Page 2 of 2

Re: G21 + G20 checkbox / LED

PostPosted: Fri Oct 27, 2017 5:13 pm
by dezsoe
I've just finished an experiment making this macroloop. :) The main trick is to select a proper S value, because in a macroloop you must not use Code, so you can only operate with the SRO, but it is an integer limited to 0..300.

Working code (fixed parameters it's just a test):
Code: Select all
double sSet = AS3.Getfielddouble(869);                                          // Setspindlespeed
double x = exec.GetXpos();

double f = 1.0 * 1000;                                                          // requested mm/min

double s = 0.0;
double p = 100.0;

if (x < 0.0001) x = 0.0001;                                                     // don't divide by zero!

s = f / (2 * x * Math.PI);

AS3.Setfieldtext(s.ToString("F4"), 21000);

p = Math.Floor(s / sSet * 100);                                                 // SpindleSet

if (p > 300) p = 300;

AS3.Setfield(p, 233);                                                           // SRODRO
AS3.Validatefield(233);

Re: G21 + G20 checkbox / LED

PostPosted: Fri Oct 27, 2017 5:33 pm
by Robertspark
Nice,

I was wondering is field 869 could be edited via the macroloop.

so at the start of the macro (within the macroloop) you obtain 869, and retain it for later set at the end when the macro is cancelled.

Then adjust the field 869 relative to the X axis DRO position up to a maximum SRO value

Re: G21 + G20 checkbox / LED

PostPosted: Fri Oct 27, 2017 5:59 pm
by dezsoe
No, I cannot change Sset (869), just read it to calculate the SRO percent.

Re: G21 + G20 checkbox / LED

PostPosted: Fri Dec 08, 2017 6:05 am
by Dan911
Robertspark wrote:I know uccnc is unitless, however I was wondering if G20 + G21 could be added to the available list of Gcodes so that they could be used to toggle a checkbox (or LED) which could then be used by macros to check for metric or inch correction for meters / min or, inch per minute or feet per minute which can be applied within the macros directly by users.

Note this is just a checkbox (or LED) toggle, we already have G50 + G51 should you wish to rescale the gcode.

G20 / G21 would do nothing other than toggle the checkbox or led unless you had a macroloop or macro which was looking for the status of that checkbox or LED within the screenset (general settings tab).

Thanks,


Hi Rob, I was searching G20/G21 and came across this thread, are you looking for leds for g20/g21 in Gcode? I already have this code fom Gcode estimator I worked on and could put into a macro if you like, but would take me so much longer..lol. Let me know if this is what you were looking for.

Create two leds... 500 for g20 and 501 for g21.

G20orG21.zip
(2.75 KiB) Downloaded 54 times

Re: G21 + G20 checkbox / LED

PostPosted: Fri Dec 08, 2017 11:35 pm
by Dan911
Dan911 wrote:
Robertspark wrote:I know uccnc is unitless, however I was wondering if G20 + G21 could be added to the available list of Gcodes so that they could be used to toggle a checkbox (or LED) which could then be used by macros to check for metric or inch correction for meters / min or, inch per minute or feet per minute which can be applied within the macros directly by users.

Note this is just a checkbox (or LED) toggle, we already have G50 + G51 should you wish to rescale the gcode.

G20 / G21 would do nothing other than toggle the checkbox or led unless you had a macroloop or macro which was looking for the status of that checkbox or LED within the screenset (general settings tab).

Thanks,


Hi Rob, I was searching G20/G21 and came across this thread, are you looking for leds for g20/g21 in Gcode? I already have this code fom Gcode estimator I worked on and could put into a macro if you like, but would take me so much longer..lol. Let me know if this is what you were looking for.

Create two leds... 500 for g20 and 501 for g21.

G20orG21.zip


Hmmmm, I guess my post didn't even warrant a reply.... Oh boy do I feel foolish!

BTW- elaborating on the writing to field #869 question, technically you can but UCCNC will just write over it.

I Enjoy using notepad++ Thank you,
Dan

Re: G21 + G20 checkbox / LED

PostPosted: Sat Dec 09, 2017 11:24 am
by Dan911
Dan911 wrote:
Robertspark wrote:I know uccnc is unitless, however I was wondering if G20 + G21 could be added to the available list of Gcodes so that they could be used to toggle a checkbox (or LED) which could then be used by macros to check for metric or inch correction for meters / min or, inch per minute or feet per minute which can be applied within the macros directly by users.

Note this is just a checkbox (or LED) toggle, we already have G50 + G51 should you wish to rescale the gcode.

G20 / G21 would do nothing other than toggle the checkbox or led unless you had a macroloop or macro which was looking for the status of that checkbox or LED within the screenset (general settings tab).

Thanks,


Hi Rob, I was searching G20/G21 and came across this thread, are you looking for leds for g20/g21 in Gcode? I already have this code fom Gcode estimator I worked on and could put into a macro if you like, but would take me so much longer..lol. Let me know if this is what you were looking for.

Create two leds... 500 for g20 and 501 for g21.

G20orG21.zip


I see a handful of people downloaded this, I just copy/pasted code from another plugin quickly to see if this was what Rob wanted.(have to stop doing that when posting :shock: )
It works but not as efficiently as it could/should.

If anyone finds any use please download from the Tool Box section of this forum. It will just check Gcode once and not continually like the one I posted here.

Dan

Re: G21 + G20 checkbox / LED

PostPosted: Mon Dec 11, 2017 6:12 pm
by Robertspark
Thanks Dan much appreciated for giving it a go, I've not tried it yet (playing with other things) but I will do shortly.

Re: G21 + G20 checkbox / LED

PostPosted: Mon Dec 11, 2017 6:18 pm
by Dan911
Robertspark wrote:Thanks Dan much appreciated for giving it a go, I've not tried it yet (playing with other things) but I will do shortly.


My pleasure, use the 1 I posted in UCCNC tool box. If it's what you were looking for LMK and I will post code so can be used in macro.

Dan