mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-03-26 07:07:55 +05:00
Fix bug 15646: Problem with GlueFaces operation.
This commit is contained in:
parent
42680ede3c
commit
0783907bc9
@ -985,9 +985,10 @@ module GEOM
|
||||
* Replace coincident faces in theShape by one face.
|
||||
* \param theShape Initial shape.
|
||||
* \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.
|
||||
*/
|
||||
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.
|
||||
@ -1003,10 +1004,11 @@ module GEOM
|
||||
* \param theShape Initial shape.
|
||||
* \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.
|
||||
* \return New GEOM_Object, containing a copy of theShape without some faces.
|
||||
*/
|
||||
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.
|
||||
|
@ -313,12 +313,14 @@ module GEOM
|
||||
GEOM_Object MakeSolidShells (in GEOM_List theShells) ;
|
||||
GEOM_Object MakeCompound (in GEOM_List theShapes) ;
|
||||
GEOM_Object MakeGlueFaces (in GEOM_Object theShape,
|
||||
in double theTolerance);
|
||||
in double theTolerance,
|
||||
in boolean doKeepNonSolids);
|
||||
GEOM_List GetGlueFaces (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);
|
||||
GEOM_List MakeExplode (in GEOM_Object theShape,
|
||||
in long theShapeType,
|
||||
in boolean isSorted) ;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -102,6 +102,7 @@ GEOMAlgo_Gluer::GEOMAlgo_Gluer()
|
||||
myTolerance=0.0001;
|
||||
myTol=myTolerance;
|
||||
myCheckGeometry=Standard_True;
|
||||
myKeepNonSolids=Standard_False;
|
||||
myNbAlone=0;
|
||||
}
|
||||
//=======================================================================
|
||||
@ -128,6 +129,14 @@ Standard_Boolean GEOMAlgo_Gluer::CheckGeometry() const
|
||||
return myCheckGeometry;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetKeepNonSolids
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Gluer::SetKeepNonSolids(const Standard_Boolean aFlag)
|
||||
{
|
||||
myKeepNonSolids=aFlag;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : AloneShapes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
@ -356,39 +365,45 @@ void GEOMAlgo_Gluer::MakeVertices()
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : MakeSolids
|
||||
//function : MakeSubShapes
|
||||
//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;
|
||||
//
|
||||
aBB.MakeCompound(aCmp);
|
||||
theMS.Add(theShape);
|
||||
//
|
||||
aNbS=aMS.Extent();
|
||||
aExpS.Init(myShape, TopAbs_SOLID);
|
||||
for (; aExpS.More(); aExpS.Next()) {
|
||||
const TopoDS_Solid& aSolid=TopoDS::Solid(aExpS.Current());
|
||||
if (aMS.Contains(aSolid)) {
|
||||
continue;
|
||||
if (theShape.ShapeType() == TopAbs_COMPOUND ||
|
||||
theShape.ShapeType() == TopAbs_COMPSOLID)
|
||||
{
|
||||
TopoDS_Iterator It (theShape, Standard_True, Standard_True);
|
||||
for (; It.More(); It.Next())
|
||||
{
|
||||
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);
|
||||
aNewSolid.Orientation(anOr);
|
||||
//
|
||||
aExp.Init(aSolid, TopAbs_SHELL);
|
||||
for (; aExp.More(); aExp.Next()) {
|
||||
for (; aExp.More(); aExp.Next())
|
||||
{
|
||||
const TopoDS_Shape& aShell=aExp.Current();
|
||||
const TopoDS_Shape& aShellR=myOrigins.Find(aShell);
|
||||
aBB.Add(aNewSolid, aShellR);
|
||||
@ -400,14 +415,39 @@ void GEOMAlgo_Gluer::MakeSolids()
|
||||
myImages.Bind(aNewSolid, aLS);
|
||||
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;
|
||||
//
|
||||
aNbS=aMS.Extent();
|
||||
if (aNbS) {
|
||||
Standard_Real aTol=1.e-7;
|
||||
if (aMS.Extent()) {
|
||||
BOP_CorrectTolerances::CorrectCurveOnSurface(myResult);
|
||||
}
|
||||
}
|
||||
|
@ -38,12 +38,18 @@
|
||||
#ifndef _TopTools_ListOfShape_HeaderFile
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#endif
|
||||
#ifndef _TopTools_MapOfShape_HeaderFile
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
#endif
|
||||
#ifndef _GEOMAlgo_ShapeAlgo_HeaderFile
|
||||
#include <GEOMAlgo_ShapeAlgo.hxx>
|
||||
#endif
|
||||
#ifndef _TopAbs_ShapeEnum_HeaderFile
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
#endif
|
||||
#ifndef _TopoDS_Compound_HeaderFile
|
||||
#include <TopoDS_Compound.hxx>
|
||||
#endif
|
||||
class TopTools_ListOfShape;
|
||||
class TopoDS_Shape;
|
||||
class TopoDS_Edge;
|
||||
@ -92,6 +98,9 @@ Standard_EXPORT void SetCheckGeometry(const Standard_Boolean aFlag) ;
|
||||
Standard_EXPORT Standard_Boolean CheckGeometry() const;
|
||||
|
||||
|
||||
Standard_EXPORT void SetKeepNonSolids(const Standard_Boolean aFlag) ;
|
||||
|
||||
|
||||
Standard_EXPORT virtual void Perform() ;
|
||||
|
||||
|
||||
@ -143,6 +152,11 @@ Standard_EXPORT void MakeShapes(const TopAbs_ShapeEnum aType) ;
|
||||
Standard_EXPORT void MakeShells() ;
|
||||
|
||||
|
||||
Standard_EXPORT void MakeSubShapes(const TopoDS_Shape& theShape,
|
||||
TopTools_MapOfShape& theMS,
|
||||
TopoDS_Compound& theResult);
|
||||
|
||||
|
||||
Standard_EXPORT void MakeSolids() ;
|
||||
|
||||
|
||||
@ -173,6 +187,7 @@ Standard_EXPORT Standard_Boolean HasNewSubShape(const TopoDS_Shape& aS) const;
|
||||
// Fields PROTECTED
|
||||
//
|
||||
Standard_Boolean myCheckGeometry;
|
||||
Standard_Boolean myKeepNonSolids;
|
||||
Standard_Real myTol;
|
||||
TopTools_DataMapOfShapeListOfShape myImages;
|
||||
TopTools_DataMapOfShapeShape myOrigins;
|
||||
|
@ -73,6 +73,7 @@ const Standard_GUID& GEOMImpl_GlueDriver::GetID()
|
||||
//=======================================================================
|
||||
TopoDS_Shape GEOMImpl_GlueDriver::GlueFacesWithWarnings (const TopoDS_Shape& theShape,
|
||||
const Standard_Real theTolerance,
|
||||
const Standard_Boolean doKeepNonSolids,
|
||||
TCollection_AsciiString& theWarning) const
|
||||
{
|
||||
Standard_Integer iErr, iWrn;
|
||||
@ -82,6 +83,7 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueFacesWithWarnings (const TopoDS_Shape& the
|
||||
aGluer.SetShape(theShape);
|
||||
aGluer.SetTolerance(theTolerance);
|
||||
aGluer.SetCheckGeometry(Standard_True);
|
||||
aGluer.SetKeepNonSolids(doKeepNonSolids);
|
||||
|
||||
aGluer.Perform();
|
||||
|
||||
@ -197,7 +199,8 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueFacesWithWarnings (const TopoDS_Shape& the
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
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;
|
||||
TopoDS_Shape aRes;
|
||||
@ -206,6 +209,7 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueFaces (const TopoDS_Shape& theShape,
|
||||
aGluer.SetShape(theShape);
|
||||
aGluer.SetTolerance(theTolerance);
|
||||
aGluer.SetCheckGeometry(Standard_True);
|
||||
aGluer.SetKeepNonSolids(doKeepNonSolids);
|
||||
|
||||
aGluer.Perform();
|
||||
|
||||
@ -261,6 +265,7 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueFaces (const TopoDS_Shape& theShape,
|
||||
//=======================================================================
|
||||
TopoDS_Shape GEOMImpl_GlueDriver::GlueFacesByList (const TopoDS_Shape& theShape,
|
||||
const Standard_Real theTolerance,
|
||||
const Standard_Boolean doKeepNonSolids,
|
||||
const TopTools_MapOfShape& aFaces)
|
||||
{
|
||||
TopoDS_Shape aRes;
|
||||
@ -272,6 +277,7 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueFacesByList (const TopoDS_Shape& theShape,
|
||||
|
||||
aGluer.SetShape(theShape);
|
||||
aGluer.SetTolerance(theTolerance);
|
||||
aGluer.SetKeepNonSolids(doKeepNonSolids);
|
||||
aGluer.Perform();
|
||||
Standard_Integer iErr = aGluer.ErrorStatus();
|
||||
if (iErr) return aRes;
|
||||
@ -327,8 +333,10 @@ Standard_Integer GEOMImpl_GlueDriver::Execute(TFunction_Logbook& log) const
|
||||
|
||||
Standard_Real tol3d = aCI.GetTolerance();
|
||||
|
||||
Standard_Boolean aKeepNonSolids = aCI.GetKeepNonSolids();
|
||||
|
||||
if (aType == GLUE_FACES) {
|
||||
aShape = GlueFacesWithWarnings(aShapeBase, tol3d, aWrn);
|
||||
aShape = GlueFacesWithWarnings(aShapeBase, tol3d, aKeepNonSolids, aWrn);
|
||||
}
|
||||
else { // aType == GLUE_FACES_BY_LIST
|
||||
Handle(TColStd_HSequenceOfTransient) SF = aCI.GetFaces();
|
||||
@ -347,7 +355,7 @@ Standard_Integer GEOMImpl_GlueDriver::Execute(TFunction_Logbook& log) const
|
||||
if(!aFaces.Contains(aFace))
|
||||
aFaces.Add(aFace);
|
||||
}
|
||||
aShape = GlueFacesByList(aShapeBase, tol3d, aFaces);
|
||||
aShape = GlueFacesByList(aShapeBase, tol3d, aKeepNonSolids, aFaces);
|
||||
}
|
||||
|
||||
if (aShape.IsNull()) return 0;
|
||||
|
@ -150,14 +150,17 @@ Standard_EXPORT static const Standard_GUID& GetID();
|
||||
Standard_EXPORT ~GEOMImpl_GlueDriver() {};
|
||||
|
||||
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,
|
||||
const Standard_Real theTolerance,
|
||||
const Standard_Boolean doKeepNonSolids,
|
||||
TCollection_AsciiString& theWarning) const;
|
||||
|
||||
Standard_EXPORT static TopoDS_Shape GlueFacesByList (const TopoDS_Shape& theShape,
|
||||
const Standard_Real theTolerance,
|
||||
const Standard_Boolean doKeepNonSolids,
|
||||
const TopTools_MapOfShape& aFaces);
|
||||
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
#define GLUE_ARG_BASE 1
|
||||
#define GLUE_ARG_TOLER 2
|
||||
#define GLUE_ARG_FACES 3
|
||||
#define GLUE_ARG_KEEPALL 4
|
||||
|
||||
class GEOMImpl_IGlue
|
||||
{
|
||||
@ -50,6 +51,9 @@ class GEOMImpl_IGlue
|
||||
Handle(TColStd_HSequenceOfTransient) GetFaces()
|
||||
{ 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:
|
||||
|
||||
Handle(GEOM_Function) _func;
|
||||
|
@ -497,7 +497,8 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeShape
|
||||
//=============================================================================
|
||||
Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFaces
|
||||
(Handle(GEOM_Object) theShape,
|
||||
const Standard_Real theTolerance)
|
||||
const Standard_Real theTolerance,
|
||||
const Standard_Boolean doKeepNonSolids)
|
||||
{
|
||||
SetErrorCode(KO);
|
||||
|
||||
@ -521,6 +522,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFaces
|
||||
|
||||
aCI.SetBase(aRefShape);
|
||||
aCI.SetTolerance(theTolerance);
|
||||
aCI.SetKeepNonSolids(doKeepNonSolids);
|
||||
|
||||
//Compute the sub-shape value
|
||||
Standard_Boolean isWarning = Standard_False;
|
||||
@ -636,7 +638,8 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetGlueFaces
|
||||
Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFacesByList
|
||||
(Handle(GEOM_Object) theShape,
|
||||
const Standard_Real theTolerance,
|
||||
list<Handle(GEOM_Object)> theFaces)
|
||||
list<Handle(GEOM_Object)> theFaces,
|
||||
const Standard_Boolean doKeepNonSolids)
|
||||
{
|
||||
SetErrorCode(KO);
|
||||
|
||||
@ -660,6 +663,8 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFacesByList
|
||||
|
||||
aCI.SetBase(aRefShape);
|
||||
aCI.SetTolerance(theTolerance);
|
||||
aCI.SetKeepNonSolids(doKeepNonSolids);
|
||||
|
||||
Handle(TColStd_HSequenceOfTransient) aFaces = new TColStd_HSequenceOfTransient;
|
||||
list<Handle(GEOM_Object)>::iterator it = theFaces.begin();
|
||||
for (; it != theFaces.end(); it++) {
|
||||
|
@ -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) 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,
|
||||
const Standard_Real theTolerance);
|
||||
|
||||
Standard_EXPORT Handle(GEOM_Object) MakeGlueFacesByList (Handle(GEOM_Object) theShape,
|
||||
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,
|
||||
const Standard_Integer theShapeType,
|
||||
const Standard_Boolean isSorted);
|
||||
const Standard_Integer theShapeType,
|
||||
const Standard_Boolean isSorted);
|
||||
|
||||
Standard_EXPORT Handle(TColStd_HSequenceOfInteger) SubShapeAllIDs (Handle(GEOM_Object) theShape,
|
||||
const Standard_Integer theShapeType,
|
||||
const Standard_Boolean isSorted);
|
||||
const Standard_Integer theShapeType,
|
||||
const Standard_Boolean isSorted);
|
||||
|
||||
Standard_EXPORT Handle(GEOM_Object) GetSubShape (Handle(GEOM_Object) theMainShape,
|
||||
const Standard_Integer theID);
|
||||
|
@ -328,7 +328,8 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeCompound
|
||||
//=============================================================================
|
||||
GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFaces
|
||||
(GEOM::GEOM_Object_ptr theShape,
|
||||
const CORBA::Double theTolerance)
|
||||
const CORBA::Double theTolerance,
|
||||
const CORBA::Boolean doKeepNonSolids)
|
||||
{
|
||||
GEOM::GEOM_Object_var aGEOMObject;
|
||||
|
||||
@ -345,7 +346,7 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFaces
|
||||
|
||||
//Perform the gluing
|
||||
Handle(GEOM_Object) anObject =
|
||||
GetOperations()->MakeGlueFaces(aShape, theTolerance);
|
||||
GetOperations()->MakeGlueFaces(aShape, theTolerance, doKeepNonSolids);
|
||||
//if (!GetOperations()->IsDone() || anObject.IsNull())
|
||||
// to allow warning
|
||||
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 theShape,
|
||||
const CORBA::Double theTolerance,
|
||||
const GEOM::ListOfGO& theFaces)
|
||||
const GEOM::ListOfGO& theFaces,
|
||||
const CORBA::Boolean doKeepNonSolids)
|
||||
{
|
||||
GEOM::GEOM_Object_var aGEOMObject;
|
||||
|
||||
@ -430,7 +432,7 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFacesByList
|
||||
|
||||
//Perform the gluing
|
||||
Handle(GEOM_Object) anObject =
|
||||
GetOperations()->MakeGlueFacesByList(aShape, theTolerance, aFaces);
|
||||
GetOperations()->MakeGlueFacesByList(aShape, theTolerance, aFaces, doKeepNonSolids);
|
||||
//if (!GetOperations()->IsDone() || anObject.IsNull())
|
||||
// to allow warning
|
||||
if (anObject.IsNull())
|
||||
|
@ -60,14 +60,16 @@ class GEOM_IShapesOperations_i :
|
||||
GEOM::GEOM_Object_ptr MakeCompound (const GEOM::ListOfGO& theShapes);
|
||||
|
||||
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,
|
||||
CORBA::Double theTolerance);
|
||||
|
||||
GEOM::GEOM_Object_ptr MakeGlueFacesByList (GEOM::GEOM_Object_ptr theShape,
|
||||
CORBA::Double theTolerance,
|
||||
const GEOM::ListOfGO& theFaces);
|
||||
const GEOM::ListOfGO& theFaces,
|
||||
const CORBA::Boolean doKeepNonSolids);
|
||||
|
||||
GEOM::ListOfGO* MakeExplode (GEOM::GEOM_Object_ptr theShape,
|
||||
CORBA::Long theShapeType,
|
||||
|
@ -1681,12 +1681,14 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCompound (GEOM::GEOM_List_ptr theShapes
|
||||
// MakeGlueFaces:
|
||||
//=============================================================================
|
||||
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" );
|
||||
MESSAGE("GEOM_Superv_i::MakeGlueFaces");
|
||||
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" );
|
||||
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,
|
||||
CORBA::Double theTolerance,
|
||||
const GEOM::ListOfGO& theFaces)
|
||||
const GEOM::ListOfGO& theFaces,
|
||||
CORBA::Boolean doKeepNonSolids)
|
||||
{
|
||||
beginService( " GEOM_Superv_i::MakeGlueFacesByList" );
|
||||
MESSAGE("GEOM_Superv_i::MakeGlueFacesByList");
|
||||
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" );
|
||||
return anObj;
|
||||
}
|
||||
|
@ -379,12 +379,14 @@ public:
|
||||
GEOM::GEOM_Object_ptr MakeSolidShells (GEOM::GEOM_List_ptr theShells);
|
||||
GEOM::GEOM_Object_ptr MakeCompound (GEOM::GEOM_List_ptr theShapes);
|
||||
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,
|
||||
CORBA::Double theTolerance);
|
||||
GEOM::GEOM_Object_ptr MakeGlueFacesByList (GEOM::GEOM_Object_ptr theShape,
|
||||
CORBA::Double theTolerance,
|
||||
const GEOM::ListOfGO& theFaces);
|
||||
const GEOM::ListOfGO& theFaces,
|
||||
CORBA::Boolean doKeepNonSolids);
|
||||
GEOM::GEOM_List_ptr MakeExplode (GEOM::GEOM_Object_ptr theShape,
|
||||
CORBA::Long theShapeType,
|
||||
CORBA::Boolean isSorted);
|
||||
|
@ -1385,8 +1385,8 @@ def MakeFilling(theShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter):
|
||||
# @return New GEOM_Object, containing a copy of theShape without coincident faces.
|
||||
#
|
||||
# Example: see GEOM_Spanner.py
|
||||
def MakeGlueFaces(theShape, theTolerance):
|
||||
anObj = ShapesOp.MakeGlueFaces(theShape, theTolerance)
|
||||
def MakeGlueFaces(theShape, theTolerance, doKeepNonSolids=True):
|
||||
anObj = ShapesOp.MakeGlueFaces(theShape, theTolerance, doKeepNonSolids)
|
||||
if ShapesOp.IsDone() == 0:
|
||||
print "MakeGlueFaces : ", ShapesOp.GetErrorCode()
|
||||
return anObj
|
||||
@ -1416,8 +1416,8 @@ def GetGlueFaces(theShape, theTolerance):
|
||||
# without some faces.
|
||||
#
|
||||
# Example: see GEOM_Spanner.py
|
||||
def MakeGlueFacesByList(theShape, theTolerance, theFaces):
|
||||
anObj = ShapesOp.MakeGlueFacesByList(theShape, theTolerance, theFaces)
|
||||
def MakeGlueFacesByList(theShape, theTolerance, theFaces, doKeepNonSolids=True):
|
||||
anObj = ShapesOp.MakeGlueFacesByList(theShape, theTolerance, theFaces, doKeepNonSolids)
|
||||
if ShapesOp.IsDone() == 0:
|
||||
print "MakeGlueFacesByList : ", ShapesOp.GetErrorCode()
|
||||
return anObj
|
||||
|
@ -411,67 +411,69 @@ bool RepairGUI_GlueDlg::execute( ObjectList& objects )
|
||||
bool aResult = false;
|
||||
objects.clear();
|
||||
|
||||
switch ( getConstructorId() )
|
||||
switch ( getConstructorId() )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
case 0 :
|
||||
{
|
||||
GEOM::GEOM_Object_var anObj = GEOM::GEOM_IShapesOperations::_narrow
|
||||
( getOperation() )->MakeGlueFaces( myObject, myTolEdt2->value() );
|
||||
aResult = !anObj->_is_nil();
|
||||
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();
|
||||
|
||||
GEOM::GEOM_Object_var anObj = GEOM::GEOM_IShapesOperations::_narrow
|
||||
( getOperation() )->MakeGlueFaces( myObject, myTolEdt2->value(), true );
|
||||
aResult = !anObj->_is_nil();
|
||||
if ( aResult )
|
||||
objects.push_back( anObj._retn() );
|
||||
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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user