Machsupport Forum
		Mach Discussion => General Mach Discussion => Topic started by: ronny on January 15, 2015, 05:49:43 PM
		
			
			- 
				i have this script that i want to use with a laser probe, i am trying to scan a kite board, usually with linux cnc, you open this script as a gcode but with mach3, it doesnt like it.
 
 the script generate a text file that i can open in a open source program call boardcad.
 
 here is the script if someone can help me:
 
 g21
 f1000
 
 (#1=0)       (x start)
 (#2=3190)      (x end)
 #3=20      (nr of segments; 20)
 #4=[[#2-#1]/#3]   (x step)
 
 #5=-268.5      (y center)
 #6=10      (nr of points; 10)
 #7=10      (y step)
 
 #8=-36     (z safe)
 #9=10      (z probe)
 
 #10=0      (current x)
 #11=0      (current y)
 #12=0      (current z)
 
 #13=0      (previous z)
 #14=0      (step size y)
 
 #15=-100   (y safe)
 #16=-100   (z probe outline)
 
 #18=1110   (x-value between support / approximately center of board)
 
 
 
 O100 sub (subroutine find apex for cross section scan)
 
 g38.2 z#9
 
 o101 while [0 lt #5070]
 g38.4 y#15 f5000
 #10=#5061
 #11=#5062
 #12=#5063
 g38.3 z[#12-50] f1000
 o101 endwhile
 
 O100 endsub
 
 
 
 (search for tail and nose)
 
 g0 z#8 a45
 g0 x#18 y#5
 
 g38.2 z#9
 
 o6 while [0 lt #5070]
 g38.4 x0 f5000
 #10=#5061
 #11=#5062
 #12=#5063
 g38.3 z[#12-50] f1000
 o6 endwhile
 
 g0 x[#10-10]
 g38.2 x#18
 
 #1=[#10+5]
 #17=#5063    (start y, used for outline)
 
 g0 z#8
 g0 x#18 y#5
 g38.2 z#9
 
 o7 while [0 lt #5070]
 g38.4 x3500 f5000
 #10=#5061
 #11=#5062
 #12=#5063
 g38.3 z[#12-50] f1000
 o7 endwhile
 
 g0 x[#10+10]
 g38.2 x#18
 
 #2=[#10-5]
 
 #4=[[#2-#1]/#3]   (x step)
 
 
 #10=#1
 g0 z#8
 g0 x#1 y#5
 
 (PROBEOPEN bottom_rocker.txt)
 
 g38.2 z#9
 
 g0 z#8
 g0 x[#10 + 20]
 g38.2 z#9
 
 o1 while [#10 lt [#2-#4/4]]
 
 #10=[#10+#4]
 g0 z#8
 g0 x#10
 
 g38.2 z#9
 
 o1 endwhile
 
 g0 z#8
 g0 x[#10 - 20]
 g38.2 z#9
 
 
 (PROBECLOSE)
 
 
 
 g0 z#8
 g0 x#1 y#15
 g0 z#17
 
 #10=#1
 
 (PROBEOPEN outline.txt)
 
 g38.2 y#5
 
 g0 y#15
 g0 x[#10 + 20]
 g38.2 y#5
 
 o2 while [#10 lt [#2-#4/4]]
 
 g38.4 z#8   (probe for apex)
 #17=#5063
 
 #10=[#10+#4]
 g0 y#15
 
 o8 if [#5061 GT #18]
 g0 x#10 z[#17-80]
 o8 else
 g0 x#10 z[#17-40]
 o8 endif
 
 g38.2 y#5   (probe for outline)
 
 o2 endwhile
 
 g0 y#15
 g0 x[#10 - 20]
 g38.2 y#5
 
 (PROBECLOSE)
 
 g0 z#8
 g0 x[#1+304.8] y#5
 
 M1       (wait if user wants to prepare board)
 
 O100 call
 
 g0 y[#5062+10]
 g38.2 y#5
 
 g0 z#8
 
 
 #10=#5061
 #11=#5062
 #12=#5063
 
 #7=[[#11-#5]/#6]   (y step)
 
 (PROBEOPEN bottomrail1.txt)
 g38.2 z#9
 
 o23 while [ #5062 gt [#11-#7]]
 g0 z#8
 g0 y[#5062 - 3]
 g38.2 z#9
 o23 endwhile
 
 o3 while [ [#5+#7/2] lt #11]
 
 #11=[#11-#7]
 g0 z#8
 g0 y#11
 
 g38.2 z#9
 
 o3 endwhile
 
 (PROBECLOSE)
 
 g0 z#8
 g0 x[[#1+#2]/2] y#5
 
 M1       (wait if user wants to prepare board)
 
 O100 call
 
 g0 y[#5062+10]
 g38.2 y#5
 
 g0 z#8
 
 
 #10=#5061
 #11=#5062
 #12=#5063
 
 #7=[[#11-#5]/#6]   (y step)
 
 (PROBEOPEN bottomrail2.txt)
 
 g38.2 z#9
 
 o24 while [ #5062 gt [#11-#7]]
 g0 z#8
 g0 y[#5062 - 3]
 g38.2 z#9
 o24 endwhile
 
 o4 while [ [#5+#7/2] lt #11]
 
 #11=[#11-#7]
 g0 z#8
 g0 y#11
 
 g38.2 z#9
 
 o4 endwhile
 
 (PROBECLOSE)
 
 
 g0 z#8
 g0 x[#2-304.8] y#5
 
 M1       (wait if user wants to prepare board)
 
 O100 call
 
 g0 y[#5062+10]
 g38.2 y#5
 
 g0 z#8
 
 
 #10=#5061
 #11=#5062
 #12=#5063
 
 #7=[[#11-#5]/#6]   (y step)
 
 (PROBEOPEN bottomrail3.txt)
 
 g38.2 z#9
 
 o25 while [ #5062 gt [#11-#7]]
 g0 z#8
 g0 y[#5062 - 3]
 g38.2 z#9
 o25 endwhile
 
 o5 while [ [#5+#7/2] lt #11]
 
 #11=[#11-#7]
 g0 z#8
 g0 y#11
 
 g38.2 z#9
 
 o5 endwhile
 
 (PROBECLOSE)
 
 g0 z#8
 
 
 (finished scanning bottom)
 #8=400      (z safe)
 g0 z#8
 
 g0 x#2 y#5   (place probe over nose)
 M0      (wait for user to turn board)
 g0 x#1 y#5   (place probe over tail)
 M0      (wait for user to place board)
 
 g0 x#2 y#5   (place probe over nose)
 M1      (optionally wait for fine tuning)
 g0 x#1 y#5   (place probe over tail)
 M1      (optionally wait for fine tuning)
 
 (scanning deck)
 
 #10=#1
 g0 z#8
 g0 x#1 y#5
 
 (PROBEOPEN deck_rocker.txt)
 
 g38.2 z#9
 
 g0 z#8
 g0 x[#10 + 20]
 g38.2 z#9
 
 o11 while [#10 lt [#2-#4/4]]
 
 #10=[#10+#4]
 g0 z#8
 g0 x#10
 
 g38.2 z#9
 
 o11 endwhile
 
 g0 z#8
 g0 x[#10 - 20]
 g38.2 z#9
 
 (PROBECLOSE)
 
 
 
 g0 z#8
 g0 x[#1+304.8] y#5
 
 M1       (wait if user wants to prepare board)
 
 O100 call
 
 g0 y[#5062+10]
 g38.2 y#5
 
 g0 z#8
 
 
 #10=#5061
 #11=#5062
 #12=#5063
 
 #7=[[#11-#5]/#6]   (y step)
 
 (PROBEOPEN deckrail1.txt)
 g38.2 z#9
 
 o33 while [ #5062 gt [#11-#7]]
 g0 z#8
 g0 y[#5062 - 3]
 g38.2 z#9
 o33 endwhile
 
 o13 while [ [#5+#7/2] lt #11]
 
 #11=[#11-#7]
 g0 z#8
 g0 y#11
 
 g38.2 z#9
 
 o13 endwhile
 
 (PROBECLOSE)
 
 g0 z#8
 g0 x[[#1+#2]/2] y#5
 M1       (wait if user wants to prepare board)
 
 O100 call
 
 g0 y[#5062+10]
 g38.2 y#5
 
 g0 z#8
 
 
 #10=#5061
 #11=#5062
 #12=#5063
 
 #7=[[#11-#5]/#6]   (y step)
 
 
 (PROBEOPEN deckrail2.txt)
 
 g38.2 z#9
 
 o34 while [ #5062 gt [#11-#7]]
 g0 z#8
 g0 y[#5062 - 3]
 g38.2 z#9
 o34 endwhile
 
 o14 while [ [#5+#7/2] lt #11]
 
 #11=[#11-#7]
 g0 z#8
 g0 y#11
 
 g38.2 z#9
 
 o14 endwhile
 
 (PROBECLOSE)
 
 
 g0 z#8
 g0 x[#2-304.8] y#5
 M1       (wait if user wants to prepare board)
 
 O100 call
 
 g0 y[#5062+10]
 g38.2 y#5
 
 g0 z#8
 
 
 #10=#5061
 #11=#5062
 #12=#5063
 
 #7=[[#11-#5]/#6]   (y step)
 
 
 (PROBEOPEN deckrail3.txt)
 
 g38.2 z#9
 
 o35 while [ #5062 gt [#11-#7]]
 g0 z#8
 g0 y[#5062 - 3]
 g38.2 z#9
 o35 endwhile
 
 o15 while [ [#5+#7/2] lt #11]
 
 #11=[#11-#7]
 g0 z#8
 g0 y#11
 
 g38.2 z#9
 
 o15 endwhile
 
 (PROBECLOSE)
 
 g0 z#8
 
 M2
 
- 
				You cannot convert it directly. EMC code and MACh3 code different dramatically in some areas. This is ONE of those areas.
 
 Mach3 cannot do conditional Gcode which is WHAT you have.
 
 Just a thought, (;-) TP
- 
				what are my option do the same thing?
 
 
- 
				You MIGHT be able to rewrite it as a Mach3 MACRO but it wont be pretty and it wont be fast.
 
 Just a thought, (;-) TP