Hello Forum,
I am trying to open a family file in the background with Dynamo from the project file. After opening this family file, I need to execute a script within that family file and lastly import that family file into the project file.
Any piece of advice on how to do that?
Thank you so much.
1 Like
Hi @Draxl_Andreas ,
I tried to do what you provided me in the previous link and I could modify parameters within a .RFA file from a .RVT file successfully.
Now I am trying to place some adaptive profile families from a list of points, giving the first try with just a couple of points to test it out. The issue I am struggling with is that instead of placing these adaptive-profile families in the .RFA file, the Python script is placing the families in the .RVT file.
I post the code too:
# Load the Python Standard and DesignScript Libraries
import sys
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference("RevitAPI")
clr.AddReference("RevitAPIUI")
import Autodesk
from Autodesk.Revit.DB import *
from Autodesk.Revit.UI import *
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
import System
# The inputs to this node will be stored as a list in the IN variables.
points = IN[0]
famType = IN[1]
doc = IN[2]
uidoc = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
# Place your code below this line
if doc.IsFamilyDocument:
# "Start" the transaction
TransactionManager.Instance.EnsureInTransaction(doc)
beams = []
arr = System.Array[Point](points[0])
arr2 = System.Array[System.Array[Point]]([arr])
beams.append(Revit.Elements.AdaptiveComponent.ByPoints(arr2,famType))
doc.Close(True)
# "End" the transaction
TransactionManager.Instance.TransactionTaskDone()
OUT = beams
else:
OUT = ["Document is not a family."]
# Assign your output to the OUT variable.
Any ideas?
Thanks!
1 Like