3D 线与多面体相交 (3D Analyst)

许可等级:BasicStandardAdvanced

摘要

确定并返回线与多面体要素之间几何交集的数量。可选择性地将表示交集的点要素和表示在此类点分开的输入线的线要素写入输出要素类中。

插图

Intersect 3D Line With Multipatch example

用法

语法

Intersect3DLineWithMultiPatch_3d (in_line_features, in_multipatch_features, {join_attributes}, {out_point_feature_class}, {out_line_feature_class})
参数说明数据类型
in_line_features

要与多面体要素相交的线要素。

Feature Layer
in_multipatch_features

要与线相交的多面体要素。

Feature Layer
join_attributes
(可选)

定义是否会将输入线要素的属性保留在输出线要素类中。

  • IDS_ONLY 不会将输入线要素的任何属性写入输出线要素类中。这是默认设置。
  • ALL将输入线要素的所有属性写入输出线要素类中。
String
out_point_feature_class
(可选)

用于表示 3D 线和多面体之间交点的可选要素。

Feature Class
out_line_feature_class
(可选)

在与多面体要素的交点处对输入 3D 线进行分割的可选线要素。

Feature Class

代码实例

Intersect3DLineWithMultipatch 示例 1(Python 窗口)

下面的示例演示了如何在 Python 窗口中使用此工具:

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 示例 2(独立脚本)

下面的示例演示了如何在独立 Python 脚本中使用此工具:

'''****************************************************************************
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)

环境

相关主题

许可信息

ArcGIS for Desktop Basic: 需要 3D Analyst
ArcGIS for Desktop Standard: 需要 3D Analyst
ArcGIS for Desktop Advanced: 需要 3D Analyst
5/10/2014