<?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 Atribute to ASCII model problem in ModelBuilder Questions</title>
    <link>https://community.esri.com/t5/modelbuilder-questions/feature-atribute-to-ascii-model-problem/m-p/769637#M3514</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Below is the script and the files i am using have generated names starting from agigea_asc [Profile 0]; agigea_asc [Profile 0]_1 up to agigea_asc [Profile 0]_78. I get same problem when exporting to dwg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# -*- coding: utf-8 -*-&lt;/P&gt;&lt;P&gt;# ---------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;# model_script.py&lt;/P&gt;&lt;P&gt;# Created on: 2015-06-29 09:39:05.00000&lt;/P&gt;&lt;P&gt;#&amp;nbsp;&amp;nbsp; (generated by ArcGIS/ModelBuilder)&lt;/P&gt;&lt;P&gt;# Description: &lt;/P&gt;&lt;P&gt;# ---------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Import arcpy module&lt;/P&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Load required toolboxes&lt;/P&gt;&lt;P&gt;arcpy.ImportToolbox("Model Functions")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Local variables:&lt;/P&gt;&lt;P&gt;profile_tot = "E:\\AGIGEA\\New folder\\profile\\profile_tot"&lt;/P&gt;&lt;P&gt;agigea_asc__Profile_0__shp = "E:\\AGIGEA\\New folder\\profile\\profile_tot\\agigea_asc [Profile 0]_9.shp"&lt;/P&gt;&lt;P&gt;profi_n_ = "C:\\Users\\Andrei\\Desktop\\asd\\profi%n%"&lt;/P&gt;&lt;P&gt;profil_n__DWG = "C:\\Users\\Andrei\\Desktop\\dwg\\profil%n%.DWG"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Process: Iterate Feature Classes&lt;/P&gt;&lt;P&gt;arcpy.IterateFeatureClasses_mb(profile_tot, "", "", "NOT_RECURSIVE")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Process: Export Feature Attribute to ASCII&lt;/P&gt;&lt;P&gt;arcpy.ExportXYv_stats(agigea_asc__Profile_0__shp, "DIST;Z", "SPACE", profi_n_, "ADD_FIELD_NAMES")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Process: Export to CAD&lt;/P&gt;&lt;P&gt;arcpy.ExportCAD_conversion("'E:\\AGIGEA\\New folder\\profile\\profile_tot\\agigea_asc [Profile 0]_9.shp'", "DWG_R2007", profil_n__DWG, "Ignore_Filenames_in_Tables", "Overwrite_Existing_Files", "")&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 29 Jun 2015 06:49:33 GMT</pubDate>
    <dc:creator>StanisteanuAndrei</dc:creator>
    <dc:date>2015-06-29T06:49:33Z</dc:date>
    <item>
      <title>Feature Atribute to ASCII model problem</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/feature-atribute-to-ascii-model-problem/m-p/769635#M3512</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've created a number of profiles as shp using SAGA and i want to create a model to export x,y,z and distances between points to a .txt format. The problem is that the model i've created goes through my folder where i keep my shapefiles (profile_tot) and where the file are (starting from agigea_asc[Profile0].shp agigea_asc[Profile0]_1.shp, and so on until agigea_asc[Profile0]_78.shp, yet the files that get exported do not contain all the values in the attribute table of the shapefiles. For example the results of 3 consecutive profiles each of them containing more than 3 thousand points is an amount similar (not exact - within 50 points missing -) for profile 1 and 3 and around 300-400 for profile 2. This issue has no pattern and it happens random, withing the exported files. &lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" height="270" src="https://community.esri.com/legacyfs/online/114275_pastedImage_0.png" style="height: 270px; width: 549.686098654709px;" width="550" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 28 Jun 2015 00:36:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/feature-atribute-to-ascii-model-problem/m-p/769635#M3512</guid>
      <dc:creator>StanisteanuAndrei</dc:creator>
      <dc:date>2015-06-28T00:36:24Z</dc:date>
    </item>
    <item>
      <title>Re: Feature Atribute to ASCII model problem</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/feature-atribute-to-ascii-model-problem/m-p/769636#M3513</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is it possible to export your model to a Python script and to attach it to this thread. That allows us to examine what is going wrong (or at least to see if the process is not correct). If it is all correct, then the next step would be to look at the data. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The alternative would be to script it with python. This would not be a long script. It is quite easy to loop through files and for instance use a cursor to export the information (in case the tool has issues).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jun 2015 00:47:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/feature-atribute-to-ascii-model-problem/m-p/769636#M3513</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2015-06-29T00:47:25Z</dc:date>
    </item>
    <item>
      <title>Re: Feature Atribute to ASCII model problem</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/feature-atribute-to-ascii-model-problem/m-p/769637#M3514</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Below is the script and the files i am using have generated names starting from agigea_asc [Profile 0]; agigea_asc [Profile 0]_1 up to agigea_asc [Profile 0]_78. I get same problem when exporting to dwg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# -*- coding: utf-8 -*-&lt;/P&gt;&lt;P&gt;# ---------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;# model_script.py&lt;/P&gt;&lt;P&gt;# Created on: 2015-06-29 09:39:05.00000&lt;/P&gt;&lt;P&gt;#&amp;nbsp;&amp;nbsp; (generated by ArcGIS/ModelBuilder)&lt;/P&gt;&lt;P&gt;# Description: &lt;/P&gt;&lt;P&gt;# ---------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Import arcpy module&lt;/P&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Load required toolboxes&lt;/P&gt;&lt;P&gt;arcpy.ImportToolbox("Model Functions")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Local variables:&lt;/P&gt;&lt;P&gt;profile_tot = "E:\\AGIGEA\\New folder\\profile\\profile_tot"&lt;/P&gt;&lt;P&gt;agigea_asc__Profile_0__shp = "E:\\AGIGEA\\New folder\\profile\\profile_tot\\agigea_asc [Profile 0]_9.shp"&lt;/P&gt;&lt;P&gt;profi_n_ = "C:\\Users\\Andrei\\Desktop\\asd\\profi%n%"&lt;/P&gt;&lt;P&gt;profil_n__DWG = "C:\\Users\\Andrei\\Desktop\\dwg\\profil%n%.DWG"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Process: Iterate Feature Classes&lt;/P&gt;&lt;P&gt;arcpy.IterateFeatureClasses_mb(profile_tot, "", "", "NOT_RECURSIVE")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Process: Export Feature Attribute to ASCII&lt;/P&gt;&lt;P&gt;arcpy.ExportXYv_stats(agigea_asc__Profile_0__shp, "DIST;Z", "SPACE", profi_n_, "ADD_FIELD_NAMES")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Process: Export to CAD&lt;/P&gt;&lt;P&gt;arcpy.ExportCAD_conversion("'E:\\AGIGEA\\New folder\\profile\\profile_tot\\agigea_asc [Profile 0]_9.shp'", "DWG_R2007", profil_n__DWG, "Ignore_Filenames_in_Tables", "Overwrite_Existing_Files", "")&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jun 2015 06:49:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/feature-atribute-to-ascii-model-problem/m-p/769637#M3514</guid>
      <dc:creator>StanisteanuAndrei</dc:creator>
      <dc:date>2015-06-29T06:49:33Z</dc:date>
    </item>
    <item>
      <title>Re: Feature Atribute to ASCII model problem</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/feature-atribute-to-ascii-model-problem/m-p/769638#M3515</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Looking at the code generated by ModelBuilder I see some strange things, but this does not have to be the reason for the errors that you encounter in the output. I mean the output generated are based on the different input shapes, right?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe you could try this code snippet:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# -*- coding: utf-8 -*-
