SET(CMAKE_AUTOMOC ON)
-INSTALL(DIRECTORY extension geom model examples DESTINATION ${SHAPER_INSTALL_PYTHON_API})
+INSTALL(DIRECTORY geom model examples DESTINATION ${SHAPER_INSTALL_PYTHON_API})
INSTALL(FILES shaper.py DESTINATION ${SHAPER_INSTALL_PYTHON_API})
# --------- Unit tests -----------
FeaturesAPI.FeaturesAPI_Placement(self.part.addFeature("Placement"))
FeaturesAPI.FeaturesAPI_Rotation(self.part.addFeature("Rotation"))
FeaturesAPI.FeaturesAPI_Translation(self.part.addFeature("Translation"))
- FeaturesAPI.FeaturesAPI_Group(self.part.addFeature("Group"))
+
+ import CollectionAPI
+ CollectionAPI.CollectionAPI_Group(self.part.addFeature("Group"))
import PrimitivesAPI
PrimitivesAPI.PrimitivesAPI_Box(self.part.addFeature("Box"))
+++ /dev/null
-"""User-defined features.
-"""
-
-from box import addBoxScript
\ No newline at end of file
+++ /dev/null
-"""Box macro-feature Interface
-Author: Daniel Brunier-Coulin
-Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-"""
-
-from model import Interface
-from macros.box.feature import BoxFeature as MY
-
-
-def addBoxScript(part, *args):
- """Add Box feature to the part and return Box.
-
- Pass all args to Box __init__ function.
- """
- feature = part.addFeature(MY.ID())
- return Box(feature, *args)
-
-
-class Box(Interface):
- """Executes the macro-feature Box.
-
- Box(feature) -> feature interface without initialization
- Extrusion(feature, dx, dy, dz) ->
- feature interface initialized from arguments:
- - dx, dy, dz -- box dimensions
- """
-
- def __init__(self, feature, *args):
- """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
- Interface.__init__(self, feature)
- assert(self._feature.getKind() == MY.ID())
-
- self._width = self._feature.real(MY.WIDTH_ID())
- self._length = self._feature.real(MY.LENGTH_ID())
- self._height = self._feature.real(MY.HEIGHT_ID())
-
- assert(self._width)
- assert(self._length)
- assert(self._height)
-
- if not args:
- return
-
- assert(len(args) == 3)
- dx, dy, dz = args
- self.setWidth(dx)
- self.setLength(dy)
- self.setHeight(dz)
-
- self.execute()
- pass
-
- def setWidth(self, width):
- """B.setWidth(float) -- modify width attribute"""
- self._width.setValue(width)
- pass
-
- def setLength(self, length):
- """B.setLength(float) -- modify length attribute"""
- self._length.setValue(length)
- pass
-
- def setHeight(self, height):
- """B.setHeight(float) -- modify height attribute"""
- self._height.setValue(height)
- pass
from GeomAlgoAPI import GeomAlgoAPI_Boolean as Boolean
-
-# Emulation of interfaces not yet swigged
-
-from missed import *
\ No newline at end of file
+++ /dev/null
-# Direct Geometry API not yet swigged
-# Author: Daniel Brunier-Coulin
-# -----------------------------
-
-#from GeomAPI import *
-
-
-class Ax3:
- """A class to represent a Coordinate system object"""
-
- def __init__(self, origin, normal, dirx):
- """Constructor"""
- ### Create an origin point
- self.o = origin
- ### Create a normal vector
- self.n = normal
- ### Create X axis direction
- self.dx = dirx
-
- def location (self):
- """Returns origin point"""
- return self.o
-
- def direction (self):
- """Returns normal direction"""
- return self.n
-
- def xDirection (self):
- """Returns direction of X axis"""
- return self.dx
-
- def yDirection (self):
- """Returns direction of Y axis"""
- return self.n.cross(self.dx)
body.store(shape)
self.setResult(body)
-
-class Interface():
- """Base class of high level Python interfaces to features."""
-
- def __init__(self, feature):
- """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
- self._feature = feature
-
- def feature(self):
- """Return ModelAPI_Feature."""
- return self._feature
-
- def getKind(self):
- """Return the unique kind of the feature"""
- return self._feature.getKind()
-
- def results(self):
- """Return current results of the feature"""
- return self._feature.results()
-
- def firstResult(self):
- """Return the first result in the list of results"""
- return self._feature.firstResult()
-
- def lastResult(self):
- """Return the last result in the list of results"""
- return self._feature.lastResult()
-
- def setRealInput(self, inputid, value):
- """I.setRealInput(str, float) -- set real value to the attribute"""
- self._feature.data().real(inputid).setValue(value)
-
- def areInputValid(self):
- """I.areInputValid() -> True or False validation result"""
- validators = ModelAPI.ModelAPI_Session.get().validators()
- return validators.validate(self._feature)
-
- def execute(self):
- """I.execute() -- validate and execute the feature.
-
- Raises RuntimeError if validation fails.
- """
- if self.areInputValid():
- self._feature.execute()
- else:
- raise RuntimeError("Can not execute %s: %s" %
- (self._feature.getKind(), self._feature.error())
- )