Strange subroutine error

More
04 Sep 2021 12:05 #219594 by viesturs.lacis
Hello!

I am trying to write some subroutines for ngcgui. The thing is that when I try to create a feature in ngcgui, I get an error that makes absolutely no sense to me. I get that error message only if I check "expand subroutines".
I would appreciate any hints, what exactly am I missing or doing incorrectly. The thing is that I get very similar error for subroutines that I downloaded from this forum.

Here is the subroutine
[code]o<drill1> sub

(info: Drilling bottom edge with horizontal spindle)

#<X_Coord> = #1 (X Coordinate)
#<Y_Coord> = #2 (Y Coordinate)
#<Z_Coord> = #3 (Z Coordinate)
#<Safe_Z> = #4 (=0 Safe Z height)
#<Y_StepBack> = #5 (= 5 Step back from edge along Y)
#<Bore_depth> = #6 (=20 Depth)
#<FeedRate> = #7 (=300 Feedrate mm/min)
#<ToolNumber> = #8 (=1 Tool Number)
#<Peck> = #9 (=6 Peck Increment)
#<X_Park> = #10 (=0 X Park)
#<Y_Park> = #11 (=0 Y Park)

;set global parameters
;#<_remain_depth> = #<Bore_depth>
;#<_temp_depth> = 0

T#<ToolNumber> M6
G43 T#<ToolNumber>

#<remain_depth> = #<Bore_depth>
#<temp_depth> = 0

S100 M3 F#<FeedRate>

G0 Z#<Safe_Z>
G0 X#<X_Coord> Y[#<Y_Coord> - #<Y_StepBack>]
G0 Z#<Z_Coord>

