From: Nicolas RECHATIN Date: Thu, 24 Jun 2021 11:50:50 +0000 (+0200) Subject: fix plugin-Features.xml and CMakeLists.txt X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c6d79c884ee8481af73a21527c183bbefa29ceee;p=modules%2Fshaper.git fix plugin-Features.xml and CMakeLists.txt patch TestNormalToFace.py add doc/example/createNormalToFace.py and createNormalToFaceAtVertex.py --- diff --git a/doc/examples/createNormalToFace.py b/doc/examples/createNormalToFace.py new file mode 100644 index 000000000..c89e07c6b --- /dev/null +++ b/doc/examples/createNormalToFace.py @@ -0,0 +1,12 @@ +from salome.shaper import model +import os + +model.begin() +Box_1 = model.addBox(Part_1_doc, 10, 10, 10) +model.do() + +### Create BoundingBox +Normal_1 = model.getNormal(Part_1_doc, model.selection("FACE", "Box_1_1/Top")) +model.do() + +model.end() diff --git a/doc/examples/createNormalToFaceAtVertex.py b/doc/examples/createNormalToFaceAtVertex.py new file mode 100644 index 000000000..eb0071efb --- /dev/null +++ b/doc/examples/createNormalToFaceAtVertex.py @@ -0,0 +1,12 @@ + +from salome.shaper import model +import os + +model.begin() +Box_1 = model.addBox(Part_1_doc, 10, 10, 10) +model.do() + +Normal_1 = model.getNormal(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Bottom]")) +model.do() + +model.end() diff --git a/src/FeaturesPlugin/Test/TestNormalToFace.py b/src/FeaturesPlugin/Test/TestNormalToFace.py index ad70044d9..51ed2424c 100644 --- a/src/FeaturesPlugin/Test/TestNormalToFace.py +++ b/src/FeaturesPlugin/Test/TestNormalToFace.py @@ -34,33 +34,44 @@ from salome.shaper import model __updated__ = "2020-11-12" - #========================================================================= -# test creating normal to face +# Initialization of the test #========================================================================= -def test_Normal_to_face(): +model.begin() +partSet = model.moduleDocument() + +### Create Part +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() - 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() +### Create Box +Box_1 = model.addBox(Part_1_doc, 10, 10, 10) +model.do() + +#========================================================================= +# Test 1. Create a normal to a face with only a face +#========================================================================= +Normal_1 = model.getNormal(Part_1_doc, model.selection("FACE", "Box_1_1/Top")) +model.do() - assert (len(Normal_1.results()) > 0) - assert(Normal_1.feature().error() == "") - anAxisResult = modelAPI_ResultConstruction(Normal_1.feature().firstResult()) - assert (anAxisResult is not None) +#========================================================================= +# Test 2. Create a normal to a face with a face and a vertex +#========================================================================= +Normal_2 = model.getNormal(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Bottom]")) +model.do() +model.end() -if __name__ == '__main__': +assert (len(Normal_1.results()) > 0) +assert(Normal_1.feature().error() == "") +anAxisResult = modelAPI_ResultConstruction(Normal_1.feature().firstResult()) +assert (anAxisResult is not None) - test_Normal_to_face() +assert (len(Normal_2.results()) > 0) +assert(Normal_2.feature().error() == "") +anAxisResult = modelAPI_ResultConstruction(Normal_2.feature().firstResult()) +assert (anAxisResult is not None) - #========================================================================= - # End of test - #========================================================================= +#========================================================================= +# End of test +#========================================================================= diff --git a/src/FeaturesPlugin/plugin-Features.xml b/src/FeaturesPlugin/plugin-Features.xml index 9092142dc..9de64b96e 100644 --- a/src/FeaturesPlugin/plugin-Features.xml +++ b/src/FeaturesPlugin/plugin-Features.xml @@ -126,7 +126,7 @@ + icon="icons/Features/fillet.png" auto_preview="true" helpfile="filletFeature.html"> + icon="icons/Features/fusion_faces.png" auto_preview="true" helpfile="fusionFacesFeature.html">