Multipatch To COLLADA (Conversion)

Summary

Converts one or more multipatch features into a collection of COLLADA files (.dae) and referenced texture image files in an output folder.

Usage

  • A COLLADA file is an XML representation of a 3D object that can reference additional image files that act as textures draped onto the 3D geometry. This means that exporting a multipatch feature to COLLADA can result in the creation of several files—a .dae file containing the XML representation of the 3D object and one or more image files (for example, a .jpg or .png file) that contain the textures.

  • This tool creates one COLLADA representation for each multipatch feature that it exports. The tool uses a field value from each feature—by default, this is the Object ID—to define the output file names. This allows the identification of which feature was exported to which COLLADA file and provides the methodology for defining unique names when exporting multiple features to the same directory. Texture files are stored in the same directory as the COLLADA file. To minimize the total export file size, textures that are used in multiple COLLADA files—such as a repeated brick or window texture—are only exported once and are referenced by the applicable .dae files.

  • This tool automatically overwrites existing COLLADA files with the same file name. When this occurs, a warning message appears stating the files that were overwritten with a new file during the export process. A geoprocessing message is also generated for features that fail to export—for example, if the output location is read-only or the disk is full.

  • To ensure a new COLLADA file is created for all exported multipatch features, set the destination directory to an empty or new folder and choose a file name field that is unique for each feature. Exporting two features with the same attribute value will result in the second exported feature overwriting the COLLADA file of the first.

  • When iteratively updating a multipatch feature by exporting it to COLLADA and making changes outside of ArcGIS, export the feature to the same location each time. This will keep a single file on disk for that feature, representing the most up-to-date state of the 3D object.

  • If the exported multipatch is in a projected coordinate system, such as a building stored in a UTM zone, a .kml file containing the coordinates as WGS84 will also be created in the output folder. This process does not use a datum transformation, which may result in positional discrepancies when viewing the KML.

    Tip:

    When converting multipatches from a layer, the tool will automatically embed colors defined in the layer's renderer. For example, if the layer is rendering features based on a use-type attribute—such as red for commercial, blue for residential, and so on—these colors will be included in the output COLLADA files. The displayed color is applied to both textured and untextured multipatch features, with the former requiring an update to the feature's underlying texture files. You can use a single display color of white to export textured multipatches with unaltered images.

Parameters

LabelExplanationData Type
Input Multipatch Features

The multipatch features to be exported.

Feature Layer
Output COLLADA Folder

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

Folder
Prepend Source Name
(Optional)

Specifies whether the names of the output COLLADA files will be prepended with the name of the source feature layer.

  • Checked—The file names will be prepended with the name of the source feature layer.
  • Unchecked—The file names will not be prepended with the name of the source feature layer. This is the default.

Boolean
Use Field Name
(Optional)

The feature attribute that will be used as the output COLLADA file name for each exported feature. If no field is specified, the feature's Object ID will be used.

Field
COLLADA Version

Specifies the COLLADA version to which the files will be exported.

  • 1.5Files will be exported to COLLADA version 1.5. Version 1.5 supports the inclusion of georeferencing information and enhanced rendering capabilities. This is the default.
  • 1.4Files will be exported to COLLADA version 1.4. Version 1.4 is the widely supported standard used in many design related application platforms. Select this version if the COLLADA file will be used on systems that do not support version 1.5.
String

arcpy.conversion.MultipatchToCollada(in_features, output_folder, {prepend_source}, {field_name}, collada_version)
NameExplanationData 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)

Specifies whether the names of the output COLLADA files will be prepended with the name of the source feature layer.

  • PREPEND_SOURCE_NAMEThe file names will be prepended with the name of the source feature layer.
  • PREPEND_NONEThe file names will not be prepended with the name of the source feature layer. This is the default.
Boolean
field_name
(Optional)

The feature attribute that will be used as the output COLLADA file name for each exported feature. If no field is specified, the feature's Object ID will be used.

Field
collada_version

Specifies the COLLADA version to which the files will be exported.

  • 1.5Files will be exported to COLLADA version 1.5. Version 1.5 supports the inclusion of georeferencing information and enhanced rendering capabilities. This is the default.
  • 1.4Files will be exported to COLLADA version 1.4. Version 1.4 is the widely supported standard used in many design related application platforms. Select this version if the COLLADA file will be used on systems that do not support version 1.5.
String

Code sample

MultipatchToCollada example 1 (Python window)

The following sample demonstrates the use of this tool in the Python window.

import arcpy
arcpy.env.workspace = "C:/data"
arcpy.conversion.MultipatchToCollada("Sample.gdb/Buildings", "C:/COLLADA", 
                                     "PREPEND_SOURCE_NAME", "BldName")
MultipatchToCollada example 2 (stand-alone script)

The following sample demonstrates the use of this tool in a stand-alone Python script.

'''*********************************************************************
Name: Convert Multipatch To Collada
Description: Converts multipatch features in an input workspace 
             to a Collada model.
*********************************************************************'''
# Import system modules
import arcpy

# Script variables
inWorkspace = arcpy.GetParameterAsText(0)

# Set environment settings
arcpy.env.workspace = inWorkspace
# Create list of feature classes in workspace
fcList = arcpy.ListFeatureClasses()

# Determine if the list contained any feature classes
if fcList:
    # 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':
           # 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 = 'OID'
           # Run MultipatchToCollada
           arcpy.conversion.MultipatchToCollada(fc, outDir, prepend, fldName)
else:
    print('There are no feature classes in {0}.'.format(inWorkspace))

Environments

This tool does not use any geoprocessing environments.

Licensing information

  • Basic: Yes
  • Standard: Yes
  • Advanced: Yes

Related topics