Introduction
This post shares a sample project which implements HOOPS Exchange and Siemens Parasolid into HOOPS Visualize using HPS sprockets.
As you can see in the above video, this sample illustrates how you can develop a 3D modeling application using Parasolid with HOOPS Visualize and Exchange.
It covers all major 3D modeling functions such as solid model creation, editing, inquiry, deletion, import and export including body, face and edge entities mapping between HOOPS Visualize and Parasolid.
It will be a good sample for evaluation, benchmark and POC of your 3D modeling application development.
There are two approaches:
-
Using Exchange-Parasolid sprocket
This is a traditional approach explained in the following documentation:
Exchange-Parasolid — HOOPS Visualize HPS 2024 Documentation -
Using Exchange sprocket and Parasolid connector of Exchange
This approach uses Exchange sprockets and optionally uses Parasolid using the following Parasolid connector of HOOPS Exchange:
HOOPS Exchange for Parasolid Developers — HOOPS Exchange Documentation
Sample project
Download sample projects from the following Git repository:
Setup and Usage
Please refer README.MD
in the Git repository.
Tips
Source code comparison between sprockets
Same 3D modeling commands are implemented in the both projects. USING_EXCHANGE_PARASOLID
per-processer definition switches source code between Exchange-Parasolid and Exchange sprocket
i.e.) To update visualization after editing a solid body, HPS::Parasolid::Component::Tessallate
is used in Exchange-Parasolid sprocket, but HPS::Exchange::Component::Reload
is used in Exchange sprocket.
Parasolid commands
Parasolid commands are implemented in the PsProcess
class and commonly used by the both projects.
Exchange initialization
To use Exchange APIs, it needs to initialize Exchange separately.
Model import
Using Exchange-Parasolid Sprocket
If it imports 3D CAD file using HPS::ExchangeParasolid::ImportNotifier
, model structure from root to Representation Item
is managed as Exchange::Component
, but from body to leaf is managed using Parasolid::Component
.
It means that Exchange-Parasolid sprocket converts all imported bodies into Parasolid bodies while import process. It takes longer time than Exchange sprocket.
Using Exchange Sprocket
To solve the performance problem, the second approach uses HPS::Exchange::ImportNotifier
.
It manages model structure from root to leaves using
Exchange::Component
.
Exchange Parasolid connector
When the second approach needs to use Parasolid, getting A3DRiBrepModel
using HPS::Exchange::Component::GetExchangeEntity
and convert it to Parasolid body using A3DRepresentationItemTranslateToPkParts
.
After model editing, Parasolid body can be converted to A3DRiBrepModel
using A3DPkPartsTranslateToA3DAsmModelFile
and replaced in PRC.
You will see this workflow sample in ExPsProcess
class of the second sample.
Before it converts Parasolid body it doesn’t know Parasolid entity tag IDs. Once a body is converted to Parasolid, it is kept in Parasolid session and can be inquiries.
Exchange-Parasolid Sprocket vs Exchange Sprocket
The below video compares performance between Exchange-Parasolid sprocket and Exchange sprocket.
-
Import
Exchange-Parasolid sprocket: 7.4 sec
Exchange sprocket: 4 sec -
Editing (Delete Face)
Exchange-Parasolid sprocket: 4.8 sec, 4.7 sec
Exchange sprocket: 13 sec, 7.1 sec
If source data is Parasolid-based such as NX, SolidWorks or Solid Edge, it retrieves PK_BODY of 3D CAD file. Although this benchmark test uses NX part, Exchange-Parasolid sprocket takes 7.4 - 4 = 3.4 sec to retrieve PK_BODY. It is shorter than PRC to PK_BODY conversion: 13 - 7.1 = 5.9 sec of Exchange sprocket.
Since Exchange sprocket converts Parasolid body when it is needed, it takes longer time:13 sec.
From second time, Exchange sprocket performance: 7.1 sec is still slower than Exchange-Parasolid sprocket: 4.7 sec. This is because that Exchange sprocket needs to create A3DRiBrepBody
for visualization. Exchange-Parasolid sprocket directly tessellate PK_BODY
for visualization.