Filtering Link Model Wall Types

Hello everyone,

I try to filter wall types from link model and then filter those wall types to specific types and then select all instances of those types. I tried with it but with no success. is there anybody can help?

Thank you guys,

Special Walls.dyn (45.6 KB)

Hi @Simo,

With All Elements From Linked Model, you already have your list of walls elements.
You can filter that list with the Type name to get the specific instances you want.

Thanks for responding,
The problem is, I couldn’t get all instances of the filtered wall types.

I already give you a simple answer.

You can also use a Python script if you want something more elaborate.
Use an altered version of Springs.ElementType.Instances.

#From Dimitar Venkov`
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = IN[1]

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)

from System.Collections.Generic import List

def tolist(x):
	if hasattr(x,'__iter__'): return x
	else : return [x]

types = UnwrapElement(tolist(IN[0]) )
catNames = set()
for t in types:
	c1 = t.Category
	if c1 is not None:
		catNames.add(c1.Name)

catId = List[ElementId]()
allCats = doc.Settings.Categories
for cn in catNames:
	if allCats.Contains(cn):
		catId.Add(allCats[cn].Id)

type_storage = dict()
fec = FilteredElementCollector(doc).WhereElementIsNotElementType()
if catId:
	fec = fec.WherePasses(ElementMulticategoryFilter(catId) )

for e in fec:
	id1 = e.GetTypeId().IntegerValue
	if id1 in type_storage:
		type_storage[id1].append(e.ToDSType(True) )
	else:
		type_storage[id1] = [e.ToDSType(True)]

OUT = [type_storage.get(t.Id.IntegerValue, None) for t in types]

I did try that, but that applies to all types not after they are filtered down.

you can test it

Thanks,

Special Walls.dyn (47.8 KB)

The first response by @Alban_de_Chasteigner will work for you, but you may need to make some modifications to work with a list of types.

  1. Create a list of the type names you’re after instead of the single string “Walls_23”.
  2. Change the lacing on the == node to cross product,
  3. Add a List.Contains node searching for true (again with longest lacing).

For many walls types, it’s almost the same thing.

Thank you guys so much for your valuable contribution. It eventually works.

He Guys, I’d like to reply on this post with a challange that is to difficult for me.

I have a Project with a lot of linked files, in which I would like to select Wall etc. based on a parameter value. For Instance:

Select all Walls in Dynamo which contains a certain value in de Parameter ‘Comments’.

I’ve tried to crack this one but nothings seems to work. You can use the method of selecting all the walls from the linked files and then filter it down, but that takes 1 hour each time I run the script (Lots of Walls & Linked files up to 3Gb).

Hope someone can help…

Hi Daan, sounds like you need a variation of this node to work for linked docs:
image
Sadly things work a little different when dealing with linked docs, so it kind of depends on what kind of parameter you want to search (shared parameter or Revit internal). Let me know and I’ll give it a try.

He Taco,

Usually it is an Instant Shared parameter, but somethimes it is also Comments, of a Type parameter instead of Instance. Dealing with a lot of variables here…

You think you can make that work? and would it be faster than the collect elements and filter method? I sure think so myself. You’re a champ if you can get this one to work!

just wonder what the end use of these filtered elements of linked model? you cannot select it in host model via element ID, you cannot VG override in view via element or filter.
i managed to get specific elements of linked model using Dynamo and Python but i cannot do anything w/ those elements (ID) in host model, so again what’s next?

Maybe reading element parameters for pushing to another value in your current model?

1 Like