Grasshopper

algorithmic modeling for Rhino

It's a very basic question, I know VB and trying to switch to c#, and certain things don't work.

In this case this line of code

Int32[] t = M.Vertices(i).GetConnectedVertices(i);

keeps giving the following error

Rhino.geometry.mesh. vertices cannot be used like a method.

I've tried the equivalent in VB and it works, I wonder what exactly Im doing wrong.

Thanks for any help

Views: 1677

Replies to This Discussion

In VB parentheses can be used to access the members of an array like: Vertices(i)

but in C#, you need to use square brackets. Try:

int32[] t = M.Vertices[i].GetConnectedVertices(i);

Hi Nicolas,

The method int[] GetConnectedVertices( int vertexIndex ) is a member of MeshVertexList and not Point3f (Vertex Datatype) so you should use:

Int32[] t = M.Vertices.GetConnectedVertices(i);

 

If you want to access a method (e.g double DistanceTo(Point3f other)) or property of the Point3f then you have to do it with the square brackets like Andrew explained.

Cheers FF

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