MCPcopy Create free account
hub / github.com/SimVascular/SimVascular / Geom_subtract

Function Geom_subtract

Code/Source/PythonAPI/Geometry_PyModule.cxx:914–952  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

912");
913
914static PyObject *
915Geom_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

Callers

nothing calls this directly

Calls 4

sys_geom_subtractFunction · 0.85
argsErrorMethod · 0.80
errorMethod · 0.80
GetNameMethod · 0.80

Tested by

no test coverage detected