Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. # Import arcpy module
  2. import arcpy
  3. arcpy.env.workspace = "C:UsersJackDesktopGISBackupParcel.gdb"
  4. arcpy.env.overwriteOutput = True
  5.  
  6. # Script arguments
  7. Input_Feature_Class = arcpy.GetParameterAsText(0)
  8. if Input_Feature_Class == '#' or not Input_Feature_Class:
  9. Input_Feature_Class = Parcel_Selected
  10.  
  11. # Local variables:
  12. SplitLines = arcpy.GetParameterAsText(1)
  13. if SplitLines == '#' or not SplitLines:
  14. SplitLines = "ParcelWithLabel"
  15.  
  16. # Process: Split Line At Vertices
  17. arcpy.SplitLine_management(Input_Feature_Class, SplitLines)
  18.  
  19. # Process: Delete Identical
  20. arcpy.DeleteIdentical_management(SplitLines, "shape", "", "0")
  21.  
  22. # Process: Show Labels
  23. mxd = arcpy.mapping.MapDocument("CURRENT") #Map document reference
  24. dataFrame = arcpy.mapping.ListDataFrames(mxd, "*")[0]
  25. addLayer = arcpy.mapping.Layer(SplitLines)
  26. arcpy.mapping.AddLayer(dataFrame, addLayer)
  27. layer = arcpy.mapping.ListLayers(mxd, "")[0]
  28. if layer.supports("LABELCLASSES"):
  29. for lblclass in layer.labelClasses:
  30. lblclass.showClassLabels = True
  31. lblclass.expression = '"{}" & round([Shape_Length],2) & "{}"'.format("<FNT name='Arial' size='12'>" , "</FNT>")
  32. layer.showLabels = True
  33. arcpy.RefreshActiveView()
  34.  
  35. mxd = arcpy.mapping.MapDocument("c:/myMXDs/project1/thing.mxd")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement