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

Intercept wen use change drawing

6 REPLIES 6
Reply
Message 1 of 7
Anonymous
307 Views, 6 Replies

Intercept wen use change drawing

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!!
6 REPLIES 6
Message 2 of 7
Anonymous
in reply to: Anonymous

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!!
Message 3 of 7
Anonymous
in reply to: Anonymous

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 😉

But I would like to have this reactor in VB 😞

"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!!
Message 4 of 7
Anonymous
in reply to: Anonymous

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 😉

But I would like to have this reactor in VB 😞

"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!!
Message 5 of 7
Anonymous
in reply to: Anonymous

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!! 😞

"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 😉

But I would like to have this reactor in VB 😞

"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!!
Message 6 of 7
Travor pei
in reply to: Anonymous

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!!
Message 7 of 7
Anonymous
in reply to: Anonymous

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!!

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost