C# Класс BuildingCoder.NestedFamilyFunctions

This class contains functions for dealing with nested families within a Revit family document.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
GetFamilyParameter ( FamilyInstance nestedFamilyInstance, string parameterName ) : Parameter

Returns a reference to the FAMILY parameter (as a simple Parameter data type) on the given instance for the parameter with the given name. Will return the parameter whether it is an instance or type parameter. Returns null if no parameter on the instance was found.

Even though the data type returned is the more generic Parameter type, it will actually be for the data of the internal FamilyParameter object.

GetFilteredNestedFamilyDefinitions ( string familyFileNameFilter, Document familyDocument, bool caseSensitiveFiltering ) : IEnumerable

Returns a list of the nested family files in the given family document whose name matches the given family file name filter. Useful for checking to see if a family desired for nesting into the host family document is already nested in. Filtering is done with a simple Contains (substring) check, so wildcards don't work.

Because standard Revit filtering techniques fail when searching for nested families in a family document, we have no choice but to iterate over all elements in the family. While there usually aren't that many elements at the family level, nonetheless this method has been built for speed.

GetFilteredNestedFamilyInstances ( string familyFileNameFilter, string typeNameFilter, Document familyDocument, bool caseSensitiveFiltering ) : List

Returns a list of family instances found in the given family document whose family file name matches the given familyFileNameFilter and whose type name matches the given typeNameFilter. If no filter values are provided (or they evaluate to the empty string when trimmed) then all instances will be evaluated. Filtering is done with a simple Contains (substring) check, so wildcards don't work.

Because standard Revit filtering techniques fail when searching for nested families in a family document, we have no choice but to iterate over all elements in the family. While there usually aren't that many elements at the family level, nonetheless this method has been built for MAXIMUM SPEED.

LinkNestedFamilyParameterToHostFamilyParameter ( Document hostFamilyDocument, FamilyInstance nestedFamilyInstance, string nestedFamilyParameterName, string hostFamilyParameterNameToLink ) : void

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.

Приватные методы

Метод Описание
FilterMatches ( string nameToCheck, string filter, bool caseSensitiveComparison ) : bool

Returns whether or not the nameToCheck matches the given filter. This is done with a simple Contains check, so wildcards won't work.

ValidateFamilyDocument ( Document document ) : void

This method will validate the provided Revit Document to make sure the reference exists and is for a FAMILY document. It will throw an ArgumentNullException if nothing is sent, and will throw an ArgumentOutOfRangeException if the document provided isn't a family document (e.g. is a project document)

Описание методов

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

Returns a reference to the FAMILY parameter (as a simple Parameter data type) on the given instance for the parameter with the given name. Will return the parameter whether it is an instance or type parameter. Returns null if no parameter on the instance was found.
Even though the data type returned is the more generic Parameter type, it will actually be for the data of the internal FamilyParameter object.
public static GetFamilyParameter ( FamilyInstance nestedFamilyInstance, string parameterName ) : Parameter
nestedFamilyInstance FamilyInstance An instance of a nested family file
parameterName string The name of the desired parameter to get a reference to
Результат Parameter

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

Returns a list of the nested family files in the given family document whose name matches the given family file name filter. Useful for checking to see if a family desired for nesting into the host family document is already nested in. Filtering is done with a simple Contains (substring) check, so wildcards don't work.
Because standard Revit filtering techniques fail when searching for nested families in a family document, we have no choice but to iterate over all elements in the family. While there usually aren't that many elements at the family level, nonetheless this method has been built for speed.
public static GetFilteredNestedFamilyDefinitions ( string familyFileNameFilter, Document familyDocument, bool caseSensitiveFiltering ) : IEnumerable
familyFileNameFilter string The portion of the family file loaded into the family document
familyDocument Document The family document being queried
caseSensitiveFiltering bool Whether or not the filter checking is case-sensitive
Результат IEnumerable

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

Returns a list of family instances found in the given family document whose family file name matches the given familyFileNameFilter and whose type name matches the given typeNameFilter. If no filter values are provided (or they evaluate to the empty string when trimmed) then all instances will be evaluated. Filtering is done with a simple Contains (substring) check, so wildcards don't work.
Because standard Revit filtering techniques fail when searching for nested families in a family document, we have no choice but to iterate over all elements in the family. While there usually aren't that many elements at the family level, nonetheless this method has been built for MAXIMUM SPEED.
public static GetFilteredNestedFamilyInstances ( string familyFileNameFilter, string typeNameFilter, Document familyDocument, bool caseSensitiveFiltering ) : List
familyFileNameFilter string The portion of the nested family file name (or exact match) to find
typeNameFilter string The portion of the type name (or exact match) to find
familyDocument Document The family document to search.
caseSensitiveFiltering bool Whether or not the filter checking is case-sensitive
Результат List

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