Summary
Adds a feature class representation to a geodatabase feature class.
Usage
The input must be a geodatabase feature class.
Two new fields with the specified field names will be appended to the input feature class attribute table to identify the representation rules that govern how each category of features will be portrayed, and to hold any feature-specific overrides to these rules.
Specify an import rule layer to import symbol choices listed under the renderer type (i.e., Categories-Unique values) specified on the layer file. All of the symbol choices will be copied into this feature class representation as new representation rules. If an import rule layer is not specified, all features will be assigned to a single default representation rule.
If the import rule layer has the same source feature class as the input feature class, you can use the Assign Rule IDs parameter to assign representation rules to features to match the RuleID assignments of the import rule layer.
If an import rule layer is specified and the Assign Rule IDs parameter is set to ASSIGN, all features will be assigned to a representation rule based on the symbol choices listed under the renderer type (i.e., Categories-Unique values) specified on the layer file. If an import rule layer is specified, but the Assign Rule IDs parameter is set to NO_ASSIGN, all features will be assigned to a single default representation rule.
If <all other values> is used to symbolize features in the input layer, that symbol will become Rule ID 1 when a representation is added.
Syntax
arcpy.cartography.AddRepresentation(in_features, representation_name, {rule_id_field_name}, {override_field_name}, {geometry_editing_option}, {import_rule_layer}, {assign_rule_id_option})
Parameter | Explanation | Data Type |
in_features | The input geodatabase feature class to which a new feature class representation will be added. | Feature Layer |
representation_name | The name of the feature class representation to be added. | String |
rule_id_field_name (Optional) | The name of the RuleID field, which will hold a reference to the representation rule for each feature. | String |
override_field_name (Optional) | The name of the Override field, which will hold overrides to representation rules for each feature. | String |
geometry_editing_option (Optional) | Specifies what will happen to the supporting feature class geometry when features are modified with the representation editing tools.
| String |
import_rule_layer (Optional) | A feature layer that symbolizes features with a feature class representation, from which the representation rules are imported. | Layer |
assign_rule_id_option (Optional) | Specifies whether or not to assign representation rules to features to match the RuleID assignments of the import rule layer. This option applies only when Import Rule Layer is specified.
| String |
Code sample
AddRepresentation tool Example (Python Window)
The following Python window script demonstrates how to use the AddRepresentation tool in immediate mode.
import arcpy
from arcpy import env
env.workspace = "C:/data"
arcpy.AddRepresentation_cartography("C:/data/cartography.gdb/buildings/footprints",
"footprints_Rep", "RuleID", "Override",
"STORE_CHANGE_AS_OVERRIDE", "C:/data/footprints.lyr", "ASSIGN")
AddRepresentation tool Example (stand-alone Python script)
This stand-alone script shows an example of using the AddRepresentation tool.
# Name: AddRepresentation_standalone_script.py
# Description: Adds a feature class representation
# to a geodatabase feature class.
# Import system modules
import arcpy
from arcpy import env
# Set environment settings
env.workspace = "C:/data"
# Set local variables
in_features = "C:/data/cartography.gdb/buildings/footprints"
representation_name = "footprints_Rep"
rule_id_field_name = "RuleID"
override_field_name = "Override"
geometry_editing_option = "STORE_CHANGE_AS_OVERRIDE"
import_rule_layer = "C:/data/footprints.lyr"
assign_rule_id_option = "ASSIGN"
# Execute Add Representation
arcpy.AddRepresentation_cartography(in_features,
representation_name,
rule_id_field_name,
override_field_name,
geometry_editing_option,
import_rule_layer,
assign_rule_id_option)
Environments
Licensing information
- Basic: No
- Standard: Yes
- Advanced: Yes