maybe there is another way to do what i want, copy lines from a geoprocessing output into a sde feature class in arcmapcurrently the output is being written to a file geodatabase
## Import standard modules
import sys, os
## Set the necessary product code
import arcinfo
## Import arcpy module and environment module
import arcpy
import arcpy.mapping
from arcpy import env
## Overwrite pre-existing files
arcpy.env.overwriteOutput = True
## Sets the MXD file
IMXD = arcpy.mapping.MapDocument("CURRENT")
DF = arcpy.mapping.ListDataFrames(IMXD, "Layers")[0]
try:
for ILayer in arcpy.mapping.ListLayers(IMXD):
if ILayer.name == "AGHXL":
arcpy.mapping.RemoveLayer(DF, ILayer)
except:
arcpy.GetMessages()
## Refresh map
arcpy.RefreshTOC()
arcpy.RefreshActiveView
## Set Relevant Layers
ALyr = arcpy.mapping.ListLayers(IMXD,"address_point")[0]
BLLyr = arcpy.mapping.ListLayers(IMXD,"Basemap_Line")[0]
try:
## Test for slected address points
NumS = str(arcpy.GetCount_management(ALyr))
Num = int(NumS)
if Num > 1000:
# print "Please select an address point"
arcpy.AddMessage("PLEASE SELECT AN ADDRESS POINT")
elif Num > 1 and Num < 1000:
# print "Please select only one address point"
arcpy.AddMessage("PLEASE SELECT ONLY ONE ADDRESS POINT")
else:
## Get the XY of the selected address point
ACur = arcpy.SearchCursor(ALyr)
for ARow in ACur:
ACenter = ARow.shape.centroid
AX = ACenter.X
AY = ACenter.Y
## Set the corners for the AGHX polygon
PNT1X = AX - 12.5
PNT1Y = AY + 12.5
PNT2X = AX + 12.5
PNT2Y = AY + 12.5
PNT3X = AX + 12.5
PNT3Y = AY - 12.5
PNT4X = AX - 12.5
PNT4Y = AY - 12.5
PNT1 = r"%s,%s"%(PNT1X, PNT1Y)
PNT2 = r"%s,%s"%(PNT2X, PNT2Y)
PNT3 = r"%s,%s"%(PNT3X, PNT3Y)
PNT4 = r"%s,%s"%(PNT4X, PNT4Y)
BArray = arcpy.Array()
COORDS = [PNT1, PNT2, PNT3, PNT4]
for COORDPAIR in COORDS:
X, Y = COORDPAIR.split(",")
X = float(X)
Y = float(Y)
PNT = arcpy.Point(X,Y)
BArray.add(PNT)
BArray.add(BArray.getObject(0))
NPolygon = arcpy.Polygon(BArray)
arcpy.FeatureToLine_management(NPolygon, "C:\\WorkSpace\\GeoProcessingTemp.gdb\\ScratchData\\AGHXL","","NO_ATTRIBUTES")
del ACur, ARow
SourceData = "C:\\WorkSpace\\GeoProcessingTemp.gdb\\ScratchData\\AGHXL"
AGHXLayer = arcpy.MakeFeatureLayer_management(SourceData,"AGHXL")
arcpy.SetParameterAsText(0,NPolygon)
arcpy.SetParameterAsText(1, AGHXLayer)
## Refresh map
arcpy.RefreshTOC()
arcpy.RefreshActiveView
except:
arcpy.GetMessages()