From 8e89dbca0f76c1f9347496f96d94e2f0213ede0b Mon Sep 17 00:00:00 2001 From: lucasjerome Date: Wed, 23 Dec 2020 11:38:19 +0100 Subject: [PATCH] #20537 replace "Basic properties" by Geometry calculation --- .../FeaturesAPI_GeometryCalculation.cpp | 4 +- .../FeaturesAPI_GeometryCalculation.h | 6 +- src/FeaturesPlugin/CMakeLists.txt | 2 +- .../FeaturesPlugin_GeometryCalculation.cpp | 20 +++--- src/FeaturesPlugin/FeaturesPlugin_msg_fr.ts | 62 ++++++++++-------- ...operties.py => TestGeometryCalculation.py} | 10 +-- .../doc/TUI_basic_properties.rst | 12 ---- .../doc/TUI_geometry_calculation.rst | 12 ++++ ..._properties.py => geometry_calculation.py} | 2 +- .../doc/geometryCalculationFeature.rst | 18 ++--- ...properties.png => geometryCalculation.png} | Bin ...g => geometryCalculationPropertyPanel.png} | Bin .../geometry_calculation_widget.xml | 6 +- ...properties.png => geometryCalculation.png} | Bin src/FeaturesPlugin/plugin-Features.xml | 4 +- src/GeomAlgoAPI/CMakeLists.txt | 4 +- ...pp => GeomAlgoAPI_GeometryCalculation.cpp} | 36 +++++----- ...es.h => GeomAlgoAPI_GeometryCalculation.h} | 16 ++--- src/ModuleBase/ModuleBase_WidgetLabel.cpp | 9 ++- src/ModuleBase/ModuleBase_WidgetLabel.h | 2 + src/PythonAPI/model/features/__init__.py | 2 +- 21 files changed, 122 insertions(+), 105 deletions(-) rename src/FeaturesPlugin/Test/{TestBasicProperties.py => TestGeometryCalculation.py} (92%) delete mode 100644 src/FeaturesPlugin/doc/TUI_basic_properties.rst create mode 100644 src/FeaturesPlugin/doc/TUI_geometry_calculation.rst rename src/FeaturesPlugin/doc/examples/{basic_properties.py => geometry_calculation.py} (74%) rename src/FeaturesPlugin/doc/images/{basicproperties.png => geometryCalculation.png} (100%) rename src/FeaturesPlugin/doc/images/{basicPropertiesPropertyPanel.png => geometryCalculationPropertyPanel.png} (100%) rename src/FeaturesPlugin/icons/{basicproperties.png => geometryCalculation.png} (100%) rename src/GeomAlgoAPI/{GeomAlgoAPI_BasicProperties.cpp => GeomAlgoAPI_GeometryCalculation.cpp} (61%) rename src/GeomAlgoAPI/{GeomAlgoAPI_BasicProperties.h => GeomAlgoAPI_GeometryCalculation.h} (75%) diff --git a/src/FeaturesAPI/FeaturesAPI_GeometryCalculation.cpp b/src/FeaturesAPI/FeaturesAPI_GeometryCalculation.cpp index 0a380678e..666489e0a 100644 --- a/src/FeaturesAPI/FeaturesAPI_GeometryCalculation.cpp +++ b/src/FeaturesAPI/FeaturesAPI_GeometryCalculation.cpp @@ -25,8 +25,8 @@ #include //================================================================================================= -std::list getBasicProperties(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theObject) +std::list getGeometryCalculation(const std::shared_ptr& thePart, + const ModelHighAPI_Selection& theObject) { FeaturePtr aPointCoodFeat = thePart->addFeature(FeaturesPlugin_GeometryCalculation::ID()); diff --git a/src/FeaturesAPI/FeaturesAPI_GeometryCalculation.h b/src/FeaturesAPI/FeaturesAPI_GeometryCalculation.h index 64e0f87c9..b1b6cb312 100644 --- a/src/FeaturesAPI/FeaturesAPI_GeometryCalculation.h +++ b/src/FeaturesAPI/FeaturesAPI_GeometryCalculation.h @@ -29,9 +29,9 @@ class ModelAPI_Document; class ModelHighAPI_Selection; /// \ingroup CPPHighAPI -/// \brief get the basic properties (length, Surface area, volume) +/// \brief get the geometry calculation (length, Surface area, volume) FEATURESAPI_EXPORT -std::list getBasicProperties(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theObject); +std::list getGeometryCalculation(const std::shared_ptr& thePart, + const ModelHighAPI_Selection& theObject); #endif // FeaturesAPI_GeometryCalculation_H_ \ No newline at end of file diff --git a/src/FeaturesPlugin/CMakeLists.txt b/src/FeaturesPlugin/CMakeLists.txt index 83df4b493..13db6d7bb 100644 --- a/src/FeaturesPlugin/CMakeLists.txt +++ b/src/FeaturesPlugin/CMakeLists.txt @@ -700,5 +700,5 @@ ADD_UNIT_TESTS(TestExtrusion.py TestFillet1D_Wire_3.py TestFillet1D_Wire_4.py TestFillet1D_Wire_5.py - TestBasicProperties.py + TestGeometryCalculation.py ) diff --git a/src/FeaturesPlugin/FeaturesPlugin_GeometryCalculation.cpp b/src/FeaturesPlugin/FeaturesPlugin_GeometryCalculation.cpp index 0b928f24a..6a349920b 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_GeometryCalculation.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_GeometryCalculation.cpp @@ -29,7 +29,7 @@ #include #include -#include +#include #include @@ -84,12 +84,12 @@ void FeaturesPlugin_GeometryCalculation::attributeChanged(const std::string& the double aSurfArea; double aVolume; std::string aError; - if (!GetBasicProperties(aShape, - aTolerance, - aLength, - aSurfArea, - aVolume, - aError)) + if (!getGeometryCalculation(aShape, + aTolerance, + aLength, + aSurfArea, + aVolume, + aError)) setError("Error in Geometry calculation :" + aError); streamL << std::setprecision(14) << aLength; @@ -100,9 +100,9 @@ void FeaturesPlugin_GeometryCalculation::attributeChanged(const std::string& the aValues->setValue(2, aVolume); } - string(LENGTH_ID())->setValue("Length = " + streamL.str()); - string(AREA_ID())->setValue("Area = " + streamA.str()); - string(VOLUME_ID())->setValue("Volume = " + streamV.str()); + string(LENGTH_ID())->setValue(streamL.str()); + string(AREA_ID())->setValue(streamA.str()); + string(VOLUME_ID())->setValue(streamV.str()); } } diff --git a/src/FeaturesPlugin/FeaturesPlugin_msg_fr.ts b/src/FeaturesPlugin/FeaturesPlugin_msg_fr.ts index 2762a5519..7d1369496 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_msg_fr.ts +++ b/src/FeaturesPlugin/FeaturesPlugin_msg_fr.ts @@ -115,9 +115,13 @@ Angular Copy Copie angulaire + + Bounding box + Boite englobante + Geometry calculation - Calcul géométrique + Calcul de la géométrie Linear copy @@ -4331,7 +4335,36 @@ Pas pour la direction angulaire - + + + GeometryCalculation + + Geometry calculation + Calcul de la géometrie + + + + GeometryCalculation:main_object + + Object + Objet + + + + GeometryCalculation + + Length = + Longueur = + + + Area = + Surface = + + + Volume = + Volume = + + LinearCopy @@ -4458,31 +4491,6 @@ Deuxième direction - - - - GeometryCalculation - - Geometry calculation - Calcul géométrique - - - GeometryCalculation:Object - Objet - - - GeometryCalculation:Length - Longueur - - - GeometryCalculation:Area - Surface - - - GeometryCalculation:Volume - Volume - - Measurement diff --git a/src/FeaturesPlugin/Test/TestBasicProperties.py b/src/FeaturesPlugin/Test/TestGeometryCalculation.py similarity index 92% rename from src/FeaturesPlugin/Test/TestBasicProperties.py rename to src/FeaturesPlugin/Test/TestGeometryCalculation.py index 2604c9ac3..a3e1f1ec2 100644 --- a/src/FeaturesPlugin/Test/TestBasicProperties.py +++ b/src/FeaturesPlugin/Test/TestGeometryCalculation.py @@ -38,9 +38,9 @@ __updated__ = "2020-11-12" #========================================================================= -# test basic properties +# test Geometry calculation #========================================================================= -def test_Basic_properties(): +def test_Geometry_Calculation(): model.begin() file_path = os.path.join(os.getenv("DATA_DIR"),"Shapes","Brep","box1.brep") @@ -51,9 +51,9 @@ def test_Basic_properties(): model.do() myDelta = 1e-6 - Props = model.getBasicProperties(Part_1_doc,model.selection("SOLID", "box1_1")) + Props = model.getGeometryCalculation(Part_1_doc,model.selection("SOLID", "box1_1")) - print(" Basic Properties:") + print(" Geometry calculation:") print(" Wires length: ", Props[0]) print(" Surface area: ", Props[1]) print(" Volume : ", Props[2]) @@ -73,7 +73,7 @@ def test_Basic_properties(): if __name__ == '__main__': - test_Basic_properties() + test_Geometry_Calculation() #========================================================================= # End of test diff --git a/src/FeaturesPlugin/doc/TUI_basic_properties.rst b/src/FeaturesPlugin/doc/TUI_basic_properties.rst deleted file mode 100644 index 8e6eeafa1..000000000 --- a/src/FeaturesPlugin/doc/TUI_basic_properties.rst +++ /dev/null @@ -1,12 +0,0 @@ - - .. _tui_basic_properties: - -Get basic properties -==================== - -.. literalinclude:: examples/basic_properties.py - :linenos: - :language: python - -:download:`Download this script ` - diff --git a/src/FeaturesPlugin/doc/TUI_geometry_calculation.rst b/src/FeaturesPlugin/doc/TUI_geometry_calculation.rst new file mode 100644 index 000000000..43a8f06a8 --- /dev/null +++ b/src/FeaturesPlugin/doc/TUI_geometry_calculation.rst @@ -0,0 +1,12 @@ + + .. _tui_geometry_calculation: + +Get Geometry Calculation +======================== + +.. literalinclude:: examples/geometry_calculation.py + :linenos: + :language: python + +:download:`Download this script ` + diff --git a/src/FeaturesPlugin/doc/examples/basic_properties.py b/src/FeaturesPlugin/doc/examples/geometry_calculation.py similarity index 74% rename from src/FeaturesPlugin/doc/examples/basic_properties.py rename to src/FeaturesPlugin/doc/examples/geometry_calculation.py index ab4284810..e1e340a3b 100644 --- a/src/FeaturesPlugin/doc/examples/basic_properties.py +++ b/src/FeaturesPlugin/doc/examples/geometry_calculation.py @@ -6,7 +6,7 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -properties = model.getBasicProperties(Part_1_doc,model.selection("SOLID", "Box_1_1")) +properties = model.getGeometryCalculation(Part_1_doc,model.selection("SOLID", "Box_1_1")) print(" length: ", properties[0]) print(" area: ", properties[1]) print(" volume: ", properties[2]) diff --git a/src/FeaturesPlugin/doc/geometryCalculationFeature.rst b/src/FeaturesPlugin/doc/geometryCalculationFeature.rst index 1b0dea0bd..2487d5317 100644 --- a/src/FeaturesPlugin/doc/geometryCalculationFeature.rst +++ b/src/FeaturesPlugin/doc/geometryCalculationFeature.rst @@ -1,22 +1,22 @@ -.. |basicproperties.icon| image:: images/basicproperties.png +.. |GeometryCalculation.icon| image:: images/geometryCalculation.png Geometry calculation ==================== The **Geometry calculation** feature displays basic properties of sub-elements of a geometrical object (shape). -The basic properties displayed in the property panel are length, area and volume. +The geometry calculation displayed in the property panel are length, area and volume. **Apply** button does not generate any result and has the same effect as **Cancel** for this feature. -To display basic properties in the active part: +To display geometry calculation in the active part: #. select in the Main Menu *Inspection - > Geometry calculation* item or -#. click |basicproperties.icon| **Geometry calculation** button in the toolbar +#. click |GeometryCalculation.icon| **Geometry calculation** button in the toolbar -The basic properties can be displayed for a selected object in the property panel : +The geometry calculation can be displayed for a selected object in the property panel : -.. figure:: images/basicPropertiesPropertyPanel.png +.. figure:: images/geometryCalculationPropertyPanel.png :align: center Geometry calculation @@ -25,14 +25,14 @@ Input fields: - **Object** contains an object selected in 3D OCC viewer or object browser. -The basic properties displayed can be selected. +The geometry calculation displayed can be selected. **TUI Command**: -.. py:function:: model.GetBasicProperties(Part_doc, shape) +.. py:function:: model.getGeometryCalculation(Part_doc, shape) :param part: The current part object. :param object: A shape in format *model.selection("type", shape)*. :return: list containing length, area and volume. -**See Also** a sample TUI Script of :ref:`tui_basic_properties` operation. \ No newline at end of file +**See Also** a sample TUI Script of :ref:`tui_geometry_calculation` operation. \ No newline at end of file diff --git a/src/FeaturesPlugin/doc/images/basicproperties.png b/src/FeaturesPlugin/doc/images/geometryCalculation.png similarity index 100% rename from src/FeaturesPlugin/doc/images/basicproperties.png rename to src/FeaturesPlugin/doc/images/geometryCalculation.png diff --git a/src/FeaturesPlugin/doc/images/basicPropertiesPropertyPanel.png b/src/FeaturesPlugin/doc/images/geometryCalculationPropertyPanel.png similarity index 100% rename from src/FeaturesPlugin/doc/images/basicPropertiesPropertyPanel.png rename to src/FeaturesPlugin/doc/images/geometryCalculationPropertyPanel.png diff --git a/src/FeaturesPlugin/geometry_calculation_widget.xml b/src/FeaturesPlugin/geometry_calculation_widget.xml index 73c6bcc07..55979378c 100644 --- a/src/FeaturesPlugin/geometry_calculation_widget.xml +++ b/src/FeaturesPlugin/geometry_calculation_widget.xml @@ -7,7 +7,7 @@ geometrical_selection="true"> -