Mantis issue 0021934: Delete the internal faces of an object

This commit is contained in:
jfa 2013-06-14 12:20:21 +00:00
parent d291bd2941
commit 8fe997ae88
27 changed files with 677 additions and 16 deletions

View File

@ -99,6 +99,7 @@ GOOD_TESTS = \
repairing_operations_ex08.py \ repairing_operations_ex08.py \
repairing_operations_ex10.py \ repairing_operations_ex10.py \
repairing_operations_ex11.py \ repairing_operations_ex11.py \
repairing_operations_ex12.py \
sketcher.py \ sketcher.py \
tolerance.py \ tolerance.py \
topological_geom_objs_ex01.py \ topological_geom_objs_ex01.py \

View File

@ -0,0 +1,26 @@
# Remove internal(shared) faces from a compound
import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
# create solids with some coincident faces
Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
Translation_1 = geompy.MakeTranslation(Box_1, 200, 0, 0)
Translation_2 = geompy.MakeTranslation(Box_1, 200, 200, 0)
geompy.addToStudy(Box_1, 'Box_1')
geompy.addToStudy(Translation_1, 'Translation_1')
geompy.addToStudy(Translation_2, 'Translation_2')
# partition three solids to obtain shared faces
Partition_1 = geompy.MakePartition([Box_1, Translation_1, Translation_2])
geompy.addToStudy(Partition_1, 'Partition_1')
# remove shared faces to obtain one solid instead of three
Joined_1 = geompy.RemoveInternalFaces(Partition_1)
geompy.addToStudy(Joined_1, 'Joined_1')
salome.sg.updateObjBrowser(1)

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -0,0 +1,27 @@
/*!
\page remove_webs_operation_page Remove Internal Faces
\n To <b>Remove internal faces</b> in the <b>Main Menu</b> select
<b>Repair - > Remove internal faces</b>.
\n This operation removes all shared faces from a compound to obtain
one or more bigger solids from the set of smaller solids.
\image html remove_webs.png
\n <b>Arguments:</b> Name + one shape.
\n <b>Advanced option:</b>
\ref restore_presentation_parameters_page "Set presentation parameters and sub-shapes from arguments".
\note Only shared faces will be removed. Coincident but not shared
faces will stay as is, use GlueFaces or MakePartition before
RemoveInternalFaces if you need to remove them.
\n <b>TUI Command:</b> <em>geompy.RemoveInternalFaces(theCompound)</em>,
where <em>theCompound</em> is a compound of solids.
\n Our <b>TUI Scripts</b> provide you with useful examples of the
\ref tui_remove_webs "Remove Internal Faces" functionality usage.
*/

View File

@ -25,6 +25,9 @@ to set new tolerance value for the given shape.</li>
splits an edge in two.</li> splits an edge in two.</li>
<li>\subpage change_orientation_operation_page "Change orientation" - <li>\subpage change_orientation_operation_page "Change orientation" -
reverses the normals of the selected faces.</li> 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 of the faces
that are shared by several solids.</li>
<li>\subpage remove_extra_edges_operation_page "Remove extra edges" - <li>\subpage remove_extra_edges_operation_page "Remove extra edges" -
removes seam and degenerated edges from the given shape.</li> removes seam and degenerated edges from the given shape.</li>
<li>\subpage fuse_edges_operation_page "Fuse Collinear Edges within a Wire" - <li>\subpage fuse_edges_operation_page "Fuse Collinear Edges within a Wire" -

View File

@ -46,4 +46,8 @@
<br><h2>Fuse Collinear Edges within a Wire</h2> <br><h2>Fuse Collinear Edges within a Wire</h2>
\tui_script{repairing_operations_ex11.py} \tui_script{repairing_operations_ex11.py}
\anchor tui_remove_webs
<br><h2>Remove internal(shared) faces</h2>
\tui_script{repairing_operations_ex12.py}
*/ */

View File

