Calling next subroutine messes up offsets

More
19 May 2025 18:34 #328751 by Routerworks
Calling next subroutine messes up offsets was created by Routerworks
I have attached my progam with subroutines and cut out much of the program inbetween.  I begin by "homing, clearing all offsets (G10 L2 P1,2,3,4,5,6), G92.1.
Then I load my program which contains 3 subroutines.  My tool position at start is program 0,0,N) N being the top of work what ever the program subroutine calls for.
Hit run and it works beautifully.
Next Engrave operation calls for a tool change and change of Z offset.
This is where it all gets lost.  I change the tool and position it, set g54 Z offset and it takes off for the last G57 position.
Don't honestly know what I am missing.
Also would like to be able to call one of the subroutines out of order and be able to run it.

Thanks for any help in advance
I am determined to get a handle of these subroutines.  I know I'm missing something here. 

File Attachment:

File Name: Subroutine...file.txt
File Size:4 KB
Attachments:

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

More
19 May 2025 19:08 #328752 by Aciera
Replied by Aciera on topic Calling next subroutine messes up offsets
Aren't you missing a 'CALL' in line N15082:
 
Attachments:

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

More
19 May 2025 20:11 #328753 by Routerworks
Replied by Routerworks on topic Calling next subroutine messes up offsets
Yes. Good catch.
I would still appreciate knowing how to call anyone of these routines without going through the entire program. Also how to set the Z after the tool change.

Thank you

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

More
20 May 2025 06:01 #328783 by Aciera
Replied by Aciera on topic Calling next subroutine messes up offsets

I would still appreciate knowing how to call anyone of these routines without going through the entire program.


You can call any subroutine in a loaded program from MDI (eg 'o100 call')

Also how to set the Z after the tool change.

Do you mean the tool-length offset or the work-offset?

The currently active work offset can be changed like this:
'G10 L20 P0 z123'

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

More
20 May 2025 13:22 #328810 by Routerworks
Replied by Routerworks on topic Calling next subroutine messes up offsets
Thank you for your responses.
I see now how to call another subrutine. If I'm in a running subroutine and stop it, do I have to end it (END SUB) before I call the new subrutine?

I meant "work offset".

If I am undestanding this L20 P0 would change the axis for all subroutines relative to the machine coordinates and not change the WCS offsets for each location i.e. G54...5,6,7. Is this the same as using the Axis Screen offset for P0?

Essintially the program ran the first opertion to all 4 locaions then lifted up and stopped. I want to be able to move it back to the first location and change the tool and set the Z work offset for the nest operation.

Many thanks

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

More
20 May 2025 18:39 #328821 by Aciera
Replied by Aciera on topic Calling next subroutine messes up offsets
If you stop a subroutine (ie use the stop execution buttion) you are free to call another subroutine.

P0 just selects whatever WCS is currently active. If you want to change a specific offset system you would use P1 ... P9.

Yes axis gui's P0 issues G10 L20 P0 ...

If you need to change the Z offset for all operations regardless of WCS you would probably want to change the tool-offset instead.

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

More
20 May 2025 20:00 #328830 by Routerworks
Replied by Routerworks on topic Calling next subroutine messes up offsets
"Then comes the dawn"!
Now I understand the difference between Axis' P0 and the others. Big help.

I just want to change the Z offset for the axis I am in. It seems that if I make a G54 offset change it affects the entire program. Moves the entire image.

The difficulty I am having is moving from the end of the 4th position of the first subroutine back to the start (first) position of the second subroutine (o103) and repositioning the Z axis.

Freecad may have added some unnecessary moves and offsets.
For example I don't understand G0 X0 Y0 F70.
Also don't understand why it adds G92 offsets at the beginning of the next set of subroutine axis.

Getting there. Greatly appreciate your help.

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

More
20 May 2025 22:11 #328834 by Routerworks
Replied by Routerworks on topic Calling next subroutine messes up offsets
Also here is what Freecad puts before each axis call:

N15060 G0 X0 Y0 F70
N15061 M06 (Set too top of surface Z0.75)
N15062 G92 Z0.75 (Pocket surface top)

Don't understand the first line. F70 should only apply to G1?
Why the G92. This changes the origin position rather than just the offset from the present origin???

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

More
21 May 2025 06:23 #328846 by Aciera
Replied by Aciera on topic Calling next subroutine messes up offsets
The 'F' word in the 'G0' line does indeed only apply to G1, G2, G3 moves. The F value is retained though and some of the first G1 moves in the subroutines are actually missing the F word which seems a bit odd but it works I guess.:
eg line N3620
N3570  (Engrave) 
N3571  O103 SUB
N3580  G0 X0 Y0 Z1.0 
N3590  G0 Z0.0
N3591  M01
N3600  G0 X-0.7617 Y-1.2343 
N3610  G0 Z0.8681 
N3620  G1 X-0.7617 Y-1.2343 Z-0.0500 
N3630  G1 X-0.7983 Y-1.2510 Z-0.0500 F70.0000 


G92 affects all coordinate systems, this can be handy but it can also be a bit confusing.
linuxcnc.org/docs/html/gcode/g-code.html#gcode:g92


The difficulty I am having is moving from the end of the 4th position of the first subroutine back to the start (first) position of the second subroutine (o103) and repositioning the Z axis.


The first round (o100) is done with 'G92 Z0.75' while the second (o103) is done with 'G92 Z0.0'. It seems that there is no tool-length offset used (ie no G43). I don't know what your tool change work flow is but this would require that the tools used have exactly the same length OR the G92 offset is used to compensate for different tool-length, which would be a somewhat odd way of doing things.

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

Time to create page: 0.095 seconds
Powered by Kunena Forum