But, the node doesn’t seems to “recognize” some family instances (see image in list, number 30, 31, 32…) and doesn’t place them in Revit. I don’t really know what the warning means, but I found some kind of fix: I place the concerned families (nb 30, 31, 32…) manually, delete them right afterwards and re-run dynamo and…tadaaa, the script works again and place the family! (I actually don’t even have to place it, just grab it from the project browser to the drawing and then press Esc)
Is it something wrong with my script or an issue with the node?
Ps: I had the same issue with some wall based sink…
Ok! I get it! That’s annoying, I guess it’s some code to add before or in the node right? I can’t code unfortunately…
@zhukoven unfortunately I am supposed to place hundreds of instances in Revit with that script, I can’t just place them manually or else the scprit loses it’s purpose…right?
Yep, this logic should work for you.
Try placing this code between the “Watch node” (where you look at the list of family types) and the “FamilyInstance.ByPointHostTypeAndLevel” node:
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
famtype = UnwrapElement(IN[0])
TransactionManager.Instance.EnsureInTransaction(doc)
# Make sure the familysymbol is active
if famtype.IsActive == False:
famtype.Activate()
doc.Regenerate()
TransactionManager.Instance.TransactionTaskDone()
OUT = famtype
The python script takes an input of Family Types, activates them, and outputs to use in the next node. @DavidDK, please check if this code works with your families. I’ve made some basic tests in the sample model, and it should work.
That seems to work well, thank you!
But it does not work when placed where you asked me to place it, maybe because of this script I have before the watch node?
import clr
import System
#Import the Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
#Import DocumentManager and TransactionManager
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
#Reference the active Document and application
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
#Start scripting here:
OUT = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Doors).WhereElementIsElementType().ToElements()
@DavidDK, that’s because I missed the for loop to iterate through the list of items . Try this one:
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
famtype = UnwrapElement(IN[0])
TransactionManager.Instance.EnsureInTransaction(doc)
# Make sure the familysymbol is active
for i in famtype:
if i.IsActive == False:
i.Activate()
doc.Regenerate()
TransactionManager.Instance.TransactionTaskDone()
OUT = famtype
Yep! That’s perfect, it works on all elements I think
(it doesn’t work anymore after a simple Family Type node though, but I do not use it so it’s fine by me!)