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.

Hole to Slot (new featurescript)

jelte_steur814jelte_steur814 Member Posts: 291 PRO

Hi,

I often create slot holes based off the hole feature. I see questions about slot holes regularly so I figured it would be a good practice case for a new feature script.

So here goes. please let me know if you come across bugs, improvement possibilities and edge cases that aren't handled well.

hole to slot feature

Tagged:

Comments

  • eric_pestyeric_pesty Member Posts: 2,049 PRO

    That's a neat idea!
    Also means if you have a design with a hole you can convert it to a slot later without sketching.

  • S1monS1mon Member Posts: 3,188 PRO

    Very cool.

    It looks like "direction" doesn't support implicit mate connectors. Any reason not to have that option?

  • EvanReeseEvanReese Member, Mentor Posts: 2,269 ✭✭✭✭✭

    yes! I've wanted to make this but your implementation looks fantastic.

    Evan Reese
  • EvanReeseEvanReese Member, Mentor Posts: 2,269 ✭✭✭✭✭

    I agree with Simon about mate connectors being handy for the direction.

    It could also be nice to be able to pick multiple holes, at least for the straight option. It seems like just adding a forEachEntity() to the SLOT_TYPE.STRAIGHT would do it. You may wanna pre-process the selection so you don't get duplicate holes if there's more than one face picked in a hole. You could set up two hole face query params that look the same so the curved version can still be limited to 1 selection.

    (or you may not want to do this at all haha)

    Evan Reese
  • martin_kopplowmartin_kopplow Member Posts: 681 PRO

    Yes, great! I've been missing that one already. When I was working with Spaceclaim, they had a very similar one, and I used it a lot. You would just drag a hole along a curve and that simply created a slot.

    Thank you very much. Good job!

  • jelte_steur814jelte_steur814 Member Posts: 291 PRO
    edited February 7

    thanks for the feedback and suggestions.

    @S1mon, I was using the standard QueryFilterCompound.ALLOWS_DIRECTION, which doesn't include the mate connector, so I added that. It makes it a lot easier to create an angled slot, so it's a significant improvement.
    BTW I found that the accompanying 'extractDirection' immediately processed the mateconnector as expected.

    @ilya_baran: could the queryFilterCompound.ALLOWS_DIRECTION be updated to include bodytype.mateconnector?

    I also found out the underlying operations don't support active sheet metal parts, so I disabled selections there.

    so these are improvements included in V6


    @EvanReese Multiple holes is indeed a neat idea. the pre-processing and the forEachEntity will be bit more work though.

  • jelte_steur814jelte_steur814 Member Posts: 291 PRO

    @ilya_baran , @EvanReese . see post above. the @links stopped working halfway the post.

  • romeograhamromeograham Member, csevp Posts: 693 PRO

    I like this functionality too! I'll give it a try and provide feedback / comments as I run into things.

  • jelte_steur814jelte_steur814 Member Posts: 291 PRO

    Update:
    V8 allows multiple hole faces for the straight slots. Just make sure you only select one face for each hole.


    The disambiguation of multiple faces into one hole face to be processed is a challenge still ahead of me. Any suggestions how to approach that?

  • EvanReeseEvanReese Member, Mentor Posts: 2,269 ✭✭✭✭✭

    There may be a better way but a check could be isQueryEmpty(context, qSubtraction(q1, q2))

    You may need to first subtract the active query from the main query, then test this.

    Evan Reese
  • jelte_steur814jelte_steur814 Member Posts: 291 PRO
    edited February 7

    thanks @EvanReese. I figured it out. perhaps there's a smarter/quicker way, but this works:

    in V9 drag selection multiple faces for one hole can be selected so drag selection is enabled


  • EvanReeseEvanReese Member, Mentor Posts: 2,269 ✭✭✭✭✭

    nice!

    Evan Reese
Sign In or Register to comment.