When you create a new add-in project with Visual Studio, you should see some options like this. ((ITransform2D)sc).Rotate(center, angle) ISegmentCollection sc = new PolygonClass() as ISegmentCollection It is usually easiest to just connect to your. To access the contents of a folder, you must Connect to Folder to make that folder or directory visible to ArcMap.
Arcmap create shapefile plus#
Click the plus sign in the toolbar to Add Data. Var mapFrame = grphCont.FindFrame(map) as IMapFrame Creating a Project Directory and Unzipping a Zipped Shapefile Adding a Shapefile To an ArcMap Map. A polygon is returned since the dataframe might be rotated Private IPolygon GetExtentPolygon(IMap map) If (File.Exists(System.IO.Path.Combine(fi.DirectoryName,fileName))) String fileName = String.Format(".shp", name) String name = fi.Name.ToUpper().EndsWith(".SHP") ? fi.Name.Substring(0, fi.Name.LastIndexOf(".")) : fi.Name Private IFeatureClass OpenShapeFile(string shpFilepath) If (length > 0 & fType = esriFieldType.esriFieldTypeString) Private IField MakeField(string name, esriFieldType fType, int length) Var fc = fws.CreateFeatureClass(fcName, flds, null, null, esriFeatureType.esriFTSimple, "Shape", "") Var shpField = MakeField("Shape", esriFieldType.esriFieldTypeGeometry, 0) as IFieldEdit įlds.AddField(MakeField("Name", esriFieldType.esriFieldTypeString, 16)) įcName = fcName.Substring(0, fcName.LastIndexOf(".")) GeomDef.SpatialReference_2 = geom.SpatialReference GeomDef.GeometryType_2 = geom.GeometryType IGeometryDefEdit geomDef = new GeometryDefClass() Var fws = wsf.OpenFromFile(fi.DirectoryName, 0) as IFeatureWorkspace įlds.AddField(MakeField("ObjectID", esriFieldType.esriFieldTypeOID,0)) Var wsf = Activator.CreateInstance(Type.GetTypeFromProgID("esriDataSourcesFile.ShapefileWorkspaceFactory")) as IWorkspaceFactory System.IO.FileInfo fi = new FileInfo(shpFilepath) Private IFeatureClass CreateShapeFile(string shpFilepath, IGeometry geom) IFeature feat = featClass.CreateFeature() Var featClass = OpenShapeFile(shpFilePath) įeatClass = CreateShapeFile(shpFilePath, geom) Private void WritePolygon(string shpFilePath, IGeometry geom) ((IFillShapeElement)element).Symbol = polygon) var element = new PolygonElementClass() as IElement IGraphicsContainer gc = as IGraphicsContainer Public class Extent2ShapefileButton : .Button
Arcmap create shapefile code#
This c# code could be used to build an add-in for Arcmap.