Unsolved

Knowing the levels of a cad file takes a long time

Comments: 0  
Posted on Jun 6, 2017
 
 

Good morning, We are using a CAD connection to load the levels of a CAD file in a combobox by "GRecordset". Our issue is this process takes a long time because the CAD file has 300.000 elements and It can not be used "DISTINCT" in the sql statement. is there other way to know the levels of a CAD file by code?

This is our code:

string[] cadFileLevels = { };

int cadFileLevelNumber = 0;

Intergraph.GeoMedia.PClient.GDatabase gDatabase = cadConnection.Database as Intergraph.GeoMedia.PClient.GDatabase;

Intergraph.GeoMedia.PClient.GRecordset gRecordset = gDatabase.OpenRecordset("SELECT ElementLevelName FROM AllElements", null, null, null, null, null);

if (gRecordset.RecordCount > 0)

{

gRecordset.MoveLast();

gRecordset.MoveFirst();

while (!gRecordset.EOF)

{

try

{

if (Array.IndexOf(cadFileLevels, gRecordset.GFields["ElementLevelName"].Value.ToString()) < 0)

{

Array.Resize<string>(ref cadFileLevels, cadFileLevels.Length + 1);

cadFileLevels[cadFileLevelNumber] = (gRecordset.GFields["ElementLevelName"].Value == DBNull.Value ? string.Empty : gRecordset.GFields["ElementLevelName"].Value.ToString());

cadFileLevelNumber++;

}

} catch { }

gRecordset.MoveNext();

}

}

Thanks.

Point your RSS reader here for a feed of the latest messages in this topic

Add a Comment

Please sign in on the right menu to comment.  If you do not have an account, please Join now.