.NET

Reply
Mentor
mzakiralam
Posts: 231
Registered: ‎11-09-2012
Message 1 of 4 (154 Views)

Catch drawing modifiy event

154 Views, 3 Replies
07-17-2013 07:26 AM

Hi ,

 

I want to catch drawing modify event, that means if user start to edit current document I want to give a message to user. Can any body help me in this regard? Sample code with VB will be appreciated.

 

Regards

Zakir

*Expert Elite*
arcticad
Posts: 1,285
Registered: ‎06-21-2004
Message 2 of 4 (144 Views)

Re: Catch drawing modifiy event

07-17-2013 08:16 AM in reply to: mzakiralam

http://exchange.autodesk.com/autocadmep/enu/online-help/BLDSYS/2012/ENU/pages/WS1a9193826455f5ff2566...

 

 

---------------------------



(defun botsbuildbots() (botsbuildbots))
Mentor
mzakiralam
Posts: 231
Registered: ‎11-09-2012
Message 3 of 4 (139 Views)

Re: Catch drawing modifiy event

07-17-2013 09:36 AM in reply to: arcticad

Thanks for your reply. I have tried with that. Below is the sample code. Code is working fine when try to delete a object of just try to modifiy the object. But the problem occurs when I try to add some new object to the drawing. Then objModification sub is executed continuously and I get the message several times. Can you give me a hint that how can I get rid of that?

 

<CommandMethod("objmod")> Public Sub ObjectModification()

 Dim doc AsDocument = Application.DocumentManager.MdiActiveDocument

 AddHandler doc.Database.ObjectModified, AddressOf objModification

 AddHandler doc.Database.ObjectErased, AddressOf objDelete

 EndSub

 

Public Sub objModification(sender AsObject, e As ObjectEventArgs)

If e.DBObject.IsModified = True Then

Application.ShowAlertDialog("Object modification is not allowed")

EndIf

EndSub

 

Public Sub objDelete(sender AsObject, e As ObjectErasedEventArgs)

If e.DBObject.IsErased = True Then

Application.ShowAlertDialog("Object delete is not allowed")

EndIf

EndSub

 

 

*Expert Elite*
arcticad
Posts: 1,285
Registered: ‎06-21-2004
Message 4 of 4 (131 Views)

Re: Catch drawing modifiy event

07-17-2013 11:14 AM in reply to: mzakiralam

The event will fire multiple times. if you look at the properties you will see the first time is *Model_Space and then if I was drawing a polyline the Dimentions throw an error untill the last one.

 

There was some discussion here

http://forums.autodesk.com/t5/NET/ObjectModified-event/td-p/2990380

that talked about trapping all the events untill the end.

---------------------------



(defun botsbuildbots() (botsbuildbots))
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!