Round system parameter to tenths?
- nick.smith
- Offline
- Junior Member
-
Less
More
- Posts: 29
- Thank you received: 5
24 Oct 2023 01:47 #283654
by nick.smith
Round system parameter to tenths? was created by nick.smith
If I have:
G28.1
(debug , X is #5161)
It will display the result as 5.123456
How can I format it to 5.1234? Also, how can I pull just the integer and modulus?
G28.1
(debug , X is #5161)
It will display the result as 5.123456
How can I format it to 5.1234? Also, how can I pull just the integer and modulus?
Please Log in or Create an account to join the conversation.
- cmorley
- Away
- Moderator
-
Less
More
- Posts: 7967
- Thank you received: 2167
24 Oct 2023 01:56 #283655
by cmorley
Replied by cmorley on topic Round system parameter to tenths?
In 2.9 you can use formatting:
linuxcnc.org/docs/2.9/html/gcode/overvie...e:comment-parameters
linuxcnc.org/docs/2.9/html/gcode/overvie...e:comment-parameters
The following user(s) said Thank You: MaHa
Please Log in or Create an account to join the conversation.
- nick.smith
- Offline
- Junior Member
-
Less
More
- Posts: 29
- Thank you received: 5
24 Oct 2023 01:59 #283656
by nick.smith
Replied by nick.smith on topic Round system parameter to tenths?
Excellent, but I'm not on 2.9 sadly.
Please Log in or Create an account to join the conversation.
- andypugh
-
- Offline
- Moderator
-
Less
More
- Posts: 23541
- Thank you received: 5013
24 Oct 2023 11:19 #283690
by andypugh
Replied by andypugh on topic Round system parameter to tenths?
To answer the second question
#100 = [#5161 MOD 10]
#101 = [#5161 - #100]
(debug, #101 #100)
If you want 2.9, it's installable, but I haven't quite finished all the documentation work around the release. But this process should work:
linuxcnc.org/docs/2.9/html/getting-start...dating-linuxcnc.html
Except that the package name is 2.9-uspace not 2.9-rtpreempt. (That's one of the thinngs I need to change)
#100 = [#5161 MOD 10]
#101 = [#5161 - #100]
(debug, #101 #100)
If you want 2.9, it's installable, but I haven't quite finished all the documentation work around the release. But this process should work:
linuxcnc.org/docs/2.9/html/getting-start...dating-linuxcnc.html
Except that the package name is 2.9-uspace not 2.9-rtpreempt. (That's one of the thinngs I need to change)
Please Log in or Create an account to join the conversation.
- xenon-alien
-
- Offline
- Premium Member
-
Less
More
- Posts: 148
- Thank you received: 4
19 Aug 2025 08:45 #333664
by xenon-alien
Replied by xenon-alien on topic Round system parameter to tenths?
Hello.
I have the same question.
After probing i have the Z coordinate value.
I measuring 2 points to align the B axis.
I'm doing it 2 times.
The 2nd measuring if gives a result with equal 2 decimals don't rotate the B axis.
Is there a code for the g-code to get a result in parameter, like in the debug
%.xf = x (0-9) number of decimals?
I have the same question.
After probing i have the Z coordinate value.
I measuring 2 points to align the B axis.
I'm doing it 2 times.
The 2nd measuring if gives a result with equal 2 decimals don't rotate the B axis.
Is there a code for the g-code to get a result in parameter, like in the debug
%.xf = x (0-9) number of decimals?
Please Log in or Create an account to join the conversation.
- andypugh
-
- Offline
- Moderator
-
Less
More
- Posts: 23541
- Thank you received: 5013
19 Aug 2025 13:03 #333674
by andypugh
But if you just want to compare two numbers to see if they differ by less than a certain amount:
linuxcnc.org/docs/html/gcode/overview.html#gcode:functions
linuxcnc.org/docs/stable/html/gcode/o-co...ml#ocode:conditional
Replied by andypugh on topic Round system parameter to tenths?
No, sorry.Is there a code for the g-code to get a result in parameter, like in the debug
%.xf = x (0-9) number of decimals?
But if you just want to compare two numbers to see if they differ by less than a certain amount:
O100 IF [ ABS[#100 - #101] LT 0.01]
<do stuff>
O100 ENDIF
linuxcnc.org/docs/html/gcode/overview.html#gcode:functions
linuxcnc.org/docs/stable/html/gcode/o-co...ml#ocode:conditional
The following user(s) said Thank You: xenon-alien
Please Log in or Create an account to join the conversation.
- xenon-alien
-
- Offline
- Premium Member
-
Less
More
- Posts: 148
- Thank you received: 4
21 Aug 2025 09:22 #333754
by xenon-alien
I saw that documents, but I'm not realized it can be done so simple way...
Replied by xenon-alien on topic Round system parameter to tenths?
Thank you.
But if you just want to compare two numbers to see if they differ by less than a certain amount:
O100 IF [ ABS[#100 - #101] LT 0.01] <do stuff> O100 ENDIF https://linuxcnc.org/docs/html/gcode/overview.html#gcode:functions https://linuxcnc.org/docs/stable/html/gcode/o-code.html#ocode:conditional
I saw that documents, but I'm not realized it can be done so simple way...
Please Log in or Create an account to join the conversation.
- xenon-alien
-
- Offline
- Premium Member
-
Less
More
- Posts: 148
- Thank you received: 4
26 Aug 2025 06:49 #333932
by xenon-alien
Replied by xenon-alien on topic Round system parameter to tenths?
I figured out how to make it work the axis alignment
But on 2.8.4 LCNC my code hangs out the LCNC when i uncomment the:
O100 do
O100 while [#_<ValueABS> GT 0.007]
The whole code in the attachment.
I want to combine 3 measurings in one file (also in attachment), but the same result - The LCNC freezes out without errors.
The decimal test code works fine
Maybe the global parameters makes the issue?
Can anyone tell how to solve this?
But on 2.8.4 LCNC my code hangs out the LCNC when i uncomment the:
O100 do
O100 while [#_<ValueABS> GT 0.007]
The whole code in the attachment.
I want to combine 3 measurings in one file (also in attachment), but the same result - The LCNC freezes out without errors.
The decimal test code works fine
Maybe the global parameters makes the issue?
Can anyone tell how to solve this?
Please Log in or Create an account to join the conversation.
- andypugh
-
- Offline
- Moderator
-
Less
More
- Posts: 23541
- Thank you received: 5013
28 Aug 2025 14:00 #334042
by andypugh
Replied by andypugh on topic Round system parameter to tenths?
You may be seeing a problem caused by the G-code preview. That runs through the code to draw the lines, but won't update values based on probe results etc (as it doesn't _move_ anything).
The trick here is probably
Which will end the loop early in preview generation.
linuxcnc.org/docs/stable/html/gcode/over...ub:system-parameters
The trick here is probably
O100 while [#<_task> EQ 1.0 AND #<_deltaabs> GT 0.007]
Which will end the loop early in preview generation.
linuxcnc.org/docs/stable/html/gcode/over...ub:system-parameters
The following user(s) said Thank You: xenon-alien
Please Log in or Create an account to join the conversation.
- xenon-alien
-
- Offline
- Premium Member
-
Less
More
- Posts: 148
- Thank you received: 4
29 Aug 2025 07:36 - 29 Aug 2025 08:42 #334076
by xenon-alien
Replied by xenon-alien on topic Round system parameter to tenths?
Thank you! It's HELPED!!The trick here is probably
O100 while [#<_task> EQ 1.0 AND #<_deltaabs> GT 0.007]
Attachments:
Last edit: 29 Aug 2025 08:42 by xenon-alien.
Please Log in or Create an account to join the conversation.
Time to create page: 0.083 seconds