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.

"Flip Part on Plane" Custom FeatureScript

Trevor_JonesTrevor_Jones Member Posts: 4
Hi, all. I want to create a featurescript that flips a part on the plane of a sketch, but I don't know the best method. It seems like a fairly simple thing to do, I'm just new to coding and featurescripts.

To explain further, I'm trying to nest many different parts with pockets and holes onto 4x8' bounding box for CNC cutting with VisualCAMc (which does not have nesting capabilities). However, the "Auto Layout" featurescript I am using does not take pockets into consideration when nesting components, so some of the pockets face down, instead of upwards for milling. Another option would be to code this parameter into the existing "Auto Layout" featurescript, but unfortunately, I'm unfamiliar with coding and am limited in this regard.

Below is a screenshot of my parts, from the bottom. Any advice that could lead me in the right direction would be appreciated!


Answers

  • Trevor_JonesTrevor_Jones Member Posts: 4
    My first thought is to make a rule that creates a mirrored part (the mirror plane being the sketch plane) It then deletes the original part. Then it will move the mirrored part upwards, the value of which is driven by the thickness of the material, or the distance between the top and bottom faces of the part.

    If I could automate this process, perhaps I could include the code into the original. 
  • larry_haweslarry_hawes Member Posts: 478 PRO
    edited July 2019
    Can you extrude your original part symmetrically? Then mirror about that sketch plane with a new part, then delete/hide the original part?
  • Trevor_JonesTrevor_Jones Member Posts: 4
    I ended up using the transform tool to rotate and translate the objects to their original position, but flipped. I did this manually, without code. Which works for this file, but for my larger assemblies with hundreds of various parts to mill, a custom feature that does this for me would speed things up significantly. I guess I just need to suck it up and take the time to learn this coding language so I can create it myself. Ugh. 
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646
    @Trevor_Jones

    This should be a relatively easy feature to write.  The question is really how you want your user to define the flip.  The best I have come up with in my brainstorming is that the user should select a part and a linear edge, and the part will be rotated 180 degrees about that edge, and then shifted back to the same plane.

    If you think of a generic non-symmetric part (like any of the three in your screenshot) the result will be different if the part is rotated left to right vs top to bottom.  Is this an important consideration?  How do you want to control this?  Once questions like this are answered, we'd be happy to guide you through writing a feature, or even mock up a quick prototype :)
    Jake Rosenfeld - Modeling Team
Sign In or Register to comment.