// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-#include <XSAlgo_AlgoContainer.ixx>
-#include <Standard_ErrorHandler.hxx>
-#include <Standard_Failure.hxx>
-
-#include <Message_ListOfMsg.hxx>
-#include <Message_ListIteratorOfListOfMsg.hxx>
-
-#include <gp_Pnt.hxx>
-#include <gp_Pnt2d.hxx>
-#include <Geom_Curve.hxx>
-#include <Geom_Surface.hxx>
-#include <Geom2d_Curve.hxx>
-#include <TopoDS.hxx>
-#include <TopoDS_Vertex.hxx>
-#include <TopoDS_Iterator.hxx>
-#include <TopExp.hxx>
-#include <BRep_Tool.hxx>
#include <BRep_Builder.hxx>
+#include <BRep_Tool.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
-#include <TopTools_DataMapOfShapeShape.hxx>
-#include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
-
-#include <ShapeProcess.hxx>
-#include <ShapeProcess_ShapeContext.hxx>
+#include <Geom2d_Curve.hxx>
+#include <Geom_Curve.hxx>
+#include <Geom_Surface.hxx>
+#include <gp_Pnt.hxx>
+#include <gp_Pnt2d.hxx>
+#include <Interface_Static.hxx>
+#include <Message_ListIteratorOfListOfMsg.hxx>
+#include <Message_ListOfMsg.hxx>
+#include <Message_Msg.hxx>
+#include <Message_ProgressIndicator.hxx>
+#include <Resource_Manager.hxx>
#include <ShapeAlgo.hxx>
#include <ShapeAlgo_AlgoContainer.hxx>
#include <ShapeAlgo_ToolContainer.hxx>
+#include <ShapeAnalysis_Edge.hxx>
+#include <ShapeBuild_Edge.hxx>
#include <ShapeBuild_ReShape.hxx>
+#include <ShapeCustom.hxx>
#include <ShapeExtend_DataMapOfShapeListOfMsg.hxx>
#include <ShapeExtend_MsgRegistrator.hxx>
-#include <ShapeFix_Shape.hxx>
-#include <ShapeBuild_Edge.hxx>
-#include <ShapeAnalysis_Edge.hxx>
#include <ShapeFix_Edge.hxx>
-#include <UnitsMethods.hxx>
-#include <ShapeCustom.hxx>
-
+#include <ShapeFix_Shape.hxx>
+#include <ShapeProcess.hxx>
+#include <ShapeProcess_ShapeContext.hxx>
+#include <Standard_ErrorHandler.hxx>
+#include <Standard_Failure.hxx>
+#include <Standard_Transient.hxx>
+#include <Standard_Type.hxx>
+#include <TopExp.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Iterator.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
+#include <TopTools_DataMapOfShapeShape.hxx>
+#include <Transfer_FinderProcess.hxx>
+#include <Transfer_TransientListBinder.hxx>
+#include <Transfer_TransientProcess.hxx>
#include <TransferBRep.hxx>
-#include <TransferBRep_ShapeMapper.hxx>
#include <TransferBRep_ShapeBinder.hxx>
-#include <Transfer_TransientListBinder.hxx>
-#include <Resource_Manager.hxx>
-#include <Interface_Static.hxx>
-#include <Message_Msg.hxx>
+#include <TransferBRep_ShapeMapper.hxx>
+#include <UnitsMethods.hxx>
+#include <XSAlgo_AlgoContainer.hxx>
+#include <XSAlgo_ToolContainer.hxx>
+#include <TopExp_Explorer.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(XSAlgo_AlgoContainer,Standard_Transient)
//=======================================================================
//function : XSAlgo_AlgoContainer
//purpose :
//=======================================================================
-
XSAlgo_AlgoContainer::XSAlgo_AlgoContainer()
{
myTC = new XSAlgo_ToolContainer;
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;
if ( !progress.IsNull() )
context->SetProgress(progress);
}
+ context->SetNonManifold(NonManifold);
info = context;
Standard_CString seq = Interface_Static::CVal ( pseq );
TCollection_AsciiString str ( seq );
str += ".exec.op";
if ( ! rsc->Find ( str.ToCString() ) ) {
-#ifdef XSALGO_DEB
+#ifdef OCCT_DEBUG
{
static Standard_Integer time = 0;
if ( ! time )
time++;
}
#endif
- // if FromSTEP or FromIGES, do default ShapeFix
+ // if reading, do default ShapeFix
if ( ! strncmp ( pseq, "read.", 5 ) ) {
try {
OCC_CATCH_SIGNALS
context->SetResult ( S );
}
}
- catch (Standard_Failure) {
-#ifdef XSALGO_DEB
+ catch (Standard_Failure const& anException) {
+#ifdef OCCT_DEBUG
cout << "Error: XSAlgo_AlgoContainer::ProcessShape(): Exception in ShapeFix::Shape" << endl;
- Standard_Failure::Caught()->Print(cout); cout << endl;
+ anException.Print(cout); cout << endl;
#endif
- }
+ (void)anException;
+ }
return context->Result();
}
- // if ToSTEP or ToIGES, define sequence of DirectFaces
- else if ( ! strcmp ( pseq, "write.step.sequence" ) ) {
- rsc->SetResource ( str.ToCString(), "DirectFaces" );
- }
- else if ( ! strcmp ( pseq, "write.iges.sequence" ) ) {
+ // for writing, define default sequence of DirectFaces
+ else if ( ! strncmp ( pseq, "write.", 6 ) ) {
rsc->SetResource ( str.ToCString(), "DirectFaces" );
}
}
rsc->SetResource ( "Runtime.MaxTolerance", maxTol );
if ( !ShapeProcess::Perform(context, seq) )
- return TopoDS_Shape(); // Null shape
+ return shape; // return original shape
return context->Result();
}
}
}
catch (Standard_Failure) {
-#ifdef DEB
+#ifdef OCCT_DEBUG
cout << "Error: XSAlgo_AlgoContainer::PerformFixShape(): Exception in ShapeFix::Shape" << endl;
#endif
}
Standard_Real DV = Abs (PUV1.Y() - PUV2.Y());
if ( DU/8. > (UL/6. - UF/6.) || DV/8. > (VL/6. - VF/6.) ) {
ShapeBuild_Edge().RemovePCurve(E,face);
-#ifdef XSALGO_DEB
+#ifdef OCCT_DEBUG
cout<<"Removing pcuve periodic"<<endl;
#endif
return Standard_False;
if (!((Dist11 <= preci) && (Dist22 <= preci))) {
ShapeBuild_Edge().RemovePCurve(E,face);
-#ifdef XSALGO_DEB
+#ifdef OCCT_DEBUG
cout<<"Removing pcurve points"<<endl;
#endif
return Standard_False;
return;
Standard_Integer i = ( startTPitem >0 ? startTPitem : 1 );
- for ( ; i <= TP->NbMapped(); i++ ) {
+ for ( ; i <= TP->NbMapped(); i++ )
+ {
Handle(Transfer_Binder) bnd = TP->MapItem ( i );
Handle(TransferBRep_ShapeBinder) sb = Handle(TransferBRep_ShapeBinder)::DownCast ( bnd );
if ( sb.IsNull() || sb->Result().IsNull() ) continue;
-
+
TopoDS_Shape orig = sb->Result();
- if ( map.IsBound ( orig ) ) sb->SetResult ( map.Find ( orig ) );
+
+ if ( map.IsBound ( orig ) )
+ {
+ sb->SetResult ( map.Find ( orig ) );
+ }
else if ( !orig.Location().IsIdentity() )
{
TopLoc_Location aNullLoc;
TopoDS_Shape atmpSh = orig.Located(aNullLoc);
if ( map.IsBound ( atmpSh ) ) sb->SetResult ( map.Find ( atmpSh ) );
}
+ else
+ {
+ // Some of edges may be modified.
+ BRepTools_ReShape aReShape;
+ Standard_Boolean hasModifiedEdges = Standard_False;
+ TopExp_Explorer anExpSE(orig, TopAbs_EDGE);
+
+ // Remember modifications.
+ for( ; anExpSE.More() ; anExpSE.Next() )
+ {
+ if ( map.IsBound ( anExpSE.Current() ) )
+ {
+ hasModifiedEdges = Standard_True;
+ TopoDS_Shape aModifiedShape = map.Find( anExpSE.Current() );
+ aReShape.Replace(anExpSE.Current(), aModifiedShape);
+ }
+ }
+
+ // Apply modifications and store result in binder.
+ if (hasModifiedEdges)
+ {
+ TopoDS_Shape aRes = aReShape.Apply(orig);
+ sb->SetResult ( aRes );
+ }
+ }
+
// update messages
if ( ! msg.IsNull() ) {
else if ( TransientListBinder->NbTransients() > 1 ) {
resBinder->AddResult(TransientListBinder);
// resBinder->SetNext(TransientListBinder, Standard_True);
-#ifdef XSALGO_DEB
+#ifdef OCCT_DEBUG
cout<<"Info: TransientListBinder created for splitted shape"<<endl;
}
else {