Close

Relief for ODA Team in Ukraine

Learn more
ODA PRC SDK
ODA PRC SDK 3D Publishing Commands Plugin

Summary

ODA Product: ODA PRC SDK, ODA Publish SDK
Sample Name: OdPrcPublish3dCmds
Categories: C++ / Beginner / Commands for publishing .prc files / Android, iOS, macOS, Linux, Windows
Source Code Location: Prc/Examples/OdPrcPublish3dCmds

Description

This sample contains a set of custom commands for publishing .prc file content to a 3D .pdf file. Commands are joined into a dynamic module (OdPrcPublish3dCmds_*.tx file) that can be loaded and used in any application hosted by ODA Platform (for example, in the OdaPrcApp sample application).

Source files are available in the Prc/Examples/OdPrcPublish3dCmds folder. Release packages (archives) contain a Visual Studio solution for the Windows platform, a CMake file, and a pre-built binary executable file.

To get additional information about user command concepts, and best practices for creating a new custom command and using it, please see Working with Commands in ODA Drawings SDK documentation.

The sample's custom commands are declared in the PrcPublish3dCmdDef.h header file using a special macro CMD_DEF. The following table describes the set of commands that are currently implemented and ready for use by your custom application.

Command Name Description
PrcPublish3Dcase1 Creates a 3D .pdf document from a specified .prc file with a carousel buttons control. A carousel buttons control allows switching between views of the 3D model interactively in a viewer application that supports 3D PDF format, for example in Adobe Acrobat Reader®. The command is implemented with the PublishTemplate1() function that is defined in the Prc\Examples\OdPrcPublish3dCmds\PublishTemplate1.cpp source file. The look of the output document is shown here. You also can download the output 3D PDF document.
PrcPublish3Dcase2 Creates a 3D .pdf document from a specified .prc file with carousel buttons and part list controls. A part list control allows switching between parts of an assembly and shows the assembly parts in a table with the part name and quantity of part instances in the assembly. The command is implemented with the PublishTemplate2() function that is defined in the Prc\Examples\OdPrcPublish3dCmds\PublishTemplate2.cpp source file. The look of the output document is shown here. You also can download the output 3D PDF document.
PrcPublish3Dcase3 Creates a 3D .pdf document from a specified .prc file containing:
  • Carousel buttons control
  • Part list control
  • Property list control
A property list control allows interactive viewing of property values for a selected part of the assembly. The command is implemented with the PublishTemplate3() function that is defined in the Prc\Examples\OdPrcPublish3dCmds\PublishTemplate3.cpp source file. The look of the output document is shown here. You also can download the output 3D PDF document.
PrcPublish3Dcase4 Creates a 3D .pdf document that contains more than one page. Each page includes several 3D views. The command is implemented with the PublishTemplate4() function that is defined in the Prc\Examples\OdPrcPublish3dCmds\PublishTemplate4.cpp source file. The look of the output document is shown here. You also can download the output 3D PDF document.
PrcPublish3Dcase5 Creates a 3D .pdf document from a specified .prc file and illustrates how to add 2D geometry to a PDF page. The command is implemented with the PublishTemplate5() function that is defined in the Prc\Examples\OdPrcPublish3dCmds\PublishTemplate5.cpp source file. The look of the output document is shown here. You also can download the output 3D PDF document.
PrcPublish3Dcase6 Creates a 3D .pdf document from a specified .prc file with an animation of the 3D model. This animation is based on playing a JavaScript scenario that rotates camera according a specified timeout. Animation starts when the document is open or when the page with the model becomes active.
The command is implemented with the PublishTemplate6() function that is defined in the Prc\Examples\OdPrcPublish3dCmds\PublishTemplate6.cpp source file. The look of the output is shown here. You also can download the output 3D PDF document.
PrcPublish3Dcase7 Creates a 3D .pdf document from a .prc input file that contains an example of creating parametric ("orbit") animations. There is no need to specify an input file for this command because the sample creates a 3D model using its own code. The command is declared and defined in the OdPrcExCommands example. The command is implemented with the PublishTemplate7() function that is defined in the Prc\Examples\OdPrcPublish3dCmds\PublishTemplate7.cpp source file. The look of the output document is shown here. You also can download the output 3D PDF document.

The PrcPublish3dCmdsModule.h header file contains the definition of the command class that inherits the OdEdCommand class. In addition, this file contains the definition of the OdPrcPublish3dCmdsModule class that inherits the OdRxModule class.

The OdPrcPublish3dCmdsModule class encapsulates two methods:

  • initApp() method — Adds publish-related commands to the command stack.
  • uninitApp() method — Removes publish-related commands from the command stack.

The PublishExportCmds.cpp file defines functions for command execution:

  • _PrcPublish3Dcase1_func()
  • _PrcPublish3Dcase2_func()
  • _PrcPublish3Dcase3_func()
  • _PrcPublish3Dcase4_func()
  • _PrcPublish3Dcase5_func()
  • _PrcPublish3Dcase6_func()
  • _PrcPublish3Dcase7_func()

Each of these functions accepts a pointer to an OdEdCommandContext object that contains command context data.

In addition to the functions described above, the PublishExportCmds.cpp file contains the definition of the Publish3DCommon() function. This function loads ODA Publish SDK, prompts for the path to the input .prc file, prompts for the path to the output .pdf file, generates a set of preview images, and calls one of the functions that implement publishing. The first parameter of the Publish3DCommon() function provides the command context object; the second one determines the publishing mode. The function Publish3DCommon() runs one of the following functions depending on the publishMode parameter value:

  • PublishTemplate1()
  • PublishTemplate2()
  • PublishTemplate3()
  • PublishTemplate4()
  • PublishTemplate5()
  • PublishTemplate6()
  • PublishTemplate7()

These functions are declared in the PublishExportCmds.cpp file as well, but their definitions are placed in separated source code files: PublishTemplate1.cpp, PublishTemplate2.cpp, ..., PublishTemplate7.cpp.

The ExPrcCommandContext.cpp source code file contains the implementation of the ExPrcCommandContext class that implements functionality for working with commands specific to ODA PRC SDK examples.

ExPrcHostAppServices provides the ODA PRC SDK custom service class for platform-dependent functionality: progress meters, console output function, etc.

Using the OdPrcPublish3dCmds sample

To run any command from the OdPrcPublish3DCmds module:

  1. Start the OdaPrcApp sample application, then create a new file or open an existing one, which activates items on the Edit and Tools menus.

  2. Select Edit -> Registered Commands -> PRC Publish 3D to begin loading the OdPrcPublish3DCmds_*.tx module.

See Also

MFC Sample Viewer Application for ODA PRC SDK
ODA PRC SDK Sample Applications
Copyright © 2002 – 2022. Open Design Alliance. All rights reserved.