FEM: Extraction code CodeQL updated and typo fix
This commit is contained in:
Submodule src/Mod/AddonManager updated: 69a6e0dc7b...34d433a02c
@@ -590,7 +590,6 @@ class ExtractLinkView(QtGui.QWidget):
|
||||
candidates = self._object.OutList
|
||||
|
||||
# get all widgets from the candidates
|
||||
extractors = []
|
||||
for candidate in candidates:
|
||||
if extr.is_extractor_object(candidate):
|
||||
summary = self._build_summary_widget(candidate)
|
||||
@@ -620,8 +619,6 @@ class ExtractLinkView(QtGui.QWidget):
|
||||
QtCore.Slot(object, object) # visualization data, extraction data
|
||||
def newVisualization(self, vis_data, ext_data):
|
||||
|
||||
doc = self._object.Document
|
||||
|
||||
FreeCADGui.addModule(vis_data.module)
|
||||
FreeCADGui.addModule(ext_data.module)
|
||||
FreeCADGui.addModule("FemGui")
|
||||
|
||||
@@ -40,8 +40,8 @@ from PySide import QtCore
|
||||
import FreeCAD
|
||||
|
||||
|
||||
# Registry to handle visulization commands
|
||||
# ########################################
|
||||
# Registry to handle visualization commands
|
||||
# #########################################
|
||||
|
||||
_registry = {}
|
||||
|
||||
|
||||
@@ -83,6 +83,8 @@ class VtkTableModel(QtCore.QAbstractTableModel):
|
||||
col = self._table.GetColumn(index.column())
|
||||
return col.GetTuple(index.row())[0]
|
||||
|
||||
return None
|
||||
|
||||
def headerData(self, section, orientation, role):
|
||||
|
||||
if orientation == QtCore.Qt.Horizontal and role == QtCore.Qt.DisplayRole:
|
||||
@@ -98,6 +100,8 @@ class VtkTableModel(QtCore.QAbstractTableModel):
|
||||
if orientation == QtCore.Qt.Vertical and role == QtCore.Qt.DisplayRole:
|
||||
return section
|
||||
|
||||
return None
|
||||
|
||||
def getTable(self):
|
||||
return self._table
|
||||
|
||||
@@ -134,6 +138,8 @@ class VtkTableSummaryModel(QtCore.QAbstractTableModel):
|
||||
range = col.GetRange()
|
||||
return range[index.column()]
|
||||
|
||||
return None
|
||||
|
||||
def headerData(self, section, orientation, role):
|
||||
|
||||
if orientation == QtCore.Qt.Horizontal and role == QtCore.Qt.DisplayRole:
|
||||
@@ -142,6 +148,8 @@ class VtkTableSummaryModel(QtCore.QAbstractTableModel):
|
||||
if orientation == QtCore.Qt.Vertical and role == QtCore.Qt.DisplayRole:
|
||||
return self._table.GetColumnName(section)
|
||||
|
||||
return None
|
||||
|
||||
def getTable(self):
|
||||
return self._table
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ class Extractor(base_fempythonobject.BaseFemPythonObject):
|
||||
case _:
|
||||
return ["Not a vector"]
|
||||
|
||||
def get_representive_fieldname(self):
|
||||
def get_representive_fieldname(self, obj):
|
||||
# should return the representive field name, e.g. Position (X)
|
||||
return ""
|
||||
|
||||
|
||||
@@ -160,8 +160,8 @@ class PostVisualization(base_fempythonobject.BaseFemPythonObject):
|
||||
array.SetNumberOfComponents(c_array.GetNumberOfComponents())
|
||||
array.SetNumberOfTuples(rows)
|
||||
array.Fill(0) # so that all non-used entries are set to 0
|
||||
for i in range(c_array.GetNumberOfTuples()):
|
||||
array.SetTuple(i, c_array.GetTuple(i))
|
||||
for j in range(c_array.GetNumberOfTuples()):
|
||||
array.SetTuple(j, c_array.GetTuple(j))
|
||||
|
||||
array.SetName(f"{child.Source.Name}: {c_array.GetName()}")
|
||||
table.AddColumn(array)
|
||||
|
||||
@@ -77,17 +77,16 @@ class PostFieldData1D(base_fempostextractors.Extractor1D):
|
||||
obj.Table = table
|
||||
return
|
||||
|
||||
frames = False
|
||||
timesteps=[]
|
||||
if obj.ExtractFrames:
|
||||
# check if we have timesteps
|
||||
info = obj.Source.getOutputAlgorithm().GetOutputInformation(0)
|
||||
if info.Has(vtkStreamingDemandDrivenPipeline.TIME_STEPS()):
|
||||
timesteps = info.Get(vtkStreamingDemandDrivenPipeline.TIME_STEPS())
|
||||
frames = True
|
||||
else:
|
||||
FreeCAD.Console.PrintWarning("No frames available in data, ignoring \"ExtractFrames\" property")
|
||||
|
||||
if not frames:
|
||||
if not timesteps:
|
||||
# get the dataset and extract the correct array
|
||||
array = self._x_array_from_dataset(obj, dataset)
|
||||
if array.GetNumberOfComponents() > 1:
|
||||
|
||||
@@ -78,17 +78,16 @@ class PostFieldData2D(base_fempostextractors.Extractor2D):
|
||||
obj.Table = table
|
||||
return
|
||||
|
||||
frames = False
|
||||
timesteps = []
|
||||
if obj.ExtractFrames:
|
||||
# check if we have timesteps
|
||||
info = obj.Source.getOutputAlgorithm().GetOutputInformation(0)
|
||||
if info.Has(vtkStreamingDemandDrivenPipeline.TIME_STEPS()):
|
||||
timesteps = info.Get(vtkStreamingDemandDrivenPipeline.TIME_STEPS())
|
||||
frames = True
|
||||
else:
|
||||
FreeCAD.Console.PrintWarning("No frames available in data, ignoring \"ExtractFrames\" property")
|
||||
|
||||
if not frames:
|
||||
if not timesteps:
|
||||
# get the dataset and extract the correct array
|
||||
xarray = self._x_array_from_dataset(obj, dataset)
|
||||
if xarray.GetNumberOfComponents() > 1:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
2# ***************************************************************************
|
||||
# ***************************************************************************
|
||||
# * Copyright (c) 2025 Stefan Tröger <stefantroeger@gmx.net> *
|
||||
# * *
|
||||
# * This file is part of the FreeCAD CAx development system. *
|
||||
|
||||
@@ -32,9 +32,7 @@ __url__ = "https://www.freecad.org"
|
||||
from PySide import QtCore, QtGui
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
|
||||
from femguiutils import selection_widgets
|
||||
from . import base_femtaskpanel
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
@@ -31,10 +31,6 @@ __url__ = "https://www.freecad.org"
|
||||
|
||||
from PySide import QtCore, QtGui
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
|
||||
from femguiutils import selection_widgets
|
||||
from . import base_fempostpanel
|
||||
|
||||
|
||||
|
||||
@@ -56,49 +56,6 @@ class _TaskPanel(base_fempostpanel._BasePostTaskPanel):
|
||||
# form made from param and selection widget
|
||||
self.form = [self.widget, vobj.createDisplayTaskWidget()]
|
||||
|
||||
# get the settings group
|
||||
self.__settings_grp = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem")
|
||||
|
||||
# Implement parent functions
|
||||
# ##########################
|
||||
|
||||
def getStandardButtons(self):
|
||||
return (
|
||||
QtGui.QDialogButtonBox.Apply | QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Cancel
|
||||
)
|
||||
|
||||
def clicked(self, button):
|
||||
# apply button hit?
|
||||
if button == QtGui.QDialogButtonBox.Apply:
|
||||
self.obj.Document.recompute()
|
||||
|
||||
def accept(self):
|
||||
# self.obj.CharacteristicLength = self.elelen
|
||||
# self.obj.References = self.selection_widget.references
|
||||
# self.selection_widget.finish_selection()
|
||||
return super().accept()
|
||||
|
||||
def reject(self):
|
||||
# self.selection_widget.finish_selection()
|
||||
return super().reject()
|
||||
|
||||
# Helper functions
|
||||
# ##################
|
||||
|
||||
def _recompute(self):
|
||||
# only recompute if the user wants automatic recompute
|
||||
if self.__settings_grp.GetBool("PostAutoRecompute", True):
|
||||
self.obj.Document.recompute()
|
||||
|
||||
def _enumPropertyToCombobox(self, obj, prop, cbox):
|
||||
cbox.blockSignals(True)
|
||||
cbox.clear()
|
||||
entries = obj.getEnumerationsOfProperty(prop)
|
||||
for entry in entries:
|
||||
cbox.addItem(entry)
|
||||
|
||||
cbox.setCurrentText(getattr(obj, prop))
|
||||
cbox.blockSignals(False)
|
||||
|
||||
# Setup functions
|
||||
# ###############
|
||||
|
||||
@@ -36,7 +36,6 @@ import FreeCADGui
|
||||
|
||||
from . import base_fempostpanel
|
||||
from femguiutils import extract_link_view as elv
|
||||
from femguiutils import vtk_table_view
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
@@ -78,9 +77,6 @@ class _TaskPanel(base_fempostpanel._BasePostTaskPanel):
|
||||
# connect data widget
|
||||
self.data_widget.show_table.clicked.connect(self.showTable)
|
||||
|
||||
# set current values to view widget
|
||||
viewObj = self.obj.ViewObject
|
||||
|
||||
|
||||
@QtCore.Slot()
|
||||
def showTable(self):
|
||||
|
||||
@@ -33,7 +33,6 @@ __url__ = "https://www.freecad.org"
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
|
||||
import FemGui
|
||||
from PySide import QtGui
|
||||
|
||||
import femobjects.base_fempostextractors as fpe
|
||||
|
||||
Reference in New Issue
Block a user