Summary
Imports one or more 3D models into a multipatch feature class.
Usage
Preserve the texture of 3D models by storing the output multipatch in a geodatabase. Shapefiles do not support the retention of textures.
If the top side of the resulting multipatch features are oriented sideways, try adjusting the orientation by using this tool again with the Y_Is_Up parameter enabled.
GeoVRML is the only format that has a defined coordinate system. Many 3D models are generated using local coordinate systems that center the XYZ axis on 0, 0, 0. Such features can be georeferenced to real-world coordinates using one of the following methods:
- If the 3D models need to be rotated and shifted, consider performing spatial adjustmenttechniques to position the features properly. Learn more about spatial adjustment.
- If the 3D models are oriented properly for a given coordinate system and only need to be shifted to the correct position, consider customizing the Coordinate System properties to produce the necessary shift. If point features that define the position of each model's centroid in real-world coordinates are available, consider using the points as inputs for the tool to georeference the models.
Point and line geometries that may exist in a 3D file are not maintained in the output multipatch feature class, as multipatches do not support them.
Syntax
Import3DFiles_3d (in_files, out_featureClass, {root_per_feature}, {spatial_reference}, {y_is_up}, file_suffix, {in_featureClass}, {symbol_field})
Parameter | Explanation | Data Type |
in_files | One or more 3D models or folders containing such files in the supported formats, which are 3D Studio Max (*.3ds), SketchUp (*.skp), VRML and GeoVRML (*.wrl), OpenFlight (*.flt), and COLLADA (*.dae). | File; Folder |
out_featureClass | The multipatch that will be created from the input files. | Feature Class |
root_per_feature (Optional) | Indicates whether to produce one feature per file or one feature for every root node in the file. This option only applies to VRML models.
| Boolean |
spatial_reference (Optional) | The coordinate system of the input data. For the majority of formats, this is unknown. Only the GeoVRML format stores its coordinate system, and its default will be obtained from the first file in the list unless a spatial reference is specified here. | Spatial Reference |
y_is_up (Optional) | Identifies the axis that defines the vertical orientation of the input files.
| Boolean |
file_suffix | The file extension of the files to import from an input folder. This parameter is required when at least one folder is specified as an input.
| String |
in_featureClass (Optional) | The point features whose coordinates define the real-world position of the input files. Each input file will be matched to its corresponding point based on the file names stored in the Symbol Field. The Coordinate System parameter should be defined to match the spatial reference of the points. | Feature Layer |
symbol_field (Optional) | The field in the point features containing the name of the 3D file associated with each point. | Field |
Code Sample
Import3DFiles example 1 (Python window)
The following sample demonstrates the use of this tool in the Python window.
import arcpy
from arcpy import env
arcpy.CheckOutExtension("3D")
env.workspace = "C:/data"
arcpy.Import3DFiles_3d("AddisSheraton.skp", "Test.gdb/AddisSheraton", False, "", False)
Import3DFiles example 2 (stand-alone script)
The following sample demonstrates the use of this tool in a stand-alone Python script.
'''*********************************************************************
Name: Model Shadows For GeoVRML Models
Description: Creates a model of the shadows cast by GeoVRML models
imported to a multipatch feature class for a range of dates
and times. A range of times from the start time and end
time can also be specified by setting the EnforceTimes
Boolean to True. This sample is designed to be used in a
script tool.
*********************************************************************'''
# Import system modules
import arcpy
from datetime import datetime, time, timedelta
#************************* Script Variables **************************
inFiles = arcpy.GetParameterAsText(0) # list of input features
spatialRef = arcpy.GetParameterAsText(1) # list of GeoVRML files
outFC = arcpy.GetParameterAsText(2) # multipatch from 3D files
inTimeZone = arcpy.GetParameterAsText(3) # time zone
startDate = arcpy.GetParameter(4) # starting date as datetime
endDate = arcpy.GetParameter(5) # ending date as datetime
dayInterval = arcpy.GetParameter(6) # day interval as long (0-365)
minInterval = arcpy.GetParameter(7) # minute interval as long (0-60)
enforceTime = arcpy.GetParameter(8) # minute interval as Boolean
outShadows = arcpy.GetParameterAsText(9) # output shadow models
outIntersection = arcpy.GetParameterAsText(10) # shadow & bldg intersection
# Function to find all possible date/time intervals for shadow modelling
def time_list():
dt_result = [startDate]
if dayInterval:
if endDate: #Defines behavior when end date is supplied
while startDate < endDate:
startDate += timedelta(days=dayInterval)
dt_result.append(startDate)
dt_result.append(endDate)
else: # Behavior when end date is not given
daymonthyear = datetime.date(startDate)
while startDate <= datetime(daymonthyear.year, 12, 31, 23, 59):
startDate += timedelta(days=dayInterval)
dt_result.append(startDate)
return dt_result
try:
arcpy.CheckOutExtension('3D')
importFC = arcpy.CreateUniqueName('geovrml_import', 'in_memory')
# Import GeoVRML files to in-memory feature
arcpy.ddd.Import3DFiles(inFiles, importFC, 'ONE_FILE_ONE_FEATURE',
spatialRef, 'Z_IS_UP', 'wrl')
# Ensure that building models are closed
arcpy.ddd.EncloseMultiPatch(importFC, outFC, 0.05)
# Discard in-memory feature
arcpy.management.Delete(importFC)
dt_result = time_list()
for dt in dt_result:
if dt == dt_result[0]:
shadows = outShadows
else:
shadows = arcpy.CreateUniqueName('shadow', 'in_memory')
arcpy.ddd.SunShadowVolume(outFC, dt, shadows, 'ADJUST_FOR_DST',
inTimeZone, '', minInterval, 'MINUTES')
if dt is not dt_result[0]:
arcpy.management.Append(shadows, outShadows)
arcpy.management.Delete(shadows)
arcpy.ddd.Intersect3D(outFC, outIntersection, outShadows, 'SOLID')
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
Licensing Information
- ArcGIS for Desktop Basic: Requires 3D Analyst
- ArcGIS for Desktop Standard: Requires 3D Analyst
- ArcGIS for Desktop Advanced: Requires 3D Analyst