I am trying to load an stl file.

stl file. However, I cannot find the StlMesh_Mesh.hxx file and the StlMesh_MeshExplorer.hxx file in the installed opencascade. Where can I find the file?

john ko's picture

bool ImportSTL(const TCollection_AsciiString& theFileName)
{

StlAPI_Reader aReader;
TopoDS_Shape aShape;
Standard_Boolean isResult = aReader.Read(aShape, theFileName.ToCString());
if (!isResult)
{
return false;
}

myAISContext()->Display(new AIS_Shape(aShape), Standard_True);

return true;
}

john ko's picture

The StlMesh_Mesh.hxx file is no longer required.

言 诺's picture

//myAISContext()->Display(new AIS_Shape(aShape), Standard_True);
new AIS_Shape(aShape) should be Handle?

Dmitrii Pasukhin's picture

Hello, please check the next link:https://dev.opencascade.org/doc/overview/html/occt_user_guides__visualiz...

Yes, it should.

Best regards, Dmitrii.

Ivan P's picture

> new AIS_Shape(aShape)
Seems like leaked pointer. Unless it's some smart pointer structure

Dmitrii Pasukhin's picture

You are right. There are not any leak, it is a smart pointer creating.

Handle - OCCT smart pointer. Moreover it is a macros, the own smart pointer type is "opencascade::handle". But it has a little different from std::shared_pointer or other std smart pointeres. It it the same with boost::intrusive_ptr

Best regards, Dmitrii.