0022745: [EDF] Improvement of Sewing operation

This commit is contained in:
eap 2014-10-09 18:34:57 +04:00 committed by vsr
parent 614060d67a
commit db4ad95d8e
23 changed files with 287 additions and 144 deletions

View File

@ -1,11 +1,10 @@
# Sewing # Sewing
import salome import salome, math
salome.salome_init() salome.salome_init()
import GEOM
from salome.geom import geomBuilder from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy) geompy = geomBuilder.New(salome.myStudy)
import math
gg = salome.ImportComponentGUI("GEOM") gg = salome.ImportComponentGUI("GEOM")
# create base points # create base points
@ -13,13 +12,13 @@ px = geompy.MakeVertex(100., 0., 0.)
py = geompy.MakeVertex(0., 100., 0.) py = geompy.MakeVertex(0., 100., 0.)
pz = geompy.MakeVertex(0., 0., 100.) pz = geompy.MakeVertex(0., 0., 100.)
# create base geometry 2D & 3D # create base geometry 2D
vector = geompy.MakeVector(px, py) vector = geompy.MakeVector(px, py)
arc = geompy.MakeArc(py, pz, px) arc = geompy.MakeArc(py, pz, px)
# create base objects # create base objects
angle = 45. * math.pi / 180 angle = 45. * math.pi / 180
WantPlanarFace = 1 #True WantPlanarFace = True
wire = geompy.MakeWire([vector, arc]) wire = geompy.MakeWire([vector, arc])
face = geompy.MakeFace(wire, WantPlanarFace) face = geompy.MakeFace(wire, WantPlanarFace)
face_rot = geompy.MakeRotation(face, vector, angle) face_rot = geompy.MakeRotation(face, vector, angle)
@ -40,3 +39,12 @@ gg.createAndDisplayGO(id_face_rot)
gg.setDisplayMode(id_face_rot,1) gg.setDisplayMode(id_face_rot,1)
gg.createAndDisplayGO(id_sewing) gg.createAndDisplayGO(id_sewing)
gg.setDisplayMode(id_sewing,1) gg.setDisplayMode(id_sewing,1)
# Example 2: make a shell of a multiply translated face
quad = geompy.MakeFaceHW( 10, 20, 1 )
quadCompound = geompy.MakeMultiTranslation1D( quad, geompy.MakeVectorDXDYDZ(1,0,0), 10, 3)
shell = geompy.Sew( quadCompound, 1e-6 )
id_shell = geompy.addToStudy( shell, "3 quads shell")
gg.createAndDisplayGO(id_shell)

BIN
doc/salome/gui/GEOM/images/neo-detect2.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.7 KiB

After

Width:  |  Height:  |  Size: 8.7 KiB

BIN
doc/salome/gui/GEOM/images/repair6.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -25,7 +25,7 @@ By <b>Cartesian coordinates</b> , which can be either:
- \b Relative coordinates \b DX, \b DY and \b DZ with respect to the previous applied point, - \b Relative coordinates \b DX, \b DY and \b DZ with respect to the previous applied point,
By <b>Angular coordinates</b>, which include: By <b>Angular coordinates</b>, which include:
- the \b Length of the segment and an \b Angle in the chosen plane (OXY for example) in \b Relative mode. The angle is then relative to a local coordinate system with the last point of the sketch as origin. </li> - the \b Length of the segment and an \b Angle in the chosen plane (OXY for example) in \b Relative mode. The angle is then relative to a local coordinate system with the last point of the sketch as origin.
\image html 3dsketch_angle_rel.png \image html 3dsketch_angle_rel.png

View File

@ -103,7 +103,7 @@ Buttons marked with small downward triangles have extended
functionality which can be accessed by locking on them with left functionality which can be accessed by locking on them with left
mouse button. mouse button.
\image tree_tool_bar \image html tree_tool_bar.png
<b>Dump View</b> - exports an object from the viewer in bmp, png or <b>Dump View</b> - exports an object from the viewer in bmp, png or
jpeg image format. jpeg image format.

View File

@ -25,8 +25,8 @@ Our <b>TUI Scripts</b> provide you with useful examples of the use of
<em>To import geometrical objects from a BREP, IGES, STEP or STL file:</em> <em>To import geometrical objects from a BREP, IGES, STEP or STL file:</em>
\par \par
From the \b File menu choose <b>Import/<FormatName></b>, where <b><FormatName></b> is a name From the \b File menu choose <b>Import/\<FormatName\></b>, where <b>\<FormatName\></b> is a name
of desirable format. In the <b>Import <FormatName></b> dialog box select the file to import of desirable format. In the <b>Import \<FormatName\></b> dialog box select the file to import
and press \b Open. The file will be imported in the module and its contents (geometrical object) and press \b Open. The file will be imported in the module and its contents (geometrical object)
will be displayed in the <b>Object Browser</b>. will be displayed in the <b>Object Browser</b>.
@ -63,8 +63,8 @@ file:</em>
\par \par
Select the object you wish to export, then from the \b File menu choose Select the object you wish to export, then from the \b File menu choose
<b>Export/<FormatName></b>, where <b><FormatName></b> is a name of desirable format. <b>Export/\<FormatName\></b>, where <b>\<FormatName\></b> is a name of desirable format.
In the <b>Export <FormatName></b> dialog box define the name and the location In the <b>Export \<FormatName\></b> dialog box define the name and the location
of the file to export and press \b Save. of the file to export and press \b Save.
The dialog box to export the file can provide additional advanced parameters. The dialog box to export the file can provide additional advanced parameters.

View File

@ -18,7 +18,7 @@ It is possible to show/hide a dimension in the view by checking on/off the box t
The buttons to the right of the list provide the following operations: The buttons to the right of the list provide the following operations:
<ul> <ul>
<li>"Add" - opens \ref add_dimension_page "Add Dimension" dialog to define a new fly-out.</li> <li>"Add" - opens "Add Dimension" dialog to define a new fly-out.</li>
<li>"Remove" - removes the selected item from the list.</li> <li>"Remove" - removes the selected item from the list.</li>
<li>"Show All" / "Hide All" - shows/hides all dimensions existing in the list.</li> <li>"Show All" / "Hide All" - shows/hides all dimensions existing in the list.</li>
</ul> </ul>

