From: Jérôme Date: Thu, 26 Nov 2020 15:00:52 +0000 (+0100) Subject: Add documentation and test unit X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d448f72525a9f49a2837dc22f5951ca39888d219;p=modules%2Fshaper.git Add documentation and test unit --- diff --git a/src/FeaturesAPI/FeaturesAPI_NormalToFace.cpp b/src/FeaturesAPI/FeaturesAPI_NormalToFace.cpp index 2875a9f97..fbc7bd650 100644 --- a/src/FeaturesAPI/FeaturesAPI_NormalToFace.cpp +++ b/src/FeaturesAPI/FeaturesAPI_NormalToFace.cpp @@ -25,7 +25,7 @@ #include #include - +//================================================================================================= FeaturesAPI_NormalToFace:: FeaturesAPI_NormalToFace(const std::shared_ptr& theFeature) : ModelHighAPI_Interface(theFeature) @@ -33,6 +33,7 @@ FeaturesAPI_NormalToFace:: initialize(); } +//================================================================================================= FeaturesAPI_NormalToFace::FeaturesAPI_NormalToFace( const std::shared_ptr& theFeature, const ModelHighAPI_Selection& theBaseFace, @@ -47,6 +48,7 @@ FeaturesAPI_NormalToFace::FeaturesAPI_NormalToFace( } } +//================================================================================================= FeaturesAPI_NormalToFace::FeaturesAPI_NormalToFace( const std::shared_ptr& theFeature, const ModelHighAPI_Selection& theBaseFace) @@ -59,21 +61,23 @@ FeaturesAPI_NormalToFace::FeaturesAPI_NormalToFace( } } +//================================================================================================= FeaturesAPI_NormalToFace::~FeaturesAPI_NormalToFace() { } +//================================================================================================= void FeaturesAPI_NormalToFace::dump(ModelHighAPI_Dumper& theDumper) const { FeaturePtr aBase = feature(); const std::string& aDocName = theDumper.name(aBase->document()); AttributeSelectionPtr anAttrObject; - anAttrObject = aBase->selection(FeaturesPlugin_CreateNormalToFace::OBJECTS_LIST_ID()); + anAttrObject = aBase->selection(FeaturesPlugin_CreateNormalToFace::FACE_SELECTED_ID()); theDumper << aBase << " = model.getNormal(" << aDocName << ", " << anAttrObject; - if ( !aBase->string(FeaturesPlugin_CreateNormalToFace::VERTEX_OPTION_ID())->value().empty()){ + if (!aBase->string(FeaturesPlugin_CreateNormalToFace::VERTEX_OPTION_ID())->value().empty()){ AttributeSelectionPtr anAttrVertex = aBase->selection(FeaturesPlugin_CreateNormalToFace::VERTEX_SELECTED_ID()); @@ -85,10 +89,9 @@ void FeaturesAPI_NormalToFace::dump(ModelHighAPI_Dumper& theDumper) const } //================================================================================================== - NormalPtr getNormal(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theBaseFace, - const ModelHighAPI_Selection& theOptionnelPoint) + const ModelHighAPI_Selection& theBaseFace, + const ModelHighAPI_Selection& theOptionnelPoint) { FeaturePtr aFeature = @@ -101,6 +104,7 @@ NormalPtr getNormal(const std::shared_ptr& thePart, return aNormalToface; } +//================================================================================================= NormalPtr getNormal(const std::shared_ptr& thePart, const ModelHighAPI_Selection& theBaseFace) { diff --git a/src/FeaturesAPI/FeaturesAPI_NormalToFace.h b/src/FeaturesAPI/FeaturesAPI_NormalToFace.h index a1ad49159..f7c1facc0 100644 --- a/src/FeaturesAPI/FeaturesAPI_NormalToFace.h +++ b/src/FeaturesAPI/FeaturesAPI_NormalToFace.h @@ -52,8 +52,8 @@ public: FEATURESAPI_EXPORT virtual ~FeaturesAPI_NormalToFace(); - INTERFACE_3(FeaturesPlugin_CreateNormalToFace::ID(), - faceSelected, FeaturesPlugin_CreateNormalToFace::OBJECTS_LIST_ID(), + INTERFACE_3(FeaturesPlugin_CreateNormalToFace::ID(), + faceSelected, FeaturesPlugin_CreateNormalToFace::FACE_SELECTED_ID(), ModelAPI_AttributeSelection, /** base face */, vertexSelected, FeaturesPlugin_CreateNormalToFace::VERTEX_SELECTED_ID(), diff --git a/src/FeaturesPlugin/CMakeLists.txt b/src/FeaturesPlugin/CMakeLists.txt index 4777f6aea..0375dd1d0 100644 --- a/src/FeaturesPlugin/CMakeLists.txt +++ b/src/FeaturesPlugin/CMakeLists.txt @@ -704,4 +704,5 @@ ADD_UNIT_TESTS(TestExtrusion.py TestFillet1D_Wire_3.py TestFillet1D_Wire_4.py TestFillet1D_Wire_5.py + TestNormalToFace.py ) diff --git a/src/FeaturesPlugin/CreateNormalToFace_widget.xml b/src/FeaturesPlugin/CreateNormalToFace_widget.xml index c2b4bece0..f7fc96d17 100644 --- a/src/FeaturesPlugin/CreateNormalToFace_widget.xml +++ b/src/FeaturesPlugin/CreateNormalToFace_widget.xml @@ -1,5 +1,5 @@ - - - diff --git a/src/FeaturesPlugin/FeaturesPlugin_CreateNormalToFace.cpp b/src/FeaturesPlugin/FeaturesPlugin_CreateNormalToFace.cpp index 4e9f7df11..14c8848ca 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_CreateNormalToFace.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_CreateNormalToFace.cpp @@ -20,21 +20,14 @@ #include "FeaturesPlugin_CreateNormalToFace.h" #include -#include -#include #include #include #include #include -#include -#include #include #include #include -#include #include -#include -#include #include #include #include @@ -42,16 +35,17 @@ #include #include -#include +//================================================================================================= FeaturesPlugin_CreateNormalToFace::FeaturesPlugin_CreateNormalToFace() { } +//================================================================================================= void FeaturesPlugin_CreateNormalToFace::initAttributes() { // attribute for object selected - data()->addAttribute(OBJECTS_LIST_ID(), ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(FACE_SELECTED_ID(), ModelAPI_AttributeSelection::typeId()); data()->addAttribute(VERTEX_SELECTED_ID(), ModelAPI_AttributeSelection::typeId()); // attributes for result message and values data()->addAttribute(VERTEX_OPTION_ID(), ModelAPI_AttributeString::typeId()); @@ -60,35 +54,37 @@ void FeaturesPlugin_CreateNormalToFace::initAttributes() } +//================================================================================================= void FeaturesPlugin_CreateNormalToFace::execute() { -AttributeSelectionPtr aSelectionFace = selection(OBJECTS_LIST_ID()); -AttributeSelectionPtr aSelectionPoint = selection(VERTEX_SELECTED_ID()); -GeomShapePtr aShape; -GeomShapePtr aShapePoint; + AttributeSelectionPtr aSelectionFace = selection(FACE_SELECTED_ID()); + AttributeSelectionPtr aSelectionPoint = selection(VERTEX_SELECTED_ID()); + + GeomShapePtr aShape; + GeomShapePtr aShapePoint; if(!string(VERTEX_OPTION_ID())->value().empty()) -{ - if (aSelectionPoint && aSelectionPoint->isInitialized()) { - aShapePoint = aSelectionPoint->value(); - if (!aShapePoint && aSelectionPoint->context()) - aShapePoint = aSelectionPoint->context()->shape(); - } -} + { + if (aSelectionPoint && aSelectionPoint->isInitialized()) { + aShapePoint = aSelectionPoint->value(); + if (!aShapePoint && aSelectionPoint->context()) + aShapePoint = aSelectionPoint->context()->shape(); + } + } -if (aSelectionFace && aSelectionFace->isInitialized()) { - aShape = aSelectionFace->value(); - if (!aShape && aSelectionFace->context()) - aShape = aSelectionFace->context()->shape(); -} + if (aSelectionFace && aSelectionFace->isInitialized()) { + aShape = aSelectionFace->value(); + if (!aShape && aSelectionFace->context()) + aShape = aSelectionFace->context()->shape(); + } -if (aShape){ - std::string aError; - std::shared_ptr theNormal(new GeomAPI_Edge); - if( !GeomAlgoAPI_NormalToFace::normal(aShape, - aShapePoint, - theNormal, - aError)) + if (aShape) { + std::string aError; + std::shared_ptr theNormal(new GeomAPI_Edge); + if( !GeomAlgoAPI_NormalToFace::normal(aShape, + aShapePoint, + theNormal, + aError)) setError("Error in bounding box calculation :" + aError); GeomDirPtr theDir; @@ -98,8 +94,8 @@ if (aShape){ theDir = theNormal->line()->direction(); } } - aPnt->translate(theDir, 100 ); - + aPnt->translate(theDir, 100); + std::shared_ptr anEdge = GeomAlgoAPI_EdgeBuilder::line(theNormal->firstPoint(), aPnt); @@ -111,6 +107,7 @@ if (aShape){ } } +//================================================================================================= void FeaturesPlugin_CreateNormalToFace::attributeChanged(const std::string& theID) { } diff --git a/src/FeaturesPlugin/FeaturesPlugin_CreateNormalToFace.h b/src/FeaturesPlugin/FeaturesPlugin_CreateNormalToFace.h index 77ad40c52..83210022b 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_CreateNormalToFace.h +++ b/src/FeaturesPlugin/FeaturesPlugin_CreateNormalToFace.h @@ -25,7 +25,6 @@ #include #include -#include /// \class FeaturesPlugin_CreateNormalToFace /// \ingroup Plugins @@ -47,16 +46,16 @@ public: } /// Attribute name for face selected. - inline static const std::string& OBJECTS_LIST_ID() + inline static const std::string& FACE_SELECTED_ID() { - static const std::string MY_OBJECTS_LIST_ID("main_objects"); - return MY_OBJECTS_LIST_ID; + static const std::string MY_FACE_ID("face"); + return MY_FACE_ID; } /// Attribute name for vertex selected. inline static const std::string& VERTEX_SELECTED_ID() { - static const std::string MY_VERTEX_SELECTED_ID("tool_objects"); + static const std::string MY_VERTEX_SELECTED_ID("vertex"); return MY_VERTEX_SELECTED_ID; } diff --git a/src/FeaturesPlugin/FeaturesPlugin_NormalToFace.cpp b/src/FeaturesPlugin/FeaturesPlugin_NormalToFace.cpp index ab98fed58..a70e8fd79 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_NormalToFace.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_NormalToFace.cpp @@ -20,7 +20,6 @@ #include "FeaturesPlugin_NormalToFace.h" #include -#include #include #include #include @@ -31,10 +30,7 @@ #include #include #include -#include #include -#include -#include #include #include #include @@ -44,16 +40,17 @@ #include #include -#include +//================================================================================================= FeaturesPlugin_NormalToFace::FeaturesPlugin_NormalToFace() { } +//================================================================================================= void FeaturesPlugin_NormalToFace::initAttributes() { // attribute for object selected - data()->addAttribute(OBJECTS_LIST_ID(), ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(FACE_SELECTED_ID(), ModelAPI_AttributeSelection::typeId()); data()->addAttribute(VERTEX_SELECTED_ID(), ModelAPI_AttributeSelection::typeId()); // attributes for result message and values data()->addAttribute(CREATENORMAL_ID(), ModelAPI_AttributeBoolean::typeId()); @@ -63,35 +60,35 @@ void FeaturesPlugin_NormalToFace::initAttributes() } +//================================================================================================= void FeaturesPlugin_NormalToFace::execute() { -AttributeSelectionPtr aSelectionFace = selection(OBJECTS_LIST_ID()); -AttributeSelectionPtr aSelectionPoint = selection(VERTEX_SELECTED_ID()); - -GeomShapePtr aShape; -GeomShapePtr aShapePoint; - if(!string(VERTEX_OPTION_ID())->value().empty()) -{ - if (aSelectionPoint && aSelectionPoint->isInitialized()) { - aShapePoint = aSelectionPoint->value(); - if (!aShapePoint && aSelectionPoint->context()) - aShapePoint = aSelectionPoint->context()->shape(); + AttributeSelectionPtr aSelectionFace = selection(FACE_SELECTED_ID()); + AttributeSelectionPtr aSelectionPoint = selection(VERTEX_SELECTED_ID()); + + GeomShapePtr aShape; + GeomShapePtr aShapePoint; + if (!string(VERTEX_OPTION_ID())->value().empty()) { + if (aSelectionPoint && aSelectionPoint->isInitialized()) { + aShapePoint = aSelectionPoint->value(); + if (!aShapePoint && aSelectionPoint->context()) + aShapePoint = aSelectionPoint->context()->shape(); } -} + } -if (aSelectionFace && aSelectionFace->isInitialized()) { - aShape = aSelectionFace->value(); - if (!aShape && aSelectionFace->context()) - aShape = aSelectionFace->context()->shape(); -} + if (aSelectionFace && aSelectionFace->isInitialized()) { + aShape = aSelectionFace->value(); + if (!aShape && aSelectionFace->context()) + aShape = aSelectionFace->context()->shape(); + } -if (aShape){ - std::string aError; - std::shared_ptr theNormal(new GeomAPI_Edge); - if( !GeomAlgoAPI_NormalToFace::normal(aShape, - aShapePoint, - theNormal, - aError)) + if (aShape) { + std::string aError; + std::shared_ptr theNormal(new GeomAPI_Edge); + if( !GeomAlgoAPI_NormalToFace::normal(aShape, + aShapePoint, + theNormal, + aError)) setError("Error in bounding box calculation :" + aError); GeomDirPtr theDir; @@ -101,26 +98,23 @@ if (aShape){ theDir = theNormal->line()->direction(); } } - aPnt->translate(theDir, 100 ); - + aPnt->translate(theDir, 100); + std::shared_ptr anEdge = - GeomAlgoAPI_EdgeBuilder::line(theNormal->firstPoint(), - aPnt); + GeomAlgoAPI_EdgeBuilder::line(theNormal->firstPoint(), aPnt); ResultConstructionPtr aConstr = document()->createConstruction(data()); aConstr->setInfinite(true); aConstr->setShape(anEdge); setResult(aConstr); } - - if(boolean(CREATENORMAL_ID())->value()) - { - if( !myCreateFeature.get() ) + + if (boolean(CREATENORMAL_ID())->value()) { + if (!myCreateFeature.get()) createNormal(); updateNormal(); - }else{ - if( myCreateFeature.get() ) - { + } else { + if (myCreateFeature.get()) { myCreateFeature->eraseResults(); SessionPtr aSession = ModelAPI_Session::get(); DocumentPtr aDoc = aSession->activeDocument(); @@ -130,10 +124,11 @@ if (aShape){ } } +//================================================================================================= void FeaturesPlugin_NormalToFace::attributeChanged(const std::string& theID) { - if (theID == OBJECTS_LIST_ID()) { - if( myCreateFeature.get() ) + if (theID == FACE_SELECTED_ID()) { + if (myCreateFeature.get()) updateNormal(); } } @@ -142,7 +137,7 @@ void FeaturesPlugin_NormalToFace::attributeChanged(const std::string& theID) void FeaturesPlugin_NormalToFace::createNormal() { SessionPtr aSession = ModelAPI_Session::get(); - + DocumentPtr aDoc = aSession->activeDocument(); if (aDoc.get()) { @@ -150,17 +145,17 @@ void FeaturesPlugin_NormalToFace::createNormal() } } +//================================================================================================= void FeaturesPlugin_NormalToFace::updateNormal() { - myCreateFeature->selection(FeaturesPlugin_CreateNormalToFace::OBJECTS_LIST_ID()) - ->setValue( selection(OBJECTS_LIST_ID())->context() , - selection(OBJECTS_LIST_ID())->value() ); + myCreateFeature->selection(FeaturesPlugin_CreateNormalToFace::FACE_SELECTED_ID()) + ->setValue( selection(FACE_SELECTED_ID())->context() , + selection(FACE_SELECTED_ID())->value() ); myCreateFeature->string(FeaturesPlugin_CreateNormalToFace::VERTEX_OPTION_ID()) ->setValue( string(VERTEX_OPTION_ID())->value()); - if(!string(VERTEX_OPTION_ID())->value().empty()) - { + if (!string(VERTEX_OPTION_ID())->value().empty()) { myCreateFeature->selection(FeaturesPlugin_CreateNormalToFace::VERTEX_SELECTED_ID()) ->setValue( selection(VERTEX_SELECTED_ID())->context() , selection(VERTEX_SELECTED_ID())->value() ); diff --git a/src/FeaturesPlugin/FeaturesPlugin_NormalToFace.h b/src/FeaturesPlugin/FeaturesPlugin_NormalToFace.h index 1b171ff9e..261b29770 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_NormalToFace.h +++ b/src/FeaturesPlugin/FeaturesPlugin_NormalToFace.h @@ -25,7 +25,6 @@ #include #include -#include /// \class FeaturesPlugin_NormalToFace /// \ingroup Plugins @@ -47,16 +46,16 @@ public: } /// Attribute name for face selected. - inline static const std::string& OBJECTS_LIST_ID() + inline static const std::string& FACE_SELECTED_ID() { - static const std::string MY_OBJECTS_LIST_ID("main_objects"); - return MY_OBJECTS_LIST_ID; + static const std::string MY_FACE_SELECTED_ID("face"); + return MY_FACE_SELECTED_ID; } /// Attribute name for vertex selected. inline static const std::string& VERTEX_SELECTED_ID() { - static const std::string MY_VERTEX_SELECTED_ID("tool_objects"); + static const std::string MY_VERTEX_SELECTED_ID("vertex"); return MY_VERTEX_SELECTED_ID; } @@ -92,7 +91,7 @@ public: private: - void createNormal(); + void createNormal(); void updateNormal(); FeaturePtr myCreateFeature; diff --git a/src/FeaturesPlugin/NormalToFace_widget.xml b/src/FeaturesPlugin/NormalToFace_widget.xml index e130762e4..a0b818a56 100644 --- a/src/FeaturesPlugin/NormalToFace_widget.xml +++ b/src/FeaturesPlugin/NormalToFace_widget.xml @@ -1,5 +1,5 @@ - - - diff --git a/src/FeaturesPlugin/Test/TestNormalToFace.py b/src/FeaturesPlugin/Test/TestNormalToFace.py new file mode 100644 index 000000000..179b2246a --- /dev/null +++ b/src/FeaturesPlugin/Test/TestNormalToFace.py @@ -0,0 +1,66 @@ +# 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 ModelAPI import * +from salome.shaper import model + + +__updated__ = "2020-11-12" + + +#========================================================================= +# test creating normal to face +#========================================================================= +def test_Normal_to_face(): + + 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() + ### Create Normal + Normal_1 = model.getNormal(Part_1_doc, model.selection("FACE", "box1_1/Shape_6")) + model.end() + + assert (len(Normal_1.results()) > 0) + assert(Normal_1.feature().error() == "") + anAxisResult = modelAPI_ResultConstruction(Normal_1.feature().firstResult()) + assert (anAxisResult is not None) + + +if __name__ == '__main__': + + test_Normal_to_face() + + #========================================================================= + # End of test + #========================================================================= diff --git a/src/FeaturesPlugin/doc/FeaturesPlugin.rst b/src/FeaturesPlugin/doc/FeaturesPlugin.rst index fb8e2a344..11cddbe42 100644 --- a/src/FeaturesPlugin/doc/FeaturesPlugin.rst +++ b/src/FeaturesPlugin/doc/FeaturesPlugin.rst @@ -24,6 +24,7 @@ Features plug-in provides a set of common topological operations. It implements importResultFeature.rst linearCopyFeature.rst measurementFeature.rst + normalToFaceFeature.rst pipeFeature.rst placementFeature.rst recoverFeature.rst diff --git a/src/FeaturesPlugin/doc/TUI_NormalToFaceFeature.rst b/src/FeaturesPlugin/doc/TUI_NormalToFaceFeature.rst new file mode 100644 index 000000000..eb8b036f8 --- /dev/null +++ b/src/FeaturesPlugin/doc/TUI_NormalToFaceFeature.rst @@ -0,0 +1,22 @@ + + .. _tui_create_Normal_To_Face: + +Create Normal to a face +======================= + +.. literalinclude:: examples/createNormalToFace.py + :linenos: + :language: python + +:download:`Download this script ` + + .. _tui_create_Normal_To_Face_At_Vertex: + +Create Normal to a face at vertex +================================= + +.. literalinclude:: examples/createNormalToFaceAtVertex.py + :linenos: + :language: python + +:download:`Download this script ` \ No newline at end of file diff --git a/src/FeaturesPlugin/doc/examples/createNormalToFace.py b/src/FeaturesPlugin/doc/examples/createNormalToFace.py new file mode 100644 index 000000000..a1f973011 --- /dev/null +++ b/src/FeaturesPlugin/doc/examples/createNormalToFace.py @@ -0,0 +1,15 @@ +from salome.shaper import model +import os + +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() + +### Create BoundingBox +Normal_1 = model.getNormal(Part_1_doc, model.selection("FACE", "box1_1/Shape_6")) +model.do() +model.end() diff --git a/src/FeaturesPlugin/doc/examples/createNormalToFaceAtVertex.py b/src/FeaturesPlugin/doc/examples/createNormalToFaceAtVertex.py new file mode 100644 index 000000000..c59aa67c5 --- /dev/null +++ b/src/FeaturesPlugin/doc/examples/createNormalToFaceAtVertex.py @@ -0,0 +1,17 @@ + +from salome.shaper import model +import os + +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() + +### Create BoundingBox +Normal_1 = model.getNormal(Part_1_doc, model.selection("FACE", "box1_1/Shape_6"), + model.selection("VERTEX", "[box1_1/Shape_2][box1_1/Shape_4][box1_1/Shape_6]")) +model.do() +model.end() diff --git a/src/FeaturesPlugin/doc/images/normal.png b/src/FeaturesPlugin/doc/images/normal.png new file mode 100644 index 000000000..16080764e Binary files /dev/null and b/src/FeaturesPlugin/doc/images/normal.png differ diff --git a/src/FeaturesPlugin/doc/images/normalToFacePropertyPanel.png b/src/FeaturesPlugin/doc/images/normalToFacePropertyPanel.png new file mode 100644 index 000000000..6ed5e8095 Binary files /dev/null and b/src/FeaturesPlugin/doc/images/normalToFacePropertyPanel.png differ diff --git a/src/FeaturesPlugin/doc/images/normalToFaceResult.png b/src/FeaturesPlugin/doc/images/normalToFaceResult.png new file mode 100644 index 000000000..ecfb260ab Binary files /dev/null and b/src/FeaturesPlugin/doc/images/normalToFaceResult.png differ diff --git a/src/FeaturesPlugin/doc/images/normalToFaceResultwithVertex.png b/src/FeaturesPlugin/doc/images/normalToFaceResultwithVertex.png new file mode 100644 index 000000000..98f1aa8ed Binary files /dev/null and b/src/FeaturesPlugin/doc/images/normalToFaceResultwithVertex.png differ diff --git a/src/FeaturesPlugin/doc/normalToFaceFeature.rst b/src/FeaturesPlugin/doc/normalToFaceFeature.rst new file mode 100644 index 000000000..b4f9b16b2 --- /dev/null +++ b/src/FeaturesPlugin/doc/normalToFaceFeature.rst @@ -0,0 +1,71 @@ +.. |normalToFace.icon| image:: images/normal.png + +Normal to a face +================ + +The **Normal to a face** feature displays the normal to a face. A vertex can be specified to indicate the position of the normal else the center of face is used. + +the resulting normal can be created via a dedicated check-box **Create normal**. If this last is checked corresponding result and feature would be created. + +If the check-box **Create normal** isn't checked, **Apply** button does not generate any result and has the same effect as **Cancel** for this feature. + +To display the normal to a face in the active part: + +#. select in the Main Menu *Inspection - > Normal to a face* item or +#. click |normalToFace.icon| **Normal to a face** button in the toolbar + +The property panel is shown below. + +.. figure:: images/normalToFacePropertyPanel.png + :align: center + + Normal to a face + + +Input fields: + +- **Face** contains face selected in 3D OCC viewer or object browser. +- **Vertex** contains optionnal vertex selected in 3D OCC viewer or object browser. +- **Create normal** check-box allow the creation of the normal (result and feature). + +**TUI Command**: + +.. py:function:: model.getNormal(Part, face) + + :param part: The current part object. + :param object: A face in format *model.selection("FACE", face)*. + :return: Created normal to a face at center. + +Result +"""""" + +Result of **Normal to a face**. + +.. figure:: images/normalToFaceResult.png + :align: center + + Normal to a face + +**See Also** a sample TUI Script of :ref:`tui_create_Normal_To_Face` operation. + + +**TUI Command**: + +.. py:function:: model.getNormal(Part, face, vertex) + + :param part: The current part object. + :param object: A face in format *model.selection("FACE", face)*. + :param object: A vertex in format *model.selection("VERTEX", vertex)*. + :return: Created normal to a face at vertex. + +Result +"""""" + +Result of **Normal to aface** where **Vertex** is selecteted. + +.. figure:: images/normalToFaceResultwithVertex.png + :align: center + + Normal to a face at vertex + +**See Also** a sample TUI Script of :ref:`tui_create_Normal_To_Face_At_Vertex` operation. \ No newline at end of file diff --git a/src/FeaturesPlugin/plugin-Features.xml b/src/FeaturesPlugin/plugin-Features.xml index 3e17f562a..4a480d18f 100644 --- a/src/FeaturesPlugin/plugin-Features.xml +++ b/src/FeaturesPlugin/plugin-Features.xml @@ -180,11 +180,11 @@ + icon="icons/Features/normale.png" helpfile="normalToFaceFeature.html"> + icon="icons/Features/axis.png" helpfile="normalToFaceFeature.html" internal="1">