Community
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<dungtdc> wrote in messageHow
href="news:6057997@discussion.autodesk.com">news:6057997@discussion.autodesk.com...
about polyline. I wrote some code like this:
Public Sub
AddPoly()
Dim ed As Editor =
Application.DocumentManager.MdiActiveDocument.Editor()
Dim pl As
Polyline
Dim DB As Database =
HostApplicationServices.WorkingDatabase()
Dim Trans As Transaction =
DB.TransactionManager.StartTransaction()
pl = New
Polyline(3)
pl.AddVertexAt(0, New Point2d(0, 0), 0, -1,
-1)
pl.AddVertexAt(1, New Point2d(10, 10), 0, -1, -1)
pl.AddVertexAt(2,
New Point2d(50, 20), 0, -1, -1)
Try
Dim Bt As BlockTable =
Trans.GetObject(DB.BlockTableId, OpenMode.ForRead)
Dim Btr As
BlockTableRecord = Trans.GetObject(Bt(BlockTableRecord.ModelSpace),
OpenMode.ForWrite)
Btr.AppendEntity(pl)
Trans.AddNewlyCreatedDBObject(pl,
True)
Trans.Commit()
Catch
MsgBox("Error Adding
Entities")
Finally
Trans.Dispose()
End Try
End If
End
Sub
any Comment or other better way to do this.
I have a polyline
with hundred of vertex like the contour in a map. Do I use a for...next to add
its step by step?.
for example in this case: I have an array like this:
arrvertex with value:(0,0,10,10,50,20...). Oh! I think it is slower than VBA.
In VBA we
do:
Thisdrawing.Modelspace.addlwpolyline(arrvertex)
and all is
done.
Do you think so? Edited by: dungtdc on Oct 23, 2008 8:32
PM