Introduction
As you can see in the above demo video, this sample illustrates how to create an interactive 3D model Web viewer from uploading a CAD file to visualization.
Server side loads a CAD file using HOOPS Exchange and exports SC model using libconverter of HOOPS Communicator. By using Exchange and libconverter separately instead of HC Converter, import options and advanced features of Exchange which are not supported by Converter can be used.
Furthermore, by keeping imported model with Exchange in a server-side, Exchange APIs can be called from client side interactively.
Sample project
Download sample projects from the following Git repository:
Setup and Usage
Please refer README.MD
in the Git repository.
Operation flow
-
Select a CAD file and upload
CAD file is updated to server side using POST request and imported using HOOPS Exchange
-
HOOPE Exchange traverses imported model to count each entity number and then export to SC
You will see that all faces are imported as separate bodies
-
Import the CAD file again with sewing options
Individual faces are merged into one body
-
Exchange also check whether each body is closed and set it as an attribute of node
This body is still open (surface body)
-
Import the CAD file again changing the sewing tolerance
-
A solid body imported properly
Exchange also computes surface area of each face and set it as an attribute of face
-
This sample can ask each face type (plane, cylinder, cone, etc.) for server side since Exchange is still keeping the ModelFile
There are many NURBS faces
-
Ask face type again with simplify
Some analytic face types (torus, sphere) are detected
-
Ask face type again changing tolerance
Entity types should be gotten dynamically since simplify and tolerance affect (It shouldn’t be set as a constant attribute)
-
Ask each edge type without simplify
All edge types become NURBS due to sewing with large tolerance
-
Analytic curves can be detected using simplify and tolerance
-
Now it is ready to estimate manufacturing cost of this part
Round holes cam be recognized properly
For 3D model viewer, healing and getting proper geometry information are important in various industries
Structure diagram
In this sample, SDKs, modules and classes are configured like below image.
Tips
libmicrohtttpd
This sample uses a free software: GNU libmicrohttpd to handle POST requests in server side and returns responses.
In fact, main.cpp is developed based on their largepost.c
Entity mapping between Exchange and Communicator
This sample can add each face and edge traversed (index) number as attribute.
However, you can see that the attribute is same with face and line ID of Communicator.
In fact this attribute isn’t used in this sample since face and edge indexes become same between Exchange ModelFile and SC model.
Body index should be set as an attribute to identify.