Global parameter set value not working

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
from Autodesk.DesignScript.Geometry import *

#import Revit API
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB

import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

global_paraName = IN[0]
newParamValue = IntegerParameterValue(IN[1])

glob_paraId = DB.GlobalParametersManager.FindByName(doc, global_paraName )
if glob_paraId != ElementId.InvalidElementId:
	glob_para = doc.GetElement(glob_paraId)
	OUT = glob_para
1 Like

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 :confused: 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.

1 Like

I create an issue in GitHub

FYI @solamour