I am registering two input parameters to record the values of the sliders (custom attributes) in the component. everything works fine and I just need to hide those parameters so user can only interact with sliders. the method
does not do anything , any idea?
Do not register them in RegisterInputParams().
Then how can I save the current value in the GH file without having a parameter registered ?
Override Write() and Read() to serialize and deserialize your data. Any other automatic behaviour that the parameters do, you will have to replace them yourself if needed. As far as I know you can’t register a parameter and not have it appear in the capsule.
Thanks Dani, I am new to GH_IWriter Interface , can you point me to a sample code or an implementation example.
private double _sliderValue1;
public override bool Write(GH_IWriter writer)
public override bool Read(GH_IReader reader)
_sliderValue1 = reader.GetDouble(nameof(_sliderValue1));
Thanks a lot
It was simpler than what I expected ,
Just one more thing , the Read() method gets called before solution update or there is mechanism to call it manually?
It is called automatically and shouldn’t be used manually in most cases.
Though I’d recommend
GetValue rather than overriding
Write. The latter is more error-prone.
Read and Write are just for writing to the gh file.
I implemented the SetValue and GetValue methods. They only save the values in the component, after I saved the GH file and re-open it the GetValue did not work. so I think I go with Dani’s solution.