Tutorial Toolkit Code Examples > Results > Introduction
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX''">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX''">   
Introduction
This chapter provides code examples for the PCL function described in Volume 1. These examples are designed so that they can be cut and pasted into a file and, by following the instructions listed with each example, executed in MSC Patran.
 
db_count_result_types_for_elem
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_count_result_types_for_elem()
#
#                      This function counts all the unique result 
#                      types used by a particular element.This 
#                      file opens the existing database “spool.db”
#                      and counts the unique result types for 
#                      element with id = 6.
#                      
#                      Before running this session file run spool.ses
#                      to create spool.db. Follow the steps given in 
#                      spool.ses to conduct the analysis.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function db_count_result_types_for_elem()
#  has the following arguments:
#
#  db_count_result_types_for_elem
#     (  elementId,
#        resultTypeCount )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_elementId
INTEGER  i_resultTypeCount
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Follow the following steps to read the results file.
#  1. From the “Analysis” window, from “Action”
#     Option Menu, select “Read Output2” option.
#  2. Click on the “Select Results File..” Button
#     and select “spool.op2”. Press “Apply”.
 
#  Session file paused.Press resume to continue.
sf_pause()
 
#  i_elementId = 6
i_elementId = 6
 
i_return_value =                                 @
   db_count_result_types_for_elem                @
      (  i_elementId,                            @
         i_resultTypeCount )
dump i_return_value
 
#  The count of unique result types used by the element with id = 6.
dump i_resultTypeCount
 
#  The result types are scalar,vector and tensor.  
#  The Default value is given in the analysis/subcase create/output
#  requests form.The default results contains Element stresses 
#  which has result type tensor.Hence the count is 1.
#---------------------------------------------------------------------
db_get_elem_scalar_name
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_elem_scalar_name()
#
#                      This function gets the name of the type results
#                      in the graphics element scalar blob.This file
#                      opens the database “spool.db” and gets the 
#                      element results from the database.Later it 
#                      creates a element scalar table with the name
#                      “RESULTS TABLE” and finally gets this name 
#                      using the above function. 
#
#                      Before running this session file run spool.ses
#                      to create spool.db. Follow the instructions in
#                      spool.ses and create spool.op2 and spool.jbr.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function db_get_elem_scalar_name()
#  has the following arguments:
#
#  db_get_elem_scalar_name
#     (  scalar_id,
#        name )
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_title[32],s_group_name[32]
INTEGER  i_ncases, iv_lcids(VIRTUAL),iv_nsub(VIRTUAL),ia_resids(5)
INTEGER  i_dtype,i_resloc,i_nbr_elems,iv_elem_ids(VIRTUAL)
INTEGER  iv_nbr_values(VIRTUAL),ia_minloc(6),ia_maxloc(6)
INTEGER  i_max_vals
INTEGER  i_id
INTEGER  i_index
REAL     rv_scalars(VIRTUAL)
INTEGER  i_scalar_id
STRING   s_name[32]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db” and read the deformation results
sf_play(“spool_res.ses”)
 
#  Get the number of Load cases and their IDs
i_return_value =                                  @
   res_utl_get_loadcases(i_ncases,iv_lcids,iv_nsub)
dump i_return_value
dump i_ncases,iv_lcids,iv_nsub
 
#  Extract the deformation results from the database
#  Load case ID        = iv_lcids(1)
#  Sub case ID         = 1
#  Primary Result ID   = 2             (Corresponds to deformation ) 
#  Secondary Result ID = 1
#  Layer ID            = 1
#  elem_list           = “Element 1:#” (All elements )
#  location            = “C”           (Centroid )
#  derivation          = “MAG”         (Magnitude: Vector to Scalar) 
#  c_id                = ““
ia_resids(1) = iv_lcids(1)
ia_resids(2) = 1
ia_resids(3) = 2
ia_resids(4) = 1
ia_resids(5) = 1
i_return_value =                                  @
   res_utl_extract_elem_results(ia_resids,        @
     “Element 1:#”,”MAG”,”C”,””,i_dtype,i_resloc, @
     i_nbr_elems,iv_elem_ids,iv_nbr_values,       @
      rv_scalars, ia_minloc,ia_maxloc)
 
dump i_return_value
 
#  Create a scalar table
s_title = “RESULTS TABLE”
i_max_vals = 1           /* Only at the Centroid */
 
i_return_value =                                  @
   ga_elem_scalar_create                          @
      (  s_title,                                 @
         i_nbr_elems,                             @
         iv_elem_ids,                             @
         iv_nbr_values,                           @
         i_max_vals,                              @
         rv_scalars,                              @
         i_id )
dump i_return_value, i_id
 
#  Set the current scalar element table associated with the
#  group “fem_model”
s_group_name = “fem_model”
i_return_value =                                  @
   ga_group_elem_scalar_set                       @
      (  s_group_name,                            @
         i_id )
dump i_return_value
 
i_scalar_id = i_id
i_return_value =                                  @
   db_get_elem_scalar_name                        @
      (  i_scalar_id,                             @
         s_name )
dump i_return_value
 
#  The name of the result type being retrived from the database
dump s_name
 
#  Delete the scalar table.
#i_return_value = ga_elem_scalar_delete(i_id)
dump i_return_value
 
sys_free_array(iv_lcids)
sys_free_array(iv_nsub)
sys_free_array(iv_elem_ids)
sys_free_array(iv_nbr_values)
sys_free_array(rv_scalars)
#---------------------------------------------------------------------
 
db_get_results_file_suffix
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_results_file_suffix()
#
#                      This function retrieves the result file suffix
#                      associated with the named analysis code.This
#                      file opens a new database “new.db” and gets 
#                      the results file suffix associated with the
#                      analysis code MSC.Nastran.Later it sets
#                      the suffix to ‘.res’ and gets the result file
#                      suffix again.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function db_get_results_file_suffix()
#  has the following arguments:
#
#  db_get_results_file_suffix
#     (  name,
#        suffix )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_name[32]
STRING   s_suffix[32]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  s_name = “MSC.Nastran”
s_name = “MSC.Nastran”
 
i_return_value =                                 @
   db_get_results_file_suffix                    @
      (  s_name,                                 @
         s_suffix )
dump i_return_value
#  The result file suffix for analysis code MSC.Nastran is 
dump s_suffix
 
#  Set the result file suffix to ‘.res’
i_return_value =                                 @
    db_set_results_file_suffix                   @
       (  s_name,                                @
          “.res”)
dump i_return_value
 
i_return_value =                                 @
   db_get_results_file_suffix                    @
      (  s_name,                                 @
         s_suffix )
dump i_return_value
#  The result file suffix for analysis code MSC.Nastran is 
dump s_suffix
#---------------------------------------------------------------------
 
jobfile.create_jobname
()
#  Purpose          :  This function creates a jobname for current 
#                      analysis code. It returns a status of 0 on 
#                      successful completion.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar.
#
#
#  The function jobfile.create_jobname()
#  has no arguments:
#
#---------------------------------------------------------------------
#  Opening a new database 
 
    IF (!db_is_open()) THEN
    uil_file_new.go("","new.db")
    ENDIF
$? YES 36000002
 
INTEGER status = 5
 
#---------------------------------------------------------------------
#  Opening the jobfile with the name 'new.jbr'.
 
     jobfile.open( "new", "RESULTS" )
 
#---------------------------------------------------------------------
#  Deleting Old result and jobfiles.
 
   msc_delete_old_files( "new", ".bdf", ".op2" )
 
#---------------------------------------------------------------------
#  Using the function jobfile.create_jobname() to the verify the jobname.
 
     status  = jobfile.create_jobname()
 
dump status
 
#---------------------------------------------------------------------
#  Closing the jobfile.
 
      jobfile.close(  )
 
#---------------------------------------------------------------------
#  Closing Patran
 
    uil_file_close.goquit(  )
 
#---------------------------------------------------------------------
#  End of File.
 
jobfile.create_param
()
#  Purpose          :  This function creates a parameter set for the 
#                      current parameter set of the type indicated.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar.
#
#
#  The function jobfile.create_param()
#  has the following arguments:
#
#   jobfile.create_param(
#                 label_str,
#                 int_val,
#                 real_val,
#                 char_val,
#                 param_type   )
#
#---------------------------------------------------------------------
#  Variable Declerations.
 
  INTEGER status = 5
 
#---------------------------------------------------------------------
#  Opening a new database 
 
    IF (!db_is_open()) THEN
    uil_file_new.go("","new.db")
    ENDIF
$? YES 36000002
 
#---------------------------------------------------------------------
#  Opening the jobfile with the name 'new.jbr'.
 
   jobfile.open( "new", "RESULTS" )
 
#---------------------------------------------------------------------
#  Deleting Old result and jobfiles.
 
   msc_delete_old_files( "new", ".bdf", ".op2" )
 
#---------------------------------------------------------------------
#  Writing statements to the jobfile.
 
   status  =   jobfile.create_param(                               @
                            "",                                    @
                            5,                                     @
                            0.0,                                   @
                            "",                                    @
                            1         )
dump status
 
#---------------------------------------------------------------------
#  Checking the number of entries written to the database.
 
status = 5
INTEGER num_param
 
     status = db_count_param_set_entries(   1,                    @
                                           num_param    )
dump num_param, status
#---------------------------------------------------------------------
#  Retriving the entries in the param set.
 
 
status = 5
INTEGER param_type(VIRTUAL), param_int(VIRTUAL), count = 1
REAL param_real(VIRTUAL)
STRING param_str[512](VIRTUAL), param_name[80](VIRTUAL)
 
   status  =  db_get_param_set_entries(  1 ,                       @
                                       count,                      @
                                       param_name,                 @
                                       param_type,                 @
                                       param_real,                 @
                                       param_str,                  @
                                       param_int    )
 
