rvtmetaprop/MetaProp.cs
/// <summary>
/// Populate a Revit shared parameter value.
/// </summary>
Populate a Revit shared parameter value.
Populate a Revit shared parameter value .
public void SetValue( Parameter p )
    {
      StorageType st = p.StorageType;
      if( metaType.Equals( "DeleteOverride" ) )
      {
        switch( st )
        {
          case StorageType.Double: p.Set( 0.0 ); break;
          case StorageType.ElementId: p.Set( ElementId.InvalidElementId ); break;
          case StorageType.Integer: p.Set( 0 ); break;
          case StorageType.String: p.Set( string.Empty ); break;
          default: Debug.Assert( false, "cannot set this storage type:" + st.ToString() ); break;
        }
      }
      else if( metaType.Equals( "Text" )
        || metaType.Equals( "Link" )
        || metaType.Equals( "File" ) )
      {
        p.Set( DisplayString );
      }
      else if( metaType.Equals( "Int" ) )
      {
        int i;
        if( int.TryParse( displayValue, out i ) )
        {
          p.Set( i );
        }
        else
        {
          Debug.Assert( false,
            "invalid int property value "
            + displayValue );
        }
      }
      else if( metaType.Equals( "Double" ) )
      {
        double d;
        if( double.TryParse( displayValue, out d ) )
        {
          p.Set( d );
        }
        else
        {
          Debug.Assert( false,
            "invalid double property value "
            + displayValue );
        }
      }
      else
      {
        Debug.Assert( false, "unexpected metaType " + metaType );
      }
    }
public void SetValue ( Parameter p ) { StorageType st = p . StorageType ; if ( metaType . Equals ( " " ) ) { switch ( st ) { case StorageType . Double : p . Set ( 0.0 ) ; break ; case StorageType . ElementId : p . Set ( ElementId . InvalidElementId ) ; break ; case StorageType . Integer : p . Set ( 0 ) ; break ; case StorageType . String : p . Set ( string . Empty ) ; break ; default : Debug . Assert ( false , " " + st . ToString ( ) ) ; break ; } } else if ( metaType . Equals ( " " ) || metaType . Equals ( " " ) || metaType . Equals ( " " ) ) { p . Set ( DisplayString ) ; } else if ( metaType . Equals ( " " ) ) { int i ; if ( int . TryParse ( displayValue , out i ) ) { p . Set ( i ) ; } else { Debug . Assert ( false , " " + displayValue ) ; } } else if ( metaType . Equals ( " " ) ) { double d ; if ( double . TryParse ( displayValue , out d ) ) { p . Set ( d ) ; } else { Debug . Assert ( false , " " + displayValue ) ; } } else { Debug . Assert ( false , " " + metaType ) ; } }
Populate a Revit shared parameter value.
Populate a Revit shared parameter value .
p
Parameter