The DefinitionFile object represents a shared parameters file on disk.
Inheritance Hierarchy
System.ObjectAutodesk.Revit.DB.APIObject
Autodesk.Revit.DB.DefinitionFile
Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.3.0.0 (25.3.0.0)
Syntax
C#
public class DefinitionFile : APIObject
The DefinitionFile type exposes the following members.
Properties
Name | Description | |
---|---|---|
![]() | Filename | This property returns the physical filename of the shared parameters file on disk. |
![]() | Groups | Return a map of shared parameter definition groups contained within the file. |
![]() ![]() | IsReadOnly | Identifies if the object is read-only or modifiable. (Inherited from APIObject) |
Methods
Name | Description | |
---|---|---|
![]() | Dispose | Causes the object to release immediately any resources it may be utilizing. (Inherited from APIObject) |
![]() | Equals | Determines whether the specified object is equal to the current object. (Inherited from Object) |
![]() | GetHashCode | Serves as the default hash function. (Inherited from Object) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object) |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object) |
Remarks
Shared Parameters are parameter definitions that are stored in a text file external to the Autodesk Revit project. These definitions can be used in multiple projects and are identifiable by a unique identifier generated when they are created. API access to shared parameters consist of a number of objects, the first of which is an object that represents the shared parameters file on disk. That object then contains a number of Group objects. Shared parameters are grouped for easier management. These groups then contain the shared parameter definitions. The groups support the ability to create new shared parameter definitions. The DefinitionFile object can be retrieved by the Application.OpenSharedParameterFile method.Example
C#
private void ShowDefinitionFileInfo(DefinitionFile myDefinitionFile) { StringBuilder fileInformation = new StringBuilder(500); // get the file name fileInformation.AppendLine("File Name: " + myDefinitionFile.Filename); // iterate the Definition groups of this file foreach (DefinitionGroup myGroup in myDefinitionFile.Groups) { // get the group name fileInformation.AppendLine("Group Name: " + myGroup.Name); // iterate the difinitions foreach (Definition definition in myGroup.Definitions) { // get definition name fileInformation.AppendLine("Definition Name: " + definition.Name); } } TaskDialog.Show("Revit",fileInformation.ToString()); }
VB
Private Sub ShowDefinitionFileInfo(myDefinitionFile As DefinitionFile) Dim fileInformation As New StringBuilder(500) ' get the file name fileInformation.AppendLine("File Name: " & Convert.ToString(myDefinitionFile.Filename)) ' iterate the Definition groups of this file For Each myGroup As DefinitionGroup In myDefinitionFile.Groups ' get the group name fileInformation.AppendLine("Group Name: " + myGroup.Name) ' iterate the difinitions For Each definition As Definition In myGroup.Definitions ' get definition name fileInformation.AppendLine("Definition Name: " + definition.Name) Next Next TaskDialog.Show("Revit", fileInformation.ToString()) End Sub