]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Move MakeBrick*.py to examples module for availability for testing.
authorspo <sergey.pokhodenko@opencascade.com>
Tue, 3 Nov 2015 12:00:56 +0000 (15:00 +0300)
committerspo <sergey.pokhodenko@opencascade.com>
Tue, 3 Nov 2015 12:00:56 +0000 (15:00 +0300)
src/PythonAPI/CMakeLists.txt
src/PythonAPI/MakeBrick1.py [deleted file]
src/PythonAPI/MakeBrick2.py [deleted file]
src/PythonAPI/MakeBrick3.py [deleted file]
src/PythonAPI/Test/TestMakeBrick1.py
src/PythonAPI/Test/TestMakeBrick2.py
src/PythonAPI/Test/TestMakeBrick3.py
src/PythonAPI/examples/MakeBrick1.py [new file with mode: 0644]
src/PythonAPI/examples/MakeBrick2.py [new file with mode: 0644]
src/PythonAPI/examples/MakeBrick3.py [new file with mode: 0644]
src/PythonAPI/examples/__init__.py [new file with mode: 0644]

index dc1ee767a70e7e727714abc7dfa0801ae003a1fe..376853dfbb10d196618d6c877b61713f3820e20b 100644 (file)
@@ -3,7 +3,7 @@
 
 SET(CMAKE_AUTOMOC ON)
 
-INSTALL(DIRECTORY extension geom model DESTINATION PythonAPI)
+INSTALL(DIRECTORY extension geom model examples DESTINATION PythonAPI)
 INSTALL(FILES shaper.py DESTINATION PythonAPI)
 
 # --------- Unit tests -----------
diff --git a/src/PythonAPI/MakeBrick1.py b/src/PythonAPI/MakeBrick1.py
deleted file mode 100644 (file)
index dd064fb..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-# Creation of a box using the end-user API
-# Author: Daniel Brunier-Coulin
-# -----------------------------
-
-import model
-
-
-# Initialisation
-
-model.begin()
-mypartset = model.moduleDocument()
-
-
-# Creating a new Part
-
-mypart = model.addPart(mypartset).document()
-
-
-# Creating the base of the box
-
-mybase = model.addSketch( mypart, model.defaultPlane("XOY") )
-
-l1 = mybase.addLine( 0, 0, 0, 1 )
-l2 = mybase.addLine( 0, 1, 1, 1 )
-l3 = mybase.addLine( 1, 1, 1, 0 )
-l4 = mybase.addLine( 1, 0, 0, 0 )
-
-mybase.setCoincident( l1.endPointData(), l2.startPointData() )
-mybase.setCoincident( l2.endPointData(), l3.startPointData() )
-mybase.setCoincident( l3.endPointData(), l4.startPointData() )
-mybase.setCoincident( l4.endPointData(), l1.startPointData() )
-
-mybase.setParallel( l1.result(), l3.result() )
-mybase.setParallel( l2.result(), l4.result() )
-
-mybase.setPerpendicular( l1.result(), l4.result() )
-
-mywidth  = mybase.setLength( l1.result(), 50 )
-mylength = mybase.setDistance( l1.startPointData(), l3.result(), 50 )
-
-# Creating the extrusion
-
-mybox = model.addExtrusion( mypart, mybase.selectFace(), 50 )
-
-# Creating a cylinder on a face of the box
-
-thisface = "Extrusion_1_1/LateralFace_2"
-thisxmin = "Extrusion_1_1/LateralFace_3|Extrusion_1_1/LateralFace_2"
-thisxmax = "Extrusion_1_1/LateralFace_2|Extrusion_1_1/LateralFace_1"
-thiszmin = "Sketch_1/Edge5_1"
-thiszmax = "Extrusion_1_1/LateralFace_2|Extrusion_1_1/ToFace_1"
-
-mystand = model.addSketch( mypart, thisface )
-
-c1      = mystand.addCircle( 0, 25, 5)
-mystand.setDistance( c1.centerData(), thisxmin, 10 )
-mystand.setDistance( c1.centerData(), thiszmax, 10 )
-
-myboss = model.addExtrusion( mypart, mystand.selectFace(c1.result()), -5 )
-
-# Subtracting the cylinder to the box
-
-model.addSubtraction( mypart, mybox.result(), myboss.result() )
-model.end()
-
-
-# Editing the box
-
-model.begin()
-mybase.setValue( mylength, 100 )
-mybox.setSize( 80 )
-model.end()
diff --git a/src/PythonAPI/MakeBrick2.py b/src/PythonAPI/MakeBrick2.py
deleted file mode 100644 (file)
index 2fa09d6..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-# Creation of a box using the end-user API
-# Author: Daniel Brunier-Coulin
-# -----------------------------
-
-import model
-import geom
-
-
-# Initialisation
-
-model.begin()
-mypartset = model.moduleDocument()
-
-
-# Creating a new Part
-
-mypart = model.addPart(mypartset).document()
-
-
-# Creating the base of the box
-
-mybase = model.addSketch(mypart, model.defaultPlane("XOY"))
-
-p1 = geom.Pnt2d(0, 0)
-p2 = geom.Pnt2d(0, 1)
-p3 = geom.Pnt2d(1, 1)
-p4 = geom.Pnt2d(1, 0)
-
-line = mybase.addPolygon(p1, p2, p3, p4)
-
-mybase.setParallel(line[0].result(), line[2].result())
-mybase.setParallel(line[1].result(), line[3].result())
-mybase.setPerpendicular(line[0].result(), line[3].result())
-
-mywidth = mybase.setLength(line[0].result(), 50)
-mylength = mybase.setDistance(line[0].startPointData(), line[2].result(), 50)
-
-
-# Creating the extrusion
-
-mybox = model.addExtrusion(mypart, mybase.selectFace(), 50)
-
-
-# Creating a cylinder on a face of the box
-
-thisface = "Extrusion_1_1/LateralFace_2"
-thisxmin = "Extrusion_1_1/LateralFace_3|Extrusion_1_1/LateralFace_2"
-thiszmax = "Extrusion_1_1/LateralFace_2|Extrusion_1_1/ToFace_1"
-
-mystand = model.addSketch(mypart, thisface)
-circle = mystand.addCircle(0, 25, 5)
-mystand.setDistance(circle.centerData(), thisxmin, 10)
-mystand.setDistance(circle.centerData(), thiszmax, 10)
-
-myboss = model.addExtrusion(mypart, mystand.selectFace(), -5)
-
-
-# Subtracting the cylinder to the box
-
-model.addSubtraction(mypart, mybox.result(), myboss.result())
-model.end()
-
-
-# Editing the box
-
-model.begin()
-mybase.setValue(mylength, 100)
-mybox.setSize(20)
-model.end()
diff --git a/src/PythonAPI/MakeBrick3.py b/src/PythonAPI/MakeBrick3.py
deleted file mode 100644 (file)
index 94fa252..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-# Creation of a box using the end-user API
-# Author: Daniel Brunier-Coulin
-# -----------------------------
-
-import model
-import extension
-
-
-# Initialisation
-
-model.begin()
-mypartset = model.moduleDocument()
-
-
-# Creating a new Part
-
-mypart = model.addPart(mypartset).document()
-
-
-# Creating the base of the box
-
-extension.addBox( mypart, 10, 20, 30 )
-model.end()
-
index 237ae03aabe9274867d83225a04b98a34501aa5b..2225919c05415fdca0265c624dcb34d1d0ff324b 100644 (file)
@@ -1,6 +1,6 @@
 import unittest
 
