Example

Discussions and examples of Parametric programming in UCCNC

Example

Postby MarcoGaspar » Wed Mar 19, 2025 4:47 pm

Hello,

Can someone provide a exemple with IF and Goto?

Best Regards,
Marco Gaspar
MarcoGaspar
 
Posts: 31
Joined: Sun Dec 08, 2024 9:21 pm
Location: Portugal

Re: Example

Postby cncdrive » Sat Mar 22, 2025 10:32 pm

Sure, please check the UCCNC users manual, there is description and example.
cncdrive
Site Admin
 
Posts: 5197
Joined: Tue Aug 12, 2014 11:17 pm

Re: Example

Postby MarcoGaspar » Mon Mar 24, 2025 10:12 am

Hello,


What is the error with the while?

N60 G90 G80 G00 G17 G40
N70 G64 P0.0018 Q0.0018
N80 S21000M3
N90 (M8)
N100 G4 P5.0
N110 #31 = -300.0 (X START)
N120 #32 = 20.0 (Y START)
N130 #33 = 1.00 (ZSTART)
N140 #34 = 290.0 (X END)
N150 #35 = -110.0 (Y END)
N160 #36 = 0.0 (Z END)
N170 #37 = 1 (LAT STEP)
N180 #38 = 1.0 (Z STEP)
N190 #39 = 5000 (FEED)
N200 #99 = 0
N210 G00 Z20.
N220 #41 = #31 - 10
N230 #42 = #32 + #37
N240 #44 = #34 + 10
N250 #45 = #35 - #37
N260 G0 X#41 Y#42
#33 = #33 + 2
N270 G0 Z#33
N280
N290
N300 WHILE[#42 GE #35]DO1
N310 G1 X#41 Y#42 F#39
N320 G1 Z#33 F#39
N330 G1 X#44
N340 #42 = #42 - #37
N350 G1 Y#42
N360 G1 X#41
N370 #42 = #42 - #37
N380 END1
N390
N600 M30
MarcoGaspar
 
Posts: 31
Joined: Sun Dec 08, 2024 9:21 pm
Location: Portugal

Re: Example

Postby MarcoGaspar » Mon Mar 24, 2025 10:36 am

And this is not possible? N270 G0 Z#33 + 2
MarcoGaspar
 
Posts: 31
Joined: Sun Dec 08, 2024 9:21 pm
Location: Portugal

Re: Example

Postby cncdrive » Mon Mar 24, 2025 5:03 pm

It looks like it works if you remove the N300 line numbering before the while
cncdrive
Site Admin
 
Posts: 5197
Joined: Tue Aug 12, 2014 11:17 pm

Re: Example

Postby MarcoGaspar » Mon Mar 24, 2025 5:19 pm

cncdrive wrote:It looks like it works if you remove the N300 line numbering before the while



it works, but it not shows all the paths on the Toolpathview.
And it's possible to do G0 Z#33 + 2 ?


N60 G90 G80 G00 G17 G40
N70 G64 P0.0018 Q0.0018
N80 S21000M3
N90 (M8)
N100 G4 P5.0
N110 #31 = -50.0 (X START)
N120 #32 = 20.0 (Y START)
N130 #33 = 1.00 (ZSTART)
N140 #34 = 50.0 (X END)
N150 #35 = -110.0 (Y END)
N160 #36 = 0.0 (Z END)
N170 #37 = 3 (LAT STEP)
N180 #38 = 1.0 (Z STEP)
N190 #39 = 5000 (FEED)
N200 #99 = 0
N210 G00 Z20.
N220 #41 = #31 - 10
N230 #42 = #32 + #37
N240 #44 = #34 + 10
N250 #45 = #35 - #37
N260 G0 X#41 Y#42
N270 G0 Z#33
N280
N290
WHILE[#42 GE #35]DO1
G1 X#41 Y#42 F#39
G1 Z#33 F#39
G1 X#44
#42 = #42 - #37
G1 Y#42
G1 X#41
#42 = #42 - #37
END1
N390
N600 M30
MarcoGaspar
 
Posts: 31
Joined: Sun Dec 08, 2024 9:21 pm
Location: Portugal

Re: Example

Postby cncdrive » Tue Mar 25, 2025 1:41 am

I will have to verify the toolpath, can do it in a few days only.
No, you can't do G0 Z#33 + 2
You could do:
#33 = #33 + 2
G0 Z#33
cncdrive
Site Admin
 
Posts: 5197
Joined: Tue Aug 12, 2014 11:17 pm

Re: Example

Postby MarcoGaspar » Tue Mar 25, 2025 11:28 am

cncdrive wrote:I will have to verify the toolpath, can do it in a few days only.
No, you can't do G0 Z#33 + 2
You could do:
#33 = #33 + 2
G0 Z#33



A working facemill gcode with lateral and Z steps.(test the toolpathview)

N60 G90 G80 G00 G17 G40
N70 G64 P0.0018 Q0.0018
N80 S21000M3
N90 (M8)
N100 G4 P5.0
N110 #31 = -50.0 (X START)
N120 #32 = 10.0 (Y START)
N130 #33 = 2.00 (ZSTART)
N140 #34 = 50.0 (X END)
N150 #35 = 0.0 (Y END)
N160 #36 = 0.0 (Z END)
N170 #37 = 3 (LAT STEP)
N180 #38 = 1.0 (Z STEP)
N190 #39 = 5000 (FEED)
N200 #99 = 0
N210 G00 Z20.
N220 #41 = #31 - 10
N230 #42 = #32 + #37
N240 #44 = #34 + 10
N250 #45 = #35 - #37
N260 G0 X#41 Y#42
N270 G0 Z#33
WHILE[#42 GE #35]DO1
G1 X#41 Y#42 F#39
G1 Z#33 F#39
G1 X#44
#42 = #42 - #37
G1 Y#42
G1 X#41
#42 = #42 - #37
END1
WHILE[#33 GT #36]DO2
#33 = #33 - #38
IF [#33 LT #36] THEN #33 = #36
GOTO 210
END2
N580 G0 Z20.
N390
N600 M30
MarcoGaspar
 
Posts: 31
Joined: Sun Dec 08, 2024 9:21 pm
Location: Portugal


Return to Parametric Programming

Who is online

Users browsing this forum: No registered users and 1 guest