Richard, thank you for your help, i gratefully appreciate it.
The reason i have two update cursors is because i need to update "only" the selected features (could be 1 or 20 or 100) of FC layer first with the first arcpy.da.UpdateCursor, then after the attributes have been updated i need to copy over the features that were updated in the first cursor to incidentsFC. I was trying to implement the InsertCursor you suggested and since none of the FC layers get copied over i used another updatecursor.
The FC already has the already has "Account" and "SiteStreet, those are fileds i need to copy over to the incidentFC as well .
The code you posted give me an error;
Runtime error
Traceback (most recent call last):
File "<string>", line 26, in <module>
RuntimeError: unknown geometry token 'SHAPE@CENTROID.X'
import arcpy
from datetime import datetime as d
startTime = d.now()
#set to folder where features are located
arcpy.env.workspace = r"C:\GIS\CCAP\CCAP_NEW.mdb" #on windows use \ instead of /
arcpy.env.overwriteOutput = True
#---------------------------
#define variables for cursor
#---------------------------
FC = "test"
incidentsFC = "CCAP"
parcelsCount = int(arcpy.GetCount_management(FC).getOutput(0))
dsc = arcpy.Describe(FC)
rowInserter = arcpy.da.InsertCursor(incidentsFC, ["SHAPE@", 'Account', 'SiteStreet'])
selection_set = dsc.FIDSet
if len(selection_set) == 0:
print "There are no features selected"
elif parcelsCount >= 1:
with arcpy.da.UpdateCursor(FC, ["FacltyType", "StructType", "Verified", "Status", "StructCat", "APA_CODE", "ACCOUNT", 'SiteStreet', 'SHAPE@CENTROID.X', 'SHAPE@CENTROID.Y']) as rows:
for row in rows:
row[0] = ("Single Family Home")
row[1] = ("Primary, Private")
row[2] = ("Yes, GRM, TA")
row[3] = ("Active")
row[4] = ("Residential")
row[5] = ("1110")
ACCOUNT = row[6]
SiteStreet = row[7]
X = row[8]
Y = row[9]
rows.updateRow(row)
inPoint = arcpy.PointGeometry(arcpy.Point(X,Y))
rowInserter.insertRow((inPoint, ACCOUNT, SiteStreet))
del row
del rows
del rowInserter
arcpy.RefreshActiveView()
try:
print '(Elapsed time: ' + str(d.now() - startTime)[:-3] + ')'
except Exception, e:
# If an error occurred, print line number and error message
import traceback, sys
tb = sys.exc_info()[2]
print "Line %i" % tb.tb_lineno
print e.message