I am trying to set a yes/no global parameter to yes, but the globalparameter.setvalue is not reporting any erros and is not changing the parameter. Anyone know how to fix this?
try with Python
import sys import clr clr.AddReference('ProtoGeometry') from Autodesk.DesignScript.Geometry import * #import Revit API clr.AddReference('RevitAPI') import Autodesk from Autodesk.Revit.DB import * import Autodesk.Revit.DB as DB clr.AddReference('RevitServices') import RevitServices from RevitServices.Persistence import DocumentManager from RevitServices.Transactions import TransactionManager doc = DocumentManager.Instance.CurrentDBDocument global_paraName = IN newParamValue = IntegerParameterValue(IN) glob_paraId = DB.GlobalParametersManager.FindByName(doc, global_paraName ) if glob_paraId != ElementId.InvalidElementId: # glob_para = doc.GetElement(glob_paraId) TransactionManager.Instance.EnsureInTransaction(doc) glob_para.SetValue(newParamValue) TransactionManager.Instance.TransactionTaskDone() OUT = glob_para
That worked perfectly! Thank you! any insight into why the other script may not have worked? just curious!
I’ve seen that integers don’t work with out-of-the-box nodes.
This may also apply to boolean values? For boolean, maybe you need to feed it “true” and “false” boolean values?
Unfortunately, True and False did not work either The python script definitely did the trick though!
I tried all those variations too. No luck. I saw the SetFormula method in the API but not Dynamo and changed @c.poupin 's code to change the formula.
“1<0” & “1>0” were entered into the formula.
not sure I’m following, the value is what I wanted to change so the script is running perfect! Its goal is to toggle a print ready parameter to turn off guidelines and things we don’t want to print across the project. reason i need it was to be able to combine it with another dynamo script that gets everything ready to print.
Sorry, I just was trying all those other things that fire off checkboxes too. I looked for a hint as to why it wasn’t working and saw the SetFormula next SetValue method. I use a formula when building families to set checkboxes for all family types and tried it for the global parameter checkbox. It worked to change the value by evaluating true and false for the equation. I thought that was cool and could even be useful if someone actually wanted to use a formula in their global parameters. But the fact that SetValue works in the python is a better way to do it.
I create an issue in GitHub