Author Topic: Document "xxx.dwg" has a command in progress.  (Read 14205 times)

0 Members and 1 Guest are viewing this topic.

mohnston

  • Bull Frog
  • Posts: 305
  • CAD Programmer
Document "xxx.dwg" has a command in progress.
« on: January 22, 2007, 06:07:54 PM »
I have a .NET app that shows a modeless dialog which is a customized print application.
It works fine except when I try to use the "qsave" command on the drawing after plotting or previewing it.
I get a message at the command line:
Document "xxx.dwg" has a command in progress.

Other commands such as Line, Copy, Move etc. work fine. Even the "Save" command works.

I've searched and read every post I could find on this subject including some in Russian (which may have lost something in the translation to English).

Is there some way to tell the Document that it doesn't have a command in progress?
I don't want to "SendCommand" since the only command that seems to shake the document free is "Save". I don't think it's good manners to save a drawing without the users permission. It's also kind of rude to make them save the drawing when all they did was print it.

Any help?
It's amazing what you can do when you don't know what you can't do.
CAD Programming Solutions

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Document "xxx.dwg" has a command in progress.
« Reply #1 on: January 22, 2007, 06:28:42 PM »
That sounds weird !

I have no ideas.

.. so this is redundant I 'spose , except to let you know that someone read the post and cares.

« Last Edit: January 22, 2007, 06:30:11 PM by Kerry Brown »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

uncoolperson

  • Guest
Re: Document "xxx.dwg" has a command in progress.
« Reply #2 on: January 22, 2007, 06:42:17 PM »
i was told to do something like this so i wouldn't have a problem like you describe... as far as what IsQuiescent is/does.... no idea other http://dictionary.reference.com/browse/Quiescent

Code: [Select]
            AutoCAD.AcadApplicationClass blah = new AutoCAD.AcadApplicationClass();
                AcadState oState = blah.GetAcadState();
                while (!oState.IsQuiescent)
                {
                }
[/s]

I read too fast.... i was having the same issue... gave up on not saving, and since i'm the only one to use my big happy batch program i just place a copy of the directory to be printed on my computer, screw with it (usually print) then get rid of it.... my network sucks so this is a better idea even for changing something in the drawing.
« Last Edit: January 22, 2007, 06:53:25 PM by uncoolperson »

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Document "xxx.dwg" has a command in progress.
« Reply #3 on: January 22, 2007, 06:51:27 PM »
The  oState.IsQuiescent 'Gets true if there is no command, LISP script, or ARX command active; otherwise, it gets false.'

ie like the CMDACTIVE getvar ..

.. it has no .set option ie it's read only.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Document "xxx.dwg" has a command in progress.
« Reply #4 on: January 22, 2007, 06:53:02 PM »
UCP, good to see you posting in the NET topics!  :-)
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

uncoolperson

  • Guest
Re: Document "xxx.dwg" has a command in progress.
« Reply #5 on: January 22, 2007, 06:58:07 PM »
UCP, good to see you posting in the NET topics!  :-)

I'll make problems, you fix em..... deal?

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Document "xxx.dwg" has a command in progress.
« Reply #6 on: January 22, 2007, 07:01:35 PM »
UCP, good to see you posting in the NET topics!  :-)

I'll make problems, you fix em..... deal?

I promise  :lmao:
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

mohnston

  • Bull Frog
  • Posts: 305
  • CAD Programmer
Re: Document "xxx.dwg" has a command in progress.
« Reply #7 on: January 22, 2007, 08:08:08 PM »
I had already tried "IsQuiescent".
I doesn't work in this situation. It isn't a matter of syncronicity. (POLICE!)
IsQuiescent never gets true.
Somehow the state of the active document is misreported.

It's amazing what you can do when you don't know what you can't do.
CAD Programming Solutions

uncoolperson

  • Guest
Re: Document "xxx.dwg" has a command in progress.
« Reply #8 on: January 22, 2007, 09:01:41 PM »
command line, as in the one in autocad... if not continue reading, else... i don't know yet.

blah being AutoCAD.AcadApplicationClass from above


have you tried
Code: [Select]
                blah.Visible = true;, to show what autocad is saying... my problem was i couldn't get it to not complain about saving the document.

Bryco

  • Water Moccasin
  • Posts: 1883
Re: Document "xxx.dwg" has a command in progress.
« Reply #9 on: January 22, 2007, 11:53:02 PM »
I've had that problem in regular cad (cad2000)
Quote
Document "xxx.dwg" has a command in progress
and never figured out what caused it. It seemed to happen in dwgs with layer and spatial indexing, or 3d but I never figured it out. I seem to remember Hit/Retry was an option.
I've also heard that acad2006 and 7 have some issues with printers. We just bought a new copier/printer and it ended up using/leaking  so much resourses the undo command , pljoin and a couple of others were taking forever. Looking at the task manager cad was using double what it normally was. It may be worth looking at your mem usage.

Big G

  • Bull Frog
  • Posts: 415
Re: Document "xxx.dwg" has a command in progress.
« Reply #10 on: January 23, 2007, 12:16:33 AM »
we use a few "add-on" packages here and i get this quite a bit too.....the only fix i have found is to type "EXIT" and when it asks you to save CANCEL it....qsave will work fine then?

as to what causes it.....no ideas!

I thought i seen the light at the end of the tunnel. But it was just someone with a torch bringing me more work.
"You have to accept that somedays youre the pigeon and  somedays youre the statue"

Glenn R

  • Guest
Re: Document "xxx.dwg" has a command in progress.
« Reply #11 on: January 23, 2007, 01:33:57 AM »
You said you have a modeless dialog...are you locking the document when you do your mojo...if so, are you UNLOCKING it afterward...???

From memory, IsQuescient is for out of process communication (ie COM controllers)......

Cheers,
Glenn.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Document "xxx.dwg" has a command in progress.
« Reply #12 on: January 23, 2007, 01:39:33 AM »
You said you have a modeless dialog...are you locking the document when you do your mojo...if so, are you UNLOCKING it afterward...???

From memory, IsQuescient is for out of process communication (ie COM controllers)......

Cheers,
Glenn.

Hi Glenn, I was going to suggest dockumentLocking, but the ability to make changes to the DB [ commands such as Line, Copy, Move etc. ] caused to to back off the idea.  .... but you may be correct anyway :-)
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Alexander Rivilis

  • Bull Frog
  • Posts: 214
  • Programmer from Kyiv (Ukraine)
Re: Document "xxx.dwg" has a command in progress.
« Reply #13 on: January 23, 2007, 05:41:50 AM »
The same situation: http://www.autocad.ru/cgi-bin/f1/board.cgi?t=32048VX (sorry but in Russian). UNLOCKING document before save it must help you.

mohnston

  • Bull Frog
  • Posts: 305
  • CAD Programmer
Re: Document "xxx.dwg" has a command in progress.
« Reply #14 on: January 23, 2007, 10:39:08 AM »
Alexander, the solution you point to is the one I referred to in my original post. I tried running the posts through Googles translator but only understood about half.

I do lock the document at the beginning of the function.
Code: [Select]
Document ThisDrawing = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
ThisDrawing.LockDocument();
Then at the end of the function.
Code: [Select]
ThisDrawing.LockDocument(DocumentLockMode.NotLocked, string.Empty, string.Empty, false);

I have also tried this at the beginning:
Code: [Select]
Document ThisDrawing = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
DocumentLock dLock = ThisDrawing.LockDocument();
And this at the end:
Code: [Select]
dLock.Dispose();

I guess this question is now "How do you UnLock a Locked document?"
It's amazing what you can do when you don't know what you can't do.
CAD Programming Solutions