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.
Trouble with successive opBoolean calls
daniel_cravens
Member Posts: 29 ✭
I am making a feature to cut dovetails into a part. I want to subtract the dovetail bodes from the female side and then union the dovetail to the male side. The following code *almost* works. I make two opBoolean calls -- one subtract and the other union. Either one works by themselves (i.e. if I comment one or the other) but this code does not execute with both opBoolean calls. There is no error. I'd appreciate any suggestions...
====================
annotation { "Feature Type Name" : "uiCutnJoin", "Feature Type Description" : "" }
====================
annotation { "Feature Type Name" : "uiCutnJoin", "Feature Type Description" : "" }
export const uiCutnJoin = defineFeature(function(context is Context, id is Id, definition is map)
precondition
{
annotation { "Name" : "Sketches", "Filter" : EntityType.FACE, "MaxNumberOfPicks" : 3 }
definition.sketches is Query;
annotation { "Name" : "Male Body", "Filter" : EntityType.BODY, "MaxNumberOfPicks" : 1 }
definition.maleBody is Query;
annotation { "Name" : "Female Body", "Filter" : EntityType.BODY, "MaxNumberOfPicks" : 1 }
definition.femaleBody is Query;
annotation { "Name" : "Terminal Face", "Filter" : EntityType.FACE, "MaxNumberOfPicks" : 1 }
definition.terminalFace is Query;
}
{
var sketchFace = qNthElement(definition.sketches, 0);
var terminalFace = qNthElement(definition.terminalFace, 0);
opExtrude(context, id + "extrudeDoveTails", {
"entities" : definition.sketches,
"endBound" : BoundingType.UP_TO_SURFACE,
"endBoundEntity" : terminalFace,
"direction" : evOwnerSketchPlane(context, {"entity" : sketchFace}).normal
});
var rails = qCreatedBy(id + "extrudeDoveTails", EntityType.BODY); // these are the dovetail bodies
opBoolean(context, id + "cutFemale", {
"tools" : rails,
"targets" : definition.femaleBody,
"operationType" : BooleanOperationType.SUBTRACTION
});
// The following wont work if the prior opBoolean executes, but does work if I comment out the prior opBoolean
opBoolean(context, id + "addMale", {
"tools" : qUnion(rails, definition.maleBody),
"operationType" : BooleanOperationType.UNION
});
});
0
Comments
There is also an existing box joint custom feature: https://cad.onshape.com/documents/57612867e4b018f59e4d52ce
https://cad.onshape.com/documents/4a05a3fe360ed36e462f3c76/w/88116110cd3e087d5b3fd67f/e/d239b905e8fcc80aa5a839f8
==========