Can I make my feature error out if the tools and targets do not intersect for a boolean subtract?

RhettRobinson
RhettRobinson Member Posts: 250 ✭✭✭✭

I basically want this message to be generated as well as my feature to error out if the boolean subtract does not create a change in geometry.

image.png

Here is what I have so far, but I am not sure if this is the right way to go about it. The standard boolean feature will show this error message but still complete (no red in the tree), but I'm wondering if I could make that happen too. Otherwise the message will suffice.

image.png

Best Answer

  • Caden_Armstrong
    Caden_Armstrong Member Posts: 472 PRO
    edited December 2024 Answer ✓

    You could just check if any geometry has been created by the operation.

            if(isQueryEmpty(context, qCreatedBy(id + "boolean1")))
            {
                reportFeatureWarning(context, id, "NON-INTERSECT");   
            }
    
    www.smartbenchsoftware.com --- Renaissance --- Kestrel -- SmartLink
    Experts in Onshape Automation - Custom Features and Integrated Applications

Answers