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

Function Geom_intersect

Code/Source/PythonAPI/Geometry_PyModule.cxx:861–899  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

859");
860
861static PyObject *
862Geom_intersect(PyObject* self, PyObject* args)
863{
864 auto api = PyUtilApiFunction("sss|d", PyRunTimeErr, __func__);
865 char *aName;
866 char *bName;
867 char *dstName;
868 double tolerance = 1e-6;
869
870 if (!PyArg_ParseTuple(args, api.format, &aName, &bName, &dstName, &tolerance)) {
871 return api.argsError();
872 }
873
874 // Retrieve operands geometry.
875 auto srcA = GetRepositoryGeometry(api, aName);
876 if (srcA == nullptr ) {
877 return nullptr;
878 }
879 auto srcB = GetRepositoryGeometry(api, bName);
880 if (srcB == nullptr ) {
881 return nullptr;
882 }
883
884 if (RepositoryGeometryExists(api, dstName)) {
885 return nullptr;
886 }
887
888 cvPolyData *dst;
889 if (sys_geom_intersect(srcA, srcB, tolerance, &dst) != SV_OK) {
890 api.error("Error performing a Boolean intersection of geometry '" + std::string(aName) + " with '" + std::string(bName)+ ".");
891 return nullptr;
892 }
893
894 if (!AddGeometryToRepository(api, dstName, dst)) {
895 return nullptr;
896 }
897
898 return Py_BuildValue("s",dst->GetName());
899}
900
901//---------------
902// Geom_subtract

Callers

nothing calls this directly

Calls 4

sys_geom_intersectFunction · 0.85
argsErrorMethod · 0.80
errorMethod · 0.80
GetNameMethod · 0.80

Tested by

no test coverage detected