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

Function Geom_all_union

Code/Source/PythonAPI/Geometry_PyModule.cxx:1677–1724  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1675");
1676
1677static PyObject*
1678Geom_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

Callers

nothing calls this directly

Calls 9

GetGeometryObjectsFunction · 0.85
sys_geom_all_unionFunction · 0.85
argsErrorMethod · 0.80
sizeMethod · 0.80
dataMethod · 0.80
errorMethod · 0.80
GetNameMethod · 0.80
GetVtkPolyDataMethod · 0.45
SetVtkPolyDataObjectMethod · 0.45

Tested by

no test coverage detected