| 912 | "); |
| 913 | |
| 914 | static PyObject * |
| 915 | Geom_subtract(PyObject* self, PyObject* args) |
| 916 | { |
| 917 | auto api = PyUtilApiFunction("sss|d", PyRunTimeErr, __func__); |
| 918 | char *aName; |
| 919 | char *bName; |
| 920 | char *dstName; |
| 921 | double tolerance = 1e-6; |
| 922 | |
| 923 | if (!PyArg_ParseTuple(args, api.format, &aName, &bName, &dstName, &tolerance)) { |
| 924 | return api.argsError(); |
| 925 | } |
| 926 | |
| 927 | // Retrieve operands geometry. |
| 928 | auto srcA = GetRepositoryGeometry(api, aName); |
| 929 | if (srcA == nullptr ) { |
| 930 | return nullptr; |
| 931 | } |
| 932 | auto srcB = GetRepositoryGeometry(api, bName); |
| 933 | if (srcB == nullptr ) { |
| 934 | return nullptr; |
| 935 | } |
| 936 | |
| 937 | if (RepositoryGeometryExists(api, dstName)) { |
| 938 | return nullptr; |
| 939 | } |
| 940 | |
| 941 | cvPolyData *dst; |
| 942 | if (sys_geom_subtract(srcA, srcB, tolerance, &dst) != SV_OK) { |
| 943 | api.error("Error performing a Boolean subtract of geometry '" + std::string(aName) + " with '" + std::string(bName)+ "."); |
| 944 | return nullptr; |
| 945 | } |
| 946 | |
| 947 | if (!AddGeometryToRepository(api, dstName, dst)) { |
| 948 | return nullptr; |
| 949 | } |
| 950 | |
| 951 | return Py_BuildValue("s",dst->GetName()); |
| 952 | } |
| 953 | |
| 954 | //-------------------- |
| 955 | // Geom_check_surface |
nothing calls this directly
no test coverage detected