Hide menu
Loading...
Searching...
No Matches
Projector Example

Demonstrates how to create a projection of a 3D model, print projection info, and export the generated projection mesh.

Overview

This example demonstrates how to create a projection of a 3D model using the projector tool Projector_PolyProjector.

The console application:

  • imports a model,
  • traverses through every unique ModelData.Part ,
  • runs Projector.PolyProjector for each part,
  • obtains projection data as Projector.Projection ,
  • prints projection info to the console,
  • exports the projection mesh to an output file (STL or MTK).


Application needs 2 input arguments to run:

Usage: poly_projector <input_file> <output_file>, where:
<input_file> is a name of the model file to be read
<output_folder> is a folder to save projections to (must end with '/' or '\\\\')"


For more information about projector visit Projection Creation page.

Implementation

To explore the model and process ModelData.Part , it's need to create an inheritor from the ModelData.ModelElementVoidVisitor and override the part processing method void operator() (const ModelData::Part& thePart). For this purpose, the ProjectionComputer class was created.

For each ModelData.Part , the projection is created in the specified direction using Projector_PolyProjector . The returned Projector_Projection provides:

  • Area() - total projection area
  • OuterPerimeter() - outer boundary perimeter
  • Mesh() - triangulated projection mesh, suitable for export to STL

Example output

Below is the example output for model from ./examples/models/Fresamento_CAM1_v3.stp:

Part [Fresamento_CAM1], projection X:
area = 7197,50 mm
outer perimeter = 439,81 mm
Part [Fresamento_CAM1], projection Y:
area = 41385,46 mm
outer perimeter = 855,51 mm
Part [Fresamento_CAM1], projection Z:
area = 12399,68 mm
outer perimeter = 659,98 mm
Model
Y Projection
X Projection
Z Projection

Files