taibc

About reading features from Dgn file ?

Discussion created by taibc on Feb 24, 2014
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

Outcomes