@ -3331,6 +3331,14 @@ module GEOM
*/ */
GEOM_Object SewAllowNonManifold(in GEOM_Object theObject, in double theTolerance); GEOM_Object SewAllowNonManifold(in GEOM_Object theObject, 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.
* \return New GEOM_Object, containing processed shape.
*/
GEOM_Object RemoveInternalFaces (in GEOM_Object theCompound);
/*! /*!
* \brief Addition of a point to a given edge object. * \brief Addition of a point to a given edge object.
* \param theObject Shape to be processed. * \param theObject Shape to be processed.

View File

@ -239,8 +239,9 @@ propagate.png \
redo.png \ redo.png \
undo.png \ undo.png \
glue2.png \ glue2.png \
remove_webs.png \
remove_extra_edges.png \ remove_extra_edges.png \
union_faces.png \ union_faces.png \
coordsys.png \ coordsys.png \
translation.png translation.png

BIN
resources/remove_webs.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 859 B

View File

@ -151,6 +151,10 @@
<source>ICON_DLG_CHANGE_DIRECTION</source> <source>ICON_DLG_CHANGE_DIRECTION</source>
<translation>change_direction.png</translation> <translation>change_direction.png</translation>
</message> </message>
<message>
<source>ICON_DLG_REMOVE_WEBS</source>
<translation>remove_webs.png</translation>
</message>
<message> <message>
<source>ICON_DLG_REMOVE_EXTRA_EDGES</source> <source>ICON_DLG_REMOVE_EXTRA_EDGES</source>
<translation>remove_extra_edges.png</translation> <translation>remove_extra_edges.png</translation>
@ -1015,6 +1019,10 @@
<source>ICO_PLANE</source> <source>ICO_PLANE</source>
<translation>plane.png</translation> <translation>plane.png</translation>
</message> </message>
<message>
<source>ICO_REMOVE_WEBS</source>
<translation>remove_webs.png</translation>
</message>
<message> <message>
<source>ICO_REMOVE_EXTRA_EDGES</source> <source>ICO_REMOVE_EXTRA_EDGES</source>
<translation>remove_extra_edges.png</translation> <translation>remove_extra_edges.png</translation>

View File

@ -1576,10 +1576,6 @@ Please, select face, shell or solid and try again</translation>
<source>GEOM_REMOVE_INTERNAL_WIRES_TITLE</source> <source>GEOM_REMOVE_INTERNAL_WIRES_TITLE</source>
<translation>Suppress internal wires</translation> <translation>Suppress internal wires</translation>
</message> </message>
<message>
<source>GEOM_REMOVE_WEBS</source>
<translation>Remove webs</translation>
</message>
<message> <message>
<source>GEOM_REQUIRED_DEGREE</source> <source>GEOM_REQUIRED_DEGREE</source>
<translation>Required degree</translation> <translation>Required degree</translation>
@ -4508,6 +4504,30 @@ Please, select face, shell or solid and try again</translation>
<source>GEOM_CENTER_2POINTS</source> <source>GEOM_CENTER_2POINTS</source>
<translation>Center and two points</translation> <translation>Center and two points</translation>
</message> </message>
<message>
<source>GEOM_REMOVE_WEBS_TITLE</source>
<translation type="unfinished">Remove internal faces</translation>
</message>
<message>
<source>GEOM_REMOVE_WEBS</source>
<translation type="unfinished">Compound of solids</translation>
</message>
<message>
<source>REMOVE_WEBS_NEW_OBJ_NAME</source>
<translation type="unfinished">NoInternalFaces</translation>
</message>
<message>
<source>TOP_REMOVE_WEBS</source>
<translation type="unfinished">Remove internal faces</translation>
</message>
<message>
<source>MEN_REMOVE_WEBS</source>
<translation type="unfinished">Remove Internal Faces</translation>
</message>
<message>
<source>STB_REMOVE_WEBS</source>
<translation type="unfinished">Remove internal faces</translation>
</message>
<message> <message>
<source>GEOM_REMOVE_EXTRA_EDGES_TITLE</source> <source>GEOM_REMOVE_EXTRA_EDGES_TITLE</source>
<translation>Remove extra edges</translation> <translation>Remove extra edges</translation>

View File

@ -1574,10 +1574,6 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
<source>GEOM_REMOVE_INTERNAL_WIRES_TITLE</source> <source>GEOM_REMOVE_INTERNAL_WIRES_TITLE</source>
<translation>Supprimer les contours internes</translation> <translation>Supprimer les contours internes</translation>
</message> </message>
<message>
<source>GEOM_REMOVE_WEBS</source>
<translation>Supprimer les toiles</translation>
</message>
<message> <message>
<source>GEOM_REQUIRED_DEGREE</source> <source>GEOM_REQUIRED_DEGREE</source>
<translation>Degré nécessaire</translation> <translation>Degré nécessaire</translation>
@ -4506,6 +4502,30 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
<source>GEOM_CENTER_2POINTS</source> <source>GEOM_CENTER_2POINTS</source>
<translation>Centre et deux points</translation> <translation>Centre et deux points</translation>
</message> </message>
<message>
<source>GEOM_REMOVE_WEBS_TITLE</source>
<translation type="unfinished">Remove internal faces</translation>
</message>
<message>
<source>GEOM_REMOVE_WEBS</source>
<translation type="unfinished">Compound of solids</translation>
</message>
<message>
<source>REMOVE_WEBS_NEW_OBJ_NAME</source>
<translation type="unfinished">NoInternalFaces</translation>
</message>
<message>
<source>TOP_REMOVE_WEBS</source>
<translation type="unfinished">Remove internal faces</translation>
</message>
<message>
<source>MEN_REMOVE_WEBS</source>
<translation type="unfinished">Remove Internal Faces</translation>
</message>
<message>
<source>STB_REMOVE_WEBS</source>
<translation type="unfinished">Remove internal faces</translation>
</message>
<message> <message>
<source>GEOM_REMOVE_EXTRA_EDGES_TITLE</source> <source>GEOM_REMOVE_EXTRA_EDGES_TITLE</source>
<translation>Supprimer les arêtes inutiles</translation> <translation>Supprimer les arêtes inutiles</translation>

View File

@ -542,6 +542,7 @@ void GeometryGUI::OnGUIEvent( int id, const QVariant& theParam )
case GEOMOp::OpGlueFaces: // MENU REPAIR - GLUE FACES case GEOMOp::OpGlueFaces: // MENU REPAIR - GLUE FACES
case GEOMOp::OpGlueEdges: // MENU REPAIR - GLUE EDGES case GEOMOp::OpGlueEdges: // MENU REPAIR - GLUE EDGES
case GEOMOp::OpLimitTolerance: // MENU REPAIR - LIMIT TOLERANCE case GEOMOp::OpLimitTolerance: // MENU REPAIR - LIMIT TOLERANCE
case GEOMOp::OpRemoveWebs: // MENU REPAIR - REMOVE INTERNAL FACES
case GEOMOp::OpRemoveExtraEdges: // MENU REPAIR - REMOVE EXTRA EDGES case GEOMOp::OpRemoveExtraEdges: // MENU REPAIR - REMOVE EXTRA EDGES
case GEOMOp::OpFuseEdges: // MENU REPAIR - FUSE COLLINEAR EDGES case GEOMOp::OpFuseEdges: // MENU REPAIR - FUSE COLLINEAR EDGES
case GEOMOp::OpUnionFaces: // MENU REPAIR - UNION FACES case GEOMOp::OpUnionFaces: // MENU REPAIR - UNION FACES
@ -823,6 +824,7 @@ void GeometryGUI::initialize( CAM_Application* app )
createGeomAction( GEOMOp::OpFreeBoundaries, "CHECK_FREE_BNDS" ); createGeomAction( GEOMOp::OpFreeBoundaries, "CHECK_FREE_BNDS" );
createGeomAction( GEOMOp::OpFreeFaces, "CHECK_FREE_FACES" ); createGeomAction( GEOMOp::OpFreeFaces, "CHECK_FREE_FACES" );
createGeomAction( GEOMOp::OpOrientation, "CHANGE_ORIENTATION" ); createGeomAction( GEOMOp::OpOrientation, "CHANGE_ORIENTATION" );
createGeomAction( GEOMOp::OpRemoveWebs, "REMOVE_WEBS" );
createGeomAction( GEOMOp::OpRemoveExtraEdges, "REMOVE_EXTRA_EDGES" ); createGeomAction( GEOMOp::OpRemoveExtraEdges, "REMOVE_EXTRA_EDGES" );
createGeomAction( GEOMOp::OpFuseEdges, "FUSE_EDGES" ); createGeomAction( GEOMOp::OpFuseEdges, "FUSE_EDGES" );
createGeomAction( GEOMOp::OpUnionFaces, "UNION_FACES" ); createGeomAction( GEOMOp::OpUnionFaces, "UNION_FACES" );
@ -1055,6 +1057,7 @@ void GeometryGUI::initialize( CAM_Application* app )
//createMenu( GEOMOp::OpFreeBoundaries, repairId, -1 ); //createMenu( GEOMOp::OpFreeBoundaries, repairId, -1 );
//createMenu( GEOMOp::OpFreeFaces, repairId, -1 ); //createMenu( GEOMOp::OpFreeFaces, repairId, -1 );
createMenu( GEOMOp::OpOrientation, repairId, -1 ); createMenu( GEOMOp::OpOrientation, repairId, -1 );
createMenu( GEOMOp::OpRemoveWebs, repairId, -1 );
createMenu( GEOMOp::OpRemoveExtraEdges, repairId, -1 ); createMenu( GEOMOp::OpRemoveExtraEdges, repairId, -1 );
createMenu( GEOMOp::OpFuseEdges, repairId, -1 ); createMenu( GEOMOp::OpFuseEdges, repairId, -1 );
createMenu( GEOMOp::OpUnionFaces, repairId, -1 ); createMenu( GEOMOp::OpUnionFaces, repairId, -1 );

View File

@ -162,6 +162,7 @@ namespace GEOMOp {
OpGlueEdges = 4013, // MENU REPAIR - GLUE EDGES OpGlueEdges = 4013, // MENU REPAIR - GLUE EDGES
OpFuseEdges = 4014, // MENU REPAIR - FUSE COLLINEAR EDGES OpFuseEdges = 4014, // MENU REPAIR - FUSE COLLINEAR EDGES
OpUnionFaces = 4015, // MENU REPAIR - UNION FACES OpUnionFaces = 4015, // MENU REPAIR - UNION FACES
OpRemoveWebs = 4016, // MENU REPAIR - REMOVE INTERNAL FACES
// MeasureGUI ------------------//-------------------------------- // MeasureGUI ------------------//--------------------------------
OpProperties = 5000, // MENU MEASURES - PROPERTIES OpProperties = 5000, // MENU MEASURES - PROPERTIES
OpCenterMass = 5001, // MENU MEASURES - CENTRE OF MASS OpCenterMass = 5001, // MENU MEASURES - CENTRE OF MASS

View File

@ -30,6 +30,9 @@
#include <GEOMImpl_GlueDriver.hxx> #include <GEOMImpl_GlueDriver.hxx>
#include <GEOMImpl_ShapeDriver.hxx> #include <GEOMImpl_ShapeDriver.hxx>
#include <GEOMUtils.hxx>
#include <GEOMAlgo_RemoverWebs.hxx>
#include <ShHealOper_ShapeProcess.hxx> #include <ShHealOper_ShapeProcess.hxx>
#include <ShHealOper_RemoveFace.hxx> #include <ShHealOper_RemoveFace.hxx>
#include <ShHealOper_CloseContour.hxx> #include <ShHealOper_CloseContour.hxx>
@ -138,6 +141,9 @@ Standard_Integer GEOMImpl_HealingDriver::Execute(TFunction_Logbook& log) const
case SEWING_NON_MANIFOLD: case SEWING_NON_MANIFOLD:
Sew(&HI, anOriginalShape, aShape, true); Sew(&HI, anOriginalShape, aShape, true);
break; break;
case REMOVE_INTERNAL_FACES:
RemoveInternalFaces(anOriginalShape, aShape);
break;
case DIVIDE_EDGE: case DIVIDE_EDGE:
AddPointOnEdge(&HI, anOriginalShape, aShape); AddPointOnEdge(&HI, anOriginalShape, aShape);
break; break;
@ -441,6 +447,33 @@ Standard_Boolean GEOMImpl_HealingDriver::Sew (GEOMImpl_IHealing* theHI,
return aResult; return aResult;
} }
//=======================================================================
//function : RemoveInternalFaces
//purpose :
//=======================================================================
Standard_Boolean GEOMImpl_HealingDriver::RemoveInternalFaces (const TopoDS_Shape& theOriginalShape,
TopoDS_Shape& theOutShape) const
{
GEOMAlgo_RemoverWebs aTool;
aTool.SetShape(theOriginalShape);
aTool.Perform();
if (aTool.ErrorStatus() != 0)
StdFail_NotDone::Raise("GEOMAlgo_RemoverWebs failed!");
theOutShape = aTool.Result();
// as GEOMAlgo_RemoverWebs always produces compound, lets simplify it
// for the case, if it contains only one sub-shape
TopTools_ListOfShape listShapeRes;
GEOMUtils::AddSimpleShapes(theOutShape, listShapeRes);
if (listShapeRes.Extent() == 1) {
theOutShape = listShapeRes.First();
}
return Standard_True;
}
//======================================================================= //=======================================================================
//function : AddPointOnEdge //function : AddPointOnEdge
//purpose : //purpose :

View File

@ -172,6 +172,7 @@ private:
Standard_Boolean RemoveIntWires( 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 RemoveHoles ( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const;
Standard_Boolean Sew ( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape&, Standard_Boolean ) 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 AddPointOnEdge( 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; Standard_Boolean ChangeOrientation( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const;
void LimitTolerance( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const; void LimitTolerance( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const;

View File

@ -626,7 +626,7 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::Sew (Handle(GEOM_Object) theObj
HI.SetTolerance( theTolerance ); HI.SetTolerance( theTolerance );
HI.SetOriginal( aLastFunction ); HI.SetOriginal( aLastFunction );
//Compute the translation //Compute the result
try { try {
#if OCC_VERSION_LARGE > 0x06010000 #if OCC_VERSION_LARGE > 0x06010000
OCC_CATCH_SIGNALS; OCC_CATCH_SIGNALS;
@ -637,9 +637,8 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::Sew (Handle(GEOM_Object) theObj
return NULL; return NULL;
} }
} }
catch (Standard_Failure) catch (Standard_Failure) {
{ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
SetErrorCode(aFail->GetMessageString()); SetErrorCode(aFail->GetMessageString());
return NULL; return NULL;
} }
@ -659,6 +658,60 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::Sew (Handle(GEOM_Object) theObj
return aNewObject; return aNewObject;
} }
//=============================================================================
/*!
* RemoveInternalFaces
*/
//=============================================================================
Handle(GEOM_Object) GEOMImpl_IHealingOperations::RemoveInternalFaces (Handle(GEOM_Object) theObject)
{
// set error code, check parameters
SetErrorCode(KO);
if (theObject.IsNull())
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
// 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);
if (aFunction.IsNull()) return NULL;
//Check if the function is set correctly
if (aFunction->GetDriverGUID() != GEOMImpl_HealingDriver::GetID()) return NULL;
// prepare "data container" class IHealing
GEOMImpl_IHealing HI (aFunction);
HI.SetOriginal(aLastFunction);
//Compute the result
try {
#if OCC_VERSION_LARGE > 0x06010000
OCC_CATCH_SIGNALS;
#endif
if (!GetSolver()->ComputeFunction(aFunction))
{
SetErrorCode("Healing driver failed");
return NULL;
}
}
catch (Standard_Failure) {
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
SetErrorCode(aFail->GetMessageString());
return NULL;
}
//Make a Python command
GEOM::TPythonDump(aFunction) << aNewObject << " = geompy.RemoveInternalFaces(" << theObject << ")";
SetErrorCode(OK);
return aNewObject;
}
//============================================================================= //=============================================================================
/*! /*!
* DivideEdge * DivideEdge

View File

@ -74,6 +74,8 @@ class GEOMImpl_IHealingOperations : public GEOM_IOperations {
double theTolerance, double theTolerance,
bool isAllowNonManifold); bool isAllowNonManifold);
Standard_EXPORT Handle(GEOM_Object) RemoveInternalFaces (Handle(GEOM_Object) theObject);
Standard_EXPORT Handle(GEOM_Object) DivideEdge( Handle(GEOM_Object) theObject, Standard_EXPORT Handle(GEOM_Object) DivideEdge( Handle(GEOM_Object) theObject,
int theIndex, int theIndex,
double theValue, double theValue,

View File

@ -301,8 +301,9 @@
#define DIVIDE_EDGE 7 #define DIVIDE_EDGE 7
#define CHANGE_ORIENTATION 8 #define CHANGE_ORIENTATION 8
#define LIMIT_TOLERANCE 9 #define LIMIT_TOLERANCE 9
#define FUSE_COLLINEAR_EDGES 10 #define FUSE_COLLINEAR_EDGES 10
#define SEWING_NON_MANIFOLD 11 #define SEWING_NON_MANIFOLD 11
#define REMOVE_INTERNAL_FACES 12
#define BASIC_FILLING 1 #define BASIC_FILLING 1

View File

@ -394,6 +394,31 @@ GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::SewAllowNonManifold (GEOM::GEOM
return GetObject(aNewObject); return GetObject(aNewObject);
} }
//=============================================================================
/*!
* RemoveInternalFaces
*/
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::RemoveInternalFaces (GEOM::GEOM_Object_ptr theCompound)
{
GEOM::GEOM_Object_var aGEOMObject;
// Set a not done flag
GetOperations()->SetNotDone();
// Get the object
Handle(GEOM_Object) anObject = GetObjectImpl(theCompound);
if (anObject.IsNull())
return aGEOMObject._retn();
// Perform
Handle(GEOM_Object) aNewObject = GetOperations()->RemoveInternalFaces(anObject);
if (!GetOperations()->IsDone() || aNewObject.IsNull())
return aGEOMObject._retn();
return GetObject(aNewObject);
}
//============================================================================= //=============================================================================
/*! /*!
* DivideEdge * DivideEdge

View File

@ -78,6 +78,8 @@ class GEOM_I_EXPORT GEOM_IHealingOperations_i :
GEOM::GEOM_Object_ptr SewAllowNonManifold (GEOM::GEOM_Object_ptr theObject, GEOM::GEOM_Object_ptr SewAllowNonManifold (GEOM::GEOM_Object_ptr theObject,
CORBA::Double theTolerance); CORBA::Double theTolerance);
GEOM::GEOM_Object_ptr RemoveInternalFaces (GEOM::GEOM_Object_ptr theCompound);
GEOM::GEOM_Object_ptr DivideEdge (GEOM::GEOM_Object_ptr theObject, GEOM::GEOM_Object_ptr DivideEdge (GEOM::GEOM_Object_ptr theObject,
CORBA::Short theIndex, CORBA::Short theIndex,
CORBA::Double theValue, CORBA::Double theValue,

View File

@ -368,6 +368,25 @@ def TestFuseEdges (geompy):
ii = ii + 1 ii = ii + 1
pass pass
def TestRemoveWebs (geompy):
# create solids with some coincident faces
Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
Translation_1 = geompy.MakeTranslation(Box_1, 200, 0, 0)
Translation_2 = geompy.MakeTranslation(Box_1, 200, 200, 0)
geompy.addToStudy(Box_1, 'Box_1')
geompy.addToStudy(Translation_1, 'Translation_1')
geompy.addToStudy(Translation_2, 'Translation_2')
# partition three solids to obtain shared faces
Partition_1 = geompy.MakePartition([Box_1, Translation_1, Translation_2])
geompy.addToStudy(Partition_1, 'Partition_1')
# remove shared faces to obtain one solid instead of three
Joined_1 = geompy.RemoveInternalFaces(Partition_1)
geompy.addToStudy(Joined_1, 'Joined_1')
def TestHealingOperations (geompy, math): def TestHealingOperations (geompy, math):
TestMakeSewing(geompy, math) TestMakeSewing(geompy, math)
@ -378,3 +397,4 @@ def TestHealingOperations (geompy, math):
TestSuppressFaces(geompy) TestSuppressFaces(geompy)
TestProcessShape(geompy) TestProcessShape(geompy)
TestFuseEdges(geompy) TestFuseEdges(geompy)
TestRemoveWebs(geompy)

View File

@ -5996,6 +5996,36 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
self._autoPublish(anObj, theName, "sewed") self._autoPublish(anObj, theName, "sewed")
return anObj 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.
# @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_remove_webs "Example"
def RemoveInternalFaces (self, theCompound, theName=None):
"""
Rebuild the topology of theCompound of solids by removing
of the faces that are shared by several solids.
Parameters:
theCompound Shape 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.
Returns:
New GEOM.GEOM_Object, containing processed shape.
"""
# Example: see GEOM_TestHealing.py
anObj = self.HealOp.RemoveInternalFaces(theCompound)
RaiseIfFailed("RemoveInternalFaces", self.HealOp)
self._autoPublish(anObj, theName, "removeWebs")
return anObj
## Remove internal wires and edges from the given object (face). ## Remove internal wires and edges from the given object (face).
# @param theObject Shape to be processed. # @param theObject Shape to be processed.
# @param theWires Indices of wires to be removed, if EMPTY then the method # @param theWires Indices of wires to be removed, if EMPTY then the method

View File

@ -38,6 +38,7 @@ salomeinclude_HEADERS = \
RepairGUI_ChangeOrientationDlg.h \ RepairGUI_ChangeOrientationDlg.h \
RepairGUI_GlueDlg.h \ RepairGUI_GlueDlg.h \
RepairGUI_LimitToleranceDlg.h \ RepairGUI_LimitToleranceDlg.h \
RepairGUI_RemoveWebsDlg.h \
RepairGUI_RemoveExtraEdgesDlg.h \ RepairGUI_RemoveExtraEdgesDlg.h \
RepairGUI_UnionFacesDlg.h \ RepairGUI_UnionFacesDlg.h \
RepairGUI_FuseEdgesDlg.h RepairGUI_FuseEdgesDlg.h
@ -59,6 +60,7 @@ dist_libRepairGUI_la_SOURCES = \
RepairGUI_ChangeOrientationDlg.h \ RepairGUI_ChangeOrientationDlg.h \
RepairGUI_GlueDlg.h \ RepairGUI_GlueDlg.h \
RepairGUI_LimitToleranceDlg.h \ RepairGUI_LimitToleranceDlg.h \
RepairGUI_RemoveWebsDlg.h \
RepairGUI_RemoveExtraEdgesDlg.h \ RepairGUI_RemoveExtraEdgesDlg.h \
RepairGUI_UnionFacesDlg.h \ RepairGUI_UnionFacesDlg.h \
RepairGUI_FuseEdgesDlg.h \ RepairGUI_FuseEdgesDlg.h \
@ -76,6 +78,7 @@ dist_libRepairGUI_la_SOURCES = \
RepairGUI_ChangeOrientationDlg.cxx \ RepairGUI_ChangeOrientationDlg.cxx \
RepairGUI_GlueDlg.cxx \ RepairGUI_GlueDlg.cxx \
RepairGUI_LimitToleranceDlg.cxx \ RepairGUI_LimitToleranceDlg.cxx \
RepairGUI_RemoveWebsDlg.cxx \
RepairGUI_RemoveExtraEdgesDlg.cxx \ RepairGUI_RemoveExtraEdgesDlg.cxx \
RepairGUI_UnionFacesDlg.cxx \ RepairGUI_UnionFacesDlg.cxx \
RepairGUI_FuseEdgesDlg.cxx RepairGUI_FuseEdgesDlg.cxx
@ -93,8 +96,9 @@ MOC_FILES = \
RepairGUI_ChangeOrientationDlg_moc.cxx \ RepairGUI_ChangeOrientationDlg_moc.cxx \
RepairGUI_GlueDlg_moc.cxx \ RepairGUI_GlueDlg_moc.cxx \
RepairGUI_LimitToleranceDlg_moc.cxx \ RepairGUI_LimitToleranceDlg_moc.cxx \
RepairGUI_RemoveWebsDlg_moc.cxx \
RepairGUI_RemoveExtraEdgesDlg_moc.cxx \ RepairGUI_RemoveExtraEdgesDlg_moc.cxx \
RepairGUI_UnionFacesDlg_moc.cxx \ RepairGUI_UnionFacesDlg_moc.cxx \
RepairGUI_FuseEdgesDlg_moc.cxx RepairGUI_FuseEdgesDlg_moc.cxx
nodist_libRepairGUI_la_SOURCES = \ nodist_libRepairGUI_la_SOURCES = \

View File

@ -43,6 +43,7 @@
#include "RepairGUI_GlueDlg.h" // Method GLUE FACES #include "RepairGUI_GlueDlg.h" // Method GLUE FACES
#include "RepairGUI_LimitToleranceDlg.h" // Method LIMIT TOLERANCE #include "RepairGUI_LimitToleranceDlg.h" // Method LIMIT TOLERANCE
#include "RepairGUI_ChangeOrientationDlg.h" // Method CHANGE ORIENTATION #include "RepairGUI_ChangeOrientationDlg.h" // Method CHANGE ORIENTATION
#include "RepairGUI_RemoveWebsDlg.h" // Method REMOVE INTERNAL FACES
#include "RepairGUI_RemoveExtraEdgesDlg.h" // Method REMOVE EXTRA EDGES #include "RepairGUI_RemoveExtraEdgesDlg.h" // Method REMOVE EXTRA EDGES
#include "RepairGUI_FuseEdgesDlg.h" // Method FUSE COLLINEAR EDGES #include "RepairGUI_FuseEdgesDlg.h" // Method FUSE COLLINEAR EDGES
#include "RepairGUI_UnionFacesDlg.h" // Method UNION FACES #include "RepairGUI_UnionFacesDlg.h" // Method UNION FACES
@ -91,6 +92,7 @@ bool RepairGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
case GEOMOp::OpFreeBoundaries: aDlg = new RepairGUI_FreeBoundDlg (getGeometryGUI(), parent); break; case GEOMOp::OpFreeBoundaries: aDlg = new RepairGUI_FreeBoundDlg (getGeometryGUI(), parent); break;
case GEOMOp::OpFreeFaces: aDlg = new RepairGUI_FreeFacesDlg (getGeometryGUI(), parent); break; case GEOMOp::OpFreeFaces: aDlg = new RepairGUI_FreeFacesDlg (getGeometryGUI(), parent); break;
case GEOMOp::OpOrientation: aDlg = new RepairGUI_ChangeOrientationDlg (getGeometryGUI(), parent); break; case GEOMOp::OpOrientation: aDlg = new RepairGUI_ChangeOrientationDlg (getGeometryGUI(), parent); break;
case GEOMOp::OpRemoveWebs: aDlg = new RepairGUI_RemoveWebsDlg (getGeometryGUI(), parent); break;
case GEOMOp::OpRemoveExtraEdges: aDlg = new RepairGUI_RemoveExtraEdgesDlg (getGeometryGUI(), parent); break; case GEOMOp::OpRemoveExtraEdges: aDlg = new RepairGUI_RemoveExtraEdgesDlg (getGeometryGUI(), parent); break;
case GEOMOp::OpFuseEdges: aDlg = new RepairGUI_FuseEdgesDlg (getGeometryGUI(), parent); break; case GEOMOp::OpFuseEdges: aDlg = new RepairGUI_FuseEdgesDlg (getGeometryGUI(), parent); break;
case GEOMOp::OpUnionFaces: aDlg = new RepairGUI_UnionFacesDlg (getGeometryGUI(), parent); break; case GEOMOp::OpUnionFaces: aDlg = new RepairGUI_UnionFacesDlg (getGeometryGUI(), parent); break;

View File

@ -0,0 +1,296 @@
// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// GEOM RepairGUI : GUI for Geometry component
// File : RepairGUI_RemoveWebsDlg.cxx
#include "RepairGUI_RemoveWebsDlg.h"
#include <DlgRef.h>
#include <GeometryGUI.h>
#include <GEOMBase.h>
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
#include <GEOMImpl_Types.hxx>
#include <TColStd_MapOfInteger.hxx>
//=================================================================================
// class : RepairGUI_RemoveWebsDlg()
// purpose : Constructs a RepairGUI_RemoveWebsDlg which is a child of 'parent', with the
// name 'name' and widget flags set to 'f'.
// The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog.
//=================================================================================
RepairGUI_RemoveWebsDlg::RepairGUI_RemoveWebsDlg (GeometryGUI* theGeometryGUI, QWidget* parent,
bool modal)
: GEOMBase_Skeleton(theGeometryGUI, parent, modal)
{
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_REMOVE_WEBS")));
QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
setWindowTitle(tr("GEOM_REMOVE_WEBS_TITLE"));
/***************************************************************/
mainFrame()->GroupConstructors->setTitle(tr("GEOM_REMOVE_WEBS_TITLE"));
mainFrame()->RadioButton1->setIcon( image0 );
mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton2->close();
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton3->close();
GroupPoints = new DlgRef_1Sel( centralWidget() );
GroupPoints->GroupBox1->setTitle( tr( "GEOM_REMOVE_WEBS" ) );
GroupPoints->TextLabel1->setText( tr( "GEOM_SELECTED_SHAPE" ) );
GroupPoints->PushButton1->setIcon( image1 );
GroupPoints->LineEdit1->setReadOnly( true );
QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( GroupPoints );
/***************************************************************/
setHelpFileName( "remove_webs_operation_page.html" );
Init();
}
//=================================================================================
// function : ~RepairGUI_RemoveWebsDlg()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
RepairGUI_RemoveWebsDlg::~RepairGUI_RemoveWebsDlg()
{
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void RepairGUI_RemoveWebsDlg::Init()
{
/* init variables */
myEditCurrentArgument = GroupPoints->LineEdit1;
myOkObject = false;
activateSelection();
mainFrame()->GroupBoxPublish->show();
//Hide preview checkbox
mainFrame()->CheckBoxPreview->hide();
/* signals and slots connections */
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument()));
initName(tr("REMOVE_WEBS_NEW_OBJ_NAME"));
resize(100,100);
SelectionIntoArgument();
}
//=================================================================================
// function : ClickOnOk()
// purpose : Same than click on apply but close this dialog.
//=================================================================================
void RepairGUI_RemoveWebsDlg::ClickOnOk()
{
setIsApplyAndClose(true);
if (ClickOnApply())
ClickOnCancel();
}
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
bool RepairGUI_RemoveWebsDlg::ClickOnApply()
{
if (!onAccept())
return false;
initName();
myEditCurrentArgument->setText("");
myObject = GEOM::GEOM_Object::_nil();
myOkObject = false;
activateSelection();
return true;
}
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection as changed or other case
// : used only by SelectButtonC1A1 (LineEditC1A1)
//=================================================================================
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());
if (CORBA::is_nil(aSelectedObject))
return;
if (myEditCurrentArgument == GroupPoints->LineEdit1) {
myObject = aSelectedObject;
myOkObject = true;
}
myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject));
}
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void RepairGUI_RemoveWebsDlg::SetEditCurrentArgument()
{
if (sender() == GroupPoints->PushButton1) {
GroupPoints->LineEdit1->setFocus();
myEditCurrentArgument = GroupPoints->LineEdit1;
}
SelectionIntoArgument();
}
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void RepairGUI_RemoveWebsDlg::LineEditReturnPressed()
{
if (sender() == GroupPoints->LineEdit1) {
myEditCurrentArgument = GroupPoints->LineEdit1;
GEOMBase_Skeleton::LineEditReturnPressed();
}
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void RepairGUI_RemoveWebsDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument()));
activateSelection();
}
//=================================================================================
// function : enterEvent()
// purpose : Mouse enter onto the dialog to activate it
//=================================================================================
void RepairGUI_RemoveWebsDlg::enterEvent (QEvent* e)
{
if (!mainFrame()->GroupConstructors->isEnabled())
ActivateThisDialog();
}
//=================================================================================
// function : activateSelection
// purpose : activate selection of solids and compounds
//=================================================================================
void RepairGUI_RemoveWebsDlg::activateSelection()
{
TColStd_MapOfInteger aTypes;
//aTypes.Add( GEOM_SOLID );
aTypes.Add( GEOM_COMPOUND );
globalSelection( aTypes );
}
//=================================================================================
// function : createOperation
// purpose :
//=================================================================================
GEOM::GEOM_IOperations_ptr RepairGUI_RemoveWebsDlg::createOperation()
{
return getGeomEngine()->GetIHealingOperations(getStudyId());
}
//=================================================================================
// function : isValid
// purpose :
//=================================================================================
bool RepairGUI_RemoveWebsDlg::isValid (QString& msg)
{
return myOkObject;
}
//=================================================================================
// function : execute
// purpose :
//=================================================================================
bool RepairGUI_RemoveWebsDlg::execute (ObjectList& objects)
{
GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow(getOperation());
GEOM::GEOM_Object_var anObj = anOper->RemoveInternalFaces(myObject);
if (!anObj->_is_nil())
objects.push_back(anObj._retn());
return true;
}
//=================================================================================
// function : restoreSubShapes
// purpose :
//=================================================================================
void RepairGUI_RemoveWebsDlg::restoreSubShapes (SALOMEDS::Study_ptr theStudy,
SALOMEDS::SObject_ptr theSObject)
{
if (mainFrame()->CheckBoxRestoreSS->isChecked()) {
// empty list of arguments means that all arguments should be restored
getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, GEOM::ListOfGO(),
/*theFindMethod=*/GEOM::FSM_GetInPlace, // ? GetInPlaceByHistory
/*theInheritFirstArg=*/true,
mainFrame()->CheckBoxAddPrefix->isChecked());
}
}

