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?

EvanReeseEvanReese Member, Mentor Posts: 2,135 ✭✭✭✭✭
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

Best Answer

  • _anton_anton Member, Onshape Employees Posts: 410
    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_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,212
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • _anton_anton Member, Onshape Employees Posts: 410
    Does the query you're passing resolve to a body? This should be working.
  • EvanReeseEvanReese Member, Mentor Posts: 2,135 ✭✭✭✭✭
    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
  • _anton_anton Member, Onshape Employees Posts: 410
    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);
  • EvanReeseEvanReese Member, Mentor Posts: 2,135 ✭✭✭✭✭
    I see. Thanks, thats a good solution.
    Evan Reese
Sign In or Register to comment.