Revit Families Come in Rotated 90 Degrees in Z Direction
Families, Symbols, Instances & Organization Families
Theory
In this article I volition present some means of getting families, instances, symbols and organization family objects using the Revit collector.
Family Structure
But allow's outset with the basics, because like many others when I first started I was a bit dislocated on the differences betwixt these concepts.
And so what is a family? Co-ordinate to the Autodesk Knowledge site it is "a group of elements with a common set of properties, called parameters, and a related graphical representation".A proper classification and description can be institute following this link
So in Revit there are 2 types of families (Component Families and Organization Families). The component families are the families that the user can create and load and the system families are congenital-in, the user can only create derived types.
Following the documentation, in Revit custom families are represented in total by:
- Family – the entire family that consists of a collection of types
- FamilySymbol – The collection of types that the family contains.
- FamilyInstance – actual instance of that type in the revit model
Type vs Symbol
So there is a lot of confusion between the FamilySymbol and the FamilyType, and I was notwithstanding dislocated when I outset dove in the api of Revit. For a detailed explanation yous can follow Jeremy's article hither.
In that location are ii contexts in which a Type exists, one is in the Revit Model infinite and some other one is in the Revit Family unit Editor. For this verbal reason at that place are two classes, because they represent the same affair but are different objects. Ane belongs to the family unit, the other exists when it'south loaded in the model infinite.
- The family type is what the Family object actually contains, information technology's the object that really defines the blazon volition all of the parameters and then on.
- The family symbol exists when the family unit blazon is loaded in the Revit Model space. It's a compiled FamilyType with express operations allowed on it, because information technology'southward definition is fabricated inside the Editor.
You can just go types in the Family Editor
Definitions:
- Family :
- A virtual representation of a working item that has a specific set of conceptual characteristics, and that tin exist configured in many means using the defined parameters.
- Equally an case a family unit tin be around tabular array where it's diameter tin exist configured dynamically
- Family Type
- A family unit tin can have multiple types that inherit the families characteristics, but will fix some parameter values for that type'south resolution.
- As an case a family type can beround table of 3 meters, it derives from the family therefore information technology's round, but information technology has the diameter stock-still. Other configurations tin can exist applied if in that location are case parameters defined
- FamilySymbol
- A family symbol is the Revit api form name that in the UI it's called a type.
- A family symbol is the same every bit the type, only that the type is the actual definition and it belongs to the family. The symbol is the compiled type in the model infinite.
- A organization family
- Built in families that are non bachelor for creating. Revit provides the graphical representation and you tin only create derived types. They are walls, dimensions, etc.
- A system family unit type in revitapi is the HostObjAttributes class and the instance is the HostObject class
To read more about this, please visit the following link.
In the model
For getting instances of the Component Family, nosotros can query for the FamilyInstance type. System families are unlike, they actually have defended classes (like Wall, Dimension). We tin query for these typed classed if we know that we want them. All system family unit instances can be retrieved by querying for their parent course HostObject
Getting family unit instances and system family blazon instances
Listing allInstances = new FilteredElementCollector ( certificate ) . OfClass ( typeof ( FamilyInstance ) ) . OfType ( ) . ToList ( ) ; List wallInstances = new FilteredElementCollector ( certificate ) . OfClass ( typeof ( Wall ) ) . OfType ( ) . ToList ( ) ; List systemFamilyInstances = new FilteredElementCollector ( document ) . OfClass ( typeof ( HostObject ) ) . OfType ( ) . ToList ( ) ; |
Listing allInstances = new FilteredElementCollector ( document ) . OfClass ( typeof ( FamilyInstance ) ) . OfType ( ) . ToList ( ) ; |
Getting system family types
var systemTypes = new FilteredElementCollector ( document ) . OfClass ( typeof ( HostObjAttributes ) ) . ToList ( ) ; |
Getting a specific family symbol
FamilySymbol mullionSymbol = new FilteredElementCollector ( document ) . OfClass ( typeof ( FamilySymbol ) ) . OfType ( ) . Where ( x = > x . FamilyName == "Rectangular Mullion" && x . Name == "64 x 128 rectangular" ) . FirstOrDefault ( ) ; |
Getting all symbols of a family with a filter
List allMullionSymbols = new FilteredElementCollector ( document ) . WherePasses ( new FamilySymbolFilter ( mullionSymbol . Family . Id ) ) . OfType ( ) . ToList ( ) ; |
Getting all instances for a symbol
var mullionInstances = new FilteredElementCollector ( document ) . WherePasses ( new FamilyInstanceFilter ( document , mullionSymbol . Id ) ) . OfType ( ) . ToList ( ) ; |
//Just getting the first mullion with this type name FamilyInstance aRandomMullion = allInstances . Where ( x = > x . Name == "64 x 128 rectangular" ) . FirstOrDefault ( ) ; //the family unit is accessed via the symbol of the family Family unit mullionFamily = aRandomMullion . Symbol . Family ; |
In the Editor
string proper noun = document . FamilyManager . CurrentType . Name ; FamilyTypeSet types = document . FamilyManager . Types ; |
petersonbonly1984.blogspot.com
Source: https://digitteck.com/dotnet/families-symbols-instances-and-system-families/
0 Response to "Revit Families Come in Rotated 90 Degrees in Z Direction"
Post a Comment