Intersect 3D Line With Multipatch (3D Analyst)
Summary
Determines and returns the number of geometric intersections between line and multipatch features. Point features representing the intersection and line features representing the input lines divided at such points can optionally be written to output feature classes.
Illustration
Usage
-
2D line features are not supported by this tool. Z-enabled 3D line features are required because intersection calculations are performed on 3D features in 3D Euclidian space. 2D line features with height definitions stored in an attribute field can be converted to 3D by using Feature To 3D By Attribute.
The intersection count will be returned as an integer result in the message window and can be used in a model or script to establish preconditions for subsequent operations.
-
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.Note:
If a line does not intersect with a multipatch, it is directly copied to the output and its FROM_MP_ID and TO_MP_ID fields will be attributed with a value of -1.
- 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.
This tool is a 3D set operator that provides analytical functions on 3D features. See Working with 3D set operators for more information on what set operators are and how to use them.
Syntax
Parameter | Explanation | Data Type |
in_line_features |
The line features that will be intersected with multipatch features.. | Feature Layer |
in_multipatch_features |
The multipatch features that the lines will be intersected against. | Feature Layer |
join_attributes (Optional) |
Defines whether attributes from the input line features will be preserved in the output line feature class.
| 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 input 3D lines at points of intersection with multipatch features. | Feature Class |
Code Sample
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')
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)