Application.NewFamilyDocument Method

ApplicationNewFamilyDocument Method

New family document, including family, titleblock, and annotation symbol

Namespace: Autodesk.Revit.ApplicationServices
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public virtual Document NewFamilyDocument(
	string templateFileName
)
Public Overridable Function NewFamilyDocument ( 
	templateFileName As String
) As Document
public:
virtual Document^ NewFamilyDocument(
	String^ templateFileName
)
abstract NewFamilyDocument : 
        templateFileName : string -> Document 
override NewFamilyDocument : 
        templateFileName : string -> Document 

Parameters

templateFileName  String
The template file name.

Return Value

Document
Exceptions
ExceptionCondition
ArgumentExceptionIf 'templateFileName' is or an empty string.
InvalidOperationExceptionIf the new family document cannot be created.
Remarks
This command corresponds to File->New->Family.../TitleBlock.../Annotation Symbol....
Example
// create a new family document using Generic Model.rft template
string templateFileName = @"C:\Documents and Settings\All Users\Application Data\Autodesk\RST 2010\Imperial Templates\Generic Model.rft";
Document familyDocument = application.NewFamilyDocument(templateFileName);
if (null == familyDocument)
{
    throw new Exception("Cannot open family document");
}
' create a new family document using Generic Model.rft template
Dim templateFileName As String = "C:\Documents and Settings\All Users\Application Data\Autodesk\RST 2010\Imperial Templates\Generic Model.rft"
Dim familyDocument As Document = application.NewFamilyDocument(templateFileName)
If familyDocument Is Nothing Then
    Throw New Exception("Cannot open family document")
End If

No code example is currently available or this language may not be supported.

No code example is currently available or this language may not be supported.

See Also