.NET

Reply
New Member
NachiBang
Posts: 1
Registered: ‎03-09-2012
Message 1 of 3 (258 Views)
Accepted Solution

How to Break loop for enter key

258 Views, 2 Replies
03-09-2012 01:58 AM

I tried the following code posted in the forum, but i need to know how to break the loop when right click/ Enter Key is pressed.

 

Following is the code i used:

 

Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument

        Dim acCurEd As Editor = acDoc.Editor

        Using lock As DocumentLock = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument

            Dim ppo As PromptPointOptions = New PromptPointOptions(vbCrLf & "Select Insertion Point:")

            Dim ppr As PromptPointResult = acCurEd.GetPoint(ppo)

            Dim _startpoint, _endpoint As Point3d

            If ppr.Status = PromptStatus.OK Then

                _startpoint = ppr.Value

            End If

 

            AddLayer(_LayName, True) 

            Dim i As Integer = 0

 

            While i = 0

                Dim acCurDb As Database = acDoc.Database

 

 

                Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()

                    Dim _newentLine As New Line

                    ppo = New PromptPointOptions(vbCrLf & "Select Next Point")

 

                    ppo.BasePoint = _startpoint    

                    ppo.UseBasePoint = True       

 

                    ppr = acCurEd.GetPoint(ppo)

 

 

                    If ppr.Status = PromptStatus.OK Then

                        _endpoint = ppr.Value

                    Else                       

                        i = 1

                        Continue While

                    End If

 

                    _newentLine.ColorIndex = _ColorIndex

                    If _LineType.ToLower = "continuous" Then

                    ElseIf _LineType.ToLower = "byblock" Then

                    Else

                        _LineType = "ByLayer"

                    End If

 

                    _newentLine.StartPoint = _startpoint

                    _newentLine.EndPoint = _endpoint

 

                    _newentLine.Linetype = _LineType

                    _newentLine.LineWeight = _LineWeight

                    _newentLine.Layer = _LayName

 

 

                    Dim acBlkTbl As BlockTable = acTrans.GetObject(acCurDb.BlockTableId, OpenMode.ForWrite)

                    Dim acBlkTblRec As BlockTableRecord = acTrans.GetObject(acBlkTbl(BlockTableRecord.ModelSpace), OpenMode.ForWrite)

                    acBlkTblRec.AppendEntity(_newentLine)

                    acTrans.AddNewlyCreatedDBObject(_newentLine, True)

                    acTrans.Commit()

                    acBlkTblRec.Dispose()

 

                    acBlkTbl.Dispose()

 

                    _startpoint = _endpoint

                    _newentLine.Dispose()

 

                End Using

                acCurDb.Dispose()

            End While

        End Using

 

*Expert Elite*
Alfred.NESWADBA
Posts: 8,865
Registered: ‎06-29-2007
Message 2 of 3 (248 Views)

Re: How to show the Scaling and Angle

03-09-2012 02:07 AM in reply to: NachiBang

Hi,

 

>> but i need to know how to break the loop when right click/ Enter Key is pressed

check the possible values in this line

If ppr.Status = .....

 

- alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Valued Contributor
chockalingam
Posts: 81
Registered: ‎03-06-2012
Message 3 of 3 (246 Views)

Re: How to show the Scaling and Angle

03-09-2012 02:10 AM in reply to: NachiBang

Use the following line which helps you to break the loop for right click/ enter key

 

 

ppo.AllowNone = True

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