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.

opBoolean targets from array of queries

graham_lockgraham_lock Member Posts: 142 PRO

Hi,

I have code of the form below.

A number of faces are selected, sketches are drawn on the first and last face and then a loft is executed between those sketch regions.

The lofted part then needs to cut through all bodies (start, all intermediate and end) which are owners of the selected faces.

I'm building an array of qOwnerBody(face) but qUnion in opBoolean fails when passing that array of bodies.

How should I actually go about gathering all of the owing bodies to be cut?

annotation { "Name" : "Faces", "Filter" : EntityType.FACE }
definition.faces is Query;

    opLoft(context, id + "loft1", {
                "profileSubqueries" : [qSketchRegion(id + "startSketch"), qSketchRegion(id + "endSketch")],
            });
            
    var bodies is array = [];
    
    for (var face in evaluateQuery(context, faces))
    {
        bodies = append(bodies, qOwnerBody(face));
    }
    
    opBoolean(context, id + "boolean1", {
                "tools" : qCreatedBy(id + "loft1", EntityType.BODY),
                "operationType" : BooleanOperationType.SUBTRACTION,
                "targets" : qUnion(bodies, qOwnerBody(anotherFace)),
                "keepTools" : true
            });

Any help appreciated.

Thank you.

Best Answer

  • graham_lockgraham_lock Member Posts: 142 PRO
    Answer ✓

    Just realised that qOwnerBody can take the faces query in my example so solved!

Answers

  • graham_lockgraham_lock Member Posts: 142 PRO
    Answer ✓

    Just realised that qOwnerBody can take the faces query in my example so solved!

Sign In or Register to comment.