parameters: (
      filename,
      analysis=None,
      result_name_prefix=None
  )
return_statement: return res_obj
docstring: insert a FreeCAD FEM mechanical result object in the ActiveDocument
      pure usage:
      import feminout.importZ88O2Results as importZ88O2Results
      disp_file = "/pathtofile/z88o2.txt"
      importZ88O2Results.import_z88_disp(disp_file)
  
      the z888i1.txt FEMMesh file needs to be in the same directory as z88o2.txt
      # ahh, make a new document first ;-)
docstring_summary: insert a FreeCAD FEM mechanical result object in the ActiveDocument
      pure usage:
      import feminout.importZ88O2Results as importZ88O2Results
      disp_file = "/pathtofile/z88o2.txt"
      importZ88O2Results.import_z88_disp(disp_file)
docstring_tokens: insert a FreeCAD FEM mechanical result object in the ActiveDocument pure usage : import feminout . importZ88O2Results as importZ88O2Results disp_file = / pathtofile / z88o2 . txt importZ88O2Results . import_z88_disp ( disp_file )
function: def import_z88_disp(
      filename,
      analysis=None,
      result_name_prefix=None
  ):
      """insert a FreeCAD FEM mechanical result object in the ActiveDocument
      pure usage:
      import feminout.importZ88O2Results as importZ88O2Results
      disp_file = "/pathtofile/z88o2.txt"
      importZ88O2Results.import_z88_disp(disp_file)
  
      the z888i1.txt FEMMesh file needs to be in the same directory as z88o2.txt
      # ahh, make a new document first ;-)
      """
      import ObjectsFem
      from . import importZ88Mesh
      from . import importToolsFem
      from femresult import resulttools
      if result_name_prefix is None:
          result_name_prefix = ""
      disp_read = read_z88_disp(filename)
      result_mesh_object = None
      if len(disp_read["Nodes"]) > 0:
          if analysis:
              analysis_object = analysis
  
          # read result mesh
          if filename.endswith("z88o2.txt"):
              mesh_file = filename.replace("o2", "i1")
              mesh_data = importZ88Mesh.read_z88_mesh(mesh_file)
              femmesh = importToolsFem.make_femmesh(mesh_data)
              result_mesh_object = ObjectsFem.makeMeshResult(
                  FreeCAD.ActiveDocument,
                  "Result_mesh"
              )
              result_mesh_object.FemMesh = femmesh
          else:
              Console.PrintError("Z88 mesh file z88i1.txt not found.\n")
  
          # create result obj
          for result_set in disp_read["Results"]:
              results_name = result_name_prefix + "results"
  
              res_obj = ObjectsFem.makeResultMechanical(FreeCAD.ActiveDocument, results_name)
              res_obj.Mesh = result_mesh_object
              res_obj = importToolsFem.fill_femresult_mechanical(res_obj, result_set)
              res_obj = resulttools.add_disp_apps(res_obj)  # fill DisplacementLengths
              res_obj = resulttools.fill_femresult_stats(res_obj)  # fill Stats
  
              if analysis:
                  analysis_object.addObject(res_obj)
  
          if FreeCAD.GuiUp:
              if analysis:
                  import FemGui
                  FemGui.setActiveAnalysis(analysis_object)
              FreeCAD.ActiveDocument.recompute()
  
      else:
          Console.PrintError(
              "Problem on Z88 result file import. No nodes found in Z88 result file.\n"
          )
      return res_obj
function_tokens: def import_z88_disp ( filename , analysis = None , result_name_prefix = None ) : import ObjectsFem from . import importZ88Mesh from . import importToolsFem from femresult import resulttools if result_name_prefix is None : result_name_prefix = "" disp_read = read_z88_disp ( filename ) result_mesh_object = None if len ( disp_read [ "Nodes" ] ) > 0 : if analysis : analysis_object = analysis # read result mesh if filename . endswith ( "z88o2.txt" ) : mesh_file = filename . replace ( "o2" , "i1" ) mesh_data = importZ88Mesh . read_z88_mesh ( mesh_file ) femmesh = importToolsFem . make_femmesh ( mesh_data ) result_mesh_object = ObjectsFem . makeMeshResult ( FreeCAD . ActiveDocument , "Result_mesh" ) result_mesh_object . FemMesh = femmesh else : Console . PrintError ( "Z88 mesh file z88i1.txt not found.\n" ) # create result obj for result_set in disp_read [ "Results" ] : results_name = result_name_prefix + "results" res_obj = ObjectsFem . makeResultMechanical ( FreeCAD . ActiveDocument , results_name ) res_obj . Mesh = result_mesh_object res_obj = importToolsFem . fill_femresult_mechanical ( res_obj , result_set ) res_obj = resulttools . add_disp_apps ( res_obj ) # fill DisplacementLengths res_obj = resulttools . fill_femresult_stats ( res_obj ) # fill Stats if analysis : analysis_object . addObject ( res_obj ) if FreeCAD . GuiUp : if analysis : import FemGui FemGui . setActiveAnalysis ( analysis_object ) FreeCAD . ActiveDocument . recompute ( ) else : Console . PrintError ( "Problem on Z88 result file import. No nodes found in Z88 result file.\n" ) return res_obj