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.

show/hide parts based on attributes

monroe_weber_shirkmonroe_weber_shirk Member Posts: 96 EDU
edited June 2023 in FeatureScript
I would like to show or hide parts based on attributes that are attached to each part. I can't find a show/hide property. NeilCooke said, "There is not"  [a way to access the show/hide command in FeatureScript.] I can make transparent all of the parts I want to hide.  The problem with this would be if the part isn't supposed to be completely opaque I would lose that setting and I don't have a way to get the original color of the part.

My question is whether transparency is the best approach for hiding objects in FeatureScript. Perhaps I am thinking about this the wrong way and there is a different approach. 


Tagged:

Comments

  • caden_armstrong2caden_armstrong2 Member, User Group Leader Posts: 127 ✭✭✭
    The reason you can't set a show/hide property is because there isn't one. The visibility of parts is based on the current user's view state (same with things like camera position), similar to how you can't "set the configuration".
    If you use the "generate link" button at the top left of the document page, you can see a url parameter for uistate, and if you change the visibility of a part, that uistate value changes. Theoretically the best you could do is share a link with someone that loads the document with certain parts hidden, but I've yet to figure out how the ui state value is actually generated.

    If you use transparency to show/hide parts, you'll run into the issue that only the faces are set. The edge of a part cannot be changed, so you'll still see all of the edges of the parts, which typically doesn't get you want you want to actually do.
  • S1monS1mon Member Posts: 2,964 PRO
    The weird thing about this is that hide/show is not just a temporary thing like isolate or make transparent. It affects all the people viewing the same workspace. It seems like there really should be a way to modify display states.
  • EvanReeseEvanReese Member, Mentor Posts: 2,120 ✭✭✭✭✭
    You can use Composite Parts to group things for hiding and showing. Keep the composite open so the parts are also fully useable in the normal way. Composites can even share parts. You could write a feature which assigns an attribute and makes a composite in one go, and even names the composite for the attribute. It's not exactly what you're after, I think, but it might get you somewhere.
    Evan Reese
  • monroe_weber_shirkmonroe_weber_shirk Member Posts: 96 EDU
    Thanks Evan! Composites were the different approach I was looking for. I've created the feature and now we have a much more intuitive way to hide subsets of parts. A demo is in this part studio.
  • EvanReeseEvanReese Member, Mentor Posts: 2,120 ✭✭✭✭✭
    great! I forgot to mention, you might also be able to set the composite to "Exclude from BoM" and "Not revision managed" in the feature so they don't accidentally end up in a document or release. Not sure if that's relevant to your use case.
    Evan Reese
Sign In or Register to comment.