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.
More to configurations.
brian_pinder662
Member Posts: 119 ✭✭
Progressing with configurations but would like a little help please. I have a pipe tee which has a variable (PipeRad17.5) or (PipeRad 21mm) Which works fine on the the 17.5 PipeRad, but on the 21mm Pipe Rad there is an extrusion that needs to increase from 1.5mm to 4.5mm. My question is how to write an equation to the extrusion that will allow this, or is this not possible.
Can anyone help please.
Regards Brian.
Can anyone help please.
Regards Brian.
0
Best Answers
-
NeilCooke Moderator, Onshape Employees Posts: 5,715== is comparing the variable to a value.
Read it as: if #PipeRad = 21mm then 4.5mm else 1.5mmSenior Director, Technical Services, EMEAI5 -
MBartlett21 Member, OS Professional, Developers Posts: 2,050 ✭✭✭✭✭You should probably take tolerance into account using
tolerantEquals
tolerantEquals(#PipeRad, 21 mm) ? 4.5 mm : 1.5 mm
PS: you can just use21 mm
, rather than21 * millimeter
5 -
owen_sparks Member, Developers Posts: 2,660 PROIt represents the word "else". So we have the question first, that is to say a logical test to see if a condition of met. Then we have the value to use if that condition is true, then after the colon the value to use if that condition is false.
Condition? Value if true : value if false
So in your example we're doing "if pipe diameter = 21mm then use 4.5mm, else use 1.5mm instead."
Does that make sense? Cheers Owen.Business Systems and Configuration Controller
HWM-Water Ltd5
Answers
Note that these expressions are evaluated as FeatureScript, so anything that's valid FeatureScript also will work in that field... But of course that's like saying you could solve your problem by learning Chinese. That help page instead just goes over most of the useful cases.
Once again thank you all. I shall be spending some time trying to work it out.
Brian.
Read it as: if #PipeRad = 21mm then 4.5mm else 1.5mm
Brian
tolerantEquals
PS: you can just use
21 mm
, rather than21 * millimeter
IR for AS/NZS 1100
Brian.
Condition? Value if true : value if false
So in your example we're doing "if pipe diameter = 21mm then use 4.5mm, else use 1.5mm instead."
Does that make sense? Cheers Owen.
HWM-Water Ltd
All the best Brian.
As @kevin_o_toole_1points out, the availability of this type of syntax inside of a feature dialog is a direct result of the expression in the box being evaluated as FeatureScript, and the ternary operator being a piece of syntax that is available in FeatureScript. If anyone has suggestions of ways we can improve the documentation around this, or ways to make doing this kind of operation easier/more understandable, please feel free to say so!
HWM-Water Ltd
Thanks for the replies and for not being all defensive over a bit of Onshape that arguably already works just fine I think I'm stuck between generations. Half of me expects to "do thing properly" when looking at new software. Read the manual, do the training etc. The other half thinks of software as apps that should be so intuitive to use, or should guide the user through a process, such that a manual isn't ever necessary.
Mulling this further, and with a view to the long term I have an additional thought. I'd love to see a function icon next to the input field on feature dialogues. Clicking this would open a Featurestudio and build a template of a blank function complete with link to the input field. The user would then have:-
(a) Space.
We've winged about tiny input fields for a while and with a Featurestudio we'd have more than we could ever need. We'd be free to use multi-line expressions to make reading them easier.
(b) Auto complete becomes available.
The is already a perfectly good auto complete for building an if statement for example.
(c) Comments.
We can add comments to expressions so the intent is even clearer even after time has passed or if editing another designer's feature.
(d) Menus.
There are already drop down menus for query functions and the like, this could be build upon with expressions to guide someone who can't benefit from the autocomplete because they don't know what to start typing.
(e) If nudges folks gently into FS.
If I have one regret over my Onshape learning curve it's not getting into FS much earlier, but that's for another post.
Thanks also for the link to that book. I'll be having a read! This excerpt just makes perfect sense:-
The Design of Everyday Things is a powerful primer on how--and why--some products satisfy customers while others only frustrate them, especially if you make all the blasted icons grey rectangles.
Owen S.
HWM-Water Ltd
YES!
For anyone following along, one such discussion we had is here and highlights a simple use case for what we describe:-
https://forum.onshape.com/discussion/7185/use-featurescript-queries-in-standard-partstudio-features
Owen S.
HWM-Water Ltd
Brian
I'd like to do something like this: #Length < 1300mm ? suppress[part] : unsuppress[part]