Our work depends on values that are taken from probing... in this case the Pythagoras theorem.
#31509 = #31501- [ #31502 - SQRT[ [ #31502 ^ 2 ]-[ 19.0000 ^ 2 ]]]
When this runs I get an undefined variable error.
I deconstructed the formula to simplify it for the controller and still have an issue.
Here you see where there is a value in #31502
When taking the square root of the of the sum of the square of the sides.
I'm still getting the undefined variable error
I am missing what I'm doing wrong.
Thanks in advance for your help and opinions. Sorry the images show sideways.
Hello Pythagoras
Moderator: cnckeith
-
- Posts: 26
- Joined: Fri Nov 22, 2024 4:25 pm
- Acorn CNC Controller: Yes
- Plasma CNC Controller: No
- AcornSix CNC Controller: No
- Allin1DC CNC Controller: No
- Hickory CNC Controller: No
- Oak CNC controller: No
- CNC Control System Serial Number: B4107B77A373-0905248481
- DC3IOB: No
- CNC12: Yes
- CNC11: No
- CPU10 or CPU7: No
Hello Pythagoras
- Attachments
-
- report_80F5B5295763-1116215369_2025-01-07_16-28-04.zip
- (1.16 MiB) Not downloaded yet
(Note: Liking will "up vote" a post in the search results helping others find good information faster)
Re: Hello Pythagoras
It looks like the "^" operator (exponentiation) binds with higher precedence than the "#" operator (variable dereferencing).
As a result, "#2 ^ 2" evaluates as "#[2 ^ 2]" and returns the value of variable #4.
"#31502 ^ 2" tries to access variable #992376004, which is invalid.
To get around this, you have to write "[#31502] ^ 2" instead.
As a result, "#2 ^ 2" evaluates as "#[2 ^ 2]" and returns the value of variable #4.
"#31502 ^ 2" tries to access variable #992376004, which is invalid.
To get around this, you have to write "[#31502] ^ 2" instead.
1 user liked this post
(Note: Liking will "up vote" a post in the search results helping others find good information faster)
(Note: Liking will "up vote" a post in the search results helping others find good information faster)
-
- Posts: 26
- Joined: Fri Nov 22, 2024 4:25 pm
- Acorn CNC Controller: Yes
- Plasma CNC Controller: No
- AcornSix CNC Controller: No
- Allin1DC CNC Controller: No
- Hickory CNC Controller: No
- Oak CNC controller: No
- CNC Control System Serial Number: B4107B77A373-0905248481
- DC3IOB: No
- CNC12: Yes
- CNC11: No
- CPU10 or CPU7: No
Re: Hello Pythagoras
You're exactly right. Great catch.
How do I report this bug?
Thanks again!
How do I report this bug?
Thanks again!
(Note: Liking will "up vote" a post in the search results helping others find good information faster)
-
- Posts: 3086
- Joined: Thu Sep 23, 2021 3:49 pm
- Acorn CNC Controller: Yes
- Allin1DC CNC Controller: No
- Oak CNC controller: No
- CNC Control System Serial Number: 6433DB0446C1-08115074
- DC3IOB: No
- CNC12: Yes
- CNC11: No
- CPU10 or CPU7: No
- Location: Germany
Re: Hello Pythagoras
It is not a bug, it is a feature
8.2.14 [ ] – Numerical Expression
The left bracket ‘[’ and right bracket ‘]’ are used to delimit a numerical expression. Numerical expressions can contain
floating-point numbers or user/system variables in combination with mathematical operators and functions. The left
parenthesis ‘(’ or bracket ‘[’ and right parenthesis ‘)’ or bracket ‘]’ can be used between the first left bracket and last
right bracket to force operator precedence or associatively. A bracketed numerical expression can be used anywhere
a number would be used. Comparison operators (‘eq’, ‘ne’, etc.) have built-in rounding specified by Parameter 144.
Without this rounding, ‘eq’ would usually return “false‘’ when comparing two numbers calculated in different ways.
Comparison operators and logical operators (‘!’, ‘&&’, ‘||’) return 1.0 for “true” and 0.0 for “false”.
Example:
G91 X [13/64] Z [1+3/8] ; Move the X axis 13/64 (0.2031) units and the Z axis 1 3/8 (1.375) units incrementally
X[ SQRT [ABS[SIN [#101] - COS [#102]]]] ; Move X as a function of #101 and #102
Uwe
1 user liked this post
(Note: Liking will "up vote" a post in the search results helping others find good information faster)
(Note: Liking will "up vote" a post in the search results helping others find good information faster)
-
- Posts: 26
- Joined: Fri Nov 22, 2024 4:25 pm
- Acorn CNC Controller: Yes
- Plasma CNC Controller: No
- AcornSix CNC Controller: No
- Allin1DC CNC Controller: No
- Hickory CNC Controller: No
- Oak CNC controller: No
- CNC Control System Serial Number: B4107B77A373-0905248481
- DC3IOB: No
- CNC12: Yes
- CNC11: No
- CPU10 or CPU7: No
Re: Hello Pythagoras
I love features! So does Microsoft
(Note: Liking will "up vote" a post in the search results helping others find good information faster)
Re: Hello Pythagoras
I think a better feature would be to give the "#" operator higher precedence than the "^" operator, but that is just my opinion.
(Note: Liking will "up vote" a post in the search results helping others find good information faster)
-
- Posts: 3086
- Joined: Thu Sep 23, 2021 3:49 pm
- Acorn CNC Controller: Yes
- Allin1DC CNC Controller: No
- Oak CNC controller: No
- CNC Control System Serial Number: 6433DB0446C1-08115074
- DC3IOB: No
- CNC12: Yes
- CNC11: No
- CPU10 or CPU7: No
- Location: Germany
Re: Hello Pythagoras
Yes, this would save some typing...
Uwe
1 user liked this post
(Note: Liking will "up vote" a post in the search results helping others find good information faster)
(Note: Liking will "up vote" a post in the search results helping others find good information faster)
-
- Posts: 26
- Joined: Fri Nov 22, 2024 4:25 pm
- Acorn CNC Controller: Yes
- Plasma CNC Controller: No
- AcornSix CNC Controller: No
- Allin1DC CNC Controller: No
- Hickory CNC Controller: No
- Oak CNC controller: No
- CNC Control System Serial Number: B4107B77A373-0905248481
- DC3IOB: No
- CNC12: Yes
- CNC11: No
- CPU10 or CPU7: No
Re: Hello Pythagoras
It would make it behave like other GCode interpreters as well as all other languages too.
(Note: Liking will "up vote" a post in the search results helping others find good information faster)