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.
Comments
but now we have configurations so seems like defining several rows of config table for two parameters is a better approach
First, the hole diameter needs to be controlled or at least linked to a variable (#Hole_Dia).
Then, your #Hole_Text would be set to the following:
#Hole_Dia<10mm?"Small Hole":"Big Hole"
So if the hole is less than 10mm, the text would read "Small Hole". If it's equal to or larger than 10mm, the text will be "Large Hole".
https://cad.onshape.com/documents/370197508187d5d8b361a414/w/64f8595ca2deaa8d5338db1a/e/fe4c2d2550f7c2d63b2704f9
You cannot currently change the name of the part in FeatureScript, but this is coming soon. Stay tuned to the update announcements.
It's doable, but it's a slightly tricky expression. The string concatenation operator in FeatureScript is ~. You also want to use the roundToPrecision function to avoid too many significant figures. For the string you asked for, with 3 significant figures, you end up with something like this:
"(" ~ roundToPrecision(#x / mm, 3) ~ "mm x " ~ roundToPrecision(#y / mm, 3) ~ "mm)"
You can also debug intermediate subexpressions by assigning them to "any" type variables -- in other words, you can create a variable xString of type "any" with the expression
roundToPrecision(#x / mm, 3) ~ "mm"
and then use #xString and similarly #yString in the text field
Hope this helps.
I reached out to Onshape support about same issue and they lead me to this:
https://cad.onshape.com/documents/3a320c371e27789f9e7681bc/w/b639c9809964f0ef281ad6cf/e/ae295a8e774ff3beff1948e2
This kind of resolves the problem. Happy to discuss in more depth.