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.
Challenging sketch constraint with variable text - not mission critical!
sasha_sklar061
Member Posts: 31 ✭✭
I have a use case where I'm populating a text block from a configuration variable to emboss onto a face and depending on the length of the text it either breaks out either horizontally or vertically. Plenty of ways to work around it but I'm curious if there's a "pure" sketch constraint approach…
I'm probably going with an expression approach that pads with whitespace if the character count is below a give length…
Best Answer
-
eric_pesty
Member, pcbaevp Posts: 2,648 PRO
I don't think you can do it just at the sketch level as you would need to change which dimension is driving depending on the limiting dimension.
Here's an example I built to answer a similar questions a while back:
0



Answers
I don't think you can do it just at the sketch level as you would need to change which dimension is driving depending on the limiting dimension.
Here's an example I built to answer a similar questions a while back:
https://cad.onshape.com/documents/691dc3dfc28f13d9c5f7a6fb/w/b959d623f3efe63dfea46f91/e/5bd3419483a0ece428be1757?configuration=text%3DABC&renderMode=0&tangentEdgeStyle=1&uiState=69c4254f646904348d542237
If you did this a lot, a custom feature would be the way to go.
Simon Gatrall | Product Development, Engineering, Design, Onshape | Ex- IDEO, PCH, Unagi, Carbon | LinkedIn
That's giving late 90s/early 2000s webdev hack and I love it!
My use case specific hack (length(#Variant_Code) <=3 ? " "~#Variant_Code~" " : #Variant_Code) doesn't work because the text field is a little too aggressive with eating trailing whitespace and the font doesn't include special characters like thin space so I may have to go with that.
Text handling (and the 2D workflow in general) really needs some love…