From 1d4c921e931c993671c86580b87ee134dc38a91b Mon Sep 17 00:00:00 2001 From: akl Date: Fri, 15 Feb 2013 12:00:51 +0000 Subject: [PATCH] Fix GEOM examples scripts. --- doc/salome/examples/Makefile.am | 14 +++++++------- doc/salome/examples/blocks_operations_ex03.py | 2 +- doc/salome/examples/complex_objs_ex06.py | 13 +++++++++---- doc/salome/examples/primitives_ex06.py | 4 ++-- doc/salome/examples/repairing_operations_ex05.py | 12 ++++++------ doc/salome/examples/repairing_operations_ex09.py | 1 + doc/salome/examples/viewing_geom_objs_ex04.py | 3 ++- 7 files changed, 28 insertions(+), 21 deletions(-) diff --git a/doc/salome/examples/Makefile.am b/doc/salome/examples/Makefile.am index d058efcc5..10fa6cba4 100644 --- a/doc/salome/examples/Makefile.am +++ b/doc/salome/examples/Makefile.am @@ -29,14 +29,8 @@ pyexamplesdir = $(docdir)/examples/GEOM BAD_TESTS = \ 3dsketcher.py \ angle.py \ - blocks_operations_ex03.py \ complex_objs_ex06.py \ - free_boundaries.py \ - import_export.py \ - primitives_ex06.py \ - repairing_operations_ex05.py \ - repairing_operations_ex09.py \ - viewing_geom_objs_ex04.py + repairing_operations_ex09.py GOOD_TESTS = \ advanced_geom_objs_ex01.py \ @@ -57,6 +51,7 @@ GOOD_TESTS = \ basic_properties.py \ blocks_operations_ex01.py \ blocks_operations_ex02.py \ + blocks_operations_ex03.py \ boolean_operations_ex01.py \ boolean_operations_ex02.py \ boolean_operations_ex03.py \ @@ -77,8 +72,10 @@ GOOD_TESTS = \ complex_objs_ex08.py \ complex_objs_ex09.py \ complex_objs_ex10.py \ + free_boundaries.py \ free_faces.py \ get_non_blocks.py \ + import_export.py \ inertia.py \ min_distance.py \ normal_face.py \ @@ -89,11 +86,13 @@ GOOD_TESTS = \ primitives_ex03.py \ primitives_ex04.py \ primitives_ex05.py \ + primitives_ex06.py \ primitives_ex07.py \ repairing_operations_ex01.py \ repairing_operations_ex02.py \ repairing_operations_ex03.py \ repairing_operations_ex04.py \ + repairing_operations_ex05.py \ repairing_operations_ex06.py \ repairing_operations_ex07.py \ repairing_operations_ex08.py \ @@ -123,6 +122,7 @@ GOOD_TESTS = \ viewing_geom_objs_ex01.py \ viewing_geom_objs_ex02.py \ viewing_geom_objs_ex03.py \ + viewing_geom_objs_ex04.py \ whatis.py \ working_with_groups_ex01.py \ working_with_groups_ex02.py \ diff --git a/doc/salome/examples/blocks_operations_ex03.py b/doc/salome/examples/blocks_operations_ex03.py index 546bc2274..268a52e10 100644 --- a/doc/salome/examples/blocks_operations_ex03.py +++ b/doc/salome/examples/blocks_operations_ex03.py @@ -4,7 +4,7 @@ import geompy import salome # create a box -box = geompy.MakeBoxDXDYDZ(200, 200, 200) +check_box = geompy.MakeBoxDXDYDZ(200, 200, 200) # build all possible propagation groups listChains = geompy.Propagate(check_box) diff --git a/doc/salome/examples/complex_objs_ex06.py b/doc/salome/examples/complex_objs_ex06.py index a836b35fc..8f6c4e35a 100644 --- a/doc/salome/examples/complex_objs_ex06.py +++ b/doc/salome/examples/complex_objs_ex06.py @@ -7,14 +7,19 @@ gg = salome.ImportComponentGUI("GEOM") # create path WirePath = geompy.MakeSketcher("Sketcher:F 0 0:TT 100 0:R 0:C 100 90:T 0 200", [0, 0, 0, 0, 0, 1, 1, 0, -0]) +# get sub-shapes +edges = geompy.SubShapeAll(WirePath, geompy.ShapeType["EDGE"]) +vertices = geompy.SubShapeAll(WirePath, geompy.ShapeType["VERTEX"]) + + #======================================================= # Create shell sections #======================================================= -ps = [Vertex_1,Vertex_2,Vertex_3,Vertex_4] -theLocations = [Vertex_1, Vertex_2, Vertex_3, Vertex_4] +ps = [vertices[0],vertices[1],vertices[2],vertices[3]] +theLocations = [vertices[0],vertices[1],vertices[2],vertices[3]] VC = geompy.MakeCompound(theLocations) geompy.addToStudy(VC,"VC") -vs = [Edge_1,Edge_1,Edge_3,Edge_3] +vs = [edges[0],edges[0],edges[2],edges[2]] hs = [20,40,30,20] shells = [] subbases = [] @@ -50,7 +55,7 @@ faces = [] w = geompy.MakeSketcher("Sketcher:F 20 20:TT 0 20:TT 0 0:TT 20 0", [c1[0], c1[1], c1[2], nx, ny, nz, 0, 0, 1]) [e1,e2,e3] = geompy.SubShapeAll(w, geompy.ShapeType["EDGE"]) -arc = MakeArc(w,3,-1) +arc = geompy.MakeArc(w,3,-1) w = geompy.MakeWire([e1,e2,e3,arc]) f1 = geompy.MakeFace(w,1) diff --git a/doc/salome/examples/primitives_ex06.py b/doc/salome/examples/primitives_ex06.py index c558eafb8..d3fd53e35 100644 --- a/doc/salome/examples/primitives_ex06.py +++ b/doc/salome/examples/primitives_ex06.py @@ -31,5 +31,5 @@ id_disk3 = geompy.addToStudy(disk3,"Disk3") # display disks gg.createAndDisplayGO(id_vxy) gg.createAndDisplayGO(id_disk1) -gg.createAndDisplayGO(id_diks2) -gg.createAndDisplayGO(id_diks3) +gg.createAndDisplayGO(id_disk2) +gg.createAndDisplayGO(id_disk3) diff --git a/doc/salome/examples/repairing_operations_ex05.py b/doc/salome/examples/repairing_operations_ex05.py index f6593b3e8..280499177 100644 --- a/doc/salome/examples/repairing_operations_ex05.py +++ b/doc/salome/examples/repairing_operations_ex05.py @@ -28,13 +28,13 @@ f_2 = geompy.GetSubShapeID(cut, faces[2]) # remove one face from the shape cut_without_f_2 = geompy.SuppressFaces(cut, [f_2]) -# get wires as sub-shapes -wires = [] -wires = geompy.SubShapeAllSortedCentres(cut_without_f_2, geompy.ShapeType["WIRE"]) -w_0 = geompy.GetSubShapeID(cut_without_f_2, wires[0]) +# get edges as sub-shapes +edges = [] +edges = geompy.SubShapeAllSortedCentres(cut_without_f_2, geompy.ShapeType["EDGE"]) +e_2 = geompy.GetSubShapeID(cut_without_f_2, edges[2]) -# suppress the selected wire -result = geompy.SuppressHoles(cut_without_f_2, [w_0]) +# suppress a hole using the selected edge +result = geompy.SuppressHoles(cut_without_f_2, [e_2]) # add objects in the study id_cut = geompy.addToStudy(cut, "Cut") diff --git a/doc/salome/examples/repairing_operations_ex09.py b/doc/salome/examples/repairing_operations_ex09.py index 41807fee4..7bb548758 100644 --- a/doc/salome/examples/repairing_operations_ex09.py +++ b/doc/salome/examples/repairing_operations_ex09.py @@ -1,6 +1,7 @@ # Limit Tolerance import geompy +import salome gg = salome.ImportComponentGUI("GEOM") # import initial topology diff --git a/doc/salome/examples/viewing_geom_objs_ex04.py b/doc/salome/examples/viewing_geom_objs_ex04.py index cf521f407..f31edefee 100644 --- a/doc/salome/examples/viewing_geom_objs_ex04.py +++ b/doc/salome/examples/viewing_geom_objs_ex04.py @@ -2,8 +2,9 @@ import salome import geompy +import GEOM -texture = geompy.LoadTexture("/users/user/mytexture.dat") +texture = geompy.LoadTexture(os.getenv("DATA_DIR")+"/Textures/texture1.dat") v1 = geompy.MakeVertex(0, 0, 0) v2 = geompy.MakeVertex(100, 0, 0) -- 2.39.2