dump status, param_int, count
#---------------------------------------------------------------------
#  Closing jobfile
 
    jobfile.close( ) 
 
#---------------------------------------------------------------------
#  Closing Patran
 
    uil_file_close.goquit(  )
 
#---------------------------------------------------------------------
 
jobfile.eval_list
 
#  Purpose          :  This function sorts the values in the string
#                      in the form of real or integer array. This 
#                      function should be followed by
#                      function jobfile.write_array_as_list to 
#                      write the array.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar.
#
#
#  The function jobfile.eval_list()
#  has the following arguments:
#
#  jobfile.eval_list
#     (  list_str,
#        sublist_filter    )
#
#---------------------------------------------------------------------
#  Opening a new database 
 
    IF(!db_is_open()) THEN
        uil_file_new.go("","new.db")
    ENDIF
$? YES 36000002
 
#---------------------------------------------------------------------
#  VAriable Decelerations
 
      INTEGER i_status = 5
      STRING s_value_format[32]
      STRING s_label[32]
      STRING s_integer_val[32]
      INTEGER num_values_on_line  = 10
      STRING s_ilist[64] = " 1:100"
 
#---------------------------------------------------------------------
# refer lpenums.i for the next assignment of LP_SUBLIST_TOKEN_INT
 
       INTEGER LP_SUBLIST_TOKEN_INT = 8192
 
s_label =  "THE INTEGER ARRAY IS"
s_value_format  = "%I2.2%"
 
#---------------------------------------------------------------------
#  Opening the jobfile with the name 'new.jba'.
 
     jobfile.open( "new", "ANALYZE" )
 
#---------------------------------------------------------------------
#  Deleting Old result and jobfiles.
 
   msc_delete_old_files( "new", ".bda", ".op2" )
 
   i_status = jobfile.eval_list(                              @
                             s_ilist,                         @
                             LP_SUBLIST_TOKEN_INT   )
 
dump i_status
#---------------------------------------------------------------------
   jobfile.write_string( "   ", "   " )
 
   i_status  =  jobfile.write_array_as_list(                    @
                            s_label,                            @
                            s_value_format,                     @
                            num_values_on_line   )
#---------------------------------------------------------------------
#  Closing the jobfile.
 
      jobfile.close(  )
 
#---------------------------------------------------------------------
#  Closing Patran
 
    uil_file_close.goquit(  )
 
#---------------------------------------------------------------------
#  End of File.
 
jobfile.write_array_as_list
 
#  Purpose          :  This function writes any array of list
#                      in the string format to the jobfile in the 
#                      desired format.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar.
#
#
#  The function jobfile.write_array_as_list()
#  has the following arguments:
#
#  jobfile.write_array_as_list
#     (  label_str,
#        value_format,
#        num_values_on_line    )
#
#---------------------------------------------------------------------
#  Opening a new database 
 
    IF(!db_is_open()) THEN
        uil_file_new.go("","new.db")
    ENDIF
$? YES 36000002
 
#---------------------------------------------------------------------
#  VAriable Decelerations
 
      INTEGER i_status = 5
      STRING s_value_format[32]
      STRING s_label[32]
      STRING s_integer_val[32]
      INTEGER num_values_on_line  = 10
      STRING s_ilist[64] = " 1:100"
 
#---------------------------------------------------------------------
# refer lpenums.i for the next assignment of LP_SUBLIST_TOKEN_INT
 
       INTEGER LP_SUBLIST_TOKEN_INT = 8192
 
s_label =  "THE INTEGER ARRAY IS"
s_value_format  = "%I2.2%"
 
#---------------------------------------------------------------------
#  Opening the jobfile with the name 'new.jba'.
 
     jobfile.open( "new", "ANALYZE" )
 
#---------------------------------------------------------------------
#  Deleting Old result and jobfiles.
 
   msc_delete_old_files( "new", ".bda", ".op2" )
 
   jobfile.eval_list(s_ilist,LP_SUBLIST_TOKEN_INT)
 
   jobfile.write_string( "   ", "   " )
 
#---------------------------------------------------------------------
#  Using the function jobfile.write_array_as_list() to the 
#  jobfile 'new.jba'.
 
   i_status  =  jobfile.write_array_as_list(                    @
                            s_label,                            @
                            s_value_format,                     @
                            num_values_on_line   )
dump i_status
#---------------------------------------------------------------------
#  Closing the jobfile.
 
      jobfile.close(  )
 
#---------------------------------------------------------------------
#  Closing Patran
 
    uil_file_close.goquit(  )
 
#---------------------------------------------------------------------
#  End of File.
 
jobfile.write_element_list
 
#  Purpose          :  This function writes an integer array of element
#                      list in the string format to the jobfile.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar.
#
#  The function jobfile.write_element_list()
#  has the following arguments:
#
#  jobfile.write_element_list
#     (  label_str,
#        element_list_array    )
#
#---------------------------------------------------------------------
#  Opening a new database 
 
    IF(!db_is_open()) THEN
        uil_file_new.go("","new.db")
    ENDIF
$? YES 36000002
 
#---------------------------------------------------------------------
#  VAriable Decelerations
 
      INTEGER i_status
      STRING s_element_list[32]
      STRING s_label[32]
 
s_label =  "ELEMENT LIST"
s_element_list = "Element 1:100"
 
#---------------------------------------------------------------------
#  Opening the jobfile with the name 'new.jba'.
 
     jobfile.open( "new", "ANALYZE" )
 
#---------------------------------------------------------------------
#  Deleting Old result and jobfiles.
 
   msc_delete_old_files( "new", ".bda", ".op2" )
 
#---------------------------------------------------------------------
#  Using the function jobfile.write_element_list() to the jobfile 'new.jba'.
 
     jobfile.write_string( "   ", "   " )
 
            jobfile.write_element_list(                            @
                            s_label,                               @
                            s_element_list   )
 
     jobfile.write_string( "   ", "   " )
 
#---------------------------------------------------------------------
#  Closing the jobfile.
 
      jobfile.close(  )
 
#---------------------------------------------------------------------
#  Closing Patran
 
    uil_file_close.goquit(  )
 
#---------------------------------------------------------------------
#  End of File.
 
jobfile.write_integer_list
 
#  Purpose          :  This function writes an integer array of list
#                      in the string format to the jobfile.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar.
#
#  The function jobfile.write_integer_list()
#  has the following arguments:
#
#  jobfile.write_integer_list
#     (  label_str,
#        integer_val_array    )
#
#---------------------------------------------------------------------
#  Opening a new database 
 
    IF(!db_is_open()) THEN
        uil_file_new.go("","new.db")
    ENDIF
$? YES 36000002
 
#---------------------------------------------------------------------
#  VAriable Decelerations
 
      INTEGER i_status
      STRING s_integer_val[32]
      STRING s_label[32]
 
s_label =  "TEST STRING"
s_integer_val = "1  5"
 
#---------------------------------------------------------------------
#  Opening the jobfile with the name 'new.jba'.
 
     jobfile.open( "new", "ANALYZE" )
 
#---------------------------------------------------------------------
#  Deleting Old result and jobfiles.
 
   msc_delete_old_files( "new", ".bda", ".op2" )
 
#---------------------------------------------------------------------
#  Using the function jobfile.write_integer_list() to the jobfile 'new.jba'.
 
     jobfile.write_string( "   ", "   " )
 
            jobfile.write_integer_list(                            @
                            s_label,                               @
                            s_integer_val   )
 
     jobfile.write_string( "   ", "   " )
 
#---------------------------------------------------------------------
#  Closing the jobfile.
 
      jobfile.close(  )
 
#---------------------------------------------------------------------
#  Closing Patran
 
    uil_file_close.goquit(  )
 
#---------------------------------------------------------------------
#  End of File.
 
jobfile.write_node_list
 
#  Purpose          :  This function writes a node array of list
#                      in the string format to the jobfile.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar.
#
#
#  The function jobfile.write_node_list()
#  has the following arguments:
#
#  jobfile.write_node_list
#     (  label_str,
#        node_list    )
#
#---------------------------------------------------------------------
#  Opening a new database 
 
    IF(!db_is_open()) THEN
        uil_file_new.go("","new.db")
    ENDIF
$? YES 36000002
 
#---------------------------------------------------------------------
#  VAriable Decelerations
 
      INTEGER i_status
      STRING s_node_list[32]
      STRING s_label[32]
 
s_label =  "NODE LIST"
s_node_list = "Node 1:100"
 
#---------------------------------------------------------------------
#  Opening the jobfile with the name 'new.jba'.
 
     jobfile.open( "new", "ANALYZE" )
 
#---------------------------------------------------------------------
#  Deleting Old result and jobfiles.
 
   msc_delete_old_files( "new", ".bda", ".op2" )
 
#---------------------------------------------------------------------
#  Using the function jobfile.write_node_list() to the jobfile 'new.jba'.
 
     jobfile.write_string( "   ", "   " )
 
            jobfile.write_node_list(                               @
                            s_label,                               @
                            s_node_list   )
 
     jobfile.write_string( "   ", "   " )
 
#---------------------------------------------------------------------
#  Closing the jobfile.
 
      jobfile.close(  )
 
#---------------------------------------------------------------------
#  Closing Patran
 
    uil_file_close.goquit(  )
 
#---------------------------------------------------------------------
#  End of File.
 
jobfile.write_real_list
 
#  Purpose          :  This function writes a real array of list in the
#                      string format to the jobfile.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar.
#
#
#  The function jobfile.write_real_list()
#  has the following arguments:
#
#  jobfile.write_real_list
#     (  label_str,
#        real_val_array    )
#
#---------------------------------------------------------------------
#  Opening a new database 
 
    IF(!db_is_open()) THEN
        uil_file_new.go("","new.db")
    ENDIF
