AnsweredAssumed Answered

ArcObjects 10.1, C#, export "Create Steepest Path" output to shapefile

Question asked by jaeckli on Oct 15, 2013
Latest reply on Oct 16, 2013 by jaeckli
I'm using ArcObjects 10.1 and C# and would like to export the result of the "Create Steepest Path" Tool into a new Shapefile or FeatureClass. I thought that the result of the "Create Steepest Path" Tool is a graphic line which will be stored in ArcMap (ActiveGraphicsLayer). After executing the "Create Steepest Path" Tool a graphic line is created and displayed but the ActiveGraphicsLayer seems to be empty. pElement in the code below, which should contain the graphic line, is empty. Any suggestion?

       // Umwandlung Graphik-Linie in 3D Shape
        public void ConvertGraphicTo3DShape(string aName, string aPath, ESRI.ArcGIS.Carto.IActiveView pActiveView)

            // Shape WorkspaceFactory
            ESRI.ArcGIS.Geodatabase.IWorkspaceFactory pWSF =
                new ESRI.ArcGIS.DataSourcesFile.ShapefileWorkspaceFactoryClass();

            // Workspace
            ESRI.ArcGIS.Geodatabase.IFeatureWorkspace pFWS =
            // Geometry Typ
            ESRI.ArcGIS.Geometry.esriGeometryType pGeomType =

            // Shape-Datei anlegen (Methode "CreateShape" aus Klasse "CreateShapeFile")
            CreateShapeFile pShape = new CreateShapeFile();
            ESRI.ArcGIS.Geodatabase.IFeatureClass pOutFC =
                pShape.CreateShape(pFWS, aPath, aName, pGeomType, null);

            // Feature Cursor
            ESRI.ArcGIS.Geodatabase.FeatureCursor pFCur =

            // Memory Buffer
            ESRI.ArcGIS.Geodatabase.IFeatureBuffer pFBuff =

            // Aktive Karte
            ESRI.ArcGIS.Carto.IMap pMxMap = pActiveView.FocusMap;

            // Graphic Container
            //ESRI.ArcGIS.Carto.IGraphicsContainer pGC = pActiveView.GraphicsContainer;
            ESRI.ArcGIS.Carto.IGraphicsContainer pGC =
            // Polyline Grafikelemente in die Shape-Datei schreiben
            ESRI.ArcGIS.Carto.IElement pElement =

            while (!(pElement == null))
                if (pElement.Geometry.GeometryType == ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline)
                    pFBuff.Shape = pElement.Geometry;
                pElement = pGC.Next();


Thank you for your help.