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.

Options

Setting the Name Property on a Composite Part

ethan_keller924ethan_keller924 Member, csevp Posts: 40 EDU
Perhaps this has come up before, but is there any fundamental reason I shouldn't be able to call setProperty for the name on a composite part? In other words, should I submit an IR to do so?

Comments

  • Options
    chadstoltzfuschadstoltzfus Member, Developers, csevp Posts: 133 PRO
    edited March 19
    Do you have a sample of your code to share? I've been able to do it before without issues.
    Applications Developer at Premier Custom Built
    chadstoltzfus@premiercb.com
  • Options
    _anton_anton Member, Onshape Employees Posts: 279
    edited March 19
    Was it set in the UI, perhaps? Edit: works for me.
  • Options
    ethan_keller924ethan_keller924 Member, csevp Posts: 40 EDU
    I think I figured out my mistake. I mistakenly assumed that `qCreatedBy(compositeId)->qBodyType(BodyType.COMPOSITE)` would result in a query that only returns bodies, but the resolved query included a vertex... So when I called `setProperty` on that query the error was thrown due to the vertex included. Changing to `qCreatedBy(compositeId, EntityType.BODY)->qBodyType(BodyType.COMPOSITE)` did the trick. Should have read the documentation for qBodyType better! Thanks for setting me straight :blush:
  • Options
    _anton_anton Member, Onshape Employees Posts: 279
    Ach, yeah, a composite part does contain a vertex (implementation detail), which we should probably filter out of queries. Sorry about the non-obviousness.
  • Options
    ethan_keller924ethan_keller924 Member, csevp Posts: 40 EDU
    Yeah - filtering that out is a good idea. To conclude, that should be the resulting IR from this :smile: As always, thanks Anton!
Sign In or Register to comment.