Hi,
After creating viewsheet i would to set parameter of drawn by and checked by with python script but i can’t find a good code.
After creating viewsheet i would to set parameter of drawn by and checked by with python script but i can’t find a good code.
Are you sure that’s the right method? String parameters just use Set(string)
. I believe that method is specifically for parameter values represented by string indicators.
Hi, as Nick mentioned, you should use the Set method.
Here’s a basic “Set parameters” script as example :
import clr
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *
clr.AddReference('System')
from System.Collections.Generic import List
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
#Preparing input from dynamo to revit
element = UnwrapElement(IN[0])
param = IN[1]
values = IN[2]
done=[]
notDone=[]
#Do some action in a Transaction
for e,vList in zip(element,values):
flag = False
for p,v in zip(param,vList):
TransactionManager.Instance.EnsureInTransaction(doc)
elem_param = e.LookupParameter(p)
if v == None or v == "":
flag = True
else:
if not elem_param.IsReadOnly:
elem_param.Set(v)
else:
flag = True
TransactionManager.Instance.TransactionTaskDone()
if flag:
notDone.append(e)
else:
done.append(e)
OUT = done,notDone
Thanks
It works, I just discovered drawn by and checked by for viewsheet don’t need the buitInParameter to set value and the LookupParameter method is enought.
Regards