Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- 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.
Non linear pattern - featurescript needed?
frank_ring
Member Posts: 42 ✭✭
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?
0
Best Answers
-
NeilCooke Moderator, Onshape Employees Posts: 5,715See second video here https://forum.onshape.com/discussion/2675/improvements-to-onshape-february-11th-2016/p1Senior Director, Technical Services, EMEAI1
-
alnis Member, Developers Posts: 452 EDU@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!
Get in touch: contact@alnis.dev | My personal site: https://alnis.dev
@alnis is my personal account. @alnis_ptc is my official PTC account.0
Answers
- Define variable(s)
- Features depending on variable
- Update variable(s) as a function of their values
- 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:
@alnis is my personal account. @alnis_ptc is my official PTC account.
@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! Learn How to FeatureScript Here 🔴
Maybe you can explain it in this example.
@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!
@alnis is my personal account. @alnis_ptc is my official PTC account.