22746: [EDF] Improvement of Glue Faces and Glue Edges operations

This commit is contained in:
eap 2014-10-14 20:45:17 +04:00
parent 79f33ff735
commit 9a5dbc5a8d
33 changed files with 682 additions and 482 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -7,7 +7,7 @@
\n This operation glues edges that are coincident with respect to the
given tolerance value.
\n <b>Arguments:</b> Name + Compound of shapes + Tolerance value.
\n <b>Arguments:</b> Name + Shapes + Tolerance value.
\n <b>Advanced option:</b>
\ref restore_presentation_parameters_page "Set presentation parameters and sub-shapes from arguments".
\n The \b Result will be a \b GEOM_Object.
@ -16,10 +16,10 @@ given tolerance value.
\image html glue4.png
\n <b>TUI Command:</b>
\n <em>geompy.MakeGlueEdges(theShape,theTolerance)</em>,
\n where \em theShape is a compound of shapes to be glued, and \em
theTolerance is a maximum distance between two faces/edges, which can
be considered as coincident.
<p><em>geompy.MakeGlueEdges( theShapes, theTolerance )</em>,
\n where \em theShapes is either a list or compound of shapes to be
glued, and \em theTolerance is a maximum distance between two
edges, which can be considered as coincident.
\n It is also possible to manually select the edges that will be
glued - select the shape, specify the tolerance and press \b Detect button.
@ -36,23 +36,24 @@ possible to select the edges for gluing in the 3D viewer.
The selected edges will be marked in white.
\n <b>TUI Command:</b>
\n <em>geompy.GetGlueEdges(theShape,theTolerance)</em>,
\n where \em theShape is a compound of shapes to be glued, \em
<p><em>geompy.GetGlueEdges( theShapes, theTolerance )</em>,
\n where \em theShape is either a list or compound of shapes to be glued, \em
theTolerance is a maximum distance between two edges, which can
be considered as coincident. The \b Result will be a list of \b
GEOM_Objects, containing one sub-shape per each detected set of
coincident sub-shapes.
GEOM_Objects (edges), containing one sub-shape per each detected set of
coincident sub-shapes. For example if there are two coincident edges
in selected shapes, the result list contains one of the two coincident edges.
\n <em>geompy.MakeGlueEdgesByList(theShape,theTolerance,theEdges)</em>,
\n where \em theShape is a compound of shapes to be glued, \em
<em>geompy.MakeGlueEdgesByList( theShapes, theTolerance, theEdges )</em>,
\n where \em theShape is either a list or compound of shapes to be glued, \em
theTolerance is a maximum distance between two edges, which can
be considered as coincident, \em theEdges is a list of
sub-shapes to be glued.
edges to be glued.
\n <b>Example:</b>
\image html glue8.png
<center><em>Box with an edge that can be glued</em></center>
<center><em>Two boxes with an edge that can be glued</em></center>
Our <b>TUI Scripts</b> provide you with useful examples of the use of
<b>Repairing Operations</b> \ref tui_glue_edges "Glue Edges".

View File

@ -8,7 +8,7 @@
\n This operation glues faces that are coincident with respect to the
given tolerance value.
\n <b>Arguments:</b> Name + Compound of shapes + Tolerance value.
\n <b>Arguments:</b> Name + Shapes + Tolerance value.
\n <b>Advanced option:</b>
\ref restore_presentation_parameters_page "Set presentation parameters and sub-shapes from arguments".
\n The \b Result will be a \b GEOM_Object.
@ -17,8 +17,9 @@ given tolerance value.
\n <b>TUI Commands:</b>
\n <em>geompy.MakeGlueFaces(theShape,theTolerance,doKeepNonSolids)</em>,
\n where \em theShape is a compound of shapes to be glued, \em
<em>geompy.MakeGlueFaces( theShapes, theTolerance, doKeepNonSolids )</em>,
\n where \em theShapes is either a list or compound of shapes to be glued, \em
theTolerance is a maximum distance between two faces, which can
be considered as coincident. The \em doKeepNonSolids flag allows to
throw away non-solids from the result, if false. The \b Result will
@ -38,20 +39,23 @@ performed and displays a notification.
possible to select the faces for gluing in the 3D viewer.
The selected faces will be marked in white.
\n When the faces are glued their edges are glued as well. By default, other
When the faces are glued their edges are glued as well. By default, other
edges are not glued. To force gluing of all edges, check <b>Glue all coincident edges</b>
checkbox.
\n <b>TUI Commands:</b>
\n <em>geompy.GetGlueFaces(theShape,theTolerance)</em>,
\n where \em theShape is a compound of shapes to be glued, \em
theTolerance is a maximum distance between two faces, which can
be considered as coincident. The \b Result will be a list of \b
GEOM_Objects, containing one sub-shape per each detected set of
coincident sub-shapes.
\n <em>geompy.MakeGlueFacesByList(theShape,theTolerance,theFaces,doKeepNonSolids,doGlueAllEdges)</em>,
\n where \em theShape is a compound of shapes to be glued, \em
<em>geompy.GetGlueFaces( theShapes, theTolerance )</em>,
\n where \em theShapes is either a list or compound of shapes to be glued, \em
theTolerance is a maximum distance between two faces, which can
be considered as coincident. The \b Result will be a list of \b
GEOM_Objects (faces), containing one sub-shape per each detected set of
coincident sub-shapes. For example if there are two coincident faces
in selected shapes, the result list contains one of the two coincident faces.
<em>geompy.MakeGlueFacesByList( theShapes, theTolerance, theFaces,
doKeepNonSolids, doGlueAllEdges )</em>,
\n where \em theShapes is either a list or compound of shapes to be glued, \em
theTolerance is a maximum distance between two faces, which can
be considered as coincident, \em theFaces is a list of
sub-shapes to be glued. The \em doKeepNonSolids flag allows to throw

View File

@ -5,7 +5,7 @@
\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
This operation removes all shared faces from a compound to obtain
one or more bigger solids from a set of smaller solids.
\image html remove_webs.png
@ -15,10 +15,11 @@ one or more bigger solids from a set of smaller solids.
\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 Glue Faces or Partition before
Remove Internal Faces if you need to remove them.
faces will stay as is, use \ref glue_faces_operation_page or \ref partition_page before
<b>Remove Internal Faces</b> if you need to remove them.
\n <b>TUI Command:</b> <em>geompy.RemoveInternalFaces(theCompound)</em>,
\n <b>TUI Command:</b> <br>
<em>geompy.RemoveInternalFaces( theCompound )</em>,<br>
where <em>theCompound</em> is a compound of solids.
\n Our <b>TUI Scripts</b> provide you with useful examples of the

View File

@ -16,9 +16,9 @@ open contour asnd miodifies the underlying face.</li>
holes with free boundaries on a selected face.</li>
<li>\subpage sewing_operation_page "Sewing" - sews faces or shells.</li>
<li>\subpage glue_faces_operation_page "Glue faces" - unites
coincident faces within the given tolerance.</li>
faces coincident within the given tolerance.</li>
<li>\subpage glue_edges_operation_page "Glue edges" - unites
coincident edges within the given tolerance.</li>
edges coincident within the given tolerance.</li>
<li>\subpage limit_tolerance_operation_page "Limit Tolerance" - tries
to set new tolerance value for the given shape.</li>
<li>\subpage add_point_on_edge_operation_page "Add point on edge" -

View File

