Author Topic: polyfacemesh  (Read 1867 times)

0 Members and 1 Guest are viewing this topic.

sybold

  • Newt
  • Posts: 62
polyfacemesh
« on: August 09, 2013, 09:56:36 AM »
how do i get all the vertices from a polyfacemesh, is it even possible?
i found the method, GetEnumerator, but i'm not sure it will get me what i need.

this is what i was working with and doesn't work.

Code: [Select]
      Dim Entity1 As PolyFaceMesh = DirectCast(tr.GetObject(id1, OpenMode.ForRead), PolyFaceMesh)
                Dim pfmenum As IEnumerable(Of PolyFaceMeshVertex) = Entity1.GetEnumerator
                For Each Pfmv As PolyFaceMeshVertex In pfmenum
                    originalpnts.Add(Pfmv.Position)
                Next

fixo

  • Guest
Re: polyfacemesh
« Reply #1 on: August 09, 2013, 03:31:03 PM »
Try this code:
Code: [Select]
For Each pt As Point3d In pfMesh'<-- Entity1

Dim mvex As New PolyFaceMeshVertex(pt)

                                                  ed.Writeline(vbLf & "{0:f3}", pt)

Next

sybold

  • Newt
  • Posts: 62
Re: polyfacemesh
« Reply #2 on: August 10, 2013, 12:22:14 PM »
got it done this way

Code: [Select]
                Dim Entity1 As PolyFaceMesh = DirectCast(tr.GetObject(id1, OpenMode.ForRead), PolyFaceMesh)
                Dim vertices As New Point3dCollection()
                For Each id As ObjectId In Entity1
                    Dim obj As DBObject = tr.GetObject(id, OpenMode.ForRead)
                    If TypeOf obj Is PolyFaceMeshVertex Then
                        Dim vertex As PolyFaceMeshVertex = DirectCast(obj, PolyFaceMeshVertex)
                        vertices.Add(vertex.Position)
                    End If
                Next