<?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 Add trace barriers in a python toolbox code in ArcGIS Utility Network Questions</title>
    <link>https://community.esri.com/t5/arcgis-utility-network-questions/add-trace-barriers-in-a-python-toolbox-code/m-p/1287561#M2478</link>
    <description>&lt;P&gt;Hi UN experts,&lt;/P&gt;&lt;P&gt;I have a need for a trace tool in ArcGIS Pro that updates certain attributes for the features traced. The tool also needs to provide option to the user to choose the trace direction at the start location.&amp;nbsp;I am trying to use barriers to stop the trace going into unwanted directions to force it go only in the selected direction.&lt;/P&gt;&lt;P&gt;I tried to add records to&amp;nbsp; arcpy.env.scratchWorkspace\\UN_Temp_Barriers using&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;arcpy.un.AddTraceLocations(&lt;SPAN&gt;self&lt;/SPAN&gt;.un_layer&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;self&lt;/SPAN&gt;.trace_barrier_fc&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;                           &lt;SPAN&gt;"DO_NOT_LOAD_SELECTED_FEATURES"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"KEEP_LOCATIONS"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;                           &lt;SPAN&gt;"{} {} # 0.5"&lt;/SPAN&gt;.format(layer_name&lt;SPAN&gt;, &lt;/SPAN&gt;layer_guid)&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;                           &lt;SPAN&gt;"FILTER_BARRIER"&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;However, I get the error below:&lt;/P&gt;&lt;P&gt;ERROR 000725: Output Feature Class: Dataset &amp;lt;location&amp;gt;\\UN_Temp_Barriers already exists.&lt;BR /&gt;Failed to execute (AddTraceLocations)&lt;/P&gt;&lt;P&gt;I could reproduce this problem. When I run the tool interactively in ArcGIS Pro using Add Trace Locations tool, it worked as below.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="EstherSmith_Dev_0-1683681760616.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/70284iAE57ACA2B39F0435/image-size/medium?v=v2&amp;amp;px=400" role="button" title="EstherSmith_Dev_0-1683681760616.png" alt="EstherSmith_Dev_0-1683681760616.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;But then when I copied the Python command for the above successful run in the Python window, it gave same error.&lt;/P&gt;&lt;P&gt;So I added,&lt;/P&gt;&lt;PRE&gt;arcpy.env.overwriteOutput = &lt;SPAN&gt;True&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;and if fixed the problem for AddTraceLocations. But when I run my tool, after the successful run, it just drops the&amp;nbsp;arcpy.env.scratchWorkspace\\UN_Temp_Barriers table afterwards. Any one knows how I can persist&amp;nbsp;UN_Temp_Barriers table? any arcpy.env value that I need to set?&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;</description>
    <pubDate>Wed, 10 May 2023 06:11:11 GMT</pubDate>
    <dc:creator>EstherSmith_Dev</dc:creator>
    <dc:date>2023-05-10T06:11:11Z</dc:date>
    <item>
      <title>Add trace barriers in a python toolbox code</title>
      <link>https://community.esri.com/t5/arcgis-utility-network-questions/add-trace-barriers-in-a-python-toolbox-code/m-p/1287561#M2478</link>
      <description>&lt;P&gt;Hi UN experts,&lt;/P&gt;&lt;P&gt;I have a need for a trace tool in ArcGIS Pro that updates certain attributes for the features traced. The tool also needs to provide option to the user to choose the trace direction at the start location.&amp;nbsp;I am trying to use barriers to stop the trace going into unwanted directions to force it go only in the selected direction.&lt;/P&gt;&lt;P&gt;I tried to add records to&amp;nbsp; arcpy.env.scratchWorkspace\\UN_Temp_Barriers using&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;arcpy.un.AddTraceLocations(&lt;SPAN&gt;self&lt;/SPAN&gt;.un_layer&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;self&lt;/SPAN&gt;.trace_barrier_fc&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;                           &lt;SPAN&gt;"DO_NOT_LOAD_SELECTED_FEATURES"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"KEEP_LOCATIONS"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;                           &lt;SPAN&gt;"{} {} # 0.5"&lt;/SPAN&gt;.format(layer_name&lt;SPAN&gt;, &lt;/SPAN&gt;layer_guid)&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;                           &lt;SPAN&gt;"FILTER_BARRIER"&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;However, I get the error below:&lt;/P&gt;&lt;P&gt;ERROR 000725: Output Feature Class: Dataset &amp;lt;location&amp;gt;\\UN_Temp_Barriers already exists.&lt;BR /&gt;Failed to execute (AddTraceLocations)&lt;/P&gt;&lt;P&gt;I could reproduce this problem. When I run the tool interactively in ArcGIS Pro using Add Trace Locations tool, it worked as below.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="EstherSmith_Dev_0-1683681760616.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/70284iAE57ACA2B39F0435/image-size/medium?v=v2&amp;amp;px=400" role="button" title="EstherSmith_Dev_0-1683681760616.png" alt="EstherSmith_Dev_0-1683681760616.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;But then when I copied the Python command for the above successful run in the Python window, it gave same error.&lt;/P&gt;&lt;P&gt;So I added,&lt;/P&gt;&lt;PRE&gt;arcpy.env.overwriteOutput = &lt;SPAN&gt;True&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;and if fixed the problem for AddTraceLocations. But when I run my tool, after the successful run, it just drops the&amp;nbsp;arcpy.env.scratchWorkspace\\UN_Temp_Barriers table afterwards. Any one knows how I can persist&amp;nbsp;UN_Temp_Barriers table? any arcpy.env value that I need to set?&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;</description>
      <pubDate>Wed, 10 May 2023 06:11:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-utility-network-questions/add-trace-barriers-in-a-python-toolbox-code/m-p/1287561#M2478</guid>
      <dc:creator>EstherSmith_Dev</dc:creator>
      <dc:date>2023-05-10T06:11:11Z</dc:date>
    </item>
    <item>
      <title>Re: Add trace barriers in a python toolbox code</title>
      <link>https://community.esri.com/t5/arcgis-utility-network-questions/add-trace-barriers-in-a-python-toolbox-code/m-p/1287652#M2481</link>
      <description>If you want to persist it, why not write it to a gdb, not a scratch workspace?&lt;BR /&gt;</description>
      <pubDate>Wed, 10 May 2023 12:16:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-utility-network-questions/add-trace-barriers-in-a-python-toolbox-code/m-p/1287652#M2481</guid>
      <dc:creator>MikeMillerGIS</dc:creator>
      <dc:date>2023-05-10T12:16:23Z</dc:date>
    </item>
    <item>
      <title>Re: Add trace barriers in a python toolbox code</title>
      <link>https://community.esri.com/t5/arcgis-utility-network-questions/add-trace-barriers-in-a-python-toolbox-code/m-p/1289168#M2491</link>
      <description>&lt;P&gt;The scratch workspace is a great idea, since you can re-use the same table within the same session instead of having to recreate it every time your run your tool. If you did want to create a new temp layer each time you ran your tool, I'd recommend you use the memory workspace for the duration of the trace. To do this just use the word "memory" for the workspace path (e.g. "memory\\temp_start_barriers").&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 15:06:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-utility-network-questions/add-trace-barriers-in-a-python-toolbox-code/m-p/1289168#M2491</guid>
      <dc:creator>RobertKrisher</dc:creator>
      <dc:date>2023-05-15T15:06:53Z</dc:date>
    </item>
  </channel>
</rss>

