Changes to the entities

Discuss and ask questions about CAD .NET library.

Moderators: SDS, support, admin

Post Reply
imilchman
Posts: 6
Joined: 03 Aug 2017, 19:40

Changes to the entities

Post by imilchman » 31 Aug 2017, 18:53

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!

support
Posts: 3271
Joined: 30 Mar 2005, 11:36
Contact:

Re: Changes to the entities

Post by support » 11 Sep 2017, 18:05

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
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

Post Reply