For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

Problem with StlAPI_Writer in OCC 7.0.0

Anatoly Vivchar's picture
Forums: 

How to fix problem with StlAPI_Writer in OCC 7.0.0 ?

Version 6.8.0 worked perfect for code

void  shape_write_stl ( const TopoDS_Shape& s, Standard_CString filepath )
{
    StlAPI_Writer writer;
    StlAPI_ErrorStatus Error = writer.Write( s, filepath );

......
}

But version 7.0.0 saving text in stl file "STL binary file, created with Open CASCADE Technology" or "solid shape, STL ascii file, created with Open CASCADE Technology endsolid shape" AND THAT'S ALL! No any problems with TopoDS_Shape cause worked for same shapes in 6.8.0... Also writer.Write returns result StlAPI_StatusOK 

HOW TO FIX THIS BUG ?

Forum supervisor's picture

Since version 6.9.0, STL writer relies on triangulation stored in the shape for exporting STL data (see Release Notes of OCCT 6.9.0, issue 25357).
This allows better control over  the quality of the triangulation (in previous versions shape was triangulated by STL writer internally).
Use BRepMesh_IncrementalMesh to build triangulation before calling StlAPI_Writer.

FSR

Anatoly Vivchar's picture

Added lines 

BRepMesh_IncrementalMesh Mesh( s, 0.01 );

Mesh.Perform();

before writer.Write...

All works. Thank You!!!

Ravi Chandra Moturi's picture

As suggested above I had used BRepMesh_IncrementalMesh() before calling StlAPI_Writer.But the code is exiting saying segmentation fault.Further debugging shown me its causing in the line StlAPI_Writer.Write().

Opencascade version used is 7.0.0

Could you suggest a fix.