#include <Handle_Geom_Line.hxx>
#include <Handle_Geom_TrimmedCurve.hxx>
#include <Geom_TrimmedCurve.hxx>
+#include <NCollection_Sequence.hxx>
#include <QFile>
const TopoDS_Shape& aMergedShape = anAlgo.Shape();
- BRep_Builder aBuilder;
+ BRep_Builder BB;
TopoDS_Shell aShell;
- aBuilder.MakeShell( aShell );
+ BB.MakeShell( aShell );
aShell.Closed( Standard_False );
- TopExp_Explorer anExplorer( aMergedShape, TopAbs_FACE );
- for( ; anExplorer.More(); anExplorer.Next() )
+
+ NCollection_Sequence<TopoDS_Shape> aSeqSh;
+
+ anIt.Initialize(theFaces);
+ bool EmptySh = true;
+ for( ; anIt.More(); anIt.Next() )
{
- const TopoDS_Face& aFace = TopoDS::Face(anExplorer.Current());
- if( aFace.IsNull() )
- continue;
- if( aFace.ShapeType() == TopAbs_FACE )
+ TopoDS_Face F = TopoDS::Face(anIt.Value());
+ TopTools_ListOfShape aLSG = anAlgo.Modified(F);
+ if (aLSG.IsEmpty())
+ aSeqSh.Append (F);
+ else
{
- aBuilder.Add( aShell, aFace );
- aShell.Closed( Standard_False );
+ EmptySh = false;
+ TopTools_ListIteratorOfListOfShape It(aLSG);
+ for (;It.More(); It.Next())
+ BB.Add(aShell, It.Value());
}
}
- TopoDS_Shape aResult;
+ TopoDS_Shape ShellR;
if( IsToUnify )
{
ShapeUpgrade_UnifySameDomain aUSD;
aUSD.Initialize( aShell );
aUSD.Build();
- aResult = aUSD.Shape();
+ ShellR = aUSD.Shape();
}
else
- aResult = aShell;
+ ShellR = aShell;
- anExplorer.Init( aResult, TopAbs_FACE );
+ TopExp_Explorer anExplorer;
+ anExplorer.Init( ShellR, TopAbs_FACE );
int n = 0;
TopoDS_Face anOneFace;
for( ; anExplorer.More(); anExplorer.Next(), n++ )
anOneFace = TopoDS::Face( anExplorer.Current() );
if (n == 1)
- aResult = anOneFace;
- else if (aResult.ShapeType() == TopAbs_SHELL)
+ ShellR = anOneFace;
+ else if (ShellR.ShapeType() == TopAbs_SHELL)
{
- BRepCheck_Shell aBCS(TopoDS::Shell(aResult));
+ BRepCheck_Shell aBCS(TopoDS::Shell(ShellR));
if (aBCS.Status().First() != BRepCheck_NoError)
{
ShapeFix_Shell aFixer;
- aFixer.FixFaceOrientation(TopoDS::Shell(aResult), 1);
- aResult = aFixer.Shape();
+ aFixer.FixFaceOrientation(TopoDS::Shell(ShellR), 1);
+ ShellR = aFixer.Shape();
}
}
+ if (!EmptySh)
+ aSeqSh.Append (ShellR);
+
+ TopoDS_Compound cmp;
+ BB.MakeCompound( cmp );
+
+ TopoDS_Shape aResult;
+
+ if (aSeqSh.Length() == 1)
+ aResult = aSeqSh.First();
+ else
+ {
+ for (int i = 1; i <= aSeqSh.Size(); i++)
+ BB.Add(cmp, aSeqSh(i));
+ aResult = cmp;
+ }
+
return aResult;
}