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

Function Geom_union

Code/Source/PythonAPI/Geometry_PyModule.cxx:808–846  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

806");
807
808static PyObject *
809Geom_union(PyObject* self, PyObject* args)
810{
811 auto api = PyUtilApiFunction("sss|d", PyRunTimeErr, __func__);
812 char *aName;
813 char *bName;
814 char *dstName;
815 double tolerance = 1e-6;
816
817 if (!PyArg_ParseTuple(args, api.format, &aName, &bName, &dstName, &tolerance)) {
818 return api.argsError();
819 }
820
821 // Retrieve operands geometry.
822 auto srcA = GetRepositoryGeometry(api, aName);
823 if (srcA == nullptr ) {
824 return nullptr;
825 }
826 auto srcB = GetRepositoryGeometry(api, bName);
827 if (srcB == nullptr ) {
828 return nullptr;
829 }
830
831 if (RepositoryGeometryExists(api, dstName)) {
832 return nullptr;
833 }
834
835 cvPolyData *dst;
836 if (sys_geom_union(srcA, srcB, tolerance, &dst) != SV_OK) {
837 api.error("Error performing a union operation of geometry '" + std::string(aName) + " with '" + std::string(bName)+ ".");
838 return nullptr;
839 }
840
841 if (!AddGeometryToRepository(api, dstName, dst)) {
842 return nullptr;
843 }
844
845 return Py_BuildValue("s", dst->GetName());
846}
847
848//----------------
849// Geom_intersect

Callers

nothing calls this directly

Calls 4

sys_geom_unionFunction · 0.85
argsErrorMethod · 0.80
errorMethod · 0.80
GetNameMethod · 0.80

Tested by

no test coverage detected