Back to index

salome-geom  6.5.0
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes
ShHealOper_Sewing Class Reference

Class ShHealOper_Sewing. More...

#include <ShHealOper_Sewing.hxx>

Inheritance diagram for ShHealOper_Sewing:
Inheritance graph
Collaboration diagram for ShHealOper_Sewing:
Collaboration graph

List of all members.

Public Member Functions

Standard_EXPORT ShHealOper_Sewing ()
Standard_EXPORT ShHealOper_Sewing (const TopoDS_Shape &theShape, const Standard_Real theTolerance)
virtual Standard_EXPORT void Init (const TopoDS_Shape &theShape)
Standard_EXPORT Standard_Boolean Perform ()
Standard_EXPORT Standard_Boolean Perform (const TopTools_SequenceOfShape &theSeqShapes)
void SetFacesMode (const Standard_Boolean theFacesMode)
Standard_Boolean GetFacesMode ()
void SetFloatingEdgesMode (const Standard_Boolean theEdgesMode)
Standard_Boolean GetFloatingEdgesMode ()
void SetNonManifoldMode (const Standard_Boolean theNonManifoldMode)
Standard_Boolean GetNonManifoldMode ()
void SetTolerance (const Standard_Real theToler)
Standard_Real GetTolerance ()
void SetHistoryLevel (TopAbs_ShapeEnum theHistLevel)
TopAbs_ShapeEnum GetHistoryLevel ()
const TopoDS_Shape & GetResultShape () const
Standard_Boolean GetModifiedShape (const TopoDS_Shape &theOldShape, TopoDS_Shape &theNewShape) const
Standard_Boolean IsDone () const
void SetContext (Handle(ShapeBuild_ReShape)&theContext)
 Handle (ShapeBuild_ReShape) Context()
Standard_Integer GetErrorStatus ()

Protected Member Functions

 Handle (ShapeBuild_ReShape) myContext

Protected Attributes

TopoDS_Shape myInitShape
TopoDS_Shape myResultShape
Standard_Boolean myDone
ShHealOper_Error myErrorStatus

Private Member Functions

Standard_Boolean sewing (const TopTools_SequenceOfShape &theSeqShapes)
Standard_Boolean getShells (const TopoDS_Shape &theSewShape) const
Standard_Boolean getWires (const TopoDS_Shape &theSewShape) const
Standard_Boolean getModifications (const TopoDS_Shape &theShape, const Handle(BRepBuilderAPI_Sewing)&theSewing) const
Standard_Boolean isSewed (const TopoDS_Shape &theShape) const
void deleteFreeEdges (const TopoDS_Shape &theSewShape, TopTools_MapOfShape &theMapEdges, TopoDS_Compound &theNewComp) const

Private Attributes

Standard_Boolean myNonManifoldMode
Standard_Boolean myEdgesMode
Standard_Boolean myFacesMode
Standard_Real myTolerance
TopAbs_ShapeEnum myHistoryLevel

Detailed Description

Class ShHealOper_Sewing.

Definition at line 42 of file ShHealOper_Sewing.hxx.

Constructor & Destructor Documentation

Definition at line 48 of file ShHealOper_Sewing.hxx.

