i trying to undestand if it’s possible to generate by dynamo different family type from a list of a different istance of the same family.
I’m going to try to speak better…
i have a beam family with height and width as istance parameter (very fast and useful for modeling), i want to use this family but i would to define a type for each beam istance (obviously i would that the name of type is connected to the height and widht parameter…)
Do someone put me in the right way …? obviously if possible
Thanks
this is certainly possible, The Archi-lab package has a node called “ElementTypes.Duplicate” that requires a current instance type and the new name. If you do not want to use external packages you could make your won python script like:
import clr
clr.AddReference(‘ProtoGeometry’)
clr.AddReference(‘ProtoGeometry’)
clr.AddReference(“RevitNodes”)
clr.AddReference(“RevitServices”)
clr.AddReference(“RevitAPI”)
import Revit
import System
import RevitServices
import Autodesk
from Revit.Elements import *
from Autodesk.DesignScript.Geometry import *
from Autodesk.Revit.DB import *
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application #The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN
Elements = UnwrapElement(IN[0])
Names = IN[1]
output = transaction
TransactionManager.Instance.EnsureInTransaction(doc)
for idx, i in enumerate(Elements):
try:
name= Names[idx]
newFamilyType = i.Duplicate(name)
output.append(newFamilyType)
except: #check if it already exists
col = list(FilteredElementCollector(doc).WhereElementIsElementType().ToElements())
namelist = [x.GetParameters(“Type Name”)[0].AsString() for x in col]
if name in namelist:
output.append("Familytype already exists: "+name)
else:
output.append("Failed to created: "+name)
TransactionManager.Instance.TransactionTaskDone() #Assign your output to the OUT variable.
OUT = output