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

0028715: Invalid shape produced by reading of attached STEP file. Regression from OCCT-6.9.1 to OCCT-7.0.0.

Corrections: to use fixed shape as result in the non-manifold mode was made.

Regression was due to using modified initial shape as result in the previous version OCCT. At present initial shape is not modified during ShapeProcessing. Therefore modification to use fixed result was made.

Additionally using of nonManifold flag is added to ShapeProcessing.
This commit is contained in:
skl 2017-07-31 17:20:25 +03:00 committed by bugmaster
parent a2456ed88a
commit 2bc6f71528
11 changed files with 108 additions and 27 deletions

View File

@ -47,6 +47,7 @@
#include <StepDimTol_GeoTolAndGeoTolWthDatRefAndModGeoTolAndPosTol.hxx>
#include <StepGeom_Axis2Placement3d.hxx>
#include <StepGeom_CartesianTransformationOperator3d.hxx>
#include <StepGeom_Direction.hxx>
#include <StepGeom_GeometricRepresentationContextAndGlobalUnitAssignedContext.hxx>
#include <StepGeom_GeometricRepresentationItem.hxx>
#include <StepGeom_GeomRepContextAndGlobUnitAssCtxAndGlobUncertaintyAssCtx.hxx>
@ -826,15 +827,27 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han
// [BEGIN] Proceed with non-manifold topology (ssv; 12.11.2010)
if (!isManifold) {
Handle(Standard_Transient) info;
// IMPORTANT: any fixing on non-manifold topology must be done after the shape is transferred from STEP
TopoDS_Shape fixedResult =
XSAlgo::AlgoContainer()->ProcessShape( comp, myPrecision, myMaxTol,
"read.step.resource.name",
"read.step.sequence", info,
TP->GetProgress() );
TP->GetProgress(), Standard_True);
XSAlgo::AlgoContainer()->MergeTransferInfo(TP, info, nbTPitems);
if (fixedResult.ShapeType() == TopAbs_COMPOUND)
{
comp = TopoDS::Compound(fixedResult);
}
else
{
comp.Nullify();
B.MakeCompound(comp);
B.Add(comp, fixedResult);
}
BRep_Builder brepBuilder;
// [BEGIN] Try to close OPEN Shells in I-DEAS case (ssv; 17.11.2010)
@ -874,10 +887,10 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han
// [BEGIN] Reconstruct Solids from Closed Shells (ssv; 15.11.2010)
TopoDS_Compound reconstComp;
brepBuilder.MakeCompound(reconstComp);
TopoDS_Iterator it(comp);
for ( ; it.More(); it.Next() ) {
TopoDS_Shape aSubShape = it.Value();
TopExp_Explorer exp(comp, TopAbs_SHELL);
for (; exp.More(); exp.Next())
{
TopoDS_Shape aSubShape = exp.Current();
if (aSubShape.ShapeType() == TopAbs_SHELL && aSubShape.Closed()) {
TopoDS_Solid nextSolid;
brepBuilder.MakeSolid(nextSolid);
@ -887,7 +900,6 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han
else if (aSubShape.ShapeType() == TopAbs_SHELL)
brepBuilder.Add(reconstComp, aSubShape);
}
comp = reconstComp;
// [END] Reconstruct Solids from Closed Shells (ssv; 15.11.2010)
}
@ -896,6 +908,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han
if (nsh == 0) shbinder.Nullify();
else if (nsh == 1) shbinder = new TransferBRep_ShapeBinder (OneResult);
else shbinder = new TransferBRep_ShapeBinder (comp);
PrepareUnits ( oldSRContext, TP ); //:S4136
TP->Bind(sr, shbinder);

View File

@ -243,6 +243,7 @@ Standard_Boolean ShapeFix_Shape::Perform(const Handle(Message_ProgressIndicator)
aPSentry.Next();
myResult = Context()->Apply(S);
if ( NeedFix(myFixSameParameterMode) )
{
SameParameter(myResult, Standard_False, theProgress);
@ -269,6 +270,7 @@ Standard_Boolean ShapeFix_Shape::Perform(const Handle(Message_ProgressIndicator)
}
}
}
myResult = Context()->Apply(myResult);
if ( !fft.IsNull() )

View File

@ -70,6 +70,7 @@ ShapeFix_Shell::ShapeFix_Shell()
myFixOrientationMode = -1;
myFixFace = new ShapeFix_Face;
myNbShells =0;
myNonManifold = Standard_False;
}
//=======================================================================
@ -84,6 +85,7 @@ ShapeFix_Shell::ShapeFix_Shell(const TopoDS_Shell& shape)
myFixOrientationMode = -1;
myFixFace = new ShapeFix_Face;
Init(shape);
myNonManifold = Standard_False;
}
//=======================================================================
@ -138,9 +140,10 @@ Standard_Boolean ShapeFix_Shell::Perform(const Handle(Message_ProgressIndicator)
if ( !aPSentry.More() )
return Standard_False;
}
TopoDS_Shape newsh = Context()->Apply(myShell);
if ( NeedFix ( myFixOrientationMode) )
FixFaceOrientation(TopoDS::Shell(newsh));
FixFaceOrientation(TopoDS::Shell(newsh), Standard_True, myNonManifold);
TopoDS_Shape aNewsh = Context()->Apply (newsh);
ShapeAnalysis_Shell aSas;
@ -853,7 +856,10 @@ static void CreateClosedShell(TopTools_SequenceOfShape& OpenShells,
// purpose :
//=======================================================================
Standard_Boolean ShapeFix_Shell::FixFaceOrientation(const TopoDS_Shell& shell,const Standard_Boolean isAccountMultiConex,const Standard_Boolean NonManifold)
Standard_Boolean ShapeFix_Shell::FixFaceOrientation(
const TopoDS_Shell& shell,
const Standard_Boolean isAccountMultiConex,
const Standard_Boolean NonManifold)
{
//myStatus = ShapeExtend::EncodeStatus (ShapeExtend_OK);
Standard_Boolean done = Standard_False;
@ -1101,6 +1107,7 @@ void ShapeFix_Shell::SetMaxTolerance (const Standard_Real maxtol)
ShapeFix_Root::SetMaxTolerance ( maxtol );
myFixFace->SetMaxTolerance ( maxtol );
}
//=======================================================================
//function : NbShells
//purpose :
@ -1110,3 +1117,13 @@ Standard_Integer ShapeFix_Shell::NbShells() const
{
return myNbShells;
}
//=======================================================================
//function : SetNonManifoldFlag
//purpose :
//=======================================================================
void ShapeFix_Shell::SetNonManifoldFlag(const Standard_Boolean isNonManifold)
{
myNonManifold = isNonManifold;
}

View File

@ -73,7 +73,10 @@ public:
//! If this mode is equal to Standard_True one non-manifold will be created from shell
//! contains multishared edges. Else if this mode is equal to Standard_False only
//! manifold shells will be created. By default - Standard_False.
Standard_EXPORT Standard_Boolean FixFaceOrientation (const TopoDS_Shell& shell, const Standard_Boolean isAccountMultiConex = Standard_True, const Standard_Boolean NonManifold = Standard_False);
Standard_EXPORT Standard_Boolean FixFaceOrientation (
const TopoDS_Shell& shell,
const Standard_Boolean isAccountMultiConex = Standard_True,
const Standard_Boolean NonManifold = Standard_False);
//! Returns fixed shell (or subset of oriented faces).
Standard_EXPORT TopoDS_Shell Shell();
@ -114,7 +117,8 @@ public:
//! FixFaceOrientation, by default True.
Standard_Integer& FixOrientationMode();
//! Sets NonManifold flag
Standard_EXPORT virtual void SetNonManifoldFlag(const Standard_Boolean isNonManifold);
DEFINE_STANDARD_RTTIEXT(ShapeFix_Shell,ShapeFix_Root)
@ -129,7 +133,7 @@ protected:
Standard_Integer myFixFaceMode;
Standard_Integer myFixOrientationMode;
Standard_Integer myNbShells;
Standard_Boolean myNonManifold;
private:

View File

@ -716,6 +716,7 @@ static Standard_Boolean fixshape (const Handle(ShapeProcess_Context)& context)
sfs->FixSolidTool()->CreateOpenSolidMode() = ctx->BooleanVal ( "CreateOpenSolidMode", Standard_True );
sfs->FixShellTool()->FixFaceMode() = ctx->IntegerVal ( "FixFaceMode", -1 );
sfs->FixShellTool()->SetNonManifoldFlag(ctx->IsNonManifold());
sfs->FixShellTool()->FixOrientationMode() = ctx->IntegerVal("FixFaceOrientationMode", -1);
//parameters for ShapeFix_Face

View File

@ -38,7 +38,8 @@ IMPLEMENT_STANDARD_RTTIEXT(ShapeProcess_ShapeContext,ShapeProcess_Context)
//=======================================================================
ShapeProcess_ShapeContext::ShapeProcess_ShapeContext (const Standard_CString file,
const Standard_CString seq)
: ShapeProcess_Context ( file, seq ), myUntil(TopAbs_FACE)
: ShapeProcess_Context ( file, seq ), myUntil(TopAbs_FACE),
myNonManifold(Standard_False)
{
}
@ -50,7 +51,8 @@ ShapeProcess_ShapeContext::ShapeProcess_ShapeContext (const Standard_CString fil
ShapeProcess_ShapeContext::ShapeProcess_ShapeContext (const TopoDS_Shape &S,
const Standard_CString file,
const Standard_CString seq)
: ShapeProcess_Context ( file, seq ), myUntil(TopAbs_FACE)
: ShapeProcess_Context ( file, seq ), myUntil(TopAbs_FACE),
myNonManifold(Standard_False)
{
Init ( S );
}

View File

@ -126,7 +126,17 @@ public:
//! Prints statistics on Shape Processing onto the current Messenger.
Standard_EXPORT void PrintStatistics() const;
//! Set NonManifold flag
Standard_EXPORT void SetNonManifold(Standard_Boolean theNonManifold)
{
myNonManifold = theNonManifold;
}
//! Get NonManifold flag
Standard_EXPORT Standard_Boolean IsNonManifold()
{
return myNonManifold;
}
DEFINE_STANDARD_RTTIEXT(ShapeProcess_ShapeContext,ShapeProcess_Context)
@ -144,7 +154,7 @@ private:
TopTools_DataMapOfShapeShape myMap;
Handle(ShapeExtend_MsgRegistrator) myMsg;
TopAbs_ShapeEnum myUntil;
Standard_Boolean myNonManifold;
};

View File

@ -97,7 +97,8 @@ TopoDS_Shape XSAlgo_AlgoContainer::ProcessShape (const TopoDS_Shape& shape,
const Standard_CString prscfile,
const Standard_CString pseq,
Handle(Standard_Transient)& info,
const Handle(Message_ProgressIndicator)& progress) const
const Handle(Message_ProgressIndicator)& progress,
const Standard_Boolean NonManifold) const
{
if ( shape.IsNull() ) return shape;
@ -112,6 +113,7 @@ TopoDS_Shape XSAlgo_AlgoContainer::ProcessShape (const TopoDS_Shape& shape,
if ( !progress.IsNull() )
context->SetProgress(progress);
}
context->SetNonManifold(NonManifold);
info = context;
Standard_CString seq = Interface_Static::CVal ( pseq );

View File

@ -63,7 +63,11 @@ public:
//! This information should be later transmitted to
//! MergeTransferInfo in order to be recorded in the
//! translation map
Standard_EXPORT virtual TopoDS_Shape ProcessShape (const TopoDS_Shape& shape, const Standard_Real Prec, const Standard_Real MaxTol, const Standard_CString rscfile, const Standard_CString seq, Handle(Standard_Transient)& info, const Handle(Message_ProgressIndicator)& progress = 0) const;
Standard_EXPORT virtual TopoDS_Shape ProcessShape (
const TopoDS_Shape& shape, const Standard_Real Prec, const Standard_Real MaxTol,
const Standard_CString rscfile, const Standard_CString seq, Handle(Standard_Transient)& info,
const Handle(Message_ProgressIndicator)& progress = 0,
const Standard_Boolean NonManifold = Standard_False) const;
//! Checks quality of pcurve of the edge on the given face,
//! and corrects it if necessary.

View File

@ -16,7 +16,7 @@ stepwrite 0 a $imagedir/bug27329_temp.stp
stepread $imagedir/bug27329_temp.stp b *
renamevar b_1 result
checknbshapes result -solid 3 -shell 3 -face 42
checknbshapes result -solid 1 -shell 5 -face 42
param write.step.nonmanifold 0
param read.step.nonmanifold 0

26
tests/bugs/step/bug28715 Normal file
View File

@ -0,0 +1,26 @@
puts "========"
puts "OCC28715"
puts "========"
puts ""
##########################################################################
# Invalid shape after import STeP file
##########################################################################
stepread [locate_data_file bug28715_Ailette_mm.stp] a *
checkshape a_1
set nbshapes_expected "
Number of shapes in shape
VERTEX : 487
EDGE : 794
WIRE : 313
FACE : 313
SHELL : 3
SOLID : 0
COMPSOLID : 0
COMPOUND : 1
SHAPE : 1911
"
checknbshapes a_1 -ref ${nbshapes_expected} -t -m "importing file"
checkview -display a_1 -3d -path ${imagedir}/${test_image}.png