From 2912e2796405e06d625a6d3e5a7d8965f288df61 Mon Sep 17 00:00:00 2001 From: cg246364 Date: Wed, 6 Jan 2021 07:54:13 +0100 Subject: [PATCH] CEA : Lot2 - Geometry calculation --- src/FeaturesAPI/CMakeLists.txt | 2 + src/FeaturesAPI/FeaturesAPI.i | 1 + .../FeaturesAPI_GeometryCalculation.cpp | 46 ++++++++ .../FeaturesAPI_GeometryCalculation.h | 37 ++++++ src/FeaturesAPI/FeaturesAPI_swig.h | 1 + src/FeaturesPlugin/CMakeLists.txt | 4 + .../FeaturesPlugin_GeometryCalculation.cpp | 110 ++++++++++++++++++ .../FeaturesPlugin_GeometryCalculation.h | 101 ++++++++++++++++ src/FeaturesPlugin/FeaturesPlugin_Plugin.cpp | 3 + src/FeaturesPlugin/FeaturesPlugin_msg_fr.ts | 34 ++++++ .../Test/TestGeometryCalculation.py | 80 +++++++++++++ src/FeaturesPlugin/doc/FeaturesPlugin.rst | 1 + .../doc/TUI_geometryCalculation.rst | 12 ++ .../doc/examples/geometry_calculation.py | 13 +++ .../doc/geometryCalculationFeature.rst | 38 ++++++ .../doc/images/geometryCalculation.png | Bin 0 -> 809 bytes .../geometryCalculationPropertyPanel.png | Bin 0 -> 11752 bytes .../geometry_calculation_widget.xml | 13 +++ .../icons/geometryCalculation.png | Bin 0 -> 809 bytes src/FeaturesPlugin/plugin-Features.xml | 4 + src/GeomAlgoAPI/CMakeLists.txt | 2 + .../GeomAlgoAPI_GeometryCalculation.cpp | 75 ++++++++++++ .../GeomAlgoAPI_GeometryCalculation.h | 42 +++++++ src/ModuleBase/ModuleBase_WidgetLabel.cpp | 9 +- src/ModuleBase/ModuleBase_WidgetLabel.h | 2 + src/PythonAPI/model/features/__init__.py | 2 +- src/SHAPERGUI/resources/LightApp.xml.in | 3 + 27 files changed, 633 insertions(+), 2 deletions(-) create mode 100644 src/FeaturesAPI/FeaturesAPI_GeometryCalculation.cpp create mode 100644 src/FeaturesAPI/FeaturesAPI_GeometryCalculation.h create mode 100644 src/FeaturesPlugin/FeaturesPlugin_GeometryCalculation.cpp create mode 100644 src/FeaturesPlugin/FeaturesPlugin_GeometryCalculation.h create mode 100644 src/FeaturesPlugin/Test/TestGeometryCalculation.py create mode 100644 src/FeaturesPlugin/doc/TUI_geometryCalculation.rst create mode 100644 src/FeaturesPlugin/doc/examples/geometry_calculation.py create mode 100644 src/FeaturesPlugin/doc/geometryCalculationFeature.rst create mode 100644 src/FeaturesPlugin/doc/images/geometryCalculation.png create mode 100644 src/FeaturesPlugin/doc/images/geometryCalculationPropertyPanel.png create mode 100644 src/FeaturesPlugin/geometry_calculation_widget.xml create mode 100644 src/FeaturesPlugin/icons/geometryCalculation.png create mode 100644 src/GeomAlgoAPI/GeomAlgoAPI_GeometryCalculation.cpp create mode 100644 src/GeomAlgoAPI/GeomAlgoAPI_GeometryCalculation.h diff --git a/src/FeaturesAPI/CMakeLists.txt b/src/FeaturesAPI/CMakeLists.txt index 78b18e83f..844baeb00 100644 --- a/src/FeaturesAPI/CMakeLists.txt +++ b/src/FeaturesAPI/CMakeLists.txt @@ -52,6 +52,7 @@ SET(PROJECT_HEADERS FeaturesAPI_ImportResult.h FeaturesAPI_Defeaturing.h FeaturesAPI_PointCoordinates.h + FeaturesAPI_GeometryCalculation.h ) SET(PROJECT_SOURCES @@ -86,6 +87,7 @@ SET(PROJECT_SOURCES FeaturesAPI_ImportResult.cpp FeaturesAPI_Defeaturing.cpp FeaturesAPI_PointCoordinates.cpp + FeaturesAPI_GeometryCalculation.cpp ) SET(PROJECT_LIBRARIES diff --git a/src/FeaturesAPI/FeaturesAPI.i b/src/FeaturesAPI/FeaturesAPI.i index 5324158dc..4a63d049b 100644 --- a/src/FeaturesAPI/FeaturesAPI.i +++ b/src/FeaturesAPI/FeaturesAPI.i @@ -230,3 +230,4 @@ %include "FeaturesAPI_Copy.h" %include "FeaturesAPI_ImportResult.h" %include "FeaturesAPI_PointCoordinates.h" +%include "FeaturesAPI_GeometryCalculation.h" diff --git a/src/FeaturesAPI/FeaturesAPI_GeometryCalculation.cpp b/src/FeaturesAPI/FeaturesAPI_GeometryCalculation.cpp new file mode 100644 index 000000000..666489e0a --- /dev/null +++ b/src/FeaturesAPI/FeaturesAPI_GeometryCalculation.cpp @@ -0,0 +1,46 @@ +// Copyright (C) 2018-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "FeaturesAPI_GeometryCalculation.h" + +#include +#include +#include +#include + +//================================================================================================= +std::list getGeometryCalculation(const std::shared_ptr& thePart, + const ModelHighAPI_Selection& theObject) +{ + FeaturePtr aPointCoodFeat = thePart->addFeature(FeaturesPlugin_GeometryCalculation::ID()); + + fillAttribute(theObject, aPointCoodFeat + ->selection(FeaturesPlugin_GeometryCalculation::OBJECT_SELECTED_ID())); + std::list res; + + // obtain result + AttributeDoubleArrayPtr aResult = std::dynamic_pointer_cast( + aPointCoodFeat->attribute(FeaturesPlugin_GeometryCalculation::RESULT_VALUES_ID())); + + for (int i : {0, 1, 2}) + res.push_back(aResult->value(i)); + + return res; +} + diff --git a/src/FeaturesAPI/FeaturesAPI_GeometryCalculation.h b/src/FeaturesAPI/FeaturesAPI_GeometryCalculation.h new file mode 100644 index 000000000..b1b6cb312 --- /dev/null +++ b/src/FeaturesAPI/FeaturesAPI_GeometryCalculation.h @@ -0,0 +1,37 @@ +// Copyright (C) 2018-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef FeaturesAPI_GeometryCalculation_H_ +#define FeaturesAPI_GeometryCalculation_H_ + +#include "FeaturesAPI.h" + +#include +#include + +class ModelAPI_Document; +class ModelHighAPI_Selection; + +/// \ingroup CPPHighAPI +/// \brief get the geometry calculation (length, Surface area, volume) +FEATURESAPI_EXPORT +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/FeaturesAPI/FeaturesAPI_swig.h b/src/FeaturesAPI/FeaturesAPI_swig.h index c2a5c5a83..1ad19edc1 100644 --- a/src/FeaturesAPI/FeaturesAPI_swig.h +++ b/src/FeaturesAPI/FeaturesAPI_swig.h @@ -54,5 +54,6 @@ #include "FeaturesAPI_Copy.h" #include "FeaturesAPI_ImportResult.h" #include "FeaturesAPI_PointCoordinates.h" + #include "FeaturesAPI_GeometryCalculation.h" #endif // FeaturesAPI_swig_H_ diff --git a/src/FeaturesPlugin/CMakeLists.txt b/src/FeaturesPlugin/CMakeLists.txt index ce50f9d33..1e14a6289 100644 --- a/src/FeaturesPlugin/CMakeLists.txt +++ b/src/FeaturesPlugin/CMakeLists.txt @@ -68,6 +68,7 @@ SET(PROJECT_HEADERS FeaturesPlugin_Defeaturing.h FeaturesPlugin_VersionedChFi.h FeaturesPlugin_PointCoordinates.h + FeaturesPlugin_GeometryCalculation.h ) SET(PROJECT_SOURCES @@ -116,6 +117,7 @@ SET(PROJECT_SOURCES FeaturesPlugin_Defeaturing.cpp FeaturesPlugin_VersionedChFi.cpp FeaturesPlugin_PointCoordinates.cpp + FeaturesPlugin_GeometryCalculation.cpp ) SET(XML_RESOURCES @@ -153,6 +155,7 @@ SET(XML_RESOURCES import_result_widget.xml defeaturing_widget.xml point_coordinates_widget.xml + geometry_calculation_widget.xml ) SET(TEXT_RESOURCES @@ -694,4 +697,5 @@ ADD_UNIT_TESTS(TestExtrusion.py Test20245_3.py Test20247.py TestPointCoordinates.py + TestGeometryCalculation.py ) diff --git a/src/FeaturesPlugin/FeaturesPlugin_GeometryCalculation.cpp b/src/FeaturesPlugin/FeaturesPlugin_GeometryCalculation.cpp new file mode 100644 index 000000000..2f94c04da --- /dev/null +++ b/src/FeaturesPlugin/FeaturesPlugin_GeometryCalculation.cpp @@ -0,0 +1,110 @@ +// Copyright (C) 2018-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "FeaturesPlugin_GeometryCalculation.h" + +#include +#include + +#include +#include +#include + +#include + +#include +#include + + +#include +#include + +//================================================================================================= +FeaturesPlugin_GeometryCalculation::FeaturesPlugin_GeometryCalculation() +{ +} + +//================================================================================================= +void FeaturesPlugin_GeometryCalculation::initAttributes() +{ + // attribute for point selected + data()->addAttribute(OBJECT_SELECTED_ID(), ModelAPI_AttributeSelection::typeId()); + + // attributes for result message and values + data()->addAttribute(LENGTH_ID(), ModelAPI_AttributeString::typeId()); + data()->addAttribute(AREA_ID(), ModelAPI_AttributeString::typeId()); + data()->addAttribute(VOLUME_ID(), ModelAPI_AttributeString::typeId()); + + data()->addAttribute(RESULT_VALUES_ID(), ModelAPI_AttributeDoubleArray::typeId()); + data()->realArray(RESULT_VALUES_ID())->setSize(3); + +} + +//================================================================================================= +void FeaturesPlugin_GeometryCalculation::execute() +{ +} + +//================================================================================================= +void FeaturesPlugin_GeometryCalculation::attributeChanged(const std::string& theID) +{ + if (theID == OBJECT_SELECTED_ID()) { + + AttributeSelectionPtr aSelection = selection(OBJECT_SELECTED_ID()); + AttributeDoubleArrayPtr aValues = + std::dynamic_pointer_cast(attribute(RESULT_VALUES_ID())); + std::stringstream streamL; + std::stringstream streamA; + std::stringstream streamV; + GeomShapePtr aShape; + + if (aSelection && aSelection->isInitialized()) { + aShape = aSelection->value(); + if (!aShape && aSelection->context()) + aShape = aSelection->context()->shape(); + } + + if (aShape) { + double aTolerance = 0.0001; + double aLength; + double aSurfArea; + double aVolume; + std::string aError; + if (!getGeometryCalculation(aShape, + aTolerance, + aLength, + aSurfArea, + aVolume, + aError)) + setError("Error in Geometry calculation :" + aError); + + streamL << std::setprecision(14) << aLength; + aValues->setValue(0, aLength); + streamA << std::setprecision(14) << aSurfArea; + aValues->setValue(1, aSurfArea); + streamV << std::setprecision(14) << aVolume; + aValues->setValue(2, aVolume); + } + + string(LENGTH_ID())->setValue(streamL.str()); + string(AREA_ID())->setValue(streamA.str()); + string(VOLUME_ID())->setValue(streamV.str()); + } +} + diff --git a/src/FeaturesPlugin/FeaturesPlugin_GeometryCalculation.h b/src/FeaturesPlugin/FeaturesPlugin_GeometryCalculation.h new file mode 100644 index 000000000..bd90966f8 --- /dev/null +++ b/src/FeaturesPlugin/FeaturesPlugin_GeometryCalculation.h @@ -0,0 +1,101 @@ +// Copyright (C) 2018-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef FeaturesPlugin_GeometryCalculation_H_ +#define FeaturesPlugin_GeometryCalculation_H_ + +#include "FeaturesPlugin.h" +#include + +#include +#include + +/// \class FeaturesPlugin_GeometryCalculation +/// \ingroup Plugins +/// \brief Feature for geometry calculation. + +class FeaturesPlugin_GeometryCalculation : public ModelAPI_Feature +{ +public: + inline static const std::string& ID() + { + static const std::string MY_ID("GeometryCalculation"); + return MY_ID; + } + + /// \return the kind of a feature. + virtual const std::string& getKind() + { + return ID(); + } + + /// Attribute name for object selected. + inline static const std::string& OBJECT_SELECTED_ID() + { + static const std::string MY_OBJECT_SELECTED_ID("main_object"); + return MY_OBJECT_SELECTED_ID; + } + + /// Attribute name for length + inline static const std::string& LENGTH_ID() + { + static const std::string MY_LENGTH_ID("length"); + return MY_LENGTH_ID; + } + + /// Attribute name for area + inline static const std::string& AREA_ID() + { + static const std::string MY_AREA_ID("area"); + return MY_AREA_ID; + } + + /// Attribute name for volume. + inline static const std::string& VOLUME_ID() + { + static const std::string MY_VOLUME_ID("volume"); + return MY_VOLUME_ID; + } + + /// Attribute name for values of result. + inline static const std::string& RESULT_VALUES_ID() + { + static const std::string MY_RESULT_VALUES_ID("result_values"); + return MY_RESULT_VALUES_ID; + } + + /// Performs the algorithm and stores results it in the data structure. + FEATURESPLUGIN_EXPORT virtual void execute(); + + /// Request for initialization of data model of the feature: adding all attributes + FEATURESPLUGIN_EXPORT virtual void initAttributes(); + + /// Called on change of any argument-attribute of this object + /// \param theID identifier of changed attribute + FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + + /// Reimplemented from ModelAPI_Feature::isMacro(). Returns true. + FEATURESPLUGIN_EXPORT virtual bool isMacro() const { return true; } + + /// Use plugin manager for features creation + FeaturesPlugin_GeometryCalculation(); + +}; + +#endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_Plugin.cpp b/src/FeaturesPlugin/FeaturesPlugin_Plugin.cpp index fdd2beeea..8419057e2 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Plugin.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Plugin.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -200,6 +201,8 @@ FeaturePtr FeaturesPlugin_Plugin::createFeature(std::string theFeatureID) return FeaturePtr(new FeaturesPlugin_Defeaturing); } else if (theFeatureID == FeaturesPlugin_PointCoordinates::ID()) { return FeaturePtr(new FeaturesPlugin_PointCoordinates); + } else if (theFeatureID == FeaturesPlugin_GeometryCalculation::ID()) { + return FeaturePtr(new FeaturesPlugin_GeometryCalculation); } diff --git a/src/FeaturesPlugin/FeaturesPlugin_msg_fr.ts b/src/FeaturesPlugin/FeaturesPlugin_msg_fr.ts index 798f86a53..ff2645663 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_msg_fr.ts +++ b/src/FeaturesPlugin/FeaturesPlugin_msg_fr.ts @@ -127,6 +127,10 @@ Point coordinates Coordonnées d'un point + + Geometry calculation + Calcul de la géométrie + Placement Placement @@ -4466,6 +4470,36 @@ Coordonnées d'un point + + + GeometryCalculation + + Geometry calculation + Calcul de la géometrie + + + + GeometryCalculation:main_object + + Object + Objet + + + + GeometryCalculation + + Length = + Longueur = + + + Area = + Surface = + + + Volume = + Volume = + + Measurement diff --git a/src/FeaturesPlugin/Test/TestGeometryCalculation.py b/src/FeaturesPlugin/Test/TestGeometryCalculation.py new file mode 100644 index 000000000..a3e1f1ec2 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestGeometryCalculation.py @@ -0,0 +1,80 @@ +# Copyright (C) 2014-2020 CEA/DEN, EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +""" + Unit test of ... +""" +#========================================================================= +# Initialization of the test +#========================================================================= + +import salome + +import os +import math + +from ModelAPI import * +from salome.shaper import model + + + +__updated__ = "2020-11-12" + + +#========================================================================= +# test Geometry calculation +#========================================================================= +def test_Geometry_Calculation(): + + model.begin() + file_path = os.path.join(os.getenv("DATA_DIR"),"Shapes","Brep","box1.brep") + partSet = model.moduleDocument() + Part_1 = model.addPart(partSet) + Part_1_doc = Part_1.document() + Import_1 = model.addImport(Part_1_doc,file_path) + model.do() + + myDelta = 1e-6 + Props = model.getGeometryCalculation(Part_1_doc,model.selection("SOLID", "box1_1")) + + print(" Geometry calculation:") + print(" Wires length: ", Props[0]) + print(" Surface area: ", Props[1]) + print(" Volume : ", Props[2]) + + aReflength = 2400 + aReslength = Props[0] + assert (math.fabs(aReslength - aReflength) < myDelta), "The surface is wrong: expected = {0}, real = {1}".format(aReflength, aReslength) + + aRefSurface = 240000 + aResSurface = Props[1] + assert (math.fabs(aResSurface - aRefSurface) < myDelta), "The surface is wrong: expected = {0}, real = {1}".format(aRefSurface, aResSurface) + + aRefVolume = 8000000 + aResVolume = Props[2] + assert (math.fabs(aResVolume - aRefVolume) < myDelta), "The volume is wrong: expected = {0}, real = {1}".format(aRefVolume, aResVolume) + + +if __name__ == '__main__': + + test_Geometry_Calculation() + + #========================================================================= + # End of test + #========================================================================= diff --git a/src/FeaturesPlugin/doc/FeaturesPlugin.rst b/src/FeaturesPlugin/doc/FeaturesPlugin.rst index dd4f08107..23cfb1f5c 100644 --- a/src/FeaturesPlugin/doc/FeaturesPlugin.rst +++ b/src/FeaturesPlugin/doc/FeaturesPlugin.rst @@ -21,6 +21,7 @@ Features plug-in provides a set of common topological operations. It implements fillet1dFeature.rst filletFeature.rst fuseFeatureFaces.rst + geometryCalculationFeature.rst importResultFeature.rst linearCopyFeature.rst measurementFeature.rst diff --git a/src/FeaturesPlugin/doc/TUI_geometryCalculation.rst b/src/FeaturesPlugin/doc/TUI_geometryCalculation.rst new file mode 100644 index 000000000..43a8f06a8 --- /dev/null +++ b/src/FeaturesPlugin/doc/TUI_geometryCalculation.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/geometry_calculation.py b/src/FeaturesPlugin/doc/examples/geometry_calculation.py new file mode 100644 index 000000000..e1e340a3b --- /dev/null +++ b/src/FeaturesPlugin/doc/examples/geometry_calculation.py @@ -0,0 +1,13 @@ +import os +from salome.shaper import model + +model.begin() +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.getGeometryCalculation(Part_1_doc,model.selection("SOLID", "Box_1_1")) +print(" length: ", properties[0]) +print(" area: ", properties[1]) +print(" volume: ", properties[2]) +model.end() \ No newline at end of file diff --git a/src/FeaturesPlugin/doc/geometryCalculationFeature.rst b/src/FeaturesPlugin/doc/geometryCalculationFeature.rst new file mode 100644 index 000000000..2487d5317 --- /dev/null +++ b/src/FeaturesPlugin/doc/geometryCalculationFeature.rst @@ -0,0 +1,38 @@ +.. |GeometryCalculation.icon| image:: images/geometryCalculation.png + +Geometry calculation +==================== + +The **Geometry calculation** feature displays basic properties of sub-elements of a geometrical object (shape). + +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 geometry calculation in the active part: + +#. select in the Main Menu *Inspection - > Geometry calculation* item or +#. click |GeometryCalculation.icon| **Geometry calculation** button in the toolbar + +The geometry calculation can be displayed for a selected object in the property panel : + +.. figure:: images/geometryCalculationPropertyPanel.png + :align: center + + Geometry calculation + +Input fields: + +- **Object** contains an object selected in 3D OCC viewer or object browser. + +The geometry calculation displayed can be selected. + +**TUI Command**: + +.. 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_geometry_calculation` operation. \ No newline at end of file diff --git a/src/FeaturesPlugin/doc/images/geometryCalculation.png b/src/FeaturesPlugin/doc/images/geometryCalculation.png new file mode 100644 index 0000000000000000000000000000000000000000..f46c0da7a378a05f515f1b3583cec1a34526ddd7 GIT binary patch literal 809 zcmV+^1J?YBP)z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ;pGibPRCwBA{Qv(y12q9a0I?u*7#SH;fs`8oJ&%BR z7ZC46mjF2qAb`LG3|&mZjg z<(tp{|NZ;-|NO-(-}w3Y_W;#9A{z=a10aA{&|J;*=N|(@dTBRYU|L5hLskWZUyvTn zz|YUapr)?Lxq0g@3wKwCs_#GmlsW~(|3GR00tnrOo4)@1|Nq?=O#I>N|NlqMKKTFT z*Z=?Tzy1IJ@%!)p+ji~y2n_cwpgtZ@6oAYC2q1J9GW`C_z))1v&Ct}|8*B3c&9Mf0Rum}x3xojzh!Hv20Bzd@3?|>NKOpXBVnEO! z@a_9ghL>+Y0O=nLTpa8Sa*})uN|HS1fd*y+rLO|b`UDU_7%uz;bYXof#AOv_r3@Wi z2v>sm3l=Vd^V@*F02;;&B=~`t4I~B-Ko~B(|K`8%hc7^v0fm_u5i~jgiHiU|EHBJ> z8OW^yMGVlaR{#OTge?pwPUvR%{u@G1p4bhhzy4xCp+Vw5|DdL85CITC7%sf}{J-yu zcf@5g2_XgsZArKbPXf()4G=(BV|npxM7V_{lrpSYfEwE{v4WCP3`+n42*ZV^AO81! z_zE-J{$VLY7CouAD z152)jgf$EgukS$-v+{=+a%^J{iWo>OIsgbD^e}vS@56tor*E;x zDigc}fB

1_mVo#*aW|3@i)*0tnrOeLw|4KpL228JLMIq;Eid3Qp4i0fcVg5+J?_ n#413{PNac9L2(J=00bBSI@)&56%FA}00000NkvXXu0mjfN^nc_ literal 0 HcmV?d00001 diff --git a/src/FeaturesPlugin/doc/images/geometryCalculationPropertyPanel.png b/src/FeaturesPlugin/doc/images/geometryCalculationPropertyPanel.png new file mode 100644 index 0000000000000000000000000000000000000000..17f8cd7ef35a4e3ef73b80f05ccea19b367dafcf GIT binary patch literal 11752 zcmb_?b8sfzw{9}Aor#T!ZB1<3w)MuC*qGS1ZB1-D6Wed>oP57i7w1;pd+MG#{YUTa zU8{GmUcL9To_h8QSCA7&fW?6Y0Rcgfln_w@0Re^lx?X_(=j_`UUHR33I}1swKz|+H z&?aGD_t-9?8ZOHAW-e}qPNpE{cJ{WWbk4?3rlxkz7WOVzU_JaGAVeUNB7!RJnHPWE z+?7pnhk^EUQI`;O=oTj+W1AVwB0r1k6UhVMvA@+P(y1or`uo$aN{fJEV2{P6Xx4_E zGi#60R(O%grg!?eKxYcUp$m2iEGNOGX96?Hj@+_u$+%jm52s{lgrGs+T2IVD78qLb zg~C$ezypzm1Oo)2^Kw0A5uP5U_9be>;LG0VI$mD$y~c`CtE+Q?xE-nO=HzUd*$!s? zTmiWEWF9++#YuHuW0+w*^EU@Ht>`Ggkzug6x8uz&?d-|NA6!s@i@gW7x2df5U|w?i zq?<$dIsWwvw)2rlUJE7L^WA&5T2fdA`WMk2ikp|G%5vGXVP?=QE@ zmC-L>2vQF%kGwMRHdiUCD^Dh^g#o)u9+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KrW2%Qm z_8tnW=N!ps!fZFD%J7Y0rdAvTX*qAnW1&z&3Yw<|2ZY59iS{70LVmMGLjQ`V^WX-T z)a>d|DguHQ@-kasghAX$F-E|OYQqqv18`-e4```!F3pjR?Mrvbj?O@G+%cmK2XZ{$ zzEVX!=}LD!Y_5O;e0433oDyNAW07r{k>eHj>izyf(8oKR6dJSIgL+WqyZ9)a6x}&% z9qyv#)(vhTj~r#X1aHEZ*_@Zg$UrgAsvG;c@TwYyyg zzd2kFU*9y)+!r>{T0+@gJ3qVlAhselZE~L-kpO+7&K!vBjOSO4H@eanzago%N1%|k zgr?5a{c>C5SayFoQEwT4N4N^I^#dc=8en+1E9Y(vYD3WTH8JBCs?oo2crEF_9f$vG nTXg@C9R4p<|NkEC1F7hlbMlZcQSqx(8$?o6PNZ7MAmHBs0#(p- literal 0 HcmV?d00001 diff --git a/src/FeaturesPlugin/geometry_calculation_widget.xml b/src/FeaturesPlugin/geometry_calculation_widget.xml new file mode 100644 index 000000000..55979378c --- /dev/null +++ b/src/FeaturesPlugin/geometry_calculation_widget.xml @@ -0,0 +1,13 @@ + + + + +

1_mVo#*aW|3@i)*0tnrOeLw|4KpL228JLMIq;Eid3Qp4i0fcVg5+J?_ n#413{PNac9L2(J=00bBSI@)&56%FA}00000NkvXXu0mjfN^nc_ literal 0 HcmV?d00001 diff --git a/src/FeaturesPlugin/plugin-Features.xml b/src/FeaturesPlugin/plugin-Features.xml index a45dbce5d..2ee033977 100644 --- a/src/FeaturesPlugin/plugin-Features.xml +++ b/src/FeaturesPlugin/plugin-Features.xml @@ -179,6 +179,10 @@ + + + diff --git a/src/GeomAlgoAPI/CMakeLists.txt b/src/GeomAlgoAPI/CMakeLists.txt index a03ae213f..0aaebb219 100644 --- a/src/GeomAlgoAPI/CMakeLists.txt +++ b/src/GeomAlgoAPI/CMakeLists.txt @@ -88,6 +88,7 @@ SET(PROJECT_HEADERS GeomAlgoAPI_Projection.h GeomAlgoAPI_Chamfer.h GeomAlgoAPI_Defeaturing.h + GeomAlgoAPI_GeometryCalculation.h ) SET(PROJECT_SOURCES @@ -155,6 +156,7 @@ SET(PROJECT_SOURCES GeomAlgoAPI_Projection.cpp GeomAlgoAPI_Chamfer.cpp GeomAlgoAPI_Defeaturing.cpp + GeomAlgoAPI_GeometryCalculation.cpp ) SET(PROJECT_LIBRARIES diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_GeometryCalculation.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_GeometryCalculation.cpp new file mode 100644 index 000000000..43af83cf2 --- /dev/null +++ b/src/GeomAlgoAPI/GeomAlgoAPI_GeometryCalculation.cpp @@ -0,0 +1,75 @@ +// Copyright (C) 2014-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "GeomAlgoAPI_GeometryCalculation.h" + +#include +#include +#include +#include +#include + +//================================================================================================= +bool getGeometryCalculation(const std::shared_ptr& theShape, + const double theTolerance, + Standard_Real& theLength, + Standard_Real& theSurfArea, + Standard_Real& theVolume, + std::string& theError) +{ + + #ifdef _DEBUG + std::cout << "getGeometryCalculation " << std::endl; + #endif + + if (!theShape.get()) { + theError = "getGeometryCalculation : An invalid argument"; + return false; + } + + TopoDS_Shape aShape = theShape->impl(); + + //Compute the parameters + GProp_GProps aLProps, aSProps; + Standard_Real anEps = theTolerance >= 0 ? theTolerance : 1.e-6; + try { + OCC_CATCH_SIGNALS; + BRepGProp::LinearProperties(aShape, aLProps, Standard_True); + theLength = aLProps.Mass(); + + BRepGProp::SurfaceProperties(aShape, aSProps, anEps, Standard_True); + theSurfArea = aSProps.Mass(); + + theVolume = 0.0; + if (aShape.ShapeType() < TopAbs_SHELL) { + for (TopExp_Explorer anExp (aShape, TopAbs_SOLID); anExp.More(); anExp.Next()) { + GProp_GProps aVProps; + BRepGProp::VolumeProperties(anExp.Current(), aVProps, anEps, Standard_True); + theVolume += aVProps.Mass(); + } + } + } + catch (Standard_Failure& aFail) { + theError = aFail.GetMessageString(); + return false; + } + + return true; + +} \ No newline at end of file diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_GeometryCalculation.h b/src/GeomAlgoAPI/GeomAlgoAPI_GeometryCalculation.h new file mode 100644 index 000000000..df1f2f2b3 --- /dev/null +++ b/src/GeomAlgoAPI/GeomAlgoAPI_GeometryCalculation.h @@ -0,0 +1,42 @@ +// Copyright (C) 2014-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef GeomAlgoAPI_GeometryCalculation_H_ +#define GeomAlgoAPI_GeometryCalculation_H_ + +#include +#include +#include + +/// Run chamfer operation with two distances or with a distance and an angle . + /// \param theShape the shape + /// \param theTolerance tolerance desirated + /// \param theLength length calculated + /// \param theSurfArea Surface Area calculated + /// \param theVolume Volume calculated + /// \param theError error +GEOMALGOAPI_EXPORT +bool getGeometryCalculation(const std::shared_ptr& theShape, + const Standard_Real theTolerance, + Standard_Real& theLength, + Standard_Real& theSurfArea, + Standard_Real& theVolume, + std::string& theError); + +#endif diff --git a/src/ModuleBase/ModuleBase_WidgetLabel.cpp b/src/ModuleBase/ModuleBase_WidgetLabel.cpp index 7e3f86de0..1f4d511e2 100644 --- a/src/ModuleBase/ModuleBase_WidgetLabel.cpp +++ b/src/ModuleBase/ModuleBase_WidgetLabel.cpp @@ -37,6 +37,9 @@ ModuleBase_WidgetLabel::ModuleBase_WidgetLabel(QWidget* theParent, : ModuleBase_ModelWidget(theParent, theData) { QString aText = translate(theData->getProperty("title")); + + myPrefix = theData->getProperty(ATTR_LABEL); + bool aIsHtml = theData->getBooleanAttribute(ATTR_HTML_STYLE, false); QString aLabelIcon = QString::fromStdString(theData->getProperty("icon")); @@ -99,7 +102,11 @@ bool ModuleBase_WidgetLabel::restoreValueCustom() aText = ModuleBase_Tools::translate(myFeature->getKind(), aMsg); } } - myLabel->setText(aText); + if (myPrefix == "") { + myLabel->setText(aText); + } else { + myLabel->setText(ModuleBase_Tools::translate(myFeature->getKind(), myPrefix) + aText); + } } return true; } diff --git a/src/ModuleBase/ModuleBase_WidgetLabel.h b/src/ModuleBase/ModuleBase_WidgetLabel.h index be90456c0..83ebd2ea2 100644 --- a/src/ModuleBase/ModuleBase_WidgetLabel.h +++ b/src/ModuleBase/ModuleBase_WidgetLabel.h @@ -61,6 +61,8 @@ protected: /// A label control QLabel* myLabel; + /// A prefix for label + std::string myPrefix; }; #endif diff --git a/src/PythonAPI/model/features/__init__.py b/src/PythonAPI/model/features/__init__.py index 41f3e1e8e..84b7b6562 100644 --- a/src/PythonAPI/model/features/__init__.py +++ b/src/PythonAPI/model/features/__init__.py @@ -30,7 +30,7 @@ from FeaturesAPI import addRecover from FeaturesAPI import addFillet, addChamfer from FeaturesAPI import addFusionFaces from FeaturesAPI import measureLength, measureDistance, measureRadius, measureAngle -from FeaturesAPI import getPointCoordinates +from FeaturesAPI import getPointCoordinates, getGeometryCalculation from FeaturesAPI import addRemoveResults from FeaturesAPI import addCopy, addImportResult from FeaturesAPI import addDefeaturing diff --git a/src/SHAPERGUI/resources/LightApp.xml.in b/src/SHAPERGUI/resources/LightApp.xml.in index 33908724f..6d303a073 100644 --- a/src/SHAPERGUI/resources/LightApp.xml.in +++ b/src/SHAPERGUI/resources/LightApp.xml.in @@ -22,6 +22,9 @@ +

+ +
-- 2.39.2