PDA

View Full Version : How can I stop an object from being erased from a drawing



lambertm
2005-02-15, 10:22 AM
Hello all,

How can I stop an object from being erased from a drawing? The code I have developed checks to see if the object is on a protected layer and if so it simply undoes the erase command. Is this OK or is there a better way.

Mike

kdayman
2005-02-15, 03:16 PM
I did a something to achieve the same result but totally different method some time ago. Created a layer XYZ_Lock and placed the protected items on this layer. Then had the code lock the layer and monitor if it got unlocked to relock it immediately, and if it got set current to change 0 to be current, this was to prevent users from adding object to the layer by accident. Soon users found away around it by renaming the layer, so instead of identifying the layer by name I changed to code to use its handle. Since then no problems.

lance.81922
2005-02-20, 11:42 PM
What about creating a series of reactors? I did something similar with OFFSET, so that any time I OFFSET an object it would be placed on the current layer. One reactor watches to see if the OFFSET command has started, a second watches for new objects being added to the database, and the third updates the object. In your case you could come up with an object reactor that notices when the object is being deleted.

mjsregister
2005-02-21, 04:32 PM
Why not attach XData to the object? Then when the erase command is initiated check to see if the XData matches and if so, remove it from the selection set.