Code Red > .NET

Lost ability to use AutoCAD icons whilst trying to get a PromptPointResult

(1/2) > >>

Grishe:
Hi there...

I recently found this forum in a post from the Autodesk .NET one... Can't belive i've only just found out about it!

I wander if anyone has had a problem with zooming and panning using the AutoCAD icons (i.e. not the wheelie ball mouse)... Whilst trying to get say a simple point location from the user??? 

If i attach the code to a toolbar created so...

Dim Tb As Autodesk.AutoCAD.Interop.AcadToolbar = acadApp.MenuGroups.Item(0).Toolbars.Add("A Tool Bar")

Dim tbBut0 As Autodesk.AutoCAD.Interop.AcadToolbarItem = PenMapTb.AddToolbarButton(0, "Pick a point", "Pick a point", "_PickaPoint ")
tbBut0.SetBitmaps("PICK.bmp", "PICK.bmp")

Tb.Dock(Autodesk.AutoCAD.Interop.Common.AcToolbarDockStatus.acToolbarDockLeft)[/color][/color]

... Where pickapoint is called such...

 <CommandMethod("PickaPoint")> _
Public Sub ShowKeyboard()
    QueryLocation
End Sub

...and QueryLocation looks like...

Public Sub QueryLocation()
            Dim ed As Autodesk.AutoCAD.EditorInput.Editor = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor
            Dim RP As New Autodesk.AutoCAD.EditorInput.PromptPointOptions("Pick Point" & vbCrLf)
            Dim ResPt As Autodesk.AutoCAD.EditorInput.PromptPointResult
            Dim Doc As Autodesk.AutoCAD.ApplicationServices.Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
            Dim Abort As Boolean

            RP.AllowNone = True
         
            Try


                Do Until Abort

                    ResPt = ed.GetPoint(RP)


                    Select Case ResPt.Status

                        Case PromptStatus.OK
                            Dim QueryLocation As New AICpoint3D(ResPt.Value.X, ResPt.Value.Y, ResPt.Value.Z) 'send the location back
                            Abort = True

                        Case PromptStatus.Keyword
                            'Dim command As String = ResPt.StringResult.Substring(2)
                            Doc.SendStringToExecute("_PAN",True, False, True)
                            'Dim Ret As Integer = aced.Invoke("command", "_.pan")

                        Case PromptStatus.Cancel
                            Abort = True

                        Case PromptStatus.Error
                            Abort = True

                    End Select

                Loop

            Catch ex As Exception
                MsgBox("Error getting location: " & ex.Message & vbCrLf & ex.StackTrace)
            End Try

       
        End Sub

Everything works perfectly.... I.e. you can zoom and pan whilst still picking... However, If you run the PickaPoint routine from a button on a form which you have popped up, you can still pick a point, but none of the AutoCAD buttons work...!!!

I have basically created a new larger toolbar as the tiny little icons are difficult to hit for some of our users... It's a just a form at the end of the day, which contains a toolstrip and is displayed by clicking one of said smaller icons. and calling..

Dim App As Autodesk.AutoCAD.ApplicationServices.Application
Autodesk.AutoCAD.ApplicationServices.Application.ShowModelessDialog(App.MainWindow, Toolbar)

The click event of the button then simply calls PickaPoint.  But for the life of me i can not use the pan and zoom tools at the same time.  Which is obviously pretty crucial when trying to move around the drawing.

I've tried executing the command in the document context, API calls, and also using SendStringToExecute on the Document to send the Pan and zoom commands again... but nothing works

I've been struggling with this for a while now and so far everythng i've tried has failed... Unless i run the code direct from the AutoCAD toolbar!

If anyone out there has any suggestions i would really appreciate it....

Kindest regards

Phil Langrishe

Glenn R:
I noticed you're using ShowModelessDialog...are you locking the document?

Paul Richardson:

--- Quote from: Grishe on August 21, 2007, 08:58:00 AM ---I have basically created a new larger toolbar as the tiny little icons are difficult to hit for some of our users... It's a just a form at the end of the day, which contains a toolstrip and is displayed by clicking one of said smaller icons. and calling..

--- End quote ---

You can increase the icon size in options->display->use large buttons for toolbars.

Grishe:
Hi There...

Thanks for those suggestions...

We're developing an application which basically allows AutoCAD to be taken outside and connected to some GPS kit costing 20k+ which allows Civil engineers and Surveyors to accurate surveys of Roads and Housing estates etc.. i.e. using the GPS as a mouse... on a rugged Tablet PC. Unfortunately even the larger icons in AutoCAD are not big enough for our users to press easily with a pen stylus... With a mouse it's a doddle, but in the wind and rain of the great out doors apparently bigger is better.  So that’s why I can't using the larger icons ..  :cry:

I've also tried locking the document but, unfortunately that doesn't allow the pan and zooms commands to work either...

The closest I’ve come is to use..

Case PromptStatus.Keyword
Dim command As String = ResPt.StringResult '.Substring(2)
app.ActiveDocument.SendCommand(command & " ")

Where app is declaired...

Dim app As AcadApplication = Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication

This allows the pan/zoom or which ever command the user clicks to fire correctly, however they will not exit!! If you click the Pan and then right click the mouse to exit, it won't exit, It just keeps panning!!  It's got to be something to do with the loop it's running inside, but the SendCommand method does not wait until the command exits... so another ed.GetPoint is fired straight after, which must be screwing it up.

Grishe:
For anyone interested I've sorted it...

The solution was to setup a new command class which would basically do all the picking, so you could in effect call it with the keyboard.  But then call the command class on the click event of the toolstripbutton in the toolbar, using SendStringToExecute on the Active Document.  A real round the houses solution... But if you want to initiate a pick from a form, which isn't initially spawned from an AutoCAD toolbar, it seems like the only way...

Navigation

[0] Message Index

[#] Next page

Go to full version