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.

Options

How do I query an object after a boolean union?

I'm creating a feature that allows me to extend multiple walls up to a target height.
  1. Select the top face of a wall element.
  2. opExtrude a calculated distance to create a new wall element.
  3. opBoolean union to join the two parts
  4. I need to select the part created with the opBoolean to modify its attributes.

I see the advice to use startTracking and I've tried that, but no luck.

What am I missing?

Below is my code snippet and a link to the FeatureScript

      opExtrude(context, id + "extrude1", {
                            "entities" : entity,
                            "direction" : myMate.zAxis,
                            "endBound" : BoundingType.BLIND,
                            "endDepth" : extendedH,
                        });
                const partsToBoolean = qUnion(qOriginalPart, qCreatedBy(id + "extrude1", EntityType.BODY));

                var mergedPart = startTracking(context, partsToBoolean);
                opBoolean(context, id + "boolean1", {
                            "tools" : partsToBoolean,
                            "operationType" : BooleanOperationType.UNION
                        });

                debug(context, mergedPart, DebugColor.GREEN);

Best Answers

  • Options
    MichaelPascoeMichaelPascoe Member Posts: 1,718 PRO
    edited August 2023 Answer ✓

    Have you tried makeRobustQuery()  ?

    Something like this perhaps:
    var partsToBoolean = qUnion(qOriginalPart, qCreatedBy(id + "extrude1", EntityType.BODY));
                    
    partsToBoolean = makeRobustQuery(context, partsToBoolean);
    
    opBoolean(context, id + "boolean1", {
         "tools" : partsToBoolean,
         "operationType" : BooleanOperationType.UNION
         });
    
    debug(context, partsToBoolean, DebugColor.GREEN);


    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   cadsharp.com/featurescripts 💎
  • Options
    MichaelPascoeMichaelPascoe Member Posts: 1,718 PRO
    edited August 2023 Answer ✓

    Here are the steps I take:
    1. Select the code in FS and copy.
    2. Within the forum post, select the paragraph format "code".
    3. Paste the code into the code formatted area.
    It's very picky. If you mess the steps up, sometimes it corrupts the format and you have to delete everything and try again.


    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   cadsharp.com/featurescripts 💎

Answers

  • Options
    MichaelPascoeMichaelPascoe Member Posts: 1,718 PRO
    edited August 2023 Answer ✓

    Have you tried makeRobustQuery()  ?

    Something like this perhaps:
    var partsToBoolean = qUnion(qOriginalPart, qCreatedBy(id + "extrude1", EntityType.BODY));
                    
    partsToBoolean = makeRobustQuery(context, partsToBoolean);
    
    opBoolean(context, id + "boolean1", {
         "tools" : partsToBoolean,
         "operationType" : BooleanOperationType.UNION
         });
    
    debug(context, partsToBoolean, DebugColor.GREEN);


    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   cadsharp.com/featurescripts 💎
  • Options
    monroe_weber_shirkmonroe_weber_shirk Member Posts: 96 EDU
    MichaelPascoe. This works like a charm. Quick question! How do you format your code in your forum response?
  • Options
    MichaelPascoeMichaelPascoe Member Posts: 1,718 PRO
    edited August 2023 Answer ✓

    Here are the steps I take:
    1. Select the code in FS and copy.
    2. Within the forum post, select the paragraph format "code".
    3. Paste the code into the code formatted area.
    It's very picky. If you mess the steps up, sometimes it corrupts the format and you have to delete everything and try again.


    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   cadsharp.com/featurescripts 💎
Sign In or Register to comment.