Grasshopper

algorithmic modeling for Rhino

Hi all,

I want to check whether the geometry I am providing into the input of my component is ofType Rhino.Geometry.Point3d. I have done this lots of times in a scripted component and it works . However when in visual studio I get an error that GeometryBase can never be of type Point3d. 

Am I missing something obvious here? 

Should I instead of declaring my input as a geometryparameter to use for example a genericparameter. And what is my list going to be consisted of ( maybe System.Object???)

any thoughts on that?

VS 2010..

Best,

M.

Views: 863

Replies to This Discussion

well, 

I just solved my issue by using (of IGH_Goo) type and then converting everything to the actual rhinocommon geometry.

But is this a legit tactic?

M.

I am a beginner, and I want to know how to shift everything from the scripts to Visual studio and I dealt a lot with datatrees, could you give me more details on how to convert using IGH_Goo?

Thanks

Hi,

Use the Grasshopper.Kernel.GH_Convert methods as David suggests below.

Ta,

M

Point3d is a ValueType that does not implement GeometryBase. Rhino.Geometry.Point is the GeometryBase flavour of points in RhinoCommon.

Data in Grasshopper parameters is always wrapped up in IGH_Goo, but this data is stripped in VB/C# script components so that may be why you're confused.

The best way to convert data of unknown type to Point3d or GH_Point or something is to use the conversion methods in Grasshopper.Kernel.GH_Convert.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Yes,

Exactly as you say David. I checked if the geometry is of GH_Point type and then converted it using the GH_convert.toPoint3d method 

Works like a charm.

Thanks for your answer 

Best,

M.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service