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.

Query for disconnected components created by opBoolean

lemon1324lemon1324 Member, Developers Posts: 225 EDU
edited November 2017 in FeatureScript
Occasionally, doing a laser joint where three plates meet at a corner at non-right angles creates disconnected components like this (originally part of the light blue plate):


This bit is created when a boolean ends up also splitting a part.  I can't figure out how to query for this.  qCreatedBy doesn't work, since the body isn't "created" by the boolean, only the edges, which are then difficult to categorize.  I don't think qSplitBy would work as it's not an opSplit.  qEverything would only work if I assumed the only objects in the part studio were part of the joint, which is a terrible assumption (aside: what's a proper use of qEverything? It seems like all it does is create unnecessary possible dependencies where a more specific query could be constructed).

Assuming the disconnected bit is part of "definition.A" (a Query pointing to the light blue body), I noticed that qOwnerBody(qOwnedBy(definition.A)) returned two bodies in my MWE test document, but didn't work buried deeper inside my Laser Joint feature, where it only returned one body.  This query was placed immediately after the boolean in both cases.  The only difference I could tell was that in the working MWE, "definition" is actually the one built in the precondition, and in the non-working Laser Joint version was, effectively, "localDefinition.A" after assigning localDefinition.A = qNthElement(definition.parts, i) and passing localDefinition a few function calls deep.  Does qNthElement not necessarily return the same body if intervening non-body-creating operations happen?

The eventual goal is to detect the creation of disconnected components and warn the user or automatically delete small-enough bits and message the user.
Arul Suresh
PhD, Mechanical Engineering, Stanford University

Best Answers

Answers

  • lemon1324lemon1324 Member, Developers Posts: 225 EDU
    So qSubtraction(newSolidsQuery, initialSolidsQuery) always returns empty, since it looks like if I have a body A, and then split body A into A' (the one I want to keep) and B, evaluating the previously-saved query for A returns both bodies, A' and B.

    I ended up using qCreatedBy to find edges, finding the owner bodies, and then sorting by size to find which parts are unlikely to be relevant.
    Arul Suresh
    PhD, Mechanical Engineering, Stanford University
Sign In or Register to comment.