mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0025357: STL writer does not check the given shape for existing triangulation and remeshes shape using BRepMesh in force mode.
StlTransfer.cxx, function StlTransfer::BuildIncrementalMesh(...) fills the StlMesh_Mesh. Before this fix the StlTransfer always force meshing of the passed shape. Now meshing is completely removed from the StlTransfer. StlWriter can return error status now, for example, if a mesh of the passed shape is empty. In this case file will be not created. Added test case bugs/xde/bug25357 Avoid the warning on gcc compiler. Test scripts were modified according to the fix. 1) bug23192, bug22670, bug23193: removed "isParallel" flag from the command arguments. Manually meshing of the shape (as far as meshing was removed from STL writer). 2) bug22898: before the fix writestl always remeshes the shape with a deflection, related to the boundery box of the shape. For "hammer" shape there is a 38.9076 deflection for mesh. Differences between before writing and after reading are dedicated to fact that stl writes triangulation as an elements of the spahe (like faces, edges etc.)
This commit is contained in:
@@ -92,21 +92,25 @@ extern Standard_Boolean VDisplayAISObject (const TCollection_AsciiString& theNam
|
||||
static Standard_Integer writestl
|
||||
(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
|
||||
{
|
||||
if (argc < 3 || argc > 5) {
|
||||
if (argc < 3 || argc > 4) {
|
||||
di << "Use: " << argv[0]
|
||||
<< " shape file [ascii/binary (0/1) : 1 by default] [InParallel (0/1) : 0 by default]" << "\n";
|
||||
<< " shape file [ascii/binary (0/1) : 1 by default]" << "\n";
|
||||
} else {
|
||||
TopoDS_Shape aShape = DBRep::Get(argv[1]);
|
||||
Standard_Boolean isASCIIMode = Standard_False;
|
||||
Standard_Boolean isInParallel = Standard_False;
|
||||
if (argc > 3) {
|
||||
if (argc == 4) {
|
||||
isASCIIMode = (Draw::Atoi(argv[3]) == 0);
|
||||
if (argc > 4)
|
||||
isInParallel = (Draw::Atoi(argv[4]) == 1);
|
||||
}
|
||||
StlAPI_Writer aWriter;
|
||||
aWriter.ASCIIMode() = isASCIIMode;
|
||||
aWriter.Write (aShape, argv[2], isInParallel);
|
||||
StlAPI_ErrorStatus aStatus = aWriter.Write (aShape, argv[2]);
|
||||
|
||||
switch (aStatus)
|
||||
{
|
||||
case StlAPI_MeshIsEmpty: di << "** Error **: Mesh is empty. Please, compute triangulation before."; break;
|
||||
case StlAPI_CannotOpenFile: di << "** Error **: Cannot create/open a file with the passed name."; break;
|
||||
case StlAPI_StatusOK: default: break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user