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..

Alexei_PittowiczAlexei_Pittowicz Member Posts: 37 PRO

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)


Grateful for any tips.


  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 2,708
    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.
  • owen_sparksowen_sparks Member, Developers Posts: 2,571 PRO
    Neil beat me to it, I'd let it fail for now but agree that it doesn't feel right.
    Production Engineer
    HWM-Water Ltd
  • AlexPittAlexPitt Member Posts: 4 PRO
    @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: 2,708
    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.
Sign In or Register to comment.