Modify(AttributedRelationshipClassDescription) Method
Enqueue the modify operation on the object referred to by the
AttributedRelationshipClassDescription. This method must be called on the MCT. Use QueuedTask.Run.
Add relationship rules to a relationship class
public void ModifyRelationshipClass(SchemaBuilder schemaBuilder, AttributedRelationshipClassDefinition attributedRelationshipClassDefinition)
{
AttributedRelationshipClassDescription attributedRelationshipClassDescription = new AttributedRelationshipClassDescription(attributedRelationshipClassDefinition);
// Update the relationship split policy
attributedRelationshipClassDescription.RelationshipSplitPolicy = RelationshipSplitPolicy.UseDefault;
// Add field in the intermediate table
attributedRelationshipClassDescription.FieldDescriptions.Add(FieldDescription.CreateIntegerField("RelationshipStatus"));
// Add relationship rules based on subtypes,if available
// Assuming origin class has subtype with code 1
attributedRelationshipClassDescription.RelationshipRuleDescriptions.Add(new RelationshipRuleDescription(1, null));
// Enqueue modify operation
schemaBuilder.Modify(attributedRelationshipClassDescription);
// Execute modify DDL operation
schemaBuilder.Build();
}
Modifying annotation labels and symbols
public void ModifyAnnotationLabelAndSymbols(SchemaBuilder schemaBuilder, AnnotationFeatureClassDefinition annotationFeatureClassDefinition)
{
AnnotationFeatureClassDescription annotationFeatureClassDescription = new AnnotationFeatureClassDescription(annotationFeatureClassDefinition);
IReadOnlyList<CIMLabelClass> labelClasses = annotationFeatureClassDescription.LabelClasses;
// Adding a new annotation label class
List<CIMLabelClass> modifiedLabelClasses = new List<CIMLabelClass>(labelClasses);
modifiedLabelClasses.Add(new CIMLabelClass()
{
Name = "RedSymbol",
TextSymbol = new CIMSymbolReference
{
Symbol = new CIMTextSymbol()
{
Angle = 45,
FontType = FontType.Type1,
FontFamilyName = "Arial",
FontEffects = FontEffects.Normal,
HaloSize = 2.0,
Symbol = new CIMPolygonSymbol { SymbolLayers = new CIMSymbolLayer[] { new CIMSolidFill { Color = CIMColor.CreateRGBColor(255, 0, 0) } }, UseRealWorldSymbolSizes = true }
},
MaxScale = 0,
MinScale = 0,
SymbolName = "TextSymbol-RED"
},
});
// Adding a new symbol
annotationFeatureClassDescription.Symbols.Add(new CIMSymbolIdentifier()
{
ID = 1001,
Name = "ID_10001",
Symbol = new CIMTextSymbol()
{
Angle = 43,
FontEffects = FontEffects.Subscript,
FontType = FontType.TTOpenType,
FontStyleName = "Regular",
FontFamilyName = "Tahoma",
TextCase = TextCase.Allcaps
}
});
// Modify annotation feature class
AnnotationFeatureClassDescription modifiedAnnotationFeatureClassDescription = new AnnotationFeatureClassDescription(annotationFeatureClassDescription.Name, annotationFeatureClassDescription.FieldDescriptions, annotationFeatureClassDescription.ShapeDescription, annotationFeatureClassDescription.GeneralPlacementProperties, modifiedLabelClasses);
// Enqueue modify
schemaBuilder.Modify(modifiedAnnotationFeatureClassDescription);
// DDL execute
schemaBuilder.Build();
}
Target Platforms: Windows 11, Windows 10
ArcGIS Pro version: 3.1 or higher.