I am working on creating a addon button to update some address points and copy that updated feature. The first part of the code does what it is suppose to do (only update the selected feature) but the second part of the code doesn't do what it is suppose to do and that is copy "only" the selected feature to the file geodatbase feature class. The code runs fine i don't get any errors but the second part of the codes doesn't copy the selected feature.
I would also like to an an "if" statement. if there is no feature selected i want it to do nothing or tell me there is nothing selected. if there is something selected i want it to only updates the selected feature and only copy the selected feature. Any ideas?
import arcpy, time import pythonaddins import os #populate selected feature APT = "TEST" arcpy.env.overwriteOutput = True mxd = arcpy.mapping.MapDocument("CURRENT") if int(arcpy.GetCount_management(APT).getOutput(0)) > 0: rows = arcpy.UpdateCursor(APT) for row in rows: row.FacltyType = ("Single Family Home") row.StructType = ("Primary, Private") row.Verified = ("Yes, GRM, TA") row.Status = ("Active") row.StructCat = ("Residential") row.APA_CODE = ("1110") rows.updateRow(row) del row, rows #Copies address point to backup address points in filegeodatabase fc1 = "CCAP" #Database workspace = r"C:\GIS\CCAP\CCAP.mdb" arcpy.env.overwriteOutput = True # Start an edit session. Must provide the worksapce. edit = arcpy.da.Editor(workspace) # Edit session is started without an undo/redo stack for versioned data # (for second argument, use False for unversioned data) edit.startEditing(True) # Start an edit operation edit.startOperation() if int(arcpy.GetCount_management(APT).getOutput(0)) > 0: arcpy.Append_management(APT, fc1, "NO_TEST") # Stop the edit operation. edit.stopOperation() # Stop the edit session and save the changes edit.stopEditing(True) arcpy.RefreshActiveView()