.NET

Reply
*Martin Langevin
Message 1 of 7 (142 Views)

Intercept wen use change drawing

142 Views, 6 Replies
11-07-2006 07:08 AM
Hello everyone, I would like to provide to know when a user changes drawing,
would be with keys ALT+TAB or by the menu window. I looked in the reactors
of the application and of the document and I do not find anything good.
There is to you it a way of being able to intercept this event.

Thank you!!
*Norman Yuan
Message 2 of 7 (142 Views)

Re: Intercept wen use change drawing

11-08-2006 06:46 AM in reply to: *Martin Langevin
If you are talking ObjectARX .NET API, then look into:

Autodesk.AutoCAD.ApplicationServices.DocumentCollection class' event:

DocumentActivated
DocumentActivationChanged
DocumentBecameCurrent

Most likely, you would handle DocumentBecameCurrent event.

BTW, it is Ctrl+Tab to switch opened drawing inside Acad if multiple
drawings are opened, not Alt+Tab, unless you mean multple sessions of Acad.

"Martin Langevin" wrote in message
news:5387583@discussion.autodesk.com...
Hello everyone, I would like to provide to know when a user changes drawing,
would be with keys ALT+TAB or by the menu window. I looked in the reactors
of the application and of the document and I do not find anything good.
There is to you it a way of being able to intercept this event.

Thank you!!
*Martin Langevin
Message 3 of 7 (142 Views)

Re: Intercept wen use change drawing

11-09-2006 01:24 PM in reply to: *Martin Langevin
No, I don't use ObjectARX.NET, just in VB.net

And lol your right, not ALT+TAB but CTRL+TAB to swith in MDI document :smileywink:

But I would like to have this reactor in VB :smileysad:

"Norman Yuan" a écrit dans le message de news:
5389096@discussion.autodesk.com...
If you are talking ObjectARX .NET API, then look into:

Autodesk.AutoCAD.ApplicationServices.DocumentCollection class' event:

DocumentActivated
DocumentActivationChanged
DocumentBecameCurrent

Most likely, you would handle DocumentBecameCurrent event.

BTW, it is Ctrl+Tab to switch opened drawing inside Acad if multiple
drawings are opened, not Alt+Tab, unless you mean multple sessions of Acad.

"Martin Langevin" wrote in message
news:5387583@discussion.autodesk.com...
Hello everyone, I would like to provide to know when a user changes drawing,
would be with keys ALT+TAB or by the menu window. I looked in the reactors
of the application and of the document and I do not find anything good.
There is to you it a way of being able to intercept this event.

Thank you!!
*Norman Yuan
Message 4 of 7 (142 Views)

Re: Intercept wen use change drawing

11-09-2006 03:17 PM in reply to: *Martin Langevin
So, you use COM interop through Acad's COM Object Model, in which, you may
look at AcadApplication object's Begin/EndOpen, or AcadDocument object's
Activate/Deactivate event, or other events that may provide some help to
your need.


"Martin Langevin" wrote in message
news:5391465@discussion.autodesk.com...
No, I don't use ObjectARX.NET, just in VB.net

And lol your right, not ALT+TAB but CTRL+TAB to swith in MDI document :smileywink:

But I would like to have this reactor in VB :smileysad:

"Norman Yuan" a écrit dans le message de news:
5389096@discussion.autodesk.com...
If you are talking ObjectARX .NET API, then look into:

Autodesk.AutoCAD.ApplicationServices.DocumentCollection class' event:

DocumentActivated
DocumentActivationChanged
DocumentBecameCurrent

Most likely, you would handle DocumentBecameCurrent event.

BTW, it is Ctrl+Tab to switch opened drawing inside Acad if multiple
drawings are opened, not Alt+Tab, unless you mean multple sessions of Acad.

"Martin Langevin" wrote in message
news:5387583@discussion.autodesk.com...
Hello everyone, I would like to provide to know when a user changes drawing,
would be with keys ALT+TAB or by the menu window. I looked in the reactors
of the application and of the document and I do not find anything good.
There is to you it a way of being able to intercept this event.

