Hi All,
I am currently trying to put continuous footing under all my walls in project. I found this topic (Wall foundations according to lines) which contains the python code. However, It gives me an error stating below
Here is a snip of my script
Thanks in advance for the help!
Mitesh
You’re getting a looping error. Python is trying to get the Id of your list object instead of the individual wall objects I’m guessing.
Edit: Yup. I looked at the code in the linked post and it’s set up for a single wall element. You’ll have to put in a loop to get each wall individually.
Hi Nick,
Thanks for getting into this. Yes, I tried to feed single wall elements instead of multiple and worked perfect.
I do not know how to put a loop in current code. Can you please help me or advise me how to do it?
Thanks,
Mitesh
Hi @Mitesh_Gajjar,
Try this:
Python:
import clr
#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
wft = UnwrapElement(IN[0])
walls = UnwrapElement(IN[1])
result = []
TransactionManager.Instance.EnsureInTransaction(doc)
for i in walls:
result.append(WallFoundation.Create(doc, wft.Id, i.Id))
TransactionManager.Instance.TransactionTaskDone()
OUT = result
Thanks @MartinSpence!!!
You’re awsome!!
This works exactly how I want it.
Regards,
Mitesh
1 Like
Thanks. I tried to use this script and since I had only 1 wall foundation type I did use the x[0], and I get an error, shown below.
If I connect the X[0], works perfectly.
How could I modify the Python script to allow this?
Thanks
Hi @simoneavellini,
You are feeding the python node a list with a single WallFoundationType. Use the original script, and it will work.
Feeding in a list of WallFoundationTypes is possible, but would make the python unnessecarily complicated.
I understand, as zero-skilled in coding was hoping was not a big deal. Thank you anyway.