Union 3D (3D Analyst)

Summary

Computes the geometric intersection of the patches of overlapping multipatches, then aggregates the multipatches together. How many features are created as output depends on the tool's settings.

Learn more about how Union 3D (3D Analyst) works

Usage

Syntax

Union3D_3d (in_feature_class, {group_field}, out_feature_class, {out_table}, {disable_optimization}, {output_all})
ParameterExplanationData Type
in_feature_class

The closed multipatch features to be intersected and aggregated.

Features
group_field
(Optional)

The field used to group input multipatch features together for aggregation.

Field
out_feature_class

The multipatch feature class into which the aggregated multipatch(es) will be placed.

Feature Class
out_table
(Optional)

A many to one table representing the Input Features and the Output Features that they where aggregated in to.

Table
disable_optimization
(Optional)

Disables the optimization that automatically determines which multipatch features overlap, and only unions those features with overlaps.

  • DISABLEDNo optimization is performed on the input data. Feature will be union according to their grouping field, or all features will be unioned into a single output feature. This is the default.
  • ENABLEDOptimization is performed on the input data. The tool will do some pre-processing to detect which features may overlap, grouping them together, to improve performance and create unique outputs for each set of overlapping features.
Boolean
output_all
(Optional)

This option forces the tool to write out all input features as output features. Features that have no overlaps are written to the output unmodified. Overlapping features are unioned together, and then written to the output.

  • DISABLEDOnly features that are unioned are written as output.
  • ENABLEDAll input features are written as output.
Boolean

Code Sample

Union 3D Example 1 (Python window)

The following Python Window script demonstrates how to use the Union 3D function in immediate mode.

import arcpy
from arcpy import env

arcpy.CheckOutExtension('3D')
env.workspace = 'C:/data'
arcpy.Union3D_3d('multipatch.shp', 'union_output.shp', 'GROUP_FIELD', 
                'DISABLE', 'ENABLE', 'UnionTable.dbf')
Union 3D Example 2 (stand-alone script)

The following Python script demonstrates how to use the Union 3D function in a stand-alone script.

'''****************************************************************************
Name: Union3D Example
Description: This script demonstrates how to use the 
             Union3D tool.
****************************************************************************'''
# Import system modules
import arcpy
import exceptions, sys, traceback
from arcpy import env

try:
    arcpy.CheckOutExtension('3D')
    # Set environment settings
    env.workspace = 'C:/data'
    # Set Local Variables
    inMP = "multipatch.shp"
    # Ensure output multipatch has a unique name
    outMP = arcpy.CreateUniqueName("union_output.shp")
    outTbl = arcpy.CreateUniqueName("UnionTable.dbf")
    GroupField = "Type"
    optimize = "DISABLE"
    solids = "ENABLE"
    #Execute Union3D
    arcpy.ddd.Union3D(inMP, outMP, GroupField, optimize, solids, outTbl)
    arcpy.CheckInExtension('3D')


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)

Environments

This tool does not use any geoprocessing environments

Related Topics

Licensing Information

ArcView: Requires 3D Analyst
ArcEditor: Requires 3D Analyst
ArcInfo: Requires 3D Analyst

6/10/2013