From 8dd3e908961654265fcf23e6fea2a77d435ed61e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Tr=C3=B6ger?= Date: Thu, 8 May 2025 19:30:01 +0200 Subject: [PATCH] FEM: port DataAlongLine filter to use arc length. This makes it easier for the new data extraction to also plot data over line length. --- src/Mod/Fem/App/FemPostFilter.cpp | 17 +++++++---------- src/Mod/Fem/App/FemPostFilter.h | 2 ++ 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/Mod/Fem/App/FemPostFilter.cpp b/src/Mod/Fem/App/FemPostFilter.cpp index d7d054f083..79da85c5a1 100644 --- a/src/Mod/Fem/App/FemPostFilter.cpp +++ b/src/Mod/Fem/App/FemPostFilter.cpp @@ -382,18 +382,21 @@ FemPostDataAlongLineFilter::FemPostDataAlongLineFilter() m_line->SetPoint2(vec2.x, vec2.y, vec2.z); m_line->SetResolution(Resolution.getValue()); + m_arclength = vtkSmartPointer::New(); + m_arclength->SetInputConnection(m_line->GetOutputPort(0)); + auto passthrough = vtkSmartPointer::New(); m_probe = vtkSmartPointer::New(); m_probe->SetSourceConnection(passthrough->GetOutputPort(0)); - m_probe->SetInputConnection(m_line->GetOutputPort()); - m_probe->SetValidPointMaskArrayName("ValidPointArray"); + m_probe->SetInputConnection(m_arclength->GetOutputPort()); m_probe->SetPassPointArrays(1); m_probe->SetPassCellArrays(1); m_probe->ComputeToleranceOff(); m_probe->SetTolerance(0.01); clip.source = passthrough; + clip.algorithmStorage.push_back(m_arclength); clip.target = m_probe; addFilterPipeline(clip, "DataAlongLine"); @@ -488,12 +491,7 @@ void FemPostDataAlongLineFilter::GetAxisData() return; } - vtkDataArray* tcoords = dset->GetPointData()->GetTCoords("Texture Coordinates"); - - const Base::Vector3d& vec1 = Point1.getValue(); - const Base::Vector3d& vec2 = Point2.getValue(); - const Base::Vector3d diff = vec1 - vec2; - double Len = diff.Length(); + vtkDataArray* alength = dset->GetPointData()->GetArray("arc_length"); for (vtkIdType i = 0; i < dset->GetNumberOfPoints(); ++i) { double value = 0; @@ -517,8 +515,7 @@ void FemPostDataAlongLineFilter::GetAxisData() } values.push_back(value); - double tcoord = tcoords->GetComponent(i, 0); - coords.push_back(tcoord * Len); + coords.push_back(alength->GetTuple1(i)); } YAxisData.setValues(values); diff --git a/src/Mod/Fem/App/FemPostFilter.h b/src/Mod/Fem/App/FemPostFilter.h index 273bd63c0f..38499d01d3 100644 --- a/src/Mod/Fem/App/FemPostFilter.h +++ b/src/Mod/Fem/App/FemPostFilter.h @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -181,6 +182,7 @@ protected: private: vtkSmartPointer m_line; + vtkSmartPointer m_arclength; vtkSmartPointer m_probe; };