I do not have time to reformat or rewrite now but here are a few things 
that stand out.
The sub definitions should come first you are setting the top level local 
variables first these should be at the begining of the main program.
Way too many [] EMC needs more then most controls I have used but not that 
many.
I would drop the N line numbers they are just distracting and without a 
GOTO comand have no use. IMO ;)

You do a call to the subs like

   N0400 o100 call [#12][#14]

But when I look in the sub definition you are not useing the values you 
passed in from #12 and #14.
Inside the sub these values will be in local (to the sub) variables #1 and #2.
A fast rewrite of sub 100, I think you intended something like this.

   o100 sub        (cuts one slot in blank)
   G1 X[#1/2] F4
   G1 Y#2
   G0 Y[0-#2]
   G1 X#1
   G1 Y#2
   G0 Y[0-#2]
   endsub

For me I would also pass in the feed rate like this.

   o100 sub        (cuts one slot in blank)
   G1 X[#1/2] F#3
   G1 Y#2
   G0 Y[0-#2]
   G1 X#1
   G1 Y#2
   G0 Y[0-#2]
   endsub

And a calling line would then be.

   o100 call [#12][#14][4.0]

That way you can use the same sub with diffenent feed rates, maybe not 
needed in this program but in larger programs that kind of thing makes it 
faster to change the things like feed rates while standing at the machine.
If you use a global variable for things like feeds and spindle speeds you 
can then change the value in the variable while the program is running and 
the new feed or spindle speed will take effect with the next block that has 
a F or S, not sure if that works in EMC but it does in the machines I am 
used to.

Got to go.





At 05:24 PM 8/16/2007, you wrote:
>Hi again,
>
>Thanks to everyone who responded to my earlier mailing. As a result and
>after a considerable rewrite and correction I have now managed to get
>the script to load - however, it does nothing!! When I hit 'R' or press
>the play button, the screen flashes briefly and returns to the stop
>state - the machine doesn't even twitch...
>Do I have a problem in trying to run nested 'do - while' loops, its the
>only thing I can think of that might do nothing. there are no error
>messages displayed.
>Here is the rewritten script - any advice would be very welcome.
>Thanks.. Ian
>
>%
>#10 = 1.4        ( o.d )
>#11 = 0.38        (root dia)
>#12 = [[#10 - #11] / 2]    (cut depth)
>#13 = 5            (number of teeth)
>#14 = 4            (length of cut)
>#15 = [360/[#13]]    (angular increment)
>#16 = 0.09        (cutter thickness)
>#17 = 1            (counter)
>#18 = 1            (tooth counter)
>#19 = 10        (step angle for rounding)
>#20 = [[#10]/2]        (radius of work)
>#21 = 10        (increment for rounding steps)
>#22 = 90        (final arc angle)
>
>o100 sub        (cuts one slot in blank)
>G1 X[[#12]/2] F4
>G1 Y[#14] F4
>G0 Y[0-[#14]]
>G1 X[#12] F4
>G1 Y[#14] F4
>G0 Y[0-[14]]
>endsub
>
>o200 sub        (rounds half top of pinion leaf in several steps)
>do
>G0 Z[[sin[#10]/[#20]] X[[cos[#10]/[#20]]
>G1 Y[#14] F4
>G0 Y[0-[#14]]
>G0 A[#21]
>#10 = [[#10]+[#21]]
>while [#10] LT [#22]
>endsub
>
>o300 sub        (rounds other half top of pinion leaf in several steps)
>do
>G0 Z[0-[[sin[#10]/[#20]] X[[cos[#10]/[#20]]]
>G1 Y[#14] F4
>G0 Y[0-[#14]]
>G0 A[0-[#21]]
>#10 = [[#10]+[#21]]
>while [#10] LT [#22]
>endsub
>
>N0100 G92 X0 Y0 Z0    (set axes to zero)
>N0200 G21 G91        (metric units, incremental moves)
>
>N0300 do        (first cut of pinion leaves)
>N0400 o100 call [#12][#14]
>N0500 [#17] = [#17] + 1    (increment counter)
>N0600 G0 A[360/[#13]]    (rotate work one tooth distance)
>N0700 while [#17] LT 5
>
>N0800 [#17] = 1        (set counter back to 1)
>N0900 G0 A[0-[[#15]/3]]    (rotate by thickness of pinion leaf and)
>N1000 G0 Z[#16]        (move cutter - saw - to other side of leaf)
>N1100 do        (cut other side of pinion leaves)
>N1200 o100 call [#12][#14]
>N1300 [#17] = [#17] + 1
>N1400 G0 A[0-[360/[#13]]]
>N1500 while [#17] LT 5
>N1600 [#17] = 1        (set counter back to 1)
>N1700 G0 A[[#15]/6]    (move cutter to centre of leaf)
>N1800 G0 Z[0-[[#16]/2]    (                 )
>N1900 do        (round over half the leaf and repeat for all leaves)
>N2000 o200 call [#10][#14][#20][#21][#22]
>N2100 #17 = [#17] + 1
>N2200 G0 A[360/[#13]]
>N2300 while #17 LT 5
>
>N2400 #17 = 1        (set counter back to 1)
>N2500 G0 Z0 A-90        (set cutter and pinion leaf back to centre)
>N2600 G0 Z[[#16]/2]
>N2700 do        (round over other half the leaf and repeat for all
>
>leaves)
>N2800 o300 call [#10][#14][#20][#21][#22]
>N2900 #17 = [#17] + 1
>N3000 G0 A[0-[360/[#13]]]
>N3100 while #17 LT 5
>
>N3200 #17 = 1        (clean up)
>N3300 G0 X-20 Z40 Y50    (retract tool)
>N3200 G30
>%
>
>--
>Best wishes,
>
>Ian
>____________
>Ian W. Wright
>Sheffield  UK
>
>"The difference between theory and practice is much smaller in theory

__________
Andre' B.  Clear Lake, Wi.



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to