$? YES 36000002
 
#---------------------------------------------------------------------
#  VAriable Decelerations
 
      INTEGER i_status
      STRING s_real_val[32]
      STRING s_label[32]
 
s_label =  "TEST STRING"
s_real_val = "1.5 2.5"
 
#---------------------------------------------------------------------
#  Opening the jobfile with the name 'new.jba'.
 
     jobfile.open( "new", "ANALYZE" )
 
#---------------------------------------------------------------------
#  Deleting Old result and jobfiles.
 
   msc_delete_old_files( "new", ".bda", ".op2" )
 
#---------------------------------------------------------------------
#  Using the function jobfile.write_real_list() to the jobfile 'new.jba'.
 
     jobfile.write_string( "   ", "   " )
 
               jobfile.write_real_list(                            @
                            s_label,                               @
                            s_real_val   )
 
     jobfile.write_string( "   ", "   " )
 
#---------------------------------------------------------------------
#  Closing the jobfile.
 
      jobfile.close(  )
 
#---------------------------------------------------------------------
#  Closing Patran
 
    uil_file_close.goquit(  )
 
#---------------------------------------------------------------------
#  End of File.
 
jobfile.write_stream
 
#  Purpose          :  This function writes a data of any type 
#                      to the jobfile.
#
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar.
#
#
#  The function jobfile.write_stream()
#  has the following arguments:
#
#  jobfile.write_stream
#     (  label_str,
#        int_val,
#        real_val,
#        string_val   )
#
#---------------------------------------------------------------------
#  Opening a new database 
 
    IF(!db_is_open()) THEN
        uil_file_new.go("","new.db")
    ENDIF
$? YES 36000002
 
#---------------------------------------------------------------------
#  VAriable Decelerations
 
      INTEGER i_int_val
      REAL r_real_val
      STRING s_string_val[32]
 
s_string_val =  "TEST STRING"
i_int_val  = 10
r_real_val = 1.5
 
#---------------------------------------------------------------------
#  Opening the jobfile with the name 'new.jba'.
 
     jobfile.open( "new", "ANALYZE" )
 
#---------------------------------------------------------------------
#  Deleting Old result and jobfiles.
 
   msc_delete_old_files( "new", ".bdf", ".op2" )
 
#---------------------------------------------------------------------
#  Using the function jobfile.write_stream() to the jobfile 'new.jba'.
 
 
     jobfile.write_string( "   ", "   " )
 
               jobfile.write_stream(                               @
   "The text is :int_va=%I%, real val=%G% and string value is %A%",@
                            i_int_val,                             @
                            r_real_val,                            @
                            s_string_val   )
 
     jobfile.write_string( "   ", "   " )
 
#---------------------------------------------------------------------
#  Closing the jobfile.
 
      jobfile.close(  )
 
#---------------------------------------------------------------------
#  Closing Patran
 
    uil_file_close.goquit(  )
 
#---------------------------------------------------------------------
#  End of File.
 
jobfile.write_string
 
#  Purpose          :   This function will write a Label = String
#                       in to job file which is opened by function
#                       jobfile.open(). It requires two arguments
#                       one is Label(String) and String which is to
#                       be written in to jobfile. It returns integer
#                       status, on success it is 0 and on failure
#                       it is non zero.
#
#  The function jobfile.write_string()
#  has the following arguments:
#
#  jobfile.write_string()
#     ( STRING label_str,
#       STRING char_val,)
#
#---------------------------------------------------------------------
# 
#  Opening a new database 
 
    uil_file_new.go("","new.db")
 
 
INTEGER status = 5
STRING label_str[32], char_val[256]
 
label_str =  "LABEL(first Arguement)"
char_val = "TRIAL_TEXT,TRIAL_TEXT,TRIAL_TEXT,TRIAL_TEXT,"  //  @
          "TRIAL_TEXT,TRIAL_TEXT,TRIAL_TEXT,TRIAL_TEXT,"  //  @
          "TRIAL_TEXT,TRIAL_TEXT,TRIAL_TEXT,TRIAL_TEXT,"  //  @
          "TRIAL_TEXT,TRIAL_TEXT,TRIAL_TEXT,TRIAL_TEXT,"
 
#---------------------------------------------------------------------
#  Opening the jobfile with the name 'new.jbr'.
 
     jobfile.open( "new", "RESULTS" )
 
#---------------------------------------------------------------------
#  Deleting Old result and jobfiles.
 
   msc_delete_old_files( "new", ".bdf", ".op2" )
 
#---------------------------------------------------------------------
#  Using the function jobfile.write_string() to the jobfile.
 
     jobfile.write_string( "   ", "   " )
     status =  jobfile.write_string( label_str, char_val)
     jobfile.write_string( "   ", "   " )
 
dump status
 
#---------------------------------------------------------------------
#  Closing the jobfile.
 
      jobfile.close(  )
 
#---------------------------------------------------------------------
#  Closing Patran
 
    uil_file_close.goquit(  )
 
#---------------------------------------------------------------------
#  End of File.
 
jobfile.writer
 
#  Purpose          :  This function writes real values in the jobfile 
#                      opened by the jobfile.open() function.
#
#                      This function can be run in batchmode by running 
#                      this session file from "File","Session","Play" 
#                      pulldown menus on the menu bar.
#
#
#  The function jobfile.writec()
#  has the following arguments:
#
#  jobfile.writec(
#     (  label_str,
#        r_val     )
#
#---------------------------------------------------------------------
#  Variable Declarations
 
      INTEGER i_return_status = 1
#---------------------------------------------------------------------
#  Open a new database "new.db"
      IF(!db_is_open())THEN 
      uil_file_new.go( "","new.db" )
      ENDIF
$? YES 36000002  
#---------------------------------------------------------------------
#  Opens the jobfile
        
      i_return_status = jobfile.open( "new", "RESULTS" )
#---------------------------------------------------------------------
#  Delete the old files - .bdf and .op2 files.
 
      msc_delete_old_files( "new", ".bdf", ".op2" )
#---------------------------------------------------------------------
#  Write the various real values in the file - new.jbr
#  The format is jobfile.writer("str_1",r_val) writes the following 
#  to the output file :  str_1 = r_val.
 
      jobfile.writer("REAL_VALUE_1 = ",3.1)
      jobfile.writer("REAL_VALUE_2 = ",-2.9673)
      jobfile.writer("REAL_VALUE_3 = ",0.4999999999999999)       
 
#---------------------------------------------------------------------
#  Close the file new.jbr
        
      jobfile.close()
 
#--------------------------------------------------------------------
#  Close the file new.db
 
      uil_file_close.goquit()
 
#--------------------------------------------------------------------
 
jobfile.writeS1
 
#  Purpose          :  This function will write the  array of one
#                      real element in to file opened by the jobfile.open()
#                      function.It requires one string and array of one
#                      real element as input argument.
#
#                      This file can be run by starting a session of
#                      MSC Patran, opening a new or existing database,
#                      and running this session file through the
#                      "File","Session","Play" pulldown menus
#                      on the menu bar.
#
#
#  The function jobfile.writeS1()
#  has the following arguments:
#
#  jobfile.writeS1
#     (  STRING label,
#        REAL rl_val()
#     ) 
#---------------------------------------------------------------------
# 
#  Opening a new database 
 
     uil_file_new.go("","new.db")
 
 
INTEGER jobstatus= 6013032
STRING msgstring[256] 
#STRING msgstring[256]="TESTING_SET.JOB_STATUS FUNCTION" 
 
 
#---------------------------------------------------------------------
#  Opening the jobfile with the name 'new.jbr'.
 
     jobfile.open( "new", "RESULTS" )
 
#---------------------------------------------------------------------
#  Deleting Old result and jobfiles.
 
     msc_delete_old_files( "new", ".bdf", ".op2" )
 
#---------------------------------------------------------------------
#  Using the function jobfile.writeS1() to the jobfile.
 
     jobfile.set_job_status(jobstatus,msgstring)
 
 
#---------------------------------------------------------------------
#  Closing the jobfile.
 
dump jobfile.close(  )
 
#---------------------------------------------------------------------
#Displaying message to form
 
   msg_to_form(jobstatus,1,0,0,0,msgstring)
#  Closing Patran
 
     uil_file_close.goquit(  )
 
#---------------------------------------------------------------------
#  End of File.
 
jobfile.writeS2
 
#  Purpose          :  This function will write the  array of two
#                      real elements in to file opened by the jobfile.open()
#                      function.It requires one string and array of two
#                      real elements as input arguments.
#
#                      This file can be run by starting a session of
#                      MSC Patran,
#                      and running this session file through the
#                      "File","Session","Play" pulldown menus
#                      on the menu bar.
#
#
#  The function jobfile.writeS2()
#  has the following arguments:
#
#  jobfile.writeS2
#     (  STRING label,
#        REAL rl_val()
#     ) 
#---------------------------------------------------------------------
#  Opening a new database 
 
    IF (!db_is_open()) THEN
    uil_file_new.go("","new.db")
    ENDIF
$? YES 36000002
 
STRING label_str[32] 
REAL rl_val(2)=[1.1,2.2]
 
label_str =  "LABEL(first Arguement)"
 
#---------------------------------------------------------------------
#  Opening the jobfile with the name 'new.jbr'.
 
     jobfile.open( "new", "RESULTS" )
 
#---------------------------------------------------------------------
#  Deleting Old result and jobfiles.
 
     msc_delete_old_files( "new", ".bdf", ".op2" )
 
#---------------------------------------------------------------------
#  Using the function jobfile.writeS2() to the jobfile.
 
     jobfile.writeS2(label_str,rl_val)
 
#---------------------------------------------------------------------
#  Closing the jobfile.
 
     jobfile.close(  )
 
