Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #
- # @author Cindy Jayakumar
- # @date 21/07/2018
- #
- # Extract domains from a field in one feature class, and apply
- # it to matching fields in another feature class.
- #
- import arcpy
- source_fc = r'C:\Some\Arb\Folder\test.gdb\source'
- target_fc = r'C:\Some\Arb\Folder\test.gdb\target'
- # Get field names and domains if applicable
- source_fields = {field.name : field.domain for field in arcpy.ListFields(source_fc) if field.domain}
- for field in arcpy.ListFields(target_fc):
- if field.name in source_fields and field.domain is None:
- arcpy.management.AssignDomainToField(target_fc, field.name, source_fields[field.name])
- print("Assigned {0} to {1}".format(source_fields[field.name], field.name)
Add Comment
Please, Sign In to add comment