| 1675 | "); |
| 1676 | |
| 1677 | static PyObject* |
| 1678 | Geom_all_union(PyObject* self, PyObject* args) |
| 1679 | { |
| 1680 | auto api = PyUtilApiFunction("Ois|d", PyRunTimeErr, __func__); |
| 1681 | PyObject* srcList; |
| 1682 | int interT; |
| 1683 | char *dstName; |
| 1684 | double tolerance = 1e-5; |
| 1685 | |
| 1686 | if (!PyArg_ParseTuple(args, api.format, &srcList, &interT, &dstName, &tolerance)) { |
| 1687 | return api.argsError(); |
| 1688 | } |
| 1689 | |
| 1690 | // Check that sources are in the repository. |
| 1691 | // |
| 1692 | std::vector<cvPolyData*> srcs; |
| 1693 | if (!GetGeometryObjects(api, srcList, srcs)) { |
| 1694 | return nullptr; |
| 1695 | } |
| 1696 | auto numSrcs = srcs.size(); |
| 1697 | |
| 1698 | if (RepositoryGeometryExists(api, dstName)) { |
| 1699 | return nullptr; |
| 1700 | } |
| 1701 | |
| 1702 | cvPolyData *dst; |
| 1703 | if (sys_geom_all_union(srcs.data(), numSrcs,interT, tolerance, &dst) != SV_OK) { |
| 1704 | api.error("Error in the all union operation."); |
| 1705 | return nullptr; |
| 1706 | } |
| 1707 | |
| 1708 | // Create new solid: |
| 1709 | auto geom = cvSolidModel::pyDefaultInstantiateSolidModel(); |
| 1710 | if (geom == NULL) { |
| 1711 | api.error("Error creating solid model."); |
| 1712 | return nullptr; |
| 1713 | } |
| 1714 | |
| 1715 | auto dstPd = dst->GetVtkPolyData(); |
| 1716 | geom->SetVtkPolyDataObject(dstPd); |
| 1717 | |
| 1718 | if (!AddGeometryToRepository(api, dstName, dst)) { |
| 1719 | delete geom; |
| 1720 | return nullptr; |
| 1721 | } |
| 1722 | |
| 1723 | return Py_BuildValue("s",geom->GetName()); |
| 1724 | } |
| 1725 | |
| 1726 | //----------------------------- |
| 1727 | // Geom_convert_nurbs_to_poly |
nothing calls this directly
no test coverage detected