TheSwamp

Code Red => .NET => Topic started by: sybold on August 09, 2013, 09:56:36 AM

Title: polyfacemesh
Post by: sybold 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
Title: Re: polyfacemesh
Post by: fixo 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
Title: Re: polyfacemesh
Post by: sybold 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