# Name: ApplyVisualSpecificationToMap_sample.py
# Description: This tool converts existing Visual Specification rules to Arcade
# Import System Modules
import arcpy
# Check Out Extensions
arcpy.CheckOutExtension('Foundation')
# Setting the environment
arcpy.env.overwriteOutput = True
# Setting Local Variables
in_map = r'C:\Data\TM50.mapx'
vs_workspace = r'C:\Data\TDS_6_1_TM_Visual_Specification.gdb'
specification = "TDS_50K :: 50K TM Visual Specification for TDS 6.1"
in_style_file = r'C:\Data\TM.stylx'
# Calling the Apply Visual Specification To Map to convert existing Visual Specification rules to Arcade
arcpy.topographic.ApplyVisualSpecificationToMap(in_map, vs_workspace, specification, in_style_file)
# Getting all messages, warnings, and errors from the tool run and printing the results back to the user
messages = arcpy.GetMessages(0)
warnings = arcpy.GetMessages(1)
errors = arcpy.GetMessages(2)
arcpy.AddMessage('Tool Messages: {}\nTool Warnings: {}\nTool Errors{}\n'.format(messages, warnings, errors))
# Check In Extensions
arcpy.CheckInExtension('Foundation')