Setting the Name Property on a Composite Part

ethan_keller924
ethan_keller924 Member, csevp Posts: 44 PRO
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

  • chadstoltzfus
    chadstoltzfus Member, Developers, csevp Posts: 175 PRO
    edited March 2024
    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
  • _anton
    _anton Member, Onshape Employees Posts: 555 image
    edited March 2024
    Was it set in the UI, perhaps? Edit: works for me.
  • ethan_keller924
    ethan_keller924 Member, csevp Posts: 44 PRO
    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:
  • _anton
    _anton Member, Onshape Employees Posts: 555 image
    Ach, yeah, a composite part does contain a vertex (implementation detail), which we should probably filter out of queries. Sorry about the non-obviousness.
  • ethan_keller924
    ethan_keller924 Member, csevp Posts: 44 PRO
    Yeah - filtering that out is a good idea. To conclude, that should be the resulting IR from this :smile: As always, thanks Anton!