Multipatch To Collada (Conversion)

Summary

Converts one or more multipatch features into a collection of COLLADA files and referenced texture image files in an output folder. The inputs can be a layer or a feature class.

Usage

Syntax

MultipatchToCollada_conversion (in_features, output_folder, {prepend_source}, field_name)
ParameterExplanationData Type
in_features

The multipatch features to be exported.

Feature Layer
output_folder

The destination folder where the output COLLADA files and texture image files will be placed.

Folder
prepend_source
(Optional)

Prepend the file names of the output COLLADA files with the name of the source feature layer.

  • PREPEND_SOURCE_NAMEPrepend the file names.
  • PREPEND_NONEDo not prepend the file names. This is the default.
Boolean
field_name

The feature attribute to use as the output COLLADA filename for each exported feature. If no field is specified, the feature's Object ID is used.

String

Code Sample

MultipatchToCollada Example (Python Window)

The following Python window script demonstrates how to use the MultipatchToCollada function in immediate mode.

 
import arcpy
from arcpy import env
env.workspace = "C:/data"
arcpy.MultipatchToCollada_conversion("Buildings","C:/COLLADA", PREPEND_SOURCE_NAME, "BldName")
MultipatchToCollada Example 2 (stand-alone script)

The following stand-alone script demonstrates how to use the MultipatchToCollada function.

 
# 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
 

Environments

This tool does not use any geoprocessing environments

Related Topics

Licensing Information

ArcView: Yes
ArcEditor: Yes
ArcInfo: Yes

11/14/2011