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

Function PyUtilCheckPointData

Code/Source/PythonAPI/PyUtils.cxx:235–255  ·  view source on GitHub ↗

---------------------- PyUtilCheckPointData ---------------------- Check Python point data. The point data is a list [x,y,z] of three floats. If there is a problem with the data then the function returns false and a string describing the problem.

Source from the content-addressed store, hash-verified

233// a string describing the problem.
234//
235bool PyUtilCheckPointData(PyObject *pointData, std::string& msg)
236{
237 if (!PyList_Check(pointData)) {
238 msg = "is not a Python list.";
239 return false;
240 }
241
242 if (PyList_Size(pointData) != 3) {
243 msg = "is not a 3D point (three float values).";
244 return false;
245 }
246
247 for (int i = 0; i < 3; i++) {
248 if (!PyFloat_Check(PyList_GetItem(pointData,i))) {
249 msg = "data at " + std::to_string(i) + " in the list is not a float.";
250 return false;
251 }
252 }
253
254 return true;
255}
256
257//------------------------
258// PyUtilConvertPointData

Callers 7

ModelingModeler_boxFunction · 0.85
ModelingModeler_cylinderFunction · 0.85
ModelingModeler_sphereFunction · 0.85
Path_add_control_pointFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected