REVIT dynamo 與ai的應用3 選取多重牆面並偵測長寬高(程式碼在下面)
Автор: eelshop chiu
Загружено: 2025-11-22
Просмотров: 54
加入會員,會有所有影片的分享素材,請成為這個頻道的會員並獲得獎勵:
/ @eelshopchiu
我們的網站與課程
https://eelshopchiu.com/
#程式在這…========================================
import clr
clr.AddReference("RevitServices")
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
接收輸入(可能是單一或多個)
raw = IN[0]
統一轉成 list
elements = raw if isinstance(raw, list) else [raw]
result = []
for element in elements:
element = UnwrapElement(element)
if element is None:
result.append("⚠️ 抓不到物件,請重新選取。")
continue
類型名稱
type_name = element.Name
長度(BoundingBox)
bbox = element.get_BoundingBox(None)
length = bbox.Max.X - bbox.Min.X
高度
height_param = element.LookupParameter("不連續高度")
height = height_param.AsDouble() if height_param else None
英尺轉公尺
ft_to_m = 0.3048
length_m = round(length * ft_to_m, 2)
height_m = round(height * ft_to_m, 2) if height else None
result.append({
"類型名稱": type_name,
"長度 (公尺)": length_m,
"高度 (公尺)": height_m
})
OUT = result
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: