Grasshopper

algorithmic modeling for Rhino

Here's a quick overview along with a link for download

http://python.rhino3d.com/entries/366-Python-component-for-Grasshopper

 

Thanks,

-Steve

Views: 2037

Replies to This Discussion

Hi Steve,

Nice work.  Looks really cool.  One quick question.  I just updated to the latest Rhino 5.0 Beta and your .gha file... and your icon for the Python component is missing.  As far as I can tell, it still works the same... just no icon.  Any ideas?  The reason I ask is that all of my Firefly icons for Rhino 5 are also missing.  The load perfectly in Rhino 4... just not in 5.  I have switched over to using: protected override Bitmap Icon method (instead of the previously used protected override Bitmap Internal_Icon_24x24)  Although the weird thing is that some of my other .gha libraries load just fine with icons (kangaroo).  Some of these are older installs so they probably haven't switched over to the new override method... but I was just curious if this was something that hadn't been implemented in Rhino 5 yet... or if I was doing something wrong.  Let me know if you have any ideas.

Cheers,

Andy

Thanks for the words of encouragement Andy!

 

That is strange that the icon is not being loaded. Rhino 5 does use .NET 4 so there are a few subtle differences over Rhino 4 which uses .NET 2.  Maybe the resource finder is not working quite as expected. Here's our code for displaying the Bitmap

https://github.com/mcneel/ghpython/blob/master/Component/PythonComp...

 

I am seeing the icon in both release and debug builds on my computer, so this is going to be difficult for me to repeat.

 

If you can repeat the icon missing bug in a debug build, try just making a bitmap on the fly by doing something like creating a new bitmap of the appropriate size and filling it with the color red. If you end up with a red square in Grasshopper, then at least we know the bug has something to do with extracting bitmaps from embedded resources in your gha.

 

Thanks,

-Steve

Hi Andy,

in Grasshopper 0.8.009, the Internal_Icon_24x24 property is obsolete.

Now, the property is simply called Icon. Can it be that in your Rhino 5 there is an older version of Gh loading?

- Giulio
_______________
giulio@mcneel.com
McNeel Europe

Great news Andy. Scott Davidson here in the office is able to repeat the icon bug on his computer. I'll run a few tests and let you know what I can figure out.

Thanks,

-Steve

Turns out Scott was just a slacker and wasn't using the latest and greatest version of Grasshopper. Once we updated his computer to Grasshopper 0.8.0010, the icon started showing up.

 

Are you a slacker too? :)

-Steve

Hi Steve, 

 

Thanks for sharing this Python Component. I just downloaded the file and try to compile it. After linking the libraries to my local files (GH_IO.dll , Grashopper.dll, RhinoCommon.dll). I got two errors saying Missing the reference for Extrusion (in the CustomTable.cs). Any idea how can I fix this?

 

Thanks, 

-javier

Hi Javier,

You need to reference the RhinoCommon that ships with Rhino5. This DLL is in the same directory as the Rhino 5 executable.

Thanks,

-Steve

When I try this in the wonderful component,


from Rhino.Geometry import Line,Point3d,Curve,NurbsCurve,Brep,LoftType
a=Brep.CreateFromLoft(Curve[x,y],Point3d.Unset,Point3d.Unset,LoftType.Normal,False)

There is a error message"Runtime error (ArgumentTypeException): expected Type, got NurbsCurveTraceback:
line 3, in , ""

Can anyone help?

Hi Bluelotus,

 

the second line should be:

a = Brep.CreateFromLoft([x, y], Point3d.Unset, Point3d.Unset, \
LoftType.Normal, False)

Python is dynamic, so you do not need to define the type of the list. Type[T1] has a special meaning in IronPython, but we do not need it. There are more notes in the file.

Hope it helps,

 

- Giulio
____________
giulio@mcneel.com
McNeel Europe

 

PS: Please also feel free to open new discussions!

Attachments:

Attachments:

Thanks,Giulio!But I got another question,sorry...I just change a little of one of the python script samples,but can get any result...

Can you help?

Attachments:

Nice setup, bluelotus,

but be careful with indenting, because the last line in the script is not running because it is inside the last function.

I changed the script a bit and made it usable both in the Python editor and in the component.

Please, if you have more questions about parametric function sampling, start a new discussion.

Hope it helps,

- Giulio

______________
giulio@mcneel.com
McNeel Europe

Attachments:

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service