View File

@ -2,9 +2,24 @@
\page sewing_operation_page Sewing \page sewing_operation_page Sewing
\b Sewing operation allows uniting several faces (possibly contained
in a shell, solid or compound) into one shell while geometrically
coincident (within a specified tolerance) edges (or parts of edges) of
different faces are replaced by one edge thus producing a shell of
faces with shared boundaries.<p>
This operation is similar to <b>New Entity - > Build - > Shell</b>
operation, the difference is that with \b Sewing you can specify the
tolerance and can get a non-manifold result. <p>
Possibility to create a non-manifold shell can be used e.g. to create a
shell forming several closed domains and then to create several solids
with shared boundaries from this shell.
\note Geometrically coincident faces (or part of faces) won't be
replaced by one face during \b Sewing.
To produce a \b Sewing operation in the <b>Main Menu</b> select <b>Repair - > Sewing</b>. To produce a \b Sewing operation in the <b>Main Menu</b> select <b>Repair - > Sewing</b>.
The \b Result will be a \b GEOM_Object. The \b Result will be a \b GEOM_Object (shell).
\image html repair6.png \image html repair6.png

View File

@ -3680,7 +3680,7 @@ module GEOM
* \param theTolerance Required tolerance value. * \param theTolerance Required tolerance value.
* \return New GEOM_Object, containing processed shape. * \return New GEOM_Object, containing processed shape.
*/ */
GEOM_Object Sew (in GEOM_Object theObject, in double theTolerance); GEOM_Object Sew (in ListOfGO theObjects, in double theTolerance);
/*! /*!
* Sewing of the given object. Allows non-manifold sewing. * Sewing of the given object. Allows non-manifold sewing.
@ -3688,7 +3688,7 @@ module GEOM
* \param theTolerance Required tolerance value. * \param theTolerance Required tolerance value.
* \return New GEOM_Object, containing processed shape. * \return New GEOM_Object, containing processed shape.
*/ */
GEOM_Object SewAllowNonManifold(in GEOM_Object theObject, in double theTolerance); GEOM_Object SewAllowNonManifold(in ListOfGO theObjects, in double theTolerance);
/*! /*!
* Rebuild the topology of theCompound of solids by removing * Rebuild the topology of theCompound of solids by removing
@ -3725,12 +3725,12 @@ module GEOM
/*! /*!
* \brief Get a list of wires (wrapped in GEOM_Object-s), * \brief Get a list of wires (wrapped in GEOM_Object-s),
* that constitute a free boundary of the given shape. * that constitute a free boundary of the given shape.
* \param theObject Shape to get free boundary of. * \param theObject Shapes to get free boundary of.
* \param theClosedWires Output. Closed wires on the free boundary of the given shape. * \param theClosedWires Output. Closed wires on the free boundary of the given shape.
* \param theOpenWires Output. Open wires on the free boundary of the given shape. * \param theOpenWires Output. Open wires on the free boundary of the given shape.
* \return FALSE, if an error(s) occured during the method execution. * \return FALSE, if an error(s) occured during the method execution.
*/ */
boolean GetFreeBoundary (in GEOM_Object theObject, boolean GetFreeBoundary (in ListOfGO theObjects,
out ListOfGO theClosedWires, out ListOfGO theClosedWires,
out ListOfGO theOpenWires); out ListOfGO theOpenWires);

View File

