Thay đổi Code cho BIM4Struc dùng cho Revit 2024

 

 

 

#Sets the Layout Rule property of rebar set to MaximumSpacing.
#Authored by Dieter Vermeulen, Autodesk, 2016
#http://revitbeyondbim.wordpress.com
 
import clr
 
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *
 
clr.AddReference("System")
from System.Collections.Generic import List
 
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)
 
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
 
doc = DocumentManager.Instance.CurrentDBDocument
 
#Preparing input from dynamo to revit
rebarElement = UnwrapElement(IN[0])
spacing = IN[1]
arrayLength = IN[2]
barsOnNormalSide = IN[3]
inclFirstBar=IN[4]
inclLastBar=IN[5]
 
#convert from mm to feet:
if IN[6]:
spacing = spacing/304.8
arrayLength = arrayLength/304.8
 
#Change rebar in transaction
TransactionManager.Instance.EnsureInTransaction(doc)
rebarElement.GetShapeDrivenAccessor().SetLayoutAsMaximumSpacing(spacing,arrayLength,barsOnNormalSide,inclFirstBar,inclLastBar)
TransactionManager.Instance.TransactionTaskDone()
 
OUT = rebarElement
 
Beniken co., Ltd
BENIKEN  有限会社
Blog