how to delete an Entity

Discuss and ask questions about CADViewX (Lite and Pro versions).

Moderators: admin, support, SDS

Post Reply
xavier
Posts: 27
Joined: 04 Dec 2012, 14:58

how to delete an Entity

Post by xavier » 09 Apr 2013, 18:38

hello

when i want to add an entity , i use the AddEntity Method,
but how to delete an entity to a draw ?

xavier

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

Re: how to delete an Entity

Post by support » 10 Apr 2013, 16:56

Hello xavier.
Unfortunately CADViewX current version doesn't include methods to delete entities or methods programmatically from a group. Because of this entities can be deleted with CADEditor tool in Pro version. The following code shows deleting all entities from a layer with index j:

Code: Select all

     CADViewLib.Group entities = CADViewX1.CADImage.Converter.get_Sections(CADViewLib.TxConvSection.csEntities);
     CADViewLib.Group sel_entities = new CADViewLib.Group();
     CADViewLib.Layer del_layer = CADViewX1.CADImage.Converter.get_Layers(j);

     for (int i = 0; i < entities.Count; i++)
     {
         CADViewLib.Entity ent = entities.get_Entities(i);
         if (ent.Layer == del_layer)
             sel_entities.AddEntity(ent);
     }

     Editor = CADViewX1.GetCADEditor();
     Editor.Select((CADViewLib.Entity)sel_entities);
     Editor.Delete(); 
Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

xavier
Posts: 27
Joined: 04 Dec 2012, 14:58

Re: how to delete an Entity

Post by xavier » 11 Apr 2013, 13:27

Thank you

It works.

There's just one thing I do not understand.
The delete function is defined as "Function Delete () As Boolean '.
Delete deletes correctly and returns false. .... ???

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

Re: how to delete an Entity

Post by support » 11 Apr 2013, 15:31

Hello.
Such results are not correct. Thank you for the remark. We have implemented minor changes in function body. So the returned value will depend on deleting results. The modification will be available with the next CADViewX version.

Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

Post Reply