From dba6fea2752ed0e5c83e246e8c2956d7b21b0923 Mon Sep 17 00:00:00 2001 From: cg246364 Date: Thu, 17 Dec 2020 15:28:18 +0100 Subject: [PATCH] Lot2 : point coordinates --- src/Config/Config_Keywords.h | 1 + src/FeaturesAPI/CMakeLists.txt | 2 + src/FeaturesAPI/FeaturesAPI.i | 1 + .../FeaturesAPI_PointCoordinates.cpp | 45 ++++++++ .../FeaturesAPI_PointCoordinates.h | 37 +++++++ src/FeaturesAPI/FeaturesAPI_swig.h | 1 + src/FeaturesPlugin/CMakeLists.txt | 6 ++ src/FeaturesPlugin/FeaturesPlugin_Plugin.cpp | 3 + .../FeaturesPlugin_PointCoordinates.cpp | 96 +++++++++++++++++ .../FeaturesPlugin_PointCoordinates.h | 101 ++++++++++++++++++ src/FeaturesPlugin/FeaturesPlugin_msg_fr.ts | 13 ++- .../Test/TestPointCoordinates.py | 73 +++++++++++++ src/FeaturesPlugin/doc/FeaturesPlugin.rst | 3 +- .../doc/TUI_point_coordinates.rst | 12 +++ .../doc/examples/point_coordinates.py | 13 +++ .../images/pointCoordinatesPropertyPanel.png | Bin 0 -> 10698 bytes src/FeaturesPlugin/doc/images/point_coord.png | Bin 0 -> 349 bytes .../doc/pointCoordinatesFeature.rst | 38 +++++++ src/FeaturesPlugin/icons/point_coord.png | Bin 0 -> 349 bytes src/FeaturesPlugin/plugin-Features.xml | 8 +- .../point_coordinates_widget.xml | 14 +++ src/ModuleBase/ModuleBase_WidgetLabel.cpp | 4 + src/PythonAPI/model/features/__init__.py | 1 + src/SHAPERGUI/SHAPERGUI.cpp | 10 +- 24 files changed, 476 insertions(+), 6 deletions(-) create mode 100644 src/FeaturesAPI/FeaturesAPI_PointCoordinates.cpp create mode 100644 src/FeaturesAPI/FeaturesAPI_PointCoordinates.h create mode 100644 src/FeaturesPlugin/FeaturesPlugin_PointCoordinates.cpp create mode 100644 src/FeaturesPlugin/FeaturesPlugin_PointCoordinates.h create mode 100644 src/FeaturesPlugin/Test/TestPointCoordinates.py create mode 100644 src/FeaturesPlugin/doc/TUI_point_coordinates.rst create mode 100644 src/FeaturesPlugin/doc/examples/point_coordinates.py create mode 100644 src/FeaturesPlugin/doc/images/pointCoordinatesPropertyPanel.png create mode 100644 src/FeaturesPlugin/doc/images/point_coord.png create mode 100644 src/FeaturesPlugin/doc/pointCoordinatesFeature.rst create mode 100644 src/FeaturesPlugin/icons/point_coord.png create mode 100644 src/FeaturesPlugin/point_coordinates_widget.xml diff --git a/src/Config/Config_Keywords.h b/src/Config/Config_Keywords.h index 5be23a997..28783fd69 100644 --- a/src/Config/Config_Keywords.h +++ b/src/Config/Config_Keywords.h @@ -100,6 +100,7 @@ MAYBE_UNUSED const static char* ATTR_TOOLTIP = FEATURE_TOOLTIP; MAYBE_UNUSED const static char* ATTR_ICON = FEATURE_ICON; MAYBE_UNUSED const static char* ATTR_LABEL = "label"; MAYBE_UNUSED const static char* ATTR_STYLE_SHEET = "styleSheet"; +MAYBE_UNUSED const static char* ATTR_IS_SELECTABLE = "isSelectable"; MAYBE_UNUSED const static char* ATTR_HTML_STYLE = "isHTML"; MAYBE_UNUSED const static char* ATTR_DEFAULT = "default"; MAYBE_UNUSED const static char* ATTR_INTERNAL = "internal"; diff --git a/src/FeaturesAPI/CMakeLists.txt b/src/FeaturesAPI/CMakeLists.txt index 0b8e3055c..78b18e83f 100644 --- a/src/FeaturesAPI/CMakeLists.txt +++ b/src/FeaturesAPI/CMakeLists.txt @@ -51,6 +51,7 @@ SET(PROJECT_HEADERS FeaturesAPI_Copy.h FeaturesAPI_ImportResult.h FeaturesAPI_Defeaturing.h + FeaturesAPI_PointCoordinates.h ) SET(PROJECT_SOURCES @@ -84,6 +85,7 @@ SET(PROJECT_SOURCES FeaturesAPI_Copy.cpp FeaturesAPI_ImportResult.cpp FeaturesAPI_Defeaturing.cpp + FeaturesAPI_PointCoordinates.cpp ) SET(PROJECT_LIBRARIES diff --git a/src/FeaturesAPI/FeaturesAPI.i b/src/FeaturesAPI/FeaturesAPI.i index b76fd2dc4..5324158dc 100644 --- a/src/FeaturesAPI/FeaturesAPI.i +++ b/src/FeaturesAPI/FeaturesAPI.i @@ -229,3 +229,4 @@ %include "FeaturesAPI_RemoveResults.h" %include "FeaturesAPI_Copy.h" %include "FeaturesAPI_ImportResult.h" +%include "FeaturesAPI_PointCoordinates.h" diff --git a/src/FeaturesAPI/FeaturesAPI_PointCoordinates.cpp b/src/FeaturesAPI/FeaturesAPI_PointCoordinates.cpp new file mode 100644 index 000000000..8898319f7 --- /dev/null +++ b/src/FeaturesAPI/FeaturesAPI_PointCoordinates.cpp @@ -0,0 +1,45 @@ +// 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_PointCoordinates.h" + +#include +#include +#include +#include + +std::list getPointCoordinates(const std::shared_ptr& thePart, + const ModelHighAPI_Selection& thePoint) +{ + FeaturePtr aPointCoordFeat = thePart->addFeature(FeaturesPlugin_PointCoordinates::ID()); + + fillAttribute(thePoint, aPointCoordFeat + ->selection(FeaturesPlugin_PointCoordinates::POINT_SELECTED_ID())); + std::list res; + + // obtain result + AttributeDoubleArrayPtr aResult = std::dynamic_pointer_cast( + aPointCoordFeat->attribute(FeaturesPlugin_PointCoordinates::RESULT_VALUES_ID())); + + for ( int i : {0, 1, 2}) + res.push_back( aResult->value(i)); + + return res; +} + diff --git a/src/FeaturesAPI/FeaturesAPI_PointCoordinates.h b/src/FeaturesAPI/FeaturesAPI_PointCoordinates.h new file mode 100644 index 000000000..b6d502d38 --- /dev/null +++ b/src/FeaturesAPI/FeaturesAPI_PointCoordinates.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_PointCoordinates_H_ +#define FeaturesAPI_PointCoordinates_H_ + +#include "FeaturesAPI.h" + +#include +#include + +class ModelAPI_Document; +class ModelHighAPI_Selection; + +/// \ingroup CPPHighAPI +/// \brief Get the point coordinates. +FEATURESAPI_EXPORT +std::list getPointCoordinates(const std::shared_ptr& thePart, + const ModelHighAPI_Selection& thePoint); + +#endif // FeaturesAPI_PointCoordinates_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_swig.h b/src/FeaturesAPI/FeaturesAPI_swig.h index 17ada7187..c2a5c5a83 100644 --- a/src/FeaturesAPI/FeaturesAPI_swig.h +++ b/src/FeaturesAPI/FeaturesAPI_swig.h @@ -53,5 +53,6 @@ #include "FeaturesAPI_RemoveResults.h" #include "FeaturesAPI_Copy.h" #include "FeaturesAPI_ImportResult.h" + #include "FeaturesAPI_PointCoordinates.h" #endif // FeaturesAPI_swig_H_ diff --git a/src/FeaturesPlugin/CMakeLists.txt b/src/FeaturesPlugin/CMakeLists.txt index 1dce791a9..ce50f9d33 100644 --- a/src/FeaturesPlugin/CMakeLists.txt +++ b/src/FeaturesPlugin/CMakeLists.txt @@ -20,6 +20,7 @@ INCLUDE(Common) INCLUDE(UnitTest) + SET(PROJECT_HEADERS FeaturesPlugin.h FeaturesPlugin_Plugin.h @@ -66,6 +67,7 @@ SET(PROJECT_HEADERS FeaturesPlugin_ImportResult.h FeaturesPlugin_Defeaturing.h FeaturesPlugin_VersionedChFi.h + FeaturesPlugin_PointCoordinates.h ) SET(PROJECT_SOURCES @@ -113,6 +115,7 @@ SET(PROJECT_SOURCES FeaturesPlugin_ImportResult.cpp FeaturesPlugin_Defeaturing.cpp FeaturesPlugin_VersionedChFi.cpp + FeaturesPlugin_PointCoordinates.cpp ) SET(XML_RESOURCES @@ -149,6 +152,7 @@ SET(XML_RESOURCES copy_widget.xml import_result_widget.xml defeaturing_widget.xml + point_coordinates_widget.xml ) SET(TEXT_RESOURCES @@ -166,6 +170,7 @@ INCLUDE_DIRECTORIES( ../GeomAPI ../GeomAlgoAPI ../GeomValidators + ../ModuleBase ../Events ../Config ${OpenCASCADE_INCLUDE_DIR} @@ -688,4 +693,5 @@ ADD_UNIT_TESTS(TestExtrusion.py Test20245_2.py Test20245_3.py Test20247.py + TestPointCoordinates.py ) diff --git a/src/FeaturesPlugin/FeaturesPlugin_Plugin.cpp b/src/FeaturesPlugin/FeaturesPlugin_Plugin.cpp index 0d49dfe08..fdd2beeea 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Plugin.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Plugin.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -197,6 +198,8 @@ FeaturePtr FeaturesPlugin_Plugin::createFeature(std::string theFeatureID) return FeaturePtr(new FeaturesPlugin_ImportResult); } else if (theFeatureID == FeaturesPlugin_Defeaturing::ID()) { return FeaturePtr(new FeaturesPlugin_Defeaturing); + } else if (theFeatureID == FeaturesPlugin_PointCoordinates::ID()) { + return FeaturePtr(new FeaturesPlugin_PointCoordinates); } diff --git a/src/FeaturesPlugin/FeaturesPlugin_PointCoordinates.cpp b/src/FeaturesPlugin/FeaturesPlugin_PointCoordinates.cpp new file mode 100644 index 000000000..a3aed9848 --- /dev/null +++ b/src/FeaturesPlugin/FeaturesPlugin_PointCoordinates.cpp @@ -0,0 +1,96 @@ +// 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_PointCoordinates.h" + +#include +#include + +#include +#include +#include + +#include + +#include +#include +#include + +#include + +#include +#include + +FeaturesPlugin_PointCoordinates::FeaturesPlugin_PointCoordinates() +{ +} + +void FeaturesPlugin_PointCoordinates::initAttributes() +{ + // attribute for point selected + data()->addAttribute(POINT_SELECTED_ID(), ModelAPI_AttributeSelection::typeId()); + + // attribute for x, y and z coordinates + data()->addAttribute(X_COORD_ID(), ModelAPI_AttributeString::typeId()); + data()->addAttribute(Y_COORD_ID(), ModelAPI_AttributeString::typeId()); + data()->addAttribute(Z_COORD_ID(), ModelAPI_AttributeString::typeId()); + + // attributes for result message and values + data()->addAttribute(RESULT_VALUES_ID(), ModelAPI_AttributeDoubleArray::typeId()); + data()->realArray(RESULT_VALUES_ID())->setSize(3); +} + +void FeaturesPlugin_PointCoordinates::execute() +{ +} + +void FeaturesPlugin_PointCoordinates::attributeChanged(const std::string& theID) +{ + if (theID == POINT_SELECTED_ID()) { + AttributeSelectionPtr aSelection = selection(POINT_SELECTED_ID()); + GeomShapePtr aShape; + GeomPointPtr aPoint; + if (aSelection && aSelection->isInitialized()) { + aShape = aSelection->value(); + if (!aShape && aSelection->context()) + aShape = aSelection->context()->shape(); + } + + AttributeDoubleArrayPtr aValues = + std::dynamic_pointer_cast(attribute(RESULT_VALUES_ID())); + std::stringstream streamx; + std::stringstream streamy; + std::stringstream streamz; + if (aShape) { + aPoint = GeomAlgoAPI_PointBuilder::point(aShape); + streamx << std::setprecision(14) << aPoint->x(); + aValues->setValue(0, aPoint->x()); + streamy << std::setprecision(14) << aPoint->y(); + aValues->setValue(1, aPoint->y()); + streamz << std::setprecision(14) << aPoint->z(); + aValues->setValue(2, aPoint->z()); + } + + string(X_COORD_ID() )->setValue( "X = " + streamx.str() ); + string(Y_COORD_ID() )->setValue( "Y = " + streamy.str() ); + string(Z_COORD_ID() )->setValue( "Z = " + streamz.str() ); + } + +} + diff --git a/src/FeaturesPlugin/FeaturesPlugin_PointCoordinates.h b/src/FeaturesPlugin/FeaturesPlugin_PointCoordinates.h new file mode 100644 index 000000000..5578c1535 --- /dev/null +++ b/src/FeaturesPlugin/FeaturesPlugin_PointCoordinates.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_PointCoordinates_H_ +#define FeaturesPlugin_PointCoordinates_H_ + +#include "FeaturesPlugin.h" +#include + +#include +#include + +/// \class FeaturesPlugin_PointCoordinates +/// \ingroup Plugins +/// \brief Feature to view point coordinates. + +class FeaturesPlugin_PointCoordinates : public ModelAPI_Feature +{ +public: + inline static const std::string& ID() + { + static const std::string MY_ID("PointCoordinates"); + return MY_ID; + } + + /// Attribute name for point selected. + inline static const std::string& POINT_SELECTED_ID() + { + static const std::string MY_POINT_SELECTED_ID("point_selected"); + return MY_POINT_SELECTED_ID; + } + + /// Attribute name for x coordinate. + inline static const std::string& X_COORD_ID() + { + static const std::string MY_X_COORD_ID("xcoordinate"); + return MY_X_COORD_ID; + } + + /// Attribute name for y coordinate. + inline static const std::string& Y_COORD_ID() + { + static const std::string MY_Y_COORD_ID("ycoordinate"); + return MY_Y_COORD_ID; + } + + /// Attribute name for z coordinate. + inline static const std::string& Z_COORD_ID() + { + static const std::string MY_Z_COORD_ID("zcoordinate"); + return MY_Z_COORD_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; + } + + /// \return the kind of a feature. + virtual const std::string& getKind() + { + return 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_PointCoordinates(); + +}; + +#endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_msg_fr.ts b/src/FeaturesPlugin/FeaturesPlugin_msg_fr.ts index 66977d71f..798f86a53 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_msg_fr.ts +++ b/src/FeaturesPlugin/FeaturesPlugin_msg_fr.ts @@ -123,6 +123,10 @@ Measurement Mesure + + Point coordinates + Coordonnées d'un point + Placement Placement @@ -4454,7 +4458,14 @@ Deuxième direction - + + + PointCoordinates + + Point coordinates + Coordonnées d'un point + + Measurement diff --git a/src/FeaturesPlugin/Test/TestPointCoordinates.py b/src/FeaturesPlugin/Test/TestPointCoordinates.py new file mode 100644 index 000000000..8b5c5b954 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestPointCoordinates.py @@ -0,0 +1,73 @@ +# 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 os +import math + +from salome.shaper import model + +__updated__ = "2020-11-12" + +#========================================================================= +# test get point coordinates +#========================================================================= +def test_point_coordinates(): + + 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 + coordinates = model.getPointCoordinates(Part_1_doc,model.selection("VERTEX", "[box1_1/Shape_2][box1_1/Shape_3][box1_1/Shape_6]")) + + print(" x: ", coordinates[0]) + print(" y: ", coordinates[1]) + print(" z: ", coordinates[2]) + + aRef = 200 + aRes = coordinates[0] + assert (math.fabs(aRes - aRef) < myDelta), "The coordinate X is wrong: expected = {0}, real = {1}".format(aRef, aRes) + + aRef = 0 + aRes= coordinates[1] + assert (math.fabs(aRes - aRef) < myDelta), "The coordinate Y is wrong: expected = {0}, real = {1}".format(aRef, aRes) + + aRef = 200 + aRes = coordinates[2] + assert (math.fabs(aRes - aRef) < myDelta), "The coordinate Z is wrong: expected = {0}, real = {1}".format(aRef, aRes) + + +if __name__ == '__main__': + + test_point_coordinates() + + #========================================================================= + # End of test + #========================================================================= diff --git a/src/FeaturesPlugin/doc/FeaturesPlugin.rst b/src/FeaturesPlugin/doc/FeaturesPlugin.rst index d3d384b68..dd4f08107 100644 --- a/src/FeaturesPlugin/doc/FeaturesPlugin.rst +++ b/src/FeaturesPlugin/doc/FeaturesPlugin.rst @@ -18,14 +18,15 @@ Features plug-in provides a set of common topological operations. It implements extrusionCutFeature.rst extrusionFeature.rst extrusionFuseFeature.rst - filletFeature.rst fillet1dFeature.rst + filletFeature.rst fuseFeatureFaces.rst importResultFeature.rst linearCopyFeature.rst measurementFeature.rst pipeFeature.rst placementFeature.rst + pointCoordinatesFeature.rst recoverFeature.rst removeSubShapesFeature.rst revolutionCutFeature.rst diff --git a/src/FeaturesPlugin/doc/TUI_point_coordinates.rst b/src/FeaturesPlugin/doc/TUI_point_coordinates.rst new file mode 100644 index 000000000..abc6e003a --- /dev/null +++ b/src/FeaturesPlugin/doc/TUI_point_coordinates.rst @@ -0,0 +1,12 @@ + + .. _tui_point_coordinates: + +Get point coordinates +===================== + +.. literalinclude:: examples/point_coordinates.py + :linenos: + :language: python + +:download:`Download this script ` + diff --git a/src/FeaturesPlugin/doc/examples/point_coordinates.py b/src/FeaturesPlugin/doc/examples/point_coordinates.py new file mode 100644 index 000000000..d7e0e0eee --- /dev/null +++ b/src/FeaturesPlugin/doc/examples/point_coordinates.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) +coordinates = model.getPointCoordinates(Part_1_doc,model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Top]")) +print(" x: ", coordinates[0]) +print(" y: ", coordinates[1]) +print(" z: ", coordinates[2]) +model.end() diff --git a/src/FeaturesPlugin/doc/images/pointCoordinatesPropertyPanel.png b/src/FeaturesPlugin/doc/images/pointCoordinatesPropertyPanel.png new file mode 100644 index 0000000000000000000000000000000000000000..4eabd78bf652909c54b1e05a58e7c310da6b4e61 GIT binary patch literal 10698 zcmch7WpEt9lBU37w3ubt0*jd}vY1&GGc%1~gd>Yt7BgAQ%w#b$j+mKwgzNWiBi`=a z?vIPxxc<>y6`h@3Rgw5*hAAmXq9GF@LqS2INlS^TKtVyn{~d22{^O1V@NxM2_y7=* zRzv)Ic_W&J{+$!Lh-1 zB>W8;l@n9uE3}9oCYDNL7bsB75NnA6dinvPyQrUbI+0N~dMa=*CbzF_w|-fMOA!bR zrQ^M-{1AY-{gEg@@GSfM?}#ezt%&baAP^$Of=GcwNf3yMoOaOWNq@zst!km}@Ya+I z*ZICoAoIo9*rb)P(|mD|YFbxMCQqF&rO}3Pe)a9BGwl60m28qT#kX%O2crJ|z=KTt zmd4c`TNHRv4gm3-#Y`%PQi;=8e0FtfCZUkYCp7P@dSu+nTpxn9Cd%{DBF;E5U=uuQ zNn;x6E6g-_t_Bnwpuq_reM>WRMW~TLG<*o(!Q#^vbySc6C~(-`a2Sp&z`1?^ZQ}!< z8_yWDYHwo~m)dmIovSh2^G3E2w<`^{S1Wlr!XQb$q7T>g@tM)k<41FBm_kBhCCr1HHIXzZZ%PCLFGYPm6Q+l|J|;3y(G33$TMvz4}F zCv0lL>(yo?Y;cpiL(-@jm1KZdVgNis6kd~Gn#-9s!A%h2IYC8!)^lubMJYCkWR`woLtRmz$_Qtv{HrR1NfQyQ7Lv*Pe9}Y89Fx_jSE37OdD!B|<)L&BAjT zTxyk?L1_Z_0Oklm0()CC>!#oYR9czumS#lv2IHKthT#X3V1Z)2ZwVsZW*!BjE{%hP z}Eav$-R8!Ry5Y2?SePnYWs!m2jfU5US& z^O(MH?>s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O^>90amFA5`@cQFRIPQ(O*E0(}b###lvxb|`1|IW2cQ$0ia@bPc zOdjx{ZgzjM_VxHNFnL+4i!FfG9wl!*Z7efuRBL@9CNkN&y==O5IDp(gf@Qxh!q&qF zDdfDdu;ib+`rGNiKp8xlb5agme|zIgJMbF$?Y2<$fn{xd;?RxU`97+@+_MU&Qt?TJ z?@-C4+q6dJOqRkqY`ojBwI!CKLt}@1*8)Ca#(3)F-B+ccU-@Avqi5nNasM$h(t$fc z^iIg)&Wmb_@b2)3HA%fT2i+GZknJvTJv;&BR>J3mWmJ-RTYUa&@r?x1XO{t`+5dqDF{rXABCSaS!ep} zu-dz;;>UK!$L?t@q<<%^NGLml)JZ59*`o8CY_2n7`1HJB_)D@gk`a4}9_?S*e=Wuo p`G2r3{}Z)|f7z=4-`rlv;S?5!b!!$%{x)MmNsB9pRf-t;{~Oh|&kg_p literal 0 HcmV?d00001 diff --git a/src/FeaturesPlugin/doc/images/point_coord.png b/src/FeaturesPlugin/doc/images/point_coord.png new file mode 100644 index 0000000000000000000000000000000000000000..a3fe457be0b30902036513910cb610044bae418b GIT binary patch literal 349 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VXMsm#F#`j)5C}6~x?A@LD9DoT z=c*G{)a2&(enxh~!5-VdZKyJIN2zAV&U5!AMrOb>>9k1A!Ag(rG*!Cy* UX`7El70`POp00i_>zopr0J({5vj6}9 literal 0 HcmV?d00001 diff --git a/src/FeaturesPlugin/doc/pointCoordinatesFeature.rst b/src/FeaturesPlugin/doc/pointCoordinatesFeature.rst new file mode 100644 index 000000000..84717d1aa --- /dev/null +++ b/src/FeaturesPlugin/doc/pointCoordinatesFeature.rst @@ -0,0 +1,38 @@ +.. |point_coord.icon| image:: images/point_coord.png + +Point Coordinates +================= + +The **Points coordinates** feature displays the coordinates of a selected point. + +The coordinates are displayed in the property panel. + +**Apply** button does not generate any result and has the same effect as **Cancel** for this feature. + +To display Point coordinates in the active part: + +#. select in the Main Menu *Inspection - > Point coordinates* item or +#. click |point_coord.icon| **Points coordinates** button in the toolbar + +The coordinates can be displayed for a selected point in the property panel : + +.. figure:: images/pointCoordinatesPropertyPanel.png + :align: center + + Point coordinates + +Input fields: + +- Input field contains a point selected in 3D OCC viewer or object browser. + +Note, the coordinates displayed can be selected. + +**TUI Command**: + +.. py:function:: model.getPointCoordinates(Part_doc, point) + + :param part: The current part object. + :param object: A point in format *model.selection("VERTEX", shape)*. + :return: list of coordinates. + +**See Also** a sample TUI Script of :ref:`tui_point_coordinates` operation. \ No newline at end of file diff --git a/src/FeaturesPlugin/icons/point_coord.png b/src/FeaturesPlugin/icons/point_coord.png new file mode 100644 index 0000000000000000000000000000000000000000..a3fe457be0b30902036513910cb610044bae418b GIT binary patch literal 349 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VXMsm#F#`j)5C}6~x?A@LD9DoT z=c*G{)a2&(enxh~!5-VdZKyJIN2zAV&U5!AMrOb>>9k1A!Ag(rG*!Cy* UX`7El70`POp00i_>zopr0J({5vj6}9 literal 0 HcmV?d00001 diff --git a/src/FeaturesPlugin/plugin-Features.xml b/src/FeaturesPlugin/plugin-Features.xml index 08c08b775..a45dbce5d 100644 --- a/src/FeaturesPlugin/plugin-Features.xml +++ b/src/FeaturesPlugin/plugin-Features.xml @@ -172,7 +172,13 @@ - + + + + + + diff --git a/src/FeaturesPlugin/point_coordinates_widget.xml b/src/FeaturesPlugin/point_coordinates_widget.xml new file mode 100644 index 000000000..8ab89ae25 --- /dev/null +++ b/src/FeaturesPlugin/point_coordinates_widget.xml @@ -0,0 +1,14 @@ + + + + + +