Parameter Set returns true but does not change the value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have code that has been working correctly for years that apparently stopped working correctly in Revit 2023
It is a basic method to set a parameter to a string value, but the same problem also occurs with the similar method for setting double values
public static void SetStringParameter(Parameter par, string waarde) { if (par != null && !par.IsReadOnly) par.Set(waarde ?? string.Empty); }
This function gets called with a valid Parameter and string value, and the parameter is not read-only. The par.Set() method is called, and when I check it in the immediate window it returns true. However, the parameter still has the original string value.
The parameter definition is
The parameter is not read-only, it has storage type string and is a normal Family Instance parameter (the family was upgraded from Revit 2022). The UserModifiable being false is odd as I can set the parameter value from the GUI (which if I understand correctly, this setting should prevent), but that is not the issue I hope.
I am trying to figure out why Revit either ignores the Set method, or quietly rolls back changes before exiting that method. And more importantly what I can change to make it work again as it should.
I am a bit at a loss here because this method has always worked correctly since at least 2015 and no code changes were made anywhere near this method, or the ones that call it. In case this unexpected behaviour has something with the family I attached the RFA file. I am trying to change the 'familynaam' parameter value among several others.
Thanks in advance for any help or suggestion
Mark de Vries
ICN Development