1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +03:00

0031617: Export STEP in nonmanifold mode corrupts the shape

This commit is contained in:
jgv 2020-07-20 17:38:22 +03:00 committed by jfa
parent bbb7f3fa94
commit 1d5cadffa7
2 changed files with 32 additions and 5 deletions

View File

@ -16,6 +16,7 @@
#include <Interface_CheckIterator.hxx>
#include <Interface_InterfaceModel.hxx>
#include <Interface_Macros.hxx>
#include <Interface_Static.hxx>
#include <Message_Messenger.hxx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
@ -29,6 +30,7 @@
#include <XSControl_Controller.hxx>
#include <XSControl_TransferWriter.hxx>
#include <XSControl_Utils.hxx>
#include <ShapeUpgrade_RemoveLocations.hxx>
IMPLEMENT_STANDARD_RTTIEXT(XSControl_TransferWriter,Standard_Transient)
@ -133,12 +135,22 @@ Standard_Boolean XSControl_TransferWriter::RecognizeShape (const TopoDS_Shape& s
//=======================================================================
IFSelect_ReturnStatus XSControl_TransferWriter::TransferWriteShape
(const Handle(Interface_InterfaceModel)& model,
const TopoDS_Shape& shape)
(const Handle(Interface_InterfaceModel)& theModel,
const TopoDS_Shape& theShape)
{
IFSelect_ReturnStatus status = IFSelect_RetVoid;
if (myController.IsNull()) return IFSelect_RetError;
if (model.IsNull()) return IFSelect_RetVoid;
if (theModel.IsNull()) return IFSelect_RetVoid;
TopoDS_Shape aShape = theShape;
Standard_Boolean isNMMode = Interface_Static::IVal("write.step.nonmanifold") != 0;
if (isNMMode)
{
ShapeUpgrade_RemoveLocations aRemLoc;
aRemLoc.SetRemoveLevel(TopAbs_COMPOUND);
aRemLoc.Remove(aShape);
aShape = aRemLoc.GetResult();
}
if (myTransferWriter.IsNull()) myTransferWriter = new Transfer_FinderProcess;
// effacer l actor : Controller s en charge
@ -149,10 +161,10 @@ IFSelect_ReturnStatus XSControl_TransferWriter::TransferWriteShape
try {
OCC_CATCH_SIGNALS
PrintStats(myTransferMode);
sout << "****** Transferring Shape, ShapeType = " << shape.ShapeType();
sout << "****** Transferring Shape, ShapeType = " << aShape.ShapeType();
sout<<" ******"<<Message_EndLine;
status = myController->TransferWriteShape
(shape,myTransferWriter,model,myTransferMode);
(aShape,myTransferWriter,theModel,myTransferMode);
}
catch(Standard_Failure const& anException) {
sout<<"**** **** TransferWriteShape, EXCEPTION : ";

15
tests/bugs/step/bug31617 Normal file
View File

@ -0,0 +1,15 @@
puts "============================================================"
puts "OCC31617: Export STEP in nonmanifold mode corrupts the shape"
puts "============================================================"
puts ""
brestore [locate_data_file bug31617.brep] a
param write.step.nonmanifold 1
testwritestep comp_nonmanifold.step a
testreadstep comp_nonmanifold.step result
checkshape result
checknbshapes result -ref [lrange [nbshapes a] 11 16]