Wall foundations according to lines

revit
clockwork
dynamo

#1

Hello everyone !

I’m trying to create wall foundations with dynamo, in the same script which create walls.
The problem is that I can’t choose any kind of wall foundations in dynamo with “Family Types”…

My script :

Any idea ?
Thanks !


#2

A wall foundation is a System Family which is completely dependent of it’s wall. If you can’t find any nodes for it, you’ll have to use a python script with the WallFoundation.Create method. Here is a completely untested mockup to get you started:

import clr

# Import List ( ICollection(ElementId) = List[ElementId]() )
clr.AddReference('System')
from System.Collections.Generic import List

# Import Revit API
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *

clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *

# Import ToDSType(bool) extension method
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

# Import DocumentManager and TransactionManager
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
uidoc = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

# Input
wall = UnwrapElement(IN[0])
wallFoundationType = UnwrapElement(IN[1])

 #Make changes to Revit DB in a Transaction
TransactionManager.Instance.EnsureInTransaction(doc)
WallFoundation.Create(doc, wallFoundationType.Id, wall.Id)
TransactionManager.Instance.TransactionTaskDone()

OUT = 0

#3

Thanks for your answer !
I’m a beginner with the API and I don’t understand how to load the foundation’s family as you said. I’m have wall foundations already loaded in my project.
Do you have any example ?

Thanks,