<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic ArcGIS Pro custom tool in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-custom-tool/m-p/1332634#M73487</link>
    <description>&lt;P&gt;Hello everyone,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I am working on a tool that used to input multi feature layers, add _QC to the end of each one and add a QC field for each one of them.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What happened when I add the features for the first time it works and I have all layers exported with correct naming and field.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But the issue happens when I select the layers for the second time, the second selected layers are being exported with no issues but for some reason it delete my first exported layers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any idea how to solve this?&lt;/P&gt;&lt;P&gt;The code:&lt;/P&gt;&lt;P&gt;import arcpy&lt;BR /&gt;import os&lt;/P&gt;&lt;P&gt;# Get input parameters&lt;BR /&gt;input_features = arcpy.GetParameterAsText(0).split(';') # Multivalue input&lt;BR /&gt;output_folder = arcpy.GetParameterAsText(1)&lt;/P&gt;&lt;P&gt;# Set overwrite output to True to automatically overwrite existing files&lt;BR /&gt;arcpy.env.overwriteOutput = False&lt;/P&gt;&lt;P&gt;# Create a function to export features with QC suffix and add QC field&lt;BR /&gt;def export_with_qc_suffix(input_feature, output_folder):&lt;BR /&gt;desc = arcpy.Describe(input_feature)&lt;BR /&gt;feature_name = os.path.splitext(desc.name)[0]&lt;BR /&gt;output_name = f"{feature_name}_QC"&lt;BR /&gt;output_feature = os.path.join(output_folder, output_name)&lt;/P&gt;&lt;P&gt;# Check if the output folder exists, and create it if not&lt;BR /&gt;if not os.path.exists(output_folder):&lt;BR /&gt;os.makedirs(output_folder)&lt;/P&gt;&lt;P&gt;arcpy.CopyFeatures_management(input_feature, output_feature)&lt;BR /&gt;arcpy.AddMessage(f"Exported {input_feature} to {output_feature}.")&lt;/P&gt;&lt;P&gt;# Add the "QC" field to the exported feature&lt;BR /&gt;output_desc = arcpy.Describe(output_feature)&lt;BR /&gt;if "QC" not in [field.name for field in output_desc.fields]:&lt;BR /&gt;arcpy.AddField_management(output_feature, "QC", "TEXT", field_length=10)&lt;BR /&gt;arcpy.AddMessage(f"Added 'QC' field to {output_feature}.")&lt;/P&gt;&lt;P&gt;# Loop through input features and export them with QC suffix and QC field&lt;BR /&gt;for feature in input_features:&lt;BR /&gt;export_with_qc_suffix(feature, output_folder)&lt;/P&gt;&lt;P&gt;# Inform the user that the tool has completed&lt;BR /&gt;arcpy.AddMessage("Export process completed.")&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Note I tried setting&amp;nbsp;arcpy.env.overwriteOutput&amp;nbsp; as True but didn't work as well&lt;/P&gt;</description>
    <pubDate>Tue, 26 Sep 2023 19:39:47 GMT</pubDate>
    <dc:creator>HusamAbuOqer</dc:creator>
    <dc:date>2023-09-26T19:39:47Z</dc:date>
    <item>
      <title>ArcGIS Pro custom tool</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-custom-tool/m-p/1332634#M73487</link>
      <description>&lt;P&gt;Hello everyone,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I am working on a tool that used to input multi feature layers, add _QC to the end of each one and add a QC field for each one of them.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What happened when I add the features for the first time it works and I have all layers exported with correct naming and field.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But the issue happens when I select the layers for the second time, the second selected layers are being exported with no issues but for some reason it delete my first exported layers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any idea how to solve this?&lt;/P&gt;&lt;P&gt;The code:&lt;/P&gt;&lt;P&gt;import arcpy&lt;BR /&gt;import os&lt;/P&gt;&lt;P&gt;# Get input parameters&lt;BR /&gt;input_features = arcpy.GetParameterAsText(0).split(';') # Multivalue input&lt;BR /&gt;output_folder = arcpy.GetParameterAsText(1)&lt;/P&gt;&lt;P&gt;# Set overwrite output to True to automatically overwrite existing files&lt;BR /&gt;arcpy.env.overwriteOutput = False&lt;/P&gt;&lt;P&gt;# Create a function to export features with QC suffix and add QC field&lt;BR /&gt;def export_with_qc_suffix(input_feature, output_folder):&lt;BR /&gt;desc = arcpy.Describe(input_feature)&lt;BR /&gt;feature_name = os.path.splitext(desc.name)[0]&lt;BR /&gt;output_name = f"{feature_name}_QC"&lt;BR /&gt;output_feature = os.path.join(output_folder, output_name)&lt;/P&gt;&lt;P&gt;# Check if the output folder exists, and create it if not&lt;BR /&gt;if not os.path.exists(output_folder):&lt;BR /&gt;os.makedirs(output_folder)&lt;/P&gt;&lt;P&gt;arcpy.CopyFeatures_management(input_feature, output_feature)&lt;BR /&gt;arcpy.AddMessage(f"Exported {input_feature} to {output_feature}.")&lt;/P&gt;&lt;P&gt;# Add the "QC" field to the exported feature&lt;BR /&gt;output_desc = arcpy.Describe(output_feature)&lt;BR /&gt;if "QC" not in [field.name for field in output_desc.fields]:&lt;BR /&gt;arcpy.AddField_management(output_feature, "QC", "TEXT", field_length=10)&lt;BR /&gt;arcpy.AddMessage(f"Added 'QC' field to {output_feature}.")&lt;/P&gt;&lt;P&gt;# Loop through input features and export them with QC suffix and QC field&lt;BR /&gt;for feature in input_features:&lt;BR /&gt;export_with_qc_suffix(feature, output_folder)&lt;/P&gt;&lt;P&gt;# Inform the user that the tool has completed&lt;BR /&gt;arcpy.AddMessage("Export process completed.")&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Note I tried setting&amp;nbsp;arcpy.env.overwriteOutput&amp;nbsp; as True but didn't work as well&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2023 19:39:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-custom-tool/m-p/1332634#M73487</guid>
      <dc:creator>HusamAbuOqer</dc:creator>
      <dc:date>2023-09-26T19:39:47Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro custom tool</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-custom-tool/m-p/1332706#M73494</link>
      <description>&lt;P&gt;&lt;A href="https://community.esri.com/t5/python-blog/code-formatting-the-community-version/ba-p/1007633" target="_blank"&gt;Code formatting ... the Community Version - Esri Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;to make reading and comments easier&lt;/P&gt;&lt;P&gt;and you would want to set overwriteOutput to False if you don't want to overwrite what you have done&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2023 21:10:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-custom-tool/m-p/1332706#M73494</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2023-09-26T21:10:50Z</dc:date>
    </item>
  </channel>
</rss>

