Application: SheetToView3D
Revit Platform: All
Revit Version: 2023.0
First Released For: 2023.0
Programming Language: C#
Skill Level: Advanced
Category: View Transforms
Type: ExternalCommand

Subject: Click on a ViewPlan viewport on a sheet to create a new perspective 3D view with its camera at that point in the model 
. 
Summary: 
This sample demonstrates how to use the View and Viewport transforms to map a point on a sheet to a location in the 3D model. It also demonstrates how to use TransformWithBoundary to inspect the view crop regions if the view crop has been broken (split) into many pieces.

Classes: 
Autodesk.Revit.DB.Curveloop
Autodesk.Revit.DB.Plane
Autodesk.Revit.DB.Transform
Autodesk.Revit.DB.TransformWithBoundary
Autodesk.Revit.DB.View
Autodesk.Revit.DB.View3D.CreatePerspective
Autodesk.Revit.DB.Viewport
Autodesk.Revit.DB.ViewSheet

Project Files:
SheetToView3D.cs
It contains two classes:
-	The class Command which implements interface IExternalCommand, it is the entry of this external command.
-	The class MakeView3D is responsible for creating a new 3D view when the user clicks on a ViewPlan viewport on a sheet.

Description: 
This sample demonstrates the following functionalities:
-	It captures a click on a sheet from the user, then verifies that a view plan viewport was clicked.  Then it collects transforms from the clicked viewport and view and builds a transform from sheet space to 3D model space. (If the view has a broken (split) crop region, then the crop region and transform for the click’s location is found.)  The click point is then converted into 3D model space and projected onto the view plan’s cut plane.  A new perspective 3D view is created with its camera at this point.
-	The most important class is MakeView3D. It shows how to get the transforms from the viewports and views, how to get crop region boundaries from TransformWithBoundary, and how to generate a new 3D view via RevitAPI.

Instructions:
A.	To use the “Sheet To 3D View” command:
1)	Open a sheet view that contains plan views.
2)	Run this external command.
3)	Click in the viewport of a plan view at the location you want to create the 3D view.