.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

2 REPLIES 2
Reply
Message 1 of 3
william.delaughter
257 Views, 2 Replies

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

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"));
    }
}

 



2 REPLIES 2
Message 2 of 3

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}");
}

 

 

Message 3 of 3
_gile
in reply to: william.delaughter

@ActivistInvestor Nice trick!

 

 

 



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report