Hello. I know, that Revit Api allows me to create custom parameters in .rfa files and set their values. For example:
foreach (var type in neededFamTypes) { familyManager.CurrentType = type; familyManager.Set(myStringParameter, "myValue"); }
Of course if I call type.HasValue(myStringParameter) it will return true. But how can I delete paramter from type (not from whole family)? Something like familyManager.Unset(myStringParameter) , and type.HasValue(myStringParameter) should return false then?
Hi,
As far as I know there's no way to reset the value to .HasValue=false (other than deleting and re-creating the parameter).
You must have the same parameters for each 'type', it's only their values that can vary.
With respect to clearing/resetting parameter values, Revit behaves a bit oddly with these types of things. (Such as using filteredElementCollector with parameterValueProvider when filtering for a null/0.0 double value. You have to filter for .HasValue=false and also .Hasvalue=true and value=0.0.)
Somebody who knows more about nullable types can probably tell you more, but the workaround I would use would be setting the default value.
For integer this would be 0, for ElementId it would be Elementid.InvalidElementId, for double it would be 0.0, for text it would be an empty string.
The .HasValue property would NOT be reset.
If you explain exactly what you're trying to achieve I may be able to help further.
-Matt