Change Family Parameter Value

Here is another issue dealing with family parameters, after the notes on how to read the values of family parameters and looking at the family parameter values via the part atom export.

Question: I'm using the AutoParameter SDK example to add parameters to my families. It was customized so that only specific parameters from the shared parameters file are added to the families (i.e. we have a large shared parameters file, and we only want certain ones added to these families) using a switch statement along with the parameter names to find. When we add a parameter with a checkbox, it's automatically checked. We need to go back after it was added and uncheck it. I went through a number of SDK examples but haven't found one that helps. Can you send me a snippet that shows how to do this? I am using C#.

Answer: Do the parameters you have added in the family appear checked in the user interface of the project after being loaded into the document environment? In that case, I assume that the parameters you have added have a Boolean data type and an initial value of True. If so, the check mark should be removed if you set their initial value to False. For instance, in the RFA family labs, the addParameter method adds two real-values parameters:

void addParameters()
{
  FamilyManager mgr = _rvtDoc.FamilyManager;
 
  // API parameter group for Dimension is PG_GEOMETRY:
  //
  FamilyParameter paramTw = mgr.AddParameter( 
    "Tw", BuiltInParameterGroup.PG_GEOMETRY, 
    ParameterType.Length, false );
 
  FamilyParameter paramTd = mgr.AddParameter( 
    "Td", BuiltInParameterGroup.PG_GEOMETRY, 
    ParameterType.Length, false );
 
  // set initial values:
  //
  double tw = mmToFeet( 150.0 );
  double td = mmToFeet( 150.0 );
  mgr.Set( paramTw, tw );
  mgr.Set( paramTd, td );
}

In your case, you might be able to use something like:

  FamilyParameter paramDan = mgr.AddParameter(
    "Dan", BuiltInParameterGroup.PG_TEXT, 
    ParameterType.YesNo, true );
 
  mgr.Set( paramDan, 0 );

Response: Thanks! that's exactly what I needed.