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.
Suppressing features when variables are within a certain range?
sam_parsons
Member Posts: 43 PRO
Is it possible to suppress features when a variable enters a specified range?
For example, I have a drawer front which is bespoke, that fixes to the front of drawer boxes with standard heights. I'd like to be able to set up a configuration where the standard height of the drawer box is automatically chosen based on the height of the drawer front that is specified in a configuration variable.
Thanks in advance!
For example, I have a drawer front which is bespoke, that fixes to the front of drawer boxes with standard heights. I'd like to be able to set up a configuration where the standard height of the drawer box is automatically chosen based on the height of the drawer front that is specified in a configuration variable.
Thanks in advance!
0
Best Answer
-
mahir Member, Developers Posts: 1,309 ✭✭✭✭✭I didn't say it was impossible - just a bit tedious. Here's the equation I used in my example. It selects #Box_Height based on the following categories of #Front_Height (x): x>=300mm, 200mm<=x<300mm, x<200mm. This is only 3 height categories, but you can see what I mean by tedious.
(#Front_Height>=300mm)?250mm:((#Front_Height>=200mm)?150mm:50mm)
Even then, this won't suppress/unsuppress any features. I don't believe this is possible on the fly. The formula above will give you a #Box_Height variable you can work with to build the box. I believe this is a more robust method anyway vs creating a bunch of imported box features and then selectively suppressing all but one. You'll just need to extract the dimensions of the standard box sizes and feed them into the formula.
Alternatively, if you want to delve into the world of programming custom featurescript (way more complicated), you might be able to turn your cabinet into one big featurescript using configuration instantiation.
https://forum.onshape.com/discussion/12514/conditional-feature-suppression
5
Answers
Depending on how your standard box sizes organized, you might be able to use a more direct formula like how #Box_Height2 is calculated. For example, if X is your front height, and you want your box height Y to be a multiple of 50mm, you could use Y = int(X/50mm)*50mm.
https://cad.onshape.com/documents/57acdfaae4b005c413ed9b6f/w/3fd585a46d3af1b3ba413c53/e/cb34679fd045218a798582d8
Apologies, here is a link:
https://cad.onshape.com/documents/827347648cc8ee130e3caf17/w/eabb548268798a41ec33b4f4/e/9b43f1bbee329773af3fae23?configuration=Bottom_Height%3D0.1%2Bmeter%3BDepth%3D0.6%2Bmeter%3BHeight%3D0.8%2Bmeter%3BInlay%3Dfalse%3BList_HJzAp8nt84tFXD%3DDefault%3BList_Jwj8U3v2PStPC7%3DDefault%3BList_Mnb6Gfld2lbfp8%3Dx0%3BList_gSQFZ0I93ExOCv%3DDefault%3BList_wl2AoVC9mDbK3X%3DDefault%3BList_yMwnONRN8V1Hui%3DDefault%3BWidth%3D0.6%2Bmeter
Actually, the drawer box isn't modelled, as it's provided by a different supplier. The info from the drawer box that's needed is the position of the screw holes for fitting the front to the box. These screw holes have different positions and configurations based on the standard height of the drawer box, i.e. If the drawer box is 105mm, there are two holes 32mm apart, if the drawer box is 145mm high then there are three holes 32mm and 64mm apart respectively.
Hopefully from the link you can see that I have created a part studio for the screw holes based on the possible configurations of the drawer box screw holes and created a boolean tool to subtract from the drawer front.
I was hoping to be able to tell the derived drawer box boolean tool have configuration X (where certain holes are suppressed and distance between holes changes) if the height of drawer front is between X and Ymm, i.e, If Drawer Front Height is between 105mm and 144mm, make Drawer Box Hole Config = K.
I can't find it at the moment, but I remember seeing a webinar with advanced sketching tips that covered this topic pretty well.
https://cad.onshape.com/documents/57acdfaae4b005c413ed9b6f/w/3fd585a46d3af1b3ba413c53/e/b02ec721136c6121c1a02cc1
I understand how useful configurations are, there are already lots in the document. What I'm really trying to do, is make the config list input of the derived drawer box boolean tool, dependent on the config variable input of the drawer front. Does that make more sense with the image?
Also, you can put conditionals inside of a formula for a dimension or variable. Take a look at this post: https://forum.onshape.com/discussion/comment/31990
How would I go about doing this then?
https://cad.onshape.com/documents/57acdfaae4b005c413ed9b6f/w/3fd585a46d3af1b3ba413c53/e/cb34679fd045218a798582d8
I understand what you are suggesting, and I'm reading between the lines here and concluding that there is no direct way to switch to a specific row of a config table based on a variable, i.e. if 105 > h > 148, then switch to drawer box height 'M'?
And if not... is there any likelihood of this becoming possible at any point in the future?
(#Front_Height>=300mm)?250mm:((#Front_Height>=200mm)?150mm:50mm)
Even then, this won't suppress/unsuppress any features. I don't believe this is possible on the fly. The formula above will give you a #Box_Height variable you can work with to build the box. I believe this is a more robust method anyway vs creating a bunch of imported box features and then selectively suppressing all but one. You'll just need to extract the dimensions of the standard box sizes and feed them into the formula.
Alternatively, if you want to delve into the world of programming custom featurescript (way more complicated), you might be able to turn your cabinet into one big featurescript using configuration instantiation.
https://forum.onshape.com/discussion/12514/conditional-feature-suppression
I'll let you know if I manage it!
https://forum.onshape.com/discussion/12514/conditional-feature-suppression
Very intrigued by this!
This gives you much more freedom in how you pick variables. Case in point, if you wanted to you could create a template part studio that has all the different types of box sizes as different features, and create a configured checkbox for each of them that toggles suppression state. This isn't useful by itself, but when instantiated in a featurescript that controls the configured checkboxes, you would be able to do exactly what you want - enter any front height you want and create a cabinet that selects the appropriate box height using either nested or chained if-else statements.