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

Rubber Band Line

2 REPLIES 2
Reply
Message 1 of 3
Mikko
385 Views, 2 Replies

Rubber Band Line

Dim PtOne As PromptPointResult = ed.GetPoint("Start Point: ")
Dim PtTwo As PromptPointResult = ed.GetPoint("End Point: ")
Dim line As New Line(PtOne.Value, PtTwo.Value)
Dim bt As BlockTable = CType(tm.GetObject(db.BlockTableId, OpenMode.ForRead, False), BlockTable)
Dim btr As BlockTableRecord = CType(tm.GetObject(bt(BlockTableRecord.ModelSpace), OpenMode.ForWrite, False), BlockTableRecord)
btr.AppendEntity(line)
tm.AddNewlyCreatedDBObject(line, True)
myT.Commit()

How do you get that rubber-band line from the first selected point to the second point?
Can you?
2 REPLIES 2
Message 2 of 3
KrishnaK
in reply to: Mikko

You must use the base point when prompting to get the rubber band line. See below:

Dim tr As Transaction = Application.DocumentManager.MdiActiveDocument.TransactionManager.StartTransaction
Dim db As Database = HostApplicationServices.WorkingDatabase
Dim pt1 As New PromptPointOptions("Enter start point")
Dim pt2 As New PromptPointOptions("Enter end point")

Dim pt1Res As PromptPointResult = Ed.GetPoint(pt1)
pt2.BasePoint = pt1Res.Value
pt2.UseBasePoint = True
Dim pt2Res As PromptPointResult = Ed.GetPoint(pt2)

Dim line As New Line(pt1Res.Value, pt2Res.Value)
Dim bt As BlockTable = CType(tr.GetObject(db.BlockTableId, OpenMode.ForRead, False), BlockTable)
Dim btr As BlockTableRecord = CType(tr.GetObject(bt(BlockTableRecord.ModelSpace), OpenMode.ForWrite, False), BlockTableRecord)
btr.AppendEntity(line)
tr.AddNewlyCreatedDBObject(line, True)
tr.Commit() Message was edited by: KrishnaK
Message 3 of 3
Mikko
in reply to: Mikko

Thank you very much.

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