i used .net selection and selected a few polylines in modelspace. but i need to convert it to acadobject lwpolyline or 2 whatever in order to feed it to civil 3d volume surface boundary but that's another story i am not quite there yet. just having trouble getting the polyline acadobject. there is one website showed up on google but company blocked it.
originally i just use the
ob = oAcadDB.ObjectIdToObject(prEntityRes.ObjectId.OldIdPtr)
then used the ctype lwpolyline but didn't work.
which worked for my other objects like points. guess i haven't tried polylines yet.
then i used this:
Private Sub btnSelPoly_Click(sender As System.Object, e As System.EventArgs) Handles btnSelPoly.Click Dim ed As Editor = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor Dim prSelectionOptions As PromptSelectionOptions = New PromptSelectionOptions Dim prSelectionRes As PromptSelectionResult = ed.GetSelection(prSelectionOptions) If prSelectionRes.Status = PromptStatus.Error Then Me.Show() Exit Sub Else Dim acDoc As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument Dim acCurDb As Database = acDoc.Database Using lock As DocumentLock = acDoc.LockDocument Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction() Dim acDocEd As Editor = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor Dim acBlkTbl As BlockTable acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId, OpenMode.ForRead) Dim obj As DBObject If prSelectionRes.Value.Count <> 0 Then lvwPolyline.Items.Clear() For i As Integer = 0 To prSelectionRes.Value.Count - 1 obj = acTrans.GetObject(prSelectionRes.Value.Item(i).ObjectId, OpenMode.ForWrite) If TypeOf obj Is Polyline Then Dim oPolylineNet As Polyline = CType(obj, Polyline) Dim oPolyline As AcadPolyline = oPolylineNet.AcadObject Dim lvwItem As ListViewItem = lvwPolyline.Items.Add(oPolyline.ObjectID) lvwItem.SubItems.Add(oPolyline.Layer) lvwItem.Tag = oPolyline End If Next End If acTrans.Commit() End Using End Using End If End Sub
and still something with the object type
ah never mind. this worked fine. maybe i had a typo when typing acadlwpolyline into acadpolyine.
For i AsInteger = 0 To prSelectionRes.Value.Count - 1
obj = oAeccDb.ObjectIdToObject(prSelectionRes.Value.Item(i).ObjectId.OldIdPtr)
Dim oPolyline AsAcadLWPolyline = CType(obj, AcadLWPolyline)
MsgBox(oPolyline.Coordinate(0).ToString)
Next
Can't find what you're looking for? Ask the community or share your knowledge.