描述
将具有 3D 显示属性的要素图层导出为 3D 线或多面体要素。
使用
- 符号系统具有以下属性的要素图层将被导出到多面体中: - 拉伸或基本高度设置。
- 具有深度的字符标记符号。
- 3D 模型标记符号(其尺寸在真实世界中用线性单位表示,如英尺、英寸、米或厘米)。
- 所有线符号系统。
- 所有面符号系统。如果面图层不具备任何 3D 显示属性,则该图层将被导出为与该面类似的多面体。
 
- 不支持 ArcGlobe 中的叠加图层。由于叠加表面的动态性,将不会保留高度值。 
- 不支持纹理填充符号。如果图层中的要素使用具有限制属性的 3D 标记符号(例如纹理),则不会将要素添加到输出中。 
- 此工具不支持通过以下任何属性符号化的要素: - 图片标记符号。
- 来自磁盘文件的形状标记符号。
- 叠加在场景表面上的栅格化图层。
- 来源于字体但不具备深度属性的形状标记符号。
- 3D 标记符号(其尺寸在真实世界中未用线性单位指定,如英尺、英寸、米或厘米)。
- 以广告牌方式显示的标记符号。这些 2D 符号的位置采用动态定向,以面向 3D 场景中的照相机位置,所以它们不具备能够用于导出的固定方向。
 
- 输出为线要素时,仅支持 XYZ 容差和分辨率的环境设置。 
语法
Layer3DToFeatureClass(in_feature_layer, out_feature_class, {group_field})| 参数 | 说明 | 数据类型 | 
| in_feature_layer | 定义了 3D 显示属性的输入要素图层。 | Feature Layer | 
| out_feature_class | 拉伸点将导出为 3D 线。含 3D 符号的点、拉伸线和面将导出为多面体要素。 | Feature Class | 
| group_field (可选) | 用于将多个输入要素合并为同一输出要素的输入要素文本字段。所生成输出的其余属性将从其中一个输入记录继承。 | Field | 
代码示例
Layer3DToFeatureClass 示例 1(Python 窗口)
下面的示例演示了如何在 Python 窗口中使用此工具。
import arcpy
from arcpy import env
arcpy.CheckOutExtension("3D")
env.workspace = "C:/data"
arcpy.Layer3DToFeatureClass_3d("Points_3D.lyr", "Test.gdb/trees")
Layer3DToFeatureClass 示例 2(独立脚本)
下面的示例演示了如何在独立 Python 脚本中使用此工具。
'''****************************************************************************
Name: Layer3DToFeatureClass Example
Description: This script demonstrates how to use the 
             Layer3DToFeatureClass tool to create multipatches from all
             layers in a target workspace. The layer files are assumed to have
             been saved wtih 3D rendering from ArcScene.
****************************************************************************'''
# Import system modules
import arcpy
from arcpy import env
import exceptions, sys, traceback
try:
    # Obtain a license for the ArcGIS 3D Analyst extension
    arcpy.CheckOutExtension("3D")
    
    # Set environment settings
    env.workspace = "C:/data"
    
    # Use the ListFiles method to identify all layer files in workspace
    if arcpy.ListFiles("*.lyr"):
        for lyrFile in arcpy.ListFiles("*.lyr"):
            # Set Local Variables
            outFC = "Test.gdb/{0}".format(lyrFile[:-4]) #Strips '.lyr' from name
            #Execute Layer3DToFeatureClass
            arcpy.Layer3DToFeatureClass_3d(file, outFC)
    else:
        "There are no layer files in {0}.".format(env.workspace)
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)
环境
许可信息
- Basic: 需要 3D Analyst
- Standard: 需要 3D Analyst
- Advanced: 需要 3D Analyst