Page 1 of 1

Changes to the entities

Posted: 31 Aug 2017, 18:53
by imilchman
Hello,
I need to track changes to the entities: programming and via mouse/keyboard. As I understood from one of the posts I have to use CADEntity.OnDraw() event. But I could not find how to do it anywhere. Any chance you could provide an example how to do it? Basically I am trying to implement custom Undo/redo function which will track programmatic changes to the entities vs only visual changes.
Thanks in advance!

Re: Changes to the entities

Posted: 11 Sep 2017, 18:05
by support
Hello,

CADEntity.DrawEvent occurs when you move or resize the entity with a mouse, i.e. visual editing takes place. To track the programmatic changes, you can use the following code:

Code: Select all

private CADEntityCollection changedEntities = new CADEntityCollection();
...

private void LoadEntity(CADImage cadImage, CADEntity ent)
{
    try
    {
        cadImage.Converter.Loads(ent);
    }
    finally
    {
        // Entity was changed programmatically
        changedEntities.Add(ent);
    }
}
The LoadEntity() method should be called right after you change a value of entity's property from code.


Mikhail