\n The \b Result will be a \b GEOM_Object.
-\n <b>TUI Command:</b> <em>geompy.MakeSewing(ListOfShape, Precision),</em>
+\n <b>TUI Command:</b> <em>geompy.MakeSewing(ListOfShape, Precision, AllowNonManifold=False),</em>
where \em ListOfShape is list of faces or shells to be sewed, \em Precision is a
-precision for sewing.
+precision for sewing, \em AllowNonManifold flag that allows non-manifold sewing.
\image html repair6.png
*/
GEOM_Object Sew (in GEOM_Object theObject, in double theTolerance);
+ /*!
+ * Sewing of the given object. Allows non-manifold sewing.
+ * \param theObject Shape to be processed.
+ * \param theTolerance Required tolerance value.
+ * \return New GEOM_Object, containing processed shape.
+ */
+ GEOM_Object SewAllowNonManifold(in GEOM_Object theObject, in double theTolerance);
+
/*!
* \brief Addition of a point to a given edge object.
* \param theObject Shape to be processed.
<source>GEOM_SEWING_TITLE</source>
<translation>Topological sewing</translation>
</message>
+ <message>
+ <source>GEOM_ALLOW_NON_MANIFOLD</source>
+ <translation>Allow Non Manifold</translation>
+ </message>
<message>
<source>GEOM_SHAPE</source>
<translation>Shape</translation>
RemoveHoles(&HI, anOriginalShape, aShape);
break;
case SEWING:
- Sew(&HI, anOriginalShape, aShape);
+ Sew(&HI, anOriginalShape, aShape, false);
+ break;
+ case SEWING_NON_MANIFOLD:
+ Sew(&HI, anOriginalShape, aShape, true);
break;
case DIVIDE_EDGE:
AddPointOnEdge(&HI, anOriginalShape, aShape);
//=======================================================================
Standard_Boolean GEOMImpl_HealingDriver::Sew (GEOMImpl_IHealing* theHI,
const TopoDS_Shape& theOriginalShape,
- TopoDS_Shape& theOutShape) const
+ TopoDS_Shape& theOutShape,
+ Standard_Boolean isAllowNonManifold) const
{
Standard_Real aTol = theHI->GetTolerance();
ShHealOper_Sewing aHealer (theOriginalShape, aTol);
+ // Set non-manifold mode.
+ aHealer.SetNonManifoldMode(isAllowNonManifold);
+
Standard_Boolean aResult = aHealer.Perform();
if (aResult)
Standard_Boolean CloseContour ( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const;
Standard_Boolean RemoveIntWires( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const;
Standard_Boolean RemoveHoles ( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const;
- Standard_Boolean Sew ( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const;
+ Standard_Boolean Sew ( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape&, Standard_Boolean ) const;
Standard_Boolean AddPointOnEdge( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const;
Standard_Boolean ChangeOrientation( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const;
void LimitTolerance( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const;
*/
//=============================================================================
Handle(GEOM_Object) GEOMImpl_IHealingOperations::Sew (Handle(GEOM_Object) theObject,
- double theTolerance)
+ double theTolerance,
+ bool isAllowNonManifold)
{
// set error code, check parameters
SetErrorCode(KO);
Handle(GEOM_Object) aNewObject = GetEngine()->AddObject( GetDocID(), GEOM_COPY );
//Add the function
- aFunction = aNewObject->AddFunction(GEOMImpl_HealingDriver::GetID(), SEWING);
+ int aFunctionType = (isAllowNonManifold ? SEWING_NON_MANIFOLD : SEWING);
+
+ aFunction = aNewObject->AddFunction(GEOMImpl_HealingDriver::GetID(), aFunctionType);
if (aFunction.IsNull()) return NULL;
}
//Make a Python command
- GEOM::TPythonDump(aFunction) << aNewObject << " = geompy.Sew("
- << theObject << ", " << theTolerance << ")";
+ GEOM::TPythonDump pd(aFunction);
+
+ pd << aNewObject << " = geompy.Sew(" << theObject << ", " << theTolerance;
+
+ if (isAllowNonManifold) {
+ pd << ", true";
+ }
+
+ pd << ")";
SetErrorCode(OK);
return aNewObject;
const Handle(TColStd_HArray1OfInteger)& theWires);
Standard_EXPORT Handle(GEOM_Object) Sew( Handle(GEOM_Object) theObject,
- double theTolerance );
+ double theTolerance,
+ bool isAllowNonManifold);
Standard_EXPORT Handle(GEOM_Object) DivideEdge( Handle(GEOM_Object) theObject,
int theIndex,
#define CHANGE_ORIENTATION 8
#define LIMIT_TOLERANCE 9
#define FUSE_COLLINEAR_EDGES 10
+#define SEWING_NON_MANIFOLD 11
#define BASIC_FILLING 1
// Perform
Handle(GEOM_Object) aNewObject =
- GetOperations()->Sew( anObject, theTolerance );
+ GetOperations()->Sew( anObject, theTolerance, false );
+ if (!GetOperations()->IsDone() || aNewObject.IsNull())
+ return aGEOMObject._retn();
+
+ return GetObject(aNewObject);
+}
+
+//=============================================================================
+/*!
+ * SewAllowNonManifold
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::SewAllowNonManifold (GEOM::GEOM_Object_ptr theObject,
+ CORBA::Double theTolerance)
+{
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ // Set a not done flag
+ GetOperations()->SetNotDone();
+
+ // Check parameters
+ if (theTolerance < 0)
+ return aGEOMObject._retn();
+
+ // Get the object itself
+ Handle(GEOM_Object) anObject = GetObjectImpl(theObject);
+ if (anObject.IsNull())
+ return aGEOMObject._retn();
+
+ // Perform
+ Handle(GEOM_Object) aNewObject =
+ GetOperations()->Sew( anObject, theTolerance, true );
if (!GetOperations()->IsDone() || aNewObject.IsNull())
return aGEOMObject._retn();
GEOM::GEOM_Object_ptr Sew (GEOM::GEOM_Object_ptr theObject,
CORBA::Double theTolerance);
+ GEOM::GEOM_Object_ptr SewAllowNonManifold (GEOM::GEOM_Object_ptr theObject,
+ CORBA::Double theTolerance);
+
GEOM::GEOM_Object_ptr DivideEdge (GEOM::GEOM_Object_ptr theObject,
CORBA::Short theIndex,
CORBA::Double theValue,
## Sewing of some shapes into single shape.
# @param ListShape Shapes to be processed.
# @param theTolerance Required tolerance value.
+ # @param AllowNonManifold Flag that allows non-manifold sewing.
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
# @return New GEOM.GEOM_Object, containing processed shape.
#
# @ref tui_sewing "Example"
- def MakeSewing(self, ListShape, theTolerance, theName=None):
+ def MakeSewing(self, ListShape, theTolerance, AllowNonManifold=False, theName=None):
"""
Sewing of some shapes into single shape.
Parameters:
ListShape Shapes to be processed.
theTolerance Required tolerance value.
+ AllowNonManifold Flag that allows non-manifold sewing.
theName Object name; when specified, this parameter is used
for result publication in the study. Otherwise, if automatic
publication is switched on, default value is used for result name.
# Example: see GEOM_TestHealing.py
comp = self.MakeCompound(ListShape)
# note: auto-publishing is done in self.Sew()
- anObj = self.Sew(comp, theTolerance, theName)
+ anObj = self.Sew(comp, theTolerance, AllowNonManifold, theName)
return anObj
## Sewing of the given object.
# @param theObject Shape to be processed.
# @param theTolerance Required tolerance value.
+ # @param AllowNonManifold Flag that allows non-manifold sewing.
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
# @return New GEOM.GEOM_Object, containing processed shape.
- def Sew(self, theObject, theTolerance, theName=None):
+ def Sew(self, theObject, theTolerance, AllowNonManifold=False, theName=None):
"""
Sewing of the given object.
Parameters:
theObject Shape to be processed.
theTolerance Required tolerance value.
+ AllowNonManifold Flag that allows non-manifold sewing.
theName Object name; when specified, this parameter is used
for result publication in the study. Otherwise, if automatic
publication is switched on, default value is used for result name.
"""
# Example: see MakeSewing() above
theTolerance,Parameters = ParseParameters(theTolerance)
- anObj = self.HealOp.Sew(theObject, theTolerance)
+ if AllowNonManifold:
+ anObj = self.HealOp.SewAllowNonManifold(theObject, theTolerance)
+ else:
+ anObj = self.HealOp.Sew(theObject, theTolerance)
RaiseIfFailed("Sew", self.HealOp)
anObj.SetParameters(Parameters)
self._autoPublish(anObj, theName, "sewed")
QGridLayout* aLay = new QGridLayout( GroupPoints->Box );
aLay->setMargin( 0 ); aLay->setSpacing( 6 );
+ myAllowNonManifoldChk = new QCheckBox (tr("GEOM_ALLOW_NON_MANIFOLD"), GroupPoints->Box);
myTolEdt = new SalomeApp_DoubleSpinBox( GroupPoints->Box );
initSpinBox( myTolEdt, 0.0, 100.0, DEFAULT_TOLERANCE_VALUE, "len_tol_precision" );
myTolEdt->setValue( DEFAULT_TOLERANCE_VALUE );
QLabel* aLbl1 = new QLabel( tr( "GEOM_TOLERANCE" ), GroupPoints->Box );
myFreeBoundBtn = new QPushButton( tr( "GEOM_DETECT" ) + QString( " [%1]" ).arg( tr( "GEOM_FREE_BOUNDARIES" ) ),
GroupPoints->Box );
- aLay->addWidget( aLbl1, 0, 0 );
- aLay->addWidget( myTolEdt, 0, 1 );
- aLay->addWidget( myFreeBoundBtn, 1, 0, 1, 2 );
+ aLay->addWidget( myAllowNonManifoldChk, 0, 0 );
+ aLay->addWidget( aLbl1, 1, 0 );
+ aLay->addWidget( myTolEdt, 1, 1 );
+ aLay->addWidget( myFreeBoundBtn, 2, 0, 1, 2 );
QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
myClosed = -1;
}
else {
- GEOM::GEOM_Object_var anObj = anOper->Sew( myObject, myTolEdt->value() );
+ GEOM::GEOM_Object_var anObj;
+
+ if (myAllowNonManifoldChk->isChecked()) {
+ anObj = anOper->SewAllowNonManifold( myObject, myTolEdt->value() );
+ } else {
+ anObj = anOper->Sew( myObject, myTolEdt->value() );
+ }
+
aResult = !anObj->_is_nil();
if ( aResult )
{
#include <GEOMBase_Skeleton.h>
class DlgRef_1SelExt;
+class QCheckBox;
class SalomeApp_DoubleSpinBox;
class QPushButton;
GEOM::GEOM_Object_var myObject;
DlgRef_1SelExt* GroupPoints;
+ QCheckBox* myAllowNonManifoldChk;
SalomeApp_DoubleSpinBox* myTolEdt;
QPushButton* myFreeBoundBtn;