Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. 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.

Query the target of an opBoolean subtract operation

martin_laabsmartin_laabs Member Posts: 6 ✭✭
Hi,

I have the following code in my FS:

            opBoolean(context, id + "booleanInset", {
                            "tools" : qCreatedBy(id + "extrudeInset", EntityType.BODY),
                            "targets" : mortiseBody,
                            "operationType" : BooleanOperationType.SUBTRACTION,
                            "targetsAndToolsNeedGrouping": true,
                            "keepTools" : false
                        });

Obviously the mortiseBody variable contains a query to the target. However - the query is not valid
after the subtraction as the edge used for that query does not exist anymore after the subtraction.
Unfortunately I need a query to the modified object for further processing. 

Is there is a standard way to obtain a query to the modified part by the opBoolean operation? I could
try to build something around the tool object but matching faces and or vertices of that will introduce
some ambiguities as there are many parts with shared faces nearby. 

Thank you,
 Martin

Comments

  • mahirmahir Member, Developers Posts: 1,291 ✭✭✭✭✭
    edited May 2020
    Try using:
     qCreatedBy( id + "booleanInset", EntityType.BODY )
    This queries all bodies that were created by your opBoolean operation (which you gave the Id of 'id + "booleanInset"'. Keep in mind, if the subtraction yields more than one body, then so will this query.
  • lanalana Onshape Employees Posts: 689
    You can assign 
     mortiseBody = qUnion(evaluateQuery(context, mortiseBody)); 

    Before the opBoolean call. That query should resolve to the target body after the operation as well

  • martin_laabsmartin_laabs Member Posts: 6 ✭✭
    Thank you - this did the job.
Sign In or Register to comment.