I keep getting error today when trying to create walls from a set of lines/curves.
# Load the necessary libraries
import clr
clr.AddReference("RevitAPI")
clr.AddReference("RevitServices")
from Autodesk.Revit.DB import *
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
from System.Collections.Generic import List
# Dynamo inputs
curves = IN[0]
doc = DocumentManager.Instance.CurrentDBDocument
# Output list of walls created
created_walls = []
# Start a transaction in Dynamo
TransactionManager.Instance.EnsureInTransaction(doc)
# Loop through each polycurve, convert to a curve array and create a wall
for curvelist in curves:
list = List[Curve]()
for curve in curvelist:
list.Add(curve)
# Create a CurveArray for the polycurv
try:
wall = Wall.Create(doc, list, True)
created_walls.append(wall)
except Exception as e:
# Handle exceptions if wall creation fails
created_walls.append(f"Error creating wall: {e}")
created_walls.append(curvelist)
# End the transaction
TransactionManager.Instance.TransactionTaskDone()
OUT = created_walls
The wierd thing is that yesterday the code seemed to work.
they error right now stades that i’m not using the right arguments, but i pretty sure i am based on the revit api to created a default wall:
jup :):
The first python node extraces the lines from the intersections between masses.
The second (top) python script is the one above.
The third (rightside) script is one simular to the above but with type and level arguments included.