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

Function Geom_loft

Code/Source/PythonAPI/Geometry_PyModule.cxx:523–610  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

521");
522
523static PyObject *
524Geom_loft(PyObject* self, PyObject* args, PyObject* kwargs)
525{
526 #ifdef dbg_Geom_loft
527 std::cout << " " << std::endl;
528 std::cout << "========== Geom_loft ==========" << std::endl;
529 #endif
530
531 auto api = PyUtilApiFunction("O!O!", PyRunTimeErr, __func__);
532 static char *keywords[] = {"polydata_list", "loft_options", NULL};
533 PyObject* objListArg;
534 PyObject* loftOptsArg;
535
536 if (!PyArg_ParseTupleAndKeywords(args, kwargs, api.format, keywords, &PyList_Type, &objListArg, &PyLoftOptionsType,
537 &loftOptsArg)) {
538 return api.argsError();
539 }
540
541 // Check the list of polydata curve profiles.
542 auto cvPolyDataList = GetGeometryObjects(api, objListArg);
543 if (cvPolyDataList.size() == 0) {
544 return nullptr;
545 }
546
547 if (cvPolyDataList.size() < 2) {
548 api.error("At least two profiles are needed for lofing.");
549 return nullptr;
550 }
551
552 // Check that the profiles have the same number of points.
553 int numProfilePoints = 0;
554 for (auto const& profile : cvPolyDataList) {
555 int numPoints = profile->GetVtkPolyData()->GetNumberOfPoints();
556 if (numProfilePoints == 0) {
557 numProfilePoints = numPoints;
558 } else if (numPoints != numProfilePoints) {
559 api.error("Profiles do not have the same number of points.");
560 return nullptr;
561 }
562 }
563
564 // Extract loft option values from the loftOptions object.
565 //
566 // Most of these are not used for now.
567 //
568 int numOutPtsInSegs = numProfilePoints;
569 int numOutPtsAlongLength = LoftOptionsGetInt(loftOptsArg, LoftOptions::NUM_OUT_PTS_ALONG_LENGTH);
570 int numLinearPtsAlongLength = LoftOptionsGetInt(loftOptsArg, LoftOptions::NUM_LINEAR_PTS_ALONG_LENGTH);
571 int numModes = 0; /*LoftOptionsGetInt(loftOptsArg, LoftOptions::NUM_MODES); */
572 int splineType = 0; /*LoftOptionsGetInt(loftOptsArg, LoftOptions::SPLINE_TYPE); */
573 int useFFT = 0; /*LoftOptionsGetInt(loftOptsArg, LoftOptions::USE_FFT); */
574 int useLinearSampleAlongLength = LoftOptionsGetInt(loftOptsArg, LoftOptions::USE_LINEAR_SAMPLE_ALONG_LENGTH);
575 double bias = 0.0; /*LoftOptionsGetDouble(loftOptsArg, LoftOptions::BIAS); */
576 double tension = 0.0; /*LoftOptionsGetDouble(loftOptsArg, LoftOptions::TENSION); */
577 double continuity = 0.0; /*LoftOptionsGetDouble(loftOptsArg, LoftOptions::CONTINUITY); */
578
579 #ifdef dbg_Geom_loft
580 std::cout << "[Geom_loft] numProfilePoints:" << numProfilePoints << std::endl;

Callers

nothing calls this directly

Calls 9

GetGeometryObjectsFunction · 0.85
LoftOptionsGetIntFunction · 0.85
sys_geom_loft_solidFunction · 0.85
argsErrorMethod · 0.80
sizeMethod · 0.80
errorMethod · 0.80
GetNumberOfPointsMethod · 0.80
dataMethod · 0.80
GetVtkPolyDataMethod · 0.45

Tested by

no test coverage detected