From e44e43fed44829929519370c456ca79f1d8c3f41 Mon Sep 17 00:00:00 2001 From: Paul RASCLE Date: Thu, 14 Jan 2016 16:14:39 +0100 Subject: [PATCH 01/11] t_shape_fluid: glue faces --- src/Tools/t_shape/t_shape_builder.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Tools/t_shape/t_shape_builder.py b/src/Tools/t_shape/t_shape_builder.py index 72ab22bd2..0cff46b98 100644 --- a/src/Tools/t_shape/t_shape_builder.py +++ b/src/Tools/t_shape/t_shape_builder.py @@ -236,7 +236,8 @@ def build_shape(study, r1, r2, h1, h2, solid_thickness=0, progressBar=None ): compound = geompy.MakeCompound([final, extru3]) plane = geompy.MakePlane(O,OX,2000) compound_mirrored = geompy.MakeMirrorByPlane(compound, plane) - final = geompy.MakeCompound([compound, compound_mirrored]) + compound_total = geompy.MakeCompound([compound, compound_mirrored]) + final = geompy.MakeGlueFaces(compound_total, 1e-07) if progressBar is not None: progressBar.addSteps(1) From 845487b15668b2d333b5065cf155946be5368c31 Mon Sep 17 00:00:00 2001 From: mpa Date: Mon, 18 Jan 2016 11:00:10 +0300 Subject: [PATCH 02/11] 0023210: [CEA 1681] Regression with the function GetInPlaceByHistory --- idl/GEOM_Gen.idl | 6 ++-- src/GEOM_SWIG/geomBuilder.py | 12 ++++--- src/XAOPlugin/XAOPlugin_IOperations.cxx | 37 ++++++++++++---------- src/XAOPlugin/XAOPlugin_IOperations.hxx | 42 ++++++++++++------------- 4 files changed, 54 insertions(+), 43 deletions(-) diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index 830fcc398..1e572a79f 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -2654,7 +2654,8 @@ module GEOM * coincident with \a theShapeWhat or could be a part of it. * \param theShapeWhere Shape to find sub-shapes of. * \param theShapeWhat Shape, specifying what to find. - * \return Group of all found sub-shapes or a single found sub-shape. + * \return Compound which includes all found sub-shapes if they have different types; + * or group of all found shapes of the equal type; or a single found sub-shape. */ GEOM_Object GetInPlace (in GEOM_Object theShapeWhere, in GEOM_Object theShapeWhat); @@ -2677,7 +2678,8 @@ module GEOM * * \param theShapeWhere Shape to find sub-shapes of. * \param theShapeWhat Shape, specifying what to find. - * \return Group of all found sub-shapes or a single found sub-shape. + * \return Compound which includes all found sub-shapes if they have different types; + * or group of all found shapes of the equal type; or a single found sub-shape. */ GEOM_Object GetInPlaceByHistory (in GEOM_Object theShapeWhere, in GEOM_Object theShapeWhat); diff --git a/src/GEOM_SWIG/geomBuilder.py b/src/GEOM_SWIG/geomBuilder.py index 0f90ef502..297b3a18a 100644 --- a/src/GEOM_SWIG/geomBuilder.py +++ b/src/GEOM_SWIG/geomBuilder.py @@ -5866,7 +5866,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen): # for result publication in the study. Otherwise, if automatic # publication is switched on, default value is used for result name. # - # @return Group of all found sub-shapes or a single found sub-shape. + # @return Compound which includes all found sub-shapes if they have different types; + # or group of all found shapes of the equal type; or a single found sub-shape. # # @note This function has a restriction on argument shapes. # If \a theShapeWhere has curved parts with significantly @@ -5891,7 +5892,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen): publication is switched on, default value is used for result name. Returns: - Group of all found sub-shapes or a single found sub-shape. + Compound which includes all found sub-shapes if they have different types; + or group of all found shapes of the equal type; or a single found sub-shape. Note: @@ -5927,7 +5929,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen): # for result publication in the study. Otherwise, if automatic # publication is switched on, default value is used for result name. # - # @return Group of all found sub-shapes or a single found sub-shape. + # @return Compound which includes all found sub-shapes if they have different types; + # or group of all found shapes of the equal type; or a single found sub-shape. # # @ref swig_GetInPlace "Example" @ManageTransactions("ShapesOp") @@ -5948,7 +5951,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen): publication is switched on, default value is used for result name. Returns: - Group of all found sub-shapes or a single found sub-shape. + Compound which includes all found sub-shapes if they have different types; + or group of all found shapes of the equal type; or a single found sub-shape. """ # Example: see GEOM_TestOthers.py anObj = self.ShapesOp.GetInPlaceByHistory(theShapeWhere, theShapeWhat) diff --git a/src/XAOPlugin/XAOPlugin_IOperations.cxx b/src/XAOPlugin/XAOPlugin_IOperations.cxx index d8c886274..a6f094194 100644 --- a/src/XAOPlugin/XAOPlugin_IOperations.cxx +++ b/src/XAOPlugin/XAOPlugin_IOperations.cxx @@ -113,15 +113,19 @@ XAOPlugin_IOperations::~XAOPlugin_IOperations() MESSAGE( "XAOPlugin_IOperations::~XAOPlugin_IOperations" ); } -void XAOPlugin_IOperations::exportGroups( std::list groupList, - XAO::Xao* xaoObject, - XAO::BrepGeometry* geometry ) +bool XAOPlugin_IOperations::exportGroups( std::list groupList, + XAO::Xao* xaoObject, + XAO::BrepGeometry* geometry ) { // add the groups std::list::iterator groupIterator = groupList.begin(); while (groupIterator != groupList.end()) { Handle(GEOM_Object) currGroup = (*groupIterator++); + if (currGroup->GetType() != GEOM_GROUP) { + SetErrorCode("Error when export groups: you could perform this operation only with group."); + return false; + } Handle(TColStd_HArray1OfInteger) groupIds = myGroupOperations->GetObjects(currGroup); TopAbs_ShapeEnum shapeGroup = myGroupOperations->GetType(currGroup); @@ -164,11 +168,12 @@ void XAOPlugin_IOperations::exportGroups( std::list groupLi break; } } + return true; } void XAOPlugin_IOperations::exportFields( std::list fieldList, - XAO::Xao* xaoObject, - XAO::BrepGeometry* geometry ) + XAO::Xao* xaoObject, + XAO::BrepGeometry* geometry ) { std::list::iterator fieldIterator = fieldList.begin(); while (fieldIterator != fieldList.end()) @@ -301,10 +306,10 @@ void XAOPlugin_IOperations::exportSubshapes( const Handle(GEOM_Object)& shape, X */ //============================================================================= bool XAOPlugin_IOperations::ExportXAO( Handle(GEOM_Object) shape, - std::list groupList, - std::list fieldList, - const char* author, - const char* fileName ) + std::list groupList, + std::list fieldList, + const char* author, + const char* fileName ) { SetErrorCode(KO); @@ -337,7 +342,7 @@ bool XAOPlugin_IOperations::ExportXAO( Handle(GEOM_Object) shape, exportSubshapes(shape, geometry); xaoObject->setGeometry(geometry); - exportGroups(groupList, xaoObject, geometry); + if (!exportGroups(groupList, xaoObject, geometry)) return false; exportFields(fieldList, xaoObject, geometry); // export the XAO to the file @@ -380,8 +385,8 @@ bool XAOPlugin_IOperations::ExportXAO( Handle(GEOM_Object) shape, } void XAOPlugin_IOperations::importSubShapes( XAO::Geometry* xaoGeometry, - Handle(GEOM_Function) function, int shapeType, int dim, - Handle(TColStd_HSequenceOfTransient)& subShapeList ) + Handle(GEOM_Function) function, int shapeType, int dim, + Handle(TColStd_HSequenceOfTransient)& subShapeList ) { Handle(GEOM_Object) subShape; Handle(GEOM_Function) aFunction; @@ -433,10 +438,10 @@ void XAOPlugin_IOperations::importSubShapes( XAO::Geometry* xaoGeometry, */ //============================================================================= bool XAOPlugin_IOperations::ImportXAO( const char* fileName, - Handle(GEOM_Object)& shape, - Handle(TColStd_HSequenceOfTransient)& subShapes, - Handle(TColStd_HSequenceOfTransient)& groups, - Handle(TColStd_HSequenceOfTransient)& fields ) + Handle(GEOM_Object)& shape, + Handle(TColStd_HSequenceOfTransient)& subShapes, + Handle(TColStd_HSequenceOfTransient)& groups, + Handle(TColStd_HSequenceOfTransient)& fields ) { SetErrorCode(KO); diff --git a/src/XAOPlugin/XAOPlugin_IOperations.hxx b/src/XAOPlugin/XAOPlugin_IOperations.hxx index 869e3a1c2..2b477442a 100644 --- a/src/XAOPlugin/XAOPlugin_IOperations.hxx +++ b/src/XAOPlugin/XAOPlugin_IOperations.hxx @@ -44,31 +44,31 @@ public: ~XAOPlugin_IOperations(); bool ExportXAO( Handle(GEOM_Object) shape, - std::list groupList, - std::list fieldList, - const char* author, - const char* fileName ); + std::list groupList, + std::list fieldList, + const char* author, + const char* fileName ); bool ImportXAO( const char* fileName, - Handle(GEOM_Object)& shape, - Handle(TColStd_HSequenceOfTransient)& subShapes, - Handle(TColStd_HSequenceOfTransient)& groups, - Handle(TColStd_HSequenceOfTransient)& fields ); + Handle(GEOM_Object)& shape, + Handle(TColStd_HSequenceOfTransient)& subShapes, + Handle(TColStd_HSequenceOfTransient)& groups, + Handle(TColStd_HSequenceOfTransient)& fields ); private: - void importSubShapes( XAO::Geometry* xaoGeometry, - Handle(GEOM_Function) function, - int shapeType, - int dim, - Handle(TColStd_HSequenceOfTransient)& subshapeList ); - void exportSubshapes( const Handle(GEOM_Object)& shape, - XAO::BrepGeometry* geometry ); - void exportFields( std::list fieldList, - XAO::Xao* xaoObject, - XAO::BrepGeometry* geometry ); - void exportGroups( std::list groupList, - XAO::Xao* xaoObject, - XAO::BrepGeometry* geometry ); + void importSubShapes( XAO::Geometry* xaoGeometry, + Handle(GEOM_Function) function, + int shapeType, + int dim, + Handle(TColStd_HSequenceOfTransient)& subshapeList ); + void exportSubshapes( const Handle(GEOM_Object)& shape, + XAO::BrepGeometry* geometry ); + void exportFields( std::list fieldList, + XAO::Xao* xaoObject, + XAO::BrepGeometry* geometry ); + bool exportGroups( std::list groupList, + XAO::Xao* xaoObject, + XAO::BrepGeometry* geometry ); }; #endif From 6013ddd73d559f081bf0a60273b192282ded75cc Mon Sep 17 00:00:00 2001 From: mpa Date: Mon, 18 Jan 2016 13:49:09 +0300 Subject: [PATCH 03/11] Adding of the necessary translations --- src/GEOMGUI/GEOM_msg_en.ts | 8 ++++++++ src/GEOMGUI/GEOM_msg_fr.ts | 8 ++++++++ src/GEOMGUI/GEOM_msg_ja.ts | 8 ++++++++ 3 files changed, 24 insertions(+) diff --git a/src/GEOMGUI/GEOM_msg_en.ts b/src/GEOMGUI/GEOM_msg_en.ts index 5a094f303..7aef53a75 100644 --- a/src/GEOMGUI/GEOM_msg_en.ts +++ b/src/GEOMGUI/GEOM_msg_en.ts @@ -4960,10 +4960,18 @@ Please, select face, shell or solid and try again MEN_POP_SHOW_DEPENDENCY_TREE Show dependency tree + + STB_POP_SHOW_DEPENDENCY_TREE + Show dependency tree + MEN_POP_REDUCE_STUDY Reduce study + + STB_POP_REDUCE_STUDY + Reduce study + MEN_POP_SHOW_ALL_DIMENSIONS Show all dimensions diff --git a/src/GEOMGUI/GEOM_msg_fr.ts b/src/GEOMGUI/GEOM_msg_fr.ts index 01acd20ca..a7111b94c 100644 --- a/src/GEOMGUI/GEOM_msg_fr.ts +++ b/src/GEOMGUI/GEOM_msg_fr.ts @@ -4952,10 +4952,18 @@ Choisissez une face, une coque ou un solide et essayez de nouveau MEN_POP_SHOW_DEPENDENCY_TREE Montrer l'arbre des dépendances + + STB_POP_SHOW_DEPENDENCY_TREE + Montrer l'arbre des dépendances + MEN_POP_REDUCE_STUDY Etude réduite + + STB_POP_REDUCE_STUDY + Etude réduite + MEN_POP_SHOW_ALL_DIMENSIONS Afficher les cotations diff --git a/src/GEOMGUI/GEOM_msg_ja.ts b/src/GEOMGUI/GEOM_msg_ja.ts index 0a55e444f..0e42dfe3d 100644 --- a/src/GEOMGUI/GEOM_msg_ja.ts +++ b/src/GEOMGUI/GEOM_msg_ja.ts @@ -4955,10 +4955,18 @@ MEN_POP_SHOW_DEPENDENCY_TREE 依存ツリーの表示 + + STB_POP_SHOW_DEPENDENCY_TREE + 依存ツリーの表示 + MEN_POP_REDUCE_STUDY スタディの削減 + + STB_POP_REDUCE_STUDY + スタディの削減 + MEN_POP_SHOW_ALL_DIMENSIONS すべての寸法を表示 From c96a24b0f89de7aee5ee119e278e802ea7f9edf3 Mon Sep 17 00:00:00 2001 From: vsr Date: Mon, 25 Jan 2016 15:50:35 +0300 Subject: [PATCH 04/11] Increment version: 8.0.0 --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cd26147d5..477914642 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,12 +29,12 @@ CMAKE_POLICY(SET CMP0003 NEW) # Project name, upper case STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC) -SET(${PROJECT_NAME_UC}_MAJOR_VERSION 7) -SET(${PROJECT_NAME_UC}_MINOR_VERSION 7) +SET(${PROJECT_NAME_UC}_MAJOR_VERSION 8) +SET(${PROJECT_NAME_UC}_MINOR_VERSION 0) SET(${PROJECT_NAME_UC}_PATCH_VERSION 0) SET(${PROJECT_NAME_UC}_VERSION ${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION}) -SET(${PROJECT_NAME_UC}_VERSION_DEV 1) +SET(${PROJECT_NAME_UC}_VERSION_DEV 0) # Find KERNEL # =========== From 5a07078335c27182bbf113fbce3d69e08bd5203f Mon Sep 17 00:00:00 2001 From: rnv Date: Wed, 27 Jan 2016 19:00:36 +0300 Subject: [PATCH 05/11] PyQt4/PyQt5 support. --- src/Tools/geom_plugins.py | 2 +- src/Tools/t_shape/t_shape_dialog.py | 13 ++++++------- src/Tools/t_shape/t_shape_progress.py | 5 ++--- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/Tools/geom_plugins.py b/src/Tools/geom_plugins.py index 395961595..d9f72d4ab 100644 --- a/src/Tools/geom_plugins.py +++ b/src/Tools/geom_plugins.py @@ -26,7 +26,7 @@ def t_shape_fluid(context): from salome.geom.t_shape import t_shape_dialog from salome.geom.t_shape import t_shape_progress import xalome - from PyQt4.QtGui import QMessageBox + from qtsalome import QMessageBox activeStudy = context.study dialog = t_shape_dialog.TShapeDialog() diff --git a/src/Tools/t_shape/t_shape_dialog.py b/src/Tools/t_shape/t_shape_dialog.py index c385efd0c..7ee76c238 100644 --- a/src/Tools/t_shape/t_shape_dialog.py +++ b/src/Tools/t_shape/t_shape_dialog.py @@ -20,15 +20,14 @@ # Author : Renaud Nédélec (OpenCascade S.A.S) import sys -from PyQt4 import QtGui -from PyQt4 import QtCore +from qtsalome import * from t_shape_dialog_ui import Ui_Dialog -class TShapeDialog(QtGui.QDialog): +class TShapeDialog(QDialog): def __init__(self): - QtGui.QDialog.__init__(self, None, QtCore.Qt.Tool) + QDialog.__init__(self, None, Qt.Tool) # Set up the user interface from Designer. self.ui = Ui_Dialog() self.ui.setupUi(self) @@ -43,7 +42,7 @@ class TShapeDialog(QtGui.QDialog): def accept(self): self._wasOk = True - QtGui.QDialog.accept(self) + QDialog.accept(self) def getData(self): r1 = self.ui.dsb_bigRadius.value() @@ -58,7 +57,7 @@ class TShapeDialog(QtGui.QDialog): def reject(self): self._wasOk = False - QtGui.QDialog.reject(self) + QDialog.reject(self) def wasOk(self): return self._wasOk @@ -70,7 +69,7 @@ class TShapeDialog(QtGui.QDialog): def main( args ): import sys - app = QtGui.QApplication(sys.argv) + app = QApplication(sys.argv) Dialog = TShapeDialog() ui = Ui_Dialog() ui.setupUi(Dialog) diff --git a/src/Tools/t_shape/t_shape_progress.py b/src/Tools/t_shape/t_shape_progress.py index 38f804502..96415d1ac 100644 --- a/src/Tools/t_shape/t_shape_progress.py +++ b/src/Tools/t_shape/t_shape_progress.py @@ -20,15 +20,14 @@ # Author : Renaud Nédélec (OpenCascade S.A.S) from salome.geom.t_shape import t_shape_builder -from PyQt4.QtGui import QProgressDialog -from PyQt4 import QtCore +from qtsalome import * class t_shape_progress(QProgressDialog): _totSteps = 0 _nmaxSteps = 27 def __init__(self, parent=None): - QProgressDialog.__init__(self, "t_shape fluid build", "stop", 0, self._nmaxSteps, parent, QtCore.Qt.Tool) + QProgressDialog.__init__(self, "t_shape fluid build", "stop", 0, self._nmaxSteps, parent, Qt.Tool) self.show() def run(self, activeStudy, r1, r2, h1, h2, thickness): From a4a4fee20cf2481d300bc74fe84c5d7b2c1e5851 Mon Sep 17 00:00:00 2001 From: skv Date: Thu, 28 Jan 2016 17:08:15 +0300 Subject: [PATCH 06/11] 0052919: Build shell with two brep files creates suspected result --- src/GEOMImpl/GEOMImpl_ShapeDriver.cxx | 216 ++++++++++++++++++++------ 1 file changed, 165 insertions(+), 51 deletions(-) diff --git a/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx b/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx index 8b585f83e..5072071be 100644 --- a/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx @@ -73,6 +73,8 @@ #include #include +#include +#include #include #include @@ -161,6 +163,165 @@ namespace return result; } + + /** + * This function constructs a shell or a compound of shells from a set of faces and/or shells. + * + * @param theShapes is a set of faces and/or shells. + * @return a shell or a compound of shells. + */ + TopoDS_Shape makeShellFromFaces + (const Handle(TColStd_HSequenceOfTransient) &theShapes) + { + const Standard_Integer aNbShapes = theShapes->Length(); + Standard_Integer i; + TopTools_ListOfShape aListFaces; + TopTools_MapOfShape aMapFence; + BRep_Builder aBuilder; + + // Fill the list of unique faces + for (i = 1; i <= aNbShapes; ++i) { + // Function + const Handle(GEOM_Function) aRefShape = + Handle(GEOM_Function)::DownCast(theShapes->Value(i)); + + if (aRefShape.IsNull()) { + Standard_NullObject::Raise("Face for shell construction is null"); + } + + // Shape + const TopoDS_Shape aShape = aRefShape->GetValue(); + + if (aShape.IsNull()) { + Standard_NullObject::Raise("Face for shell construction is null"); + } + + // Shape type + const TopAbs_ShapeEnum aType = aShape.ShapeType(); + + if (aType == TopAbs_SHELL) { + // Get faces. + TopExp_Explorer anExp(aShape, TopAbs_FACE); + + for (; anExp.More(); anExp.Next()) { + const TopoDS_Shape &aFace = anExp.Current(); + + if (aMapFence.Add(aFace)) { + aListFaces.Append(aFace); + } + } + } else if (aType == TopAbs_FACE) { + // Append the face in the list + if (aMapFence.Add(aShape)) { + aListFaces.Append(aShape); + } + } else { + Standard_TypeMismatch::Raise + ("Shape for shell construction is neither a shell nor a face"); + } + } + + // Perform computation of shells. + TopTools_ListOfShape aListShells; + TopTools_ListIteratorOfListOfShape anIter; + + while (!aListFaces.IsEmpty()) { + // Perform sewing + BRepBuilderAPI_Sewing aSewing(Precision::Confusion()*10.0); + + for (anIter.Initialize(aListFaces); anIter.More(); anIter.Next()) { + aSewing.Add(anIter.Value()); + } + + aSewing.Perform(); + + // Fill list of shells. + const TopoDS_Shape &aSewed = aSewing.SewedShape(); + TopExp_Explorer anExp(aSewed, TopAbs_SHELL); + Standard_Boolean isNewShells = Standard_False; + + // Append shells + for (; anExp.More(); anExp.Next()) { + aListShells.Append(anExp.Current()); + isNewShells = Standard_True; + } + + // Append single faces. + anExp.Init(aSewed, TopAbs_FACE, TopAbs_SHELL); + + for (; anExp.More(); anExp.Next()) { + TopoDS_Shell aShell; + + aBuilder.MakeShell(aShell); + aBuilder.Add(aShell, anExp.Current()); + aListShells.Append(aShell); + isNewShells = Standard_True; + } + + if (!isNewShells) { + // There are no more shell can be obtained. Break the loop. + break; + } + + // Remove faces that are in the result from the list. + TopTools_IndexedMapOfShape aMapFaces; + + TopExp::MapShapes(aSewed, TopAbs_FACE, aMapFaces); + + // Add deleted faces to the map + const Standard_Integer aNbDelFaces = aSewing.NbDeletedFaces(); + + for (i = 1; i <= aNbDelFaces; ++i) { + aMapFaces.Add(aSewing.DeletedFace(i)); + } + + for (anIter.Initialize(aListFaces); anIter.More();) { + const TopoDS_Shape &aFace = anIter.Value(); + Standard_Boolean isFaceUsed = Standard_False; + + if (aMapFaces.Contains(aFace) || aSewing.IsModified(aFace)) { + // Remove face from the list. + aListFaces.Remove(anIter); + } else { + // Go to the next face. + anIter.Next(); + } + } + } + + // If there are faces not used in shells create a shell for each face. + for (anIter.Initialize(aListFaces); anIter.More(); anIter.Next()) { + TopoDS_Shell aShell; + + aBuilder.MakeShell(aShell); + aBuilder.Add(aShell, anIter.Value()); + aListShells.Append(aShell); + } + + // Construct the result that can be either a shell or a compound of shells + TopoDS_Shape aResult; + + if (!aListShells.IsEmpty()) { + if (aListShells.Extent() == 1) { + aResult = aListShells.First(); + } else { + // There are more then one shell. + TopoDS_Compound aCompound; + + aBuilder.MakeCompound(aCompound); + + for (anIter.Initialize(aListShells); anIter.More(); anIter.Next()) { + aBuilder.Add(aCompound, anIter.Value()); + } + + aResult = aCompound; + } + } + + return aResult; + } + + // End of namespace } //modified by NIZNHY-PKV Wed Dec 28 13:48:20 2011f @@ -432,60 +593,13 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const allowCompound = true; Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes(); - unsigned int ind, nbshapes = aShapes->Length(); - // add faces - BRepBuilderAPI_Sewing aSewing (Precision::Confusion()*10.0); - for (ind = 1; ind <= nbshapes; ind++) { - Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aShapes->Value(ind)); - TopoDS_Shape aShape_i = aRefShape->GetValue(); - if (aShape_i.IsNull()) { - Standard_NullObject::Raise("Face for shell construction is null"); - } - aSewing.Add(aShape_i); - } - - aSewing.Perform(); - - TopoDS_Shape sh = aSewing.SewedShape(); - - if (sh.ShapeType()==TopAbs_FACE && nbshapes==1) { - // case for creation of shell from one face - PAL12722 (skl 26.06.2006) - TopoDS_Shell ss; - B.MakeShell(ss); - B.Add(ss,sh); - aShape = ss; - } - else { - //TopExp_Explorer exp (aSewing.SewedShape(), TopAbs_SHELL); - TopExp_Explorer exp (sh, TopAbs_SHELL); - Standard_Integer ish = 0; - for (; exp.More(); exp.Next()) { - aShape = exp.Current(); - ish++; - } - - if (ish != 1) { - // try the case of one face (Mantis issue 0021809) - TopExp_Explorer expF (sh, TopAbs_FACE); - Standard_Integer ifa = 0; - for (; expF.More(); expF.Next()) { - aShape = expF.Current(); - ifa++; - } - - if (ifa == 1) { - TopoDS_Shell ss; - B.MakeShell(ss); - B.Add(ss,aShape); - aShape = ss; - } - else { - aShape = aSewing.SewedShape(); - } - } + if (aShapes.IsNull()) { + Standard_NullObject::Raise("Argument Shapes is null"); } + // Compute a shell or a compound of shells. + aShape = makeShellFromFaces(aShapes); } else if (aType == SOLID_SHELLS) { // result may be only a solid or a compound of solids From 78b2a5e0dad1c9a5b0085b8548adf55df319d59e Mon Sep 17 00:00:00 2001 From: skv Date: Wed, 3 Feb 2016 16:55:29 +0300 Subject: [PATCH 07/11] MakeShell: compound acceptance, update TUI documentation --- src/GEOMImpl/GEOMImpl_ShapeDriver.cxx | 78 +++++++++++++++++---------- src/GEOM_SWIG/geomBuilder.py | 4 +- 2 files changed, 51 insertions(+), 31 deletions(-) diff --git a/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx b/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx index 5072071be..46bcd193e 100644 --- a/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx @@ -165,9 +165,55 @@ namespace } /** - * This function constructs a shell or a compound of shells from a set of faces and/or shells. + * This function adds faces from the input shape into the list of faces. If + * the input shape is a face, it is added itself. If it is a shell, its + * sub-shapes (faces) are added. If it is a compound, its sub-shapes + * (faces or shells) are added in the list. For null shapes and for other + * types of shapes an exception is thrown. * - * @param theShapes is a set of faces and/or shells. + * @param theShape the shape to be added. Either face or shell or a compound + * of faces and/or shells. + * @param theListFaces the list of faces that is modified on output. + * @param theMapFence the map that protects from adding the same faces in + * the list. + */ + void addFaces(const TopoDS_Shape &theShape, + TopTools_ListOfShape &theListFaces, + TopTools_MapOfShape &theMapFence) + { + if (theShape.IsNull()) { + Standard_NullObject::Raise("Face for shell construction is null"); + } + + // Append the shape is the mapFence + if (theMapFence.Add(theShape)) { + // Shape type + const TopAbs_ShapeEnum aType = theShape.ShapeType(); + + if (aType == TopAbs_FACE) { + theListFaces.Append(theShape); + } else if (aType == TopAbs_SHELL || aType == TopAbs_COMPOUND) { + TopoDS_Iterator anIter(theShape); + + for (; anIter.More(); anIter.Next()) { + // Add sub-shapes: faces for shell or faces/shells for compound. + const TopoDS_Shape &aSubShape = anIter.Value(); + + addFaces(aSubShape, theListFaces, theMapFence); + } + } else { + Standard_TypeMismatch::Raise + ("Shape for shell construction is neither a shell nor a face"); + } + } + } + + /** + * This function constructs a shell or a compound of shells + * from a set of faces and/or shells. + * + * @param theShapes is a set of faces, shells and/or + * compounds of faces/shells. * @return a shell or a compound of shells. */ TopoDS_Shape makeShellFromFaces @@ -192,33 +238,7 @@ namespace // Shape const TopoDS_Shape aShape = aRefShape->GetValue(); - if (aShape.IsNull()) { - Standard_NullObject::Raise("Face for shell construction is null"); - } - - // Shape type - const TopAbs_ShapeEnum aType = aShape.ShapeType(); - - if (aType == TopAbs_SHELL) { - // Get faces. - TopExp_Explorer anExp(aShape, TopAbs_FACE); - - for (; anExp.More(); anExp.Next()) { - const TopoDS_Shape &aFace = anExp.Current(); - - if (aMapFence.Add(aFace)) { - aListFaces.Append(aFace); - } - } - } else if (aType == TopAbs_FACE) { - // Append the face in the list - if (aMapFence.Add(aShape)) { - aListFaces.Append(aShape); - } - } else { - Standard_TypeMismatch::Raise - ("Shape for shell construction is neither a shell nor a face"); - } + addFaces(aShape, aListFaces, aMapFence); } // Perform computation of shells. diff --git a/src/GEOM_SWIG/geomBuilder.py b/src/GEOM_SWIG/geomBuilder.py index 297b3a18a..379105b72 100644 --- a/src/GEOM_SWIG/geomBuilder.py +++ b/src/GEOM_SWIG/geomBuilder.py @@ -4834,8 +4834,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen): self._autoPublish(anObj, theName, "face") return anObj - ## Create a shell from the set of faces and shells. - # @param theFacesAndShells List of faces and/or shells. + ## Create a shell from the set of faces, shells and/or compounds of faces. + # @param theFacesAndShells List of faces, shells and/or compounds of faces. # @param theName Object name; when specified, this parameter is used # for result publication in the study. Otherwise, if automatic # publication is switched on, default value is used for result name. From e087bbd0639cc0e9ffd05416387007385187bcdd Mon Sep 17 00:00:00 2001 From: skv Date: Thu, 4 Feb 2016 16:29:39 +0300 Subject: [PATCH 08/11] 0052840: Fuse fails if "Remove extra edges" is ON --- src/GEOMImpl/GEOMImpl_PipeDriver.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/GEOMImpl/GEOMImpl_PipeDriver.cxx b/src/GEOMImpl/GEOMImpl_PipeDriver.cxx index ef5b07e79..039bf0027 100644 --- a/src/GEOMImpl/GEOMImpl_PipeDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PipeDriver.cxx @@ -180,6 +180,8 @@ static GeomFill_Trihedron EvaluateBestSweepMode(const TopoDS_Shape& Spine) //======================================================================= static Standard_Boolean BuildPipeShell(BRepOffsetAPI_MakePipeShell &theBuilder) { + theBuilder.SetForceApproxC1(Standard_True); + theBuilder.Build(); Standard_Boolean isDone = theBuilder.IsDone(); @@ -3125,7 +3127,8 @@ Standard_Integer GEOMImpl_PipeDriver::Execute (TFunction_Logbook& log) const else { GeomFill_Trihedron theBestMode = EvaluateBestSweepMode(aWirePath); - BRepOffsetAPI_MakePipe aMkPipe(aWirePath, aShapeBase, theBestMode); + BRepOffsetAPI_MakePipe aMkPipe + (aWirePath, aShapeBase, theBestMode, Standard_True); if (aMkPipe.IsDone() && aMkPipe.ErrorOnSurface() <= TolPipeSurf) { aShape = aMkPipe.Shape(); @@ -3137,7 +3140,7 @@ Standard_Integer GEOMImpl_PipeDriver::Execute (TFunction_Logbook& log) const } else if (theBestMode != GeomFill_IsDiscreteTrihedron) { // Try to use Descrete Trihedron mode. BRepOffsetAPI_MakePipe aMkPipeDescrete - (aWirePath, aShapeBase, GeomFill_IsDiscreteTrihedron); + (aWirePath, aShapeBase, GeomFill_IsDiscreteTrihedron, Standard_True); if (aMkPipeDescrete.IsDone()) { aShape = aMkPipeDescrete.Shape(); From 0e330446a29f4acbd571ffd65d0f5ed1c38f88db Mon Sep 17 00:00:00 2001 From: skv Date: Fri, 5 Feb 2016 17:03:36 +0300 Subject: [PATCH 09/11] 0053079: SALOME crashes at Python Dump --- src/GEOM/GEOM_Engine.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/GEOM/GEOM_Engine.cxx b/src/GEOM/GEOM_Engine.cxx index e7921bed4..41be7c204 100644 --- a/src/GEOM/GEOM_Engine.cxx +++ b/src/GEOM/GEOM_Engine.cxx @@ -1278,7 +1278,10 @@ void FillMapOfRef(const Handle(GEOM_Function) &theFunction, const int aRefTag = GetTag(anObjEntry); - theRefMap[anObjTag].push_back(aRefTag); + if (anObjTag != aRefTag) { + // Avoid making references for operations without copy. + theRefMap[anObjTag].push_back(aRefTag); + } } } } From 09357329ca1aeb2b7ceb4af2e8234863ae17a8dc Mon Sep 17 00:00:00 2001 From: vsr Date: Mon, 8 Feb 2016 18:48:44 +0300 Subject: [PATCH 10/11] 0023208: [CEA 1660] GetType function returns 0 with an object resulting from a transformation Update documentation on GEOM_Object::GetType() method. --- idl/GEOM_Gen.idl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index 1e572a79f..be4adbbd0 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -299,7 +299,9 @@ module GEOM long GetStudyID(); /*! - * \brief Get internal type of the object (POINT, BOX, CYLINDER, EXTRUSION...). + * \brief Get internal type of operation created this object (POINT, BOX, CYLINDER, EXTRUSION...). + * \note To get topological information on the object, use \ref GEOM_IMeasureOperations::WhatIs() "WhatIs()" + * or \ref GEOM_IMeasureOperations::KindOfShape() "KindOfShape()" operation. */ long GetType(); From fc8218a049e2f4c9da3fc89d3ed001093edb137d Mon Sep 17 00:00:00 2001 From: vsr Date: Thu, 11 Feb 2016 18:26:21 +0300 Subject: [PATCH 11/11] Updates from V7_dev branch --- src/GEOMBase/CMakeLists.txt | 2 ++ src/GEOMGUI/GEOMGUI.cxx | 2 +- src/GEOMToolsGUI/CMakeLists.txt | 2 ++ src/GEOMToolsGUI/GEOMToolsGUI_DeflectionDlg.cxx | 2 +- src/GEOMToolsGUI/GEOMToolsGUI_LineWidthDlg.cxx | 2 +- src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.cxx | 2 +- src/GEOM_SWIG_WITHIHM/CMakeLists.txt | 2 +- src/Material/CMakeLists.txt | 3 +++ src/PrimitiveGUI/CMakeLists.txt | 2 ++ 9 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/GEOMBase/CMakeLists.txt b/src/GEOMBase/CMakeLists.txt index a6b58e6a5..21cd7e8b2 100755 --- a/src/GEOMBase/CMakeLists.txt +++ b/src/GEOMBase/CMakeLists.txt @@ -17,6 +17,8 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # +INCLUDE(UseQtExt) + # --- options --- # additional include directories diff --git a/src/GEOMGUI/GEOMGUI.cxx b/src/GEOMGUI/GEOMGUI.cxx index 05dabb9fe..9425cb809 100644 --- a/src/GEOMGUI/GEOMGUI.cxx +++ b/src/GEOMGUI/GEOMGUI.cxx @@ -68,7 +68,7 @@ bool GEOMGUI::OnGUIEvent( int /*theCommandID*/, SUIT_Desktop* /*parent*/ ) //================================================================================= // class : GEOMGUI::OnMousePress -// purpose : Mouse press event processing. Should return FALSE to let the event +// purpose : Mouse press event processing. Should return false to let the event // be processed further. //================================================================================= bool GEOMGUI::OnMousePress( QMouseEvent* /*pe*/, SUIT_Desktop* /*parent*/, SUIT_ViewWindow* /*studyFrame*/ ) diff --git a/src/GEOMToolsGUI/CMakeLists.txt b/src/GEOMToolsGUI/CMakeLists.txt index 96380bee2..47164d839 100755 --- a/src/GEOMToolsGUI/CMakeLists.txt +++ b/src/GEOMToolsGUI/CMakeLists.txt @@ -17,6 +17,8 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # +INCLUDE(UseQtExt) + # --- options --- # additional include directories diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_DeflectionDlg.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_DeflectionDlg.cxx index 1d8bc588b..0a8e4ffde 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_DeflectionDlg.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI_DeflectionDlg.cxx @@ -43,7 +43,7 @@ // purpose : Constructs a GEOMToolsGUI_DeflectionDlg which is a child of 'parent', with the // name 'name' and widget flags set to 'f'. // The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. +// true to construct a modal dialog. //================================================================================= GEOMToolsGUI_DeflectionDlg::GEOMToolsGUI_DeflectionDlg (QWidget* parent) : QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_LineWidthDlg.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_LineWidthDlg.cxx index bfadece29..82985ae1a 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_LineWidthDlg.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI_LineWidthDlg.cxx @@ -44,7 +44,7 @@ // purpose : Constructs a GEOMToolsGUI_LineWidthDlg which is a child of 'parent', with the // name 'name' and widget flags set to 'f'. // The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. +// true to construct a modal dialog. //================================================================================= GEOMToolsGUI_LineWidthDlg::GEOMToolsGUI_LineWidthDlg (QWidget* parent, const QString& title) diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.cxx index 724346eb8..4e7541f04 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.cxx @@ -44,7 +44,7 @@ // purpose : Constructs a GEOMToolsGUI_NbIsosDlg which is a child of 'parent', with the // name 'name' and widget flags set to 'f'. // The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. +// true to construct a modal dialog. //================================================================================= GEOMToolsGUI_NbIsosDlg::GEOMToolsGUI_NbIsosDlg(QWidget* parent ) :QDialog( parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint ) diff --git a/src/GEOM_SWIG_WITHIHM/CMakeLists.txt b/src/GEOM_SWIG_WITHIHM/CMakeLists.txt index 8580ae6eb..4b0607795 100755 --- a/src/GEOM_SWIG_WITHIHM/CMakeLists.txt +++ b/src/GEOM_SWIG_WITHIHM/CMakeLists.txt @@ -18,12 +18,12 @@ # INCLUDE(${SWIG_USE_FILE}) -INCLUDE(UseQtExt) # --- options --- # additional include directories INCLUDE_DIRECTORIES( + ${QT_INCLUDE_DIRS} ${PTHREAD_INCLUDE_DIR} ${VTK_INCLUDE_DIRS} ${OMNIORB_INCLUDE_DIR} diff --git a/src/Material/CMakeLists.txt b/src/Material/CMakeLists.txt index c7f0291ab..7511183a6 100755 --- a/src/Material/CMakeLists.txt +++ b/src/Material/CMakeLists.txt @@ -17,10 +17,13 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # +INCLUDE(UseQtExt) + # --- options --- # additional include directories INCLUDE_DIRECTORIES( + ${QT_INCLUDE_DIRS} ${VTK_INCLUDE_DIRS} ${OMNIORB_INCLUDE_DIR} ${CAS_INCLUDE_DIRS} diff --git a/src/PrimitiveGUI/CMakeLists.txt b/src/PrimitiveGUI/CMakeLists.txt index 876d2068f..38a9d318e 100755 --- a/src/PrimitiveGUI/CMakeLists.txt +++ b/src/PrimitiveGUI/CMakeLists.txt @@ -17,6 +17,8 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # +INCLUDE(UseQtExt) + # --- options --- # additional include directories