NewViewDrafting Method


Creates a new drafting view.

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

Syntax

C#
[ObsoleteAttribute("This method is obsolete in Revit 2015.  Use ViewDrafting.Create() instead.")]
public ViewDrafting NewViewDrafting()
Visual Basic
<ObsoleteAttribute("This method is obsolete in Revit 2015.  Use ViewDrafting.Create() instead.")> _
Public Function NewViewDrafting As ViewDrafting
Visual C++
[ObsoleteAttribute(L"This method is obsolete in Revit 2015.  Use ViewDrafting.Create() instead.")]
public:
ViewDrafting^ NewViewDrafting()

Return Value

The newly created drafting view.

Examples

Copy C#
// For simplicity, we'll look what drafting view types are already available,
// and we'll use the first one we can find to create our new drafting view.
FilteredElementCollector collector = new FilteredElementCollector(document);
collector.OfClass(typeof(ViewFamilyType));
ViewFamilyType viewFamilyType = collector.Cast<ViewFamilyType>().First(vft => vft.ViewFamily == ViewFamily.Drafting);

// Create a new ViewDrafting instance
ViewDrafting view = ViewDrafting.Create(document, viewFamilyType.Id); 
view.ViewName = "MyViewDrafting";

// Set the CropBox
BoundingBoxXYZ boundingBox = new BoundingBoxXYZ();
boundingBox.Max = new XYZ(100, 100, 50);
boundingBox.Min = new XYZ(-100, -100, -50);
view.CropBox = boundingBox;
Copy VB.NET
' For simplicity, we'll look what drafting view types are already available,
' and we'll use the first one we can find to create our new drafting view.
Dim collector As New FilteredElementCollector(document)
collector.OfClass(GetType(ViewFamilyType))
Dim viewFamilyType As ViewFamilyType = collector.Cast(Of ViewFamilyType)().First(Function(vft) vft.ViewFamily = ViewFamily.Drafting)

' Create a new ViewDrafting instance
Dim view As ViewDrafting = ViewDrafting.Create(document, viewFamilyType.Id)
view.ViewName = "MyViewDrafting"

' Set the CropBox
Dim boundingBox As New BoundingBoxXYZ()
boundingBox.Max = New XYZ(100, 100, 50)
boundingBox.Min = New XYZ(-100, -100, -50)
view.CropBox = boundingBox

See Also