Thank you!!
*Martin Langevin
Message 5 of 7 (142 Views)

Re: Intercept wen use change drawing

11-13-2006 04:55 AM in reply to: *Martin Langevin
Thank you!! Wend I open, desactivated reactor work good and after, I can
reset my current document with acadapp.ActiveDocument . But wend I swith to
first drawing, the reactor work correcly but I can't reset my active
document with acadapp.ActiveDocument, it give me always the start document,
not the document were I go!! :smileysad:

"Norman Yuan" a écrit dans le message de news:
5391624@discussion.autodesk.com...
So, you use COM interop through Acad's COM Object Model, in which, you may
look at AcadApplication object's Begin/EndOpen, or AcadDocument object's
Activate/Deactivate event, or other events that may provide some help to
your need.


"Martin Langevin" wrote in message
news:5391465@discussion.autodesk.com...
No, I don't use ObjectARX.NET, just in VB.net

And lol your right, not ALT+TAB but CTRL+TAB to swith in MDI document :smileywink:

But I would like to have this reactor in VB :smileysad:

"Norman Yuan" a écrit dans le message de news:
5389096@discussion.autodesk.com...
If you are talking ObjectARX .NET API, then look into:

Autodesk.AutoCAD.ApplicationServices.DocumentCollection class' event:

DocumentActivated
DocumentActivationChanged
DocumentBecameCurrent

Most likely, you would handle DocumentBecameCurrent event.

BTW, it is Ctrl+Tab to switch opened drawing inside Acad if multiple
drawings are opened, not Alt+Tab, unless you mean multple sessions of Acad.

"Martin Langevin" wrote in message
news:5387583@discussion.autodesk.com...
Hello everyone, I would like to provide to know when a user changes drawing,
would be with keys ALT+TAB or by the menu window. I looked in the reactors
of the application and of the document and I do not find anything good.
There is to you it a way of being able to intercept this event.

Thank you!!
New Member
Travor pei
Posts: 1
Registered: ‎01-24-2007
Message 6 of 7 (142 Views)

Re: Intercept wen use change drawing

01-24-2007 11:43 PM in reply to: *Martin Langevin
Hello Norman Yuan,I know DocumentCollection have some events like DocumentActivated,but how can I use them,I mean the whole process.For example,I want AutoCAD show a MessageBox when I change the document,what code should I add and where?thanks!!
*Norman Yuan
Message 7 of 7 (142 Views)

Re: Intercept wen use change drawing

01-29-2007 07:01 AM in reply to: *Martin Langevin
I assume you are talking .NET API.

I suggest to use DocumentCollection.DocumentBecameCurrent event, instead of
DocumentActivated event, in general.

You hook the event to an event handler at beginning of your app (for
example, if your app implement the IExtensionApplication interface, you put
the code into Initialize() method:

mDwgManager =
Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager;

mDwgManager.DocumentBecameCurrent += new
DocumentCollectionEventHandler(mDwgManager_DocumentBecameCurrent);

//The event handler

private static void mDwgManager_DocumentBecameCurrent(object sender,
DocumentCollectionEventArgs e)

{

//Assume you have a static Document object "mThisDrawing" declared and
set each time a drawing became current

//Save previous file name

string dwg=mThisDrawing.Name

//Set mThisDrawing to current drawing

mThisDwg =
Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;

string newdwg=mThisDrawing.Name;

mThisDrawing.Editor.WriteMessage("\nPreviuos drawing->" + dwg + "\nNew
drawing->" + newdwg);

//or if you have reference to System.Windows.Forms

//MessageNox.Show("Previous drawing: " + dwg + "\nNew drawing: " +
newdwg);

}



HTH.



wrote in message news:5463107@discussion.autodesk.com...
Hello Norman Yuan,I know DocumentCollection have some events like
DocumentActivated,but how can I use them,I mean the whole process.For
example,I want AutoCAD show a MessageBox when I change the document,what
code should I add and where?thanks!!
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.