Answers for "transaction in dynamo"

0

transaction in dynamo

import clr
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *


clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)
from Revit.Elements import *

doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

p1 = IN[0].ToXyz()
p2 = IN[1].ToXyz()
level = UnwrapElement(IN[2])
fam = UnwrapElement(IN[3])


tGroup = TransactionGroup(doc, 'Place Families')
tGroup.Start()
trans1 = Transaction(doc, 'Place Family1')
trans1.Start()
instance1 = doc.Create.NewFamilyInstance(p1, fam, level, Structure.StructuralType.NonStructural)
trans1.Commit()
trans2 = Transaction(doc, 'Place Family2')
trans2.Start()
instance2 = doc.Create.NewFamilyInstance(p2, fam, level, Structure.StructuralType.NonStructural)
trans2.Commit()
tGroup.Commit()

OUT = instance1,instance2
Posted by: Guest on July-02-2021

Browse Popular Code Answers by Language