- Posts: 32
- Thank you received: 0
Round system parameter to tenths?
- nick.smith
- Topic Author
- Offline
- Junior Member
-
Less
More
3 years 1 week ago #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 to join the conversation.
3 years 1 week ago #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
Please Log in to join the conversation.
- nick.smith
- Topic Author
- Offline
- Junior Member
-
Less
More
- Posts: 32
- Thank you received: 0
3 years 1 week ago #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 to join the conversation.
3 years 6 days ago #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 to join the conversation.
- xenon-alien
- Offline
- Premium Member
-
Less
More
- Posts: 157
- Thank you received: 0
1 year 2 months ago #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 to join the conversation.
1 year 2 months ago #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:
Code:
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
Please Log in to join the conversation.
- xenon-alien
- Offline
- Premium Member
-
Less
More
- Posts: 157
- Thank you received: 0
1 year 2 months ago #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:
Code: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 to join the conversation.
- xenon-alien
- Offline
- Premium Member
-
Less
More
- Posts: 157
- Thank you received: 0
1 year 2 months ago #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 to join the conversation.
1 year 2 months ago #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
Code:
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
Please Log in to join the conversation.
- xenon-alien
- Offline
- Premium Member
-
Less
More
- Posts: 157
- Thank you received: 0
1 year 2 months ago #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
Code:O100 while [#<_task> EQ 1.0 AND #<_deltaabs> GT 0.007]
Attachment not found
Please Log in to join the conversation.
Time to create page: 0.098 seconds
