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.

Evenly Spaced Points on Sphere / Fibonacci Lattice

peter_1776peter_1776 Member Posts: 6
First off: I understand I can do something similar using patterns, but that is not my goal

Apparently it is not possible to get perfect spacing of points on a sphere (with a few exceptions). While mathematicians may be distraught over this, engineers can use Fibonacci Lattice to accomplish a 'close-enough' result. I would like to have this function available. The code for creating the 3D points is rather simple, but I don't know enough about Onshape internals (nor programming for that matter) to do this on my own.
I believe I can code the creation of a matrix of 3d points in FS, but that's all at this point. What are the steps to make this happen?
This is my guess:
1) Input sphere diameter, boolean body diameter (sphere for now), number of instances, boolean operation (add/subtract)
2) Generate sphere of variable diameter
3) Generate body to boolean pattern
4) Create 3D matrix of points
*At this point, a similar FS (SurfacePattern) seems to do planes and normals, which I'm not sure whether it's necessary.
*I also am not clear if calculations should be in radians or degrees, though I can play with that
5) Pattern boolean body at each 3D point
6) Perform boolean operation for bodies

Appreciate any feedback or direction on this.

Comments

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 2,712
    That sounds perfectly reasonable and not too difficult. There are plenty of people on this forum that would be glad to help! You don't have to physically create the 3D points, just the transformations (then use opPattern). For the calculations, you can specify if it is degree or radian.
  • peter_1776peter_1776 Member Posts: 6
    Thanks for the feedback! It helped me get from point A to B. 

    I've got patterning done, it seems correctly, but I need to shift the origin of the pattern to a selected mateConnector. I know how to select it, but I am not clear how shift it. 
  • mahirmahir Member, Developers Posts: 880 ✭✭✭✭
    edited December 2019
    If it helps my Parametric Curve FS can be used to generate a curve on a sphere. That curve can then be used with the Curve Pattern feature to generate bodies along the curve. It won't be exact, but it's close to an out of the box solution using already completed features and FS.

  • peter_1776peter_1776 Member Posts: 6
    Thanks Mahir! I will probably find a use for that in a different project. The key point about the Fibonacci Lattice is that the points get spaced as evenly as is possible. The curve pattern won't space evenly over the sphere, only evenly along the curve.

    I figured out a way to accomplish my previous 'shift' (transform) issue. Probably not the best, but it works.

    A new issue: I can't find documentation on creating a random variable/constant. I came across a rather complicated FS that does it, but surely there is a random number generator?
  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 2,712
    Thanks Mahir! I will probably find a use for that in a different project. The key point about the Fibonacci Lattice is that the points get spaced as evenly as is possible. The curve pattern won't space evenly over the sphere, only evenly along the curve.

    I figured out a way to accomplish my previous 'shift' (transform) issue. Probably not the best, but it works.

    A new issue: I can't find documentation on creating a random variable/constant. I came across a rather complicated FS that does it, but surely there is a random number generator?
    No, there is no random number generator, nor can you access any data that might change over time, like date/time. This is done on purpose so that the feature regenerates the same way every time - imagine if your points moved every time you rebuilt the model - chaos. The FS creates a pseudo-random number, but it will be the same every time it rgenerates.
  • john_mcclaryjohn_mcclary Member, Developers Posts: 2,323 PRO
    NeilCooke said:
    Thanks Mahir! I will probably find a use for that in a different project. The key point about the Fibonacci Lattice is that the points get spaced as evenly as is possible. The curve pattern won't space evenly over the sphere, only evenly along the curve.

    I figured out a way to accomplish my previous 'shift' (transform) issue. Probably not the best, but it works.

    A new issue: I can't find documentation on creating a random variable/constant. I came across a rather complicated FS that does it, but surely there is a random number generator?
    No, there is no random number generator, nor can you access any data that might change over time, like date/time. This is done on purpose so that the feature regenerates the same way every time - imagine if your points moved every time you rebuilt the model - chaos. The FS creates a pseudo-random number, but it will be the same every time it rgenerates.

Sign In or Register to comment.