Summary
Returns the number of geometric intersections between 3D line and multipatch features and also provides optional features that represent points of intersection and also divide the 3D lines at such points.
Illustration
Usage
The intersection count will be returned in the message window and can be used in a model or script to establish preconditions for subsequent operations.
This tool determines the points of intersection in 3D Euclidian space. 2D line features are not supported by this tool, but 2D line features with height definitions stored in an attribute field can be converted to 3D by using Feature To 3D By Attribute.
The optional point output represents points of intersection between the input line and multipatch features and contains the following attributes:
- LINE_OID—The OBJECTID of the original line along which the intersection was found.
- MPATCH_OID—The OBJECTID of the multipatch which intersected the line at this location.
- DIST_3D—The 3D distance along the original line at which the intersection was found.
The optional line output divides input line features at the points of intersection and contains the following attributes:
- LINE_OID—The OBJECTID of the original line from which the new line was derived.
- FROM_MP_ID—The OBJECTID of the multipatch feature that intersects the beginning of the line. A value of -1 is used to denote that the beginning of the line is not a point of intersection.
- TO_MP_ID—The OBJECTID of the multipatch that intersects the end of the line. A value of -1 is used to denote that the beginning of the line is not a point of intersection.
- DIST_3D—The 3D distance along the original line at which an intersection was found and which represents the beginning of this new line.
- LENGTH_3D—The 3D length of this new line. The sum of the lengths of each new line derived from an original line will be equal to the 3D length of that original line.
Attribute values from the original lines can be referenced in the optional output features through the use of output line feature class through the Join Attributes parameter.
Syntax
Intersect3DLineWithMultiPatch_3d (in_line_features, in_multipatch_features, {join_attributes}, {out_point_feature_class}, {out_line_feature_class})
Parameter | Explanation | Data Type |
in_line_features | The line features that will be intersected with the multipatch features. | Feature Layer |
in_multipatch_features | The multipatch features that the lines will be intersected against. | Feature Layer |
join_attributes (Optional) | The input line feature attributes that will be stored with the optional output features.
| String |
out_point_feature_class (Optional) | Optional features that represent points of intersection between the 3D line and multipatch. | Feature Class |
out_line_feature_class (Optional) | Optional line features that divide the input lines at each point of intersection with a multipatch feature. | Feature Class |
Code Sample
Intersect3DLineWithMultipatch example 1 (Python window)
The following sample demonstrates the use of this tool in the Python window.
import arcpy
from arcpy import env
arcpy.CheckOutExtension('3D')
env.workspace = 'C:/data'
arcpy.Intersect3DLineWithMultiPatch_3d('inLine.shp', 'inMultipatch.shp',
'IDS_ONLY', 'outPts.shp', 'outLine.shp')
Intersect3DLineWithMultipatch example 2 (stand-alone script)
The following sample demonstrates the use of this tool in a stand-alone Python script.
'''****************************************************************************
Name: Intersect3DLineWithMultiPatch Example
Description: This script demonstrates how to
use the Intersect3DLine tool.
****************************************************************************'''
# Import system modules
import arcpy
import exceptions, sys, traceback
from arcpy import env
try:
# Obtain a license for the ArcGIS 3D Analyst extension
arcpy.CheckOutExtension('3D')
# Set environment settings
env.workspace = 'C:/data'
# Set Local Variables
inLineFC = 'sample.gdb/lines_3d'
inMP = 'sample.gdb/test_MP'
# Ensure a unique name is produced for output files
outPoint = arcpy.CreateUniqueName('OutPt_3DIntersect', 'sample.gdb')
outLine = arcpy.CreateUniqueName('OutLine_3DIntersect', 'sample.gdb')
# Execute Intersect 3D Line with Multipatch
arcpy.Intersect3DLineWithMultiPatch_3d(inLineFC, inMP, 'IDS_ONLY',
outPoint, outLine)
except arcpy.ExecuteError:
print arcpy.GetMessages()
except:
# Get the traceback object
tb = sys.exc_info()[2]
tbinfo = traceback.format_tb(tb)[0]
# Concatenate error information into message string
pymsg = 'PYTHON ERRORS:\nTraceback info:\n{0}\nError Info:\n{1}'\
.format(tbinfo, str(sys.exc_info()[1]))
msgs = 'ArcPy ERRORS:\n {0}\n'.format(arcpy.GetMessages(2))
# Return python error messages for script tool or Python Window
arcpy.AddError(pymsg)
arcpy.AddError(msgs)
Environments
Licensing Information
- ArcGIS for Desktop Basic: Requires 3D Analyst
- ArcGIS for Desktop Standard: Requires 3D Analyst
- ArcGIS for Desktop Advanced: Requires 3D Analyst