Hello,
A tool created for conversion, worked fine on ArcGIS Pro, but while/when published the Input value changed to constant value, need kindly help
Environment: ArcGIS Pro 3.2.1, ArcGIS Enterprise 11.1
def getParameterInfo(self):
"""Define the tool parameters."""
params = [
arcpy.Parameter(displayName="Input CAD File",
name="in_cad",
datatype="DECadDrawingDataset",
parameterType="Required",
direction="Input"),
arcpy.Parameter(displayName="Output JSON File",
name="out_json",
datatype="DEFile",
parameterType="Required",
direction="Output")
]
return params
def execute(self, parameters, messages):
"""The source code of the tool."""
in_cad = parameters[0].valueAsText
out_json = parameters[1].valueAsText
desktop = os.path.join(os.path.join(os.environ['USERPROFILE']), 'Desktop')
newpath = desktop+str(r'\output')
if not os.path.exists(newpath):
os.makedirs(newpath)
arcpy.env.workspace = desktop+r"\output\fGDB.gdb"
# Set local variables
out_folder_path = desktop+str(r"\output" )
out_name = "fGDB.gdb"
# Execute Create FileGDB, temp
arcpy.CreateFileGDB_management(out_folder_path, out_name)
#####################################
# Process: CAD to Geodatabase
arcpy.CADToGeodatabase_conversion(in_cad, out_folder_path+'/'+out_name, "FClass", "1000", "GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]];-400 -400 11258999068426.2;-1073.7418235 4194304001953.12;-100000 10000;8.98315284119522E-09;0.001;0.001;IsHighPrecision")
#####################################
# Process: Iterate Feature Classes
datasets = arcpy.ListDatasets(feature_type='feature')
datasets = [''] + datasets if datasets is not None else []
for ds in datasets:
for fc in arcpy.ListFeatureClasses(feature_dataset=ds):
path = os.path.join(arcpy.env.workspace, ds, fc)
print(path)
#####################################
# Process: Features To JSON
arcpy.FeaturesToJSON_conversion(fc, out_json, "FORMATTED", "NO_Z_VALUES", "NO_M_VALUES", "GEOJSON")
#####################################
# Execute Delete FileGDB
arcpy.Delete_management(newpath)
return