GCode formula

If you have a question about the software please ask it here.

GCode formula

Postby DavidT » Sat Dec 31, 2022 5:05 pm

Hi,

The M17 macro set the variable #3 to either 0.0 or 0.5.

I can't figure out how to use it in GCode formula.

Code: Select all
...
#3 = 0.0
M17
...
G00 Z80.000
G00 X10.000 Y10.000
G01 X10.000 Y10.000 Z[8.000+#3] (brackets are not interpretable(they, and everything in it, appear in red in the GCode viewer))
G01 X10.000 Y10.000 Z[#3+8.000] (same as above)
G01 X10.000 Y10.000 Z#3+8.000 (will ignore the +8.000)
G01 X10.000 Y10.000 Z8.000+#3 (will ignore the variable)
...


I fear I have to recalculate the Z value for each and every line.
Something like:
Code: Select all
#103 = Zcoord + #3
G01 X10.000 Y10.000 Z#103

Is that right?

Cheers
User avatar
DavidT
 
Posts: 13
Joined: Fri Sep 24, 2021 5:51 pm
Location: Montreal, Canada

Re: GCode formula

Postby dezsoe » Tue Jan 03, 2023 9:56 am

Yes, you are right.
dezsoe
 
Posts: 2093
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: GCode formula

Postby DavidT » Sat Jan 07, 2023 9:00 pm

Thank you dezsoe.

So far, everything seems to work properly with this method.
The GCode is a bit harder to read, the file size is practically doubled but hey! if it works!? Let's carry on!

Cheers!
User avatar
DavidT
 
Posts: 13
Joined: Fri Sep 24, 2021 5:51 pm
Location: Montreal, Canada

Re: GCode formula

Postby DavidT » Tue Mar 28, 2023 10:43 pm

Hi!

I've been using the previous solution and it works fine but I know encounter the problem that if I merge various GCode together and separate them by M00 (wait for operator to Cycle Start before continuing), the value of #3 is lost ... from what I can understand, it is set to 0 after the M00.

Is there a more robust way to set a variable?

For now I just ask the question again every time I pause but it's redundant and there's a risk of error (if the operator makes a mistake when retyping in the value).

Thank you
User avatar
DavidT
 
Posts: 13
Joined: Fri Sep 24, 2021 5:51 pm
Location: Montreal, Canada

Re: GCode formula

Postby dezsoe » Wed Mar 29, 2023 8:16 am

M0 (or any other internal command) will not zero any variable, so check your g-code, there must be a line that changes it. Also, if you call macros or you have any macroloop then check them.
dezsoe
 
Posts: 2093
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary


Return to Ask a question from support here

Who is online

Users browsing this forum: Bing [Bot] and 35 guests

cron