How to make this script take a list of distances along a selected line and create a point featureclass with points at these distances?
import arcpy
from arcpy import env
import os
arcpy.env.overwriteOutput = True
arcpy.env.workspace = "in memory"
arcpy.FeatureClassToFeatureClass_conversion("PolyLineDataSet",
r"C:\Users\Default.gdb","SelectedLine",)
arcpy.CreateFeatureclass_management(r"C:\Users\Default.gdb",
"PointsOnLines","POINT","","DISABLED","DISABLED",3600)
cursor = arcpy.da.InsertCursor("PointsOnLines",["SHAPE@XY"])
distances = [30,60,90]
for distance in distances:
for row in arcpy.da.SearchCursor("SelectedLine", ["SHAPE@"]):
point = cursor.insertRow(row[0].positionAlongLine(distance["SHAPE@XY"])
After running this I end up with this error.
Runtime error
Traceback (most recent call last):
File "<string>", line 20, in <module>
TypeError: 'PointGeometry' object has no attribute '__getitem__'