AssemblyViewUtils Class

AssemblyViewUtils Class

Utilities that provide capabilities related to assembly view creation and validation.
Inheritance Hierarchy
SystemObject
  Autodesk.Revit.DBAssemblyViewUtils

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public static class AssemblyViewUtils
Public NotInheritable Class AssemblyViewUtils
public ref class AssemblyViewUtils abstract sealed
[<AbstractClassAttribute>]
[<SealedAttribute>]
type AssemblyViewUtils = class end

The AssemblyViewUtils type exposes the following members.

Methods
 NameDescription
Public methodStatic memberAcquireAssemblyViews Transfers the assembly views owned by a source assembly instance to a target sibling assembly instance of the same assembly type.
Public methodStatic memberCreate3DOrthographic(Document, ElementId) Creates a new orthographic 3D assembly view for the assembly instance.
Public methodStatic memberCreate3DOrthographic(Document, ElementId, ElementId, Boolean) Creates a new orthographic 3D assembly view for the assembly instance. The view will have the same orientation as the Default 3D view. The document must be regenerated before using the 3D view.
Public methodStatic memberCreateDetailSection(Document, ElementId, AssemblyDetailViewOrientation) Creates a new detail section assembly view for the assembly instance.
Public methodStatic memberCreateDetailSection(Document, ElementId, AssemblyDetailViewOrientation, ElementId, Boolean) Creates a new detail section assembly view for the assembly instance.
Public methodStatic memberCreateMaterialTakeoff(Document, ElementId) Creates a new material takeoff multicategory schedule assembly view for the assembly instance.
Public methodStatic memberCreateMaterialTakeoff(Document, ElementId, ElementId, Boolean) Creates a new material takeoff multicategory schedule assembly view for the assembly instance.
Public methodStatic memberCreatePartList(Document, ElementId) Creates a new part list multicategory schedule assembly view for the assembly instance.
Public methodStatic memberCreatePartList(Document, ElementId, ElementId, Boolean) Creates a new part list multicategory schedule assembly view for the assembly instance.
Public methodStatic memberCreateSheet Creates a new sheet assembly view for the assembly instance.
Public methodStatic memberCreateSingleCategorySchedule(Document, ElementId, ElementId) Creates a new single-category schedule assembly view for the assembly instance.
Public methodStatic memberCreateSingleCategorySchedule(Document, ElementId, ElementId, ElementId, Boolean) Creates a new single-category schedule assembly view for the assembly instance.
Top
Example
private ViewSchedule CreateScheduleForAssembly(Document doc, AssemblyInstance assemblyInstance, ElementId viewTemplateId)
{
    ViewSchedule schedule = null;
    if (assemblyInstance.AllowsAssemblyViewCreation()) // create assembly views for this assembly instance
    {
        using (Transaction transaction = new Transaction(doc))
        {
            transaction.Start("Create Schedule");

            // use naming category for the schedule
            if (ViewSchedule.IsValidCategoryForSchedule(assemblyInstance.NamingCategoryId))
            {
                schedule = AssemblyViewUtils.CreateSingleCategorySchedule(doc, assemblyInstance.Id, assemblyInstance.NamingCategoryId, viewTemplateId, false);
            }
            transaction.Commit();

            if (schedule != null && transaction.GetStatus() == TransactionStatus.Committed)
            {
                transaction.Start("Edit Schedule");
                schedule.Name = "AssemblyViewSchedule";
                transaction.Commit();
            }
        }
    }

    return schedule;
}
Private Function CreateScheduleForAssembly(doc As Document, assemblyInstance As AssemblyInstance, viewTemplateId As ElementId) As ViewSchedule
    Dim schedule As ViewSchedule = Nothing
    If assemblyInstance.AllowsAssemblyViewCreation() Then
        ' create assembly views for this assembly instance
        Using transaction As New Transaction(doc)
            transaction.Start("Create Schedule")

            ' use naming category for the schedule
            If ViewSchedule.IsValidCategoryForSchedule(assemblyInstance.NamingCategoryId) Then
                schedule = AssemblyViewUtils.CreateSingleCategorySchedule(doc, assemblyInstance.Id, assemblyInstance.NamingCategoryId, viewTemplateId, False)
            End If
            transaction.Commit()

            If schedule IsNot Nothing AndAlso transaction.GetStatus() = TransactionStatus.Committed Then
                transaction.Start("Edit Schedule")
                schedule.Name = "AssemblyViewSchedule"
                transaction.Commit()
            End If
        End Using
    End If

    Return schedule
End Function

Private Function IExternalCommand_Execute(commandData As ExternalCommandData, ByRef message As String, elements As ElementSet) As Result Implements IExternalCommand.Execute
    Throw New NotImplementedException()
End Function

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