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.

change composite part color with FS?

EvanReese
EvanReese Member, Mentor Posts: 3,059 PRO
I've tried setProperty() with the composite and it says only bodies and faces are allowed. I've tried qContainedInCompositeParts() to get the bodies inside of it, and it still doesn't do much. How do I change the color of a closed composite part?
Evan Reese
The Onsherpa | Reach peak Onshape productivity
www.theonsherpa.com

Best Answer

  • _anton
    _anton Member, Onshape Employees Posts: 550 image
    Answer ✓
    Because of the way it's implemented, the composite body contains a vertex. I'd get just the composite body like so:
    colorBodies = qCreatedBy(id + "compositePart1", EntityType.BODY);

Answers

  • ilya_baran
    ilya_baran Onshape Employees, Developers, HDM Posts: 1,273 image
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • _anton
    _anton Member, Onshape Employees Posts: 550 image
    Does the query you're passing resolve to a body? This should be working.
  • EvanReese
    EvanReese Member, Mentor Posts: 3,059 PRO
    hmm, for some reason the way I was querying my composite part also queried a vertex, which was failing setProperty(). Here's how i'm getting the query:
    colorBodies = qCreatedBy(id + "compositePart1");
    I was able to get it working like this, but where did the vertex come from? The only inputs to the composite part were 4 solid bodies.
    colorBodies = evaluateQuery(context, colorBodies)[1];

    Evan Reese
    The Onsherpa | Reach peak Onshape productivity
    www.theonsherpa.com
  • _anton
    _anton Member, Onshape Employees Posts: 550 image
    Answer ✓
    Because of the way it's implemented, the composite body contains a vertex. I'd get just the composite body like so:
    colorBodies = qCreatedBy(id + "compositePart1", EntityType.BODY);
  • EvanReese
    EvanReese Member, Mentor Posts: 3,059 PRO
    I see. Thanks, thats a good solution.
    Evan Reese
    The Onsherpa | Reach peak Onshape productivity
    www.theonsherpa.com