| 792 | } |
| 793 | |
| 794 | App::DocumentObjectExecReturn* Feature::execute() |
| 795 | { |
| 796 | bool useMultithreading = true; |
| 797 | |
| 798 | App::DocumentObject* pcActual = Actual.getValue(); |
| 799 | if (!pcActual) { |
| 800 | throw Base::ValueError("No actual geometry to inspect specified"); |
| 801 | } |
| 802 | |
| 803 | InspectActualGeometry* actual = nullptr; |
| 804 | if (pcActual->isDerivedFrom<Mesh::Feature>()) { |
| 805 | Mesh::Feature* mesh = static_cast<Mesh::Feature*>(pcActual); |
| 806 | actual = new InspectActualMesh(mesh->Mesh.getValue()); |
| 807 | } |
| 808 | else if (pcActual->isDerivedFrom<Points::Feature>()) { |
| 809 | Points::Feature* pts = static_cast<Points::Feature*>(pcActual); |
| 810 | actual = new InspectActualPoints(pts->Points.getValue()); |
| 811 | } |
| 812 | else if (pcActual->isDerivedFrom<Part::Feature>()) { |
| 813 | useMultithreading = false; |
| 814 | Part::Feature* part = static_cast<Part::Feature*>(pcActual); |
| 815 | actual = new InspectActualShape(part->Shape.getShape()); |
| 816 | } |
| 817 | else { |
| 818 | throw Base::TypeError("Unknown geometric type"); |
| 819 | } |
| 820 | |
| 821 | // clang-format off |
| 822 | // get a list of nominals |
| 823 | std::vector<InspectNominalGeometry*> inspectNominal; |
| 824 | const std::vector<App::DocumentObject*>& nominals = Nominals.getValues(); |
| 825 | for (auto it : nominals) { |
| 826 | InspectNominalGeometry* nominal = nullptr; |
| 827 | if (it->isDerivedFrom<Mesh::Feature>()) { |
| 828 | Mesh::Feature* mesh = static_cast<Mesh::Feature*>(it); |
| 829 | nominal = new InspectNominalMesh(mesh->Mesh.getValue(), this->SearchRadius.getValue()); |
| 830 | } |
| 831 | else if (it->isDerivedFrom<Points::Feature>()) { |
| 832 | Points::Feature* pts = static_cast<Points::Feature*>(it); |
| 833 | nominal = new InspectNominalPoints(pts->Points.getValue(), this->SearchRadius.getValue()); |
| 834 | } |
| 835 | else if (it->isDerivedFrom<Part::Feature>()) { |
| 836 | useMultithreading = false; |
| 837 | Part::Feature* part = static_cast<Part::Feature*>(it); |
| 838 | nominal = new InspectNominalShape(part->Shape.getValue(), this->SearchRadius.getValue()); |
| 839 | } |
| 840 | |
| 841 | if (nominal) { |
| 842 | inspectNominal.push_back(nominal); |
| 843 | } |
| 844 | } |
| 845 | // clang-format on |
| 846 | |
| 847 | #if 0 |
| 848 | # if 1 // test with some huge data sets |
| 849 | std::vector<unsigned long> index(actual->countPoints()); |
| 850 | std::generate(index.begin(), index.end(), Base::iotaGen<unsigned long>(0)); |
| 851 | DistanceInspection check(this->SearchRadius.getValue(), actual, inspectNominal); |
nothing calls this directly
no test coverage detected