How to get the latest modified entity in a drawing?

How to get the latest modified entity in a drawing?

_Bilal
Advocate Advocate
3,609 Views
24 Replies
Message 1 of 25

How to get the latest modified entity in a drawing?

_Bilal
Advocate
Advocate

Hello, everybody

 

Is it possible to get the latest modified entity in a drawing? I try to use ssget "_P" but it doesn't play when the user uses the grip to modify an entity.

0 Likes
3,610 Views
24 Replies
Replies (24)
Message 21 of 25

doaiena
Collaborator
Collaborator

I've read the code carefully enough. You still have not given enough information, about what exactly you are trying to achieve. Whatever it is though, your approach is wrong in my opinion.

 

- You should not use a command reactor to attach an object reactor, because that will trigger every time you run an AutoCAD command.

- You should also avoid using (ssget "X"). I doubt you want to track changes to every entity in the database. Narrow down your selection to only include objects of interest.

- If for some reason you want to track all entities in the drawing, you should use a database reactor, to monitor the entire db, instead of an object reactor for each entity.

 

If you want to recieve proper advice, state your use case, else you can stick to your code that is "tested many time and it works very well".

0 Likes
Message 22 of 25

_Bilal
Advocate
Advocate

@doaeina: "If for some reason you want to track all entities in the drawing, you should use a database reactor,
to monitor the entire db, instead of an object reactor for each entity."
@_Bilal: This is exactly what I need, It is a good idea to control the database instead of controlling each object in the drawing
I am asking here if there is such a routine that controls the database instead of every object?
If no, I will stick on this routine, and trying to develop it to accomplish what Uhden mentioned in his advice.

 

Thanks

0 Likes
Message 23 of 25

john.uhden
Mentor
Mentor

After checking my help, it appears that the vlr-acdb-reactor will do what you want and with a lot less overhead.

Check out the events.

Of course, if you open a drawing and do nothing, then there's no way of telling what was changed last in a previous session, so you should use the vlr-dwg-reactor to store in the drawing the handle of the latest revised object, probably as an xrecord in a dictionary.  I like to add extension dictionaries to the Modelspace object, which can't be deleted.  Umm, the dictionary can be deleted by a knowledgeable programmer, but not by your average AutoCAD user.

John F. Uhden

0 Likes
Message 24 of 25

_Bilal
Advocate
Advocate

A quick survey on the options of the vlr-acdb-reactor, it seems as you said, less effort and more accurate, I will try to work on this the soonest.

 

Thanks,

0 Likes
Message 25 of 25

_Bilal
Advocate
Advocate