<?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 Re: Feature Class Z to ASCII File Names in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/feature-class-z-to-ascii-file-names/m-p/183373#M8134</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;your code is hard to read... for reference&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/blogs/dan_patterson/2016/08/14/script-formatting"&gt;/blogs/dan_patterson/2016/08/14/script-formatting&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;maybe dump the try, except block to make the error line more visible in the trackback&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 13 Mar 2019 03:06:43 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2019-03-13T03:06:43Z</dc:date>
    <item>
      <title>Feature Class Z to ASCII File Names</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/feature-class-z-to-ascii-file-names/m-p/183372#M8133</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&amp;nbsp;&lt;BR /&gt;I have a seemingly minor problem which likely requires some Python coding. I am not currently familiar with python (more of a Matlab person), and was wondering if anyone had any advice.&amp;nbsp;&lt;BR /&gt;I am attempting to use the Feature Class Z to ASCII tool to make text files with my Z elevations. This tool performs correctly in all respects except 1: It names the text files based on the OID (or FID) column instead of a unique column (named 'Id') that is in my attribute table. Up until this point we have had a separate, hand made file that converts from FID to Id in subsequent analysis, but it is incredibly prone to error and confusing to use.&amp;nbsp;&lt;BR /&gt;Is there any simple way to modify this tool so that it outputs names based on a chosen column instead of the default OID column?&amp;nbsp;&lt;BR /&gt;I&amp;nbsp; have attached a zip file of a z-interpolated shapefile below. The 'Id' column is the desired naming column.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Code is below:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;'''****************************************************************************
Name: FeatureClassZToASCII Example
Description: This script demonstrates how to use the
 FeatureClassZToASCII tool to create generate files for all
 z-aware point features in a given workspace.
****************************************************************************'''
import arcpy
import exceptions, sys, traceback
from arcpy import env

try:
 # Obtain a license for the ArcGIS 3D Analyst extension
 arcpy.CheckOutExtension('3D')
 # Set environment settings
 env.workspace = 'C:/data'
 # List all points in the target workspace
 fcList = arcpy.ListFeatureClasses("*", "POINT")
 if fcList:
 # Set Local Variables
 outFolder = "C:/output"
 outFormat = "GENERATE"
 delimeter = "SPACE"
 decimal = "FIXED"
 digits = 3
 dec_sep = "DECIMAL_POINT"
 for fc in fcList: 
 # Use Describe method to evaluate whether the feature class is z-aware
 desc = arcpy.Describe(fc)
 if desc.hasZ == True:
 # Define the output file name by replacing '.shp' with _ascii.txt
 outName = fc.replace('.shp', '') + "_ascii.txt"
 #Execute FeatureClassZToASCII_3d
 arcpy.FeatureClassZToASCII_3d(fc, outFolder, outName, outFormat, delimeter, decimal, digits, dec_sep)
 else:
 print "There are no feature classes in the " + env.workspace + " directory."


except arcpy.ExecuteError:
 print arcpy.GetMessages()
except:
 # Get the traceback object
 tb = sys.exc_info()[2]
 tbinfo = traceback.format_tb(tb)[0]
 # Concatenate error information into message string
 pymsg = 'PYTHON ERRORS:\nTraceback info:\n{0}\nError Info:\n{1}'\
 .format(tbinfo, str(sys.exc_info()[1]))
 msgs = 'ArcPy ERRORS:\n {0}\n'.format(arcpy.GetMessages(2))
 # Return python error messages for script tool or Python Window
 arcpy.AddError(pymsg)
 arcpy.AddError(msgs)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I assume that the root of the problem is the 'fclist' variable. Any help in solving this problem is appreciated.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Ps. Bonus points if anyone can give some guidance on how to include this as a tool in arcgis so I don't have to run it in an IDE&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:09:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/feature-class-z-to-ascii-file-names/m-p/183372#M8133</guid>
      <dc:creator>RussellNasrallah1</dc:creator>
      <dc:date>2021-12-12T16:09:26Z</dc:date>
    </item>
    <item>
      <title>Re: Feature Class Z to ASCII File Names</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/feature-class-z-to-ascii-file-names/m-p/183373#M8134</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;your code is hard to read... for reference&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/blogs/dan_patterson/2016/08/14/script-formatting"&gt;/blogs/dan_patterson/2016/08/14/script-formatting&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;maybe dump the try, except block to make the error line more visible in the trackback&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Mar 2019 03:06:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/feature-class-z-to-ascii-file-names/m-p/183373#M8134</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2019-03-13T03:06:43Z</dc:date>
    </item>
  </channel>
</rss>

