algorithmic modeling for Rhino
Hi,
I'm learning Python (stil beginning) and I tried to creat a network surface but I have the following error :
Runtime error (ArgumentTypeException): expected IEnumerable[Curve], got Guid
My code is simple :
srf = rh.Geometry.NurbsSurface.CreateNetworkSurface(Ucurves, 0, 0, Vcurves, 0, 0, 0.1, 0.1, 0.1, 0)
Curves are grouped in two "curve" components.
Regards,
Shimegi
Tags:
No one is able to help me there ?
You could use the Rhinoscriptsyntax function called "coercecurve" to get the curve object from a GUID.
Thank a lot, I'll give a try.
Hi, it doesn't work, it return the type of the curve. (ArcCurve), I'm still searching how to obtain this "IEnumerable[curve]" :)
Guess I didn't read your runtime error properly, apologies. As far as I can tell the "IEnumerable[curve]" is a .NET iterator of the type Curve. I.e. a container/list of curves which supports iteration. That said, I would expect the Python function to be able to input a regular Python list. Guess it could be a bug/not updated yet!
In fact, I think the matter come from the curves input. I made some tries and all I obtain in input is something like : 9982e6e5-0501-41a2-90e3-47cefb52f8e1
I have six curves of different types in one GH curve component. I eaded somewhere that connecting GH curves to a script component will automatically convert them into a rhino.geometry.curve but I'm still having only the GUID and I don't understand how to extract a rhino compliant geometry.
When I create a list from inputs I obtain a list of System.Guid. I successfully (I think ! It didn't return errors) created IEnumerated with :
curvelist = list.GetEnumerator(inputcurves)
but I still have an error like :
Unable to cast object of type 'System.Guid' to type 'Rhino.Geometry.Curve'
Learning is a long way to go ...
Haaaaaaa !!!!!!!! I got it. Thank to your first answer, I just have to use "coercecurve" on my list.
That's it :) I'll make some make up on my code and post a example for people which could have the same interrogations :)
Thanks a lot !
Cool, glad it worked out in the end. By the way, if you set "Type Hint" to "Curve" on the Python component input you don't have to coerce the curves. The component will automatically make the input of type "NurbsCurve". Good luck with the project :)
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
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by