This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def isCADLayer(layer): | |
| ''' Returns True if a layer is a CAD layer. | |
| ''' | |
| desc = arcpy.Describe(layer) | |
| if hasattr(desc, "dataType") and (desc.dataType == "FeatureLayer"): | |
| describeTable = arcpy.Describe(desc.catalogPath) | |
| if describeTable.dataElementType == "DEFeatureClass": | |
| describePath = arcpy.Describe(describeTable.path) | |
| if hasattr(describePath, "dataType") | |
| and (describePath.dataType == "CadDrawingDataset"): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def OpenLink([Hyperlink_Log], [Hyperlink_Log2], [Hyperlink_Photo], [Hyperlink_LabTest], [Hyperlink_Televiewer], [Hyperlink_Geonor], [Hyperlink_Instrumentation] ): | |
| """Open multiple hyperlinks fields via python""" | |
| import webbrowser | |
| import os | |
| mxd = arcpy.mapping.MapDocument("CURRENT") | |
| basePath = mxd.hyperlinkBase | |
| paths = [Hyperlink_Log], [Hyperlink_Log2], [Hyperlink_LabTest], [Hyperlink_Photo], [Hyperlink_LabTest], [Hyperlink_Televiewer], [Hyperlink_Geonor], [Hyperlink_Instrumentation] | |
| for path in paths: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def RotateXY(x,y,xc=0,yc=0,angle=0,units='DEGREES'): | |
| """Rotate an xy cooordinate about a specified origin | |
| returning a new xy cooordinate | |
| x,y xy coordinates | |
| xc,yc center of rotation | |
| angle angle | |
| units "DEGREES" (default) or "RADIANS" | |
| """ | |
| import math |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def setNAN(): | |
| minx = float('nan') | |
| def checkNAN(): | |
| import math | |
| if math.isnan(minx): | |
| return 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def hasSelection(lyr): | |
| ''' Check whether specified layer has a selection. ''' | |
| import arcpy | |
| desc = arcpy.Describe(lyr) | |
| if len(desc.FIDSet) == 0: | |
| # Layer has no selection | |
| return False | |
| else: | |
| # Layer has a selection | |
| return True |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """---------------------------------------------------------------------------- | |
| Name: $[ActiveDoc-Name] | |
| Description: | |
| Requirements: ArcGIS Desktop Standard (10.2) | |
| Python Version: 2.7 | |
| Inputs: | |
| Outputs: |
NewerOlder