o<y100> while [#<remain_depth>]
    o<y1100> if [#<remain_depth> GT #<Peck>]
      #<temp_depth> = [#<temp_depth> + #<Peck>]
      G1 Y[#<Y_Coord> + #<temp_depth>]
      G1 Y#<Y_Coord>
      #<remain_depth> = [#<remain_depth> - #<Peck>]
     o<y1100> else
        #<remain_depth> = 0
        G1 Y[#<Y_Coord> + #<Bore_depth>]
        G1 Y[#<Y_Coord> - #<Y_StepBack>]
    o<y1100> endif
o<y100> endwhile

G0 Z#<Safe_Z>

o<drill1> endsub
[/code]
[code]Here is the error message:
[/code]
[code][code][code][code]Near line 57 of
/home/cnc/linuxcnc/nc_files/0.auto.ngc:
57:duplicate O-word label: 'o<001y1100>
while [#<remain_depth>]' - defined in line 52
[/code][/code][/code]
[/code]
[code][code][code][code]Here is the 0.auto.ngc file that was generated by ngcgui:
[/code][/code][/code][/code]
[code][code][code][code][code][code][code][code](pyngcgui: FEATURE 210904:14.53.47)
(pyngcgui: files: </home/cnc/linuxcnc/nc_files/ngcgui_lib/utilitysubs/mm_std.ngc,/home/cnc/linuxcnc/nc_files/drill1.ngc,>;)
(pyngcgui: feature line added) #<_feature:> = 0
(pyngcgui: remaining_features line added)  #<_remaining_features:> = 0
(pyngcgui: preamble file: /home/cnc/linuxcnc/nc_files/ngcgui_lib/utilitysubs/mm_std.ngc)
g17 (xy plane)
g21 (mm)
g40 (cancel cutter radius compensation)
g49 (cancel tool lengthoffset)
g90 (absolute distance mode)
g94 (units/min feedrate)
g54 (Coordinate system 1 default)
#<tol>  = 0.001
g64 p#<tol> (path control stop)
(Positional parameters for /home/cnc/linuxcnc/nc_files/drill1.ngc)
        #1 = 50
        #2 = 15
        #3 = 9
        #4 = 0
        #5 = 5
        #6 = 20
        #7 = 300
        #8 = 1
        #9 = 6
        #10 = 0
        #11 = 0
(expanded file: /home/cnc/linuxcnc/nc_files/drill1.ngc)
            (info: Drilling bottom edge with horizontal spindle)
            #<X_Coord> = #1 (X Coordinate)
            #<Y_Coord> = #2 (Y Coordinate)
            #<Z_Coord> = #3 (Z Coordinate)
            #<Safe_Z> = #4 (=0 Safe Z height)
            #<Y_StepBack> = #5 (= 5 Step back from edge along Y)
            #<Bore_depth> = #6 (=20 Depth)
            #<FeedRate> = #7 (=300 Feedrate mm/min)
            #<ToolNumber> = #8 (=1 Tool Number)
            #<Peck> = #9 (=6 Peck Increment)
            #<X_Park> = #10 (=0 X Park)
            #<Y_Park> = #11 (=0 Y Park)
            ;set global parameters
            ;#<_remain_depth> = #<Bore_depth>
            ;#<_temp_depth> = 0
            T#<ToolNumber> M6
            G43 T#<ToolNumber>
            #<remain_depth> = #<Bore_depth>
            #<temp_depth> = 0
            S100 M3 F#<FeedRate>
            G0 Z#<Safe_Z>
            G0 X#<X_Coord> Y[#<Y_Coord> - #<Y_StepBack>]
            G0 Z#<Z_Coord>
 o<001y100>  while [#<remain_depth>]
o<001y1100>  while [#<remain_depth>]
                  #<temp_depth> = [#<temp_depth> + #<Peck>]
                  G1 Y[#<Y_Coord> + #<temp_depth>]
                  G1 Y#<Y_Coord>
                  #<remain_depth> = [#<remain_depth> - #<Peck>]
o<001y1100>  while [#<remain_depth>]
                    #<remain_depth> = 0
                    G1 Y[#<Y_Coord> + #<Bore_depth>]
                    G1 Y[#<Y_Coord> - #<Y_StepBack>]
o<001y1100>  while [#<remain_depth>]
 o<001y100>  endwhile
            G0 Z#<Safe_Z>
(pyngcgui: m2 line added) m2 (g54 activated)
[/code][/code][/code][/code][/code][/code][/code]
[/code]

Please Log in or Create an account to join the conversation.

More
04 Sep 2021 12:08 #219596 by viesturs.lacis
Sorry about those duplications of code tags, no idea, where they came from, I did put them correctly. Firefox version too old in the LinuxCNC iso image?

Please Log in or Create an account to join the conversation.

More
04 Sep 2021 13:17 #219601 by tommylight
Replied by tommylight on topic Strange subroutine error
I would blame the forum editor, it is a bit iffy lately ! :)

Please Log in or Create an account to join the conversation.

More
04 Sep 2021 13:50 - 04 Sep 2021 13:50 #219604 by viesturs.lacis
any idea about the subroutine error?
Last edit: 04 Sep 2021 13:50 by viesturs.lacis.

Please Log in or Create an account to join the conversation.

More
04 Sep 2021 15:06 #219608 by viesturs.lacis
BTW this subroutine also triggers the same error about duplicate O-word label:
forum.linuxcnc.org/subroutine-library/27...gle3-for-mill-router

I have 2.8.2 version installed

Please Log in or Create an account to join the conversation.

More
04 Sep 2021 15:59 #219614 by viesturs.lacis
Forgot to mention, that I did find this thread:
forum.linuxcnc.org/20-g-code/27728-dupli...-version-2-6?start=0

But I get the error also when I call the subroutine more than once without editing. Restarting LinuxCNC between attempts also was tried without success.

Please Log in or Create an account to join the conversation.

More
05 Sep 2021 14:39 - 05 Sep 2021 14:55 #219672 by dgarrett
Replied by dgarrett on topic Strange subroutine error
I could not reproduce the errror, perhaps
you have inadvertently edited the source file:
/home/cnc/linuxcnc/nc_files/drill1.ngc
and corrupted the original o<y1100> line
Last edit: 05 Sep 2021 14:55 by dgarrett.

Please Log in or Create an account to join the conversation.

More
05 Sep 2021 15:23 #219676 by viesturs.lacis
so are you saying that my subroutine works for you?

yes, bad editing of original file that I copied those lines from is completely possible situation as this is my first attempt at writing my own subroutines.

Please Log in or Create an account to join the conversation.

More
05 Sep 2021 15:28 #219677 by viesturs.lacis
Just in case the subroutine is lost in that mess of the original post, here is a link:
pastebin.com/VMGbyhKP

Please Log in or Create an account to join the conversation.

More
05 Sep 2021 17:16 #219683 by dgarrett
Replied by dgarrett on topic Strange subroutine error
now i reproduced, pyngcgui bug fix committed to 2.8 branch (for next release),

(for now use without expanding)

Ref: github.com/LinuxCNC/linuxcnc/commit/2c24928af

Please Log in or Create an account to join the conversation.

Time to create page: 0.090 seconds
Powered by Kunena Forum