Fix bug 15646: Problem with GlueFaces operation.

This commit is contained in:
jfa 2007-07-10 08:43:38 +00:00
parent 42680ede3c
commit 0783907bc9
16 changed files with 769 additions and 373 deletions

View File

@ -985,9 +985,10 @@ module GEOM
* Replace coincident faces in theShape by one face. * Replace coincident faces in theShape by one face.
* \param theShape Initial shape. * \param theShape Initial shape.
* \param theTolerance Maximum distance between faces, which can be considered as coincident. * \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 a copy of theShape without coincident faces.
*/ */
GEOM_Object MakeGlueFaces (in GEOM_Object theShape, in double theTolerance); GEOM_Object MakeGlueFaces (in GEOM_Object theShape, in double theTolerance, in boolean doKeepNonSolids);
/*! /*!
* Find coincident faces in theShape for possible gluing. * Find coincident faces in theShape for possible gluing.
@ -1003,10 +1004,11 @@ module GEOM
* \param theShape Initial shape. * \param theShape Initial shape.
* \param theTolerance Maximum distance between faces, which can be considered as coincident. * \param theTolerance Maximum distance between faces, which can be considered as coincident.
* \param theFaces List of faces for gluing. * \param theFaces List of faces for gluing.
* \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 some faces. * \return New GEOM_Object, containing a copy of theShape without some faces.
*/ */
GEOM_Object MakeGlueFacesByList (in GEOM_Object theShape, in double theTolerance, GEOM_Object MakeGlueFacesByList (in GEOM_Object theShape, in double theTolerance,
in ListOfGO theFaces); in ListOfGO theFaces, in boolean doKeepNonSolids);
/*! /*!
* Explode a shape on subshapes of a given type. * Explode a shape on subshapes of a given type.

View File

@ -313,12 +313,14 @@ module GEOM
GEOM_Object MakeSolidShells (in GEOM_List theShells) ; GEOM_Object MakeSolidShells (in GEOM_List theShells) ;
GEOM_Object MakeCompound (in GEOM_List theShapes) ; GEOM_Object MakeCompound (in GEOM_List theShapes) ;
GEOM_Object MakeGlueFaces (in GEOM_Object theShape, GEOM_Object MakeGlueFaces (in GEOM_Object theShape,
in double theTolerance); in double theTolerance,
in boolean doKeepNonSolids);
GEOM_List GetGlueFaces (in GEOM_Object theShape, GEOM_List GetGlueFaces (in GEOM_Object theShape,
in double theTolerance); in double theTolerance);
GEOM_Object MakeGlueFacesByList (in GEOM_Object theShape, GEOM_Object MakeGlueFacesByList (in GEOM_Object theShape,
in double theTolerance, in double theTolerance,
in ListOfGO theFaces); in ListOfGO theFaces,
in boolean doKeepNonSolids);
GEOM_List MakeExplode (in GEOM_Object theShape, GEOM_List MakeExplode (in GEOM_Object theShape,
in long theShapeType, in long theShapeType,
in boolean isSorted) ; in boolean isSorted) ;

File diff suppressed because it is too large Load Diff

View File

@ -102,6 +102,7 @@ GEOMAlgo_Gluer::GEOMAlgo_Gluer()
myTolerance=0.0001; myTolerance=0.0001;
myTol=myTolerance; myTol=myTolerance;
myCheckGeometry=Standard_True; myCheckGeometry=Standard_True;
myKeepNonSolids=Standard_False;
myNbAlone=0; myNbAlone=0;
} }
//======================================================================= //=======================================================================
@ -128,6 +129,14 @@ Standard_Boolean GEOMAlgo_Gluer::CheckGeometry() const
return myCheckGeometry; return myCheckGeometry;
} }
//======================================================================= //=======================================================================
//function : SetKeepNonSolids
//purpose :
//=======================================================================
void GEOMAlgo_Gluer::SetKeepNonSolids(const Standard_Boolean aFlag)
{
myKeepNonSolids=aFlag;
}
//=======================================================================
//function : AloneShapes //function : AloneShapes
//purpose : //purpose :
//======================================================================= //=======================================================================
@ -356,39 +365,45 @@ void GEOMAlgo_Gluer::MakeVertices()
} }
} }
//======================================================================= //=======================================================================
//function : MakeSolids //function : MakeSubShapes
//purpose : //purpose :
//======================================================================= //=======================================================================
void GEOMAlgo_Gluer::MakeSolids() void GEOMAlgo_Gluer::MakeSubShapes (const TopoDS_Shape& theShape,
TopTools_MapOfShape& theMS,
TopoDS_Compound& theResult)
{ {
myErrorStatus=0; if (theMS.Contains(theShape))
return;
// //
Standard_Integer aNbS;
TopAbs_Orientation anOr;
TopoDS_Compound aCmp;
TopoDS_Solid aNewSolid;
TopTools_IndexedMapOfShape aMS;
TopExp_Explorer aExpS, aExp;
BRep_Builder aBB; BRep_Builder aBB;
// //
aBB.MakeCompound(aCmp); theMS.Add(theShape);
// //
aNbS=aMS.Extent(); if (theShape.ShapeType() == TopAbs_COMPOUND ||
aExpS.Init(myShape, TopAbs_SOLID); theShape.ShapeType() == TopAbs_COMPSOLID)
for (; aExpS.More(); aExpS.Next()) { {
const TopoDS_Solid& aSolid=TopoDS::Solid(aExpS.Current()); TopoDS_Iterator It (theShape, Standard_True, Standard_True);
if (aMS.Contains(aSolid)) { for (; It.More(); It.Next())
continue; {
MakeSubShapes(It.Value(), theMS, theResult);
} }
aMS.Add(aSolid); }
else if (theShape.ShapeType() == TopAbs_SOLID)
{
// build a solid
TopoDS_Solid aNewSolid;
TopExp_Explorer aExpS, aExp;
// //
anOr=aSolid.Orientation(); const TopoDS_Solid& aSolid = TopoDS::Solid(theShape);
//
TopAbs_Orientation anOr = aSolid.Orientation();
// //
aBB.MakeSolid(aNewSolid); aBB.MakeSolid(aNewSolid);
aNewSolid.Orientation(anOr); aNewSolid.Orientation(anOr);
// //
aExp.Init(aSolid, TopAbs_SHELL); aExp.Init(aSolid, TopAbs_SHELL);
for (; aExp.More(); aExp.Next()) { for (; aExp.More(); aExp.Next())
{
const TopoDS_Shape& aShell=aExp.Current(); const TopoDS_Shape& aShell=aExp.Current();
const TopoDS_Shape& aShellR=myOrigins.Find(aShell); const TopoDS_Shape& aShellR=myOrigins.Find(aShell);
aBB.Add(aNewSolid, aShellR); aBB.Add(aNewSolid, aShellR);
@ -400,14 +415,39 @@ void GEOMAlgo_Gluer::MakeSolids()
myImages.Bind(aNewSolid, aLS); myImages.Bind(aNewSolid, aLS);
myOrigins.Bind(aSolid, aNewSolid); myOrigins.Bind(aSolid, aNewSolid);
// //
aBB.Add(aCmp, aNewSolid); aBB.Add(theResult, aNewSolid);
} }
else
{
if (myKeepNonSolids)
{
// just add image
const TopoDS_Shape& aShapeR = myOrigins.Find(theShape);
aBB.Add(theResult, aShapeR);
}
}
}
//=======================================================================
//function : MakeSolids
//purpose :
//=======================================================================
void GEOMAlgo_Gluer::MakeSolids()
{
myErrorStatus=0;
//
BRep_Builder aBB;
TopoDS_Compound aCmp;
TopTools_MapOfShape aMS;
//
aBB.MakeCompound(aCmp);
//
// Add images of all initial sub-shapes in the result.
// If myKeepNonSolids==false, add only solids images.
MakeSubShapes(myShape, aMS, aCmp);
// //
myResult=aCmp; myResult=aCmp;
// //
aNbS=aMS.Extent(); if (aMS.Extent()) {
if (aNbS) {
Standard_Real aTol=1.e-7;
BOP_CorrectTolerances::CorrectCurveOnSurface(myResult); BOP_CorrectTolerances::CorrectCurveOnSurface(myResult);
} }
} }

View File

@ -38,12 +38,18 @@
#ifndef _TopTools_ListOfShape_HeaderFile #ifndef _TopTools_ListOfShape_HeaderFile
#include <TopTools_ListOfShape.hxx> #include <TopTools_ListOfShape.hxx>
#endif #endif
#ifndef _TopTools_MapOfShape_HeaderFile
#include <TopTools_MapOfShape.hxx>
#endif
#ifndef _GEOMAlgo_ShapeAlgo_HeaderFile #ifndef _GEOMAlgo_ShapeAlgo_HeaderFile
#include <GEOMAlgo_ShapeAlgo.hxx> #include <GEOMAlgo_ShapeAlgo.hxx>
#endif #endif
#ifndef _TopAbs_ShapeEnum_HeaderFile #ifndef _TopAbs_ShapeEnum_HeaderFile
#include <TopAbs_ShapeEnum.hxx> #include <TopAbs_ShapeEnum.hxx>
#endif #endif
#ifndef _TopoDS_Compound_HeaderFile
#include <TopoDS_Compound.hxx>
#endif
class TopTools_ListOfShape; class TopTools_ListOfShape;
class TopoDS_Shape; class TopoDS_Shape;
class TopoDS_Edge; class TopoDS_Edge;
@ -92,6 +98,9 @@ Standard_EXPORT void SetCheckGeometry(const Standard_Boolean aFlag) ;
Standard_EXPORT Standard_Boolean CheckGeometry() const; Standard_EXPORT Standard_Boolean CheckGeometry() const;
Standard_EXPORT void SetKeepNonSolids(const Standard_Boolean aFlag) ;
Standard_EXPORT virtual void Perform() ; Standard_EXPORT virtual void Perform() ;
@ -143,6 +152,11 @@ Standard_EXPORT void MakeShapes(const TopAbs_ShapeEnum aType) ;
Standard_EXPORT void MakeShells() ; Standard_EXPORT void MakeShells() ;
Standard_EXPORT void MakeSubShapes(const TopoDS_Shape& theShape,
TopTools_MapOfShape& theMS,
TopoDS_Compound& theResult);
Standard_EXPORT void MakeSolids() ; Standard_EXPORT void MakeSolids() ;
@ -173,6 +187,7 @@ Standard_EXPORT Standard_Boolean HasNewSubShape(const TopoDS_Shape& aS) const;
// Fields PROTECTED // Fields PROTECTED
// //
Standard_Boolean myCheckGeometry; Standard_Boolean myCheckGeometry;
Standard_Boolean myKeepNonSolids;
Standard_Real myTol; Standard_Real myTol;
TopTools_DataMapOfShapeListOfShape myImages; TopTools_DataMapOfShapeListOfShape myImages;
TopTools_DataMapOfShapeShape myOrigins; TopTools_DataMapOfShapeShape myOrigins;

View File

@ -73,6 +73,7 @@ const Standard_GUID& GEOMImpl_GlueDriver::GetID()
//======================================================================= //=======================================================================
TopoDS_Shape GEOMImpl_GlueDriver::GlueFacesWithWarnings (const TopoDS_Shape& theShape, TopoDS_Shape GEOMImpl_GlueDriver::GlueFacesWithWarnings (const TopoDS_Shape& theShape,
const Standard_Real theTolerance, const Standard_Real theTolerance,
const Standard_Boolean doKeepNonSolids,
TCollection_AsciiString& theWarning) const TCollection_AsciiString& theWarning) const
{ {
Standard_Integer iErr, iWrn; Standard_Integer iErr, iWrn;
@ -82,6 +83,7 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueFacesWithWarnings (const TopoDS_Shape& the
aGluer.SetShape(theShape); aGluer.SetShape(theShape);
aGluer.SetTolerance(theTolerance); aGluer.SetTolerance(theTolerance);
aGluer.SetCheckGeometry(Standard_True); aGluer.SetCheckGeometry(Standard_True);
aGluer.SetKeepNonSolids(doKeepNonSolids);
aGluer.Perform(); aGluer.Perform();
@ -197,7 +199,8 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueFacesWithWarnings (const TopoDS_Shape& the
//purpose : //purpose :
//======================================================================= //=======================================================================
TopoDS_Shape GEOMImpl_GlueDriver::GlueFaces (const TopoDS_Shape& theShape, TopoDS_Shape GEOMImpl_GlueDriver::GlueFaces (const TopoDS_Shape& theShape,
const Standard_Real theTolerance) const Standard_Real theTolerance,
const Standard_Boolean doKeepNonSolids)
{ {
Standard_Integer iErr, iWrn; Standard_Integer iErr, iWrn;
TopoDS_Shape aRes; TopoDS_Shape aRes;
@ -206,6 +209,7 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueFaces (const TopoDS_Shape& theShape,
aGluer.SetShape(theShape); aGluer.SetShape(theShape);
aGluer.SetTolerance(theTolerance); aGluer.SetTolerance(theTolerance);
aGluer.SetCheckGeometry(Standard_True); aGluer.SetCheckGeometry(Standard_True);
aGluer.SetKeepNonSolids(doKeepNonSolids);
aGluer.Perform(); aGluer.Perform();
@ -261,6 +265,7 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueFaces (const TopoDS_Shape& theShape,
//======================================================================= //=======================================================================
TopoDS_Shape GEOMImpl_GlueDriver::GlueFacesByList (const TopoDS_Shape& theShape, TopoDS_Shape GEOMImpl_GlueDriver::GlueFacesByList (const TopoDS_Shape& theShape,
const Standard_Real theTolerance, const Standard_Real theTolerance,
const Standard_Boolean doKeepNonSolids,
const TopTools_MapOfShape& aFaces) const TopTools_MapOfShape& aFaces)
{ {
TopoDS_Shape aRes; TopoDS_Shape aRes;
@ -272,6 +277,7 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueFacesByList (const TopoDS_Shape& theShape,
aGluer.SetShape(theShape); aGluer.SetShape(theShape);
aGluer.SetTolerance(theTolerance); aGluer.SetTolerance(theTolerance);
aGluer.SetKeepNonSolids(doKeepNonSolids);
aGluer.Perform(); aGluer.Perform();
Standard_Integer iErr = aGluer.ErrorStatus(); Standard_Integer iErr = aGluer.ErrorStatus();
if (iErr) return aRes; if (iErr) return aRes;
@ -327,8 +333,10 @@ Standard_Integer GEOMImpl_GlueDriver::Execute(TFunction_Logbook& log) const
Standard_Real tol3d = aCI.GetTolerance(); Standard_Real tol3d = aCI.GetTolerance();
Standard_Boolean aKeepNonSolids = aCI.GetKeepNonSolids();
if (aType == GLUE_FACES) { if (aType == GLUE_FACES) {
aShape = GlueFacesWithWarnings(aShapeBase, tol3d, aWrn); aShape = GlueFacesWithWarnings(aShapeBase, tol3d, aKeepNonSolids, aWrn);
} }
else { // aType == GLUE_FACES_BY_LIST else { // aType == GLUE_FACES_BY_LIST
Handle(TColStd_HSequenceOfTransient) SF = aCI.GetFaces(); Handle(TColStd_HSequenceOfTransient) SF = aCI.GetFaces();
@ -347,7 +355,7 @@ Standard_Integer GEOMImpl_GlueDriver::Execute(TFunction_Logbook& log) const
if(!aFaces.Contains(aFace)) if(!aFaces.Contains(aFace))
aFaces.Add(aFace); aFaces.Add(aFace);
} }
aShape = GlueFacesByList(aShapeBase, tol3d, aFaces); aShape = GlueFacesByList(aShapeBase, tol3d, aKeepNonSolids, aFaces);
} }
if (aShape.IsNull()) return 0; if (aShape.IsNull()) return 0;

View File

@ -150,14 +150,17 @@ Standard_EXPORT static const Standard_GUID& GetID();
Standard_EXPORT ~GEOMImpl_GlueDriver() {}; Standard_EXPORT ~GEOMImpl_GlueDriver() {};
Standard_EXPORT static TopoDS_Shape GlueFaces (const TopoDS_Shape& theShape, Standard_EXPORT static TopoDS_Shape GlueFaces (const TopoDS_Shape& theShape,
const Standard_Real theTolerance); const Standard_Real theTolerance,
const Standard_Boolean doKeepNonSolids = Standard_True);
Standard_EXPORT TopoDS_Shape GlueFacesWithWarnings (const TopoDS_Shape& theShape, Standard_EXPORT TopoDS_Shape GlueFacesWithWarnings (const TopoDS_Shape& theShape,
const Standard_Real theTolerance, const Standard_Real theTolerance,
const Standard_Boolean doKeepNonSolids,
TCollection_AsciiString& theWarning) const; TCollection_AsciiString& theWarning) const;
Standard_EXPORT static TopoDS_Shape GlueFacesByList (const TopoDS_Shape& theShape, Standard_EXPORT static TopoDS_Shape GlueFacesByList (const TopoDS_Shape& theShape,
const Standard_Real theTolerance, const Standard_Real theTolerance,
const Standard_Boolean doKeepNonSolids,
const TopTools_MapOfShape& aFaces); const TopTools_MapOfShape& aFaces);

View File

@ -27,6 +27,7 @@
#define GLUE_ARG_BASE 1 #define GLUE_ARG_BASE 1
#define GLUE_ARG_TOLER 2 #define GLUE_ARG_TOLER 2
#define GLUE_ARG_FACES 3 #define GLUE_ARG_FACES 3
#define GLUE_ARG_KEEPALL 4
class GEOMImpl_IGlue class GEOMImpl_IGlue
{ {
@ -50,6 +51,9 @@ class GEOMImpl_IGlue
Handle(TColStd_HSequenceOfTransient) GetFaces() Handle(TColStd_HSequenceOfTransient) GetFaces()
{ return _func->GetReferenceList(GLUE_ARG_FACES); } { return _func->GetReferenceList(GLUE_ARG_FACES); }
void SetKeepNonSolids (Standard_Boolean theFlag) { _func->SetInteger(GLUE_ARG_KEEPALL, theFlag ? 1 : 0); }
Standard_Boolean GetKeepNonSolids() { return (_func->GetInteger(GLUE_ARG_KEEPALL) != 0); }
private: private:
Handle(GEOM_Function) _func; Handle(GEOM_Function) _func;

View File

@ -497,7 +497,8 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeShape
//============================================================================= //=============================================================================
Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFaces Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFaces
(Handle(GEOM_Object) theShape, (Handle(GEOM_Object) theShape,
const Standard_Real theTolerance) const Standard_Real theTolerance,
const Standard_Boolean doKeepNonSolids)
{ {
SetErrorCode(KO); SetErrorCode(KO);
@ -521,6 +522,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFaces
aCI.SetBase(aRefShape); aCI.SetBase(aRefShape);
aCI.SetTolerance(theTolerance); aCI.SetTolerance(theTolerance);
aCI.SetKeepNonSolids(doKeepNonSolids);
//Compute the sub-shape value //Compute the sub-shape value
Standard_Boolean isWarning = Standard_False; Standard_Boolean isWarning = Standard_False;
@ -636,7 +638,8 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetGlueFaces
Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFacesByList Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFacesByList
(Handle(GEOM_Object) theShape, (Handle(GEOM_Object) theShape,
const Standard_Real theTolerance, const Standard_Real theTolerance,
list<Handle(GEOM_Object)> theFaces) list<Handle(GEOM_Object)> theFaces,
const Standard_Boolean doKeepNonSolids)
{ {
SetErrorCode(KO); SetErrorCode(KO);
@ -660,6 +663,8 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFacesByList
aCI.SetBase(aRefShape); aCI.SetBase(aRefShape);
aCI.SetTolerance(theTolerance); aCI.SetTolerance(theTolerance);
aCI.SetKeepNonSolids(doKeepNonSolids);
Handle(TColStd_HSequenceOfTransient) aFaces = new TColStd_HSequenceOfTransient; Handle(TColStd_HSequenceOfTransient) aFaces = new TColStd_HSequenceOfTransient;
list<Handle(GEOM_Object)>::iterator it = theFaces.begin(); list<Handle(GEOM_Object)>::iterator it = theFaces.begin();
for (; it != theFaces.end(); it++) { for (; it != theFaces.end(); it++) {

View File

@ -61,22 +61,24 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations
Standard_EXPORT Handle(GEOM_Object) MakeCompound (list<Handle(GEOM_Object)> theShapes); Standard_EXPORT Handle(GEOM_Object) MakeCompound (list<Handle(GEOM_Object)> theShapes);
Standard_EXPORT Handle(GEOM_Object) MakeGlueFaces (Handle(GEOM_Object) theShape, Standard_EXPORT Handle(GEOM_Object) MakeGlueFaces (Handle(GEOM_Object) theShape,
const Standard_Real theTolerance); const Standard_Real theTolerance,
const Standard_Boolean doKeepNonSolids);
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetGlueFaces (Handle(GEOM_Object) theShape, Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetGlueFaces (Handle(GEOM_Object) theShape,
const Standard_Real theTolerance); const Standard_Real theTolerance);
Standard_EXPORT Handle(GEOM_Object) MakeGlueFacesByList (Handle(GEOM_Object) theShape, Standard_EXPORT Handle(GEOM_Object) MakeGlueFacesByList (Handle(GEOM_Object) theShape,
const Standard_Real theTolerance, const Standard_Real theTolerance,
list<Handle(GEOM_Object)> theFaces); list<Handle(GEOM_Object)> theFaces,
const Standard_Boolean doKeepNonSolids);
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) MakeExplode (Handle(GEOM_Object) theShape, Standard_EXPORT Handle(TColStd_HSequenceOfTransient) MakeExplode (Handle(GEOM_Object) theShape,
const Standard_Integer theShapeType, const Standard_Integer theShapeType,
const Standard_Boolean isSorted); const Standard_Boolean isSorted);
Standard_EXPORT Handle(TColStd_HSequenceOfInteger) SubShapeAllIDs (Handle(GEOM_Object) theShape, Standard_EXPORT Handle(TColStd_HSequenceOfInteger) SubShapeAllIDs (Handle(GEOM_Object) theShape,
const Standard_Integer theShapeType, const Standard_Integer theShapeType,
const Standard_Boolean isSorted); const Standard_Boolean isSorted);
Standard_EXPORT Handle(GEOM_Object) GetSubShape (Handle(GEOM_Object) theMainShape, Standard_EXPORT Handle(GEOM_Object) GetSubShape (Handle(GEOM_Object) theMainShape,
const Standard_Integer theID); const Standard_Integer theID);

View File

@ -328,7 +328,8 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeCompound
//============================================================================= //=============================================================================
GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFaces GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFaces
(GEOM::GEOM_Object_ptr theShape, (GEOM::GEOM_Object_ptr theShape,
const CORBA::Double theTolerance) const CORBA::Double theTolerance,
const CORBA::Boolean doKeepNonSolids)
{ {
GEOM::GEOM_Object_var aGEOMObject; GEOM::GEOM_Object_var aGEOMObject;
@ -345,7 +346,7 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFaces
//Perform the gluing //Perform the gluing
Handle(GEOM_Object) anObject = Handle(GEOM_Object) anObject =
GetOperations()->MakeGlueFaces(aShape, theTolerance); GetOperations()->MakeGlueFaces(aShape, theTolerance, doKeepNonSolids);
//if (!GetOperations()->IsDone() || anObject.IsNull()) //if (!GetOperations()->IsDone() || anObject.IsNull())
// to allow warning // to allow warning
if (anObject.IsNull()) if (anObject.IsNull())
@ -401,7 +402,8 @@ GEOM::ListOfGO* GEOM_IShapesOperations_i::GetGlueFaces
GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFacesByList GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFacesByList
(GEOM::GEOM_Object_ptr theShape, (GEOM::GEOM_Object_ptr theShape,
const CORBA::Double theTolerance, const CORBA::Double theTolerance,
const GEOM::ListOfGO& theFaces) const GEOM::ListOfGO& theFaces,
const CORBA::Boolean doKeepNonSolids)
{ {
GEOM::GEOM_Object_var aGEOMObject; GEOM::GEOM_Object_var aGEOMObject;
@ -430,7 +432,7 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFacesByList
//Perform the gluing //Perform the gluing
Handle(GEOM_Object) anObject = Handle(GEOM_Object) anObject =
GetOperations()->MakeGlueFacesByList(aShape, theTolerance, aFaces); GetOperations()->MakeGlueFacesByList(aShape, theTolerance, aFaces, doKeepNonSolids);
//if (!GetOperations()->IsDone() || anObject.IsNull()) //if (!GetOperations()->IsDone() || anObject.IsNull())
// to allow warning // to allow warning
if (anObject.IsNull()) if (anObject.IsNull())

View File

@ -60,14 +60,16 @@ class GEOM_IShapesOperations_i :
GEOM::GEOM_Object_ptr MakeCompound (const GEOM::ListOfGO& theShapes); GEOM::GEOM_Object_ptr MakeCompound (const GEOM::ListOfGO& theShapes);
GEOM::GEOM_Object_ptr MakeGlueFaces (GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_Object_ptr MakeGlueFaces (GEOM::GEOM_Object_ptr theShape,
CORBA::Double theTolerance); CORBA::Double theTolerance,
const CORBA::Boolean doKeepNonSolids);
GEOM::ListOfGO* GetGlueFaces (GEOM::GEOM_Object_ptr theShape, GEOM::ListOfGO* GetGlueFaces (GEOM::GEOM_Object_ptr theShape,
CORBA::Double theTolerance); CORBA::Double theTolerance);
GEOM::GEOM_Object_ptr MakeGlueFacesByList (GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_Object_ptr MakeGlueFacesByList (GEOM::GEOM_Object_ptr theShape,
CORBA::Double theTolerance, CORBA::Double theTolerance,
const GEOM::ListOfGO& theFaces); const GEOM::ListOfGO& theFaces,
const CORBA::Boolean doKeepNonSolids);
GEOM::ListOfGO* MakeExplode (GEOM::GEOM_Object_ptr theShape, GEOM::ListOfGO* MakeExplode (GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType, CORBA::Long theShapeType,

View File

@ -1681,12 +1681,14 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCompound (GEOM::GEOM_List_ptr theShapes
// MakeGlueFaces: // MakeGlueFaces:
//============================================================================= //=============================================================================
GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeGlueFaces (GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeGlueFaces (GEOM::GEOM_Object_ptr theShape,
CORBA::Double theTolerance) CORBA::Double theTolerance,
CORBA::Boolean doKeepNonSolids)
{ {
beginService( " GEOM_Superv_i::MakeGlueFaces" ); beginService( " GEOM_Superv_i::MakeGlueFaces" );
MESSAGE("GEOM_Superv_i::MakeGlueFaces"); MESSAGE("GEOM_Superv_i::MakeGlueFaces");
getShapesOp(); getShapesOp();
GEOM::GEOM_Object_ptr anObj = myShapesOp->MakeGlueFaces(theShape, theTolerance); GEOM::GEOM_Object_ptr anObj =
myShapesOp->MakeGlueFaces(theShape, theTolerance, doKeepNonSolids);
endService( " GEOM_Superv_i::MakeGlueFaces" ); endService( " GEOM_Superv_i::MakeGlueFaces" );
return anObj; return anObj;
} }
@ -1712,12 +1714,14 @@ GEOM::GEOM_List_ptr GEOM_Superv_i::GetGlueFaces (GEOM::GEOM_Object_ptr theShape,
//============================================================================= //=============================================================================
GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeGlueFacesByList (GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeGlueFacesByList (GEOM::GEOM_Object_ptr theShape,
CORBA::Double theTolerance, CORBA::Double theTolerance,
const GEOM::ListOfGO& theFaces) const GEOM::ListOfGO& theFaces,
CORBA::Boolean doKeepNonSolids)
{ {
beginService( " GEOM_Superv_i::MakeGlueFacesByList" ); beginService( " GEOM_Superv_i::MakeGlueFacesByList" );
MESSAGE("GEOM_Superv_i::MakeGlueFacesByList"); MESSAGE("GEOM_Superv_i::MakeGlueFacesByList");
getShapesOp(); getShapesOp();
GEOM::GEOM_Object_ptr anObj = myShapesOp->MakeGlueFacesByList(theShape, theTolerance, theFaces); GEOM::GEOM_Object_ptr anObj =
myShapesOp->MakeGlueFacesByList(theShape, theTolerance, theFaces, doKeepNonSolids);
endService( " GEOM_Superv_i::MakeGlueFacesByList" ); endService( " GEOM_Superv_i::MakeGlueFacesByList" );
return anObj; return anObj;
} }

View File

@ -379,12 +379,14 @@ public:
GEOM::GEOM_Object_ptr MakeSolidShells (GEOM::GEOM_List_ptr theShells); GEOM::GEOM_Object_ptr MakeSolidShells (GEOM::GEOM_List_ptr theShells);
GEOM::GEOM_Object_ptr MakeCompound (GEOM::GEOM_List_ptr theShapes); GEOM::GEOM_Object_ptr MakeCompound (GEOM::GEOM_List_ptr theShapes);
GEOM::GEOM_Object_ptr MakeGlueFaces (GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_Object_ptr MakeGlueFaces (GEOM::GEOM_Object_ptr theShape,
CORBA::Double theTolerance); CORBA::Double theTolerance,
CORBA::Boolean doKeepNonSolids);
GEOM::GEOM_List_ptr GetGlueFaces (GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_List_ptr GetGlueFaces (GEOM::GEOM_Object_ptr theShape,
CORBA::Double theTolerance); CORBA::Double theTolerance);
GEOM::GEOM_Object_ptr MakeGlueFacesByList (GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_Object_ptr MakeGlueFacesByList (GEOM::GEOM_Object_ptr theShape,
CORBA::Double theTolerance, CORBA::Double theTolerance,
const GEOM::ListOfGO& theFaces); const GEOM::ListOfGO& theFaces,
CORBA::Boolean doKeepNonSolids);
GEOM::GEOM_List_ptr MakeExplode (GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_List_ptr MakeExplode (GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType, CORBA::Long theShapeType,
CORBA::Boolean isSorted); CORBA::Boolean isSorted);

View File

@ -1385,8 +1385,8 @@ def MakeFilling(theShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter):
# @return New GEOM_Object, containing a copy of theShape without coincident faces. # @return New GEOM_Object, containing a copy of theShape without coincident faces.
# #
# Example: see GEOM_Spanner.py # Example: see GEOM_Spanner.py
def MakeGlueFaces(theShape, theTolerance): def MakeGlueFaces(theShape, theTolerance, doKeepNonSolids=True):
anObj = ShapesOp.MakeGlueFaces(theShape, theTolerance) anObj = ShapesOp.MakeGlueFaces(theShape, theTolerance, doKeepNonSolids)
if ShapesOp.IsDone() == 0: if ShapesOp.IsDone() == 0:
print "MakeGlueFaces : ", ShapesOp.GetErrorCode() print "MakeGlueFaces : ", ShapesOp.GetErrorCode()
return anObj return anObj
@ -1416,8 +1416,8 @@ def GetGlueFaces(theShape, theTolerance):
# without some faces. # without some faces.
# #
# Example: see GEOM_Spanner.py # Example: see GEOM_Spanner.py
def MakeGlueFacesByList(theShape, theTolerance, theFaces): def MakeGlueFacesByList(theShape, theTolerance, theFaces, doKeepNonSolids=True):
anObj = ShapesOp.MakeGlueFacesByList(theShape, theTolerance, theFaces) anObj = ShapesOp.MakeGlueFacesByList(theShape, theTolerance, theFaces, doKeepNonSolids)
if ShapesOp.IsDone() == 0: if ShapesOp.IsDone() == 0:
print "MakeGlueFacesByList : ", ShapesOp.GetErrorCode() print "MakeGlueFacesByList : ", ShapesOp.GetErrorCode()
return anObj return anObj

View File

@ -411,67 +411,69 @@ bool RepairGUI_GlueDlg::execute( ObjectList& objects )
bool aResult = false; bool aResult = false;
objects.clear(); objects.clear();
switch ( getConstructorId() ) switch ( getConstructorId() )
{
case 0:
{ {
case 0 : GEOM::GEOM_Object_var anObj = GEOM::GEOM_IShapesOperations::_narrow
{ ( getOperation() )->MakeGlueFaces( myObject, myTolEdt2->value(), true );
GEOM::GEOM_Object_var anObj = GEOM::GEOM_IShapesOperations::_narrow aResult = !anObj->_is_nil();
( getOperation() )->MakeGlueFaces( myObject, myTolEdt2->value() ); if ( aResult )
aResult = !anObj->_is_nil(); objects.push_back( anObj._retn() );
if ( aResult )
objects.push_back( anObj._retn() );
break;
}
case 1 :
if ( IsPreview() )
{
// if this method is used for displaying preview then we must detect glue faces only
ObjectList::iterator anIter;
for (anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter)
objects.push_back( GEOM::GEOM_Object::_duplicate( *anIter ) );
return myTmpObjs.size() ? true : false;
} // IsPreview
// Make glue face by list.
// Iterate through myTmpObjs and verifies where each object is currently selected or not.
QMap<QString, char> selected;
// Get names of selected objects
SALOME_ListIteratorOfListIO it ( selectedIO() );
for (; it.More(); it.Next())
selected.insert( it.Value()->getName(), 0 );
// Iterate through result and select objects with names from selection
// ObjectList toRemoveFromEnggine;
ObjectList toGlue;
ObjectList::iterator anIter;
for (anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter)
{
if ( selected.contains( myGeomGUI->getApp()->orb()->object_to_string(*anIter) ) )
toGlue.push_back(*anIter);
}
// make glue faces
GEOM::ListOfGO_var aListForGlue = new GEOM::ListOfGO();
aListForGlue->length( toGlue.size() );
ObjectList::iterator anIter3 = toGlue.begin();
for ( int i = 0; anIter3 != toGlue.end(); ++anIter3, ++i )
aListForGlue[ i ] = *anIter3;
GEOM::GEOM_Object_var anObj = GEOM::GEOM_IShapesOperations::_narrow
( getOperation() )->MakeGlueFacesByList( myObject, myTolEdt2->value(), aListForGlue );
aResult = !anObj->_is_nil();
if ( aResult )
objects.push_back( anObj._retn() );
// Remove from engine useless objects
clearTemporary();
updateButtonState();
break; break;
} // case }
case 1:
{
if ( IsPreview() )
{
// if this method is used for displaying preview then we must detect glue faces only
ObjectList::iterator anIter;
for (anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter)
objects.push_back( GEOM::GEOM_Object::_duplicate( *anIter ) );
return myTmpObjs.size() ? true : false;
} // IsPreview
// Make glue face by list.
// Iterate through myTmpObjs and verifies where each object is currently selected or not.
QMap<QString, char> selected;
// Get names of selected objects
SALOME_ListIteratorOfListIO it ( selectedIO() );
for (; it.More(); it.Next())
selected.insert( it.Value()->getName(), 0 );
// Iterate through result and select objects with names from selection
// ObjectList toRemoveFromEnggine;
ObjectList toGlue;
ObjectList::iterator anIter;
for (anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter)
{
if ( selected.contains( myGeomGUI->getApp()->orb()->object_to_string(*anIter) ) )
toGlue.push_back(*anIter);
}
// make glue faces
GEOM::ListOfGO_var aListForGlue = new GEOM::ListOfGO();
aListForGlue->length( toGlue.size() );
ObjectList::iterator anIter3 = toGlue.begin();
for ( int i = 0; anIter3 != toGlue.end(); ++anIter3, ++i )
aListForGlue[ i ] = *anIter3;
GEOM::GEOM_Object_var anObj = GEOM::GEOM_IShapesOperations::_narrow
( getOperation() )->MakeGlueFacesByList( myObject, myTolEdt2->value(), aListForGlue, true );
aResult = !anObj->_is_nil();
if ( aResult )
objects.push_back( anObj._retn() );
// Remove from engine useless objects
clearTemporary();
updateButtonState();
break;
} // case 1
} // switch
return aResult; return aResult;
} }