public static Parameter GetFamilyParameter(
FamilyInstance nestedFamilyInstance,
string parameterName)
{
// Following good SOA practices, verify the
// incoming parameters before attempting to proceed.
if( nestedFamilyInstance == null )
{
throw new ArgumentNullException(
"nestedFamilyInstance" );
}
if( string.IsNullOrEmpty( parameterName ) )
{
throw new ArgumentNullException(
"parameterName" );
}
Parameter oResult = null;
// See if the parameter is an Instance parameter
//oResult = nestedFamilyInstance.get_Parameter( parameterName ); // 2014
Debug.Assert( 2 > nestedFamilyInstance.GetParameters( parameterName ).Count,
"ascertain that there are not more than one parameter of the given name" );
oResult = nestedFamilyInstance.LookupParameter( parameterName ); // 2015
// No? See if it's a Type parameter
if( oResult == null )
{
//oResult = nestedFamilyInstance.Symbol.get_Parameter( parameterName ); // 2014
Debug.Assert( 2 > nestedFamilyInstance.Symbol.GetParameters( parameterName ).Count,
"ascertain that there are not more than one parameter of the given name" );
oResult = nestedFamilyInstance.Symbol.LookupParameter( parameterName ); // 2015
}
return oResult;
}