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.

Options

Non linear pattern - featurescript needed?

frank_ringfrank_ring Member Posts: 35 ✭✭
I should generate a non-linear pattern where each distance is increased by a value (variable). E.g. first distance: 10 mm second distance 10+5, etc., where the "5" could be a variable. 
The result could look like this: 0 - 10 - 25 - 45 ....
Is there a featurescript which does the job?

Best Answers

Answers

  • Options
    mahirmahir Member, Developers Posts: 1,291 ✭✭✭✭✭
    There is Point Pattern. Drop sketch points in whatever random location you want patterned and feed the sketch into this FS. Parametric Sketch Pattern works similarly, but it will update the pattern when the driving sketch is updated.
  • Options
    alnisalnis Member, Developers Posts: 449 EDU
    You can pattern variables, so if you do something like:
    1. Define variable(s)
    2. Features depending on variable
    3. Update variable(s) as a function of their values
    4. Pattern features 2 and 3 with apply per instance enabled and zero distance
    You can get the result you want. Alternatively, if you want a math function, I'll often define a variable of the number type and increment it by 1 each "loop," then having variable values calculated from the input. Here's an example showing how to do it with a face, feature, and part pattern:
    https://cad.onshape.com/documents/b36835e0b8c5c0ae67603156/w/e055f55f4098317ec7891d23/e/af25df1e4390c6076a7062f8


    To quote Thanos:

    Student at University of Washington | Get in touch: contact@alnis.dev | My personal site: https://alnis.dev
  • Options
    MichaelPascoeMichaelPascoe Member Posts: 1,717 PRO
    edited May 2021
    How often would you need this feature?  If not very often, Mahir's solution is great. If you are doing this all the time, a custom feature could save lots of time.

    @alnis_smidchens - Genius 
    I did not know Onshape could do that!
     

    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   cadsharp.com/featurescripts 💎
  • Options
    frank_ringfrank_ring Member Posts: 35 ✭✭
    Thank you, that are very helpful tips!

    @alnis_smidchens - What is not clear to me is the process, how Onshape calculates the variables (circled in red) in the feature pattern.
    Maybe you can explain it in this example.






  • Options
    NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,395
    Answer ✓
    Senior Director, Technical Services, EMEAI
  • Options
    alnisalnis Member, Developers Posts: 449 EDU
    Answer ✓
    @NeilCooke great video!

    @frank_ring the short of it is that the second variable definitions are defined as #previous_value + some_number, so each time the feature is evaluated in the pattern, the variable is incremented. By including the variable update features in the pattern, the variables are changed on each "loop" through the previous features, driving the interesting spacing. Let me know if you'd like some more clarification!
    Student at University of Washington | Get in touch: contact@alnis.dev | My personal site: https://alnis.dev
  • Options
    frank_ringfrank_ring Member Posts: 35 ✭✭
    Now everything is clear - thank's a lot for your explanations  :)
Sign In or Register to comment.