ShHealOper_Sewing::ShHealOper_Sewing ( const TopoDS_Shape &  theShape,
const Standard_Real  theTolerance 

Definition at line 46 of file ShHealOper_Sewing.cxx.

  myTolerance = theTolerance;

Here is the call graph for this function:

Member Function Documentation

void ShHealOper_Sewing::deleteFreeEdges ( const TopoDS_Shape &  theSewShape,
TopTools_MapOfShape &  theMapEdges,
TopoDS_Compound &  theNewComp 
) const [private]

Definition at line 265 of file ShHealOper_Sewing.cxx.

  BRep_Builder aB;
  TopoDS_Iterator aIt(theSewShape);
  for( ; aIt.More(); aIt.Next()) {
    if((aIt.Value().ShapeType() == TopAbs_EDGE ) && theMapEdges.Contains(aIt.Value()))
    else if(aIt.Value().ShapeType() == TopAbs_COMPOUND) {
      TopoDS_Compound aC;

Here is the caller graph for this function:

Standard_Integer ShHealOper_Tool::GetErrorStatus ( ) [inline, inherited]

Definition at line 90 of file ShHealOper_Tool.hxx.

    return myErrorStatus;

Here is the caller graph for this function:

Standard_Boolean ShHealOper_Sewing::GetFacesMode ( ) [inline]

Definition at line 70 of file ShHealOper_Sewing.hxx.

    return myFacesMode;
Standard_Boolean ShHealOper_Sewing::GetFloatingEdgesMode ( ) [inline]

Definition at line 82 of file ShHealOper_Sewing.hxx.

    return myEdgesMode;
TopAbs_ShapeEnum ShHealOper_Sewing::GetHistoryLevel ( ) [inline]

Definition at line 118 of file ShHealOper_Sewing.hxx.

    return myHistoryLevel;
Standard_Boolean ShHealOper_Sewing::getModifications ( const TopoDS_Shape &  theShape,
const Handle(BRepBuilderAPI_Sewing)&  theSewing 
) const [private]

Definition at line 226 of file ShHealOper_Sewing.cxx.

  if((Standard_Integer)theShape.ShapeType() > (Standard_Integer)myHistoryLevel)
    return Standard_False;
  Standard_Boolean isDone = theSewing->IsModifiedSubShape(theShape);
  if(isDone) {
    TopoDS_Shape aNewShape = theSewing->ModifiedSubShape(theShape);
  TopoDS_Iterator aIt(theShape);
  for( ; aIt.More(); aIt.Next()) {
    isDone = (getModifications( aIt.Value(),theSewing) || isDone);
  return isDone;

Here is the caller graph for this function:

Standard_Boolean ShHealOper_Tool::GetModifiedShape ( const TopoDS_Shape &  theOldShape,
TopoDS_Shape &  theNewShape 
) const [inline, inherited]

Definition at line 64 of file ShHealOper_Tool.hxx.

    theNewShape = myContext->Apply(theOldShape);
    return (!theNewShape.IsSame(theOldShape));
Standard_Boolean ShHealOper_Sewing::GetNonManifoldMode ( ) [inline]

Definition at line 94 of file ShHealOper_Sewing.hxx.

    return myNonManifoldMode;
const TopoDS_Shape& ShHealOper_Tool::GetResultShape ( ) const [inline, inherited]

Definition at line 57 of file ShHealOper_Tool.hxx.

    return myResultShape;


Here is the caller graph for this function:

Standard_Boolean ShHealOper_Sewing::getShells ( const TopoDS_Shape &  theSewShape) const [private]

Definition at line 146 of file ShHealOper_Sewing.cxx.

  Standard_Boolean isDone = Standard_False;
  TopoDS_Shape aTmpShape = theSewShape;
  if(myNonManifoldMode) {
    TopoDS_Shell tempShell;
    BRep_Builder aB;
    for(TopExp_Explorer aExpf(theSewShape,TopAbs_FACE);aExpf.More(); aExpf.Next()) 
    aTmpShape = tempShell;
  Handle(ShapeFix_Shell) asfs = new ShapeFix_Shell;
  TopExp_Explorer aexpShell(aTmpShape,TopAbs_SHELL);
  for ( ; aexpShell.More(); aexpShell.Next()) 
    isDone = (asfs->FixFaceOrientation(TopoDS::Shell(aexpShell.Current()),
                                       Standard_True,myNonManifoldMode) || isDone);
  return isDone;

Here is the call graph for this function:

Here is the caller graph for this function:

Standard_Real ShHealOper_Sewing::GetTolerance ( ) [inline]

Definition at line 106 of file ShHealOper_Sewing.hxx.

    return myTolerance;
Standard_Boolean ShHealOper_Sewing::getWires ( const TopoDS_Shape &  theSewShape) const [private]

Definition at line 175 of file ShHealOper_Sewing.cxx.

  if(theSewShape.ShapeType() != TopAbs_COMPOUND)
    return Standard_False;
  Handle(TopTools_HSequenceOfShape) aSeqEdges = new TopTools_HSequenceOfShape;
  TopExp_Explorer aexpEdges(theSewShape,TopAbs_EDGE,TopAbs_WIRE);
  for ( ; aexpEdges.More(); aexpEdges.Next()) {
  if(aSeqEdges->Length() <2)
    return Standard_False;
  //get manifold wires from sewed edges.
  Standard_Real aTol = 0.;
  Standard_Boolean aShared = Standard_True;
  Handle(TopTools_HSequenceOfShape) aTmpWires = new TopTools_HSequenceOfShape;
  ShapeAnalysis_FreeBounds::ConnectEdgesToWires(aSeqEdges, aTol, aShared, aTmpWires);

  TopTools_MapOfShape aMapEdges;
  Standard_Integer i =1;
  for( ; i <= aSeqEdges->Length(); i++)
  //remove free edges from result shape.
  TopoDS_Compound aNewComp;
  //add new wires in the result shape.
  BRep_Builder aB;
  for( i =1; i <= aTmpWires->Length(); i++) {
    TopoDS_Iterator aite(aTmpWires->Value(i));
    Standard_Integer nbe =0;
    TopoDS_Shape aE;
    for( ; aite.More() && nbe < 3; aite.Next(),nbe++)
      aE = aite.Value();
    else if(nbe ==1)
  return Standard_True;

Here is the call graph for this function:

Here is the caller graph for this function:

ShHealOper_Tool::Handle ( ShapeBuild_ReShape  ) [inline, inherited]

Definition at line 84 of file ShHealOper_Tool.hxx.

    return myContext;

Here is the caller graph for this function:

ShHealOper_Tool::Handle ( ShapeBuild_ReShape  ) [protected, inherited]
void ShHealOper_Sewing::Init ( const TopoDS_Shape &  theShape) [virtual]

Reimplemented from ShHealOper_Tool.

Definition at line 57 of file ShHealOper_Sewing.cxx.

  myTolerance = Precision::Confusion();
  myEdgesMode = Standard_False;
  myFacesMode = Standard_True;
  myNonManifoldMode = Standard_False;
  myHistoryLevel = TopAbs_FACE;

Here is the caller graph for this function:

Standard_Boolean ShHealOper_Tool::IsDone ( ) const [inline, inherited]

Definition at line 72 of file ShHealOper_Tool.hxx.

    return myDone;
Standard_Boolean ShHealOper_Sewing::isSewed ( const TopoDS_Shape &  theShape) const [private]

Definition at line 249 of file ShHealOper_Sewing.cxx.

  Standard_Integer nbNewShells =0;
  Standard_Integer nbOldShells =0;
  TopExp_Explorer aExpShells(theShape,TopAbs_SHELL);
  for( ; aExpShells.More(); aExpShells.Next())
  for( aExpShells.Init(myInitShape,TopAbs_SHELL); aExpShells.More(); aExpShells.Next())
  return (nbNewShells != nbOldShells);

Here is the caller graph for this function:

Standard_Boolean ShHealOper_Sewing::Perform ( )

Definition at line 71 of file ShHealOper_Sewing.cxx.

  TopTools_SequenceOfShape theSeqShapes;
  return sewing(theSeqShapes);

Here is the call graph for this function:

Here is the caller graph for this function:

Standard_Boolean ShHealOper_Sewing::Perform ( const TopTools_SequenceOfShape &  theSeqShapes)

Definition at line 81 of file ShHealOper_Sewing.cxx.

  return sewing(theSeqShapes);

Here is the call graph for this function:

void ShHealOper_Tool::SetContext ( Handle(ShapeBuild_ReShape)&  theContext) [inline, inherited]

Definition at line 78 of file ShHealOper_Tool.hxx.

    myContext = theContext;
void ShHealOper_Sewing::SetFacesMode ( const Standard_Boolean  theFacesMode) [inline]

Definition at line 64 of file ShHealOper_Sewing.hxx.

    myFacesMode = theFacesMode;
void ShHealOper_Sewing::SetFloatingEdgesMode ( const Standard_Boolean  theEdgesMode) [inline]

Definition at line 76 of file ShHealOper_Sewing.hxx.

    myEdgesMode = theEdgesMode;
void ShHealOper_Sewing::SetHistoryLevel ( TopAbs_ShapeEnum  theHistLevel) [inline]

Definition at line 112 of file ShHealOper_Sewing.hxx.

    myHistoryLevel =theHistLevel;
void ShHealOper_Sewing::SetNonManifoldMode ( const Standard_Boolean  theNonManifoldMode) [inline]

Definition at line 88 of file ShHealOper_Sewing.hxx.

    myNonManifoldMode = theNonManifoldMode;
void ShHealOper_Sewing::SetTolerance ( const Standard_Real  theToler) [inline]

Definition at line 100 of file ShHealOper_Sewing.hxx.

    myTolerance = theToler;
Standard_Boolean ShHealOper_Sewing::sewing ( const TopTools_SequenceOfShape &  theSeqShapes) [private]

Definition at line 91 of file ShHealOper_Sewing.cxx.

  myDone = Standard_False;
  myErrorStatus = ShHealOper_NotError;
  if(myInitShape.IsNull()) {
    myErrorStatus = ShHealOper_InvalidParameters;
    return myDone;
  //sewing shape
  Handle(BRepBuilderAPI_Sewing) aSewing = new BRepBuilderAPI_Sewing;
  Standard_Integer j =1;
  for( ; j <= theSeqShapes.Length();j++)

  const TopoDS_Shape aSewShape = aSewing->SewedShape();
  if(aSewShape.IsNull()) {
    myErrorStatus = ShHealOper_ErrorExecution;
    return myDone;
    return myDone;

  //analysis either sewing was made by changing number of shells
  myDone = isSewed(aSewShape);

  //keep modification of the sub-shapes in the Context.
  TopExp_Explorer aExp(myInitShape,TopAbs_FACE);
  for( ; aExp.More(); aExp.Next())
    myDone = (getModifications( aExp.Current(),aSewing) || myDone);

  TopoDS_Shape aTempShape = myContext->Apply(aSewShape);
  //obtained shells with fixed orientation for manifold and nonmanifold shells
    myDone = getShells(aTempShape) || myDone;

  //obtained manifold wires if sewing edges was performed.
    myDone = getWires(aTempShape) || myDone;
    myResultShape = myContext->Apply(aTempShape);
  return myDone;

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

Standard_Boolean ShHealOper_Tool::myDone [protected, inherited]

Definition at line 100 of file ShHealOper_Tool.hxx.

Standard_Boolean ShHealOper_Sewing::myEdgesMode [private]

Definition at line 142 of file ShHealOper_Sewing.hxx.

Definition at line 101 of file ShHealOper_Tool.hxx.

Standard_Boolean ShHealOper_Sewing::myFacesMode [private]

Definition at line 143 of file ShHealOper_Sewing.hxx.

TopAbs_ShapeEnum ShHealOper_Sewing::myHistoryLevel [private]

Definition at line 145 of file ShHealOper_Sewing.hxx.

TopoDS_Shape ShHealOper_Tool::myInitShape [protected, inherited]

Definition at line 98 of file ShHealOper_Tool.hxx.

Standard_Boolean ShHealOper_Sewing::myNonManifoldMode [private]

Definition at line 141 of file ShHealOper_Sewing.hxx.

TopoDS_Shape ShHealOper_Tool::myResultShape [protected, inherited]

Definition at line 99 of file ShHealOper_Tool.hxx.

Standard_Real ShHealOper_Sewing::myTolerance [private]

Definition at line 144 of file ShHealOper_Sewing.hxx.

The documentation for this class was generated from the following files: