Hi @eirannejad, I’ve noticed an issue with the way the Value attribute of an input parameter is exposed to the new Script Editor in Python
Consider this code:
t_input = [i for i in ghenv.Component.Params.Input if i.Name == "T"][0]
t_input_toggle = t_input.Sources[0]
print(t_input_toggle)
print(hasattr(t_input_toggle, "Value"))
Output with the old GHPython editor:
<Grasshopper.Kernel.Special.GH_BooleanToggle object at 0x000000000000002B [Grasshopper.Kernel.Special.GH_BooleanToggle]>
True
Output with the new Python editor:
Grasshopper.Kernel.Special.GH_BooleanToggle
False
This works as expected with the new C# editor:
private void RunScript(bool T)
{
var tInputParam = Component.Params.Input.Find(p => p.Name == "T");
var tInputSource = tInputParam.Sources[0];
var hasValueProperty = tInputSource.GetType().GetProperty("Value") != null;
Print(tInputSource.GetType().ToString());
Print(hasValueProperty.ToString());
}
Somehow the t_input_toggle.Value = False line has no effect!!! and it throw GH into solving the solution forever since boolean toggle never becomes False
Update:
Found the problem and putting a fix for Rhino 8.9 RC
RH-82012 Interface wrapped object can not set value