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

Function Vmtk_cap_with_ids

Code/Source/PythonAPI/Vmtk_PyModule.cxx:282–347  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

280");
281
282static PyObject *
283Vmtk_cap_with_ids(PyObject* self, PyObject* args, PyObject* kwargs)
284{
285 //std::cout << "========== Vmtk_cap_with_ids ==========" << std::endl;
286 auto api = PyUtilApiFunction("O|O!O!", PyRunTimeErr, __func__);
287 static char *keywords[] = {"surface", "fill_id", "increment_id", NULL};
288 //static char *keywords[] = {"surface", "fill_id", "fill_type", NULL};
289 PyObject* surfaceArg;
290 PyObject* fillIdArg = nullptr;
291 PyObject* incIdArg = nullptr;
292
293 if (!PyArg_ParseTupleAndKeywords(args, kwargs, api.format, keywords, &surfaceArg, &PyInt_Type, &fillIdArg,
294 &PyBool_Type, &incIdArg)) {
295 return api.argsError();
296 }
297
298 // Set fill ID and fill type.
299 //
300 // fill type: How to assign ids to caps on polydata.
301 // 0 - start from 1 and each cap gets a new id.
302 // 1 - give every cap the same id (fillid).
303 // 2 - start from fillid and give each new cap a value increasing from this
304 //
305 int fillId = 0;
306 int fillType = 2;
307
308 if (fillIdArg != nullptr) {
309 fillId = PyInt_AsLong(fillIdArg);
310 if (fillId < 0) {
311 api.error("Cap fill ID must be >= 0.");
312 return nullptr;
313 }
314
315 if (incIdArg != nullptr) {
316 if (PyObject_IsTrue(incIdArg)) {
317 fillType = 2;
318 } else {
319 fillType = 1;
320 }
321 }
322 }
323 //std::cout << "[Vmtk_cap_with_ids] fillId: " << fillId << std::endl;
324 //std::cout << "[Vmtk_cap_with_ids] fillType: " << fillType << std::endl;
325
326 // Get the vtkPolyData objectsfrom the Python object.
327 //
328 auto surfPolydata = GetVtkPolyData(api, surfaceArg);
329 if (surfPolydata == nullptr) {
330 return nullptr;
331 }
332 cvPolyData cvSurfPolydata(surfPolydata);
333
334 // Perform cap operation.
335 //
336 // [TODO:DaveP] The 'num_filled' argument is not passed back from
337 // this function, it will always be 0.
338 //
339 int num_filled = 0;

Callers

nothing calls this directly

Calls 5

sys_geom_cap_with_idsFunction · 0.85
argsErrorMethod · 0.80
errorMethod · 0.80
GetVtkPolyDataFunction · 0.70
GetVtkPolyDataMethod · 0.45

Tested by

no test coverage detected