示例#1
0
      Xcent = L + ((R-L)/2.0); Ycent = B + ((T-B)/2.0)
  if (length < 0.0):
    length_out = random.uniform(1, 100)
  else:
    length_out = length
  #
  #generate the points
  #
  if scatter == 0.0:
    if theType == "Random":
      pnts = PM.line_on(n, Xcent, Ycent, lineSlope_out, length_out, "True")
    else:
      pnts = PM.line_on(n, Xcent, Ycent, lineSlope_out, length_out, "False")
  else:
    if theType == "Random":
      pnts = PM.line_about(n, Xcent, Ycent, lineSlope_out, length_out, "True", scatter)
    else:
      pnts = PM.line_about(n, Xcent, Ycent, lineSlope_out, length_out, "False", scatter)
  #
  outPnts.append(pnts)
#
#optional shapefile creation
if outFC != "#":
  fieldsToAdd = [["Group", "LONG", "9", "#"],
                 ["X", "DOUBLE", 16, 7],
                 ["Y", "DOUBLE", 16, 7]]
  py_gp.createPointFile (outFC, shapeClass, "#", outPnts, fieldsToAdd, arcpy)
  arcpy.AddMessage("\n" + "You can join the original table to " \
                + "this shapefile table if you want other attributes." + "\n")
#
#optional csv file creation or output to screen