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