.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Coordinates on a Polyline

2 REPLIES 2
Reply
Message 1 of 3
Jozi68
316 Views, 2 Replies

Coordinates on a Polyline

Hi All,
For a given X value, how can I find the corresponding Y values on a selected Polyline? Or maybe just a list of coordinates of vertexes in the correct order?
regards,
Jozi68
2 REPLIES 2
Message 2 of 3
norman.yuan
in reply to: Jozi68

You can create a Line start at x,0 and to x,anyY (that is a vertical line), then use IntersactWith() to find the intersection point of the line and the polyline, thus the y coordinate of the intersection point is what you are looking for.
Message 3 of 3
danny.boy.1
in reply to: Jozi68

If polyline is type lwpolyline or polyline

{code}

Dim Coords As Point3dCollection = New Point3dCollection

For i as integer = 1 To SelPoly.NumberOfVertices

Coords.Add(SelPoly.GetPoint3dAt(i - 1))

Next i


{code}



If selected poylline is poyliline2d then

{code}


Dim Coords As Point3dCollection = New Point3dCollection

For Each vId As DatabaseServices.ObjectId In SelPoly2d

Dim v2d As DatabaseServices.Vertex2d = DirectCast(myTrans.GetObject(vId, DatabaseServices.OpenMode.ForRead), DatabaseServices.Vertex2d)

Coords.Add(CType(v2d.Position, Point3d))

Next

{code}

Now you can easy get every vertex in drawing order at integer parametar i.

xi = Coords(i).x
yi = Coords(i).y
zi = Coords(i).z

i=0 to Coords.count-1

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost