.NET

Reply
Active Contributor
btmcad
Posts: 31
Registered: ‎05-09-2007
Message 1 of 2 (183 Views)

getselection problem

183 Views, 1 Replies
12-04-2012 07:48 AM

I'm having an issue with "getselection". I've used this before without problems, however, when I run the attached code, the program cancels when it gets to PromptSelectionResult. It shows my prompt at the command line, but a cancel afterwards, and the program is ended. Any suggestions would be greatly appreciated.

 

<CommandMethod("CreateImage")> _
        Public Sub Main()

            Dim doc As Document = Application.DocumentManager.MdiActiveDocument()
            
            Dim ed As Editor = doc.Editor
            Dim docWindow As Window = doc.Window
            Dim db As Database = doc.Database

            docWindow.WindowState = Window.State.Normal

            Dim size As System.Drawing.Size = docWindow.GetSize

            ed.WriteMessage(vbCrLf + "Document Size:" + vbCrLf + size.ToString() + vbCrLf)

            Dim newSize As System.Drawing.Size = New System.Drawing.Size(950, 573) 'was 608

            docWindow.SetSize(newSize)

            ZoomDwg()


            Dim selectionOpts As PromptSelectionOptions = New PromptSelectionOptions
            selectionOpts.MessageForAdding = "Select Geometry for image:"
            selectionOpts.AllowDuplicates = False

            Dim selection As PromptSelectionResult = ed.GetSelection(selectionOpts)

            ' if the selection was successful

            If selection.Status = PromptStatus.OK Then

 

Valued Mentor
DiningPhilosopher
Posts: 370
Registered: ‎05-06-2012
Message 2 of 2 (142 Views)

Re: getselection problem

12-07-2012 03:10 PM in reply to: btmcad

You can't change the size of the document window without cancelling the active command.

 

Start the LINE command and pick a point. 

 

Then, resize the document window (or the AutoCAD application window if the document window is maximized)

 

What happens?

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