Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Clear family type parameter value

1 REPLY 1
Reply
Message 1 of 2
abr98904
846 Views, 1 Reply

Clear family type parameter value

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?

1 REPLY 1
Message 2 of 2
matthew_taylor
in reply to: abr98904

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

 


Cheers,

-Matt
_______________________________________________________________________________
Marking a post as a 'solution' helps the community. Giving a post 'Kudos' is as good as saying thanks. Why not do both?

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community