top of page

在Dynamo透過python節點將視圖放到圖紙上

  • 作家相片: Yimin Chen
    Yimin Chen
  • 2024年7月19日
  • 讀畢需時 1 分鐘

已更新:2025年12月17日

不囉嗦,直接上程式碼

import clr

# Import Revit API
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

# Import RevitServices
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

# Current Revit Document
doc = DocumentManager.Instance.CurrentDBDocument

# Unwrap the inputs
sheet = UnwrapElement(IN[0])
view = UnwrapElement(IN[1])
point = IN[2]  # Point where the view will be placed on the sheet (as a list [x, y])

# Convert the point to XYZ
placement_point = XYZ(point[0], point[1], 0)

# Start a transaction
TransactionManager.Instance.EnsureInTransaction(doc)

for s in sheet:
# Create the viewport
	viewport = Viewport.Create(doc, s.Id, view.Id, placement_point)

# End the transaction
TransactionManager.Instance.TransactionTaskDone()

OUT = viewport

下面提供影片Demo



留言


0920520711

新北市永和區成功路一段93巷20弄17號3樓

  • Facebook

Copyright © 2020 by 鉤逸科技有限公司

bottom of page