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.
Inequality & modulus constraints?
brooks_talley
Member Posts: 27 ✭
Is there any way to create sketch constraints that reflect "greater than / less than" or "is a multiple of"?
Two scenarios:
Two scenarios:
- I have two holes that need to be at least 1" apart. They can be farther apart, but they can't be closer.
- A spacer can be any multiple of 0.5", but making a 1.3172" spacer is prohibitive
Tagged:
0
Best Answers
-
mahir Member, Developers Posts: 1,304 ✭✭✭✭✭There is no boundary constraint in OS, and I haven't seen anything like that in any other CAD software either. However, you can definitely use variables to drive your dimensions, and those variables can be the result of fairly complex branching logic. For example, you can make your hole spacing dependent on a variable that controls your panel width. In this example if #panel_width is less than 2in, then your hole spacing will be 1in. But if it's greater than 2in, then the hole spacing will be the panel width less 1in.
#hole_spacing = #panel_width < 2? 1in : #panel_width - 1in
As for the spacer example, you can definitely use expressions for that, too. This expression will set #spacer_width to #x rounded up to the nearest half inch.#spacer_width = ceil(#x / 0.5in) * 0.5in
6 -
mahir Member, Developers Posts: 1,304 ✭✭✭✭✭Check out the Measure Value FeatureScript. I believe it does exactly that. Alternatively, you can create the variable first and drive the dimension with the variable.5
Answers
As for the spacer example, you can definitely use expressions for that, too. This expression will set #spacer_width to #x rounded up to the nearest half inch.