Help with NGCGUI routine
23 Mar 2014 21:55 #45146
by mariusl
Regards
Marius
www.bluearccnc.com
Help with NGCGUI routine was created by mariusl
Hi
This is my first time using NGCGUI and its subroutine methods. I created the attached subroutine (still in the making) to test with and I get LCNC to hang when I load this file. It is actually the captured result from the ngcgui output..
The first section where I cut the ID of the part works but it stopped working when I added the second part cutting the OD.
Any suggestions on my error?
This is my first time using NGCGUI and its subroutine methods. I created the attached subroutine (still in the making) to test with and I get LCNC to hang when I load this file. It is actually the captured result from the ngcgui output..
The first section where I cut the ID of the part works but it stopped working when I added the second part cutting the OD.
Any suggestions on my error?
(pyngcgui: FEATURE 140323:16.44.42)
(pyngcgui: files: </home/marius/dev/bluearc/nc_files/ngcgui_lib/lathe/lathe_mm.ngc,/home/marius/dev/bluearc/nc_files/ngcgui_lib/lathe/seal_a.ngc,>)
(pyngcgui: feature line added) #<_feature:> = 0
(pyngcgui: preamble file: /home/marius/dev/bluearc/nc_files/ngcgui_lib/lathe/lathe_mm.ngc)
g18 (xz 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/marius/dev/bluearc/nc_files/ngcgui_lib/lathe/seal_a.ngc)
#1 = 50
#2 = 50
#3 = 20
#4 = 22
#5 = 1
#6 = 1
#7 = 1
#8 = 1
#9 = 10
#10 = 1
#11 = 1
#12 = 80
#13 = 20
#14 = 1500
#15 = 2
#16 = 2
(expanded file: /home/marius/dev/bluearc/nc_files/ngcgui_lib/lathe/seal_a.ngc)
; Author: Marius Liebenberg
(info: Complete seal turning - lathe)
#<Stock_Dia> = #1 (=50 Stock Size)
#<OD> = #2 (=50 OD-Outside Diameter)
#<Hole_Dia> = #3 (=20 Hole size)
#<ID> = #4 (=22 ID-Inside Diameter)
#<S0> = #5 (=1 S0-Width Outside Slot)
#<S1> = #6 (=1 S1-Width Inside Slot)
#<D0> = #7 (=1 D0-Depth Outside Slot)
#<D1> = #8 (=1 D1-Depth Inside Slot)
#<W> = #9 (=10 W-Width of Seal)
#<C> = #10 (=1 C-Width of chamfer)
#<Depth_Cut>= #11 (=1 Cut Size)
#<SurfaceSpeed> = #12 (=80 Surface Speed)
#<FeedRate> = #13 (=20 Feed mmPM)
#<MaxSpindle_RPM> = #14 (=1500 MAX RPM)
#<T1W> = #15 (=2 Tool 1 width)
#<T2W> = #16 (=2 Tool 2 Width)
;#<left:> = #<_hal[twincontrol.select-lh]>
;#<right> = #<_hal[twincontrol.select-rh]>
(Probe here first)
;o<if00> if [[#<left> eq 1] and [#<right> eq 1]]
; o<probe_both> call
; else if [#<left> eq 1]
; o<probe_left> call
; else if [#<right> eq 1]
; o<probe_right> call
;o<if00> endif
#<Z_StartOfCut> = 0.5
;T#<ToolNumber> M6
; G43: toollength offset
; G7: diameter mode
; G96: constant surface speed
;G43 G7 G96 D#<MaxSpindle_RPM> S#<SurfaceSpeed>
; Turn the ID
M3 ;M#<Coolant> ; spindle cw, coolant on/off:w
; Turn the ID
G0 X#<Hole_Dia> Z#<Z_StartOfCut>
#<Current-Diameter> = #<Hole_Dia>
#<Final_Dia> = #<ID>
;;;;;; I am trying to invert the W variable to be negative here ???
#<Z_EndOfCut> = [[#<W> * [-1]] - 1]
o100 while [#<Hole_Dia> lt #<ID>]
O101 if [#<Current-Diameter> + #<Depth_Cut> lt #<ID>]
#<Current-Diameter> = [#<Current-Diameter> + #<Depth_Cut>]
O101 else
#<Current-Diameter> = #<ID>
O101 endif
X#<Current-Diameter>
G1 Z#<Z_EndOfCut> F#<FeedRate>
G0 X[#<Current-Diameter>-1]
Z#<Z_StartOfCut>
o100 endwhile
o102 while [#<Spring_Cuts> gt 0]
G1 X#<ID>
Z#<Z_EndOfCut>
X[#<ID>-1]
G0 Z#<Z_StartOfCut>
#<Spring_Cuts> = [#<Spring_Cuts> -1]
o102 endwhile
G0 X[#<Current-Diameter> + 1]
;Now cut the OD
G0 X#<Stock_Size> Z#<Z_StartOfCut>
#<Current-Diameter> = #<Stock_Size>
o200 while [#<Current-Diameter> gt #<OD>]
O201 if [#<Current-Diameter> - #<Depth_Cut> gt #<OD>]
#<Current-Diameter> = [#<Current-Diameter> - #<Depth_Cut>]
O201 else
#<Current-Diameter> = #<OD>
O201 endif
X#<Current-Diameter>
G1 Z#<Z_EndOfCut> F#<FeedRate>
G0 X[#<Current-Diameter>+1]
Z#<Z_StartOfCut>
o200 endwhile
o202 while [#<Spring_Cuts> gt 0]
G1 X#<OD>
Z#<Z_EndOfCut>
X[#<OD>+1]
G0 Z#<Z_StartOfCut>
#<Spring_Cuts> = [#<Spring_Cuts> -1]
o202 endwhile
G0 X[#<Current-Diameter>+1]
M5 M9 ; stop spindle, all coolant off
Z#<Z_StartOfCut>
G49 ; cancel tool length offset
G53 G0 X0 Z0 ; move in machine coordinates
;pyngcgui ignoring: m2
(pyngcgui: m2 line added) m2 (g54 activated)
Regards
Marius
www.bluearccnc.com
Please Log in or Create an account to join the conversation.
23 Mar 2014 22:43 #45148
by ArcEye
Replied by ArcEye on topic Help with NGCGUI routine
Hi Marius
If you mean the hour glass cursor comes up and just stays there, it is not hanging.
The interpreter for the plotting is running the code, but there is an endless loop or similar in the code, so it never completes.
The only thing that leaps out at the moment is that #<Spring_Cuts> was never declared and initialised, so could contain anything
Also as #<Spring_Cuts> is taken down to 0 in o102, o202 will never do anything because #<Spring_Cuts> will now already be 0
regards
I get LCNC to hang when I load this file
If you mean the hour glass cursor comes up and just stays there, it is not hanging.
The interpreter for the plotting is running the code, but there is an endless loop or similar in the code, so it never completes.
The only thing that leaps out at the moment is that #<Spring_Cuts> was never declared and initialised, so could contain anything
Also as #<Spring_Cuts> is taken down to 0 in o102, o202 will never do anything because #<Spring_Cuts> will now already be 0
regards
Please Log in or Create an account to join the conversation.
23 Mar 2014 22:55 #45149
by mariusl
Regards
Marius
www.bluearccnc.com
Replied by mariusl on topic Help with NGCGUI routine
Hi Arceye
The hourglass comes up and I have to forcefully quit. The screen goes blackish.
The Spring_Cuts can be zero so that the loop is not executed if not needed. I will try to initialize it.
The hourglass comes up and I have to forcefully quit. The screen goes blackish.
The Spring_Cuts can be zero so that the loop is not executed if not needed. I will try to initialize it.
Regards
Marius
www.bluearccnc.com
Please Log in or Create an account to join the conversation.
23 Mar 2014 23:45 - 23 Mar 2014 23:46 #45152
by ArcEye
Replied by ArcEye on topic Help with NGCGUI routine
OK, found it
Your first loop should be
But you used #<Hole_Dia> instead of #<Current_Diameter>, and that never changes so loops forever
You will find errors with #<Stock_Size> being used instead of #<Stock_Dia> later in the code too
regards
Your first loop should be
o100 while [#<Current_Diameter> lt #<ID>]
o101 if [#<Current_Diameter> + #<Depth_Cut> lt #<ID>]
#<Current_Diameter> = [#<Current_Diameter> + #<Depth_Cut>]
o101 else
#<Current_Diameter> = #<ID>
o101 endif
X#<Current_Diameter>
G1 Z#<Z_EndOfCut> F#<FeedRate>
G0 X[#<Current_Diameter>-1]
Z#<Z_StartOfCut>
o100 endwhile
But you used #<Hole_Dia> instead of #<Current_Diameter>, and that never changes so loops forever
You will find errors with #<Stock_Size> being used instead of #<Stock_Dia> later in the code too
regards
Last edit: 23 Mar 2014 23:46 by ArcEye.
The following user(s) said Thank You: mariusl
Please Log in or Create an account to join the conversation.
24 Mar 2014 01:54 #45161
by mariusl
Regards
Marius
www.bluearccnc.com
Replied by mariusl on topic Help with NGCGUI routine
Man I stared at that piece of silly code for hours and could not see it. Thanks a lot.
Regards
Marius
www.bluearccnc.com
Please Log in or Create an account to join the conversation.
Time to create page: 0.088 seconds