ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Core.Data.DDL Namespace / SchemaBuilder Class / Create Method / Create(DimensionFeatureClassDescription) Method
Indicates the ArcGIS.Core.Data.Mapping.DimensionFeatureClass to be created.
Example

In This Topic
    Create(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 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.

    dimensionFeatureClassDescription is null.
    This method or property must be called within the lambda passed to QueuedTask.Run.
    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
          };
        }
      }
    }
    Creating a table with index from scratch
    {
      // Must be called within QueuedTask.Run
      void CreatingTableWithIndex(SchemaBuilder schemaBuilder)
      {
        FieldDescription nameFieldDescription = FieldDescription.CreateStringField("Name", 50);
        FieldDescription addressFieldDescription = FieldDescription.CreateStringField("Address", 200);
    
        // Creating a feature class, 'Buildings' with two fields
        TableDescription tableDescription = new TableDescription("Buildings",
          new List<FieldDescription>() { nameFieldDescription, addressFieldDescription });
    
        // Enqueue DDL operation to create a table
        TableToken tableToken = schemaBuilder.Create(tableDescription);
    
        // Creating an attribute index named as 'Idx'
        AttributeIndexDescription attributeIndexDescription = new AttributeIndexDescription("Idx", new TableDescription(tableToken),
          new List<string> { nameFieldDescription.Name, addressFieldDescription.Name });
    
        // Enqueue DDL operation to create an attribute index
        schemaBuilder.Create(attributeIndexDescription);
    
        // Execute build indexes operation
        bool isBuildSuccess = schemaBuilder.Build();
      }
    }
    Adding indexes in pre-existing dataset
    {
      // Must be called within QueuedTask.Run
      void AddingIndexes(SchemaBuilder schemaBuilder, FeatureClassDefinition featureClassDefinition)
      {
        // Field names to add in the attribute index
        string fieldName = featureClassDefinition.GetFields().First(f => f.AliasName.Contains("Name")).Name;
        string fieldAddress = featureClassDefinition.GetFields().First(f => f.AliasName.Contains("Address")).Name;
    
        // Creating an attribute index with index name 'Idx' and two participating fields' name
        AttributeIndexDescription attributeIndexDescription = new AttributeIndexDescription("Idx",
          new TableDescription(featureClassDefinition), new List<string> { fieldName, fieldAddress });
    
        // Enqueue DDL operation for an attribute index creation 
        schemaBuilder.Create(attributeIndexDescription);
    
        // Creating the spatial index 
        SpatialIndexDescription spatialIndexDescription = new SpatialIndexDescription(new FeatureClassDescription(featureClassDefinition));
    
        // Enqueue DDL operation for the spatial index creation
        schemaBuilder.Create(spatialIndexDescription);
    
        // Execute build indexes operation
        bool isBuildSuccess = schemaBuilder.Build();
    
        if (!isBuildSuccess)
        {
          IReadOnlyList<string> errors = schemaBuilder.ErrorMessages;
          // Iterate and handle errors 
        }
      }
    }
    Creating table with subtypes
    {
      // Must be called within QueuedTask.Run
      void CreateTableWithSubtypes(SchemaBuilder schemaBuilder)
      {
        // Creating a 'Building' table with the subtype field 'BuildingType'
        FieldDescription buildingType = new FieldDescription("BuildingType", FieldType.Integer);
        FieldDescription buildingName = new FieldDescription("Name", FieldType.String);
    
        TableDescription tableDescription = new TableDescription("Building", new List<FieldDescription> { buildingName, buildingType });
    
        // Add the building type subtype with three subtypes - Business, Marketing, Security
        tableDescription.SubtypeFieldDescription = new SubtypeFieldDescription(buildingType.Name,
          new Dictionary<int, string> { { 1, "Business" }, { 2, "Marketing" }, { 3, "Security" } })
        {
          DefaultSubtypeCode = 3 // Assigning 'Security' building type as the default subtype
        };
    
        schemaBuilder.Create(tableDescription);
        schemaBuilder.Build();
      }
    }
    Creating relationship class
    {
      // Must be called within QueuedTask.Run
      void CreateRelationshipWithRelationshipRules(SchemaBuilder schemaBuilder)
      {
        // Creating a 'BuildingType' table with two fields - BuildingType and BuildingTypeDescription
        FieldDescription buildingType = FieldDescription.CreateIntegerField("BuildingType");
        FieldDescription buildingTypeeDescription = FieldDescription.CreateStringField("BuildingTypeDescription", 100);
        TableDescription buildingTypeDescription = new TableDescription("BuildingType",
          new List<FieldDescription>() { buildingType, buildingTypeeDescription });
        TableToken buildingtypeToken = schemaBuilder.Create(buildingTypeDescription);
    
        // Creating a 'Building' feature class with three fields - BuildingId, Address, and BuildingType
        FieldDescription buildingId = FieldDescription.CreateIntegerField("BuildingId");
        FieldDescription buildingAddress = FieldDescription.CreateStringField("Address", 100);
        FieldDescription usageSubType = FieldDescription.CreateIntegerField("UsageSubtype");
        FeatureClassDescription featureClassDescription = new FeatureClassDescription("Building",
          new List<FieldDescription> { buildingId, buildingAddress, buildingType, usageSubType },
          new ShapeDescription(GeometryType.Polygon, SpatialReferences.WGS84));
    
        // Set subtype details (optional)
        featureClassDescription.SubtypeFieldDescription = new SubtypeFieldDescription(usageSubType.Name,
          new Dictionary<int, string> { { 1, "Marketing" }, { 2, "Utility" } });
    
        FeatureClassToken buildingToken = schemaBuilder.Create(featureClassDescription);
    
        // Creating a 1:M relationship between the 'Building' feature class and 'BuildingType' table
        RelationshipClassDescription relationshipClassDescription = new RelationshipClassDescription(
          "BuildingToBuildingType", new FeatureClassDescription(buildingToken), new TableDescription(buildingtypeToken),
          RelationshipCardinality.OneToMany, buildingType.Name, buildingType.Name)
        {
          RelationshipType = RelationshipType.Composite
        };
    
        // Adding relationship rules for the 'Marketing' subtype
        relationshipClassDescription.RelationshipRuleDescriptions.Add(new RelationshipRuleDescription(1, null));
    
        schemaBuilder.Create(relationshipClassDescription);
        schemaBuilder.Build();
      }
    }
    Creating attributed relationship class
    {
      // Must be called within QueuedTask.Run
      void CreateAttributedRelationship(SchemaBuilder schemaBuilder)
      {
        // Creating a 'BuildingType' table with two fields - BuildingType and BuildingTypeDescription
        FieldDescription buildingType = FieldDescription.CreateIntegerField("BuildingType");
        FieldDescription buildingTypeeDescription = FieldDescription.CreateStringField("BuildingTypeDescription", 100);
        TableDescription buildingTypeDescription = new TableDescription("BuildingType",
          new List<FieldDescription>() { buildingType, buildingTypeeDescription });
        TableToken buildingtypeToken = schemaBuilder.Create(buildingTypeDescription);
    
        // Creating a 'Building' feature class with three fields - BuildingId, Address, and BuildingType
        FieldDescription buildingId = FieldDescription.CreateIntegerField("BuildingId");
        FieldDescription buildingAddress = FieldDescription.CreateStringField("Address", 100);
        FeatureClassDescription featureClassDescription = new FeatureClassDescription("Building",
          new List<FieldDescription> { buildingId, buildingAddress, buildingType },
          new ShapeDescription(GeometryType.Polygon, SpatialReferences.WGS84));
        FeatureClassToken buildingToken = schemaBuilder.Create(featureClassDescription);
    
        // Creating M:M relationship between the 'Building' feature class and 'BuildingType' table
        AttributedRelationshipClassDescription attributedRelationshipClassDescription =
          new AttributedRelationshipClassDescription("BuildingToBuildingType",
            new FeatureClassDescription(buildingToken),
            new TableDescription(buildingtypeToken), RelationshipCardinality.ManyToMany, "OBJECTID", "BuildingID",
            "OBJECTID", "BuildingTypeID");
    
        // Adding optional attribute field in the intermediate table - 'OwnershipPercentage' field
        attributedRelationshipClassDescription.FieldDescriptions.Add(FieldDescription.CreateIntegerField("OwnershipPercentage"));
    
        schemaBuilder.Create(attributedRelationshipClassDescription);
        schemaBuilder.Build();
      }
    }
    Requirements

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

    ArcGIS Pro version: 3.5 or higher.
    See Also