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