In Revit, when changing a BuiltInParameter
which is on a Design Option, it gets an error that it is read-only.
The line of code is:
floor.get_Parameter(BuiltInParameter.FLOOR_HEIGHTABOVELEVEL_PARAM).Set(currentStoopHeigth - joist9Height)
there is a isReadOnly
, but I do not know how to add it.
I do not know how to add isReadOnly
to the line of code. I need to grab this parameter whether on Design Option or not, and change it.
If you are able to edit a parameter in Revit, then you should be able to edit it from the API. The Parameter.IsReadOnly
is intended to let you know whether or not a parameter is editable for a given element. This should help prevent errors where you try to set the value of a parameter that cannot be edited.
Note that you cannot control Parameter.IsReadOnly
property from the API since it is only a get
property.
Here is a way to check if a parameter is read only:
var floorHeightAboveLevelParam = floor.get_Parameter(BuiltInParameter.FLOOR_HEIGHTABOVELEVEL_PARAM);
if (floorHeightAboveLevelParam != null && !floorHeightAboveLevelParam.IsReadOnly)
{
floorHeightAboveLevelParam.Set(currentStoopHeigth - joist9Height);
}