I have a scenario where I a macro is storing the address of an entity in a system attribute.
On startup the macro gets the attribute and if it exists then does an ent_get using the lgladdr in the attribute. The behaviour of the macro is then slightly different depending on the return value of the ent_get call.
I have an issue if the entity whose address is stored in the attribute has subsequently been erased: ent_get is still returning true (and the details of the entity are returned in the ent parameter) even though the entity has been erased. (Note: Problem does not occur if PurgeDrawingsOnExit is set to 1 in the ini file and the drawing has been saved since the entity was erased ... ent_get is correctly returning false in this case).
The entity record returned by ent_get for the erased entity appears to be 'correct' (i.e. same as was returned before the entity was erased). The macro actually calls the hi_lite procedure with the returned entity and it is being hilited on the screen as though it had not been erased.
Is there a way to tell that the returned entity has in fact been erased? I don't notice any field in the entity definition that looks like it would indicate the entity was erased (I thought that perhaps the lyr field may be set to nil but that appears to still have the original [undeleted] value). Is it even advisable to store an address like this (or might a file purge move things around?)
Any advice would be appreciated.
Thanks,
David H.
On startup the macro gets the attribute and if it exists then does an ent_get using the lgladdr in the attribute. The behaviour of the macro is then slightly different depending on the return value of the ent_get call.
I have an issue if the entity whose address is stored in the attribute has subsequently been erased: ent_get is still returning true (and the details of the entity are returned in the ent parameter) even though the entity has been erased. (Note: Problem does not occur if PurgeDrawingsOnExit is set to 1 in the ini file and the drawing has been saved since the entity was erased ... ent_get is correctly returning false in this case).
The entity record returned by ent_get for the erased entity appears to be 'correct' (i.e. same as was returned before the entity was erased). The macro actually calls the hi_lite procedure with the returned entity and it is being hilited on the screen as though it had not been erased.
Is there a way to tell that the returned entity has in fact been erased? I don't notice any field in the entity definition that looks like it would indicate the entity was erased (I thought that perhaps the lyr field may be set to nil but that appears to still have the original [undeleted] value). Is it even advisable to store an address like this (or might a file purge move things around?)
Any advice would be appreciated.
Thanks,
David H.
David Henderson
dhSoftware - Add-on Macros for DataCAD
dhSoftware - Add-on Macros for DataCAD