algorithmic modeling for Rhino
Greetings,
I am working with Grasshopper and I am trying to make a script that creates a network surface and returns it to Grasshopper.
Marc Hoppermann made a similar one befor but it is outdated. http://www.grasshopper3d.com/forum/topics/network-surface
At the moment, I am working with C# and got some problems understanding the new SDK of Rhino.
My question would be:
Is there a way to change the “AddCurve” command in line 2 so that it returns a Curve (type)?
Or do I have to work with Guid and if yes, how can I select them and add them to a list?
1 foreach (Curve Crv in CrvList) {
2 Curve bakedCrv = doc.Objects.AddCurve(Crv);
//doc.Objects.AddCurve(Crv) returns type Guid, but I need type Curve
3 bakedCrv.Select();
4 ListOfCrv.Add(bakedCrv);
5 }
Thank you very much.
Max
Tags:
Hi Maximilian,
Can't help you with your current problem, but at the time when that topic was created (2009), there was no RhinoCommon method for creating a surface out of curves network. Since then, at some point it has been implemented:
There's a simplified version, and the one with control of curve parameters for both directions.
Sorry, Why do you want to bake anything?
Network surface is now in the sdk and as a component.
private void RunScript(List<Curve> C, ref object E, ref object S)
{
int error;
NurbsSurface Surf = NurbsSurface.CreateNetworkSurface((C), 1, RhinoDoc.ActiveDoc.ModelAbsoluteTolerance, RhinoDoc.ActiveDoc.ModelAbsoluteTolerance, RhinoDoc.ActiveDoc.ModelAngleToleranceDegrees, out error);
S = Surf;
switch (error)
{
case 1:
E = "Curve sorter failed";
break;
case 2:
E = "Network initializing failed";
break;
case 3:
E = "Failed to build surface";
break;
case 4:
E = "Network surface is not valid";
break;
default:
E = ":)";
break;
}
}
Thank you both very much for your help.
Honestly, I have a hard time to find anything on the SDK site. =(
But I am starting to understand the logic behind it. (Lerned C# two days ago.)
So yeah, I already crafted something nice for my tool. Thanks again and have a nice day.
Best regards
Max
Yeah, there's a learning curve... btw I hate c# if I were in your place I'd try python!
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