View File

@ -0,0 +1,70 @@
// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// GEOM GEOMGUI : GUI for Geometry component
// File : RepairGUI_RemoveWebsDlg.h
#ifndef REPAIRGUI_REMOVEWEBSDLG_H
#define REPAIRGUI_REMOVEWEBSDLG_H
#include <GEOMBase_Skeleton.h>
class DlgRef_1Sel;
//=================================================================================
// class : RepairGUI_RemoveWebsDlg
// purpose : Unites faces of a given shape.
//=================================================================================
class RepairGUI_RemoveWebsDlg : public GEOMBase_Skeleton
{
Q_OBJECT
public:
RepairGUI_RemoveWebsDlg (GeometryGUI*, QWidget* = 0, bool = false);
~RepairGUI_RemoveWebsDlg();
protected:
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid (QString&);
virtual bool execute (ObjectList&);
virtual void restoreSubShapes (SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr);
private:
void Init();
void enterEvent (QEvent*);
void activateSelection();
private:
GEOM::GEOM_Object_var myObject;
bool myOkObject;
DlgRef_1Sel* GroupPoints;
private slots:
void ClickOnOk();
bool ClickOnApply();
void ActivateThisDialog();
void LineEditReturnPressed();
void SelectionIntoArgument();
void SetEditCurrentArgument();
};
#endif // REPAIRGUI_REMOVEWEBSDLG_H