I’m trying to extract the adaptive points from instances in a linked file.
This works perfect in the host file, just not in the linked file.
Any workaround suggestions?
I’ve been trying to solve this for hours with Copilot but me brain is literally fried now…
yeah no problem, but you could use ootb as well, but think it depemds on version, or spring, bimorph etc…i just play around for practice python you will need ironpython 3 package here, for now
@sovitek The script you shared doesn’t include the python…
Could you share from what package and what version the LinkInstance.AllElementsOfCategory node is? Or please share the python?
guess is it because, you dont have ironpython 3 installed, then you cant see it…maybe…i have that issue with pythonnet 3 as well for not so long time ago…see if it work, but you could try bimorph or spring as work in 2.7, and seems you are in a version where we dont have linkinstance OOTB
@sovitek I don’t kow what OOTB nodes you are talking about, I feel like I tried all of them already and I couldn’t get there.
When I check for the Python version it says CPython3…
yes …ironpython 3 is a package from package manager as ironpython 2.7…give it a try, the reason you dont have ootb linkinstance is you probably is in lower 25 version, cant really remember when it comes right now…hahah
this one her works for iron 2.7 and 3
import clr
clr.AddReference("RevitAPI")
clr.AddReference("RevitServices")
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
from Autodesk.Revit.DB import FilteredElementCollector
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
def tolist(x):
if x is None: return []
if hasattr(x, "__iter__") and not isinstance(x, str):
return list(x)
return [x]
def safe_to_ds(e):
try: return Revit.Elements.ElementWrapper.ToDSType(e, True)
except: return None
links = tolist(IN[0]) if IN.Count > 0 else []
cats = tolist(IN[1]) if IN.Count > 1 else []
catnames = [c.Name for c in cats]
out_elems = []
for l in links:
revit_link = getattr(l, "InternalElement", None)
if revit_link is None: continue
try:
linkDoc = revit_link.GetLinkDocument()
if linkDoc is None: continue
except:
continue
col = FilteredElementCollector(linkDoc).WhereElementIsNotElementType()
for e in col:
cat = getattr(e, "Category", None)
if catnames and (cat is None or cat.Name not in catnames):
continue
d = safe_to_ds(e)
if d: out_elems.append(d)
OUT = out_elems
Aah yes, when I switch to 2.7 it works!
Our project is currently still in 2024, but we are upgrading to 2026 during the Christmas holidays…
The only thing I’m still wondering is if they can be grouped by instance with the python?
1 (family) instance has 2 adaptive points so I want those 2 to be grouped in sublists…
then it will be your time for go away from 2.7, actuelly i dont understand what you mean with manuel selection, is it the link you mean ? you will could find it with ootb…yeah guess we can pair you points up…but im not in dyn in the moment and probably first in the weekend…if you then dont have find a way…i will give it a try
Hello! Does anyone have a solution that works with link elements? not just getting all the points? or a way to group them with the family of the points?