Creates a new ViewDrafting in the model.
Namespace: Autodesk.Revit.DBAssembly: RevitAPI (in RevitAPI.dll) Version: 21.0.0.0 (21.1.1.109)
Since:
2015
Syntax
Return Value
The newly created drafting view.
Examples
CopyC#
FilteredElementCollector collector = new FilteredElementCollector(document);
collector.OfClass(typeof(ViewFamilyType));
ViewFamilyType viewFamilyType = collector.Cast<ViewFamilyType>().First(vft => vft.ViewFamily == ViewFamily.Drafting);
ViewDrafting view = ViewDrafting.Create(document, viewFamilyType.Id);
view.Name = "MyViewDrafting";
BoundingBoxXYZ boundingBox = new BoundingBoxXYZ();
boundingBox.Max = new XYZ(100, 100, 50);
boundingBox.Min = new XYZ(-100, -100, -50);
view.CropBox = boundingBox;
CopyVB.NET
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)
Dim view As ViewDrafting = ViewDrafting.Create(document, viewFamilyType.Id)
view.Name = "MyViewDrafting"
Dim boundingBox As New BoundingBoxXYZ()
boundingBox.Max = New XYZ(100, 100, 50)
boundingBox.Min = New XYZ(-100, -100, -50)
view.CropBox = boundingBox
Exceptions
See Also