From 81df8b7dc4c698877ee337254f6749a145f9bf00 Mon Sep 17 00:00:00 2001 From: spo Date: Tue, 20 Oct 2015 10:30:13 +0300 Subject: [PATCH] [PythonAPI] Rename 'modeler' into 'model' --- src/PythonAPI/CMakeLists.txt | 4 ++-- src/PythonAPI/MakeBrick1.py | 24 +++++++++---------- src/PythonAPI/MakeBrick2.py | 24 +++++++++---------- src/PythonAPI/MakeBrick3.py | 10 ++++---- src/PythonAPI/Test/TestModeler.py | 16 ++++++------- src/PythonAPI/Test/TestSketcher.py | 14 +++++------ src/PythonAPI/Test/TestSketcherAddArc.py | 4 ++-- src/PythonAPI/Test/TestSketcherAddCircle.py | 2 +- src/PythonAPI/Test/TestSketcherAddLine.py | 2 +- src/PythonAPI/Test/TestSketcherAddPoint.py | 2 +- .../Test/TestSketcherSetCoincident.py | 2 +- src/PythonAPI/Test/TestSketcherSetParallel.py | 2 +- src/PythonAPI/extension/box.py | 6 ++--- src/PythonAPI/{modeler => model}/__init__.py | 0 src/PythonAPI/{modeler => model}/boolean.py | 0 src/PythonAPI/{modeler => model}/errors.py | 4 ++-- src/PythonAPI/{modeler => model}/extrusion.py | 0 src/PythonAPI/{modeler => model}/part.py | 4 ++-- src/PythonAPI/{modeler => model}/roots.py | 0 src/PythonAPI/{modeler => model}/services.py | 0 .../{modeler => model}/sketcher/__init__.py | 0 .../{modeler => model}/sketcher/arc.py | 2 +- .../{modeler => model}/sketcher/circle.py | 0 .../{modeler => model}/sketcher/line.py | 0 .../{modeler => model}/sketcher/point.py | 0 .../{modeler => model}/sketcher/sketch.py | 8 +++---- 26 files changed, 65 insertions(+), 65 deletions(-) rename src/PythonAPI/{modeler => model}/__init__.py (100%) rename src/PythonAPI/{modeler => model}/boolean.py (100%) rename src/PythonAPI/{modeler => model}/errors.py (83%) rename src/PythonAPI/{modeler => model}/extrusion.py (100%) rename src/PythonAPI/{modeler => model}/part.py (77%) rename src/PythonAPI/{modeler => model}/roots.py (100%) rename src/PythonAPI/{modeler => model}/services.py (100%) rename src/PythonAPI/{modeler => model}/sketcher/__init__.py (100%) rename src/PythonAPI/{modeler => model}/sketcher/arc.py (97%) rename src/PythonAPI/{modeler => model}/sketcher/circle.py (100%) rename src/PythonAPI/{modeler => model}/sketcher/line.py (100%) rename src/PythonAPI/{modeler => model}/sketcher/point.py (100%) rename src/PythonAPI/{modeler => model}/sketcher/sketch.py (98%) diff --git a/src/PythonAPI/CMakeLists.txt b/src/PythonAPI/CMakeLists.txt index 300e74f4d..45cedd051 100644 --- a/src/PythonAPI/CMakeLists.txt +++ b/src/PythonAPI/CMakeLists.txt @@ -3,13 +3,13 @@ SET(CMAKE_AUTOMOC ON) -INSTALL(DIRECTORY extension geom modeler DESTINATION PythonAPI) +INSTALL(DIRECTORY extension geom model DESTINATION PythonAPI) # --------- Unit tests ----------- INCLUDE(UnitTest) ADD_UNIT_TESTS( - TestModeler.py + TestModel.py TestSketcherAddPoint.py TestSketcherAddLine.py TestSketcherAddArc.py diff --git a/src/PythonAPI/MakeBrick1.py b/src/PythonAPI/MakeBrick1.py index 8320de026..ceead3f69 100644 --- a/src/PythonAPI/MakeBrick1.py +++ b/src/PythonAPI/MakeBrick1.py @@ -2,23 +2,23 @@ # Author: Daniel Brunier-Coulin # ----------------------------- -import modeler +import model # Initialisation -modeler.begin() -mypartset = modeler.moduleDocument() +model.begin() +mypartset = model.moduleDocument() # Creating a new Part -mypart = modeler.addPart(mypartset).document() +mypart = model.addPart(mypartset).document() # Creating the base of the box -mybase = modeler.addSketch( mypart, modeler.defaultPlane("XOY") ) +mybase = model.addSketch( mypart, model.defaultPlane("XOY") ) l1 = mybase.addLine( 0, 0, 0, 1 ) l2 = mybase.addLine( 0, 1, 1, 1 ) @@ -41,7 +41,7 @@ mylength = mybase.setDistance( l1.startPointData(), l3.result(), 50 ) # Creating the extrusion -mybox = modeler.addExtrusion( mypart, mybase.selectFace(), 50 ) +mybox = model.addExtrusion( mypart, mybase.selectFace(), 50 ) # Creating a cylinder on a face of the box @@ -52,23 +52,23 @@ thisxmax = "Extrusion_1/LateralFace_2|Extrusion_1/LateralFace_1" thiszmin = "Sketch_1/Edge5_1" thiszmax = "Extrusion_1/LateralFace_2|Extrusion_1/TopFace_1" -mystand = modeler.addSketch( mypart, thisface ) +mystand = model.addSketch( mypart, thisface ) c1 = mystand.addCircle( 0, 25, 5) mystand.setDistance( c1.centerData(), thisxmin, 10 ) mystand.setDistance( c1.centerData(), thiszmax, 10 ) -myboss = modeler.addExtrusion( mypart, mystand.selectFace(c1.result()), -5 ) +myboss = model.addExtrusion( mypart, mystand.selectFace(c1.result()), -5 ) # Subtracting the cylinder to the box -modeler.addSubtraction( mypart, mybox.result(), myboss.result() ) -modeler.end() +model.addSubtraction( mypart, mybox.result(), myboss.result() ) +model.end() # Editing the box -modeler.begin() +model.begin() mybase.setValue( mylength, 100 ) mybox.setSize( 80 ) -modeler.end() +model.end() diff --git a/src/PythonAPI/MakeBrick2.py b/src/PythonAPI/MakeBrick2.py index 24865b532..c3e06e356 100644 --- a/src/PythonAPI/MakeBrick2.py +++ b/src/PythonAPI/MakeBrick2.py @@ -2,24 +2,24 @@ # Author: Daniel Brunier-Coulin # ----------------------------- -import modeler +import model import geom # Initialisation -modeler.begin() -mypartset = modeler.moduleDocument() +model.begin() +mypartset = model.moduleDocument() # Creating a new Part -mypart = modeler.addPart(mypartset).document() +mypart = model.addPart(mypartset).document() # Creating the base of the box -mybase = modeler.addSketch( mypart, modeler.defaultPlane("XOY") ) +mybase = model.addSketch( mypart, model.defaultPlane("XOY") ) p1 = geom.Pnt2d( 0, 0 ) p2 = geom.Pnt2d( 0, 1 ) @@ -38,7 +38,7 @@ mylength = mybase.setDistance( line[0].startPointData(),line[2].result(), 50 ) # Creating the extrusion -mybox = modeler.addExtrusion( mypart, mybase.selectFace(), 50 ) +mybox = model.addExtrusion( mypart, mybase.selectFace(), 50 ) # Creating a cylinder on a face of the box @@ -47,23 +47,23 @@ thisface = "Extrusion_1/LateralFace_2" thisxmin = "Extrusion_1/LateralFace_3|Extrusion_1/LateralFace_2" thiszmax = "Extrusion_1/LateralFace_2|Extrusion_1/TopFace_1" -mystand = modeler.addSketch( mypart, thisface ) +mystand = model.addSketch( mypart, thisface ) circle = mystand.addCircle( 0, 25, 5) mystand.setDistance( circle.centerData(), thisxmin, 10 ) mystand.setDistance( circle.centerData(), thiszmax, 10 ) -myboss = modeler.addExtrusion( mypart, mystand.selectFace(), -5 ) +myboss = model.addExtrusion( mypart, mystand.selectFace(), -5 ) # Subtracting the cylinder to the box -modeler.addSubtraction( mypart, mybox.result(), myboss.result() ) -modeler.end() +model.addSubtraction( mypart, mybox.result(), myboss.result() ) +model.end() # Editing the box -modeler.begin() +model.begin() mybase.setValue( mylength, 100 ) mybox.setSize( 20 ) -modeler.end() +model.end() diff --git a/src/PythonAPI/MakeBrick3.py b/src/PythonAPI/MakeBrick3.py index c3147800e..94fa252d2 100644 --- a/src/PythonAPI/MakeBrick3.py +++ b/src/PythonAPI/MakeBrick3.py @@ -2,23 +2,23 @@ # Author: Daniel Brunier-Coulin # ----------------------------- -import modeler +import model import extension # Initialisation -modeler.begin() -mypartset = modeler.moduleDocument() +model.begin() +mypartset = model.moduleDocument() # Creating a new Part -mypart = modeler.addPart(mypartset).document() +mypart = model.addPart(mypartset).document() # Creating the base of the box extension.addBox( mypart, 10, 20, 30 ) -modeler.end() +model.end() diff --git a/src/PythonAPI/Test/TestModeler.py b/src/PythonAPI/Test/TestModeler.py index 347aa5afe..d76377736 100644 --- a/src/PythonAPI/Test/TestModeler.py +++ b/src/PythonAPI/Test/TestModeler.py @@ -1,18 +1,18 @@ import unittest -import modeler +import model -class ModelerTestCase(unittest.TestCase): +class ModelTestCase(unittest.TestCase): def setUp(self): - modeler.begin() - partset = modeler.moduleDocument() - self.part = modeler.addPart(partset).document() + model.begin() + partset = model.moduleDocument() + self.part = model.addPart(partset).document() def tearDown(self): - modeler.end() + model.end() def test_add_sketch(self): - plane = modeler.defaultPlane("XOY") - modeler.addSketch(self.part, plane) + plane = model.defaultPlane("XOY") + model.addSketch(self.part, plane) if __name__ == "__main__": unittest.main() diff --git a/src/PythonAPI/Test/TestSketcher.py b/src/PythonAPI/Test/TestSketcher.py index f187c28b9..0f62e7aff 100644 --- a/src/PythonAPI/Test/TestSketcher.py +++ b/src/PythonAPI/Test/TestSketcher.py @@ -1,13 +1,13 @@ import unittest -import modeler +import model class SketcherTestCase(unittest.TestCase): def setUp(self): - modeler.begin() - partset = modeler.moduleDocument() - part = modeler.addPart(partset).document() - plane = modeler.defaultPlane("XOY") - self.sketch = modeler.addSketch(part, plane) + model.begin() + partset = model.moduleDocument() + part = model.addPart(partset).document() + plane = model.defaultPlane("XOY") + self.sketch = model.addSketch(part, plane) def tearDown(self): - modeler.end() + model.end() diff --git a/src/PythonAPI/Test/TestSketcherAddArc.py b/src/PythonAPI/Test/TestSketcherAddArc.py index 53c07cfff..87378aef0 100644 --- a/src/PythonAPI/Test/TestSketcherAddArc.py +++ b/src/PythonAPI/Test/TestSketcherAddArc.py @@ -1,8 +1,8 @@ import unittest -import modeler +import model import geom -from modeler import WrongNumberOfArguments +from model import WrongNumberOfArguments from TestSketcher import SketcherTestCase diff --git a/src/PythonAPI/Test/TestSketcherAddCircle.py b/src/PythonAPI/Test/TestSketcherAddCircle.py index ac956e0db..3c45e320f 100644 --- a/src/PythonAPI/Test/TestSketcherAddCircle.py +++ b/src/PythonAPI/Test/TestSketcherAddCircle.py @@ -1,5 +1,5 @@ import unittest -import modeler +import model from TestSketcher import SketcherTestCase class SketcherAddCircle(SketcherTestCase): diff --git a/src/PythonAPI/Test/TestSketcherAddLine.py b/src/PythonAPI/Test/TestSketcherAddLine.py index a0e4a9a28..ce5b31349 100644 --- a/src/PythonAPI/Test/TestSketcherAddLine.py +++ b/src/PythonAPI/Test/TestSketcherAddLine.py @@ -1,5 +1,5 @@ import unittest -import modeler +import model from TestSketcher import SketcherTestCase class SketcherAddLine(SketcherTestCase): diff --git a/src/PythonAPI/Test/TestSketcherAddPoint.py b/src/PythonAPI/Test/TestSketcherAddPoint.py index 8ebdb2314..e521c9a08 100644 --- a/src/PythonAPI/Test/TestSketcherAddPoint.py +++ b/src/PythonAPI/Test/TestSketcherAddPoint.py @@ -1,5 +1,5 @@ import unittest -import modeler +import model from TestSketcher import SketcherTestCase class SketcherAddPoint(SketcherTestCase): diff --git a/src/PythonAPI/Test/TestSketcherSetCoincident.py b/src/PythonAPI/Test/TestSketcherSetCoincident.py index 0b4cae6c3..f6a13e12a 100644 --- a/src/PythonAPI/Test/TestSketcherSetCoincident.py +++ b/src/PythonAPI/Test/TestSketcherSetCoincident.py @@ -1,5 +1,5 @@ import unittest -import modeler +import model from TestSketcher import SketcherTestCase class SketcherSetCoincident(SketcherTestCase): diff --git a/src/PythonAPI/Test/TestSketcherSetParallel.py b/src/PythonAPI/Test/TestSketcherSetParallel.py index d37d02795..0f7fa1844 100644 --- a/src/PythonAPI/Test/TestSketcherSetParallel.py +++ b/src/PythonAPI/Test/TestSketcherSetParallel.py @@ -1,5 +1,5 @@ import unittest -import modeler +import model from TestSketcher import SketcherTestCase class SketcherSetParallel(SketcherTestCase): diff --git a/src/PythonAPI/extension/box.py b/src/PythonAPI/extension/box.py index 957da5412..e0e866c20 100644 --- a/src/PythonAPI/extension/box.py +++ b/src/PythonAPI/extension/box.py @@ -3,15 +3,15 @@ Author: Daniel Brunier-Coulin Copyright (C) 2014-20xx CEA/DEN, EDF R&D """ -import modeler +import model from macros.box.feature import BoxFeature as MY -class Box(modeler.Interface): +class Box(model.Interface): """Executes the macro-feature Box. """ def __init__(self, part, dx, dy, dz): - modeler.Interface.__init__(self, part, MY.ID()) + model.Interface.__init__(self, part, MY.ID()) self.setRealInput( MY.WIDTH_ID(), dx ) self.setRealInput( MY.LENGTH_ID(), dy ) diff --git a/src/PythonAPI/modeler/__init__.py b/src/PythonAPI/model/__init__.py similarity index 100% rename from src/PythonAPI/modeler/__init__.py rename to src/PythonAPI/model/__init__.py diff --git a/src/PythonAPI/modeler/boolean.py b/src/PythonAPI/model/boolean.py similarity index 100% rename from src/PythonAPI/modeler/boolean.py rename to src/PythonAPI/model/boolean.py diff --git a/src/PythonAPI/modeler/errors.py b/src/PythonAPI/model/errors.py similarity index 83% rename from src/PythonAPI/modeler/errors.py rename to src/PythonAPI/model/errors.py index 642af0a51..b848f6058 100644 --- a/src/PythonAPI/modeler/errors.py +++ b/src/PythonAPI/model/errors.py @@ -1,10 +1,10 @@ # Package exceptions -class ModelerError(Exception): +class ModelError(Exception): """Base class for exceptions in this package.""" pass -class WrongNumberOfArguments(ModelerError): +class WrongNumberOfArguments(ModelError): """Exception raised when a wrong number of arguments is given.""" pass diff --git a/src/PythonAPI/modeler/extrusion.py b/src/PythonAPI/model/extrusion.py similarity index 100% rename from src/PythonAPI/modeler/extrusion.py rename to src/PythonAPI/model/extrusion.py diff --git a/src/PythonAPI/modeler/part.py b/src/PythonAPI/model/part.py similarity index 77% rename from src/PythonAPI/modeler/part.py rename to src/PythonAPI/model/part.py index 597d1cc75..560f76a37 100644 --- a/src/PythonAPI/modeler/part.py +++ b/src/PythonAPI/model/part.py @@ -3,7 +3,7 @@ Author: Daniel Brunier-Coulin Copyright (C) 2014-20xx CEA/DEN, EDF R&D """ -import modeler # Required by the temporary implementation of result member function +import model # Required by the temporary implementation of result member function class Part(): @@ -16,4 +16,4 @@ class Part(): def document (self): """Returns the Part document created by this feature.""" #TODO: Get the document referenced by this feature - return modeler.activeDocument() \ No newline at end of file + return model.activeDocument() \ No newline at end of file diff --git a/src/PythonAPI/modeler/roots.py b/src/PythonAPI/model/roots.py similarity index 100% rename from src/PythonAPI/modeler/roots.py rename to src/PythonAPI/model/roots.py diff --git a/src/PythonAPI/modeler/services.py b/src/PythonAPI/model/services.py similarity index 100% rename from src/PythonAPI/modeler/services.py rename to src/PythonAPI/model/services.py diff --git a/src/PythonAPI/modeler/sketcher/__init__.py b/src/PythonAPI/model/sketcher/__init__.py similarity index 100% rename from src/PythonAPI/modeler/sketcher/__init__.py rename to src/PythonAPI/model/sketcher/__init__.py diff --git a/src/PythonAPI/modeler/sketcher/arc.py b/src/PythonAPI/model/sketcher/arc.py similarity index 97% rename from src/PythonAPI/modeler/sketcher/arc.py rename to src/PythonAPI/model/sketcher/arc.py index 853ceb6c9..8e1bb1a50 100644 --- a/src/PythonAPI/modeler/sketcher/arc.py +++ b/src/PythonAPI/model/sketcher/arc.py @@ -1,7 +1,7 @@ """Sketch circle feature interface.""" from GeomDataAPI import geomDataAPI_Point2D -from modeler.errors import WrongNumberOfArguments +from model.errors import WrongNumberOfArguments class Arc(): def __init__(self, arc_feature, *args): diff --git a/src/PythonAPI/modeler/sketcher/circle.py b/src/PythonAPI/model/sketcher/circle.py similarity index 100% rename from src/PythonAPI/modeler/sketcher/circle.py rename to src/PythonAPI/model/sketcher/circle.py diff --git a/src/PythonAPI/modeler/sketcher/line.py b/src/PythonAPI/model/sketcher/line.py similarity index 100% rename from src/PythonAPI/modeler/sketcher/line.py rename to src/PythonAPI/model/sketcher/line.py diff --git a/src/PythonAPI/modeler/sketcher/point.py b/src/PythonAPI/model/sketcher/point.py similarity index 100% rename from src/PythonAPI/modeler/sketcher/point.py rename to src/PythonAPI/model/sketcher/point.py diff --git a/src/PythonAPI/modeler/sketcher/sketch.py b/src/PythonAPI/model/sketcher/sketch.py similarity index 98% rename from src/PythonAPI/modeler/sketcher/sketch.py rename to src/PythonAPI/model/sketcher/sketch.py index 5e9c1d5d3..30ddbfedc 100644 --- a/src/PythonAPI/modeler/sketcher/sketch.py +++ b/src/PythonAPI/model/sketcher/sketch.py @@ -6,10 +6,10 @@ Copyright (C) 2014-20xx CEA/DEN, EDF R&D from ModelAPI import * from GeomDataAPI import * from GeomAlgoAPI import * -from modeler.sketcher.point import Point -from modeler.sketcher.line import Line -from modeler.sketcher.circle import Circle -from modeler.sketcher.arc import Arc +from model.sketcher.point import Point +from model.sketcher.line import Line +from model.sketcher.circle import Circle +from model.sketcher.arc import Arc def addSketch(doc, plane): """Add a Sketch feature to the Part or PartSet and return an interface -- 2.39.2