本文整理汇总了Python中Fem.readResult方法的典型用法代码示例。如果您正苦于以下问题:Python Fem.readResult方法的具体用法?Python Fem.readResult怎么用?Python Fem.readResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fem
的用法示例。
在下文中一共展示了Fem.readResult方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: importVtkFCResult
# 需要导入模块: import Fem [as 别名]
# 或者: from Fem import readResult [as 别名]
def importVtkFCResult(filename, resultname, analysis=None, result_name_prefix=None):
# only fields from vtk are imported if they exactly named as the FreeCAD result properties
# See _getFreeCADMechResultProperties() in FemVTKTools.cpp for the supported names
import ObjectsFem
from . import importToolsFem
if result_name_prefix is None:
result_name_prefix = ''
if analysis:
analysis_object = analysis
results_name = result_name_prefix + 'results'
result_obj = ObjectsFem.makeResultMechanical(FreeCAD.ActiveDocument, results_name)
Fem.readResult(filename, result_obj.Name) # readResult always creates a new femmesh named ResultMesh
# workaround for the DisplacementLengths (They should have been calculated by Fem.readResult)
if not result_obj.DisplacementLengths:
result_obj.DisplacementLengths = importToolsFem.calculate_disp_abs(result_obj.DisplacementVectors)
FreeCAD.Console.PrintMessage('Recalculated DisplacementLengths.\n')
''' seems unused at the moment
filenamebase = '.'.join(filename.split('.')[:-1]) # pattern: filebase_timestamp.vtk
ts = filenamebase.split('_')[-1]
try:
time_step = float(ts)
except:
time_step = 0.0
'''
if analysis:
analysis_object.addObject(result_obj)
result_obj.touch()
FreeCAD.ActiveDocument.recompute()
示例2: importVTK
# 需要导入模块: import Fem [as 别名]
# 或者: from Fem import readResult [as 别名]
def importVTK(filename, analysis=None, result_name_prefix=None):
import ObjectsFem
if result_name_prefix is None:
result_name_prefix = ''
if analysis is None:
analysis_name = os.path.splitext(os.path.basename(filename))[0]
analysis_object = ObjectsFem.makeAnalysis('Analysis')
analysis_object.Label = analysis_name
else:
analysis_object = analysis
# if properties can be added in FemVTKTools importCfdResult(), this file can be used for CFD workbench
results_name = result_name_prefix + 'results'
result_obj = ObjectsFem.makeResultMechanical(results_name)
# result_obj = FreeCAD.ActiveDocument.addObject('Fem::FemResultObject', results_name)
Fem.readResult(filename, result_obj.Name) # readResult always creates a new femmesh named ResultMesh
# workaround for the DisplacementLengths (They should have been calculated by Fem.readResult)
if not result_obj.DisplacementLengths:
import importToolsFem
result_obj.DisplacementLengths = importToolsFem.calculate_disp_abs(result_obj.DisplacementVectors)
analysis_object.Member = analysis_object.Member + [result_obj]
# FIXME move the ResultMesh in the analysis
''' seams not used at the moment
示例3: importVTK
# 需要导入模块: import Fem [as 别名]
# 或者: from Fem import readResult [as 别名]
def importVTK(filename, analysis=None, result_name_prefix=None):
import ObjectsFem
if result_name_prefix is None:
result_name_prefix = ''
if analysis:
analysis_object = analysis
# if properties can be added in FemVTKTools importCfdResult(), this file can be used for CFD workbench
results_name = result_name_prefix + 'results'
result_obj = ObjectsFem.makeResultMechanical(results_name)
Fem.readResult(filename, result_obj.Name) # readResult always creates a new femmesh named ResultMesh
# workaround for the DisplacementLengths (They should have been calculated by Fem.readResult)
if not result_obj.DisplacementLengths:
import importToolsFem
result_obj.DisplacementLengths = importToolsFem.calculate_disp_abs(result_obj.DisplacementVectors)
if analysis:
analysis_object.Member = analysis_object.Member + [result_obj]
''' seams not used at the moment
示例4: importVtkFCResult
# 需要导入模块: import Fem [as 别名]
# 或者: from Fem import readResult [as 别名]
def importVtkFCResult(
filename,
resultname,
analysis=None,
result_name_prefix=None
):
# only fields from vtk are imported if they exactly named as the FreeCAD result properties
# See _getFreeCADMechResultProperties() in FemVTKTools.cpp for the supported names
import ObjectsFem
if result_name_prefix is None:
result_name_prefix = ''
if analysis:
analysis_object = analysis
results_name = result_name_prefix + 'results'
result_obj = ObjectsFem.makeResultMechanical(FreeCAD.ActiveDocument, results_name)
# readResult always creates a new femmesh named ResultMesh
Fem.readResult(filename, result_obj.Name)
# add missing DisplacementLengths (They should have been added by Fem.readResult)
if not result_obj.DisplacementLengths:
import femresult.resulttools as restools
result_obj = restools.add_disp_apps(result_obj) # DisplacementLengths
''' seems unused at the moment
filenamebase = '.'.join(filename.split('.')[:-1]) # pattern: filebase_timestamp.vtk
ts = filenamebase.split('_')[-1]
try:
time_step = float(ts)
except:
time_step = 0.0
'''
if analysis:
analysis_object.addObject(result_obj)
result_obj.touch()
FreeCAD.ActiveDocument.recompute()
return result_obj