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.

FS query circular edge on face

imants_smidchensimants_smidchens Member Posts: 42 EDU
Hi! I'm relatively new to featurescript, and I'm wondering if there's a way to query an interior circular edge (or ideally an edge loop) on selected faces (plus also the outer loop of edges on that face). I'm writing a tool that makes 3D printing some geometry more reliable, namely counter-bored or pocketed holes that would normally necessitate printing with supports. The idea is to modify those faces into bridging layers that set up the structure for the part and result in cleaner prints. Below are two images showing what the tool would ideally accomplish in terms of modifying faces:

Thanks!

Comments

  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,017 EDU
    edited March 15
    Maybe something using connectedComponents (Standard Library Documentation (onshape.com)) to get the edge loops, and then filtering specific edge loops?

    You should be able to use qLoopEdges (Standard Library Documentation (onshape.com)) to get the outside edge loop.
    mb - draughtsman - also FS author: View FeatureScripts
  • imants_smidchensimants_smidchens Member Posts: 42 EDU
    I ended up doing something a little different: since the center hole is always a circle, I can do an opExtrude on the input face, then query the smallest cylindrical face of the extruded part in order to get the hole diameter. Instead of projecting the outer edges into a sketch, I can then just perform opSplits on the input face with planes (that automatically extend to the edges of the face.

    feature publication coming soon!
  • Evan_ReeseEvan_Reese Member Posts: 1,474 PRO
    great! I've been wanting to add that functionality to my Bridge Layer feature, which does it the easier, but less cool way that requires a tiny bit of cleanup. For yours you'd have to probably specify layer height, and a direction to figure out which way it needs to orient on any given layer. I like your solution of just splitting the faces and moving them.

    Evan Reese / Principal and Industrial Designer with Ovyl
    Website: ovyl.io
  • Evan_ReeseEvan_Reese Member Posts: 1,474 PRO
    Sounds like you've already found a way to do it, but I think you could also query all of the edges belonging to a face, then iterate over them in a loop checking if they are a circle or not (curveType.CIRCLE). If they are, append them to a list.

    Here's a half-baked take on it: 
    https://cad.onshape.com/documents/23ce61a31395b69120620049/w/bc63ba8571a32109da058ecd/e/ac2ee1c7f7491682d431597e
    Evan Reese / Principal and Industrial Designer with Ovyl
    Website: ovyl.io
  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,017 EDU
    Sounds like you've already found a way to do it, but I think you could also query all of the edges belonging to a face, then iterate over them in a loop checking if they are a circle or not (curveType.CIRCLE). If they are, append them to a list.

    Here's a half-baked take on it: 
    https://cad.onshape.com/documents/23ce61a31395b69120620049/w/bc63ba8571a32109da058ecd/e/ac2ee1c7f7491682d431597e
    You should actually also be able to use qGeometry(GeometryType.CIRCLE) and filter the query before evaluating it. (It should also be a little faster)
    mb - draughtsman - also FS author: View FeatureScripts
  • Evan_ReeseEvan_Reese Member Posts: 1,474 PRO
    @MBartlett21
    I hope you're always active on the forums! I learn so much.
    Evan Reese / Principal and Industrial Designer with Ovyl
    Website: ovyl.io
Sign In or Register to comment.