I'm attempting to automate this in ModelBuilder in ArcMap. I have one feature class with one point (Start) and one feature class with multiple points (Destinations). I want to iterate through the Destinations so I create multiple lines from the Start point to each Destination point.
I don't have Arc on this machine but this should work. It would actually work with multiple start points, but will work on a single start point as well.
import arcpy start_feature = arcpy.GetParameterAsText(0) end_feature = arcpy.GetParameterAsText(1) out_feature = arcpy.GetParameterAsText(2) start_cursor = arcpy.SearchCursor(start_feature) end_cursor = arcpy.SearchCursor(end_feature) desc = arcpy.Describe(start_feature) shapefieldname = desc.ShapeFieldName point = arcpy.Point() array = arcpy.Array() featureList =  cursor = arcpy.InsertCursor(out_feature) feat = cursor.newRow() for start in start_cursor: startFeature = start.getValue(shapefieldname) pnt1 = startFeature.getPart() for end in end_cursor: endFeature = end.getValue(shapefieldname) pnt2 = endFeature.getPart() point.X = pnt1.X point.Y = pnt1.Y array.add(point) point.X = pnt2.X point.Y = pnt2.Y array.add(point) polyline = arcpy.Polyline(array) array.removeAll() featureList.append(polyline) feat.shape = polyline cursor.insertRow(feat) del feat, cursor, end_cursor, start_cursor
You may actually want to change the inputs so it creates the output file during the script instead of having to point at one that's already created, but that depends on what you want to do.
While this is not model builder, it should give you what you are looking for (python). If you change the origin_x, origin_y, "MYFILE.csv", "layer_with_destinations","field_with_x_coordinate", and "field_with_y_coordinate" to the appropriate names this should give you a single table that has origin x, origin y, destination x and destination y fields which you can use for the input for "XY To Line"
import arcpy import csv cur = arcpy.UpdateCursor("layer_with_destinations") destinations= origin_x = #put your start point x coordinate here origin_y = #put your start point y coordinate here for i in cur: x,y=i.getValue("field_with_x_coordinate"),i.getValue("field_with_y_coordinate") destinations.append([x,y]) output_file = open("MYFILE.csv", "wb")#put your desired output csv file here including path c = csv.writer(output_file) c.writerow(["org_x", "org_y", "dest_x", "dest_y"]) for dest in destinations: c.writerow([origin_x, origin_y, dest, dest]) output_file.close()