Samples

The following is a list of code samples available to HOOPS Publish developers. These samples are short applications that demonstrate a specific functional topic. The source code for each sample is distributed as part of the HOOPS Publish package. The sample sources are located at <publish_install_dir>/samples/publish/publishsource/. Before running each sample, you must first build it. Visual Studio project files are included. Pre-generated PDF files from these sample are distributed in the package in the package at <publish_install_dir>/samples/publish/publishgallery/Coding_Samples/.

If you’ve licensed HOOPS Publish Standard, you should load the publishstandard.sln solution. If you’ve licensed HOOPS Publish Advanced, you should load publishadvanced.sln solution.

HOOPS Publish Standard Samples

Samples Available in HOOPS Publish Advanced


In addition to the examples listed below, the HOOPS Publish package includes example 3D PDF files and example PDF templates that you can use in your own application.

PublishImportExport

samples/publish/publishsource/PublishImportExport

This sample demonstrates how to import and export a CAD file.


CreatePRCCubes

samples/publish/publishsource/CreatePRCCubes

This sample demonstrates how to create a PRC file with the Publish API. The only input is the output file path. The program generates a PRC file containing a tessellated textured cube that is instantiated multiple times. The generated output also contains PMIs and Views, as well as links between markups, Views, and entities.


HelloWorld

samples/publish/publishsource/HelloWorld

This sample creates a simple 3D PDF programmatically without using a template.


U3DWithAnimation

samples/publish/publishsource/U3DWithAnimation

Based on a supplied PDF template, this sample shows how to activate an animation in a U3D file with a button click in a PDF form.


UserDefinedViews

samples/publish/publishsource/UserDefinedViews

This sample demonstrates how to create and activate a simple view that changes camera when clicking on a button.


DemoFunctionalities

samples/publish/publishsource/DemoFunctionalities

This sample application demonstrates how to create a document with diffrent pages inserted from different sources. It also demonstrates the creation of tables on a PDF page. Warning: this sample needs the free add-on TableToPDF to be installed.


Samples Only Available in HOOPS Publish Advanced

manufacturing_mbe

/samples/publish/publishsource/manufacturing_mbe

Shows how to create a Technical Data Package. It works with 3D annotated models and demonstrates how to insert 3D elements, how to add a view carousel that activates annotation views, and how to attach files (such as STEP files) to create a TDP.

It also demonstrates how to link 2D and 3D content and update what’s displayed in some text fields when certain PMI are selected.


PDFWithBOMAndCarousel

samples/publish/publishsource/PDFWithBOMAndCarousel

Demonstrates how to create a scrolling table with 3D assemblies. The scrolling table represents a Bill of Materials. When a line is selected, the 3D part it’s linked to is highlighted. Conversely when a 3D node is selected in the scene, the table line it’s linked to is highlighted


DemoDataModel

samples/publish/publishsource/DemoDataModel

Demonstrates how to create a rich interactive PDF without using JavaScript. By pushing data into specific structures and binding data to the layout, rich interactive PDF can be created. Text fields, lists, and scrolling tables can typically be updated automatically depending on what’s been selected by the user.


AnimWorkInstruction

samples/publish/publishsource/AnimWorkinstruction

This sample creates an example Work Instruction from a PDF template by populating text fields and adding JavaScript to buttons to set the camera position and model entity states (visibility and transform) based on viewpoint states stored in the source PRC file.


DemoFunctionalitiesAdv

samples/publish/publishsource/DemoFunctionalitiesAdv

This sample application demonstrates miscellaneous functionalities for HOOPS Publish Advanced.


DemoLayers

samples/publish/publishsource/DemoLayers

This sample application demonstrates how to generate a PDF document with layers using HOOPS Publish.


Export3DToHtml

samples/publish/publishsource/Export3DToHtml

This sample application demonstrates how to export a 3D model to HTML using HOOPS Publish. The sample shows how to generate a single monolithic HTML file and also how to generate an SCS stream cache file to be used with an HTTP server. Note that a sample HTTP server is provided to demonstrate how to implement an SCS workflow. See the section Viewing 3D in the Browser in our Programming Guide for more details.


ExportPDFToHtml

samples/publish/publishsource/ExportPDFToHtml

This sample application demonstrates how to export an interactive 3D PDF to HTML using HOOPS Publish. The sample shows how to generate a root XML file with the associated resources (HTML, JavaScript …) to be used with an HTTP server. Note that a python script is given to generate files which can be consumed without HTTP server. See the section Viewing PDF in the Browser in our Programming Guide for more details.


UpdateData

samples/publish/publishsource/UpdateData

This sample application demonstrates how to update a PDF file generated with Tetra 4D Enrich, using HOOPS Publish. See the section Using Tetra 4D Enrich templates in our Programming Guide for more details.