Collect Elements from the browser, how, is this a transaction?

Hello,

How can call Elements from the project browser (later i want place them!)
2021-01-26_22h39_22
I can call them when they are placed, but can i call them “idealised” for later placing! f.e. they got placed when a family has a particularly value.

Symbl = FilteredElementCollector(doc).
OfCategory(BuiltInCategory.
OST_DetailComponents).
WhereElementIsNotElementType().ToElements()

Can i do something like familyInstance.Type("Blau","Gelb","Rot")?
Need i a transaction in my script?

… need some insperation!

KR

Andreas

I don’t quite understand what you are asking? Do you want to get all the FamilyInstances of the Types [Blue, Red, Yellow]? or do you want to get the Families, so not the Instances?

yes, i have symbols they have to be placed on doors.

the doors are in the view, but my symbols remain in the project-browser!

How can i “take” them via dynamo python

a option would place the instances type by type so i can collect them, but i would prefer the workflow to get the type and later i place them on the doors, the placement depents on different values ("Gelb", "Rot"...)

You should use:
WhereElementIsElementType()
instead of
WhereElementIsNotElementType()
Because you are search for FamilySymbols (better known as Family Types)

Another problem is that you will find System Families, I filter these away using a Try Except because they will throw an error if you query their “Family” property.

I dont understand why you want to do this in Python, because it is done with a few nodes in Dynamo, but this would do the trick.

Let me know if this works for you

1 Like

Thank you! thats the current status:

Types = ["Blau","Gelb","Rot"]

doc = DocumentManager.Instance.CurrentDBDocument
TransactionManager.Instance.EnsureInTransaction(doc)

myDoors = FilteredElementCollector(doc).
OfCategory(BuiltInCategory.OST_Doors).WhereElementIsNotElementType().ToElements()
Symbl = FilteredElementCollector(doc).
OfCategory(BuiltInCategory.OST_DetailComponents).WhereElementIsElementType().ToElements()

elements = UnwrapElement(myDoors)
points =[]

 for e in elements:
   bb = e.get_BoundingBox(None)
      if not bb is None:
	     centre = bb.Min+(bb.Max-bb.Min)/2
	     points.append(centre.ToPoint())

for s in Symbl:
try:
	if Types.Contains(s.Family.Name):
		output.append(s)
except:
	pass
		
TransactionManager.Instance.TransactionTaskDone()

OUT = points