Author Topic: Determine if a drawing has changed since opening  (Read 2181 times)

0 Members and 1 Guest are viewing this topic.

Eddie D.

  • Newt
  • Posts: 29
Determine if a drawing has changed since opening
« on: October 18, 2016, 03:27:41 PM »
Hey, everyone!
As the topic states, I need to determine if a drawing has changed since opening (graphics only). I have done the obligatory search of The Swamp with no luck (maybe I missed something???).
Anyway, I do not need to know if variables, windows, views, or fields changed. I know about DBMOD, but can't seem to determine if changes were made to the graphics (along with panning, zooming, tilemode changes and viewport activations).
Any ideas?

rkmcswain

  • Swamp Rat
  • Posts: 978
Re: Determine if a drawing has changed since opening
« Reply #1 on: October 18, 2016, 03:44:51 PM »
Do you only want to know about graphics changes?
You say you do not need to know about "views", but then late you say "determine if changes were made to ....panning, zooming"

Does the bitcode 1 on DBMOD not do it?

Eddie D.

  • Newt
  • Posts: 29
Re: Determine if a drawing has changed since opening
« Reply #2 on: October 18, 2016, 03:56:00 PM »
I thought bitcode 1 would do it, but just switching from paperspace to modelspace in a freshly opened drawing returns a DBMOD of 29. That's why I mentioned the "zoomin, panning, tilemode..."

rkmcswain

  • Swamp Rat
  • Posts: 978
Re: Determine if a drawing has changed since opening
« Reply #3 on: October 18, 2016, 04:11:37 PM »
Yeah, I see that now. Are you limited to using autolisp?

Eddie D.

  • Newt
  • Posts: 29
Re: Determine if a drawing has changed since opening
« Reply #4 on: October 18, 2016, 04:13:15 PM »
Sadly, yes.

rkmcswain

  • Swamp Rat
  • Posts: 978
Re: Determine if a drawing has changed since opening
« Reply #5 on: October 18, 2016, 04:18:20 PM »
*If* it can be done using a more low level API, maybe a lisp function could be exported. Sort of like the DOSLIB functions.

Eddie D.

  • Newt
  • Posts: 29
Re: Determine if a drawing has changed since opening
« Reply #6 on: October 18, 2016, 04:20:46 PM »
WAY above my head.....

rkmcswain

  • Swamp Rat
  • Posts: 978
Re: Determine if a drawing has changed since opening
« Reply #7 on: October 18, 2016, 04:22:13 PM »
I keep waiting for someone smarter than me to jump in here :-)

David Bethel

  • Swamp Rat
  • Posts: 656
Re: Determine if a drawing has changed since opening
« Reply #8 on: October 22, 2016, 08:44:02 AM »
Can you not querry the bitcode for the information that you are seeking ?

http://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/dbmod-question/td-p/2133076

You should be able to use (logand)

-David
R12 Dos - A2K

rkmcswain

  • Swamp Rat
  • Posts: 978
Re: Determine if a drawing has changed since opening
« Reply #9 on: October 22, 2016, 04:04:46 PM »
Can you not querry the bitcode for the information that you are seeking ?

Check reply #2 again.  Bitcode 1 is being set in certain situations even though no database entities are being modified.

ChrisCarlson

  • Guest
Re: Determine if a drawing has changed since opening
« Reply #10 on: October 24, 2016, 08:52:07 AM »
Correct, any graphics display change will trigger a change in the drawing. However looking at the values of DBMod

Quote
(Read-only)
Type: Integer
Not saved
Indicates the drawing modification status using bit-code. It is the sum of
the following:

1   Object database modified
4   Database variable modified
8   Window modified
16   View modified

I'd also look into acad-push-dbmod and acad-pop-dbmod


rkmcswain

  • Swamp Rat
  • Posts: 978
Re: Determine if a drawing has changed since opening
« Reply #11 on: October 24, 2016, 08:57:02 AM »
But a graphics change should not trigger bitcode 1. No "objects" are being modified.
I believe this is OP's problem.

ChrisCarlson

  • Guest
Re: Determine if a drawing has changed since opening
« Reply #12 on: October 24, 2016, 10:09:26 AM »
The value returned is the sum of what's changed, the value will never be 0.

Opening a drawing should change the variable to "4", creating an entity without modifying the view returns a value of "5"
(Object database modified + database variable modified)

Opening a drawing, creating an entity and modifying the view returns a value of "29"
(Object database modified + database variable modified + window modified + view modified)

rkmcswain

  • Swamp Rat
  • Posts: 978
Re: Determine if a drawing has changed since opening
« Reply #13 on: October 24, 2016, 10:16:25 AM »
The value is 0 when you open the drawing, before any changes are made, and immediately after the file is SAVED.
Opening a drawing does not cause the value to be 4, unless you have routines running at startup that make changes.

Side note: some people choose to use (acad-push-dbmod) and (acad-pop-dbmod) to get DBMOD = 0 at startup, instead of removing the things that are causing DBMOD to be changed.

Eddie D.

  • Newt
  • Posts: 29
Re: Determine if a drawing has changed since opening
« Reply #14 on: October 24, 2016, 12:38:13 PM »
Initial value of DBMOD on opening is "0".  Just switching from PS to MS gives a DBMOD value of  29. How can you determine a difference in just switching PS/MS and adding and entity (i.e. drawing a line)?