Hi all, I am trying to set the structural parameter check/uncheck of a structural wall element.
Please let me know how to check and uncheck parameter of an element ? somehow I manage to get the parameter details but getting difficulty in setting the parameter like checkbox.
A couple of things in your initial code:
In your Revit image, you are previewing a wall, but your code says floors. Small detail I guess, since both have the Structural parameter, but just to be consistent
In your collector, you are using the method WhereElementIsElementType() which will only give you types. It needs to be WhereElementIsNotElementType(), if you are collecting instances.
Whenever it’s possible to use BuiltInParameters, I’d recommend going with that, since it will provide you with a more stable code:
import clr
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
#Do some action in a Transaction
walls=FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Walls).WhereElementIsNotElementType().ToElements()
output = []
for i in walls:
struct= i.get_Parameter(BuiltInParameter.WALL_STRUCTURAL_SIGNIFICANT)
TransactionManager.Instance.EnsureInTransaction(doc)
setstru=struct.Set(1)
TransactionManager.Instance.TransactionTaskDone()
output.append(setstru)
OUT = output
One last detail: To set a Boolean to True, it’s 1 and not 0