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.

designing feature-pattern compatible features

adamohernadamohern Member, OS Professional Posts: 216 PRO
I have a feature that creates a "board" (of wood) using any of a variety of input types. Think of it like the cPlane tool, which can be defined in a number of different ways. A board can be created along an edge, between vertices, starting from a vertex and pointing in an arbitrary direction, etc. There are options.

I also have a mortise and tenon feature. It is somewhat complex to set up, but much less so than creating and constraining the necessary sketches by hand. It requires three reference faces, and five dimensions. The result cuts both the mortise and tenon in a single feature.

Question: what best practices can I use to insure my features can be patterned?

In the above example, the boards are defined using static geometry, so feature-patterning them doesn't work. The mortise and tenon feature could, in theory, be feature-patterned, but since it relies on a body as an input, I'm not sure how that could work.

In my ideal workflow I could create a board, cut its mortises and tenons at either end, and then pattern it along the length of another board, each instance cutting both mortise and tenon properly along the way. My current setup can't do that.

One idea is to create a separate feature called something like "cross beam pattern." This single feature would both create the boards, mortises, and tenons using the end rail boards as inputs. This has advantages, but is in some ways less elegant (and flexible) than being able to use the built-in feature patterns in Onshape.

Any hints from the pros?

Comments

  • elifelif Onshape Employees Posts: 49
    While there are some special cases, basically any feature can be made "patternable" by doing two things.
    1. call a function that computes the transform that needs to be applied to the entities input to the feature. This needs to happen *before* the operation. The function is called "getRemainderPatternTransform". 
    2. call a function that applies this transform to the results *after* the operation. And this function is: "transformResultIfNecessary"

    A simple example can be found in sweep.fs:

         var remainingTransform = getRemainderPatternTransform(context,
                    {"references" : qUnion([definition.profiles, definition.path])});

          opSweep(context, id, definition);
          transformResultIfNecessary(context, id, remainingTransform);

    Let us know if this helps.



    Team Lead, Part Studios
  • adamohernadamohern Member, OS Professional Posts: 216 PRO
    Oh wow, I have no idea why that works... but it does. Thanks so much! :)
  • elifelif Onshape Employees Posts: 49
    Excellent! Glad it worked!
    Team Lead, Part Studios
  • adamohernadamohern Member, OS Professional Posts: 216 PRO
    That was incredibly easy. Blown away. SO GOOD.
Sign In or Register to comment.