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.

querying faces made by opBoolean

EvanReeseEvanReese Member, Mentor Posts: 2,135 ✭✭✭✭✭
I don't think that opBoolean doesn't actually "creates" faces, but what's the best way to find the faces that an opBoolean used. In other words, if I cut a cylindrical hole with opBoolean, how can i query all of the faces of the cylinder? Better yet, how might I get a face query to persist after opBoolean? For example, I have an extrude and I only want the cap entities. It doesn't seem that i can query them after the body is used in opBoolean to subtract.
Evan Reese

Best Answer

  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    edited January 2022 Answer ✓
    Say if you have face created by opExtrude(context, extrudeId, ...) after it is created you can start tracking
    var capFacesTracking = startTracking(context, qCapEntity(...));
    then you performing operations and after each one tracking query should resolve to entities that are derived from entities you started tracking. That means that if you boolean subtract tool body created by extrudeId from target tracking query will resolve to face owned by the target which was imprinted from the tool cap. Sometimes you need to use startTracking() with map argument and set "trackPartialDependency" option to "true" and make sure that from the tracking query you filtered entities of a specific type owned by the specific body because in that case it can generally resolve to entities of multiple types.

Answers

  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    Tracking queries through boolean can be pretty tricky. You generally need to use makeRobustQuery(), if its a query like cap entity in boolean union operation. But if its subtracting you can either use qCreatedBy() or startTracking() tool body query before operation and it will resolve to imprinted entities on the target body. If its boolean intersection things can get even trickier, but makeRobustQuery of faces are generally pretty persistent.
  • EvanReeseEvanReese Member, Mentor Posts: 2,135 ✭✭✭✭✭
    @konstantin_shiriazdanov
    I've seen makeRobustQuery() mentioned but wasn't sure what it was for. Thanks!

    I tired it and I'm still not able to get this thing working, and maybe it's time to actually just share my code instead of asking my general questions. I'm working on a feature to convert holes into a droplet shape so they can be 3D printed without supports. I'm using opSplitByIsocline which gives me the right droplet angle for any hole based on its axis relative to the printer's Z direction (holes angled up at 45° don't need support, for example). Because I'm using that though, I'm building my droplet shape with 3 opExtrudes and 2 opFills. I want to track the opFill faces through the boolean which subtracts them from the main body. This is because there's an edge-case when the start or end faces of the hole tilt a certain way that creates a little sliver of material (see the orange highlighted face below). I want to use opDelete to clean these up when they show up. Here's my code. I'm sure there are lots of ways to improve the whole thing, but this is the last thing I want to solve before I release the feature for public use. Any ideas how to query that face after opBoolean(context, id + "cutDropletHoles"? Or maybe there's a better way to avoid them altogether.

    Evan Reese
  • EvanReeseEvanReese Member, Mentor Posts: 2,135 ✭✭✭✭✭
    I'm reading through the documentation on startTracking() and I can't understand whether it might be useful here either. Might that help?
    Evan Reese
  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    edited January 2022 Answer ✓
    Say if you have face created by opExtrude(context, extrudeId, ...) after it is created you can start tracking
    var capFacesTracking = startTracking(context, qCapEntity(...));
    then you performing operations and after each one tracking query should resolve to entities that are derived from entities you started tracking. That means that if you boolean subtract tool body created by extrudeId from target tracking query will resolve to face owned by the target which was imprinted from the tool cap. Sometimes you need to use startTracking() with map argument and set "trackPartialDependency" option to "true" and make sure that from the tracking query you filtered entities of a specific type owned by the specific body because in that case it can generally resolve to entities of multiple types.
  • EvanReeseEvanReese Member, Mentor Posts: 2,135 ✭✭✭✭✭
    Thanks, this is what I needed to use.
    Evan Reese
Sign In or Register to comment.