DirectShapeLibrary
DirectShapeLibrary is used to store pre-created geometry for further referencing via the definition/instance mechanism. It is not persistent: the scope of a library object is usually a single data creation session. DirectShape::createGeometryInstance and DirectShape::CreateElementInstance will use the current DirectShapeLibrary to look up the definitions. store a collection of GNodes as definition end class DirectShapeDefinition
Inheritance Hierarchy
System.Object
Autodesk.Revit.DB.DirectShapeLibrary
Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public class DirectShapeLibrary : IDisposableThe DirectShapeLibrary type exposes the following members.
Properties
Name
Description
Public Property
IsValidObject
Specifies whether the .NET object represents a valid Revit entity.
Methods
Name
Description
Public Method
AddDefinition(String, GeometryObject)
Add a definition to be reused by instances. A definition is a single geometry object.
Public Method
AddDefinition(String, IList.GeometryObject.)
Add a definition to be reused by instances. A definition is a collection of geometry objects.
Public Method
AddDefinitionType
Add a definition to be reused by instances. Adding a definition type will change how the instances are created. When asked to create a definition, the library object will look for a corresponding type object. If one is found, it will create an instance of geometry stored in the type object. If it is not found, the library will look for a list of geometry objects stored as definition, and will copy and transform these to create an instance.
Public Method
Contains
A quick check whether a definition already exists in the library. Checks for stored geometry objects only.
Public Method
ContainsType
A quick check whether a definition type already exists in the library. Checks for type objects only.
Public Method
Dispose
Releases all resources used by the DirectShapeLibrary
Public Method
Equals
Determines whether the specified object is equal to the current object.
(Inherited from Object)
Public Method
FindDefinition
Find a definition by id
Public Method
FindDefinitionType
Find a DirectShapeType element by definition id. The element will be used for creating instances of that definition.
Public Method
Static Member
GetDirectShapeLibrary
Get the currently active Library object
Public Method
GetHashCode
Serves as the default hash function.
(Inherited from Object)
Public Method
GetType
Gets the Type of the current instance.
(Inherited from Object)
Public Method
Reset
Removes all definitions from library. This is useful when importing several self-contained data sets within one session. Once a data set is imported, keeping the definitions specific to that data set will slow down the searches.
Public Method
ToString
Returns a string that represents the current object.
(Inherited from Object)
Remarks
There are two ways to add a definition to the library. The first is to add the definition as an array of geometry objects. A DirectShape created as an instance of that definition will hold a copy of predefined geometry, transformed as requested. If the definition was added as a DirectShapeType, a DirectShape object created as an instance of that definition will reference the type. Its geometry would be an instance of type geometry.