Namespace:
Autodesk.Revit.DB
TypeBinding
Class
Description:
TypeBinding objects are used to bind a property to a Revit type, such as a wall type.
TypeBinding objects are used to bind a property to a Revit type, such as a wall type.
Remarks:
This differs from Instance bindings in that the property is then shared by all instances that use that type. Changing the parameter for one type affects all other instances that use that type.
This differs from Instance bindings in that the property is then shared by all instances that use that type. Changing the parameter for one type affects all other instances that use that type.
Inheritance Hierarchy:
System.Object
Autodesk.Revit.DB.APIObject
Autodesk.Revit.DB.Binding
Autodesk.Revit.DB.ElementBinding
Autodesk.Revit.DB.TypeBinding
System.Object
Autodesk.Revit.DB.APIObject
Autodesk.Revit.DB.Binding
Autodesk.Revit.DB.ElementBinding
Autodesk.Revit.DB.TypeBinding
Examples
public bool SetNewParameterToTypeWall(UIApplication app, DefinitionFile myDefinitionFile)
{
// Create a new group in the shared parameters file
DefinitionGroups myGroups = myDefinitionFile.Groups;
DefinitionGroup myGroup = myGroups.Create("MyParameters");
// Create a type definition
ExternalDefinitionCreationOptions option = new ExternalDefinitionCreationOptions("CompanyName", SpecTypeId.String.Text);
Definition myDefinition_CompanyName = myGroup.Definitions.Create(option);
// Create a category set and insert category of wall to it
CategorySet myCategories = app.Application.Create.NewCategorySet();
// Use BuiltInCategory to get category of wall
Category myCategory = Category.GetCategory(app.ActiveUIDocument.Document, BuiltInCategory.OST_Walls);
myCategories.Insert(myCategory);
//Create an object of TypeBinding according to the Categories
TypeBinding typeBinding = app.Application.Create.NewTypeBinding(myCategories);
// Get the BingdingMap of current document.
BindingMap bindingMap = app.ActiveUIDocument.Document.ParameterBindings;
// Bind the definitions to the document
bool typeBindOK = bindingMap.Insert(myDefinition_CompanyName, typeBinding,
GroupTypeId.Text);
return typeBindOK;
}
TypeBinding Class Members:
Name | Description | Inherited From |
---|---|---|
TypeBinding() | Constructs an empty type binding. | |
TypeBinding(CategorySet) | Constructs a type binding with the set of categories passed. |
Name | Description | Inherited From |
---|---|---|
Categories | Retrieve or set the categories to which a parameter definition will be bound. (Inherited from ElementBinding ) | ElementBinding |
IsReadOnly | Identifies if the object is read-only or modifiable. (Inherited from APIObject ) | APIObject |
Name | Description | Inherited From |
---|---|---|
Dispose | Causes the object to release immediately any resources it may be utilizing. (Inherited from APIObject ) | APIObject |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object ) | Object |
GetHashCode | Serves as the default hash function. (Inherited from Object ) | Object |
GetType | Gets the Type of the current instance. (Inherited from Object ) | Object |
ToString | Returns a string that represents the current object. (Inherited from Object ) | Object |