.NET

Reply
Active Member
emilg
Posts: 6
Registered: ‎09-18-2005
Message 1 of 3 (252 Views)

some questions about Polyline and Polyline3d

252 Views, 2 Replies
09-24-2005 10:23 PM
I have some questions about Polyline and Polyline3d.

1. How to get Start/End point?
According to HELP I may Get and SET Start/End point from Curve class. Bat in fact I succeed only in Get, but not to Set. Duos it bug in wrappers?
2. How I Get number of vertices for Polyline3d (I tried to fined something like NumberOfVertices for Polyline)
3. How I can iterate throw vertices of Polyline3d from last vertex to first (I found GetEnumerator() and MoveNext(), but only in direction from start to end, But I need reverse from end to start).

Thank you for any help, source examples or references.
Emil
Member
hguerrero
Posts: 4
Registered: ‎09-05-2005
Message 2 of 3 (251 Views)

Re: some questions about Polyline and Polyline3d

09-25-2005 08:07 PM in reply to: emilg
Try some of these:

plent = (ent)Polyline;
plent.EndParam();
plent.NumberOfVertices();
plent.GetDistanceAtParameter()

I think they will help.

Hugo
Distinguished Contributor
ChrisArps
Posts: 311
Registered: ‎07-29-2004
Message 3 of 3 (252 Views)

Re: some questions about Polyline and Polyline3d

09-26-2005 11:25 AM in reply to: emilg
Try this, it works for me.

Public Shared Sub TestPline3d()
Dim editor As Editor = Application.DocumentManager.MdiActiveDocument.Editor
Dim db As Database = Application.DocumentManager.MdiActiveDocument.Database
Dim trans As Transaction = db.TransactionManager.StartTransaction()

Try
Dim prEnt As New PromptEntityOptions("Select a 3d polyline:")
Dim prEntRes As PromptEntityResult = editor.GetEntity(prEnt)
If prEntRes.Status <> PromptStatus.OK Then Return

Dim id As ObjectId = prEntRes.ObjectId
' get input polyline
Dim ent As Entity = DirectCast(trans.GetObject(id, OpenMode.ForRead), Entity)
Dim pl As Polyline3d = DirectCast(ent, Polyline3d)
Dim c As Curve = DirectCast(pl, Curve)

' the magic trick is first line segment on 3dpoly is 0.0 to 1.0,
' 2nd line seg is 1.0 to 2.0, rinse and repeat
Dim sp As Double = c.StartParam
Dim ep As Double = c.EndParam
Dim outPts As String
Dim p As Double

For p = sp To ep Step 1.0
Dim pt As Point3d = c.GetPointAtParameter(p)
outPts &= String.Format(" {0},{1},{2} ", pt.X, pt.Y, pt.Z) & vbCrLf
Next

MsgBox(outPts)


trans.Commit()
Catch ex As Exception
trans.Abort()
MsgBox(ex.Message)
Finally
trans.Dispose()
End Try

End Sub

You cannot set information using the curve interface, it looks like you will have to define a new Polyline3d and add it to the database instead.



Chris Arps Message was edited by: CArps

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community