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.
@opBoolean: BOOLEAN_SAME_INPUT error message
CAD_SSP
Member Posts: 45 ✭✭
I am trying to create 2 holes in the same body using an adaption of the featurescript from "Dowel and Minifix", I can create and subtract the first hole and create the cylinder for the second hole but when I try to subtract that I get the error "@opBoolean: BOOLEAN_SAME_INPUT".
My code is as follows:
My code is as follows:
<div> // Create Hole cylinder geometry
</div><div> fCylinder(context, id + THstr, { "bottomCenter" : THBot1, "topCenter" : THTop1, "radius" : TH_RADIUS });</div><div>
</div><div> // Subtract Hole Geometry from all other bodies to create holes.
</div><div> opBoolean(context, id + THbooleanstr, { tools : qCreatedBy(id + THstr, EntityType.BODY), targets : everythingelse, operationType : BooleanOperationType.SUBTRACTION });</div><div>
//Update ID Strings
</div><div> THstr ~= 1;
</div><div> THbooleanstr ~= 1;</div><div>
</div><div> // Create 2nd Hole cylinder geometry
</div><div> fCylinder(context, id + THstr, { "bottomCenter" : THBot2, "topCenter" : THTop2, "radius" : TH_RADIUS });</div><div>
</div><div> //Works fine up to this point
</div><div> // Subtract Hole Geometry from all other bodies to create holes.
</div><div> opBoolean(context, id + THbooleanstr, { tools : qCreatedBy(id + THstr, EntityType.BODY), targets : everythingelse, operationType : BooleanOperationType.SUBTRACTION });</div>I have tried googling the error but no results.
If there is a way to subtract multiple bodies that would be even more useful!
Thanks in advance for any help.
If there is a way to subtract multiple bodies that would be even more useful!
Thanks in advance for any help.
0
Best Answer
-
Without testing I don’t know what is causing the error, but you can use qUnion for the tools argument and subtract both in one operation.Senior Director, Technical Services, EMEA5
Answers
-
Without testing I don’t know what is causing the error, but you can use qUnion for the tools argument and subtract both in one operation.Senior Director, Technical Services, EMEA5
-
@NeilCooke found the error (soon as I clicked "Ask Question" I had a flash of inspiration but couldn't cancel the post)
"everythingelse" is created by subtracting a created hole cylinder from literally everything else so I had to update that to be the new hole cylinder I had just created and it worked fine.
added...everythingelse = qSubtraction(everythingelse, qCreatedBy(id + THstr, EntityType.BODY));
as follows:<div> // Create 2nd Hole cylinder geometry fCylinder(context, id + THstr, { "bottomCenter" : THBot2, "topCenter" : THTop2, "radius" : TH_RADIUS }); </div><div> //Update everythingelse everythingelse = qSubtraction(everythingelse, qCreatedBy(id + THstr, EntityType.BODY)); </div><div> </div><div> // Subtract Hole Geometry from all other bodies to create holes. opBoolean(context, id + THbooleanstr, { tools : qCreatedBy(id + THstr, EntityType.BODY), targets : everythingelse, operationType : BooleanOperationType.SUBTRACTION }); </div>
Your qUnion suggestion is a good one so will try that.0 -
Final solution in case anyone else has the same query:
<div> everythingelse = qSubtraction(everythingelse, qUnion([qCreatedBy(id + THstr, EntityType.BODY),qCreatedBy(id + THstr2, EntityType.BODY)])); <span style="background-color: transparent; color: inherit; font-size: inherit; font-family: Flama, sans-serif;"> // Create Hole cylinder geometry </span><span style="background-color: transparent; color: inherit; font-size: inherit; font-family: Flama, sans-serif;"> fCylinder(context, id + THstr, { </span><span style="background-color: transparent; color: inherit; font-size: inherit; font-family: Flama, sans-serif;"> "bottomCenter" : THBot1, </span><span style="background-color: transparent; color: inherit; font-size: inherit; font-family: Flama, sans-serif;"> "topCenter" : THTop1, </span><span style="background-color: transparent; color: inherit; font-size: inherit; font-family: Flama, sans-serif;"> "radius" : TH_RADIUS </span><span style="background-color: transparent; color: inherit; font-size: inherit; font-family: Flama, sans-serif;"> });</span></div><div><span style="background-color: transparent; color: inherit; font-size: inherit;"> <font face="Flama, sans-serif"> </font></span><span style="background-color: transparent; color: inherit; font-size: inherit; font-family: Flama, sans-serif;">// Create 2nd Hole cylinder geometry </span><span style="background-color: transparent; color: inherit; font-family: Flama, sans-serif; font-size: inherit;"> fCylinder(context, id + THstr2, { </span><span style="background-color: transparent; color: inherit; font-family: Flama, sans-serif; font-size: inherit;"> "bottomCenter" : THBot2, </span><span style="background-color: transparent; color: inherit; font-family: Flama, sans-serif; font-size: inherit;"> "topCenter" : THTop2, </span><span style="background-color: transparent; color: inherit; font-family: Flama, sans-serif; font-size: inherit;"> "radius" : TH_RADIUS </span><span style="background-color: transparent; color: inherit; font-family: Flama, sans-serif; font-size: inherit;"> }); </span><span style="background-color: transparent; color: inherit; font-family: Flama, sans-serif; font-size: inherit;"> // Subtract Hole Geometry from all other bodies to create holes. </span><span style="background-color: transparent; color: inherit; font-family: Flama, sans-serif; font-size: inherit;"> opBoolean(context, id + THbooleanstr, { </span><span style="background-color: transparent; color: inherit; font-family: Flama, sans-serif; font-size: inherit;"> tools : qUnion([qCreatedBy(id + THstr, EntityType.BODY),qCreatedBy(id + THstr2, EntityType.BODY)]), </span><span style="background-color: transparent; color: inherit; font-family: Flama, sans-serif; font-size: inherit;"> targets : everythingelse, </span><span style="background-color: transparent; color: inherit; font-family: Flama, sans-serif; font-size: inherit;"> operationType : BooleanOperationType.SUBTRACTION </span><span style="background-color: transparent; color: inherit; font-family: Flama, sans-serif; font-size: inherit;"> });</span></div>1 -
@keith_marsh looks great, although your first statement will do nothing since id + THstr and id + THstr2 do not exist yet
EDIT: correction - your code is fine since your first statement is just constructing the query not executing it (which is done in opBoolean). Sorry!
Senior Director, Technical Services, EMEA0

