| 634 | "); |
| 635 | |
| 636 | static PyObject * |
| 637 | Geom_loft_nurbs(PyObject* self, PyObject* args, PyObject* kwargs) |
| 638 | { |
| 639 | #define ndbg_Geom_loft_nurbs |
| 640 | #ifdef dbg_Geom_loft_nurbs |
| 641 | std::cout << " " << std::endl; |
| 642 | std::cout << "========== Geom_loft_nurbs ==========" << std::endl; |
| 643 | #endif |
| 644 | auto api = PyUtilApiFunction("O!O!|i", PyRunTimeErr, __func__); |
| 645 | static char *keywords[] = {"polydata_list", "loft_options", "num_sections", NULL}; |
| 646 | PyObject* objListArg; |
| 647 | PyObject* loftOptsArg; |
| 648 | int num_sections = 12; |
| 649 | |
| 650 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, api.format, keywords, &PyList_Type, &objListArg, |
| 651 | &PyLoftNurbsOptionsType, &loftOptsArg, &num_sections)) { |
| 652 | return api.argsError(); |
| 653 | } |
| 654 | |
| 655 | // Check the list of polydata curve profiles. |
| 656 | auto cvPolyDataList = GetGeometryObjects(api, objListArg); |
| 657 | int numProfiles = cvPolyDataList.size(); |
| 658 | if (numProfiles == 0) { |
| 659 | return nullptr; |
| 660 | } |
| 661 | |
| 662 | if (numProfiles < 2) { |
| 663 | api.error("At least two profiles are needed for lofing."); |
| 664 | return nullptr; |
| 665 | } |
| 666 | |
| 667 | // Check that the profiles have the same number of points. |
| 668 | int numProfilePoints = 0; |
| 669 | for (auto const& profile : cvPolyDataList) { |
| 670 | int numPoints = profile->GetVtkPolyData()->GetNumberOfPoints(); |
| 671 | if (numProfilePoints == 0) { |
| 672 | numProfilePoints = numPoints; |
| 673 | } else if (numPoints != numProfilePoints) { |
| 674 | api.error("Profiles do not have the same number of points."); |
| 675 | return nullptr; |
| 676 | } |
| 677 | } |
| 678 | |
| 679 | // Extract loft option values from the loftOptions object. |
| 680 | // |
| 681 | int uDegree = LoftNurbsOptionsGetInt(loftOptsArg, LoftNurbsOptions::U_DEGREE); |
| 682 | int vDegree = LoftNurbsOptionsGetInt(loftOptsArg, LoftNurbsOptions::V_DEGREE); |
| 683 | double uSpacing = 1.0 / (num_sections * numProfiles); |
| 684 | double vSpacing = 1.0 / numProfilePoints; |
| 685 | char* uKnotSpanType = LoftNurbsOptionsGetString(loftOptsArg, LoftNurbsOptions::U_KNOT_SPAN_TYPE); |
| 686 | char* vKnotSpanType = LoftNurbsOptionsGetString(loftOptsArg, LoftNurbsOptions::V_KNOT_SPAN_TYPE); |
| 687 | char* uParametricSpanType = LoftNurbsOptionsGetString(loftOptsArg, LoftNurbsOptions::U_PARAMETRIC_SPAN_TYPE); |
| 688 | char* vParametricSpanType = LoftNurbsOptionsGetString(loftOptsArg, LoftNurbsOptions::V_PARAMETRIC_SPAN_TYPE); |
| 689 | |
| 690 | #ifdef dbg_Geom_loft_nurbs |
| 691 | std::cout << "[Geom_loft_nurbs] numProfilePoints: " << numProfilePoints << std::endl; |
| 692 | std::cout << "[Geom_loft_nurbs] uDegree: " << uDegree << std::endl; |
| 693 | std::cout << "[Geom_loft_nurbs] vDegree: " << vDegree << std::endl; |
nothing calls this directly
no test coverage detected