]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
0021895: EDF 2372 GEOM SMESH : Generate the doc examples from real python scripts
authorakl <akl@opencascade.com>
Fri, 8 Feb 2013 14:23:51 +0000 (14:23 +0000)
committerakl <akl@opencascade.com>
Fri, 8 Feb 2013 14:23:51 +0000 (14:23 +0000)
139 files changed:
configure.ac
doc/salome/Makefile.am
doc/salome/examples/3dsketcher.py [new file with mode: 0644]
doc/salome/examples/Makefile.am [new file with mode: 0644]
doc/salome/examples/advanced_geom_objs_ex01.py [new file with mode: 0644]
doc/salome/examples/advanced_geom_objs_ex02.py [new file with mode: 0644]
doc/salome/examples/advanced_geom_objs_ex03.py [new file with mode: 0644]
doc/salome/examples/angle.py [new file with mode: 0644]
doc/salome/examples/basic_geom_objs_ex01.py [new file with mode: 0644]
doc/salome/examples/basic_geom_objs_ex02.py [new file with mode: 0644]
doc/salome/examples/basic_geom_objs_ex03.py [new file with mode: 0644]
doc/salome/examples/basic_geom_objs_ex04.py [new file with mode: 0644]
doc/salome/examples/basic_geom_objs_ex05.py [new file with mode: 0644]
doc/salome/examples/basic_geom_objs_ex06.py [new file with mode: 0644]
doc/salome/examples/basic_geom_objs_ex07.py [new file with mode: 0644]
doc/salome/examples/basic_geom_objs_ex08.py [new file with mode: 0644]
doc/salome/examples/basic_geom_objs_ex09.py [new file with mode: 0644]
doc/salome/examples/basic_operations_ex01.py [new file with mode: 0644]
doc/salome/examples/basic_operations_ex02.py [new file with mode: 0644]
doc/salome/examples/basic_operations_ex03.py [new file with mode: 0644]
doc/salome/examples/basic_properties.py [new file with mode: 0644]
doc/salome/examples/blocks_operations_ex01.py [new file with mode: 0644]
doc/salome/examples/blocks_operations_ex02.py [new file with mode: 0644]
doc/salome/examples/blocks_operations_ex03.py [new file with mode: 0644]
doc/salome/examples/boolean_operations_ex01.py [new file with mode: 0644]
doc/salome/examples/boolean_operations_ex02.py [new file with mode: 0644]
doc/salome/examples/boolean_operations_ex03.py [new file with mode: 0644]
doc/salome/examples/boolean_operations_ex04.py [new file with mode: 0644]
doc/salome/examples/bounding_box.py [new file with mode: 0644]
doc/salome/examples/building_by_blocks_ex01.py [new file with mode: 0644]
doc/salome/examples/building_by_blocks_ex02.py [new file with mode: 0644]
doc/salome/examples/center_of_mass.py [new file with mode: 0644]
doc/salome/examples/check_compound_of_blocks.py [new file with mode: 0644]
doc/salome/examples/check_self_intersections.py [new file with mode: 0644]
doc/salome/examples/check_shape.py [new file with mode: 0644]
doc/salome/examples/complex_objs_ex01.py [new file with mode: 0644]
doc/salome/examples/complex_objs_ex02.py [new file with mode: 0644]
doc/salome/examples/complex_objs_ex03.py [new file with mode: 0644]
doc/salome/examples/complex_objs_ex04.py [new file with mode: 0644]
doc/salome/examples/complex_objs_ex05.py [new file with mode: 0644]
doc/salome/examples/complex_objs_ex06.py [new file with mode: 0644]
doc/salome/examples/complex_objs_ex07.py [new file with mode: 0644]
doc/salome/examples/complex_objs_ex08.py [new file with mode: 0644]
doc/salome/examples/complex_objs_ex09.py [new file with mode: 0644]
doc/salome/examples/complex_objs_ex10.py [new file with mode: 0644]
doc/salome/examples/free_boundaries.py [new file with mode: 0644]
doc/salome/examples/free_faces.py [new file with mode: 0644]
doc/salome/examples/get_non_blocks.py [new file with mode: 0644]
doc/salome/examples/import_export.py [new file with mode: 0644]
doc/salome/examples/inertia.py [new file with mode: 0644]
doc/salome/examples/min_distance.py [new file with mode: 0644]
doc/salome/examples/normal_face.py [new file with mode: 0644]
doc/salome/examples/notebook_geom.py [new file with mode: 0644]
doc/salome/examples/point_coordinates.py [new file with mode: 0644]
doc/salome/examples/primitives_ex01.py [new file with mode: 0644]
doc/salome/examples/primitives_ex02.py [new file with mode: 0644]
doc/salome/examples/primitives_ex03.py [new file with mode: 0644]
doc/salome/examples/primitives_ex04.py [new file with mode: 0644]
doc/salome/examples/primitives_ex05.py [new file with mode: 0644]
doc/salome/examples/primitives_ex06.py [new file with mode: 0644]
doc/salome/examples/primitives_ex07.py [new file with mode: 0644]
doc/salome/examples/repairing_operations_ex01.py [new file with mode: 0644]
doc/salome/examples/repairing_operations_ex02.py [new file with mode: 0644]
doc/salome/examples/repairing_operations_ex03.py [new file with mode: 0644]
doc/salome/examples/repairing_operations_ex04.py [new file with mode: 0644]
doc/salome/examples/repairing_operations_ex05.py [new file with mode: 0644]
doc/salome/examples/repairing_operations_ex06.py [new file with mode: 0644]
doc/salome/examples/repairing_operations_ex07.py [new file with mode: 0644]
doc/salome/examples/repairing_operations_ex08.py [new file with mode: 0644]
doc/salome/examples/repairing_operations_ex09.py [new file with mode: 0644]
doc/salome/examples/repairing_operations_ex10.py [new file with mode: 0644]
doc/salome/examples/repairing_operations_ex11.py [new file with mode: 0644]
doc/salome/examples/sketcher.py [new file with mode: 0644]
doc/salome/examples/testme.py [new file with mode: 0755]
doc/salome/examples/tolerance.py [new file with mode: 0644]
doc/salome/examples/topological_geom_objs_ex01.py [new file with mode: 0644]
doc/salome/examples/topological_geom_objs_ex02.py [new file with mode: 0644]
doc/salome/examples/topological_geom_objs_ex03.py [new file with mode: 0644]
doc/salome/examples/topological_geom_objs_ex04.py [new file with mode: 0644]
doc/salome/examples/topological_geom_objs_ex05.py [new file with mode: 0644]
doc/salome/examples/topological_geom_objs_ex06.py [new file with mode: 0644]
doc/salome/examples/transformation_operations_ex01.py [new file with mode: 0644]
doc/salome/examples/transformation_operations_ex02.py [new file with mode: 0644]
doc/salome/examples/transformation_operations_ex03.py [new file with mode: 0644]
doc/salome/examples/transformation_operations_ex04.py [new file with mode: 0644]
doc/salome/examples/transformation_operations_ex05.py [new file with mode: 0644]
doc/salome/examples/transformation_operations_ex06.py [new file with mode: 0644]
doc/salome/examples/transformation_operations_ex07.py [new file with mode: 0644]
doc/salome/examples/transformation_operations_ex08.py [new file with mode: 0644]
doc/salome/examples/transformation_operations_ex09.py [new file with mode: 0644]
doc/salome/examples/transformation_operations_ex10.py [new file with mode: 0644]
doc/salome/examples/transformation_operations_ex11.py [new file with mode: 0644]
doc/salome/examples/transformation_operations_ex12.py [new file with mode: 0644]
doc/salome/examples/transformation_operations_ex13.py [new file with mode: 0644]
doc/salome/examples/viewing_geom_objs_ex01.py [new file with mode: 0644]
doc/salome/examples/viewing_geom_objs_ex02.py [new file with mode: 0644]
doc/salome/examples/viewing_geom_objs_ex03.py [new file with mode: 0644]
doc/salome/examples/viewing_geom_objs_ex04.py [new file with mode: 0644]
doc/salome/examples/whatis.py [new file with mode: 0644]
doc/salome/examples/working_with_groups_ex01.py [new file with mode: 0644]
doc/salome/examples/working_with_groups_ex02.py [new file with mode: 0644]
doc/salome/examples/working_with_groups_ex03.py [new file with mode: 0644]
doc/salome/examples/working_with_groups_ex04.py [new file with mode: 0644]
doc/salome/examples/working_with_groups_ex05.py [new file with mode: 0644]
doc/salome/examples/working_with_groups_ex06.py [new file with mode: 0644]
doc/salome/gui/GEOM/doxyfile.in
doc/salome/gui/GEOM/input/tui_3dsketcher.doc
doc/salome/gui/GEOM/input/tui_advanced_geom_objs.doc
doc/salome/gui/GEOM/input/tui_angle.doc
doc/salome/gui/GEOM/input/tui_basic_geom_objs.doc
doc/salome/gui/GEOM/input/tui_basic_operations.doc
doc/salome/gui/GEOM/input/tui_basic_properties.doc
doc/salome/gui/GEOM/input/tui_blocks_operations.doc
doc/salome/gui/GEOM/input/tui_boolean_operations.doc
doc/salome/gui/GEOM/input/tui_bounding_box.doc
doc/salome/gui/GEOM/input/tui_building_by_blocks.doc
doc/salome/gui/GEOM/input/tui_center_of_mass.doc
doc/salome/gui/GEOM/input/tui_check_compound_of_blocks.doc
doc/salome/gui/GEOM/input/tui_check_self_intersections.doc
doc/salome/gui/GEOM/input/tui_check_shape.doc
doc/salome/gui/GEOM/input/tui_complex_objs.doc
doc/salome/gui/GEOM/input/tui_free_boundaries.doc
doc/salome/gui/GEOM/input/tui_free_faces.doc
doc/salome/gui/GEOM/input/tui_get_non_blocks.doc
doc/salome/gui/GEOM/input/tui_import_export.doc
doc/salome/gui/GEOM/input/tui_inertia.doc
doc/salome/gui/GEOM/input/tui_min_distance.doc
doc/salome/gui/GEOM/input/tui_normal_face.doc
doc/salome/gui/GEOM/input/tui_notebook_geom.doc
doc/salome/gui/GEOM/input/tui_point_coordinates.doc
doc/salome/gui/GEOM/input/tui_primitives.doc
doc/salome/gui/GEOM/input/tui_repairing_operations.doc
doc/salome/gui/GEOM/input/tui_sketcher.doc
doc/salome/gui/GEOM/input/tui_tolerance.doc
doc/salome/gui/GEOM/input/tui_topological_geom_objs.doc
doc/salome/gui/GEOM/input/tui_transformation_operations.doc
doc/salome/gui/GEOM/input/tui_viewing_geom_objs.doc
doc/salome/gui/GEOM/input/tui_whatis.doc
doc/salome/gui/GEOM/input/tui_working_with_groups.doc

index e249b1f5ddeacef85b48623800956f1b8cda738a..d96257fdce09c0182355d006612d2377ff9c8fe8 100644 (file)
@@ -476,6 +476,7 @@ AC_OUTPUT([ \
   doc/docutils/Makefile \
   doc/docutils/conf.py \
   doc/salome/Makefile \
+  doc/salome/examples/Makefile \
   doc/salome/gui/Makefile \
   doc/salome/gui/GEOM/Makefile \
   doc/salome/gui/GEOM/doxyfile \
index 0ce3f816bb05be752b62c77a2bf8931f13c4ccdb..18bd139603c75ba23d0cff88af6b06bea4bd58a6 100644 (file)
@@ -22,7 +22,7 @@
 # Date : 30/11/2001
 # Modified by : Alexander BORODIN (OCN) - autotools usage
 #
-SUBDIRS = tui gui
+SUBDIRS = tui gui examples
 SUBDIRSTUI = tui
 SUBDIRSGUI = gui
 
diff --git a/doc/salome/examples/3dsketcher.py b/doc/salome/examples/3dsketcher.py
new file mode 100644 (file)
index 0000000..84dc281
--- /dev/null
@@ -0,0 +1,43 @@
+# 3D Sketcher
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# Create a 3D sketcher (wire) on the given points coordinates
+sketcher1 = geompy.Make3DSketcher([ 0,0,0, 50,50,50, 0,50,0, 50,0,50, 10,20,100, 0,0,0 ])
+
+# add object in the study
+id_sketcher1 = geompy.addToStudy(sketcher1, "Sketcher1")
+
+# display the sketcher
+gg.createAndDisplayGO(id_sketcher1)
+
+# Create a 3D sketcher (wire) with Sketcher3D interface
+
+# get the interface instance
+sk = geompy.Sketcher3D()
+
+# add three points with absolute coordinates
+# the first point will be the start point of sketcher
+# two segments will be added by this command
+sk.addPointsAbsolute(1,2,3, 7,0,0, 10,-3.5,-11)
+
+# add one segment, defined by two angles in "OXY" coordinate system and length
+sk.addPointAnglesLength("OXY", 45, 0, 100)
+
+# add three points with relative coordinates
+# three segments will be added by this command
+sk.addPointsRelative(20,0,0, 20,0,100, -40,0,-50)
+
+# set to close the sketcher
+sk.close()
+
+# obtain the sketcher result
+sketcher2 = sk.wire()
+
+# add object in the study
+id_sketcher2 = geompy.addToStudy(sketcher2, "Sketcher2")
+
+# display the sketcher
+gg.createAndDisplayGO(id_sketcher2)
diff --git a/doc/salome/examples/Makefile.am b/doc/salome/examples/Makefile.am
new file mode 100644 (file)
index 0000000..1174f01
--- /dev/null
@@ -0,0 +1,141 @@
+# Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# 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.
+#
+# 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
+#
+
+#  File   : Makefile
+#  Author : Alexander KOVALEV (Open Cascade NN)
+#  Modified by : 
+#  Module : doc
+#
+include $(top_srcdir)/adm_local/unix/make_common_starter.am
+
+pyexamplesdir = $(docdir)/examples/GEOM
+
+BAD_TESTS = 
+
+GOOD_TESTS = \
+       3dsketcher.py \
+       advanced_geom_objs_ex01.py \
+       advanced_geom_objs_ex02.py \
+       advanced_geom_objs_ex03.py \
+       angle.py \
+       basic_geom_objs_ex01.py \
+       basic_geom_objs_ex02.py \
+       basic_geom_objs_ex03.py \
+       basic_geom_objs_ex04.py \
+       basic_geom_objs_ex05.py \
+       basic_geom_objs_ex06.py \
+       basic_geom_objs_ex07.py \
+       basic_geom_objs_ex08.py \
+       basic_geom_objs_ex09.py \
+       basic_operations_ex01.py \
+       basic_operations_ex02.py \
+       basic_operations_ex03.py \
+       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 \
+       boolean_operations_ex04.py \
+       bounding_box.py \
+       building_by_blocks_ex01.py \
+       building_by_blocks_ex02.py \
+       center_of_mass.py \
+       check_compound_of_blocks.py \
+       check_self_intersections.py \
+       check_shape.py \
+       complex_objs_ex01.py \
+       complex_objs_ex02.py \
+       complex_objs_ex03.py \
+       complex_objs_ex04.py \
+       complex_objs_ex05.py \
+       complex_objs_ex06.py \
+       complex_objs_ex07.py \
+       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 \
+       notebook_geom.py \
+       point_coordinates.py \
+       primitives_ex01.py \
+       primitives_ex02.py \
+       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 \
+       repairing_operations_ex09.py \
+       repairing_operations_ex10.py \
+       repairing_operations_ex11.py \
+       sketcher.py \
+       tolerance.py \
+       topological_geom_objs_ex01.py \
+       topological_geom_objs_ex02.py \
+       topological_geom_objs_ex03.py \
+       topological_geom_objs_ex04.py \
+       topological_geom_objs_ex05.py \
+       topological_geom_objs_ex06.py \
+       transformation_operations_ex01.py \
+       transformation_operations_ex02.py \
+       transformation_operations_ex03.py \
+       transformation_operations_ex04.py \
+       transformation_operations_ex05.py \
+       transformation_operations_ex06.py \
+       transformation_operations_ex07.py \
+       transformation_operations_ex08.py \
+       transformation_operations_ex09.py \
+       transformation_operations_ex10.py \
+       transformation_operations_ex11.py \
+       transformation_operations_ex12.py \
+       transformation_operations_ex13.py \
+       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 \
+       working_with_groups_ex03.py \
+       working_with_groups_ex04.py \
+       working_with_groups_ex05.py \
+       working_with_groups_ex06.py
+
+pyexamples_SCRIPTS = $(BAD_TESTS) $(GOOD_TESTS)
+
+EXTRA_DIST += $(pyexamples_SCRIPTS) testme.py
+
+check-local:
+       @for f in $(GOOD_TESTS) ; do \
+         python $(top_srcdir)/doc/salome/examples/testme.py $(top_srcdir)/doc/salome/examples/$$f || exit 1; \
+       done
diff --git a/doc/salome/examples/advanced_geom_objs_ex01.py b/doc/salome/examples/advanced_geom_objs_ex01.py
new file mode 100644 (file)
index 0000000..eb3db5f
--- /dev/null
@@ -0,0 +1,73 @@
+# Creation of PipeTShape
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create PipeTShape object
+pipetshape = geompy.MakePipeTShape(80.0, 20.0, 200.0, 50.0, 20.0, 200.0)
+
+# add object in the study
+id_pipetshape = geompy.addToStudy(pipetshape[0],"PipeTShape")
+# add groups in the study
+for g in pipetshape[1:]:
+    geompy.addToStudyInFather(pipetshape[0], g, g.GetName())
+    
+# Create junction vertices
+P1 = geompy.MakeVertex(0.0, 0.0, 0.0)
+P2 = geompy.MakeVertex(400.0, 0.0, 0.0)
+P3 = geompy.MakeVertex(200.0, 0.0, 200.0)
+
+# create PipeTShape object with position
+pipetshape_position = geompy.MakePipeTShape(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, True, P1, P2, P3)
+
+# add object in the study
+id_pipetshape_position = geompy.addToStudy(pipetshape_position[0],"PipeTShape_position")
+# add groups in the study
+for g in pipetshape_position[1:]:
+    geompy.addToStudyInFather(pipetshape_position[0], g, g.GetName())
+
+# create PipeTShape with chamfer object
+pipetshapechamfer = geompy.MakePipeTShapeChamfer(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, 20.0, 20.0)
+
+# add object in the study
+id_pipetshapechamfer = geompy.addToStudy(pipetshapechamfer[0],"PipeTShapeChamfer")
+# add groups in the study
+for g in pipetshapechamfer[1:]:
+    geompy.addToStudyInFather(pipetshapechamfer[0], g, g.GetName())
+
+# create PipeTShape with chamfer object with position
+pipetshapechamfer_position = geompy.MakePipeTShapeChamfer(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, 20.0, 20.0, True, P1, P2, P3)
+
+# add object in the study
+id_pipetshapechamfer_position = geompy.addToStudy(pipetshapechamfer_position[0],"PipeTShapeChamfer_position")
+# add groups in the study
+for g in pipetshapechamfer_position[1:]:
+    geompy.addToStudyInFather(pipetshapechamfer_position[0], g, g.GetName())
+
+# create PipeTShape with fillet object
+pipetshapefillet = geompy.MakePipeTShapeFillet(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, 5.0)
+
+# add object in the study
+id_pipetshapefillet = geompy.addToStudy(pipetshapefillet[0],"PipeTShapeFillet")
+# add groups in the study
+for g in pipetshapefillet[1:]:
+    geompy.addToStudyInFather(pipetshapefillet[0], g, g.GetName())
+
+# create PipeTShape with fillet object with position
+pipetshapefillet_position = geompy.MakePipeTShapeFillet(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, 5.0, True, P1, P2, P3)
+
+# add object in the study
+id_pipetshapefillet_position = geompy.addToStudy(pipetshapefillet_position[0],"PipeTShapeFillet_position")
+# add groups in the study
+for g in pipetshapefillet_position[1:]:
+    geompy.addToStudyInFather(pipetshapefillet_position[0], g, g.GetName())
+    
+
+# display pipetshapes
+gg.createAndDisplayGO(id_pipetshape)
+gg.createAndDisplayGO(id_pipetshape_position)
+gg.createAndDisplayGO(id_pipetshapechamfer)
+gg.createAndDisplayGO(id_pipetshapechamfer_position)
+gg.createAndDisplayGO(id_pipetshapefillet)
+gg.createAndDisplayGO(id_pipetshapefillet_position)
diff --git a/doc/salome/examples/advanced_geom_objs_ex02.py b/doc/salome/examples/advanced_geom_objs_ex02.py
new file mode 100644 (file)
index 0000000..2ee3016
--- /dev/null
@@ -0,0 +1,15 @@
+# Creation of DividedDisk
+
+import geompy
+import salome
+import GEOM
+gg = salome.ImportComponentGUI("GEOM")
+
+# create DividedDisk object
+divideddisk = geompy.MakeDividedDisk(100, 1, GEOM.SQUARE)
+
+# add object in the study
+id_divideddisk = geompy.addToStudy(divideddisk,"DividedDisk")
+
+# display divideddisk
+gg.createAndDisplayGO(id_divideddisk)
diff --git a/doc/salome/examples/advanced_geom_objs_ex03.py b/doc/salome/examples/advanced_geom_objs_ex03.py
new file mode 100644 (file)
index 0000000..195cda0
--- /dev/null
@@ -0,0 +1,15 @@
+# Creation of DividedCylinder
+
+import geompy
+import salome
+import GEOM
+gg = salome.ImportComponentGUI("GEOM")
+
+# create DividedCylinder object
+dividedcylinder = geompy.MakeDividedCylinder(100, 300, GEOM.SQUARE)
+
+# add object in the study
+id_dividedcylinder = geompy.addToStudy(dividedcylinder,"DividedCylinder")
+
+# display dividedcylinder
+gg.createAndDisplayGO(id_dividedcylinder)
diff --git a/doc/salome/examples/angle.py b/doc/salome/examples/angle.py
new file mode 100644 (file)
index 0000000..547db71
--- /dev/null
@@ -0,0 +1,60 @@
+# Angle
+
+import salome
+salome.salome_init()
+
+import math
+import geompy
+geompy.init_geom(salome.myStudy)
+
+OX  = geompy.MakeVectorDXDYDZ(10, 0,0)
+OXY = geompy.MakeVectorDXDYDZ(10,10,0)
+
+# in one plane
+Angle = geompy.GetAngle(OX, OXY)
+
+print "\nAngle between OX and OXY = ", Angle
+if math.fabs(Angle - 45.0) > 1e-05:
+    print "  Error: returned angle is", Angle, "while must be 45.0"
+    pass
+
+Angle = geompy.GetAngleRadians(OX, OXY)
+
+print "\nAngle between OX and OXY in radians = ", Angle
+if math.fabs(Angle - math.pi/4) > 1e-05:
+    print "  Error: returned angle is", Angle, "while must be pi/4"
+    pass
+
+Angle = geompy.GetAngleVectors(OX, OXY, True)
+
+print "\nAngle between vectors OX and OXY = ", Angle
+if math.fabs(Angle - 45.0) > 1e-05:
+    print "  Error: returned angle is", Angle, "while must be 45.0"
+    pass
+
+Angle = geompy.GetAngleRadiansVectors(OX, OXY, False)
+
+print "\nBig angle between vectors OX and OXY in radians = ", Angle
+if math.fabs(Angle - math.pi*7./4.) > 1e-05:
+    print "  Error: returned angle is", Angle, "while must be 7*pi/4"
+    pass
+
+# not in one plane
+OXY_shift = geompy.MakeTranslation(OXY,10,-10,20)
+Angle = geompy.GetAngle(OX, OXY_shift)
+
+print "\nAngle between OX and OXY_shift = ", Angle
+if math.fabs(Angle - 45.0) > 1e-05:
+    print "  Error: returned angle is", Angle, "while must be 45.0"
+    pass
+
+# not linear
+pnt1 = geompy.MakeVertex(0, 0, 0)
+pnt2 = geompy.MakeVertex(10, 0, 0)
+pnt3 = geompy.MakeVertex(20, 10, 0)
+arc  = geompy.MakeArc(pnt1, pnt2, pnt3)
+Angle = geompy.GetAngle(OX, arc)
+
+if (math.fabs(Angle + 1.0) > 1e-6 or geompy.MeasuOp.IsDone()):
+    print "Error. Angle must not be computed on curvilinear edges"
+    pass
diff --git a/doc/salome/examples/basic_geom_objs_ex01.py b/doc/salome/examples/basic_geom_objs_ex01.py
new file mode 100644 (file)
index 0000000..05abb79
--- /dev/null
@@ -0,0 +1,61 @@
+# Creation of a Point
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create vertices
+p0 = geompy.MakeVertex(0., 0., 0.)
+p100 = geompy.MakeVertexWithRef(p0, 100., 100., 100.)
+px = geompy.MakeVertex(100., 0., 0.)
+py = geompy.MakeVertex(0., 100., 0.)
+pz = geompy.MakeVertex(0., 0., 100.)
+p1 = geompy.MakeVertex(50., 50., 30.)
+
+# create a curve and vertices on it
+Arc = geompy.MakeArc(py, pz, px)
+# create a vertex by parameter
+p_on_arc = geompy.MakeVertexOnCurve(Arc, 0.25)
+# create a vertex by length
+p_on_arc2 = geompy.MakeVertexOnCurveByLength(Arc, 50., None)
+#create a vertex by point projection
+p_on_arc3 = geompy.MakeVertexOnCurveByCoord(Arc, 100, -10, 10)
+
+# create 2 lines and make a point on its intersection
+line_1 = geompy.MakeLineTwoPnt(p0, p100)
+line_2 = geompy.MakeLineTwoPnt(p1, pz)
+p_inter = geompy.MakeVertexOnLinesIntersection(line_1, line_2)
+
+# create a face and vertices on it
+Add_line = geompy.MakeLineTwoPnt(px, py)
+arc_face = geompy.MakeFaceWires([Arc, Add_line], 1)
+p_on_face1 = geompy.MakeVertexOnSurface(arc_face, 0.5, 0.5)
+p_on_face2 = geompy.MakeVertexOnSurfaceByCoord(arc_face, 35, 35, 35)
+p_on_face3 = geompy.MakeVertexInsideFace(arc_face)
+
+
+# add objects in the study
+id_p0       = geompy.addToStudy(p0,   "Vertex 0")
+id_p100     = geompy.addToStudy(p100, "Vertex 100")
+id_px       = geompy.addToStudy(px,   "Vertex X")
+id_py       = geompy.addToStudy(py,   "Vertex Y")
+id_pz       = geompy.addToStudy(pz,   "Vertex Z")
+id_Arc      = geompy.addToStudy(Arc,  "Arc")
+id_line_1   = geompy.addToStudy(line_1,  "Line 1")
+id_line_2   = geompy.addToStudy(line_2,  "Line 2")
+id_p_on_arc = geompy.addToStudy(p_on_arc, "Vertex on Arc by parameter")
+id_p_on_arc2  = geompy.addToStudy(p_on_arc2, "Vertex on Arc by length")
+id_p_on_arc3  = geompy.addToStudy(p_on_arc3, "Vertex on Arc by point projection")
+id_p_inter    = geompy.addToStudy(p_inter,   "Vertex on Lines Intersection")
+id_p_on_face1 = geompy.addToStudy(p_on_face1, "Vertex on face by parameter")
+id_p_on_face2 = geompy.addToStudy(p_on_face2, "Vertex on face by point projection")
+id_p_on_face3 = geompy.addToStudy(p_on_face3, "Vertex inside face")
+
+# display vertices
+gg.createAndDisplayGO(id_p0)
+gg.createAndDisplayGO(id_p100)
+gg.createAndDisplayGO(id_Arc)
+gg.createAndDisplayGO(id_p_inter)
+gg.createAndDisplayGO(id_p_on_arc)
+gg.createAndDisplayGO(id_p_on_arc2)
+gg.createAndDisplayGO(id_p_on_arc3)
diff --git a/doc/salome/examples/basic_geom_objs_ex02.py b/doc/salome/examples/basic_geom_objs_ex02.py
new file mode 100644 (file)
index 0000000..02f87e9
--- /dev/null
@@ -0,0 +1,31 @@
+# Creation of a Line
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create vertices
+p0 = geompy.MakeVertex(0., 0., 0.)
+p100 = geompy.MakeVertexWithRef(p0, 100., 100., 100.)
+px = geompy.MakeVertex(100., 0.  , 0.  )
+py = geompy.MakeVertex(0.  , 100., 0.  )
+pz = geompy.MakeVertex(0.  , 0.  , 100.)
+
+# create a vector from two points
+vxy  = geompy.MakeVector(px, py)
+
+# create a line from a point and a vector
+line1 = geompy.MakeLine(pz, vxy)
+
+#create a line from two points
+line2 = geompy.MakeLineTwoPnt(p0, p100)
+
+# add objects in the study
+id_vxy      = geompy.addToStudy(vxy,  "Vector")
+id_line1    = geompy.addToStudy(line1,"Line1")
+id_line2    = geompy.addToStudy(line2,"Line2")
+
+# display lines
+gg.createAndDisplayGO(id_vxy)
+gg.createAndDisplayGO(id_line1)
+gg.createAndDisplayGO(id_line2) 
diff --git a/doc/salome/examples/basic_geom_objs_ex03.py b/doc/salome/examples/basic_geom_objs_ex03.py
new file mode 100644 (file)
index 0000000..510ae18
--- /dev/null
@@ -0,0 +1,30 @@
+# Creation of a Circle
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create vertices
+p0 = geompy.MakeVertex(0., 0., 0.)
+px = geompy.MakeVertex(100., 0.  , 0.  )
+py = geompy.MakeVertex(0.  , 100., 0.  )
+pz = geompy.MakeVertex(0.  , 0.  , 100.)
+
+# create a vector on two points
+vxy  = geompy.MakeVector(px, py)
+
+# create a circle from a point, a vector and a radius
+circle1 = geompy.MakeCircle(pz, vxy, 30)
+
+#create a circle from three points
+circle2 = geompy.MakeCircleThreePnt(p0, px, py)
+
+# add objects in the study
+id_vxy      = geompy.addToStudy(vxy,    "Vector")
+id_circle1  = geompy.addToStudy(circle1,"Circle1")
+id_circle2  = geompy.addToStudy(circle2,"Circle2")
+
+# display circles
+gg.createAndDisplayGO(id_vxy)
+gg.createAndDisplayGO(id_circle1)
+gg.createAndDisplayGO(id_circle2)
diff --git a/doc/salome/examples/basic_geom_objs_ex04.py b/doc/salome/examples/basic_geom_objs_ex04.py
new file mode 100644 (file)
index 0000000..bf7d3e8
--- /dev/null
@@ -0,0 +1,34 @@
+# Creation of an Ellipse
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create vertices
+p0 = geompy.MakeVertex(0., 0., 0.)
+p1 = geompy.MakeVertex(50., 50., 50.)
+p2 = geompy.MakeVertex(0., 50., 0.)
+
+# create a normal vector from two points
+normal  = geompy.MakeVector(p0, p1)
+
+# create a major axis vector from two points
+major   = geompy.MakeVector(p0, p2)
+
+# create an ellipse from a point, a vector and radiuses
+ellipse1 = geompy.MakeEllipse(p1, normal, 50, 25)
+
+# create an ellipse from a point, a normal vector, radiuses and a major axis vector
+ellipse2 = geompy.MakeEllipse(p1, normal, 50, 25, major)
+
+# add objects in the study
+id_normal   = geompy.addToStudy(normal,   "Normal")
+id_major    = geompy.addToStudy(major,    "Major Axis")
+id_ellipse1 = geompy.addToStudy(ellipse1, "Ellipse 1")
+id_ellipse2 = geompy.addToStudy(ellipse2, "Ellipse 2")
+
+# display the ellipse and its normal vector
+gg.createAndDisplayGO(id_normal)
+gg.createAndDisplayGO(id_major)
+gg.createAndDisplayGO(id_ellipse1)
+gg.createAndDisplayGO(id_ellipse2)
diff --git a/doc/salome/examples/basic_geom_objs_ex05.py b/doc/salome/examples/basic_geom_objs_ex05.py
new file mode 100644 (file)
index 0000000..5a82c3b
--- /dev/null
@@ -0,0 +1,29 @@
+# Creation of an Arc
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create vertices
+p0 = geompy.MakeVertex(0., 0., 0.)
+p1 = geompy.MakeVertex(100., 0., 0.)
+p2 = geompy.MakeVertex(50., 0., 50.)
+
+# create an arc from a three points
+arc1 = geompy.MakeArc(p0, p1, p2)
+
+# create an arc from a center point, a start point and end point
+arc2 = geompy.MakeArcCenter(p0, p1, p2, 1)
+
+# create an arc from a center point, a major point and minor point
+arc3 = geompy.MakeArcOfEllipse(p0, p1, p2)
+
+# add objects in the study
+id_arc1 = geompy.addToStudy(arc1, "Arc 1")
+id_arc2 = geompy.addToStudy(arc2, "Arc 2")
+id_arc3 = geompy.addToStudy(arc3, "Arc 3")
+
+# display the arcs
+gg.createAndDisplayGO(id_arc1)
+gg.createAndDisplayGO(id_arc2)
+gg.createAndDisplayGO(id_arc3)
diff --git a/doc/salome/examples/basic_geom_objs_ex06.py b/doc/salome/examples/basic_geom_objs_ex06.py
new file mode 100644 (file)
index 0000000..ba4940c
--- /dev/null
@@ -0,0 +1,68 @@
+# Creation of a Curve
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create vertices and vectors
+p0 = geompy.MakeVertex(0.  , 0.  , 0.  )
+p1 = geompy.MakeVertex(50. , 100., 200.)
+p2 = geompy.MakeVertex(150.,  50., 100.)
+p3 = geompy.MakeVertex(100., 150., 170.)
+p4 = geompy.MakeVertex(200., 200., 150.)
+
+v1 = geompy.MakeVectorDXDYDZ(0, 1, 0)
+v2 = geompy.MakeVectorDXDYDZ(1, 0, 0)
+
+# create a polyline from a list of points
+polyline = geompy.MakePolyline([p0, p1, p2, p3, p4])
+
+# create a bezier curve from a list of points
+bezier = geompy.MakeBezier([p0, p1, p2, p3, p4])
+
+#create a b-spline curve from a list of points
+interpol = geompy.MakeInterpol([p0, p1, p2, p3, p4], False)
+
+#create a b-spline curve with defined directions at the ends
+interpol_tangents = geompy.MakeInterpolWithTangents([p0, p1, p2, p3, p4], v1, v2)
+
+#create a polyline using parametric definition of the basic points
+param_polyline = geompy.MakeCurveParametric("t", "sin(t)", "cos(t)", 0., 100., 100, geompy.GEOM.Polyline, theNewMethod=True)
+
+# create a bezier curve using parametric definition of the basic points
+param_bezier = geompy.MakeCurveParametric("t", "sin(t)", "cos(t)", 0., 100., 20, geompy.GEOM.Bezier, theNewMethod=True)
+
+#create a b-spline curve using parametric definition of the basic points
+param_interpol = geompy.MakeCurveParametric("t", "sin(t)", "cos(t)", 0., 100., 100, geompy.GEOM.Interpolation, theNewMethod=True)
+
+
+# add objects in the study
+id_p0       = geompy.addToStudy(p0,       "Point1")
+id_p1       = geompy.addToStudy(p1,       "Point2")
+id_p2       = geompy.addToStudy(p2,       "Point3")
+id_p3       = geompy.addToStudy(p3,       "Point4")
+id_p4       = geompy.addToStudy(p4,       "Point5")
+id_v1       = geompy.addToStudy(v1,       "Vector1")
+id_v2       = geompy.addToStudy(v2,       "Vector2")
+id_polyline = geompy.addToStudy(polyline, "Polyline")
+id_bezier   = geompy.addToStudy(bezier,   "Bezier")
+id_interpol = geompy.addToStudy(interpol, "Interpol")
+id_interpol_tangents = geompy.addToStudy(interpol_tangents, "Interpol Tangents")
+id_param_polyline = geompy.addToStudy(param_polyline, "Polyline Parametric")
+id_param_bezier = geompy.addToStudy(param_bezier, "Bezier Parametric")
+id_param_interpol = geompy.addToStudy(param_interpol, "Interpol Parametric")
+
+
+# display the points and the curves
+gg.createAndDisplayGO(id_p0)
+gg.createAndDisplayGO(id_p1)
+gg.createAndDisplayGO(id_p2)
+gg.createAndDisplayGO(id_p3)
+gg.createAndDisplayGO(id_p4)
+gg.createAndDisplayGO(id_polyline)
+gg.createAndDisplayGO(id_bezier)
+gg.createAndDisplayGO(id_interpol) 
+gg.createAndDisplayGO(id_interpol_tangents) 
+gg.createAndDisplayGO(id_param_polyline)
+gg.createAndDisplayGO(id_param_bezier)
+gg.createAndDisplayGO(id_param_interpol)
diff --git a/doc/salome/examples/basic_geom_objs_ex07.py b/doc/salome/examples/basic_geom_objs_ex07.py
new file mode 100644 (file)
index 0000000..2de687a
--- /dev/null
@@ -0,0 +1,27 @@
+# Creation of a Vector
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create vertices
+p1 = geompy.MakeVertex(10., 50., 20.)
+p2 = geompy.MakeVertex(70., 70., 70.)
+
+# create a vector from two points
+vector1 = geompy.MakeVector(p1, p2)
+
+# create a vector from the given components
+vector2 = geompy.MakeVectorDXDYDZ(30, 30, 100)
+
+# add objects in the study
+id_p1      = geompy.addToStudy(p1,     "Point1")
+id_p2      = geompy.addToStudy(p2,     "Point2")
+id_vector1 = geompy.addToStudy(vector1,"Vector1")
+id_vector2 = geompy.addToStudy(vector2,"Vector2")
+
+# display the points and the vectors
+gg.createAndDisplayGO(id_p1)
+gg.createAndDisplayGO(id_p2)
+gg.createAndDisplayGO(id_vector1)
+gg.createAndDisplayGO(id_vector2) 
diff --git a/doc/salome/examples/basic_geom_objs_ex08.py b/doc/salome/examples/basic_geom_objs_ex08.py
new file mode 100644 (file)
index 0000000..81a8745
--- /dev/null
@@ -0,0 +1,75 @@
+# Creation of a Plane
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create vertices
+p1 = geompy.MakeVertex(  0.,   0., 100.)
+p2 = geompy.MakeVertex(100.,   0.,   0.)
+p3 = geompy.MakeVertex(200., 200., 200.)
+p4 = geompy.MakeVertex(100., 100.,   0.)
+p5 = geompy.MakeVertex(0.  , 100.,   0.)
+
+# create a vectors from the given components
+vector1 = geompy.MakeVectorDXDYDZ(100., 100., 100.)
+vector2 = geompy.MakeVectorDXDYDZ(-100., 0., 100.)
+
+# create a vector from two points
+vector_arc = geompy.MakeVector(p2, p5)
+
+# create an arc from three points
+arc = geompy.MakeArc(p2, p4, p5)
+
+# create a wire
+wire = geompy.MakeWire([vector_arc, arc])
+
+# create a face
+isPlanarWanted = 1
+face = geompy.MakeFace(wire, isPlanarWanted)
+trimsize = 1000.
+
+# create a Local Coordinate System
+
+LCS = geompy.MakeMarker(100., 100., 101., 1, 0, 0, 0, 1, 0)
+
+# create a plane from a point, a vector and a trimsize
+plane1 = geompy.MakePlane(p1, vector1, trimsize)
+
+# create a plane from three points and a trimsize
+plane2 = geompy.MakePlaneThreePnt(p1, p2, p3, trimsize)
+
+# create a plane from the given face
+plane3 = geompy.MakePlaneFace(face, trimsize)
+
+# create a plane from two vectors and a trimsize
+plane4 = geompy.MakePlane2Vec(vector1, vector2, trimsize)
+
+# create a plane with the Local Coordinate System and a trimsize
+plane5 = geompy.MakePlaneLCS(LCS, trimsize, 1)
+
+# add objects in the study
+id_face   = geompy.addToStudy(face,  "Face")
+id_plane1 = geompy.addToStudy(plane1,"Plane1")
+id_plane2 = geompy.addToStudy(plane2,"Plane2")
+id_plane3 = geompy.addToStudy(plane3,"Plane3")
+id_plane4 = geompy.addToStudy(plane4,"Plane4")
+id_plane5 = geompy.addToStudy(plane5,"Plane5")
+
+# display the points and the vectors
+gg.createAndDisplayGO(id_face)
+gg.createAndDisplayGO(id_plane1)
+gg.createAndDisplayGO(id_plane2)
+gg.createAndDisplayGO(id_plane3)
+gg.createAndDisplayGO(id_plane4)
+gg.createAndDisplayGO(id_plane5)
+gg.setDisplayMode(id_plane1,1)
+gg.setTransparency(id_plane1,0.5)
+gg.setDisplayMode(id_plane2,1)
+gg.setTransparency(id_plane2,0.5)
+gg.setDisplayMode(id_plane3,1)
+gg.setTransparency(id_plane3,0.5)
+gg.setDisplayMode(id_plane4,1)
+gg.setTransparency(id_plane4,0.5)
+gg.setDisplayMode(id_plane5,1)
+gg.setTransparency(id_plane5,0.5)
diff --git a/doc/salome/examples/basic_geom_objs_ex09.py b/doc/salome/examples/basic_geom_objs_ex09.py
new file mode 100644 (file)
index 0000000..3934410
--- /dev/null
@@ -0,0 +1,38 @@
+# Creation of a Local Coordinate System
+
+import GEOM
+import geompy
+import math
+import SALOMEDS
+
+#Create vertexes, vectors and shapes to construct local CS
+Vertex_1 = geompy.MakeVertex(50, 50, 50)
+Vertex_2 = geompy.MakeVertex(70, 70, 70)
+Vertex_3 = geompy.MakeVertex(0, 0, 0)
+Vector_X = geompy.MakeVectorDXDYDZ(50, 0, 0)
+Vector_Y = geompy.MakeVectorDXDYDZ(0, 50, 0)
+Face_1 = geompy.MakeFaceHW(100, 100, 1)
+Box_1 = geompy.MakeBoxTwoPnt(Vertex_1, Vertex_2)
+
+#Construct local CS by manual definition
+LocalCS_1 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0)
+
+#Construct local CS by center point and two vectors (X and Y directions)
+LocalCS_2 = geompy.MakeMarkerPntTwoVec(Vertex_3, Vector_X, Vector_Y)
+
+#Construct local CS from shape orientation
+LocalCS_FACE = geompy.MakeMarkerFromShape(Face_1)
+LocalCS_BOX = geompy.MakeMarkerFromShape(Box_1)
+
+#Add created object to study
+geompy.addToStudy( Face_1, "Face_1" )
+geompy.addToStudy( Vertex_1, "Vertex_1" )
+geompy.addToStudy( Vertex_2, "Vertex_2" )
+geompy.addToStudy( Box_1, "Box_1" )
+geompy.addToStudy( Vertex_3, "Vertex_3" )
+geompy.addToStudy( Vector_X, "Vector_X" )
+geompy.addToStudy( Vector_Y, "Vector_Y" )
+geompy.addToStudy( LocalCS_1, "LocalCS_1" )
+geompy.addToStudy( LocalCS_2, "LocalCS_3" )
+geompy.addToStudy( LocalCS_FACE, "LocalCS_FACE" )
+geompy.addToStudy( LocalCS_BOX, "LocalCS_BOX" )
diff --git a/doc/salome/examples/basic_operations_ex01.py b/doc/salome/examples/basic_operations_ex01.py
new file mode 100644 (file)
index 0000000..bed9e1c
--- /dev/null
@@ -0,0 +1,41 @@
+# Partition
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a vertex and a vector
+p0   = geompy.MakeVertex(  0.,   0.,   0.)
+p200 = geompy.MakeVertex(200., 200., 200.)
+pz   = geompy.MakeVertex(  0.,   0., 100.)
+
+# create a vector
+vxyz = geompy.MakeVectorDXDYDZ(100., 100., 100.)
+
+# create a box from two points
+box = geompy.MakeBoxTwoPnt(p0, p200)
+
+# create a plane
+trimsize  = 500.
+plane = geompy.MakePlane(pz, vxyz, trimsize)
+
+# create partition objects
+partition1 = geompy.MakePartition([box], [plane])
+partition2 = geompy.Partition([box], [plane])
+partition3 = geompy.MakeHalfPartition(box, plane)
+
+# add objects in the study
+id_box = geompy.addToStudy(box,"Box")
+id_plane = geompy.addToStudy(plane,"Plane")
+id_partition1 = geompy.addToStudy(partition1,"MakePartition")
+id_partition2 = geompy.addToStudy(partition2,"Partition")
+id_partition3 = geompy.addToStudy(partition3,"MakeHalfPartition")
+
+# display the partition objects and the plane
+gg.createAndDisplayGO(id_box)
+gg.setDisplayMode(id_box,1)
+gg.createAndDisplayGO(id_plane)
+gg.setDisplayMode(id_plane,1)
+gg.createAndDisplayGO(id_partition1)
+gg.createAndDisplayGO(id_partition2)
+gg.createAndDisplayGO(id_partition3)
diff --git a/doc/salome/examples/basic_operations_ex02.py b/doc/salome/examples/basic_operations_ex02.py
new file mode 100644 (file)
index 0000000..ac9b77b
--- /dev/null
@@ -0,0 +1,28 @@
+# Archimede
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a vertex and a vector
+p0   = geompy.MakeVertex(  0.,   0.,   0.)
+p200 = geompy.MakeVertex(200., 200., 200.)
+
+# create a box from two points
+box = geompy.MakeBoxTwoPnt(p0, p200)
+
+# perform an Archimede operation on the selected shape with selected parameters
+weight  = 1000000.
+waterdensity = 1.
+meshingdeflection = 0.01
+archimede  = geompy.Archimede(box, weight, waterdensity, meshingdeflection)
+
+# add objects in the study
+id_box = geompy.addToStudy(box,"Box")
+id_archimede = geompy.addToStudy(archimede,"Archimede")
+
+# display the box and the result of Archimede operation
+gg.createAndDisplayGO(id_box)
+gg.setDisplayMode(id_box,1)
+gg.createAndDisplayGO(id_archimede)
+gg.setDisplayMode(id_archimede,1) 
diff --git a/doc/salome/examples/basic_operations_ex03.py b/doc/salome/examples/basic_operations_ex03.py
new file mode 100644 (file)
index 0000000..39b1dd2
--- /dev/null
@@ -0,0 +1,55 @@
+# Restore presentation parameters and sub-shapes
+
+import geompy
+import GEOM
+import SALOMEDS
+
+# create a box and a cylinder
+box = geompy.MakeBoxDXDYDZ(200, 200, 200)
+cyl = geompy.MakeCylinderRH(100, 300)
+
+# create translated box
+vec = geompy.MakeVectorDXDYDZ(100, 50, 0)
+tra = geompy.MakeTranslationVector(box, vec)
+
+# create partition objects
+partition1 = geompy.MakePartition([box, cyl])
+partition2 = geompy.MakePartition([box], [cyl])
+partition3 = geompy.MakePartition([box], [tra])
+
+# set colours
+box.SetColor(SALOMEDS.Color(1,0,0))
+cyl.SetColor(SALOMEDS.Color(0,1,0))
+
+# add objects in the study
+geompy.addToStudy(box, "Box")
+geompy.addToStudy(cyl, "Cylinder")
+geompy.addToStudy(vec, "Vector")
+geompy.addToStudy(tra, "Translation")
+geompy.addToStudy(partition1, "Partition_1")
+geompy.addToStudy(partition2, "Partition_2")
+geompy.addToStudy(partition3, "Partition_3")
+
+# Restore presentation parameters and sub-shapes
+# different methods can be used to find the sub-shapes in the result:
+# GetInPlace, GetSame, GetInPlaceByHistory, GetShapesOnShape.
+# By default, GetInPlace method is used (GEOM.FSM_GetInPlace)
+geompy.RestoreSubShapes(partition1)
+
+geompy.RestoreSubShapes(partition2, [], GEOM.FSM_GetInPlace)
+
+# The list of arguments can be used to avoid restoring all arguments,
+# but restore only the passed.
+geompy.RestoreSubShapes(partition3, [tra], GEOM.FSM_GetInPlaceByHistory)
+
+# To find sub-shapes in a transformed shape only one method could be
+# used: pass GEOM.FSM_Transformed for that.
+# True passed for the last argument, means that the transformed shape
+# will inherit colour and sub-shapes from its first argument (see above
+# MakeTranslation).
+geompy.RestoreSubShapes(tra, [], GEOM.FSM_Transformed, True)
+
+# Also we could do this directly with method addToStudy:
+partition4 = geompy.MakePartition([box, tra])
+geompy.addToStudy(partition4, "Partition_4", True, [],
+                  GEOM.FSM_GetInPlaceByHistory, False)
diff --git a/doc/salome/examples/basic_properties.py b/doc/salome/examples/basic_properties.py
new file mode 100644 (file)
index 0000000..2396559
--- /dev/null
@@ -0,0 +1,20 @@
+# Basic Properties
+
+import geompy
+import math
+
+# create a box
+box = geompy.MakeBoxDXDYDZ(100,30,100)
+props = geompy.BasicProperties(box)
+print "\nBox 100x30x100 Basic Properties:"
+print " Wires length: ", props[0]
+print " Surface area: ", props[1]
+print " Volume      : ", props[2]
+length = math.sqrt((props[0] - 1840)*(props[0] - 1840))
+area = math.sqrt((props[1] - 32000)*(props[1] - 32000))
+volume = math.sqrt((props[2] - 300000)*(props[2] - 300000))
+if length > 1e-7 or area > 1e-7 or volume > 1e-7:
+    print "While must be:"
+    print " Wires length: ", 1840
+    print " Surface area: ", 32000
+    print " Volume      : ", 300000.
diff --git a/doc/salome/examples/blocks_operations_ex01.py b/doc/salome/examples/blocks_operations_ex01.py
new file mode 100644 (file)
index 0000000..5535f12
--- /dev/null
@@ -0,0 +1,35 @@
+# Multi Transformation
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create vertices
+p_25_25_50 = geompy.MakeVertex(25., 25., 50.)
+p_50_25_25 = geompy.MakeVertex(50., 25., 25.)
+p_25_50_25 = geompy.MakeVertex(25., 50., 25.)
+
+box = geompy.MakeBoxDXDYDZ(50, 50, 50)
+
+top_face = geompy.GetFaceNearPoint(box, p_25_25_50)
+yz_face = geompy.GetFaceNearPoint(box, p_50_25_25)
+xz_face = geompy.GetFaceNearPoint(box, p_25_50_25)
+
+top_face_ind = geompy.GetSubShapeID(box, top_face)
+yz_face_ind = geompy.GetSubShapeID(box, yz_face)
+xz_face_ind = geompy.GetSubShapeID(box, xz_face)
+
+# Multi-transformate block and glue the result
+box_tr1 = geompy.MakeMultiTransformation1D(box, yz_face_ind, top_face_ind, 3)
+box_tr2 = geompy.MakeMultiTransformation2D(box, xz_face_ind, yz_face_ind, 3, top_face_ind, 0, 2)
+
+# add objects in the study
+id_box = geompy.addToStudy(box, "Box")
+id_box_tr1 = geompy.addToStudy(box_tr1, "Multi-transformed Block 1D")
+id_box_tr2 = geompy.addToStudy(box_tr2, "Multi-transformed Block 2D")
+
+# display the results
+gg.createAndDisplayGO(id_box)
+gg.setDisplayMode(id_box,1)
+gg.createAndDisplayGO(id_box_tr1)
+gg.createAndDisplayGO(id_box_tr2) 
diff --git a/doc/salome/examples/blocks_operations_ex02.py b/doc/salome/examples/blocks_operations_ex02.py
new file mode 100644 (file)
index 0000000..68fbb01
--- /dev/null
@@ -0,0 +1,26 @@
+# Explode on Blocks
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a box and a sphere
+box = geompy.MakeBoxDXDYDZ(200, 200, 200)
+sphere = geompy.MakeSphereR(100)
+
+# make a compound
+compound = geompy.MakeCompound([box, sphere])
+
+# get all the blocks of the given compound, by criteria: min_nb_faces <= nb. of faces <= max_nb_faces
+min_nb_faces = 6
+max_nb_faces = 6
+make_block_explode = geompy.MakeBlockExplode(compound, min_nb_faces, max_nb_faces)
+
+# add objects in the study
+id_compound = geompy.addToStudy(compound, "Compound")
+id_make_block_explode = geompy.addToStudyInFather(compound, make_block_explode[0], "MakeBlockExplode")
+
+# display the results
+gg.createAndDisplayGO(id_compound)
+gg.createAndDisplayGO(id_make_block_explode)
+gg.setDisplayMode(id_make_block_explode,1) 
diff --git a/doc/salome/examples/blocks_operations_ex03.py b/doc/salome/examples/blocks_operations_ex03.py
new file mode 100644 (file)
index 0000000..546bc22
--- /dev/null
@@ -0,0 +1,20 @@
+# Propagate
+
+import geompy
+import salome
+
+# create a box
+box = geompy.MakeBoxDXDYDZ(200, 200, 200)
+
+# build all possible propagation groups
+listChains = geompy.Propagate(check_box)
+
+# add objects in the study
+geompy.addToStudy(check_box, "Box")
+ii = 1
+for chain in listChains:
+    geompy.addToStudyInFather(check_box, chain, "propagation chain " + `ii`)
+    ii = ii + 1
+    pass
+
+salome.sg.updateObjBrowser(1) 
diff --git a/doc/salome/examples/boolean_operations_ex01.py b/doc/salome/examples/boolean_operations_ex01.py
new file mode 100644 (file)
index 0000000..5f52542
--- /dev/null
@@ -0,0 +1,38 @@
+# Fuse
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a vertex and a vector
+p1 = geompy.MakeVertex(25, 55, 0)
+p2 = geompy.MakeVertex( 0,  0, 0)
+v = geompy.MakeVector(p1, p2)
+
+# create a cylinder
+height = 35
+radius1 = 20
+cylinder = geompy.MakeCylinder(p1, v, radius1, height)
+
+# create a sphere
+sphere = geompy.MakeSphereR(40)
+
+# fuse
+fuse1 = geompy.MakeFuse(cylinder, sphere)
+fuse2 = geompy.MakeBoolean(cylinder, sphere, 3)
+
+# add objects in the study
+id_cylinder = geompy.addToStudy(cylinder, "Cylinder")
+id_sphere = geompy.addToStudy(sphere, "Sphere")
+id_fuse1 = geompy.addToStudy(fuse1, "Fuse_1")
+id_fuse2 = geompy.addToStudy(fuse2, "Fuse_2")
+
+# display results
+gg.createAndDisplayGO(id_cylinder)
+gg.setDisplayMode(id_cylinder,1)
+gg.createAndDisplayGO(id_sphere)
+gg.setDisplayMode(id_sphere,1)
+gg.createAndDisplayGO(id_fuse1)
+gg.setDisplayMode(id_fuse1,1)
+gg.createAndDisplayGO(id_fuse2)
+gg.setDisplayMode(id_fuse2,1)
diff --git a/doc/salome/examples/boolean_operations_ex02.py b/doc/salome/examples/boolean_operations_ex02.py
new file mode 100644 (file)
index 0000000..b7e73b7
--- /dev/null
@@ -0,0 +1,28 @@
+# Common
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a vertex and a vector
+p1 = geompy.MakeVertex(25, 55, 0)
+p2 = geompy.MakeVertex( 0,  0, 0)
+v = geompy.MakeVector(p1, p2)
+
+# create a cylinder
+height = 35
+radius1 = 20
+cylinder = geompy.MakeCylinder(p1, v, radius1, height)
+
+# create a sphere
+sphere = geompy.MakeSphereR(40)
+
+# make common
+common = geompy.MakeCommon(cylinder, sphere)
+
+# add objects in the study
+id_common = geompy.addToStudy(common, "Common")
+
+# display the results
+gg.createAndDisplayGO(id_common)
+gg.setDisplayMode(id_common,1)
diff --git a/doc/salome/examples/boolean_operations_ex03.py b/doc/salome/examples/boolean_operations_ex03.py
new file mode 100644 (file)
index 0000000..44c5974
--- /dev/null
@@ -0,0 +1,28 @@
+# Cut
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a vertex and a vector
+p1 = geompy.MakeVertex(25, 55, 0)
+p2 = geompy.MakeVertex( 0,  0, 0)
+v = geompy.MakeVector(p1, p2)
+
+# create a cylinder
+height = 35
+radius1 = 20
+cylinder = geompy.MakeCylinder(p1, v, radius1, height)
+
+# create a sphere
+sphere = geompy.MakeSphereR(40)
+
+#cut
+cut = geompy.MakeCut(cylinder, sphere)
+
+# add objects in the study
+id_cut = geompy.addToStudy(cut, "Cut")
+
+# display the results
+gg.createAndDisplayGO(id_cut)
+gg.setDisplayMode(id_cut,1) 
diff --git a/doc/salome/examples/boolean_operations_ex04.py b/doc/salome/examples/boolean_operations_ex04.py
new file mode 100644 (file)
index 0000000..9472f7a
--- /dev/null
@@ -0,0 +1,28 @@
+# Section
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a vertex and a vector
+p1 = geompy.MakeVertex(25, 55, 0)
+p2 = geompy.MakeVertex( 0,  0, 0)
+v = geompy.MakeVector(p1, p2)
+
+# create a cylinder
+height = 35
+radius1 = 20
+cylinder = geompy.MakeCylinder(p1, v, radius1, height)
+
+# create a sphere
+sphere = geompy.MakeSphereR(40)
+
+# make a section
+section = geompy.MakeSection(cylinder, sphere)
+
+# add objects in the study
+id_section = geompy.addToStudy(section, "Section")
+
+# display the results
+gg.createAndDisplayGO(id_section)
+gg.setDisplayMode(id_section,1) 
diff --git a/doc/salome/examples/bounding_box.py b/doc/salome/examples/bounding_box.py
new file mode 100644 (file)
index 0000000..d6480ae
--- /dev/null
@@ -0,0 +1,17 @@
+# Bounding Box
+
+import geompy
+
+# create a box
+box = geompy.MakeBoxDXDYDZ(100,30,100)
+
+bb = geompy.BoundingBox(box)
+print "\nBounding Box of box 100x30x100:"
+print " Xmin = ", bb[0], ", Xmax = ", bb[1]
+print " Ymin = ", bb[2], ", Ymax = ", bb[3]
+print " Zmin = ", bb[4], ", Zmax = ", bb[5]
+
+aBB = geompy.MakeBoundingBox(box)
+
+geompy.addToStudy(box, "box 100x30x100")
+geompy.addToStudy(aBB, "Bounding box of box 100x30x100")
diff --git a/doc/salome/examples/building_by_blocks_ex01.py b/doc/salome/examples/building_by_blocks_ex01.py
new file mode 100644 (file)
index 0000000..16b02d7
--- /dev/null
@@ -0,0 +1,55 @@
+# Quadrangle Face
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create vertices
+p1 = geompy.MakeVertex(  0.,   0.,   0.)
+p2 = geompy.MakeVertex(150.,  30.,   0.)
+p3 = geompy.MakeVertex(  0., 120.,  50.)
+p4 = geompy.MakeVertex(  0.,  40.,  70.)
+
+# create edges
+edge1 = geompy.MakeEdge(p1, p2)
+edge2 = geompy.MakeEdge(p2, p3)
+edge3 = geompy.MakeEdge(p3, p4)
+edge4 = geompy.MakeEdge(p4, p1)
+
+# create a quadrangle face from four edges
+qface1 = geompy.MakeQuad(edge1, edge2, edge3, edge4)
+
+# create a quadrangle face from two edges
+qface2 = geompy.MakeQuad2Edges(edge1, edge3)
+
+# create a quadrangle from four points in its corners
+qface3 = geompy.MakeQuad4Vertices(p1, p2, p3, p4)
+
+# add objects in the study
+id_p1 = geompy.addToStudy(p1,"Point1")
+id_p2 = geompy.addToStudy(p2,"Point2")
+id_p3 = geompy.addToStudy(p3,"Point3")
+id_p4 = geompy.addToStudy(p4,"Point4")
+id_edge1 = geompy.addToStudy(edge1,"Edge1")
+id_edge2 = geompy.addToStudy(edge2,"Edge2")
+id_edge3 = geompy.addToStudy(edge3,"Edge3")
+id_edge4 = geompy.addToStudy(edge4,"Edge4")
+id_qface1 = geompy.addToStudy(qface1,"Qface1")
+id_qface2 = geompy.addToStudy(qface2,"Qface2")
+id_qface3 = geompy.addToStudy(qface3,"Qface3")
+
+# display the vertices, the edges and the quadrangle faces
+gg.createAndDisplayGO(id_p1)
+gg.createAndDisplayGO(id_p2)
+gg.createAndDisplayGO(id_p3)
+gg.createAndDisplayGO(id_p4)
+gg.createAndDisplayGO(id_edge1)
+gg.createAndDisplayGO(id_edge2)
+gg.createAndDisplayGO(id_edge3)
+gg.createAndDisplayGO(id_edge4)
+gg.createAndDisplayGO(id_qface1)
+gg.setDisplayMode(id_qface1,1)
+gg.createAndDisplayGO(id_qface2)
+gg.setDisplayMode(id_qface2,1)
+gg.createAndDisplayGO(id_qface3)
+gg.setDisplayMode(id_qface3,1)
diff --git a/doc/salome/examples/building_by_blocks_ex02.py b/doc/salome/examples/building_by_blocks_ex02.py
new file mode 100644 (file)
index 0000000..ed81f42
--- /dev/null
@@ -0,0 +1,54 @@
+# Hexagonal Solid
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create vertices
+p0  = geompy.MakeVertex(  0.,   0.,   0.)
+p1  = geompy.MakeVertex(  0.,   0.,  40.)
+p2  = geompy.MakeVertex( 70., -15.,   0.)
+p3  = geompy.MakeVertex( 70., -15.,  70.)
+
+p4  = geompy.MakeVertex(  0.,  70.,   0.)
+p5  = geompy.MakeVertex(  0.,  70.,  40.)
+p6  = geompy.MakeVertex( 70.,  70.,   0.)
+p7  = geompy.MakeVertex( 70.,  70.,  70.)
+
+p8  = geompy.MakeVertex(  0., -50.,   0.)
+p9  = geompy.MakeVertex(  0., -50.,  40.)
+p10 = geompy.MakeVertex( 70., -35.,   0.)
+p11 = geompy.MakeVertex( 70., -35.,  70.)
+
+# create faces
+qface1 = geompy.MakeQuad4Vertices(p0, p1, p2, p3)
+qface2 = geompy.MakeQuad4Vertices(p4, p5, p6, p7)
+qface3 = geompy.MakeQuad4Vertices(p0, p1, p4, p5)
+qface4 = geompy.MakeQuad4Vertices(p2, p3, p6, p7)
+qface5 = geompy.MakeQuad4Vertices(p0, p2, p4, p6)
+qface6 = geompy.MakeQuad4Vertices(p1, p3, p5, p7)
+qface7 = geompy.MakeQuad4Vertices(p8, p9, p10, p11)
+
+# create a hexahedral solid between two given faces
+solid1 = geompy.MakeHexa2Faces(qface1, qface7)
+
+# create a hexahedral solid, bounded by six given faces
+solid2 = geompy.MakeHexa(qface1, qface2, qface3, qface4, qface5, qface6)
+
+# add objects in the study
+geompy.addToStudy(qface1,"qface1")
+geompy.addToStudy(qface2,"qface2")
+geompy.addToStudy(qface3,"qface3")
+geompy.addToStudy(qface4,"qface4")
+geompy.addToStudy(qface5,"qface5")
+geompy.addToStudy(qface6,"qface6")
+geompy.addToStudy(qface7,"qface7")
+
+id_solid1 = geompy.addToStudy(solid1,"Solid1")
+id_solid2 = geompy.addToStudy(solid2,"Solid2")
+
+# display solids
+gg.createAndDisplayGO(id_solid1)
+gg.setDisplayMode(id_solid1, 1)
+gg.createAndDisplayGO(id_solid2)
+gg.setDisplayMode(id_solid2, 1) 
diff --git a/doc/salome/examples/center_of_mass.py b/doc/salome/examples/center_of_mass.py
new file mode 100644 (file)
index 0000000..acf5962
--- /dev/null
@@ -0,0 +1,19 @@
+# Center of masses
+
+import geompy
+import math
+
+# create a box
+box = geompy.MakeBoxDXDYDZ(100,30,100)
+cm = geompy.MakeCDG(box)
+if cm is None:
+    raise RuntimeError, "MakeCDG(box) failed"
+else:
+    print "\nCentre of gravity of box has been successfully obtained:"
+    coords = geompy.PointCoordinates(cm)
+    print "(", coords[0], ", ", coords[1], ", ", coords[2], ")"
+    dx = math.sqrt((coords[0] - 50)*(coords[0] - 50))
+    dy = math.sqrt((coords[1] - 15)*(coords[1] - 15))
+    dz = math.sqrt((coords[2] - 50)*(coords[2] - 50))
+    if dx > 1e-7 or dy > 1e-7 or dz > 1e-7:
+        print "But must be (50, 15, 50)"
diff --git a/doc/salome/examples/check_compound_of_blocks.py b/doc/salome/examples/check_compound_of_blocks.py
new file mode 100644 (file)
index 0000000..2f1ba98
--- /dev/null
@@ -0,0 +1,21 @@
+# Check Compound of Blocks
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create boxes
+box1 = geompy.MakeBox(0,0,0,100,50,100)
+box2 = geompy.MakeBox(100,0,0,250,50,100)
+
+# make a compound
+compound = geompy.MakeCompound([box1, box2])
+
+# glue the faces of the compound
+tolerance = 1e-5
+glue = geompy.MakeGlueFaces(compound, tolerance)
+IsValid = geompy.CheckCompoundOfBlocks(glue)
+if IsValid == 0:
+    raise RuntimeError, "Invalid compound created"
+else:
+    print "\nCompound is valid"
diff --git a/doc/salome/examples/check_self_intersections.py b/doc/salome/examples/check_self_intersections.py
new file mode 100644 (file)
index 0000000..44c55d2
--- /dev/null
@@ -0,0 +1,11 @@
+# Detect Self-intersections
+
+import geompy
+
+# create a box
+box = geompy.MakeBoxDXDYDZ(100,30,100)
+IsValid = geompy.CheckSelfIntersections(box)
+if IsValid == 0:
+    raise RuntimeError, "Box with self-intersections created"
+else:
+    print "\nBox is valid"
diff --git a/doc/salome/examples/check_shape.py b/doc/salome/examples/check_shape.py
new file mode 100644 (file)
index 0000000..b708494
--- /dev/null
@@ -0,0 +1,11 @@
+# Check Shape
+
+import geompy
+
+# create a box
+box = geompy.MakeBoxDXDYDZ(100,30,100)
+IsValid = geompy.CheckShape(box)
+if IsValid == 0:
+    raise RuntimeError, "Invalid box created"
+else:
+    print "\nBox is valid"
diff --git a/doc/salome/examples/complex_objs_ex01.py b/doc/salome/examples/complex_objs_ex01.py
new file mode 100644 (file)
index 0000000..a5cf102
--- /dev/null
@@ -0,0 +1,61 @@
+# Creation of a Prism
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a vertex and a vector
+p1 = geompy.MakeVertex(   0.,   0.,   0.)
+p2 = geompy.MakeVertex( 100.,   0.,   0.)
+p3 = geompy.MakeVertex( 100., 100.,   0.)
+p4 = geompy.MakeVertex(   0., 100.,   0.)
+p5 = geompy.MakeVertex(   0.,   0.,  60.)
+p6 = geompy.MakeVertex(-100.,   0.,   0.)
+p7 = geompy.MakeVertex(-100.,-100.,   0.)
+p8 = geompy.MakeVertex(   0.,-100.,   0.)
+
+# create a vector from the given components
+vector = geompy.MakeVectorDXDYDZ(50., 50., 50.)
+
+#create vectors from two points
+vector1_arc1 = geompy.MakeVector(p1, p2)
+vector2_arc1 = geompy.MakeVector(p1, p4)
+vector1_arc2 = geompy.MakeVector(p1, p6)
+vector2_arc2 = geompy.MakeVector(p1, p8)
+
+# create arcs from three points
+arc1 = geompy.MakeArc(p2, p3, p4)
+arc2 = geompy.MakeArc(p6, p7, p8)
+
+# create wires
+wire1 = geompy.MakeWire([vector1_arc1, arc1, vector2_arc1])
+wire2 = geompy.MakeWire([vector1_arc2, arc2, vector2_arc2])
+
+# create faces
+isPlanarWanted = 1
+face1 = geompy.MakeFace(wire1, isPlanarWanted)
+face2 = geompy.MakeFace(wire2, isPlanarWanted)
+
+# create prisms
+prism1 = geompy.MakePrism(face2, p1, p5)
+prism2 = geompy.MakePrismVecH(face1, vector, 50)
+prism3 = geompy.MakePrismVecH2Ways(face1, vector, 50)
+
+# add objects in the study
+id_face1   = geompy.addToStudy(face1,"Face1")
+id_face2   = geompy.addToStudy(face2,"Face2")
+id_prism1 = geompy.addToStudy(prism1,"Prism1")
+id_prism2 = geompy.addToStudy(prism2,"Prism2")
+id_prism3 = geompy.addToStudy(prism3,"Prism3")
+
+# display cylinders
+gg.createAndDisplayGO(id_face1)
+gg.setDisplayMode(id_face1,1)
+gg.createAndDisplayGO(id_face2)
+gg.setDisplayMode(id_face2,1)
+gg.createAndDisplayGO(id_prism1)
+gg.setDisplayMode(id_prism1,1)
+gg.createAndDisplayGO(id_prism2)
+gg.setDisplayMode(id_prism2,1) 
+gg.createAndDisplayGO(id_prism3)
+gg.setDisplayMode(id_prism3,1) 
diff --git a/doc/salome/examples/complex_objs_ex02.py b/doc/salome/examples/complex_objs_ex02.py
new file mode 100644 (file)
index 0000000..e096551
--- /dev/null
@@ -0,0 +1,34 @@
+# Creation of a Revolution
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a vertex and a vector
+p1 = geompy.MakeVertex(  10.,  10.,  10.)
+p2 = geompy.MakeVertex(  15.,  15.,  50.)
+p3 = geompy.MakeVertex(  40.,  40.,   0.)
+
+#create vectors from two points
+vector1 = geompy.MakeVector(p1, p2)
+vector2 = geompy.MakeVector(p1, p3)
+
+# create a vector from the given components
+vector3 = geompy.MakeVectorDXDYDZ(-20., -20., 100.)
+
+# create a wire
+wire = geompy.MakeWire([vector1, vector2])
+
+# create a revolution
+revolution = geompy.MakeRevolution(wire, vector3, 2.3)
+
+# add objects in the study
+id_vector3    = geompy.addToStudy(vector3,"Axis")
+id_wire       = geompy.addToStudy(wire,"Wire")
+id_revolution = geompy.addToStudy(revolution,"Revolution")
+
+# display the vector, the wire and the revolution
+gg.createAndDisplayGO(id_vector3)
+gg.createAndDisplayGO(id_wire)
+gg.createAndDisplayGO(id_revolution)
+gg.setDisplayMode(id_revolution,1) 
diff --git a/doc/salome/examples/complex_objs_ex03.py b/doc/salome/examples/complex_objs_ex03.py
new file mode 100644 (file)
index 0000000..ec7767b
--- /dev/null
@@ -0,0 +1,39 @@
+# Creation of a Filling
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+mindeg = 2
+maxdeg = 5
+tol3d  = 0.0001
+tol2d  = 0.0001
+nbiter = 5
+
+# create a vertex and a vector
+p1 = geompy.MakeVertex(  -30.,  -30.,  50.)
+p2 = geompy.MakeVertex(  -60.,  -60.,  30.)
+p3 = geompy.MakeVertex(  -30.,  -30.,  10.)
+
+# create an arc from three points
+arc = geompy.MakeArc(p1, p2, p3)
+ShapeListCompound = []
+i = 0
+while i <= 3 :
+    S = geompy.MakeTranslation(arc, i * 50., 0., 0.)
+    ShapeListCompound.append(S)
+    i = i + 1
+
+compound = geompy.MakeCompound(ShapeListCompound)
+
+# create a filling
+filling = geompy.MakeFilling(compound, mindeg, maxdeg, tol3d, tol2d, nbiter)
+
+# add objects in the study
+id_compound = geompy.addToStudy(compound,"Compound")
+id_filling = geompy.addToStudy(filling,"Filling")
+
+# display the compound and the filling
+gg.createAndDisplayGO(id_compound)
+gg.createAndDisplayGO(id_filling)
+gg.setDisplayMode(id_filling,1) 
diff --git a/doc/salome/examples/complex_objs_ex04.py b/doc/salome/examples/complex_objs_ex04.py
new file mode 100644 (file)
index 0000000..72af08f
--- /dev/null
@@ -0,0 +1,38 @@
+# Creation of a Pipe
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create vertices
+p0   = geompy.MakeVertex(0.  , 0.  , 0.  )
+px   = geompy.MakeVertex(100., 0.  , 0.  )
+py   = geompy.MakeVertex(0.  , 100., 0.  )
+pz   = geompy.MakeVertex(0.  , 0.  , 100.)
+pxyz = geompy.MakeVertex(100., 100., 100.)
+
+# create a vector from two points
+vxy = geompy.MakeVector(px, py)
+
+# create an arc from three points
+arc = geompy.MakeArc(py, pz, px)
+
+# create a wire
+wire = geompy.MakeWire([vxy, arc])
+
+# create an edge
+edge = geompy.MakeEdge(p0, pxyz)
+
+# create a pipe
+pipe = geompy.MakePipe(wire, edge)
+
+# add objects in the study
+id_wire = geompy.addToStudy(wire,"Wire")
+id_edge = geompy.addToStudy(edge,"Edge")
+id_pipe = geompy.addToStudy(pipe,"Pipe")
+
+# display the wire, the edge (path) and the pipe
+gg.createAndDisplayGO(id_wire)
+gg.createAndDisplayGO(id_edge)
+gg.createAndDisplayGO(id_pipe)
+gg.setDisplayMode(id_pipe,1) 
diff --git a/doc/salome/examples/complex_objs_ex05.py b/doc/salome/examples/complex_objs_ex05.py
new file mode 100644 (file)
index 0000000..724810c
--- /dev/null
@@ -0,0 +1,32 @@
+# Creation of a PipeWithDifferentSections
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+Wire_1 = 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])
+edges = geompy.SubShapeAll(Wire_1, geompy.ShapeType["EDGE"])
+vertices = geompy.SubShapeAll(Wire_1, geompy.ShapeType["VERTEX"])
+
+# create sections
+circles=[]
+circles.append(geompy.MakeCircle(vertices[0], edges[0], 20))
+circles.append(geompy.MakeCircle(vertices[1], edges[0], 40))
+circles.append(geompy.MakeCircle(vertices[2], edges[2], 30))
+circles.append(geompy.MakeCircle(vertices[3], edges[2], 20))
+
+# create pipe
+Pipe = geompy.MakePipeWithDifferentSections(circles, vertices, Wire_1, 0, 0)
+
+# add objects in the study
+geompy.addToStudy(circles[0], "circles1")
+geompy.addToStudy(circles[1], "circles2")
+geompy.addToStudy(circles[2], "circles3")
+geompy.addToStudy(circles[3], "circles4")
+id_wire = geompy.addToStudy(Wire_1, "Path")
+id_pipe = geompy.addToStudy(Pipe, "Pipe")
+
+# display the wire(path) and the pipe
+gg.createAndDisplayGO(id_wire)
+gg.createAndDisplayGO(id_pipe)
+gg.setDisplayMode(id_pipe,1) 
diff --git a/doc/salome/examples/complex_objs_ex06.py b/doc/salome/examples/complex_objs_ex06.py
new file mode 100644 (file)
index 0000000..a836b35
--- /dev/null
@@ -0,0 +1,192 @@
+# Creation of a PipeWithShellSections
+
+import geompy
+import salome
+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])
+
+#=======================================================
+#                 Create shell sections
+#=======================================================
+ps = [Vertex_1,Vertex_2,Vertex_3,Vertex_4]
+theLocations = [Vertex_1, Vertex_2, Vertex_3, Vertex_4]
+VC = geompy.MakeCompound(theLocations)
+geompy.addToStudy(VC,"VC")
+vs = [Edge_1,Edge_1,Edge_3,Edge_3]
+hs = [20,40,30,20]
+shells = []
+subbases = []
+
+# 1 section
+c0 = geompy.PointCoordinates(ps[0])
+c1 = geompy.PointCoordinates(ps[1])
+nx = c1[0] - c0[0]
+ny = c1[1] - c0[1]
+nz = c1[2] - c0[2]
+
+faces = []
+f1 = geompy.MakeSketcher("Sketcher:F 0 0:TT 20 0:TT 20 20:TT 0 20:WF",
+                         [c0[0], c0[1], c0[2], nx, ny, nz, 0, 0, 1])
+f2 = geompy.MakeSketcher("Sketcher:F 0 0:TT 0 20:TT -20 20:TT -20 0:WF",
+                         [c0[0], c0[1], c0[2], nx, ny, nz, 0, 0, 1])
+f3 = geompy.MakeSketcher("Sketcher:F 0 0:TT -20 0:TT -20 -20:TT 0 -20:WF",
+                         [c0[0], c0[1], c0[2], nx, ny, nz, 0, 0, 1])
+f4 = geompy.MakeSketcher("Sketcher:F 0 0:TT 0 -20:TT 20 -20:TT 20 0:WF",
+                         [c0[0], c0[1], c0[2], nx, ny, nz, 0, 0, 1])
+faces.append(f1)
+faces.append(f2)
+faces.append(f3)
+faces.append(f4)
+shell = geompy.MakeSewing(faces,1.e-6)
+shells.append(shell)
+faces = geompy.SubShapeAllSortedCentres(shell, geompy.ShapeType["FACE"])
+subbases.append(faces[0])
+
+# 2 section
+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)
+w = geompy.MakeWire([e1,e2,e3,arc])
+f1 = geompy.MakeFace(w,1)
+
+w = geompy.MakeSketcher("Sketcher:F -20 0:TT 0 0:TT 0 20:TT -20 20",
+                         [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)
+w = geompy.MakeWire([e1,e2,e3,arc])
+f2 = geompy.MakeFace(w,1)
+
+w = geompy.MakeSketcher("Sketcher:F 20 0:TT 0 0:TT 0 -20:TT 20 -20",
+                         [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)
+w = geompy.MakeWire([e1,e2,e3,arc])
+f3 = geompy.MakeFace(w,1)
+
+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)
+w = geompy.MakeWire([e1,e2,e3,arc])
+f4 = geompy.MakeFace(w,1)
+
+faces.append(f1)
+faces.append(f2)
+faces.append(f3)
+faces.append(f4)
+shell = geompy.MakeSewing(faces,1.e-6)
+shells.append(shell)
+faces = geompy.SubShapeAllSortedCentres(shell, geompy.ShapeType["FACE"])
+subbases.append(faces[0])
+
+# 3 section
+faces = []
+c2 = geompy.PointCoordinates(ps[2])
+c3 = geompy.PointCoordinates(ps[3])
+nx = c3[0] - c2[0]
+ny = c3[1] - c2[1]
+nz = c3[2] - c2[2]
+
+w = geompy.MakeSketcher("Sketcher:F 20 20:TT 0 20:TT 0 0:TT 20 0",
+                         [c2[0], c2[1], c2[2], nx, ny, nz, 0, 0, 1])
+[e1,e2,e3] = geompy.SubShapeAll(w, geompy.ShapeType["EDGE"])
+arc = MakeArc(w,3,1)
+w = geompy.MakeWire([e1,e2,e3,arc])
+f1 = geompy.MakeFace(w,1)
+
+w = geompy.MakeSketcher("Sketcher:F -20 0:TT 0 0:TT 0 20:TT -20 20",
+                         [c2[0], c2[1], c2[2], nx, ny, nz, 0, 0, 1])
+[e1,e2,e3] = geompy.SubShapeAll(w, geompy.ShapeType["EDGE"])
+arc = MakeArc(w,3,1)
+w = geompy.MakeWire([e1,e2,e3,arc])
+f2 = geompy.MakeFace(w,1)
+
+w = geompy.MakeSketcher("Sketcher:F 20 0:TT 0 0:TT 0 -20:TT 20 -20",
+                         [c2[0], c2[1], c2[2], nx, ny, nz, 0, 0, 1])
+[e1,e2,e3] = geompy.SubShapeAll(w, geompy.ShapeType["EDGE"])
+arc = MakeArc(w,3,1)
+w = geompy.MakeWire([e1,e2,e3,arc])
+f3 = geompy.MakeFace(w,1)
+
+w = geompy.MakeSketcher("Sketcher:F -20 -20:TT 0 -20:TT 0 0:TT -20 0",
+                         [c2[0], c2[1], c2[2], nx, ny, nz, 0, 0, 1])
+[e1,e2,e3] = geompy.SubShapeAll(w, geompy.ShapeType["EDGE"])
+arc = MakeArc(w,3,1)
+w = geompy.MakeWire([e1,e2,e3,arc])
+f4 = geompy.MakeFace(w,1)
+
+faces.append(f1)
+faces.append(f2)
+faces.append(f3)
+faces.append(f4)
+shell = geompy.MakeSewing(faces,1.e-6)
+shells.append(shell)
+faces = geompy.SubShapeAllSortedCentres(shell, geompy.ShapeType["FACE"])
+subbases.append(faces[2])
+
+# 4 section
+faces = []
+
+kk = 4
+dx = c3[0] - nx/kk
+dy = c3[1] - ny/kk
+dz = c3[2] - nz/kk
+rad = math.sqrt(nx*nx+ny*ny+nz*nz)
+vc = geompy.MakeVertex(dx,dy,dz)
+sph = geompy.MakeSpherePntR(vc,rad/kk)
+shellsph = geompy.SubShapeAll(sph, geompy.ShapeType["SHELL"])
+
+fs = []
+vec = geompy.MakeVectorDXDYDZ(0,0,1)
+ff = geompy.MakePlane(ps[3],vec,40)
+fs.append(ff)
+vp = geompy.MakeVertex(c3[0],c3[1],c3[2]+20)
+ff = geompy.MakePlane(vp,vec,40)
+fs.append(ff)
+vp = geompy.MakeVertex(c3[0],c3[1],c3[2]-20)
+ff = geompy.MakePlane(vp,vec,40)
+fs.append(ff)
+vec = geompy.MakeVectorDXDYDZ(1,0,0)
+ff = geompy.MakePlane(ps[3],vec,40)
+fs.append(ff)
+vp = geompy.MakeVertex(c3[0]+20,c3[1],c3[2])
+ff = geompy.MakePlane(vp,vec,40)
+fs.append(ff)
+vp = geompy.MakeVertex(c3[0]-20,c3[1],c3[2])
+ff = geompy.MakePlane(vp,vec,40)
+fs.append(ff)
+aPartition = geompy.MakePartition(shellsph,fs)
+fs = geompy.SubShapeAllSortedCentres(aPartition, geompy.ShapeType["FACE"])
+
+faces.append(fs[0])
+faces.append(fs[1])
+faces.append(fs[2])
+faces.append(fs[3])
+shell = geompy.MakeSewing(faces,1.e-6)
+shells.append(shell)
+faces = geompy.SubShapeAllSortedCentres(shell, geompy.ShapeType["FACE"])
+
+
+#===========================================================
+#                   Create Pipe
+#===========================================================
+subbases = []
+Pipe = geompy.MakePipeWithShellSections(shells, subbases, theLocations, WirePath,
+                                        theWithContact=0, theWithCorrection=0)
+
+# add objects in the study
+resc = geompy.MakeCompound(shells)
+id_sec = geompy.addToStudy(resc,"sections")
+id_wire = geompy.addToStudy(WirePath,"WirePath")
+id_pipe = geompy.addToStudy(Pipe, "Pipe")
+
+# display the wire(path), sections and the pipe
+gg.createAndDisplayGO(id_wire)
+gg.createAndDisplayGO(id_sec)
+gg.createAndDisplayGO(id_pipe)
+gg.setDisplayMode(id_pipe,1) 
diff --git a/doc/salome/examples/complex_objs_ex07.py b/doc/salome/examples/complex_objs_ex07.py
new file mode 100644 (file)
index 0000000..1b37a2e
--- /dev/null
@@ -0,0 +1,116 @@
+# Creation of a PipeShellsWithoutPath
+
+import geompy
+import math
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# Add a section based on quadrangles
+# ----------------------------------
+def section(s, p1, p2=None, p3=None, p4=None):
+    if p2==None:
+        q = p1
+    else:
+        q = geompy.MakeQuad4Vertices(p1, p2, p3, p4)
+        pass
+    s.append(q)
+    publish(q, "section")
+    return q
+
+
+# find distance between two points
+# -------------------------------
+def Dist(p1,p2):
+    c1 = geompy.PointCoordinates(p1)
+    c2 = geompy.PointCoordinates(p2)
+    return math.sqrt( (c2[0]-c1[0])*(c2[0]-c1[0]) +
+                      (c2[1]-c1[1])*(c2[1]-c1[1]) +
+                      (c2[2]-c1[2])*(c2[2]-c1[2]) )
+
+
+# return middle point
+# -------------------------------
+def MiddleVert(p1,p2):
+    c1 = geompy.PointCoordinates(p1)
+    c2 = geompy.PointCoordinates(p2)
+    return geompy.MakeVertex( (c2[0]+c1[0])/2, (c2[1]+c1[1])/2, (c2[2]+c1[2])/2 )
+
+
+# Complex section
+# result - 16 quads from lines
+# pnt - point from path
+# vec - direction from path
+def MakeComplexSect(pnt,vec,rmax,rmin,nb):
+    dang = 1.0/nb/2
+    cmax = geompy.MakeCircle(pnt,vec,rmax)
+    cmin = geompy.MakeCircle(pnt,vec,rmin)
+    faces = []
+    for i in range(0,2*nb,2):
+        p1 = geompy.MakeVertexOnCurve(cmin,dang*i)
+        p2 = geompy.MakeVertexOnCurve(cmax,dang*(i+1))
+        p3 = geompy.MakeVertexOnCurve(cmin,dang*(i+2))
+        f = geompy.MakeQuad4Vertices(pnt,p1,p2,p3)
+        faces.append(f)
+        pass
+    shell = geompy.MakeSewing(faces,1.e-6)
+    return shell
+
+
+#=======================================================
+#       Create simple path and recieve points
+#              for section creation
+#=======================================================
+WirePath = geompy.MakeSketcher("Sketcher:F 0 0:T 60 0:T 40 0:R 0:C 100 90:",
+                               [0, 0, 0, 0, 0, 1, 1, 0, 0])
+vs = geompy.SubShapeAll(WirePath, geompy.ShapeType["VERTEX"])
+
+#=======================================================
+#                 Create shell sections
+#=======================================================
+shells = []
+subbases = []
+locs = []
+
+# 1 section
+shell = MakeComplexSect(vs[0], geompy.MakeVectorDXDYDZ(1,0,0), 60, 40, 16)
+shells.append(shell)
+vs1 = geompy.SubShapeAllSortedCentres(shell,geompy.ShapeType["VERTEX"])
+locs.append(vs1[17])
+
+# 2 section
+shell = MakeComplexSect(vs[1], geompy.MakeVectorDXDYDZ(1,0,0), 80, 30, 16)
+shells.append(shell)
+vs2 = geompy.SubShapeAllSortedCentres(shell,geompy.ShapeType["VERTEX"])
+locs.append(vs2[17])
+
+# 3 section
+shell = MakeComplexSect(vs[2], geompy.MakeVectorDXDYDZ(1,0,0), 60, 40, 16)
+shells.append(shell)
+vs3 = geompy.SubShapeAllSortedCentres(shell,geompy.ShapeType["VERTEX"])
+locs.append(vs3[17])
+
+# 4 section
+shell = MakeComplexSect(vs[3], geompy.MakeVectorDXDYDZ(0,1,0), 40, 35, 16)
+shells.append(shell)
+vs4 = geompy.SubShapeAllSortedCentres(shell,geompy.ShapeType["VERTEX"])
+locs.append(vs4[17])
+
+
+#===========================================================
+#                   Create Pipe
+#===========================================================
+
+Pipe = geompy.MakePipeShellsWithoutPath(shells,locs)
+
+# add objects in the study
+resc = geompy.MakeCompound(shells)
+id_sec = geompy.addToStudy(resc,"sections")
+resl = geompy.MakeCompound(locs)
+id_loc = geompy.addToStudy(resl,"locations")
+id_pipe = geompy.addToStudy(Pipe, "Pipe")
+
+# display the sections, locations and pipe
+gg.createAndDisplayGO(id_sec)
+gg.createAndDisplayGO(id_loc)
+gg.createAndDisplayGO(id_pipe)
+gg.setDisplayMode(id_pipe,1) 
diff --git a/doc/salome/examples/complex_objs_ex08.py b/doc/salome/examples/complex_objs_ex08.py
new file mode 100644 (file)
index 0000000..4777e07
--- /dev/null
@@ -0,0 +1,76 @@
+# Creation of a PipeBiNormalAlongVector
+
+def MakeHelix(radius, height, rotation, direction):
+    #  - create a helix -
+    radius = 1.0 * radius
+    height = 1.0 * height
+    rotation = 1.0 * rotation
+    if direction > 0:
+        direction = +1
+    else:
+        direction = -1
+        pass
+    from math import sqrt
+    length_z  = height
+    length_xy = radius*rotation
+    length = sqrt(length_z*length_z + length_xy*length_xy)
+    import geompy
+    nb_steps = 1
+    epsilon = 1.0e-6
+    while 1:
+        z_step = height / nb_steps
+        angle_step = rotation / nb_steps
+        z = 0.0
+        angle = 0.0
+        helix_points = []
+        for n in range(nb_steps+1):
+            from math import cos, sin
+            x = radius * cos(angle)
+            y = radius * sin(angle)
+            p = geompy.MakeVertex(x, y, z)
+            helix_points.append( p )
+            z += z_step
+            angle += direction * angle_step
+            pass
+        helix = geompy.MakeInterpol(helix_points)
+        length_test = geompy.BasicProperties(helix)[0]
+        prec = abs(length-length_test)/length
+        # print nb_steps, length_test, prec
+        if prec < epsilon:
+            break
+        nb_steps *= 2
+        pass
+    return helix
+
+def MakeSpring(radius, height, rotation, direction, thread_radius, base_rotation=0.0):
+    #  - create a pipe -
+    thread_radius = 1.0 * thread_radius
+    # create a helix
+    helix = MakeHelix(radius, height, rotation, direction)
+    # base in the (Ox, Oz) plane
+    import geompy
+    p0 = geompy.MakeVertex(radius-3*thread_radius, 0.0, -thread_radius)
+    p1 = geompy.MakeVertex(radius+3*thread_radius, 0.0, -thread_radius)
+    p2 = geompy.MakeVertex(radius+3*thread_radius, 0.0, +thread_radius)
+    p3 = geompy.MakeVertex(radius-3*thread_radius, 0.0, +thread_radius)
+    e0 = geompy.MakeEdge(p0, p1)
+    e1 = geompy.MakeEdge(p1, p2)
+    e2 = geompy.MakeEdge(p2, p3)
+    e3 = geompy.MakeEdge(p3, p0)
+    w = geompy.MakeWire([e0, e1, e2, e3])
+    # create a base face
+    base = geompy.MakeFace(w, True)
+    # create a binormal vector
+    binormal = geompy.MakeVectorDXDYDZ(0.0, 0.0, 10.0)
+    # create a pipe
+    spring = geompy.MakePipeBiNormalAlongVector(base, helix, binormal)
+    # Publish in the study
+    geompy.addToStudy(base, "base")
+    geompy.addToStudy(helix, "helix")
+    geompy.addToStudy(binormal, "binormal")
+    geompy.addToStudy(spring, "spring")
+    return spring
+
+from math import pi
+
+spring = MakeSpring(50, 100, 2*pi, 1, 5, pi/2)
diff --git a/doc/salome/examples/complex_objs_ex09.py b/doc/salome/examples/complex_objs_ex09.py
new file mode 100644 (file)
index 0000000..55c347a
--- /dev/null
@@ -0,0 +1,43 @@
+# Creation of a Middle Path
+
+import salome
+import geompy
+
+# Create a box
+Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
+
+# Get two opposite faces
+[Face_1,Face_2] = geompy.SubShapes(Box_1, [31, 33])
+
+# Get edges
+Box_1_edge_12 = geompy.GetSubShape(Box_1, [12])
+Box_1_edge_22 = geompy.GetSubShape(Box_1, [22])
+Box_1_edge_25 = geompy.GetSubShape(Box_1, [25])
+Box_1_edge_29 = geompy.GetSubShape(Box_1, [29])
+Box_1_edge_8 = geompy.GetSubShape(Box_1, [8])
+Box_1_edge_18 = geompy.GetSubShape(Box_1, [18])
+Box_1_edge_26 = geompy.GetSubShape(Box_1, [26])
+Box_1_edge_30 = geompy.GetSubShape(Box_1, [30])
+
+# These three calls to RestorePath return the same result
+Path_1 = geompy.RestorePath(Box_1, Face_1, Face_2)
+Path_2 = geompy.RestorePathEdges(Box_1, [Face_1], [Face_2])
+Path_3 = geompy.RestorePathEdges(Box_1,
+                                 [Box_1_edge_12, Box_1_edge_22, Box_1_edge_25, Box_1_edge_29],
+                                 [Box_1_edge_8, Box_1_edge_18, Box_1_edge_26, Box_1_edge_30])
+
+# Publish created objects
+geompy.addToStudy( Box_1, 'Box_1' )
+geompy.addToStudyInFather( Box_1, Face_1, 'Face_1' )
+geompy.addToStudyInFather( Box_1, Face_2, 'Face_2' )
+geompy.addToStudyInFather( Box_1, Box_1_edge_25, 'Box_1:edge_25' )
+geompy.addToStudyInFather( Box_1, Box_1_edge_22, 'Box_1:edge_22' )
+geompy.addToStudyInFather( Box_1, Box_1_edge_12, 'Box_1:edge_12' )
+geompy.addToStudyInFather( Box_1, Box_1_edge_29, 'Box_1:edge_29' )
+geompy.addToStudyInFather( Box_1, Box_1_edge_18, 'Box_1:edge_18' )
+geompy.addToStudyInFather( Box_1, Box_1_edge_26, 'Box_1:edge_26' )
+geompy.addToStudyInFather( Box_1, Box_1_edge_8, 'Box_1:edge_8' )
+geompy.addToStudyInFather( Box_1, Box_1_edge_30, 'Box_1:edge_30' )
+geompy.addToStudy( Path_1, 'Path_1' )
+geompy.addToStudy( Path_2, 'Path_2' )
+geompy.addToStudy( Path_3, 'Path_3' )
diff --git a/doc/salome/examples/complex_objs_ex10.py b/doc/salome/examples/complex_objs_ex10.py
new file mode 100644 (file)
index 0000000..8a14455
--- /dev/null
@@ -0,0 +1,24 @@
+# Creation of Tangent Plane On Face
+
+import salome
+import geompy
+
+# Create Vertexes for curve
+Vertex_1 = geompy.MakeVertex(0, 0, 0)
+Vertex_2 = geompy.MakeVertex(0, 90, 30)
+Vertex_3 = geompy.MakeVertex(100, 90, 0)
+Vertex_4 = geompy.MakeVertex(-100, 90, 0)
+# Create curve
+Curve_1 = geompy.MakeInterpol([Vertex_4, Vertex_2, Vertex_3, Vertex_1])
+# Create Face by Extrusion of the Curve
+Extrusion_1 = geompy.MakePrismDXDYDZ(Curve_1, 0, 30, -60)
+# Make Tangent on this Extrusion (Face)
+Tangent_1 = geompy.MakeTangentPlaneOnFace(Extrusion_1, 0.7, 0.5, 150)
+# Publish in the study
+geompy.addToStudy( Vertex_1, "Vertex_1" )
+geompy.addToStudy( Vertex_2, "Vertex_2" )
+geompy.addToStudy( Vertex_3, "Vertex_3" )
+geompy.addToStudy( Vertex_4, "Vertex_4" )
+geompy.addToStudy( Curve_1, "Curve_1" )
+geompy.addToStudy( Extrusion_1, "Extrusion_1" )
+geompy.addToStudy( Tangent_1, "Tangent_1" )
diff --git a/doc/salome/examples/free_boundaries.py b/doc/salome/examples/free_boundaries.py
new file mode 100644 (file)
index 0000000..7582f79
--- /dev/null
@@ -0,0 +1,79 @@
+# Check Free Boundaries
+
+import os
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create boxes
+box1 = geompy.MakeBox(0,0,0,100,50,100)
+box2 = geompy.MakeBox(100,0,0,250,50,100)
+
+# make a compound
+compound = geompy.MakeCompound([box1, box2])
+
+# import from *.brep
+ImportFromBREP = geompy.ImportBREP(os.getenv("DATA_DIR")+"/Shapes/Brep/flight_solid.brep")
+
+# get a face
+faces = geompy.SubShapeAllSortedCentres(ImportFromBREP, geompy.ShapeType["FACE"])
+
+# get the free boundary for face 32
+Res = geompy.GetFreeBoundary(faces[32])
+isSuccess   = Res[0]
+ClosedWires = Res[1]
+OpenWires   = Res[2]
+
+if isSuccess == 1 :
+    print "Checking free boudaries is OK."
+else :
+    print "Checking free boudaries is KO!"
+print "len(ClosedWires) = ", len(ClosedWires)
+
+i = 0
+for wire in ClosedWires :
+    wire_name = "Face 32 -> Close wires : WIRE %d"%(i+1)
+    geompy.addToStudy(ClosedWires[i], wire_name)
+    if i < len(ClosedWires) :
+        i = i+ 1
+
+print "len(OpenWires) = ", len(OpenWires)
+
+i = 0
+for wire in OpenWires :
+    wire_name = "Face 32 -> Open wires : WIRE %d"%(i+1)
+    geompy.addToStudy(OpenWires[i], wire_name)
+    if i < len(OpenWires) :
+        i = i+ 1
+
+# get the free boundary for face 41
+Res = geompy.GetFreeBoundary(faces[41])
+isSuccess   = Res[0]
+ClosedWires = Res[1]
+OpenWires   = Res[2]
+
+if isSuccess == 1 :
+    print "Checking free boudaries is OK."
+else :
+    print "Checking free boudaries is KO!"
+print "len(ClosedWires) = ", len(ClosedWires)
+
+i = 0
+for wire in ClosedWires :
+    wire_name = "Face 41 -> Close wires : WIRE %d"%(i+1)
+    geompy.addToStudy(ClosedWires[i], wire_name)
+    if i < len(ClosedWires) :
+        i = i+ 1
+
+print "len(OpenWires) = ", len(OpenWires)
+
+i = 0
+for wire in OpenWires :
+    wire_name = "Face 41 -> Open wires : WIRE %d"%(i+1)
+    geompy.addToStudy(OpenWires[i], wire_name)
+    if i < len(OpenWires) :
+        i = i+ 1
+
+# add the imported object to the study
+id_ImportFromBREP = geompy.addToStudy(ImportFromBREP, "ImportFromBREP")
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/free_faces.py b/doc/salome/examples/free_faces.py
new file mode 100644 (file)
index 0000000..16d7056
--- /dev/null
@@ -0,0 +1,46 @@
+# Check Free Faces
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a vertex and a vector
+p1 = geompy.MakeVertex(35, 35, 0)
+p2 = geompy.MakeVertex(35, 35, 50)
+v = geompy.MakeVector(p1, p2)
+
+# create a cylinder
+cylinder = geompy.MakeCone(p1, v, 30, 20, 20)
+
+# create a cone
+cone = geompy.MakeCone(p1, v, 70, 40, 60)
+
+# make cut
+cut = geompy.MakeCut(cone, cylinder)
+
+# get faces as sub-shapes
+faces = []
+faces = geompy.SubShapeAllSortedCentres(cut, geompy.ShapeType["FACE"])
+f_2 = geompy.GetSubShapeID(cut, faces[0])
+
+# remove one face from the shape
+cut_without_f_2 = geompy.SuppressFaces(cut, [f_2])
+
+# suppress the specified wire
+result = geompy.GetFreeFacesIDs(cut_without_f_2)
+print "A number of free faces is ", len(result)
+
+# add objects in the study
+all_faces = geompy.SubShapeAllSortedCentres(cut_without_f_2, geompy.ShapeType["FACE"])
+for face in all_faces :
+    sub_shape_id = geompy.GetSubShapeID(cut_without_f_2, face)
+    if result.count(sub_shape_id) > 0 :
+        face_name = "Free face %d"%(sub_shape_id)
+        geompy.addToStudy(face, face_name)
+
+# in this example all faces from cut_without_f_2 are free
+id_cut_without_f_2 = geompy.addToStudy(cut_without_f_2, "Cut without f_2")
+
+# display the results
+gg.createAndDisplayGO(id_cut_without_f_2)
+gg.setDisplayMode(id_cut_without_f_2,1)
diff --git a/doc/salome/examples/get_non_blocks.py b/doc/salome/examples/get_non_blocks.py
new file mode 100644 (file)
index 0000000..267fa87
--- /dev/null
@@ -0,0 +1,26 @@
+# Get Non Blocks
+
+import geompy
+import salome
+
+# create solids
+box = geompy.MakeBoxDXDYDZ(100, 100, 100)
+cyl = geompy.MakeCylinderRH(100, 200)
+
+geompy.addToStudy(box, 'box')
+geompy.addToStudy(cyl, 'cyl')
+
+# make a compound
+compound = geompy.MakeCompound([box, cyl])
+geompy.addToStudy(compound, 'compound')
+
+# explore the compound
+pair = geompy.GetNonBlocks(compound)
+
+if pair[0] is not None:
+  geompy.addToStudyInFather(compound, pair[0], "GrNonBlocks")
+  pass
+
+if pair[1] is not None:
+  geompy.addToStudyInFather(compound, pair[1], "GrNonQuads")
+  pass
diff --git a/doc/salome/examples/import_export.py b/doc/salome/examples/import_export.py
new file mode 100644 (file)
index 0000000..ecde244
--- /dev/null
@@ -0,0 +1,40 @@
+# Import/Export
+
+import geompy
+import salome
+
+# Example of import from IGES using various formats
+
+# get a path to SAMPLES_SRC
+import os
+thePath = os.getenv("DATA_DIR")
+# create filenames
+theFileName1 = thePath + "/Shapes/Iges/boite-3Dipsos_m.igs"
+theFileName2 = thePath + "/Shapes/Iges/boite-3Dipsos_mm.igs"
+#print "thePath = ", thePath
+
+# get units from files
+UnitName1 = geompy.GetIGESUnit(theFileName1)
+UnitName2 = geompy.GetIGESUnit(theFileName2)
+print "UnitName1 = ", UnitName1
+print "UnitName2 = ", UnitName2
+
+# import shapes
+Shape1 = geompy.ImportIGES(theFileName1)
+Shape2 = geompy.ImportIGES(theFileName2)
+Shape3 = geompy.ImportFile(theFileName2,"IGES_SCALE")
+[Xmin1,Xmax1, Ymin1,Ymax1, Zmin1,Zmax1] = geompy.BoundingBox(Shape1)
+[Xmin2,Xmax2, Ymin2,Ymax2, Zmin2,Zmax2] = geompy.BoundingBox(Shape2)
+[Xmin3,Xmax3, Ymin3,Ymax3, Zmin3,Zmax3] = geompy.BoundingBox(Shape3)
+geompy.addToStudy(Shape1, "3Dipsos_m")
+geompy.addToStudy(Shape2, "3Dipsos_mm")
+geompy.addToStudy(Shape3, "3Dipsos_mm_scaled")
+d1 = (Xmax1-Xmin1)*(Xmax1-Xmin1) + (Ymax1-Ymin1)*(Ymax1-Ymin1) + (Zmax1-Zmin1)*(Zmax1-Zmin1)
+d2 = (Xmax2-Xmin2)*(Xmax2-Xmin2) + (Ymax2-Ymin2)*(Ymax2-Ymin2) + (Zmax2-Zmin2)*(Zmax2-Zmin2)
+d3 = (Xmax3-Xmin3)*(Xmax3-Xmin3) + (Ymax3-Ymin3)*(Ymax3-Ymin3) + (Zmax3-Zmin3)*(Zmax3-Zmin3)
+import math
+dd32 = math.sqrt(d3/d2)
+dd12 = math.sqrt(d1/d2)
+dd31 = math.sqrt(d3/d1)
+# values dd31, dd12 and dd31 can be using for checking
+print "dd32 = ",dd32,"  dd12 = ",dd12,"  dd31 = ",dd31
diff --git a/doc/salome/examples/inertia.py b/doc/salome/examples/inertia.py
new file mode 100644 (file)
index 0000000..203a394
--- /dev/null
@@ -0,0 +1,14 @@
+# Inertia
+
+import geompy
+import math
+
+# create a box
+box = geompy.MakeBoxDXDYDZ(100,30,100)
+In = geompy.Inertia(box)
+print "\nInertia matrix of box 100x30x100:"
+print " (", In[0], ", ", In[1], ", ", In[2], ")"
+print " (", In[3], ", ", In[4], ", ", In[5], ")"
+print " (", In[6], ", ", In[7], ", ", In[8], ")"
+print "Main moments of inertia of box 100x30x100:"
+print " Ix = ", In[9], ", Iy = ", In[10], ", Iz = ", In[11]
diff --git a/doc/salome/examples/min_distance.py b/doc/salome/examples/min_distance.py
new file mode 100644 (file)
index 0000000..e6048bb
--- /dev/null
@@ -0,0 +1,49 @@
+# Minimal Distance
+
+import geompy
+
+# Create two curves with three closest points
+Vertex_1 = geompy.MakeVertex(0, 0, 0)
+Vertex_2 = geompy.MakeVertex(0, 70, 0)
+Vertex_3 = geompy.MakeVertex(30, 100, 0)
+Vertex_4 = geompy.MakeVertex(60, 70, 0)
+Vertex_5 = geompy.MakeVertex(90, 100, 0)
+Vertex_6 = geompy.MakeVertex(120, 70, 0)
+Vertex_7 = geompy.MakeVertex(120, 0, 0)
+Vertex_8 = geompy.MakeVertex(90, -30, 0)
+Vertex_9 = geompy.MakeVertex(60, 0, 0)
+Vertex_10 = geompy.MakeVertex(30, -30, 0)
+
+geompy.addToStudy( Vertex_1, 'Vertex_1' )
+geompy.addToStudy( Vertex_2, 'Vertex_2' )
+geompy.addToStudy( Vertex_3, 'Vertex_3' )
+geompy.addToStudy( Vertex_4, 'Vertex_4' )
+geompy.addToStudy( Vertex_5, 'Vertex_5' )
+geompy.addToStudy( Vertex_6, 'Vertex_6' )
+geompy.addToStudy( Vertex_7, 'Vertex_7' )
+geompy.addToStudy( Vertex_8, 'Vertex_8' )
+geompy.addToStudy( Vertex_9, 'Vertex_9' )
+geompy.addToStudy( Vertex_10, 'Vertex_10' )
+
+Curve_a = geompy.MakeInterpol([Vertex_2, Vertex_3, Vertex_4, Vertex_5, Vertex_6], False, True)
+Curve_b = geompy.MakeInterpol([Vertex_1, Vertex_7, Vertex_8, Vertex_9, Vertex_10], False, True)
+
+geompy.addToStudy( Curve_a, 'Curve_a' )
+geompy.addToStudy( Curve_b, 'Curve_b' )
+
+# Get all closest points
+[nbSols, listCoords] = geompy.ClosestPoints(Curve_a, Curve_b)
+
+for i in range(nbSols):
+  v1 = geompy.MakeVertex(listCoords[i*6 + 0], listCoords[i*6 + 1], listCoords[i*6 + 2])
+  v2 = geompy.MakeVertex(listCoords[i*6 + 3], listCoords[i*6 + 4], listCoords[i*6 + 5])
+
+  geompy.addToStudy(v1, 'MinDist_%d_Curve_a'%(i+1))
+  geompy.addToStudy(v2, 'MinDist_%d_Curve_b'%(i+1))
+
+# Get minimum distance
+print "Minimal distance between Curve_a and Curve_b is", geompy.MinDistance(Curve_a, Curve_b)
+
+# Get minimum distance with components along axes
+[aDist, DX, DY, DZ] = geompy.MinDistanceComponents(Curve_a, Curve_b)
+print "Minimal distance between Curve_a and Curve_b is (", DX, ",", DY, ",", DZ, ")"
diff --git a/doc/salome/examples/normal_face.py b/doc/salome/examples/normal_face.py
new file mode 100644 (file)
index 0000000..572b0f9
--- /dev/null
@@ -0,0 +1,17 @@
+# Normal to a Face
+
+import geompy
+import math
+
+# create a box
+box = geompy.MakeBoxDXDYDZ(100,30,100)
+
+faces = geompy.SubShapeAllSortedCentres(box, geompy.ShapeType["FACE"])
+face0 = faces[0]
+vnorm = geompy.GetNormal(face0)
+if vnorm is None:
+  raise RuntimeError, "GetNormal(face0) failed"
+else:
+  geompy.addToStudy(face0, "Face0")
+  geompy.addToStudy(vnorm, "Normale to Face0")
+  print "\nNormale of face has been successfully obtained"
diff --git a/doc/salome/examples/notebook_geom.py b/doc/salome/examples/notebook_geom.py
new file mode 100644 (file)
index 0000000..a84ae87
--- /dev/null
@@ -0,0 +1,21 @@
+# Using SALOME NoteBook
+
+import geompy
+import salome
+import salome_notebook
+gg = salome.ImportComponentGUI("GEOM")
+
+# set variables
+notebook = salome_notebook.notebook
+notebook.set("Length", 150)
+notebook.set("Width", 100)
+
+# create box
+box = geompy.MakeBoxDXDYDZ("Length", "Width", 200)
+
+# add object in the study
+id_box = geompy.addToStudy(box,"Box")
+
+# display the boxes
+gg.createAndDisplayGO(id_box)
+gg.setDisplayMode(id_box,1)
diff --git a/doc/salome/examples/point_coordinates.py b/doc/salome/examples/point_coordinates.py
new file mode 100644 (file)
index 0000000..802c88c
--- /dev/null
@@ -0,0 +1,21 @@
+# Point Coordinates
+
+import math
+import geompy
+
+# create a point
+point = geompy.MakeVertex(15., 23., 80.)
+
+# get the coordinates of the point and check its values
+coords = geompy.PointCoordinates(point)
+
+# check the obtained coordinate values
+tolerance = 1.e-07
+def IsEqual(val1, val2): return (math.fabs(val1 - val2) < tolerance)
+
+if IsEqual(coords[0], 15.) and IsEqual(coords[1], 23.) and IsEqual(coords[2], 80.):
+    print "All values are OK."
+else :
+    print "Coordinates of point must be (15, 23, 80), but returned (",
+    print coords[0], ", ", coords[1], ", ", coords[2], ")"
+    pass
diff --git a/doc/salome/examples/primitives_ex01.py b/doc/salome/examples/primitives_ex01.py
new file mode 100644 (file)
index 0000000..77db019
--- /dev/null
@@ -0,0 +1,27 @@
+# Creation of a Box
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create vertices
+p0 = geompy.MakeVertex(15, 25, 35)
+p70 = geompy.MakeVertex(70, 70, 70)
+
+# create boxes
+box1 = geompy.MakeBoxDXDYDZ(10, 20, 30)
+box2 = geompy.MakeBox(10,20,30, 15,25,35)
+box3 = geompy.MakeBoxTwoPnt(p0, p70)
+
+# add objects in the study
+id_box1 = geompy.addToStudy(box1,"Box1")
+id_box2 = geompy.addToStudy(box2,"Box2")
+id_box3 = geompy.addToStudy(box3,"Box3")
+
+# display the boxes
+gg.createAndDisplayGO(id_box1)
+gg.setDisplayMode(id_box1,1)
+gg.createAndDisplayGO(id_box2)
+gg.setDisplayMode(id_box2,1)
+gg.createAndDisplayGO(id_box3)
+gg.setDisplayMode(id_box3,1)
diff --git a/doc/salome/examples/primitives_ex02.py b/doc/salome/examples/primitives_ex02.py
new file mode 100644 (file)
index 0000000..ed6a6f9
--- /dev/null
@@ -0,0 +1,30 @@
+# Creation of a Cylinder
+
+import geompy
+import salome
+
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a vertex and a vector
+p1 = geompy.MakeVertex(25, 35, 45)
+p2 = geompy.MakeVertex(70, 70, 70)
+v = geompy.MakeVector(p1, p2)
+
+# create cylinders
+height = 40
+
+radius1 = 15
+cylinder1 = geompy.MakeCylinder(p1, v, radius1, height)
+
+radius2 = 30
+cylinder2 = geompy.MakeCylinderRH(radius2, height)
+
+# add objects in the study
+id_cylinder1 = geompy.addToStudy(cylinder1,"Cylinder1")
+id_cylinder2 = geompy.addToStudy(cylinder2,"Cylinder2")
+
+# display the cylinders
+gg.createAndDisplayGO(id_cylinder1)
+gg.setDisplayMode(id_cylinder1,1)
+gg.createAndDisplayGO(id_cylinder2)
+gg.setDisplayMode(id_cylinder2,1)
diff --git a/doc/salome/examples/primitives_ex03.py b/doc/salome/examples/primitives_ex03.py
new file mode 100644 (file)
index 0000000..21dbc9e
--- /dev/null
@@ -0,0 +1,29 @@
+# Creation of a Sphere
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a vertex
+p = geompy.MakeVertex(55, 45, 25)
+
+# create spheres
+radius1 = 20
+sphere1 = geompy.MakeSpherePntR(p, radius1)
+radius2 = 15
+sphere2 = geompy.MakeSphere(0, 0, 45, radius2)
+radius3 = 30
+sphere3 = geompy.MakeSphereR(radius3)
+
+# add objects in the study
+id_sphere1 = geompy.addToStudy(sphere1,"Sphere1")
+id_sphere2 = geompy.addToStudy(sphere2,"Sphere2")
+id_sphere3 = geompy.addToStudy(sphere3,"Sphere3")
+
+# display spheres
+gg.createAndDisplayGO(id_sphere1)
+gg.setDisplayMode(id_sphere1,1)
+gg.createAndDisplayGO(id_sphere2)
+gg.setDisplayMode(id_sphere2,1)
+gg.createAndDisplayGO(id_sphere3)
+gg.setDisplayMode(id_sphere3,1)
diff --git a/doc/salome/examples/primitives_ex04.py b/doc/salome/examples/primitives_ex04.py
new file mode 100644 (file)
index 0000000..99a003a
--- /dev/null
@@ -0,0 +1,24 @@
+# Creation of a Torus
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a vertex and a vector
+p1 = geompy.MakeVertex(35, 40, 45)
+p2 = geompy.MakeVertex(35, 45, 70)
+v = geompy.MakeVector(p1, p2)
+
+# create toruses
+torus1 = geompy.MakeTorus(p1, v, 20, 10)
+torus2 = geompy.MakeTorusRR(30, 15)
+
+# add objects in the study
+id_torus1 = geompy.addToStudy(torus1,"Torus1")
+id_torus2 = geompy.addToStudy(torus2,"Torus2")
+
+# display toruses
+gg.createAndDisplayGO(id_torus1)
+gg.setDisplayMode(id_torus1,1)
+gg.createAndDisplayGO(id_torus2)
+gg.setDisplayMode(id_torus2,1)
diff --git a/doc/salome/examples/primitives_ex05.py b/doc/salome/examples/primitives_ex05.py
new file mode 100644 (file)
index 0000000..b563303
--- /dev/null
@@ -0,0 +1,24 @@
+# Creation of a Cone
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a vertex and a vector
+p1 = geompy.MakeVertex(35, 35, 0)
+p2 = geompy.MakeVertex(35, 35, 70)
+v = geompy.MakeVector(p1, p2)
+
+# create cones
+cone1 = geompy.MakeCone(p1, v, 17, 1, 20)
+cone2 = geompy.MakeConeR1R2H(30, 10, 30)
+
+# add objects in the study
+id_cone1 = geompy.addToStudy(cone1,"Cone1")
+id_cone2 = geompy.addToStudy(cone2,"Cone2")
+
+# display cones
+gg.createAndDisplayGO(id_cone1)
+gg.setDisplayMode(id_cone1,1)
+gg.createAndDisplayGO(id_cone2)
+gg.setDisplayMode(id_cone2,1)
diff --git a/doc/salome/examples/primitives_ex06.py b/doc/salome/examples/primitives_ex06.py
new file mode 100644 (file)
index 0000000..c558eaf
--- /dev/null
@@ -0,0 +1,35 @@
+# Creation of a Disk
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create vertices
+p0 = geompy.MakeVertex(0., 0., 0.)
+px = geompy.MakeVertex(100., 0.  , 0.  )
+py = geompy.MakeVertex(0.  , 100., 0.  )
+pz = geompy.MakeVertex(0.  , 0.  , 100.)
+
+# create a vector on two points
+vxy  = geompy.MakeVector(px, py)
+
+# create a disk in OXY plane
+disk1 = geompy.MakeDiskR(100, 1)
+
+# create a disk from a point, a vector and a radius
+disk2 = geompy.MakeDiskPntVecR(pz, vxy, 30)
+
+#create a circle from three points
+disk3 = geompy.MakeDiskThreePnt(p0, px, py)
+
+# add objects in the study
+id_vxy    = geompy.addToStudy(vxy,  "Vector")
+id_disk1  = geompy.addToStudy(disk1,"Disk1")
+id_disk2  = geompy.addToStudy(disk2,"Disk2")
+id_disk3  = geompy.addToStudy(disk3,"Disk3")
+
+# display disks
+gg.createAndDisplayGO(id_vxy)
+gg.createAndDisplayGO(id_disk1)
+gg.createAndDisplayGO(id_diks2)
+gg.createAndDisplayGO(id_diks3)
diff --git a/doc/salome/examples/primitives_ex07.py b/doc/salome/examples/primitives_ex07.py
new file mode 100644 (file)
index 0000000..75dad1e
--- /dev/null
@@ -0,0 +1,31 @@
+# Creation of a Rectangle
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create vertices
+px = geompy.MakeVertex(100., 0.  , 0.  )
+py = geompy.MakeVertex(0.  , 100., 0.  )
+
+# create a vector on two points
+vxy  = geompy.MakeVector(px, py)
+
+# create a rectangle in OXY plane
+face1 = geompy.MakeFaceHW(100, 100, 1)
+
+# create a rectangle using normal vector
+face2 = geompy.MakeFaceObjHW(vxy, 50, 150)
+
+# create a rectangle from other face
+face3 = geompy.MakeFaceObjHW(face2, 150, 50)
+
+# add objects in the study
+id_face1  = geompy.addToStudy(face1,"Face1")
+id_face2  = geompy.addToStudy(face2,"Face2")
+id_face3  = geompy.addToStudy(face3,"Face3")
+
+# display rectangles
+gg.createAndDisplayGO(id_face1)
+gg.createAndDisplayGO(id_face2)
+gg.createAndDisplayGO(id_face3)
diff --git a/doc/salome/examples/repairing_operations_ex01.py b/doc/salome/examples/repairing_operations_ex01.py
new file mode 100644 (file)
index 0000000..8a57db0
--- /dev/null
@@ -0,0 +1,46 @@
+# Shape Processing
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create vertices, an edge, an arc, a wire, a face and a prism
+p1 = geompy.MakeVertex(0,0,0)
+p2 = geompy.MakeVertex(200,0,0)
+p3 = geompy.MakeVertex(100,150,0)
+edge = geompy.MakeEdge(p1,p2)
+arc  = geompy.MakeArc(p1,p3,p2)
+wire = geompy.MakeWire([edge,arc])
+face = geompy.MakeFace(wire, 1)
+theShape = geompy.MakePrismVecH(face, edge, 130)
+
+# check the shape at the beginning
+print "Before ProcessShape:"
+isValid = geompy.CheckShape(theShape)
+if isValid == 0:
+    print "The shape is not valid"
+else:
+    print "The shape seems to be valid"
+
+# process the Shape
+Operators = ["FixShape"]
+Parameters = ["FixShape.Tolerance3d"]
+Values = ["1e-7"]
+PS = geompy.ProcessShape(theShape, Operators, Parameters, Values)
+
+# check the shape at the end
+print "After ProcessShape:"
+isValid = geompy.CheckShape(PS)
+if isValid == 0:
+    print "The shape is not valid"
+    raise RuntimeError, "It seems, that the ProcessShape() has failed"
+else:
+    print "The shape seems to be valid"
+
+# add in the study and display
+Id_Shape = geompy.addToStudy(theShape, "Invalid Shape")
+Id_PS    = geompy.addToStudy(PS, "Processed Shape")
+gg.createAndDisplayGO(Id_Shape)
+gg.setDisplayMode(Id_Shape,1)
+gg.createAndDisplayGO(Id_PS)
+gg.setDisplayMode(Id_PS,1) 
diff --git a/doc/salome/examples/repairing_operations_ex02.py b/doc/salome/examples/repairing_operations_ex02.py
new file mode 100644 (file)
index 0000000..f5ee65c
--- /dev/null
@@ -0,0 +1,28 @@
+# Suppress Faces
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a box
+box = geompy.MakeBoxDXDYDZ(200, 200, 200)
+
+# The list of IDs (IDList) for suppress faces
+sup_faces = []
+sup_faces = geompy.SubShapeAllSortedCentres(box, geompy.ShapeType["FACE"])
+
+# get indices of the sub-shape
+f1_id = geompy.GetSubShapeID(box, sup_faces[3])
+
+# remove faces from the given object (shape)
+result = geompy.SuppressFaces(box, [f1_id])
+
+# add objects in the study
+id_box = geompy.addToStudy(box, "Box")
+id_result = geompy.addToStudy(result, "Result")
+
+# display the results
+gg.createAndDisplayGO(id_box)
+gg.setDisplayMode(id_box,1)
+gg.createAndDisplayGO(id_result)
+gg.setDisplayMode(id_result,1)
diff --git a/doc/salome/examples/repairing_operations_ex03.py b/doc/salome/examples/repairing_operations_ex03.py
new file mode 100644 (file)
index 0000000..50eec11
--- /dev/null
@@ -0,0 +1,30 @@
+# Close Contour
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create vertices and vectors
+p0  = geompy.MakeVertex(  0.,   0.,   0.)
+px  = geompy.MakeVertex(100.,   0.,   0.)
+py  = geompy.MakeVertex(  0., 100.,   0.)
+py1 = geompy.MakeVertex(  0., 140.,   0.)
+pz  = geompy.MakeVertex(  0.,   0., 100.)
+vxy = geompy.MakeVector(px, py)
+
+# create an arc
+arc = geompy.MakeArc(py1, pz, px)
+
+# create a wire
+wire = geompy.MakeWire([vxy, arc])
+
+# close an open wire by creation of an edge between ends
+wire_close = geompy.CloseContour(wire, [1], 0)
+
+# add objects in the study
+id_wire = geompy.addToStudy(wire, "Wire")
+id_wire_close = geompy.addToStudy(wire_close, "Wire close")
+
+# display the results
+gg.createAndDisplayGO(id_wire)
+gg.createAndDisplayGO(id_wire_close) 
diff --git a/doc/salome/examples/repairing_operations_ex04.py b/doc/salome/examples/repairing_operations_ex04.py
new file mode 100644 (file)
index 0000000..fad6913
--- /dev/null
@@ -0,0 +1,34 @@
+# Suppress Internal Wires
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a vertex and a vector
+p1 = geompy.MakeVertex(55, 65, 50)
+p2 = geompy.MakeVertex(55,  0, 50)
+v = geompy.MakeVector(p1, p2)
+
+# create a cylinder
+height = 100
+radius1 = 40
+cylinder = geompy.MakeCylinder(p1, v, radius1, height)
+
+# create a box
+box = geompy.MakeBoxDXDYDZ(100, 100, 100)
+
+# make a cut
+cut = geompy.MakeCut(box, cylinder)
+
+# suppress all internal wires
+result = geompy.SuppressInternalWires(cut, [])
+
+# add objects in the study
+id_cut = geompy.addToStudy(cut, "Cut")
+id_result = geompy.addToStudy(result, "Result")
+
+# display the results
+gg.createAndDisplayGO(id_cut)
+gg.setDisplayMode(id_cut,1)
+gg.createAndDisplayGO(id_result)
+gg.setDisplayMode(id_result,1) 
diff --git a/doc/salome/examples/repairing_operations_ex05.py b/doc/salome/examples/repairing_operations_ex05.py
new file mode 100644 (file)
index 0000000..f6593b3
--- /dev/null
@@ -0,0 +1,50 @@
+# Suppress Holes
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a vertex and a vector
+p1 = geompy.MakeVertex(35, 35, 0)
+p2 = geompy.MakeVertex(35, 35, 50)
+v = geompy.MakeVector(p1, p2)
+
+# create a cylinder
+height = 20
+radius1 = 20
+cylinder = geompy.MakeCylinder(p1, v, radius1, height)
+
+# create a cone
+cone = geompy.MakeCone(p1, v, 70, 0, 80)
+
+# make a cut
+cut = geompy.MakeCut(cone, cylinder)
+
+# get faces as sub-shapes
+faces = []
+faces = geompy.SubShapeAllSortedCentres(cut, geompy.ShapeType["FACE"])
+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])
+
+# suppress the selected wire
+result = geompy.SuppressHoles(cut_without_f_2, [w_0])
+
+# add objects in the study
+id_cut = geompy.addToStudy(cut, "Cut")
+id_cut_without_f_2 = geompy.addToStudy(cut_without_f_2, "Cut without f_2")
+id_result = geompy.addToStudy(result, "Result")
+
+# display the results
+gg.createAndDisplayGO(id_cut)
+gg.setDisplayMode(id_cut,1)
+gg.createAndDisplayGO(id_cut_without_f_2)
+gg.setDisplayMode(id_cut_without_f_2,1)
+gg.createAndDisplayGO(id_result)
+gg.setDisplayMode(id_result,1) 
diff --git a/doc/salome/examples/repairing_operations_ex06.py b/doc/salome/examples/repairing_operations_ex06.py
new file mode 100644 (file)
index 0000000..e6120a7
--- /dev/null
@@ -0,0 +1,39 @@
+# Sewing
+
+import geompy
+import salome
+import math
+gg = salome.ImportComponentGUI("GEOM")
+
+# create base points
+px = geompy.MakeVertex(100., 0., 0.)
+py = geompy.MakeVertex(0., 100., 0.)
+pz = geompy.MakeVertex(0., 0., 100.)
+
+# create base geometry 2D & 3D
+vector = geompy.MakeVector(px, py)
+arc = geompy.MakeArc(py, pz, px)
+
+# create base objects
+angle = 45. * math.pi / 180
+WantPlanarFace = 1 #True
+wire = geompy.MakeWire([vector, arc])
+face = geompy.MakeFace(wire, WantPlanarFace)
+face_rot = geompy.MakeRotation(face, vector, angle)
+
+# make sewing
+precision = 0.00001
+sewing = geompy.MakeSewing([face, face_rot], precision)
+
+# add objects in the study
+id_face = geompy.addToStudy(face, "Face")
+id_face_rot = geompy.addToStudy(face_rot, "Face rotation")
+id_sewing = geompy.addToStudy(sewing, "Sewing")
+
+# display the results
+gg.createAndDisplayGO(id_face)
+gg.setDisplayMode(id_face,1)
+gg.createAndDisplayGO(id_face_rot)
+gg.setDisplayMode(id_face_rot,1)
+gg.createAndDisplayGO(id_sewing)
+gg.setDisplayMode(id_sewing,1) 
diff --git a/doc/salome/examples/repairing_operations_ex07.py b/doc/salome/examples/repairing_operations_ex07.py
new file mode 100644 (file)
index 0000000..6cc688a
--- /dev/null
@@ -0,0 +1,32 @@
+# Glue Faces
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create boxes
+box1 = geompy.MakeBox(0,0,0,100,50,100)
+box2 = geompy.MakeBox(100,0,0,250,50,100)
+
+# make compound
+compound = geompy.MakeCompound([box1, box2])
+
+# glue compound's faces
+tolerance = 1e-5
+glue = geompy.MakeGlueFaces(compound, tolerance)
+
+# add objects in study
+id_box1 = geompy.addToStudy(box1, "Box1")
+id_box2 = geompy.addToStudy(box2, "Box2")
+id_compound = geompy.addToStudy(compound, "Compound")
+id_glue = geompy.addToStudy(glue, "Glue faces")
+
+# display results
+gg.createAndDisplayGO(id_box1)
+gg.setDisplayMode(id_box1,1)
+gg.createAndDisplayGO(id_box2)
+gg.setDisplayMode(id_box2,1)
+gg.createAndDisplayGO(id_compound)
+gg.setDisplayMode(id_compound,1)
+gg.createAndDisplayGO(id_glue)
+gg.setDisplayMode(id_glue,1) 
diff --git a/doc/salome/examples/repairing_operations_ex08.py b/doc/salome/examples/repairing_operations_ex08.py
new file mode 100644 (file)
index 0000000..a39d110
--- /dev/null
@@ -0,0 +1,30 @@
+# Glue Edges
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create boxes
+box1 = geompy.MakeBox(0,0,0,100,50,100)
+box2 = geompy.MakeBox(100,0,0,250,50,100)
+
+# make compound
+compound = geompy.MakeCompound([box1, box2])
+
+# glue all compound's edges
+tolerance = 1e-5
+glue1 = geompy.MakeGlueEdges(compound, tolerance)
+
+# glue some compound's edges
+list_edges = geompy.GetGlueEdges(compound, tolerance)
+glue2 = geompy.MakeGlueEdgesByList(compound, tolerance, [list_edges[0], list_edges[2]])
+
+# add objects in study
+geompy.addToStudy(box1, "Box1")
+geompy.addToStudy(box2, "Box2")
+geompy.addToStudy(compound, "Compound")
+geompy.addToStudy(glue1, "Glue all edges")
+geompy.addToStudy(glue2, "Glue two edges")
+
+if salome.sg.hasDesktop():
+  salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/repairing_operations_ex09.py b/doc/salome/examples/repairing_operations_ex09.py
new file mode 100644 (file)
index 0000000..41807fe
--- /dev/null
@@ -0,0 +1,33 @@
+# Limit Tolerance
+
+import geompy
+gg = salome.ImportComponentGUI("GEOM")
+
+# import initial topology
+shape1 = geompy.ImportBREP("my_shape_1.brep")
+shape2 = geompy.ImportBREP("my_shape_2.brep")
+
+geompy.addToStudy(shape1, "Shape 1")
+geompy.addToStudy(shape2, "Shape 2")
+
+# perform partition
+try:
+    part = geompy.MakePartition([shape1, shape2])
+except:
+    # limit tolerance
+    tolerance = 1e-07
+    shape1_lt = geompy.LimitTolerance(shape1, tolerance)
+    shape2_lt = geompy.LimitTolerance(shape2, tolerance)
+
+    # process shape
+    good_shape1 = geompy.ProcessShape(shape1_lt, ["FixShape"], ["FixShape.Tolerance3d"], ["1e-7"])
+    good_shape2 = geompy.ProcessShape(shape2_lt, ["FixShape"], ["FixShape.Tolerance3d"], ["1e-7"])
+
+    geompy.addToStudy(good_shape1, "Shape 1 corrected")
+    geompy.addToStudy(good_shape2, "Shape 2 corrected")
+
+    # perform partition on corrected shapes
+    part = geompy.MakePartition([good_shape1, good_shape2])
+    pass
+
+geompy.addToStudy(part, "Partition")
diff --git a/doc/salome/examples/repairing_operations_ex10.py b/doc/salome/examples/repairing_operations_ex10.py
new file mode 100644 (file)
index 0000000..7849a7c
--- /dev/null
@@ -0,0 +1,27 @@
+# Add Point on Edge
+
+import geompy
+import salome
+
+# create vertices
+p1 = geompy.MakeVertex(0,0,50)
+p2 = geompy.MakeVertex(60,0,50)
+
+# make an edge
+edge = geompy.MakeEdge(p1, p2) #geompy.GetSubShape(box, edge_ind)
+
+# divide an edge
+divide = geompy.DivideEdge(edge, -1, 0.5, 0)
+
+# add objects in the study
+id_edge = geompy.addToStudy(edge, "Edge")
+edge_points = geompy.SubShapeAllSortedCentres(edge, geompy.ShapeType["VERTEX"])
+for point in edge_points:
+    geompy.addToStudyInFather(edge, point, "Edge's point")
+
+id_divide = geompy.addToStudy(divide, "Divided edge")
+edge_points = geompy.SubShapeAllSortedCentres(divide, geompy.ShapeType["VERTEX"])
+for point in edge_points:
+    geompy.addToStudyInFather(divide, point, "Edge's point after divide")
+
+salome.sg.updateObjBrowser(1) 
diff --git a/doc/salome/examples/repairing_operations_ex11.py b/doc/salome/examples/repairing_operations_ex11.py
new file mode 100644 (file)
index 0000000..396881c
--- /dev/null
@@ -0,0 +1,49 @@
+# Fuse Collinear Edges within a Wire
+
+import geompy
+import salome
+
+# create vertices
+p1 = geompy.MakeVertex(0, 0, 0)
+p2 = geompy.MakeVertex(70, 0, 0)
+p3 = geompy.MakeVertex(70, 50, 0)
+p4 = geompy.MakeVertex(70, 80, 0)
+p5 = geompy.MakeVertex(50, 80, 0)
+p6 = geompy.MakeVertex(20, 80, 0)
+p7 = geompy.MakeVertex(0, 80, 0)
+p8 = geompy.MakeVertex(0, 30, 0)
+
+points = [p1, p2, p3, p4, p5, p6, p7, p8]
+
+# make a wire
+wire_1 = geompy.MakePolyline(points, True)
+
+# suppress some vertices in the wire
+wire_2 = geompy.FuseCollinearEdgesWithinWire(wire_1, [p3])
+wire_3 = geompy.FuseCollinearEdgesWithinWire(wire_1, [p5, p6])
+
+# suppress all suitable vertices in the wire
+wire_4 = geompy.FuseCollinearEdgesWithinWire(wire_1, [])
+
+wires = [wire_1, wire_2, wire_3, wire_4]
+
+# add objects in the study
+ii = 1
+for point in points:
+    geompy.addToStudy(point, "p%d"%ii)
+    ii = ii + 1
+    pass
+
+ii = 1
+for wire in wires:
+    geompy.addToStudy(wire, "wire_%d"%ii)
+    wire_points = geompy.SubShapeAllSortedCentres(wire, geompy.ShapeType["VERTEX"])
+    jj = 1
+    for point in wire_points:
+        geompy.addToStudyInFather(wire, point, "point_%d"%jj)
+        jj = jj + 1
+        pass
+    ii = ii + 1
+    pass
+
+salome.sg.updateObjBrowser(1) 
diff --git a/doc/salome/examples/sketcher.py b/doc/salome/examples/sketcher.py
new file mode 100644 (file)
index 0000000..8ca1f98
--- /dev/null
@@ -0,0 +1,42 @@
+# 2D Sketcher
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create vertices
+p1 = geompy.MakeVertex(70.,  0.,  0.)
+p2 = geompy.MakeVertex(70., 70., 80.)
+p3 = geompy.MakeVertex( 0., 70.,  0.)
+
+#create a vector from two points
+vector_arc = geompy.MakeVector(p1, p3)
+
+# create an arc from three points
+arc = geompy.MakeArc(p1, p2, p3)
+
+# create a wire
+wire = geompy.MakeWire([vector_arc, arc])
+
+# create a planar face
+isPlanarWanted = 1
+face = geompy.MakeFace(wire, isPlanarWanted)
+
+# create a sketcher (face), following the textual description
+sketcher1 = geompy.MakeSketcher("Sketcher:F -100 -100:TT 250 -100:R 0:C 100 150:R 0:L 300:WF",
+                                [100,0,0, 1,1,1, -1,1,0])
+
+# create a sketcher (wire) on the given face
+sketcher2 = geompy.MakeSketcherOnPlane("Sketcher:F 10 -30:R 10:C 20 180:R 15:L 50:WW", face)
+
+# add objects in the study
+id_face = geompy.addToStudy(face,"Face")
+id_sketcher1 = geompy.addToStudy(sketcher1,"Sketcher1")
+id_sketcher2 = geompy.addToStudy(sketcher2,"Sketcher2")
+
+# display the first sketcher and the second sketcher with its planar face
+gg.createAndDisplayGO(id_face)
+gg.setDisplayMode(id_face,1)
+gg.setTransparency(id_face,0.5)
+gg.createAndDisplayGO(id_sketcher1)
+gg.createAndDisplayGO(id_sketcher2) 
diff --git a/doc/salome/examples/testme.py b/doc/salome/examples/testme.py
new file mode 100755 (executable)
index 0000000..d8a9820
--- /dev/null
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+
+import unittest, sys
+
+class SalomeSession(object):
+    def __init__(self, script):
+        import runSalome
+        sys.argv  = ["runSalome.py"]
+        sys.argv += ["--terminal"]
+        sys.argv += ["--modules=GEOM"]
+        sys.argv += ["--execute=%s" % script]
+        clt, d = runSalome.main()
+        self.port = d['port']
+        return
+
+    def __del__(self):
+        port = self.port
+        import killSalomeWithPort
+        killSalomeWithPort.killMyPort(port)
+        return
+    pass
+
+class MyTest(unittest.TestCase):
+    def testFunction(self):
+        SalomeSession(sys.argv[1])
+    pass
+
+unittest.main(argv=sys.argv[:1])
diff --git a/doc/salome/examples/tolerance.py b/doc/salome/examples/tolerance.py
new file mode 100644 (file)
index 0000000..639a676
--- /dev/null
@@ -0,0 +1,14 @@
+# Tolerance
+
+import geompy
+
+# create a box
+box = geompy.MakeBoxDXDYDZ(100,30,100)
+Toler = geompy.Tolerance(box)
+print "\nBox 100x30x100 tolerance:"
+print " Face min. tolerance: ", Toler[0]
+print " Face max. tolerance: ", Toler[1]
+print " Edge min. tolerance: ", Toler[2]
+print " Edge max. tolerance: ", Toler[3]
+print " Vertex min. tolerance: ", Toler[4]
+print " Vertex max. tolerance: ", Toler[5]
diff --git a/doc/salome/examples/topological_geom_objs_ex01.py b/doc/salome/examples/topological_geom_objs_ex01.py
new file mode 100644 (file)
index 0000000..77c1d18
--- /dev/null
@@ -0,0 +1,57 @@
+# Creation of an Edge
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+#
+# create edge by two points
+#
+
+# create vertices
+p0   = geompy.MakeVertex(0.  , 0.  , 0.  )
+pxyz = geompy.MakeVertex(100., 100., 100.)
+
+# create an edge
+edge = geompy.MakeEdge(p0, pxyz)
+
+# add object in the study
+id_edge = geompy.addToStudy(edge,"Edge_1")
+
+# display an edge
+gg.createAndDisplayGO(id_edge) 
+
+#
+# create edge from wire
+#
+
+# create a circle
+c = geompy.MakeCircle(None, None, 100)
+
+# create a wire
+w = geompy.MakeWire([c], 1e-07)
+
+# create an edge from wire
+edge = geompy.MakeEdgeWire(w)
+
+# add object in the study
+id_edge = geompy.addToStudy(edge,"Edge_2")
+
+# display an edge
+gg.createAndDisplayGO(id_edge) 
+
+#
+# create edge from existing curve and a length
+#
+
+# create a circle
+c = geompy.MakeCircle(None, None, 100)
+
+# create an edge of length 25.0 from the circle
+edge = geompy.MakeEdgeOnCurveByLength(c, 25.0)
+
+# add object in the study
+id_edge = geompy.addToStudy(edge,"Edge_3")
+
+# display an edge
+gg.createAndDisplayGO(id_edge) 
diff --git a/doc/salome/examples/topological_geom_objs_ex02.py b/doc/salome/examples/topological_geom_objs_ex02.py
new file mode 100644 (file)
index 0000000..62806d7
--- /dev/null
@@ -0,0 +1,25 @@
+# Creation of a Wire
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create vertices
+px   = geompy.MakeVertex(100., 0.  , 0.  )
+py   = geompy.MakeVertex(0.  , 100., 0.  )
+pz   = geompy.MakeVertex(0.  , 0.  , 100.)
+
+# create a vector from two points
+vxy = geompy.MakeVector(px, py)
+
+# create an arc from three points
+arc = geompy.MakeArc(py, pz, px)
+
+# create a wire
+wire = geompy.MakeWire([vxy, arc])
+
+# add an object in the study
+id_wire = geompy.addToStudy(wire,"Wire")
+
+# display the wire
+gg.createAndDisplayGO(id_wire) 
diff --git a/doc/salome/examples/topological_geom_objs_ex03.py b/doc/salome/examples/topological_geom_objs_ex03.py
new file mode 100644 (file)
index 0000000..7b16001
--- /dev/null
@@ -0,0 +1,51 @@
+# Creation of a Face
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create vertices
+p0   = geompy.MakeVertex(0.  , 0.  , 0.  )
+px   = geompy.MakeVertex(100., 0.  , 0.  )
+py   = geompy.MakeVertex(0.  , 100., 0.  )
+pz   = geompy.MakeVertex(0.  , 0.  , 100.)
+pxyz = geompy.MakeVertex(100., 100., 100.)
+
+# create a vector from two points
+vxy = geompy.MakeVector(px, py)
+
+# create an arc from three points
+arc = geompy.MakeArc(py, pz, px)
+
+# create a wire
+wire = geompy.MakeWire([vxy, arc])
+
+# create sketchers
+sketcher1 = geompy.MakeSketcher("Sketcher:F -100 -100:TT 250 -100:R 0:C 100 150:R 0:L 300:WW",
+                                [100,0,0, 1,1,1, -1,1,0])
+sketcher2 = geompy.MakeSketcher("Sketcher:F 0 0:TT 70 0:TT 70 70:TT 0 70:WW")
+sketcher3 = geompy.MakeSketcher("Sketcher:F 20 20:TT 50 20:TT 50 50:TT 20 50:WW")
+isPlanarFace = 1
+
+# create a face from the wire
+face1 = geompy.MakeFace(wire, isPlanarFace)
+
+# create faces from two wires
+face2 = geompy.MakeFaceWires([wire, sketcher1],isPlanarFace)
+face3 = geompy.MakeFaces([sketcher2, sketcher3],isPlanarFace)
+
+# add objects in the study
+id_face1 = geompy.addToStudy(face1,"Face1")
+id_face2 = geompy.addToStudy(face2,"Face2")
+id_face3 = geompy.addToStudy(face3,"Face3")
+
+# display the faces
+gg.createAndDisplayGO(id_face1)
+gg.setDisplayMode(id_face1,1)
+gg.setTransparency(id_face1,0.2)
+gg.createAndDisplayGO(id_face2)
+gg.setDisplayMode(id_face2,1)
+gg.setTransparency(id_face2,0.2)
+gg.createAndDisplayGO(id_face3)
+gg.setDisplayMode(id_face3,1)
+gg.setTransparency(id_face3,0.2) 
diff --git a/doc/salome/examples/topological_geom_objs_ex04.py b/doc/salome/examples/topological_geom_objs_ex04.py
new file mode 100644 (file)
index 0000000..b85e553
--- /dev/null
@@ -0,0 +1,34 @@
+# Creation of a Shell
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+#create vertices
+p0   = geompy.MakeVertex( 0.,  0.,  0.)
+pxyz = geompy.MakeVertex( 5.,  5., 40.)
+
+# create sketchers
+sketcher1 = geompy.MakeSketcher("Sketcher:F 0 0:TT 70 0:TT 70 70:TT 0 70:WW")
+sketcher2 = geompy.MakeSketcher("Sketcher:F 20 20:TT 50 20:TT 50 50:TT 20 50:WW")
+isPlanarFace = 1
+
+# create a face from two wires
+face = geompy.MakeFaces([sketcher1, sketcher2],isPlanarFace)
+
+# create a prism
+prism = geompy.MakePrism(face, p0, pxyz)
+
+# explode the prism into faces
+prism_faces = geompy.SubShapeAllSortedCentres(prism, geompy.ShapeType["FACE"])
+
+# create a shell from a set of faces
+shell = geompy.MakeShell([prism_faces[0], prism_faces[2], prism_faces[3],
+                          prism_faces[7], prism_faces[9]])
+
+# add objects in the study
+id_shell = geompy.addToStudy(shell,"Shell")
+
+# display the shell
+gg.createAndDisplayGO(id_shell)
+gg.setDisplayMode(id_shell,1) 
diff --git a/doc/salome/examples/topological_geom_objs_ex05.py b/doc/salome/examples/topological_geom_objs_ex05.py
new file mode 100644 (file)
index 0000000..700236b
--- /dev/null
@@ -0,0 +1,36 @@
+# Creation of a Solid
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+#create vertices
+p0 = geompy.MakeVertex( 0.,  0.,  0.)
+pz = geompy.MakeVertex( 0.,  0., 40.)
+
+# create sketchers
+sketcher = geompy.MakeSketcher("Sketcher:F -50 -50:TT 100 -50:R 0:C 50 70:R 0:L 100:WW")
+
+# create faces from two wires
+face = geompy.MakeFace(sketcher,1)
+
+# create a prism
+prism = geompy.MakePrism(face, p0, pz)
+
+# explode the prism into faces
+prism_faces = geompy.SubShapeAllSortedCentres(prism, geompy.ShapeType["FACE"])
+
+# create a shell from a set of faces
+shell = geompy.MakeShell([prism_faces[0], prism_faces[1],
+                          prism_faces[3], prism_faces[4],
+                          prism_faces[5], prism_faces[2]])
+
+# create a solid, bounded by the given shells
+solid = geompy.MakeSolid([shell])
+
+# add objects in the study
+id_solid = geompy.addToStudy(solid,"Solid")
+
+# display the solid
+gg.createAndDisplayGO(id_solid)
+gg.setDisplayMode(id_solid,1) 
diff --git a/doc/salome/examples/topological_geom_objs_ex06.py b/doc/salome/examples/topological_geom_objs_ex06.py
new file mode 100644 (file)
index 0000000..071730b
--- /dev/null
@@ -0,0 +1,28 @@
+# Creation of a Compound
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a vertex and a vector
+p1 = geompy.MakeVertex(  -30.,  -30.,  50.)
+p2 = geompy.MakeVertex(  -60.,  -60.,  30.)
+p3 = geompy.MakeVertex(  -30.,  -30.,  10.)
+
+# create an arc from three points
+arc = geompy.MakeArc(p1, p2, p3)
+ShapeListCompound = []
+i = 0
+while i <= 3 :
+    S = geompy.MakeTranslation(arc, i * 50., 0., 0.)
+    ShapeListCompound.append(S)
+    i = i + 1
+
+# create a compund of the given shapes
+compound = geompy.MakeCompound(ShapeListCompound)
+
+# add object in the study
+id_compound = geompy.addToStudy(compound,"Compound")
+
+# display the compound
+gg.createAndDisplayGO(id_compound) 
diff --git a/doc/salome/examples/transformation_operations_ex01.py b/doc/salome/examples/transformation_operations_ex01.py
new file mode 100644 (file)
index 0000000..678afa9
--- /dev/null
@@ -0,0 +1,43 @@
+# Translation
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a vertex and a vector
+p1 = geompy.MakeVertex(10, 40, 0)
+p2 = geompy.MakeVertex( 0,  0, 50)
+p3 = geompy.MakeVertex(50, 80, 0)
+v = geompy.MakeVector(p1, p2)
+vt = geompy.MakeVector(p1, p3)
+
+# create a cylinder
+height = 35
+radius1 = 20
+cylinder = geompy.MakeCylinder(p1, v, radius1, height)
+
+# translate the given object along the vector, specified by its end points
+# (all three functions produce the same result)
+translation1 = geompy.MakeTranslationTwoPoints(cylinder, p1, p3)
+translation2 = geompy.MakeTranslation(cylinder, 40, 40, 0)
+translation3 = geompy.MakeTranslationVector(cylinder, vt)
+translation4 = geompy.MakeTranslationVectorDistance(cylinder, vt, 200)
+
+# add objects in the study
+id_cylinder = geompy.addToStudy(cylinder, "Cylinder")
+id_translation1 = geompy.addToStudy(translation1, "Translation1")
+id_translation2 = geompy.addToStudy(translation2, "Translation2")
+id_translation3 = geompy.addToStudy(translation3, "Translation3")
+id_translation4 = geompy.addToStudy(translation4, "Translation4")
+
+# display the results
+gg.createAndDisplayGO(id_cylinder)
+gg.setDisplayMode(id_cylinder,1)
+gg.createAndDisplayGO(id_translation1)
+gg.setDisplayMode(id_translation1,1)
+gg.createAndDisplayGO(id_translation2)
+gg.setDisplayMode(id_translation2,1)
+gg.createAndDisplayGO(id_translation3)
+gg.setDisplayMode(id_translation3,1) 
+gg.createAndDisplayGO(id_translation4)
+gg.setDisplayMode(id_translation4,1) 
diff --git a/doc/salome/examples/transformation_operations_ex02.py b/doc/salome/examples/transformation_operations_ex02.py
new file mode 100644 (file)
index 0000000..7abbb78
--- /dev/null
@@ -0,0 +1,44 @@
+# Rotation
+
+import geompy
+import salome
+import math
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a vertex and a vector
+p1 = geompy.MakeVertex(10, 40,  0)
+p2 = geompy.MakeVertex( 0,  0, 50)
+p3 = geompy.MakeVertex(10, 50,-20)
+p4 = geompy.MakeVertex(10, 50, 60)
+v = geompy.MakeVector(p1, p2)
+vr = geompy.MakeVector(p3, p4)
+
+# create a cylinder
+height = 35
+radius1 = 20
+cylinder = geompy.MakeCylinder(p1, v, radius1, height)
+
+# rotate the given object around the given axis by the given angle
+rotation1 = geompy.MakeRotation(cylinder, vr, math.pi)
+rotation2 = geompy.MakeRotationThreePoints(cylinder, p4, p1, p2)
+
+# add objects in the study
+id_vr = geompy.addToStudy(vr, "Rotation 1 axis")
+id_p4 = geompy.addToStudy(p4, "Rotation 2 center")
+id_p1 = geompy.addToStudy(p1, "Rotation 2 point 1")
+id_p2 = geompy.addToStudy(p2, "Rotation 2 point 2")
+id_cylinder = geompy.addToStudy(cylinder, "Cylinder")
+id_rotation1 = geompy.addToStudy(rotation1, "Rotation 1")
+id_rotation2 = geompy.addToStudy(rotation2, "Rotation 2")
+
+# display the results
+gg.createAndDisplayGO(id_vr)
+gg.createAndDisplayGO(id_p4)
+gg.createAndDisplayGO(id_p1)
+gg.createAndDisplayGO(id_p2)
+gg.createAndDisplayGO(id_cylinder)
+gg.setDisplayMode(id_cylinder,1)
+gg.createAndDisplayGO(id_rotation1)
+gg.createAndDisplayGO(id_rotation2)
+gg.setDisplayMode(id_rotation1,1)
+gg.setDisplayMode(id_rotation2,1)
diff --git a/doc/salome/examples/transformation_operations_ex03.py b/doc/salome/examples/transformation_operations_ex03.py
new file mode 100644 (file)
index 0000000..3d250fd
--- /dev/null
@@ -0,0 +1,43 @@
+# Modify Location
+
+import geompy
+import salome
+import math
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a vertex and a vector
+p1 = geompy.MakeVertex(10, 40, 0)
+p2 = geompy.MakeVertex( 0,  0, 50)
+v = geompy.MakeVector(p1, p2)
+
+# create a cylinder
+height = 35
+radius1 = 20
+cylinder = geompy.MakeCylinder(p1, v, radius1, height)
+circle   = geompy.MakeCircle(p2, v, radius1)
+
+# create local coordinate systems
+cs1 = geompy.MakeMarker( 0, 0, 0, 1,0,0, 0,1,0)
+cs2 = geompy.MakeMarker(30,40,40, 1,0,0, 0,1,0)
+
+# modify the location of the given object
+position = geompy.MakePosition(cylinder, cs1, cs2)
+position2 = geompy.PositionAlongPath(position, circle, 0.75, 1, 1)
+
+# add objects in the study
+id_cs1 = geompy.addToStudy(cs1, "Coordinate system 1")
+id_cs2 = geompy.addToStudy(cs2, "Coordinate system 2")
+id_cylinder = geompy.addToStudy(cylinder, "Cylinder")
+id_circle = geompy.addToStudy(circle, "Circle")
+id_position = geompy.addToStudy(position, "Position")
+id_position2 = geompy.addToStudy(position2, "PositionAlongPath")
+
+# display the results
+gg.createAndDisplayGO(id_cylinder)
+gg.setDisplayMode(id_cylinder,1)
+gg.createAndDisplayGO(id_position)
+gg.setDisplayMode(id_position,1)
+gg.createAndDisplayGO(id_circle)
+gg.setDisplayMode(id_circle,1)
+gg.createAndDisplayGO(id_position2)
+gg.setDisplayMode(id_position2,1)
diff --git a/doc/salome/examples/transformation_operations_ex04.py b/doc/salome/examples/transformation_operations_ex04.py
new file mode 100644 (file)
index 0000000..28e8b30
--- /dev/null
@@ -0,0 +1,46 @@
+# Mirror Image
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a box
+box = geompy.MakeBoxDXDYDZ(200, 200, 200)
+
+# create an object, symmetrical to another object through the given plane
+p1 = geompy.MakeVertex( 0, 25,  0)
+p2 = geompy.MakeVertex( 5, 25,  0)
+p3 = geompy.MakeVertex( 0,-30, 40)
+plane = geompy.MakePlaneThreePnt(p1, p2, p3, 1000.)
+mirror1 = geompy.MakeMirrorByPlane(box, plane)
+
+# create an object, symmetrical to another object through the given axis
+p4 = geompy.MakeVertex( 210, 210, -20)
+p5 = geompy.MakeVertex( 210, 210, 220)
+axis = geompy.MakeVector(p4, p5)
+mirror2 = geompy.MakeMirrorByAxis(box, axis)
+
+# create an object, symmetrical to another object through the given point
+mirror3 = geompy.MakeMirrorByPoint(box, p4)
+
+# add objects in the study
+id_box = geompy.addToStudy(box, "Box")
+id_plane = geompy.addToStudy(plane, "Plane")
+id_mirror1 = geompy.addToStudy(mirror1, "Mirror plane")
+id_axis = geompy.addToStudy(axis, "Axis")
+id_mirror2 = geompy.addToStudy(mirror2, "Mirror axis")
+id_p4 = geompy.addToStudy(p4, "Point")
+id_mirror3 = geompy.addToStudy(mirror3, "Mirror point")
+
+# display the results
+gg.createAndDisplayGO(id_box)
+gg.setDisplayMode(id_box,1)
+gg.createAndDisplayGO(id_plane)
+gg.createAndDisplayGO(id_mirror1)
+gg.setDisplayMode(id_mirror1,1)
+gg.createAndDisplayGO(id_axis)
+gg.createAndDisplayGO(id_mirror2)
+gg.setDisplayMode(id_mirror2,1)
+gg.createAndDisplayGO(id_p4)
+gg.createAndDisplayGO(id_mirror3)
+gg.setDisplayMode(id_mirror3,1) 
diff --git a/doc/salome/examples/transformation_operations_ex05.py b/doc/salome/examples/transformation_operations_ex05.py
new file mode 100644 (file)
index 0000000..7b906b9
--- /dev/null
@@ -0,0 +1,24 @@
+# Scale Transform
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a box and a sphere
+box = geompy.MakeBoxDXDYDZ(200, 200, 200)
+
+# scale the given object by the factor
+p0 = geompy.MakeVertex(100, 100, 100)
+factor = 0.5
+scale = geompy.MakeScaleTransform(box, p0, factor)
+
+# add objects in the study
+id_box = geompy.addToStudy(box, "Box")
+id_scale = geompy.addToStudy(scale, "Scale")
+
+# display the results
+gg.createAndDisplayGO(id_box)
+gg.setDisplayMode(id_box,1)
+gg.setTransparency(id_box,0.5)
+gg.createAndDisplayGO(id_scale)
+gg.setDisplayMode(id_scale,1)
diff --git a/doc/salome/examples/transformation_operations_ex06.py b/doc/salome/examples/transformation_operations_ex06.py
new file mode 100644 (file)
index 0000000..f6c2adf
--- /dev/null
@@ -0,0 +1,20 @@
+# Offset Surface
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a box and a sphere
+box = geompy.MakeBox(20, 20, 20, 200, 200, 200)
+
+# create a new object as offset of the given object
+offset = geompy.MakeOffset(box, 70.)
+
+# add objects in the study
+id_box = geompy.addToStudy(box, "Box")
+id_offset = geompy.addToStudy(offset, "Offset")
+
+# display the results
+gg.createAndDisplayGO(id_box)
+gg.setDisplayMode(id_box,1)
+gg.createAndDisplayGO(id_offset) 
diff --git a/doc/salome/examples/transformation_operations_ex07.py b/doc/salome/examples/transformation_operations_ex07.py
new file mode 100644 (file)
index 0000000..c1efc39
--- /dev/null
@@ -0,0 +1,31 @@
+# Projection
+
+import geompy
+import salome
+
+# create a cylindric face and a curve(edge)
+cylinder = geompy.MakeCylinderRH(100, 300)
+[face_cyl] = geompy.SubShapes(cylinder, [3])
+
+p1 = geompy.MakeVertex(200, 0, 100)
+p2 = geompy.MakeVertex(200, 80, 100)
+p3 = geompy.MakeVertex(200, 80, 180)
+p4 = geompy.MakeVertex(130, 80, 180)
+p5 = geompy.MakeVertex(90, 80, 240)
+
+curve = geompy.MakeInterpol([p1, p2, p3, p4, p5], False, False)
+
+# create a new object as projection of the
+# given curve on the given cylindric face
+projection = geompy.MakeProjection(curve, face_cyl)
+
+# add objects in the study
+geompy.addToStudy(cylinder, "cylinder")
+geompy.addToStudyInFather(cylinder, face_cyl, "face_cyl")
+geompy.addToStudy(p1, "p1")
+geompy.addToStudy(p2, "p2")
+geompy.addToStudy(p3, "p3")
+geompy.addToStudy(p4, "p4")
+geompy.addToStudy(p5, "p5")
+geompy.addToStudy(curve, "curve")
+geompy.addToStudy(projection, "projection")
diff --git a/doc/salome/examples/transformation_operations_ex08.py b/doc/salome/examples/transformation_operations_ex08.py
new file mode 100644 (file)
index 0000000..fb103f9
--- /dev/null
@@ -0,0 +1,48 @@
+# Multi Translation
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create vertices and vectors
+p0  = geompy.MakeVertex( 0.,  0.,  0.)
+px  = geompy.MakeVertex(20.,  0.,  0.)
+py  = geompy.MakeVertex( 0., 20.,  0.)
+pz  = geompy.MakeVertex( 0.,  0., 20.)
+pxy = geompy.MakeVertex( 50., 0., 0.)
+pxyz = geompy.MakeVertex( 50., 50., 50.)
+vz  = geompy.MakeVector(p0, pz)
+vxy = geompy.MakeVector(px, py)
+vtr1d = geompy.MakeVector(p0, pxyz)
+vtr2d = geompy.MakeVector(p0, pxy)
+
+# create an arc
+arc = geompy.MakeArc(py, pz, px)
+
+# create a wire
+wire = geompy.MakeWire([vxy, arc])
+
+# create a planar face
+face = geompy.MakeFace(wire, 1)
+
+# create a prism
+prism = geompy.MakePrismVecH(face, vz, 20.0)
+
+# translate the given object along the given vector a given number of times
+tr1d = geompy.MakeMultiTranslation1D(prism, vtr1d, 20, 4)
+
+# consequently apply two specified translations to the object a given number of times
+tr2d = geompy.MakeMultiTranslation2D(prism, vtr1d, 20, 4, vtr2d, 80, 3)
+
+# add objects in the study
+id_prism = geompy.addToStudy(prism,"Prism")
+id_tr1d = geompy.addToStudy(tr1d,"Translation 1D")
+id_tr2d = geompy.addToStudy(tr2d,"Translation 2D")
+
+# display the prism and the results of fillet operation
+gg.createAndDisplayGO(id_prism)
+gg.setDisplayMode(id_prism,1)
+gg.createAndDisplayGO(id_tr1d)
+gg.setDisplayMode(id_tr1d,1)
+gg.createAndDisplayGO(id_tr2d)
+gg.setDisplayMode(id_tr2d,1) 
diff --git a/doc/salome/examples/transformation_operations_ex09.py b/doc/salome/examples/transformation_operations_ex09.py
new file mode 100644 (file)
index 0000000..665a2ac
--- /dev/null
@@ -0,0 +1,64 @@
+# Multi Rotation
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+import math
+
+# create vertices and vectors
+p0  = geompy.MakeVertex( 0.,  0.,  0.)
+px  = geompy.MakeVertex(20.,  0.,  0.)
+py  = geompy.MakeVertex( 0., 20.,  0.)
+pz  = geompy.MakeVertex( 0.,  0., 20.)
+pxyz = geompy.MakeVertex( 50., 50., 10.)
+vz  = geompy.MakeVector(p0, pz)
+vxy = geompy.MakeVector(px, py)
+vrot = geompy.MakeVector(p0, pxyz)
+
+# create an arc
+arc = geompy.MakeArc(py, pz, px)
+
+# create a wire
+wire = geompy.MakeWire([vxy, arc])
+
+# create a planar face
+face = geompy.MakeFace(wire, 1)
+
+# create a prism
+prism = geompy.MakePrismVecH(face, vz, 20.0)
+
+# 1. Rotate the prism around the axis vrot 4 times
+
+# rotation angle = 2 * PI / 4
+rot1da = geompy.MultiRotate1DNbTimes(prism, vrot, 4)
+
+# by the given angle of 30 degrees
+rot1db = geompy.MultiRotate1DByStep(prism, vrot, math.pi/6., 4)
+
+# 2. Rotate the prism around the axis vrot 4 times
+#    and translate the result of each rotation 5 times on distance 50
+
+# rotation angle = 2 * PI / 4
+rot2da = geompy.MultiRotate2DNbTimes(prism, vrot, 4, 50, 5)
+
+# by the given angle of 60 degrees
+rot2db = geompy.MultiRotate2DByStep(prism, vrot, math.pi/3., 4, 50, 5)
+
+# add objects in the study
+id_prism = geompy.addToStudy(prism,"Prism")
+id_rot1da = geompy.addToStudy(rot1da,"Rotation 1D Nb.Times")
+id_rot1db = geompy.addToStudy(rot1db,"Rotation 1D By Step")
+id_rot2da = geompy.addToStudy(rot2da,"Rotation 2D Nb.Times")
+id_rot2db = geompy.addToStudy(rot2db,"Rotation 2D By Step")
+
+# display the prism and the results of fillet operation
+gg.createAndDisplayGO(id_prism)
+gg.setDisplayMode(id_prism,1)
+gg.createAndDisplayGO(id_rot1da)
+gg.setDisplayMode(id_rot1da,1)
+gg.createAndDisplayGO(id_rot1db)
+gg.setDisplayMode(id_rot1db,1)
+gg.createAndDisplayGO(id_rot2da)
+gg.setDisplayMode(id_rot2da,1) 
+gg.createAndDisplayGO(id_rot2db)
+gg.setDisplayMode(id_rot2db,1) 
diff --git a/doc/salome/examples/transformation_operations_ex10.py b/doc/salome/examples/transformation_operations_ex10.py
new file mode 100644 (file)
index 0000000..cd25273
--- /dev/null
@@ -0,0 +1,17 @@
+# Fillet 2D
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a face in OXY plane
+face = geompy.MakeFaceHW(100, 100, 1)
+fillet2d = geompy.MakeFillet2D(face, 30, [7, 9])
+
+# add objects in the study
+id_face  = geompy.addToStudy(face,"Face_1")
+id_fillet2d  = geompy.addToStudy(fillet2d,"Fillet 2D_1")
+
+# display disks
+gg.createAndDisplayGO(id_face)
+gg.createAndDisplayGO(id_fillet2d)
diff --git a/doc/salome/examples/transformation_operations_ex11.py b/doc/salome/examples/transformation_operations_ex11.py
new file mode 100644 (file)
index 0000000..f3b4bd0
--- /dev/null
@@ -0,0 +1,19 @@
+# Fillet 1D
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create box
+Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
+# take box edges to create custom complex wire
+[Edge_1,Edge_2,Edge_3,Edge_4,Edge_5,Edge_6,Edge_7,Edge_8,Edge_9,Edge_10,Edge_11,Edge_12] = geompy.SubShapeAllSortedCentres(Box_1, geompy.ShapeType["EDGE"])
+# create wire
+Wire_1 = geompy.MakeWire([Edge_12, Edge_7, Edge_11, Edge_6, Edge_1,Edge_4])
+# make fillet at given wire vertices with giver radius
+Fillet_1D_1 = geompy.MakeFillet1D(Wire_1, 55, [3, 4, 6, 8, 10])
+
+
+# display disks
+gg.createAndDisplayGO(Wire_1)
+gg.createAndDisplayGO(Fillet_1D_1)
diff --git a/doc/salome/examples/transformation_operations_ex12.py b/doc/salome/examples/transformation_operations_ex12.py
new file mode 100644 (file)
index 0000000..1f0f31c
--- /dev/null
@@ -0,0 +1,53 @@
+# Fillet
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+radius  = 10.
+ShapeTypeEdge = geompy.ShapeType["EDGE"]
+
+# create vertices and vectors
+p0  = geompy.MakeVertex(  0.,   0.,   0.)
+px  = geompy.MakeVertex(100.,   0.,   0.)
+py  = geompy.MakeVertex(  0., 100.,   0.)
+pz  = geompy.MakeVertex(  0.,   0., 100.)
+vz  = geompy.MakeVector(p0, pz)
+vxy = geompy.MakeVector(px, py)
+
+# create an arc
+arc = geompy.MakeArc(py, pz, px)
+
+# create a wire
+wire = geompy.MakeWire([vxy, arc])
+
+# create a planar face
+face = geompy.MakeFace(wire, 1)
+
+# create a prism
+prism = geompy.MakePrismVecH(face, vz, 100.0)
+
+# get the list of IDs (IDList) for the fillet
+prism_edges = geompy.SubShapeAllSortedCentres(prism, ShapeTypeEdge)
+IDlist_e = []
+IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[0]))
+IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[1]))
+IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[2]))
+
+# make a fillet on the specified edges of the given shape
+fillet = geompy.MakeFillet(prism, radius, ShapeTypeEdge, IDlist_e)
+
+# make a fillet on all edges of the given shape
+filletall = geompy.MakeFilletAll(prism, radius)
+
+# add objects in the study
+id_prism = geompy.addToStudy(prism,"Prism")
+id_fillet = geompy.addToStudy(fillet,"Fillet")
+id_filletall = geompy.addToStudy(filletall,"Fillet all")
+
+# display the prism and the results of fillet operation
+gg.createAndDisplayGO(id_prism)
+gg.setDisplayMode(id_prism,1)
+gg.createAndDisplayGO(id_fillet)
+gg.setDisplayMode(id_fillet,1)
+gg.createAndDisplayGO(id_filletall)
+gg.setDisplayMode(id_filletall,1) 
diff --git a/doc/salome/examples/transformation_operations_ex13.py b/doc/salome/examples/transformation_operations_ex13.py
new file mode 100644 (file)
index 0000000..ecc896e
--- /dev/null
@@ -0,0 +1,63 @@
+# Chamfer
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+d1 = 10.
+d2 = 10.
+ShapeTypeFace = geompy.ShapeType["FACE"]
+
+# create vertices and vectors
+p0  = geompy.MakeVertex(  0.,   0.,   0.)
+px  = geompy.MakeVertex(100.,   0.,   0.)
+py  = geompy.MakeVertex(  0., 100.,   0.)
+pz  = geompy.MakeVertex(  0.,   0., 100.)
+vz  = geompy.MakeVector(p0, pz)
+vxy = geompy.MakeVector(px, py)
+
+# create an arc
+arc = geompy.MakeArc(py, pz, px)
+
+# create a wire
+wire = geompy.MakeWire([vxy, arc])
+
+# create a planar face
+face = geompy.MakeFace(wire, 1)
+
+# create a prism
+prism = geompy.MakePrismVecH(face, vz, 100.0)
+
+# get the list of IDs (IDList) for the chamfer
+prism_faces = geompy.SubShapeAllSortedCentres(prism, ShapeTypeFace)
+f_ind_1 = geompy.GetSubShapeID(prism, prism_faces[0])
+f_ind_2 = geompy.GetSubShapeID(prism, prism_faces[1])
+IDlist_f = [f_ind_1, f_ind_2]
+
+# perform a chamfer on the edges common to the specified faces
+chamfer_e = geompy.MakeChamferEdge(prism, d1, d2, f_ind_1, f_ind_2)
+
+# perform a chamfer on all edges of the specified faces
+chamfer_f = geompy.MakeChamferFaces(prism, d1, d2, IDlist_f)
+chamfer_f1 = geompy.MakeChamfer(prism, d1, d2, ShapeTypeFace, IDlist_f)
+
+# perform a symmetric chamfer on all edges of the given shape
+chamfer_all = geompy.MakeChamferAll(prism, d1)
+
+# add objects in the study
+id_prism = geompy.addToStudy(prism,"Prism")
+id_chamfer_e = geompy.addToStudy(chamfer_e,"Chamfer edge")
+id_chamfer_f = geompy.addToStudy(chamfer_f,"Chamfer faces")
+id_chamfer_f1 = geompy.addToStudy(chamfer_f1,"Chamfer faces 1")
+id_chamfer_all = geompy.addToStudy(chamfer_all,"Chamfer all")
+
+# display the prism and the results of chamfer operation
+gg.createAndDisplayGO(id_prism)
+gg.setDisplayMode(id_prism,1)
+gg.createAndDisplayGO(id_chamfer_e)
+gg.setDisplayMode(id_chamfer_e,1)
+gg.createAndDisplayGO(id_chamfer_f)
+gg.setDisplayMode(id_chamfer_f,1)
+gg.createAndDisplayGO(id_chamfer_f1)
+gg.setDisplayMode(id_chamfer_f1,1)
+gg.createAndDisplayGO(id_chamfer_all)
+gg.setDisplayMode(id_chamfer_all,1) 
diff --git a/doc/salome/examples/viewing_geom_objs_ex01.py b/doc/salome/examples/viewing_geom_objs_ex01.py
new file mode 100644 (file)
index 0000000..473c7f1
--- /dev/null
@@ -0,0 +1,17 @@
+# Changing Display Mode
+
+import salome
+import geompy
+box = geompy.MakeBox(0,0,0, 50,50,50)
+box2 = geompy.MakeBox(-50,-50,-50, 0,0,0)
+
+sphere = geompy.MakeSphere(50,50,50, 30)
+fuse = geompy.MakeBoolean(box,sphere,3)
+fuse_id = geompy.addToStudy(fuse,"Fuse")
+box_id = geompy.addToStudy(box2, "Box")
+
+gg = salome.ImportComponentGUI("GEOM")
+gg.createAndDisplayGO(fuse_id)
+gg.setDisplayMode(fuse_id,1)
+gg.createAndDisplayGO(box_id)
+gg.setVectorsMode(box_id, 1)
diff --git a/doc/salome/examples/viewing_geom_objs_ex02.py b/doc/salome/examples/viewing_geom_objs_ex02.py
new file mode 100644 (file)
index 0000000..fd8243d
--- /dev/null
@@ -0,0 +1,14 @@
+# Changing Color
+
+import salome
+import geompy
+box = geompy.MakeBox(0,0,0, 50,50,50)
+
+sphere = geompy.MakeSphere(50,50,50, 30)
+fuse = geompy.MakeBoolean(box,sphere,3)
+fuse_id = geompy.addToStudy(fuse,"Fuse")
+
+gg = salome.ImportComponentGUI("GEOM")
+gg.createAndDisplayGO(fuse_id)
+gg.setDisplayMode(fuse_id,1)
+gg.setColor(fuse_id,218,165,31) 
diff --git a/doc/salome/examples/viewing_geom_objs_ex03.py b/doc/salome/examples/viewing_geom_objs_ex03.py
new file mode 100644 (file)
index 0000000..381f0e9
--- /dev/null
@@ -0,0 +1,16 @@
+# Changing Transparency
+
+import salome
+import geompy
+
+box = geompy.MakeBox(0,0,0, 50,50,50)
+sphere = geompy.MakeSphere(50,50,50, 30)
+
+fuse = geompy.MakeBoolean(box,sphere,3)
+fuse_id = geompy.addToStudy(fuse,"Fuse")
+
+gg = salome.ImportComponentGUI("GEOM")
+gg.createAndDisplayGO(fuse_id)
+gg.setDisplayMode(fuse_id,1)
+gg.setColor(fuse_id,218,165,31)
+gg.setTransparency(fuse_id,0.5) 
diff --git a/doc/salome/examples/viewing_geom_objs_ex04.py b/doc/salome/examples/viewing_geom_objs_ex04.py
new file mode 100644 (file)
index 0000000..cf521f4
--- /dev/null
@@ -0,0 +1,14 @@
+# Set Point Marker
+
+import salome
+import geompy
+
+texture = geompy.LoadTexture("/users/user/mytexture.dat")
+
+v1 = geompy.MakeVertex(0, 0, 0)
+v2 = geompy.MakeVertex(100, 0, 0)
+v3 = geompy.MakeVertex(0, 100, 0)
+
+v1.SetMarkerStd(GEOM.MT_O_PLUS, GEOM.MS_25)
+v2.SetMarkerStd(GEOM.MT_BALL,   GEOM.MS_40)
+v3.SetMarkerTexture(texture)
diff --git a/doc/salome/examples/whatis.py b/doc/salome/examples/whatis.py
new file mode 100644 (file)
index 0000000..42e7e4e
--- /dev/null
@@ -0,0 +1,9 @@
+# What Is
+
+import geompy
+
+# create a box
+box = geompy.MakeBoxDXDYDZ(100,30,100)
+Descr = geompy.WhatIs(box)
+print "\nBox 100x30x100 description:"
+print Descr
diff --git a/doc/salome/examples/working_with_groups_ex01.py b/doc/salome/examples/working_with_groups_ex01.py
new file mode 100644 (file)
index 0000000..821862f
--- /dev/null
@@ -0,0 +1,37 @@
+# Creation of a group
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create two vertices
+p0 = geompy.MakeVertex(0.  , 0.  , 0.  )
+p200 = geompy.MakeVertex(200., 200., 200.)
+
+# create a box from two points
+Box = geompy.MakeBoxTwoPnt(p0, p200)
+
+# create a group from the faces of the box
+group = geompy.CreateGroup(Box, geompy.ShapeType["FACE"])
+
+# add objects to the group
+SubFaceList = geompy.SubShapeAllSortedCentres(Box, geompy.ShapeType["FACE"])
+for i in [0, 3, 5] :
+    FaceID = geompy.GetSubShapeID(Box, SubFaceList[i])
+    geompy.AddObject(group, FaceID)
+
+# add all selected shapes from the list to the group
+# (the program doesn't raise error, if some shapes are already included)
+geompy.UnionList(group, [SubFaceList[0], SubFaceList[2], SubFaceList[5]])
+
+# remove an object from the group
+geompy.RemoveObject(group, FaceID)
+
+# remove all selected shapes from the group
+# (the program doesn't raise error, if some shapes are not included)
+geompy.DifferenceList(group, [SubFaceList[2], SubFaceList[3], SubFaceList[4]])
+id_group1 = geompy.addToStudy(group, "Group1")
+
+# display the contents of the group
+gg.createAndDisplayGO(id_group1)
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/working_with_groups_ex02.py b/doc/salome/examples/working_with_groups_ex02.py
new file mode 100644 (file)
index 0000000..4c415ba
--- /dev/null
@@ -0,0 +1,26 @@
+# Adding an object to the group
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create two vertices
+p0 = geompy.MakeVertex(0.  , 0.  , 0.  )
+p200 = geompy.MakeVertex(200., 200., 200.)
+
+# create a box from two points
+Box = geompy.MakeBoxTwoPnt(p0, p200)
+
+# create a group from the faces of the box
+group = geompy.CreateGroup(Box, geompy.ShapeType["FACE"])
+
+# add objects to the group
+SubFaceList = geompy.SubShapeAllSortedCentres(Box, geompy.ShapeType["FACE"])
+for i in [0, 3, 5] :
+    FaceID = geompy.GetSubShapeID(Box, SubFaceList[i])
+    geompy.AddObject(group, FaceID)
+id_group1 = geompy.addToStudy(group, "Group1")
+
+# display the contents of the group
+gg.createAndDisplayGO(id_group1)
+salome.sg.updateObjBrowser(1) 
diff --git a/doc/salome/examples/working_with_groups_ex03.py b/doc/salome/examples/working_with_groups_ex03.py
new file mode 100644 (file)
index 0000000..2c8a3d5
--- /dev/null
@@ -0,0 +1,33 @@
+# Removing an object from the group
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create two vertices
+p0 = geompy.MakeVertex(0.  , 0.  , 0.  )
+p200 = geompy.MakeVertex(200., 200., 200.)
+
+# create a box from two points
+Box = geompy.MakeBoxTwoPnt(p0, p200)
+
+# create a group from the faces of the box
+group = geompy.CreateGroup(Box, geompy.ShapeType["FACE"])
+
+# add objects to the group
+SubFaceList = geompy.SubShapeAllSortedCentres(Box, geompy.ShapeType["FACE"])
+for i in [0, 3, 5] :
+    FaceID = geompy.GetSubShapeID(Box, SubFaceList[i])
+    geompy.AddObject(group, FaceID)
+
+# add all selected shapes from the list to the group
+# (the program doesn't raise errors, if some shapes are already included)
+geompy.UnionList(group, [SubFaceList[0], SubFaceList[2], SubFaceList[5]])
+
+# remove an object from the group
+geompy.RemoveObject(group, FaceID)
+id_group1 = geompy.addToStudy(group, "Group1")
+
+# display the contents of the group
+gg.createAndDisplayGO(id_group1)
+salome.sg.updateObjBrowser(1) 
diff --git a/doc/salome/examples/working_with_groups_ex04.py b/doc/salome/examples/working_with_groups_ex04.py
new file mode 100644 (file)
index 0000000..945ae61
--- /dev/null
@@ -0,0 +1,29 @@
+# Union Groups
+
+import geompy
+import salome
+
+# create a box and some groups of faces on it
+Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
+Group_1 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
+geompy.UnionIDs(Group_1, [13, 23])
+Group_2 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
+geompy.UnionIDs(Group_2, [3, 27])
+Group_3 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
+geompy.UnionIDs(Group_3, [33, 23])
+Group_4 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
+geompy.UnionIDs(Group_4, [31, 27])
+
+# union groups
+Group_U_1_2 = geompy.UnionGroups(Group_1, Group_2)
+Group_UL_3_4 = geompy.UnionListOfGroups([Group_3, Group_4])
+
+# publish shapes
+geompy.addToStudy(Box_1, 'Box_1')
+geompy.addToStudyInFather(Box_1, Group_1, 'Group_1')
+geompy.addToStudyInFather(Box_1, Group_2, 'Group_2')
+geompy.addToStudyInFather(Box_1, Group_3, 'Group_3')
+geompy.addToStudyInFather(Box_1, Group_4, 'Group_4')
+geompy.addToStudyInFather(Box_1, Group_U_1_2, 'Group_U_1_2')
+geompy.addToStudyInFather(Box_1, Group_UL_3_4, 'Group_UL_3_4')
+salome.sg.updateObjBrowser(1) 
diff --git a/doc/salome/examples/working_with_groups_ex05.py b/doc/salome/examples/working_with_groups_ex05.py
new file mode 100644 (file)
index 0000000..422c672
--- /dev/null
@@ -0,0 +1,29 @@
+# Intersect Groups
+
+import geompy
+import salome
+
+# create a box and some groups of faces on it
+Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
+Group_1 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
+geompy.UnionIDs(Group_1, [13, 23])
+Group_2 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
+geompy.UnionIDs(Group_2, [3, 27])
+Group_3 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
+geompy.UnionIDs(Group_3, [33, 23])
+Group_4 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
+geompy.UnionIDs(Group_4, [31, 27])
+
+# intersect groups
+Group_I_1_3 = geompy.IntersectGroups(Group_1, Group_3)
+Group_IL_1_3 = geompy.IntersectListOfGroups([Group_1, Group_3])
+
+# publish shapes
+geompy.addToStudy(Box_1, 'Box_1')
+geompy.addToStudyInFather(Box_1, Group_1, 'Group_1')
+geompy.addToStudyInFather(Box_1, Group_2, 'Group_2')
+geompy.addToStudyInFather(Box_1, Group_3, 'Group_3')
+geompy.addToStudyInFather(Box_1, Group_4, 'Group_4')
+geompy.addToStudyInFather(Box_1, Group_I_1_3, 'Group_I_1_3')
+geompy.addToStudyInFather(Box_1, Group_IL_1_3, 'Group_IL_1_3')
+salome.sg.updateObjBrowser(1) 
diff --git a/doc/salome/examples/working_with_groups_ex06.py b/doc/salome/examples/working_with_groups_ex06.py
new file mode 100644 (file)
index 0000000..65c4fe2
--- /dev/null
@@ -0,0 +1,29 @@
+# Cut Groups
+
+import geompy
+import salome
+
+# create a box and some groups of faces on it
+Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
+Group_1 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
+geompy.UnionIDs(Group_1, [13, 23])
+Group_2 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
+geompy.UnionIDs(Group_2, [3, 27])
+Group_3 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
+geompy.UnionIDs(Group_3, [33, 23])
+Group_4 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
+geompy.UnionIDs(Group_4, [31, 27])
+
+# cut groups
+Group_C_2_4 = geompy.CutGroups(Group_2, Group_4)
+Group_CL_2_4 = geompy.CutListOfGroups([Group_2], [Group_4])
+
+# publish shapes
+geompy.addToStudy(Box_1, 'Box_1')
+geompy.addToStudyInFather(Box_1, Group_1, 'Group_1')
+geompy.addToStudyInFather(Box_1, Group_2, 'Group_2')
+geompy.addToStudyInFather(Box_1, Group_3, 'Group_3')
+geompy.addToStudyInFather(Box_1, Group_4, 'Group_4')
+geompy.addToStudyInFather(Box_1, Group_C_2_4, 'Group_C_2_4')
+geompy.addToStudyInFather(Box_1, Group_CL_2_4, 'Group_CL_2_4')
+salome.sg.updateObjBrowser(1) 
index 06d9bfd860a73899dace5260e4b3ca6f0670509f..267b71c24f865f49ac3b2d6577d03b383d92fee6 100755 (executable)
@@ -43,7 +43,7 @@ FILE_PATTERNS     = *.doc
 EXCLUDE_PATTERNS  = creating_adv_obj.doc
 EXCLUDE           = 
 IMAGE_PATH        = @srcdir@/images
-EXAMPLE_PATH      = @top_srcdir@/src/GEOM_SWIG
+EXAMPLE_PATH      = @top_srcdir@/src/GEOM_SWIG @top_srcdir@/doc/salome/examples
 
 #---------------------------------------------------------------------------
 #HTML related options
index 4916dfce2d4037dfa69d771bfca836a015904d18..9afadc9ca4a8f0d8c37c924744e7f684dedc6d27 100755 (executable)
@@ -1,49 +1,7 @@
 /*!
 
 \page tui_3dsketcher_page 3D Sketcher
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# Create a 3D sketcher (wire) on the given points coordinates
-sketcher1 = geompy.Make3DSketcher([ 0,0,0, 50,50,50, 0,50,0, 50,0,50, 10,20,100, 0,0,0 ])
-
-# add object in the study
-id_sketcher1 = geompy.addToStudy(sketcher1, "Sketcher1")
-
-# display the sketcher
-gg.createAndDisplayGO(id_sketcher1)
-
-# Create a 3D sketcher (wire) with Sketcher3D interface
-
-# get the interface instance
-sk = geompy.Sketcher3D()
-
-# add three points with absolute coordinates
-# the first point will be the start point of sketcher
-# two segments will be added by this command
-sk.addPointsAbsolute(1,2,3, 7,0,0, 10,-3.5,-11)
-
-# add one segment, defined by two angles in "OXY" coordinate system and length
-sk.addPointAnglesLength("OXY", 45, 0, 100)
-
-# add three points with relative coordinates
-# three segments will be added by this command
-sk.addPointsRelative(20,0,0, 20,0,100, -40,0,-50)
-
-# set to close the sketcher
-sk.close()
-
-# obtain the sketcher result
-sketcher2 = sk.wire()
-
-# add object in the study
-id_sketcher2 = geompy.addToStudy(sketcher2, "Sketcher2")
-
-# display the sketcher
-gg.createAndDisplayGO(id_sketcher2)
-\endcode
+\include 3dsketcher.py
+<a href="../../examples/GEOM/3dsketcher.py">Download this script</a>
 
 */
index 1d469e9e8fab7db43dcd370c438edee76fd0a58a..1f513a496ee6d430ad63cc1a0be2ee5318013698 100644 (file)
 
 \anchor tui_creation_pipetshape
 <br><h2>Creation of PipeTShape</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create PipeTShape object
-pipetshape = geompy.MakePipeTShape(80.0, 20.0, 200.0, 50.0, 20.0, 200.0)
-
-# add object in the study
-id_pipetshape = geompy.addToStudy(pipetshape[0],"PipeTShape")
-# add groups in the study
-for g in pipetshape[1:]:
-    geompy.addToStudyInFather(pipetshape[0], g, g.GetName())
-    
-# Create junction vertices
-P1 = geompy.MakeVertex(0.0, 0.0, 0.0)
-P2 = geompy.MakeVertex(400.0, 0.0, 0.0)
-P3 = geompy.MakeVertex(200.0, 0.0, 200.0)
-
-# create PipeTShape object with position
-pipetshape_position = geompy.MakePipeTShape(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, True, P1, P2, P3)
-
-# add object in the study
-id_pipetshape_position = geompy.addToStudy(pipetshape_position[0],"PipeTShape_position")
-# add groups in the study
-for g in pipetshape_position[1:]:
-    geompy.addToStudyInFather(pipetshape_position[0], g, g.GetName())
-
-# create PipeTShape with chamfer object
-pipetshapechamfer = geompy.MakePipeTShapeChamfer(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, 20.0, 20.0)
-
-# add object in the study
-id_pipetshapechamfer = geompy.addToStudy(pipetshapechamfer[0],"PipeTShapeChamfer")
-# add groups in the study
-for g in pipetshapechamfer[1:]:
-    geompy.addToStudyInFather(pipetshapechamfer[0], g, g.GetName())
-
-# create PipeTShape with chamfer object with position
-pipetshapechamfer_position = geompy.MakePipeTShapeChamfer(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, 20.0, 20.0, True, P1, P2, P3)
-
-# add object in the study
-id_pipetshapechamfer_position = geompy.addToStudy(pipetshapechamfer_position[0],"PipeTShapeChamfer_position")
-# add groups in the study
-for g in pipetshapechamfer_position[1:]:
-    geompy.addToStudyInFather(pipetshapechamfer_position[0], g, g.GetName())
-
-# create PipeTShape with fillet object
-pipetshapefillet = geompy.MakePipeTShapeFillet(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, 5.0)
-
-# add object in the study
-id_pipetshapefillet = geompy.addToStudy(pipetshapefillet[0],"PipeTShapeFillet")
-# add groups in the study
-for g in pipetshapefillet[1:]:
-    geompy.addToStudyInFather(pipetshapefillet[0], g, g.GetName())
-
-# create PipeTShape with fillet object with position
-pipetshapefillet_position = geompy.MakePipeTShapeFillet(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, 5.0, True, P1, P2, P3)
-
-# add object in the study
-id_pipetshapefillet_position = geompy.addToStudy(pipetshapefillet_position[0],"PipeTShapeFillet_position")
-# add groups in the study
-for g in pipetshapefillet_position[1:]:
-    geompy.addToStudyInFather(pipetshapefillet_position[0], g, g.GetName())
-    
-
-# display pipetshapes
-gg.createAndDisplayGO(id_pipetshape)
-gg.createAndDisplayGO(id_pipetshape_position)
-gg.createAndDisplayGO(id_pipetshapechamfer)
-gg.createAndDisplayGO(id_pipetshapechamfer_position)
-gg.createAndDisplayGO(id_pipetshapefillet)
-gg.createAndDisplayGO(id_pipetshapefillet_position)
-
-\endcode
+\include advanced_geom_objs_ex01.py
+<a href="../../examples/GEOM/advanced_geom_objs_ex01.py">Download this script</a>
 
 \anchor tui_creation_divideddisk
 <br><h2>Creation of DividedDisk</h2>
-
-\code
-import geompy
-import salome
-import GEOM
-gg = salome.ImportComponentGUI("GEOM")
-
-# create DividedDisk object
-divideddisk = geompy.MakeDividedDisk(100, 1, GEOM.SQUARE)
-
-# add object in the study
-id_divideddisk = geompy.addToStudy(divideddisk,"DividedDisk")
-
-# display divideddisk
-gg.createAndDisplayGO(id_divideddisk)
-\endcode
+\include advanced_geom_objs_ex02.py
+<a href="../../examples/GEOM/advanced_geom_objs_ex02.py">Download this script</a>
 
 \anchor tui_creation_dividedcylinder
 <br><h2>Creation of DividedCylinder</h2>
-
-\code
-import geompy
-import salome
-import GEOM
-gg = salome.ImportComponentGUI("GEOM")
-
-# create DividedCylinder object
-dividedcylinder = geompy.MakeDividedCylinder(100, 300, GEOM.SQUARE)
-
-# add object in the study
-id_dividedcylinder = geompy.addToStudy(dividedcylinder,"DividedCylinder")
-
-# display dividedcylinder
-gg.createAndDisplayGO(id_dividedcylinder)
-\endcode
+\include advanced_geom_objs_ex03.py
+<a href="../../examples/GEOM/advanced_geom_objs_ex03.py">Download this script</a>
 
 <!--@@ insert new functions before this line @@ do not remove this line @@-->
 */
index fa459d31eb5bed40c1d5024a8ee204d1c6a97202..e1618fb307e46f959402633dfa4c29d350e12451 100644 (file)
@@ -1,67 +1,7 @@
 /*!
 
 \page tui_angle_page Angle
-
-\code
-import salome
-salome.salome_init()
-
-import math
-import geompy
-geompy.init_geom(salome.myStudy)
-
-OX  = geompy.MakeVectorDXDYDZ(10, 0,0)
-OXY = geompy.MakeVectorDXDYDZ(10,10,0)
-
-# in one plane
-Angle = geompy.GetAngle(OX, OXY)
-
-print "\nAngle between OX and OXY = ", Angle
-if math.fabs(Angle - 45.0) > 1e-05:
-    print "  Error: returned angle is", Angle, "while must be 45.0"
-    pass
-
-Angle = geompy.GetAngleRadians(OX, OXY)
-
-print "\nAngle between OX and OXY in radians = ", Angle
-if math.fabs(Angle - math.pi/4) > 1e-05:
-    print "  Error: returned angle is", Angle, "while must be pi/4"
-    pass
-
-Angle = geompy.GetAngleVectors(OX, OXY, True)
-
-print "\nAngle between vectors OX and OXY = ", Angle
-if math.fabs(Angle - 45.0) > 1e-05:
-    print "  Error: returned angle is", Angle, "while must be 45.0"
-    pass
-
-Angle = geompy.GetAngleRadiansVectors(OX, OXY, False)
-
-print "\nBig angle between vectors OX and OXY in radians = ", Angle
-if math.fabs(Angle - math.pi*7./4.) > 1e-05:
-    print "  Error: returned angle is", Angle, "while must be 7*pi/4"
-    pass
-
-# not in one plane
-OXY_shift = geompy.MakeTranslation(OXY,10,-10,20)
-Angle = geompy.GetAngle(OX, OXY_shift)
-
-print "\nAngle between OX and OXY_shift = ", Angle
-if math.fabs(Angle - 45.0) > 1e-05:
-    print "  Error: returned angle is", Angle, "while must be 45.0"
-    pass
-
-# not linear
-pnt1 = geompy.MakeVertex(0, 0, 0)
-pnt2 = geompy.MakeVertex(10, 0, 0)
-pnt3 = geompy.MakeVertex(20, 10, 0)
-arc  = geompy.MakeArc(pnt1, pnt2, pnt3)
-Angle = geompy.GetAngle(OX, arc)
-
-if (math.fabs(Angle + 1.0) > 1e-6 or geompy.MeasuOp.IsDone()):
-    print "Error. Angle must not be computed on curvilinear edges"
-    pass
-
-\endcode
+\include angle.py
+<a href="../../examples/GEOM/angle.py">Download this script</a>
 
 */
index e9b6bd63db7b92a3e840d4efc997dd134ea3b635..fcb21c2683d47e1332936e9cb0694d5956d577e3 100644 (file)
 
 \anchor tui_creation_point
 <br><h2>Creation of a Point</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create vertices
-p0 = geompy.MakeVertex(0., 0., 0.)
-p100 = geompy.MakeVertexWithRef(p0, 100., 100., 100.)
-px = geompy.MakeVertex(100., 0., 0.)
-py = geompy.MakeVertex(0., 100., 0.)
-pz = geompy.MakeVertex(0., 0., 100.)
-p1 = geompy.MakeVertex(50., 50., 30.)
-
-# create a curve and vertices on it
-Arc = geompy.MakeArc(py, pz, px)
-# create a vertex by parameter
-p_on_arc = geompy.MakeVertexOnCurve(Arc, 0.25)
-# create a vertex by length
-p_on_arc2 = geompy.MakeVertexOnCurveByLength(Arc, 50., None)
-#create a vertex by point projection
-p_on_arc3 = geompy.MakeVertexOnCurveByCoord(Arc, 100, -10, 10)
-
-# create 2 lines and make a point on its intersection
-line_1 = geompy.MakeLineTwoPnt(p0, p100)
-line_2 = geompy.MakeLineTwoPnt(p1, pz)
-p_inter = geompy.MakeVertexOnLinesIntersection(line_1, line_2)
-
-# create a face and vertices on it
-Add_line = geompy.MakeLineTwoPnt(px, py)
-arc_face = geompy.MakeFaceWires([Arc, Add_line], 1)
-p_on_face1 = geompy.MakeVertexOnSurface(arc_face, 0.5, 0.5)
-p_on_face2 = geompy.MakeVertexOnSurfaceByCoord(arc_face, 35, 35, 35)
-p_on_face3 = geompy.MakeVertexInsideFace(arc_face)
-
-
-# add objects in the study
-id_p0       = geompy.addToStudy(p0,   "Vertex 0")
-id_p100     = geompy.addToStudy(p100, "Vertex 100")
-id_px       = geompy.addToStudy(px,   "Vertex X")
-id_py       = geompy.addToStudy(py,   "Vertex Y")
-id_pz       = geompy.addToStudy(pz,   "Vertex Z")
-id_Arc      = geompy.addToStudy(Arc,  "Arc")
-id_line_1   = geompy.addToStudy(line_1,  "Line 1")
-id_line_2   = geompy.addToStudy(line_2,  "Line 2")
-id_p_on_arc = geompy.addToStudy(p_on_arc, "Vertex on Arc by parameter")
-id_p_on_arc2  = geompy.addToStudy(p_on_arc2, "Vertex on Arc by length")
-id_p_on_arc3  = geompy.addToStudy(p_on_arc3, "Vertex on Arc by point projection")
-id_p_inter    = geompy.addToStudy(p_inter,   "Vertex on Lines Intersection")
-id_p_on_face1 = geompy.addToStudy(p_on_face1, "Vertex on face by parameter")
-id_p_on_face2 = geompy.addToStudy(p_on_face2, "Vertex on face by point projection")
-id_p_on_face3 = geompy.addToStudy(p_on_face3, "Vertex inside face")
-
-# display vertices
-gg.createAndDisplayGO(id_p0)
-gg.createAndDisplayGO(id_p100)
-gg.createAndDisplayGO(id_Arc)
-gg.createAndDisplayGO(id_p_inter)
-gg.createAndDisplayGO(id_p_on_arc)
-gg.createAndDisplayGO(id_p_on_arc2)
-gg.createAndDisplayGO(id_p_on_arc3)
-\endcode
+\include basic_geom_objs_ex01.py
+<a href="../../examples/GEOM/basic_geom_objs_ex01.py">Download this script</a>
 
 \anchor tui_creation_line
 <br><h2>Creation of a Line</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create vertices
-p0 = geompy.MakeVertex(0., 0., 0.)
-p100 = geompy.MakeVertexWithRef(p0, 100., 100., 100.)
-px = geompy.MakeVertex(100., 0.  , 0.  )
-py = geompy.MakeVertex(0.  , 100., 0.  )
-pz = geompy.MakeVertex(0.  , 0.  , 100.)
-
-# create a vector from two points
-vxy  = geompy.MakeVector(px, py)
-
-# create a line from a point and a vector
-line1 = geompy.MakeLine(pz, vxy)
-
-#create a line from two points
-line2 = geompy.MakeLineTwoPnt(p0, p100)
-
-# add objects in the study
-id_vxy      = geompy.addToStudy(vxy,  "Vector")
-id_line1    = geompy.addToStudy(line1,"Line1")
-id_line2    = geompy.addToStudy(line2,"Line2")
-
-# display lines
-gg.createAndDisplayGO(id_vxy)
-gg.createAndDisplayGO(id_line1)
-gg.createAndDisplayGO(id_line2) 
-\endcode
+\include basic_geom_objs_ex02.py
+<a href="../../examples/GEOM/basic_geom_objs_ex02.py">Download this script</a>
 
 \anchor tui_creation_circle
 <br><h2>Creation of a Circle</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create vertices
-p0 = geompy.MakeVertex(0., 0., 0.)
-px = geompy.MakeVertex(100., 0.  , 0.  )
-py = geompy.MakeVertex(0.  , 100., 0.  )
-pz = geompy.MakeVertex(0.  , 0.  , 100.)
-
-# create a vector on two points
-vxy  = geompy.MakeVector(px, py)
-
-# create a circle from a point, a vector and a radius
-circle1 = geompy.MakeCircle(pz, vxy, 30)
-
-#create a circle from three points
-circle2 = geompy.MakeCircleThreePnt(p0, px, py)
-
-# add objects in the study
-id_vxy      = geompy.addToStudy(vxy,    "Vector")
-id_circle1  = geompy.addToStudy(circle1,"Circle1")
-id_circle2  = geompy.addToStudy(circle2,"Circle2")
-
-# display circles
-gg.createAndDisplayGO(id_vxy)
-gg.createAndDisplayGO(id_circle1)
-gg.createAndDisplayGO(id_circle2)
-\endcode
+\include basic_geom_objs_ex03.py
+<a href="../../examples/GEOM/basic_geom_objs_ex03.py">Download this script</a>
 
 \anchor tui_creation_ellipse
 <br><h2>Creation of an Ellipse</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create vertices
-p0 = geompy.MakeVertex(0., 0., 0.)
-p1 = geompy.MakeVertex(50., 50., 50.)
-p2 = geompy.MakeVertex(0., 50., 0.)
-
-# create a normal vector from two points
-normal  = geompy.MakeVector(p0, p1)
-
-# create a major axis vector from two points
-major   = geompy.MakeVector(p0, p2)
-
-# create an ellipse from a point, a vector and radiuses
-ellipse1 = geompy.MakeEllipse(p1, normal, 50, 25)
-
-# create an ellipse from a point, a normal vector, radiuses and a major axis vector
-ellipse2 = geompy.MakeEllipse(p1, normal, 50, 25, major)
-
-# add objects in the study
-id_normal   = geompy.addToStudy(normal,   "Normal")
-id_major    = geompy.addToStudy(major,    "Major Axis")
-id_ellipse1 = geompy.addToStudy(ellipse1, "Ellipse 1")
-id_ellipse2 = geompy.addToStudy(ellipse2, "Ellipse 2")
-
-# display the ellipse and its normal vector
-gg.createAndDisplayGO(id_normal)
-gg.createAndDisplayGO(id_major)
-gg.createAndDisplayGO(id_ellipse1)
-gg.createAndDisplayGO(id_ellipse2)
-\endcode
+\include basic_geom_objs_ex04.py
+<a href="../../examples/GEOM/basic_geom_objs_ex04.py">Download this script</a>
 
 \anchor tui_creation_arc
 <br><h2>Creation of an Arc</h2>
+\include basic_geom_objs_ex05.py
+<a href="../../examples/GEOM/basic_geom_objs_ex05.py">Download this script</a>
 
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create vertices
-p0 = geompy.MakeVertex(0., 0., 0.)
-p1 = geompy.MakeVertex(100., 0., 0.)
-p2 = geompy.MakeVertex(50., 0., 50.)
-
-# create an arc from a three points
-arc1 = geompy.MakeArc(p0, p1, p2)
-
-# create an arc from a center point, a start point and end point
-arc2 = geompy.MakeArcCenter(p0, p1, p2, 1)
-
-# create an arc from a center point, a major point and minor point
-arc3 = geompy.MakeArcOfEllipse(p0, p1, p2)
-
-# add objects in the study
-id_arc1 = geompy.addToStudy(arc1, "Arc 1")
-id_arc2 = geompy.addToStudy(arc2, "Arc 2")
-id_arc3 = geompy.addToStudy(arc3, "Arc 3")
-
-# display the arcs
-gg.createAndDisplayGO(id_arc1)
-gg.createAndDisplayGO(id_arc2)
-gg.createAndDisplayGO(id_arc3)
-\endcode
 \anchor tui_creation_curve
 <br><h2>Creation of a Curve</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create vertices and vectors
-p0 = geompy.MakeVertex(0.  , 0.  , 0.  )
-p1 = geompy.MakeVertex(50. , 100., 200.)
-p2 = geompy.MakeVertex(150.,  50., 100.)
-p3 = geompy.MakeVertex(100., 150., 170.)
-p4 = geompy.MakeVertex(200., 200., 150.)
-
-v1 = geompy.MakeVectorDXDYDZ(0, 1, 0)
-v2 = geompy.MakeVectorDXDYDZ(1, 0, 0)
-
-# create a polyline from a list of points
-polyline = geompy.MakePolyline([p0, p1, p2, p3, p4])
-
-# create a bezier curve from a list of points
-bezier = geompy.MakeBezier([p0, p1, p2, p3, p4])
-
-#create a b-spline curve from a list of points
-interpol = geompy.MakeInterpol([p0, p1, p2, p3, p4], False)
-
-#create a b-spline curve with defined directions at the ends
-interpol_tangents = geompy.MakeInterpolWithTangents([p0, p1, p2, p3, p4], v1, v2)
-
-#create a polyline using parametric definition of the basic points
-param_polyline = geompy.MakeCurveParametric("t", "sin(t)", "cos(t)", 0., 100., 100, geompy.GEOM.Polyline, theNewMethod=True)
-
-# create a bezier curve using parametric definition of the basic points
-param_bezier = geompy.MakeCurveParametric("t", "sin(t)", "cos(t)", 0., 100., 20, geompy.GEOM.Bezier, theNewMethod=True)
-
-#create a b-spline curve using parametric definition of the basic points
-param_interpol = geompy.MakeCurveParametric("t", "sin(t)", "cos(t)", 0., 100., 100, geompy.GEOM.Interpolation, theNewMethod=True)
-
-
-# add objects in the study
-id_p0       = geompy.addToStudy(p0,       "Point1")
-id_p1       = geompy.addToStudy(p1,       "Point2")
-id_p2       = geompy.addToStudy(p2,       "Point3")
-id_p3       = geompy.addToStudy(p3,       "Point4")
-id_p4       = geompy.addToStudy(p4,       "Point5")
-id_v1       = geompy.addToStudy(v1,       "Vector1")
-id_v2       = geompy.addToStudy(v2,       "Vector2")
-id_polyline = geompy.addToStudy(polyline, "Polyline")
-id_bezier   = geompy.addToStudy(bezier,   "Bezier")
-id_interpol = geompy.addToStudy(interpol, "Interpol")
-id_interpol_tangents = geompy.addToStudy(interpol_tangents, "Interpol Tangents")
-id_param_polyline = geompy.addToStudy(param_polyline, "Polyline Parametric")
-id_param_bezier = geompy.addToStudy(param_bezier, "Bezier Parametric")
-id_param_interpol = geompy.addToStudy(param_interpol, "Interpol Parametric")
-
-
-# display the points and the curves
-gg.createAndDisplayGO(id_p0)
-gg.createAndDisplayGO(id_p1)
-gg.createAndDisplayGO(id_p2)
-gg.createAndDisplayGO(id_p3)
-gg.createAndDisplayGO(id_p4)
-gg.createAndDisplayGO(id_polyline)
-gg.createAndDisplayGO(id_bezier)
-gg.createAndDisplayGO(id_interpol) 
-gg.createAndDisplayGO(id_interpol_tangents) 
-gg.createAndDisplayGO(id_param_polyline)
-gg.createAndDisplayGO(id_param_bezier)
-gg.createAndDisplayGO(id_param_interpol)
-
-\endcode
+\include basic_geom_objs_ex06.py
+<a href="../../examples/GEOM/basic_geom_objs_ex06.py">Download this script</a>
 
 \anchor tui_creation_vector
 <br><h2>Creation of a Vector</h2>
-
-\code
-mport geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create vertices
-p1 = geompy.MakeVertex(10., 50., 20.)
-p2 = geompy.MakeVertex(70., 70., 70.)
-
-# create a vector from two points
-vector1 = geompy.MakeVector(p1, p2)
-
-# create a vector from the given components
-vector2 = geompy.MakeVectorDXDYDZ(30, 30, 100)
-
-# add objects in the study
-id_p1      = geompy.addToStudy(p1,     "Point1")
-id_p2      = geompy.addToStudy(p2,     "Point2")
-id_vector1 = geompy.addToStudy(vector1,"Vector1")
-id_vector2 = geompy.addToStudy(vector2,"Vector2")
-
-# display the points and the vectors
-gg.createAndDisplayGO(id_p1)
-gg.createAndDisplayGO(id_p2)
-gg.createAndDisplayGO(id_vector1)
-gg.createAndDisplayGO(id_vector2) 
-\endcode
+\include basic_geom_objs_ex07.py
+<a href="../../examples/GEOM/basic_geom_objs_ex07.py">Download this script</a>
 
 \anchor tui_creation_plane
 <br><h2>Creation of a Plane</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create vertices
-p1 = geompy.MakeVertex(  0.,   0., 100.)
-p2 = geompy.MakeVertex(100.,   0.,   0.)
-p3 = geompy.MakeVertex(200., 200., 200.)
-p4 = geompy.MakeVertex(100., 100.,   0.)
-p5 = geompy.MakeVertex(0.  , 100.,   0.)
-
-# create a vectors from the given components
-vector1 = geompy.MakeVectorDXDYDZ(100., 100., 100.)
-vector2 = geompy.MakeVectorDXDYDZ(-100., 0., 100.)
-
-# create a vector from two points
-vector_arc = geompy.MakeVector(p2, p5)
-
-# create an arc from three points
-arc = geompy.MakeArc(p2, p4, p5)
-
-# create a wire
-wire = geompy.MakeWire([vector_arc, arc])
-
-# create a face
-isPlanarWanted = 1
-face = geompy.MakeFace(wire, isPlanarWanted)
-trimsize = 1000.
-
-# create a Local Coordinate System
-
-LCS = geompy.MakeMarker(100., 100., 101., 1, 0, 0, 0, 1, 0)
-
-# create a plane from a point, a vector and a trimsize
-plane1 = geompy.MakePlane(p1, vector1, trimsize)
-
-# create a plane from three points and a trimsize
-plane2 = geompy.MakePlaneThreePnt(p1, p2, p3, trimsize)
-
-# create a plane from the given face
-plane3 = geompy.MakePlaneFace(face, trimsize)
-
-# create a plane from two vectors and a trimsize
-plane4 = geompy.MakePlane2Vec(vector1, vector2, trimsize)
-
-# create a plane with the Local Coordinate System and a trimsize
-plane5 = geompy.MakePlaneLCS(LCS, trimsize, 1)
-
-# add objects in the study
-id_face   = geompy.addToStudy(face,  "Face")
-id_plane1 = geompy.addToStudy(plane1,"Plane1")
-id_plane2 = geompy.addToStudy(plane2,"Plane2")
-id_plane3 = geompy.addToStudy(plane3,"Plane3")
-id_plane4 = geompy.addToStudy(plane4,"Plane4")
-id_plane5 = geompy.addToStudy(plane5,"Plane5")
-
-# display the points and the vectors
-gg.createAndDisplayGO(id_face)
-gg.createAndDisplayGO(id_plane1)
-gg.createAndDisplayGO(id_plane2)
-gg.createAndDisplayGO(id_plane3)
-gg.createAndDisplayGO(id_plane4)
-gg.createAndDisplayGO(id_plane5)
-gg.setDisplayMode(id_plane1,1)
-gg.setTransparency(id_plane1,0.5)
-gg.setDisplayMode(id_plane2,1)
-gg.setTransparency(id_plane2,0.5)
-gg.setDisplayMode(id_plane3,1)
-gg.setTransparency(id_plane3,0.5)
-gg.setDisplayMode(id_plane4,1)
-gg.setTransparency(id_plane4,0.5)
-gg.setDisplayMode(id_plane5,1)
-gg.setTransparency(id_plane5,0.5)
-\endcode
+\include basic_geom_objs_ex08.py
+<a href="../../examples/GEOM/basic_geom_objs_ex08.py">Download this script</a>
 
 \anchor tui_creation_lcs
 <br><h2>Creation of a Local Coordinate System</h2>
-\code
-import GEOM
-import geompy
-import math
-import SALOMEDS
-
-#Create vertexes, vectors and shapes to construct local CS
-Vertex_1 = geompy.MakeVertex(50, 50, 50)
-Vertex_2 = geompy.MakeVertex(70, 70, 70)
-Vertex_3 = geompy.MakeVertex(0, 0, 0)
-Vector_X = geompy.MakeVectorDXDYDZ(50, 0, 0)
-Vector_Y = geompy.MakeVectorDXDYDZ(0, 50, 0)
-Face_1 = geompy.MakeFaceHW(100, 100, 1)
-Box_1 = geompy.MakeBoxTwoPnt(Vertex_1, Vertex_2)
-
-#Construct local CS by manual definition
-LocalCS_1 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0)
-
-#Construct local CS by center point and two vectors (X and Y directions)
-LocalCS_2 = geompy.MakeMarkerPntTwoVec(Vertex_3, Vector_X, Vector_Y)
-
-#Construct local CS from shape orientation
-LocalCS_FACE = geompy.MakeMarkerFromShape(Face_1)
-LocalCS_BOX = geompy.MakeMarkerFromShape(Box_1)
-
-#Add created object to study
-geompy.addToStudy( Face_1, "Face_1" )
-geompy.addToStudy( Vertex_1, "Vertex_1" )
-geompy.addToStudy( Vertex_2, "Vertex_2" )
-geompy.addToStudy( Box_1, "Box_1" )
-geompy.addToStudy( Vertex_3, "Vertex_3" )
-geompy.addToStudy( Vector_X, "Vector_X" )
-geompy.addToStudy( Vector_Y, "Vector_Y" )
-geompy.addToStudy( LocalCS_1, "LocalCS_1" )
-geompy.addToStudy( LocalCS_2, "LocalCS_3" )
-geompy.addToStudy( LocalCS_FACE, "LocalCS_FACE" )
-geompy.addToStudy( LocalCS_BOX, "LocalCS_BOX" )
-\endcode
+\include basic_geom_objs_ex09.py
+<a href="../../examples/GEOM/basic_geom_objs_ex09.py">Download this script</a>
 
 */
index aec3a74654c292b456b8695e9a34a0c6dc3958b3..3899255b12a46c244bae3f649119095f11864cf1 100644 (file)
 
 \anchor tui_partition
 <br><h2>Partition</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a vertex and a vector
-p0   = geompy.MakeVertex(  0.,   0.,   0.)
-p200 = geompy.MakeVertex(200., 200., 200.)
-pz   = geompy.MakeVertex(  0.,   0., 100.)
-
-# create a vector
-vxyz = geompy.MakeVectorDXDYDZ(100., 100., 100.)
-
-# create a box from two points
-box = geompy.MakeBoxTwoPnt(p0, p200)
-
-# create a plane
-trimsize  = 500.
-plane = geompy.MakePlane(pz, vxyz, trimsize)
-
-# create partition objects
-partition1 = geompy.MakePartition([box], [plane])
-partition2 = geompy.Partition([box], [plane])
-partition3 = geompy.MakeHalfPartition(box, plane)
-
-# add objects in the study
-id_box = geompy.addToStudy(box,"Box")
-id_plane = geompy.addToStudy(plane,"Plane")
-id_partition1 = geompy.addToStudy(partition1,"MakePartition")
-id_partition2 = geompy.addToStudy(partition2,"Partition")
-id_partition3 = geompy.addToStudy(partition3,"MakeHalfPartition")
-
-# display the partition objects and the plane
-gg.createAndDisplayGO(id_box)
-gg.setDisplayMode(id_box,1)
-gg.createAndDisplayGO(id_plane)
-gg.setDisplayMode(id_plane,1)
-gg.createAndDisplayGO(id_partition1)
-gg.createAndDisplayGO(id_partition2)
-gg.createAndDisplayGO(id_partition3)
-\endcode
+\include basic_operations_ex01.py
+<a href="../../examples/GEOM/basic_operations_ex01.py">Download this script</a>
 
 \anchor tui_archimede
 <br><h2>Archimede</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a vertex and a vector
-p0   = geompy.MakeVertex(  0.,   0.,   0.)
-p200 = geompy.MakeVertex(200., 200., 200.)
-
-# create a box from two points
-box = geompy.MakeBoxTwoPnt(p0, p200)
-
-# perform an Archimede operation on the selected shape with selected parameters
-weight  = 1000000.
-waterdensity = 1.
-meshingdeflection = 0.01
-archimede  = geompy.Archimede(box, weight, waterdensity, meshingdeflection)
-
-# add objects in the study
-id_box = geompy.addToStudy(box,"Box")
-id_archimede = geompy.addToStudy(archimede,"Archimede")
-
-# display the box and the result of Archimede operation
-gg.createAndDisplayGO(id_box)
-gg.setDisplayMode(id_box,1)
-gg.createAndDisplayGO(id_archimede)
-gg.setDisplayMode(id_archimede,1) 
-\endcode
+\include basic_operations_ex02.py
+<a href="../../examples/GEOM/basic_operations_ex02.py">Download this script</a>
 
 \anchor tui_restore_prs_params
 <br><h2>Restore presentation parameters and sub-shapes</h2>
-
-\code
-import geompy
-import GEOM
-import SALOMEDS
-
-# create a box and a cylinder
-box = geompy.MakeBoxDXDYDZ(200, 200, 200)
-cyl = geompy.MakeCylinderRH(100, 300)
-
-# create translated box
-vec = geompy.MakeVectorDXDYDZ(100, 50, 0)
-tra = geompy.MakeTranslationVector(box, vec)
-
-# create partition objects
-partition1 = geompy.MakePartition([box, cyl])
-partition2 = geompy.MakePartition([box], [cyl])
-partition3 = geompy.MakePartition([box], [tra])
-
-# set colours
-box.SetColor(SALOMEDS.Color(1,0,0))
-cyl.SetColor(SALOMEDS.Color(0,1,0))
-
-# add objects in the study
-geompy.addToStudy(box, "Box")
-geompy.addToStudy(cyl, "Cylinder")
-geompy.addToStudy(vec, "Vector")
-geompy.addToStudy(tra, "Translation")
-geompy.addToStudy(partition1, "Partition_1")
-geompy.addToStudy(partition2, "Partition_2")
-geompy.addToStudy(partition3, "Partition_3")
-
-# Restore presentation parameters and sub-shapes
-# different methods can be used to find the sub-shapes in the result:
-# GetInPlace, GetSame, GetInPlaceByHistory, GetShapesOnShape.
-# By default, GetInPlace method is used (GEOM.FSM_GetInPlace)
-geompy.RestoreSubShapes(partition1)
-
-geompy.RestoreSubShapes(partition2, [], GEOM.FSM_GetInPlace)
-
-# The list of arguments can be used to avoid restoring all arguments,
-# but restore only the passed.
-geompy.RestoreSubShapes(partition3, [tra], GEOM.FSM_GetInPlaceByHistory)
-
-# To find sub-shapes in a transformed shape only one method could be
-# used: pass GEOM.FSM_Transformed for that.
-# True passed for the last argument, means that the transformed shape
-# will inherit colour and sub-shapes from its first argument (see above
-# MakeTranslation).
-geompy.RestoreSubShapes(tra, [], GEOM.FSM_Transformed, True)
-
-# Also we could do this directly with method addToStudy:
-partition4 = geompy.MakePartition([box, tra])
-geompy.addToStudy(partition4, "Partition_4", True, [],
-                  GEOM.FSM_GetInPlaceByHistory, False)
-\endcode
+\include basic_operations_ex03.py
+<a href="../../examples/GEOM/basic_operations_ex03.py">Download this script</a>
 
 */
index 4c01ec438463e66d1d256e56d2d2454e0e3e7c8b..dad8e828bef03a1ed14c79409b2805e7a556f1ce 100644 (file)
@@ -1,26 +1,7 @@
 /*!
 
 \page tui_basic_properties_page Basic Properties
-
-\code
-import geompy
-import math
-
-# create a box
-box = geompy.MakeBoxDXDYDZ(100,30,100)
-props = geompy.BasicProperties(box)
-print "\nBox 100x30x100 Basic Properties:"
-print " Wires length: ", props[0]
-print " Surface area: ", props[1]
-print " Volume      : ", props[2]
-length = math.sqrt((props[0] - 1840)*(props[0] - 1840))
-area = math.sqrt((props[1] - 32000)*(props[1] - 32000))
-volume = math.sqrt((props[2] - 300000)*(props[2] - 300000))
-if length > 1e-7 or area > 1e-7 or volume > 1e-7:
-    print "While must be:"
-    print " Wires length: ", 1840
-    print " Surface area: ", 32000
-    print " Volume      : ", 300000.
-\endcode
+\include basic_properties.py
+<a href="../../examples/GEOM/basic_properties.py">Download this script</a>
 
 */
index 8544667f1a313091211e21fda409264e2b28dc10..4acb44f809adda6aea2bde6a7e34f6f87f10ac57 100644 (file)
@@ -4,95 +4,17 @@
 
 \anchor tui_multi_transformation
 <br><h2>Multi Transformation</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create vertices
-p_25_25_50 = geompy.MakeVertex(25., 25., 50.)
-p_50_25_25 = geompy.MakeVertex(50., 25., 25.)
-p_25_50_25 = geompy.MakeVertex(25., 50., 25.)
-
-box = geompy.MakeBoxDXDYDZ(50, 50, 50)
-
-top_face = geompy.GetFaceNearPoint(box, p_25_25_50)
-yz_face = geompy.GetFaceNearPoint(box, p_50_25_25)
-xz_face = geompy.GetFaceNearPoint(box, p_25_50_25)
-
-top_face_ind = geompy.GetSubShapeID(box, top_face)
-yz_face_ind = geompy.GetSubShapeID(box, yz_face)
-xz_face_ind = geompy.GetSubShapeID(box, xz_face)
-
-# Multi-transformate block and glue the result
-box_tr1 = geompy.MakeMultiTransformation1D(box, yz_face_ind, top_face_ind, 3)
-box_tr2 = geompy.MakeMultiTransformation2D(box, xz_face_ind, yz_face_ind, 3, top_face_ind, 0, 2)
-
-# add objects in the study
-id_box = geompy.addToStudy(box, "Box")
-id_box_tr1 = geompy.addToStudy(box_tr1, "Multi-transformed Block 1D")
-id_box_tr2 = geompy.addToStudy(box_tr2, "Multi-transformed Block 2D")
-
-# display the results
-gg.createAndDisplayGO(id_box)
-gg.setDisplayMode(id_box,1)
-gg.createAndDisplayGO(id_box_tr1)
-gg.createAndDisplayGO(id_box_tr2) 
-\endcode
+\include blocks_operations_ex01.py
+<a href="../../examples/GEOM/blocks_operations_ex01.py">Download this script</a>
 
 \anchor tui_explode_on_blocks
 <br><h2>Explode on Blocks</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a box and a sphere
-box = geompy.MakeBoxDXDYDZ(200, 200, 200)
-sphere = geompy.MakeSphereR(100)
-
-# make a compound
-compound = geompy.MakeCompound([box, sphere])
-
-# get all the blocks of the given compound, by criteria: min_nb_faces <= nb. of faces <= max_nb_faces
-min_nb_faces = 6
-max_nb_faces = 6
-make_block_explode = geompy.MakeBlockExplode(compound, min_nb_faces, max_nb_faces)
-
-# add objects in the study
-id_compound = geompy.addToStudy(compound, "Compound")
-id_make_block_explode = geompy.addToStudyInFather(compound, make_block_explode[0], "MakeBlockExplode")
-
-# display the results
-gg.createAndDisplayGO(id_compound)
-gg.createAndDisplayGO(id_make_block_explode)
-gg.setDisplayMode(id_make_block_explode,1) 
-\endcode
+\include blocks_operations_ex02.py
+<a href="../../examples/GEOM/blocks_operations_ex02.py">Download this script</a>
 
 \anchor tui_propagate
 <br><h2>Propagate</h2>
+\include blocks_operations_ex03.py
+<a href="../../examples/GEOM/blocks_operations_ex03.py">Download this script</a>
 
-\code
-import geompy
-import salome
-
-# create a box
-box = geompy.MakeBoxDXDYDZ(200, 200, 200)
-
-# build all possible propagation groups
-listChains = geompy.Propagate(check_box)
-
-# add objects in the study
-geompy.addToStudy(check_box, "Box")
-ii = 1
-for chain in listChains:
-    geompy.addToStudyInFather(check_box, chain, "propagation chain " + `ii`)
-    ii = ii + 1
-    pass
-
-salome.sg.updateObjBrowser(1) 
-\endcode
-
-*/
\ No newline at end of file
+*/
index 60563757c190d2880d09ba7d52a2e7c423ed7107..0ab8db001cdb4f55e5e0ea1184f1b1d24c2c85e1 100644 (file)
 
 \anchor tui_fuse
 <br><h2>Fuse</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a vertex and a vector
-p1 = geompy.MakeVertex(25, 55, 0)
-p2 = geompy.MakeVertex( 0,  0, 0)
-v = geompy.MakeVector(p1, p2)
-
-# create a cylinder
-height = 35
-radius1 = 20
-cylinder = geompy.MakeCylinder(p1, v, radius1, height)
-
-# create a sphere
-sphere = geompy.MakeSphereR(40)
-
-# fuse
-fuse1 = geompy.MakeFuse(cylinder, sphere)
-fuse2 = geompy.MakeBoolean(cylinder, sphere, 3)
-
-# add objects in the study
-id_cylinder = geompy.addToStudy(cylinder, "Cylinder")
-id_sphere = geompy.addToStudy(sphere, "Sphere")
-id_fuse1 = geompy.addToStudy(fuse1, "Fuse_1")
-id_fuse2 = geompy.addToStudy(fuse2, "Fuse_2")
-
-# display results
-gg.createAndDisplayGO(id_cylinder)
-gg.setDisplayMode(id_cylinder,1)
-gg.createAndDisplayGO(id_sphere)
-gg.setDisplayMode(id_sphere,1)
-gg.createAndDisplayGO(id_fuse1)
-gg.setDisplayMode(id_fuse1,1)
-gg.createAndDisplayGO(id_fuse2)
-gg.setDisplayMode(id_fuse2,1)
-\endcode
+\include boolean_operations_ex01.py
+<a href="../../examples/GEOM/boolean_operations_ex01.py">Download this script</a>
 
 \anchor tui_common
 <br><h2>Common</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a vertex and a vector
-p1 = geompy.MakeVertex(25, 55, 0)
-p2 = geompy.MakeVertex( 0,  0, 0)
-v = geompy.MakeVector(p1, p2)
-
-# create a cylinder
-height = 35
-radius1 = 20
-cylinder = geompy.MakeCylinder(p1, v, radius1, height)
-
-# create a sphere
-sphere = geompy.MakeSphereR(40)
-
-# make common
-common = geompy.MakeCommon(cylinder, sphere)
-
-# add objects in the study
-id_common = geompy.addToStudy(common, "Common")
-
-# display the results
-gg.createAndDisplayGO(id_common)
-gg.setDisplayMode(id_common,1)
-\endcode
+\include boolean_operations_ex02.py
+<a href="../../examples/GEOM/boolean_operations_ex02.py">Download this script</a>
 
 \anchor tui_cut
 <br><h2>Cut</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a vertex and a vector
-p1 = geompy.MakeVertex(25, 55, 0)
-p2 = geompy.MakeVertex( 0,  0, 0)
-v = geompy.MakeVector(p1, p2)
-
-# create a cylinder
-height = 35
-radius1 = 20
-cylinder = geompy.MakeCylinder(p1, v, radius1, height)
-
-# create a sphere
-sphere = geompy.MakeSphereR(40)
-
-#cut
-cut = geompy.MakeCut(cylinder, sphere)
-
-# add objects in the study
-id_cut = geompy.addToStudy(cut, "Cut")
-
-# display the results
-gg.createAndDisplayGO(id_cut)
-gg.setDisplayMode(id_cut,1) 
-\endcode
+\include boolean_operations_ex03.py
+<a href="../../examples/GEOM/boolean_operations_ex03.py">Download this script</a>
 
 \anchor tui_section
 <br><h2>Section</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a vertex and a vector
-p1 = geompy.MakeVertex(25, 55, 0)
-p2 = geompy.MakeVertex( 0,  0, 0)
-v = geompy.MakeVector(p1, p2)
-
-# create a cylinder
-height = 35
-radius1 = 20
-cylinder = geompy.MakeCylinder(p1, v, radius1, height)
-
-# create a sphere
-sphere = geompy.MakeSphereR(40)
-
-# make a section
-section = geompy.MakeSection(cylinder, sphere)
-
-# add objects in the study
-id_section = geompy.addToStudy(section, "Section")
-
-# display the results
-gg.createAndDisplayGO(id_section)
-gg.setDisplayMode(id_section,1) 
-\endcode
+\include boolean_operations_ex04.py
+<a href="../../examples/GEOM/boolean_operations_ex04.py">Download this script</a>
 
 */
index 022795cbb291a2c49e8362110b59ca0c78a80a1f..76d4b43474d5d1e059d224677d56bc1c6e4f914d 100644 (file)
@@ -1,23 +1,7 @@
 /*!
 
 \page tui_bounding_box_page Bounding Box
-
-\code
-import geompy
-
-# create a box
-box = geompy.MakeBoxDXDYDZ(100,30,100)
-
-bb = geompy.BoundingBox(box)
-print "\nBounding Box of box 100x30x100:"
-print " Xmin = ", bb[0], ", Xmax = ", bb[1]
-print " Ymin = ", bb[2], ", Ymax = ", bb[3]
-print " Zmin = ", bb[4], ", Zmax = ", bb[5]
-
-aBB = geompy.MakeBoundingBox(box)
-
-geompy.addToStudy(box, "box 100x30x100")
-geompy.addToStudy(aBB, "Bounding box of box 100x30x100")
-\endcode
+\include bounding_box.py
+<a href="../../examples/GEOM/bounding_box.py">Download this script</a>
 
 */
index 3584c7ef57e9e6248d65e0c1ca65cfe2361929af..77f8e363bf2f275a43441cff62dfbe661bc32f33 100644 (file)
 \page tui_building_by_blocks_page Building by Blocks
 
 <br><h2>Quadrangle Face</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create vertices
-p1 = geompy.MakeVertex(  0.,   0.,   0.)
-p2 = geompy.MakeVertex(150.,  30.,   0.)
-p3 = geompy.MakeVertex(  0., 120.,  50.)
-p4 = geompy.MakeVertex(  0.,  40.,  70.)
-
-# create edges
-edge1 = geompy.MakeEdge(p1, p2)
-edge2 = geompy.MakeEdge(p2, p3)
-edge3 = geompy.MakeEdge(p3, p4)
-edge4 = geompy.MakeEdge(p4, p1)
-
-# create a quadrangle face from four edges
-qface1 = geompy.MakeQuad(edge1, edge2, edge3, edge4)
-
-# create a quadrangle face from two edges
-qface2 = geompy.MakeQuad2Edges(edge1, edge3)
-
-# create a quadrangle from four points in its corners
-qface3 = geompy.MakeQuad4Vertices(p1, p2, p3, p4)
-
-# add objects in the study
-id_p1 = geompy.addToStudy(p1,"Point1")
-id_p2 = geompy.addToStudy(p2,"Point2")
-id_p3 = geompy.addToStudy(p3,"Point3")
-id_p4 = geompy.addToStudy(p4,"Point4")
-id_edge1 = geompy.addToStudy(edge1,"Edge1")
-id_edge2 = geompy.addToStudy(edge2,"Edge2")
-id_edge3 = geompy.addToStudy(edge3,"Edge3")
-id_edge4 = geompy.addToStudy(edge4,"Edge4")
-id_qface1 = geompy.addToStudy(qface1,"Qface1")
-id_qface2 = geompy.addToStudy(qface2,"Qface2")
-id_qface3 = geompy.addToStudy(qface3,"Qface3")
-
-# display the vertices, the edges and the quadrangle faces
-gg.createAndDisplayGO(id_p1)
-gg.createAndDisplayGO(id_p2)
-gg.createAndDisplayGO(id_p3)
-gg.createAndDisplayGO(id_p4)
-gg.createAndDisplayGO(id_edge1)
-gg.createAndDisplayGO(id_edge2)
-gg.createAndDisplayGO(id_edge3)
-gg.createAndDisplayGO(id_edge4)
-gg.createAndDisplayGO(id_qface1)
-gg.setDisplayMode(id_qface1,1)
-gg.createAndDisplayGO(id_qface2)
-gg.setDisplayMode(id_qface2,1)
-gg.createAndDisplayGO(id_qface3)
-gg.setDisplayMode(id_qface3,1)
-\endcode
+\include building_by_blocks_ex01.py
+<a href="../../examples/GEOM/building_by_blocks_ex01.py">Download this script</a>
 
 <br><h2>Hexagonal Solid</h2>
+\include building_by_blocks_ex02.py
+<a href="../../examples/GEOM/building_by_blocks_ex02.py">Download this script</a>
 
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create vertices
-p0  = geompy.MakeVertex(  0.,   0.,   0.)
-p1  = geompy.MakeVertex(  0.,   0.,  40.)
-p2  = geompy.MakeVertex( 70., -15.,   0.)
-p3  = geompy.MakeVertex( 70., -15.,  70.)
-
-p4  = geompy.MakeVertex(  0.,  70.,   0.)
-p5  = geompy.MakeVertex(  0.,  70.,  40.)
-p6  = geompy.MakeVertex( 70.,  70.,   0.)
-p7  = geompy.MakeVertex( 70.,  70.,  70.)
-
-p8  = geompy.MakeVertex(  0., -50.,   0.)
-p9  = geompy.MakeVertex(  0., -50.,  40.)
-p10 = geompy.MakeVertex( 70., -35.,   0.)
-p11 = geompy.MakeVertex( 70., -35.,  70.)
-
-# create faces
-qface1 = geompy.MakeQuad4Vertices(p0, p1, p2, p3)
-qface2 = geompy.MakeQuad4Vertices(p4, p5, p6, p7)
-qface3 = geompy.MakeQuad4Vertices(p0, p1, p4, p5)
-qface4 = geompy.MakeQuad4Vertices(p2, p3, p6, p7)
-qface5 = geompy.MakeQuad4Vertices(p0, p2, p4, p6)
-qface6 = geompy.MakeQuad4Vertices(p1, p3, p5, p7)
-qface7 = geompy.MakeQuad4Vertices(p8, p9, p10, p11)
-
-# create a hexahedral solid between two given faces
-solid1 = geompy.MakeHexa2Faces(qface1, qface7)
-
-# create a hexahedral solid, bounded by six given faces
-solid2 = geompy.MakeHexa(qface1, qface2, qface3, qface4, qface5, qface6)
-
-# add objects in the study
-geompy.addToStudy(qface1,"qface1")
-geompy.addToStudy(qface2,"qface2")
-geompy.addToStudy(qface3,"qface3")
-geompy.addToStudy(qface4,"qface4")
-geompy.addToStudy(qface5,"qface5")
-geompy.addToStudy(qface6,"qface6")
-geompy.addToStudy(qface7,"qface7")
-
-id_solid1 = geompy.addToStudy(solid1,"Solid1")
-id_solid2 = geompy.addToStudy(solid2,"Solid2")
-
-# display solids
-gg.createAndDisplayGO(id_solid1)
-gg.setDisplayMode(id_solid1, 1)
-gg.createAndDisplayGO(id_solid2)
-gg.setDisplayMode(id_solid2, 1) 
-\endcode
-
-*/
\ No newline at end of file
+*/
index 9c9b6f6595d80169beb9a920a70697586d080853..49eb49538b4188ddec2dbf424b43c9e27266de12 100644 (file)
@@ -1,25 +1,7 @@
 /*!
 
 \page tui_center_of_mass_page Center of masses
-
-\code
-import geompy
-import math
-
-# create a box
-box = geompy.MakeBoxDXDYDZ(100,30,100)
-cm = geompy.MakeCDG(box)
-if cm is None:
-    raise RuntimeError, "MakeCDG(box) failed"
-else:
-    print "\nCentre of gravity of box has been successfully obtained:"
-    coords = geompy.PointCoordinates(cm)
-    print "(", coords[0], ", ", coords[1], ", ", coords[2], ")"
-    dx = math.sqrt((coords[0] - 50)*(coords[0] - 50))
-    dy = math.sqrt((coords[1] - 15)*(coords[1] - 15))
-    dz = math.sqrt((coords[2] - 50)*(coords[2] - 50))
-    if dx > 1e-7 or dy > 1e-7 or dz > 1e-7:
-        print "But must be (50, 15, 50)"
-\endcode
+\include center_of_mass.py
+<a href="../../examples/GEOM/center_of_mass.py">Download this script</a>
 
 */
index 1bd2fe9bb813d6fbfc9897f0bae911f4b99b6066..eeb9d92a1e8afd5004144dbb9c515b21b21616fd 100644 (file)
@@ -1,27 +1,7 @@
 /*!
 
 \page tui_check_compound_of_blocks_page Check Compound of Blocks
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create boxes
-box1 = geompy.MakeBox(0,0,0,100,50,100)
-box2 = geompy.MakeBox(100,0,0,250,50,100)
-
-# make a compound
-compound = geompy.MakeCompound([box1, box2])
-
-# glue the faces of the compound
-tolerance = 1e-5
-glue = geompy.MakeGlueFaces(compound, tolerance)
-IsValid = geompy.CheckCompoundOfBlocks(glue)
-if IsValid == 0:
-    raise RuntimeError, "Invalid compound created"
-else:
-    print "\nCompound is valid"
-\endcode
+\include check_compound_of_blocks.py
+<a href="../../examples/GEOM/check_compound_of_blocks.py">Download this script</a>
 
 */
index e49de0a3065e45653adef23b658b440990113b57..346de0c2b6577997f06e8894b126f213f78ffba9 100644 (file)
@@ -1,17 +1,7 @@
 /*!
 
 \page tui_check_self_intersections_page Detect Self-intersections
-
-\code
-import geompy
-
-# create a box
-box = geompy.MakeBoxDXDYDZ(100,30,100)
-IsValid = geompy.CheckSelfIntersections(box)
-if IsValid == 0:
-    raise RuntimeError, "Box with self-intersections created"
-else:
-    print "\nBox is valid"
-\endcode
+\include check_self_intersections.py
+<a href="../../examples/GEOM/check_self_intersections.py">Download this script</a>
 
 */
index f9ca32c9714e9de87a0614bc344ee578de3787f3..5e11279eff0108efbbee713e9b43f4e70b291b38 100644 (file)
@@ -1,17 +1,7 @@
 /*!
 
 \page tui_check_shape_page Check Shape
-
-\code
-import geompy
-
-# create a box
-box = geompy.MakeBoxDXDYDZ(100,30,100)
-IsValid = geompy.CheckShape(box)
-if IsValid == 0:
-    raise RuntimeError, "Invalid box created"
-else:
-    print "\nBox is valid"
-\endcode
+\include check_shape.py
+<a href="../../examples/GEOM/check_shape.py">Download this script</a>
 
 */
index 2cdcf156a135612b5fedd0321fd92c1bbeb25cd4..03094395632ff0e186bc9e5271e7d8237aaf2936 100644 (file)
 
 \anchor tui_creation_prism
 <br><h2>Creation of a Prism</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a vertex and a vector
-p1 = geompy.MakeVertex(   0.,   0.,   0.)
-p2 = geompy.MakeVertex( 100.,   0.,   0.)
-p3 = geompy.MakeVertex( 100., 100.,   0.)
-p4 = geompy.MakeVertex(   0., 100.,   0.)
-p5 = geompy.MakeVertex(   0.,   0.,  60.)
-p6 = geompy.MakeVertex(-100.,   0.,   0.)
-p7 = geompy.MakeVertex(-100.,-100.,   0.)
-p8 = geompy.MakeVertex(   0.,-100.,   0.)
-
-# create a vector from the given components
-vector = geompy.MakeVectorDXDYDZ(50., 50., 50.)
-
-#create vectors from two points
-vector1_arc1 = geompy.MakeVector(p1, p2)
-vector2_arc1 = geompy.MakeVector(p1, p4)
-vector1_arc2 = geompy.MakeVector(p1, p6)
-vector2_arc2 = geompy.MakeVector(p1, p8)
-
-# create arcs from three points
-arc1 = geompy.MakeArc(p2, p3, p4)
-arc2 = geompy.MakeArc(p6, p7, p8)
-
-# create wires
-wire1 = geompy.MakeWire([vector1_arc1, arc1, vector2_arc1])
-wire2 = geompy.MakeWire([vector1_arc2, arc2, vector2_arc2])
-
-# create faces
-isPlanarWanted = 1
-face1 = geompy.MakeFace(wire1, isPlanarWanted)
-face2 = geompy.MakeFace(wire2, isPlanarWanted)
-
-# create prisms
-prism1 = geompy.MakePrism(face2, p1, p5)
-prism2 = geompy.MakePrismVecH(face1, vector, 50)
-prism3 = geompy.MakePrismVecH2Ways(face1, vector, 50)
-
-# add objects in the study
-id_face1   = geompy.addToStudy(face1,"Face1")
-id_face2   = geompy.addToStudy(face2,"Face2")
-id_prism1 = geompy.addToStudy(prism1,"Prism1")
-id_prism2 = geompy.addToStudy(prism2,"Prism2")
-id_prism3 = geompy.addToStudy(prism3,"Prism3")
-
-# display cylinders
-gg.createAndDisplayGO(id_face1)
-gg.setDisplayMode(id_face1,1)
-gg.createAndDisplayGO(id_face2)
-gg.setDisplayMode(id_face2,1)
-gg.createAndDisplayGO(id_prism1)
-gg.setDisplayMode(id_prism1,1)
-gg.createAndDisplayGO(id_prism2)
-gg.setDisplayMode(id_prism2,1) 
-gg.createAndDisplayGO(id_prism3)
-gg.setDisplayMode(id_prism3,1) 
-\endcode
+\include complex_objs_ex01.py
+<a href="../../examples/GEOM/complex_objs_ex01.py">Download this script</a>
 
 \anchor tui_creation_revolution
 <br><h2>Creation of a Revolution</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a vertex and a vector
-p1 = geompy.MakeVertex(  10.,  10.,  10.)
-p2 = geompy.MakeVertex(  15.,  15.,  50.)
-p3 = geompy.MakeVertex(  40.,  40.,   0.)
-
-#create vectors from two points
-vector1 = geompy.MakeVector(p1, p2)
-vector2 = geompy.MakeVector(p1, p3)
-
-# create a vector from the given components
-vector3 = geompy.MakeVectorDXDYDZ(-20., -20., 100.)
-
-# create a wire
-wire = geompy.MakeWire([vector1, vector2])
-
-# create a revolution
-revolution = geompy.MakeRevolution(wire, vector3, 2.3)
-
-# add objects in the study
-id_vector3    = geompy.addToStudy(vector3,"Axis")
-id_wire       = geompy.addToStudy(wire,"Wire")
-id_revolution = geompy.addToStudy(revolution,"Revolution")
-
-# display the vector, the wire and the revolution
-gg.createAndDisplayGO(id_vector3)
-gg.createAndDisplayGO(id_wire)
-gg.createAndDisplayGO(id_revolution)
-gg.setDisplayMode(id_revolution,1) 
-\endcode
+\include complex_objs_ex02.py
+<a href="../../examples/GEOM/complex_objs_ex02.py">Download this script</a>
 
 \anchor tui_creation_filling
 <br><h2>Creation of a Filling</h2>
+\include complex_objs_ex03.py
+<a href="../../examples/GEOM/complex_objs_ex03.py">Download this script</a>
 
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-mindeg = 2
-maxdeg = 5
-tol3d  = 0.0001
-tol2d  = 0.0001
-nbiter = 5
-
-# create a vertex and a vector
-p1 = geompy.MakeVertex(  -30.,  -30.,  50.)
-p2 = geompy.MakeVertex(  -60.,  -60.,  30.)
-p3 = geompy.MakeVertex(  -30.,  -30.,  10.)
-
-# create an arc from three points
-arc = geompy.MakeArc(p1, p2, p3)
-ShapeListCompound = []
-i = 0
-while i <= 3 :
-    S = geompy.MakeTranslation(arc, i * 50., 0., 0.)
-    ShapeListCompound.append(S)
-    i = i + 1
-
-compound = geompy.MakeCompound(ShapeListCompound)
-
-# create a filling
-filling = geompy.MakeFilling(compound, mindeg, maxdeg, tol3d, tol2d, nbiter)
-
-# add objects in the study
-id_compound = geompy.addToStudy(compound,"Compound")
-id_filling = geompy.addToStudy(filling,"Filling")
-
-# display the compound and the filling
-gg.createAndDisplayGO(id_compound)
-gg.createAndDisplayGO(id_filling)
-gg.setDisplayMode(id_filling,1) 
-\endcode
 \anchor tui_creation_pipe
 <br><h2>Creation of a Pipe</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create vertices
-p0   = geompy.MakeVertex(0.  , 0.  , 0.  )
-px   = geompy.MakeVertex(100., 0.  , 0.  )
-py   = geompy.MakeVertex(0.  , 100., 0.  )
-pz   = geompy.MakeVertex(0.  , 0.  , 100.)
-pxyz = geompy.MakeVertex(100., 100., 100.)
-
-# create a vector from two points
-vxy = geompy.MakeVector(px, py)
-
-# create an arc from three points
-arc = geompy.MakeArc(py, pz, px)
-
-# create a wire
-wire = geompy.MakeWire([vxy, arc])
-
-# create an edge
-edge = geompy.MakeEdge(p0, pxyz)
-
-# create a pipe
-pipe = geompy.MakePipe(wire, edge)
-
-# add objects in the study
-id_wire = geompy.addToStudy(wire,"Wire")
-id_edge = geompy.addToStudy(edge,"Edge")
-id_pipe = geompy.addToStudy(pipe,"Pipe")
-
-# display the wire, the edge (path) and the pipe
-gg.createAndDisplayGO(id_wire)
-gg.createAndDisplayGO(id_edge)
-gg.createAndDisplayGO(id_pipe)
-gg.setDisplayMode(id_pipe,1) 
-\endcode
+\include complex_objs_ex04.py
+<a href="../../examples/GEOM/complex_objs_ex04.py">Download this script</a>
 
 \anchor tui_creation_pipe_with_diff_sec
 <br><h2>Creation of a PipeWithDifferentSections</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-Wire_1 = 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])
-edges = geompy.SubShapeAll(Wire_1, geompy.ShapeType["EDGE"])
-vertices = geompy.SubShapeAll(Wire_1, geompy.ShapeType["VERTEX"])
-
-# create sections
-circles=[]
-circles.append(geompy.MakeCircle(vertices[0], edges[0], 20))
-circles.append(geompy.MakeCircle(vertices[1], edges[0], 40))
-circles.append(geompy.MakeCircle(vertices[2], edges[2], 30))
-circles.append(geompy.MakeCircle(vertices[3], edges[2], 20))
-
-# create pipe
-Pipe = geompy.MakePipeWithDifferentSections(circles, vertices, Wire_1, 0, 0)
-
-# add objects in the study
-geompy.addToStudy(circles[0], "circles1")
-geompy.addToStudy(circles[1], "circles2")
-geompy.addToStudy(circles[2], "circles3")
-geompy.addToStudy(circles[3], "circles4")
-id_wire = geompy.addToStudy(Wire_1, "Path")
-id_pipe = geompy.addToStudy(Pipe, "Pipe")
-
-# display the wire(path) and the pipe
-gg.createAndDisplayGO(id_wire)
-gg.createAndDisplayGO(id_pipe)
-gg.setDisplayMode(id_pipe,1) 
-\endcode
+\include complex_objs_ex05.py
+<a href="../../examples/GEOM/complex_objs_ex05.py">Download this script</a>
 
 \anchor tui_creation_pipe_with_shell_sec
 <br><h2>Creation of a PipeWithShellSections</h2>
-
-\code
-import geompy
-import salome
-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])
-
-#=======================================================
-#                 Create shell sections
-#=======================================================
-ps = [Vertex_1,Vertex_2,Vertex_3,Vertex_4]
-theLocations = [Vertex_1, Vertex_2, Vertex_3, Vertex_4]
-VC = geompy.MakeCompound(theLocations)
-geompy.addToStudy(VC,"VC")
-vs = [Edge_1,Edge_1,Edge_3,Edge_3]
-hs = [20,40,30,20]
-shells = []
-subbases = []
-
-# 1 section
-c0 = geompy.PointCoordinates(ps[0])
-c1 = geompy.PointCoordinates(ps[1])
-nx = c1[0] - c0[0]
-ny = c1[1] - c0[1]
-nz = c1[2] - c0[2]
-
-faces = []
-f1 = geompy.MakeSketcher("Sketcher:F 0 0:TT 20 0:TT 20 20:TT 0 20:WF",
-                         [c0[0], c0[1], c0[2], nx, ny, nz, 0, 0, 1])
-f2 = geompy.MakeSketcher("Sketcher:F 0 0:TT 0 20:TT -20 20:TT -20 0:WF",
-                         [c0[0], c0[1], c0[2], nx, ny, nz, 0, 0, 1])
-f3 = geompy.MakeSketcher("Sketcher:F 0 0:TT -20 0:TT -20 -20:TT 0 -20:WF",
-                         [c0[0], c0[1], c0[2], nx, ny, nz, 0, 0, 1])
-f4 = geompy.MakeSketcher("Sketcher:F 0 0:TT 0 -20:TT 20 -20:TT 20 0:WF",
-                         [c0[0], c0[1], c0[2], nx, ny, nz, 0, 0, 1])
-faces.append(f1)
-faces.append(f2)
-faces.append(f3)
-faces.append(f4)
-shell = geompy.MakeSewing(faces,1.e-6)
-shells.append(shell)
-faces = geompy.SubShapeAllSortedCentres(shell, geompy.ShapeType["FACE"])
-subbases.append(faces[0])
-
-# 2 section
-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)
-w = geompy.MakeWire([e1,e2,e3,arc])
-f1 = geompy.MakeFace(w,1)
-
-w = geompy.MakeSketcher("Sketcher:F -20 0:TT 0 0:TT 0 20:TT -20 20",
-                         [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)
-w = geompy.MakeWire([e1,e2,e3,arc])
-f2 = geompy.MakeFace(w,1)
-
-w = geompy.MakeSketcher("Sketcher:F 20 0:TT 0 0:TT 0 -20:TT 20 -20",
-                         [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)
-w = geompy.MakeWire([e1,e2,e3,arc])
-f3 = geompy.MakeFace(w,1)
-
-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)
-w = geompy.MakeWire([e1,e2,e3,arc])
-f4 = geompy.MakeFace(w,1)
-
-faces.append(f1)
-faces.append(f2)
-faces.append(f3)
-faces.append(f4)
-shell = geompy.MakeSewing(faces,1.e-6)
-shells.append(shell)
-faces = geompy.SubShapeAllSortedCentres(shell, geompy.ShapeType["FACE"])
-subbases.append(faces[0])
-
-# 3 section
-faces = []
-c2 = geompy.PointCoordinates(ps[2])
-c3 = geompy.PointCoordinates(ps[3])
-nx = c3[0] - c2[0]
-ny = c3[1] - c2[1]
-nz = c3[2] - c2[2]
-
-w = geompy.MakeSketcher("Sketcher:F 20 20:TT 0 20:TT 0 0:TT 20 0",
-                         [c2[0], c2[1], c2[2], nx, ny, nz, 0, 0, 1])
-[e1,e2,e3] = geompy.SubShapeAll(w, geompy.ShapeType["EDGE"])
-arc = MakeArc(w,3,1)
-w = geompy.MakeWire([e1,e2,e3,arc])
-f1 = geompy.MakeFace(w,1)
-
-w = geompy.MakeSketcher("Sketcher:F -20 0:TT 0 0:TT 0 20:TT -20 20",
-                         [c2[0], c2[1], c2[2], nx, ny, nz, 0, 0, 1])
-[e1,e2,e3] = geompy.SubShapeAll(w, geompy.ShapeType["EDGE"])
-arc = MakeArc(w,3,1)
-w = geompy.MakeWire([e1,e2,e3,arc])
-f2 = geompy.MakeFace(w,1)
-
-w = geompy.MakeSketcher("Sketcher:F 20 0:TT 0 0:TT 0 -20:TT 20 -20",
-                         [c2[0], c2[1], c2[2], nx, ny, nz, 0, 0, 1])
-[e1,e2,e3] = geompy.SubShapeAll(w, geompy.ShapeType["EDGE"])
-arc = MakeArc(w,3,1)
-w = geompy.MakeWire([e1,e2,e3,arc])
-f3 = geompy.MakeFace(w,1)
-
-w = geompy.MakeSketcher("Sketcher:F -20 -20:TT 0 -20:TT 0 0:TT -20 0",
-                         [c2[0], c2[1], c2[2], nx, ny, nz, 0, 0, 1])
-[e1,e2,e3] = geompy.SubShapeAll(w, geompy.ShapeType["EDGE"])
-arc = MakeArc(w,3,1)
-w = geompy.MakeWire([e1,e2,e3,arc])
-f4 = geompy.MakeFace(w,1)
-
-faces.append(f1)
-faces.append(f2)
-faces.append(f3)
-faces.append(f4)
-shell = geompy.MakeSewing(faces,1.e-6)
-shells.append(shell)
-faces = geompy.SubShapeAllSortedCentres(shell, geompy.ShapeType["FACE"])
-subbases.append(faces[2])
-
-# 4 section
-faces = []
-
-kk = 4
-dx = c3[0] - nx/kk
-dy = c3[1] - ny/kk
-dz = c3[2] - nz/kk
-rad = math.sqrt(nx*nx+ny*ny+nz*nz)
-vc = geompy.MakeVertex(dx,dy,dz)
-sph = geompy.MakeSpherePntR(vc,rad/kk)
-shellsph = geompy.SubShapeAll(sph, geompy.ShapeType["SHELL"])
-
-fs = []
-vec = geompy.MakeVectorDXDYDZ(0,0,1)
-ff = geompy.MakePlane(ps[3],vec,40)
-fs.append(ff)
-vp = geompy.MakeVertex(c3[0],c3[1],c3[2]+20)
-ff = geompy.MakePlane(vp,vec,40)
-fs.append(ff)
-vp = geompy.MakeVertex(c3[0],c3[1],c3[2]-20)
-ff = geompy.MakePlane(vp,vec,40)
-fs.append(ff)
-vec = geompy.MakeVectorDXDYDZ(1,0,0)
-ff = geompy.MakePlane(ps[3],vec,40)
-fs.append(ff)
-vp = geompy.MakeVertex(c3[0]+20,c3[1],c3[2])
-ff = geompy.MakePlane(vp,vec,40)
-fs.append(ff)
-vp = geompy.MakeVertex(c3[0]-20,c3[1],c3[2])
-ff = geompy.MakePlane(vp,vec,40)
-fs.append(ff)
-aPartition = geompy.MakePartition(shellsph,fs)
-fs = geompy.SubShapeAllSortedCentres(aPartition, geompy.ShapeType["FACE"])
-
-faces.append(fs[0])
-faces.append(fs[1])
-faces.append(fs[2])
-faces.append(fs[3])
-shell = geompy.MakeSewing(faces,1.e-6)
-shells.append(shell)
-faces = geompy.SubShapeAllSortedCentres(shell, geompy.ShapeType["FACE"])
-
-
-#===========================================================
-#                   Create Pipe
-#===========================================================
-subbases = []
-Pipe = geompy.MakePipeWithShellSections(shells, subbases, theLocations, WirePath,
-                                        theWithContact=0, theWithCorrection=0)
-
-# add objects in the study
-resc = geompy.MakeCompound(shells)
-id_sec = geompy.addToStudy(resc,"sections")
-id_wire = geompy.addToStudy(WirePath,"WirePath")
-id_pipe = geompy.addToStudy(Pipe, "Pipe")
-
-# display the wire(path), sections and the pipe
-gg.createAndDisplayGO(id_wire)
-gg.createAndDisplayGO(id_sec)
-gg.createAndDisplayGO(id_pipe)
-gg.setDisplayMode(id_pipe,1) 
-\endcode
-
+\include complex_objs_ex06.py
+<a href="../../examples/GEOM/complex_objs_ex06.py">Download this script</a>
 
 \anchor tui_creation_pipe_without_path
 <br><h2>Creation of a PipeShellsWithoutPath</h2>
-
-\code
-import geompy
-import math
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# Add a section based on quadrangles
-# ----------------------------------
-def section(s, p1, p2=None, p3=None, p4=None):
-    if p2==None:
-        q = p1
-    else:
-        q = geompy.MakeQuad4Vertices(p1, p2, p3, p4)
-        pass
-    s.append(q)
-    publish(q, "section")
-    return q
-
-
-# find distance between two points
-# -------------------------------
-def Dist(p1,p2):
-    c1 = geompy.PointCoordinates(p1)
-    c2 = geompy.PointCoordinates(p2)
-    return math.sqrt( (c2[0]-c1[0])*(c2[0]-c1[0]) +
-                      (c2[1]-c1[1])*(c2[1]-c1[1]) +
-                      (c2[2]-c1[2])*(c2[2]-c1[2]) )
-
-
-# return middle point
-# -------------------------------
-def MiddleVert(p1,p2):
-    c1 = geompy.PointCoordinates(p1)
-    c2 = geompy.PointCoordinates(p2)
-    return geompy.MakeVertex( (c2[0]+c1[0])/2, (c2[1]+c1[1])/2, (c2[2]+c1[2])/2 )
-
-
-# Complex section
-# result - 16 quads from lines
-# pnt - point from path
-# vec - direction from path
-def MakeComplexSect(pnt,vec,rmax,rmin,nb):
-    dang = 1.0/nb/2
-    cmax = geompy.MakeCircle(pnt,vec,rmax)
-    cmin = geompy.MakeCircle(pnt,vec,rmin)
-    faces = []
-    for i in range(0,2*nb,2):
-        p1 = geompy.MakeVertexOnCurve(cmin,dang*i)
-        p2 = geompy.MakeVertexOnCurve(cmax,dang*(i+1))
-        p3 = geompy.MakeVertexOnCurve(cmin,dang*(i+2))
-        f = geompy.MakeQuad4Vertices(pnt,p1,p2,p3)
-        faces.append(f)
-        pass
-    shell = geompy.MakeSewing(faces,1.e-6)
-    return shell
-
-
-#=======================================================
-#       Create simple path and recieve points
-#              for section creation
-#=======================================================
-WirePath = geompy.MakeSketcher("Sketcher:F 0 0:T 60 0:T 40 0:R 0:C 100 90:",
-                               [0, 0, 0, 0, 0, 1, 1, 0, 0])
-vs = geompy.SubShapeAll(WirePath, geompy.ShapeType["VERTEX"])
-
-#=======================================================
-#                 Create shell sections
-#=======================================================
-shells = []
-subbases = []
-locs = []
-
-# 1 section
-shell = MakeComplexSect(vs[0], geompy.MakeVectorDXDYDZ(1,0,0), 60, 40, 16)
-shells.append(shell)
-vs1 = geompy.SubShapeAllSortedCentres(shell,geompy.ShapeType["VERTEX"])
-locs.append(vs1[17])
-
-# 2 section
-shell = MakeComplexSect(vs[1], geompy.MakeVectorDXDYDZ(1,0,0), 80, 30, 16)
-shells.append(shell)
-vs2 = geompy.SubShapeAllSortedCentres(shell,geompy.ShapeType["VERTEX"])
-locs.append(vs2[17])
-
-# 3 section
-shell = MakeComplexSect(vs[2], geompy.MakeVectorDXDYDZ(1,0,0), 60, 40, 16)
-shells.append(shell)
-vs3 = geompy.SubShapeAllSortedCentres(shell,geompy.ShapeType["VERTEX"])
-locs.append(vs3[17])
-
-# 4 section
-shell = MakeComplexSect(vs[3], geompy.MakeVectorDXDYDZ(0,1,0), 40, 35, 16)
-shells.append(shell)
-vs4 = geompy.SubShapeAllSortedCentres(shell,geompy.ShapeType["VERTEX"])
-locs.append(vs4[17])
-
-
-#===========================================================
-#                   Create Pipe
-#===========================================================
-
-Pipe = geompy.MakePipeShellsWithoutPath(shells,locs)
-
-# add objects in the study
-resc = geompy.MakeCompound(shells)
-id_sec = geompy.addToStudy(resc,"sections")
-resl = geompy.MakeCompound(locs)
-id_loc = geompy.addToStudy(resl,"locations")
-id_pipe = geompy.addToStudy(Pipe, "Pipe")
-
-# display the sections, locations and pipe
-gg.createAndDisplayGO(id_sec)
-gg.createAndDisplayGO(id_loc)
-gg.createAndDisplayGO(id_pipe)
-gg.setDisplayMode(id_pipe,1) 
-\endcode
+\include complex_objs_ex07.py
+<a href="../../examples/GEOM/complex_objs_ex07.py">Download this script</a>
 
 \anchor tui_creation_pipe_binormal_along_vector
 <br><h2>Creation of a PipeBiNormalAlongVector</h2>
-
-\code
-def MakeHelix(radius, height, rotation, direction):
-    #  - create a helix -
-    radius = 1.0 * radius
-    height = 1.0 * height
-    rotation = 1.0 * rotation
-    if direction > 0:
-        direction = +1
-    else:
-        direction = -1
-        pass
-    from math import sqrt
-    length_z  = height
-    length_xy = radius*rotation
-    length = sqrt(length_z*length_z + length_xy*length_xy)
-    import geompy
-    nb_steps = 1
-    epsilon = 1.0e-6
-    while 1:
-        z_step = height / nb_steps
-        angle_step = rotation / nb_steps
-        z = 0.0
-        angle = 0.0
-        helix_points = []
-        for n in range(nb_steps+1):
-            from math import cos, sin
-            x = radius * cos(angle)
-            y = radius * sin(angle)
-            p = geompy.MakeVertex(x, y, z)
-            helix_points.append( p )
-            z += z_step
-            angle += direction * angle_step
-            pass
-        helix = geompy.MakeInterpol(helix_points)
-        length_test = geompy.BasicProperties(helix)[0]
-        prec = abs(length-length_test)/length
-        # print nb_steps, length_test, prec
-        if prec < epsilon:
-            break
-        nb_steps *= 2
-        pass
-    return helix
-
-def MakeSpring(radius, height, rotation, direction, thread_radius, base_rotation=0.0):
-    #  - create a pipe -
-    thread_radius = 1.0 * thread_radius
-    # create a helix
-    helix = MakeHelix(radius, height, rotation, direction)
-    # base in the (Ox, Oz) plane
-    import geompy
-    p0 = geompy.MakeVertex(radius-3*thread_radius, 0.0, -thread_radius)
-    p1 = geompy.MakeVertex(radius+3*thread_radius, 0.0, -thread_radius)
-    p2 = geompy.MakeVertex(radius+3*thread_radius, 0.0, +thread_radius)
-    p3 = geompy.MakeVertex(radius-3*thread_radius, 0.0, +thread_radius)
-    e0 = geompy.MakeEdge(p0, p1)
-    e1 = geompy.MakeEdge(p1, p2)
-    e2 = geompy.MakeEdge(p2, p3)
-    e3 = geompy.MakeEdge(p3, p0)
-    w = geompy.MakeWire([e0, e1, e2, e3])
-    # create a base face
-    base = geompy.MakeFace(w, True)
-    # create a binormal vector
-    binormal = geompy.MakeVectorDXDYDZ(0.0, 0.0, 10.0)
-    # create a pipe
-    spring = geompy.MakePipeBiNormalAlongVector(base, helix, binormal)
-    # Publish in the study
-    geompy.addToStudy(base, "base")
-    geompy.addToStudy(helix, "helix")
-    geompy.addToStudy(binormal, "binormal")
-    geompy.addToStudy(spring, "spring")
-    return spring
-
-from math import pi
-
-spring = MakeSpring(50, 100, 2*pi, 1, 5, pi/2)
-\endcode
-
+\include complex_objs_ex08.py
+<a href="../../examples/GEOM/complex_objs_ex08.py">Download this script</a>
 
 \anchor tui_creation_pipe_path
 <br><h2>Creation of a Middle Path</h2>
-
-\code
-import salome
-import geompy
-
-# Create a box
-Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
-
-# Get two opposite faces
-[Face_1,Face_2] = geompy.SubShapes(Box_1, [31, 33])
-
-# Get edges
-Box_1_edge_12 = geompy.GetSubShape(Box_1, [12])
-Box_1_edge_22 = geompy.GetSubShape(Box_1, [22])
-Box_1_edge_25 = geompy.GetSubShape(Box_1, [25])
-Box_1_edge_29 = geompy.GetSubShape(Box_1, [29])
-Box_1_edge_8 = geompy.GetSubShape(Box_1, [8])
-Box_1_edge_18 = geompy.GetSubShape(Box_1, [18])
-Box_1_edge_26 = geompy.GetSubShape(Box_1, [26])
-Box_1_edge_30 = geompy.GetSubShape(Box_1, [30])
-
-# These three calls to RestorePath return the same result
-Path_1 = geompy.RestorePath(Box_1, Face_1, Face_2)
-Path_2 = geompy.RestorePathEdges(Box_1, [Face_1], [Face_2])
-Path_3 = geompy.RestorePathEdges(Box_1,
-                                 [Box_1_edge_12, Box_1_edge_22, Box_1_edge_25, Box_1_edge_29],
-                                 [Box_1_edge_8, Box_1_edge_18, Box_1_edge_26, Box_1_edge_30])
-
-# Publish created objects
-geompy.addToStudy( Box_1, 'Box_1' )
-geompy.addToStudyInFather( Box_1, Face_1, 'Face_1' )
-geompy.addToStudyInFather( Box_1, Face_2, 'Face_2' )
-geompy.addToStudyInFather( Box_1, Box_1_edge_25, 'Box_1:edge_25' )
-geompy.addToStudyInFather( Box_1, Box_1_edge_22, 'Box_1:edge_22' )
-geompy.addToStudyInFather( Box_1, Box_1_edge_12, 'Box_1:edge_12' )
-geompy.addToStudyInFather( Box_1, Box_1_edge_29, 'Box_1:edge_29' )
-geompy.addToStudyInFather( Box_1, Box_1_edge_18, 'Box_1:edge_18' )
-geompy.addToStudyInFather( Box_1, Box_1_edge_26, 'Box_1:edge_26' )
-geompy.addToStudyInFather( Box_1, Box_1_edge_8, 'Box_1:edge_8' )
-geompy.addToStudyInFather( Box_1, Box_1_edge_30, 'Box_1:edge_30' )
-geompy.addToStudy( Path_1, 'Path_1' )
-geompy.addToStudy( Path_2, 'Path_2' )
-geompy.addToStudy( Path_3, 'Path_3' )
-\endcode
+\include complex_objs_ex09.py
+<a href="../../examples/GEOM/complex_objs_ex09.py">Download this script</a>
 
 <br><h2>Creation of Tangent Plane On Face</h2>
-\code
-import salome
-import geompy
-
-# Create Vertexes for curve
-Vertex_1 = geompy.MakeVertex(0, 0, 0)
-Vertex_2 = geompy.MakeVertex(0, 90, 30)
-Vertex_3 = geompy.MakeVertex(100, 90, 0)
-Vertex_4 = geompy.MakeVertex(-100, 90, 0)
-# Create curve
-Curve_1 = geompy.MakeInterpol([Vertex_4, Vertex_2, Vertex_3, Vertex_1])
-# Create Face by Extrusion of the Curve
-Extrusion_1 = geompy.MakePrismDXDYDZ(Curve_1, 0, 30, -60)
-# Make Tangent on this Extrusion (Face)
-Tangent_1 = geompy.MakeTangentPlaneOnFace(Extrusion_1, 0.7, 0.5, 150)
-# Publish in the study
-geompy.addToStudy( Vertex_1, "Vertex_1" )
-geompy.addToStudy( Vertex_2, "Vertex_2" )
-geompy.addToStudy( Vertex_3, "Vertex_3" )
-geompy.addToStudy( Vertex_4, "Vertex_4" )
-geompy.addToStudy( Curve_1, "Curve_1" )
-geompy.addToStudy( Extrusion_1, "Extrusion_1" )
-geompy.addToStudy( Tangent_1, "Tangent_1" )
-\endcode
+\include complex_objs_ex10.py
+<a href="../../examples/GEOM/complex_objs_ex10.py">Download this script</a>
 
 */
index b764df1b2499f6382de24f90842255eb6169599b..fb0420c6dd77d327eb217f07c7dbf216956d5a9c 100644 (file)
@@ -1,85 +1,7 @@
 /*!
 
 \page tui_free_boundaries_page Check Free Boundaries
-
-\code
-import os
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create boxes
-box1 = geompy.MakeBox(0,0,0,100,50,100)
-box2 = geompy.MakeBox(100,0,0,250,50,100)
-
-# make a compound
-compound = geompy.MakeCompound([box1, box2])
-
-# import from *.brep
-ImportFromBREP = geompy.ImportBREP(os.getenv("DATA_DIR")+"/Shapes/Brep/flight_solid.brep")
-
-# get a face
-faces = geompy.SubShapeAllSortedCentres(ImportFromBREP, geompy.ShapeType["FACE"])
-
-# get the free boundary for face 32
-Res = geompy.GetFreeBoundary(faces[32])
-isSuccess   = Res[0]
-ClosedWires = Res[1]
-OpenWires   = Res[2]
-
-if isSuccess == 1 :
-    print "Checking free boudaries is OK."
-else :
-    print "Checking free boudaries is KO!"
-print "len(ClosedWires) = ", len(ClosedWires)
-
-i = 0
-for wire in ClosedWires :
-    wire_name = "Face 32 -> Close wires : WIRE %d"%(i+1)
-    geompy.addToStudy(ClosedWires[i], wire_name)
-    if i < len(ClosedWires) :
-        i = i+ 1
-
-print "len(OpenWires) = ", len(OpenWires)
-
-i = 0
-for wire in OpenWires :
-    wire_name = "Face 32 -> Open wires : WIRE %d"%(i+1)
-    geompy.addToStudy(OpenWires[i], wire_name)
-    if i < len(OpenWires) :
-        i = i+ 1
-
-# get the free boundary for face 41
-Res = geompy.GetFreeBoundary(faces[41])
-isSuccess   = Res[0]
-ClosedWires = Res[1]
-OpenWires   = Res[2]
-
-if isSuccess == 1 :
-    print "Checking free boudaries is OK."
-else :
-    print "Checking free boudaries is KO!"
-print "len(ClosedWires) = ", len(ClosedWires)
-
-i = 0
-for wire in ClosedWires :
-    wire_name = "Face 41 -> Close wires : WIRE %d"%(i+1)
-    geompy.addToStudy(ClosedWires[i], wire_name)
-    if i < len(ClosedWires) :
-        i = i+ 1
-
-print "len(OpenWires) = ", len(OpenWires)
-
-i = 0
-for wire in OpenWires :
-    wire_name = "Face 41 -> Open wires : WIRE %d"%(i+1)
-    geompy.addToStudy(OpenWires[i], wire_name)
-    if i < len(OpenWires) :
-        i = i+ 1
-
-# add the imported object to the study
-id_ImportFromBREP = geompy.addToStudy(ImportFromBREP, "ImportFromBREP")
-salome.sg.updateObjBrowser(1)
-\endcode
+\include free_boundaries.py
+<a href="../../examples/GEOM/free_boundaries.py">Download this script</a>
 
 */
index 7fd302288c678f2f87a872fd0eca9a8b6177fa3c..00ae5bd238b0e553ed85611a9a9c13e0123d5b1b 100644 (file)
@@ -1,52 +1,7 @@
 /*!
 
 \page tui_free_faces_page Check Free Faces
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a vertex and a vector
-p1 = geompy.MakeVertex(35, 35, 0)
-p2 = geompy.MakeVertex(35, 35, 50)
-v = geompy.MakeVector(p1, p2)
-
-# create a cylinder
-cylinder = geompy.MakeCone(p1, v, 30, 20, 20)
-
-# create a cone
-cone = geompy.MakeCone(p1, v, 70, 40, 60)
-
-# make cut
-cut = geompy.MakeCut(cone, cylinder)
-
-# get faces as sub-shapes
-faces = []
-faces = geompy.SubShapeAllSortedCentres(cut, geompy.ShapeType["FACE"])
-f_2 = geompy.GetSubShapeID(cut, faces[0])
-
-# remove one face from the shape
-cut_without_f_2 = geompy.SuppressFaces(cut, [f_2])
-
-# suppress the specified wire
-result = geompy.GetFreeFacesIDs(cut_without_f_2)
-print "A number of free faces is ", len(result)
-
-# add objects in the study
-all_faces = geompy.SubShapeAllSortedCentres(cut_without_f_2, geompy.ShapeType["FACE"])
-for face in all_faces :
-    sub_shape_id = geompy.GetSubShapeID(cut_without_f_2, face)
-    if result.count(sub_shape_id) > 0 :
-        face_name = "Free face %d"%(sub_shape_id)
-        geompy.addToStudy(face, face_name)
-
-# in this example all faces from cut_without_f_2 are free
-id_cut_without_f_2 = geompy.addToStudy(cut_without_f_2, "Cut without f_2")
-
-# display the results
-gg.createAndDisplayGO(id_cut_without_f_2)
-gg.setDisplayMode(id_cut_without_f_2,1)
-\endcode
+\include free_faces.py
+<a href="../../examples/GEOM/free_faces.py">Download this script</a>
 
 */
index b83ea96474993b5cbc8466f0b9b3704443024a23..ca7a98d8fe72a06edb88ae69fd747e245a83b14e 100644 (file)
@@ -1,32 +1,7 @@
 /*!
 
 \page tui_get_non_blocks_page Get Non Blocks
-
-\code
-import geompy
-import salome
-
-# create solids
-box = geompy.MakeBoxDXDYDZ(100, 100, 100)
-cyl = geompy.MakeCylinderRH(100, 200)
-
-geompy.addToStudy(box, 'box')
-geompy.addToStudy(cyl, 'cyl')
-
-# make a compound
-compound = geompy.MakeCompound([box, cyl])
-geompy.addToStudy(compound, 'compound')
-
-# explore the compound
-pair = geompy.GetNonBlocks(compound)
-
-if pair[0] is not None:
-  geompy.addToStudyInFather(compound, pair[0], "GrNonBlocks")
-  pass
-
-if pair[1] is not None:
-  geompy.addToStudyInFather(compound, pair[1], "GrNonQuads")
-  pass
-\endcode
+\include get_non_blocks.py
+<a href="../../examples/GEOM/get_non_blocks.py">Download this script</a>
 
 */
index cdd8c4ea0bc4eb4280bc4c4eeeac923908d62b0e..52adf987e1c7f6f0754c852d7f581083535dd666 100644 (file)
@@ -1,45 +1,7 @@
 /*!
 
 \page tui_import_export_page Import/Export
-\code
-import geompy
-import salome
-
-# Example of import from IGES using various formats
-
-# get a path to SAMPLES_SRC
-import os
-thePath = os.getenv("DATA_DIR")
-# create filenames
-theFileName1 = thePath + "/Shapes/Iges/boite-3Dipsos_m.igs"
-theFileName2 = thePath + "/Shapes/Iges/boite-3Dipsos_mm.igs"
-#print "thePath = ", thePath
-
-# get units from files
-UnitName1 = geompy.GetIGESUnit(theFileName1)
-UnitName2 = geompy.GetIGESUnit(theFileName2)
-print "UnitName1 = ", UnitName1
-print "UnitName2 = ", UnitName2
-
-# import shapes
-Shape1 = geompy.ImportIGES(theFileName1)
-Shape2 = geompy.ImportIGES(theFileName2)
-Shape3 = geompy.ImportFile(theFileName2,"IGES_SCALE")
-[Xmin1,Xmax1, Ymin1,Ymax1, Zmin1,Zmax1] = geompy.BoundingBox(Shape1)
-[Xmin2,Xmax2, Ymin2,Ymax2, Zmin2,Zmax2] = geompy.BoundingBox(Shape2)
-[Xmin3,Xmax3, Ymin3,Ymax3, Zmin3,Zmax3] = geompy.BoundingBox(Shape3)
-geompy.addToStudy(Shape1, "3Dipsos_m")
-geompy.addToStudy(Shape2, "3Dipsos_mm")
-geompy.addToStudy(Shape3, "3Dipsos_mm_scaled")
-d1 = (Xmax1-Xmin1)*(Xmax1-Xmin1) + (Ymax1-Ymin1)*(Ymax1-Ymin1) + (Zmax1-Zmin1)*(Zmax1-Zmin1)
-d2 = (Xmax2-Xmin2)*(Xmax2-Xmin2) + (Ymax2-Ymin2)*(Ymax2-Ymin2) + (Zmax2-Zmin2)*(Zmax2-Zmin2)
-d3 = (Xmax3-Xmin3)*(Xmax3-Xmin3) + (Ymax3-Ymin3)*(Ymax3-Ymin3) + (Zmax3-Zmin3)*(Zmax3-Zmin3)
-import math
-dd32 = math.sqrt(d3/d2)
-dd12 = math.sqrt(d1/d2)
-dd31 = math.sqrt(d3/d1)
-# values dd31, dd12 and dd31 can be using for checking
-print "dd32 = ",dd32,"  dd12 = ",dd12,"  dd31 = ",dd31
-\endcode
+\include import_export.py
+<a href="../../examples/GEOM/import_export.py">Download this script</a>
 
 */
index 29530e2926082f9349301897d8c0681dae1e17d7..a62b20784fa0d1150a398e092c906535abaf38f4 100644 (file)
@@ -1,20 +1,7 @@
 /*!
 
 \page tui_inertia_page Inertia
-
-\code
-import geompy
-import math
-
-# create a box
-box = geompy.MakeBoxDXDYDZ(100,30,100)
-In = geompy.Inertia(box)
-print "\nInertia matrix of box 100x30x100:"
-print " (", In[0], ", ", In[1], ", ", In[2], ")"
-print " (", In[3], ", ", In[4], ", ", In[5], ")"
-print " (", In[6], ", ", In[7], ", ", In[8], ")"
-print "Main moments of inertia of box 100x30x100:"
-print " Ix = ", In[9], ", Iy = ", In[10], ", Iz = ", In[11]
-\endcode
+\include inertia.py
+<a href="../../examples/GEOM/inertia.py">Download this script</a>
 
 */
index 6afa6abd615a6ec06fc1ee68030e08c1e3aae45b..db024ca4b05509a3c5813fdcf1abc887ae235cc4 100644 (file)
@@ -1,55 +1,7 @@
 /*!
 
 \page tui_min_distance_page Minimal Distance
-
-\code
-import geompy
-
-# Create two curves with three closest points
-Vertex_1 = geompy.MakeVertex(0, 0, 0)
-Vertex_2 = geompy.MakeVertex(0, 70, 0)
-Vertex_3 = geompy.MakeVertex(30, 100, 0)
-Vertex_4 = geompy.MakeVertex(60, 70, 0)
-Vertex_5 = geompy.MakeVertex(90, 100, 0)
-Vertex_6 = geompy.MakeVertex(120, 70, 0)
-Vertex_7 = geompy.MakeVertex(120, 0, 0)
-Vertex_8 = geompy.MakeVertex(90, -30, 0)
-Vertex_9 = geompy.MakeVertex(60, 0, 0)
-Vertex_10 = geompy.MakeVertex(30, -30, 0)
-
-geompy.addToStudy( Vertex_1, 'Vertex_1' )
-geompy.addToStudy( Vertex_2, 'Vertex_2' )
-geompy.addToStudy( Vertex_3, 'Vertex_3' )
-geompy.addToStudy( Vertex_4, 'Vertex_4' )
-geompy.addToStudy( Vertex_5, 'Vertex_5' )
-geompy.addToStudy( Vertex_6, 'Vertex_6' )
-geompy.addToStudy( Vertex_7, 'Vertex_7' )
-geompy.addToStudy( Vertex_8, 'Vertex_8' )
-geompy.addToStudy( Vertex_9, 'Vertex_9' )
-geompy.addToStudy( Vertex_10, 'Vertex_10' )
-
-Curve_a = geompy.MakeInterpol([Vertex_2, Vertex_3, Vertex_4, Vertex_5, Vertex_6], False, True)
-Curve_b = geompy.MakeInterpol([Vertex_1, Vertex_7, Vertex_8, Vertex_9, Vertex_10], False, True)
-
-geompy.addToStudy( Curve_a, 'Curve_a' )
-geompy.addToStudy( Curve_b, 'Curve_b' )
-
-# Get all closest points
-[nbSols, listCoords] = geompy.ClosestPoints(Curve_a, Curve_b)
-
-for i in range(nbSols):
-  v1 = geompy.MakeVertex(listCoords[i*6 + 0], listCoords[i*6 + 1], listCoords[i*6 + 2])
-  v2 = geompy.MakeVertex(listCoords[i*6 + 3], listCoords[i*6 + 4], listCoords[i*6 + 5])
-
-  geompy.addToStudy(v1, 'MinDist_%d_Curve_a'%(i+1))
-  geompy.addToStudy(v2, 'MinDist_%d_Curve_b'%(i+1))
-
-# Get minimum distance
-print "Minimal distance between Curve_a and Curve_b is", geompy.MinDistance(Curve_a, Curve_b)
-
-# Get minimum distance with components along axes
-[aDist, DX, DY, DZ] = geompy.MinDistanceComponents(Curve_a, Curve_b)
-print "Minimal distance between Curve_a and Curve_b is (", DX, ",", DY, ",", DZ, ")"
-\endcode
+\include min_distance.py
+<a href="../../examples/GEOM/min_distance.py">Download this script</a>
 
 */
index 0c81116a8f4348ee14565b2681907175151bac55..7d31fcc265dbc627c93400f7984dd1199a770fce 100644 (file)
@@ -1,23 +1,7 @@
 /*!
 
 \page tui_normal_face_page Normal to a Face
-
-\code
-import geompy
-import math
-
-# create a box
-box = geompy.MakeBoxDXDYDZ(100,30,100)
-
-faces = geompy.SubShapeAllSortedCentres(box, geompy.ShapeType["FACE"])
-face0 = faces[0]
-vnorm = geompy.GetNormal(face0)
-if vnorm is None:
-  raise RuntimeError, "GetNormal(face0) failed"
-else:
-  geompy.addToStudy(face0, "Face0")
-  geompy.addToStudy(vnorm, "Normale to Face0")
-  print "\nNormale of face has been successfully obtained"
-\endcode
+\include normal_face.py
+<a href="../../examples/GEOM/normal_face.py">Download this script</a>
 
 */
index 629ce632970b08244222113a567dc97d05440ea2..8db9c59d2ee382a78815b00cf3c4e4ed940057de 100644 (file)
@@ -3,27 +3,7 @@
 \page tui_notebook_geom_page Using SALOME NoteBook
 
 \anchor tui_notebook_geom
-
-\code
-import geompy
-import salome
-import salome_notebook
-gg = salome.ImportComponentGUI("GEOM")
-
-# set variables
-notebook = salome_notebook.notebook
-notebook.set("Length", 150)
-notebook.set("Width", 100)
-
-# create box
-box = geompy.MakeBoxDXDYDZ("Length", "Width", 200)
-
-# add object in the study
-id_box = geompy.addToStudy(box,"Box")
-
-# display the boxes
-gg.createAndDisplayGO(id_box)
-gg.setDisplayMode(id_box,1)
-\endcode
+\include notebook_geom.py
+<a href="../../examples/GEOM/notebook_geom.py">Download this script</a>
 
 */
index 0f138367b4089b2f9f524e68a2025f2afc9ac7e6..6fbb9c9a60d946504a3f599c64441b80017f09fa 100644 (file)
@@ -1,27 +1,7 @@
 /*!
 
 \page tui_point_coordinates_page Point Coordinates
+\include point_coordinates.py
+<a href="../../examples/GEOM/point_coordinates.py">Download this script</a>
 
-\code
-import math
-import geompy
-
-# create a point
-point = geompy.MakeVertex(15., 23., 80.)
-
-# get the coordinates of the point and check its values
-coords = geompy.PointCoordinates(point)
-
-# check the obtained coordinate values
-tolerance = 1.e-07
-def IsEqual(val1, val2): return (math.fabs(val1 - val2) < tolerance)
-
-if IsEqual(coords[0], 15.) and IsEqual(coords[1], 23.) and IsEqual(coords[2], 80.):
-    print "All values are OK."
-else :
-    print "Coordinates of point must be (15, 23, 80), but returned (",
-    print coords[0], ", ", coords[1], ", ", coords[2], ")"
-    pass
-\endcode
-
-*/
\ No newline at end of file
+*/
index af7670ea8130ada03dc622756f26d29a8913fa87..9c4f49d558865c960a25f260b4854fe8bb67e651 100644 (file)
 
 \anchor tui_creation_box
 <br><h2>Creation of a Box</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create vertices
-p0 = geompy.MakeVertex(15, 25, 35)
-p70 = geompy.MakeVertex(70, 70, 70)
-
-# create boxes
-box1 = geompy.MakeBoxDXDYDZ(10, 20, 30)
-box2 = geompy.MakeBox(10,20,30, 15,25,35)
-box3 = geompy.MakeBoxTwoPnt(p0, p70)
-
-# add objects in the study
-id_box1 = geompy.addToStudy(box1,"Box1")
-id_box2 = geompy.addToStudy(box2,"Box2")
-id_box3 = geompy.addToStudy(box3,"Box3")
-
-# display the boxes
-gg.createAndDisplayGO(id_box1)
-gg.setDisplayMode(id_box1,1)
-gg.createAndDisplayGO(id_box2)
-gg.setDisplayMode(id_box2,1)
-gg.createAndDisplayGO(id_box3)
-gg.setDisplayMode(id_box3,1)
-\endcode
+\include primitives_ex01.py
+<a href="../../examples/GEOM/primitives_ex01.py">Download this script</a>
 
 \anchor tui_creation_cylinder
 <br><h2>Creation of a Cylinder</h2>
-
-\code
-import geompy
-import salome
-
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a vertex and a vector
-p1 = geompy.MakeVertex(25, 35, 45)
-p2 = geompy.MakeVertex(70, 70, 70)
-v = geompy.MakeVector(p1, p2)
-
-# create cylinders
-height = 40
-
-radius1 = 15
-cylinder1 = geompy.MakeCylinder(p1, v, radius1, height)
-
-radius2 = 30
-cylinder2 = geompy.MakeCylinderRH(radius2, height)
-
-# add objects in the study
-id_cylinder1 = geompy.addToStudy(cylinder1,"Cylinder1")
-id_cylinder2 = geompy.addToStudy(cylinder2,"Cylinder2")
-
-# display the cylinders
-gg.createAndDisplayGO(id_cylinder1)
-gg.setDisplayMode(id_cylinder1,1)
-gg.createAndDisplayGO(id_cylinder2)
-gg.setDisplayMode(id_cylinder2,1)
-\endcode
+\include primitives_ex02.py
+<a href="../../examples/GEOM/primitives_ex02.py">Download this script</a>
 
 \anchor tui_creation_sphere
 <br><h2>Creation of a Sphere</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a vertex
-p = geompy.MakeVertex(55, 45, 25)
-
-# create spheres
-radius1 = 20
-sphere1 = geompy.MakeSpherePntR(p, radius1)
-radius2 = 15
-sphere2 = geompy.MakeSphere(0, 0, 45, radius2)
-radius3 = 30
-sphere3 = geompy.MakeSphereR(radius3)
-
-# add objects in the study
-id_sphere1 = geompy.addToStudy(sphere1,"Sphere1")
-id_sphere2 = geompy.addToStudy(sphere2,"Sphere2")
-id_sphere3 = geompy.addToStudy(sphere3,"Sphere3")
-
-# display spheres
-gg.createAndDisplayGO(id_sphere1)
-gg.setDisplayMode(id_sphere1,1)
-gg.createAndDisplayGO(id_sphere2)
-gg.setDisplayMode(id_sphere2,1)
-gg.createAndDisplayGO(id_sphere3)
-gg.setDisplayMode(id_sphere3,1)
-\endcode
+\include primitives_ex03.py
+<a href="../../examples/GEOM/primitives_ex03.py">Download this script</a>
 
 \anchor tui_creation_torus
 <br><h2>Creation of a Torus</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a vertex and a vector
-p1 = geompy.MakeVertex(35, 40, 45)
-p2 = geompy.MakeVertex(35, 45, 70)
-v = geompy.MakeVector(p1, p2)
-
-# create toruses
-torus1 = geompy.MakeTorus(p1, v, 20, 10)
-torus2 = geompy.MakeTorusRR(30, 15)
-
-# add objects in the study
-id_torus1 = geompy.addToStudy(torus1,"Torus1")
-id_torus2 = geompy.addToStudy(torus2,"Torus2")
-
-# display toruses
-gg.createAndDisplayGO(id_torus1)
-gg.setDisplayMode(id_torus1,1)
-gg.createAndDisplayGO(id_torus2)
-gg.setDisplayMode(id_torus2,1)
-\endcode
+\include primitives_ex04.py
+<a href="../../examples/GEOM/primitives_ex04.py">Download this script</a>
 
 \anchor tui_creation_cone
 <br><h2>Creation of a Cone</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a vertex and a vector
-p1 = geompy.MakeVertex(35, 35, 0)
-p2 = geompy.MakeVertex(35, 35, 70)
-v = geompy.MakeVector(p1, p2)
-
-# create cones
-cone1 = geompy.MakeCone(p1, v, 17, 1, 20)
-cone2 = geompy.MakeConeR1R2H(30, 10, 30)
-
-# add objects in the study
-id_cone1 = geompy.addToStudy(cone1,"Cone1")
-id_cone2 = geompy.addToStudy(cone2,"Cone2")
-
-# display cones
-gg.createAndDisplayGO(id_cone1)
-gg.setDisplayMode(id_cone1,1)
-gg.createAndDisplayGO(id_cone2)
-gg.setDisplayMode(id_cone2,1)
-\endcode
+\include primitives_ex05.py
+<a href="../../examples/GEOM/primitives_ex05.py">Download this script</a>
 
 \anchor tui_creation_disk
 <br><h2>Creation of a Disk</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create vertices
-p0 = geompy.MakeVertex(0., 0., 0.)
-px = geompy.MakeVertex(100., 0.  , 0.  )
-py = geompy.MakeVertex(0.  , 100., 0.  )
-pz = geompy.MakeVertex(0.  , 0.  , 100.)
-
-# create a vector on two points
-vxy  = geompy.MakeVector(px, py)
-
-# create a disk in OXY plane
-disk1 = geompy.MakeDiskR(100, 1)
-
-# create a disk from a point, a vector and a radius
-disk2 = geompy.MakeDiskPntVecR(pz, vxy, 30)
-
-#create a circle from three points
-disk3 = geompy.MakeDiskThreePnt(p0, px, py)
-
-# add objects in the study
-id_vxy    = geompy.addToStudy(vxy,  "Vector")
-id_disk1  = geompy.addToStudy(disk1,"Disk1")
-id_disk2  = geompy.addToStudy(disk2,"Disk2")
-id_disk3  = geompy.addToStudy(disk3,"Disk3")
-
-# display disks
-gg.createAndDisplayGO(id_vxy)
-gg.createAndDisplayGO(id_disk1)
-gg.createAndDisplayGO(id_diks2)
-gg.createAndDisplayGO(id_diks3)
-\endcode
+\include primitives_ex06.py
+<a href="../../examples/GEOM/primitives_ex06.py">Download this script</a>
 
 \anchor tui_creation_squareface
 <br><h2>Creation of a Rectangle</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create vertices
-px = geompy.MakeVertex(100., 0.  , 0.  )
-py = geompy.MakeVertex(0.  , 100., 0.  )
-
-# create a vector on two points
-vxy  = geompy.MakeVector(px, py)
-
-# create a rectangle in OXY plane
-face1 = geompy.MakeFaceHW(100, 100, 1)
-
-# create a rectangle using normal vector
-face2 = geompy.MakeFaceObjHW(vxy, 50, 150)
-
-# create a rectangle from other face
-face3 = geompy.MakeFaceObjHW(face2, 150, 50)
-
-# add objects in the study
-id_face1  = geompy.addToStudy(face1,"Face1")
-id_face2  = geompy.addToStudy(face2,"Face2")
-id_face3  = geompy.addToStudy(face3,"Face3")
-
-# display rectangles
-gg.createAndDisplayGO(id_face1)
-gg.createAndDisplayGO(id_face2)
-gg.createAndDisplayGO(id_face3)
-\endcode
+\include primitives_ex07.py
+<a href="../../examples/GEOM/primitives_ex07.py">Download this script</a>
 
 */
index 0ce8b63dbd0d7b8df3eeb442b02b1cced53ab855..28673197079498e75bf155d4ada82eee7001ea11 100644 (file)
 
 \anchor tui_shape_processing
 <br><h2>Shape Processing</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create vertices, an edge, an arc, a wire, a face and a prism
-p1 = geompy.MakeVertex(0,0,0)
-p2 = geompy.MakeVertex(200,0,0)
-p3 = geompy.MakeVertex(100,150,0)
-edge = geompy.MakeEdge(p1,p2)
-arc  = geompy.MakeArc(p1,p3,p2)
-wire = geompy.MakeWire([edge,arc])
-face = geompy.MakeFace(wire, 1)
-theShape = geompy.MakePrismVecH(face, edge, 130)
-
-# check the shape at the beginning
-print "Before ProcessShape:"
-isValid = geompy.CheckShape(theShape)
-if isValid == 0:
-    print "The shape is not valid"
-else:
-    print "The shape seems to be valid"
-
-# process the Shape
-Operators = ["FixShape"]
-Parameters = ["FixShape.Tolerance3d"]
-Values = ["1e-7"]
-PS = geompy.ProcessShape(theShape, Operators, Parameters, Values)
-
-# check the shape at the end
-print "After ProcessShape:"
-isValid = geompy.CheckShape(PS)
-if isValid == 0:
-    print "The shape is not valid"
-    raise RuntimeError, "It seems, that the ProcessShape() has failed"
-else:
-    print "The shape seems to be valid"
-
-# add in the study and display
-Id_Shape = geompy.addToStudy(theShape, "Invalid Shape")
-Id_PS    = geompy.addToStudy(PS, "Processed Shape")
-gg.createAndDisplayGO(Id_Shape)
-gg.setDisplayMode(Id_Shape,1)
-gg.createAndDisplayGO(Id_PS)
-gg.setDisplayMode(Id_PS,1) 
-\endcode
+\include repairing_operations_ex01.py
+<a href="../../examples/GEOM/repairing_operations_ex01.py">Download this script</a>
 
 \anchor tui_suppress_faces
 <br><h2>Suppress Faces</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a box
-box = geompy.MakeBoxDXDYDZ(200, 200, 200)
-
-# The list of IDs (IDList) for suppress faces
-sup_faces = []
-sup_faces = geompy.SubShapeAllSortedCentres(box, geompy.ShapeType["FACE"])
-
-# get indices of the sub-shape
-f1_id = geompy.GetSubShapeID(box, sup_faces[3])
-
-# remove faces from the given object (shape)
-result = geompy.SuppressFaces(box, [f1_id])
-
-# add objects in the study
-id_box = geompy.addToStudy(box, "Box")
-id_result = geompy.addToStudy(result, "Result")
-
-# display the results
-gg.createAndDisplayGO(id_box)
-gg.setDisplayMode(id_box,1)
-gg.createAndDisplayGO(id_result)
-gg.setDisplayMode(id_result,1)
-\endcode
+\include repairing_operations_ex02.py
+<a href="../../examples/GEOM/repairing_operations_ex02.py">Download this script</a>
 
 \anchor tui_close_contour
 <br><h2>Close Contour</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create vertices and vectors
-p0  = geompy.MakeVertex(  0.,   0.,   0.)
-px  = geompy.MakeVertex(100.,   0.,   0.)
-py  = geompy.MakeVertex(  0., 100.,   0.)
-py1 = geompy.MakeVertex(  0., 140.,   0.)
-pz  = geompy.MakeVertex(  0.,   0., 100.)
-vxy = geompy.MakeVector(px, py)
-
-# create an arc
-arc = geompy.MakeArc(py1, pz, px)
-
-# create a wire
-wire = geompy.MakeWire([vxy, arc])
-
-# close an open wire by creation of an edge between ends
-wire_close = geompy.CloseContour(wire, [1], 0)
-
-# add objects in the study
-id_wire = geompy.addToStudy(wire, "Wire")
-id_wire_close = geompy.addToStudy(wire_close, "Wire close")
-
-# display the results
-gg.createAndDisplayGO(id_wire)
-gg.createAndDisplayGO(id_wire_close) 
-\endcode
+\include repairing_operations_ex03.py
+<a href="../../examples/GEOM/repairing_operations_ex03.py">Download this script</a>
 
 \anchor tui_suppress_internal_wires 
 <br><h2>Suppress Internal Wires</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a vertex and a vector
-p1 = geompy.MakeVertex(55, 65, 50)
-p2 = geompy.MakeVertex(55,  0, 50)
-v = geompy.MakeVector(p1, p2)
-
-# create a cylinder
-height = 100
-radius1 = 40
-cylinder = geompy.MakeCylinder(p1, v, radius1, height)
-
-# create a box
-box = geompy.MakeBoxDXDYDZ(100, 100, 100)
-
-# make a cut
-cut = geompy.MakeCut(box, cylinder)
-
-# suppress all internal wires
-result = geompy.SuppressInternalWires(cut, [])
-
-# add objects in the study
-id_cut = geompy.addToStudy(cut, "Cut")
-id_result = geompy.addToStudy(result, "Result")
-
-# display the results
-gg.createAndDisplayGO(id_cut)
-gg.setDisplayMode(id_cut,1)
-gg.createAndDisplayGO(id_result)
-gg.setDisplayMode(id_result,1) 
-\endcode
+\include repairing_operations_ex04.py
+<a href="../../examples/GEOM/repairing_operations_ex04.py">Download this script</a>
 
 \anchor tui_suppress_holes
 <br><h2>Suppress Holes</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a vertex and a vector
-p1 = geompy.MakeVertex(35, 35, 0)
-p2 = geompy.MakeVertex(35, 35, 50)
-v = geompy.MakeVector(p1, p2)
-
-# create a cylinder
-height = 20
-radius1 = 20
-cylinder = geompy.MakeCylinder(p1, v, radius1, height)
-
-# create a cone
-cone = geompy.MakeCone(p1, v, 70, 0, 80)
-
-# make a cut
-cut = geompy.MakeCut(cone, cylinder)
-
-# get faces as sub-shapes
-faces = []
-faces = geompy.SubShapeAllSortedCentres(cut, geompy.ShapeType["FACE"])
-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])
-
-# suppress the selected wire
-result = geompy.SuppressHoles(cut_without_f_2, [w_0])
-
-# add objects in the study
-id_cut = geompy.addToStudy(cut, "Cut")
-id_cut_without_f_2 = geompy.addToStudy(cut_without_f_2, "Cut without f_2")
-id_result = geompy.addToStudy(result, "Result")
-
-# display the results
-gg.createAndDisplayGO(id_cut)
-gg.setDisplayMode(id_cut,1)
-gg.createAndDisplayGO(id_cut_without_f_2)
-gg.setDisplayMode(id_cut_without_f_2,1)
-gg.createAndDisplayGO(id_result)
-gg.setDisplayMode(id_result,1) 
-\endcode
+\include repairing_operations_ex05.py
+<a href="../../examples/GEOM/repairing_operations_ex05.py">Download this script</a>
 
 \anchor tui_sewing
 <br><h2>Sewing</h2>
-
-\code
-import geompy
-import salome
-import math
-gg = salome.ImportComponentGUI("GEOM")
-
-# create base points
-px = geompy.MakeVertex(100., 0., 0.)
-py = geompy.MakeVertex(0., 100., 0.)
-pz = geompy.MakeVertex(0., 0., 100.)
-
-# create base geometry 2D & 3D
-vector = geompy.MakeVector(px, py)
-arc = geompy.MakeArc(py, pz, px)
-
-# create base objects
-angle = 45. * math.pi / 180
-WantPlanarFace = 1 #True
-wire = geompy.MakeWire([vector, arc])
-face = geompy.MakeFace(wire, WantPlanarFace)
-face_rot = geompy.MakeRotation(face, vector, angle)
-
-# make sewing
-precision = 0.00001
-sewing = geompy.MakeSewing([face, face_rot], precision)
-
-# add objects in the study
-id_face = geompy.addToStudy(face, "Face")
-id_face_rot = geompy.addToStudy(face_rot, "Face rotation")
-id_sewing = geompy.addToStudy(sewing, "Sewing")
-
-# display the results
-gg.createAndDisplayGO(id_face)
-gg.setDisplayMode(id_face,1)
-gg.createAndDisplayGO(id_face_rot)
-gg.setDisplayMode(id_face_rot,1)
-gg.createAndDisplayGO(id_sewing)
-gg.setDisplayMode(id_sewing,1) 
-\endcode
+\include repairing_operations_ex06.py
+<a href="../../examples/GEOM/repairing_operations_ex06.py">Download this script</a>
 
 \anchor tui_glue_faces
 <br><h2>Glue Faces</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create boxes
-box1 = geompy.MakeBox(0,0,0,100,50,100)
-box2 = geompy.MakeBox(100,0,0,250,50,100)
-
-# make compound
-compound = geompy.MakeCompound([box1, box2])
-
-# glue compound's faces
-tolerance = 1e-5
-glue = geompy.MakeGlueFaces(compound, tolerance)
-
-# add objects in study
-id_box1 = geompy.addToStudy(box1, "Box1")
-id_box2 = geompy.addToStudy(box2, "Box2")
-id_compound = geompy.addToStudy(compound, "Compound")
-id_glue = geompy.addToStudy(glue, "Glue faces")
-
-# display results
-gg.createAndDisplayGO(id_box1)
-gg.setDisplayMode(id_box1,1)
-gg.createAndDisplayGO(id_box2)
-gg.setDisplayMode(id_box2,1)
-gg.createAndDisplayGO(id_compound)
-gg.setDisplayMode(id_compound,1)
-gg.createAndDisplayGO(id_glue)
-gg.setDisplayMode(id_glue,1) 
-\endcode
+\include repairing_operations_ex07.py
+<a href="../../examples/GEOM/repairing_operations_ex07.py">Download this script</a>
 
 \anchor tui_glue_edges
 <br><h2>Glue Edges</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create boxes
-box1 = geompy.MakeBox(0,0,0,100,50,100)
-box2 = geompy.MakeBox(100,0,0,250,50,100)
-
-# make compound
-compound = geompy.MakeCompound([box1, box2])
-
-# glue all compound's edges
-tolerance = 1e-5
-glue1 = geompy.MakeGlueEdges(compound, tolerance)
-
-# glue some compound's edges
-list_edges = geompy.GetGlueEdges(compound, tolerance)
-glue2 = geompy.MakeGlueEdgesByList(compound, tolerance, [list_edges[0], list_edges[2]])
-
-# add objects in study
-geompy.addToStudy(box1, "Box1")
-geompy.addToStudy(box2, "Box2")
-geompy.addToStudy(compound, "Compound")
-geompy.addToStudy(glue1, "Glue all edges")
-geompy.addToStudy(glue2, "Glue two edges")
-
-if salome.sg.hasDesktop():
-  salome.sg.updateObjBrowser(1)
-\endcode
+\include repairing_operations_ex08.py
+<a href="../../examples/GEOM/repairing_operations_ex08.py">Download this script</a>
 
 \anchor tui_limit_tolerance
 <br><h2>Limit Tolerance</h2>
-
-\code
-import geompy
-gg = salome.ImportComponentGUI("GEOM")
-
-# import initial topology
-shape1 = geompy.ImportBREP("my_shape_1.brep")
-shape2 = geompy.ImportBREP("my_shape_2.brep")
-
-geompy.addToStudy(shape1, "Shape 1")
-geompy.addToStudy(shape2, "Shape 2")
-
-# perform partition
-try:
-    part = geompy.MakePartition([shape1, shape2])
-except:
-    # limit tolerance
-    tolerance = 1e-07
-    shape1_lt = geompy.LimitTolerance(shape1, tolerance)
-    shape2_lt = geompy.LimitTolerance(shape2, tolerance)
-
-    # process shape
-    good_shape1 = geompy.ProcessShape(shape1_lt, ["FixShape"], ["FixShape.Tolerance3d"], ["1e-7"])
-    good_shape2 = geompy.ProcessShape(shape2_lt, ["FixShape"], ["FixShape.Tolerance3d"], ["1e-7"])
-
-    geompy.addToStudy(good_shape1, "Shape 1 corrected")
-    geompy.addToStudy(good_shape2, "Shape 2 corrected")
-
-    # perform partition on corrected shapes
-    part = geompy.MakePartition([good_shape1, good_shape2])
-    pass
-
-geompy.addToStudy(part, "Partition")
-\endcode
+\include repairing_operations_ex09.py
+<a href="../../examples/GEOM/repairing_operations_ex09.py">Download this script</a>
 
 \anchor tui_add_point_on_edge
 <br><h2>Add Point on Edge</h2>
-
-\code
-import geompy
-import salome
-
-# create vertices
-p1 = geompy.MakeVertex(0,0,50)
-p2 = geompy.MakeVertex(60,0,50)
-
-# make an edge
-edge = geompy.MakeEdge(p1, p2) #geompy.GetSubShape(box, edge_ind)
-
-# divide an edge
-divide = geompy.DivideEdge(edge, -1, 0.5, 0)
-
-# add objects in the study
-id_edge = geompy.addToStudy(edge, "Edge")
-edge_points = geompy.SubShapeAllSortedCentres(edge, geompy.ShapeType["VERTEX"])
-for point in edge_points:
-    geompy.addToStudyInFather(edge, point, "Edge's point")
-
-id_divide = geompy.addToStudy(divide, "Divided edge")
-edge_points = geompy.SubShapeAllSortedCentres(divide, geompy.ShapeType["VERTEX"])
-for point in edge_points:
-    geompy.addToStudyInFather(divide, point, "Edge's point after divide")
-
-salome.sg.updateObjBrowser(1) 
-\endcode
+\include repairing_operations_ex10.py
+<a href="../../examples/GEOM/repairing_operations_ex10.py">Download this script</a>
 
 \anchor tui_fuse_collinear_edges
 <br><h2>Fuse Collinear Edges within a Wire</h2>
-
-\code
-import geompy
-import salome
-
-# create vertices
-p1 = geompy.MakeVertex(0, 0, 0)
-p2 = geompy.MakeVertex(70, 0, 0)
-p3 = geompy.MakeVertex(70, 50, 0)
-p4 = geompy.MakeVertex(70, 80, 0)
-p5 = geompy.MakeVertex(50, 80, 0)
-p6 = geompy.MakeVertex(20, 80, 0)
-p7 = geompy.MakeVertex(0, 80, 0)
-p8 = geompy.MakeVertex(0, 30, 0)
-
-points = [p1, p2, p3, p4, p5, p6, p7, p8]
-
-# make a wire
-wire_1 = geompy.MakePolyline(points, True)
-
-# suppress some vertices in the wire
-wire_2 = geompy.FuseCollinearEdgesWithinWire(wire_1, [p3])
-wire_3 = geompy.FuseCollinearEdgesWithinWire(wire_1, [p5, p6])
-
-# suppress all suitable vertices in the wire
-wire_4 = geompy.FuseCollinearEdgesWithinWire(wire_1, [])
-
-wires = [wire_1, wire_2, wire_3, wire_4]
-
-# add objects in the study
-ii = 1
-for point in points:
-    geompy.addToStudy(point, "p%d"%ii)
-    ii = ii + 1
-    pass
-
-ii = 1
-for wire in wires:
-    geompy.addToStudy(wire, "wire_%d"%ii)
-    wire_points = geompy.SubShapeAllSortedCentres(wire, geompy.ShapeType["VERTEX"])
-    jj = 1
-    for point in wire_points:
-        geompy.addToStudyInFather(wire, point, "point_%d"%jj)
-        jj = jj + 1
-        pass
-    ii = ii + 1
-    pass
-
-salome.sg.updateObjBrowser(1) 
-\endcode
+\include repairing_operations_ex11.py
+<a href="../../examples/GEOM/repairing_operations_ex11.py">Download this script</a>
 
 */
index e344eae2772e741d791cb0b736574fc68b22adb0..be24fd763abb3ce27da1de6822a0d0b95057e6f9 100644 (file)
@@ -1,48 +1,7 @@
 /*!
 
 \page tui_sketcher_page 2D Sketcher
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create vertices
-p1 = geompy.MakeVertex(70.,  0.,  0.)
-p2 = geompy.MakeVertex(70., 70., 80.)
-p3 = geompy.MakeVertex( 0., 70.,  0.)
-
-#create a vector from two points
-vector_arc = geompy.MakeVector(p1, p3)
-
-# create an arc from three points
-arc = geompy.MakeArc(p1, p2, p3)
-
-# create a wire
-wire = geompy.MakeWire([vector_arc, arc])
-
-# create a planar face
-isPlanarWanted = 1
-face = geompy.MakeFace(wire, isPlanarWanted)
-
-# create a sketcher (face), following the textual description
-sketcher1 = geompy.MakeSketcher("Sketcher:F -100 -100:TT 250 -100:R 0:C 100 150:R 0:L 300:WF",
-                                [100,0,0, 1,1,1, -1,1,0])
-
-# create a sketcher (wire) on the given face
-sketcher2 = geompy.MakeSketcherOnPlane("Sketcher:F 10 -30:R 10:C 20 180:R 15:L 50:WW", face)
-
-# add objects in the study
-id_face = geompy.addToStudy(face,"Face")
-id_sketcher1 = geompy.addToStudy(sketcher1,"Sketcher1")
-id_sketcher2 = geompy.addToStudy(sketcher2,"Sketcher2")
-
-# display the first sketcher and the second sketcher with its planar face
-gg.createAndDisplayGO(id_face)
-gg.setDisplayMode(id_face,1)
-gg.setTransparency(id_face,0.5)
-gg.createAndDisplayGO(id_sketcher1)
-gg.createAndDisplayGO(id_sketcher2) 
-\endcode
+\include sketcher.py
+<a href="../../examples/GEOM/sketcher.py">Download this script</a>
 
 */
index 55151302ac952d8b2c41628d95be58383d91b0c6..4da20b24936fde1dea77fb010490952d5feee5f3 100644 (file)
@@ -1,20 +1,7 @@
 /*!
 
 \page tui_tolerance_page Tolerance
-
-\code
-import geompy
-
-# create a box
-box = geompy.MakeBoxDXDYDZ(100,30,100)
-Toler = geompy.Tolerance(box)
-print "\nBox 100x30x100 tolerance:"
-print " Face min. tolerance: ", Toler[0]
-print " Face max. tolerance: ", Toler[1]
-print " Edge min. tolerance: ", Toler[2]
-print " Edge max. tolerance: ", Toler[3]
-print " Vertex min. tolerance: ", Toler[4]
-print " Vertex max. tolerance: ", Toler[5]
-\endcode
+\include tolerance.py
+<a href="../../examples/GEOM/tolerance.py">Download this script</a>
 
 */
index e314abc85495e505775cd9e1c094a0fa92d86521..2b9f5d1c2f64d33dbda4de33affbf227a64e3d19 100644 (file)
 
 \anchor tui_creation_edge
 <br><h2>Creation of an Edge</h2>
+\include topological_geom_objs_ex01.py
+<a href="../../examples/GEOM/topological_geom_objs_ex01.py">Download this script</a>
 
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-#
-# create edge by two points
-#
-
-# create vertices
-p0   = geompy.MakeVertex(0.  , 0.  , 0.  )
-pxyz = geompy.MakeVertex(100., 100., 100.)
-
-# create an edge
-edge = geompy.MakeEdge(p0, pxyz)
-
-# add object in the study
-id_edge = geompy.addToStudy(edge,"Edge_1")
-
-# display an edge
-gg.createAndDisplayGO(id_edge) 
-
-#
-# create edge from wire
-#
-
-# create a circle
-c = geompy.MakeCircle(None, None, 100)
-
-# create a wire
-w = geompy.MakeWire([c], 1e-07)
-
-# create an edge from wire
-edge = geompy.MakeEdgeWire(w)
-
-# add object in the study
-id_edge = geompy.addToStudy(edge,"Edge_2")
-
-# display an edge
-gg.createAndDisplayGO(id_edge) 
-
-#
-# create edge from existing curve and a length
-#
-
-# create a circle
-c = geompy.MakeCircle(None, None, 100)
-
-# create an edge of length 25.0 from the circle
-edge = geompy.MakeEdgeOnCurveByLength(c, 25.0)
-
-# add object in the study
-id_edge = geompy.addToStudy(edge,"Edge_3")
-
-# display an edge
-gg.createAndDisplayGO(id_edge) 
-
-\endcode
 \anchor tui_creation_wire
 <br><h2>Creation of a Wire</h2>
+\include topological_geom_objs_ex02.py
+<a href="../../examples/GEOM/topological_geom_objs_ex02.py">Download this script</a>
 
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create vertices
-px   = geompy.MakeVertex(100., 0.  , 0.  )
-py   = geompy.MakeVertex(0.  , 100., 0.  )
-pz   = geompy.MakeVertex(0.  , 0.  , 100.)
-
-# create a vector from two points
-vxy = geompy.MakeVector(px, py)
-
-# create an arc from three points
-arc = geompy.MakeArc(py, pz, px)
-
-# create a wire
-wire = geompy.MakeWire([vxy, arc])
-
-# add an object in the study
-id_wire = geompy.addToStudy(wire,"Wire")
-
-# display the wire
-gg.createAndDisplayGO(id_wire) 
-\endcode
 \anchor tui_creation_face
 <br><h2>Creation of a Face</h2>
+\include topological_geom_objs_ex03.py
+<a href="../../examples/GEOM/topological_geom_objs_ex03.py">Download this script</a>
 
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create vertices
-p0   = geompy.MakeVertex(0.  , 0.  , 0.  )
-px   = geompy.MakeVertex(100., 0.  , 0.  )
-py   = geompy.MakeVertex(0.  , 100., 0.  )
-pz   = geompy.MakeVertex(0.  , 0.  , 100.)
-pxyz = geompy.MakeVertex(100., 100., 100.)
-
-# create a vector from two points
-vxy = geompy.MakeVector(px, py)
-
-# create an arc from three points
-arc = geompy.MakeArc(py, pz, px)
-
-# create a wire
-wire = geompy.MakeWire([vxy, arc])
-
-# create sketchers
-sketcher1 = geompy.MakeSketcher("Sketcher:F -100 -100:TT 250 -100:R 0:C 100 150:R 0:L 300:WW",
-                                [100,0,0, 1,1,1, -1,1,0])
-sketcher2 = geompy.MakeSketcher("Sketcher:F 0 0:TT 70 0:TT 70 70:TT 0 70:WW")
-sketcher3 = geompy.MakeSketcher("Sketcher:F 20 20:TT 50 20:TT 50 50:TT 20 50:WW")
-isPlanarFace = 1
-
-# create a face from the wire
-face1 = geompy.MakeFace(wire, isPlanarFace)
-
-# create faces from two wires
-face2 = geompy.MakeFaceWires([wire, sketcher1],isPlanarFace)
-face3 = geompy.MakeFaces([sketcher2, sketcher3],isPlanarFace)
-
-# add objects in the study
-id_face1 = geompy.addToStudy(face1,"Face1")
-id_face2 = geompy.addToStudy(face2,"Face2")
-id_face3 = geompy.addToStudy(face3,"Face3")
-
-# display the faces
-gg.createAndDisplayGO(id_face1)
-gg.setDisplayMode(id_face1,1)
-gg.setTransparency(id_face1,0.2)
-gg.createAndDisplayGO(id_face2)
-gg.setDisplayMode(id_face2,1)
-gg.setTransparency(id_face2,0.2)
-gg.createAndDisplayGO(id_face3)
-gg.setDisplayMode(id_face3,1)
-gg.setTransparency(id_face3,0.2) 
-\endcode
 \anchor tui_creation_shell
 <br><h2>Creation of a Shell</h2>
+\include topological_geom_objs_ex04.py
+<a href="../../examples/GEOM/topological_geom_objs_ex04.py">Download this script</a>
 
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-#create vertices
-p0   = geompy.MakeVertex( 0.,  0.,  0.)
-pxyz = geompy.MakeVertex( 5.,  5., 40.)
-
-# create sketchers
-sketcher1 = geompy.MakeSketcher("Sketcher:F 0 0:TT 70 0:TT 70 70:TT 0 70:WW")
-sketcher2 = geompy.MakeSketcher("Sketcher:F 20 20:TT 50 20:TT 50 50:TT 20 50:WW")
-isPlanarFace = 1
-
-# create a face from two wires
-face = geompy.MakeFaces([sketcher1, sketcher2],isPlanarFace)
-
-# create a prism
-prism = geompy.MakePrism(face, p0, pxyz)
-
-# explode the prism into faces
-prism_faces = geompy.SubShapeAllSortedCentres(prism, geompy.ShapeType["FACE"])
-
-# create a shell from a set of faces
-shell = geompy.MakeShell([prism_faces[0], prism_faces[2], prism_faces[3],
-                          prism_faces[7], prism_faces[9]])
-
-# add objects in the study
-id_shell = geompy.addToStudy(shell,"Shell")
-
-# display the shell
-gg.createAndDisplayGO(id_shell)
-gg.setDisplayMode(id_shell,1) 
-\endcode
 \anchor tui_creation_solid
 <br><h2>Creation of a Solid</h2>
+\include topological_geom_objs_ex05.py
+<a href="../../examples/GEOM/topological_geom_objs_ex05.py">Download this script</a>
 
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-#create vertices
-p0 = geompy.MakeVertex( 0.,  0.,  0.)
-pz = geompy.MakeVertex( 0.,  0., 40.)
-
-# create sketchers
-sketcher = geompy.MakeSketcher("Sketcher:F -50 -50:TT 100 -50:R 0:C 50 70:R 0:L 100:WW")
-
-# create faces from two wires
-face = geompy.MakeFace(sketcher,1)
-
-# create a prism
-prism = geompy.MakePrism(face, p0, pz)
-
-# explode the prism into faces
-prism_faces = geompy.SubShapeAllSortedCentres(prism, geompy.ShapeType["FACE"])
-
-# create a shell from a set of faces
-shell = geompy.MakeShell([prism_faces[0], prism_faces[1],
-                          prism_faces[3], prism_faces[4],
-                          prism_faces[5], prism_faces[2]])
-
-# create a solid, bounded by the given shells
-solid = geompy.MakeSolid([shell])
-
-# add objects in the study
-id_solid = geompy.addToStudy(solid,"Solid")
-
-# display the solid
-gg.createAndDisplayGO(id_solid)
-gg.setDisplayMode(id_solid,1) 
-\endcode
 \anchor tui_creation_compound
 <br><h2>Creation of a Compound</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a vertex and a vector
-p1 = geompy.MakeVertex(  -30.,  -30.,  50.)
-p2 = geompy.MakeVertex(  -60.,  -60.,  30.)
-p3 = geompy.MakeVertex(  -30.,  -30.,  10.)
-
-# create an arc from three points
-arc = geompy.MakeArc(p1, p2, p3)
-ShapeListCompound = []
-i = 0
-while i <= 3 :
-    S = geompy.MakeTranslation(arc, i * 50., 0., 0.)
-    ShapeListCompound.append(S)
-    i = i + 1
-
-# create a compund of the given shapes
-compound = geompy.MakeCompound(ShapeListCompound)
-
-# add object in the study
-id_compound = geompy.addToStudy(compound,"Compound")
-
-# display the compound
-gg.createAndDisplayGO(id_compound) 
-\endcode
+\include topological_geom_objs_ex06.py
+<a href="../../examples/GEOM/topological_geom_objs_ex06.py">Download this script</a>
 
 */
index 9c582a8971acc619d735c7f8273a9fbaa3692541..10e392ec0d52fdadaf3a7a378bf6ee2eb89c36ea 100644 (file)
 
 \anchor tui_translation
 <br><h2>Translation</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a vertex and a vector
-p1 = geompy.MakeVertex(10, 40, 0)
-p2 = geompy.MakeVertex( 0,  0, 50)
-p3 = geompy.MakeVertex(50, 80, 0)
-v = geompy.MakeVector(p1, p2)
-vt = geompy.MakeVector(p1, p3)
-
-# create a cylinder
-height = 35
-radius1 = 20
-cylinder = geompy.MakeCylinder(p1, v, radius1, height)
-
-# translate the given object along the vector, specified by its end points
-# (all three functions produce the same result)
-translation1 = geompy.MakeTranslationTwoPoints(cylinder, p1, p3)
-translation2 = geompy.MakeTranslation(cylinder, 40, 40, 0)
-translation3 = geompy.MakeTranslationVector(cylinder, vt)
-translation4 = geompy.MakeTranslationVectorDistance(cylinder, vt, 200)
-
-# add objects in the study
-id_cylinder = geompy.addToStudy(cylinder, "Cylinder")
-id_translation1 = geompy.addToStudy(translation1, "Translation1")
-id_translation2 = geompy.addToStudy(translation2, "Translation2")
-id_translation3 = geompy.addToStudy(translation3, "Translation3")
-id_translation4 = geompy.addToStudy(translation4, "Translation4")
-
-# display the results
-gg.createAndDisplayGO(id_cylinder)
-gg.setDisplayMode(id_cylinder,1)
-gg.createAndDisplayGO(id_translation1)
-gg.setDisplayMode(id_translation1,1)
-gg.createAndDisplayGO(id_translation2)
-gg.setDisplayMode(id_translation2,1)
-gg.createAndDisplayGO(id_translation3)
-gg.setDisplayMode(id_translation3,1) 
-gg.createAndDisplayGO(id_translation4)
-gg.setDisplayMode(id_translation4,1) 
-\endcode
+\include transformation_operations_ex01.py
+<a href="../../examples/GEOM/transformation_operations_ex01.py">Download this script</a>
 
 \anchor tui_rotation
 <br><h2>Rotation</h2>
-
-\code
-import geompy
-import salome
-import math
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a vertex and a vector
-p1 = geompy.MakeVertex(10, 40,  0)
-p2 = geompy.MakeVertex( 0,  0, 50)
-p3 = geompy.MakeVertex(10, 50,-20)
-p4 = geompy.MakeVertex(10, 50, 60)
-v = geompy.MakeVector(p1, p2)
-vr = geompy.MakeVector(p3, p4)
-
-# create a cylinder
-height = 35
-radius1 = 20
-cylinder = geompy.MakeCylinder(p1, v, radius1, height)
-
-# rotate the given object around the given axis by the given angle
-rotation1 = geompy.MakeRotation(cylinder, vr, math.pi)
-rotation2 = geompy.MakeRotationThreePoints(cylinder, p4, p1, p2)
-
-# add objects in the study
-id_vr = geompy.addToStudy(vr, "Rotation 1 axis")
-id_p4 = geompy.addToStudy(p4, "Rotation 2 center")
-id_p1 = geompy.addToStudy(p1, "Rotation 2 point 1")
-id_p2 = geompy.addToStudy(p2, "Rotation 2 point 2")
-id_cylinder = geompy.addToStudy(cylinder, "Cylinder")
-id_rotation1 = geompy.addToStudy(rotation1, "Rotation 1")
-id_rotation2 = geompy.addToStudy(rotation2, "Rotation 2")
-
-# display the results
-gg.createAndDisplayGO(id_vr)
-gg.createAndDisplayGO(id_p4)
-gg.createAndDisplayGO(id_p1)
-gg.createAndDisplayGO(id_p2)
-gg.createAndDisplayGO(id_cylinder)
-gg.setDisplayMode(id_cylinder,1)
-gg.createAndDisplayGO(id_rotation1)
-gg.createAndDisplayGO(id_rotation2)
-gg.setDisplayMode(id_rotation1,1)
-gg.setDisplayMode(id_rotation2,1)
-\endcode
+\include transformation_operations_ex02.py
+<a href="../../examples/GEOM/transformation_operations_ex02.py">Download this script</a>
 
 \anchor tui_modify_location 
 <br><h2>Modify Location</h2>
-
-\code
-import geompy
-import salome
-import math
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a vertex and a vector
-p1 = geompy.MakeVertex(10, 40, 0)
-p2 = geompy.MakeVertex( 0,  0, 50)
-v = geompy.MakeVector(p1, p2)
-
-# create a cylinder
-height = 35
-radius1 = 20
-cylinder = geompy.MakeCylinder(p1, v, radius1, height)
-circle   = geompy.MakeCircle(p2, v, radius1)
-
-# create local coordinate systems
-cs1 = geompy.MakeMarker( 0, 0, 0, 1,0,0, 0,1,0)
-cs2 = geompy.MakeMarker(30,40,40, 1,0,0, 0,1,0)
-
-# modify the location of the given object
-position = geompy.MakePosition(cylinder, cs1, cs2)
-position2 = geompy.PositionAlongPath(position, circle, 0.75, 1, 1)
-
-# add objects in the study
-id_cs1 = geompy.addToStudy(cs1, "Coordinate system 1")
-id_cs2 = geompy.addToStudy(cs2, "Coordinate system 2")
-id_cylinder = geompy.addToStudy(cylinder, "Cylinder")
-id_circle = geompy.addToStudy(circle, "Circle")
-id_position = geompy.addToStudy(position, "Position")
-id_position2 = geompy.addToStudy(position2, "PositionAlongPath")
-
-# display the results
-gg.createAndDisplayGO(id_cylinder)
-gg.setDisplayMode(id_cylinder,1)
-gg.createAndDisplayGO(id_position)
-gg.setDisplayMode(id_position,1)
-gg.createAndDisplayGO(id_circle)
-gg.setDisplayMode(id_circle,1)
-gg.createAndDisplayGO(id_position2)
-gg.setDisplayMode(id_position2,1)
-\endcode
+\include transformation_operations_ex03.py
+<a href="../../examples/GEOM/transformation_operations_ex03.py">Download this script</a>
 
 \anchor tui_mirror
 <br><h2>Mirror Image</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a box
-box = geompy.MakeBoxDXDYDZ(200, 200, 200)
-
-# create an object, symmetrical to another object through the given plane
-p1 = geompy.MakeVertex( 0, 25,  0)
-p2 = geompy.MakeVertex( 5, 25,  0)
-p3 = geompy.MakeVertex( 0,-30, 40)
-plane = geompy.MakePlaneThreePnt(p1, p2, p3, 1000.)
-mirror1 = geompy.MakeMirrorByPlane(box, plane)
-
-# create an object, symmetrical to another object through the given axis
-p4 = geompy.MakeVertex( 210, 210, -20)
-p5 = geompy.MakeVertex( 210, 210, 220)
-axis = geompy.MakeVector(p4, p5)
-mirror2 = geompy.MakeMirrorByAxis(box, axis)
-
-# create an object, symmetrical to another object through the given point
-mirror3 = geompy.MakeMirrorByPoint(box, p4)
-
-# add objects in the study
-id_box = geompy.addToStudy(box, "Box")
-id_plane = geompy.addToStudy(plane, "Plane")
-id_mirror1 = geompy.addToStudy(mirror1, "Mirror plane")
-id_axis = geompy.addToStudy(axis, "Axis")
-id_mirror2 = geompy.addToStudy(mirror2, "Mirror axis")
-id_p4 = geompy.addToStudy(p4, "Point")
-id_mirror3 = geompy.addToStudy(mirror3, "Mirror point")
-
-# display the results
-gg.createAndDisplayGO(id_box)
-gg.setDisplayMode(id_box,1)
-gg.createAndDisplayGO(id_plane)
-gg.createAndDisplayGO(id_mirror1)
-gg.setDisplayMode(id_mirror1,1)
-gg.createAndDisplayGO(id_axis)
-gg.createAndDisplayGO(id_mirror2)
-gg.setDisplayMode(id_mirror2,1)
-gg.createAndDisplayGO(id_p4)
-gg.createAndDisplayGO(id_mirror3)
-gg.setDisplayMode(id_mirror3,1) 
-\endcode
+\include transformation_operations_ex04.py
+<a href="../../examples/GEOM/transformation_operations_ex04.py">Download this script</a>
 
 \anchor tui_scale
 <br><h2>Scale Transform</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a box and a sphere
-box = geompy.MakeBoxDXDYDZ(200, 200, 200)
-
-# scale the given object by the factor
-p0 = geompy.MakeVertex(100, 100, 100)
-factor = 0.5
-scale = geompy.MakeScaleTransform(box, p0, factor)
-
-# add objects in the study
-id_box = geompy.addToStudy(box, "Box")
-id_scale = geompy.addToStudy(scale, "Scale")
-
-# display the results
-gg.createAndDisplayGO(id_box)
-gg.setDisplayMode(id_box,1)
-gg.setTransparency(id_box,0.5)
-gg.createAndDisplayGO(id_scale)
-gg.setDisplayMode(id_scale,1)
-\endcode
+\include transformation_operations_ex05.py
+<a href="../../examples/GEOM/transformation_operations_ex05.py">Download this script</a>
 
 \anchor tui_offset 
 <br><h2>Offset Surface</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a box and a sphere
-box = geompy.MakeBox(20, 20, 20, 200, 200, 200)
-
-# create a new object as offset of the given object
-offset = geompy.MakeOffset(box, 70.)
-
-# add objects in the study
-id_box = geompy.addToStudy(box, "Box")
-id_offset = geompy.addToStudy(offset, "Offset")
-
-# display the results
-gg.createAndDisplayGO(id_box)
-gg.setDisplayMode(id_box,1)
-gg.createAndDisplayGO(id_offset) 
-\endcode
+\include transformation_operations_ex06.py
+<a href="../../examples/GEOM/transformation_operations_ex06.py">Download this script</a>
 
 \anchor tui_projection
 <br><h2>Projection</h2>
-
-\code
-import geompy
-import salome
-
-# create a cylindric face and a curve(edge)
-cylinder = geompy.MakeCylinderRH(100, 300)
-[face_cyl] = geompy.SubShapes(cylinder, [3])
-
-p1 = geompy.MakeVertex(200, 0, 100)
-p2 = geompy.MakeVertex(200, 80, 100)
-p3 = geompy.MakeVertex(200, 80, 180)
-p4 = geompy.MakeVertex(130, 80, 180)
-p5 = geompy.MakeVertex(90, 80, 240)
-
-curve = geompy.MakeInterpol([p1, p2, p3, p4, p5], False, False)
-
-# create a new object as projection of the
-# given curve on the given cylindric face
-projection = geompy.MakeProjection(curve, face_cyl)
-
-# add objects in the study
-geompy.addToStudy(cylinder, "cylinder")
-geompy.addToStudyInFather(cylinder, face_cyl, "face_cyl")
-geompy.addToStudy(p1, "p1")
-geompy.addToStudy(p2, "p2")
-geompy.addToStudy(p3, "p3")
-geompy.addToStudy(p4, "p4")
-geompy.addToStudy(p5, "p5")
-geompy.addToStudy(curve, "curve")
-geompy.addToStudy(projection, "projection")
-\endcode
+\include transformation_operations_ex07.py
+<a href="../../examples/GEOM/transformation_operations_ex07.py">Download this script</a>
 
 \anchor tui_multi_translation 
 <br><h2>Multi Translation</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create vertices and vectors
-p0  = geompy.MakeVertex( 0.,  0.,  0.)
-px  = geompy.MakeVertex(20.,  0.,  0.)
-py  = geompy.MakeVertex( 0., 20.,  0.)
-pz  = geompy.MakeVertex( 0.,  0., 20.)
-pxy = geompy.MakeVertex( 50., 0., 0.)
-pxyz = geompy.MakeVertex( 50., 50., 50.)
-vz  = geompy.MakeVector(p0, pz)
-vxy = geompy.MakeVector(px, py)
-vtr1d = geompy.MakeVector(p0, pxyz)
-vtr2d = geompy.MakeVector(p0, pxy)
-
-# create an arc
-arc = geompy.MakeArc(py, pz, px)
-
-# create a wire
-wire = geompy.MakeWire([vxy, arc])
-
-# create a planar face
-face = geompy.MakeFace(wire, 1)
-
-# create a prism
-prism = geompy.MakePrismVecH(face, vz, 20.0)
-
-# translate the given object along the given vector a given number of times
-tr1d = geompy.MakeMultiTranslation1D(prism, vtr1d, 20, 4)
-
-# consequently apply two specified translations to the object a given number of times
-tr2d = geompy.MakeMultiTranslation2D(prism, vtr1d, 20, 4, vtr2d, 80, 3)
-
-# add objects in the study
-id_prism = geompy.addToStudy(prism,"Prism")
-id_tr1d = geompy.addToStudy(tr1d,"Translation 1D")
-id_tr2d = geompy.addToStudy(tr2d,"Translation 2D")
-
-# display the prism and the results of fillet operation
-gg.createAndDisplayGO(id_prism)
-gg.setDisplayMode(id_prism,1)
-gg.createAndDisplayGO(id_tr1d)
-gg.setDisplayMode(id_tr1d,1)
-gg.createAndDisplayGO(id_tr2d)
-gg.setDisplayMode(id_tr2d,1) 
-\endcode
+\include transformation_operations_ex08.py
+<a href="../../examples/GEOM/transformation_operations_ex08.py">Download this script</a>
 
 \anchor tui_multi_rotation
 <br><h2>Multi Rotation</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-import math
-
-# create vertices and vectors
-p0  = geompy.MakeVertex( 0.,  0.,  0.)
-px  = geompy.MakeVertex(20.,  0.,  0.)
-py  = geompy.MakeVertex( 0., 20.,  0.)
-pz  = geompy.MakeVertex( 0.,  0., 20.)
-pxyz = geompy.MakeVertex( 50., 50., 10.)
-vz  = geompy.MakeVector(p0, pz)
-vxy = geompy.MakeVector(px, py)
-vrot = geompy.MakeVector(p0, pxyz)
-
-# create an arc
-arc = geompy.MakeArc(py, pz, px)
-
-# create a wire
-wire = geompy.MakeWire([vxy, arc])
-
-# create a planar face
-face = geompy.MakeFace(wire, 1)
-
-# create a prism
-prism = geompy.MakePrismVecH(face, vz, 20.0)
-
-# 1. Rotate the prism around the axis vrot 4 times
-
-# rotation angle = 2 * PI / 4
-rot1da = geompy.MultiRotate1DNbTimes(prism, vrot, 4)
-
-# by the given angle of 30 degrees
-rot1db = geompy.MultiRotate1DByStep(prism, vrot, math.pi/6., 4)
-
-# 2. Rotate the prism around the axis vrot 4 times
-#    and translate the result of each rotation 5 times on distance 50
-
-# rotation angle = 2 * PI / 4
-rot2da = geompy.MultiRotate2DNbTimes(prism, vrot, 4, 50, 5)
-
-# by the given angle of 60 degrees
-rot2db = geompy.MultiRotate2DByStep(prism, vrot, math.pi/3., 4, 50, 5)
-
-# add objects in the study
-id_prism = geompy.addToStudy(prism,"Prism")
-id_rot1da = geompy.addToStudy(rot1da,"Rotation 1D Nb.Times")
-id_rot1db = geompy.addToStudy(rot1db,"Rotation 1D By Step")
-id_rot2da = geompy.addToStudy(rot2da,"Rotation 2D Nb.Times")
-id_rot2db = geompy.addToStudy(rot2db,"Rotation 2D By Step")
-
-# display the prism and the results of fillet operation
-gg.createAndDisplayGO(id_prism)
-gg.setDisplayMode(id_prism,1)
-gg.createAndDisplayGO(id_rot1da)
-gg.setDisplayMode(id_rot1da,1)
-gg.createAndDisplayGO(id_rot1db)
-gg.setDisplayMode(id_rot1db,1)
-gg.createAndDisplayGO(id_rot2da)
-gg.setDisplayMode(id_rot2da,1) 
-gg.createAndDisplayGO(id_rot2db)
-gg.setDisplayMode(id_rot2db,1) 
-\endcode
+\include transformation_operations_ex09.py
+<a href="../../examples/GEOM/transformation_operations_ex09.py">Download this script</a>
 
 \anchor tui_fillet2d
 <br><h2>Fillet 2D</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a face in OXY plane
-face = geompy.MakeFaceHW(100, 100, 1)
-fillet2d = geompy.MakeFillet2D(face, 30, [7, 9])
-
-# add objects in the study
-id_face  = geompy.addToStudy(face,"Face_1")
-id_fillet2d  = geompy.addToStudy(fillet2d,"Fillet 2D_1")
-
-# display disks
-gg.createAndDisplayGO(id_face)
-gg.createAndDisplayGO(id_fillet2d)
-\endcode
+\include transformation_operations_ex10.py
+<a href="../../examples/GEOM/transformation_operations_ex10.py">Download this script</a>
 
 \anchor tui_fillet1d
 <br><h2>Fillet 1D</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create box
-Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
-# take box edges to create custom complex wire
-[Edge_1,Edge_2,Edge_3,Edge_4,Edge_5,Edge_6,Edge_7,Edge_8,Edge_9,Edge_10,Edge_11,Edge_12] = geompy.SubShapeAllSortedCentres(Box_1, geompy.ShapeType["EDGE"])
-# create wire
-Wire_1 = geompy.MakeWire([Edge_12, Edge_7, Edge_11, Edge_6, Edge_1,Edge_4])
-# make fillet at given wire vertices with giver radius
-Fillet_1D_1 = geompy.MakeFillet1D(Wire_1, 55, [3, 4, 6, 8, 10])
-
-
-# display disks
-gg.createAndDisplayGO(Wire_1)
-gg.createAndDisplayGO(Fillet_1D_1)
-\endcode
+\include transformation_operations_ex11.py
+<a href="../../examples/GEOM/transformation_operations_ex11.py">Download this script</a>
 
 \anchor tui_fillet
 <br><h2>Fillet</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-radius  = 10.
-ShapeTypeEdge = geompy.ShapeType["EDGE"]
-
-# create vertices and vectors
-p0  = geompy.MakeVertex(  0.,   0.,   0.)
-px  = geompy.MakeVertex(100.,   0.,   0.)
-py  = geompy.MakeVertex(  0., 100.,   0.)
-pz  = geompy.MakeVertex(  0.,   0., 100.)
-vz  = geompy.MakeVector(p0, pz)
-vxy = geompy.MakeVector(px, py)
-
-# create an arc
-arc = geompy.MakeArc(py, pz, px)
-
-# create a wire
-wire = geompy.MakeWire([vxy, arc])
-
-# create a planar face
-face = geompy.MakeFace(wire, 1)
-
-# create a prism
-prism = geompy.MakePrismVecH(face, vz, 100.0)
-
-# get the list of IDs (IDList) for the fillet
-prism_edges = geompy.SubShapeAllSortedCentres(prism, ShapeTypeEdge)
-IDlist_e = []
-IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[0]))
-IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[1]))
-IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[2]))
-
-# make a fillet on the specified edges of the given shape
-fillet = geompy.MakeFillet(prism, radius, ShapeTypeEdge, IDlist_e)
-
-# make a fillet on all edges of the given shape
-filletall = geompy.MakeFilletAll(prism, radius)
-
-# add objects in the study
-id_prism = geompy.addToStudy(prism,"Prism")
-id_fillet = geompy.addToStudy(fillet,"Fillet")
-id_filletall = geompy.addToStudy(filletall,"Fillet all")
-
-# display the prism and the results of fillet operation
-gg.createAndDisplayGO(id_prism)
-gg.setDisplayMode(id_prism,1)
-gg.createAndDisplayGO(id_fillet)
-gg.setDisplayMode(id_fillet,1)
-gg.createAndDisplayGO(id_filletall)
-gg.setDisplayMode(id_filletall,1) 
-\endcode
+\include transformation_operations_ex12.py
+<a href="../../examples/GEOM/transformation_operations_ex12.py">Download this script</a>
 
 \anchor tui_chamfer
 <br><h2>Chamfer</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-d1 = 10.
-d2 = 10.
-ShapeTypeFace = geompy.ShapeType["FACE"]
-
-# create vertices and vectors
-p0  = geompy.MakeVertex(  0.,   0.,   0.)
-px  = geompy.MakeVertex(100.,   0.,   0.)
-py  = geompy.MakeVertex(  0., 100.,   0.)
-pz  = geompy.MakeVertex(  0.,   0., 100.)
-vz  = geompy.MakeVector(p0, pz)
-vxy = geompy.MakeVector(px, py)
-
-# create an arc
-arc = geompy.MakeArc(py, pz, px)
-
-# create a wire
-wire = geompy.MakeWire([vxy, arc])
-
-# create a planar face
-face = geompy.MakeFace(wire, 1)
-
-# create a prism
-prism = geompy.MakePrismVecH(face, vz, 100.0)
-
-# get the list of IDs (IDList) for the chamfer
-prism_faces = geompy.SubShapeAllSortedCentres(prism, ShapeTypeFace)
-f_ind_1 = geompy.GetSubShapeID(prism, prism_faces[0])
-f_ind_2 = geompy.GetSubShapeID(prism, prism_faces[1])
-IDlist_f = [f_ind_1, f_ind_2]
-
-# perform a chamfer on the edges common to the specified faces
-chamfer_e = geompy.MakeChamferEdge(prism, d1, d2, f_ind_1, f_ind_2)
-
-# perform a chamfer on all edges of the specified faces
-chamfer_f = geompy.MakeChamferFaces(prism, d1, d2, IDlist_f)
-chamfer_f1 = geompy.MakeChamfer(prism, d1, d2, ShapeTypeFace, IDlist_f)
-
-# perform a symmetric chamfer on all edges of the given shape
-chamfer_all = geompy.MakeChamferAll(prism, d1)
-
-# add objects in the study
-id_prism = geompy.addToStudy(prism,"Prism")
-id_chamfer_e = geompy.addToStudy(chamfer_e,"Chamfer edge")
-id_chamfer_f = geompy.addToStudy(chamfer_f,"Chamfer faces")
-id_chamfer_f1 = geompy.addToStudy(chamfer_f1,"Chamfer faces 1")
-id_chamfer_all = geompy.addToStudy(chamfer_all,"Chamfer all")
-
-# display the prism and the results of chamfer operation
-gg.createAndDisplayGO(id_prism)
-gg.setDisplayMode(id_prism,1)
-gg.createAndDisplayGO(id_chamfer_e)
-gg.setDisplayMode(id_chamfer_e,1)
-gg.createAndDisplayGO(id_chamfer_f)
-gg.setDisplayMode(id_chamfer_f,1)
-gg.createAndDisplayGO(id_chamfer_f1)
-gg.setDisplayMode(id_chamfer_f1,1)
-gg.createAndDisplayGO(id_chamfer_all)
-gg.setDisplayMode(id_chamfer_all,1) 
-\endcode
+\include transformation_operations_ex13.py
+<a href="../../examples/GEOM/transformation_operations_ex13.py">Download this script</a>
 
 */
index 2573c0fa5d8ecfca7cccbbd6b7a9d01e5e3836c7..8505548d3aced07b8c2a6732027dd3aa5b91c0f1 100644 (file)
@@ -4,78 +4,22 @@
 
 \anchor tui_change_disp_mode
 <br><h2>Changing Display Mode</h2>
-
-\code
-import salome
-import geompy
-box = geompy.MakeBox(0,0,0, 50,50,50)
-box2 = geompy.MakeBox(-50,-50,-50, 0,0,0)
-
-sphere = geompy.MakeSphere(50,50,50, 30)
-fuse = geompy.MakeBoolean(box,sphere,3)
-fuse_id = geompy.addToStudy(fuse,"Fuse")
-box_id = geompy.addToStudy(box2, "Box")
-
-gg = salome.ImportComponentGUI("GEOM")
-gg.createAndDisplayGO(fuse_id)
-gg.setDisplayMode(fuse_id,1)
-gg.createAndDisplayGO(box_id)
-gg.setVectorsMode(box_id, 1)
-\endcode
+\include viewing_geom_objs_ex01.py
+<a href="../../examples/GEOM/viewing_geom_objs_ex01.py">Download this script</a>
 
 \anchor tui_change_color 
 <br><h2> Changing Color</h2>
-
-\code
-import salome
-import geompy
-box = geompy.MakeBox(0,0,0, 50,50,50)
-
-sphere = geompy.MakeSphere(50,50,50, 30)
-fuse = geompy.MakeBoolean(box,sphere,3)
-fuse_id = geompy.addToStudy(fuse,"Fuse")
-
-gg = salome.ImportComponentGUI("GEOM")
-gg.createAndDisplayGO(fuse_id)
-gg.setDisplayMode(fuse_id,1)
-gg.setColor(fuse_id,218,165,31) 
-\endcode
+\include viewing_geom_objs_ex02.py
+<a href="../../examples/GEOM/viewing_geom_objs_ex02.py">Download this script</a>
 
 \anchor tui_change_transparency
 <br><h2>Changing Transparency</h2>
-
-\code
-import salome
-import geompy
-
-box = geompy.MakeBox(0,0,0, 50,50,50)
-sphere = geompy.MakeSphere(50,50,50, 30)
-
-fuse = geompy.MakeBoolean(box,sphere,3)
-fuse_id = geompy.addToStudy(fuse,"Fuse")
-
-gg = salome.ImportComponentGUI("GEOM")
-gg.createAndDisplayGO(fuse_id)
-gg.setDisplayMode(fuse_id,1)
-gg.setColor(fuse_id,218,165,31)
-gg.setTransparency(fuse_id,0.5) 
-\endcode
+\include viewing_geom_objs_ex03.py
+<a href="../../examples/GEOM/viewing_geom_objs_ex03.py">Download this script</a>
 
 \anchor tui_point_marker
 <br><h2>Set Point Marker</h2>
+\include viewing_geom_objs_ex04.py
+<a href="../../examples/GEOM/viewing_geom_objs_ex04.py">Download this script</a>
 
-\code
-import salome
-import geompy
-
-texture = geompy.LoadTexture("/users/user/mytexture.dat")
-
-v1 = geompy.MakeVertex(0, 0, 0)
-v2 = geompy.MakeVertex(100, 0, 0)
-v3 = geompy.MakeVertex(0, 100, 0)
-
-v1.SetMarkerStd(GEOM.MT_O_PLUS, GEOM.MS_25)
-v2.SetMarkerStd(GEOM.MT_BALL,   GEOM.MS_40)
-v3.SetMarkerTexture(texture)
-\endcode
 */
index e89e8bf181f64a95063c11ea9dd48e8bba456801..d1c8fc91187a5d39197fe9f4d11a9fa8b50ddcf6 100644 (file)
@@ -1,15 +1,7 @@
 /*!
 
 \page tui_whatis_page What Is
-
-\code
-import geompy
-
-# create a box
-box = geompy.MakeBoxDXDYDZ(100,30,100)
-Descr = geompy.WhatIs(box)
-print "\nBox 100x30x100 description:"
-print Descr
-\endcode
+\include whatis.py
+<a href="../../examples/GEOM/whatis.py">Download this script</a>
 
 */
index 37813417c41ad96f5432df931976de9a0fc40326..4f252c2e9e97423cb08fb68eb21e643dbc593fc6 100644 (file)
 <br>
 \anchor tui_create_groups_anchor
 <h2>Creation of a group</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create two vertices
-p0 = geompy.MakeVertex(0.  , 0.  , 0.  )
-p200 = geompy.MakeVertex(200., 200., 200.)
-
-# create a box from two points
-Box = geompy.MakeBoxTwoPnt(p0, p200)
-
-# create a group from the faces of the box
-group = geompy.CreateGroup(Box, geompy.ShapeType["FACE"])
-
-# add objects to the group
-SubFaceList = geompy.SubShapeAllSortedCentres(Box, geompy.ShapeType["FACE"])
-for i in [0, 3, 5] :
-    FaceID = geompy.GetSubShapeID(Box, SubFaceList[i])
-    geompy.AddObject(group, FaceID)
-
-# add all selected shapes from the list to the group
-# (the program doesn't raise error, if some shapes are already included)
-geompy.UnionList(group, [SubFaceList[0], SubFaceList[2], SubFaceList[5]])
-
-# remove an object from the group
-geompy.RemoveObject(group, FaceID)
-
-# remove all selected shapes from the group
-# (the program doesn't raise error, if some shapes are not included)
-geompy.DifferenceList(group, [SubFaceList[2], SubFaceList[3], SubFaceList[4]])
-id_group1 = geompy.addToStudy(group, "Group1")
-
-# display the contents of the group
-gg.createAndDisplayGO(id_group1)
-salome.sg.updateObjBrowser(1)
-\endcode
+\include working_with_groups_ex01.py
+<a href="../../examples/GEOM/working_with_groups_ex01.py">Download this script</a>
 
 \anchor tui_edit_groups_anchor
 
 <br><h2>Adding an object to the group</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create two vertices
-p0 = geompy.MakeVertex(0.  , 0.  , 0.  )
-p200 = geompy.MakeVertex(200., 200., 200.)
-
-# create a box from two points
-Box = geompy.MakeBoxTwoPnt(p0, p200)
-
-# create a group from the faces of the box
-group = geompy.CreateGroup(Box, geompy.ShapeType["FACE"])
-
-# add objects to the group
-SubFaceList = geompy.SubShapeAllSortedCentres(Box, geompy.ShapeType["FACE"])
-for i in [0, 3, 5] :
-    FaceID = geompy.GetSubShapeID(Box, SubFaceList[i])
-    geompy.AddObject(group, FaceID)
-id_group1 = geompy.addToStudy(group, "Group1")
-
-# display the contents of the group
-gg.createAndDisplayGO(id_group1)
-salome.sg.updateObjBrowser(1) 
-\endcode
+\include working_with_groups_ex02.py
+<a href="../../examples/GEOM/working_with_groups_ex02.py">Download this script</a>
 
 <br><h2>Removing an object from the group</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create two vertices
-p0 = geompy.MakeVertex(0.  , 0.  , 0.  )
-p200 = geompy.MakeVertex(200., 200., 200.)
-
-# create a box from two points
-Box = geompy.MakeBoxTwoPnt(p0, p200)
-
-# create a group from the faces of the box
-group = geompy.CreateGroup(Box, geompy.ShapeType["FACE"])
-
-# add objects to the group
-SubFaceList = geompy.SubShapeAllSortedCentres(Box, geompy.ShapeType["FACE"])
-for i in [0, 3, 5] :
-    FaceID = geompy.GetSubShapeID(Box, SubFaceList[i])
-    geompy.AddObject(group, FaceID)
-
-# add all selected shapes from the list to the group
-# (the program doesn't raise errors, if some shapes are already included)
-geompy.UnionList(group, [SubFaceList[0], SubFaceList[2], SubFaceList[5]])
-
-# remove an object from the group
-geompy.RemoveObject(group, FaceID)
-id_group1 = geompy.addToStudy(group, "Group1")
-
-# display the contents of the group
-gg.createAndDisplayGO(id_group1)
-salome.sg.updateObjBrowser(1) 
-\endcode
+\include working_with_groups_ex03.py
+<a href="../../examples/GEOM/working_with_groups_ex03.py">Download this script</a>
 
 <br>
 \anchor tui_union_groups_anchor
 <h2>Union Groups</h2>
-
-\code
-import geompy
-import salome
-
-# create a box and some groups of faces on it
-Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
-Group_1 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
-geompy.UnionIDs(Group_1, [13, 23])
-Group_2 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
-geompy.UnionIDs(Group_2, [3, 27])
-Group_3 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
-geompy.UnionIDs(Group_3, [33, 23])
-Group_4 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
-geompy.UnionIDs(Group_4, [31, 27])
-
-# union groups
-Group_U_1_2 = geompy.UnionGroups(Group_1, Group_2)
-Group_UL_3_4 = geompy.UnionListOfGroups([Group_3, Group_4])
-
-# publish shapes
-geompy.addToStudy(Box_1, 'Box_1')
-geompy.addToStudyInFather(Box_1, Group_1, 'Group_1')
-geompy.addToStudyInFather(Box_1, Group_2, 'Group_2')
-geompy.addToStudyInFather(Box_1, Group_3, 'Group_3')
-geompy.addToStudyInFather(Box_1, Group_4, 'Group_4')
-geompy.addToStudyInFather(Box_1, Group_U_1_2, 'Group_U_1_2')
-geompy.addToStudyInFather(Box_1, Group_UL_3_4, 'Group_UL_3_4')
-salome.sg.updateObjBrowser(1) 
-\endcode
+\include working_with_groups_ex04.py
+<a href="../../examples/GEOM/working_with_groups_ex04.py">Download this script</a>
 
 <br>
 \anchor tui_intersect_groups_anchor
 <h2>Intersect Groups</h2>
-
-\code
-import geompy
-import salome
-
-# create a box and some groups of faces on it
-Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
-Group_1 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
-geompy.UnionIDs(Group_1, [13, 23])
-Group_2 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
-geompy.UnionIDs(Group_2, [3, 27])
-Group_3 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
-geompy.UnionIDs(Group_3, [33, 23])
-Group_4 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
-geompy.UnionIDs(Group_4, [31, 27])
-
-# intersect groups
-Group_I_1_3 = geompy.IntersectGroups(Group_1, Group_3)
-Group_IL_1_3 = geompy.IntersectListOfGroups([Group_1, Group_3])
-
-# publish shapes
-geompy.addToStudy(Box_1, 'Box_1')
-geompy.addToStudyInFather(Box_1, Group_1, 'Group_1')
-geompy.addToStudyInFather(Box_1, Group_2, 'Group_2')
-geompy.addToStudyInFather(Box_1, Group_3, 'Group_3')
-geompy.addToStudyInFather(Box_1, Group_4, 'Group_4')
-geompy.addToStudyInFather(Box_1, Group_I_1_3, 'Group_I_1_3')
-geompy.addToStudyInFather(Box_1, Group_IL_1_3, 'Group_IL_1_3')
-salome.sg.updateObjBrowser(1) 
-
-\endcode
+\include working_with_groups_ex05.py
+<a href="../../examples/GEOM/working_with_groups_ex05.py">Download this script</a>
 
 <br>
 \anchor tui_cut_groups_anchor
 <h2>Cut Groups</h2>
-
-\code
-import geompy
-import salome
-
-# create a box and some groups of faces on it
-Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
-Group_1 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
-geompy.UnionIDs(Group_1, [13, 23])
-Group_2 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
-geompy.UnionIDs(Group_2, [3, 27])
-Group_3 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
-geompy.UnionIDs(Group_3, [33, 23])
-Group_4 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
-geompy.UnionIDs(Group_4, [31, 27])
-
-# cut groups
-Group_C_2_4 = geompy.CutGroups(Group_2, Group_4)
-Group_CL_2_4 = geompy.CutListOfGroups([Group_2], [Group_4])
-
-# publish shapes
-geompy.addToStudy(Box_1, 'Box_1')
-geompy.addToStudyInFather(Box_1, Group_1, 'Group_1')
-geompy.addToStudyInFather(Box_1, Group_2, 'Group_2')
-geompy.addToStudyInFather(Box_1, Group_3, 'Group_3')
-geompy.addToStudyInFather(Box_1, Group_4, 'Group_4')
-geompy.addToStudyInFather(Box_1, Group_C_2_4, 'Group_C_2_4')
-geompy.addToStudyInFather(Box_1, Group_CL_2_4, 'Group_CL_2_4')
-salome.sg.updateObjBrowser(1) 
-
-\endcode
+\include working_with_groups_ex06.py
+<a href="../../examples/GEOM/working_with_groups_ex06.py">Download this script</a>
 
 */