View |
Returns a new section ViewSection.
Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)

public static ViewSection CreateSection(
Document document,
ElementId viewFamilyTypeId,
BoundingBoxXYZ sectionBox
)
Parameters
- document Document
- The document to which the new section ViewSection will be added.
- viewFamilyTypeId ElementId
- The id of the ViewFamilyType which will be used by the new section ViewSection. The type needs to be a Section ViewFamily.
- sectionBox BoundingBoxXYZ
- The BoundingBoxXYZ which specifies the new ViewSection's view direction and extents.
Return Value
ViewSectionThe new section ViewSection.

Exception | Condition |
---|---|
ArgumentException | The ViewFamilyType must be a Section ViewFamily. -or- The BoundingBoxXYZ is not appropriate for detail views. The basis vectors of must be unit length and orthonormal. The near and far bound offsets cannot be reversed or too close to each other. MinEnabled and MaxEnabled must be set to true for all three directions. -or- Section view creation is not allowed in this family. |
ArgumentNullException | A non-optional argument was null |
ModificationForbiddenException | The document is in failure mode: an operation has failed, and Revit requires the user to either cancel the operation or fix the problem (usually by deleting certain elements). -or- The document is being loaded, or is in the midst of another sensitive process. |
ModificationOutsideTransactionException | The document has no open transaction. |

Create a section whose view volume corresponds geometrically with the specified sectionBox. The view direction of the resulting section will be sectionBox.Transform.BasisZ and the up direction will be sectionBox.Transform.BasisY. The right hand direction will be computed so that (right, up, view direction) form a left handed coordinate system. The resulting view will be cropped, and far clipping will be active. The crop region will correspond to the projections of BoundingBoxXYZ.Min and BoundingBoxXYZ.Max onto the view's cut plane. The far clip distance will be equal to the difference of the z-coordinates of BoundingBoxXYZ.Min and BoundingBoxXYZ.Max. The new section ViewSection will receive a unique view name.