import arcpy
import os

def main():
&amp;nbsp;&amp;nbsp;&amp;nbsp; # folder and file settings
&amp;nbsp;&amp;nbsp;&amp;nbsp; profile_folder = r"E:\AGIGEA\New folder\profile\profile_tot"
&amp;nbsp;&amp;nbsp;&amp;nbsp; out_folder_txt = r"C:\Users\Andrei\Desktop\asd"
&amp;nbsp;&amp;nbsp;&amp;nbsp; out_prefix_txt = "profi"
&amp;nbsp;&amp;nbsp;&amp;nbsp; out_folder_dwg = r"C:\Users\Andrei\Desktop\dwg"
&amp;nbsp;&amp;nbsp;&amp;nbsp; out_prefix_dwg = "profil"

&amp;nbsp;&amp;nbsp;&amp;nbsp; # export settings
&amp;nbsp;&amp;nbsp;&amp;nbsp; sep = " "
&amp;nbsp;&amp;nbsp;&amp;nbsp; flds = ("SHAPE@X", "SHAPE@Y", "DIST", "Z")

&amp;nbsp;&amp;nbsp;&amp;nbsp; # environment
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = profile_folder

&amp;nbsp;&amp;nbsp;&amp;nbsp; # list featureclasses and loop through list
&amp;nbsp;&amp;nbsp;&amp;nbsp; fcs = arcpy.ListFeatureClasses("agigea_asc*")
&amp;nbsp;&amp;nbsp;&amp;nbsp; for fc in fcs:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # define output file name
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; postfix = getPostFix(fc)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; out_txt = os.path.join(out_folder_txt, "{0}{1}.txt".format(out_prefix_txt, postfix))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # open output file
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; with open(out_txt, 'w') as f:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; f.write("X Y DIST Z\n")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # create search cursor on input shape
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.SearchCursor(fc, flds) as curs:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in curs:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # write to file
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; f.write("{0} {1} {2} {3}\n".format(row[0], row[1], row[2], row[3]))

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Export fc to DWG
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; out_dwg = os.path.join(out_folder_dwg, "{0}{1}.txt".format(out_prefix_dwg, postfix))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.ExportCAD_conversion(os.path.join(profile_folder, fc), "DWG_R2007",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; out_dwg, "Ignore_Filenames_in_Tables",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Overwrite_Existing_Files", "")

def getPostFix(fc):
&amp;nbsp;&amp;nbsp;&amp;nbsp; # agigea_asc[Profile0].shp&amp;nbsp;&amp;nbsp;&amp;nbsp; -&amp;gt; ''
&amp;nbsp;&amp;nbsp;&amp;nbsp; # agigea_asc[Profile0]_1.shp&amp;nbsp; -&amp;gt; '_1'
&amp;nbsp;&amp;nbsp;&amp;nbsp; # agigea_asc[Profile0]_78.shp -&amp;gt; '_78'
&amp;nbsp;&amp;nbsp;&amp;nbsp; return fc.split(']')[1].split('.')[0]

if __name__ == '__main__':
&amp;nbsp;&amp;nbsp;&amp;nbsp; main()&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;... and check it the output is different (and the missing points are included). Please do create a copy of the output you have created with the ModelBuilder, since it might generate the same output file names (not sure how they are generated in ModelBuilder). &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 08:35:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/feature-atribute-to-ascii-model-problem/m-p/769638#M3515</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-12T08:35:19Z</dc:date>
    </item>
  </channel>
</rss>

