Cannot Pan/Rotate when calling GetPoint() or GetString() in modeless palette

william.delaughter
Observer
Observer

Cannot Pan/Rotate when calling GetPoint() or GetString() in modeless palette

william.delaughter
Observer
Observer

I'm trying to call a prompt to get a point while in a modeless palette. I'm currently using document.Editor.GetPoint(). Getting the point works just fine, however, I am unable to pan/rotate. When I click the middle mouse and drag, it just says "Invalid Point" and presents the prompt again.

Curious as to what was going on, I tried using GetString() instead trying to middle click pan or rotate would just quit out of the command. Pulling it up in the debug, I saw that the string that was being accepted was "'_.3DPAN2". Meaning the pan input is being read, but the actual pan command isn't getting processed.

What I've gathered is that somehow, when calling the prompt this way, AutoCAD isn't accepting the transparent commands. I've seen in other threads that a solution I can use is to wrap the code needing the prompt in a command, but that will require some re-architecting and my team wanted to see if there was another way to achieve this first.

Here's a code example (note we were experimenting with document locking, but that didn't seem to change anything):

 

private void SaveThumbnail_Click(object sender, RoutedEventArgs e)
{
    Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
    PromptResult result;
    using (doc.LockDocument(DocumentLockMode.Read, "MYCOMMANDNAME", "MYCOMMANDNAME", false))
    {
         result = doc.Editor.GetString(new PromptStringOptions("Get String"));
    }
}

 



0 Likes
Reply
275 Views
2 Replies
Replies (2)

ActivistInvestor
Advisor
Advisor

Perhaps this might allow transparent pans/zooms:

 

private async void SaveThumbnail_Click2(object sender, RoutedEventArgs e)
{
   var docmgr = Application.DocumentManager;
   Document doc = docmgr.MdiActiveDocument;
   PromptResult result;
   await docmgr.ExecuteInCommandContextAsync(o => 
   {
      result = doc.Editor.GetString("\nGetString: ");
      return Task.CompletedTask; 
   }, null);
   doc.Editor.WriteMessage($"\nResult: {result.StringResult}");
}

 

 

_gile
Mentor
Mentor

@ActivistInvestor Nice trick!

 

 

 



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes