#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>
#include <XSControl_Controller.hxx>
#include <XSControl_TransferWriter.hxx>
#include <XSControl_Utils.hxx>
+#include <ShapeUpgrade_RemoveLocations.hxx>
IMPLEMENT_STANDARD_RTTIEXT(XSControl_TransferWriter,Standard_Transient)
//=======================================================================
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
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 : ";
--- /dev/null
+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]