Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- 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.
Get remaining part after opBoolean union
This seems like it should be trivial, but I'm stumped: When I perform an opBoolean to merge a set of parts together into a single part, I can't figure out how to directly query the resulting part. As a work around, I use qNthElement to extract the first part out of the tools query prior to executing opBoolean, as that part is the resulting part. This works, but it seems very hacky. Any better ideas?
Here's a code excerpt demonstrating what I'm asking:
qParts = qUnion(qParts1, qParts2); // Get the first element from qParts, as it will be the part into which opBoolean merges all the other parts qfinalPart = qNthElement(qBaseParts, 0); opBoolean(context, id + "boolean1", { "tools" : qBaseParts, "operationType" : BooleanOperationType.UNION }); setProperty(context, { "entities" : qFinalPart, "propertyType" : PropertyType.NAME, "value" : "Final Part" });
In short: How do I determine qFinalPart from the opBoolean operation rather than having to infer it in advance using qNthElement?
Comments
For Union it is always the first part, so you could just use qParts1 ?
Ya, that's a little syntactically easier. I guess I'm surprised that you can't get the unified part from opBoolean itself.
If the first part was created by an extrude I usually use qCreatedBy(id + "extrude", EntityType.BODY)