| | |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| |
|
| | #include "GeometryPyCXX.h" |
| |
|
| | |
| | #include "CoordinateSystemPy.h" |
| | #include "CoordinateSystemPy.cpp" |
| |
|
| | #include "AxisPy.h" |
| | #include "PlacementPy.h" |
| | #include "VectorPy.h" |
| |
|
| | using namespace Base; |
| |
|
| | |
| | std::string CoordinateSystemPy::representation() const |
| | { |
| | return {"<CoordinateSystem object>"}; |
| | } |
| |
|
| | PyObject* CoordinateSystemPy::PyMake(PyTypeObject* , PyObject* , PyObject* ) |
| | { |
| | |
| | return new CoordinateSystemPy(new CoordinateSystem); |
| | } |
| |
|
| | |
| | int CoordinateSystemPy::PyInit(PyObject* , PyObject* ) |
| | { |
| | return 0; |
| | } |
| |
|
| | PyObject* CoordinateSystemPy::setAxes(PyObject* args) |
| | { |
| | PyObject* axis {}; |
| | PyObject* xdir {}; |
| | if (PyArg_ParseTuple(args, "O!O!", &(AxisPy::Type), &axis, &(VectorPy::Type), &xdir)) { |
| | getCoordinateSystemPtr()->setAxes( |
| | *static_cast<AxisPy*>(axis)->getAxisPtr(), |
| | *static_cast<VectorPy*>(xdir)->getVectorPtr() |
| | ); |
| | Py_Return; |
| | } |
| |
|
| | PyErr_Clear(); |
| | if (PyArg_ParseTuple(args, "O!O!", &(VectorPy::Type), &axis, &(VectorPy::Type), &xdir)) { |
| | getCoordinateSystemPtr()->setAxes( |
| | *static_cast<VectorPy*>(axis)->getVectorPtr(), |
| | *static_cast<VectorPy*>(xdir)->getVectorPtr() |
| | ); |
| | Py_Return; |
| | } |
| |
|
| | PyErr_SetString(PyExc_TypeError, "Axis and Vector or Vector and Vector expected"); |
| | return nullptr; |
| | } |
| |
|
| | PyObject* CoordinateSystemPy::displacement(PyObject* args) const |
| | { |
| | PyObject* cs {}; |
| | if (!PyArg_ParseTuple(args, "O!", &(CoordinateSystemPy::Type), &cs)) { |
| | return nullptr; |
| | } |
| | Placement plm = getCoordinateSystemPtr()->displacement( |
| | *static_cast<CoordinateSystemPy*>(cs)->getCoordinateSystemPtr() |
| | ); |
| | return new PlacementPy(new Placement(plm)); |
| | } |
| |
|
| | PyObject* CoordinateSystemPy::transformTo(PyObject* args) |
| | { |
| | PyObject* vecpy {}; |
| | if (!PyArg_ParseTuple(args, "O!", &(VectorPy::Type), &vecpy)) { |
| | return nullptr; |
| | } |
| | Vector3d vec = static_cast<VectorPy*>(vecpy)->value(); |
| | getCoordinateSystemPtr()->transformTo(vec); |
| | return new VectorPy(new Vector3d(vec)); |
| | } |
| |
|
| | PyObject* CoordinateSystemPy::transform(PyObject* args) |
| | { |
| | PyObject* plm {}; |
| | if (PyArg_ParseTuple(args, "O!", &(PlacementPy::Type), &plm)) { |
| | getCoordinateSystemPtr()->transform(*static_cast<PlacementPy*>(plm)->getPlacementPtr()); |
| | Py_Return; |
| | } |
| |
|
| | PyErr_Clear(); |
| | if (PyArg_ParseTuple(args, "O!", &(RotationPy::Type), &plm)) { |
| | getCoordinateSystemPtr()->transform(*static_cast<RotationPy*>(plm)->getRotationPtr()); |
| | Py_Return; |
| | } |
| |
|
| | PyErr_SetString(PyExc_TypeError, "Rotation or placement expected"); |
| | return nullptr; |
| | } |
| |
|
| | PyObject* CoordinateSystemPy::setPlacement(PyObject* args) |
| | { |
| | PyObject* plm {}; |
| | if (!PyArg_ParseTuple(args, "O!", &(PlacementPy::Type), &plm)) { |
| | return nullptr; |
| | } |
| | getCoordinateSystemPtr()->setPlacement(*static_cast<PlacementPy*>(plm)->getPlacementPtr()); |
| | Py_Return; |
| | } |
| |
|
| | Py::Object CoordinateSystemPy::getAxis() const |
| | { |
| | const Axis& axis = getCoordinateSystemPtr()->getAxis(); |
| | return Py::asObject(new AxisPy(new Axis(axis))); |
| | } |
| |
|
| | void CoordinateSystemPy::setAxis(Py::Object arg) |
| | { |
| | if (PyObject_TypeCheck(arg.ptr(), &(AxisPy::Type))) { |
| | AxisPy* axis = static_cast<AxisPy*>(arg.ptr()); |
| | getCoordinateSystemPtr()->setAxis(*axis->getAxisPtr()); |
| | return; |
| | } |
| |
|
| | throw Py::TypeError("not an Axis"); |
| | } |
| |
|
| | Py::Object CoordinateSystemPy::getXDirection() const |
| | { |
| | return Py::Vector(getCoordinateSystemPtr()->getXDirection()); |
| | } |
| |
|
| | void CoordinateSystemPy::setXDirection(Py::Object arg) |
| | { |
| | getCoordinateSystemPtr()->setXDirection(Py::Vector(arg).toVector()); |
| | } |
| |
|
| | Py::Object CoordinateSystemPy::getYDirection() const |
| | { |
| | return Py::Vector(getCoordinateSystemPtr()->getYDirection()); |
| | } |
| |
|
| | void CoordinateSystemPy::setYDirection(Py::Object arg) |
| | { |
| | getCoordinateSystemPtr()->setYDirection(Py::Vector(arg).toVector()); |
| | } |
| |
|
| | Py::Object CoordinateSystemPy::getZDirection() const |
| | { |
| | return Py::Vector(getCoordinateSystemPtr()->getZDirection()); |
| | } |
| |
|
| | void CoordinateSystemPy::setZDirection(Py::Object arg) |
| | { |
| | getCoordinateSystemPtr()->setZDirection(Py::Vector(arg).toVector()); |
| | } |
| |
|
| | Py::Object CoordinateSystemPy::getPosition() const |
| | { |
| | return Py::Vector(getCoordinateSystemPtr()->getPosition()); |
| | } |
| |
|
| | void CoordinateSystemPy::setPosition(Py::Object arg) |
| | { |
| | getCoordinateSystemPtr()->setPosition(Py::Vector(arg).toVector()); |
| | } |
| |
|
| | PyObject* CoordinateSystemPy::getCustomAttributes(const char* ) const |
| | { |
| | return nullptr; |
| | } |
| |
|
| | int CoordinateSystemPy::setCustomAttributes(const char* , PyObject* ) |
| | { |
| | return 0; |
| | } |
| |
|