Query the target of an opBoolean subtract operation

martin_laabs
martin_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

  • mahir
    mahir Member, Developers Posts: 1,324 ✭✭✭✭✭
    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.
  • lana
    lana Onshape Employees Posts: 782 image
    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_laabs
    martin_laabs Member Posts: 6 ✭✭
    Thank you - this did the job.