Close

Relief for ODA Team in Ukraine

Learn more
ODA PRC SDK
Sample Console Application that Illustrates Creation of Boundary Representation Entities

Summary

ODA Product: ODA PRC SDK
Sample Name: OdPrcBrepBuilderEx
Categories: C++ / Advanced / Working with .prc entities / Android, iOS, macOS, Linux, Windows
Source Code Location: CommonApplications/Prc/Examples/OdPrcBrepBuilderEx

Description

A console sample application that creates a .prc file and adds boundary representation entities to it.

Run Sample Application

To run the OdPrcBrepBuilderEx sample application, please do the following:

  1. Open the terminal window and go to the directory where the sample binary file is allocated:
    • For Windows® platforms: <PRC_DIR>\exe\<version>
    • For Non-Windows platforms: <PRC_DIR>/bin/<version>

    <PRC_DIR> is a directory where you unpacked the PRC SDK archive.

    To determine your <version> parameter, please see the appropriate section in the Download ODA PRC SDK topic.

  2. Run the sample with appropriate parameters:
    
                OdPrcBrepBuilderEx <example_case> <filename>
              
    example_case A symbolic name of the example case that represents the kind of B-Rep item to create.

    Possible example case values supported by the sample application:

    • BBBox — Creates a boundary representation of a box entity and adds it to the file structure. The source code for this example case can be found in the Box.cpp file, located in Prc/Examples/OdPrcBrepBuilderEx of the ODA software installation directory. Adding a box entity is implemented in the createBox() function.
    • BBComplexPlane — Creates a boundary representation of a complex plane entity and adds it to the file structure. The source code for this example case can be found in the ComplexPlane.cpp file, located in Prc/Examples/OdPrcBrepBuilderEx of the ODA software installation directory. Adding a complex plane entity is implemented in the createComplexPlane() function.
    • BBCone — Creates a boundary representation of a cone entity and adds it to the file structure. The source code for this example case can be found in the Cone.cpp file, located in Prc/Examples/OdPrcBrepBuilderEx of the ODA software installation directory. Adding a cone entity is implemented in the createCone() function.
    • BBCylinder — Creates a boundary representation of a cylinder entity and adds it to the file structure. The source code for this example case can be found in the Cylinder.cpp file, located in Prc/Examples/OdPrcBrepBuilderEx of the ODA software installation directory. Adding a cylinder entity is implemented in the createCylinder() function.
    • BBSphere — Creates a boundary representation of a sphere entity and adds it to the file structure. The source code for this example case can be found in the Sphere.cpp file, located in Prc/Examples/OdPrcBrepBuilderEx of the ODA software installation directory. Adding a sphere entity is implemented in the createSphere() function.
    • BBTorus — Creates a boundary representation of a torus entity and adds it to the file structure. The source code for this example case can be found in the Torus.cpp file, located in Prc/Examples/OdPrcBrepBuilderEx of the ODA software installation directory. Adding a torus entity is implemented in the createTorus() function.
    filename Full path to the output .prc file.

If the application executed properly, you will see the following console window:

If the input parameters are not specified or are specified incorrectly, the application prints the usage instructions:

The results of running each example case are represented below.

  • BBBox:

  • BBComplexPlane:

  • BBCone:

  • BBCylinder:

  • BBSphere:

  • BBTorus:

Sample Application Structure

The application entry point (main() function) is defined in the OdPrcBrepBuilderEx.cpp source code file.

The main() function implements the following steps for creating boundary representation entities:

  1. Customize locale time function, assert function, and create an instance of the MyServices class. For additional information about this functionality, see the ODA PRC SDK Sample Applications Reusable Files documentation.
  2. Parse and validate the application input parameters.
  3. Initialize ODA platform functionality.
  4. Create an instance of OdPrcModuleName; this module implements functionality for manipulating .prc files.
  5. Create B-Rep topology (the createTopologyForBrep() function is defined in the PrcCreateTopologyHelper.cpp and PrcCreateTopologyHelper.h source code files, which are located in the Prc/Examples/OdPrcCreate folder).
  6. Get the B-Rep data and part definition objects, then open them for writing.
  7. Run the OdPrcBrepBuilderExStart() function which calls the appropriate function for creating retrieved B-Rep entities and checks the result of B-Rep data creation. If the entity was successfully created, write the created contents to the specified output file.
  8. Uninitialize ODA platform functionality.

See Also

Work with Representation Entities

ODA PRC SDK Sample Applications

Copyright © 2002 – 2022. Open Design Alliance. All rights reserved.