@ -1939,64 +1939,64 @@ module GEOM
GEOM_Object MakeCompound (in ListOfGO theShapes);
/*!
* \brief Replace coincident faces in theShape by one face.
* \param theShape Initial shape.
* \brief Replace coincident faces in \a theShapes by one face.
* \param theShapes Initial shapes.
* \param theTolerance Maximum distance between faces, which can be considered as coincident.
* \param doKeepNonSolids If FALSE, only solids will present in the result, otherwise all initial shapes.
* \return New GEOM_Object, containing a copy of theShape without coincident faces.
* \return New GEOM_Object containing copies of theShapes without coincident faces.
*/
GEOM_Object MakeGlueFaces (in GEOM_Object theShape, in double theTolerance, in boolean doKeepNonSolids);
GEOM_Object MakeGlueFaces (in ListOfGO theShapes, in double theTolerance, in boolean doKeepNonSolids);
/*!
* Find coincident faces in theShape for possible gluing.
* \param theShape Initial shape.
* Find coincident faces in theShapes for possible gluing.
* \param theShapes Initial shapes.
* \param theTolerance Maximum distance between faces, which can be considered as coincident.
* \return ListOfGO
*/
ListOfGO GetGlueFaces (in GEOM_Object theShape, in double theTolerance);
ListOfGO GetGlueFaces (in ListOfGO theShapes, in double theTolerance);
/*!
* \brief Replace coincident faces in theShape by one face
* in compliance with given list of faces
* \param theShape Initial shape.
* \brief Replace coincident faces in \a theShapes by one face
* in compliance with given list of faces
* \param theShapes Initial shapes.
* \param theTolerance Maximum distance between faces, which can be considered as coincident.
* \param theFaces List of faces for gluing.
* \param doKeepNonSolids If FALSE, only solids will present in the result, otherwise all initial shapes.
* \param doGlueAllEdges If TRUE, all coincident edges of <VAR>theShape</VAR>
* will be glued, otherwise only the edges,
* belonging to <VAR>theFaces</VAR>.
* \return New GEOM_Object, containing a copy of theShape without some faces.
* \return New GEOM_Object containing copies of theShapes without coincident faces.
*/
GEOM_Object MakeGlueFacesByList (in GEOM_Object theShape, in double theTolerance,
in ListOfGO theFaces, in boolean doKeepNonSolids,
GEOM_Object MakeGlueFacesByList (in ListOfGO theShapes, in double theTolerance,
in ListOfGO theFaces, in boolean doKeepNonSolids,
in boolean doGlueAllEdges);
/*!
* \brief Replace coincident edges in theShape by one edge.
* \param theShape Initial shape.
* \brief Replace coincident edges in \a theShapes by one edge.
* \param theShapes Initial shapes.
* \param theTolerance Maximum distance between edges, which can be considered as coincident.
* \return New GEOM_Object, containing a copy of theShape without coincident edges.
* \return New GEOM_Object containing copies of theShapes without coincident edges.
*/
GEOM_Object MakeGlueEdges (in GEOM_Object theShape, in double theTolerance);
GEOM_Object MakeGlueEdges (in ListOfGO theShapes, in double theTolerance);
/*!
* Find coincident edges in theShape for possible gluing.
* \param theShape Initial shape.
* Find coincident edges in \a theShapes for possible gluing.
* \param theShapes Initial shapes.
* \param theTolerance Maximum distance between edges, which can be considered as coincident.
* \return ListOfGO
*/
ListOfGO GetGlueEdges (in GEOM_Object theShape, in double theTolerance);
ListOfGO GetGlueEdges (in ListOfGO theShapes, in double theTolerance);
/*!
* \brief Replace coincident edges in theShape by one edge
* in compliance with given list of edges
* \param theShape Initial shape.
* \brief Replace coincident edges in \a theShapes by one edge
* in compliance with given list of edges
* \param theShapes Initial shapes.
* \param theTolerance Maximum distance between edges, which can be considered as coincident.
* \param theEdges List of edges for gluing.
* \return New GEOM_Object, containing a copy of theShape without some edges.
* \return New GEOM_Object containing copies of theShapes without some edges.
*/
GEOM_Object MakeGlueEdgesByList (in GEOM_Object theShape,
in double theTolerance,
GEOM_Object MakeGlueEdgesByList (in ListOfGO theShape,
in double theTolerance,
in ListOfGO theEdges);
/*!

View File

@ -154,9 +154,9 @@ AdvancedEngine_IOperations::~AdvancedEngine_IOperations()
*/
//=============================================================================
gp_Trsf AdvancedEngine_IOperations::GetPositionTrsf(double theL1, double theL2,
Handle(GEOM_Object) theP1,
Handle(GEOM_Object) theP2,
Handle(GEOM_Object) theP3)
Handle(GEOM_Object) theP1,
Handle(GEOM_Object) theP2,
Handle(GEOM_Object) theP3)
{
// Old Local Coordinates System oldLCS
gp_Pnt P0(0, 0, 0);
@ -195,10 +195,10 @@ gp_Trsf AdvancedEngine_IOperations::GetPositionTrsf(double theL1, double theL2,
*/
//=============================================================================
bool AdvancedEngine_IOperations::CheckCompatiblePosition(double& theL1, double& theL2,
Handle(GEOM_Object) theP1,
Handle(GEOM_Object) theP2,
Handle(GEOM_Object) theP3,
double theTolerance)
Handle(GEOM_Object) theP1,
Handle(GEOM_Object) theP2,
Handle(GEOM_Object) theP3,
double theTolerance)
{
SetErrorCode(KO);
gp_Pnt P1 = BRep_Tool::Pnt(TopoDS::Vertex(theP1->GetValue()));
@ -266,11 +266,11 @@ bool AdvancedEngine_IOperations::CheckCompatiblePosition(double& theL1, double&
*/
//=============================================================================
bool AdvancedEngine_IOperations::MakeGroups(Handle(GEOM_Object) theShape, int shapeType,
double theR1, double theW1, double theL1,
double theR2, double theW2, double theL2,
double theH, double theW, double theRF,
Handle(TColStd_HSequenceOfTransient) theSeq,
gp_Trsf aTrsf)
double theR1, double theW1, double theL1,
double theR2, double theW2, double theL2,
double theH, double theW, double theRF,
Handle(TColStd_HSequenceOfTransient) theSeq,
gp_Trsf aTrsf)
{
SetErrorCode(KO);
@ -1132,10 +1132,10 @@ bool AdvancedEngine_IOperations::MakeInternalGroup
}
bool AdvancedEngine_IOperations::MakePipeTShapePartition(Handle(GEOM_Object) theShape,
double theR1, double theW1, double theL1,
double theR2, double theW2, double theL2,
double theH, double theW,
double theRF, bool isNormal)
double theR1, double theW1, double theL1,
double theR2, double theW2, double theL2,
double theH, double theW,
double theRF, bool isNormal)
{
SetErrorCode(KO);
@ -1203,12 +1203,12 @@ bool AdvancedEngine_IOperations::MakePipeTShapePartition(Handle(GEOM_Object) the
if (Abs(aP.X()) <= Precision::Confusion()) {
if (Abs(aP.Y()) < d1min) {
vi1 = v;
d1min = Abs(aP.Y());
}
d1min = Abs(aP.Y());
}
} else if (Abs(aP.Y()) <= Precision::Confusion()) {
if (Abs(aP.X()) < d2min) {
vi2 = v;
d2min = Abs(aP.X());
if (Abs(aP.X()) < d2min) {
vi2 = v;
d2min = Abs(aP.X());
}
}
}
@ -1249,14 +1249,14 @@ bool AdvancedEngine_IOperations::MakePipeTShapePartition(Handle(GEOM_Object) the
if (Abs(aP.X()) <= Precision::Confusion()) {
if (Abs(aP.Y()) > d1max) {
ve1 = v;
vertex1 = aVertex;
d1max = Abs(aP.Y());
vertex1 = aVertex;
d1max = Abs(aP.Y());
}
} else if (Abs(aP.Y()) <= Precision::Confusion()) {
if (Abs(aP.X()) > d2max) {
ve2 = v;
vertex2 = aVertex;
d2max = Abs(aP.X());
vertex2 = aVertex;
d2max = Abs(aP.X());
}
}
}
@ -1281,12 +1281,12 @@ bool AdvancedEngine_IOperations::MakePipeTShapePartition(Handle(GEOM_Object) the
for (int i=1; i<=edges_e->Length();i++) {
Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(edges_e->Value(i));
anObj->GetLastFunction()->SetDescription("");
TopoDS_Edge anEdge = TopoDS::Edge(anObj->GetValue());
if ( !anEdge.IsNull() &&
(sae.FirstVertex(anEdge).IsSame(vertex1) || sae.LastVertex(anEdge).IsSame(vertex1)) &&
(sae.FirstVertex(anEdge).IsSame(vertex2) || sae.LastVertex(anEdge).IsSame(vertex2))) {
arete_intersect_ext = anObj;
}
TopoDS_Edge anEdge = TopoDS::Edge(anObj->GetValue());
if ( !anEdge.IsNull() &&
(sae.FirstVertex(anEdge).IsSame(vertex1) || sae.LastVertex(anEdge).IsSame(vertex1)) &&
(sae.FirstVertex(anEdge).IsSame(vertex2) || sae.LastVertex(anEdge).IsSame(vertex2))) {
arete_intersect_ext = anObj;
}
}
edge_e1 = myBasicOperations->MakeLineTwoPnt(ve1, vi1);
@ -1614,8 +1614,8 @@ bool AdvancedEngine_IOperations::MakePipeTShapePartition(Handle(GEOM_Object) the
// Mirror and glue faces
bool AdvancedEngine_IOperations::MakePipeTShapeMirrorAndGlue(Handle(GEOM_Object) theShape,
double theR1, double theW1, double theL1,
double theR2, double theW2, double theL2)
double theR1, double theW1, double theL1,
double theR2, double theW2, double theL2)
{
SetErrorCode(KO);
@ -1669,7 +1669,8 @@ bool AdvancedEngine_IOperations::MakePipeTShapeMirrorAndGlue(Handle(GEOM_Object)
TColStd_IndexedDataMapOfTransientTransient aMapTShapes;
TNaming_CopyShape::CopyTool(Te7->GetValue(), aMapTShapes, aShapeCopy);
Handle(GEOM_Object) Te8 = myShapesOperations->MakeGlueFaces(Te7, 1e-7, true);
std::list<Handle(GEOM_Object)> Te7list( 1, Te7 );
Handle(GEOM_Object) Te8 = myShapesOperations->MakeGlueFaces(Te7list, 1e-7, true);
if (Te8.IsNull()) {
SetErrorCode("Impossible to glue faces of TShape");
return false;
@ -1694,7 +1695,7 @@ bool AdvancedEngine_IOperations::MakePipeTShapeMirrorAndGlue(Handle(GEOM_Object)
// Perform gluing
Te7->GetLastFunction()->SetValue(aShapeCopy);
Te8 = myShapesOperations->MakeGlueFaces(Te7, aTolMax, true);
Te8 = myShapesOperations->MakeGlueFaces(Te7list, aTolMax, true);
if (Te8.IsNull()) {
SetErrorCode("Impossible to glue faces of TShape");
@ -1845,10 +1846,10 @@ TopoDS_Shape AdvancedEngine_IOperations::MakePipeTShapeThicknessReduction
//purpose : Static method. Create one thickness reduction element.
//=======================================================================
TopoDS_Shape AdvancedEngine_IOperations::MakeThicknessReduction (gp_Ax2 theAxes,
const double R, const double W,
const double Rthin, const double Wthin,
const double Ltrans, const double Lthin,
bool fuse)
const double R, const double W,
const double Rthin, const double Wthin,
const double Ltrans, const double Lthin,
bool fuse)
{
double aTol = Precision::Confusion();
if (Rthin < aTol || Wthin < aTol || Ltrans < aTol) {
@ -1953,11 +1954,11 @@ TopoDS_Shape AdvancedEngine_IOperations::MakeThicknessReduction (gp_Ax2 theAxes,
//=============================================================================
Handle(TColStd_HSequenceOfTransient)
AdvancedEngine_IOperations::MakePipeTShape(double theR1, double theW1, double theL1,
double theR2, double theW2, double theL2,
double theRL, double theWL, double theLtransL, double theLthinL,
double theRR, double theWR, double theLtransR, double theLthinR,
double theRI, double theWI, double theLtransI, double theLthinI,
bool theHexMesh)
double theR2, double theW2, double theL2,
double theRL, double theWL, double theLtransL, double theLthinL,
double theRR, double theWR, double theLtransR, double theLthinR,
double theRI, double theWI, double theLtransI, double theLthinI,
bool theHexMesh)
{
MESSAGE("AdvancedEngine_IOperations::MakePipeTShape");
SetErrorCode(KO);
@ -3215,7 +3216,7 @@ AdvancedEngine_IOperations::MakePipeTShapeFilletWithPosition
*/
//=============================================================================
Handle(GEOM_Object) AdvancedEngine_IOperations::MakeDividedDisk (double theR, double theRatio,
int theOrientation, int thePattern)
int theOrientation, int thePattern)
{
SetErrorCode(KO);
@ -3287,10 +3288,10 @@ Handle(GEOM_Object) AdvancedEngine_IOperations::MakeDividedDisk (double theR, do
*/
//=============================================================================
Handle(GEOM_Object) AdvancedEngine_IOperations::MakeDividedDiskPntVecR (Handle(GEOM_Object) thePnt,
Handle(GEOM_Object) theVec,
double theR,
double theRatio,
int thePattern)
Handle(GEOM_Object) theVec,
double theR,
double theRatio,
int thePattern)
{
SetErrorCode(KO);
@ -3362,8 +3363,8 @@ Handle(GEOM_Object) AdvancedEngine_IOperations::MakeDividedDiskPntVecR (Handle(G
*/
//=============================================================================
Handle(GEOM_Object) AdvancedEngine_IOperations::MakeDividedCylinder (double theR,
double theH,
int thePattern)
double theH,
int thePattern)
{
SetErrorCode(KO);
@ -3409,9 +3410,9 @@ Handle(GEOM_Object) AdvancedEngine_IOperations::MakeDividedCylinder (double theR
*/
//=============================================================================
Handle(GEOM_Object) AdvancedEngine_IOperations::MakeSmoothingSurface (std::list<Handle(GEOM_Object)> thelPoints,
int theNbMax,
int theDegMax,
double theDMax)
int theNbMax,
int theDegMax,
double theDMax)
{
SetErrorCode(KO);

View File

@ -46,7 +46,7 @@
*/
//=============================================================================
Handle(GEOM_Object) GEOM_Object::GetObject(TDF_Label& theLabel)
Handle(GEOM_Object) GEOM_Object::GetObject(const TDF_Label& theLabel)
{
Handle(GEOM_BaseObject) base = GEOM_BaseObject::GetObject(theLabel);
return Handle(GEOM_Object)::DownCast( base );
@ -58,7 +58,7 @@ Handle(GEOM_Object) GEOM_Object::GetObject(TDF_Label& theLabel)
*/
//=============================================================================
Handle(GEOM_Object) GEOM_Object::GetReferencedObject(TDF_Label& theLabel)
Handle(GEOM_Object) GEOM_Object::GetReferencedObject(const TDF_Label& theLabel)
{
Handle(GEOM_BaseObject) base = GEOM_BaseObject::GetReferencedObject(theLabel);
return Handle(GEOM_Object)::DownCast( base );
@ -275,5 +275,27 @@ bool GEOM_Object::IsMainShape()
return false;
}
//================================================================================
/*!
* \brief Returns GetLastFunction() of given objects
*/
//================================================================================
Handle(TColStd_HSequenceOfTransient)
GEOM_Object::GetLastFunctions( const std::list< Handle(GEOM_Object) >& theObjects )
{
Handle(TColStd_HSequenceOfTransient) funs = new TColStd_HSequenceOfTransient;
std::list<Handle(GEOM_Object)>::const_iterator it = theObjects.begin();
for (; it != theObjects.end(); it++)
{
Handle(GEOM_Function) fun = (*it)->GetLastFunction();
if ( fun.IsNull())
return Handle(TColStd_HSequenceOfTransient)();
funs->Append( fun );
}
return funs;
}
IMPLEMENT_STANDARD_HANDLE (GEOM_Object, GEOM_BaseObject );
IMPLEMENT_STANDARD_RTTIEXT(GEOM_Object, GEOM_BaseObject );

View File

@ -27,9 +27,12 @@
#include <Aspect_TypeOfMarker.hxx>
#include <Standard_GUID.hxx>
#include <TColStd_HSequenceOfTransient.hxx>
#include <TDF_Label.hxx>
#include <TopoDS_Shape.hxx>
#include <list>
class GEOM_Object;
class Handle(TFunction_Driver);
class GEOM_Engine;
@ -58,10 +61,10 @@ class GEOM_Object : public GEOM_BaseObject
Standard_EXPORT ~GEOM_Object();
//Finds a GEOM_Object on the label theLabel
Standard_EXPORT static Handle(GEOM_Object) GetObject(TDF_Label& theLabel);
Standard_EXPORT static Handle(GEOM_Object) GetObject(const TDF_Label& theLabel);
//Finds a GEOM_Object by a reference, stored on the label theLabel
Standard_EXPORT static Handle(GEOM_Object) GetReferencedObject(TDF_Label& theLabel);
Standard_EXPORT static Handle(GEOM_Object) GetReferencedObject(const TDF_Label& theLabel);
//###########################################################
//Access to properties
@ -107,6 +110,10 @@ class GEOM_Object : public GEOM_BaseObject
//Returns false if the object is a sub-shape of another object
Standard_EXPORT bool IsMainShape();
//Comfort method
Standard_EXPORT static Handle(TColStd_HSequenceOfTransient)
GetLastFunctions( const std::list< Handle(GEOM_Object) >& theObjects );
public:
DEFINE_STANDARD_RTTI( GEOM_Object );
};

View File

@ -201,6 +201,11 @@ namespace GEOM
for (i = 1; i <= aLen; i++) {
anObject = Handle(GEOM_Object)::DownCast(theObjects->Value(i));
if ( anObject.IsNull() ) {
Handle(GEOM_Function) fun = Handle(GEOM_Function)::DownCast(theObjects->Value(i));
if ( !fun.IsNull() )
anObject = GEOM_Object::GetObject( fun->GetOwnerEntry() );
}
aLatest = GetCreatedLast(aLatest, anObject);
}
return aLatest;

View File

@ -872,6 +872,14 @@ Please, select face, shell or solid and try again</translation>
<source>GEOM_GLUE_EDGES_TITLE</source>
<translation>Glue edges</translation>
</message>
<message>
<source>GEOM_GLUE_EDGES_DETECT_TITLE</source>
<translation>Coincident edges detection</translation>
</message>
<message>
<source>GEOM_GLUE_FACES_DETECT_TITLE</source>
<translation>Coincident faces detection</translation>
</message>
<message>
<source>GLUE_ERROR_STICKED_SHAPES</source>
<translation>The tolerance value is too big. Sticked shapes are detected.</translation>
@ -1668,6 +1676,10 @@ Please, select face, shell or solid and try again</translation>
<source>GEOM_SELECTED_SHAPE</source>
<translation>Selected shape</translation>
</message>
<message>
<source>GEOM_SELECTED_SHAPES</source>
<translation>Selected shapes</translation>
</message>
<message>
<source>GEOM_SELECTION</source>
<translation>Selection</translation>

View File

@ -38,16 +38,15 @@
#include "utilities.h"
#include <BRep_Builder.hxx>
#include <ShapeFix_Shape.hxx>
#include <TDataStd_IntegerArray.hxx>
#include <TopExp.hxx>
#include <TopoDS_Shape.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <ShapeFix_Shape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopoDS_Shape.hxx>
#include <Standard_NullObject.hxx>
#include <Standard_Failure.hxx>
@ -729,8 +728,36 @@ Standard_Integer GEOMImpl_GlueDriver::Execute(TFunction_Logbook& log) const
TopoDS_Shape aShape;
TCollection_AsciiString aWrn;
Handle(GEOM_Function) aRefBase = aCI.GetBase();
TopoDS_Shape aShapeBase = aRefBase->GetValue();
TopoDS_Shape aShapeBase;
Handle(TColStd_HSequenceOfTransient) aRefBases = aCI.GetBase();
if ( aRefBases && !aRefBases->IsEmpty() )
{
if ( aRefBases->Length() == 1 )
{
Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aRefBases->Value(1));
if ( !aRefShape.IsNull() )
aShapeBase = aRefShape->GetValue();
}
else
{
TopoDS_Compound compound;
BRep_Builder builder;
builder.MakeCompound( compound );
int ind = 1;
for ( ; ind <= aRefBases->Length(); ind++)
{
Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aRefBases->Value(ind));
if ( aRefShape.IsNull() ) break;
TopoDS_Shape aShape = aRefShape->GetValue();
if (aShape.IsNull()) break;
builder.Add( compound, aShape );
}
if ( ind > aRefBases->Length() )
aShapeBase = compound;
else
aShapeBase.Nullify();
}
}
if (aShapeBase.IsNull()) {
Standard_NullObject::Raise("Shape for gluing is null");
}
@ -803,18 +830,18 @@ GetCreationInformation(std::string& theOperationName,
switch ( aType ) {
case GLUE_FACES:
theOperationName = "GLUE_FACES";
AddParam( theParams, "Selected shape", aCI.GetBase() );
AddParam( theParams, "Selected shapes", aCI.GetBase() );
AddParam( theParams, "Tolerance", aCI.GetTolerance() );
AddParam( theParams, "To keep non solids", aCI.GetKeepNonSolids() );
break;
case GLUE_EDGES:
theOperationName = "GLUE_EDGES";
AddParam( theParams, "Selected shape", aCI.GetBase() );
AddParam( theParams, "Selected shapes", aCI.GetBase() );
AddParam( theParams, "Tolerance", aCI.GetTolerance() );
break;
case GLUE_FACES_BY_LIST:
theOperationName = "GLUE_FACES";
AddParam( theParams, "Selected shape", aCI.GetBase() );
AddParam( theParams, "Selected shapes", aCI.GetBase() );
AddParam( theParams, "Tolerance", aCI.GetTolerance() );
AddParam( theParams, "Faces", aCI.GetFaces() );
AddParam( theParams, "To keep non solids", aCI.GetKeepNonSolids() );
@ -822,7 +849,7 @@ GetCreationInformation(std::string& theOperationName,
break;
case GLUE_EDGES_BY_LIST:
theOperationName = "GLUE_EDGES";
AddParam( theParams, "Selected shape", aCI.GetBase() );
AddParam( theParams, "Selected shapes", aCI.GetBase() );
AddParam( theParams, "Tolerance", aCI.GetTolerance() );
AddParam( theParams, "Edges", aCI.GetFaces() );
break;

View File

@ -26,9 +26,9 @@
#include <TColStd_HSequenceOfTransient.hxx>
#define GLUE_ARG_BASE 1
#define GLUE_ARG_TOLER 2
#define GLUE_ARG_FACES 3
#define GLUE_ARG_BASE 1
#define GLUE_ARG_TOLER 2
#define GLUE_ARG_FACES 3
#define GLUE_ARG_KEEPALL 4
#define GLUE_ARG_GLUEEDG 5
@ -38,10 +38,11 @@ class GEOMImpl_IGlue
GEOMImpl_IGlue(Handle(GEOM_Function) theFunction): _func(theFunction) {}
void SetBase(Handle(GEOM_Function) theRefBase)
{ _func->SetReference(GLUE_ARG_BASE, theRefBase); }
void SetBase(const Handle(TColStd_HSequenceOfTransient)& theShapes)
{ _func->SetReferenceList(GLUE_ARG_BASE, theShapes); }
Handle(GEOM_Function) GetBase() { return _func->GetReference(GLUE_ARG_BASE); }
Handle(TColStd_HSequenceOfTransient) GetBase()
{ return _func->GetReferenceList(GLUE_ARG_BASE); }
void SetTolerance(const Standard_Real theTolerance)
{ _func->SetReal(GLUE_ARG_TOLER, theTolerance); }

View File

@ -592,16 +592,11 @@ GEOMImpl_IHealingOperations::Sew (std::list<Handle(GEOM_Object)>& theObjects,
if (theObjects.empty())
return NULL;
Handle(TColStd_HSequenceOfTransient) objects = new TColStd_HSequenceOfTransient;
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);
Handle(TColStd_HSequenceOfTransient) objects =
GEOM_Object::GetLastFunctions( theObjects );
if ( objects.IsNull() || objects->IsEmpty() ) {
SetErrorCode("NULL argument shape");
return NULL;
}
// Add a new object
@ -643,7 +638,7 @@ GEOMImpl_IHealingOperations::Sew (std::list<Handle(GEOM_Object)>& theObjects,
pd << aNewObject << " = geompy.Sew(" << theObjects << ", " << theTolerance;
if (isAllowNonManifold) {
pd << ", true";
pd << ", True";
}
pd << ")";

View File

@ -67,60 +67,61 @@
#include <OpUtil.hxx>
#include <Utils_ExceptHandlers.hxx>
#include <TFunction_DriverTable.hxx>
#include <TFunction_Driver.hxx>
#include <TFunction_Logbook.hxx>
#include <TDataStd_Integer.hxx>
#include <TDataStd_IntegerArray.hxx>
#include <TDataStd_ListIteratorOfListOfExtendedString.hxx>
#include <TDF_Tool.hxx>
#include <BRepExtrema_ExtCF.hxx>
#include <BRepExtrema_DistShapeShape.hxx>
#include <BRep_Tool.hxx>
#include <BRep_Builder.hxx>
#include <BRepTools.hxx>
#include <BRepGProp.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <BRepBndLib.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
#include <BRepClass3d_SolidClassifier.hxx>
#include <BRepClass_FaceClassifier.hxx>
#include <BRepExtrema_DistShapeShape.hxx>
#include <BRepExtrema_ExtCF.hxx>
#include <BRepGProp.hxx>
#include <BRepMesh_IncrementalMesh.hxx>
#include <TopAbs.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopLoc_Location.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Solid.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopTools_Array1OfShape.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_MapOfOrientedShape.hxx>
#include <Geom_Surface.hxx>
#include <BRepTools.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <Bnd_Box.hxx>
#include <GEOMImpl_IMeasure.hxx>
#include <GEOMImpl_MeasureDriver.hxx>
#include <GProp_GProps.hxx>
#include <Geom2d_Curve.hxx>
#include <GeomAdaptor_Surface.hxx>
#include <GeomLib_Tool.hxx>
#include <Geom_CylindricalSurface.hxx>
#include <Geom_Plane.hxx>
#include <Geom_SphericalSurface.hxx>
#include <Geom_CylindricalSurface.hxx>
#include <GeomAdaptor_Surface.hxx>
#include <GeomLib_Tool.hxx>
#include <Geom2d_Curve.hxx>
#include <Bnd_Box.hxx>
#include <GProp_GProps.hxx>
#include <Geom_Surface.hxx>
#include <Precision.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <TColStd_HArray1OfInteger.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <TColStd_ListOfInteger.hxx>
#include <TDF_Tool.hxx>
#include <TDataStd_Integer.hxx>
#include <TDataStd_IntegerArray.hxx>
#include <TDataStd_ListIteratorOfListOfExtendedString.hxx>
#include <TFunction_Driver.hxx>
#include <TFunction_DriverTable.hxx>
#include <TFunction_Logbook.hxx>
#include <TopAbs.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopLoc_Location.hxx>
#include <TopTools_Array1OfShape.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_MapOfOrientedShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_SequenceOfShape.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Solid.hxx>
#include <TopoDS_Vertex.hxx>
#include <gp_Cylinder.hxx>
#include <gp_Lin.hxx>
#include <gp_Pnt.hxx>
@ -133,15 +134,6 @@
#include <Standard_Failure.hxx>
#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
// Includes added for GetInPlace algorithm improvement
#include <GEOMImpl_MeasureDriver.hxx>
#include <GEOMImpl_IMeasure.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
#include <BRepClass_FaceClassifier.hxx>
#include <BRepClass3d_SolidClassifier.hxx>
#include <Precision.hxx>
//=============================================================================
/*!
@ -666,14 +658,18 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeShape
* MakeGlueFaces
*/
//=============================================================================
Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFaces
(Handle(GEOM_Object) theShape,
const Standard_Real theTolerance,
const Standard_Boolean doKeepNonSolids)
Handle(GEOM_Object)
GEOMImpl_IShapesOperations::MakeGlueFaces (std::list< Handle(GEOM_Object) >& theShapes,
const Standard_Real theTolerance,
const Standard_Boolean doKeepNonSolids)
{
SetErrorCode(KO);
if (theShape.IsNull()) return NULL;
Handle(TColStd_HSequenceOfTransient) objects = GEOM_Object::GetLastFunctions( theShapes );
if ( objects.IsNull() || objects->IsEmpty() ) {
SetErrorCode("NULL argument shape");
return NULL;
}
//Add a new Glued object
Handle(GEOM_Object) aGlued = GetEngine()->AddObject(GetDocID(), GEOM_GLUED);
@ -688,10 +684,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFaces
GEOMImpl_IGlue aCI (aFunction);
Handle(GEOM_Function) aRefShape = theShape->GetLastFunction();
if (aRefShape.IsNull()) return NULL;
aCI.SetBase(aRefShape);
aCI.SetBase( objects );
aCI.SetTolerance(theTolerance);
aCI.SetKeepNonSolids(doKeepNonSolids);
@ -717,7 +710,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFaces
//Make a Python command
GEOM::TPythonDump(aFunction) << aGlued << " = geompy.MakeGlueFaces("
<< theShape << ", " << theTolerance << ")";
<< theShapes << ", " << theTolerance << ")";
// to provide warning
if (!isWarning) SetErrorCode(OK);
@ -806,16 +799,25 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetGlueFaces
* MakeGlueFacesByList
*/
//=============================================================================
Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFacesByList
(Handle(GEOM_Object) theShape,
const Standard_Real theTolerance,
std::list<Handle(GEOM_Object)> theFaces,
const Standard_Boolean doKeepNonSolids,
const Standard_Boolean doGlueAllEdges)
Handle(GEOM_Object)
GEOMImpl_IShapesOperations::MakeGlueFacesByList(std::list< Handle(GEOM_Object) >& theShapes,
const Standard_Real theTolerance,
std::list<Handle(GEOM_Object)> & theFaces,
const Standard_Boolean doKeepNonSolids,
const Standard_Boolean doGlueAllEdges)
{
SetErrorCode(KO);
if (theShape.IsNull()) return NULL;
Handle(TColStd_HSequenceOfTransient) objects = GEOM_Object::GetLastFunctions( theShapes );
if ( objects.IsNull() || objects->IsEmpty() ) {
SetErrorCode("NULL argument shape");
return NULL;
}
Handle(TColStd_HSequenceOfTransient) aFaces = GEOM_Object::GetLastFunctions( theFaces );
if ( aFaces.IsNull() ) {
SetErrorCode("NULL argument shape for the shape construction");
return NULL;
}
//Add a new Glued object
Handle(GEOM_Object) aGlued = GetEngine()->AddObject(GetDocID(), GEOM_GLUED);
@ -830,24 +832,10 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFacesByList
GEOMImpl_IGlue aCI (aFunction);
Handle(GEOM_Function) aRefShape = theShape->GetLastFunction();
if (aRefShape.IsNull()) return NULL;
aCI.SetBase(aRefShape);
aCI.SetBase( objects );
aCI.SetTolerance(theTolerance);
aCI.SetKeepNonSolids(doKeepNonSolids);
aCI.SetGlueAllEdges(doGlueAllEdges);
Handle(TColStd_HSequenceOfTransient) aFaces = new TColStd_HSequenceOfTransient;
std::list<Handle(GEOM_Object)>::iterator it = theFaces.begin();
for (; it != theFaces.end(); it++) {
Handle(GEOM_Function) aRefSh = (*it)->GetLastFunction();
if (aRefSh.IsNull()) {
SetErrorCode("NULL argument shape for the shape construction");
return NULL;
}
aFaces->Append(aRefSh);
}
aCI.SetFaces(aFaces);
//Compute the sub-shape value
@ -874,16 +862,8 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFacesByList
GEOM::TPythonDump pd(aFunction);
pd << aGlued << " = geompy.MakeGlueFacesByList("
<< theShape << ", " << theTolerance << ", [";
// Faces
it = theFaces.begin();
if (it != theFaces.end()) {
pd << (*it++);
while (it != theFaces.end()) {
pd << ", " << (*it++);
}
}
pd << "], " << (bool)doKeepNonSolids << ", " << (bool)doGlueAllEdges << ")";
<< theShapes << ", " << theTolerance << ", " << theFaces << ", "
<< (bool)doKeepNonSolids << ", " << (bool)doGlueAllEdges << ")";
// to provide warning
if (!isWarning) SetErrorCode(OK);
@ -895,13 +875,17 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFacesByList
* MakeGlueEdges
*/
//=============================================================================
Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueEdges
(Handle(GEOM_Object) theShape,
const Standard_Real theTolerance)
Handle(GEOM_Object)
GEOMImpl_IShapesOperations::MakeGlueEdges (std::list< Handle(GEOM_Object) >& theShapes,
const Standard_Real theTolerance)
{
SetErrorCode(KO);
if (theShape.IsNull()) return NULL;
Handle(TColStd_HSequenceOfTransient) objects = GEOM_Object::GetLastFunctions( theShapes );
if ( objects.IsNull() || objects->IsEmpty() ) {
SetErrorCode("NULL argument shape");
return NULL;
}
//Add a new Glued object
Handle(GEOM_Object) aGlued = GetEngine()->AddObject(GetDocID(), GEOM_GLUED);
@ -916,10 +900,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueEdges
GEOMImpl_IGlue aCI (aFunction);
Handle(GEOM_Function) aRefShape = theShape->GetLastFunction();
if (aRefShape.IsNull()) return NULL;
aCI.SetBase(aRefShape);
aCI.SetBase( objects );
aCI.SetTolerance(theTolerance);
aCI.SetKeepNonSolids(true);
@ -945,7 +926,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueEdges
//Make a Python command
GEOM::TPythonDump(aFunction) << aGlued << " = geompy.MakeGlueEdges("
<< theShape << ", " << theTolerance << ")";
<< theShapes << ", " << theTolerance << ")";
// to provide warning
if (!isWarning) SetErrorCode(OK);
@ -957,16 +938,36 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueEdges
* GetGlueShapes
*/
//=============================================================================
Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetGlueShapes
(Handle(GEOM_Object) theShape,
const Standard_Real theTolerance,
const TopAbs_ShapeEnum theType)
Handle(TColStd_HSequenceOfTransient)
GEOMImpl_IShapesOperations::GetGlueShapes (std::list< Handle(GEOM_Object) >& theShapes,
const Standard_Real theTolerance,
const TopAbs_ShapeEnum theType)
{
SetErrorCode(KO);
if (theShape.IsNull()) return NULL;
TopoDS_Shape aShape = theShape->GetValue();
if (aShape.IsNull()) return NULL;
TopoDS_Shape aShape;
TopTools_SequenceOfShape shapes;
std::list< Handle(GEOM_Object) >::iterator s = theShapes.begin();
Handle(GEOM_Object) lastCreatedGO;
for ( ; s != theShapes.end(); ++s )
{
Handle(GEOM_Object) go = *s;
if ( go.IsNull() ) return NULL;
aShape = go->GetValue();
if ( aShape.IsNull() ) return NULL;
shapes.Append( aShape );
lastCreatedGO = GEOM::GetCreatedLast( lastCreatedGO, go );
}
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;
}
Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
@ -977,9 +978,7 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetGlueShapes
Standard_Integer iErr = aGluer.ErrorStatus();
if (iErr) return NULL;
TCollection_AsciiString anAsciiList, anEntry;
TopTools_IndexedMapOfShape anIndices;
TopExp::MapShapes(aShape, anIndices);
std::vector< TopTools_IndexedMapOfShape* > anIndices( shapes.Length(), NULL );
Handle(TColStd_HArray1OfInteger) anArray;
Handle(GEOM_Object) anObj;
@ -1006,31 +1005,40 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetGlueShapes
GEOMUtils::SortShapes(listOnePerSet, Standard_False);
TopTools_ListIteratorOfListOfShape aListIt (listOnePerSet);
for (; aListIt.More(); aListIt.Next()) {
for (; aListIt.More(); aListIt.Next())
{
TopoDS_Shape aValue = aListIt.Value();
anArray = new TColStd_HArray1OfInteger(1,1);
anArray->SetValue(1, anIndices.FindIndex(aValue));
anObj = GetEngine()->AddSubShape(theShape, anArray);
if (!anObj.IsNull()) {
aSeq->Append(anObj);
// for python command
TDF_Tool::Entry(anObj->GetEntry(), anEntry);
anAsciiList += anEntry;
anAsciiList += ",";
// find a shape to add aValue as a sub-shape
anObj.Nullify();
s = theShapes.begin();
for ( int i = 0; i < shapes.Length(); ++i, ++s )
{
Handle(GEOM_Object) object = *s;
if ( !anIndices[i] ) {
anIndices[i] = new TopTools_IndexedMapOfShape;
TopExp::MapShapes( object->GetValue(), *anIndices[i]);
}
if (int index = anIndices[i]->FindIndex( aValue )) {
anArray = new TColStd_HArray1OfInteger(1,1);
anArray->SetValue(1, index);
anObj = GetEngine()->AddSubShape( object, anArray);
break;
}
}
if (!anObj.IsNull())
aSeq->Append(anObj);
}
for ( size_t i = 0 ; i < anIndices.size(); ++i )
delete anIndices[i];
// Make a Python command
if (anAsciiList.Length() > 0) {
anAsciiList.Trunc(anAsciiList.Length() - 1);
Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
if ( aSeq->Length() > 0)
{
Handle(GEOM_Function) aFunction = lastCreatedGO->GetLastFunction();
GEOM::TPythonDump pd (aFunction, /*append=*/true);
pd << "[" << anAsciiList.ToCString();
if (theType == TopAbs_FACE)
pd << "] = geompy.GetGlueFaces(" << theShape << ", " << theTolerance << ")";
else if (theType == TopAbs_EDGE)
pd << "] = geompy.GetGlueEdges(" << theShape << ", " << theTolerance << ")";
pd << aSeq
<< " = geompy." << (theType == TopAbs_FACE ? "GetGlueFaces" : "GetGlueEdges" )
<< "( " << theShapes << ", " << theTolerance << ")";
}
SetErrorCode(OK);
@ -1043,15 +1051,23 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetGlueShapes
* MakeGlueEdgesByList
*/
//=============================================================================
Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueEdgesByList
(Handle(GEOM_Object) theShape,
const Standard_Real theTolerance,
std::list<Handle(GEOM_Object)> theEdges)
Handle(GEOM_Object)
GEOMImpl_IShapesOperations::MakeGlueEdgesByList (std::list< Handle(GEOM_Object) >& theShapes,
const Standard_Real theTolerance,
std::list<Handle(GEOM_Object)>& theEdges)
{
SetErrorCode(KO);
if (theShape.IsNull()) return NULL;
Handle(TColStd_HSequenceOfTransient) objects = GEOM_Object::GetLastFunctions( theShapes );
if ( objects.IsNull() || objects->IsEmpty() ) {
SetErrorCode("NULL argument shape");
return NULL;
}
Handle(TColStd_HSequenceOfTransient) anEdges = GEOM_Object::GetLastFunctions( theEdges );
if ( anEdges.IsNull() ) {
SetErrorCode("NULL argument shape for the shape construction");
return NULL;
}
//Add a new Glued object
Handle(GEOM_Object) aGlued = GetEngine()->AddObject(GetDocID(), GEOM_GLUED);
@ -1065,23 +1081,9 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueEdgesByList
GEOMImpl_IGlue aCI (aFunction);
Handle(GEOM_Function) aRefShape = theShape->GetLastFunction();
if (aRefShape.IsNull()) return NULL;
aCI.SetBase(aRefShape);
aCI.SetBase( objects );
aCI.SetTolerance(theTolerance);
aCI.SetKeepNonSolids(true);
Handle(TColStd_HSequenceOfTransient) anEdges = new TColStd_HSequenceOfTransient;
std::list<Handle(GEOM_Object)>::iterator it = theEdges.begin();
for (; it != theEdges.end(); it++) {
Handle(GEOM_Function) aRefSh = (*it)->GetLastFunction();
if (aRefSh.IsNull()) {
SetErrorCode("NULL argument shape for the shape construction");
return NULL;
}
anEdges->Append(aRefSh);
}
aCI.SetFaces(anEdges);
//Compute the sub-shape value
@ -1108,16 +1110,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueEdgesByList
GEOM::TPythonDump pd (aFunction);
pd << aGlued << " = geompy.MakeGlueEdgesByList("
<< theShape << ", " << theTolerance << ", [";
// Edges
it = theEdges.begin();
if (it != theEdges.end()) {
pd << (*it++);
while (it != theEdges.end()) {
pd << ", " << (*it++);
}
}
pd << "])";
<< theShapes << ", " << theTolerance << ", " << theEdges << " )";
// to provide warning
if (!isWarning) SetErrorCode(OK);
@ -1131,7 +1124,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueEdgesByList
//=============================================================================
Handle(TColStd_HSequenceOfTransient)
GEOMImpl_IShapesOperations::GetExistingSubObjects(Handle(GEOM_Object) theShape,
const Standard_Boolean theGroupsOnly)
const Standard_Boolean theGroupsOnly)
{
// note: this method does not return fields
@ -1146,7 +1139,7 @@ GEOMImpl_IShapesOperations::GetExistingSubObjects(Handle(GEOM_Object) theShap
Handle(GEOM_BaseObject) obj = Handle(GEOM_BaseObject)::DownCast( results->Value(i));
obj->GetEntryString();
if ( i < results->Length() )
anAsciiList += ",";
anAsciiList += ",";
}
GEOM::TPythonDump pd (theShape->GetLastFunction(), /*append=*/true);
@ -1160,7 +1153,7 @@ GEOMImpl_IShapesOperations::GetExistingSubObjects(Handle(GEOM_Object) theShap
Handle(TColStd_HSequenceOfTransient)
GEOMImpl_IShapesOperations::GetExistingSubObjects(Handle(GEOM_Object) theShape,
const Standard_Integer theTypes)
const Standard_Integer theTypes)
{
SetErrorCode(KO);
@ -1190,8 +1183,8 @@ GEOMImpl_IShapesOperations::GetExistingSubObjects(Handle(GEOM_Object) theShap
bool isSubShape = anObj->IsKind(STANDARD_TYPE(GEOM_Object)) && anObj->GetType() != GEOM_GROUP;
bool isField = anObj->IsKind(STANDARD_TYPE(GEOM_Field));
if (theTypes & Groups && isGroup ||
theTypes & SubShapes && isSubShape ||
theTypes & Fields && isField) {
theTypes & SubShapes && isSubShape ||
theTypes & Fields && isField) {
aSeq->Append(anObj);
}
}

View File

@ -91,34 +91,31 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations
Standard_EXPORT Handle(GEOM_Object) MakeCompound (std::list<Handle(GEOM_Object)> theShapes);
Standard_EXPORT Handle(GEOM_Object) MakeGlueFaces (Handle(GEOM_Object) theShape,
Standard_EXPORT Handle(GEOM_Object) MakeGlueFaces (std::list< Handle(GEOM_Object) >& theShapes,
const Standard_Real theTolerance,
const Standard_Boolean doKeepNonSolids);
//Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetGlueFaces (Handle(GEOM_Object) theShape,
// const Standard_Real theTolerance);
Standard_EXPORT Handle(GEOM_Object) MakeGlueFacesByList (Handle(GEOM_Object) theShape,
Standard_EXPORT Handle(GEOM_Object) MakeGlueFacesByList (std::list< Handle(GEOM_Object) >& theShapes,
const Standard_Real theTolerance,
std::list<Handle(GEOM_Object)> theFaces,
std::list<Handle(GEOM_Object)>& theFaces,
const Standard_Boolean doKeepNonSolids,
const Standard_Boolean doGlueAllEdges);
Standard_EXPORT Handle(GEOM_Object) MakeGlueEdges (Handle(GEOM_Object) theShape,
Standard_EXPORT Handle(GEOM_Object) MakeGlueEdges (std::list< Handle(GEOM_Object) >& theShapes,
const Standard_Real theTolerance);
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetGlueShapes (Handle(GEOM_Object) theShape,
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetGlueShapes (std::list< Handle(GEOM_Object) >& theShapes,
const Standard_Real theTolerance,
const TopAbs_ShapeEnum theType);
Standard_EXPORT Handle(GEOM_Object) MakeGlueEdgesByList (Handle(GEOM_Object) theShape,
Standard_EXPORT Handle(GEOM_Object) MakeGlueEdgesByList (std::list< Handle(GEOM_Object) >& theShapes,
const Standard_Real theTolerance,
std::list<Handle(GEOM_Object)> theEdges);
std::list<Handle(GEOM_Object)> & theEdges);
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetExistingSubObjects(Handle(GEOM_Object) theShape,
const Standard_Boolean theGroupsOnly);
const Standard_Boolean theGroupsOnly);
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetExistingSubObjects(Handle(GEOM_Object) theShape,
const Standard_Integer theTypes = All);
const Standard_Integer theTypes = All);
enum ExplodeType {
EXPLODE_OLD_INCLUDE_MAIN,

View File

@ -347,17 +347,12 @@ GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::Sew (const GEOM::ListOfGO& theO
return aGEOMObject._retn();
//Get the shapes
std::list<Handle(GEOM_Object)> objects;
const int aLen = theObjects.length();
for ( int ind = 0; ind < aLen; ind++)
{
Handle(GEOM_Object) aSh = GetObjectImpl(theObjects[ind]);
if (aSh.IsNull()) return aGEOMObject._retn();
objects.push_back(aSh);
}
std::list< Handle(GEOM_Object) > aShapes;
if (! GetListOfObjectsImpl( theObjects, aShapes ))
return aGEOMObject._retn();
// Perform
Handle(GEOM_Object) aNewObject = GetOperations()->Sew( objects, theTolerance, false );
Handle(GEOM_Object) aNewObject = GetOperations()->Sew( aShapes, theTolerance, false );
if (!GetOperations()->IsDone() || aNewObject.IsNull())
return aGEOMObject._retn();
@ -383,17 +378,12 @@ GEOM_IHealingOperations_i::SewAllowNonManifold (const GEOM::ListOfGO& theObjects
return aGEOMObject._retn();
//Get the shapes
std::list<Handle(GEOM_Object)> objects;
const int aLen = theObjects.length();
for ( int ind = 0; ind < aLen; ind++)
{
Handle(GEOM_Object) aSh = GetObjectImpl(theObjects[ind]);
if (aSh.IsNull()) return aGEOMObject._retn();
objects.push_back(aSh);
}
std::list< Handle(GEOM_Object) > aShapes;
if (! GetListOfObjectsImpl( theObjects, aShapes ))
return aGEOMObject._retn();
// Perform
Handle(GEOM_Object) aNewObject = GetOperations()->Sew( objects, theTolerance, true );
Handle(GEOM_Object) aNewObject = GetOperations()->Sew( aShapes, theTolerance, true );
if (!GetOperations()->IsDone() || aNewObject.IsNull())
return aGEOMObject._retn();

View File

@ -209,6 +209,29 @@ Handle(TColStd_HSequenceOfTransient) GEOM_IOperations_i::GetListOfObjectsImpl
return aResult;
}
//=======================================================================
//function : GetListOfObjectsImpl
//purpose :
//=======================================================================
bool GEOM_IOperations_i::GetListOfObjectsImpl(const GEOM::ListOfGO& theObjects,
std::list< Handle(GEOM_Object) >& theList)
{
int i;
int aNbObj = theObjects.length();
for (i = 0; i < aNbObj; i++) {
Handle(GEOM_Object) anObj = GetObjectImpl(theObjects[i]);
if (anObj.IsNull())
return false;
theList.push_back(anObj);
}
return true;
}
//=============================================================================
/*!
* UpdateGUIForObject

View File

@ -54,6 +54,8 @@ class GEOM_I_EXPORT GEOM_IOperations_i : public virtual POA_GEOM::GEOM_IOperatio
virtual Handle(TColStd_HSequenceOfTransient)
GetListOfObjectsImpl(const GEOM::ListOfGO& theObjects);
bool GetListOfObjectsImpl(const GEOM::ListOfGO& theObjects,
std::list< Handle(GEOM_Object) >& theList);
virtual void StartOperation();

View File

@ -345,8 +345,8 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeSolidShells
* MakeCompound
*/
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeCompound
(const GEOM::ListOfGO& theShapes)
GEOM::GEOM_Object_ptr
GEOM_IShapesOperations_i::MakeCompound (const GEOM::ListOfGO& theShapes)
{
GEOM::GEOM_Object_var aGEOMObject;
@ -378,10 +378,10 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeCompound
* MakeGlueFaces
*/
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFaces
(GEOM::GEOM_Object_ptr theShape,
CORBA::Double theTolerance,
CORBA::Boolean doKeepNonSolids)
GEOM::GEOM_Object_ptr
GEOM_IShapesOperations_i::MakeGlueFaces (const GEOM::ListOfGO& theShapes,
CORBA::Double theTolerance,
CORBA::Boolean doKeepNonSolids)
{
GEOM::GEOM_Object_var aGEOMObject;
@ -389,12 +389,13 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFaces
GetOperations()->SetNotDone();
//Get the reference objects
Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
if (aShape.IsNull()) return aGEOMObject._retn();
std::list< Handle(GEOM_Object) > aShapes;
if (! GetListOfObjectsImpl( theShapes, aShapes ))
return aGEOMObject._retn();
//Perform the gluing
Handle(GEOM_Object) anObject =
GetOperations()->MakeGlueFaces(aShape, theTolerance, doKeepNonSolids);
GetOperations()->MakeGlueFaces(aShapes, theTolerance, doKeepNonSolids);
//if (!GetOperations()->IsDone() || anObject.IsNull())
// to allow warning
if (anObject.IsNull())
@ -408,9 +409,9 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFaces
* GetGlueFaces
*/
//=============================================================================
GEOM::ListOfGO* GEOM_IShapesOperations_i::GetGlueFaces
(GEOM::GEOM_Object_ptr theShape,
const CORBA::Double theTolerance)
GEOM::ListOfGO*
GEOM_IShapesOperations_i::GetGlueFaces (const GEOM::ListOfGO& theShapes,
const CORBA::Double theTolerance)
{
GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
@ -418,12 +419,12 @@ GEOM::ListOfGO* GEOM_IShapesOperations_i::GetGlueFaces
GetOperations()->SetNotDone();
//Get the reference objects
Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
if (aShape.IsNull()) return aSeq._retn();
std::list< Handle(GEOM_Object) > aShapes;
if (! GetListOfObjectsImpl( theShapes, aShapes ))
return aSeq._retn();
Handle(TColStd_HSequenceOfTransient) aHSeq =
//GetOperations()->GetGlueFaces(aShape, theTolerance);
GetOperations()->GetGlueShapes(aShape, theTolerance, TopAbs_FACE);
GetOperations()->GetGlueShapes(aShapes, theTolerance, TopAbs_FACE);
//if (!GetOperations()->IsDone() || aHSeq.IsNull())
// to allow warning
@ -443,12 +444,12 @@ GEOM::ListOfGO* GEOM_IShapesOperations_i::GetGlueFaces
* MakeGlueFacesByList
*/
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFacesByList
(GEOM::GEOM_Object_ptr theShape,
CORBA::Double theTolerance,
const GEOM::ListOfGO& theFaces,
CORBA::Boolean doKeepNonSolids,
CORBA::Boolean doGlueAllEdges)
GEOM::GEOM_Object_ptr
GEOM_IShapesOperations_i::MakeGlueFacesByList (const GEOM::ListOfGO& theShapes,
CORBA::Double theTolerance,
const GEOM::ListOfGO& theFaces,
CORBA::Boolean doKeepNonSolids,
CORBA::Boolean doGlueAllEdges)
{
GEOM::GEOM_Object_var aGEOMObject;
@ -456,22 +457,19 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFacesByList
GetOperations()->SetNotDone();
//Get the reference objects
Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
if (aShape.IsNull()) return aGEOMObject._retn();
std::list< Handle(GEOM_Object) > aShapes;
if (! GetListOfObjectsImpl( theShapes, aShapes ))
return aGEOMObject._retn();
int ind, aLen;
std::list<Handle(GEOM_Object)> aFaces;
//Get the shapes
aLen = theFaces.length();
for (ind = 0; ind < aLen; ind++) {
Handle(GEOM_Object) aSh = GetObjectImpl(theFaces[ind]);
if (aSh.IsNull()) return aGEOMObject._retn();
aFaces.push_back(aSh);
}
std::list<Handle(GEOM_Object)> aFaces;
if (! GetListOfObjectsImpl( theFaces, aFaces ))
return aGEOMObject._retn();
//Perform the gluing
Handle(GEOM_Object) anObject =
GetOperations()->MakeGlueFacesByList(aShape, theTolerance, aFaces, doKeepNonSolids, doGlueAllEdges);
GetOperations()->MakeGlueFacesByList(aShapes, theTolerance, aFaces,
doKeepNonSolids, doGlueAllEdges);
//if (!GetOperations()->IsDone() || anObject.IsNull())
// to allow warning
if (anObject.IsNull())
@ -485,9 +483,9 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFacesByList
* MakeGlueEdges
*/
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueEdges
(GEOM::GEOM_Object_ptr theShape,
CORBA::Double theTolerance)
GEOM::GEOM_Object_ptr
GEOM_IShapesOperations_i::MakeGlueEdges (const GEOM::ListOfGO& theShapes,
CORBA::Double theTolerance)
{
GEOM::GEOM_Object_var aGEOMObject;
@ -495,12 +493,13 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueEdges
GetOperations()->SetNotDone();
//Get the reference objects
Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
if (aShape.IsNull()) return aGEOMObject._retn();
std::list< Handle(GEOM_Object) > aShapes;
if (! GetListOfObjectsImpl( theShapes, aShapes ))
return aGEOMObject._retn();
//Perform the gluing
Handle(GEOM_Object) anObject =
GetOperations()->MakeGlueEdges(aShape, theTolerance);
GetOperations()->MakeGlueEdges(aShapes, theTolerance);
//if (!GetOperations()->IsDone() || anObject.IsNull())
// to allow warning
if (anObject.IsNull())
@ -514,9 +513,9 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueEdges
* GetGlueEdges
*/
//=============================================================================
GEOM::ListOfGO* GEOM_IShapesOperations_i::GetGlueEdges
(GEOM::GEOM_Object_ptr theShape,
const CORBA::Double theTolerance)
GEOM::ListOfGO*
GEOM_IShapesOperations_i::GetGlueEdges (const GEOM::ListOfGO& theShapes,
const CORBA::Double theTolerance)
{
GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
@ -524,11 +523,12 @@ GEOM::ListOfGO* GEOM_IShapesOperations_i::GetGlueEdges
GetOperations()->SetNotDone();
//Get the reference objects
Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
if (aShape.IsNull()) return aSeq._retn();
std::list< Handle(GEOM_Object) > aShapes;
if (! GetListOfObjectsImpl( theShapes, aShapes ))
return aSeq._retn();
Handle(TColStd_HSequenceOfTransient) aHSeq =
GetOperations()->GetGlueShapes(aShape, theTolerance, TopAbs_EDGE);
GetOperations()->GetGlueShapes(aShapes, theTolerance, TopAbs_EDGE);
//if (!GetOperations()->IsDone() || aHSeq.IsNull())
// to allow warning
@ -548,10 +548,10 @@ GEOM::ListOfGO* GEOM_IShapesOperations_i::GetGlueEdges
* MakeGlueEdgesByList
*/
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueEdgesByList
(GEOM::GEOM_Object_ptr theShape,
CORBA::Double theTolerance,
const GEOM::ListOfGO& theEdges)
GEOM::GEOM_Object_ptr
GEOM_IShapesOperations_i::MakeGlueEdgesByList (const GEOM::ListOfGO& theShapes,
CORBA::Double theTolerance,
const GEOM::ListOfGO& theEdges)
{
GEOM::GEOM_Object_var aGEOMObject;
@ -559,22 +559,18 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueEdgesByList
GetOperations()->SetNotDone();
//Get the reference objects
Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
if (aShape.IsNull()) return aGEOMObject._retn();
std::list< Handle(GEOM_Object) > aShapes;
if (! GetListOfObjectsImpl( theShapes, aShapes ))
return aGEOMObject._retn();
int ind, aLen;
std::list<Handle(GEOM_Object)> anEdges;
//Get the shapes
aLen = theEdges.length();
for (ind = 0; ind < aLen; ind++) {
Handle(GEOM_Object) aSh = GetObjectImpl(theEdges[ind]);
if (aSh.IsNull()) return aGEOMObject._retn();
anEdges.push_back(aSh);
}
std::list<Handle(GEOM_Object)> anEdges;
if (! GetListOfObjectsImpl( theEdges, anEdges ))
return aGEOMObject._retn();
//Perform the gluing
Handle(GEOM_Object) anObject =
GetOperations()->MakeGlueEdgesByList(aShape, theTolerance, anEdges);
GetOperations()->MakeGlueEdgesByList(aShapes, theTolerance, anEdges);
//if (!GetOperations()->IsDone() || anObject.IsNull())
// to allow warning
if (anObject.IsNull())
@ -588,8 +584,9 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueEdgesByList
* GetExistingSubObjects
*/
//=============================================================================
GEOM::ListOfGO* GEOM_IShapesOperations_i::GetExistingSubObjects (GEOM::GEOM_Object_ptr theShape,
CORBA::Boolean theGroupsOnly)
GEOM::ListOfGO*
GEOM_IShapesOperations_i::GetExistingSubObjects (GEOM::GEOM_Object_ptr theShape,
CORBA::Boolean theGroupsOnly)
{
GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;

View File

@ -72,26 +72,26 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i :
GEOM::GEOM_Object_ptr MakeCompound (const GEOM::ListOfGO& theShapes);
GEOM::GEOM_Object_ptr MakeGlueFaces (GEOM::GEOM_Object_ptr theShape,
GEOM::GEOM_Object_ptr MakeGlueFaces (const GEOM::ListOfGO& theShape,
CORBA::Double theTolerance,
CORBA::Boolean doKeepNonSolids);
GEOM::ListOfGO* GetGlueFaces (GEOM::GEOM_Object_ptr theShape,
GEOM::ListOfGO* GetGlueFaces (const GEOM::ListOfGO& theShape,
CORBA::Double theTolerance);
GEOM::GEOM_Object_ptr MakeGlueFacesByList (GEOM::GEOM_Object_ptr theShape,
GEOM::GEOM_Object_ptr MakeGlueFacesByList (const GEOM::ListOfGO& theShape,
CORBA::Double theTolerance,
const GEOM::ListOfGO& theFaces,
CORBA::Boolean doKeepNonSolids,
CORBA::Boolean doGlueAllEdges);
GEOM::GEOM_Object_ptr MakeGlueEdges (GEOM::GEOM_Object_ptr theShape,
GEOM::GEOM_Object_ptr MakeGlueEdges (const GEOM::ListOfGO& theShape,
CORBA::Double theTolerance);
GEOM::ListOfGO* GetGlueEdges (GEOM::GEOM_Object_ptr theShape,
GEOM::ListOfGO* GetGlueEdges (const GEOM::ListOfGO& theShape,
CORBA::Double theTolerance);
GEOM::GEOM_Object_ptr MakeGlueEdgesByList (GEOM::GEOM_Object_ptr theShape,
GEOM::GEOM_Object_ptr MakeGlueEdgesByList (const GEOM::ListOfGO& theShape,
CORBA::Double theTolerance,
const GEOM::ListOfGO& theEdges);

View File

@ -387,8 +387,125 @@ def TestRemoveWebs (geompy):
Joined_1 = geompy.RemoveInternalFaces(Partition_1)
geompy.addToStudy(Joined_1, 'Joined_1')
def TestSewGluing(geompy):
import GEOM
box1 = geompy.MakeBox(0,0,0, 1,1,1)
box2 = geompy.MakeBox(1,0,0, 2,1,1)
comp = geompy.MakeCompound( [box1, box2] )
# no sewing with AllowNonManifold=False
sew1 = geompy.MakeSewing( [box1,box2], 1e-5, AllowNonManifold=False)
assert not sew1
sew2 = geompy.MakeSewing( comp, 1e-5, AllowNonManifold=False)
assert not sew2
sew3 = geompy.MakeSewing( [comp], 1e-5, AllowNonManifold=False)
assert not sew3
sew1 = geompy.Sew( [box1,box2], 1e-5, AllowNonManifold=False)
assert not sew1
sew2 = geompy.Sew( comp, 1e-5, AllowNonManifold=False)
assert not sew2
sew3 = geompy.Sew( [comp], 1e-5, AllowNonManifold=False)
assert not sew3
# check MakeSewing()
sew1 = geompy.MakeSewing( [box1,box2], 1e-5, AllowNonManifold=True)
assert sew1.GetShapeType() == GEOM.SHELL
assert geompy.NumberOfFaces( sew1 ) == geompy.NumberOfFaces( comp )
assert geompy.NumberOfEdges( sew1 ) == geompy.NumberOfEdges( comp ) - 4
sew2 = geompy.MakeSewing( comp, 1e-5, AllowNonManifold=True)
assert sew2.GetShapeType() == GEOM.SHELL
assert geompy.NumberOfFaces( sew2 ) == geompy.NumberOfFaces( comp )
assert geompy.NumberOfEdges( sew2 ) == geompy.NumberOfEdges( comp ) - 4
sew3 = geompy.MakeSewing( [comp], 1e-5, AllowNonManifold=True)
assert sew3.GetShapeType() == GEOM.SHELL
assert geompy.NumberOfFaces( sew3 ) == geompy.NumberOfFaces( comp )
assert geompy.NumberOfEdges( sew3 ) == geompy.NumberOfEdges( comp ) - 4
# check Sew()
sew1 = geompy.Sew( [box1,box2], 1e-5, AllowNonManifold=True)
assert sew1.GetShapeType() == GEOM.SHELL
assert geompy.NumberOfFaces( sew1 ) == geompy.NumberOfFaces( comp )
assert geompy.NumberOfEdges( sew1 ) == geompy.NumberOfEdges( comp ) - 4
sew2 = geompy.Sew( comp, 1e-5, AllowNonManifold=True)
assert sew2.GetShapeType() == GEOM.SHELL
assert geompy.NumberOfFaces( sew2 ) == geompy.NumberOfFaces( comp )
assert geompy.NumberOfEdges( sew2 ) == geompy.NumberOfEdges( comp ) - 4
sew3 = geompy.Sew( [comp], 1e-5, AllowNonManifold=True)
assert sew3.GetShapeType() == GEOM.SHELL
assert geompy.NumberOfFaces( sew3 ) == geompy.NumberOfFaces( comp )
assert geompy.NumberOfEdges( sew3 ) == geompy.NumberOfEdges( comp ) - 4
# check MakeGlueFaces()
glueF1 = geompy.MakeGlueFaces( [box1,box2], 1e-5)
assert glueF1.GetShapeType() == GEOM.COMPOUND
assert geompy.NumberOfFaces( glueF1 ) == geompy.NumberOfFaces( comp ) - 1
assert geompy.NumberOfEdges( glueF1 ) == geompy.NumberOfEdges( comp ) - 4
glueF2 = geompy.MakeGlueFaces( [comp], 1e-5)
assert glueF2.GetShapeType() == GEOM.COMPOUND
assert geompy.NumberOfFaces( glueF2 ) == geompy.NumberOfFaces( comp ) - 1
assert geompy.NumberOfEdges( glueF2 ) == geompy.NumberOfEdges( comp ) - 4
glueF3 = geompy.MakeGlueFaces( comp, 1e-5)
assert glueF3.GetShapeType() == GEOM.COMPOUND
assert geompy.NumberOfFaces( glueF3 ) == geompy.NumberOfFaces( comp ) - 1
assert geompy.NumberOfEdges( glueF3 ) == geompy.NumberOfEdges( comp ) - 4
# check GetGlueFaces()
glueFF1 = geompy.GetGlueFaces( [box1,box2], 1e-5)
assert len( glueFF1 ) == 1 and glueFF1[0].GetShapeType() == GEOM.FACE
glueFF2 = geompy.GetGlueFaces( [comp], 1e-5)
assert len( glueFF2 ) == 1 and glueFF2[0].GetShapeType() == GEOM.FACE
glueFF3 = geompy.GetGlueFaces( comp, 1e-5)
assert len( glueFF3 ) == 1 and glueFF3[0].GetShapeType() == GEOM.FACE
#check MakeGlueFacesByList()
glueF1 = geompy.MakeGlueFacesByList( [box1,box2], 1e-5, glueFF1)
assert glueF1.GetShapeType() == GEOM.COMPOUND
assert geompy.NumberOfFaces( glueF1 ) == geompy.NumberOfFaces( comp ) - 1
assert geompy.NumberOfEdges( glueF1 ) == geompy.NumberOfEdges( comp ) - 4
glueF2 = geompy.MakeGlueFacesByList( [comp], 1e-5, glueFF2)
assert glueF2.GetShapeType() == GEOM.COMPOUND
assert geompy.NumberOfFaces( glueF2 ) == geompy.NumberOfFaces( comp ) - 1
assert geompy.NumberOfEdges( glueF2 ) == geompy.NumberOfEdges( comp ) - 4
glueF3 = geompy.MakeGlueFacesByList( comp, 1e-5, glueFF3 )
assert glueF3.GetShapeType() == GEOM.COMPOUND
assert geompy.NumberOfFaces( glueF3 ) == geompy.NumberOfFaces( comp ) - 1
assert geompy.NumberOfEdges( glueF3 ) == geompy.NumberOfEdges( comp ) - 4
# check MakeGlueEdges()
glueE1 = geompy.MakeGlueEdges( [box1,box2], 1e-5)
assert glueE1.GetShapeType() == GEOM.COMPOUND
assert geompy.NumberOfEdges( glueE1 ) == geompy.NumberOfEdges( comp ) - 4
glueE2 = geompy.MakeGlueEdges( [comp], 1e-5)
assert glueE2.GetShapeType() == GEOM.COMPOUND
assert geompy.NumberOfEdges( glueE2 ) == geompy.NumberOfEdges( comp ) - 4
glueE3 = geompy.MakeGlueEdges( comp, 1e-5)
assert glueE3.GetShapeType() == GEOM.COMPOUND
assert geompy.NumberOfEdges( glueE3 ) == geompy.NumberOfEdges( comp ) - 4
# check GetGlueEdges()
glueEE1 = geompy.GetGlueEdges( [box1,box2], 1e-5)
assert len( glueEE1 ) == 4 and glueEE1[0].GetShapeType() == GEOM.EDGE
glueEE2 = geompy.GetGlueEdges( [comp], 1e-5)
assert len( glueEE2 ) == 4 and glueEE2[0].GetShapeType() == GEOM.EDGE
glueEE3 = geompy.GetGlueEdges( comp, 1e-5)
assert len( glueEE3 ) == 4 and glueEE3[0].GetShapeType() == GEOM.EDGE
#check MakeGlueEdgesByList()
glueEL1 = geompy.MakeGlueEdgesByList( [box1,box2], 1e-5, glueEE1)
assert glueEL1.GetShapeType() == GEOM.COMPOUND
assert geompy.NumberOfEdges( glueEL1 ) == geompy.NumberOfEdges( comp ) - 4
glueEL2 = geompy.MakeGlueEdgesByList( [comp], 1e-5, glueEE2)
assert glueEL2.GetShapeType() == GEOM.COMPOUND
assert geompy.NumberOfEdges( glueEL2 ) == geompy.NumberOfEdges( comp ) - 4
glueEL3 = geompy.MakeGlueEdgesByList( comp, 1e-5, glueEE3 )
assert glueEL3.GetShapeType() == GEOM.COMPOUND
assert geompy.NumberOfEdges( glueEL3 ) == geompy.NumberOfEdges( comp ) - 4
return
def TestHealingOperations (geompy, math):
TestSewGluing(geompy)
TestMakeSewing(geompy, math)
TestDivideEdge(geompy)
TestSuppressHoles(geompy)

View File

@ -6702,8 +6702,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
self._autoPublish(anObj[2], theName, "openWire")
return anObj
## Replace coincident faces in theShape by one face.
# @param theShape Initial shape.
## Replace coincident faces in \a theShapes by one face.
# @param theShapes Initial shapes, either a list or compound of shapes.
# @param theTolerance Maximum distance between faces, which can be considered as coincident.
# @param doKeepNonSolids If FALSE, only solids will present in the result,
# otherwise all initial shapes.
@ -6711,16 +6711,16 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
# 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 a copy of theShape without coincident faces.
# @return New GEOM.GEOM_Object, containing copies of theShapes without coincident faces.
#
# @ref tui_glue_faces "Example"
@ManageTransactions("ShapesOp")
def MakeGlueFaces(self, theShape, theTolerance, doKeepNonSolids=True, theName=None):
def MakeGlueFaces(self, theShapes, theTolerance, doKeepNonSolids=True, theName=None):
"""
Replace coincident faces in theShape by one face.
Replace coincident faces in theShapes by one face.
Parameters:
theShape Initial shape.
theShapes Initial shapes, either a list or compound of shapes.
theTolerance Maximum distance between faces, which can be considered as coincident.
doKeepNonSolids If FALSE, only solids will present in the result,
otherwise all initial shapes.
@ -6729,19 +6729,19 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing a copy of theShape without coincident faces.
New GEOM.GEOM_Object, containing copies of theShapes without coincident faces.
"""
# Example: see GEOM_Spanner.py
theTolerance,Parameters = ParseParameters(theTolerance)
anObj = self.ShapesOp.MakeGlueFaces(theShape, theTolerance, doKeepNonSolids)
anObj = self.ShapesOp.MakeGlueFaces(ToList(theShapes), theTolerance, doKeepNonSolids)
if anObj is None:
raise RuntimeError, "MakeGlueFaces : " + self.ShapesOp.GetErrorCode()
anObj.SetParameters(Parameters)
self._autoPublish(anObj, theName, "glueFaces")
return anObj
## Find coincident faces in theShape for possible gluing.
# @param theShape Initial shape.
## Find coincident faces in \a theShapes for possible gluing.
# @param theShapes Initial shapes, either a list or compound of shapes.
# @param theTolerance Maximum distance between faces,
# which can be considered as coincident.
# @param theName Object name; when specified, this parameter is used
@ -6752,12 +6752,12 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
#
# @ref tui_glue_faces "Example"
@ManageTransactions("ShapesOp")
def GetGlueFaces(self, theShape, theTolerance, theName=None):
def GetGlueFaces(self, theShapes, theTolerance, theName=None):
"""
Find coincident faces in theShape for possible gluing.
Find coincident faces in theShapes for possible gluing.
Parameters:
theShape Initial shape.
theShapes Initial shapes, either a list or compound of shapes.
theTolerance Maximum distance between faces,
which can be considered as coincident.
theName Object name; when specified, this parameter is used
@ -6767,14 +6767,14 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
Returns:
GEOM.ListOfGO
"""
anObj = self.ShapesOp.GetGlueFaces(theShape, theTolerance)
anObj = self.ShapesOp.GetGlueFaces(ToList(theShapes), theTolerance)
RaiseIfFailed("GetGlueFaces", self.ShapesOp)
self._autoPublish(anObj, theName, "facesToGlue")
return anObj
## Replace coincident faces in theShape by one face
## Replace coincident faces in \a theShapes by one face
# in compliance with given list of faces
# @param theShape Initial shape.
# @param theShapes Initial shapes, either a list or compound of shapes.
# @param theTolerance Maximum distance between faces,
# which can be considered as coincident.
# @param theFaces List of faces for gluing.
@ -6787,19 +6787,18 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
# 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 a copy of theShape
# without some faces.
# @return New GEOM.GEOM_Object, containing copies of theShapes without coincident faces.
#
# @ref tui_glue_faces "Example"
@ManageTransactions("ShapesOp")
def MakeGlueFacesByList(self, theShape, theTolerance, theFaces,
def MakeGlueFacesByList(self, theShapes, theTolerance, theFaces,
doKeepNonSolids=True, doGlueAllEdges=True, theName=None):
"""
Replace coincident faces in theShape by one face
Replace coincident faces in theShapes by one face
in compliance with given list of faces
Parameters:
theShape Initial shape.
theShapes theShapes Initial shapes, either a list or compound of shapes.
theTolerance Maximum distance between faces,
which can be considered as coincident.
theFaces List of faces for gluing.
@ -6813,51 +6812,50 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing a copy of theShape
without some faces.
New GEOM.GEOM_Object, containing copies of theShapes without coincident faces.
"""
anObj = self.ShapesOp.MakeGlueFacesByList(theShape, theTolerance, theFaces,
anObj = self.ShapesOp.MakeGlueFacesByList(ToList(theShapes), theTolerance, theFaces,
doKeepNonSolids, doGlueAllEdges)
if anObj is None:
raise RuntimeError, "MakeGlueFacesByList : " + self.ShapesOp.GetErrorCode()
self._autoPublish(anObj, theName, "glueFaces")
return anObj
## Replace coincident edges in theShape by one edge.
# @param theShape Initial shape.
## Replace coincident edges in \a theShapes by one edge.
# @param theShapes Initial shapes, either a list or compound of shapes.
# @param theTolerance Maximum distance between edges, which can be considered as coincident.
# @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 a copy of theShape without coincident edges.
# @return New GEOM.GEOM_Object, containing copies of theShapes without coincident edges.
#
# @ref tui_glue_edges "Example"
@ManageTransactions("ShapesOp")
def MakeGlueEdges(self, theShape, theTolerance, theName=None):
def MakeGlueEdges(self, theShapes, theTolerance, theName=None):
"""
Replace coincident edges in theShape by one edge.
Replace coincident edges in theShapes by one edge.
Parameters:
theShape Initial shape.
theShapes Initial shapes, either a list or compound of shapes.
theTolerance Maximum distance between edges, which can be considered as coincident.
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 a copy of theShape without coincident edges.
New GEOM.GEOM_Object, containing copies of theShapes without coincident edges.
"""
theTolerance,Parameters = ParseParameters(theTolerance)
anObj = self.ShapesOp.MakeGlueEdges(theShape, theTolerance)
anObj = self.ShapesOp.MakeGlueEdges(ToList(theShapes), theTolerance)
if anObj is None:
raise RuntimeError, "MakeGlueEdges : " + self.ShapesOp.GetErrorCode()
anObj.SetParameters(Parameters)
self._autoPublish(anObj, theName, "glueEdges")
return anObj
## Find coincident edges in theShape for possible gluing.
# @param theShape Initial shape.
## Find coincident edges in \a theShapes for possible gluing.
# @param theShapes Initial shapes, either a list or compound of shapes.
# @param theTolerance Maximum distance between edges,
# which can be considered as coincident.
# @param theName Object name; when specified, this parameter is used
@ -6868,12 +6866,12 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
#
# @ref tui_glue_edges "Example"
@ManageTransactions("ShapesOp")
def GetGlueEdges(self, theShape, theTolerance, theName=None):
def GetGlueEdges(self, theShapes, theTolerance, theName=None):
"""
Find coincident edges in theShape for possible gluing.
Find coincident edges in theShapes for possible gluing.
Parameters:
theShape Initial shape.
theShapes Initial shapes, either a list or compound of shapes.
theTolerance Maximum distance between edges,
which can be considered as coincident.
theName Object name; when specified, this parameter is used
@ -6883,14 +6881,14 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
Returns:
GEOM.ListOfGO
"""
anObj = self.ShapesOp.GetGlueEdges(theShape, theTolerance)
anObj = self.ShapesOp.GetGlueEdges(ToList(theShapes), theTolerance)
RaiseIfFailed("GetGlueEdges", self.ShapesOp)
self._autoPublish(anObj, theName, "edgesToGlue")
return anObj
## Replace coincident edges in theShape by one edge
## Replace coincident edges in theShapes by one edge
# in compliance with given list of edges.
# @param theShape Initial shape.
# @param theShapes Initial shapes, either a list or compound of shapes.
# @param theTolerance Maximum distance between edges,
# which can be considered as coincident.
# @param theEdges List of edges for gluing.
@ -6898,18 +6896,17 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
# 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 a copy of theShape
# without some edges.
# @return New GEOM.GEOM_Object, containing copies of theShapes without coincident edges.
#
# @ref tui_glue_edges "Example"
@ManageTransactions("ShapesOp")
def MakeGlueEdgesByList(self, theShape, theTolerance, theEdges, theName=None):
def MakeGlueEdgesByList(self, theShapes, theTolerance, theEdges, theName=None):
"""
Replace coincident edges in theShape by one edge
Replace coincident edges in theShapes by one edge
in compliance with given list of edges.
Parameters:
theShape Initial shape.
theShapes Initial shapes, either a list or compound of shapes.
theTolerance Maximum distance between edges,
which can be considered as coincident.
theEdges List of edges for gluing.
@ -6918,10 +6915,9 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing a copy of theShape
without some edges.
New GEOM.GEOM_Object, containing copies of theShapes without coincident edges.
"""
anObj = self.ShapesOp.MakeGlueEdgesByList(theShape, theTolerance, theEdges)
anObj = self.ShapesOp.MakeGlueEdgesByList(ToList(theShapes), theTolerance, theEdges)
if anObj is None:
raise RuntimeError, "MakeGlueEdgesByList : " + self.ShapesOp.GetErrorCode()
self._autoPublish(anObj, theName, "glueEdges")

View File

@ -91,7 +91,7 @@ RepairGUI_GlueDlg::RepairGUI_GlueDlg(GeometryGUI* theGeometryGUI, QWidget* paren
GroupPoints = new DlgRef_1SelExt(centralWidget());
GroupPoints->GroupBox1->setTitle(tr("GEOM_GLUE"));
GroupPoints->TextLabel1->setText(tr("GEOM_SELECTED_SHAPE"));
GroupPoints->TextLabel1->setText(tr("GEOM_SELECTED_SHAPES"));
GroupPoints->PushButton1->setIcon(image0);
GroupPoints->LineEdit1->setReadOnly(true);
@ -108,7 +108,7 @@ RepairGUI_GlueDlg::RepairGUI_GlueDlg(GeometryGUI* theGeometryGUI, QWidget* paren
GroupPoints2 = new DlgRef_1SelExt(centralWidget());
GroupPoints2->GroupBox1->setTitle(tr("GEOM_GLUE"));
GroupPoints2->TextLabel1->setText(tr("GEOM_SELECTED_SHAPE"));
GroupPoints2->TextLabel1->setText(tr("GEOM_SELECTED_SHAPES"));
GroupPoints2->PushButton1->setIcon(image0);
GroupPoints2->LineEdit1->setReadOnly(true);
@ -191,7 +191,7 @@ void RepairGUI_GlueDlg::Init()
/* init variables */
myEditCurrentArgument = GroupPoints->LineEdit1;
myObject = GEOM::GEOM_Object::_nil();
myObjects.clear();
//myGeomGUI->SetState(0);
//globalSelection(GEOM_COMPOUND);
@ -330,17 +330,13 @@ void RepairGUI_GlueDlg::SelectionIntoArgument()
erasePreview();
myEditCurrentArgument->setText("");
myObject = GEOM::GEOM_Object::_nil();
myObjects.clear();
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
SALOME_ListIO aSelList;
aSelMgr->selectedObjects(aSelList);
myObjects = getSelected( TopAbs_SHAPE, -1 );
if (aSelList.Extent() == 1) {
Handle(SALOME_InteractiveObject) anIO = aSelList.First();
myObject = GEOMBase::ConvertIOinGEOMObject(anIO);
if (!CORBA::is_nil(myObject))
myEditCurrentArgument->setText(GEOMBase::GetName(myObject));
if ( !myObjects.isEmpty() ) {
QString aName = myObjects.count() > 1 ? QString( "%1_objects").arg( myObjects.count() ) : GEOMBase::GetName( myObjects[0].get() );
myEditCurrentArgument->setText( aName );
}
updateButtonState();
}
@ -432,7 +428,7 @@ bool RepairGUI_GlueDlg::isValid(QString& msg)
ok = myTolEdt2->isValid(msg, !IsPreview());
break;
}
return !myObject->_is_nil() && (IsPreview() || v > 0.) && ok;
return !myObjects.isEmpty() && (IsPreview() || v > 0.) && ok;
}
//=================================================================================
@ -444,15 +440,20 @@ bool RepairGUI_GlueDlg::execute(ObjectList& objects)
bool aResult = false;
objects.clear();
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_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow(getOperation());
switch (getConstructorId()) {
case 0:
{
GEOM::GEOM_Object_var anObj;
if (myGlueMode == TopAbs_FACE)
anObj = anOper->MakeGlueFaces(myObject, myTolEdt->value(), true);
anObj = anOper->MakeGlueFaces( objList, myTolEdt->value(), true);
else if (myGlueMode == TopAbs_EDGE)
anObj = anOper->MakeGlueEdges(myObject, myTolEdt->value());
anObj = anOper->MakeGlueEdges( objList, myTolEdt->value());
aResult = !anObj->_is_nil();
if (aResult && !IsPreview())
@ -506,11 +507,11 @@ bool RepairGUI_GlueDlg::execute(ObjectList& objects)
GEOM::GEOM_Object_var anObj;
if (myGlueMode == TopAbs_FACE) {
bool doGlueAllEdges = myGlueAllEdgesChk->isChecked();
anObj = anOper->MakeGlueFacesByList(myObject, myTolEdt2->value(), aListForGlue.in(),
anObj = anOper->MakeGlueFacesByList( objList, myTolEdt2->value(), aListForGlue.in(),
true, doGlueAllEdges);
}
else if (myGlueMode == TopAbs_EDGE)
anObj = anOper->MakeGlueEdgesByList(myObject, myTolEdt2->value(), aListForGlue.in());
anObj = anOper->MakeGlueEdgesByList( objList, myTolEdt2->value(), aListForGlue.in());
aResult = !anObj->_is_nil();
@ -693,12 +694,17 @@ void RepairGUI_GlueDlg::onDetect()
buttonApply()->setEnabled(false);
globalSelection(GEOM_ALLSHAPES);
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_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow(getOperation());
GEOM::ListOfGO_var aList;
if (myGlueMode == TopAbs_FACE)
aList = anOper->GetGlueFaces(myObject.in(), myTolEdt2->value());
aList = anOper->GetGlueFaces( objList, myTolEdt2->value());
else if (myGlueMode == TopAbs_EDGE)
aList = anOper->GetGlueEdges(myObject.in(), myTolEdt2->value());
aList = anOper->GetGlueEdges( objList, myTolEdt2->value());
for (int i = 0, n = aList->length(); i < n; i++)
myTmpObjs << GEOM::GeomObjPtr(aList[i].in());
@ -719,7 +725,10 @@ void RepairGUI_GlueDlg::onDetect()
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument())) ;
SUIT_MessageBox::information(this, tr("GEOM_FREE_BOUNDS_TLT"), msg, tr("Close"));
if ( myGlueMode == TopAbs_FACE )
SUIT_MessageBox::information(this, tr("GEOM_GLUE_FACES_DETECT_TITLE"), msg, tr("Close"));
else
SUIT_MessageBox::information(this, tr("GEOM_GLUE_EDGES_DETECT_TITLE"), msg, tr("Close"));
updateButtonState();
activateSelection();
}
@ -739,7 +748,7 @@ void RepairGUI_GlueDlg::activateSelection()
this, SLOT(SelectionIntoArgument()));
globalSelection(GEOM_ALLSHAPES);
if (myObject->_is_nil())
if ( myObjects.isEmpty() )
SelectionIntoArgument();
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
@ -768,7 +777,7 @@ void RepairGUI_GlueDlg::activateSelection()
void RepairGUI_GlueDlg::updateButtonState()
{
int anId = getConstructorId();
bool hasMainObj = !myObject->_is_nil();
bool hasMainObj = !myObjects.isEmpty();
if (anId == 0) {
buttonOk()->setEnabled(hasMainObj);
buttonApply()->setEnabled(hasMainObj);

View File

@ -73,7 +73,7 @@ private:
void selectTmpInViewer();
private:
GEOM::GEOM_Object_var myObject;
QList<GEOM::GeomObjPtr> myObjects;
QList<GEOM::GeomObjPtr> myTmpObjs;
DlgRef_1SelExt* GroupPoints;

View File

@ -70,7 +70,7 @@ RepairGUI_SewingDlg::RepairGUI_SewingDlg( GeometryGUI* theGeometryGUI, QWidget*
GroupPoints = new DlgRef_1SelExt( centralWidget() );
GroupPoints->GroupBox1->setTitle( tr( "GEOM_SEWING" ) );
GroupPoints->TextLabel1->setText( tr( "GEOM_SELECTED_SHAPE" ) );
GroupPoints->TextLabel1->setText( tr( "GEOM_SELECTED_SHAPES" ) );
GroupPoints->PushButton1->setIcon( image1 );
GroupPoints->LineEdit1->setReadOnly( true );