\n To <b>Remove internal faces</b> in the <b>Main Menu</b> select
<b>Repair - > Remove internal faces</b>.
-This operation removes all shared faces from a compound to obtain
+This operation removes all shared faces from given solids to obtain
one or more bigger solids from a set of smaller solids.
\image html remove_webs.png
-\n <b>Arguments:</b> Name + one shape.
+\n <b>Arguments:</b> Name + one or more shapes containing solids.
\n <b>Advanced option:</b>
\ref restore_presentation_parameters_page "Set presentation parameters and sub-shapes from arguments".
<b>Remove Internal Faces</b> if you need to remove them.
\n <b>TUI Command:</b> <br>
-<em>geompy.RemoveInternalFaces( theCompound )</em>,<br>
-where <em>theCompound</em> is a compound of solids.
+<em>geompy.RemoveInternalFaces( theSolids )</em>,<br>
+where <em>theSolids</em> is either a compound or a list of solids.
\n Our <b>TUI Scripts</b> provide you with useful examples of the
\ref tui_remove_webs "Remove Internal Faces" functionality usage.
<li>\subpage change_orientation_operation_page "Change orientation" -
reverses the normals of the selected faces.</li>
<li>\subpage remove_webs_operation_page "Remove internal faces" -
-rebuilds the topology of a compound of solids by removing the faces
+rebuilds the topology of solids by removing the faces
are shared by several solids.</li>
<li>\subpage remove_extra_edges_operation_page "Remove extra edges" -
removes seam and degenerated edges from the given shape.</li>
GEOM_Object SewAllowNonManifold(in ListOfGO theObjects, in double theTolerance);
/*!
- * Rebuild the topology of theCompound of solids by removing
- * of the faces that are shared by several solids.
- * \param theCompound Shape to be processed.
+ * Rebuild the topology of theSolids by removing
+ * the faces that are shared by several solids.
+ * \param theSolids A list of shapes containing solids to be processed.
* \return New GEOM_Object, containing processed shape.
*/
- GEOM_Object RemoveInternalFaces (in GEOM_Object theCompound);
+ GEOM_Object RemoveInternalFaces (in ListOfGO theSolids);
/*!
* \brief Addition of a point to a given edge object.
</message>
<message>
<source>GEOM_REMOVE_WEBS</source>
- <translation>Compound of solids</translation>
+ <translation>Solids</translation>
</message>
<message>
<source>REMOVE_WEBS_NEW_OBJ_NAME</source>
Sew(&HI, anOriginalShape, aShape, true);
break;
case REMOVE_INTERNAL_FACES:
- RemoveInternalFaces(anOriginalShape, aShape);
+ RemoveInternalFaces(&HI, anOriginalShape, aShape);
break;
case DIVIDE_EDGE:
AddPointOnEdge(&HI, anOriginalShape, aShape);
//function : RemoveInternalFaces
//purpose :
//=======================================================================
-Standard_Boolean GEOMImpl_HealingDriver::RemoveInternalFaces (const TopoDS_Shape& theOriginalShape,
- TopoDS_Shape& theOutShape) const
+Standard_Boolean
+GEOMImpl_HealingDriver::RemoveInternalFaces (GEOMImpl_IHealing* theHI,
+ const TopoDS_Shape& theOriginalShape,
+ TopoDS_Shape& theOutShape) const
{
+ // get all input shapes
+ TopTools_SequenceOfShape shapeSeq;
+ shapeSeq.Append( theOriginalShape );
+ Handle(TColStd_HSequenceOfTransient) otherObjs = theHI->GetShapes();
+ if ( !otherObjs.IsNull() )
+ 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");
+ shapeSeq.Append( aShape );
+ }
+
+ // pass input shapes to the algorithm
GEOMAlgo_RemoverWebs aTool;
- aTool.SetShape(theOriginalShape);
+ if ( shapeSeq.Length() == 1 )
+ {
+ aTool.SetShape( shapeSeq.First() );
+ }
+ else
+ {
+ TopoDS_Compound solidCompound;
+ BRep_Builder builder;
+ builder.MakeCompound( solidCompound );
+ for ( int ind = 1; ind <= shapeSeq.Length(); ++ind )
+ for ( TopExp_Explorer so( shapeSeq( ind ), TopAbs_SOLID ); so.More(); so.Next() )
+ builder.Add( solidCompound, so.Current() );
+
+ aTool.SetShape( solidCompound );
+ }
+
+ // run the algorithm
aTool.Perform();
if (aTool.ErrorStatus() == 0) { // OK
break;
case REMOVE_INTERNAL_FACES:
theOperationName = "REMOVE_WEBS";
- AddParam( theParams, "Selected shape", aCI.GetOriginal() );
+ AddParam( theParams, "Selected shapes", aCI.GetOriginalAndShapes() );
break;
default:
return false;
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&, Standard_Boolean ) const;
- Standard_Boolean RemoveInternalFaces ( const TopoDS_Shape&, TopoDS_Shape& ) const;
+ Standard_Boolean RemoveInternalFaces ( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) 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;
* RemoveInternalFaces
*/
//=============================================================================
-Handle(GEOM_Object) GEOMImpl_IHealingOperations::RemoveInternalFaces (Handle(GEOM_Object) theObject)
+Handle(GEOM_Object)
+GEOMImpl_IHealingOperations::RemoveInternalFaces (std::list< Handle(GEOM_Object)> & theSolids)
{
// set error code, check parameters
SetErrorCode(KO);
- if (theObject.IsNull())
+ if (theSolids.empty())
return NULL;
- Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
- if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be processed
+ Handle(TColStd_HSequenceOfTransient) objects = GEOM_Object::GetLastFunctions( theSolids );
+ if ( objects.IsNull() || objects->IsEmpty() ) {
+ SetErrorCode("NULL argument shape");
+ return NULL;
+ }
// Add a new object
Handle(GEOM_Object) aNewObject = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
//Add the function
- aFunction = aNewObject->AddFunction(GEOMImpl_HealingDriver::GetID(), REMOVE_INTERNAL_FACES);
+ Handle(GEOM_Function)
+ aFunction = aNewObject->AddFunction(GEOMImpl_HealingDriver::GetID(), REMOVE_INTERNAL_FACES);
if (aFunction.IsNull()) return NULL;
//Check if the function is set correctly
// prepare "data container" class IHealing
GEOMImpl_IHealing HI (aFunction);
- HI.SetOriginal(aLastFunction);
+ HI.SetOriginal( theSolids.front()->GetLastFunction() ); objects->Remove(1);
+ HI.SetShapes( objects );
//Compute the result
try {
}
//Make a Python command
- GEOM::TPythonDump(aFunction) << aNewObject << " = geompy.RemoveInternalFaces(" << theObject << ")";
+ GEOM::TPythonDump(aFunction) << aNewObject << " = geompy.RemoveInternalFaces(" << theSolids << ")";
SetErrorCode(OK);
return aNewObject;
double theTolerance,
bool isAllowNonManifold);
- Standard_EXPORT Handle(GEOM_Object) RemoveInternalFaces (Handle(GEOM_Object) theObject);
+ Standard_EXPORT Handle(GEOM_Object) RemoveInternalFaces (std::list< Handle(GEOM_Object)> & theSolids);
Standard_EXPORT Handle(GEOM_Object) DivideEdge( Handle(GEOM_Object) theObject,
int theIndex,
* RemoveInternalFaces
*/
//=============================================================================
-GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::RemoveInternalFaces (GEOM::GEOM_Object_ptr theCompound)
+GEOM::GEOM_Object_ptr
+GEOM_IHealingOperations_i::RemoveInternalFaces (const GEOM::ListOfGO& theSolids)
{
GEOM::GEOM_Object_var aGEOMObject;
// Set a not done flag
GetOperations()->SetNotDone();
- // Get the object
- Handle(GEOM_Object) anObject = GetObjectImpl(theCompound);
- if (anObject.IsNull())
+ // Get the objects
+ std::list< Handle(GEOM_Object) > aShapes;
+ if (! GetListOfObjectsImpl( theSolids, aShapes ))
return aGEOMObject._retn();
// Perform
- Handle(GEOM_Object) aNewObject = GetOperations()->RemoveInternalFaces(anObject);
+ Handle(GEOM_Object) aNewObject = GetOperations()->RemoveInternalFaces(aShapes);
if (!GetOperations()->IsDone() || aNewObject.IsNull())
return aGEOMObject._retn();
GEOM::GEOM_Object_ptr SewAllowNonManifold (const GEOM::ListOfGO & theObject,
CORBA::Double theTolerance);
- GEOM::GEOM_Object_ptr RemoveInternalFaces (GEOM::GEOM_Object_ptr theCompound);
+ GEOM::GEOM_Object_ptr RemoveInternalFaces (const GEOM::ListOfGO& theSolids);
GEOM::GEOM_Object_ptr DivideEdge (GEOM::GEOM_Object_ptr theObject,
CORBA::Short theIndex,
self._autoPublish(anObj, theName, "sewed")
return anObj
- ## Rebuild the topology of theCompound of solids by removing
- # of the faces that are shared by several solids.
- # @param theCompound Shape to be processed.
+ ## Rebuild the topology of theSolids by removing
+ # the faces that are shared by several solids.
+ # @param theSolids A compound or a list of solids to be processed.
# @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.
#
# @ref tui_remove_webs "Example"
@ManageTransactions("HealOp")
- def RemoveInternalFaces (self, theCompound, theName=None):
+ def RemoveInternalFaces (self, theSolids, theName=None):
"""
- Rebuild the topology of theCompound of solids by removing
- of the faces that are shared by several solids.
+ Rebuild the topology of theSolids by removing
+ the faces that are shared by several solids.
Parameters:
- theCompound Shape to be processed.
+ theSolids A compound or a list of solids to be processed.
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.
New GEOM.GEOM_Object, containing processed shape.
"""
# Example: see GEOM_TestHealing.py
- anObj = self.HealOp.RemoveInternalFaces(theCompound)
+ anObj = self.HealOp.RemoveInternalFaces(ToList(theSolids))
RaiseIfFailed("RemoveInternalFaces", self.HealOp)
self._autoPublish(anObj, theName, "removeWebs")
return anObj
GroupPoints = new DlgRef_1Sel( centralWidget() );
GroupPoints->GroupBox1->setTitle( tr( "GEOM_REMOVE_WEBS" ) );
- GroupPoints->TextLabel1->setText( tr( "GEOM_SELECTED_SHAPE" ) );
+ GroupPoints->TextLabel1->setText( tr( "GEOM_SELECTED_SHAPES" ) );
GroupPoints->PushButton1->setIcon( image1 );
GroupPoints->LineEdit1->setReadOnly( true );
initName();
myEditCurrentArgument->setText("");
- myObject = GEOM::GEOM_Object::_nil();
+ myObjects.clear();
myOkObject = false;
void RepairGUI_RemoveWebsDlg::SelectionIntoArgument()
{
myEditCurrentArgument->setText( "" );
- QString aName;
-
- LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
- SALOME_ListIO aSelList;
- aSelMgr->selectedObjects(aSelList);
-
- if (myEditCurrentArgument == GroupPoints->LineEdit1) {
- if (aSelList.Extent() != 1) {
- if (myEditCurrentArgument == GroupPoints->LineEdit1)
- myOkObject = false;
- return;
- }
- }
-
- // nbSel == 1
- GEOM::GEOM_Object_ptr aSelectedObject =
- GEOMBase::ConvertIOinGEOMObject(aSelList.First());
+ myObjects.clear();
+ myOkObject = false;
- if (CORBA::is_nil(aSelectedObject))
- return;
+ myObjects = getSelected( TopAbs_SHAPE, -1 );
- if (myEditCurrentArgument == GroupPoints->LineEdit1) {
- myObject = aSelectedObject;
+ if ( !myObjects.isEmpty() ) {
+ QString aName = myObjects.count() > 1 ? QString( "%1_objects").arg( myObjects.count() ) : GEOMBase::GetName( myObjects[0].get() );
myOkObject = true;
+ myEditCurrentArgument->setText( aName );
}
-
- myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject));
}
//=================================================================================
void RepairGUI_RemoveWebsDlg::activateSelection()
{
TColStd_MapOfInteger aTypes;
- //aTypes.Add( GEOM_SOLID );
+ aTypes.Add( GEOM_SOLID );
aTypes.Add( GEOM_COMPOUND );
globalSelection( aTypes );
}
//=================================================================================
bool RepairGUI_RemoveWebsDlg::execute (ObjectList& objects)
{
+ GEOM::ListOfGO_var objList = new GEOM::ListOfGO;
+ objList->length( myObjects.count() );
+ for ( int i = 0; i < myObjects.count(); ++i )
+ objList[i] = myObjects[i].copy();
+
GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow(getOperation());
- GEOM::GEOM_Object_var anObj = anOper->RemoveInternalFaces(myObject);
+ GEOM::GEOM_Object_var anObj = anOper->RemoveInternalFaces(objList);
if (!anObj->_is_nil())
objects.push_back(anObj._retn());
void activateSelection();
private:
- GEOM::GEOM_Object_var myObject;
+ QList<GEOM::GeomObjPtr> myObjects;
bool myOkObject;
DlgRef_1Sel* GroupPoints;