Community
Hi, try this sub, it will create a line with default values (layer, line type, etc)
Private Sub AddLine(ByVal dbp1 As DBPoint, ByVal dbp2 As DBPoint) Dim doc As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument Dim db As Database = HostApplicationServices.WorkingDatabase() Using acTrans As Transaction = db.TransactionManager.StartTransaction() Dim acBlkTbl As BlockTable acBlkTbl = acTrans.GetObject(db.BlockTableId, OpenMode.ForRead) Dim acBlkTblRec As BlockTableRecord acBlkTblRec = acTrans.GetObject(acBlkTbl(BlockTableRecord.ModelSpace), OpenMode.ForWrite) Dim nl As New Line(dbp1.Position, dbp2.Position) acBlkTblRec.AppendEntity(nl) acTrans.AddNewlyCreatedDBObject(nl, True) acTrans.Commit() End Using End Sub
Gaston Nunez
Can't find what you're looking for? Ask the community or share your knowledge.