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.
Is there a way to randomly instance parts over a surface?
ron_moreland
Member Posts: 90 ✭✭
I want to scatter spheres over a freeform surface. Is there a featurescript to do this?
0
Answers
We intentionally don't provide true randomness in FeatureScript. If we did, your spheres would regenerate in a different place every time and lots of downstream features would probably break due to references changing in unpredictable ways.
Instead, you can use this function that Ilya wrote:
https://forum.onshape.com/discussion/4086/pseudo-random-number-generator
It takes a "seed" that you could take as a parameter into your feature. That way, when you change the seed, the spheres change position, but every time it regenerates with the same seed, it regenerates the same way.