AnsweredAssumed Answered

Setting arcpy.env tolerance and resolution in standalone script

Question asked by mkisakye_works on Jun 5, 2020
Latest reply on Jun 8, 2020 by mkisakye_works

I have a template file from which I am retrieving tolerance and resolution settings as in the code below. Using arcpy.AddMessage, I am able to confirm that the settings were retrieved from the template file and applied. I then run FeatureClassToFeatureClass in a bid to have the newly set tolerance and resolution values applied to the output feature class. Unfortunately, these settings are not applied to the output file. When I run this same code in the python window, the settings are applied as expected. I am using ArcGIS Pro 2.5.1. Dan Patterson

templateFile=arcpy.GetParameterAsText(0)
if templateFile != "":
    sr_object=arcpy.Describe(templateFile).spatialreference
    arcpy.env.MTolerance=sr_object.MTolerance
    arcpy.env.MResolution=sr_object.MResolution
    arcpy.env.XYTolerance="{0} {1}".format(sr_object.XYTolerance,sr_object.linearUnitName)
    arcpy.env.XYResolution="{0} {1}".format(sr_object.XYResolution,sr_object.linearUnitName)

arcpy.AddMessage(arcpy.env.MTolerance)
arcpy.AddMessage(arcpy.env.MResolution)
arcpy.AddMessage(arcpy.env.XYTolerance)
arcpy.AddMessage(arcpy.env.XYResolution)
arcpy.FeatureClassToFeatureClass_conversion("Mylayer","//Path//to//gdb", "OutLayer")

Outcomes