<?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 Clip Analysis troubles in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/clip-analysis-troubles/m-p/667902#M51851</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Wondering if anyone would be kind enough to share their thoughts and suggestions on this code. I am trying to have a script that adds a field, updates the field with something and then clips it to a project area. I have it working for a single shapefile, and have commented out what I think I would need to use to get my desired results. Any help would be greatly appreciated, and thanks in advance!&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
import arcpy, os, sys
import glob
from arcpy import env



#Functions
##fieldName = CONAME
inTest = arcpy.GetParameterAsText(0)
#Project Area used for the clip
clipArea = arcpy.GetParameterAsText(1)
#Directory the clips will be stored
outClip = arcpy.GetParameterAsText(2)
##clipShp = "S:/TallPinesGIS/py/bin/"
#Name of project area
##projectArea_name = arcpy.GetParameterAsText(3)

##(filepath, filename) = os.path.split(clipArea)
##for inTest in glob.glob(S:/TallPinesGIS/py/projectArea/'*.shp')

env = arcpy.env.workspace = "S:/TallPinesGIS/py/"

inTeast = arcpy.MakeFeatureLayer_management(inTest)
clipArea = arcpy.MakeFeatureLayer_management(clipArea)


# Add Field to Polygon for ranking
arcpy.AddMessage('Adding Fields')
arcpy.AddField_management(inTest,"CONAME","TEXT","8","#","#","#","NON_NULLABLE","NON_REQUIRED","#")

rows = arcpy.UpdateCursor(inTest)
for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; row.setValue("CONAME", "DODGECO")
&amp;nbsp;&amp;nbsp;&amp;nbsp; rows.updateRow(row)

# Clip Features to current Project Area
##fileList = arcpy.ListFeatureClasses()
##fileList = glob.glob(inTest + env*)
##for shp in fileList:
 ##&amp;nbsp;&amp;nbsp; if shp == filename:
&amp;nbsp;&amp;nbsp;&amp;nbsp; ##&amp;nbsp;&amp;nbsp;&amp;nbsp; continue
&amp;nbsp;&amp;nbsp; ## clipShp = inTest "clip_" +"+shp+"
&amp;nbsp;&amp;nbsp; 
arcpy.AddMessage('Clipping features outside of project area')
##arcpy.Clip_analysis(fc,clipArea,clipShp)
arcpy.Clip_analysis(inTest, clipArea, outClip)
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Chris&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 16 Dec 2011 17:45:35 GMT</pubDate>
    <dc:creator>ChrisBrannin</dc:creator>
    <dc:date>2011-12-16T17:45:35Z</dc:date>
    <item>
      <title>Clip Analysis troubles</title>
      <link>https://community.esri.com/t5/python-questions/clip-analysis-troubles/m-p/667902#M51851</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Wondering if anyone would be kind enough to share their thoughts and suggestions on this code. I am trying to have a script that adds a field, updates the field with something and then clips it to a project area. I have it working for a single shapefile, and have commented out what I think I would need to use to get my desired results. Any help would be greatly appreciated, and thanks in advance!&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
import arcpy, os, sys
import glob
from arcpy import env



#Functions
##fieldName = CONAME
inTest = arcpy.GetParameterAsText(0)
#Project Area used for the clip
clipArea = arcpy.GetParameterAsText(1)
#Directory the clips will be stored
outClip = arcpy.GetParameterAsText(2)
##clipShp = "S:/TallPinesGIS/py/bin/"
#Name of project area
##projectArea_name = arcpy.GetParameterAsText(3)

##(filepath, filename) = os.path.split(clipArea)
##for inTest in glob.glob(S:/TallPinesGIS/py/projectArea/'*.shp')

env = arcpy.env.workspace = "S:/TallPinesGIS/py/"

inTeast = arcpy.MakeFeatureLayer_management(inTest)
clipArea = arcpy.MakeFeatureLayer_management(clipArea)


# Add Field to Polygon for ranking
arcpy.AddMessage('Adding Fields')
arcpy.AddField_management(inTest,"CONAME","TEXT","8","#","#","#","NON_NULLABLE","NON_REQUIRED","#")

rows = arcpy.UpdateCursor(inTest)
for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; row.setValue("CONAME", "DODGECO")
&amp;nbsp;&amp;nbsp;&amp;nbsp; rows.updateRow(row)

# Clip Features to current Project Area
##fileList = arcpy.ListFeatureClasses()
##fileList = glob.glob(inTest + env*)
##for shp in fileList:
 ##&amp;nbsp;&amp;nbsp; if shp == filename:
&amp;nbsp;&amp;nbsp;&amp;nbsp; ##&amp;nbsp;&amp;nbsp;&amp;nbsp; continue
&amp;nbsp;&amp;nbsp; ## clipShp = inTest "clip_" +"+shp+"
&amp;nbsp;&amp;nbsp; 
arcpy.AddMessage('Clipping features outside of project area')
##arcpy.Clip_analysis(fc,clipArea,clipShp)
arcpy.Clip_analysis(inTest, clipArea, outClip)
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Chris&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Dec 2011 17:45:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/clip-analysis-troubles/m-p/667902#M51851</guid>
      <dc:creator>ChrisBrannin</dc:creator>
      <dc:date>2011-12-16T17:45:35Z</dc:date>
    </item>
  </channel>
</rss>

