Using code to modify code in a DVB file : disable the Object Modified Event

Using code to modify code in a DVB file : disable the Object Modified Event

arcticad
Advisor Advisor
743 Views
6 Replies
Message 1 of 7

Using code to modify code in a DVB file : disable the Object Modified Event

arcticad
Advisor
Advisor
I remember reading about this before, but I can't seem to find it.

I need to disable and then reenable the Object Modified Event.

I want some code to change the event in the file so it won't fire when saving the file.

This is to prevent it from running a zillion times when I save a file. As every object is modified on save.

I tried to unload the DVB file with another when save is run. However. When I run "Copy with Base Point".

Save runs in the middle of the command and tried to unload the dvb file. and AutoCAD crashes.

Any Help would be appreciated. Thanks.
---------------------------



(defun botsbuildbots() (botsbuildbots))
0 Likes
744 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable

can you set a flag in beginsave and chek that in
your object modified event?

hth

mark


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
I
remember reading about this before, but I can't seem to find it. I need to
disable and then reenable the Object Modified Event. I want some code to
change the event in the file so it won't fire when saving the file. This is to
prevent it from running a zillion times when I save a file. As every object is
modified on save. I tried to unload the DVB file with another when save is
run. However. When I run "Copy with Base Point". Save runs in the middle of
the command and tried to unload the dvb file. and AutoCAD crashes. Any Help
would be appreciated. Thanks.
0 Likes
Message 3 of 7

arcticad
Advisor
Advisor
I've tried that. The Issues is that the Object Modified event is triggered for every object that is in the drawing and some drawing will take minutes to finish. The computer acts like it's crashed until it finishes. I tried to use one file to unload the other on BeginSave. This is fine when I actually want to save the file. But AutoDesk in it's infinite wisdom has decided to save the file in the middle of the command. The sequence as I see it. {code:java} copybase pick base point select objects BeginSave event is triggered. DVB tries to unload the other DVB file. *crash* {code}if i unload the file while AutoCAD is in the command then I get an exception error and it crashes. I'm getting lots of crashes as a result.
---------------------------



(defun botsbuildbots() (botsbuildbots))
0 Likes
Message 4 of 7

Anonymous
Not applicable
How about disabling the autosave at the beginning of the routine, and re-enabling it at the end?
0 Likes
Message 5 of 7

arcticad
Advisor
Advisor
I disabled AutoSave in the options dialog box. and it didn't seem to help. Also I suspect that it's doing it in other commands, as I am still getting random crashes. Which doesn't happen when I'm not unloading the file.

Where should I be setting it?

Thanks.
---------------------------



(defun botsbuildbots() (botsbuildbots))
0 Likes
Message 6 of 7

arcticad
Advisor
Advisor
I've tracked down the issue to the dvb file itself. it I create a new file and unload it. Then it doesn't have the issue. it will unload just fine.

setting "Savetime" 0 didn't help.

However does anyone know how to modify the code in the dvb with another code.. I'd still like to know.

Thank You.
---------------------------



(defun botsbuildbots() (botsbuildbots))
0 Likes
Message 7 of 7

arcticad
Advisor
Advisor
Tanzillo, Tony

Posted this.

http://discussion.autodesk.com/forums/thread.jspa?threadID=103581

The only solution I can see in VBA is to intercept
BeginSave, and then disconnect the object that's
sinking the ObjectModified event, and the reconnect
it in EndSave.

I can't seem to get this to work.

if I Set ACADApp = GetObject(, "AutoCAD.Application.17")

then I try to use

Private Sub ACADAPP_ObjectModified(ByVal Object As Object)

nothing works.

I'm Missing something ....
---------------------------



(defun botsbuildbots() (botsbuildbots))
0 Likes