From 0783907bc901353dc1aedfb3d8cdad9d7945888e Mon Sep 17 00:00:00 2001 From: jfa Date: Tue, 10 Jul 2007 08:43:38 +0000 Subject: [PATCH] Fix bug 15646: Problem with GlueFaces operation. --- idl/GEOM_Gen.idl | 6 +- idl/GEOM_Superv.idl | 6 +- resources/GEOMCatalog.xml.in | 821 ++++++++++++++------ src/GEOMAlgo/GEOMAlgo_Gluer.cxx | 86 +- src/GEOMAlgo/GEOMAlgo_Gluer.hxx | 15 + src/GEOMImpl/GEOMImpl_GlueDriver.cxx | 14 +- src/GEOMImpl/GEOMImpl_GlueDriver.hxx | 5 +- src/GEOMImpl/GEOMImpl_IGlue.hxx | 4 + src/GEOMImpl/GEOMImpl_IShapesOperations.cxx | 9 +- src/GEOMImpl/GEOMImpl_IShapesOperations.hxx | 14 +- src/GEOM_I/GEOM_IShapesOperations_i.cc | 10 +- src/GEOM_I/GEOM_IShapesOperations_i.hh | 6 +- src/GEOM_I_Superv/GEOM_Superv_i.cc | 12 +- src/GEOM_I_Superv/GEOM_Superv_i.hh | 6 +- src/GEOM_SWIG/geompy.py | 8 +- src/RepairGUI/RepairGUI_GlueDlg.cxx | 116 +-- 16 files changed, 767 insertions(+), 371 deletions(-) diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index d9c4d61dc..bed796e59 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -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. diff --git a/idl/GEOM_Superv.idl b/idl/GEOM_Superv.idl index 5ba10377c..4ad14db98 100644 --- a/idl/GEOM_Superv.idl +++ b/idl/GEOM_Superv.idl @@ -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) ; diff --git a/resources/GEOMCatalog.xml.in b/resources/GEOMCatalog.xml.in index 4b05e9c22..2a3f4aa09 100644 --- a/resources/GEOMCatalog.xml.in +++ b/resources/GEOMCatalog.xml.in @@ -517,6 +517,44 @@ + + GetDumpName + + + unknown + 0 + + + theStudyEntry + string + unknown + + + + + return + string + unknown + + + + + + GetAllDumpNames + + + unknown + 0 + + + + return + string_array + unknown + + + + hostname = localhost @@ -526,11 +564,11 @@ GEOM_Superv GEOM_Superv OTHER - mkr + @VERSION@ Supervision wrapper for Geometry component 1 - 1 + 1 @@ -539,8 +577,8 @@ SetStudyID - mkr - 2.1.0 + + unknown 0 @@ -555,8 +593,8 @@ CreateListOfGO - mkr - 2.1.0 + + unknown 0 @@ -571,8 +609,8 @@ AddItemToListOfGO - mkr - 2.1.0 + + unknown 0 @@ -598,8 +636,8 @@ CreateListOfLong - mkr - 2.1.0 + + unknown 0 @@ -614,8 +652,8 @@ AddItemToListOfLong - mkr - 2.1.0 + + unknown 0 @@ -641,8 +679,8 @@ CreateListOfDouble - mkr - 2.1.0 + + unknown 0 @@ -657,8 +695,8 @@ AddItemToListOfDouble - mkr - 2.1.0 + + unknown 0 @@ -684,8 +722,8 @@ MakePointXYZ - mkr - 2.1.0 + + unknown 0 @@ -716,8 +754,8 @@ MakePointWithReference - mkr - 2.1.0 + + unknown 0 @@ -753,8 +791,35 @@ MakePointOnCurve - mkr - 2.1.0 + + + unknown + 0 + + + theRefCurve + GEOM_Object + unknown + + + theParameter + double + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeTangentOnCurve + + unknown 0 @@ -780,8 +845,8 @@ MakeVectorDXDYDZ - mkr - 2.1.0 + + unknown 0 @@ -812,8 +877,8 @@ MakeVectorTwoPnt - mkr - 2.1.0 + + unknown 0 @@ -839,8 +904,8 @@ MakeLineTwoPnt - mkr - 2.1.0 + + unknown 0 @@ -866,8 +931,8 @@ MakePlaneThreePnt - mkr - 2.1.0 + + unknown 0 @@ -903,8 +968,8 @@ MakePlanePntVec - mkr - 2.1.0 + + unknown 0 @@ -935,8 +1000,8 @@ MakePlaneFace - mkr - 2.1.0 + + unknown 0 @@ -962,8 +1027,8 @@ MakeMarker - mkr - 2.1.0 + + unknown 0 @@ -1022,10 +1087,47 @@ + + MakeTangentPlaneOnFace + + + unknown + 0 + + + theFace + GEOM_Object + unknown + + + theParameterU + double + unknown + + + theParameterV + double + unknown + + + theTrimSize + double + unknown + + + + + return + GEOM_Object + unknown + + + + MakeBox - mkr - 2.1.0 + + unknown 0 @@ -1071,8 +1173,8 @@ MakeBoxDXDYDZ - mkr - 2.1.0 + + unknown 0 @@ -1103,8 +1205,8 @@ MakeBoxTwoPnt - mkr - 2.1.0 + + unknown 0 @@ -1130,8 +1232,8 @@ MakeCylinderPntVecRH - mkr - 2.1.0 + + unknown 0 @@ -1167,8 +1269,8 @@ MakeCylinderRH - mkr - 2.1.0 + + unknown 0 @@ -1194,8 +1296,8 @@ MakeSphere - mkr - 2.1.0 + + unknown 0 @@ -1231,8 +1333,8 @@ MakeSphereR - mkr - 2.1.0 + + unknown 0 @@ -1253,8 +1355,8 @@ MakeSpherePntR - mkr - 2.1.0 + + unknown 0 @@ -1280,8 +1382,8 @@ MakeTorusPntVecRR - mkr - 2.1.0 + + unknown 0 @@ -1317,8 +1419,8 @@ MakeTorusRR - mkr - 2.1.0 + + unknown 0 @@ -1344,8 +1446,8 @@ MakeConePntVecR1R2H - mkr - 2.1.0 + + unknown 0 @@ -1386,8 +1488,8 @@ MakeConeR1R2H - mkr - 2.1.0 + + unknown 0 @@ -1418,8 +1520,8 @@ MakePrismVecH - mkr - 2.1.0 + + unknown 0 @@ -1450,8 +1552,8 @@ MakePrismTwoPnt - mkr - 2.1.0 + + unknown 0 @@ -1482,8 +1584,8 @@ MakePipe - mkr - 2.1.0 + + unknown 0 @@ -1509,8 +1611,8 @@ MakeRevolutionAxisAngle - mkr - 2.1.0 + + unknown 0 @@ -1541,8 +1643,8 @@ MakeFilling - mkr - 2.1.0 + + unknown 0 @@ -1586,10 +1688,136 @@ + + MakeThruSections + + + unknown + 0 + + + theSeqSections + ListOfGO + unknown + + + theModeSolid + boolean + unknown + + + thePreci + double + unknown + + + theRuled + boolean + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakePipeWithDifferentSections + + + unknown + 0 + + + theSeqBases + ListOfGO + unknown + + + theLocations + ListOfGO + unknown + + + thePath + GEOM_Object + unknown + + + theWithContact + boolean + unknown + + + theWithCorrection + boolean + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakePipeWithShellSections + + + unknown + 0 + + + theSeqBases + ListOfGO + unknown + + + theSeqSubBases + ListOfGO + unknown + + + theLocations + ListOfGO + unknown + + + thePath + GEOM_Object + unknown + + + theWithContact + boolean + unknown + + + theWithCorrection + boolean + unknown + + + + + return + GEOM_Object + unknown + + + + MakeBoolean - mkr - 2.1.0 + + unknown 0 @@ -1620,8 +1848,8 @@ MakeFuse - mkr - 2.1.0 + + unknown 0 @@ -1647,8 +1875,8 @@ MakePartition - mkr - 2.1.0 + + unknown 0 @@ -1687,6 +1915,11 @@ GEOM_List unknown + + theKeepNonlimitShapes + short + unknown + @@ -1699,8 +1932,8 @@ MakeHalfPartition - mkr - 2.1.0 + + unknown 0 @@ -1726,8 +1959,8 @@ MakeCopy - mkr - 2.1.0 + + unknown 0 @@ -1748,8 +1981,8 @@ Export - mkr - 2.1.0 + + unknown 0 @@ -1774,8 +2007,8 @@ Import - mkr - 2.1.0 + + unknown 0 @@ -1801,8 +2034,8 @@ ImportTranslators - mkr - 2.1.0 + + unknown 0 @@ -1822,8 +2055,8 @@ ExportTranslators - mkr - 2.1.0 + + unknown 0 @@ -1843,8 +2076,8 @@ TranslateTwoPoints - mkr - 2.1.0 + + unknown 0 @@ -1875,8 +2108,8 @@ TranslateTwoPointsCopy - mkr - 2.1.0 + + unknown 0 @@ -1907,8 +2140,8 @@ TranslateDXDYDZ - mkr - 2.1.0 + + unknown 0 @@ -1944,8 +2177,8 @@ TranslateDXDYDZCopy - mkr - 2.1.0 + + unknown 0 @@ -1981,8 +2214,8 @@ TranslateVector - mkr - 2.1.0 + + unknown 0 @@ -2008,8 +2241,8 @@ TranslateVectorCopy - mkr - 2.1.0 + + unknown 0 @@ -2035,8 +2268,8 @@ MultiTranslate1D - mkr - 2.1.0 + + unknown 0 @@ -2072,8 +2305,8 @@ MultiTranslate2D - mkr - 2.1.0 + + unknown 0 @@ -2124,8 +2357,8 @@ Rotate - mkr - 2.1.0 + + unknown 0 @@ -2156,8 +2389,8 @@ RotateCopy - mkr - 2.1.0 + + unknown 0 @@ -2188,8 +2421,8 @@ RotateThreePoints - mkr - 2.1.0 + + unknown 0 @@ -2225,8 +2458,8 @@ RotateThreePointsCopy - mkr - 2.1.0 + + unknown 0 @@ -2262,8 +2495,8 @@ MultiRotate1D - mkr - 2.1.0 + + unknown 0 @@ -2294,8 +2527,8 @@ MultiRotate2D - mkr - 2.1.0 + + unknown 0 @@ -2341,8 +2574,8 @@ MirrorPlane - mkr - 2.1.0 + + unknown 0 @@ -2368,8 +2601,8 @@ MirrorPlaneCopy - mkr - 2.1.0 + + unknown 0 @@ -2395,8 +2628,8 @@ MirrorAxis - mkr - 2.1.0 + + unknown 0 @@ -2422,8 +2655,8 @@ MirrorAxisCopy - mkr - 2.1.0 + + unknown 0 @@ -2449,8 +2682,8 @@ MirrorPoint - mkr - 2.1.0 + + unknown 0 @@ -2476,8 +2709,8 @@ MirrorPointCopy - mkr - 2.1.0 + + unknown 0 @@ -2503,8 +2736,8 @@ OffsetShape - mkr - 2.1.0 + + unknown 0 @@ -2530,8 +2763,8 @@ OffsetShapeCopy - mkr - 2.1.0 + + unknown 0 @@ -2557,8 +2790,8 @@ ScaleShape - mkr - 2.1.0 + + unknown 0 @@ -2589,8 +2822,8 @@ ScaleShapeCopy - mkr - 2.1.0 + + unknown 0 @@ -2621,8 +2854,8 @@ PositionShape - mkr - 2.1.0 + + unknown 0 @@ -2653,8 +2886,8 @@ PositionShapeCopy - mkr - 2.1.0 + + unknown 0 @@ -2685,8 +2918,8 @@ MakeEdge - mkr - 2.1.0 + + unknown 0 @@ -2712,8 +2945,8 @@ MakeWire - mkr - 2.1.0 + + unknown 0 @@ -2734,8 +2967,8 @@ MakeFace - mkr - 2.1.0 + + unknown 0 @@ -2761,8 +2994,8 @@ MakeFaceWires - mkr - 2.1.0 + + unknown 0 @@ -2788,8 +3021,8 @@ MakeShell - mkr - 2.1.0 + + unknown 0 @@ -2810,8 +3043,8 @@ MakeSolidShell - mkr - 2.1.0 + + unknown 0 @@ -2832,8 +3065,8 @@ MakeSolidShells - mkr - 2.1.0 + + unknown 0 @@ -2854,8 +3087,8 @@ MakeCompound - mkr - 2.1.0 + + unknown 0 @@ -2876,8 +3109,40 @@ MakeGlueFaces - mkr - 2.1.0 + + + unknown + 0 + + + theShape + GEOM_Object + unknown + + + theTolerance + double + unknown + + + doKeepNonSolids + boolean + unknown + + + + + return + GEOM_Object + unknown + + + + + + GetGlueFaces + + unknown 0 @@ -2892,6 +3157,43 @@ unknown + + + return + GEOM_List + unknown + + + + + + MakeGlueFacesByList + + + unknown + 0 + + + theShape + GEOM_Object + unknown + + + theTolerance + double + unknown + + + theFaces + ListOfGO + unknown + + + doKeepNonSolids + boolean + unknown + + return @@ -2903,8 +3205,8 @@ MakeExplode - mkr - 2.1.0 + + unknown 0 @@ -2935,8 +3237,8 @@ NumberOfFaces - mkr - 2.1.0 + + unknown 0 @@ -2957,8 +3259,8 @@ NumberOfEdges - mkr - 2.1.0 + + unknown 0 @@ -2979,8 +3281,8 @@ ChangeOrientation - mkr - 2.1.0 + + unknown 0 @@ -3001,8 +3303,8 @@ MakeQuad4Vertices - mkr - 2.1.0 + + unknown 0 @@ -3038,8 +3340,8 @@ MakeQuad - mkr - 2.1.0 + + unknown 0 @@ -3075,8 +3377,8 @@ MakeQuad2Edges - mkr - 2.1.0 + + unknown 0 @@ -3102,8 +3404,8 @@ MakeHexa - mkr - 2.1.0 + + unknown 0 @@ -3149,8 +3451,8 @@ MakeHexa2Faces - mkr - 2.1.0 + + unknown 0 @@ -3176,8 +3478,8 @@ GetPoint - mkr - 2.1.0 + + unknown 0 @@ -3218,8 +3520,8 @@ GetEdge - mkr - 2.1.0 + + unknown 0 @@ -3250,8 +3552,8 @@ GetEdgeNearPoint - mkr - 2.1.0 + + unknown 0 @@ -3277,8 +3579,8 @@ GetFaceByPoints - mkr - 2.1.0 + + unknown 0 @@ -3319,8 +3621,8 @@ GetFaceByEdges - mkr - 2.1.0 + + unknown 0 @@ -3351,8 +3653,8 @@ GetOppositeFace - mkr - 2.1.0 + + unknown 0 @@ -3378,8 +3680,8 @@ GetFaceNearPoint - mkr - 2.1.0 + + unknown 0 @@ -3405,8 +3707,8 @@ GetFaceByNormale - mkr - 2.1.0 + + unknown 0 @@ -3432,8 +3734,8 @@ IsCompoundOfBlocks - mkr - 2.1.0 + + unknown 0 @@ -3456,7 +3758,7 @@ return - long + boolean unknown @@ -3469,8 +3771,8 @@ CheckCompoundOfBlocks - mkr - 2.1.0 + + unknown 0 @@ -3483,7 +3785,7 @@ return - long + boolean unknown @@ -3496,8 +3798,8 @@ PrintBCErrors - mkr - 2.1.0 + + unknown 0 @@ -3523,8 +3825,8 @@ ExplodeCompoundOfBlocks - mkr - 2.1.0 + + unknown 0 @@ -3555,8 +3857,8 @@ GetBlockNearPoint - mkr - 2.1.0 + + unknown 0 @@ -3582,8 +3884,8 @@ GetBlockByParts - mkr - 2.1.0 + + unknown 0 @@ -3609,8 +3911,8 @@ GetBlocksByParts - mkr - 2.1.0 + + unknown 0 @@ -3636,8 +3938,8 @@ MakeMultiTransformation1D - mkr - 2.1.0 + + unknown 0 @@ -3673,8 +3975,8 @@ MakeMultiTransformation2D - mkr - 2.1.0 + + unknown 0 @@ -3725,8 +4027,8 @@ MakeCirclePntVecR - mkr - 2.1.0 + + unknown 0 @@ -3757,8 +4059,8 @@ MakeCircleThreePnt - mkr - 2.1.0 + + unknown 0 @@ -3789,8 +4091,8 @@ MakeEllipse - mkr - 2.1.0 + + unknown 0 @@ -3826,8 +4128,8 @@ MakeArc - mkr - 2.1.0 + + unknown 0 @@ -3858,8 +4160,8 @@ MakeArcCenter - ngr - 3.2.6 + + unknown 0 @@ -3892,10 +4194,11 @@ - + + MakePolyline - mkr - 2.1.0 + + unknown 0 @@ -3916,8 +4219,8 @@ MakeSplineBezier - mkr - 2.1.0 + + unknown 0 @@ -3938,8 +4241,8 @@ MakeSplineInterpolation - mkr - 2.1.0 + + unknown 0 @@ -3960,8 +4263,8 @@ MakeSketcher - mkr - 2.1.0 + + unknown 0 @@ -3987,8 +4290,8 @@ MakeFilletAll - mkr - 2.1.0 + + unknown 0 @@ -4014,8 +4317,8 @@ MakeFilletEdges - mkr - 2.1.0 + + unknown 0 @@ -4046,8 +4349,8 @@ MakeFilletFaces - mkr - 2.1.0 + + unknown 0 @@ -4078,8 +4381,8 @@ MakeChamferAll - mkr - 2.1.0 + + unknown 0 @@ -4105,8 +4408,8 @@ MakeChamferEdge - mkr - 2.1.0 + + unknown 0 @@ -4147,8 +4450,8 @@ MakeChamferFaces - mkr - 2.1.0 + + unknown 0 @@ -4184,8 +4487,8 @@ MakeArchimede - mkr - 2.1.0 + + unknown 0 @@ -4221,8 +4524,8 @@ GetSubShapeIndex - mkr - 2.1.0 + + unknown 0 @@ -4248,8 +4551,8 @@ CreateGroup - mkr - 2.1.0 + + unknown 0 @@ -4275,8 +4578,8 @@ AddObject - mkr - 2.1.0 + + unknown 0 @@ -4296,8 +4599,8 @@ RemoveObject - mkr - 2.1.0 + + unknown 0 @@ -4317,8 +4620,8 @@ GetType - mkr - 2.1.0 + + unknown 0 @@ -4339,8 +4642,8 @@ GetMainShape - mkr - 2.1.0 + + unknown 0 @@ -4361,8 +4664,8 @@ GetObjects - mkr - 2.1.0 + + unknown 0 diff --git a/src/GEOMAlgo/GEOMAlgo_Gluer.cxx b/src/GEOMAlgo/GEOMAlgo_Gluer.cxx index 9c27ede44..0d1b7707c 100755 --- a/src/GEOMAlgo/GEOMAlgo_Gluer.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Gluer.cxx @@ -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); } } diff --git a/src/GEOMAlgo/GEOMAlgo_Gluer.hxx b/src/GEOMAlgo/GEOMAlgo_Gluer.hxx index 0f8a871ab..5ca326149 100644 --- a/src/GEOMAlgo/GEOMAlgo_Gluer.hxx +++ b/src/GEOMAlgo/GEOMAlgo_Gluer.hxx @@ -38,12 +38,18 @@ #ifndef _TopTools_ListOfShape_HeaderFile #include #endif +#ifndef _TopTools_MapOfShape_HeaderFile +#include +#endif #ifndef _GEOMAlgo_ShapeAlgo_HeaderFile #include #endif #ifndef _TopAbs_ShapeEnum_HeaderFile #include #endif +#ifndef _TopoDS_Compound_HeaderFile +#include +#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; diff --git a/src/GEOMImpl/GEOMImpl_GlueDriver.cxx b/src/GEOMImpl/GEOMImpl_GlueDriver.cxx index e056bf7d8..ec18620ff 100644 --- a/src/GEOMImpl/GEOMImpl_GlueDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_GlueDriver.cxx @@ -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; diff --git a/src/GEOMImpl/GEOMImpl_GlueDriver.hxx b/src/GEOMImpl/GEOMImpl_GlueDriver.hxx index eee00b868..e7c3befa8 100644 --- a/src/GEOMImpl/GEOMImpl_GlueDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_GlueDriver.hxx @@ -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); diff --git a/src/GEOMImpl/GEOMImpl_IGlue.hxx b/src/GEOMImpl/GEOMImpl_IGlue.hxx index 7670ed70a..e6e269221 100644 --- a/src/GEOMImpl/GEOMImpl_IGlue.hxx +++ b/src/GEOMImpl/GEOMImpl_IGlue.hxx @@ -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; diff --git a/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx b/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx index e8a351f61..957c1840a 100644 --- a/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx @@ -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 theFaces) + list 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::iterator it = theFaces.begin(); for (; it != theFaces.end(); it++) { diff --git a/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx b/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx index 228aa8862..b34567755 100644 --- a/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx @@ -61,22 +61,24 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations Standard_EXPORT Handle(GEOM_Object) MakeCompound (list 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 theFaces); + list 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); diff --git a/src/GEOM_I/GEOM_IShapesOperations_i.cc b/src/GEOM_I/GEOM_IShapesOperations_i.cc index b3edf98db..7e022a0c3 100644 --- a/src/GEOM_I/GEOM_IShapesOperations_i.cc +++ b/src/GEOM_I/GEOM_IShapesOperations_i.cc @@ -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()) diff --git a/src/GEOM_I/GEOM_IShapesOperations_i.hh b/src/GEOM_I/GEOM_IShapesOperations_i.hh index 98e4e4e3e..036603b7f 100644 --- a/src/GEOM_I/GEOM_IShapesOperations_i.hh +++ b/src/GEOM_I/GEOM_IShapesOperations_i.hh @@ -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, diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.cc b/src/GEOM_I_Superv/GEOM_Superv_i.cc index f2c741940..fa0a64a0e 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.cc +++ b/src/GEOM_I_Superv/GEOM_Superv_i.cc @@ -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; } diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.hh b/src/GEOM_I_Superv/GEOM_Superv_i.hh index db4bd41d6..84773c8c4 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.hh +++ b/src/GEOM_I_Superv/GEOM_Superv_i.hh @@ -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); diff --git a/src/GEOM_SWIG/geompy.py b/src/GEOM_SWIG/geompy.py index d752a1ee3..7527c88e8 100644 --- a/src/GEOM_SWIG/geompy.py +++ b/src/GEOM_SWIG/geompy.py @@ -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 diff --git a/src/RepairGUI/RepairGUI_GlueDlg.cxx b/src/RepairGUI/RepairGUI_GlueDlg.cxx index c01a6a00b..c81a200dd 100644 --- a/src/RepairGUI/RepairGUI_GlueDlg.cxx +++ b/src/RepairGUI/RepairGUI_GlueDlg.cxx @@ -411,67 +411,69 @@ bool RepairGUI_GlueDlg::execute( ObjectList& objects ) bool aResult = false; objects.clear(); - switch ( getConstructorId() ) + switch ( getConstructorId() ) + { + case 0: + { + 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 1: { - case 0 : + if ( IsPreview() ) { - 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 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; + // 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) - { - 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(); - + 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 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 + } // case 1 + } // switch return aResult; } -- 2.39.2