#---------------------------------------------------------------------
#  Closing Patran
 
     uil_file_close.goquit(  )
 
#---------------------------------------------------------------------
#  End of File.  /*jobfile.writeS2.example.ses*/
 
jobfile.writeS3
 
#  Purpose          :  This function will write the  array of three
#                      real elements in to file opened by the jobfile.open()
#                      function.It requires one string and array of three
#                      real elements as input arguments.
#
#                      This file can be run by starting a session of
#                      MSC Patran,
#                      and running this session file through the
#                      "File","Session","Play" pulldown menus
#                      on the menu bar.
#
#
#  The function jobfile.writeS3()
#  has the following arguments:
#
#  jobfile.writeS3
#     (  STRING label,
#        REAL rl_val()
#     ) 
#---------------------------------------------------------------------
#  Opening a new database 
 
    IF (!db_is_open()) THEN
    uil_file_new.go("","new.db")
    ENDIF
$? YES 36000002
 
STRING label_str[32] 
REAL rl_val(3)=[1.1,2.2,3.3]
 
label_str =  "LABEL(first Arguement)"
 
#---------------------------------------------------------------------
#  Opening the jobfile with the name 'new.jbr'.
 
     jobfile.open( "new", "RESULTS" )
 
#---------------------------------------------------------------------
#  Deleting Old result and jobfiles.
 
     msc_delete_old_files( "new", ".bdf", ".op2" )
 
#---------------------------------------------------------------------
#  Using the function jobfile.write_string() to the jobfile.
 
     jobfile.writeS3(label_str,rl_val)
 
#---------------------------------------------------------------------
#  Closing the jobfile.
 
     jobfile.close(  )
 
#---------------------------------------------------------------------
#  Closing Patran
 
     uil_file_close.goquit(  )
 
#---------------------------------------------------------------------
#  End of File.  /* jobfile.writeS3.example.ses */
 
jobfile.writeS4
 
#  Purpose          :  This function will write the  array of four
#                      real elements in to file opened by the jobfile.open()
#                      function.It requires one string and array of four
#                      real elements as input arguments.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar.
#
#
#  The function jobfile.writeS4()
#  has the following arguments:
#
#  jobfile.writeS4
#     (  STRING label,
#        REAL rl_val()
#     ) 
#---------------------------------------------------------------------
#  Opening a new database 
 
    IF (!db_is_open()) THEN
    uil_file_new.go("","new.db")
    ENDIF
$? YES 36000002
 
 
STRING label_str[32] 
REAL rl_val(4)=[1.1,2.2,3.3,4.4]
 
label_str =  "LABEL(first Arguement)"
 
#---------------------------------------------------------------------
#  Opening the jobfile with the name 'new.jbr'.
 
     jobfile.open( "new", "RESULTS" )
 
#---------------------------------------------------------------------
#  Deleting Old result and jobfiles.
 
     msc_delete_old_files( "new", ".bdf", ".op2" )
 
#---------------------------------------------------------------------
#  Using the function jobfile.writeS4() to the jobfile.
 
     jobfile.writeS4(label_str,rl_val)
 
#---------------------------------------------------------------------
#  Closing the jobfile.
 
     jobfile.close(  )
 
#---------------------------------------------------------------------
#  Closing Patran
 
     uil_file_close.goquit(  )
 
#---------------------------------------------------------------------
#  End of File.  /* jobfile.writeS4.example.ses */
 
jobfile.writeSS
 
#  Purpose          :  This function will write the  array of two
#				       integer elements in to file opened by the jobfile.open()
#				       function.It requires one string and array of two
#				       integer elements as input arguments.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the "File","Session","Play" pulldown menus
#                      on the menu bar.
#
#
#  The function jobfile.writeSS()
#  has the following arguments:
#
#  jobfile.writeSS
#     (  STRING label,
#        INTEGER int_val()
#     ) 
#---------------------------------------------------------------------
#  Opening a new database 
 
    IF (!db_is_open()) THEN
    uil_file_new.go("","new.db")
    ENDIF
$? YES 36000002
 
STRING label_str[32] 
INTEGER int_val(2)=[1,2]
 
label_str =  "LABEL(first Arguement)"
 
#---------------------------------------------------------------------
#  Opening the jobfile with the name 'new.jbr'.
 
     jobfile.open( "new", "RESULTS" )
 
#---------------------------------------------------------------------
#  Deleting Old result and jobfiles.
 
     msc_delete_old_files( "new", ".bdf", ".op2" )
 
#---------------------------------------------------------------------
#  Using the function jobfile.writeSS() to the jobfile.
 
     jobfile.writeSS(label_str,int_val)
 
#---------------------------------------------------------------------
#  Closing the jobfile.
 
     jobfile.close(  )
 
#---------------------------------------------------------------------
#  Closing Patran
 
     uil_file_close.goquit(  )
 
#---------------------------------------------------------------------
#  End of File.  /*jobfile.writeSS.example.ses*/
 
rdm_result_minmax_get
()
#  Purpose          :  This file provides an example of a call to the
#                      function rdm_result_minmax_get()
#
#                      This function optains the minmax from the current
#                      "active" result controlling the current viewport
#                       spectrum/range.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file through
#                      the "File","Session","Play" pulldown menus
#                      on the menu bar.
#
#
#  The function rdm_result_minmax_get()
#  has the following arguments:
#
#   rdm_result_minmax_get
#		(Active viewport spectrum,  @
#		 min, @
#		 max)
#
#---------------------------------------------------------------------
# Variable Decleration
 
STRING asm_create_patch_xy_created_ids[VIRTUAL]
INTEGER fem_create_mesh_surfa_num_nodes
INTEGER fem_create_mesh_surfa_num_elems
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]
INTEGER res_create_demo_mcid
INTEGER res_create_demo_scid
INTEGER res_create_demo_rcid
INTEGER res_create_demo_rtid
INTEGER res_create_demo_layerposid
REAL min, max
INTEGER i_return_status
 
#---------------------------------------------------------------------
#  Opening a new database
 
     if(!db_is_open())THEN
     uil_file_new.go("","new.db")
$? YES 36000002
     endif
 
#---------------------------------------------------------------------
#  Creating a patch
 
               asm_const_patch_xyz( "1", "<1 1 0>",          @
                        "[0 0 0]", "Coord 0",                @
                        asm_create_patch_xy_created_ids )
#---------------------------------------------------------------------
#  Meshing the geometry with 121 nodes and 100 elements.
 
ui_exec_function( "mesh_seed_display_mgr", "init" )
 
fem_create_mesh_surf_3( "IsoMesh",                           @
                        16384,                               @
                        "Surface 1",                         @
                        1,                                   @
                        ["0.1"],                             @
                        "Quad4",                             @
                        "#",                                 @
                        "#",                                 @
                        "Coord 0",                           @
                        "Coord 0",                           @
                        fem_create_mesh_surfa_num_nodes,     @
                        fem_create_mesh_surfa_num_elems,     @
                        fem_create_mesh_s_nodes_created,     @
                        fem_create_mesh_s_elems_created )
 
mesh_seed_display_mgr.erase(  )
#---------------------------------------------------------------------
#  Creating Demo results
 
db_drop_res_index(  )
 
res_db_create_loadcase_c("Derived Results", 1,  @
                      "Created by PATRAN for demo results",  @
                      res_create_demo_mcid )
res_db_create_subcase_c( 2, "Demo",                          @
                         res_create_demo_scid,               @
                         res_create_demo_rcid )
 
res_db_createlayerpos_c( 0, 0,                               @
                        res_create_demo_layerposid )
 
res_db_create_restype_c( "Nodal Scalar", "Demo Result1",     @
                         1, 1, "By PATRAN For Demo Results", @
                         0, res_create_demo_rtid )
 
res_create_demoresult2( 1, 1, 1., 1, 1, 1,                   @
                       [0, 0, 0, 0], 1, 0, 0, 0 )
 
#---------------------------------------------------------------------
#  Creating a patch
db_post_results_load(  )
 
res_data_load_dbresult( 0, "Nodal", "Scalar",                @
              "Derived Results", "Demo",  "Nodal Scalar",    @
             "Demo Result1", "(NON-LAYERED)", "", "Default", @
                       "DeriveAverage", "All", "ShapeFunc" )
 
