Grasshopper

algorithmic modeling for Rhino

i.e. 

 

Dim m as new mesh

...

Dim fList as new List(of meshFace) 

fList.addrange(m.faces)

^^^^this works perfectly

but how to add edges, topology edges, vertices, topology vertices to any list without looping ? or what has to be written in list constructor ( of what ?)

When I create List(of point3d) and try to add vertices (m.vertices) I get casting error.

And yes, I know "m.vertices.topoint3darray", but is there any more elegant (like adding faces) way of creating lists ?

 

Views: 420

Replies to This Discussion

Mesh vertices are Point3f, not Point3d. Edges do not have a type associated with them, so you cannot create a list of MeshEdges, because MeshEdge doesn't exist. The same is true of TopologyVertices.

But I'm afraid the Mesh class is still somewhat cumbersome to work with.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

I think I read in some v5 release update that double precision meshes are now possible.

At least this code works:

 

    Dim m As New mesh

    Dim vertexlist As New list(Of point3d)

    vertexlist.add(New point3d(1, 0, 0))

    vertexlist.add(New point3d(0, 1, 0))

    vertexlist.add(New point3d(1, 1, 0))

 

     m.Vertices.AddVertices(vertexlist.toarray)

     m.Faces.AddFace(0, 1, 2)

    a = m

Thanks to both of you. 

David - I actually like to work with mesh class, but one thing makes me confused : Which should I operate on - topologyVertices or vertices. (as far as I know vertices and topologyVertices are differently ordered)

TopologyVertices are computed from the Vertices. You never create your own topological classes, they are created by Rhino.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

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