Hi,
Is there a way to apply a filter to return a group of entities, much like the AutoCAD SelectionSet method?
SelectionSet or Filter for Entities
Moderators: SDS, support, admin
Re: SelectionSet or Filter for Entities
Hello.
You can use own simple condition, for example:
Alexander.
You can use own simple condition, for example:
Code: Select all
CADEntityCollection co = new CADEntityCollection();
for (int i = 0; i < this.cadImage.Converter.Entities.Count; i++)
{
CADEntity ent = this.cadImage.Converter.Entities[i];
if (ent.EntType == EntityType.Ellipse)
co.Add(ent);
}
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support
-
- Posts: 16
- Joined: 31 May 2010, 13:33
Re: SelectionSet or Filter for Entities
Hi,
So iterating over the entire collection of entities is the only option?
I ask because I can see times where there might by 100,000 entities or more and having to iterate through each one might be an issue.
Is the underlying structure of a dwg a database? If it is could you not have a method to query the db directly? I can only assume this is how AutoCAD selection sets work...
So iterating over the entire collection of entities is the only option?
I ask because I can see times where there might by 100,000 entities or more and having to iterate through each one might be an issue.
Is the underlying structure of a dwg a database? If it is could you not have a method to query the db directly? I can only assume this is how AutoCAD selection sets work...
Re: SelectionSet or Filter for Entities
Hello.
The code sample was an example of creating collection of entities with some specific characteristic (ellipse entities). If I understand correctly the filling of selection set object in AutoCAD is similar proccess, for example by group codes. The necessity of iterating over collection depends on your task. Selection can be realized by handle or visually.
Alexander.
The code sample was an example of creating collection of entities with some specific characteristic (ellipse entities). If I understand correctly the filling of selection set object in AutoCAD is similar proccess, for example by group codes. The necessity of iterating over collection depends on your task. Selection can be realized by handle or visually.
Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support
-
- Posts: 16
- Joined: 31 May 2010, 13:33
Re: SelectionSet or Filter for Entities
Hi,
Maybe if I'm more specific you can tell me if it can do this.
Say I have 100,000 lines in my dwg and 200,000 block references for a total of 300,000 entities in my drawing (lets not even talk about points).
I want to be able to quickly select all lines on layer 123, that are red and have a linetype of dot.
What would be great would be to query the data directly from the drawing if it has an underlying database, I don't know enough about dwg's to say for sure I am just speculating, but it makes since to me that it's built on a relational database.
For example for regular SQL: SELECT ALL Lines FROM LineTable WHERE Layer ="Red" AND Linetype = "dot";.
Let the database do the work it's designed to do, rather that iterating over all 300,000 entities, first checking if its a Line then check the layer name and linetype AND so on.
AutoCAD selectionset's are like the first example in that I set some group codes and logical operators (less than, greater than, equal to etc...) to form a quasi query. Selection sets are much much faster that trying to iterate over every entity in the drawing.
I don't know if you guys have any features/abilities to get at data like that or not?
Maybe if I'm more specific you can tell me if it can do this.
Say I have 100,000 lines in my dwg and 200,000 block references for a total of 300,000 entities in my drawing (lets not even talk about points).
I want to be able to quickly select all lines on layer 123, that are red and have a linetype of dot.
What would be great would be to query the data directly from the drawing if it has an underlying database, I don't know enough about dwg's to say for sure I am just speculating, but it makes since to me that it's built on a relational database.
For example for regular SQL: SELECT ALL Lines FROM LineTable WHERE Layer ="Red" AND Linetype = "dot";.
Let the database do the work it's designed to do, rather that iterating over all 300,000 entities, first checking if its a Line then check the layer name and linetype AND so on.
AutoCAD selectionset's are like the first example in that I set some group codes and logical operators (less than, greater than, equal to etc...) to form a quasi query. Selection sets are much much faster that trying to iterate over every entity in the drawing.
I don't know if you guys have any features/abilities to get at data like that or not?
Re: SelectionSet or Filter for Entities
Hello Scott.
The AutoCAD DWG/DXF format structure is a database itself. Each entity from AutoCAD drawing has its own unique identifier - the handle. The handle is the key to AutoCAD drawing's data. However, selection of a set of entities that have some specific property (like color or type) require Iterating.
Alexander.
The AutoCAD DWG/DXF format structure is a database itself. Each entity from AutoCAD drawing has its own unique identifier - the handle. The handle is the key to AutoCAD drawing's data. However, selection of a set of entities that have some specific property (like color or type) require Iterating.
yes, but you need create the selection set before use it. And this proccess is similar to code for the CAD Import .NET.AutoCAD selectionset's are like the first example in that I set some group codes and logical operators (less than, greater than, equal to etc...) to form a quasi query. Selection sets are much much faster that trying to iterate over every entity in the drawing.
Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support