<?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: how to pass a variable to a python script in model builder in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/how-to-pass-a-variable-to-a-python-script-in-model/m-p/442493#M14859</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: frankv3&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;it didn't like these lines:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.ImportToolbox("Model Functions")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SX = arcpy.GetFieldValue_mb(Parcel_XY_View, "X_COORD", "Double", "0")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SY = arcpy.GetFieldValue_mb(Parcel_XY_View, "Y_COORD", "Double", "0")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thiose were removed and the Script arguments was changed to include&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SX = arcpy.GetParameter(2)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SY = arcpy.GetParameter(3)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;and it runs fine&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 15 Feb 2011 11:18:00 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2011-02-15T11:18:00Z</dc:date>
    <item>
      <title>how to pass a variable to a python script in model builder</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/how-to-pass-a-variable-to-a-python-script-in-model/m-p/442492#M14858</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: frankv3&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;how do you send the results of geoprocessing tools in model builder to a python script that has been added to the model?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The model fails for some reason, but it doesn't say why in the results&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;this is the script:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Import arcpy module&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import sys&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import os&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import types&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Load required toolboxes&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.ImportToolbox("Model Functions")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Script arguments&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;AltNum = arcpy.GetParameterAsText(0)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;DXFWorkspace = arcpy.GetParameterAsText(1)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Process: Get Field Value&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SX = arcpy.GetFieldValue_mb(Parcel_XY_View, "X_COORD", "Double", "0")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Process: Get Field Value (2)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SY = arcpy.GetFieldValue_mb(Parcel_XY_View, "Y_COORD", "Double", "0")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;X1 = SX - 1000&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Y1 = SY - 1000&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;X2 = SX + 1000&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Y2 = SY + 1000&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;coord = ('-1000.000000,-1000.00000 %s,%s' + '\n' + '1000.00000,1000.00000 %s,%s')%(X1,Y1,X2,Y2)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Afile = r"%s\%s.wld"%(DXFWorkspace,AltNum)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Wfile =&amp;nbsp; file(Afile, 'w')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Wfile.write(coord)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Wfile.close()&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Feb 2011 17:50:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/how-to-pass-a-variable-to-a-python-script-in-model/m-p/442492#M14858</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2011-02-14T17:50:24Z</dc:date>
    </item>
    <item>
      <title>Re: how to pass a variable to a python script in model builder</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/how-to-pass-a-variable-to-a-python-script-in-model/m-p/442493#M14859</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: frankv3&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;it didn't like these lines:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.ImportToolbox("Model Functions")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SX = arcpy.GetFieldValue_mb(Parcel_XY_View, "X_COORD", "Double", "0")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SY = arcpy.GetFieldValue_mb(Parcel_XY_View, "Y_COORD", "Double", "0")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thiose were removed and the Script arguments was changed to include&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SX = arcpy.GetParameter(2)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SY = arcpy.GetParameter(3)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;and it runs fine&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Feb 2011 11:18:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/how-to-pass-a-variable-to-a-python-script-in-model/m-p/442493#M14859</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2011-02-15T11:18:00Z</dc:date>
    </item>
  </channel>
</rss>

