algorithmic modeling for Rhino
Hi,
I'm trying to learn how to write components inside grasshopper and I decided to write a small component that outputs a möbius strip surface. I have manage to output a list of points and I want to convert this to a surface through the Surface from Points command but I do not know where to find. I have tried looking in the Rhinocommon SDK and this forum but so far I had no luck.
Any ideas where this is located?
This is my code so far:
private void RunScript(double u, double v, double r, ref object A)
{
if (u == 0 || v == 0){
u = 100;
v = 100;
};
if (r == 0 ){
r = 1;
}
double uLowerLimit = 0;
double uUpperLimit = 2 * Math.PI;
double uStep = 2 / u * Math.PI;
double vLowerLimit = -1;
double vUpperLimit = 1;
double vStep = (2 / v);
List<Point3d> pts = new List<Point3d>();
for (double uu = uLowerLimit; uu <= uUpperLimit; uu += uStep){
for (double vv = vLowerLimit; vv <= vUpperLimit; vv += vStep){
double x = (r + (vv * Math.Cos(uu / 2))) * Math.Cos(uu);
double y = (r + (vv * Math.Cos(uu / 2))) * Math.Sin(uu);
double z = (vv) * Math.Sin(uu / 2);
pts.Add(new Point3d(x, y, z));
}
}
A = pts;
}
Tags:
Hi Miguel
have a look at the NurbsSurface.CreateFromPoints static method:
http://www.rhino3d.com/5/rhinocommon/html/M_Rhino_Geometry_NurbsSur...
A List<Point3d> is IEnumerable<Point3d>, so it is compatible.
I hope it helps,
- Giulio
_________________
giulio@mcneel.com
Hi Giulio
thanks for the quick reply. It did help.
Miguel
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by