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.

Suppress a feature if config variable is equal to 1..

APDAPD Member Posts: 40 PRO
Hi,

I've set up a configured part studio for a Generic Furniture Unit. Shelf spacing and number are controlled with my #ShelfQty config variable.

If my #ShelfQty is equal to 1, I'd like to suppress my Array feature (which fails with just 1 shelf in this set-up)

https://cad.onshape.com/documents/17a0cbeb16f67cb4426f970b/w/2b1760473795123af0eb627c/e/d9edaaa09c39d4fd9699c56b?configuration=Depth=0.59+meter;Height=0.8+meter;ShelfQty=1.0;Single_Shelf=false;VFC_Thickness=0.018000000000000002+meter;Width=0.59+meter

Grateful for any tips.
Tagged:

Answers

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,671
    Currently, it is not possible to suppress via an expression. There is nothing wrong per se with having a failing feature. I see you have added an extra drop-down with the options to have shelves or not - in this case, you can set the max/min values of the number of shelves so that the value cannot be set to 1. The only other way I can think of doing it is to create a custom feature and configure that, but that may be too much for what you are trying to achieve.
    Senior Director, Technical Services, EMEAI
  • owen_sparksowen_sparks Member, Developers Posts: 2,660 PRO
    Neil beat me to it, I'd let it fail for now but agree that it doesn't feel right.
    Business Systems and Configuration Controller
    HWM-Water Ltd
  • AlexPittAlexPitt Member Posts: 22 ✭✭
    @NeilCooke @owen_sparks Thanks Both,
    I'll not worry so much about the failed featured for now, as what I have is working.  Pity the Linear Array tool prohibits a single instance, (i.e. 0 child parts generated).

    To test the part studio I generated the max of 10 shelves, renaming them (Shelf1, Shelf2 ... Shelf10). 
    Then reduced the number to 2, (wiping out 8 shelves ). 
    Finally I set the control back to 10 again.
    When they all regenerated I was pleasantly surprised that Onshape remembered their names!

    Hopefully all other part meta-data would be remembered too? I will test that at some point.

    Neil, one day I might have a go at feature script, (I would really love to learn) but for now I'll keep it simple.

    Thanks Again.
  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,671
    One of the cool things about Onshape is that we open source our feature code. I copied the code for linear pattern and added this line at the top:
     if(definition.instanceCount == 1) return;
    Works like a charm if you want to use it.
    https://cad.onshape.com/documents/87a9311e82efb0e400844954/w/2ac11d504ee56cc35486f483/e/3ad2935735a046e7b8680829
    Senior Director, Technical Services, EMEAI
  • lucas_johnson223lucas_johnson223 Member, csevp Posts: 18 PRO
    Any chance this can get added to the standard linear array? Just trying to keep the number of extra FSs to access to a minimum.
    Thanks!
  • robert_stilesrobert_stiles Member Posts: 116 PRO
    @NeilCooke could I ask a quick question on this topic please....

    Not being able to supress a feature based on a logic expression is something that often causes problems for me. For example, I need to supress several features if a configuration parameter is an even number, or if its less than a given number. These must be relatively common problems for configuration users

    Now that Boolean tick boxes can be converted to an expression (which was a great recent improvement, thankyou), why not have an "convert suppression to an expression" option? currently I am cloning native features, adding a suppression Boolean, converting to an expression, and then putting the logic in there, but its crowding my tool bar to have all these feature scripts that are basically just copies of the native tools.

    Or put an on/off Boolean in every native feature !? (this would also allow users to potentially supress a feature in TWO configuration parameter tables, which I know can lead to configuration conflicts and could be seen as bad practice... but with careful use it can also be very powerful) 

    Thanks for your time.

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,671
    @robert_stiles totally agree and it is a highly requested feature.
    Senior Director, Technical Services, EMEAI
  • robert_stilesrobert_stiles Member Posts: 116 PRO
    @NeilCooke does this mean it might be coming? Please say yes. 
Sign In or Register to comment.