摘要
根据非闭合多面体要素创建闭合多面体要素。
用法
此工具可用于设计为闭合但具有几何间隙以保持其开放的多面体要素(例如建筑物)。
将对所有多面体要素进行评估以确定哪些多面体是闭合的。已闭合的要素将复制到输出多面体。
是否为闭合 3D 工具可用于确定多面体要素类是否包含任何未闭合要素。
此工具是 3D 集合运算工具,提供针对 3D 要素的分析函数。有关集合运算的概念和用法的详细信息,请参阅使用 3D 集合运算。
语法
EncloseMultiPatch_3d (in_features, out_feature_class, {grid_size})
参数 | 说明 | 数据类型 |
in_features | 用于构造闭合多面体的多面体要素。 | Feature Layer |
out_feature_class | 输出闭合多面体要素。 | Feature Class |
grid_size (可选) | 用于构造闭合多面体要素的分辨率。此值使用输入要素空间参考的线性单位定义。 | Double |
代码示例
EncloseMultiPatch 示例 1(Python 窗口)
下面的示例演示了如何在 Python 窗口中使用此工具。
import arcpy
from arcpy import env
arcpy.CheckOutExtension('3D')
env.workspace = 'C:/data'
arcpy.EncloseMultiPatch_3d('unclosed_features.shp',
'enclosed_features.shp', 0.5)
EncloseMultiPatch 示例 2(独立脚本)
下面的示例演示了如何在独立 Python 脚本中使用此工具。
'''*********************************************************************
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)
环境
许可信息
- ArcGIS Desktop Basic: 需要 3D Analyst
- ArcGIS Desktop Standard: 需要 3D Analyst
- ArcGIS Desktop Advanced: 需要 3D Analyst