| 1397 | } |
| 1398 | } |
| 1399 | Py::Object makeBox(const Py::Tuple& args) |
| 1400 | { |
| 1401 | double length, width, height; |
| 1402 | PyObject *pPnt = nullptr, *pDir = nullptr; |
| 1403 | if (!PyArg_ParseTuple( |
| 1404 | args.ptr(), |
| 1405 | "ddd|O!O!", |
| 1406 | &length, |
| 1407 | &width, |
| 1408 | &height, |
| 1409 | &(Base::VectorPy::Type), |
| 1410 | &pPnt, |
| 1411 | &(Base::VectorPy::Type), |
| 1412 | &pDir |
| 1413 | )) { |
| 1414 | throw Py::Exception(); |
| 1415 | } |
| 1416 | |
| 1417 | if (length < Precision::Confusion()) { |
| 1418 | throw Py::ValueError("length of box too small"); |
| 1419 | } |
| 1420 | if (width < Precision::Confusion()) { |
| 1421 | throw Py::ValueError("width of box too small"); |
| 1422 | } |
| 1423 | if (height < Precision::Confusion()) { |
| 1424 | throw Py::ValueError("height of box too small"); |
| 1425 | } |
| 1426 | |
| 1427 | try { |
| 1428 | gp_Pnt p(0, 0, 0); |
| 1429 | gp_Dir d(0, 0, 1); |
| 1430 | if (pPnt) { |
| 1431 | Base::Vector3d pnt = static_cast<Base::VectorPy*>(pPnt)->value(); |
| 1432 | p.SetCoord(pnt.x, pnt.y, pnt.z); |
| 1433 | } |
| 1434 | if (pDir) { |
| 1435 | Base::Vector3d vec = static_cast<Base::VectorPy*>(pDir)->value(); |
| 1436 | d.SetCoord(vec.x, vec.y, vec.z); |
| 1437 | } |
| 1438 | BRepPrimAPI_MakeBox mkBox(gp_Ax2(p, d), length, width, height); |
| 1439 | TopoDS_Shape ResultShape = mkBox.Shape(); |
| 1440 | return Py::asObject(new TopoShapeSolidPy(new TopoShape(ResultShape))); |
| 1441 | } |
| 1442 | catch (Standard_DomainError&) { |
| 1443 | throw Py::Exception(PartExceptionOCCDomainError, "creation of box failed"); |
| 1444 | } |
| 1445 | } |
| 1446 | Py::Object makeWedge(const Py::Tuple& args) |
| 1447 | { |
| 1448 | double xmin, ymin, zmin, z2min, x2min, xmax, ymax, zmax, z2max, x2max; |