FEM: Adopt post extraction code to updated main

This commit is contained in:
Stefan Tröger
2025-05-06 16:37:03 +02:00
parent 3c22e30cd2
commit 463c6c9149
13 changed files with 47 additions and 36 deletions

View File

@@ -189,7 +189,7 @@ PyObject* FemPostFilterPy::getInputScalarFields(PyObject* args)
PyObject* FemPostFilterPy::getOutputAlgorithm(PyObject* args)
{
#ifdef BUILD_FEM_VTK_WRAPPER
#ifdef FC_USE_VTK_PYTHON
// we take no arguments
if (!PyArg_ParseTuple(args, "")) {
return nullptr;

View File

@@ -29,7 +29,7 @@
#include "FemPostObjectPy.h"
#include "FemPostObjectPy.cpp"
#ifdef BUILD_FEM_VTK_WRAPPER
#ifdef FC_USE_VTK_PYTHON
#include <vtkDataSet.h>
#include <vtkPythonUtil.h>
#endif //BUILD_FEM_VTK
@@ -61,7 +61,7 @@ PyObject* FemPostObjectPy::writeVTK(PyObject* args)
PyObject* FemPostObjectPy::getDataSet(PyObject* args)
{
#ifdef BUILD_FEM_VTK_WRAPPER
#ifdef FC_USE_VTK_PYTHON
// we take no arguments
if (!PyArg_ParseTuple(args, "")) {
return nullptr;

View File

@@ -34,7 +34,7 @@
#include "FemPostPipelinePy.cpp"
// clang-format on
#ifdef BUILD_FEM_VTK_WRAPPER
#ifdef FC_USE_VTK_PYTHON
#include <vtkPythonUtil.h>
#endif //BUILD_FEM_VTK
@@ -319,7 +319,7 @@ PyObject* FemPostPipelinePy::renameArrays(PyObject* args)
PyObject* FemPostPipelinePy::getOutputAlgorithm(PyObject* args)
{
#ifdef BUILD_FEM_VTK_WRAPPER
#ifdef FC_USE_VTK_PYTHON
// we take no arguments
if (!PyArg_ParseTuple(args, "")) {
return nullptr;

View File

@@ -182,8 +182,6 @@ SET(FemObjects_SRCS
femobjects/base_femelement.py
femobjects/base_femmeshelement.py
femobjects/base_fempythonobject.py
femobjects/base_fempostextractors.py
femobjects/base_fempostvisualizations.py
femobjects/constant_vacuumpermittivity.py
femobjects/constraint_bodyheatsource.py
femobjects/constraint_centrif.py
@@ -216,8 +214,9 @@ SET(FemObjects_SRCS
)
if(BUILD_FEM_VTK_PYTHON)
SET(FemObjects_SRCS
${FemObjects_SRCS}
list(APPEND FemObjects_SRCS
femobjects/base_fempostextractors.py
femobjects/base_fempostvisualizations.py
femobjects/post_glyphfilter.py
femobjects/post_extract1D.py
femobjects/post_extract2D.py
@@ -633,8 +632,7 @@ SET(FemGuiTaskPanels_SRCS
)
if(BUILD_FEM_VTK_PYTHON)
SET(FemGuiTaskPanels_SRCS
${FemGuiTaskPanels_SRCS}
list(APPEND FemGuiTaskPanels_SRCS
femtaskpanels/task_post_glyphfilter.py
femtaskpanels/task_post_histogram.py
femtaskpanels/task_post_lineplot.py
@@ -653,13 +651,18 @@ SET(FemGuiUtils_SRCS
femguiutils/disambiguate_solid_selection.py
femguiutils/migrate_gui.py
femguiutils/selection_widgets.py
femguiutils/vtk_module_handling.py
femguiutils/vtk_table_view.py
femguiutils/data_extraction.py
femguiutils/extract_link_view.py
femguiutils/post_visualization.py
)
if(BUILD_FEM_VTK_PYTHON)
list(APPEND FemGuiUtils_SRCS
femguiutils/vtk_module_handling.py
femguiutils/vtk_table_view.py
femguiutils/data_extraction.py
femguiutils/extract_link_view.py
femguiutils/post_visualization.py
)
endif(BUILD_FEM_VTK_PYTHON)
SET(FemGuiViewProvider_SRCS
femviewprovider/__init__.py
femviewprovider/view_base_femconstraint.py
@@ -667,8 +670,6 @@ SET(FemGuiViewProvider_SRCS
femviewprovider/view_base_femmaterial.py
femviewprovider/view_base_femmeshelement.py
femviewprovider/view_base_femobject.py
femviewprovider/view_base_fempostvisualization.py
femviewprovider/view_base_fempostextractors.py
femviewprovider/view_constant_vacuumpermittivity.py
femviewprovider/view_constraint_bodyheatsource.py
femviewprovider/view_constraint_centrif.py
@@ -701,10 +702,10 @@ SET(FemGuiViewProvider_SRCS
)
if(BUILD_FEM_VTK_PYTHON)
SET(FemGuiViewProvider_SRCS
${FemGuiViewProvider_SRCS}
list(APPEND FemGuiViewProvider_SRCS
femviewprovider/view_base_fempostextractors.py
femviewprovider/view_base_fempostvisualization.py
femviewprovider/view_post_glyphfilter.py
femviewprovider/view_post_extract.py
femviewprovider/view_post_histogram.py
femviewprovider/view_post_lineplot.py
femviewprovider/view_post_table.py

View File

@@ -76,7 +76,7 @@ TaskPostExtraction::TaskPostExtraction(ViewProviderFemPostObject* view, QWidget*
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
if (m_panel.hasAttr(std::string("widget"))) {
@@ -129,7 +129,7 @@ void TaskPostExtraction::onPostDataChanged(Fem::FemPostObject* obj)
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
};
@@ -145,7 +145,7 @@ bool TaskPostExtraction::isGuiTaskOnly()
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
return false;
@@ -162,7 +162,7 @@ void TaskPostExtraction::apply()
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -178,7 +178,7 @@ bool TaskPostExtraction::initiallyCollapsed()
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
return false;

View File

@@ -215,7 +215,7 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
<< "FEM_PostFilterCalculator"
<< "Separator"
<< "FEM_PostCreateFunctions"
#ifdef BUILD_FEM_VTK_WRAPPER
#ifdef FC_USE_VTK_PYTHON
<< "FEM_PostVisualization"
#endif
;
@@ -371,7 +371,7 @@ Gui::MenuItem* Workbench::setupMenuBar() const
<< "FEM_PostFilterCalculator"
<< "Separator"
<< "FEM_PostCreateFunctions"
#ifdef BUILD_FEM_VTK_WRAPPER
#ifdef FC_USE_VTK_PYTHON
<< "FEM_PostVisualization"
#endif
;

View File

@@ -81,9 +81,9 @@ class FemWorkbench(Workbench):
False if femcommands.commands.__name__ else True
# check vtk version to potentially find missmatchs
from femguiutils.vtk_module_handling import vtk_module_handling
vtk_module_handling()
if "BUILD_FEM_VTK_PYTHON" in FreeCAD.__cmake__:
from femguiutils.vtk_module_handling import vtk_module_handling
vtk_module_handling()
def GetClassName(self):
# see https://forum.freecad.org/viewtopic.php?f=10&t=43300

View File

@@ -40,7 +40,6 @@ from .manager import CommandManager
from femtools.femutils import expandParentObject
from femtools.femutils import is_of_type
from femsolver.settings import get_default_solver
from femguiutils import post_visualization
# Python command definitions:
# for C++ command definitions see src/Mod/Fem/Command.cpp
@@ -1294,4 +1293,6 @@ if "BUILD_FEM_VTK_PYTHON" in FreeCAD.__cmake__:
import femobjects.post_lineplot
import femobjects.post_histogram
import femobjects.post_table
from femguiutils import post_visualization
post_visualization.setup_commands("FEM_PostVisualization")

View File

@@ -34,7 +34,6 @@ import FreeCAD
from femtools.femutils import expandParentObject
from femtools.femutils import is_of_type
from femguiutils.vtk_module_handling import vtk_compatibility_abort
if FreeCAD.GuiUp:
from PySide import QtCore
@@ -380,7 +379,8 @@ class CommandManager:
# like add_obj_on_gui_selobj_noset_edit but the selection is kept
# and the selobj is expanded in the tree to see the added obj
# check if we should use python filter
# check if we should use python fitler
from femguiutils.vtk_module_handling import vtk_compatibility_abort
if vtk_compatibility_abort(True):
return

View File

@@ -33,7 +33,6 @@ import FreeCAD
# check vtk version to potentially find missmatchs
from femguiutils.vtk_module_handling import vtk_module_handling
vtk_module_handling()
# IMPORTANT: Never import vtk directly. Often vtk is compiled with different QT

View File

@@ -29,6 +29,9 @@ __url__ = "https://www.freecad.org"
# \ingroup FEM
# \brief Post processing plot displaying histograms
# check vtk version to potentially find missmatchs
from femguiutils.vtk_module_handling import vtk_module_handling
vtk_module_handling()
from . import base_fempostextractors
from . import base_fempostvisualizations

View File

@@ -29,6 +29,10 @@ __url__ = "https://www.freecad.org"
# \ingroup FEM
# \brief Post processing plot displaying lines
# check vtk version to potentially find missmatchs
from femguiutils.vtk_module_handling import vtk_module_handling
vtk_module_handling()
from . import base_fempostextractors
from . import base_fempostvisualizations
from . import post_extract2D

View File

@@ -29,11 +29,14 @@ __url__ = "https://www.freecad.org"
# \ingroup FEM
# \brief Post processing plot displaying tables
# check vtk version to potentially find missmatchs
from femguiutils.vtk_module_handling import vtk_module_handling
vtk_module_handling()
from . import base_fempostextractors
from . import base_fempostvisualizations
from . import post_extract1D
from femguiutils import post_visualization
# register visualization and extractors