Jeff Epler wrote:
> On Fri, Aug 17, 2007 at 11:15:29AM +0100, [EMAIL PROTECTED] wrote:
>> Just a couple of points I'm not completely clear on - in the above 
>> example, are line numbers needed on every line of the subroutine or 
>> just at the ends?
>
> O-numbers are required on lines where the flow control words such as
> "sub", "endsub", "do", "while" are used.  The interpreter uses these
> numbers to "match up" the beginning and end of a subroutine or a loop.
>
Gene Heskett wrote:

 >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

Ahh, I think your do & while need to be matching o words.

Thanks Jeff & Gene,

I modified the script as below but now I'm back to one of the original 
problems - it won't load because it says  "near line 49 ...... unknown 
word where unary operation could be" (Line 49 is my line numbered 
N0400). This is at the call to the first subroutine, o100, and the only 
way I could clear it before was to take out the o100 before the endsub - 
but then the program wouldn't run. I tried isolating the problem by the 
rather crude method of simply temporarily deleting each line of code in 
turn to see if the error would clear or at least move on to the next 
error and this was how I identified the endsub line number to be a 
problem, however, I've just tried the same again and it has no effect. - 
now I'm stuck again although there may be just a glimmer of light from 
Gene's comment - is the error that the do/while loop in the main part of 
the program should be numbered differently and have both lines preceded 
by an Oxxx number? If so would that then be another subroutine which 
would need calling from a main program consisting just of calls? Boy, 
this stuff is fussy!!

%
#40 = 1.4        ( o.d )
#41 = 0.38        (root dia)
#42 = [[#40 - #41] / 2]    (cut depth)
#43 = 5            (number of teeth)
#44 = 4            (length of cut)
#45 = [360/[#43]]    (angular increment)
#46 = 0.09        (cutter thickness)
#47 = 1            (counter)
#48 = 1            (tooth counter)
#49 = 10        (step angle for rounding)
#50 = [[#40]/2]        (radius of work)
#51 = 10        (increment for rounding steps)
#52 = 90        (final arc angle)

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

o200 sub        (rounds half top of pinion leaf in several steps)
o201 do
    G0 Z[sin[#4]/#6] X[cos[#4]/#6]
    G1 Y#5 F4
    G0 Y[0-[#5]]
    G0 A#7
    #10 = [[#4]+[#7]]
o201 while [#4 LT #8]
o200 endsub

o300 sub        (rounds other half top of pinion leaf in several steps)
o301 do
    G0 Z[0-[sin[#4]/#6] X[cos[#4]/#6]
    G1 Y#5 F4
    G0 Y[0-[#5]]
    G0 A[0-[#7]]
    #10 = [[#4]+[#7]]
o301 while [#4 LT #8]
o300 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 [#42][#44][4.0]
N0500 #47 = [#47 + 1]    (increment counter)
N0600 G0 A[360/[#43]]    (rotate work one tooth distance)
N0700 while [#47 LT 5]

N0800 #47 = 1        (set counter back to 1)
N0900 G0 A[0-[[#45]/3]]    (rotate by thickness of pinion leaf and)
N1000 G0 Z#46        (move cutter - saw - to other side of leaf)

N1100 do        (cut other side of pinion leaves)
N1200 o100 call [#42][#44][4.0]
N1300 #47 = [#47 + 1]
N1400 G0 A[0-[360/[#43]]]
N1500 while [#47 LT 5]

N1600 #47 = 1        (set counter back to 1)
N1700 G0 A[[#45]/6]    (move cutter to centre of leaf)
N1800 G0 Z[0-[[#46]/2]    (                 )

N1900 do        (round over half the leaf and repeat for all leaves)
N2000 o200 call [#40][#44][#50][#51][#52]
N2100 #47 = [#47 + 1]
N2200 G0 A[360/[#43]]
N2300 while [#47 LT 5]

N2400 #47 = 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 [#40][#44][#50][#51][#52]
N2900 #47 = [#47 + 1]
N3000 G0 A[0-[360/[#43]]]
N3100 while [#47 LT 5]

N3200 #47 = 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 
than in practice..."



-- 
Best wishes,

Ian
____________
Ian W. Wright
Sheffield  UK

"The difference between theory and practice is much smaller in theory than in 
practice..."


-------------------------------------------------------------------------
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
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to