G21 + G20 checkbox / LED

Here is where you can request new features or special features.

Re: G21 + G20 checkbox / LED

Postby dezsoe » Fri Oct 27, 2017 5:13 pm

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);
dezsoe
 
Posts: 531
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: G21 + G20 checkbox / LED

Postby Robertspark » Fri Oct 27, 2017 5:33 pm

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
Rob
Einstein ― “If you can't explain it to a six year old, you don't understand it yourself”
...working my way through the 1000+ ways things don't work to find the one that does
UC400eth, UC300eth, UCCNC v1.2106, Neuron Lite
UCCNC v1.2105 Macro Manual
Robertspark
 
Posts: 968
Joined: Sat Sep 03, 2016 4:27 pm
Location: Nr Liverpool, England

Re: G21 + G20 checkbox / LED

Postby dezsoe » Fri Oct 27, 2017 5:59 pm

No, I cannot change Sset (869), just read it to calculate the SRO percent.
dezsoe
 
Posts: 531
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: G21 + G20 checkbox / LED

Postby Dan911 » Fri Dec 08, 2017 6:05 am

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 52 times
Dan911
 
Posts: 416
Joined: Mon Oct 31, 2016 1:22 am
Location: USA

Re: G21 + G20 checkbox / LED

Postby Dan911 » Fri Dec 08, 2017 11:35 pm

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
Dan911
 
Posts: 416
Joined: Mon Oct 31, 2016 1:22 am
Location: USA

Re: G21 + G20 checkbox / LED

Postby Dan911 » Sat Dec 09, 2017 11:24 am

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
Dan911
 
Posts: 416
Joined: Mon Oct 31, 2016 1:22 am
Location: USA

Re: G21 + G20 checkbox / LED

Postby Robertspark » Mon Dec 11, 2017 6:12 pm

Thanks Dan much appreciated for giving it a go, I've not tried it yet (playing with other things) but I will do shortly.
Rob
Einstein ― “If you can't explain it to a six year old, you don't understand it yourself”
...working my way through the 1000+ ways things don't work to find the one that does
UC400eth, UC300eth, UCCNC v1.2106, Neuron Lite
UCCNC v1.2105 Macro Manual
Robertspark
 
Posts: 968
Joined: Sat Sep 03, 2016 4:27 pm
Location: Nr Liverpool, England

Re: G21 + G20 checkbox / LED

Postby Dan911 » Mon Dec 11, 2017 6:18 pm

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
Dan911
 
Posts: 416
Joined: Mon Oct 31, 2016 1:22 am
Location: USA

Previous

Return to Feature Request

Who is online

Users browsing this forum: No registered users and 8 guests