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_BezierCurve.hxx>
00027 # include <Geom_BezierSurface.hxx>
00028 # include <Handle_Geom_BezierCurve.hxx>
00029 # include <TColStd_Array1OfReal.hxx>
00030 # include <TColStd_Array2OfReal.hxx>
00031 # include <TColgp_Array1OfPnt.hxx>
00032 # include <TColgp_Array2OfPnt.hxx>
00033 #endif
00034
00035 #include <Base/VectorPy.h>
00036 #include <Base/GeometryPyCXX.h>
00037
00038 #include "Geometry.h"
00039 #include "BezierCurvePy.h"
00040 #include "BezierSurfacePy.h"
00041 #include "BezierSurfacePy.cpp"
00042
00043 using namespace Part;
00044
00045
00046 std::string BezierSurfacePy::representation(void) const
00047 {
00048 return "<BezierSurface object>";
00049 }
00050
00051 PyObject *BezierSurfacePy::PyMake(struct _typeobject *, PyObject *, PyObject *)
00052 {
00053
00054 return new BezierSurfacePy(new GeomBezierSurface);
00055 }
00056
00057
00058 int BezierSurfacePy::PyInit(PyObject* , PyObject* )
00059 {
00060 return 0;
00061 }
00062
00063 PyObject* BezierSurfacePy::bounds(PyObject *args)
00064 {
00065 if (!PyArg_ParseTuple(args, ""))
00066 return 0;
00067
00068 Handle_Geom_BezierSurface surf = Handle_Geom_BezierSurface::DownCast
00069 (getGeometryPtr()->handle());
00070 Py::Tuple bound(4);
00071 Standard_Real u1,u2,v1,v2;
00072 surf->Bounds(u1,u2,v1,v2);
00073 bound.setItem(0,Py::Float(u1));
00074 bound.setItem(1,Py::Float(u2));
00075 bound.setItem(2,Py::Float(v1));
00076 bound.setItem(3,Py::Float(v2));
00077 return Py::new_reference_to(bound);
00078 }
00079
00080 PyObject* BezierSurfacePy::isURational(PyObject *args)
00081 {
00082 if (!PyArg_ParseTuple(args, ""))
00083 return 0;
00084
00085 Handle_Geom_BezierSurface surf = Handle_Geom_BezierSurface::DownCast
00086 (getGeometryPtr()->handle());
00087 Standard_Boolean val = surf->IsURational();
00088 if (val) {
00089 Py_INCREF(Py_True);
00090 return Py_True;
00091 }
00092 else {
00093 Py_INCREF(Py_False);
00094 return Py_False;
00095 }
00096 }
00097
00098 PyObject* BezierSurfacePy::isVRational(PyObject *args)
00099 {
00100 if (!PyArg_ParseTuple(args, ""))
00101 return 0;
00102
00103 Handle_Geom_BezierSurface surf = Handle_Geom_BezierSurface::DownCast
00104 (getGeometryPtr()->handle());
00105 Standard_Boolean val = surf->IsVRational();
00106 if (val) {
00107 Py_INCREF(Py_True);
00108 return Py_True;
00109 }
00110 else {
00111 Py_INCREF(Py_False);
00112 return Py_False;
00113 }
00114 }
00115
00116 PyObject* BezierSurfacePy::isUPeriodic(PyObject *args)
00117 {
00118 if (!PyArg_ParseTuple(args, ""))
00119 return 0;
00120
00121 Handle_Geom_BezierSurface surf = Handle_Geom_BezierSurface::DownCast
00122 (getGeometryPtr()->handle());
00123 Standard_Boolean val = surf->IsUPeriodic();
00124 if (val) {
00125 Py_INCREF(Py_True);
00126 return Py_True;
00127 }
00128 else {
00129 Py_INCREF(Py_False);
00130 return Py_False;
00131 }
00132 }
00133
00134 PyObject* BezierSurfacePy::isVPeriodic(PyObject *args)
00135 {
00136 if (!PyArg_ParseTuple(args, ""))
00137 return 0;
00138
00139 Handle_Geom_BezierSurface surf = Handle_Geom_BezierSurface::DownCast
00140 (getGeometryPtr()->handle());
00141 Standard_Boolean val = surf->IsVPeriodic();
00142 if (val) {
00143 Py_INCREF(Py_True);
00144 return Py_True;
00145 }
00146 else {
00147 Py_INCREF(Py_False);
00148 return Py_False;
00149 }
00150 }
00151
00152 PyObject* BezierSurfacePy::isUClosed(PyObject *args)
00153 {
00154 if (!PyArg_ParseTuple(args, ""))
00155 return 0;
00156
00157 Handle_Geom_BezierSurface surf = Handle_Geom_BezierSurface::DownCast
00158 (getGeometryPtr()->handle());
00159 Standard_Boolean val = surf->IsUClosed();
00160 if (val) {
00161 Py_INCREF(Py_True);
00162 return Py_True;
00163 }
00164 else {
00165 Py_INCREF(Py_False);
00166 return Py_False;
00167 }
00168 }
00169
00170 PyObject* BezierSurfacePy::isVClosed(PyObject *args)
00171 {
00172 if (!PyArg_ParseTuple(args, ""))
00173 return 0;
00174
00175 Handle_Geom_BezierSurface surf = Handle_Geom_BezierSurface::DownCast
00176 (getGeometryPtr()->handle());
00177 Standard_Boolean val = surf->IsVPeriodic();
00178 if (val) {
00179 Py_INCREF(Py_True);
00180 return Py_True;
00181 }
00182 else {
00183 Py_INCREF(Py_False);
00184 return Py_False;
00185 }
00186 }
00187
00188 PyObject* BezierSurfacePy::increase(PyObject *args)
00189 {
00190 int udegree,vdegree;
00191 if (!PyArg_ParseTuple(args, "ii", &udegree, &vdegree))
00192 return 0;
00193 Handle_Geom_BezierSurface surf = Handle_Geom_BezierSurface::DownCast
00194 (getGeometryPtr()->handle());
00195 surf->Increase(udegree, vdegree);
00196 Py_Return;
00197 }
00198
00199 PyObject* BezierSurfacePy::insertPoleColAfter(PyObject *args)
00200 {
00201 int vindex;
00202 PyObject* obj;
00203 PyObject* obj2=0;
00204 if (!PyArg_ParseTuple(args, "iO!|O!",&vindex,&PyList_Type,&obj,&PyList_Type,&obj2))
00205 return 0;
00206 try {
00207 Py::List list(obj);
00208 TColgp_Array1OfPnt poles(1, list.size());
00209 int index=1;
00210 for (Py::List::iterator it = list.begin(); it != list.end(); ++it) {
00211 Py::Vector p(*it);
00212 Base::Vector3d v = p.toVector();
00213 poles(index++) = gp_Pnt(v.x,v.y,v.z);
00214 }
00215
00216 Handle_Geom_BezierSurface surf = Handle_Geom_BezierSurface::DownCast
00217 (getGeometryPtr()->handle());
00218 if (obj2 == 0) {
00219 surf->InsertPoleColAfter(vindex, poles);
00220 }
00221 else {
00222 Py::List list(obj2);
00223 TColStd_Array1OfReal weights(1, list.size());
00224 int index=1;
00225 for (Py::List::iterator it = list.begin(); it != list.end(); ++it) {
00226 weights(index++) = (double)Py::Float(*it);
00227 }
00228 surf->InsertPoleColAfter(vindex, poles, weights);
00229 }
00230
00231 Py_Return;
00232 }
00233 catch (Standard_Failure) {
00234 Handle_Standard_Failure e = Standard_Failure::Caught();
00235 PyErr_SetString(PyExc_Exception, e->GetMessageString());
00236 return 0;
00237 }
00238 }
00239
00240 PyObject* BezierSurfacePy::insertPoleRowAfter(PyObject *args)
00241 {
00242 int uindex;
00243 PyObject* obj;
00244 PyObject* obj2=0;
00245 if (!PyArg_ParseTuple(args, "iO!|O!",&uindex,&PyList_Type,&obj,&PyList_Type,&obj2))
00246 return 0;
00247 try {
00248 Py::List list(obj);
00249 TColgp_Array1OfPnt poles(1, list.size());
00250 int index=1;
00251 for (Py::List::iterator it = list.begin(); it != list.end(); ++it) {
00252 Py::Vector p(*it);
00253 Base::Vector3d v = p.toVector();
00254 poles(index++) = gp_Pnt(v.x,v.y,v.z);
00255 }
00256
00257 Handle_Geom_BezierSurface surf = Handle_Geom_BezierSurface::DownCast
00258 (getGeometryPtr()->handle());
00259 if (obj2 == 0) {
00260 surf->InsertPoleRowAfter(uindex, poles);
00261 }
00262 else {
00263 Py::List list(obj2);
00264 TColStd_Array1OfReal weights(1, list.size());
00265 int index=1;
00266 for (Py::List::iterator it = list.begin(); it != list.end(); ++it) {
00267 weights(index++) = (double)Py::Float(*it);
00268 }
00269 surf->InsertPoleRowAfter(uindex, poles, weights);
00270 }
00271
00272 Py_Return;
00273 }
00274 catch (Standard_Failure) {
00275 Handle_Standard_Failure e = Standard_Failure::Caught();
00276 PyErr_SetString(PyExc_Exception, e->GetMessageString());
00277 return 0;
00278 }
00279 }
00280
00281 PyObject* BezierSurfacePy::insertPoleColBefore(PyObject *args)
00282 {
00283 int vindex;
00284 PyObject* obj;
00285 PyObject* obj2=0;
00286 if (!PyArg_ParseTuple(args, "iO!|O!",&vindex,&PyList_Type,&obj,&PyList_Type,&obj2))
00287 return 0;
00288 try {
00289 Py::List list(obj);
00290 TColgp_Array1OfPnt poles(1, list.size());
00291 int index=1;
00292 for (Py::List::iterator it = list.begin(); it != list.end(); ++it) {
00293 Py::Vector p(*it);
00294 Base::Vector3d v = p.toVector();
00295 poles(index++) = gp_Pnt(v.x,v.y,v.z);
00296 }
00297
00298 Handle_Geom_BezierSurface surf = Handle_Geom_BezierSurface::DownCast
00299 (getGeometryPtr()->handle());
00300 if (obj2 == 0) {
00301 surf->InsertPoleColBefore(vindex, poles);
00302 }
00303 else {
00304 Py::List list(obj2);
00305 TColStd_Array1OfReal weights(1, list.size());
00306 int index=1;
00307 for (Py::List::iterator it = list.begin(); it != list.end(); ++it) {
00308 weights(index++) = (double)Py::Float(*it);
00309 }
00310 surf->InsertPoleColBefore(vindex, poles, weights);
00311 }
00312
00313 Py_Return;
00314 }
00315 catch (Standard_Failure) {
00316 Handle_Standard_Failure e = Standard_Failure::Caught();
00317 PyErr_SetString(PyExc_Exception, e->GetMessageString());
00318 return 0;
00319 }
00320 }
00321
00322 PyObject* BezierSurfacePy::insertPoleRowBefore(PyObject *args)
00323 {
00324 int uindex;
00325 PyObject* obj;
00326 PyObject* obj2=0;
00327 if (!PyArg_ParseTuple(args, "iO!|O!",&uindex,&PyList_Type,&obj,&PyList_Type,&obj2))
00328 return 0;
00329 try {
00330 Py::List list(obj);
00331 TColgp_Array1OfPnt poles(1, list.size());
00332 int index=1;
00333 for (Py::List::iterator it = list.begin(); it != list.end(); ++it) {
00334 Py::Vector p(*it);
00335 Base::Vector3d v = p.toVector();
00336 poles(index++) = gp_Pnt(v.x,v.y,v.z);
00337 }
00338
00339 Handle_Geom_BezierSurface surf = Handle_Geom_BezierSurface::DownCast
00340 (getGeometryPtr()->handle());
00341 if (obj2 == 0) {
00342 surf->InsertPoleRowBefore(uindex, poles);
00343 }
00344 else {
00345 Py::List list(obj2);
00346 TColStd_Array1OfReal weights(1, list.size());
00347 int index=1;
00348 for (Py::List::iterator it = list.begin(); it != list.end(); ++it) {
00349 weights(index++) = (double)Py::Float(*it);
00350 }
00351 surf->InsertPoleRowBefore(uindex, poles, weights);
00352 }
00353
00354 Py_Return;
00355 }
00356 catch (Standard_Failure) {
00357 Handle_Standard_Failure e = Standard_Failure::Caught();
00358 PyErr_SetString(PyExc_Exception, e->GetMessageString());
00359 return 0;
00360 }
00361 }
00362
00363 PyObject* BezierSurfacePy::removePoleCol(PyObject *args)
00364 {
00365 int vindex;
00366 if (!PyArg_ParseTuple(args, "i",&vindex))
00367 return 0;
00368 try {
00369 Handle_Geom_BezierSurface surf = Handle_Geom_BezierSurface::DownCast
00370 (getGeometryPtr()->handle());
00371 surf->RemovePoleCol(vindex);
00372 Py_Return;
00373 }
00374 catch (Standard_Failure) {
00375 Handle_Standard_Failure e = Standard_Failure::Caught();
00376 PyErr_SetString(PyExc_Exception, e->GetMessageString());
00377 return 0;
00378 }
00379 }
00380
00381 PyObject* BezierSurfacePy::removePoleRow(PyObject *args)
00382 {
00383 int uindex;
00384 if (!PyArg_ParseTuple(args, "i",&uindex))
00385 return 0;
00386 try {
00387 Handle_Geom_BezierSurface surf = Handle_Geom_BezierSurface::DownCast
00388 (getGeometryPtr()->handle());
00389 surf->RemovePoleRow(uindex);
00390 Py_Return;
00391 }
00392 catch (Standard_Failure) {
00393 Handle_Standard_Failure e = Standard_Failure::Caught();
00394 PyErr_SetString(PyExc_Exception, e->GetMessageString());
00395 return 0;
00396 }
00397 }
00398
00399 PyObject* BezierSurfacePy::segment(PyObject *args)
00400 {
00401 Standard_Real u1,u2,v1,v2;
00402 if (!PyArg_ParseTuple(args, "dddd",&u1,&u2,&v1,&v2))
00403 return 0;
00404 try {
00405 Handle_Geom_BezierSurface surf = Handle_Geom_BezierSurface::DownCast
00406 (getGeometryPtr()->handle());
00407 surf->Segment(u1,u2,v1,v2);
00408 Py_Return;
00409 }
00410 catch (Standard_Failure) {
00411 Handle_Standard_Failure e = Standard_Failure::Caught();
00412 PyErr_SetString(PyExc_Exception, e->GetMessageString());
00413 return 0;
00414 }
00415 }
00416
00417 PyObject* BezierSurfacePy::setPole(PyObject *args)
00418 {
00419 int uindex,vindex;
00420 PyObject* obj;
00421 double weight=0.0;
00422 if (!PyArg_ParseTuple(args, "iiO!|d",&uindex,&vindex,&(Base::VectorPy::Type),&obj,&weight))
00423 return 0;
00424 try {
00425 Base::Vector3d pole = static_cast<Base::VectorPy*>(obj)->value();
00426 Handle_Geom_BezierSurface surf = Handle_Geom_BezierSurface::DownCast
00427 (getGeometryPtr()->handle());
00428 if (weight <= gp::Resolution())
00429 surf->SetPole(uindex,vindex,gp_Pnt(pole.x,pole.y,pole.z));
00430 else
00431 surf->SetPole(uindex,vindex,gp_Pnt(pole.x,pole.y,pole.z),weight);
00432 Py_Return;
00433 }
00434 catch (Standard_Failure) {
00435 Handle_Standard_Failure e = Standard_Failure::Caught();
00436 PyErr_SetString(PyExc_Exception, e->GetMessageString());
00437 return 0;
00438 }
00439 }
00440
00441 PyObject* BezierSurfacePy::setPoleCol(PyObject *args)
00442 {
00443 int vindex;
00444 PyObject* obj;
00445 PyObject* obj2=0;
00446 if (!PyArg_ParseTuple(args, "iO!|O!",&vindex,&PyList_Type,&obj,&PyList_Type,&obj2))
00447 return 0;
00448 try {
00449 Py::List list(obj);
00450 TColgp_Array1OfPnt poles(1, list.size());
00451 int index=1;
00452 for (Py::List::iterator it = list.begin(); it != list.end(); ++it) {
00453 Py::Vector p(*it);
00454 Base::Vector3d v = p.toVector();
00455 poles(index++) = gp_Pnt(v.x,v.y,v.z);
00456 }
00457
00458 Handle_Geom_BezierSurface surf = Handle_Geom_BezierSurface::DownCast
00459 (getGeometryPtr()->handle());
00460 if (obj2 == 0) {
00461 surf->SetPoleCol(vindex, poles);
00462 }
00463 else {
00464 Py::List list(obj2);
00465 TColStd_Array1OfReal weights(1, list.size());
00466 int index=1;
00467 for (Py::List::iterator it = list.begin(); it != list.end(); ++it) {
00468 weights(index++) = (double)Py::Float(*it);
00469 }
00470 surf->SetPoleCol(vindex, poles, weights);
00471 }
00472
00473 Py_Return;
00474 }
00475 catch (Standard_Failure) {
00476 Handle_Standard_Failure e = Standard_Failure::Caught();
00477 PyErr_SetString(PyExc_Exception, e->GetMessageString());
00478 return 0;
00479 }
00480 }
00481
00482 PyObject* BezierSurfacePy::setPoleRow(PyObject *args)
00483 {
00484 int uindex;
00485 PyObject* obj;
00486 PyObject* obj2=0;
00487 if (!PyArg_ParseTuple(args, "iO!|O!",&uindex,&PyList_Type,&obj,&PyList_Type,&obj2))
00488 return 0;
00489 try {
00490 Py::List list(obj);
00491 TColgp_Array1OfPnt poles(1, list.size());
00492 int index=1;
00493 for (Py::List::iterator it = list.begin(); it != list.end(); ++it) {
00494 Py::Vector p(*it);
00495 Base::Vector3d v = p.toVector();
00496 poles(index++) = gp_Pnt(v.x,v.y,v.z);
00497 }
00498
00499 Handle_Geom_BezierSurface surf = Handle_Geom_BezierSurface::DownCast
00500 (getGeometryPtr()->handle());
00501 if (obj2 == 0) {
00502 surf->SetPoleRow(uindex, poles);
00503 }
00504 else {
00505 Py::List list(obj2);
00506 TColStd_Array1OfReal weights(1, list.size());
00507 int index=1;
00508 for (Py::List::iterator it = list.begin(); it != list.end(); ++it) {
00509 weights(index++) = (double)Py::Float(*it);
00510 }
00511 surf->SetPoleRow(uindex, poles, weights);
00512 }
00513
00514 Py_Return;
00515 }
00516 catch (Standard_Failure) {
00517 Handle_Standard_Failure e = Standard_Failure::Caught();
00518 PyErr_SetString(PyExc_Exception, e->GetMessageString());
00519 return 0;
00520 }
00521 }
00522
00523 PyObject* BezierSurfacePy::getPole(PyObject *args)
00524 {
00525 int uindex,vindex;
00526 if (!PyArg_ParseTuple(args, "ii",&uindex,&vindex))
00527 return 0;
00528 try {
00529 Handle_Geom_BezierSurface surf = Handle_Geom_BezierSurface::DownCast
00530 (getGeometryPtr()->handle());
00531 gp_Pnt p = surf->Pole(uindex,vindex);
00532 return new Base::VectorPy(Base::Vector3d(p.X(),p.Y(),p.Z()));
00533 }
00534 catch (Standard_Failure) {
00535 Handle_Standard_Failure e = Standard_Failure::Caught();
00536 PyErr_SetString(PyExc_Exception, e->GetMessageString());
00537 return 0;
00538 }
00539 }
00540
00541 PyObject* BezierSurfacePy::getPoles(PyObject *args)
00542 {
00543 if (!PyArg_ParseTuple(args, ""))
00544 return 0;
00545 try {
00546 Handle_Geom_BezierSurface surf = Handle_Geom_BezierSurface::DownCast
00547 (getGeometryPtr()->handle());
00548 TColgp_Array2OfPnt p(1,surf->NbUPoles(),1,surf->NbVPoles());
00549 surf->Poles(p);
00550 Py::List poles;
00551 for (Standard_Integer i=p.LowerRow(); i<=p.UpperRow(); i++) {
00552 Py::List row;
00553 for (Standard_Integer j=p.LowerCol(); j<=p.UpperCol(); j++) {
00554 const gp_Pnt& pole = p(i,j);
00555 row.append(Py::Object(new Base::VectorPy(
00556 Base::Vector3d(pole.X(),pole.Y(),pole.Z()))));
00557 }
00558 poles.append(row);
00559 }
00560 return Py::new_reference_to(poles);
00561 }
00562 catch (Standard_Failure) {
00563 Handle_Standard_Failure e = Standard_Failure::Caught();
00564 PyErr_SetString(PyExc_Exception, e->GetMessageString());
00565 return 0;
00566 }
00567 }
00568
00569 PyObject* BezierSurfacePy::setWeight(PyObject *args)
00570 {
00571 int uindex,vindex;
00572 double weight;
00573 if (!PyArg_ParseTuple(args, "iid",&uindex,&vindex,&weight))
00574 return 0;
00575 try {
00576 Handle_Geom_BezierSurface surf = Handle_Geom_BezierSurface::DownCast
00577 (getGeometryPtr()->handle());
00578 surf->SetWeight(uindex,vindex,weight);
00579 Py_Return;
00580 }
00581 catch (Standard_Failure) {
00582 Handle_Standard_Failure e = Standard_Failure::Caught();
00583 PyErr_SetString(PyExc_Exception, e->GetMessageString());
00584 return 0;
00585 }
00586 }
00587
00588 PyObject* BezierSurfacePy::setWeightCol(PyObject *args)
00589 {
00590 int vindex;
00591 PyObject* obj;
00592 if (!PyArg_ParseTuple(args, "iO!",&vindex,&PyList_Type,&obj))
00593 return 0;
00594 try {
00595 Py::List list(obj);
00596 TColStd_Array1OfReal weights(1, list.size());
00597 int index=1;
00598 for (Py::List::iterator it = list.begin(); it != list.end(); ++it) {
00599 weights(index++) = (double)Py::Float(*it);
00600 }
00601
00602 Handle_Geom_BezierSurface surf = Handle_Geom_BezierSurface::DownCast
00603 (getGeometryPtr()->handle());
00604 surf->SetWeightCol(vindex, weights);
00605 Py_Return;
00606 }
00607 catch (Standard_Failure) {
00608 Handle_Standard_Failure e = Standard_Failure::Caught();
00609 PyErr_SetString(PyExc_Exception, e->GetMessageString());
00610 return 0;
00611 }
00612 }
00613
00614 PyObject* BezierSurfacePy::setWeightRow(PyObject *args)
00615 {
00616 int uindex;
00617 PyObject* obj;
00618 if (!PyArg_ParseTuple(args, "iO!",&uindex,&PyList_Type,&obj))
00619 return 0;
00620 try {
00621 Py::List list(obj);
00622 TColStd_Array1OfReal weights(1, list.size());
00623 int index=1;
00624 for (Py::List::iterator it = list.begin(); it != list.end(); ++it) {
00625 weights(index++) = (double)Py::Float(*it);
00626 }
00627
00628 Handle_Geom_BezierSurface surf = Handle_Geom_BezierSurface::DownCast
00629 (getGeometryPtr()->handle());
00630 surf->SetWeightRow(uindex, weights);
00631 Py_Return;
00632 }
00633 catch (Standard_Failure) {
00634 Handle_Standard_Failure e = Standard_Failure::Caught();
00635 PyErr_SetString(PyExc_Exception, e->GetMessageString());
00636 return 0;
00637 }
00638 }
00639
00640 PyObject* BezierSurfacePy::getWeight(PyObject *args)
00641 {
00642 int uindex,vindex;
00643 if (!PyArg_ParseTuple(args, "ii",&uindex,&vindex))
00644 return 0;
00645 try {
00646 Handle_Geom_BezierSurface surf = Handle_Geom_BezierSurface::DownCast
00647 (getGeometryPtr()->handle());
00648 double w = surf->Weight(uindex,vindex);
00649 return Py_BuildValue("d", w);
00650 }
00651 catch (Standard_Failure) {
00652 Handle_Standard_Failure e = Standard_Failure::Caught();
00653 PyErr_SetString(PyExc_Exception, e->GetMessageString());
00654 return 0;
00655 }
00656 }
00657
00658 PyObject* BezierSurfacePy::getWeights(PyObject *args)
00659 {
00660 if (!PyArg_ParseTuple(args, ""))
00661 return 0;
00662 try {
00663 Handle_Geom_BezierSurface surf = Handle_Geom_BezierSurface::DownCast
00664 (getGeometryPtr()->handle());
00665 TColStd_Array2OfReal w(1,surf->NbUPoles(),1,surf->NbVPoles());
00666 surf->Weights(w);
00667 Py::List weights;
00668 for (Standard_Integer i=w.LowerRow(); i<=w.UpperRow(); i++) {
00669 Py::List row;
00670 for (Standard_Integer j=w.LowerCol(); j<=w.UpperCol(); j++) {
00671 row.append(Py::Float(w(i,j)));
00672 }
00673 weights.append(row);
00674 }
00675 return Py::new_reference_to(weights);
00676 }
00677 catch (Standard_Failure) {
00678 Handle_Standard_Failure e = Standard_Failure::Caught();
00679 PyErr_SetString(PyExc_Exception, e->GetMessageString());
00680 return 0;
00681 }
00682 }
00683
00684 PyObject* BezierSurfacePy::getResolution(PyObject *args)
00685 {
00686 double tol;
00687 if (!PyArg_ParseTuple(args, "d", &tol))
00688 return 0;
00689 try {
00690 Handle_Geom_BezierSurface surf = Handle_Geom_BezierSurface::DownCast
00691 (getGeometryPtr()->handle());
00692 double utol, vtol;
00693 surf->Resolution(tol,utol,vtol);
00694 return Py_BuildValue("(dd)",utol,vtol);
00695 }
00696 catch (Standard_Failure) {
00697 Handle_Standard_Failure e = Standard_Failure::Caught();
00698 PyErr_SetString(PyExc_Exception, e->GetMessageString());
00699 return 0;
00700 }
00701 }
00702
00703 PyObject* BezierSurfacePy::exchangeUV(PyObject *args)
00704 {
00705 if (!PyArg_ParseTuple(args, ""))
00706 return 0;
00707
00708 try {
00709 Handle_Geom_BezierSurface surf = Handle_Geom_BezierSurface::DownCast
00710 (getGeometryPtr()->handle());
00711
00712 surf->ExchangeUV();
00713 Py_Return;
00714 }
00715 catch (Standard_Failure) {
00716 Handle_Standard_Failure e = Standard_Failure::Caught();
00717 PyErr_SetString(PyExc_Exception, e->GetMessageString());
00718 return 0;
00719 }
00720 }
00721
00722 PyObject* BezierSurfacePy::uIso(PyObject * args)
00723 {
00724 double u;
00725 if (!PyArg_ParseTuple(args, "d", &u))
00726 return 0;
00727
00728 try {
00729 Handle_Geom_BezierSurface surf = Handle_Geom_BezierSurface::DownCast
00730 (getGeometryPtr()->handle());
00731 Handle_Geom_Curve c = surf->UIso(u);
00732 return new BezierCurvePy(new GeomBezierCurve(Handle_Geom_BezierCurve::DownCast(c)));
00733 }
00734 catch (Standard_Failure) {
00735 Handle_Standard_Failure e = Standard_Failure::Caught();
00736 PyErr_SetString(PyExc_Exception, e->GetMessageString());
00737 return 0;
00738 }
00739 }
00740
00741 PyObject* BezierSurfacePy::vIso(PyObject * args)
00742 {
00743 double v;
00744 if (!PyArg_ParseTuple(args, "d", &v))
00745 return 0;
00746
00747 try {
00748 Handle_Geom_BezierSurface surf = Handle_Geom_BezierSurface::DownCast
00749 (getGeometryPtr()->handle());
00750 Handle_Geom_Curve c = surf->VIso(v);
00751 return new BezierCurvePy(new GeomBezierCurve(Handle_Geom_BezierCurve::DownCast(c)));
00752 }
00753 catch (Standard_Failure) {
00754 Handle_Standard_Failure e = Standard_Failure::Caught();
00755 PyErr_SetString(PyExc_Exception, e->GetMessageString());
00756 return 0;
00757 }
00758 }
00759
00760 Py::Int BezierSurfacePy::getUDegree(void) const
00761 {
00762 Handle_Geom_BezierSurface surf = Handle_Geom_BezierSurface::DownCast
00763 (getGeometryPtr()->handle());
00764 return Py::Int(surf->UDegree());
00765 }
00766
00767 Py::Int BezierSurfacePy::getVDegree(void) const
00768 {
00769 Handle_Geom_BezierSurface surf = Handle_Geom_BezierSurface::DownCast
00770 (getGeometryPtr()->handle());
00771 return Py::Int(surf->UDegree());
00772 }
00773
00774 Py::Int BezierSurfacePy::getMaxDegree(void) const
00775 {
00776 Handle_Geom_BezierSurface surf = Handle_Geom_BezierSurface::DownCast
00777 (getGeometryPtr()->handle());
00778 return Py::Int(surf->MaxDegree());
00779 }
00780
00781 Py::Int BezierSurfacePy::getNbUPoles(void) const
00782 {
00783 Handle_Geom_BezierSurface surf = Handle_Geom_BezierSurface::DownCast
00784 (getGeometryPtr()->handle());
00785 return Py::Int(surf->NbUPoles());
00786 }
00787
00788 Py::Int BezierSurfacePy::getNbVPoles(void) const
00789 {
00790 Handle_Geom_BezierSurface surf = Handle_Geom_BezierSurface::DownCast
00791 (getGeometryPtr()->handle());
00792 return Py::Int(surf->NbVPoles());
00793 }
00794
00795 PyObject *BezierSurfacePy::getCustomAttributes(const char* ) const
00796 {
00797 return 0;
00798 }
00799
00800 int BezierSurfacePy::setCustomAttributes(const char* , PyObject* )
00801 {
00802 return 0;
00803 }