When calling an o-word subroutine, does the subroutine have to be in the
current file?

I was under the impression that it would locate the subroutine in the
nc_files path?

For example, my Gcode file...

o<turn> CALL [13.050000] [12.000000] [1.000000] 
M2


would automatically look in nc_files for "turn.ngc".  

I think this has been successfully working for a week or so, but now I'm
having a problem where I am getting the error "Near line 67 of t.ngc: Named
parameter not defined".  t.ngc is the file above.  A snippet of turn.ngc
around line 67 is... (I've added the line numbers)



64:    #<xPos> = [ #<endX> + #<finishDepth> * [#<xFinishCount>-1] ]
65:    o30 repeat [ #<xFinishCount> ]
66:
67:        o<turn_do_pass> call [#<xPos>] [#<startZ>] [#<endZ>] [#<mpm>]
[#<max_rpm>] [#<finishFeed>] [#<clearance>] [#<zClearance>]
68:        #<xPos> = [#<xPos> - #<finishDepth>]
69:    o30 endrepeat
70:
71:    G0 X[#<startX>+#<clearance>]


I inserted blank lines until the error line number moved.  The actual error
line is line #65.  Which is weird, because the only named parameter on that
line is successfully used on the line before, line #64 (and it is defined
and assigned earlier in the script).

The error goes away if I join the two files together.  

The complete files are....

t.ngc

o<turn> CALL [13.050000] [12.000000] [1.000000] [-10.000000] [0.090000]
[0.250000] [1.000000] [0.100000] [0.100000] [100.100000] [1164.000000]
[2.000000]
M2

turn.ngc

O<turn> sub (outside diameter turning)
    #<startX> = #1
    #<endX> = #2
    #<startZ> = #3
    #<endZ> = #4
    #<roughFeed> = #5
    #<roughDepth> = #6
    #<finishPasses> = #7
    #<finishFeed> = #8
    #<finishDepth> = #9
    #<sfm> = #10
    #<max_rpm> = #11
    #<clearance> = #12

    #<finishPasses> = 1
    (verify parameters)
    o5 if [ #<endX> GT #<startX> ]
        ! endX coordinate must be less than or equal to startX
    O5 endif

    (CSS mode)
    #<mpm> = [#<sfm> * 12 * 25.4/1000]
    G96 D#<max_rpm> S#<mpm>

    (Todo - how do we determine plunge speeds from SFM)
    F50

    (save start position)
    G30.1

    (Make sure spindle is on)
    M3

    (compute the first cut point backwards, allowing for a full finishing
cuts)
    o10 if [#<finishDepth> EQ 0 OR #<finishPasses> EQ 0]
        #<xRoughFinish> = #<endX>
        #<xFinishCount> = 0
    o10 else
        #<xRoughFinish> = [#<endX> + #<finishPasses> * #<finishDepth>]
        #<xFinishCount> = #<finishPasses>
    o10 endif

    o11 if [#<startZ> GE #<endZ>]
        #<zClearance> = #<clearance>
    o11 else
        #<zClearance> = [-1 * #<clearance>]
    o11 endif

    #<xRoughCount> = fup[[#<startX> - #<xRoughFinish>] / #<roughDepth>]
    o12 if [#<xRoughCount> LT 0 ]
        #<xRoughCount> = 0
    o12 endif
    #<xFirst> = [[#<xRoughCount>-1] * #<roughDepth> + #<xRoughFinish>]

    (do the loop)
    G0 X[#<startX>+#<clearance>]
    G0 Z#<startZ>
    #<xPos> = #<xFirst>
    o20 repeat [ #<xRoughCount> ]
        o<turn_do_pass> call [#<xPos>] [#<startZ>] [#<endZ>] [#<mpm>]
[#<max_rpm>] [#<roughFeed>] [#<clearance>] [#<zClearance>]
        #<xPos> = [#<xPos> - #<roughDepth>]
    o20 endrepeat

    #<xPos> = [ #<endX> + #<finishDepth> * [#<xFinishCount>-1] ]
    o30 repeat [ #<xFinishCount> ]

        o<turn_do_pass> call [#<xPos>] [#<startZ>] [#<endZ>] [#<mpm>]
[#<max_rpm>] [#<finishFeed>] [#<clearance>] [#<zClearance>]
        #<xPos> = [#<xPos> - #<finishDepth>]
    o30 endrepeat

    G0 X[#<startX>+#<clearance>]

    (return to start position)
    G30
O<turn> endsub


o<turn_do_pass> sub
    #<xPos> = #1
    #<startZ> = #2
    #<endZ> = #3
    #<mpm> = #4
    #<max_rpm> = #5
    #<FeedRate> = #6
    #<xClearance> = #7
    #<zClearance> = #8

    #<css_rpm> = [ [#<mpm> * 1000 ] / [#<xPos> * 3.14159 ] ]
    o21 if [ #<css_rpm> LT 0 ]
        #<css_rpm> = [ -1 * #<css_rpm> ]
    o21 endif
    o22 if [ #<css_rpm> GT #<max_rpm> ]
        #<css_rpm> = #<max_rpm> ]
    o22 endif

    #<feed> = [ #<FeedRate> * #<css_rpm> ]

    G0 Z#<startZ>
    G1 X#<xPos> F[#<feed>]
    G1 Z#<endZ> F[#<feed>]

    ( Dwell to cut a complete revolution)
    G4 P[1/[#<css_rpm>/60]]

    (Retract)
    G0 Z[#<endZ>+#<zClearance>] X[#<xPos>+#<xClearance>]

o<turn_do_pass> endsub


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to