Hi,
this question is not new, but the last thread didn’t get an answer:
I need to use this node in a script, because i want to place different adaptiv families in a specific order on a line. But the node works only with one family.
I tryed different things, but every time i get another error.
import clr
clr.AddReference("RevitAPI")
clr.AddReference("ProtoGeometry")
clr.AddReference("RevitNodes")
clr.AddReference("RevitServices")
clr.AddReference('RevitAPIUI')
clr.AddReference('DSCoreNodes')
import DSCore
from DSCore import *
import Autodesk
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
import RevitServices
from Autodesk.Revit.DB import *
from Autodesk.DesignScript.Geometry import *
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from System import Array
plist = IN[0]
typelist= IN[1]
result=[]
i=0
#ids = List[ElementId](e.Id for e in typelist)
for p in plist:
pp = Array.CreateInstance(Array[Point], 1)
result.append(Revit.Elements.AdaptiveComponent.ByPoints(pp,typelist[i]))
i+=1
OUT = result
plist = IN[0]
typelist= IN[1]
result=[]
i=0
ids = List[ElementId](e.Id for e in typelist)
for p in plist:
#pp = Array.CreateInstance(Array[Point], 1)
result.append(Revit.Elements.AdaptiveComponent.ByPoints(ids,typelist[i]))
i+=1
OUT = result
Hi Fiesta,
First of all - nice nickname. I like it.
There are 2 ways to create an adaptive component from a python node:
Using the API directly.
Using the Revit nodes from Dynamo.
Revit.Elements.AdaptiveComponent.ByPoints() is the Revit nodes method so the inputs should be exactly as the inputs to the node - a list of placement points for each family type.
So you don’t need arrays or or elementIds.
Using this node in Python also means that you have to do the lacing and the list management yourself as opposed to using levels and lacing in the node.
So briefly in the brackets you need a list of placement points and a family type:
Revit.Elements.AdaptiveComponent.ByPoints(pointlist, family type)
import clr
clr.AddReference("RevitAPI")
clr.AddReference("ProtoGeometry")
clr.AddReference("RevitNodes")
clr.AddReference("RevitServices")
clr.AddReference('RevitAPIUI')
clr.AddReference('DSCoreNodes')
import DSCore
from DSCore import *
import Autodesk
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
import RevitServices
from Autodesk.Revit.DB import *
from Autodesk.DesignScript.Geometry import *
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from System import Array
plist = IN[0]
typelist= IN[1]
result=[]
for p,t in zip(plist,typelist):
result.append(Revit.Elements.AdaptiveComponent.ByPoints(p,t))
OUT = result
it’s not advisable to use these methods from code (unless you want element binding behavior) - they have element binding I think and might not behave how a normal function call would.
Thx for the information.
There is an abnormal behavior that I noticed so far.
The families i placed are not bound to the dynamo node. So every time i run my script the families gets placed again and again.