subroutines and post processor

More
11 Jan 2023 11:59 #261553 by sibelius
Good evening everyone

I am facing a new problem; actually not really new just posponed to many times.
I am using Artcam to generate my gcode and I usually generate one single file for all my toolpath and I change manually my tools when the line with M6 is hit.
Now the problem arise when for some reason I need to hit the button stop and run my gcode from a certain line.
At this point if I am lucky everything is ok but if is not I start to have problems.

Now I don't' like the idea to split every single toolpath in a single file so what I am thinking to do is to wrap each toolpath in a subroutine (and keep all in one single file) in the following way:

o1112 sub
T3 M6

code in the middle

o1112 endsub
o1112 call
M2

To do so I decided to modify my post processor but here I am facing a new problem:
inside the post processor file I add lines in the following format (among other code's lines)

START = "o01[N] sub"
 
TOOLCHANGE = "o01[N] endsub"
TOOLCHANGE = "o01[N] call"
TOOLCHANGE = "M2"
TOOLCHANGE = "o01[N] sub"

END = "o01[N] endsub"

So what happened is that in this way I have the subroutine where I want them but What I need is consistency of the name of these subroutine.
(The parameter [N] is wrong) 

what I expect is something like that:

HEAD line code

o1112 sub
T3 M6

code in the middle

o1112 endsub
o1112 call
M2

o1113 sub
T5 M6

code in the middle

o1113 endsub
o1113 call
M2

o1114 sub
T7 M6

code in the middle

o1114 endsub
o1114 call
M2

END line code

i m not sure if I make myself clear enough
Thanks in advance for any help
V. 
 

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

More
12 Jan 2023 12:53 #261689 by andypugh

i m not sure if I make myself clear enough

 

Sorry, no, not really. I don't know what question you are asking. 

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

More
13 Jan 2023 05:39 #261772 by sibelius
Hi, thanks for the answer

What I'm traying to do is to adapt one of my postprocessor in a way that the output gcode file has every toolpath included in a subroutine.
If I output every toolpath in a single file I have no problem but if I want to keep all my toolpath in a single file this one should look something like:

HEAD line code

o1112 sub
T3 M6

code in the middle

o1112 endsub
o1112 call
M2

o1113 sub
T5 M6

code in the middle

o1113 endsub
o1113 call
M2

o1114 sub
T7 M6

code in the middle

o1114 endsub
o1114 call
M2

END line code

Now every subroutine need to have a unique name and in order to generate the name for every toolpath I use this piece code line:

"o01[N] sub"

of course id N is the picked line I will end up with subroutines were at the beginning I have something like

o0010 sub

and at the end of the same subroutine

o1115 endsub
o11142 call

Basically I don't know how to generate the same name for a subroutine inside a file that contains numbers of subroutines same as the number of tool change. Modifying the post processor.

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

More
14 Jan 2023 11:34 #261922 by andypugh
So, your question is about the specific syntax of the Artcam postprocessor?

In that case I can't help, but perhaps someone else can.

Why not just increment a variable on every call??

O1 sub
...
O1 endsub
01 call

O2 sub
...
O2 endsub
O2 call. [/code]

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

More
14 Jan 2023 12:15 #261931 by sibelius
Hi
Basically yes
That's exactly what I m trying to achive.
My problem is to understand how to declare a variable that can be incremented at every call.
Thanks in anycase for your time.

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

More
14 Jan 2023 18:18 #261965 by andypugh
Can you attach your modified post? Perhaps we can figure out what language it is written in?

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

More
15 Jan 2023 06:34 #262015 by sibelius
Hi, 
One file is my original post (that I use at the moment); the other one is my attempt to get the result with the subroutines.
I very much appreciate your help but please don't spend to much time on; this is just an experiment.
Bye for now.
V. 
 
Attachments:

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

More
16 Jan 2023 23:04 #262183 by andypugh
I found two alternative posts on Github:
github.com/search?q=artcam+postprocessor

Sadly neither show any indication of a way to create and increment a variable.

An alternative might be to just use (for example) ##### for all the numbers, then run the G-code through an input filter (LinuxCNC can do this automatically when the file loads.) This could be a Python (or, in fact, anything else) script that converts the ##### into sequential numbers. (or stick with using the line numbers, but fix them)
The following user(s) said Thank You: sibelius

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

More
17 Jan 2023 00:34 #262200 by sibelius
Thank you very much for your help Andy.
I will have a look
Bye for now
V.

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

Time to create page: 0.455 seconds
Powered by Kunena Forum