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
-
For the cut you need to include {"keepTools" : true} otherwise the tool body will be deleted.
There is also an existing box joint custom feature: https://cad.onshape.com/documents/57612867e4b018f59e4d52ceSenior Director, Technical Services, EMEA1 -
Yes, thank you. That was the problem!0
-
My feature is for a butt joint with an aim at splitting, printing, and then joining parts too large to 3d print.

0 -
My feature works as expected on some faces (as in the picture above), but opextrusion fails if I use it on other faces of the model. I'm at a loss. I'd really appreciate any advice as to how to troubleshoot this error. The notices and code are below. I apologize for such a large post but I'm not sure what information folks need to offer advice.
https://cad.onshape.com/documents/4a05a3fe360ed36e462f3c76/w/88116110cd3e087d5b3fd67f/e/d239b905e8fcc80aa5a839f8Part Studio 1@opExtrude: EXTRUDE_FAILED575:12 onshape/std/geomOperations.fs (const opExtrude)201:9 Feature Studio 1 (const uiCutnJoin)56:17 onshape/std/feature.fs (defineFeature)Part Studio 1Part Studio 1debug: Direction (-0, -0, -1) Result: Regeneration complete
==========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;annotation { "Name" : "Variance" }isLength(definition.variance, LENGTH_BOUNDS);}{var sketchFace = qNthElement(definition.sketches, 0);var terminalFace = qNthElement(definition.terminalFace, 0);var extrudeDirection = -1*evOwnerSketchPlane(context, {"entity" : sketchFace}).normal; // I expected this vector to point into the model all of the timedebug(context,extrudeDirection ); // this seems wrong because I would have thoughtopExtrude(context, id + "extrudeDoveTails", {"entities" : definition.sketches,"endBound" : BoundingType.UP_TO_SURFACE, // I've also tried UP_TO_FACE and UP_TO_NEXT with same results"endBoundEntity" : terminalFace, // I remove this when I use UP_TO_NEXT"direction" : extrudeDirection // I've tried flipping the direction by multiplying by -1});});
0 -
Two problems - terminalFace needs to be bigger than the sketches you are extruding - your selection is only half the size so it "falls off the end", and the extrude direction is wrong.Senior Director, Technical Services, EMEA1

