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.
How do I query an object after a boolean union?
monroe_weber_shirk
Member Posts: 103 EDU
I'm creating a feature that allows me to extend multiple walls up to a target height.
I see the advice to use startTracking and I've tried that, but no luck.
What am I missing?
Below is my code snippet and a link to the FeatureScript
- Select the top face of a wall element.
- opExtrude a calculated distance to create a new wall element.
- opBoolean union to join the two parts
- I need to select the part created with the opBoolean to modify its attributes.
I see the advice to use startTracking and I've tried that, but no luck.
What am I missing?
Below is my code snippet and a link to the FeatureScript
opExtrude(context, id + "extrude1", {
"entities" : entity,
"direction" : myMate.zAxis,
"endBound" : BoundingType.BLIND,
"endDepth" : extendedH,
});
const partsToBoolean = qUnion(qOriginalPart, qCreatedBy(id + "extrude1", EntityType.BODY));
var mergedPart = startTracking(context, partsToBoolean);
opBoolean(context, id + "boolean1", {
"tools" : partsToBoolean,
"operationType" : BooleanOperationType.UNION
});
debug(context, mergedPart, DebugColor.GREEN);
Tagged:
0
Best Answers
-
Have you tried makeRobustQuery() ?
Something like this perhaps:var partsToBoolean = qUnion(qOriginalPart, qCreatedBy(id + "extrude1", EntityType.BODY)); partsToBoolean = makeRobustQuery(context, partsToBoolean); opBoolean(context, id + "boolean1", { "tools" : partsToBoolean, "operationType" : BooleanOperationType.UNION }); debug(context, partsToBoolean, DebugColor.GREEN);
RENDERCAD
rendercad.ai - Photorealistic product rendering.
▚▞▚▞▚▞▚▞▚
________________________________________________________________________0 -
Here are the steps I take:- Select the code in FS and copy.
- Within the forum post, select the paragraph format "code".
- Paste the code into the code formatted area.
RENDERCAD
rendercad.ai - Photorealistic product rendering.
▚▞▚▞▚▞▚▞▚
________________________________________________________________________0
Answers
-
Have you tried makeRobustQuery() ?
Something like this perhaps:var partsToBoolean = qUnion(qOriginalPart, qCreatedBy(id + "extrude1", EntityType.BODY)); partsToBoolean = makeRobustQuery(context, partsToBoolean); opBoolean(context, id + "boolean1", { "tools" : partsToBoolean, "operationType" : BooleanOperationType.UNION }); debug(context, partsToBoolean, DebugColor.GREEN);
RENDERCAD
rendercad.ai - Photorealistic product rendering.
▚▞▚▞▚▞▚▞▚
________________________________________________________________________0 -
MichaelPascoe. This works like a charm. Quick question! How do you format your code in your forum response?1
-
Here are the steps I take:- Select the code in FS and copy.
- Within the forum post, select the paragraph format "code".
- Paste the code into the code formatted area.
RENDERCAD
rendercad.ai - Photorealistic product rendering.
▚▞▚▞▚▞▚▞▚
________________________________________________________________________0
