Viewing and Interrogating 3D Models in the Browser
HOOPS Publish can be used to view and interrogate 3D models in a browser using standard web technologies without the help of any plug-ins.
This section addresses how to use the StreamCache file format to view files in a browser.
Client/Server Mode and Stream Cache
In client/server mode, you will start by exporting a stream cache single file (scs).
The SCS file will then be parsed and displayed in the browser by a client web viewer that we provide as part of HOOPS Publish. See the samples directory in the package download: samples\publish\publishhtml\htmlforserver.
To help test this functionality, we have provided a simple HTTP server that can be launched by clicking on samples\publish\publishhtml\htmlforserver\export3dtohtml\start_server.bat .
Once the server is launched, open the following URL in your browser:
hoops_web_viewer.html can load any SCS file; to change the file you’re viewing, simply change the query string “scs=helloworld.scs” in the URL with the new file name.
To generate an SCS file, use the
A3DExport data structure.
A3DRWParamsExportScsData can be used to include exact measurement information that will be re-used by the web viewer.
A3DStatus iRet = sHoopsExchangeLoader.Export(sExport);
Please note, hoops_web_viewer.html can be customized to include your own content or logo. If you need to further customize the 3D viewer component, you might consider using HOOPS Communicator or The HOOPS Web platform. Please contact us for more information.
Monolithic File and Stream Cache
One of the primary advantages of the monolithic file is that it can be used to share data without having to use an HTTP server. The downside is that much of the data embedded in the HTML file has to be sent for each 3D model to share. Also, this mode does not leverage the cache mechanism from the server.
The Monolithic HTML export works like any export functionality:
// specify output file
sExport.m_sExportHtmlData.m_bIncludeMeasurementInformation = false;
sExport.m_sExportHtmlData.m_pcHtmlTemplateName = IN_FILE_HTMLTEMPLATE;
// conversion is performed
iRet = sHoopsExchangeLoader.Convert(sImport, sExport);
A3DRWParamsExportHtmlData can be used to include information that will be used with the measurement tool in the web viewer.
A default template is included in the Publish package to export 3d model: samples\data\html\export3dtohtml_template.html. It can be used and referenced by the
You can use this HTML page to customize your own page - for instance, you can embed your own content, objects, logo, etc.
If you need more advanced customization of the 3D viewer component, you might consider using HOOPS Communicator or The HOOPS Web platform. Please contact us to learn more about these products.
Another template file (samples\data\html\export3dtohtml_template_custom.html.html) is given as an example of customization. If you wish to customize the 3D export to HTML, you could draw your inspiration from it.