ceicher

Python to create rectangle geometry works in 9.3.1, but doesn't work in 10.0 SP2

Discussion created by ceicher on Jun 20, 2011
Latest reply on Jun 23, 2011 by ceicher
Hi,

The code at the bottom of the following thread works like a charm in 9.3.1....

http://forums.esri.com/thread.asp?t=280489&c=93&f=1729

... but it doesn't work in 10.0 SP2. In 10.0 SP2, the script executes, but the inserted row has no geometry.

I've included my 10.0 SP2 code below. Anyone know how I can get this to work in 10?

Thanks,

-Cory

# Import system modules
import sys, string, os, arcpy

# Create the Geoprocessor object
ary = arcpy.CreateObject("Array")
pnt = arcpy.CreateObject("Point")

## create rect starting lower right going clockwise
pnt.x = -117.0
pnt.y = 35
ary.add(pnt)

pnt.x = -117.0
pnt.y = 35.75
ary.add(pnt)

pnt.x = -116.25
pnt.y = 35.75
ary.add(pnt)

pnt.x = -116.25
pnt.y = 35
ary.add(pnt)

## redo first point (lower right)
pnt.x = -117.0
pnt.y = 35
ary.add(pnt)
## -------------------------------------------------------------

AOI = "C:\\Temp\\test7.shp"
ScratchWS = "C:\\Temp"

# Process: Create AOI Feature Class...
arcpy.CreateFeatureclass_management(ScratchWS, "test7", "POLYGON", "", "DISABLED", "DISABLED", "GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]];IsHighPrecision", "", "0", "0", "0")
cur = arcpy.InsertCursor(AOI)
feat = cur.newRow()
feat.shape = ary
cur.insertRow(feat)

Outcomes