.NET

Reply
Distinguished Contributor
Mikko
Posts: 212
Registered: ‎10-03-2003
Message 1 of 3 (146 Views)

Rubber Band Line

146 Views, 2 Replies
05-27-2005 10:04 AM
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?
Contributor
KrishnaK
Posts: 17
Registered: ‎05-24-2005
Message 2 of 3 (146 Views)

Re: Rubber Band Line

05-27-2005 11:22 AM 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
Distinguished Contributor
Mikko
Posts: 212
Registered: ‎10-03-2003
Message 3 of 3 (146 Views)

Re: Rubber Band Line

05-27-2005 11:34 AM in reply to: Mikko
Thank you very much.
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.