Grasshopper

algorithmic modeling for Rhino

I am trying to implement a component that combines the Mesh Decompose (mComp) and Vertices (Face Vertices) behaviour but I can't cast GH_MeshFace to MeshFace in order to access the indices A, B, C and D of each face. 

 

Is there a way to do this with my or other approach?

 

Thank you.

Views: 684

Replies to This Discussion

All GH_XXXX classes have a Value property that provides access to the wrapped data.

 

Dim mf As MeshFace = ghMeshFace.Value

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Awesome! Just starting to play with the SDK and also my C# foundations aren't so strong.

 

By the way, what is the difference between using Rhino.Geometry.MeshFace vs using Grasshopper.Kernel.Types.GH_MeshFace, or more in general, what is the difference between using GH_XXXX types and Rhino.Geometry types?

 

Thank you David.

 

 

GH_XXXX are not useful types for most developers. All they do is provide a set of functions that are not present on actual data but which are required by Grasshopper. These functions include ways to format the data, copy it, convert it to other types and so on and so forth.

 

You can usually ask for the encapsulated data type right away via DA.GetData / DA.GetDataList and the conversion will happen automatically.

 

For example

 

GH_Curve crv = null;

if (!Da.GetData(0, ref crv)) { return; }

 

is one way of accessing data, but I prefer you use

 

Rhino.Geometry.Curve crv = null;

if (!DA.GetData(0, ref crv)) { return; }

 

 

Of course if you're interested in the reference information as well, you'll have to retrieve GH_XXXX types as Rhino.Geometry.Curve does not maintain this information.

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Ah HA!

 

Rember when i said i had no idea how to use your types - now i understand the general idea for how, why and when. wow! 

Thank you David. As clear as always.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service