BuildingCoder.NestedFamilyFunctions.LinkNestedFamilyParameterToHostFamilyParameter C# (CSharp) Метод

LinkNestedFamilyParameterToHostFamilyParameter() публичный статический Метод

This method takes an instance of a nested family and links a parameter on it to a parameter on the given host family instance. This allows a change at the host level to automatically be sent down and applied to the nested family instance.
public static LinkNestedFamilyParameterToHostFamilyParameter ( Document hostFamilyDocument, FamilyInstance nestedFamilyInstance, string nestedFamilyParameterName, string hostFamilyParameterNameToLink ) : void
hostFamilyDocument Document The host family document to have one of its parameters be linked to a parameter on the given nested family instance
nestedFamilyInstance FamilyInstance The nested family whose parameter should be linked to a parameter on the host family
nestedFamilyParameterName string The name of the parameter on the nested family to link to the host family parameter
hostFamilyParameterNameToLink string The name of the parameter on the host family to link to a parameter on the given nested family instance
Результат void
        public static void LinkNestedFamilyParameterToHostFamilyParameter(
            Document hostFamilyDocument,
            FamilyInstance nestedFamilyInstance,
            string nestedFamilyParameterName,
            string hostFamilyParameterNameToLink)
        {
            // Following good SOA practices, verify the incoming
              // parameters before attempting to proceed.

              ValidateFamilyDocument( hostFamilyDocument ); // Throws an exception if is not valid family doc

              if( nestedFamilyInstance == null )
              {
            throw new ArgumentNullException(
              "nestedFamilyInstance" );
              }

              if( string.IsNullOrEmpty( nestedFamilyParameterName ) )
              {
            throw new ArgumentNullException(
              "nestedFamilyParameterName" );
              }

              if( string.IsNullOrEmpty( hostFamilyParameterNameToLink ) )
              {
            throw new ArgumentNullException(
              "hostFamilyParameterNameToLink" );
              }

              Parameter oNestedFamilyParameter
            = GetFamilyParameter( nestedFamilyInstance,
              nestedFamilyParameterName );

              if( oNestedFamilyParameter == null )
              {
            throw new Exception( "Parameter '"
              + nestedFamilyParameterName
              + "' was not found on the nested family '"
              + nestedFamilyInstance.Symbol.Name + "'" );
              }

              FamilyParameter oHostFamilyParameter
            = hostFamilyDocument.FamilyManager.get_Parameter(
              hostFamilyParameterNameToLink );

              if( oHostFamilyParameter == null )
              {
            throw new Exception( "Parameter '"
              + hostFamilyParameterNameToLink
              + "' was not found on the host family." );
              }

              hostFamilyDocument.FamilyManager
            .AssociateElementParameterToFamilyParameter(
              oNestedFamilyParameter, oHostFamilyParameter );
        }