当前位置: 首页>>代码示例>>Python>>正文


Python Fem.readResult方法代码示例

本文整理汇总了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()
开发者ID:KeithSloan,项目名称:FreeCAD_sf_master,代码行数:35,代码来源:importVTKResults.py

示例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
开发者ID:crobarcro,项目名称:FreeCAD,代码行数:28,代码来源:importVTKResults.py

示例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
开发者ID:itain,项目名称:FreeCAD,代码行数:23,代码来源:importVTKResults.py

示例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
开发者ID:ianrrees,项目名称:FreeCAD_tinkering,代码行数:41,代码来源:importVTKResults.py


注:本文中的Fem.readResult方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。