Hello everyone,
I’m unable to change the value of the parameter ‘Switch ID’ . I’m using 2 Families with a common parameter mentioned before (‘Switch ID’). The 1º Family is of a built in category type ‘Lighting Fixture’, the 2º Family is a custom created ‘Lighting Devices’.
I have already tried the following dynamo coding with the python script respectively. But no luck there.
Couple thing I’d ask.
What does the error message say?
Are they instance or Type parameters?
I’d recommend using double quotes " and not single quotes ’ for Parameter Name and Value. Those mean different things.
I think you need to specific and OUT for your python unless you just aren’t showing that.
I have specified an OUT but did not show it in the first code I sent.
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
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
x = IN[0][0]
z = UnwrapElement(x)
TransactionManager.Instance.EnsureInTransaction(doc)
zz = z.LookupParameter("Switch ID").Set("1")
TransactionManager.Instance.TransactionTaskDone()
#This basically tells me if the set operation was successful
OUT = zz
I want to complement the information I said initially, the ‘Lighting Fixtures’ Category belongs to an Electrical System, and it contains several Families. Each of these Families have a Switch System. And in this System I want to assign a value to the parameter ‘Switch ID’ via the python script.
I would suggest you check either of the following:
Check the elements going in are just the elements you want to change, filter the elements down if needed.
Is the parameter a Type or a instance, if it is a instance make sure you only input instances, and similar for type.
Check on what type of storage that parameter can hold, as parameters can be Doubles, String, Elements or a Int. Therefore if it wants a Double you have to input a double not a string.
I filter by the first element of the category, where I get a list of parameters in that element, and afterwards with 'LookupParameter command I’m able to select the desired parameter.
The parameter is instance
When I change manually via UI it can hold either String or Double