多面体(Multipatch)转 Collada (转换)

摘要

将一个或多个多面体要素转换为 COLLADA 文件及其引用的纹理图像文件的集合并将此集合存储在输出文件夹中。输入可以是图层或要素类。

用法

语法

MultipatchToCollada_conversion (in_features, output_folder, {prepend_source}, field_name)
参数说明数据类型
in_features

要导出的多面体要素。

Feature Layer
output_folder

放置输出 COLLADA 文件和纹理图像文件的目标文件夹。

Folder
prepend_source
(可选)

将源要素图层的名称添加为输出 COLLADA 文件的文件名的前缀。

  • PREPEND_SOURCE_NAME添加文件名前缀。
  • PREPEND_NONE不添加文件名前缀。这是默认设置。
Boolean
field_name

用作每个导出的要素的输出 COLLADA 文件名的要素属性。如果未指定字段,则使用要素的“对象 ID”。

String

代码示例

MultipatchToCollada 示例(Python 窗口)

以下 Python 窗口脚本演示了如何在立即模式下使用 MultipatchToCollada 函数。

  import arcpy from arcpy import env env.workspace = "C:/data" arcpy.MultipatchToCollada_conversion("Buildings","C:/COLLADA", PREPEND_SOURCE_NAME, "BldName")
MultipatchToCollada 示例 2(独立脚本)

以下独立脚本演示了如何使用 MultipatchToCollada 函数。

  # Name: MultipatchToCollada_Example2.py # Description: The following stand-alone script demonstrates how to use the # 			MultipatchToCollada tool to convert all multipatch shapefiles  #			in a target workspace. # Requirements: 3D Analyst extension # Author: ESRI  # Import system modules import arcpy from arcpy import env  # Obtain a license for the 3D Analyst extension arcpy.CheckOutExtension("3D")  # Set environment settings env.workspace = "C:/data"  try:     # Create list of feature classes in workspace     fcList = arcpy.ListFeatureClasses()     # Determine if the list contained any feature classes     if len(fcList) > 0:         # Iterate through each feature class         for fc in fcList:             # Describe the feature class             desc = arcpy.Describe(fc)             # Determine if feature class is a multipatch             if desc.shapeType is "MultiPatch":                 # Set Local Variables                 ## Ensure unique name for output folder                 outDir = arcpy.CreateUniqueName("collada_dir")                 ## Specify that collada file is prefixed by source name                  prepend = "PREPEND_SOURCE_NAME"                 ## Specify the feature attribute used to name Collada files                 fldName = "Name"                 #Execute MultipatchToCollada                 arcpy.MultipatchToCollada(fc, outDir, prepend, fldName)                 del outDir, prepend, fldName    	        else:                 print "There are no multipatch shapefiles in " + env.workspace + "."     else:         print "There are no feature classes in " + env.workspace + "."  except Exception as e:     # Returns any other error messages     print arcpy.GetMessages(2)  del arcpy  

环境

此工具不使用任何地理处理环境

相关主题

许可信息

ArcView: 是
ArcEditor: 是
ArcInfo: 是

7/10/2012