How to get all the Entities in a Particular Layer.
Can we filter the Entities selected using MultipleSelect with respect to Layers?
Getting all the Entities of a Particular Layer
Moderators: SDS, support, admin
-
- Posts: 19
- Joined: 31 Aug 2017, 09:47
Re: Getting all the Entities of a Particular Layer
Also can we Get only the Selected type of Entities from the Selected Enities.
(Say Only Polyline or Rotated Entities)
(Say Only Polyline or Rotated Entities)
Re: Getting all the Entities of a Particular Layer
Hello,
To get all entities in one certain layer, use the following code:
Also, it is possible to filter entities selected by MultipleSelect according to layers:
Catherine
To get all entities in one certain layer, use the following code:
Code: Select all
public List<CADEntity> GetAllLayerEntities(CADImage img, string layerName)
{
List<CADEntity> ResList = new List<CADEntity>();
for (int i = 0; i < img.Converter.Entities.Count; i++)
{
CADEntity ent = img.Converter.Entities[i];
if (ent.Layer.Name == layerName)
{
ResList.Add(ent);
}
}
return ResList;
}
Code: Select all
public List<CADEntity> GetSelectedByLayer(CADImage img, string layerName)
{
List<CADEntity> ResList = new List<CADEntity>();
for (int i = 0; i < img.SelectedEntities.Count; i++)
{
CADEntity ent = img.SelectedEntities[i];
if (ent.Layer.Name == layerName)
{
ResList.Add(ent);
}
}
return ResList;
}
Catherine
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support
Re: Getting all the Entities of a Particular Layer
This is how you can get only the selected type of entities from the selected entities:
Catherine
Code: Select all
public List<CADEntity> GetSelectedByType(CADImage img,EntityType type)
{
List<CADEntity> ResList = new List<CADEntity>();
for (int i = 0; i < img.SelectedEntities.Count; i++)
{
CADEntity ent = img.SelectedEntities[i];
if (ent.EntType==type)
{
ResList.Add(ent);
}
}
return ResList;
}
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support