algorithmic modeling for Rhino
I'm ussing Reflector to view the code of your plugin and learn how some pieces are maked. I'm coding some custom components and I need good reference to learn.
I've seen that you use Grasshopper.Kernel.Types instead Rhino.Geometry. Why?
Is good to import Classes? I've seen that you have import Grasshopper.Kernel.Types. It's confortable not to write all name when you are coding but, could make your code runs slowly or take more memory to run properly?
That kind of objects have less properties than Rhino.Geometry., isn't it?
Other question is about getting data from inputs. I can't get working list in data input. I've post some question and code in VB and C# forum here: http://www.grasshopper3d.com/forum/topics/trying-to-get-this-code
I hope you could help me a little bit with this questions. Thank You in advance.
Best Regards.
Tags:
List used in data input is solved :) I was missing "GH_ParamAccess.list"
http://www.grasshopper3d.com/forum/topics/trying-to-get-this-code?p...
Hello Ángel,
I'm the coder behind the SPM Components, so I'll try and answer your questions as best as I can.
When I started learning how to create the GH components I used the GH types, and am most comfortable with those. All of the inputs into our components are GH types and then I just continue working with them from there. This is mostly just a matter of comfort and programmer choice.
Importing a namespace is done for ease of use and to keep the code clean:
'someFunction(List<GH_Point> points, List<GH_Vector> vectors)' is easier to read than
'someFunction(List<Grasshopper.Kernel.Types.GH_Point> points, List<Grasshopper.Kernel.Types.GH_Vector> vectors)'
It is also less typing :) Sometimes you may wish to not import a namespace to accent in the code that 'this particular object is not mine', or that its presence unusual. This is a matter of taste.
I'm happy to further answer any other questions you may have. Also, I'll take a look at your list question in the other thread now.
Cheers,
Chris
Really good explanation :) I understand.
The question about GH types is beacause I've seen that you have less methods to use with. Is not bad, but for me is better to keep all methods as posible working in the code (more easy handy tools, faster I code now I'm a beginer).
I understand that importing classes you must take care about your variables names (you cannot use curve if you import Rhino.Geometry because it overlaps the class).
Thanks for your great reply.
Best Regards.
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