FEM: frd reader, fix analysis identifier
This commit is contained in:
@@ -33,6 +33,7 @@ __url__ = "http://www.freecadweb.org"
|
||||
import FreeCAD
|
||||
from FreeCAD import Console
|
||||
import os
|
||||
import Fem
|
||||
|
||||
|
||||
# ********* generic FreeCAD import and export methods *********
|
||||
@@ -67,18 +68,14 @@ def insert(
|
||||
def importFrd(
|
||||
filename,
|
||||
analysis=None,
|
||||
result_name_prefix=None
|
||||
result_name_prefix=""
|
||||
):
|
||||
from . import importToolsFem
|
||||
import ObjectsFem
|
||||
if result_name_prefix is None:
|
||||
result_name_prefix = ""
|
||||
|
||||
m = read_frd_result(filename)
|
||||
result_mesh_object = None
|
||||
if len(m["Nodes"]) > 0:
|
||||
if analysis:
|
||||
analysis_object = analysis
|
||||
|
||||
mesh = importToolsFem.make_femmesh(m)
|
||||
result_mesh_object = ObjectsFem.makeMeshResult(
|
||||
FreeCAD.ActiveDocument,
|
||||
@@ -120,7 +117,7 @@ def importFrd(
|
||||
res_obj.Mesh = result_mesh_object
|
||||
res_obj = importToolsFem.fill_femresult_mechanical(res_obj, result_set)
|
||||
if analysis:
|
||||
analysis_object.addObject(res_obj)
|
||||
analysis.addObject(res_obj)
|
||||
|
||||
# complementary result object calculations
|
||||
import femresult.resulttools as restools
|
||||
@@ -178,12 +175,12 @@ def importFrd(
|
||||
)
|
||||
Console.PrintMessage(error_message)
|
||||
if analysis:
|
||||
analysis_object.addObject(result_mesh_object)
|
||||
analysis.addObject(result_mesh_object)
|
||||
|
||||
if FreeCAD.GuiUp:
|
||||
if analysis:
|
||||
import FemGui
|
||||
FemGui.setActiveAnalysis(analysis_object)
|
||||
FemGui.setActiveAnalysis(analysis)
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
|
||||
else:
|
||||
|
||||
@@ -79,6 +79,8 @@ class TestCcxTools(unittest.TestCase):
|
||||
|
||||
analysis = self.active_doc.Analysis
|
||||
solver_object = self.active_doc.CalculiXccxTools
|
||||
fcc_print("Analysis {}".format(type(analysis)))
|
||||
fcc_print("Analysis {}".format(analysis.TypeId))
|
||||
|
||||
static_analysis_dir = testtools.get_unit_test_tmp_dir(
|
||||
self.temp_dir,
|
||||
@@ -86,6 +88,8 @@ class TestCcxTools(unittest.TestCase):
|
||||
)
|
||||
fea = ccxtools.FemToolsCcx(analysis, solver_object, test_mode=True)
|
||||
fea.update_objects()
|
||||
fcc_print("fea Analysis {}".format(type(fea.analysis)))
|
||||
fcc_print("fea Analysis {}".format(fea.analysis.TypeId))
|
||||
|
||||
fcc_print("Setting up working directory {}".format(static_analysis_dir))
|
||||
fea.setup_working_dir(static_analysis_dir)
|
||||
|
||||
Reference in New Issue
Block a user