Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. 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_parsonssam_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!

Best Answer

Answers

  • mahirmahir Member, Developers Posts: 1,309 ✭✭✭✭✭
    A link would help. It's not exactly clear what you're trying to accomplish. I think what you want is to have a continuously variable drawer front height height that then drives a standard/discrete/quantized  drawer box height. I don't think you need to control feature suppression. What you need is to dictate the box height dimension/variable based on the front height dimension/variable. That sound right?
  • mahirmahir Member, Developers Posts: 1,309 ✭✭✭✭✭
    Here's an example of selecting discrete variable values based on a separate input variable. It uses nested ternary operators to select #Box_Height based on #Front_Height.

    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

  • sam_parsonssam_parsons Member Posts: 43 PRO
    Thanks for the quick response!

    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.
  • tim_hess427tim_hess427 Member Posts: 648 ✭✭✭✭
    If you're trying to control the configuration of some holes, you might be able to do some configurations of a sketch pattern, then extrude the hole sketch. With a sketch pattern, you can control the number of "instances" and the spacing between them independently. 

    I can't find it at the moment, but I remember seeing a webinar with advanced sketching tips that covered this topic pretty well. 
  • mahirmahir Member, Developers Posts: 1,309 ✭✭✭✭✭
    edited April 2020
    Yes, configurations are an easy way to create permutations of dimensions, including hole spacing, count, and size. Configurations can also control suppression state of features. I got thrown off thinking you wanted a custom continuously variable front height. But it sounds like there are specific sets of dimensions you're interested in creating, which lends itself more to configurations. Here is an example of various types of parameters that can be controlled via configurations.

    https://cad.onshape.com/documents/57acdfaae4b005c413ed9b6f/w/3fd585a46d3af1b3ba413c53/e/b02ec721136c6121c1a02cc1

  • sam_parsonssam_parsons Member Posts: 43 PRO
    Thanks again guys.

    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?


  • tim_hess427tim_hess427 Member Posts: 648 ✭✭✭✭
    I believe there is a featurescript that allows you to measure something and it puts the measurement into a variable (I can't remember the name, though). Maybe that could be a missing link? 

    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


  • mahirmahir Member, Developers Posts: 1,309 ✭✭✭✭✭
    edited April 2020
    He doesn't need to make it a variable, because there is already a configured variable #Height. So it sounds like we've come back to my original problem statement - selecting a discrete box height based on a continuous front height. You can use a formula that selects a particular drawer based on nested ternary/if statements. Although, I have to ask do you really need a custom height? If you can get away with selecting from a list of height values, then the solution becomes relatively simple using configurations. For each option, even if it's every 1mm, you can set the proper box size. Is it super important to be able to set the height to 423.9mm? Would every 10mm be sufficient? That makes the problem much simpler. 
  • sam_parsonssam_parsons Member Posts: 43 PRO
    I'm afraid I do need a custom height, as the height is a function of the height of the cabinet and the space that the door has to fit into (might be 2-5 drawers in a cabinet: drawer front height = cabinet height/2 , or , cabinet height/3 , etc).
    mahir said:
    You can use a formula that selects a particular drawer based on nested ternary/if statements.
    How would I go about doing this then?
  • mahirmahir Member, Developers Posts: 1,309 ✭✭✭✭✭
    @sam_parsons, take a look at the first lick I posted (copied below). #Box_Height uses nested if/ternary operators. This can work, but I believe it's klugey and more complicated than necessary. I understand you need a custom height, but what I was asking is how fine an adjustment on that height do you need? What is the largest height increment you're willing to live with? For example, if you're ok being able to select from a list front heights that increment every 10mm, then you can just create those specific height options as a configured list. Then for each height option you can specify spreadsheet-style the specific box height you want to use. This method is more direct and easier to edit/tweak after the fact. 

    https://cad.onshape.com/documents/57acdfaae4b005c413ed9b6f/w/3fd585a46d3af1b3ba413c53/e/cb34679fd045218a798582d8

  • sam_parsonssam_parsons Member Posts: 43 PRO
    @mahir, thanks again, but the drawer front height really does need to a variable, because this part studio is derived into other part studios and the height is defined by a function of the height of another model (the cabinet body).

    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? 
  • sam_parsonssam_parsons Member Posts: 43 PRO
    Ok, thanks mahir, I think that's enough for me to play around with for now.

    I'll let you know if I manage it!
    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

    Very intrigued by this!

  • mahirmahir Member, Developers Posts: 1,309 ✭✭✭✭✭
    No problem. The gist of using configuration instantiation is you have to create a template part studio that drives all the variable geometry using configured variables. You can then create a featurescript that instantiates a template configuration with specific dimensions driven by user input and programmed logic.

    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.
Sign In or Register to comment.