res_display_fringe_create( "", "FreeFaces", 0, [""], 12,     @
 [ "Range:Fri_default_Fringe", "RangeOverwrite:ON",          @
 "FringeStyle:Discrete/Smooth", "Shade:None",                @
 "ElemEdge:FreeEdge,Blue,Solid,1", "Shrink:0",               @
"TitleDisplay:ON", "MinMaxDisplay:ON", "ValueDisplay:OFF",   @
"Filter:None",  "ScaleFactor:1.", "LabelStyle:Exponential,   @
   12, White, 3"], TRUE )
 
res_display_fringe_post( "", 0, "Nodal", TRUE, TRUE )
#---------------------------------------------------------------------
#  Using the function rdm_result_minmax_get to get the minimum and 
#  maximum values of the fringe.
 
 
  i_return_status =  rdm_result_minmax_get(                  @
                         "",                                 @
                         min,                                @
                         max            )
 
dump min , max , i_return_status
 
#---------------------------------------------------------------------
#  Closing the patran environment.
uil_file_close.goquit(  )
#---------------------------------------------------------------------
#  End of File.
 
res_db_cgetlayerposids
()
#  Purpose          :  This function will retrive list of layers of
#                      a result type in a given result case.
#                      This function requires result case id,and
#                      result type id as input arguments.
#
#                      Before running this session file run spool.ses
#                      and import result file spool.op2 to create 
#                      spool.db with results. For instruction see
#                      file spool.ses.
#
#                      This file can be run by starting a session of
#                      MSC Patran,running this session file through 
#                      the "File","Session","Play" pulldown menus
#                      on the menu bar.
#
#
#  The function res_db_cgetlayerposids()
#  has the following arguments:
#
#  res_db_cgetlayerposids
#     (  INPUT:
#        INTEGER rescase_id
#        INTEGER rt_id 
#        OUTPUT:
#        INTEGER nlayers
#        INTEGER layerposids()
#     ) 
#---------------------------------------------------------------------
# 
#  Opening a spool.db database 
 
     uil_file_open.go("spool.db")
 
#---------------------------------------------------------------------
 
#  Declaring input arguents
 
   INTEGER rescase_id(1)
   INTEGER rt_id
 
#  Declaring output argument
 
   INTEGER nlayers
   INTEGER layerposids(1)
   INTEGER status
 
#----------------------------------------------------------------------
 
#  Using the function db_get_load_case_id() to get the load case id.
 
      INTEGER loadcase_id(1)
               db_get_load_case_id("spool_loads",             @
	                            loadcase_id(1))
 
 
#  Using the function db_get_sub_case_id() to get the sub case id.
 
      INTEGER subcase_id(1) 
               db_get_sub_case_id(loadcase_id(1),             @
                                  "Static Subcase",           @
                                   subcase_id(1))
 
 
#  Using the function res_db_cgetrescases() to get the the result 
#  case ids.
 
      INTEGER numload_cases = 1
               res_db_cgetrescases(numload_cases,             @
				   loadcase_id,               @
                                   subcase_id,                @
                                   rescase_id)
 
#  Using the function db_get_primary_res_id to get the primary result id
 
      STRING pri_res_label[32] = "Displacements"
      INTEGER prires_id
               db_get_primary_res_id(pri_res_label,           @
                                     prires_id)
 
#  Using the function db_get_secondary_res_id to get the secondary result id
 
      STRING sec_res_label[32] = "Translational"
      INTEGER secres_id
               db_get_secondary_res_id(prires_id,             @
                                       sec_res_label,         @
                                       secres_id)
 
#  Using the function vki_db_getresid to retrive result type id 
#  from the data base.
 
               rt_id = vki_db_getresid(rescase_id(1),         @
                                       prires_id,             @
                                       secres_id)
 
#---------------------------------------------------------------------
 
#  Using the function res_db_cgetlayerposids to retrive number of 
#  layers and layerposids from the data base.
 
               status = res_db_cgetlayerposids(rescase_id(1),  @
                                               rt_id,          @
                                               nlayers,        @
                                               layerposids )
 
    dump status
    dump nlayers
    dump layerposids
 
#---------------------------------------------------------------------
 
#  End of File.
 
#---------------------------------------------------------------------
 
res_db_cgetrescases
()
#  Purpose          :  This function will get the resultcase ids.
#                      This function requires number of load cases
#                      primary load case ids, primary subcase ids
#                      as input argument.
#
#                      Before running this session file run spool.ses
#                      and import result file spool.op2 to create 
#                      spool.db with results. For instruction see
#                      file spool.ses.
#
#                      This file can be run by starting a session of
#                      MSC Patran,running this session file through 
#                      the "File","Session","Play" pulldown menus
#                      on the menu bar.
#
#
#  The function res_db_cgetrescases()
#  has the following arguments:
#
#  res_db_cgetrescases
#     (  INPUT:
#        INTEGER num_ldcase
#        INTEGER loadcase_id() 
#        INTEGER subcase_id()
#        OUTPUT:
#        INTEGER rescase_id()
#        INTEGER status
#     ) 
#---------------------------------------------------------------------
# 
#  Opening a spool.db database 
 
     uil_file_open.go("spool.db")
 
#---------------------------------------------------------------------
 
#  Declaring input arguents
 
   INTEGER numload_cases = 1
 
   INTEGER loadcase_id(1)
 
   INTEGER subcase_id(1)
 
#  Declaring output argument
 
   INTEGER rescase_id(1)
 
   INTEGER status
 
#----------------------------------------------------------------------
 
#  Using the function db_get_load_case_id() to get the load case id.
 
   db_get_load_case_id("spool_loads", loadcase_id(1))
 
 
#  Using the function db_get_sub_case_id() to get the sub case id.
 
   db_get_sub_case_id(loadcase_id(1), "Static Subcase", subcase_id(1))
 
#-----------------------------------------------------------------------
 
#  Using the function res_db_cgetrescases() to get the the result 
#  case ids.
 
      status = res_db_cgetrescases(numload_cases,             @
				   loadcase_id,               @
                                   subcase_id,                @
                                   rescase_id)
 
    dump status
    dump rescase_id
 
#---------------------------------------------------------------------
#  End of File.
#---------------------------------------------------------------------
 
res_utl_create_elem_result
()
#  Purpose          :  This file provides an example of a call to the
#                      function res_utl_create_elem_result() 
#
#                      This session file creates new result case and 
#                      writes to the database. After that the new result 
#                      case can be displayed in the viewport.               
#                      
#                      Before running this session file run spool.ses and
#                      create result file spool.op2 as per the instructions 
#                      given in it. Import this result file spool.op2 into 
#                      spool.db.                    
#                       
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file through
#                      the "File","Session","Play" pulldown menus
#                      on the menu bar.
#
#
#  The function res_utl_create_elem_result() 
#  has the following arguments:
#
#  res_utl_create_elem_result( resultids,                            @
#                              primary_title,                        @
#                              secondary_title,                      @
#                              nids,                                 @
#                              ids,                                  @ 
#                              cidlist,                              @
#                              datatype,                             @
#                              location,                             @
#                              nresults,                             @
#                              results)
#                              
#
#---------------------------------------------------------------------
# Variable Decleration
 
INTEGER   resultids(5)
STRING    primary_title[80]
STRING    secondary_title[80]
INTEGER   nids 
INTEGER   ids(virtual)
STRING    cidlist[12]
INTEGER   datatype
STRING    location[12]
INTEGER   nresults(VIRTUAL)
REAL      results(VIRTUAL)
 
STRING    elem_list[12]
STRING    derivation[12]
INTEGER   resloc, cnt
INTEGER   min_loc(12), max_loc(12)
INTEGER   nrc, lcids(virtual), subids(virtual)
INTEGER   nres, primary_id(virtual), secondary_id(virtual)
INTEGER   nsub(virtual), nsub1
INTEGER   result_ids(4), nlayers, layerids(VIRTUAL)
STRING    layerlabels[80](VIRTUAL)
INTEGER   i_return_value
 
#---------------------------------------------------------------------
#  Opening the file spool.db
 
uil_file_open.go( "./spool.db") 
 
#---------------------------------------------------------------------
# Clear any previous results from the memory
 
res_utl_clear_result()
 
#---------------------------------------------------------------------
# Gets the loadcases associated with the results
 
res_utl_get_loadcases(nrc, lcids, nsub)
dump nrc, lcids, nsub
 
#---------------------------------------------------------------------
# Gets the subcases
 
res_utl_get_subcases(lcids(1), nsub1, subids)
dump lcids(1), nsub1, subids
 
#---------------------------------------------------------------------
# Gets the result ids
 
res_utl_get_result_ids (  nrc, lcids,                                @
                          subids, nres,                              @
                          primary_id, secondary_id)
 
dump nres, primary_id, secondary_id
dump nrc
dump lcids
dump subids
 
#---------------------------------------------------------------------
# Gets the layer positions associated with the results
 
result_ids(1) = lcids(1)
result_ids(2) = subids(1)
result_ids(3) = primary_id(2)
result_ids(4) = secondary_id(2)
 
res_utl_get_result_layers( result_ids, nlayers,                      @
                           layerids, layerlabels)
 
dump nlayers
dump layerids
dump layerlabels
 
#---------------------------------------------------------------------
# Extracts result data for 10 elements (Elm 1:10) from the database
 
resultids(1)    = lcids(1)
resultids(2)    = subids(1)
resultids(3)    = primary_id(2)
resultids(4)    = secondary_id(2)
resultids(5)    = layerids(1)
 
elem_list       = "Elm 1:10"
derivation      = "MAG"
location        = "N[odal"
cidlist         = ""
 
res_utl_extract_elem_results ( resultids,                            @
                               elem_list,                            @
                               derivation,                           @
                               location,                             @
                               cidlist,                              @
                               datatype,                             @
                               resloc,                               @
                               cnt,                                  @
                               ids,                                  @
                               nresults,                             @
                               results,                              @
                               min_loc,                              @
                               max_loc )
 
#---------------------------------------------------------------------
# Dump all extracted results as a output
 
dump datatype
dump resloc
dump cnt
dump ids
dump nresults
dump results 
dump min_loc
dump max_loc 
 
#---------------------------------------------------------------------
# Argument Initialization
 
resultids(1)    = lcids(1)
resultids(2)    = subids(1)
resultids(3)    = 0
resultids(4)    = 0 
resultids(5)    = layerids(1)
 
primary_title   = "NEW RESULT CASE"
secondary_title = "Displacement"
 
nids            = nres
location        = "N[odal"
cidlist         = ""
 
#---------------------------------------------------------------------
# Created new result case in the database as a 
# "NEW RESULT CASE" (Primary load case title) and 
# "DISPLACEMENT" (Secondary load case title)
 
i_return_value =  res_utl_create_elem_result( resultids,             @
                                              primary_title,         @
                                              secondary_title,       @
                                              nids,                  @
                                              ids,                   @
                                              cidlist,               @
                                              datatype,              @
                                              location,              @
                                              nresults,              @
                                              results )
 
#---------------------------------------------------------------------
# Dump the return value of the function and output of the used function.
# The resultids(3) and resultids(4) are created newly.
 
dump i_return_value
dump resultids
 
#---------------------------------------------------------------------
#  Closing the patran environment.
 
uil_file_close.goquit(  )
 
#---------------------------------------------------------------------
#  End of File.
 
res_utl_extract_elem_history2
()
#  Purpose          :  This file provides an example of a call to the
#                      function res_utl_extract_elem_history2() 
#
#                      This session file extracts specified results from the 
#                      database. It gives the result at each element along 
#                      with the type of results, element ids after using the
#                      averaging method, averaging domain, extrapolation 
#                      method and given complex form as a input. Apart from 
#                      that it also gives an array index for each minimum                       
#                      and maximum element result component.                       
#                      
#                      Before running this session file run spool.ses and
#                      create result file spool.op2 as per the instructions 
#                      given in it. Import this result file spool.op2 into 
#                      spool.db.                    
#                       
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file through
#                      the "File","Session","Play" pulldown menus
#                      on the menu bar.
#
#
#  The function res_utl_extract_elem_history2() 
#  has the following arguments:
#
#  res_utl_extract_elem_history2 ( nrc,                             @
#                                  lcids,                           @
#                                  subids,                          @
#                                  resultids,                       @
#                                  elem_list,                       @
#                                  derivation,                      @
#                                  location,                        @
#                                  cidlist,                         @
#                                  avg_method,                      @
#                                  avg_domain,                      @
#                                  extrap_method,                   @
#                                  complex_form,                    @
#                                  complex_angle,                   @
#                                  datatype,                        @
#                                  resloc,                          @
#                                  cnt,                             @
#                                  ids,                             @
#                                  nresults,                        @
#                                  results,                         @
#                                  min_loc,                         @
#                                  max_loc )
#
#
#---------------------------------------------------------------------
# Variable Decleration
 
INTEGER   nrc 
INTEGER   lcids(virtual)
INTEGER   subids(virtual)
INTEGER   resultids(3)
STRING    elem_list[12]
STRING    derivation[12]
STRING    location[12]
STRING    cidlist[12]
STRING    avg_method[24]
STRING    avg_domain[24]
STRING    extrap_method[24]
STRING    complex_form[24]
REAL      complex_angle
INTEGER   datatype
INTEGER   resloc
INTEGER   cnt 
INTEGER   ids(VIRTUAL) 
INTEGER   nresults(VIRTUAL)
REAL      results(VIRTUAL)
INTEGER   min_loc(virtual)
INTEGER   max_loc(virtual)
 
INTEGER   nres, primary_id(virtual), secondary_id(virtual)
INTEGER   nsub(virtual), nsub1
INTEGER   result_ids(4), nlayers, layerids(VIRTUAL)
STRING    layerlabels[80](VIRTUAL)
INTEGER   i_return_value
 
#---------------------------------------------------------------------
#  Opening the file spool.db
 
uil_file_open.go( "./spool.db") 
 
#---------------------------------------------------------------------
# Clear any previous results from the memory
 
i_return_value = res_utl_clear_result()
dump i_return_value
 
#---------------------------------------------------------------------
# Gets the loadcases associated with the results
 
i_return_value = res_utl_get_loadcases(nrc, lcids, nsub)
dump i_return_value, nrc, lcids, nsub
 
#---------------------------------------------------------------------
# Gets the subcases
 
i_return_value = res_utl_get_subcases(lcids(1), nsub1, subids)
dump i_return_value, lcids(1), nsub1, subids
 
#---------------------------------------------------------------------
# Gets the result ids
 
i_return_value = res_utl_get_result_ids(nrc, lcids,                  @
                            subids, nres, primary_id, secondary_id)
 
dump i_return_value, nres, primary_id, secondary_id
dump nrc
dump lcids
dump subids
 
#---------------------------------------------------------------------
# Gets the layer positions associated with the results
 
result_ids(1) = lcids(1)
result_ids(2) = subids(1)
result_ids(3) = primary_id(2)
result_ids(4) = secondary_id(2)
 
dump result_ids
 
i_return_value = res_utl_get_result_layers(result_ids, nlayers,      @  
                           layerids, layerlabels)
 
dump i_return_value
dump nlayers
dump layerids
dump layerlabels
 
#---------------------------------------------------------------------
# Argument Initialization
 
resultids(1)    = primary_id(2)
resultids(2)    = secondary_id(2)
resultids(3)    = layerids(1)
elem_list       = "Elm 1:10"
derivation      = "MAG"
location        = "Nodal"
cidlist         = ""
avg_method      = "Sum"
avg_domain      = "All"
extrap_method   = "ShapeFunc"
complex_form    = "Real"
complex_angle   = 0.0
 
#---------------------------------------------------------------------
#  Extracts result data for 10 elements (Elements 1:10) from the database
 
i_return_value = res_utl_extract_elem_history2 (    nrc,            @
                                                    lcids,          @
                                                    subids,         @
                                                    resultids,      @
                                                    elem_list,      @
                                                    derivation,     @
                                                    location,       @
                                                    cidlist,        @
                                                    avg_method,     @
                                                    avg_domain,     @
                                                    extrap_method,  @
                                                    complex_form,   @
                                                    complex_angle,  @
                                                    datatype,       @
                                                    resloc,         @
                                                    cnt,            @
                                                    ids,            @
                                                    nresults,       @
                                                    results,        @
                                                    min_loc,        @
                                                    max_loc )
 
#---------------------------------------------------------------------
 
dump i_return_value
dump datatype
dump resloc
dump cnt
dump ids
dump nresults
dump results 
dump min_loc
dump max_loc 
 
#---------------------------------------------------------------------
#  Closing the patran environment.
 
uil_file_close.goquit(  )
 
#---------------------------------------------------------------------
#  End of File.
 
res_utl_extract_elem_results2
()
#  Purpose          :  This file provides an example of a call to the
#                      function res_utl_extract_elem_results2() 
#
#                      This session file extracts specified results from the 
#                      database. It gives the result at each element along 
#                      with the type of results, element ids after using the
#                      averaging method, averaging domain, extrapolation 
#                      method and given complex form as a input.               
#                      
#                      Before running this session file run spool.ses and
#                      create result file spool.op2 as per the instructions 
#                      given in it. Import this result file spool.op2 into 
#                      spool.db.                    
#                       
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file through
#                      the "File","Session","Play" pulldown menus
#                      on the menu bar.
#
#
#  The function res_utl_extract_elem_results2() 
#  has the following arguments:
#
#  res_utl_extract_elem_results2 ( resultids,                       @
#                                  elem_list,                       @
#                                  derivation,                      @
#                                  location,                        @
#                                  cidlist,                         @
#                                  avg_method,                      @
#                                  avg_domain,                      @
#                                  extrap_method,                   @
#                                  complex_form,                    @
#                                  complex_angle,                   @
#                                  datatype,                        @
#                                  resloc,                          @
#                                  cnt,                             @
#                                  ids,                             @
#                                  nresults,                        @
#                                  results,                         @
#                                  min_loc,                         @
#                                  max_loc)
#
#
#---------------------------------------------------------------------
# Variable Decleration
 
INTEGER   resultids(5) 
STRING    elem_list[12]
STRING    derivation[12]
STRING    location[12]
STRING    cidlist[12]
STRING    avg_method[24]
STRING    avg_domain[24]
STRING    extrap_method[24]
STRING    complex_form[24]
REAL      complex_angle
INTEGER   datatype
INTEGER   resloc
INTEGER   cnt
INTEGER   ids(VIRTUAL)
INTEGER   nresults(VIRTUAL)
REAL      results(VIRTUAL)
INTEGER   min_loc(12)
INTEGER   max_loc(12)
 
INTEGER   nrc, lcids(virtual), subids(virtual)
INTEGER   nres, primary_id(virtual), secondary_id(virtual)
INTEGER   nsub(virtual), nsub1
INTEGER   result_ids(4), nlayers, layerids(VIRTUAL)
STRING    layerlabels[80](VIRTUAL)
INTEGER   i_return_value
 
#---------------------------------------------------------------------
#  Opening the file spool.db
 
uil_file_open.go( "./spool.db") 
 
#---------------------------------------------------------------------
# Clear any previous results from the memory
 
res_utl_clear_result()
 
#---------------------------------------------------------------------
# Gets the loadcases associated with the results
 
res_utl_get_loadcases(nrc, lcids, nsub)
dump nrc, lcids, nsub
 
#---------------------------------------------------------------------
# Gets the subcases
 
res_utl_get_subcases(lcids(1), nsub1, subids)
dump nsub1, subids
 
#---------------------------------------------------------------------
# Gets the result ids
 
res_utl_get_result_ids ( nrc, lcids, subids, nres,                   @
                         primary_id, secondary_id)
 
dump nres, primary_id, secondary_id
dump nrc
dump lcids
dump subids
 
#---------------------------------------------------------------------
# Gets the layer positions associated with the results
 
result_ids(1) = lcids(1)
result_ids(2) = subids(1)
result_ids(3) = primary_id(2)
result_ids(4) = secondary_id(2)
 
res_utl_get_result_layers(result_ids, nlayers, layerids, layerlabels)
 
dump nlayers
dump layerids
dump layerlabels
 
#---------------------------------------------------------------------
# Argument Initialization
 
resultids(1)    = lcids(1)
resultids(2)    = subids(1)
resultids(3)    = primary_id(2)
resultids(4)    = secondary_id(2)
resultids(5)    = layerids(1)
 
elem_list       = "Elm 1:10"
derivation      = "MAG"
location        = "N[odal"
cidlist         = ""
avg_method      = "Sum"
avg_domain      = "All"
extrap_method   = "ShapeFunc"
complex_form    = "Real"
complex_angle   = 0.0
 
#---------------------------------------------------------------------
# Extracts result data for 10 elements (Elm 1:10) from the database
 
i_return_value = res_utl_extract_elem_results2 ( resultids,          @
                                                 elem_list,          @
                                                 derivation,         @
                                                 location,           @
                                                 cidlist,            @
                                                 avg_method,         @
                                                 avg_domain,         @
                                                 extrap_method,      @
                                                 complex_form,       @
                                                 complex_angle,      @
                                                 datatype,           @
                                                 resloc,             @
                                                 cnt,                @
                                                 ids,                @
                                                 nresults,           @
                                                 results,            @
                                                 min_loc,            @
                                                 max_loc )
 
#---------------------------------------------------------------------
 
dump i_return_value
dump datatype
dump resloc
dump cnt
dump ids
dump nresults
dump results 
dump min_loc
dump max_loc 
 
#---------------------------------------------------------------------
#  Closing the patran environment.
 
uil_file_close.goquit(  )
 
#---------------------------------------------------------------------
#  End of File.
 
res_utl_extract_nodal_history2
()
#  Purpose          :  This file provides an example of a call to the
#                      function res_utl_extract_nodal_history2() 
#
#                      This session file extracts specified results from the 
#                      database. It gives the result at each node along 
#                      with the type of results, nodal ids after using the
#                      averaging method, averaging domain, extrapolation 
#                      method and given complex form as a input. Apart from 
#                      that it also gives an array index for each minimum 
#                      and maximum nodal result component.                       
#                      
#                      Before running this session file run spool.ses and
#                      create result file spool.op2 as per the instructions 
#                      given in it. Import this result file spool.op2 into 
#                      spool.db.                    
#                       
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file through
#                      the "File","Session","Play" pulldown menus
#                      on the menu bar.
#
#
#  The function res_utl_extract_nodal_history2() 
#  has the following arguments:
#
#  res_utl_extract_nodal_history2 ( nrc,                             @
#                                   lcids,                           @
#                                   subids,                          @
#                                   resultids,                       @
#                                   node_list,                       @
#                                   derivation,                      @
#                                   cidlist,                         @
#                                   avg_method,                      @
#                                   avg_domain,                      @
#                                   extrap_method,                   @
#                                   complex_form,                    @
#                                   complex_angle,                   @
#                                   datatype,                        @
#                                   cnt,                             @
#                                   ids,                             @
#                                   results,                         @
#                                   min_loc,                         @
#                                   max_loc)
#
#---------------------------------------------------------------------
# Variable Decleration
 
INTEGER   nrc
INTEGER   lcids(virtual)
INTEGER   subids(virtual) 
INTEGER   resultids(5) 
STRING    node_list[12]
STRING    derivation[12]
STRING    cidlist[12]
STRING    avg_method[24]
STRING    avg_domain[24]
STRING    extrap_method[24]
STRING    complex_form[24]
REAL      complex_angle
INTEGER   datatype
INTEGER   cnt
INTEGER   ids(VIRTUAL)
REAL      results(VIRTUAL)
INTEGER   max_loc(virtual)
INTEGER   min_loc(virtual)
 
INTEGER   nres, primary_id(virtual), secondary_id(virtual)
INTEGER   nsub(virtual), nsub1
INTEGER   result_ids(4), nlayers, layerids(VIRTUAL)
STRING    layerlabels[80](VIRTUAL)
INTEGER   i_return_value
 
#---------------------------------------------------------------------
#  Opening the file spool.db
 
uil_file_open.go( "./spool.db") 
 
#---------------------------------------------------------------------
# Clear any previous results from the memory
 
res_utl_clear_result()
 
#---------------------------------------------------------------------
# Gets the loadcases associated with the results
 
res_utl_get_loadcases(nrc, lcids, nsub)
dump nrc, lcids, nsub
 
#---------------------------------------------------------------------
# Gets the subcases
 
res_utl_get_subcases(lcids(1), nsub1, subids)
dump nsub1, subids
 
#---------------------------------------------------------------------
# Gets the result ids
 
res_utl_get_result_ids ( nrc, lcids, subids, nres,                   @
                         primary_id, secondary_id)
  
dump nres, primary_id, secondary_id
dump nrc
dump lcids
dump subids
 
#---------------------------------------------------------------------
# Gets the layer positions associated with the results
 
result_ids(1) = lcids(1)
result_ids(2) = subids(1)
result_ids(3) = primary_id(2)
result_ids(4) = secondary_id(2)
 
res_utl_get_result_layers(result_ids, nlayers, layerids, layerlabels)
 
dump nlayers
dump layerids
dump layerlabels
 
#---------------------------------------------------------------------
# Argument Initialization
 
resultids(1)    = primary_id(2)
resultids(2)    = secondary_id(2)
resultids(3)    = layerids(1)
node_list       = "NODE 1:20"
derivation      = "MAG"
cidlist         = ""
avg_method      = "Sum"
avg_domain      = "All"
extrap_method   = "ShapeFunc"
complex_form    = "Real"
complex_angle   = 0.0
 
#---------------------------------------------------------------------
#  Extracts result data for 20 nodes (Nodes 1:20) from the database
 
i_return_value = res_utl_extract_nodal_history2( nrc,                @
                                                 lcids,              @
                                                 subids,             @
                                                 resultids,          @
                                                 node_list,          @
                                                 derivation,         @
                                                 cidlist,            @
                                                 avg_method,         @
                                                 avg_domain,         @
                                                 extrap_method,      @
                                                 complex_form,       @
                                                 complex_angle,      @
                                                 datatype,           @
                                                 cnt,                @
                                                 ids,                @
                                                 results,            @
                                                 min_loc,            @
                                                 max_loc )
 
#---------------------------------------------------------------------
 
dump i_return_value
dump datatype
dump cnt
dump ids
dump results 
dump min_loc
dump max_loc 
 
#---------------------------------------------------------------------
#  Closing the patran environment.
 
uil_file_close.goquit(  )
 
#---------------------------------------------------------------------
#  End of File.
 
res_utl_extract_nodal_results2
()
#  Purpose          :  This file provides an example of a call to the
#                      function res_utl_extract_nodal_results2() 
#
#                      This session file extracts specified results from the 
#                      database. It gives the result at each node along 
#                      with the type of results, nodalent ids after using the
#                      averaging method, averaging domain, extrapolation 
#                      method and given complex form as a input. 
# 
#                      Before running this session file run spool.ses and
#                      create result file spool.op2 as per the instructions 
#                      given in it. Import this result file spool.op2 into 
#                      spool.db. 
#                       
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file through
#                      the "File","Session","Play" pulldown menus
#                      on the menu bar.
#
#
#  The function res_utl_extract_nodal_results2() 
#  has the following arguments:
#
#  res_utl_extract_nodal_results2 ( resultids,                       @
#                                   nodal_list,                      @
#                                   derivation,                      @
#                                   cidlist,                         @
#                                   avg_method,                      @
#                                   avg_domain,                      @
#                                   extrap_method,                   @
#                                   complex_form,                    @
#                                   complex_angle,                   @
#                                   datatype,                        @
#                                   cnt,                             @
#                                   ids,                             @
#                                   nresults,                        @
#                                   results,                         @
#                                   min_loc,                         @
#                                   max_loc)
#
#
#---------------------------------------------------------------------
# Variable Decleration
 
INTEGER   resultids(5) 
STRING    node_list[12]
STRING    derivation[12]
STRING    cidlist[12]
STRING    avg_method[24]
STRING    avg_domain[24]
STRING    extrap_method[24]
STRING    complex_form[24]
REAL      complex_angle
INTEGER   datatype
INTEGER   cnt
INTEGER   ids(VIRTUAL)
REAL      results(VIRTUAL)
INTEGER   min_loc(6)
INTEGER   max_loc(6)
 
INTEGER   nrc, lcids(virtual), subids(virtual)
INTEGER   nres, primary_id(virtual), secondary_id(virtual)
INTEGER   nsub(virtual), nsub1
INTEGER   result_ids(4), nlayers, layerids(VIRTUAL)
STRING    layerlabels[80](VIRTUAL)
INTEGER   i_return_value
 
#---------------------------------------------------------------------
#  Opening the file spool.db
 
uil_file_open.go( "./spool.db") 
 
#---------------------------------------------------------------------
# Clear any previous results from the memory
 
res_utl_clear_result()
 
#---------------------------------------------------------------------
# Gets the loadcases associated with the results
 
res_utl_get_loadcases(nrc, lcids, nsub)
dump nrc, lcids, nsub
 
#---------------------------------------------------------------------
# Gets the subcases
 
res_utl_get_subcases(lcids(1), nsub1, subids)
dump nsub1, subids
 
#---------------------------------------------------------------------
# Gets the result ids
 
res_utl_get_result_ids(nrc, lcids,                                   @
               subids, nres, primary_id, secondary_id)
 
dump nres, primary_id, secondary_id
dump nrc
dump lcids
dump subids
 
#---------------------------------------------------------------------
# Gets the layer positions associated with the results
 
result_ids(1) = lcids(1)
result_ids(2) = subids(1)
result_ids(3) = primary_id(2)
result_ids(4) = secondary_id(2)
 
res_utl_get_result_layers(result_ids, nlayers, layerids, layerlabels)
 
dump nlayers
dump layerids
dump layerlabels
 
#---------------------------------------------------------------------
# Argument Initialization
 
resultids(1)    = lcids(1)
resultids(2)    = subids(1)
resultids(3)    = primary_id(2)
resultids(4)    = secondary_id(2)
resultids(5)    = layerids(1)
node_list       = "Node 1:10"
derivation      = "MAG"
cidlist         = ""
avg_method      = "Sum"
avg_domain      = "All"
extrap_method   = "ShapeFunc"
complex_form    = "Real"
complex_angle   = 0.0
 
#---------------------------------------------------------------------
#  Extracts result data for 10 nodes (Node 1:10) from the database
 
i_return_value = res_utl_extract_nodal_results2 ( resultids,         @
                                                  node_list,         @
                                                  derivation,        @
                                                  cidlist,           @
                                                  avg_method,        @
                                                  avg_domain,        @
                                                  extrap_method,     @
                                                  complex_form,      @
                                                  complex_angle,     @
                                                  datatype,          @
                                                  cnt,               @
                                                  ids,               @
                                                  results,           @
                                                  min_loc,           @
                                                  max_loc )
 
#---------------------------------------------------------------------
 
dump i_return_value
dump datatype
dump cnt
dump ids
dump results 
dump min_loc
dump max_loc 
 
#---------------------------------------------------------------------
#  Closing the patran environment.
 
uil_file_close.goquit(  )
 
#---------------------------------------------------------------------
#  End of File.
 
res_utl_transform_nodal_results
()
#  Purpose          :  This file provides an example of a call to the
#                      function res_utl_transform_nodal_results() 
#
#                      This session file transforms the specified nodal 
#                      results for specified coordinate system.              
#                      
#                      Before running this session file run spool.ses and
#                      create result file spool.op2 as per the instructions 
#                      given in it. Import this result file spool.op2 into 
#                      spool.db.                    
#                       
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file through
#                      the "File","Session","Play" pulldown menus
#                      on the menu bar.
#
#
#  The function res_utl_transform_nodal_results() 
#  has the following arguments:
#
#  res_utl_transform_nodal_results ( node_count,                    @
#                                    ids,                           @
#                                    cid,                           @
#                                    ncomp,                         @ 
#                                    results)
#
#---------------------------------------------------------------------
# Variable Decleration
 
INTEGER   node_count
INTEGER   ids(VIRTUAL)
INTEGER   cid
INTEGER   ncomp
REAL      results(VIRTUAL)
INTEGER   i_return_value
 
INTEGER   asm_create_cord_axi_created_ids
INTEGER   resultids(5) 
INTEGER   datatype
INTEGER   min_loc(6)
INTEGER   max_loc(6)
INTEGER   nrc, lcids(virtual), subids(virtual)
INTEGER   nres, primary_id(virtual), secondary_id(virtual)
INTEGER   nsub(virtual), nsub1
INTEGER   result_ids(4), nlayers, layerids(VIRTUAL)
STRING    layerlabels[80](VIRTUAL)
 
#---------------------------------------------------------------------
#  Opening the file spool.db
 
uil_file_open.go( "./spool.db") 
 
#---------------------------------------------------------------------
# Clear any previous results from the memory
 
res_utl_clear_result()
 
#---------------------------------------------------------------------
# Gets the loadcases associated with the results
 
res_utl_get_loadcases(nrc, lcids, nsub)
dump nrc, lcids, nsub
 
#---------------------------------------------------------------------
# Gets the subcases
 
res_utl_get_subcases(lcids(1), nsub1, subids)
dump nsub1, subids
 
#---------------------------------------------------------------------
# Gets the result ids
 
res_utl_get_result_ids(nrc, lcids,                                  @
               subids, nres, primary_id, secondary_id)
 
dump nres, primary_id, secondary_id
dump nrc
dump lcids
dump subids
 
#---------------------------------------------------------------------
# Gets the layer positions associated with the results
 
result_ids(1) = lcids(1)
result_ids(2) = subids(1)
result_ids(3) = primary_id(2)
result_ids(4) = secondary_id(2)
 
res_utl_get_result_layers(result_ids, nlayers, layerids, layerlabels)
 
dump nlayers
dump layerids
dump layerlabels
 
#---------------------------------------------------------------------
# Extracts result data for the 50 nodes from the database. 
 
resultids(1)    = lcids(1)
resultids(2)    = subids(1)
resultids(3)    = primary_id(2)
resultids(4)    = secondary_id(2)
resultids(5)    = layerids(1)
 
res_utl_extract_nodal_results (  resultids,                         @
                                 "Node 51:100",                     @
                                 "MAG",                             @
                                 "",                                @
                                 datatype,                          @
                                 node_count,                        @
                                 ids,                               @
                                 results,                           @
                                 min_loc,                           @
                                 max_loc )
 
dump datatype
dump node_count
dump ids
dump results 
dump min_loc
dump max_loc 
 
#---------------------------------------------------------------------
# Create a new cordinate system.
 
i_return_value = asm_const_coord_axis("2", "XY", "Coord 0",1,       @
                    "[0 0 5]", "[1 0 0]", "[0 1 0]",                @
                    asm_create_cord_axi_created_ids) 
dump i_return_value
 
#---------------------------------------------------------------------
# Argument Initialization
 
cid   = 2
ncomp = 1
 
#---------------------------------------------------------------------
# Transform the specified nodal results for specified cid. 
 
i_return_value = res_utl_transform_nodal_results ( node_count,       @
                                                   ids,              @
                                                   cid,              @
                                                   ncomp,            @
                                                   results) 
dump i_return_value
dump results
 
#---------------------------------------------------------------------
#  Closing the patran environment.
 
uil_file_close.goquit(  )
 
#---------------------------------------------------------------------
#  End of File.
 
vki_db_getresid
()
#  Purpose          :  This function will retrive the result type
#                      id from the data base. This function requires
#                      result case id,primary result id and secondary
#                      result id as input arguments.
#
#                      Before running this session file run spool.ses
#                      and import result file spool.op2 to create 
#                      spool.db with results. For instruction see
#                      file spool.ses.
#
#                      This file can be run by starting a session of
#                      MSC Patran,running this session file through 
#                      the "File","Session","Play" pulldown menus
#                      on the menu bar.
#
#
#  The function vki_db_getresids()
#  has the following arguments:
#
#  vki_db_getresid
#     (  INPUT:
#        INTEGER rescase_id
#        INTEGER prires_id
#        INTEGER secres_id
#        OUTPUT:
#        INTEGER rt_id 
#     ) 
#---------------------------------------------------------------------
# 
#  Opening a spool.db database 
 
     uil_file_open.go("spool.db")
 
#---------------------------------------------------------------------
 
#  Declaring input arguents
 
   INTEGER rescase_id(1)
   INTEGER prires_id
   INTEGER secres_id
 
#  Declaring output argument
 
   INTEGER rt_id
 
#----------------------------------------------------------------------
 
#  Using the function db_get_load_case_id() to get the load case id.
 
   INTEGER loadcase_id(1)
               db_get_load_case_id("spool_loads",             @
	                            loadcase_id(1))
 
 
#  Using the function db_get_sub_case_id() to get the sub case id.
 
   INTEGER subcase_id(1) 
               db_get_sub_case_id(loadcase_id(1),             @
                                  "Static Subcase",           @
                                   subcase_id(1))
 
 
#  Using the function res_db_cgetrescases() to get the the result 
#  case ids.
 
      INTEGER numload_cases = 1
               res_db_cgetrescases(numload_cases,             @
				   loadcase_id,               @
                                   subcase_id,                @
                                   rescase_id)
 
#  Using the function db_get_primary_res_id to get the primary result id
 
      STRING pri_res_label[32] = "Displacements"
               db_get_primary_res_id(pri_res_label,           @
                                     prires_id)
 
#  Using the function db_get_secondary_res_id to get the secondary result id
 
     STRING sec_res_label[32] = "Translational"
               db_get_secondary_res_id(prires_id,             @
                                       sec_res_label,         @
                                       secres_id)
 
#---------------------------------------------------------------------
 
#  Using the function vki_db_getresid to retrive result type id 
#  from the data base.
 
               rt_id = vki_db_getresid(rescase_id(1),        @
                                       prires_id,            @
                                       secres_id)
 
    dump rt_id
 
#---------------------------------------------------------------------
 
#  End of File.
 
#---------------------------------------------------------------------
 
xy_curve_results_set_wnd
()
#  Purpose          :  This function opens a window and
#                      draws a graph with given no. of points
#                      and the array for coordinates of the points
#                      It returns an integer with 0 as success 
#                      condition or the error code in case of
#                      failure.
#
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the "File","Session","Play" 
#                      pulldown menus on the menu bar.
#
#
#  The function xy_curve_result_set_wnd()
#  has the following arguments:
#
#  xy_curve_result_set_wnd
#     (  windowname,
#        num_points,
#        curve_name,
#        x,
#        y)           
#---------------------------------------------------------------------
#  Variable Declarations
 
      STRING  windowname[64]
      INTEGER num_points
      INTEGER int_status
      STRING  curve_name[64]
      REAL    x(VIRTUAL), y(VIRTUAL)
 
#----------------------------------------------------------------------
#  Open a new database
     if(!db_is_open())THEN
     uil_file_new.go("","new.db")
$? YES 36000002
     endif
#----------------------------------------------------------------------
#  Setting the preference to MSC.Nastran.
 
       uil_pref_analysis.set_analysis_pref( "MSC.Nastran",    @
                                   "Structural",              @
                                   "",                        @
                                   ".op2" )
#----------------------------------------------------------------------
#  Declare the windows and the variables.
 
      windowname = "win1"
      num_points = 5
      curve_name = "CURVE 1"
#----------------------------------------------------------------------
#  Define the size of the array for x and y values.
 
      sys_allocate_array(x,1,num_points)
      sys_allocate_array(y,1,num_points)
 
      x = [5.0, 2.0, 1.0, 5.1, 2.1]
      y = [5.0, -.01, 0.90, 7.3, 5]
 
#----------------------------------------------------------------------
#  Open the window with the function.
 
      int_status = xy_curve_results_set_wnd(                 @
                            windowname,                      @
                            num_points,                      @
                            curve_name,                      @
                            x,                               @
                            y                  )
dump int_status
#----------------------------------------------------------------------
#  Closing the file new.db
 
#      uil_file_close.goquit()
 
#  End of file
#----------------------------------------------------------------------