ArcGIS Pro 3.5 API Reference Guide
ArcGIS.Core.Data.DDL Namespace / SchemaBuilder Class / Create Method / Create(FeatureDatasetDescription,DimensionFeatureClassDescription) Method
Indicates the ArcGIS.Core.Data.FeatureDataset where the ArcGIS.Core.Data.Mapping.DimensionFeatureClass will be created.
Indicates the ArcGIS.Core.Data.Mapping.DimensionFeatureClass to be created.
Example

In This Topic
    Create(FeatureDatasetDescription,DimensionFeatureClassDescription) Method
    In This Topic
    Enqueue the create operation on the object referred to by the DimensionFeatureClassDescription. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Exceptions
    ExceptionDescription

    The ArcGIS.Core.Geometry.SpatialReference of the featureDatasetDescription and the dimensionFeatureClassDescription do not match.

    -or-

    The total path length for the ArcGIS.Core.Data.Mapping.DimensionFeatureClass to be created must be less than 252 characters.

    -or-

    The annotation symbols are invalid.

    featureDatasetDescription and/or dimensionFeatureClassDescription is null.
    Memory ArcGIS.Core.Data.Geodatabase does not support feature datasets.
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Example
    Creating a dimension feature class
    public 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.
      }
    }
    
    private 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;
    }
    
    private CIMFill DefaultFill(CIMColor color)
    {
      return new CIMSolidFill()
      {
        Enable = true,
        Name = "Fill_" + Guid.NewGuid().ToString(),
        ColorLocked = false,
        Color = color
      };
    }
    
    private 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,
      };
    }
    
    private 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) } };
    }
    
    private CIMLineSymbol GetLineSymbol(CIMColor color, double width)
    {
      var stroke = DefaultStroke(color, width);
    
      return new CIMLineSymbol() { SymbolLayers = new CIMSymbolLayer[1] { stroke } };
    }
    
    private Polygon CreateArrowGeometry()
    {
      double x = 2.39;
      double y = 1.20;
      double xMod = 0.3;
    
      var pt1 = new Coordinate2D() { X = -x + xMod, Y = -y };
      var pt2 = new Coordinate2D() { X = x + xMod, Y = 0 };
      var pt3 = new Coordinate2D() { X = -x + xMod, Y = y };
      var coords = new List<Coordinate2D>() { pt1, pt2, pt3 };
    
      var polygon = PolygonBuilderEx.CreatePolygon(coords);
      return polygon;
    }
    
    private 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,
      };
    }
    
    private 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
      };
    }
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.5 or higher.
    See Also