diabase / H-Series-Configuration

Configuration files for use with Diabase H-Series machines.
https://www.diabasemachines.com/
2 stars 3 forks source link

Datatype mismatch error in {move.axes[5].letter == "W"} statement #5

Closed RonaldThomas closed 3 years ago

RonaldThomas commented 3 years ago

While attempting to evaluate this if statement, I'm getting a "Error: meta command: cannot convert operands to same type" error.

https://github.com/diabase/H-Series-Configuration/blob/154a40fe0ff24d4869cf3f173e4143524600d84b/tprime-universal.g#L32 Data Type Mismatch Error on W Axis Letter

RonaldThomas commented 3 years ago

Thanks to @wilriker!

You actually discovered a bug here. This will be fixed in the next release but meanwhile here is a workaround (that will still work in the future):

{(move.axes[5].letter ^ "") == "W"}

Explanation: move.axes[].letter is of type Character and "W" is of type String. These are not compatible (as you've seen in the error message). Also you cannot provide Character literals. Usually this should lead to automatic conversion to a String (that's the bug that this is not done). The workaround above is to append ^ "" to it which will convert any type into a String.