ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Core.Data.Mapping Namespace / DimensionFeatureClassDefinition Class
Members Example

In This Topic
    DimensionFeatureClassDefinition Class
    In This Topic
    Represents the schema and properties of a DimensionFeatureClass.
    Object Model
    DimensionFeatureClassDefinition ClassEnvelope ClassUnit ClassSpatialReference Class
    Syntax
    Public NotInheritable Class DimensionFeatureClassDefinition 
       Inherits ArcGIS.Core.Data.FeatureClassDefinition
       Implements System.IDisposable 
    public sealed class DimensionFeatureClassDefinition : ArcGIS.Core.Data.FeatureClassDefinition, System.IDisposable  
    Example
    Creating a dimension feature class
    {
      // Must be called within QueuedTask.Run
      void CreateDimensionFeatureClass(Geodatabase geodatabase)
      {
        // Dimension feature class name
        string dimensionFeatureClassName = "LineInfo";
    
        // Create user defined attribute fields for dimension feature class 
        FieldDescription nameFieldDescription = new FieldDescription("Name", FieldType.String);
        FieldDescription distanceFieldDescription = new FieldDescription("DistanceMeasure", FieldType.Double);
        FieldDescription measurementDateFieldDescription = new FieldDescription("MeasurementDate", FieldType.Date);
    
        // Create a list of all field descriptions
        List<FieldDescription> fieldDescriptions = new List<FieldDescription>
            { nameFieldDescription, distanceFieldDescription, measurementDateFieldDescription };
    
        // Create a ShapeDescription object
        ShapeDescription shapeDescription = new ShapeDescription(GeometryType.Polygon, SpatialReferences.WGS84);
    
        // Create a SchemaBuilder object
        SchemaBuilder schemaBuilder = new SchemaBuilder(geodatabase);
    
        // Create DimensionFeatureClassDescription object
        DimensionFeatureClassDescription dimensionFeatureClassDescription = new DimensionFeatureClassDescription(
          dimensionFeatureClassName, fieldDescriptions,
          shapeDescription, GetCIMDimensionStyles());
    
        // Token
        DimensionFeatureClassToken dimensionFeatureClassToken =
          schemaBuilder.Create(dimensionFeatureClassDescription);
    
        // Execute the DDL
        bool success = schemaBuilder.Build();
    
        // Inspect error messages
        if (!success)
        {
          IReadOnlyList<string> errorMessages = schemaBuilder.ErrorMessages;
          //etc.
        }
    
        List<CIMDimensionStyle> GetCIMDimensionStyles()
        {
          CIMColor color = CIMColor.CreateRGBColor(10, 20, 30);
          CIMPointSymbol beginMarkerSymbol = GetMarkerSymbol(color);
          CIMPointSymbol endMarkerSymbol = GetMarkerSymbol(color);
          CIMLineSymbol dimensionLineSymbol = GetLineSymbol(color, 0.5);
          CIMLineSymbol extensionLineSymbol = GetLineSymbol(color, 0.5);
          CIMTextSymbol textSymbol = GetDefaultTextSymbol(10);
          textSymbol.Symbol = GetPolygonSymbol(color, color, 0);
          textSymbol.HorizontalAlignment = HorizontalAlignment.Center;
    
          CIMDimensionStyle cimDimensionStyle = new CIMDimensionStyle()
          {
            Name = "Style 1",
            ID = 0,
            Align = true,
            DisplayUnits = null,
            DisplayPrecision = 0,
    
            BeginMarkerSymbol = beginMarkerSymbol,
            EndMarkerSymbol = endMarkerSymbol,
            MarkerOption = DimensionPartOptions.Both,
            MarkerFit = DimensionMarkerFit.Text,
    
            DimensionLineSymbol = dimensionLineSymbol,
            DimensionLineOption = DimensionPartOptions.Both,
            DrawLineOnFit = false,
            ExtendLineOnFit = true,
    
            BaselineHeight = 0.0,
            ExtensionLineSymbol = extensionLineSymbol,
            ExtensionLineOption = DimensionPartOptions.Both,
            ExtensionLineOvershot = 0.0,
            ExtensionLineOffset = 0.0,
    
            Expression = "",
            ExpressionParserName = "Arcade",
    
            TextSymbol = textSymbol,
            TextOption = DimensionTextOption.Only,
            TextFit = DimensionTextFit.MoveBegin,
          };
    
          List<CIMDimensionStyle> cimDimensionStyles = [cimDimensionStyle];
    
          return cimDimensionStyles;
        }
    
        CIMFill DefaultFill(CIMColor color)
        {
          return new CIMSolidFill()
          {
            Enable = true,
            Name = "Fill_" + Guid.NewGuid().ToString(),
            ColorLocked = false,
            Color = color
          };
        }
    
        CIMStroke DefaultStroke(CIMColor color, double width = 1)
        {
          return new CIMSolidStroke()
          {
            Color = color,
            Name = "Stroke_" + Guid.NewGuid().ToString(),
            CapStyle = LineCapStyle.Round,
            JoinStyle = LineJoinStyle.Round,
            CloseCaps3D = false,
            LineStyle3D = Simple3DLineStyle.Strip,
            MiterLimit = 4,
            Width = width,
    
            ColorLocked = false,
            Enable = true,
          };
        }
    
        CIMPolygonSymbol GetPolygonSymbol(CIMColor fillColor, CIMColor outlineColor, double outlineWidth)
        {
          if ((outlineColor == null) || (outlineWidth <= 0))
            return new CIMPolygonSymbol() { SymbolLayers = new CIMSymbolLayer[1] { DefaultFill(fillColor) } };
          return new CIMPolygonSymbol()
          {
            SymbolLayers = new CIMSymbolLayer[2]
              { DefaultStroke(outlineColor, outlineWidth), DefaultFill(fillColor) }
          };
        }
    
        CIMLineSymbol GetLineSymbol(CIMColor color, double width)
        {
          CIMStroke stroke = DefaultStroke(color, width);
    
          return new CIMLineSymbol() { SymbolLayers = new CIMSymbolLayer[1] { stroke } };
        }
    
        Polygon CreateArrowGeometry()
        {
          double x = 2.39;
          double y = 1.20;
          double xMod = 0.3;
    
          Coordinate2D pt1 = new Coordinate2D() { X = -x + xMod, Y = -y };
          Coordinate2D pt2 = new Coordinate2D() { X = x + xMod, Y = 0 };
          Coordinate2D pt3 = new Coordinate2D() { X = -x + xMod, Y = y };
          List<Coordinate2D> coords = new List<Coordinate2D>() { pt1, pt2, pt3 };
    
          Polygon polygon = PolygonBuilderEx.CreatePolygon(coords);
          return polygon;
        }
    
        CIMPointSymbol GetMarkerSymbol(CIMColor color)
        {
          CIMMarkerGraphic graphic = new CIMMarkerGraphic()
          {
            Geometry = CreateArrowGeometry(),
            Symbol = new CIMPolygonSymbol()
            {
              SymbolLayers = new CIMSymbolLayer[1]
              {
                  new CIMSolidFill()
                  {
                    Enable = true,
                    Color = color,
                  }
              },
              UseRealWorldSymbolSizes = false
            }
          };
    
          CIMSymbolLayer symbolLayer = new CIMVectorMarker()
          {
            Enable = true,
            Size = 12,
            Frame = new EnvelopeBuilderEx() { XMin = -5, YMin = -3, XMax = 5, YMax = 3 }.ToGeometry() as Envelope,
            MarkerGraphics = new CIMMarkerGraphic[1] { graphic },
            ScaleSymbolsProportionally = true,
            RespectFrame = true
          };
    
          return new CIMPointSymbol()
          {
            SymbolLayers = new CIMSymbolLayer[1] { symbolLayer },
            HaloSize = 1,
            ScaleX = 1,
            AngleAlignment = AngleAlignment.Map,
          };
        }
    
        CIMTextSymbol GetDefaultTextSymbol(double height)
        {
          return new CIMTextSymbol()
          {
            DrawGlyphsAsGeometry = false,
            DrawSoftHyphen = false,
            ExtrapolateBaselines = true,
            FlipAngle = 0.0,
            IndentAfter = 0.0,
            IndentBefore = 0.0,
            IndentFirstLine = 0.0,
            Kerning = true,
            LetterSpacing = 0.0,
            LetterWidth = 100.0,
            Ligatures = true,
            LineGap = 0.0,
            LineGapType = LineGapType.ExtraLeading,
            Underline = false,
            Strikethrough = false,
            OffsetX = 0.0,
            OffsetY = 0.0,
            FontFamilyName = "Tahoma",
            FontStyleName = "Regular",
            WordSpacing = 100.0,
            Height = height
          };
        }
      }
    }
    Inheritance Hierarchy

    System.Object
       ArcGIS.Core.CoreObjectsBase
          ArcGIS.Core.Data.Definition
             ArcGIS.Core.Data.TableDefinition
                ArcGIS.Core.Data.FeatureClassDefinition
                   ArcGIS.Core.Data.Mapping.DimensionFeatureClassDefinition

    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also