Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.
If you would like to contact our Community Manager personally, feel free to send a private message or an email.
Why are units being handled in two different ways by identical feature dialogs?
Fletcher_Chapin
Member Posts: 3 ✭
in General
I have a predicate with units, defined here, which doesn't add units to the variables, but expects the variables to already have units, as you can see in this screenshot:
I have another predicate with units defined here, and even though the code appears identical to me, it's handling the units differently, as you can see here:
What this means is that I sometimes have to strip the units before passing variables into the dialog (I've written an FS function for that) but I'm confused why the behavior is inconsistent, so that in each Parts Studio I may or may not have to strip the units.
I have another predicate with units defined here, and even though the code appears identical to me, it's handling the units differently, as you can see here:
What this means is that I sometimes have to strip the units before passing variables into the dialog (I've written an FS function for that) but I'm confused why the behavior is inconsistent, so that in each Parts Studio I may or may not have to strip the units.
0
Answers
@alnis is my personal account. @alnis_ptc is my official PTC account.
I realized the following behavior is what's causing this:
1) the variable #HLbod was created as a unitless number, 0.3
2) that variable was entered into the dialog box which desired units, so it now appears as (#HLbod) m in the dialog box
3) the value of #HLbod was modified to include meters
4) the dialog box doesn't check if the variable was modified since it was entered, so it continues to try to pass in the expression (#HLbod) m. HOWEVER, #HLbod was redefined from a unitless 0.3 to 0.3 meters, so the predicate throws an error, stating that 0.3 meter meter is not a valid length.
Ideally, the dialog box would check the variable's units whenever it ran the feature, not just once upon variable entry.