NewFamilyDocument Method


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

Namespace: Autodesk.Revit.ApplicationServices
Assembly: RevitAPI (in RevitAPI.dll) Version: 2015.0.0.0 (2015.0.0.0)

Syntax

C#
public virtual Document NewFamilyDocument(
	string templateFileName
)
Visual Basic
Public Overridable Function NewFamilyDocument ( _
	templateFileName As String _
) As Document
Visual C++
public:
virtual Document^ NewFamilyDocument(
	String^ templateFileName
)

Parameters

templateFileName
Type: System String
The template file name.

Remarks

This command corresponds to File->New->Family.../TitleBlock.../Annotation Symbol....

Examples

Copy C#
// 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");
}
Copy VB.NET
' 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

Exceptions

Exception Condition
Autodesk.Revit.Exceptions ArgumentException If 'templateFileName' is a null reference ( Nothing in Visual Basic) or an empty string.
Autodesk.Revit.Exceptions InvalidOperationException If the new family document cannot be created.

See Also

ArchiLabs

Stop fighting Revit automation.

Build repeatable BIM design and documentation workflows with scripts, data, and AI in one place, without wrestling brittle one-off automations.

Try ArchiLabs →