.NET

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

Rubber Band Line

140 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 (140 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 (140 Views)

Re: Rubber Band Line

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

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community