I am currently using Open CASCADE Technology (OCCT) 7.5 to load a large STL model of approximately 1.9 GB.
After reading the file and displaying it using AIS_Shape, I experience severe performance issues during basic interactions such as model rotation, translation, and bounding box updates.
The viewer often freezes for several seconds even for simple transformations.
I would like to ask whether there are recommended best practices or optimization techniques in OCCT for handling very large STL meshes. In particular:
*Are there performance considerations when using AIS_Shape for large triangulated models?
*Are there preferred approaches such as MeshVS, AIS_Triangulation, or other visualization methods for large STL data?
*Are there recommended ways to manage Bnd_Box updates and transformations efficiently?
Any guidance on improving interactive performance with large mesh-based models would be greatly appreciated.
Discussion
3 archived replies
Posts are displayed in their archived order.
01Commenter-1
What is your current approach to read and display STL file?
STL file doesn't define B-Rep information, so the usual way is to display it as a mesh object in a CAD viewer:
// read STL
Handle(Poly_Triangulation) aTriangles = RWStl::ReadFile("myfile.stl");
// wrap it into a triangulation-only face for visualization
TopoDS_Face aFace;
BRep_Builder().MakeFace(aFace, aTriangles);
// display in the viewer
Handle(AIS_Shape) aPrs = new AIS_Shape(aFace);
theCtx->Display (aPrs, AIS_Shaded, 0, false);
...
02Author
Thank you for your reply!
I am currently using the approach you mentioned. However, to enable the selection of mesh endpoints, I ended up creating an additional MeshVS_Mesh object. While this works, it has significantly impacted the performance, making the application run much slower due to the overhead of managing multiple mesh representations.
Is there a more efficient way to enable vertex/endpoint selection directly on a single mesh object without duplicating it? I am looking for a solution that maintains high performance while allowing me to switch between object-level and vertex-level selection.
03Commenter-1
However, to enable the selection of mesh endpoints, I ended up creating an additional MeshVS_Mesh object.
MeshVS is a legacy component implementing display and selection facilities using mostly 'old-style' approaches; so that in the current state it doesn't scale well for large meshes.
What you are probably looking for is an approach used by AIS_PointCloud, which relies on Select3D_SensitivePrimitiveArray to pick points with much smaller overhead than MeshVS (in memory and in performance).
There is no similar class for triangulation yet. AIS_Triangulation doesn't implement selection at all, but you may use AIS_Triangulation::Compute() implementation as a code snippet for filling in Graphic3d_ArrayOfTriangles from Poly_Triangulation. Then you may passGraphic3d_ArrayOfTriangles to Select3D_SensitivePrimitiveArray::InitPoints() as AIS_PointCloud::ComputeSelection::() does or as Select3D_SensitivePrimitiveArray::InitTriangulation() to be able select triangles in addition to nodes.
Though you will have to dig a little bit further to understand the basic logic of AIS for visualization and selection (take also look to AIS tutorials).