This method marks the beginning of a Face to be exported.
Namespace:
Autodesk.Revit.DB
Assembly:
RevitAPI
(in RevitAPI.dll) Version: 18.0.0.0 (18.0.0.420)
Since:
2014
Syntax
C# |
---|
|
Visual Basic |
---|
|
Visual C++ |
---|
|
Parameters
- node
-
Type:
Autodesk.Revit.DB
FaceNode
An output node that represents a Face.
Return Value
Return RenderNodeAction. Proceed if you wish to receive geometry (polymesh) for this face, or return RenderNodeAction.Skip otherwise.Remarks
Note that this method (as well as OnFaceEnd) is invoked only if the custom
exporter was set up to include geometric objects in the output stream.
See
IncludeGeometricObjects
for mode details.
Examples
Copy
C#
/// <summary>
/// This code demonstrates how to process face geometry
/// </summary>
/// <remarks>
/// This method is invoked only if the custom exporter was set to include faces.
/// </remarks>
public RenderNodeAction OnFaceBegin(FaceNode node)
{
// Get the get the actual geometric face and all information about it
// and its edges by using standard API for Face and Edge
Face theFace = node.GetFace();
double area = theFace.Area;
if (theFace.HasRegions)
{
IList<Face> regionedFaces = theFace.GetRegions();
}
// We can either skip this face or proceed with rendering it depending on
// whether our export process can handle face geometry or not. If we choose
// to proceed, we get calls to export tessellated meshes for this face.
if (true == ExportAFace(theFace))
{
return RenderNodeAction.Skip;
}
return RenderNodeAction.Proceed;
}
/// <summary>
/// This code marks the end of processing a face
/// </summary>
/// <remarks>
/// This method is invoked only if the custom exporter was set to include faces.
/// </remarks>
public void OnFaceEnd(FaceNode node)
{
// Note: This method is invoked even for faces that were skipped.
}
/// <summary>
/// Assuming this would be the method that processes faces and exports them in our proprietary format.
/// </summary>
/// <remarks>
/// For example, we can decide that our format supports planar faces only, but no curved surfaces.
/// Or we can support basic surfaces only (planar, spherical, cylindrical), but not complex faces.
/// This is, naturally, depending on what a particular custom exporter is designed to output.
/// </remarks>
/// <returns>
/// Should return True if the face could be handled (exported), False otherwise.
/// </returns>
private bool ExportAFace(Face face)
{
return false; // in this case,
}
Copy
VB.NET
' <summary>
' This code demonstrates how to process face geometry
' </summary>
' <remarks>
' This method is invoked only if the custom exporter was set to include faces.
' </remarks>
Public Function OnFaceBegin(node As FaceNode) As RenderNodeAction Implements IExportContext.OnFaceBegin
' Get the get the actual geometric face and all information about it
' and its edges by using standard API for Face and Edge
Dim theFace As Face = node.GetFace()
Dim area As Double = theFace.Area
If theFace.HasRegions Then
Dim regionedFaces As IList(Of Face) = theFace.GetRegions()
End If
' We can either skip this face or proceed with rendering it depending on
' whether our export process can handle face geometry or not. If we choose
' to proceed, we get calls to export tessellated meshes for this face.
If True = ExportAFace(theFace) Then
Return RenderNodeAction.Skip
End If
Return RenderNodeAction.Proceed
End Function
' <summary>
' This code marks the end of processing a face
' </summary>
' <remarks>
' This method is invoked only if the custom exporter was set to include faces.
' </remarks>
Public Sub OnFaceEnd(node As FaceNode) Implements IExportContext.OnFaceEnd
' Note: This method is invoked even for faces that were skipped.
End Sub
' <summary>
' Assuming this would be the method that processes faces and exports them in our proprietary format.
' </summary>
' <remarks>
' For example, we can decide that our format supports planar faces only, but no curved surfaces.
' Or we can support basic surfaces only (planar, spherical, cylindrical), but not complex faces.
' This is, naturally, depending on what a particular custom exporter is designed to output.
' </remarks>
' <returns>
' Should return True if the face could be handled (exported), False otherwise.
' </returns>
Private Function ExportAFace(face As Face) As Boolean
Return False
' in this case,
End Function