-import MakeBrick1
+import examples.MakeBrick1
 
 if __name__ == "__main__":
     unittest.main()
index f903e907e70ff671f52a37f62fc900517e47136f..21ea7263e5f9809df2ab9c0ce0079b1e0649655c 100644 (file)
@@ -1,6 +1,6 @@
 import unittest
 
-import MakeBrick2
+import examples.MakeBrick2
 
 if __name__ == "__main__":
     unittest.main()
index 34ba01b1675ff079e45c92301459e644fd9bc508..bbdb4a989012bd948da84fd61dc439fe19a5803c 100644 (file)
@@ -1,6 +1,6 @@
 import unittest
 
-import MakeBrick3
+import examples.MakeBrick3
 
 if __name__ == "__main__":
     unittest.main()
diff --git a/src/PythonAPI/examples/MakeBrick1.py b/src/PythonAPI/examples/MakeBrick1.py
new file mode 100644 (file)
index 0000000..dd064fb
--- /dev/null
@@ -0,0 +1,72 @@
+# Creation of a box using the end-user API
+# Author: Daniel Brunier-Coulin
+# -----------------------------
+
+import model
+
+
+# Initialisation
+
+model.begin()
+mypartset = model.moduleDocument()
+
+
+# Creating a new Part
+
+mypart = model.addPart(mypartset).document()
+
+
+# Creating the base of the box
+
+mybase = model.addSketch( mypart, model.defaultPlane("XOY") )
+
+l1 = mybase.addLine( 0, 0, 0, 1 )
+l2 = mybase.addLine( 0, 1, 1, 1 )
+l3 = mybase.addLine( 1, 1, 1, 0 )
+l4 = mybase.addLine( 1, 0, 0, 0 )
+
+mybase.setCoincident( l1.endPointData(), l2.startPointData() )
+mybase.setCoincident( l2.endPointData(), l3.startPointData() )
+mybase.setCoincident( l3.endPointData(), l4.startPointData() )
+mybase.setCoincident( l4.endPointData(), l1.startPointData() )
+
+mybase.setParallel( l1.result(), l3.result() )
+mybase.setParallel( l2.result(), l4.result() )
+
+mybase.setPerpendicular( l1.result(), l4.result() )
+
+mywidth  = mybase.setLength( l1.result(), 50 )
+mylength = mybase.setDistance( l1.startPointData(), l3.result(), 50 )
+
+# Creating the extrusion
+
+mybox = model.addExtrusion( mypart, mybase.selectFace(), 50 )
+
+# Creating a cylinder on a face of the box
+
+thisface = "Extrusion_1_1/LateralFace_2"
+thisxmin = "Extrusion_1_1/LateralFace_3|Extrusion_1_1/LateralFace_2"
+thisxmax = "Extrusion_1_1/LateralFace_2|Extrusion_1_1/LateralFace_1"
+thiszmin = "Sketch_1/Edge5_1"
+thiszmax = "Extrusion_1_1/LateralFace_2|Extrusion_1_1/ToFace_1"
+
+mystand = model.addSketch( mypart, thisface )
+
+c1      = mystand.addCircle( 0, 25, 5)
+mystand.setDistance( c1.centerData(), thisxmin, 10 )
+mystand.setDistance( c1.centerData(), thiszmax, 10 )
+
+myboss = model.addExtrusion( mypart, mystand.selectFace(c1.result()), -5 )
+
+# Subtracting the cylinder to the box
+
+model.addSubtraction( mypart, mybox.result(), myboss.result() )
+model.end()
+
+
+# Editing the box
+
+model.begin()
+mybase.setValue( mylength, 100 )
+mybox.setSize( 80 )
+model.end()
diff --git a/src/PythonAPI/examples/MakeBrick2.py b/src/PythonAPI/examples/MakeBrick2.py
new file mode 100644 (file)
index 0000000..2fa09d6
--- /dev/null
@@ -0,0 +1,69 @@
+# Creation of a box using the end-user API
+# Author: Daniel Brunier-Coulin
+# -----------------------------
+
+import model
+import geom
+
+
+# Initialisation
+
+model.begin()
+mypartset = model.moduleDocument()
+
+
+# Creating a new Part
+
+mypart = model.addPart(mypartset).document()
+
+
+# Creating the base of the box
+
+mybase = model.addSketch(mypart, model.defaultPlane("XOY"))
+
+p1 = geom.Pnt2d(0, 0)
+p2 = geom.Pnt2d(0, 1)
+p3 = geom.Pnt2d(1, 1)
+p4 = geom.Pnt2d(1, 0)
+
+line = mybase.addPolygon(p1, p2, p3, p4)
+
+mybase.setParallel(line[0].result(), line[2].result())
+mybase.setParallel(line[1].result(), line[3].result())
+mybase.setPerpendicular(line[0].result(), line[3].result())
+
+mywidth = mybase.setLength(line[0].result(), 50)
+mylength = mybase.setDistance(line[0].startPointData(), line[2].result(), 50)
+
+
+# Creating the extrusion
+
+mybox = model.addExtrusion(mypart, mybase.selectFace(), 50)
+
+
+# Creating a cylinder on a face of the box
+
+thisface = "Extrusion_1_1/LateralFace_2"
+thisxmin = "Extrusion_1_1/LateralFace_3|Extrusion_1_1/LateralFace_2"
+thiszmax = "Extrusion_1_1/LateralFace_2|Extrusion_1_1/ToFace_1"
+
+mystand = model.addSketch(mypart, thisface)
+circle = mystand.addCircle(0, 25, 5)
+mystand.setDistance(circle.centerData(), thisxmin, 10)
+mystand.setDistance(circle.centerData(), thiszmax, 10)
+
+myboss = model.addExtrusion(mypart, mystand.selectFace(), -5)
+
+
+# Subtracting the cylinder to the box
+
+model.addSubtraction(mypart, mybox.result(), myboss.result())
+model.end()
+
+
+# Editing the box
+
+model.begin()
+mybase.setValue(mylength, 100)
+mybox.setSize(20)
+model.end()
diff --git a/src/PythonAPI/examples/MakeBrick3.py b/src/PythonAPI/examples/MakeBrick3.py
new file mode 100644 (file)
index 0000000..94fa252
--- /dev/null
@@ -0,0 +1,24 @@
+# Creation of a box using the end-user API
+# Author: Daniel Brunier-Coulin
+# -----------------------------
+
+import model
+import extension
+
+
+# Initialisation
+
+model.begin()
+mypartset = model.moduleDocument()
+
+
+# Creating a new Part
+
+mypart = model.addPart(mypartset).document()
+
+
+# Creating the base of the box
+
+extension.addBox( mypart, 10, 20, 30 )
+model.end()
+
diff --git a/src/PythonAPI/examples/__init__.py b/src/PythonAPI/examples/__init__.py
new file mode 100644 (file)
index 0000000..e69de29