From dd2ea7185d49ba062061b3b2fadf2ec69be8e772 Mon Sep 17 00:00:00 2001 From: jfa Date: Wed, 13 Jul 2022 14:00:31 +0300 Subject: [PATCH] Add test --- test/test_point_cloud_on_face.py | 34 ++++++++++++++++++++++++++++++++ test/tests.set | 1 + 2 files changed, 35 insertions(+) create mode 100644 test/test_point_cloud_on_face.py diff --git a/test/test_point_cloud_on_face.py b/test/test_point_cloud_on_face.py new file mode 100644 index 000000000..d31d6536a --- /dev/null +++ b/test/test_point_cloud_on_face.py @@ -0,0 +1,34 @@ +# Point Cloud on Face + +import math +import salome +salome.salome_init_without_session() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New() + +# create spherical face +Sphere = geompy.MakeSphereR(10, "Sphere") +[Face] = geompy.ExtractShapes(Sphere, geompy.ShapeType["FACE"], True, "Sphere_face") + +# make a cloud of 100 points on the spherical face +CompoundOfVertices = geompy.MakeVertexInsideFace(Face, 100, "CompoundOfVertices") + +# check result +nb_vert = geompy.NumberOfSubShapes(CompoundOfVertices, geompy.ShapeType["VERTEX"]) +assert(geompy.NumberOfSubShapes(CompoundOfVertices, geompy.ShapeType["VERTEX"]) == 100) + +# test point cloud on a "Horse saddle" +OX = geompy.MakeVectorDXDYDZ(1, 0, 0, 'OX') +OY = geompy.MakeVectorDXDYDZ(0, 1, 0, 'OY') +[Edge_1,Edge_2,Edge_3] = geompy.ExtractShapes(Sphere, geompy.ShapeType["EDGE"], True, "Edge") +Rotation_1 = geompy.MakeRotation(Edge_3, OX, 90*math.pi/180.0, 'Rotation_1') +Rotation_2 = geompy.MakeRotation(Rotation_1, OY, 180*math.pi/180.0, 'Rotation_2') +Translation_1 = geompy.MakeTranslation(Rotation_2, 200, 0, 0, 'Translation_1') +Translation_2 = geompy.MakeTranslation(Edge_3, 100, 100, 0, 'Translation_2') +Translation_3 = geompy.MakeTranslation(Translation_2, 0, -200, 0, 'Translation_3') +Filling_1 = geompy.MakeFilling([Translation_2, Edge_3, Translation_3]) +geompy.addToStudy(Filling_1, 'Filling_1') + +PointCloudOnFilling = geompy.MakeVertexInsideFace(Face, 30, "PointCloudOnFilling") +assert(geompy.NumberOfSubShapes(PointCloudOnFilling, geompy.ShapeType["VERTEX"]) == 30) diff --git a/test/tests.set b/test/tests.set index f9d399eff..761c34213 100644 --- a/test/tests.set +++ b/test/tests.set @@ -19,4 +19,5 @@ SET(ALL_TESTS test_perf_01.py + test_point_cloud_on_face.py ) -- 2.39.2