OffsetSurfacePyImp.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "PreCompiled.h"
00025 #ifndef _PreComp_
00026 # include <Geom_OffsetSurface.hxx>
00027 #endif
00028
00029 #include <Base/VectorPy.h>
00030 #include <Base/Vector3D.h>
00031
00032 #include "Geometry.h"
00033 #include "OffsetSurfacePy.h"
00034 #include "OffsetSurfacePy.cpp"
00035
00036 using namespace Part;
00037
00038
00039 std::string OffsetSurfacePy::representation(void) const
00040 {
00041 return "<OffsetSurface object>";
00042 }
00043
00044 PyObject *OffsetSurfacePy::PyMake(struct _typeobject *, PyObject *, PyObject *)
00045 {
00046
00047 return new OffsetSurfacePy(new GeomOffsetSurface);
00048 }
00049
00050
00051 int OffsetSurfacePy::PyInit(PyObject* args, PyObject* )
00052 {
00053 PyObject* pGeom;
00054 double offset;
00055 if (!PyArg_ParseTuple(args, "O!d",
00056 &(GeometryPy::Type), &pGeom,
00057 &offset))
00058 return -1;
00059
00060 GeometryPy* pcGeo = static_cast<GeometryPy*>(pGeom);
00061 Handle_Geom_Surface surf = Handle_Geom_Surface::DownCast
00062 (pcGeo->getGeometryPtr()->handle());
00063 if (surf.IsNull()) {
00064 PyErr_SetString(PyExc_TypeError, "geometry is not a surface");
00065 return -1;
00066 }
00067
00068 try {
00069 Handle_Geom_OffsetSurface surf2 = new Geom_OffsetSurface(surf, offset);
00070 getGeomOffsetSurfacePtr()->setHandle(surf2);
00071 return 0;
00072 }
00073 catch (Standard_Failure) {
00074 Handle_Standard_Failure e = Standard_Failure::Caught();
00075 PyErr_SetString(PyExc_Exception, e->GetMessageString());
00076 return -1;
00077 }
00078 }
00079
00080 PyObject* OffsetSurfacePy::uIso(PyObject *args)
00081 {
00082 PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
00083 return 0;
00084 }
00085
00086 PyObject* OffsetSurfacePy::vIso(PyObject *args)
00087 {
00088 PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
00089 return 0;
00090 }
00091
00092 Py::Float OffsetSurfacePy::getOffsetValue(void) const
00093 {
00094 Handle_Geom_OffsetSurface surf = Handle_Geom_OffsetSurface::DownCast(getGeometryPtr()->handle());
00095 return Py::Float(surf->Offset());
00096 }
00097
00098 void OffsetSurfacePy::setOffsetValue(Py::Float arg)
00099 {
00100 Handle_Geom_OffsetSurface surf = Handle_Geom_OffsetSurface::DownCast(getGeometryPtr()->handle());
00101 surf->SetOffsetValue((double)arg);
00102 }
00103
00104 Py::Object OffsetSurfacePy::getBasisSurface(void) const
00105 {
00106 throw Py::Exception(PyExc_NotImplementedError, "Not yet implemented");
00107 }
00108
00109 void OffsetSurfacePy::setBasisSurface(Py::Object arg)
00110 {
00111 PyObject* p = arg.ptr();
00112 if (PyObject_TypeCheck(p, &(GeometryPy::Type))) {
00113 GeometryPy* pcGeo = static_cast<GeometryPy*>(p);
00114 Handle_Geom_Surface surf = Handle_Geom_Surface::DownCast
00115 (pcGeo->getGeometryPtr()->handle());
00116 if (surf.IsNull()) {
00117 throw Py::TypeError("geometry is not a surface");
00118 }
00119
00120 try {
00121 Handle_Geom_OffsetSurface surf2 = Handle_Geom_OffsetSurface::DownCast
00122 (getGeometryPtr()->handle());
00123 surf2->SetBasisSurface(surf);
00124 }
00125 catch (Standard_Failure) {
00126 Handle_Standard_Failure e = Standard_Failure::Caught();
00127 throw Py::Exception(e->GetMessageString());
00128 }
00129 }
00130 }
00131
00132 PyObject *OffsetSurfacePy::getCustomAttributes(const char* ) const
00133 {
00134 return 0;
00135 }
00136
00137 int OffsetSurfacePy::setCustomAttributes(const char* , PyObject* )
00138 {
00139 return 0;
00140 }