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

create line from dbpoints

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
gulzar25
446 Views, 2 Replies

create line from dbpoints

Hi,

How to create line from dbpoints?

2 REPLIES 2
Message 2 of 3
hgasty1001
in reply to: gulzar25

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

Message 3 of 3
gulzar25
in reply to: hgasty1001

HI,

Thanks a lot for the reply it worked.

 

Thankyou so much 🙂

Gulzar

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