STRING(REPLACE ";" "\\;" _PYTHONPATH "${_PYTHONPATH}")
else()
SET(_LD_LIBRARY_PATH "${CMAKE_INSTALL_PREFIX}/bin:${CMAKE_INSTALL_PREFIX}/swig:${CMAKE_INSTALL_PREFIX}/plugins:${SUIT_LIB_DIR}:$ENV{LD_LIBRARY_PATH}")
- SET(_PYTHONPATH "${CMAKE_INSTALL_PREFIX}/swig:${CMAKE_INSTALL_PREFIX}/plugins:${CMAKE_INSTALL_PREFIX}/addons:${CMAKE_INSTALL_PREFIX}/pythonAPI:$ENV{PYTHONPATH}")
+ SET(_PYTHONPATH "${CMAKE_BINARY_DIR}:${CMAKE_INSTALL_PREFIX}/swig:${CMAKE_INSTALL_PREFIX}/pythonAPI:$ENV{PYTHONPATH}")
endif()
SET(_CONFIG_FILE "${CMAKE_INSTALL_PREFIX}/plugins")
ENDIF(CMAKE_COMPILER_IS_GNUCC)
ENDIF(UNIX)
+SET (PYTHON_PACKAGE_NAME shaper)
+#SET (PYTHON_PACKAGE_NAME openparts)
+SET (PYTHONAPI_DIR PythonAPI/${PYTHON_PACKAGE_NAME})
+
#IF(CMAKE_BUILD_TYPE MATCHES Release)
ADD_SUBDIRECTORY (doc)
#ENDIF(CMAKE_BUILD_TYPE MATCHES Release)
#------ NewGEOM ------
export PATH=${NEWGEOM_ROOT_DIR}/bin:${NEWGEOM_ROOT_DIR}/plugins:${PATH}
-export PYTHONPATH=${NEWGEOM_ROOT_DIR}/swig:${NEWGEOM_ROOT_DIR}/plugins:${NEWGEOM_ROOT_DIR}/addons:${NEWGEOM_ROOT_DIR}/PythonAPI:${PYTHONPATH}
+
+export PYTHONPATH=${NEWGEOM_ROOT_DIR}/swig:${PYTHONPATH}
+#export PYTHONPATH=${NEWGEOM_ROOT_DIR}/plugins:${PYTHONPATH}
+#export PYTHONPATH=${NEWGEOM_ROOT_DIR}/addons:${PYTHONPATH}
+export PYTHONPATH=${NEWGEOM_ROOT_DIR}/PythonAPI:${PYTHONPATH}
+
export LD_LIBRARY_PATH=${NEWGEOM_ROOT_DIR}/bin:${NEWGEOM_ROOT_DIR}/swig:${NEWGEOM_ROOT_DIR}/plugins:${LD_LIBRARY_PATH}
export NEW_GEOM_CONFIG_FILE=${NEWGEOM_ROOT_DIR}/plugins
export NewGeomResources=${NEWGEOM_ROOT_DIR}/resources
+
<plugin library="ConstructionPlugin" configuration="plugin-Construction.xml"/>
<plugin library="FeaturesPlugin" configuration="plugin-Features.xml"/>
<plugin library="ExchangePlugin" configuration="plugin-Exchange.xml"/>
- <plugin script="addons_Features" configuration="addons_Features.xml"/>
- <plugin script="ConnectorPlugin" configuration="plugin-Connector.xml" dependency="Geometry"/>
+ <plugin script="@PYTHON_PACKAGE_NAME@.plugins.addons_Features" configuration="addons_Features.xml"/>
+ <plugin script="@PYTHON_PACKAGE_NAME@.plugins.ConnectorPlugin" configuration="plugin-Connector.xml" dependency="Geometry"/>
<plugin library="ParametersPlugin" configuration="plugin-Parameters.xml"/>
@DEFAULT_SOLVER@
<!--
ADD_CUSTOM_TARGET(ConnectorPlugin SOURCES ${PYTHON_FILES} ${XML_RESSOURCES})
-INSTALL(FILES ${PYTHON_FILES} ${XML_RESSOURCES} DESTINATION plugins)
+INSTALL(FILES ${PYTHON_FILES} DESTINATION ${PYTHONAPI_DIR}/plugins)
+INSTALL(FILES ${XML_RESSOURCES} DESTINATION plugins)
SET(CMAKE_AUTOMOC ON)
-INSTALL(DIRECTORY extension geom model examples DESTINATION PythonAPI)
-INSTALL(FILES shaper.py DESTINATION PythonAPI)
+# configuration
+CONFIGURE_FILE(
+ "${CMAKE_CURRENT_SOURCE_DIR}/Test/config.py.in"
+ "${CMAKE_BINARY_DIR}/config.py"
+ )
+
+INSTALL(DIRECTORY extension geom model examples plugins DESTINATION ${PYTHONAPI_DIR})
+INSTALL(FILES __init__.py DESTINATION ${PYTHONAPI_DIR})
# --------- Unit tests -----------
INCLUDE(UnitTest)
import ModelAPI
-import model
+from config import model
#-----------------------------------------------------------------------------
# Fixtures
import ModelAPI
-import model
+from config import model
#-----------------------------------------------------------------------------
# Fixtures
import ModelAPI
-import model
-from model.tools import Selection
+from config import model
+# from config.model.tools import Selection
#-----------------------------------------------------------------------------
# Fixtures
model.do()
base = base_sketch.selectFace(circle.lastResult())
- axis_object = Selection(axis_sketch.firstResult(),
- line.firstResult().shape())
+ axis_object = model.Selection(axis_sketch.firstResult(),
+ line.firstResult().shape())
self.revolution = model.addRevolution(self.part, base, axis_object,
0, 180)
model.do()
base = base_sketch.selectFace(circle.lastResult())
- axis_object = Selection(axis_sketch.firstResult(),
- line.firstResult().shape())
+ axis_object = model.Selection(axis_sketch.firstResult(),
+ line.firstResult().shape())
revolution = model.addRevolution(self.part, base, axis_object,
0, 180)
model.do()
base = base_sketch.selectFace(base_circle.result())
- axis_object = Selection(axis_sketch.firstResult(),
- line.firstResult().shape())
+ axis_object = model.Selection(axis_sketch.firstResult(),
+ line.firstResult().shape())
to_obejct = to_sketch.selectFace(to_circle.result())[0]
from_object = from_sketch.selectFace(from_circle.result())[0]
model.do()
base = base_sketch.selectFace(base_circle.result())
- axis_object = Selection(axis_sketch.firstResult(),
- line.firstResult().shape())
+ axis_object = model.Selection(axis_sketch.firstResult(),
+ line.firstResult().shape())
to_obejct = to_sketch.selectFace(to_circle.result())[0]
from_object = from_sketch.selectFace(from_circle.result())[0]
import unittest
-import examples.MakeBrick1
+from config import examples
+
+class MakeBrick1TestCase(unittest.TestCase):
+ def test_main(self):
+ examples.MakeBrick1.main()
if __name__ == "__main__":
unittest.main()
import unittest
-import examples.MakeBrick2
+from config import examples
+
+class MakeBrick2TestCase(unittest.TestCase):
+ def test_main(self):
+ examples.MakeBrick2.main()
if __name__ == "__main__":
unittest.main()
import unittest
-import examples.MakeBrick3
+from config import examples
+
+class MakeBrick3TestCase(unittest.TestCase):
+ def test_main(self):
+ examples.MakeBrick3.main()
if __name__ == "__main__":
unittest.main()
import unittest
-import model
+from config import model
class ModelTestCase(unittest.TestCase):
def setUp(self):
import unittest
-import examples.Platine
+from config import examples
+
+class PlatineTestCase(unittest.TestCase):
+ def test_main(self):
+ examples.Platine.main()
if __name__ == "__main__":
unittest.main()
import unittest
-import model
-import geom
+from config import model
+from config import geom
if __name__ == "__main__":
unittest.main()
import unittest
-import model
+from config import model
# Delta value for almost equal comparisons
DELTA = 1e-10
import unittest
-import model
-import geom
-from model import WrongNumberOfArguments
+from config import model
+from config import geom
from TestSketcher import SketcherTestCase
self.assertEqual(arc.startPoint().y(), 0)
def test_number_of_args(self):
- with self.assertRaises(WrongNumberOfArguments):
+ with self.assertRaises(model.WrongNumberOfArguments):
self.sketch.addArc(0, 1, 1, 1)
- with self.assertRaises(WrongNumberOfArguments):
+ with self.assertRaises(model.WrongNumberOfArguments):
self.sketch.addArc(0, 1)
def test_modify_arc(self):
import unittest
-import model
+from config import model
from TestSketcher import SketcherTestCase
class SketcherAddCircle(SketcherTestCase):
import unittest
-import model
+from config import model
from TestSketcher import SketcherTestCase
class SketcherAddLine(SketcherTestCase):
import unittest
-import model
+from config import model
from TestSketcher import SketcherTestCase
from ModelAPI import *
from GeomDataAPI import geomDataAPI_Point2D
import unittest
-import model
+from config import model
from TestSketcher import SketcherTestCase
class SketcherAddPoint(SketcherTestCase):
import unittest
-import model
+from config import model
import math
import TestSketcher
from TestSketcher import SketcherTestCase
import unittest
-import model
+from config import model
from TestSketcher import SketcherTestCase
class SketcherSetCoincident(SketcherTestCase):
import unittest
-import model
+from config import model
import math
import TestSketcher
from TestSketcher import SketcherTestCase
import unittest
-import model
+from config import model
from TestSketcher import SketcherTestCase
class SketcherSetFillet(SketcherTestCase):
import unittest
-import model
+from config import model
from TestSketcher import SketcherTestCase
class SketcherSetHorizontal(SketcherTestCase):
import unittest
-import model
+from config import model
import math
import TestSketcher
from TestSketcher import SketcherTestCase
import unittest
-import model
+from config import model
from TestSketcher import SketcherTestCase
class SketcherSetParallel(SketcherTestCase):
import unittest
-import model
+from config import model
import TestSketcher
from TestSketcher import SketcherTestCase
import unittest
-import model
+from config import model
from TestSketcher import SketcherTestCase
class SketcherSetRadius(SketcherTestCase):
import unittest
-import model
+from config import model
from TestSketcher import SketcherTestCase
class SketcherSetRigid(SketcherTestCase):
import unittest
-import model
+from config import model
from TestSketcher import SketcherTestCase
class SketcherSetTangent(SketcherTestCase):
import unittest
-import model
+from config import model
from TestSketcher import SketcherTestCase
class SketcherSetVertical(SketcherTestCase):
--- /dev/null
+from @PYTHON_PACKAGE_NAME@ import geom, model
+from @PYTHON_PACKAGE_NAME@ import examples
--- /dev/null
+"""This package defines the Python API of the Shaper.
+"""
+
+# Main packages
+
+from . import geom
+from . import model
# Author: Daniel Brunier-Coulin
# -----------------------------
-import model
+from .. import model
+def main():
+ # Initialisation
-# Initialisation
+ model.begin()
+ mypartset = model.moduleDocument()
-model.begin()
-mypartset = model.moduleDocument()
+ # Creating a new Part
-# Creating a new Part
+ mypart = model.addPart(mypartset).document()
-mypart = model.addPart(mypartset).document()
+ # Creating the base of the box
-# Creating the base of the box
+ mybase = model.addSketch(mypart, model.defaultPlane("XOY"))
-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)
-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.endPoint(), l2.startPoint())
+ mybase.setCoincident(l2.endPoint(), l3.startPoint())
+ mybase.setCoincident(l3.endPoint(), l4.startPoint())
+ mybase.setCoincident(l4.endPoint(), l1.startPoint())
-mybase.setCoincident(l1.endPoint(), l2.startPoint())
-mybase.setCoincident(l2.endPoint(), l3.startPoint())
-mybase.setCoincident(l3.endPoint(), l4.startPoint())
-mybase.setCoincident(l4.endPoint(), l1.startPoint())
+ mybase.setParallel(l1.result(), l3.result())
+ mybase.setParallel(l2.result(), l4.result())
-mybase.setParallel(l1.result(), l3.result())
-mybase.setParallel(l2.result(), l4.result())
+ mybase.setPerpendicular(l1.result(), l4.result())
-mybase.setPerpendicular(l1.result(), l4.result())
+ mywidth = mybase.setLength(l1.result(), 50)
+ mylength = mybase.setDistance(l1.startPoint(), l3.result(), 50)
-mywidth = mybase.setLength(l1.result(), 50)
-mylength = mybase.setDistance(l1.startPoint(), l3.result(), 50)
+ # Creating the extrusion
-# Creating the extrusion
+ mybox = model.addExtrusion(mypart, mybase.selectFace(), 50)
-mybox = model.addExtrusion(mypart, mybase.selectFace(), 50)
+ # Creating a cylinder on a face of the box
-# 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"
-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)
-mystand = model.addSketch(mypart, thisface)
+ c1 = mystand.addCircle(0, 25, 5)
+ mystand.setDistance(c1.center(), thisxmin, 10)
+ mystand.setDistance(c1.center(), thiszmax, 10)
-c1 = mystand.addCircle(0, 25, 5)
-mystand.setDistance(c1.center(), thisxmin, 10)
-mystand.setDistance(c1.center(), thiszmax, 10)
+ myboss = model.addExtrusion(mypart, mystand.selectFace(c1.result()), -5)
-myboss = model.addExtrusion(mypart, mystand.selectFace(c1.result()), -5)
+ # Subtracting the cylinder to the box
-# Subtracting the cylinder to the box
+ model.addSubtraction(mypart, mybox.result(), myboss.result())
+ model.end()
-model.addSubtraction(mypart, mybox.result(), myboss.result())
-model.end()
+ # Editing the box
-# Editing the box
+ model.begin()
+ mybase.setValue(mylength, 100)
+ mybox.setSize(80)
+ model.end()
-model.begin()
-mybase.setValue(mylength, 100)
-mybox.setSize(80)
-model.end()
+if __name__ == '__main__':
+ main()
\ No newline at end of file
# Author: Daniel Brunier-Coulin
# -----------------------------
-import model
-import geom
+from .. import model
+from .. import geom
+def main():
+ # Initialisation
-# Initialisation
+ model.begin()
+ mypartset = model.moduleDocument()
-model.begin()
-mypartset = model.moduleDocument()
+ # Creating a new Part
-# Creating a new Part
+ mypart = model.addPart(mypartset).document()
-mypart = model.addPart(mypartset).document()
+ # Creating the base of the box
-# Creating the base of the box
+ mybase = model.addSketch(mypart, model.defaultPlane("XOY"))
-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)
-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)
-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())
-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].startPoint(), line[2].result(), 50)
-mywidth = mybase.setLength(line[0].result(), 50)
-mylength = mybase.setDistance(line[0].startPoint(), line[2].result(), 50)
+ # Creating the extrusion
-# Creating the extrusion
+ mybox = model.addExtrusion(mypart, mybase.selectFace(), 50)
-mybox = model.addExtrusion(mypart, mybase.selectFace(), 50)
+ # Creating a cylinder on a face of the box
-# 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"
-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.center(), thisxmin, 10)
+ mystand.setDistance(circle.center(), thiszmax, 10)
-mystand = model.addSketch(mypart, thisface)
-circle = mystand.addCircle(0, 25, 5)
-mystand.setDistance(circle.center(), thisxmin, 10)
-mystand.setDistance(circle.center(), thiszmax, 10)
+ myboss = model.addExtrusion(mypart, mystand.selectFace(), -5)
-myboss = model.addExtrusion(mypart, mystand.selectFace(), -5)
+ # Subtracting the cylinder to the box
-# Subtracting the cylinder to the box
+ model.addSubtraction(mypart, mybox.result(), myboss.result())
+ model.end()
-model.addSubtraction(mypart, mybox.result(), myboss.result())
-model.end()
+ # Editing the box
-# Editing the box
+ model.begin()
+ mybase.setValue(mylength, 100)
+ mybox.setSize(20)
+ model.end()
-model.begin()
-mybase.setValue(mylength, 100)
-mybox.setSize(20)
-model.end()
+if __name__ == '__main__':
+ main()
# Author: Daniel Brunier-Coulin
# -----------------------------
-import model
-import extension
+from .. import model
+from .. import extension
+def main():
+ # Initialisation
-# Initialisation
+ model.begin()
+ mypartset = model.moduleDocument()
-model.begin()
-mypartset = model.moduleDocument()
+ # Creating a new Part
-# Creating a new Part
+ mypart = model.addPart(mypartset).document()
-mypart = model.addPart(mypartset).document()
+ # Creating the base of the box
-# Creating the base of the box
-
-extension.addBox( mypart, 10, 20, 30 )
-model.end()
+ extension.addBox(mypart, 10, 20, 30)
+ model.end()
+if __name__ == '__main__':
+ main()
# Author: Sergey POKHODENKO
# -----------------------------
-import geom
-import model
-
-# Initialisation
-model.begin()
-partset = model.moduleDocument()
-
-# Create a new Part
-part = model.addPart(partset).document()
+from .. import geom
+from .. import model
L = 64
E = 16
P = 80
-# Create Parameters
-model.addParameter(part, "L", L)
-model.addParameter(part, "E", E)
-model.addParameter(part, "P", P)
-
-def vertical_body():
+def vertical_body(part):
# Create YOZ sketch
sketch = model.addSketch(part, model.defaultPlane("YOZ"))
return body
-def bottom_body():
+def bottom_body(part):
# Create XOY sketch
sketch = model.addSketch(part, "Extrusion_1_1/LateralFace_2")
return body
-def body_3():
+def body_3(part):
# Create XOZ sketch
sketch = model.addSketch(part, "Boolean_1_1/Modified_3")
return body
-def body_4():
+def body_4(part):
# Create XOZ 2nd sketch
sketch = model.addSketch(part, "Boolean_2_1/Modified_7")
return body
+def main():
+ # Initialisation
+ model.begin()
+ partset = model.moduleDocument()
-b1 = vertical_body()
-b2 = bottom_body()
+ # Create a new Part
+ part = model.addPart(partset).document()
-boolean = model.addAddition(part, b1.result() + b2.result())
-model.do()
+ # Create Parameters
+ model.addParameter(part, "L", L)
+ model.addParameter(part, "E", E)
+ model.addParameter(part, "P", P)
-b3 = body_3()
+ b1 = vertical_body(part)
+ b2 = bottom_body(part)
+
+ boolean = model.addAddition(part, b1.result() + b2.result())
+ model.do()
-boolean = model.addAddition(part, boolean.result() + b3.result())
-model.do()
+ b3 = body_3(part)
-b4 = body_4()
+ boolean = model.addAddition(part, boolean.result() + b3.result())
+ model.do()
+
+ b4 = body_4(part)
+
+ boolean = model.addAddition(part, boolean.result() + b4.result())
+ model.do()
-boolean = model.addAddition(part, boolean.result() + b4.result())
-model.do()
+if __name__ == '__main__':
+ main()
+import MakeBrick1
+import MakeBrick2
+import MakeBrick3
+import Platine
Copyright (C) 2014-20xx CEA/DEN, EDF R&D
"""
-from model import Interface
-from macros.box.feature import BoxFeature as MY
+from ..model import Interface
+from ..addons.macros.box.feature import BoxFeature as MY
def addBox(part, *args):
Copyright (C) 2014-20xx CEA/DEN, EDF R&D
"""
-from model.roots import Interface
+from ...model.roots import Interface
def exportToGEOM(part):
Copyright (C) 2014-20xx CEA/DEN, EDF R&D
"""
-from model.roots import Interface
+from ...model.roots import Interface
def addAxis(part, *args):
Copyright (C) 2014-20xx CEA/DEN, EDF R&D
"""
-from model.roots import Interface
+from ...model.roots import Interface
def addPlane(part, *args):
Copyright (C) 2014-20xx CEA/DEN, EDF R&D
"""
-from model.roots import Interface
+from ...model.roots import Interface
def addPoint(part, *args):
Copyright (C) 2014-20xx CEA/DEN, EDF R&D
"""
-from model.roots import Interface
+from ...model.roots import Interface
def addImport(part, *args):
from GeomAlgoAPI import GeomAlgoAPI_Boolean
-from model.roots import Interface
-from model import Selection
+from ...model.roots import Interface
+from ...model import Selection
def addAddition(part, *args):
"""Perform addition in the Part.
Args:
part (ModelAPI_Document): part document
- main_objects (list of :class:`model.Selection`): main objects
- tool_objects (list of :class:`model.Selection`): (optional) tool_objects objects
+ main_objects (list of :class:`...model.Selection`): main objects
+ tool_objects (list of :class:`...model.Selection`): (optional) tool_objects objects
Returns:
Boolean: boolean object
Args:
part (ModelAPI_Document): part document
- main_objects (list of :class:`model.Selection`): main objects
- tool_objects (list of :class:`model.Selection`): tool_objects objects
+ main_objects (list of :class:`...model.Selection`): main objects
+ tool_objects (list of :class:`...model.Selection`): tool_objects objects
Returns:
Boolean: boolean object
Args:
part (ModelAPI_Document): part document
- main_objects (list of :class:`model.Selection`): main objects
- tool_objects (list of :class:`model.Selection`): tool_objects objects
+ main_objects (list of :class:`...model.Selection`): main objects
+ tool_objects (list of :class:`...model.Selection`): tool_objects objects
Returns:
Boolean: boolean object
"""Modify main_objects attribute of the feature.
Args:
- main_objects (list of :class:`model.Selection`): main objects
+ main_objects (list of :class:`...model.Selection`): main objects
"""
self._fillAttribute(self._main_objects, main_objects)
pass
"""Modify tool_objects attribute of the feature.
Args:
- tool_objects (list of :class:`model.Selection`): tool objects
+ tool_objects (list of :class:`...model.Selection`): tool objects
"""
self._fillAttribute(self._tool_objects, tool_objects)
pass
Copyright (C) 2014-20xx CEA/DEN, EDF R&D
"""
-from model.roots import Interface
-from model import Selection
+from ...model.roots import Interface
+from ...model import Selection
def addExtrusion(part, *args):
"""Add an Extrusion feature to the Part and return Extrusion.
See __init__.
"""
- # MPV: with "clear" calling here the extrusion all the time becomes modificed (height is set to
+ # MPV: with "clear" calling here the extrusion all the time becomes modificed (height is set to
# zero and then to actual value, but this function is used in macro Bax, that causes "modified"
# values without changes that causes cyclic dependency
- #self.__clear()
+ # self.__clear()
self._fillAttribute(self._CreationMethod, "BySizes")
self._fillAttribute(self._to_size, to_size)
self._fillAttribute(self._from_size, from_size)
Copyright (C) 2014-20xx CEA/DEN, EDF R&D
"""
-from model.roots import Interface
+from ...model.roots import Interface
def addGroup(part, *args):
Copyright (C) 2014-20xx CEA/DEN, EDF R&D
"""
-from model.roots import Interface
+from ...model.roots import Interface
def addPartition(part, *args):
Copyright (C) 2014-20xx CEA/DEN, EDF R&D
"""
-from model.roots import Interface
+from ...model.roots import Interface
def addPlacement(part, *args):
Copyright (C) 2014-20xx CEA/DEN, EDF R&D
"""
-from model.roots import Interface
+from ...model.roots import Interface
def addRevolution(part, *args):
-from model.roots import Interface
+from ...model.roots import Interface
class CompositeBoolean(Interface):
Copyright (C) 2014-20xx CEA/DEN, EDF R&D
"""
-from model.roots import Interface
+from ...model.roots import Interface
def addRotation(part, *args):
Copyright (C) 2014-20xx CEA/DEN, EDF R&D
"""
-from model.roots import Interface
+from ...model.roots import Interface
def addTranslation(part, *args):
Copyright (C) 2014-20xx CEA/DEN, EDF R&D
"""
-from model.roots import Interface
+from ...model.roots import Interface
def addParameter(part, *args):
import ModelAPI
-from model.roots import Interface
+from ...model.roots import Interface
def addPart(partset):
import ModelAPI
-from model import tools
+from . import tools
class Feature(ModelAPI.ModelAPI_Feature):
import ModelAPI
import GeomAPI
-import geom # To be removed when gp_Ax3 will be Pythonized
+from .. import geom # To be removed when gp_Ax3 will be Pythonized
def moduleDocument ():
"""Sketch circle feature interface."""
from GeomDataAPI import geomDataAPI_Point2D
-from model.errors import WrongNumberOfArguments
-from model.roots import Interface
+from ...model.errors import WrongNumberOfArguments
+from ...model.roots import Interface
class Arc(Interface):
"""Interface to a sketch arc feature."""
"""Sketch circle feature interface."""
from GeomDataAPI import geomDataAPI_Point2D
-from model.roots import Interface
+from ...model.roots import Interface
class Circle(Interface):
"""Interface for circle feature data manipulation."""
def __init__(self, feature, *args):
Interface.__init__(self, feature)
assert(self._feature.getKind() == "SketchCircle")
-
+
self._center = geomDataAPI_Point2D(
self._feature.data().attribute("CircleCenter")
)
self._radius = self._feature.data().real("CircleRadius")
-
+
if not args:
return
-
+
if len(args) != 3:
raise TypeError(
- "Invalid number of arguments, 3 arguments needed (%s given)"
+ "Invalid number of arguments, 3 arguments needed (%s given)"
% len(args)
)
-
+
self.setCenter(args[0], args[1])
self.setRadius(args[2])
self.execute()
def setCenter(self, x, y):
"""Set the center of the circle."""
self._center.setValue(x, y)
-
+
def setRadius(self, radius):
"""Set the radius of the circle."""
self._radius.setValue(radius)
-
+
def center(self):
"""Return the center attribute of the circle."""
return self._center
def radius(self):
"""Return the radius value.
-
+
:return: radius
:rtype: double
"""
-from model.roots import Interface
+from ...model.roots import Interface
class Entity(Interface):
"""Interface for editing of a sketch entity feature."""
from GeomDataAPI import geomDataAPI_Point2D
-from model.roots import Interface
-from model.errors import WrongNumberOfArguments
+from ...model.roots import Interface
+from ...model.errors import WrongNumberOfArguments
from .entity import Entity
from GeomDataAPI import geomDataAPI_Point2D
from ModelAPI import ModelAPI_Feature
-from model.roots import Interface
-from model.errors import FeatureInputInvalid
+from ...model.roots import Interface
+from ...model.errors import FeatureInputInvalid
class Mirror(Interface):
"""Interface on mirror constraint for data manipulation."""
def __init__(self, feature, mirror_line, *mirror_objects):
Interface.__init__(self, feature)
assert(self._feature.getKind() == "SketchConstraintMirror")
-
+
self._feature.data().refattr("ConstraintEntityA").setObject(mirror_line)
self._feature.data().reflist("ConstraintEntityB").clear()
for object_ in mirror_objects:
"""Sketch point feature interface."""
from GeomDataAPI import geomDataAPI_Point2D
-from model.roots import Interface
-from model.errors import FeatureInputInvalid
+from ...model.roots import Interface
+from ...model.errors import FeatureInputInvalid
class Point(Interface):
"""Interface on point feature for data manipulation."""
def __init__(self, feature, x, y):
Interface.__init__(self, feature)
assert(self._feature.getKind() == "SketchPoint")
-
+
# Initialize attributes of the feature
self._point_data = geomDataAPI_Point2D(
self._feature.data().attribute("PointCoordindates")
.. doctest::
- >>> import model
+ >>> from shaper import model
>>> model.begin()
>>> partset = model.moduleDocument()
>>> part = model.addPart(partset).document()
from GeomDataAPI import geomDataAPI_Point, geomDataAPI_Dir
from GeomAlgoAPI import GeomAlgoAPI_SketchBuilder, ShapeList
-from model.sketcher.point import Point
-from model.sketcher.line import Line
-from model.sketcher.circle import Circle
-from model.sketcher.arc import Arc
-from model.sketcher.mirror import Mirror
-from model.roots import Interface
-from model.tools import Selection
+from ...model.sketcher.point import Point
+from ...model.sketcher.line import Line
+from ...model.sketcher.circle import Circle
+from ...model.sketcher.arc import Arc
+from ...model.sketcher.mirror import Mirror
+from ...model.roots import Interface
+from ...model.tools import Selection
def addSketch(document, plane):
+++ /dev/null
-"""This package defines the Python API of the Shaper.
-"""
-
-# Main packages
-
-import geom
-import model
SET(CMAKE_AUTOMOC ON)
-INSTALL(FILES addons_Features.py addons_Features.xml DESTINATION plugins)
+# configuration
+CONFIGURE_FILE(
+ "${CMAKE_CURRENT_SOURCE_DIR}/addons_Features.xml.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/addons_Features.xml"
+ )
+INSTALL(FILES addons_Features.py DESTINATION ${PYTHONAPI_DIR}/plugins)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/addons_Features.xml DESTINATION plugins)
-INSTALL(FILES __init__.py DESTINATION addons)
-INSTALL(DIRECTORY macros DESTINATION addons)
+INSTALL(FILES __init__.py DESTINATION ${PYTHONAPI_DIR}/addons)
+INSTALL(DIRECTORY macros DESTINATION ${PYTHONAPI_DIR}/addons)
"""
import ModelAPI
-from macros.box.feature import BoxFeature
+from ..addons.macros.box.feature import BoxFeature
class PythonFeaturesPlugin(ModelAPI.ModelAPI_Plugin):
+++ /dev/null
-<plugin>
- <source path="../addons/macros/box/widget.xml"/>
-</plugin>
--- /dev/null
+<plugin>
+ <source path="../@PYTHONAPI_DIR@/addons/macros/box/widget.xml"/>
+</plugin>
\ No newline at end of file
Copyright (C) 2014-20xx CEA/DEN, EDF R&D
"""
-import model
-import geom
+from .... import model
+from .... import geom
class BoxFeature(model.Feature):