How does Parameter.UserModifiable work?

How does Parameter.UserModifiable work?

David_Robison
Advocate Advocate
3,998 Views
3 Replies
Message 1 of 4

How does Parameter.UserModifiable work?

David_Robison
Advocate
Advocate

I cannot figure out how the Parameter.UserModifiable property should work.

 

Attached is a sample project. Based on the API docs, I would expect it to be True if the parameter is modifiable in the Revit Properties, and False if it is disabled and not modifiable.

 

For Family Parameters, it appears to be backward. It is True if not modifiable and False if modifiable.

 

For Shared Parameters, it appears to always be True.

 

Are these results how it should be working? A sample project and family are attached.

 

Here is a family parameter that can be changed in the Properties UI.

 

familyparam1.png

 

Here is a family parameter that cannot be changed in the Properties UI.

 

familyparam2.png

 

Here is a shared parameter that can be changed in the Properties UI.

 

sharedparam1.png

 

Here is a shared parameter that cannot be changed in the Properties UI.

 

sharedparam2.png

0 Likes
Accepted solutions (1)
3,999 Views
3 Replies
Replies (3)
Message 2 of 4

Sean_Page
Collaborator
Collaborator

Take a look at your photos and then compare the UserModifiable with the IsReadOnly properties and I think you will see the correlation.

 

From API Docs also give you some insight:

  • Note that for shared parameters IsReadOnly can return false for shared parameters whose UserModifiable property is also false, because the value of those parameters can be modified by the API. If a parameter is governed by a formula, IsReadOnly would return true, even if the flag for UserModifiable was set to true when the shared parameter was created.
Sean Page, AIA, NCARB, LEED AP
Partner, Computational Designer, Architect
0 Likes
Message 3 of 4

David_Robison
Advocate
Advocate

I'm still confused.

 

Look at FamilyParam2, the second image.

 

It is disabled in the Properties UI. In the Family, it is set as a formula. The user cannot change the value.

 

The UserModifiable property is set to True. I would expect this value to be False.

 

Look at SharedParam1 and SharedParam2. The first can be changed in properties, the second cannot. The second one is defined with a formula.

 

In both cases, the UserModifiable property is set to True. I would expect the value for SharedParam1 to be True and the value for SharedParam2 to be False.

0 Likes
Message 4 of 4

RPTHOMAS108
Mentor
Mentor
Accepted solution

UserModifiable is a behaviour assigned to a shared parameter in shared parameter file. When assigned with false It means the user will not be able to change it's value from the UI i.e. the value of such parameters can only be changed from API. The purpose is primarily to allow API developer to not have automated values they assign to certain parameters manually edited in the UI. Could have been better called UIModifiable perhaps.

 

It does not indicate any other state. When set to true elsewhere (on BIPs, ReadOnly params) it just means it's not been assigned at all because it is irrelevant to non-shared parameters i.e. true is the default.

 

IsReadonly is the only guidance on if a parameter can be set from the API e.g. when it is locked by formula, is BIP that can't be set or is on a nested non-shared element etc.

 

UserModifiable = an attribute the creator of a shared parameter has marked the parameter with.

IsReadOnly = something that Revit is indicating about the API writable state of the parameter.