Clear parameter value

Hello to everyone

Is there any way to reset an object’s parameter value?
because when i am trying to assign value to Comment parameter it just doesn’t work :c
image

Try putting text into a panel

Hello!

Thank you for the reply! The problem is that Comment parameter is being held as the String; so it assigns the same well

i have also tried to assign an Integer to the parameter, but it only returned an error

Are you trying to use the Integer as a calculation elsewhere in Revit? Just use the String value of 54, if you bring it back into GH it will cast to Integer once again.

If you need an Integer you have to make a new parameter in Revit, probably Shared.

Comments is hard coded string value

https://www.revitapidocs.com/2020/d64db023-f9a1-9177-1fb2-054625d19673.htm

But the thing i want to achive is to reset the parameter’s value. Like Mark value here. It is completely empty. So i want Comments to become empty again, as it is by default, when you creating a brand new wall.
image

just plug in a blank panel

oh, thanks! it works


but be careful:

Sory, but here is an another problem: the represented method doesn’t work for the integer parameters. I have found something in API:
https://www.revitapidocs.com/2020/14658620-d5d5-d8f2-1b6c-343180951d63.htm
But i am not able to create a code-script :innocent:
I think providing such kind of node would be useful for the project.

The documentation says:

This method will only succeed for Shared parameters that have their HideWhenNoValue property set to true.

What should we do with non shared parameters?

Hello, thank you for joining discussion!

i am not fluent in english, but i think this means, that it works for ALL NON-SHARED parameters AND for SHARED PARAMETERS, WHICH are not hiding when they have no value. It is logically consequent, because base project parameters are never hiding from Properties panel, simultaneously some shared parameters are.

I should just try test ClearValue() for several parameters, to check how it works, but i need to deal with programming languages first :sweat_smile: :sweat_smile: :sweat_smile: So, i hoped, someone has a ready solution yet.

Here is a related topic from our Dynamo homies:

Hi,

I tested it an unfortunately this is the result on non shared parameters.

image

We have included a new component called Reset Element Parameter that sets everything to False, 0, null, empty string, black color, depending on the parameter type.
If the parameter fulfills ClearValue() requirements we call ClearValue() on it.

As you may expect some parameters do not accept 0.0 as value like Unconnected Height in Walls, in that case the component just shows the error.

Will this help?

2 Likes