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_RectangularTrimmedSurface.hxx>
00027 # include <Geom_Curve.hxx>
00028 #endif
00029
00030 #include "Mod/Part/App/Geometry.h"
00031
00032
00033 #include "RectangularTrimmedSurfacePy.h"
00034 #include "RectangularTrimmedSurfacePy.cpp"
00035 #include "GeometryCurvePy.h"
00036
00037 using namespace Part;
00038
00039
00040 std::string RectangularTrimmedSurfacePy::representation(void) const
00041 {
00042 return std::string("<RectangularTrimmedSurface object>");
00043 }
00044
00045 PyObject *RectangularTrimmedSurfacePy::PyMake(struct _typeobject *, PyObject *, PyObject *)
00046 {
00047
00048 return new RectangularTrimmedSurfacePy(new GeomTrimmedSurface);
00049 }
00050
00051
00052 int RectangularTrimmedSurfacePy::PyInit(PyObject* args, PyObject* )
00053 {
00054 PyObject* surf;
00055 double u1,u2,v1,v2;
00056 PyObject *usense=Py_True, *vsense=Py_True;
00057 if (PyArg_ParseTuple(args, "O!dddd|O!O!",&(Part::GeometrySurfacePy::Type),&surf,
00058 &u1,&u2,&v1,&v2,&PyBool_Type,&usense,&PyBool_Type,&vsense)) {
00059 getGeomTrimmedSurfacePtr()->setHandle(new Geom_RectangularTrimmedSurface(
00060 Handle_Geom_Surface::DownCast(static_cast<GeometrySurfacePy*>(surf)->
00061 getGeomSurfacePtr()->handle()),
00062 u1, u2, v1, v2, (usense==Py_True), (vsense==Py_True)
00063 ));
00064 return 0;
00065 }
00066
00067 PyErr_Clear();
00068 double param1,param2;
00069 PyObject *utrim=0, *sense=Py_True;
00070 if (PyArg_ParseTuple(args, "O!ddO!|O!",&(Part::GeometrySurfacePy::Type),&surf,
00071 ¶m1,¶m2,&PyBool_Type,&utrim,&PyBool_Type,&sense)) {
00072 Standard_Boolean UTrim = (utrim==Py_True);
00073 Standard_Boolean Sense = (sense==Py_True);
00074 getGeomTrimmedSurfacePtr()->setHandle(new Geom_RectangularTrimmedSurface(
00075 Handle_Geom_Surface::DownCast(static_cast<GeometrySurfacePy*>(surf)->
00076 getGeomSurfacePtr()->handle()),
00077 param1, param2, UTrim, Sense
00078 ));
00079 return 0;
00080 }
00081
00082 PyErr_SetString(PyExc_Exception, "A surface and the trim parameters must be given");
00083 return -1;
00084 }
00085
00086 PyObject* RectangularTrimmedSurfacePy::uIso(PyObject * args)
00087 {
00088 double v;
00089 if (!PyArg_ParseTuple(args, "d", &v))
00090 return 0;
00091
00092 try {
00093 Handle_Geom_Surface surf = Handle_Geom_Surface::DownCast
00094 (getGeometryPtr()->handle());
00095 Handle_Geom_Curve c = surf->UIso(v);
00096 if (c->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
00097 Handle_Geom_TrimmedCurve aCurve = Handle_Geom_TrimmedCurve::DownCast(c);
00098 return new GeometryCurvePy(new GeomTrimmedCurve(aCurve));
00099 }
00100
00101 PyErr_Format(PyExc_NotImplementedError, "Iso curve is of type '%s'",
00102 c->DynamicType()->Name());
00103 return 0;
00104 }
00105 catch (Standard_Failure) {
00106 Handle_Standard_Failure e = Standard_Failure::Caught();
00107 PyErr_SetString(PyExc_Exception, e->GetMessageString());
00108 return 0;
00109 }
00110 }
00111
00112 PyObject* RectangularTrimmedSurfacePy::vIso(PyObject * args)
00113 {
00114 double v;
00115 if (!PyArg_ParseTuple(args, "d", &v))
00116 return 0;
00117
00118 try {
00119 Handle_Geom_Surface surf = Handle_Geom_Surface::DownCast
00120 (getGeometryPtr()->handle());
00121 Handle_Geom_Curve c = surf->VIso(v);
00122 if (c->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
00123 Handle_Geom_TrimmedCurve aCurve = Handle_Geom_TrimmedCurve::DownCast(c);
00124 return new GeometryCurvePy(new GeomTrimmedCurve(aCurve));
00125 }
00126
00127 PyErr_Format(PyExc_NotImplementedError, "Iso curve is of type '%s'",
00128 c->DynamicType()->Name());
00129 return 0;
00130 }
00131 catch (Standard_Failure) {
00132 Handle_Standard_Failure e = Standard_Failure::Caught();
00133 PyErr_SetString(PyExc_Exception, e->GetMessageString());
00134 return 0;
00135 }
00136 }
00137
00138 PyObject *RectangularTrimmedSurfacePy::getCustomAttributes(const char* ) const
00139 {
00140 return 0;
00141 }
00142
00143 int RectangularTrimmedSurfacePy::setCustomAttributes(const char* , PyObject* )
00144 {
00145 return 0;
00146 }