2012 CommandFlags.Session problem.

2012 CommandFlags.Session problem.

Anonymous
Not applicable
1,186 Views
4 Replies
Message 1 of 5

2012 CommandFlags.Session problem.

Anonymous
Not applicable

Hi all. I'm experiencing a problem with a "session context" command in AutoCAD 2012. Can someone please try this and let me know if you have the same issue.

 

Here's what I've got...

 

   [CommandMethod("MYCOMMAND", CommandFlags.Session)]

   public static void MyCommand()

   {

      Editor ed = Autodesk.AutoCAD.Application.DocumentManager.MdiActiveDocument.Editor;

      ed.WriteLine("\nMYCOMMAND completed.");

   }

 

Pretty simple and it appears to work, BUT something strange occurs when you have another drawing with an active command running (e.g. a "CIRCLE" command is active in a "non-active" drawing waiting for user input). When you try to run the above "MYCOMMAND" in the "active drawing", well AutoCAD 2012 just seems to hang there.

 

Has anyone noticed this hang with AutoCAD 2012? Or am I doing something wrong here? I'm using vanilla AutoCAD 2012.

 

Cheers,

Art

0 Likes
1,187 Views
4 Replies
Replies (4)
Message 2 of 5

Hallex
Advisor
Advisor

Can't tested it but you might be want to try:

 

[CommandMethod("MYCOMMAND", CommandFlags.Session | CommandFlags.NoHistory)]

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
0 Likes
Message 3 of 5

Anonymous
Not applicable

Hi Hallex. Thanks for this. I gave it a go but still no good. It's weird, this works just fine in AutoCAD 2011.

0 Likes
Message 4 of 5

Anonymous
Not applicable

In 2012 if I started the cirlce command it would not hang up

but if I picked the center point then before selecting the next point for diameter then switched docs it hung up.

 

using Ctrl + Tab to switch docs

I was able to get the mouse pointer to show up to close the drawing the circle command was active then it became responsive.

 

Also with that and debugging the command would not start to execute until I closed the circle drawing

I have a idea but need to refresh about Command Processor, contexts etc.....

 

0 Likes
Message 5 of 5

Anonymous
Not applicable

Hi Jeffrey. Yes that's exactly what I observed.

 

Doesn't happen for me in AutoCAD 2011, just to add to my confusion. Any ideas you can conjure would be much appreciated.

0 Likes