@ -140,6 +140,23 @@ namespace GEOM
} }
return *this; return *this;
} }
Standard_EXPORT TPythonDump&
TPythonDump::operator<< (const std::list<Handle(GEOM_Object)>& theObjects)
{
Standard_Integer aLength = theObjects.size();
if ( aLength > 1 ) {
myStream << "[";
}
std::list<Handle(GEOM_Object)>::const_iterator obj = theObjects.begin();
for ( Standard_Integer i = 1; i <= aLength; i++, ++obj ) {
*this << *obj;
if ( i < aLength ) myStream << ", ";
}
if ( aLength > 1 ) {
myStream << "]";
}
return *this;
}
TPythonDump& TPythonDump::operator<< (const GEOM_BaseObject* theObject) TPythonDump& TPythonDump::operator<< (const GEOM_BaseObject* theObject)
{ {

View File

@ -30,6 +30,8 @@
#include <TCollection_AsciiString.hxx> #include <TCollection_AsciiString.hxx>
#include <list>
namespace GEOM namespace GEOM
{ {
class TPythonDump class TPythonDump
@ -56,7 +58,8 @@ namespace GEOM
Standard_EXPORT TPythonDump& operator<< (const TCollection_AsciiString theArg); Standard_EXPORT TPythonDump& operator<< (const TCollection_AsciiString theArg);
Standard_EXPORT TPythonDump& operator<< (const TopAbs_ShapeEnum theArg); Standard_EXPORT TPythonDump& operator<< (const TopAbs_ShapeEnum theArg);
Standard_EXPORT TPythonDump& operator<< (const Handle(GEOM_BaseObject)& theObject); Standard_EXPORT TPythonDump& operator<< (const Handle(GEOM_BaseObject)& theObject);
Standard_EXPORT TPythonDump& operator<< (const Handle(TColStd_HSequenceOfTransient)& theObjects); Standard_EXPORT TPythonDump& operator<< (const Handle(TColStd_HSequenceOfTransient)& objects);
Standard_EXPORT TPythonDump& operator<< (const std::list<Handle(GEOM_Object)>& theObjects);
Standard_EXPORT TPythonDump& operator<< (const GEOM_BaseObject* theObject); Standard_EXPORT TPythonDump& operator<< (const GEOM_BaseObject* theObject);
}; };

View File

@ -432,7 +432,26 @@ Standard_Boolean GEOMImpl_HealingDriver::Sew (GEOMImpl_IHealing* theHI,
{ {
Standard_Real aTol = theHI->GetTolerance(); Standard_Real aTol = theHI->GetTolerance();
ShHealOper_Sewing aHealer (theOriginalShape, aTol); TopoDS_Compound faceCompound;
BRep_Builder builder;
builder.MakeCompound( faceCompound );
TopExp_Explorer faceExp( theOriginalShape, TopAbs_FACE );
for ( ; faceExp.More(); faceExp.Next() )
builder.Add( faceCompound, faceExp.Current() );
Handle(TColStd_HSequenceOfTransient) otherObjs = theHI->GetShapes();
for ( int ind = 1; ind <= otherObjs->Length(); ind++)
{
Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(otherObjs->Value(ind));
TopoDS_Shape aShape = aRefShape->GetValue();
if (aShape.IsNull())
Standard_NullObject::Raise("Null object given");
for ( faceExp.Init( aShape, TopAbs_FACE ); faceExp.More(); faceExp.Next() )
builder.Add( faceCompound, faceExp.Current() );
}
ShHealOper_Sewing aHealer (faceCompound, aTol);
// Set non-manifold mode. // Set non-manifold mode.
aHealer.SetNonManifoldMode(isAllowNonManifold); aHealer.SetNonManifoldMode(isAllowNonManifold);
@ -606,7 +625,7 @@ void GEOMImpl_HealingDriver::FuseCollinearEdges (const TopoDS_Shape& theOriginal
removeAll = true; removeAll = true;
if (!removeAll) { if (!removeAll) {
for (unsigned int ind = 1; ind <= aVerts->Length(); ind++) { for ( int ind = 1; ind <= aVerts->Length(); ind++) {
Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aVerts->Value(ind)); Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aVerts->Value(ind));
TopoDS_Shape aShape_i = aRefShape->GetValue(); TopoDS_Shape aShape_i = aRefShape->GetValue();
if (aShape_i.IsNull()) if (aShape_i.IsNull())
@ -881,7 +900,7 @@ GetCreationInformation(std::string& theOperationName,
case SEWING: case SEWING:
case SEWING_NON_MANIFOLD: case SEWING_NON_MANIFOLD:
theOperationName = "SEWING"; theOperationName = "SEWING";
AddParam( theParams, "Selected shape", aCI.GetOriginal() ); AddParam( theParams, "Selected shapes", aCI.GetOriginalAndShapes() );
AddParam( theParams, "Allow Non Manifold", ( aType == SEWING_NON_MANIFOLD )); AddParam( theParams, "Allow Non Manifold", ( aType == SEWING_NON_MANIFOLD ));
AddParam( theParams, "Tolerance", aCI.GetTolerance() ); AddParam( theParams, "Tolerance", aCI.GetTolerance() );
break; break;

View File

@ -55,7 +55,7 @@ public:
void SetValues( const Handle(TColStd_HArray1OfExtendedString)& arr ) { if ( !arr.IsNull() ) _func->SetStringArray(ARG_SHAPE_PROCESS_VALUES, arr); } void SetValues( const Handle(TColStd_HArray1OfExtendedString)& arr ) { if ( !arr.IsNull() ) _func->SetStringArray(ARG_SHAPE_PROCESS_VALUES, arr); }
Handle(TColStd_HArray1OfExtendedString) GetValues() { return _func->GetStringArray(ARG_SHAPE_PROCESS_VALUES); } Handle(TColStd_HArray1OfExtendedString) GetValues() { return _func->GetStringArray(ARG_SHAPE_PROCESS_VALUES); }
void SetOriginal( Handle(GEOM_Function)& f ) { _func->SetReference(ARG_ORIGINAL, f); } void SetOriginal( Handle(GEOM_Function) f ) { _func->SetReference(ARG_ORIGINAL, f); }
Handle(GEOM_Function) GetOriginal() { return _func->GetReference(ARG_ORIGINAL); } Handle(GEOM_Function) GetOriginal() { return _func->GetReference(ARG_ORIGINAL); }
void SetFaces( const Handle(TColStd_HArray1OfInteger)& arr ) { if ( !arr.IsNull() ) _func->SetIntegerArray(ARG_LIST_ARGUMENTS, arr); } void SetFaces( const Handle(TColStd_HArray1OfInteger)& arr ) { if ( !arr.IsNull() ) _func->SetIntegerArray(ARG_LIST_ARGUMENTS, arr); }
@ -84,6 +84,13 @@ public:
Handle(TColStd_HSequenceOfTransient) GetShapes() Handle(TColStd_HSequenceOfTransient) GetShapes()
{ return _func->GetReferenceList(ARG_LIST_SHAPES); } { return _func->GetReferenceList(ARG_LIST_SHAPES); }
Handle(TColStd_HSequenceOfTransient) GetOriginalAndShapes()
{
Handle(TColStd_HSequenceOfTransient) funs = GetShapes();
if ( funs.IsNull() ) funs = new TColStd_HSequenceOfTransient;
funs->Prepend( GetOriginal() );
return funs;
}
private: private:
Handle(GEOM_Function) _func; Handle(GEOM_Function) _func;
}; };

View File

@ -28,9 +28,7 @@
#include <Standard_Stream.hxx> #include <Standard_Stream.hxx>
#include <GEOMImpl_IHealingOperations.hxx> #include <GEOMImpl_IHealingOperations.hxx>
#include <GEOM_PythonDump.hxx> #include <GEOM_PythonDump.hxx>
#include <GEOMImpl_HealingDriver.hxx> #include <GEOMImpl_HealingDriver.hxx>
#include <GEOMImpl_Types.hxx> #include <GEOMImpl_Types.hxx>
#include <GEOMImpl_IHealing.hxx> #include <GEOMImpl_IHealing.hxx>
@ -40,22 +38,20 @@
#include <Basics_OCCTVersion.hxx> #include <Basics_OCCTVersion.hxx>
#include "utilities.h" #include <utilities.h>
#include <OpUtil.hxx> #include <OpUtil.hxx>
#include <Utils_ExceptHandlers.hxx> #include <Utils_ExceptHandlers.hxx>
#include <BRep_Builder.hxx>
#include <ShHealOper_ShapeProcess.hxx> #include <ShHealOper_ShapeProcess.hxx>
#include <ShapeAnalysis_FreeBounds.hxx> #include <ShapeAnalysis_FreeBounds.hxx>
#include <TopoDS_Compound.hxx>
#include <TopExp_Explorer.hxx>
#include <TColStd_HArray1OfExtendedString.hxx> #include <TColStd_HArray1OfExtendedString.hxx>
#include <TColStd_HSequenceOfTransient.hxx> #include <TColStd_HSequenceOfTransient.hxx>
#include <TCollection_AsciiString.hxx> #include <TCollection_AsciiString.hxx>
#include <TDF_Tool.hxx> #include <TDF_Tool.hxx>
#include <TopExp_Explorer.hxx>
#include <TopTools_SequenceOfShape.hxx>
#include <TopoDS_Compound.hxx>
#include <Standard_Failure.hxx> #include <Standard_Failure.hxx>
#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC #include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
@ -585,27 +581,36 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::FillHoles (Handle(GEOM_Object)
* Sew * Sew
*/ */
//============================================================================= //=============================================================================
Handle(GEOM_Object) GEOMImpl_IHealingOperations::Sew (Handle(GEOM_Object) theObject, Handle(GEOM_Object)
GEOMImpl_IHealingOperations::Sew (std::list<Handle(GEOM_Object)>& theObjects,
double theTolerance, double theTolerance,
bool isAllowNonManifold) bool isAllowNonManifold)
{ {
// set error code, check parameters // set error code, check parameters
SetErrorCode(KO); SetErrorCode(KO);
if (theObject.IsNull()) if (theObjects.empty())
return NULL; return NULL;
Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction(); Handle(TColStd_HSequenceOfTransient) objects = new TColStd_HSequenceOfTransient;
if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be processed std::list<Handle(GEOM_Object)>::iterator it = theObjects.begin();
for (; it != theObjects.end(); it++)
{
Handle(GEOM_Function) aRefSh = (*it)->GetLastFunction();
if (aRefSh.IsNull()) {
SetErrorCode("NULL argument shape");
return NULL;
}
objects->Append(aRefSh);
}
// Add a new object // Add a new object
Handle(GEOM_Object) aNewObject = GetEngine()->AddObject( GetDocID(), GEOM_COPY ); Handle(GEOM_Object) aNewObject = GetEngine()->AddObject( GetDocID(), GEOM_COPY );
//Add the function //Add the function
int aFunctionType = (isAllowNonManifold ? SEWING_NON_MANIFOLD : SEWING); int aFunctionType = (isAllowNonManifold ? SEWING_NON_MANIFOLD : SEWING);
Handle(GEOM_Function) aFunction =
aFunction = aNewObject->AddFunction(GEOMImpl_HealingDriver::GetID(), aFunctionType); aNewObject->AddFunction(GEOMImpl_HealingDriver::GetID(), aFunctionType);
if (aFunction.IsNull()) return NULL; if (aFunction.IsNull()) return NULL;
//Check if the function is set correctly //Check if the function is set correctly
@ -614,7 +619,8 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::Sew (Handle(GEOM_Object) theObj
// prepare "data container" class IHealing // prepare "data container" class IHealing
GEOMImpl_IHealing HI(aFunction); GEOMImpl_IHealing HI(aFunction);
HI.SetTolerance( theTolerance ); HI.SetTolerance( theTolerance );
HI.SetOriginal( aLastFunction ); HI.SetOriginal( theObjects.front()->GetLastFunction() ); objects->Remove(1);
HI.SetShapes( objects );
//Compute the result //Compute the result
try { try {
@ -634,7 +640,7 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::Sew (Handle(GEOM_Object) theObj
//Make a Python command //Make a Python command
GEOM::TPythonDump pd(aFunction); GEOM::TPythonDump pd(aFunction);
pd << aNewObject << " = geompy.Sew(" << theObject << ", " << theTolerance; pd << aNewObject << " = geompy.Sew(" << theObjects << ", " << theTolerance;
if (isAllowNonManifold) { if (isAllowNonManifold) {
pd << ", true"; pd << ", true";
@ -835,19 +841,40 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::FuseCollinearEdgesWithinWire
* GetFreeBoundary * GetFreeBoundary
*/ */
//============================================================================= //=============================================================================
bool GEOMImpl_IHealingOperations::GetFreeBoundary (Handle(GEOM_Object) theObject, bool GEOMImpl_IHealingOperations::GetFreeBoundary (Handle(TColStd_HSequenceOfTransient)& theObjects,
Handle(TColStd_HSequenceOfTransient)& theClosed, Handle(TColStd_HSequenceOfTransient)& theClosed,
Handle(TColStd_HSequenceOfTransient)& theOpen ) Handle(TColStd_HSequenceOfTransient)& theOpen )
{ {
// set error code, check parameters // set error code, check parameters
SetErrorCode(KO); SetErrorCode(KO);
if ( theObject.IsNull() || theClosed.IsNull() || theOpen.IsNull() ) if ( theObjects.IsNull() || theObjects->Length() == 0 ||
theClosed.IsNull() || theOpen.IsNull() )
return false; return false;
TopoDS_Shape aShape = theObject->GetValue(); TopoDS_Shape aShape;
TopTools_SequenceOfShape shapes;
for ( int ind = 1; ind <= theObjects->Length(); ind++)
{
Handle(GEOM_Object) aRefShape = Handle(GEOM_Object)::DownCast( theObjects->Value(ind));
if ( aRefShape.IsNull() )
return false;
aShape = aRefShape->GetValue();
if ( aShape.IsNull() ) if ( aShape.IsNull() )
return false; return false;
shapes.Append( aShape );
}
if ( shapes.Length() > 1 )
{
TopoDS_Compound compound;
BRep_Builder builder;
builder.MakeCompound( compound );
for ( int i = 1; i <= shapes.Length(); ++i )
builder.Add( compound, shapes( i ) );
aShape = compound;
}
// get free boundary shapes // get free boundary shapes
@ -906,7 +933,7 @@ bool GEOMImpl_IHealingOperations::GetFreeBoundary (Handle(GEOM_Object) theObject
pd << "empty_list"; pd << "empty_list";
} }
pd << ") = geompy.GetFreeBoundary(" << theObject << ")"; pd << ") = geompy.GetFreeBoundary(" << theObjects << ")";
} }
SetErrorCode(OK); SetErrorCode(OK);

View File

@ -70,7 +70,7 @@ class GEOMImpl_IHealingOperations : public GEOM_IOperations {
Standard_EXPORT Handle(GEOM_Object) FillHoles( Handle(GEOM_Object) theObject, Standard_EXPORT Handle(GEOM_Object) FillHoles( Handle(GEOM_Object) theObject,
const Handle(TColStd_HArray1OfInteger)& theWires); const Handle(TColStd_HArray1OfInteger)& theWires);
Standard_EXPORT Handle(GEOM_Object) Sew( Handle(GEOM_Object) theObject, Standard_EXPORT Handle(GEOM_Object) Sew( std::list<Handle(GEOM_Object)> & theObject,
double theTolerance, double theTolerance,
bool isAllowNonManifold); bool isAllowNonManifold);
@ -88,7 +88,7 @@ class GEOMImpl_IHealingOperations : public GEOM_IOperations {
// this function does not use Function-Driver mechanism, it just computes the free // this function does not use Function-Driver mechanism, it just computes the free
// boundary edges and returns them in the sequence. It is called just for information reasons // boundary edges and returns them in the sequence. It is called just for information reasons
// and it's not intended for history/undo/redo/etc.. // and it's not intended for history/undo/redo/etc..
Standard_EXPORT bool GetFreeBoundary ( Handle(GEOM_Object) theObject, Standard_EXPORT bool GetFreeBoundary ( Handle(TColStd_HSequenceOfTransient)& theObjects,
Handle(TColStd_HSequenceOfTransient)& theOutClosedWires, Handle(TColStd_HSequenceOfTransient)& theOutClosedWires,
Handle(TColStd_HSequenceOfTransient)& theOutOpenWires ); Handle(TColStd_HSequenceOfTransient)& theOutOpenWires );

View File

@ -316,7 +316,7 @@ GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::FillHoles (GEOM::GEOM_Object_pt
* Sew * Sew
*/ */
//============================================================================= //=============================================================================
GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::Sew (GEOM::GEOM_Object_ptr theObject, GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::Sew (const GEOM::ListOfGO& theObjects,
CORBA::Double theTolerance) CORBA::Double theTolerance)
{ {
GEOM::GEOM_Object_var aGEOMObject; GEOM::GEOM_Object_var aGEOMObject;
@ -328,14 +328,18 @@ GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::Sew (GEOM::GEOM_Object_ptr theO
if (theTolerance < 0) if (theTolerance < 0)
return aGEOMObject._retn(); return aGEOMObject._retn();
// Get the object itself //Get the shapes
Handle(GEOM_Object) anObject = GetObjectImpl(theObject); std::list<Handle(GEOM_Object)> objects;
if (anObject.IsNull()) const int aLen = theObjects.length();
return aGEOMObject._retn(); for ( int ind = 0; ind < aLen; ind++)
{
Handle(GEOM_Object) aSh = GetObjectImpl(theObjects[ind]);
if (aSh.IsNull()) return aGEOMObject._retn();
objects.push_back(aSh);
}
// Perform // Perform
Handle(GEOM_Object) aNewObject = Handle(GEOM_Object) aNewObject = GetOperations()->Sew( objects, theTolerance, false );
GetOperations()->Sew( anObject, theTolerance, false );
if (!GetOperations()->IsDone() || aNewObject.IsNull()) if (!GetOperations()->IsDone() || aNewObject.IsNull())
return aGEOMObject._retn(); return aGEOMObject._retn();
@ -347,7 +351,8 @@ GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::Sew (GEOM::GEOM_Object_ptr theO
* SewAllowNonManifold * SewAllowNonManifold
*/ */
//============================================================================= //=============================================================================
GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::SewAllowNonManifold (GEOM::GEOM_Object_ptr theObject, GEOM::GEOM_Object_ptr
GEOM_IHealingOperations_i::SewAllowNonManifold (const GEOM::ListOfGO& theObjects,
CORBA::Double theTolerance) CORBA::Double theTolerance)
{ {
GEOM::GEOM_Object_var aGEOMObject; GEOM::GEOM_Object_var aGEOMObject;
@ -359,14 +364,18 @@ GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::SewAllowNonManifold (GEOM::GEOM
if (theTolerance < 0) if (theTolerance < 0)
return aGEOMObject._retn(); return aGEOMObject._retn();
// Get the object itself //Get the shapes
Handle(GEOM_Object) anObject = GetObjectImpl(theObject); std::list<Handle(GEOM_Object)> objects;
if (anObject.IsNull()) const int aLen = theObjects.length();
return aGEOMObject._retn(); for ( int ind = 0; ind < aLen; ind++)
{
Handle(GEOM_Object) aSh = GetObjectImpl(theObjects[ind]);
if (aSh.IsNull()) return aGEOMObject._retn();
objects.push_back(aSh);
}
// Perform // Perform
Handle(GEOM_Object) aNewObject = Handle(GEOM_Object) aNewObject = GetOperations()->Sew( objects, theTolerance, true );
GetOperations()->Sew( anObject, theTolerance, true );
if (!GetOperations()->IsDone() || aNewObject.IsNull()) if (!GetOperations()->IsDone() || aNewObject.IsNull())
return aGEOMObject._retn(); return aGEOMObject._retn();
@ -473,7 +482,8 @@ GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::FuseCollinearEdgesWithinWire
* GetFreeBoundary * GetFreeBoundary
*/ */
//============================================================================= //=============================================================================
CORBA::Boolean GEOM_IHealingOperations_i::GetFreeBoundary ( GEOM::GEOM_Object_ptr theObject, CORBA::Boolean
GEOM_IHealingOperations_i::GetFreeBoundary ( const GEOM::ListOfGO & theObjects,
GEOM::ListOfGO_out theClosedWires, GEOM::ListOfGO_out theClosedWires,
GEOM::ListOfGO_out theOpenWires ) GEOM::ListOfGO_out theOpenWires )
{ {
@ -483,14 +493,19 @@ CORBA::Boolean GEOM_IHealingOperations_i::GetFreeBoundary ( GEOM::GEOM_Object_pt
// Set a not done flag // Set a not done flag
GetOperations()->SetNotDone(); GetOperations()->SetNotDone();
// Get the object itself // Get the objects
Handle(GEOM_Object) anObject = GetObjectImpl(theObject); Handle(TColStd_HSequenceOfTransient) anObjects = new TColStd_HSequenceOfTransient();
for ( size_t i = 0; i < theObjects.length(); ++i )
{
Handle(GEOM_Object) anObject = GetObjectImpl(theObjects[i]);
if (anObject.IsNull()) if (anObject.IsNull())
return false; return false;
anObjects->Append( anObject );
}
Handle(TColStd_HSequenceOfTransient) aClosed = new TColStd_HSequenceOfTransient(); Handle(TColStd_HSequenceOfTransient) aClosed = new TColStd_HSequenceOfTransient();
Handle(TColStd_HSequenceOfTransient) anOpen = new TColStd_HSequenceOfTransient(); Handle(TColStd_HSequenceOfTransient) anOpen = new TColStd_HSequenceOfTransient();
bool res = GetOperations()->GetFreeBoundary( anObject, aClosed, anOpen ); bool res = GetOperations()->GetFreeBoundary( anObjects, aClosed, anOpen );
if ( !GetOperations()->IsDone() || !res ) if ( !GetOperations()->IsDone() || !res )
return false; return false;

View File

@ -69,10 +69,10 @@ class GEOM_I_EXPORT GEOM_IHealingOperations_i :
GEOM::GEOM_Object_ptr FillHoles (GEOM::GEOM_Object_ptr theObject, GEOM::GEOM_Object_ptr FillHoles (GEOM::GEOM_Object_ptr theObject,
const GEOM::short_array& theWires); const GEOM::short_array& theWires);
GEOM::GEOM_Object_ptr Sew (GEOM::GEOM_Object_ptr theObject, GEOM::GEOM_Object_ptr Sew (const GEOM::ListOfGO & theObject,
CORBA::Double theTolerance); CORBA::Double theTolerance);
GEOM::GEOM_Object_ptr SewAllowNonManifold (GEOM::GEOM_Object_ptr theObject, GEOM::GEOM_Object_ptr SewAllowNonManifold (const GEOM::ListOfGO & theObject,
CORBA::Double theTolerance); CORBA::Double theTolerance);
GEOM::GEOM_Object_ptr RemoveInternalFaces (GEOM::GEOM_Object_ptr theCompound); GEOM::GEOM_Object_ptr RemoveInternalFaces (GEOM::GEOM_Object_ptr theCompound);
@ -85,7 +85,7 @@ class GEOM_I_EXPORT GEOM_IHealingOperations_i :
GEOM::GEOM_Object_ptr FuseCollinearEdgesWithinWire (GEOM::GEOM_Object_ptr theWire, GEOM::GEOM_Object_ptr FuseCollinearEdgesWithinWire (GEOM::GEOM_Object_ptr theWire,
const GEOM::ListOfGO& theVertices); const GEOM::ListOfGO& theVertices);
CORBA::Boolean GetFreeBoundary(GEOM::GEOM_Object_ptr theObject, CORBA::Boolean GetFreeBoundary(const GEOM::ListOfGO& theObjects,
GEOM::ListOfGO_out theClosedWires, GEOM::ListOfGO_out theClosedWires,
GEOM::ListOfGO_out theOpenWires ); GEOM::ListOfGO_out theOpenWires );

View File

@ -517,6 +517,14 @@ def EnumToLong(theItem):
if hasattr(theItem, "_v"): ret = theItem._v if hasattr(theItem, "_v"): ret = theItem._v
return ret return ret
## Pack an argument into a list
def ToList( arg ):
if isinstance( arg, list ):
return arg
if hasattr( arg, "__getitem__" ):
return list( arg )
return [ arg ]
## Information about closed/unclosed state of shell or wire ## Information about closed/unclosed state of shell or wire
# @ingroup l1_geomBuilder_auxiliary # @ingroup l1_geomBuilder_auxiliary
class info: class info:
@ -4537,7 +4545,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
New GEOM.GEOM_Object, containing the created shell. New GEOM.GEOM_Object, containing the created shell.
""" """
# Example: see GEOM_TestAll.py # Example: see GEOM_TestAll.py
anObj = self.ShapesOp.MakeShell(theFacesAndShells) anObj = self.ShapesOp.MakeShell( ToList( theFacesAndShells ))
RaiseIfFailed("MakeShell", self.ShapesOp) RaiseIfFailed("MakeShell", self.ShapesOp)
self._autoPublish(anObj, theName, "shell") self._autoPublish(anObj, theName, "shell")
return anObj return anObj
@ -6317,7 +6325,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
self._autoPublish(anObj, theName, "suppressFaces") self._autoPublish(anObj, theName, "suppressFaces")
return anObj return anObj
## Sewing of some shapes into single shape. ## Sewing of faces into a single shell.
# @param ListShape Shapes to be processed. # @param ListShape Shapes to be processed.
# @param theTolerance Required tolerance value. # @param theTolerance Required tolerance value.
# @param AllowNonManifold Flag that allows non-manifold sewing. # @param AllowNonManifold Flag that allows non-manifold sewing.
@ -6325,12 +6333,12 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
# for result publication in the study. Otherwise, if automatic # for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name. # publication is switched on, default value is used for result name.
# #
# @return New GEOM.GEOM_Object, containing processed shape. # @return New GEOM.GEOM_Object, containing a result shell.
# #
# @ref tui_sewing "Example" # @ref tui_sewing "Example"
def MakeSewing(self, ListShape, theTolerance, AllowNonManifold=False, theName=None): def MakeSewing(self, ListShape, theTolerance, AllowNonManifold=False, theName=None):
""" """
Sewing of some shapes into single shape. Sewing of faces into a single shell.
Parameters: Parameters:
ListShape Shapes to be processed. ListShape Shapes to be processed.
@ -6341,30 +6349,29 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
publication is switched on, default value is used for result name. publication is switched on, default value is used for result name.
Returns: Returns:
New GEOM.GEOM_Object, containing processed shape. New GEOM.GEOM_Object, containing containing a result shell.
""" """
# Example: see GEOM_TestHealing.py # Example: see GEOM_TestHealing.py
comp = self.MakeCompound(ListShape)
# note: auto-publishing is done in self.Sew() # note: auto-publishing is done in self.Sew()
anObj = self.Sew(comp, theTolerance, AllowNonManifold, theName) anObj = self.Sew(ListShape, theTolerance, AllowNonManifold, theName)
return anObj return anObj
## Sewing of the given object. ## Sewing of faces into a single shell.
# @param theObject Shape to be processed. # @param ListShape Shapes to be processed.
# @param theTolerance Required tolerance value. # @param theTolerance Required tolerance value.
# @param AllowNonManifold Flag that allows non-manifold sewing. # @param AllowNonManifold Flag that allows non-manifold sewing.
# @param theName Object name; when specified, this parameter is used # @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic # for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name. # publication is switched on, default value is used for result name.
# #
# @return New GEOM.GEOM_Object, containing processed shape. # @return New GEOM.GEOM_Object, containing a result shell.
@ManageTransactions("HealOp") @ManageTransactions("HealOp")
def Sew(self, theObject, theTolerance, AllowNonManifold=False, theName=None): def Sew(self, ListShape, theTolerance, AllowNonManifold=False, theName=None):
""" """
Sewing of the given object. Sewing of faces into a single shell.
Parameters: Parameters:
theObject Shape to be processed. ListShape Shapes to be processed.
theTolerance Required tolerance value. theTolerance Required tolerance value.
AllowNonManifold Flag that allows non-manifold sewing. AllowNonManifold Flag that allows non-manifold sewing.
theName Object name; when specified, this parameter is used theName Object name; when specified, this parameter is used
@ -6372,17 +6379,18 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
publication is switched on, default value is used for result name. publication is switched on, default value is used for result name.
Returns: Returns:
New GEOM.GEOM_Object, containing processed shape. New GEOM.GEOM_Object, containing a result shell.
""" """
# Example: see MakeSewing() above # Example: see MakeSewing() above
theTolerance,Parameters = ParseParameters(theTolerance) theTolerance,Parameters = ParseParameters(theTolerance)
if AllowNonManifold: if AllowNonManifold:
anObj = self.HealOp.SewAllowNonManifold(theObject, theTolerance) anObj = self.HealOp.SewAllowNonManifold( ToList( ListShape ), theTolerance)
else: else:
anObj = self.HealOp.Sew(theObject, theTolerance) anObj = self.HealOp.Sew( ToList( ListShape ), theTolerance)
# To avoid script failure in case of good argument shape # To avoid script failure in case of good argument shape
# (Fix of test cases geom/bugs11/L7,L8)
if self.HealOp.GetErrorCode() == "ShHealOper_NotError_msg": if self.HealOp.GetErrorCode() == "ShHealOper_NotError_msg":
return theObject return anObj
RaiseIfFailed("Sew", self.HealOp) RaiseIfFailed("Sew", self.HealOp)
anObj.SetParameters(Parameters) anObj.SetParameters(Parameters)
self._autoPublish(anObj, theName, "sewed") self._autoPublish(anObj, theName, "sewed")
@ -6707,7 +6715,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
theOpenWires: Open wires on the free boundary of the given shape. theOpenWires: Open wires on the free boundary of the given shape.
""" """
# Example: see GEOM_TestHealing.py # Example: see GEOM_TestHealing.py
anObj = self.HealOp.GetFreeBoundary(theObject) anObj = self.HealOp.GetFreeBoundary( ToList( theObject ))
RaiseIfFailed("GetFreeBoundary", self.HealOp) RaiseIfFailed("GetFreeBoundary", self.HealOp)
self._autoPublish(anObj[1], theName, "closedWire") self._autoPublish(anObj[1], theName, "closedWire")
self._autoPublish(anObj[2], theName, "openWire") self._autoPublish(anObj[2], theName, "openWire")

View File

@ -261,8 +261,11 @@ bool RepairGUI_FreeBoundDlg::execute (ObjectList& objects)
{ {
GEOM::ListOfGO_var aClosed, anOpen; GEOM::ListOfGO_var aClosed, anOpen;
GEOM::ListOfGO_var objList = new GEOM::ListOfGO;
objList->length(1);
objList[0] = myObj;
GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow(getOperation()); GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow(getOperation());
bool result = anOper->GetFreeBoundary(myObj, aClosed, anOpen); bool result = anOper->GetFreeBoundary(objList, aClosed, anOpen);
if (result) { if (result) {
myNbClosed = aClosed->length(); myNbClosed = aClosed->length();

View File

@ -330,8 +330,11 @@ bool RepairGUI_RemoveHolesDlg::execute (ObjectList& objects)
// highlight them (add to objects), display message dialog // highlight them (add to objects), display message dialog
GEOM::ListOfGO_var aClosed, anOpen; GEOM::ListOfGO_var aClosed, anOpen;
GEOM::ListOfGO_var objList = new GEOM::ListOfGO;
objList->length(1);
objList[0] = myObject;
GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow(getOperation()); GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow(getOperation());
aResult = anOper->GetFreeBoundary(myObject, aClosed, anOpen); aResult = anOper->GetFreeBoundary(objList, aClosed, anOpen);
if (aResult) { if (aResult) {
myClosed = aClosed->length(); myClosed = aClosed->length();

View File

@ -117,7 +117,7 @@ void RepairGUI_SewingDlg::Init()
/* init variables */ /* init variables */
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
myObject = GEOM::GEOM_Object::_nil(); myObjects.clear();
//myGeomGUI->SetState( 0 ); //myGeomGUI->SetState( 0 );
initSelection(); initSelection();
@ -166,7 +166,7 @@ bool RepairGUI_SewingDlg::ClickOnApply()
initName(); initName();
GroupPoints->LineEdit1->setText( "" ); GroupPoints->LineEdit1->setText( "" );
myObject = GEOM::GEOM_Object::_nil(); myObjects.clear();
initSelection(); initSelection();
@ -182,17 +182,13 @@ void RepairGUI_SewingDlg::SelectionIntoArgument()
{ {
erasePreview(); erasePreview();
myEditCurrentArgument->setText( "" ); myEditCurrentArgument->setText( "" );
myObject = GEOM::GEOM_Object::_nil(); myObjects.clear();
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); myObjects = getSelected( TopAbs_SHAPE, -1 );
SALOME_ListIO aSelList;
aSelMgr->selectedObjects(aSelList);
if ( aSelList.Extent() == 1 ) { if ( !myObjects.isEmpty() ) {
Handle(SALOME_InteractiveObject) anIO = aSelList.First(); QString aName = myObjects.count() > 1 ? QString( "%1_objects").arg( myObjects.count() ) : GEOMBase::GetName( myObjects[0].get() );
myObject = GEOMBase::ConvertIOinGEOMObject( anIO ); myEditCurrentArgument->setText( aName );
if ( !CORBA::is_nil( myObject ) )
myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) );
} }
} }
@ -235,7 +231,7 @@ void RepairGUI_SewingDlg::ActivateThisDialog()
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
GroupPoints->LineEdit1->setText( "" ); GroupPoints->LineEdit1->setText( "" );
myObject = GEOM::GEOM_Object::_nil(); myObjects.clear();
myClosed = -1; myClosed = -1;
myOpen = -1; myOpen = -1;
@ -273,7 +269,7 @@ bool RepairGUI_SewingDlg::isValid( QString& msg )
{ {
myClosed = -1; myClosed = -1;
bool ok = myTolEdt->isValid( msg, !IsPreview() ); bool ok = myTolEdt->isValid( msg, !IsPreview() );
return !myObject->_is_nil() && ( IsPreview() || myTolEdt->value() > 0. ) && ok; return !myObjects.isEmpty() && ( IsPreview() || myTolEdt->value() > 0. ) && ok;
} }
//================================================================================= //=================================================================================
@ -285,10 +281,15 @@ bool RepairGUI_SewingDlg::execute( ObjectList& objects )
bool aResult = false; bool aResult = false;
GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow( getOperation() ); GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow( getOperation() );
GEOM::ListOfGO_var objList = new GEOM::ListOfGO;
objList->length( myObjects.count() );
for ( int i = 0; i < myObjects.count(); ++i )
objList[i] = myObjects[i].copy();
if ( IsPreview() ) { // called from onDetect(): detect free boundary edges, highlight them (add to objects), display message dialog if ( IsPreview() ) { // called from onDetect(): detect free boundary edges, highlight them (add to objects), display message dialog
GEOM::ListOfGO_var aClosed, anOpen; GEOM::ListOfGO_var aClosed, anOpen;
aResult = anOper->GetFreeBoundary( myObject, aClosed, anOpen ); aResult = anOper->GetFreeBoundary( objList, aClosed, anOpen );
if ( aResult ) { if ( aResult ) {
myClosed = aClosed->length(); myClosed = aClosed->length();
@ -306,9 +307,9 @@ bool RepairGUI_SewingDlg::execute( ObjectList& objects )
GEOM::GEOM_Object_var anObj; GEOM::GEOM_Object_var anObj;
if (myAllowNonManifoldChk->isChecked()) { if (myAllowNonManifoldChk->isChecked()) {
anObj = anOper->SewAllowNonManifold( myObject, myTolEdt->value() ); anObj = anOper->SewAllowNonManifold( objList, myTolEdt->value() );
} else { } else {
anObj = anOper->Sew( myObject, myTolEdt->value() ); anObj = anOper->Sew( objList, myTolEdt->value() );
} }
aResult = !anObj->_is_nil(); aResult = !anObj->_is_nil();
@ -334,6 +335,7 @@ bool RepairGUI_SewingDlg::execute( ObjectList& objects )
void RepairGUI_SewingDlg::initSelection() void RepairGUI_SewingDlg::initSelection()
{ {
TColStd_MapOfInteger aTypes; TColStd_MapOfInteger aTypes;
aTypes.Add( GEOM_FACE );
aTypes.Add( GEOM_SHELL ); aTypes.Add( GEOM_SHELL );
aTypes.Add( GEOM_SOLID ); aTypes.Add( GEOM_SOLID );
aTypes.Add( GEOM_COMPOUND ); aTypes.Add( GEOM_COMPOUND );

View File

@ -58,7 +58,7 @@ private:
void initSelection(); void initSelection();
private: private:
GEOM::GEOM_Object_var myObject; QList<GEOM::GeomObjPtr> myObjects;
DlgRef_1SelExt* GroupPoints; DlgRef_1SelExt* GroupPoints;
QCheckBox* myAllowNonManifoldChk; QCheckBox* myAllowNonManifoldChk;

View File

@ -248,15 +248,31 @@ Standard_Boolean ShHealOper_Sewing::getModifications(const TopoDS_Shape& theShap
Standard_Boolean ShHealOper_Sewing::isSewed(const TopoDS_Shape& theShape) const Standard_Boolean ShHealOper_Sewing::isSewed(const TopoDS_Shape& theShape) const
{ {
Standard_Integer nbNewShells =0; // Standard_Integer nbNewShells =0;
Standard_Integer nbOldShells =0; // Standard_Integer nbOldShells =0;
TopExp_Explorer aExpShells(theShape,TopAbs_SHELL); // TopExp_Explorer aExpShells(theShape,TopAbs_SHELL);
for( ; aExpShells.More(); aExpShells.Next()) // for( ; aExpShells.More(); aExpShells.Next())
nbNewShells++; // nbNewShells++;
for( aExpShells.Init(myInitShape,TopAbs_SHELL); aExpShells.More(); aExpShells.Next()) // for( aExpShells.Init(myInitShape,TopAbs_SHELL); aExpShells.More(); aExpShells.Next())
nbOldShells++; // nbOldShells++;
return (nbNewShells != nbOldShells); // return (nbNewShells != nbOldShells);
// EAP, 22745: [EDF] Improvement of Sewing operation
// now myInitShape is ALWAYS a compound of faces -> no shells
int nbNew = 0, nbOld = 0;
TopExp_Explorer exp;
for ( exp.Init( theShape, TopAbs_VERTEX ); exp.More(); exp.Next() ) ++nbNew;
for ( exp.Init( myInitShape, TopAbs_VERTEX ); exp.More(); exp.Next() ) ++nbOld;
if ( nbNew != nbOld )
return true;
for ( exp.Init( theShape, TopAbs_EDGE ); exp.More(); exp.Next() ) ++nbNew;
for ( exp.Init( myInitShape, TopAbs_EDGE ); exp.More(); exp.Next() ) ++nbOld;
if ( nbNew != nbOld )
return true;
return false;
} }
//======================================================================= //=======================================================================
//function : deleteFreeEdges //function : deleteFreeEdges
//purpose : //purpose :