IExportContextOnFaceBegin Method

This method marks the beginning of a Face to be exported.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
RenderNodeAction OnFaceBegin(
	FaceNode node
)

Parameters

node  FaceNode
An output node that represents a Face.

Return Value

RenderNodeAction
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.
Example
/// <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, 
}
See Also