Find below the code that I used to recreate the Feature Vertices To Points tool for Basic licenses (sorry for the Spanish interface):
Code for the tool:
import arcpy
import os
def main():
fc_in = arcpy.GetParameterAsText(0)
fc_out = arcpy.GetParameterAsText(1)
method = arcpy.GetParameterAsText(2)
fld_oid_in = "OIDentrada"
geomtype = "POINT"
sr = arcpy.Describe(fc_in).spatialReference
ws_name, fc_name = os.path.split(fc_out)
createFeatureClass(fc_out, fc_in, geomtype, sr)
arcpy.AddField_management(fc_out, fld_oid_in, "LONG")
cnt = 0
flds_out = ("SHAPE@", fld_oid_in)
with arcpy.da.InsertCursor(fc_out, flds_out) as curs_out:
flds_in =("SHAPE@", "OID@")
with arcpy.da.SearchCursor(fc_in, flds_in) as curs:
for row in curs:
feat = row[0]
oid = row[1]
lst_vertices = getVertices(feat, method)
for vertice in lst_vertices:
cnt += 1
if cnt % 100 == 0:
arcpy.AddMessage("Procesando punto: {0}".format(cnt))
curs_out.insertRow((vertice, oid, ))
def getVertices(feat, method):
"""Convertir poligono o linea a puntos dependiendo del metodo"""
if feat.type == "polygon":
polyline = feat.boundary()
else:
polyline = feat
lst_vertices = []
if method == "ALL":
for part in polyline:
for pnt in part:
lst_vertices.append(pnt)
elif method == "MID":
pnt = polyline.positionAlongLine(0.5, True)
lst_vertices.append(pnt)
elif method == "START":
lst_vertices.append(polyline.firstPoint)
elif method == "END":
lst_vertices.append(polyline.lastPoint)
elif method == "BOTH_ENDS":
lst_vertices.append(polyline.firstPoint)
lst_vertices.append(polyline.lastPoint)
return lst_vertices
def createFeatureClass(fc_out, fc_in, geomtype, sr):
ws_name, fc_name = os.path.split(fc_out)
arcpy.CreateFeatureclass_management(ws_name, fc_name, geomtype, spatial_reference=sr)
if __name__ == '__main__':
main()