def createPolygonCell(intCellsize, leftX, upperY):
aPoint1 = arcpy.Point()
aPoint2 = arcpy.Point()
aPoint3 = arcpy.Point()
aPoint4 = arcpy.Point()
aPoint1.X = leftX
aPoint1.Y = upperY
aPoint2.X = leftX + intCellsize
aPoint2.Y = upperY
aPoint3.X = leftX + intCellsize
aPoint3.Y = upperY - intCellsize
aPoint4.X = leftX
aPoint4.Y = upperY - intCellsize
array= arcpy.Array()
array.add(aPoint1)
array.add(aPoint2)
array.add(aPoint3)
array.add(aPoint4)
array.add(aPoint1)
aPolygon = arcpy.Polygon(array)
array.removeAll()
return aPolygon
rows = arcpy.SearchCursor(inMaskShp) #inMaskShp is the input mask shapefile attached
row = rows.next()
inMask = row.getValue("Shape") #inMask is the first polygon of the inMaskShp
apoly = createPolygonCell(30, 565845, 3881985)
apoly.within(inMask) #this returns FALSE although it should be TRUE
without examining the details of your situation in detail, you should be aware that problems have been discovered when using arcpy's geometry objects when no spatial reference is specified. a protracted discussion is noted in:
http://forums.arcgis.com/threads/9763-Errors-in-arcpy-s-Polygon-class
there is a NIM number which you can track the error on
NIM059845
which indicates that it is resolved as of version 10 SP2 and in 10.2
http://resources.arcgis.com/content/nimbus-bug?bugID=TklNMDU5ODQ1
I don't think it is out yet...so use the workaround in the interim