ViewDraftingCreate Method |
Creates a new ViewDrafting in the model.
Namespace: Autodesk.Revit.DBAssembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntaxpublic static ViewDrafting Create(
Document document,
ElementId viewFamilyTypeId
)
Public Shared Function Create (
document As Document,
viewFamilyTypeId As ElementId
) As ViewDrafting
public:
static ViewDrafting^ Create(
Document^ document,
ElementId^ viewFamilyTypeId
)
static member Create :
document : Document *
viewFamilyTypeId : ElementId -> ViewDrafting
Parameters
- document Document
-
The document in which the new drafting view will be created.
- viewFamilyTypeId ElementId
-
The id of the ViewFamilyType that should be assigned to the new drafting view.
Return Value
ViewDrafting
The newly created drafting view.
Exceptions
Example
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;
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
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