Quantcast
Channel: Forums - ArcObjects SDKs
Viewing all articles
Browse latest Browse all 1374

How to add Annotation Layer to ArcMap from CAD file

$
0
0
I need to add Annotation Layers from .dwg and .dgn CAD files to arcmap

At first I used Block of code like this

Code:

ESRI.ArcGIS.Geodatabase.IWorkspaceFactory pWorkspaceFact = new
                ESRI.ArcGIS.DataSourcesFile.CadWorkspaceFactory();
                //Open the workspace.
                ESRI.ArcGIS.Geodatabase.IWorkspace pWorkspace = pWorkspaceFact.OpenFromFile
                    (workspace_path, 0);

                ESRI.ArcGIS.Geodatabase.IFeatureWorkspace pFeatureWorkspace =
    (ESRI.ArcGIS.Geodatabase.IFeatureWorkspace)pWorkspace;
 IGroupLayer cl = new GroupLayerClass();
            cl.Name = fc_name;


                IAnnotationLayerFactory lf = new FDOGraphicsLayerFactory() as IAnnotationLayerFactory;
                IAnnotationLayer al= lf.OpenAnnotationLayer(pFeatureWorkspace, null, System.String.Concat(fc_name,":Annotation"));

                cl.Add(al as ILayer);

but this code generates Annotation Layer with broken emty datasource. And datasource cannot be set from CAD manually.

There also is interface
EngineCadAnnotationLayerFactory and CoClass EngineCadAnnotationLayerFactoryClass, but they only implement ILayerFactory interface, not the IAnnotationLayerFacory interface. This trouble makes unreachable OpenAnnotationLayer() method.

Can anyone help me to find solution?

Viewing all articles
Browse latest Browse all 1374

Trending Articles