[FEM] fix enable editing for all solvers
- currently for Z88 nothing happens when clicking the Edit button in the solver task dialog. The reason is that opening *.txt files was never implemented - also do this for Elmer - for Z88 we need to open several file for a proper editing because the solver info is distributed over these files
This commit is contained in:
@@ -28,6 +28,11 @@ __url__ = "https://www.freecadweb.org"
|
||||
## \addtogroup FEM
|
||||
# @{
|
||||
|
||||
import glob
|
||||
import os
|
||||
|
||||
import FreeCAD
|
||||
|
||||
from . import tasks
|
||||
from .equations import elasticity
|
||||
from .equations import electrostatic
|
||||
@@ -39,6 +44,9 @@ from .. import run
|
||||
from .. import solverbase
|
||||
from femtools import femutils
|
||||
|
||||
if FreeCAD.GuiUp:
|
||||
import FemGui
|
||||
|
||||
|
||||
def create(doc, name="ElmerSolver"):
|
||||
return femutils.createObject(
|
||||
@@ -109,6 +117,15 @@ class Proxy(solverbase.Proxy):
|
||||
def isSupported(self, eqId):
|
||||
return eqId in self._EQUATIONS
|
||||
|
||||
def editSupported(self):
|
||||
return True
|
||||
|
||||
def edit(self, directory):
|
||||
pattern = os.path.join(directory, "case.sif")
|
||||
FreeCAD.Console.PrintMessage("{}\n".format(pattern))
|
||||
f = glob.glob(pattern)[0]
|
||||
FemGui.open(f)
|
||||
|
||||
|
||||
class ViewProxy(solverbase.ViewProxy):
|
||||
"""Proxy for FemSolverElmers View Provider."""
|
||||
|
||||
@@ -78,7 +78,27 @@ class Proxy(solverbase.Proxy):
|
||||
return True
|
||||
|
||||
def edit(self, directory):
|
||||
pattern = os.path.join(directory, "*.txt")
|
||||
pattern = os.path.join(directory, "z88i1.txt")
|
||||
FreeCAD.Console.PrintMessage("{}\n".format(pattern))
|
||||
f = glob.glob(pattern)[0]
|
||||
FemGui.open(f)
|
||||
pattern = os.path.join(directory, "z88i2.txt")
|
||||
FreeCAD.Console.PrintMessage("{}\n".format(pattern))
|
||||
f = glob.glob(pattern)[0]
|
||||
FemGui.open(f)
|
||||
pattern = os.path.join(directory, "z88i5.txt")
|
||||
FreeCAD.Console.PrintMessage("{}\n".format(pattern))
|
||||
f = glob.glob(pattern)[0]
|
||||
FemGui.open(f)
|
||||
pattern = os.path.join(directory, "z88man.txt")
|
||||
FreeCAD.Console.PrintMessage("{}\n".format(pattern))
|
||||
f = glob.glob(pattern)[0]
|
||||
FemGui.open(f)
|
||||
pattern = os.path.join(directory, "z88mat.txt")
|
||||
FreeCAD.Console.PrintMessage("{}\n".format(pattern))
|
||||
f = glob.glob(pattern)[0]
|
||||
FemGui.open(f)
|
||||
pattern = os.path.join(directory, "z88elp.txt")
|
||||
FreeCAD.Console.PrintMessage("{}\n".format(pattern))
|
||||
f = glob.glob(pattern)[0]
|
||||
FemGui.open(f)
|
||||
|
||||
Reference in New Issue
Block a user