Select to view content in your preferred language

About reading features from Dgn file ?

718
0
02-24-2014 07:21 PM
TaiBui
by
Frequent Contributor
Hi everyone,

I am getting a problem when try to read features from the Dgn files using ArcObjects. After I delete some elements (polygons) in Dgn file. They still exist when reading the dgn file.

Do you know how to ignore the deleted features ? Please see my code:

           Type factoryType = Type.GetTypeFromProgID(
                 "esriDataSourcesFile.CadWorkspaceFactory");
            System.Object obj = Activator.CreateInstance(factoryType);

            factory = obj as IWorkspaceFactory;

            IFeatureWorkspace ftrWorkSpace = (IFeatureWorkspace)factory.OpenFromFile(strWorkSpace, 0);
            IFeatureDataset pFeatureDataset = ftrWorkSpace.OpenFeatureDataset(strFileName);
            IFeatureClassContainer pFeatureClassContainer = (IFeatureClassContainer)pFeatureDataset;
            IFeatureClass pCadPolygon;
            pCadPolygon = pFeatureClassContainer.get_ClassByName("polygon");
            IFeatureCursor pFeatureCursor = pCadPolygon.Search(null, false);
            if (pFeatureCursor == null)
                return false;
            While (pFeature != null)
            {
                   //.....
            }


Thanks and regards,
Tai
Tags (2)
0 Kudos
0 Replies