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.
help using opBoolean
papawo
Member, Developers Posts: 206 PRO
where should i put the opBoolean so it subtract everytime it extrude?
----------------------
var i = 0;
----------------------
var i = 0;
for (var vertex in evaluateQuery(context, definition.locationsAH))
{
var point is Vector = evVertexPoint(context, {
"vertex" : vertex
});
var sketchNormal is Vector = evOwnerSketchPlane(context, {
"entity" : vertex
}).normal;
var sketchPlane is Plane = plane(point, sketchNormal);
var sketch = newSketchOnPlane(context, id + ("sketch" ~ i), {
"sketchPlane" : sketchPlane
});
skCircle(sketch, "circle", {
"center" : vector(0, 0) * inch,
"radius" : .25 * inch
});
skSolve(sketch);
opExtrude(context, id + "extrude1"+i, {
"entities" :qSketchRegion(id + ("sketch" ~ i), true),
"direction" : evOwnerSketchPlane(context, {"entity" : definition.locationsAH}).normal,
"endBound" : BoundingType.BLIND,
"endDepth" : 100 * inch
});
opBoolean(context, id + "boolean1"+i, {
"tools" : qCreatedBy(id + "extrude1"+i, EntityType.BODY),
"targets":definition.partToCutAH,
"operationType" : BooleanOperationType.SUBTRACTION
});
i += 1;
}
0
Comments
id+"extrude1"+0
id+"boolean1"+0
id+"extrude1"+1
id+"boolean1"+1
...
And the problem is that the id+"extrude1"+1 can't be used because the id+"extrude1" portion of the hierarchy has been closed. The fixed is to do id+i+"extrude1" and id+i+"boolean1" instead. That way the sequence is
id+0+"extrude1"
id+0+"boolean1"
id+1+"extrude1"
id+1+"boolean1"
...
and everything is happy.