Tutorial Toolkit Code Examples > Analysis > 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.
 
analysis_get.pset_for_job
()
#  Purpose          :  This file provides an example of a call to the
#                      function analysis_get.pset_for_job()
#
#                      This session file creates an analysis step for
#                      MSC.Nastran code and displays the same.
#
#                      Before running this session file run plate.ses
#                      to create plate.db. This database contains a
#                      model of a plate with two jobs created.
#
#                      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 analysis_get.pset_for_job()
#  has the following arguments:
#
#  analysis_get.pset_for_job
#     (  analysis_code,
#        anal_job_name,
#        anal_job_id )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_analysis_code      [128]
STRING   s_anal_job_names     [80]  (VIRTUAL)
STRING   s_anal_job_descr     [256] (VIRTUAL)
INTEGER  i_anal_code_id
INTEGER  i_anal_job_id
INTEGER  i_return_value
INTEGER  i_job_count
INTEGER  i_job_id_list              (VIRTUAL)
INTEGER  i_job_sets                 (VIRTUAL)
INTEGER  i_job_stats                (VIRTUAL)
 
#---------------------------------------------------------------------
#  Open the database “plate.db”
uil_file_open.go(“plate.db”)
 
#---------------------------------------------------------------------
 
i_return_value = db_get_default_anal_code ( s_analysis_code)
 
dump i_return_value
dump s_analysis_code
 
#  To get the analysis code id for “MSC.Nastran” code.
i_return_value = db_get_anal_code_id(s_analysis_code,i_anal_code_id)
dump i_return_value
 
#---------------------------------------------------------------------
# Get the number of jobs associated with the analysis code.
i_return_value = db_count_job_names_for_a_code( i_anal_code_id, i_job_count )
 
dump i_return_value
dump i_anal_code_id
dump i_job_count
 
#---------------------------------------------------------------------
 
i_job_count = i_job_count * 2
 
SYS_ALLOCATE_ARRAY( s_anal_job_names,  1, i_job_count )
SYS_ALLOCATE_ARRAY( i_job_id_list,     1, i_job_count )
SYS_ALLOCATE_ARRAY( s_anal_job_descr,  1, i_job_count )
SYS_ALLOCATE_ARRAY( i_job_sets,        1, i_job_count )
SYS_ALLOCATE_ARRAY( i_job_stats,       1, i_job_count )
 
i_return_value =  db_get_jobnames_for_a_code                         @
                     (  i_anal_code_id,                              @
                        i_job_count,                                 @
                        s_anal_job_names,                            @
                        i_job_id_list,                               @
                        s_anal_job_descr,                            @
                        i_job_sets,                                  @
                        i_job_stats )
 
dump i_return_value
dump i_anal_code_id
dump i_job_count
dump s_anal_job_names
dump i_job_id_list
dump s_anal_job_descr
dump i_job_sets
dump i_job_stats
 
#---------------------------------------------------------------------
#  Call the function to get the analysis job id
 
s_anal_job_name = “plate1”
 
i_return_value =                                 @
   analysis_get.pset_for_job                     @
      (  s_analysis_code,                        @
         s_anal_job_names(1),                    @
         i_anal_job_id )
 
dump i_return_value
 
#  The analysis step id is.
dump i_anal_job_id
#---------------------------------------------------------------------
 
analysis_import
()
#  Purpose          :  This function controls the submittal of either 
#                       a "Result File" importation or an "Input File " 
#                       importation.  It generates the geometry and FEM 
#                       data from a input file like ".bdf" or from a 
#                       result file like ".op2" file.         
#
#                      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 analysis_import()
#  has the following arguments:
#
#  analysis_import
#     (  analysis_code,
#        jobname_text,
#        object,
#        filename,
#        wait)
#
#
#
#---------------------------------------------------------------------
#  Variable Declarations
 
      STRING asm_create_patch_xy_created_ids[VIRTUAL]
      STRING fem_create_mesh_s_nodes_created[VIRTUAL]
      STRING fem_create_mesh_s_elems_created[VIRTUAL]
      INTEGER fem_create_mesh_surfa_num_nodes
      INTEGER fem_create_mesh_surfa_num_elems
      INTEGER i_return_value
#----------------------------------------------------------------------
#  Open a new database
#     uil_file_new.go("","new.db")
 
#----------------------------------------------------------------------
      i_return_value = asm_const_patch_xyz                              @
                (       "1",                                            @
                        "<1 1 0>",                                      @
                        "[0 0 0]",                                      @
                        "Coord 0",                                      @
                        asm_create_patch_xy_created_ids )
 
      dump i_return_value
#----------------------------------------------------------------------
#  Create finite element entities 
 
      ui_exec_function( "mesh_seed_display_mgr", "init" )
      mesh_seed_create( "Surface 1.4 1.3 1.2 1.1 ",                     @
                                 1, 5, 0., 0., 0. )
 
      i_return_value = fem_create_mesh_surf_3( "IsoMesh",               @
                                0,                                      @
                                "Surface 1 ",                           @
                                1,                                      @
                                ["0.2"],                                @
                                "Quad4",                                @
                                "1",                                    @
                                 "1",                                   @
                                "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  )
 
      dump i_return_value
 
      mesh_seed_display_mgr.erase(  )
 
 
#----------------------------------------------------------------------
#  Create loads/boundary conditions
#  Creating set 'fixed_nodes' on L.H.S. of the model
#  Creating set of forces 'Loads_at_ends', Force of 50 units downwards.
 
 
      i_return_value = loadsbcs_create2( "fixed_nodes",                 @
                                "Displacement",                         @
                                "Nodal",                                @
                                "",                                     @
                                "Static",                               @
                                [" Node 1 31"],                         @
                                "FEM",                                  @
                                "Coord 0",                              @
                                "1.",                                   @
                                ["<0,0,0>",                             @
                                "<0,0,0>"],                             @
                                ["", ""]                 )
 
      dump i_return_value 
 
      i_return_value = loadsbcs_create2( "Loads_at_ends",               @
                                "Force",                                @
                                "Nodal",                                @
                                "",                                     @
                                "Static",                               @
                                [" Node 36 6"],                         @
                                "FEM",                                  @
                                "Coord 0",                              @
                                "1.",                                   @
                                ["<0,-50,0>",                           @
                                "<0,0,0>"],                             @
                                ["", ""]                 )
 
      dump i_return_value
 
#----------------------------------------------------------------------
#  Create Material - Steel
#  Modulus of elasticity - 29 E6 units
#  Piosson ratio - 0.3 
     
      i_return_value = material.create( "Analysis code ID",             @
                                1,                                      @
                                "Analysis type ID",                     @
                                1,                                      @
                                "Steel",                                @
                                0,                                      @
                                "",                                     @
                                "Isotropic",                            @
                                1,                                      @
                                "Directionality",                       @
                                1,                                      @
                                "Linearity",                            @
                                1,                                      @
                                "Homogeneous",                          @
                                0,                                      @
                                "Linear Elastic",                       @
                                1,                                      @
                                "Model Options & IDs",                  @
                                ["", "", "", "", ""],                   @
                                [0, 0, 0, 0, 0],                        @
                                "Active Flag",                          @
                                1,                                      @
                                "Create",                               @
                                10,                                     @
                                "External Flag",                        @
                                FALSE,                                  @
                                "Property IDs",                         @
                                ["Elastic Modulus",                     @
                                "Poisson Ratio"],                       @
                                [2, 5, 0],                              @
                                "Property Values",                      @
                                ["29E6", "0.3", ""]  )
      dump i_return_value
 
#----------------------------------------------------------------------
#  Create Element Properties  'Prop_1'
#  thickness - 0.05 units 
 
      i_return_value =  elementprops_create( "Prop_1",                  @
                                51,25,35,1,1,20,                        @
                                [13, 20, 36, 4037, 4111,4118, 4119],    @
                                [5, 9, 1, 1, 1, 1, 1],                  @
                                ["m:Steel","","0.05","","","",""],      @
                                " Element 1:25"                 )
 
      dump i_return_value
 
#----------------------------------------------------------------------
# Preparing the job for submission
jobfile.open( "new", "ANALYZE NO JOBFILE" )
msc_delete_old_files( "new", ".bdf", ".op2" )
jobfile.writec( "", "TRANSLATOR = pat3nas" )
jobfile.writec( "DATABASE", "new.db" )
jobfile.writec( "JOBNAME", "new" )
jobfile.writec( "ANALYSIS TITLE", "")
jobfile.writec( "", "" )
jobfile.writec( "OBJECT", "Entire Model" )
jobfile.writec( "METHOD", "Full Run" )
jobfile.writec( "", "" )
jobfile.writec( "MODEL SUFFIX", ".bdf" )
jobfile.writec( "RESULTS SUFFIX", ".op2" )
jobfile.writec( "", "" )
jobfile.writec( "", "/*" )
jobfile.writec( "", " * Translation Parameters" )
jobfile.writec( "", " */" )
jobfile.writec( "", "" )
jobfile.writec( "DATA OUTPUT", "OP2 Only" )
jobfile.writec( "OUTPUT2 REQUESTS", "P3 Built In" )
jobfile.writec( "OUTPUT2 FORMAT", "Binary" )
jobfile.writec( "DIVISION TOLERANCE", "1.0e-08" )
jobfile.writec( "NUMERICAL TOLERANCE", "1.0e-04" )
jobfile.writec( "MODEL TOLERANCE", "0.0049999999" )
jobfile.writec( "WRITING TOLERANCE", "1.0e-21" )
jobfile.writec( "CARD FORMAT", "either" )
jobfile.writec( "MINIMUM SIGNIF. DIGITS", "4" )
jobfile.writec( "NODE COORDINATES", "reference frame" )
jobfile.writec( "MSC.Nastran VERSION", "70.5" )
jobfile.writec( "PROPS ON ELEM ENTRY", "FALSE" )
jobfile.writec( "NO CONTINUATION ENTRY", "FALSE" )
jobfile.writec( "ITERATIVE SOLVER", "FALSE" )
jobfile.writec( "ELEMENT PROPERTY OFFSET", "0" )
jobfile.writec( "MATERIAL PROPERTY OFFSET", "0" )
jobfile.writec( "TABLE OFFSET", "0" )
jobfile.writec( "LOAD SET OFFSET", "0" )
jobfile.writec( "LOAD CASE OFFSET", "0" )
jobfile.writec( "CONTROL SET OFFSET", "0" )
jobfile.writec( "RIGID ELEMENT OFFSET", "0" )
jobfile.writec( "SCALAR POINT OFFSET", "0" )
jobfile.writec( "BEGINNING CONTINUATION MARKER", "+      A" )
jobfile.writec( "NUMBER ONLY", "ON" )
jobfile.writec( "BEGINNING NUMBER", "OFF" )
jobfile.writec( "TRAILING NUMBER", "OFF" )
jobfile.writec( "SYNTAX NUMBER", "ON" )
jobfile.writec( "SYNTAX MARKER", "." )
jobfile.writec( "", "" )
jobfile.writec( "", "/*" )
jobfile.writec( "", " * Solution Parameters" )
jobfile.writec( "", " */" )
jobfile.writec( "", "" )
jobfile.writec( "SOLUTION TYPE", "LINEAR STATIC" )
jobfile.writei( "SOLUTION SEQUENCE", 101 )
jobfile.writec( "DATABASE RUN", "ON" )
jobfile.writec( "CYCLIC SYMMETRY", "OFF" )
jobfile.writec( "AUTOMATIC CONSTRAINTS", "ON" )
jobfile.writec( "INERTIA RELIEF", "OFF" )
jobfile.writec( "ALTERNATE REDUCTION", "OFF" )
jobfile.writec( "MASS CALCULATION", "Lumped" )
jobfile.writec( "DATA DECK ECHO", "None" )
jobfile.writec( "PLATE RZ STIFFNESS FACTOR", "0.0" )
jobfile.writec( "MAXIMUM PRINTED LINES", "999999999" )
jobfile.writec( "MAXIMUM RUN TIME", "600" )
jobfile.writec( "WT-MASS CONVERSION", "1.0" )
jobfile.writec( "NODE ID FOR WT-GENER", "" )
jobfile.writec( "FMS WRITE", "ON" )
jobfile.writei( "FMS INPUT 0", 0 )
jobfile.writec( "EXEC WRITE", "ON" )
jobfile.writei( "EXEC INPUT 0", 0 )
jobfile.writec( "CASE WRITE", "ON" )
jobfile.writei( "CASE INPUT 0", 0 )
jobfile.writec( "BULK WRITE", "ON" )
jobfile.writei( "BULK INPUT 0", 0 )
jobfile.writec( "", "END" )
jobfile.close(  )
mscnastran_job.associate_subcases( "101", "new", 1, ["Default"] )
 
#-----------------------------------------------------------------------
#  Submitting the job for analysis
 
      analysis_submit( "MSC.Nastran", "new",TRUE )
#-----------------------------------------------------------------------
 
#  Closing the file new.db
 
      uil_file_close.go(  )
#-----------------------------------------------------------------------
#  Opening the file with the name new.db again.
      uil_file_new.go( "","new.db" )
$? YES 36000002 
 
#-----------------------------------------------------------------------
#  Importing data from the closed new.bdf file
 
      analysis_import("MSC.Nastran","new","Input File","new.bdf",TRUE)
#-----------------------------------------------------------------------
# Closing the file new.db
#
      uil_file_close.goquit(  )
-----------------------------------------------------------------------
 
analysis_main.job_name_lbox
()
#  Purpose          :  The function analysis_main.job_name_lbox()
#                      is a callback to "Available Jobs" listbox in
#                      "Analysis" form. Execution of this function 
#                      will load the corresponding jobname in to 
#                      "Job Name" data box in "Analysis" form.
#
#                      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 analysis_main.job_name_lbox()
#  has the following arguments:
#
#  analysis_main.job_name_lbox
#     (  INPUT:
#        INTEGER num_items,
#        STRING job_name[]()
#        OUTPUT:
#     ) 
#---------------------------------------------------------------------
# 
#  Opening a new database 
 
     uil_file_new.go("","new.db")
 
#---------------------------------------------------------------------
 
#  Displaying Analyis Application form
 
   ui_exec_function( "uil_app_analysis", "display" )
 
#--------------------------------------------------------------------
 
#  Declaring and defining input arguents
 
   INTEGER num_items = 1
 
   STRING job_name[64](1) = ["new_job"]
 
#---------------------------------------------------------------------
 
#  Using the function analysis_main.job_name_lbox() to load the 
#  jobname into "Job Name" data box in "Analysis" form. 
   
        analysis_main.job_name_lbox(num_items,         @
                                    job_name)
 
 
#---------------------------------------------------------------------
 
#  Using the function analysis_main.get_job_name_and_desc()
#  to check the job name in "Job Name" data box in "Analysis" form.
 
   STRING check_job_name[64]
 
   STRING job_desc[256]
 
   analysis_main.get_job_name_and_desc(check_job_name,job_desc)
 
   dump check_job_name
 
#----------------------------------------------------------------------
 
#  End of File.
 
#---------------------------------------------------------------------
 
analysis_main.user_function
()
#  Purpose          :  This file provides an example of a call to the
#                      function analysis_main.user_function()
#
#                      This function executes a given function under a
#                      classname.  It first checks the status of the 
#                      function and checks whether it exists and   
#                      whether it is currently loaded in memory.
#                      If the function does not exists then the 
#                      value of the output return is 0.  If the function
#                      gets executed then the value returned is 1.
#                      It invokes a class' function.  Problems could 
#                      occur if the function has input arguements.  this 
#                      can best be utilised to "init" or "display"
#                      functions.
#
#
#                      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 analysis_main.user_function()
#  has the following arguments:
#
#   analysis_main.user_function
#     (  class_name,
#        function_name,
#        exist_flag  )
#
#---------------------------------------------------------------------
#  Variable Declarations
 
      STRING classname[128]
      STRING function_name[128]
      INTEGER exist_flag
      INTEGER status
 
#----------------------------------------------------------------------
#  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" )
 
#---------------------------------------------------------------------
#  Playing the event file to open the analysis open form
 
      em_event_play("analysis_form_open.evt.01")
 
#---------------------------------------------------------------------
#  Initialising the class of functions :  analysis_main
 
       analysis_main.init()
 
#---------------------------------------------------------------------
#  Use the function to execute the function - jobfile.close
#  Assigning values to the variables 
 
      classname       = "jobfile"
      function_name   = "close"
 
      status = analysis_main.user_function(               @
                             classname,                   @
                             function_name,               @
                             exist_flag)
 
dump status
dump exist_flag
 
#---------------------------------------------------------------------
#  Closing the file
 
     uil_file_close.goquit()
 
#---------------------------------------------------------------------
#  End of file
 
analysis_submit
()
#  Purpose          :  This function submits a job for analysis with a
#                      wait flag option. If running in a batch mode the
#                      wait flag can be set to TRUE to assure that the
#                      process will wait for completion of the analysis
#                      prior to continuing. analysis_submit() call must
#                      follow a job preparation sequence that is 
#                      dependent upon the analysis solver preference 
#                      selected. For example, the MSC Patran ADVANCED
#                      FEA preference which invokes a direct translator
#                      without writing out a saved input file, requires
#                      a prerequisite sequence of "analysis_create" 
#                      class calls. 
#                      For the MSC.Nastran preference, a typical job
#                      submission involves the following sequence. A 
#                      job file is created by a series of calls: 
#                      jobfile.open, msc_delete_old_files, 
#                      jobfile.write_spl, jobfile.writec,jobfile.writei,
#                      jobfile.close. Next, mscnastran_job.associate_
#                      subcases, and then finally analysis_submit is 
#                      called. An exact sequence is best found from 
#                      MSC Patran session files. 
#
# 
#                      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 analysis_submit()
#  has the following arguments:
#
#  analysis_submit
#     (  analysis_code,
#        jobname,
#        wait_for_analysis)
#
#---------------------------------------------------------------------
#  Variable Declarations
 
      STRING asm_create_patch_xy_created_ids[VIRTUAL]
      STRING fem_create_mesh_s_nodes_created[VIRTUAL]
      STRING fem_create_mesh_s_elems_created[VIRTUAL]
      INTEGER fem_create_mesh_surfa_num_nodes
      INTEGER fem_create_mesh_surfa_num_elems
      INTEGER i_return_value
#----------------------------------------------------------------------
#  Open a new database
#      uil_file_new.go("","new.db")
#$? YES 36000002
 
#----------------------------------------------------------------------
      i_return_value = asm_const_patch_xyz                              @
                (       "1",                                            @
                        "<1 1 0>",                                      @
                        "[0 0 0]",                                      @
                        "Coord 0",                                      @
                        asm_create_patch_xy_created_ids )
 
      dump i_return_value
#----------------------------------------------------------------------
#  Create finite element entities 
 
      ui_exec_function( "mesh_seed_display_mgr", "init" )
      mesh_seed_create( "Surface 1.4 1.3 1.2 1.1 ",                     @
                                 1, 5, 0., 0., 0. )
 
      i_return_value = fem_create_mesh_surf_3( "IsoMesh",               @
                                0,                                      @
                                "Surface 1 ",                           @
                                1,                                      @
                                ["0.2"],                                @
                                "Quad4",                                @
                                "1",                                    @
                                 "1",                                   @
                                "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  )
 
      dump i_return_value
 
      mesh_seed_display_mgr.erase(  )
 
 
#----------------------------------------------------------------------
#  Create loads/boundary conditions
#  Creating set 'fixed_nodes' on L.H.S. of the model
#  Creating set of forces 'Loads_at_ends', Force of 50 units downwards.
 
 
      i_return_value = loadsbcs_create2( "fixed_nodes",                 @
                                "Displacement",                         @
                                "Nodal",                                @
                                "",                                     @
                                "Static",                               @
                                [" Node 1 31"],                         @
                                "FEM",                                  @
                                "Coord 0",                              @
                                "1.",                                   @
                                ["<0,0,0>",                             @
                                "<0,0,0>"],                             @
                                ["", ""]                 )
 
      dump i_return_value 
 
      i_return_value = loadsbcs_create2( "Loads_at_ends",               @
                                "Force",                                @
                                "Nodal",                                @
                                "",                                     @
                                "Static",                               @
                                [" Node 36 6"],                         @
                                "FEM",                                  @
                                "Coord 0",                              @
                                "1.",                                   @
                                ["<0,-50,0>",                           @
                                "<0,0,0>"],                             @
                                ["", ""]                 )
 
      dump i_return_value
 
#----------------------------------------------------------------------
#  Create Material - Steel
#  Modulus of elasticity - 29 E6 units
#  Piosson ratio - 0.3 
 
      i_return_value = material.create( "Analysis code ID",             @
                                1,                                      @
                                "Analysis type ID",                     @
                                1,                                      @
                                "Steel",                                @
                                0,                                      @
                                "",                                     @
                                "Isotropic",                            @
                                1,                                      @
                                "Directionality",                       @
                                1,                                      @
                                "Linearity",                            @
                                1,                                      @
                                "Homogeneous",                          @
                                0,                                      @
                                "Linear Elastic",                       @
                                1,                                      @
                                "Model Options & IDs",                  @
                                ["", "", "", "", ""],                   @
                                [0, 0, 0, 0, 0],                        @
                                "Active Flag",                          @
                                1,                                      @
                                "Create",                               @
                                10,                                     @
                                "External Flag",                        @
                                FALSE,                                  @
                                "Property IDs",                         @
                                ["Elastic Modulus",                     @
                                "Poisson Ratio"],                       @
                                [2, 5, 0],                              @
                                "Property Values",                      @
                                ["29E6", "0.3", ""]  )
 
      dump i_return_value
 
#----------------------------------------------------------------------
#  Create Element Properties  'Prop_1'
#  thickness - 0.05 units 
 
      i_return_value =  elementprops_create( "Prop_1",                  @
                                51,25,35,1,1,20,                        @
                                [13, 20, 36, 4037, 4111,4118, 4119],    @
                                [5, 9, 1, 1, 1, 1, 1],                  @
                                ["m:Steel","","0.05","","","",""],      @
                                " Element 1:25"                 )
 
 
      dump i_return_value
 
#----------------------------------------------------------------------
#  Preaparing the file new.bdf required for submission
 
jobfile.open( "new", "ANALYZE NO JOBFILE" )
msc_delete_old_files( "new", ".bdf", ".op2" )
jobfile.writec( "", "TRANSLATOR = pat3nas" )
jobfile.writec( "DATABASE", "new.db" )
jobfile.writec( "JOBNAME", "new" )
jobfile.writec( "ANALYSIS TITLE", "" )
jobfile.writec( "", "" )
jobfile.writec( "OBJECT", "Entire Model" )
jobfile.writec( "METHOD", "Full Run" )
jobfile.writec( "", "" )
jobfile.writec( "MODEL SUFFIX", ".bdf" )
jobfile.writec( "RESULTS SUFFIX", ".op2" )
jobfile.writec( "", "" )
jobfile.writec( "", "/*" )
jobfile.writec( "", " * Translation Parameters" )
jobfile.writec( "", " */" )
jobfile.writec( "", "" )
jobfile.writec( "DATA OUTPUT", "OP2 Only" )
jobfile.writec( "OUTPUT2 REQUESTS", "P3 Built In" )
jobfile.writec( "OUTPUT2 FORMAT", "Binary" )
jobfile.writec( "DIVISION TOLERANCE", "1.0e-08" )
jobfile.writec( "NUMERICAL TOLERANCE", "1.0e-04" )
jobfile.writec( "MODEL TOLERANCE", "0.0049999999" )
jobfile.writec( "WRITING TOLERANCE", "1.0e-21" )
jobfile.writec( "CARD FORMAT", "either" )
jobfile.writec( "MINIMUM SIGNIF. DIGITS", "4" )
jobfile.writec( "NODE COORDINATES", "reference frame" )
jobfile.writec( "MSC.Nastran VERSION", "70.7" )
jobfile.writec( "PROPS ON ELEM ENTRY", "FALSE" )
jobfile.writec( "NO CONTINUATION ENTRY", "TRUE" )
jobfile.writec( "ITERATIVE SOLVER", "FALSE" )
jobfile.writec( "ELEMENT PROPERTY OFFSET", "0" )
jobfile.writec( "MATERIAL PROPERTY OFFSET", "0" )
jobfile.writec( "TABLE OFFSET", "0" )
jobfile.writec( "LOAD SET OFFSET", "0" )
jobfile.writec( "LOAD CASE OFFSET", "0" )
jobfile.writec( "CONTROL SET OFFSET", "0" )
jobfile.writec( "RIGID ELEMENT OFFSET", "0" )
jobfile.writec( "SCALAR POINT OFFSET", "0" )
jobfile.writec( "BEGINNING CONTINUATION MARKER", "+      A" )
jobfile.writec( "NUMBER ONLY", "ON" )
jobfile.writec( "BEGINNING NUMBER", "OFF" )
jobfile.writec( "TRAILING NUMBER", "OFF" )
jobfile.writec( "SYNTAX NUMBER", "ON" )
jobfile.writec( "SYNTAX MARKER", "." )
jobfile.writec( "", "" )
jobfile.writec( "", "/*" )
jobfile.writec( "", " * Solution Parameters" )
jobfile.writec( "", " */" )
jobfile.writec( "", "" )
jobfile.writec( "SOLUTION TYPE", "LINEAR STATIC" )
jobfile.writei( "SOLUTION SEQUENCE", 101 )
jobfile.writec( "DATABASE RUN", "ON" )
jobfile.writec( "CYCLIC SYMMETRY", "OFF" )
jobfile.writec( "AUTOMATIC CONSTRAINTS", "ON" )
jobfile.writec( "INERTIA RELIEF", "OFF" )
jobfile.writec( "ALTERNATE REDUCTION", "OFF" )
jobfile.writec( "MASS CALCULATION", "Lumped" )
jobfile.writec( "DATA DECK ECHO", "None" )
jobfile.writec( "PLATE RZ STIFFNESS FACTOR", "0.0" )
jobfile.writec( "MAXIMUM PRINTED LINES", "999999999" )
jobfile.writec( "MAXIMUM RUN TIME", "600" )
jobfile.writec( "WT-MASS CONVERSION", "1.0" )
jobfile.writec( "NODE ID FOR WT-GENER", "" )
jobfile.writec( "FMS WRITE", "ON" )
jobfile.writei( "FMS INPUT 0", 0 )
jobfile.writec( "EXEC WRITE", "ON" )
jobfile.writei( "EXEC INPUT 0", 0 )
jobfile.writec( "CASE WRITE", "ON" )
jobfile.writei( "CASE INPUT 0", 0 )
jobfile.writec( "BULK WRITE", "ON" )
jobfile.writei( "BULK INPUT 0", 0 )
jobfile.writec( "", "END" )
jobfile.close(  )
mscnastran_job.associate_subcases( "101", "new", 1, ["Default"] )
#----------------------------------------------------------------------
#  Submitting the job for analysis
 
        analysis_submit( "MSC.Nastran", "new" ,TRUE)
 
#----------------------------------------------------------------------
# Closing the file new.db
 
        uil_file_close.goquit(  )
 
#----------------------------------------------------------------------
 
analysis_submit_2
()
#  Purpose          : This is a new function designed to replace the 
#                       call to analysis_submit in the session files.  
#                       This function will determine what to do with the 
#                       wait flag and then call the analysis_submit 
#                       function with the appropriate wait flag instead 
#                       of always having the wait flag set to FALSE as 
#                       was done previously.
#
#                      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 analysis_submit_2()
#  has the following arguments:
#
#  analysis_submit_2
#     (  analysis_code,
#        jobname  )
#
#---------------------------------------------------------------------
#  Variable Declarations
 
      STRING asm_create_patch_xy_created_ids[VIRTUAL]
      STRING fem_create_mesh_s_nodes_created[VIRTUAL]
      STRING fem_create_mesh_s_elems_created[VIRTUAL]
      INTEGER fem_create_mesh_surfa_num_nodes
      INTEGER fem_create_mesh_surfa_num_elems
      INTEGER i_return_value
#----------------------------------------------------------------------
#  Open a new database
#      uil_file_new.go("","new.db")
#$? YES 36000002
 
#----------------------------------------------------------------------
      i_return_value = asm_const_patch_xyz                              @
                (       "1",                                            @
                        "<1 1 0>",                                      @
                        "[0 0 0]",                                      @
                        "Coord 0",                                      @
                        asm_create_patch_xy_created_ids )
 
      dump i_return_value
#----------------------------------------------------------------------
#  Create finite element entities 
 
      ui_exec_function( "mesh_seed_display_mgr", "init" )
      mesh_seed_create( "Surface 1.4 1.3 1.2 1.1 ",                     @
                                 1, 5, 0., 0., 0. )
 
      i_return_value = fem_create_mesh_surf_3( "IsoMesh",               @
                                0,                                      @
                                "Surface 1 ",                           @
                                1,                                      @
                                ["0.2"],                                @
                                "Quad4",                                @
                                "1",                                    @
                                 "1",                                   @
                                "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  )
 
      dump i_return_value
 
      mesh_seed_display_mgr.erase(  )
 
#----------------------------------------------------------------------
#  Create loads/boundary conditions
#  Creating set 'fixed_nodes' on L.H.S. of the model
#  Creating set of forces 'Loads_at_ends', Force of 50 units downwards.
 
 
      i_return_value = loadsbcs_create2( "fixed_nodes",                 @
                                "Displacement",                         @
                                "Nodal",                                @
                                "",                                     @
                                "Static",                               @
                                [" Node 1 31"],                         @
                                "FEM",                                  @
                                "Coord 0",                              @
                                "1.",                                   @
                                ["<0,0,0>",                             @
                                "<0,0,0>"],                             @
                                ["", ""]                 )
 
      dump i_return_value 
 
      i_return_value = loadsbcs_create2( "Loads_at_ends",               @
                                "Force",                                @
                                "Nodal",                                @
                                "",                                     @
                                "Static",                               @
                                [" Node 36 6"],                         @
                                "FEM",                                  @
                                "Coord 0",                              @
                                "1.",                                   @
                                ["<0,-50,0>",                           @
                                "<0,0,0>"],                             @
                                ["", ""]                 )
 
      dump i_return_value
 
#----------------------------------------------------------------------
#  Create Material - Steel
#  Modulus of elasticity - 29 E6 units
#  Piosson ratio - 0.3 
 
      i_return_value = material.create( "Analysis code ID",             @
                                1,                                      @
                                "Analysis type ID",                     @
                                1,                                      @
                                "Steel",                                @
                                0,                                      @
                                "",                                     @
                                "Isotropic",                            @
                                1,                                      @
                                "Directionality",                       @
                                1,                                      @
                                "Linearity",                            @
                                1,                                      @
                                "Homogeneous",                          @
                                0,                                      @
                                "Linear Elastic",                       @
                                1,                                      @
                                "Model Options & IDs",                  @
                                ["", "", "", "", ""],                   @
                                [0, 0, 0, 0, 0],                        @
                                "Active Flag",                          @
                                1,                                      @
                                "Create",                               @
                                10,                                     @
                                "External Flag",                        @
                                FALSE,                                  @
                                "Property IDs",                         @
                                ["Elastic Modulus",                     @
                                "Poisson Ratio"],                       @
                                [2, 5, 0],                              @
                                "Property Values",                      @
                                ["29E6", "0.3", ""]  )
 
      dump i_return_value
 
#----------------------------------------------------------------------
#  Create Element Properties  'Prop_1'
#  thickness - 0.05 units 
 
      i_return_value =  elementprops_create( "Prop_1",                  @
                                51,25,35,1,1,20,                        @
                                [13, 20, 36, 4037, 4111,4118, 4119],    @
                                [5, 9, 1, 1, 1, 1, 1],                  @
                                ["m:Steel","","0.05","","","",""],      @
                                " Element 1:25"                 )
 
 
      dump i_return_value
 
#----------------------------------------------------------------------
#  Preaparing the file new.bdf required for submission
 
jobfile.open( "new", "ANALYZE NO JOBFILE" )
msc_delete_old_files( "new", ".bdf", ".op2" )
jobfile.writec( "", "TRANSLATOR = pat3nas" )
jobfile.writec( "DATABASE", "new.db" )
jobfile.writec( "JOBNAME", "new" )
jobfile.writec( "ANALYSIS TITLE", "" )
jobfile.writec( "", "" )
jobfile.writec( "OBJECT", "Entire Model" )
jobfile.writec( "METHOD", "Full Run" )
jobfile.writec( "", "" )
jobfile.writec( "MODEL SUFFIX", ".bdf" )
jobfile.writec( "RESULTS SUFFIX", ".op2" )
jobfile.writec( "", "" )
jobfile.writec( "", "/*" )
jobfile.writec( "", " * Translation Parameters" )
jobfile.writec( "", " */" )
jobfile.writec( "", "" )
jobfile.writec( "DATA OUTPUT", "OP2 Only" )
jobfile.writec( "OUTPUT2 REQUESTS", "P3 Built In" )
jobfile.writec( "OUTPUT2 FORMAT", "Binary" )
jobfile.writec( "DIVISION TOLERANCE", "1.0e-08" )
jobfile.writec( "NUMERICAL TOLERANCE", "1.0e-04" )
jobfile.writec( "MODEL TOLERANCE", "0.0049999999" )
jobfile.writec( "WRITING TOLERANCE", "1.0e-21" )
jobfile.writec( "CARD FORMAT", "either" )
jobfile.writec( "MINIMUM SIGNIF. DIGITS", "4" )
jobfile.writec( "NODE COORDINATES", "reference frame" )
jobfile.writec( "MSC.Nastran VERSION", "70.7" )
jobfile.writec( "PROPS ON ELEM ENTRY", "FALSE" )
jobfile.writec( "NO CONTINUATION ENTRY", "TRUE" )
jobfile.writec( "ITERATIVE SOLVER", "FALSE" )
jobfile.writec( "ELEMENT PROPERTY OFFSET", "0" )
jobfile.writec( "MATERIAL PROPERTY OFFSET", "0" )
jobfile.writec( "TABLE OFFSET", "0" )
jobfile.writec( "LOAD SET OFFSET", "0" )
jobfile.writec( "LOAD CASE OFFSET", "0" )
jobfile.writec( "CONTROL SET OFFSET", "0" )
jobfile.writec( "RIGID ELEMENT OFFSET", "0" )
jobfile.writec( "SCALAR POINT OFFSET", "0" )
jobfile.writec( "BEGINNING CONTINUATION MARKER", "+      A" )
jobfile.writec( "NUMBER ONLY", "ON" )
jobfile.writec( "BEGINNING NUMBER", "OFF" )
jobfile.writec( "TRAILING NUMBER", "OFF" )
jobfile.writec( "SYNTAX NUMBER", "ON" )
jobfile.writec( "SYNTAX MARKER", "." )
jobfile.writec( "", "" )
jobfile.writec( "", "/*" )
jobfile.writec( "", " * Solution Parameters" )
jobfile.writec( "", " */" )
jobfile.writec( "", "" )
jobfile.writec( "SOLUTION TYPE", "LINEAR STATIC" )
jobfile.writei( "SOLUTION SEQUENCE", 101 )
jobfile.writec( "DATABASE RUN", "ON" )
jobfile.writec( "CYCLIC SYMMETRY", "OFF" )
jobfile.writec( "AUTOMATIC CONSTRAINTS", "ON" )
jobfile.writec( "INERTIA RELIEF", "OFF" )
jobfile.writec( "ALTERNATE REDUCTION", "OFF" )
jobfile.writec( "MASS CALCULATION", "Lumped" )
jobfile.writec( "DATA DECK ECHO", "None" )
jobfile.writec( "PLATE RZ STIFFNESS FACTOR", "0.0" )
jobfile.writec( "MAXIMUM PRINTED LINES", "999999999" )
jobfile.writec( "MAXIMUM RUN TIME", "600" )
jobfile.writec( "WT-MASS CONVERSION", "1.0" )
jobfile.writec( "NODE ID FOR WT-GENER", "" )
jobfile.writec( "FMS WRITE", "ON" )
jobfile.writei( "FMS INPUT 0", 0 )
jobfile.writec( "EXEC WRITE", "ON" )
jobfile.writei( "EXEC INPUT 0", 0 )
jobfile.writec( "CASE WRITE", "ON" )
jobfile.writei( "CASE INPUT 0", 0 )
jobfile.writec( "BULK WRITE", "ON" )
jobfile.writei( "BULK INPUT 0", 0 )
jobfile.writec( "", "END" )
jobfile.close(  )
mscnastran_job.associate_subcases( "101", "new", 1, ["Default"] )
#-----------------------------------------------------------------------------
#  Submitting the job for analysis
 
      analysis_submit_2( "MSC.Nastran", "new")
$? YES 6016072
#  
#-----------------------------------------------------------------------------
#  Closing the file new.db
      uil_file_close.goquit(  )
#-----------------------------------------------------------------------------
 
db_assign_last_jobname
()
#  Purpose          :  This file provides an example of two calls to 
#                      the function db_assign_last_jobname()
#
#                      Before running this session file run plate.ses
#                      to create plate.db. This database contains a
#                      model of a plate with two jobs created.
#
#                      This illustration opens the database 
#                      “plate.db” and gets the array of job names
#                      for “MSC.Nastran”. Assigns first two job names
#                      as last job names. Each time gets the last 
#                      job name for verification.
#                      
#                      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_assign_last_jobname() has the following arguments:
#
#  db_assign_last_jobname
#     (  jobname )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_jobname[32]
INTEGER  i_return_value
INTEGER  i_analysis_code_id, i_max
INTEGER  ia_job_name_ids(2)
STRING   sa_jobnames[128](2)
STRING   sa_description[512](2)
INTEGER  ia_param_set_ids(2)
INTEGER  ia_status_array(2)
#---------------------------------------------------------------------
#  Open the database “plate.db”
uil_file_open.go(“plate.db”)
#
#  Get the code id for “MSC.Nastran”
i_return_value =                                @
   db_get_anal_code_id( “MSC.Nastran”, i_analysis_code_id )
dump i_return_value
dump i_analysis_code_id
#
#  Get the two Job names for this analysis code
i_max = 2
i_return_value =                                @
   db_get_jobnames_for_a_code                   @
      (  i_analysis_code_id,                    @
         i_max,                                 @
         sa_jobnames,                           @
         ia_job_name_ids,                       @
         sa_description,                        @
         ia_param_set_ids,                      @
         ia_status_array )
dump i_return_value
#
#  The Job names array is
dump sa_jobnames
#---------------------------------------------------------------------
#  Set the sa_jobnames(1) as the last job name
s_jobname = sa_jobnames(1)
i_return_value =                                 @
   db_assign_last_jobname                        @
      (  s_jobname )
dump i_return_value
#
#  Get the last job name
i_return_value =                                 @
   db_get_last_jobname(s_jobname)
dump i_return_value
dump s_jobname
#
#  Now set the sa_jobnames(2) as the last job name
dump sa_jobnames(2)
s_jobname = sa_jobnames(2)
i_return_value =                                 @
   db_assign_last_jobname                        @
      (  s_jobname )
dump i_return_value
#
#  Now get the newly set last job name
i_return_value =                                 @
   db_get_last_jobname ( s_jobname )
dump i_return_value
dump s_jobname
#---------------------------------------------------------------------
db_count_all_job_name_ids
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_count_all_job_name_ids()
#
#                      Before running this session file run plate.ses
#                      to create plate.db. This database contains a
#                      model of a plate with two jobs created.
#
#                      This illustration opens the data base
#                      “plate.db” and gets the count of job name ids.
#
#                      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_all_job_name_ids()
#  has the following arguments:
#
#  db_count_all_job_name_ids
#     (  nbr_of_jobnames )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_nbr_of_jobnames
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “plate.db”
uil_file_open.go(“plate.db”)
 
#  Get the count of all the job name ids
i_return_value =                                 @
   db_count_all_job_name_ids                     @
      (  i_nbr_of_jobnames )
dump i_return_value
dump i_nbr_of_jobnames
#---------------------------------------------------------------------
db_count_anal_codes
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_count_anal_codes()
#
#                      This file opens a new data base “new.db”
#                      and gets the count of analysis codes stored
#                      in the data base.
#
#                      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_anal_codes() has the following arguments:
#
#  db_count_anal_codes
#     (  count )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_count
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
#  Get the number of analysis codes stored in the database.
i_return_value =                                 @
   db_count_anal_codes                           @
      (  i_count )
dump i_return_value
dump i_count
#---------------------------------------------------------------------
db_count_anal_types
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_count_anal_types()
#      
#                      This file opens a new data base “new.db” and
#                      gets the count of analysis types for the
#                      analysis code “MSC.Nastran”. 
#
#                      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_anal_types() has the following arguments:
#
#  db_count_anal_types
#     (  name,
#        count )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_name[32]
INTEGER  i_count
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Count the analysis types for the analysis code “MSC.Nastran”
s_name = “MSC.Nastran”
i_return_value =                                 @
   db_count_anal_types                           @
      (  s_name,                                 @
         i_count )
dump i_return_value
 
#  The number of analysis types
dump i_count
 
#---------------------------------------------------------------------
db_count_analysis_steps
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_count_analysis_steps()
#
#                      This session file gives the analysis steps used
#                      so far in the current database.
#
#                      Before running this session file run plate.ses
#                      to create plate.db. This database contains a 
#                      model of a plate with two jobs created.
#
#                      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_analysis_steps()
#  has the following arguments:
#
#  db_count_analysis_steps
#     (  acode_id,
#        num_steps )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_acode_id
INTEGER  i_num_steps
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “plate.db”
uil_file_open.go(“plate.db”)
 
#  To get the analysis code id for “MSC.Nastran” code.
i_return_value = db_get_anal_code_id(“MSC.Nastran”, i_acode_id)
dump i_return_value
#---------------------------------------------------------------------
i_return_value =                                 @
   db_count_analysis_steps                       @
      (  i_acode_id,                             @
         i_num_steps )
dump i_return_value
#  The number of analysis steps for “MSC.Nastran” code are
dump i_num_steps
#---------------------------------------------------------------------
 
db_count_job_name_list_entry
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_count_job_name_list_entry()
#
#                      This illustration opens the database plate.db
#                      and calls the functions to get all the job name
#                      IDs in the database. Then it calls the function
#                      to count the number of load cases associated 
#                      with the last job. Finally it displays the load
#                      cases counted already.
#
#                      Before running this session file run plate.ses
#                      to create plate.db. This database contains a
#                      model of a plate with two jobs created.
#
#                      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_job_name_list_entry()
#  has the following arguments:
#
#  db_count_job_name_list_entry
#     (  jobname_id,
#        num_lists )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_jobname_id
INTEGER  i_num_lists
INTEGER  i_return_value
 
INTEGER  i_analysis_code_id
STRING   sv_jobname[80](VIRTUAL)
STRING   sv_description[256](VIRTUAL)
INTEGER  iv_jobname_id(VIRTUAL)
INTEGER  iv_param_set_id(VIRTUAL)
INTEGER  iv_status(VIRTUAL)
INTEGER  i_count
INTEGER  iv_step_id(VIRTUAL)
INTEGER  iv_load_case_id(VIRTUAL)
#---------------------------------------------------------------------
#  Open the database “plate.db”
uil_file_open.go(“plate.db”)
 
#  To get the analysis code id for “MSC.Nastran” code.
i_return_value = db_get_anal_code_id(“MSC.Nastran”,i_analysis_code_id)
dump i_return_value
 
#  Find out number of jobs in the model for memory allocation.
#
i_return_value =                                 @
   db_count_job_names_for_a_code(i_analysis_code_id,i_count)
dump i_return_value
 
sys_allocate_array(sv_jobname,1,i_count)
sys_allocate_array(sv_description,1,i_count)
sys_allocate_array(iv_jobname_id,1,i_count)
sys_allocate_array(iv_param_set_id,1,i_count)
sys_allocate_array(iv_status,1,i_count)
 
#  Get all the job names for analysis code “MSC.Nastran”
#
i_return_value =                                 @
   db_get_jobnames_for_a_code                    @
      ( i_analysis_code_id,i_count,sv_jobname,   @
        iv_jobname_id ,sv_description,           @
        iv_param_set_id,iv_status )
dump i_return_value
#---------------------------------------------------------------------
#  Call the function to count the load cases associated with the
#  last job name.
i_jobname_id = iv_jobname_id(i_count)
#
i_return_value =                                 @
   db_count_job_name_list_entry                  @
      (  i_jobname_id,                           @
         i_num_lists )
dump i_return_value
 
#  The number of load cases associated with the job are.
dump i_num_lists
#---------------------------------------------------------------------
#  Get  the list of loadcase IDs and Step IDs related to a individual
#  job for all the jobs.
i_count = i_num_lists
 
sys_allocate_array(iv_load_case_id,1,i_num_lists)
sys_allocate_array(iv_step_id,1,i_num_lists)
 
i_return_value =                                 @
   db_get_jobname_list_entries                   @
      (i_jobname_id,                             @
      i_count,                                   @
      iv_load_case_id,                           @
      iv_step_id)
dump i_return_value
 
#  The load case id and analysis step id associated with the job are.
dump iv_load_case_id,iv_step_id
 
#  Free the allocated memory
sys_free_array(iv_load_case_id)
sys_free_array(iv_step_id)
sys_free_array(sv_jobname)
sys_free_array(sv_description)
sys_free_array(iv_jobname_id)
sys_free_array(iv_param_set_id)
sys_free_array(iv_status)
#---------------------------------------------------------------------
db_count_job_names_for_a_code
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_count_job_names_for_a_code()
#
#                      Before running this session file run plate.ses
#                      to create plate.db. This database contains a
#                      model of a plate with two jobs created.
#
#                      This file opens the data base “plate.db” and
#                      gets the count of job names for the analysis
#                      code “MSC.Nastran”.                      
#
#                      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_job_names_for_a_code()
#  has the following arguments:
#
#  db_count_job_names_for_a_code
#     (  acode_id,
#        num_acodes )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_acode_id
INTEGER  i_num_acodes
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “plate.db”
uil_file_open.go(“plate.db”)
#
#  Get the analysis code id(i_acode_id) of “MSC.Nastran”
i_return_value =                                 @
   db_get_anal_code_id( “MSC.Nastran”, i_acode_id )
dump i_return_value
dump i_acode_id
#
#  Get the count of job names for the “MSC.Nastran” code id
i_return_value =                                 @
   db_count_job_names_for_a_code                 @
      (  i_acode_id,                             @
         i_num_acodes )
dump i_return_value
dump i_num_acodes
#
#  The number of available  job names can also be seen on “Analysis”
#  window form
#---------------------------------------------------------------------
db_count_param_set_entries
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_count_param_set_entries()
#
#                      Session file prints the number of entries in 
#                      the first parameter set listed in the 
#                      analysis_step relation.
#
#                      Before running this session file run plate.ses
#                      to create plate.db. This database contains a
#                      model of a plate with two jobs created.
#
#                      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_param_set_entries()
#  has the following arguments:
#
#  db_count_param_set_entries
#     (  param_id,
#        num_params )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_param_id
INTEGER  i_num_params
INTEGER  i_return_value
 
INTEGER  i_analysis_code_id
INTEGER  i_count
STRING   sa_stepname[80](16)
INTEGER  ia_step_id(16)
STRING   sa_description[256](16)
INTEGER  ia_param_id(16)
#---------------------------------------------------------------------
#  Open the database “plate.db”
uil_file_open.go(“plate.db”)
 
#  To get the analysis code id for “MSC.Nastran” code.
i_return_value =db_get_anal_code_id(“MSC.Nastran”, i_analysis_code_id)
dump i_return_value
#---------------------------------------------------------------------
#  Initialized to get maximum number of steps used in the database.
i_count= 16
#
i_return_value =                                 @
   db_get_analysis_steps                         @
      (  i_analysis_code_id,                     @
         i_count,                                @
         sa_stepname,                            @
         ia_step_id,                             @
         sa_description,                         @
         ia_param_id )
dump i_return_value
 
#  Available parameter set ids are.
dump ia_param_id
 
#---------------------------------------------------------------------
#  Using first parameter set.
i_param_id = ia_param_id(1)
dump i_param_id
 
i_return_value =                                 @
   db_count_param_set_entries                    @
      (  i_param_id,                             @
         i_num_params )
dump i_return_value
 
#  The number of parameter entries for the parameter set are.
dump i_num_params
#---------------------------------------------------------------------
db_count_steps_for_a_job
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_count_steps_for_a_job()
#
#                      For a given job name used with a analysis code 
#                      this function gives the steps used for the 
#                      analysis.
#
#                      Before running this session file run plate.ses
#                      to create plate.db. This database contains a
#                      model of a plate with two jobs created.
#
#                      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_steps_for_a_job()
#  has the following arguments:
#
#  db_count_steps_for_a_job
#     (  ac_id,
#        job_id,
#        num_steps )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_ac_id
INTEGER  i_job_id
INTEGER  i_num_steps
INTEGER  i_return_value
STRING  s_jobname[80]
#---------------------------------------------------------------------
#  Open the database “plate.db”
uil_file_open.go(“plate.db”)
 
#  To get the analysis code id for “MSC.Nastran” code.
i_return_value = db_get_anal_code_id(“MSC.Nastran”, i_ac_id)
dump i_return_value
 
#  To get the job name of the last job created.
i_return_value = db_get_last_jobname(s_jobname)
dump i_return_value
 
#  To get the job id of the last job created.
i_return_value =                                 @
   db_get_id_given_job_name_code(i_ac_id,s_jobname,i_job_id)
dump i_return_value
#---------------------------------------------------------------------
#
i_return_value =                                 @
   db_count_steps_for_a_job                      @
      (  i_ac_id,                                @
         i_job_id,                               @
         i_num_steps  )
dump i_return_value
 
#  The number of analysis steps for the last job and “MSC.Nastran” as 
#  analysis code are
dump i_num_steps
#---------------------------------------------------------------------
db_create_analysis_step
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_create_analysis_step()
#
#                      This session file shows how to add a analysis_
#                      step and also shows the available analysis_
#                      steps in the data base.
#
#                      Before running this session file run plate.ses
#                      to create plate.db. This database contains a
#                      model of a plate with two jobs created.
#
#                      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_create_analysis_step()
#  has the following arguments:
#
#  db_create_analysis_step
#     (  stepname,
#        stepdesc,
#        ac_id,
#        step_id,
#        param_set_id )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_stepname[80]
STRING   s_stepdesc[256]
INTEGER  i_ac_id
INTEGER  i_step_id=0
INTEGER  i_param_set_id
INTEGER  i_return_value
 
INTEGER  i_count,i_temp
STRING   sa_stepname[80](16)
INTEGER  ia_step_id(16)
STRING   sa_description[256](16)
INTEGER  ia_param_set_id(16)
#---------------------------------------------------------------------
#  Open the database “plate.db”
uil_file_open.go(“plate.db”)
 
#  To get the analysis code id for “MSC.Nastran” code.
i_return_value = db_get_anal_code_id(“MSC.Nastran”, i_ac_id)
dump i_return_value
#---------------------------------------------------------------------
# Calling the function to add an analysis step “pcl_example”
 
s_stepname= “pcl_example”
s_stepdesc= “Written as example for function db_create_analysis_step”
 
i_return_value =                                 @
   db_create_analysis_step                       @
      (  s_stepname,                             @
         s_stepdesc,                             @
         i_ac_id,                                @
         i_step_id,                              @
         i_param_set_id )
dump i_return_value
 
# The step id of the step created is 
dump i_step_id
# The parameter set id of the step created is 
dump i_param_set_id
 
#---------------------------------------------------------------------
#  Initialized to get maximum number of steps used in the database.
i_count= 16
#
i_return_value =                                 @
   db_get_analysis_steps                         @
      (  i_ac_id,                                @
         i_count,                                @
         sa_stepname,                            @
         ia_step_id,                             @
         sa_description,                         @
         ia_param_set_id )
dump i_return_value
 
#  The actual number of steps in the current data base are
dump i_count
#  The steps are
FOR (i_temp=1 TO i_count)
   dump sa_stepname(i_temp)
   dump ia_step_id(i_temp)
   dump sa_description(i_temp)
   dump ia_param_set_id(i_temp)
END FOR
 
#---------------------------------------------------------------------
db_create_job_name
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_create_job_name()
#
#                      Before running this session file run plate.ses
#                      to create plate.db. This database contains a
#                      model of a plate with two jobs created.
#
#                      This illustration opens the database 
#                      “plate.db” and creates a new job name for
#                      “MSC.Nastran”. Before and after the creation
#                      of the new job name, the count of job names ids
#                      in the database is shown.
#
#                      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_create_job_name() has the following arguments:
#
#  db_create_job_name
#     (  jobname,
#        id )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_jobname[32]
INTEGER  i_id, i_count
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “plate.db”
uil_file_open.go(“plate.db”)
#
#  Get the count of the existing job name ids 
i_return_value =                                 @
   db_count_all_job_name_ids ( i_count )
dump i_return_value
dump i_count
#
#  Create the new job name “new” for “MSC.Nastran”
s_jobname = “new”
i_return_value =                                 @
   db_create_job_name                            @
      (  s_jobname,                              @
         i_id )
dump i_return_value
dump i_id
#
#  Get the latest count of the job name ids
i_return_value =                                 @
   db_count_all_job_name_ids ( i_count )
dump i_return_value
dump i_count
#---------------------------------------------------------------------
 
db_create_job_name_for_a_code
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_create_job_name_for_a_code()
#
#                      Before running this session file run plate.ses
#                      to create plate.db. This database contains a
#                      model of a plate with two jobs created.
#
#                      This file opens a data base “plate.db” and
#                      creates a new job name. It also checks for its
#                      existence.
#
#                      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_create_job_name_for_a_code()
#  has the following arguments:
#
#  db_create_job_name_for_a_code
#     (  ac_id,
#        jobname,
#        jobdesc,
#        status,
#        jobname_id,
#        param_set_id )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_ac_id
STRING   s_jobname[32]
STRING   s_jobdesc[128]
INTEGER  i_status
INTEGER  i_jobname_id
INTEGER  i_param_set_id
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “plate.db”
uil_file_open.go(“plate.db”)
#
#  Get the Code id for “MSC.Nastran”
i_return_value =                                        @      
   db_get_anal_code_id( “MSC.Nastran”,i_ac_id )
dump i_return_value
dump i_ac_id
#
#  Set the job name and the description
s_jobname = “new_job”
s_jobdesc = “The new job is created for the illustration”
i_status = 0
i_return_value =                                        @
   db_create_job_name_for_a_code                        @
      (  i_ac_id,                                       @
         s_jobname,                                     @
         s_jobdesc,                                     @
         i_status,                                      @
         i_jobname_id,                                  @
         i_param_set_id )
dump i_return_value
dump i_jobname_id
dump i_param_set_id
#
#  Check the existence of the newly created jobname
i_return_value =                                        @
   db_get_job_name_given_id( i_jobname_id, s_jobname )
dump i_return_value
dump s_jobname
#---------------------------------------------------------------------
db_create_job_name_list
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_create_job_name_list()
#
#                      This session file shows how to associate
#                      load cases with an existing job.
#
#                      Before running this session file run plate.ses
#                      to create plate.db. This database contains a
#                      model of a plate with two jobs created.
#
#                      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_create_job_name_list()
#  has the following arguments:
#
#  db_create_job_name_list
#     (  jobname_id,
#        nbr_of_loadcases,
#        loadcase_ids )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_jobname_id
INTEGER  i_nbr_of_loadcases
INTEGER  iv_loadcase_ids(VIRTUAL)
INTEGER  i_return_value
 
STRING   s_jobname[32]
INTEGER  i_count
INTEGER  iv_step_id(VIRTUAL)
#---------------------------------------------------------------------
#  Open the database “plate.db”
uil_file_open.go(“plate.db”)
 
#  Create a new job with “Session_Example” as name and get the job id.
s_jobname = “Session_Example”
 
i_return_value = db_create_job_name(s_jobname,i_jobname_id)
dump i_return_value
 
#  Associating the three available load cases with the new job.
#  The IDs of the three load cases are 1,2 and 3.
 
i_nbr_of_loadcases = 3
sys_allocate_array(iv_loadcase_ids,1,i_nbr_of_loadcases)
iv_loadcase_ids(1)=1
iv_loadcase_ids(2)=2
iv_loadcase_ids(3)=3
#
i_return_value =                                 @
   db_create_job_name_list                       @
      (  i_jobname_id,                           @
         i_nbr_of_loadcases,                     @
         iv_loadcase_ids )
dump i_return_value
 
#---------------------------------------------------------------------
#  Get the entries in the jobname list created.
i_return_value = db_count_job_name_list_entry(i_jobname_id, i_count)
dump i_return_value,i_count
 
sys_allocate_array(iv_loadcase_ids,1,i_count)
sys_allocate_array(iv_step_id,1,i_count)
 
i_return_value =                                 @
   db_get_jobname_list_entries                   @
      ( i_jobname_id,i_count,                    @
        iv_loadcase_ids ,iv_step_id )
dump i_return_value
 
#  Displaying the entries in the jobname list created.
dump iv_loadcase_ids,iv_step_id
 
#  Deleting the job name
i_return_value = db_delete_job_name(i_jobname_id)
dump i_return_value
 
sys_free_array(iv_loadcase_ids)
sys_free_array(iv_step_id)
#---------------------------------------------------------------------
db_create_job_name_list_entry
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_create_job_name_list_entry()
#
#                      This file shows how to add a load case into
#                      a job.
#
#                      Before running this session file run plate.ses
#                      to create plate.db. This database contains a
#                      model of a plate with two jobs created.
#
#                      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_create_job_name_list_entry()
#  has the following arguments:
#
#  db_create_job_name_list_entry
#     (  jobname_id,
#        load_case_id,
#        analysis_step_id )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_jobname_id
INTEGER  i_load_case_id
INTEGER  i_analysis_step_id
INTEGER  i_return_value
 
INTEGER  i_analysis_code_id
INTEGER  i_count,i_temp
STRING   sa_stepname[80](8)
STRING   s_jobname[80]
INTEGER  ia_step_id(8)
INTEGER  iv_step_id(VIRTUAL)
INTEGER  iv_loadcase_ids(VIRTUAL)
STRING   sa_description[256](8)
INTEGER  ia_param_set_id(8)
#---------------------------------------------------------------------
#  Open the database “plate.db”
uil_file_open.go(“plate.db”)
 
#  To get the analysis code id for “MSC.Nastran” code.
i_return_value=db_get_anal_code_id(“MSC.Nastran”, i_analysis_code_id)
dump i_return_value
 
#  Create a new job with “Session_Example” as name and get the job id.
s_jobname = “Session_Example”
 
i_return_value = db_create_job_name(s_jobname,i_jobname_id)
dump i_return_value
 
#---------------------------------------------------------------------
#  Create 3 job name list entries  with analysis step id as 2 and 
#  using load case id as 1,2 and 3
 
i_analysis_step_id = 2
#
FOR(i_count=1 TO 3)
   i_load_case_id = i_count
   i_return_value =                                 @
      db_create_job_name_list_entry                 @
         (  i_jobname_id,                           @
            i_load_case_id,                         @
            i_analysis_step_id )
   dump i_return_value
END FOR
#---------------------------------------------------------------------
#  Get the entries in the jobname list created.
i_return_value =                                    @
   db_count_job_name_list_entry                     @
      ( i_jobname_id, i_count )
dump i_return_value
#  Number of loadcases associated with the job
dump  i_count
 
sys_allocate_array(iv_loadcase_ids,1,i_count)
sys_allocate_array(iv_step_id,1,i_count)
 
i_return_value =                                    @
   db_get_jobname_list_entries                      @
      ( i_jobname_id,i_count,                       @
        iv_loadcase_ids ,                           @
        iv_step_id )
dump i_return_value
 
#  Displaying the entries in the jobname list created.
dump iv_loadcase_ids,iv_step_id
 
#  Delete the newly created job
i_return_value = db_delete_job_name(i_jobname_id)
dump i_return_value
 
sys_free_array(iv_loadcase_ids)
sys_free_array(iv_step_id)
#---------------------------------------------------------------------
 
db_create_param_set_entry
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_create_param_set_entry()
#
#                      This session file demonstrates how to access 
#                      data required to add a entry into a parameter_
#                      set relation.
#
#                      Before running this session file run plate.ses
#                      to create plate.db. This database contains a
#                      model of a plate with two jobs created.
#
#                      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_create_param_set_entry()
#  has the following arguments:
#
#  db_create_param_set_entry
#     (  param_set_id,
#        param_name,
#        param_type,
#        param_real,
#        param_char,
#        param_int )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_param_set_id
STRING   s_param_name[128]
INTEGER  i_param_type
REAL     r_param_real
STRING   s_param_char[128]
INTEGER  i_param_int
INTEGER  i_return_value
 
INTEGER  i_count
STRING   sv_param_name[80](VIRTUAL)
INTEGER  iv_param_type(VIRTUAL)
REAL     rv_param_real(VIRTUAL)
STRING   sv_param_char[256](VIRTUAL)
INTEGER  iv_param_int(VIRTUAL)
 
INTEGER  i_analysis_code_id
INTEGER  i_temp
STRING   sa_stepname[80](16)
INTEGER  ia_step_id(16)
STRING   sa_description[256](16)
INTEGER  ia_param_set_id(16)
#---------------------------------------------------------------------
#  Open the database “plate.db”
uil_file_open.go(“plate.db”)
 
#  To get the analysis code id for “MSC.Nastran” code.
i_return_value =db_get_anal_code_id(“MSC.Nastran”, i_analysis_code_id)
dump i_return_value
#---------------------------------------------------------------------
#  Initialized to get maximum number of steps used in the database.
i_count= 16
#
i_return_value =                                 @
   db_get_analysis_steps                         @
      (  i_analysis_code_id,                     @
         i_count,                                @
         sa_stepname,                            @
         ia_step_id,                             @
         sa_description,                         @
         ia_param_set_id )
dump i_return_value
#---------------------------------------------------------------------
#  Using the parameter set id for the first step.
i_param_set_id=ia_param_set_id(1)
#  Initialized to get all parameters entries from the database.
i_return_value = db_count_param_set_entries(i_param_set_id,i_count)
dump i_return_value,i_count
 
sys_allocate_array(sv_param_name,1,i_count+1)
sys_allocate_array(iv_param_type,1,i_count+1)
sys_allocate_array(rv_param_real,1,i_count+1)
sys_allocate_array(sv_param_char,1,i_count+1)
sys_allocate_array(iv_param_int,1,i_count+1)
#
i_return_value =                                 @
   db_get_param_set_ent_pcl                      @
      (  i_param_set_id,                         @
         i_count,                                @
         sv_param_name,                          @
         iv_param_type,                          @
         rv_param_real,                          @
         sv_param_char,                          @
         iv_param_int )
dump i_return_value
 
#  Displaying all the parameter entries in the set.
FOR (i_temp=1 TO i_count)
   dump sv_param_name(i_temp)
   dump iv_param_type(i_temp)
   dump rv_param_real(i_temp)
   dump sv_param_char(i_temp)
   dump iv_param_int(i_temp)
END FOR
#---------------------------------------------------------------------
#  Adding a parameter to the set.
s_param_name=”Session_Example”
i_param_type=3
r_param_real=1.33465e-5
s_param_char=””
i_param_int=0
#
i_return_value =                                 @
   db_create_param_set_entry                     @
      (  i_param_set_id,                         @
         s_param_name,                           @
         i_param_type,                           @
         r_param_real,                           @
         s_param_char,                           @
         i_param_int )
dump i_return_value
 
#---------------------------------------------------------------------
#  Initialized to get all parameter entries from the database.
i_return_value = db_count_param_set_entries(i_param_set_id,i_count)
dump i_return_value,i_count
#
i_return_value =                                 @
   db_get_param_set_ent_pcl                      @
      (  i_param_set_id,                         @
         i_count,                                @
         sv_param_name,                          @
         iv_param_type,                          @
         rv_param_real,                          @
         sv_param_char,                          @
         iv_param_int )
dump i_return_value
 
#  Displaying all the parameter entries in the set.
FOR (i_temp=1 TO i_count)
   dump sv_param_name(i_temp)
   dump iv_param_type(i_temp)
   dump rv_param_real(i_temp)
   dump sv_param_char(i_temp)
   dump iv_param_int(i_temp)
END FOR
 
sys_free_array(sv_param_name)
sys_free_array(iv_param_type)
sys_free_array(rv_param_real)
sys_free_array(sv_param_char)
sys_free_array(iv_param_int)
#---------------------------------------------------------------------
#  End of File
db_create_pset_matrix_entry
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_create_pset_matrix_entry()
#
#                      This session file demonstrates how to add a 
#                      real matrix in a parameter set.
#
#                      Before running this session file run plate.ses
#                      to create plate.db. This database contains a
#                      model of a plate with two jobs created.
#
#                      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_create_pset_matrix_entry()
#  has the following arguments:
#
#  db_create_pset_matrix_entry
#     (  param_set_id,
#        param_name,
#        nrows,
#        ncols,
#        matrix )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_param_set_id
STRING   s_param_name[128]
INTEGER  i_nrows
INTEGER  i_ncols
REAL     rv_matrix(VIRTUAL)
INTEGER  i_return_value
 
INTEGER  i_count,i_temp
INTEGER  i_analysis_code_id
STRING   sa_stepname[80](16)
INTEGER  ia_step_id(16)
STRING   sa_description[256](16)
INTEGER  ia_param_set_id(16)
#---------------------------------------------------------------------
#  Open the database “plate.db”
uil_file_open.go(“plate.db”)
 
#  To get the analysis code id for “MSC.Nastran” code.
i_return_value =db_get_anal_code_id(“MSC.Nastran”, i_analysis_code_id)
dump i_return_value
#---------------------------------------------------------------------
#  Initialized to get maximum number of steps used in the database.
i_count = 16
#
i_return_value =                                 @
   db_get_analysis_steps                         @
      (  i_analysis_code_id,                     @
         i_count,                                @
         sa_stepname,                            @
         ia_step_id,                             @
         sa_description,                         @
         ia_param_set_id )
dump i_return_value
#---------------------------------------------------------------------
#  Using the parameter set id for the first step.
i_param_set_id=ia_param_set_id(1)
s_param_name=”pset_Session_example”
i_nrows=4
i_ncols=3
 
sys_allocate_array(rv_matrix,1,i_nrows*i_ncols)
FOR(i_temp=1 TO i_nrows*i_ncols)
   rv_matrix(i_temp)=i_temp/3.0
END FOR
#---------------------------------------------------------------------
#  Call the function to add a “parameter pset_Session_example”
i_return_value =                                 @
   db_create_pset_matrix_entry                   @
      (  i_param_set_id,                         @
         s_param_name,                           @
         i_nrows,                                @
         i_ncols,                                @
         rv_matrix )
dump i_return_value
 
sys_free_array(rv_matrix)
#---------------------------------------------------------------------
#  Call the function to get the size of the matrix.
 
i_return_value =                                 @
   db_get_pset_matrix_size                       @
      (  i_param_set_id,                         @
         s_param_name,                           @
         i_nrows,                                @
         i_ncols )
dump i_return_value
 
#  The size of the matrix is
dump i_nrows,i_ncols
#  Allocating memory to the array.
sys_allocate_array(rv_matrix,1,i_nrows*i_ncols)
#---------------------------------------------------------------------
#  Get the matrix.
 
i_return_value =                                 @
   db_get_pset_matrix_entry                      @
      (  i_param_set_id,                         @
         s_param_name,                           @
         rv_matrix )
dump i_return_value
 
#  The array is.
dump rv_matrix
 
sys_free_array(rv_matrix)
#---------------------------------------------------------------------
db_delete_analysis_step_id
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_delete_analysis_step_id()
#
#                      This session file creates an analysis_step and
#                      deletes the same analysis_step.
#
#                      Before running this session file run plate.ses
#                      to create plate.db. This database contains a
#                      model of a plate with two jobs created.
#
#                      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_delete_analysis_step_id()
#  has the following arguments:
#
#  db_delete_analysis_step_id
#     (  ac_id,
#        step_id )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_ac_id
INTEGER  i_step_id
INTEGER  i_return_value
 
STRING   s_stepname[80]
STRING   s_stepdesc[256]
INTEGER  i_param_set_id
 
INTEGER  i_count,i_temp
STRING   sa_stepname[80](16)
INTEGER  ia_step_id(16)
STRING   sa_description[256](16)
INTEGER  ia_param_set_id(16)
#---------------------------------------------------------------------
#  Open the database “plate.db”
uil_file_open.go(“plate.db”)
 
#  To get the analysis code id for “MSC.Nastran” code.
i_return_value = db_get_anal_code_id(“MSC.Nastran”, i_ac_id)
dump i_return_value
#---------------------------------------------------------------------
#  Creating a analysis_step for “MSC.Nastran” analysis code.
s_stepname= “ pcl_example”
s_stepdesc= “Written as example for function db_delete_analysis_step”
 
i_return_value =                                 @
   db_create_analysis_step                       @
      (  s_stepname,                            @
         s_stepdesc,                            @
         i_ac_id,                                @
         i_step_id,                              @
         i_param_set_id )
dump i_return_value
#  The step id of the step created is
dump i_step_id
#  The parameter set id of the step created is
dump i_param_set_id
#---------------------------------------------------------------------
#  Initialized to get maximum number of steps used in the database.
i_count= 16
#
i_return_value =                                 @
   db_get_analysis_steps                         @
      (  i_ac_id,                                @
         i_count,                                @
         sa_stepname,                            @
         ia_step_id,                             @
         sa_description,                         @
         ia_param_set_id )
dump i_return_value
 
#  The actual number of steps in the current data base are
dump i_count
#  The steps are
FOR (i_temp=1 TO i_count)
   dump sa_stepname(i_temp)
   dump ia_step_id(i_temp)
   dump sa_description(i_temp)
   dump ia_param_set_id(i_temp)
END FOR
#---------------------------------------------------------------------
#  Deleting the last step.
i_step_id=ia_step_id(i_count)
i_return_value =                                 @
   db_delete_analysis_step_id                    @
      (  i_ac_id,                                @
         i_step_id )
dump i_return_value
 
#---------------------------------------------------------------------
#  Initialized to get maximum number of steps used in the database.
i_count= 16
#
i_return_value =                                 @
   db_get_analysis_steps                         @
      (  i_ac_id,                                @
         i_count,                                @
         sa_stepname,                            @
         ia_step_id,                             @
         sa_description,                         @
         ia_param_set_id )
dump i_return_value
 
#  The actual number of steps in the current data base are
dump i_count
#  The steps are
FOR (i_temp=1 TO i_count)
   dump sa_stepname(i_temp)
   dump ia_step_id(i_temp)
   dump sa_description(i_temp)
   dump ia_param_set_id(i_temp)
END FOR
#---------------------------------------------------------------------
 
db_delete_job_name
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_delete_job_name()
#
#                      Before running this session file run plate.ses
#                      to create plate.db. This database contains a
#                      model of a plate with two jobs created.
#
#                      This file opens the data base “plate.db”, gets
#                      the array of job name ids and count of job name
#                      ids.Then deletes one job name and again gets 
#                      the count of job name ids. 
#
#                      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_delete_job_name() has the following arguments:
#
#  db_delete_job_name
#     (  id )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_id
INTEGER  i_return_value
INTEGER  i_analysis_code_id, i_max
INTEGER  ia_job_name_ids(2)
STRING   sa_jobnames[128](2)
STRING   sa_description[512](2)
INTEGER  ia_param_set_ids(2)
INTEGER  ia_status_array(2)
INTEGER  i_nbr_of_jobnames 
#---------------------------------------------------------------------
#  Open the database “plate.db”
uil_file_open.go(“plate.db”)
#
#  Get the code id for “MSC.Nastran”
i_return_value =                                @
   db_get_anal_code_id(“MSC.Nastran”,i_analysis_code_id)
dump i_return_value
dump i_analysis_code_id
#
#  Get the two Job names and then ids for this analysis code
i_max = 2
i_return_value =                                @
   db_get_jobnames_for_a_code                   @
      (  i_analysis_code_id,                    @
         i_max,                                 @
         sa_jobnames,                           @
         ia_job_name_ids,                       @
         sa_description,                        @
         ia_param_set_ids,                      @
         ia_status_array )
dump i_return_value
dump ia_job_name_ids
#
#  Get the count of all the job name ids
i_return_value =                                @
   db_count_all_job_name_ids                    @
      (  i_nbr_of_jobnames )
dump i_return_value
dump i_nbr_of_jobnames
#---------------------------------------------------------------------
#  Delete the first job name using it’s id
i_id = ia_job_name_ids(1)
i_return_value =                                @
   db_delete_job_name                           @
      (  i_id )
dump i_return_value
#
#  Get the count of all the job name ids
i_return_value =                                @
   db_count_all_job_name_ids                    @
      (  i_nbr_of_jobnames )
dump i_return_value
dump i_nbr_of_jobnames
#---------------------------------------------------------------------
db_delete_job_name_list
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_delete_job_name_list()
#
#                      To delete the association between the load 
#                      cases and the job.
#
#                      Before running this session file run plate.ses
#                      to create plate.db. This database contains a
#                      model of a plate with two jobs created.
#
#                      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_delete_job_name_list() has the following arguments:
#  db_delete_job_name_list
#     (  jobname_id )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_jobname_id
INTEGER  i_return_value
 
INTEGER  i_load_case_id
INTEGER  i_analysis_step_id
INTEGER  i_analysis_code_id
INTEGER  i_count,i_temp
STRING   sa_stepname[80](8)
STRING   s_jobname[80]
INTEGER  ia_step_id(8)
INTEGER  iv_step_id(VIRTUAL)
INTEGER  iv_loadcase_ids(VIRTUAL)
STRING   sa_description[256](8)
INTEGER  ia_param_set_id(8)
#---------------------------------------------------------------------
#  Open the database “plate.db”
uil_file_open.go(“plate.db”)
 
#  To get the analysis code id for “MSC.Nastran” code.
i_return_value=db_get_anal_code_id(“MSC.Nastran”, i_analysis_code_id)
dump i_return_value
 
#  Create a new job with “Session_Example” as name and get the job id.
s_jobname = “Session_Example”
 
i_return_value = db_create_job_name(s_jobname,i_jobname_id)
dump i_return_value
 
#---------------------------------------------------------------------
#  Create 3 job name list entries  with analysis step id as 2 and 
#  using load case id as 1,2 and 3
 
i_analysis_step_id = 2
#
FOR(i_count=1 TO 3)
   i_load_case_id = i_count
   i_return_value =                                 @
      db_create_job_name_list_entry                 @
         (  i_jobname_id,                           @
            i_load_case_id,                         @
            i_analysis_step_id )
   dump i_return_value
END FOR
#---------------------------------------------------------------------
#  Get the entries in the jobname list created.
i_return_value =                                    @
   db_count_job_name_list_entry                     @
      ( i_jobname_id, i_count )
dump i_return_value
#  Number of loadcases associated with the job
dump  i_count
sys_allocate_array(iv_loadcase_ids,1,i_count)
sys_allocate_array(iv_step_id,1,i_count)
 
i_return_value =                                    @
   db_get_jobname_list_entries                      @
      ( i_jobname_id,i_count,                       @
        iv_loadcase_ids ,                           @
        iv_step_id )
dump i_return_value
 
#  Displaying the entries in the jobname list created.
dump iv_loadcase_ids,iv_step_id
#---------------------------------------------------------------------
#  Deleting the list.
i_return_value =                                    @
   db_delete_job_name_list                          @
      (  i_jobname_id )
dump i_return_value
#---------------------------------------------------------------------
#  Get the entries in the jobname list created.
i_return_value =                                    @
   db_count_job_name_list_entry                     @
      ( i_jobname_id, i_count )
dump i_return_value
#  Number of loadcases associated with the job
dump  i_count
#---------------------------------------------------------------------
#  Delete the newly created job
i_return_value = db_delete_job_name(i_jobname_id)
dump i_return_value
 
sys_free_array(iv_loadcase_ids)
sys_free_array(iv_step_id)
#---------------------------------------------------------------------
 
db_delete_param_set_entries
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_delete_param_set_entries()
#
#                      This function shows how to delete all entries
#                      in the parameter set.
#
#                      Before running this session file run plate.ses
#                      to create plate.db. This database contains a
#                      model of a plate with two jobs created.
#
#                      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_delete_param_set_entries()
#  has the following arguments:
#
#  db_delete_param_set_entries
#     (  param_set_id )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_param_set_id
INTEGER  i_return_value
 
INTEGER  i_count
STRING   sv_param_name[80](VIRTUAL)
INTEGER  iv_param_type(VIRTUAL)
REAL     rv_param_real(VIRTUAL)
STRING   sv_param_char[256](VIRTUAL)
INTEGER  iv_param_int(VIRTUAL)
 
INTEGER  i_analysis_code_id
INTEGER  i_temp
STRING   sa_stepname[80](16)
INTEGER  ia_step_id(16)
STRING   sa_description[256](16)
INTEGER  ia_param_set_id(16)
 
#---------------------------------------------------------------------
#  Open the database “plate.db”
uil_file_open.go(“plate.db”)
 
#  To get the analysis code id for “MSC.Nastran” code.
i_return_value =db_get_anal_code_id(“MSC.Nastran”, i_analysis_code_id)
dump i_return_value
#---------------------------------------------------------------------
#  Initialized to get maximum number of steps used in the database.
i_count= 16
#
i_return_value =                                 @
   db_get_analysis_steps                         @
      (  i_analysis_code_id,                     @
         i_count,                                @
         sa_stepname,                            @
         ia_step_id,                             @
         sa_description,                         @
         ia_param_set_id )
dump i_return_value
 
#---------------------------------------------------------------------
#  Using the parameter set id for the first step.
i_param_set_id=ia_param_set_id(1)
#  Initialized to get all parameter entries from the database.
i_return_value = db_count_param_set_entries(i_param_set_id,i_count)
dump i_return_value,i_count
 
sys_allocate_array(sv_param_name,1,i_count)
sys_allocate_array(iv_param_type,1,i_count)
sys_allocate_array(rv_param_real,1,i_count)
sys_allocate_array(sv_param_char,1,i_count)
sys_allocate_array(iv_param_int,1,i_count)
#
i_return_value =                                 @
   db_get_param_set_ent_pcl                      @
      (  i_param_set_id,                         @
         i_count,                                @
         sv_param_name,                          @
         iv_param_type,                          @
         rv_param_real,                          @
         sv_param_char,                          @
         iv_param_int )
dump i_return_value,i_count
 
#  Displaying all the parameter entries in the set.
FOR (i_temp=1 TO i_count)
   dump sv_param_name(i_temp)
   dump iv_param_type(i_temp)
   dump rv_param_real(i_temp)
   dump sv_param_char(i_temp)
   dump iv_param_int(i_temp)
END FOR
#---------------------------------------------------------------------
#  Call the function to delete the parameter set.
i_return_value =                                 @
   db_delete_param_set_entries                   @
      (  i_param_set_id )
dump i_return_value
#---------------------------------------------------------------------
#  Get all the parameters associated with the parameter set id.
#
dump i_count
 
i_return_value =                                 @
   db_get_param_set_ent_pcl                      @
      (  i_param_set_id,                         @
         i_count,                                @
         sv_param_name,                          @
         iv_param_type,                          @
         rv_param_real,                          @
         sv_param_char,                          @
         iv_param_int )
#  The zero value for i_count indicates that all entries are deleted.
#  This function will return an error code of 13000072
#  (“Unmatched count”) which in this case indicates that the
#  parameter set is undefined.
dump i_return_value,i_count
 
sys_free_array(sv_param_name)
sys_free_array(iv_param_type)
sys_free_array(rv_param_real)
sys_free_array(sv_param_char)
sys_free_array(iv_param_int)
#---------------------------------------------------------------------
 
db_delete_param_set_entry
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_delete_param_set_entry()
#
#                      To delete a specific parameter set entry, when
#                      parameter name is known, this function can
#                      be used.
#
#                      Before running this session file run plate.ses
#                      to create plate.db. This database contains a
#                      model of a plate with two jobs created.
#
#                      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_delete_param_set_entry()
#  has the following arguments:
#
#  db_delete_param_set_entry
#     (  param_set_id,
#        name )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_param_set_id
STRING   s_name[80]
INTEGER  i_return_value
 
INTEGER  i_count
STRING   sv_param_name[80](VIRTUAL)
INTEGER  iv_param_type(VIRTUAL)
REAL     rv_param_real(VIRTUAL)
STRING   sv_param_char[256](VIRTUAL)
INTEGER  iv_param_int(VIRTUAL)
 
INTEGER  i_analysis_code_id
INTEGER  i_temp
STRING   sa_stepname[80](16)
INTEGER  ia_step_id(16)
STRING   sa_description[256](16)
INTEGER  ia_param_set_id(16)
 
STRING   s_param_name[80]
INTEGER  i_param_type
REAL     r_param_real
STRING   s_param_char[256]
INTEGER  i_param_int
INTEGER  i_return_value
#---------------------------------------------------------------------
#Open the database “plate.db”
uil_file_open.go(“plate.db”)
 
#  To get the analysis code id for “MSC.Nastran” code.
i_return_value =db_get_anal_code_id(“MSC.Nastran”, i_analysis_code_id)
dump i_return_value
#---------------------------------------------------------------------
#  Initialized to get maximum number of steps used in the database.
i_count= 16
#
i_return_value =                                 @
   db_get_analysis_steps                         @
      (  i_analysis_code_id,                     @
         i_count,                                @
         sa_stepname,                            @
         ia_step_id,                             @
         sa_description,                         @
         ia_param_set_id )
dump i_return_value
 
#---------------------------------------------------------------------
#  Using the parameter set id for the first step.
i_param_set_id=ia_param_set_id(1)
#---------------------------------------------------------------------
s_param_name=”Session_Example”
i_param_type=3
r_param_real=1.33465e-5
s_param_char=””
i_param_int=0
#
i_return_value =                                 @
   db_create_param_set_entry                     @
      (  i_param_set_id,                         @
         s_param_name,                           @
         i_param_type,                           @
         r_param_real,                           @
         s_param_char,                           @
         i_param_int )
dump i_return_value
 
#---------------------------------------------------------------------
#  Initialized to get all parameter entries from the database.
i_return_value = db_count_param_set_entries(i_param_set_id,i_count)
dump i_return_value,i_count
 
sys_allocate_array(sv_param_name,1,i_count)
sys_allocate_array(iv_param_type,1,i_count)
sys_allocate_array(rv_param_real,1,i_count)
sys_allocate_array(sv_param_char,1,i_count)
sys_allocate_array(iv_param_int,1,i_count)
#
i_return_value =                                 @
   db_get_param_set_ent_pcl                      @
      (  i_param_set_id,                         @
         i_count,                                @
         sv_param_name,                          @
         iv_param_type,                          @
         rv_param_real,                          @
         sv_param_char,                          @
         iv_param_int )
dump i_return_value,i_count
 
#  Displaying all the parameter entries in the set.
FOR (i_temp=1 TO i_count)
   WRITE(“ “)
   dump sv_param_name(i_temp)
   dump iv_param_type(i_temp)
   dump rv_param_real(i_temp)
   dump sv_param_char(i_temp)
   dump iv_param_int(i_temp)
END FOR
#---------------------------------------------------------------------
#  Call the function to delete the parameter “Session_Example”
s_name = s_param_name
 
dump s_name
 
#
i_return_value =                                 @
   db_delete_param_set_entry                     @
      (  i_param_set_id,                         @
         s_name )
dump i_return_value
#---------------------------------------------------------------------
i_return_value =                                 @
   db_get_param_set_ent_pcl                      @
      (  i_param_set_id,                         @
         i_count,                                @
         sv_param_name,                          @
         iv_param_type,                          @
         rv_param_real,                          @
         sv_param_char,                          @
         iv_param_int )
dump i_return_value,i_count
 
#  Displaying all the parameter entries in the set.
FOR (i_temp=1 TO i_count)
   WRITE(“ “)
   dump sv_param_name(i_temp)
   dump iv_param_type(i_temp)
   dump rv_param_real(i_temp)
   dump sv_param_char(i_temp)
   dump iv_param_int(i_temp)
END FOR
 
sys_free_array(sv_param_name)
sys_free_array(iv_param_type)
sys_free_array(rv_param_real)
sys_free_array(sv_param_char)
sys_free_array(iv_param_int)
#---------------------------------------------------------------------
db_get_all_anal_codes
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_all_anal_codes()
#
#                      This file opens a new database “new.db”
#                      and gets all the analysis code names from the
#                      database, in get all, get next method.
#
#                      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_all_anal_codes() has NO arguments.
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_name[32]
INTEGER  i_return_value
INTEGER  all_status
INTEGER  next_status = 0
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
#  Get all the analysis codes from the database
all_status =                                        @
   db_get_all_anal_codes()
dump all_status
#
#  Get the analysis code from the database
WHILE ( next_status == 0 )
   next_status =                                    @
      db_get_next_anal_code                         @
         (  s_name )
   dump next_status
   dump s_name
END WHILE
#---------------------------------------------------------------------
db_get_all_anal_types
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_all_anal_types()
#
#                      Demonstrate the use of ‘get_all’ and ‘get_next’
#                      method of retrieving data for analysis types.
#
#                      Before running this session file run plate.ses
#                      to create plate.db. This database contains a 
#                      model of a plate with two jobs created.
#
#                      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_all_anal_types()
#  has the following arguments:
#
#  db_get_all_anal_types
#     (  name )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_name[128]
INTEGER  i_count,i_temp
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “plate.db”
uil_file_open.go(“plate.db”)
 
s_name=”MSC.Nastran”
#
i_return_value =                                 @
   db_get_all_anal_types                         @
      (  s_name )
dump i_return_value
#---------------------------------------------------------------------
#  Count the number of analysis types.
i_return_value = db_count_anal_types(s_name,i_count)
dump i_return_value
#---------------------------------------------------------------------
#  Sequentially accessing the analysis types
 
FOR(i_temp=1 TO i_count)
   s_name=”MSC.Nastran”
   i_return_value =                               @
      db_get_next_anal_type                       @
         (  s_name )
   dump i_return_value
   dump s_name
END FOR
#---------------------------------------------------------------------
 
db_get_all_job_name_ids
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_all_job_name_ids()
#
#                      Before running this session file run plate.ses
#                      to create plate.db. This database contains a
#                      model of a plate with two jobs created.
#
#                      This illustration opens the data base
#                      “plate.db”, gets the count  of job name ids 
#                      and the array of job name ids.  
#
#                      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_all_job_name_ids() has the following arguments:
#  db_get_all_job_name_ids
#     (  max_count,
#        nbr_of_jobnames,
#        id )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_max_count, i_count
INTEGER  i_nbr_of_jobnames
INTEGER  iv_id(VIRTUAL)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “plate.db”
uil_file_open.go(“plate.db”)
#
#  Count all job name ids
i_return_value =                                 @
   db_count_all_job_name_ids ( i_count )
dump i_return_value
dump i_count
#
#  Set the maximum count as i_count
i_max_count = i_count
SYS_ALLOCATE_ARRAY( iv_id, 1, i_count )
 
#  Call the function to get the array of IDs
 
i_return_value =                                 @
   db_get_all_job_name_ids                       @
      (  i_max_count,                            @
         i_nbr_of_jobnames,                      @
         iv_id )
dump i_return_value
dump iv_id
 
sys_free_array ( iv_id )
#---------------------------------------------------------------------
 
db_get_all_job_names
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_all_job_names()
#
#                      Before running this session file run plate.ses
#                      to create plate.db. This database contains a
#                      model of a plate with two jobs created.
#
#                      This file opens a database “plate.db”
#                      and gets all the job names from the
#                      database, in get all, get next method.
#
#                      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_all_job_names() has NO arguments.
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_jobname[32]
INTEGER  all_status
INTEGER  next_status = 0
#---------------------------------------------------------------------
#  Open the database “plate.db”
uil_file_open.go(“plate.db”)
#
#  Get all the job names from the database
all_status = db_get_all_job_names ( )
dump all_status
#
#  Get the job names from the database
WHILE ( next_status == 0 )
   next_status =                                    @
      db_get_next_job_name                          @
         (  s_jobname )
   dump next_status
   dump s_jobname
END WHILE
#
#---------------------------------------------------------------------
db_get_anal_code_id
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_anal_code_id()
#
#                      The template database should support all the
#                      analysis preferences for running this file.
#                      
#                      This illustration opens a new database 
#                      “new.db” and gets the analysis code ids
#                      for “MSC.Nastran” and “ABAQUS” codes.
#
#                      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_anal_code_id() has the following arguments:
#  db_get_anal_code_id
#     (  name,
#        id )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_name[32]
INTEGER  i_id
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
#  Get the analysis code id for “MSC.Nastran”
s_name = “MSC.Nastran”
i_return_value =                                 @
   db_get_anal_code_id                           @
      (  s_name,                                 @
         i_id )
dump i_return_value
dump i_id
#
#  Get the analysis code id for “ABAQUS”
s_name = “ABAQUS”
i_return_value =                                 @
   db_get_anal_code_id                           @
      (  s_name,                                 @
         i_id )
dump i_return_value
dump i_id
#---------------------------------------------------------------------
db_get_anal_code_name
()
#  Purpose          :  This file provides an example of two calls to 
#                      the function db_get_anal_code_name()
#
#                      The template database should support all the
#                      analysis preferences for running this file.
#                      The reserved analysis code ids are available in
#                      MSC Patran User Manual, Volume 4, Chapter 7.
#
#                      This file opens a new database “new.db” and 
#                      gets  the analysis code names for two reserved 
#                      analysis code ids
#
#                      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_anal_code_name() has the following arguments:
#  db_get_anal_code_name
#     (  id,
#        name )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_id
STRING   s_name[32]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
#  Get the analysis code name for id = 1
i_id = 1
i_return_value =                                 @
   db_get_anal_code_name                         @
      (  i_id,                                   @
         s_name )
dump i_return_value
dump s_name
 
#  Get the analysis code name for id = 2
i_id = 2
i_return_value =                                 @
   db_get_anal_code_name                         @
      (  i_id,                                   @
         s_name )
dump i_return_value
dump s_name
#---------------------------------------------------------------------
db_get_anal_type_id
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_anal_type_id()
#
#                      This file opens a new data base “new.db” and
#                      creates a new analysis type “New_Type” with a 
#                      id number as “4” and gets the id of newly
#                      created analysis type. The reserved  analysis 
#                      type ids are given in the MSC Patran User
#                      Manual, Volume 4, Chapter 7.
#
#                      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_anal_type_id() has the following arguments:
#  db_get_anal_type_id
#     (  name,
#        id )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_name[32]
INTEGER  i_id
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
#  Create a new analysis type. The ids 1, 2 and 3
#  are reserved for the analysis types “Structural”,
#  “Thermal” and “Fluid Dynamics”
#
i_id = 4
s_name = “New_Type”
i_return_value =                                 @
   db_create_analysis_type ( i_id, s_name )
dump i_return_value
#
#  Get the analysis type id for “New_Type”
s_name = “New_Type”
i_return_value =                                 @
   db_get_anal_type_id                           @
      (  s_name,                                 @
         i_id )
dump i_return_value
dump i_id
#---------------------------------------------------------------------
db_get_anal_type_name
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_anal_type_name()
#                        
#                      This file opens a new data base “new.db” and
#                      creates a new analysis type “New_Type” with a 
#                      id number as “4” and gets the name of newly
#                      created analysis type. The reserved  analysis 
#                      type ids are given in the MSC Patran User
#                      Manual, Volume 4, Chapter 7.
#
#                      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_anal_type_name() has the following arguments:
#  db_get_anal_type_name
#     (  id,
#        name )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_id
STRING   s_name[32]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
#  Create a new analysis type “New_type” with id 4. The ids 1, 2 and 3
#  are reserved for the analysis types “Structural”,
#  “Thermal” and “Fluid Dynamics”
#
i_id = 4
s_name = “New_type”
i_return_value =                                 @
   db_create_analysis_type ( i_id, s_name )
dump i_return_value
#
#  Get the analysis type name for id = 4
i_id = 4
i_return_value =                                 @
   db_get_anal_type_name                         @
      (  i_id,                                   @
         s_name )
dump i_return_value
dump s_name
#---------------------------------------------------------------------
 
db_get_analysis_steps
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_analysis_steps()
#
#                      This function gets the information about all 
#                      currently active analysis steps in the database
#
#                      Before running this session file run plate.ses
#                      to create plate.db. This database contains a
#                      model of a plate with two jobs created.
#
#                      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_analysis_steps()
#  has the following arguments:
#
#  db_get_analysis_steps
#     (  analysis_code_id,
#        count,
#        stepname,
#        step_id,
#        description,
#        param-set_id )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_analysis_code_id
INTEGER  i_count,i_temp
STRING   sa_stepname[80](16)
INTEGER  ia_step_id(16)
STRING   sa_description[256](16)
INTEGER  ia_param_set_id(16)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “plate.db”
uil_file_open.go(“plate.db”)
 
#  To get the analysis code id for “MSC.Nastran” code.
i_return_value= db_get_anal_code_id(“MSC.Nastran”, i_analysis_code_id)
dump i_return_value
#---------------------------------------------------------------------
#  Initialized to get maximum number of steps used in the database.
i_count = 16
#
i_return_value =                                 @
   db_get_analysis_steps                         @
      (  i_analysis_code_id,                     @
         i_count,                                @
         sa_stepname,                            @
         ia_step_id,                             @
         sa_description,                         @
         ia_param_set_id )
dump i_return_value
 
#  The actual number of steps in the current data base are
dump i_count
#  The steps are
FOR (i_temp=1 TO i_count)
   dump sa_stepname(i_temp)
   dump ia_step_id(i_temp)
   dump sa_description(i_temp)
   dump ia_param_set_id(i_temp)
END FOR
 
#---------------------------------------------------------------------
db_get_at_for_ac
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_at_for_ac()
#
#                      This file opens a new data base “new.db” and
#                      gets the default analysis type for the 
#                      analysis code “MSC.Nastran” 
#
#                      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_at_for_ac() has the following arguments:
#  db_get_at_for_ac
#     (  acname,
#        atname )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_acname[32]
STRING   s_atname[32]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
#  Get the default analysis type for “MSC.Nastran” 
s_acname = “MSC.Nastran”
i_return_value =                                 @
   db_get_at_for_ac                              @
      (  s_acname,                               @
         s_atname )
dump i_return_value
dump s_atname
#---------------------------------------------------------------------
db_get_default_anal_code
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_default_anal_code()
#
#                      This function is used to get the default
#                      analysis code name. This illustration opens a
#                      new database “new.db”, and gets the default
#                      analysis code name.
#
#                      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_default_anal_code()
#  has the following arguments:
#
#  db_get_default_anal_code
#     (  name )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_name[32]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
#  Get the default analysis code name
i_return_value =                                 @
   db_get_default_anal_code                      @
      (  s_name )
dump i_return_value
dump s_name
#---------------------------------------------------------------------
db_get_default_anal_type
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_default_anal_type()
#
#                      This file opens a new data base “new.db” and
#                      gets the default analysis type name.
#
#                      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_default_anal_type()
#  has the following arguments:
#
#  db_get_default_anal_type
#     (  name )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_name[32]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
#   Get the default analysis type (s_name)
i_return_value =                                 @
   db_get_default_anal_type                      @
      (  s_name )
dump i_return_value
dump s_name
#---------------------------------------------------------------------
db_get_id_given_job_name
()
#  Purpose          :  This file provides an example of two calls to 
#                      the function db_get_id_given_job_name()
#
#                      Before running this session file run plate.ses
#                      to create plate.db. This database contains a
#                      model of a plate with two jobs created.
#
#                      This illustration opens the data base
#                      “plate.db”, gets the array of jobnames, and
#                      the ids for two job names.
#
#                      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_id_given_job_name ( )
#  has the following arguments:
#
#  db_get_id_given_job_name
#     (  jobname,
#        id )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_jobname[128]
INTEGER  i_id
INTEGER  i_return_value
INTEGER  i_analysis_code_id, i_max
INTEGER  ia_job_name_ids(2)
STRING   sa_jobnames[128](2)
STRING   sa_description[512](2)
INTEGER  ia_param_set_ids(2)
INTEGER  ia_status_array(2)
#---------------------------------------------------------------------
#  Open the database “plate.db”
uil_file_open.go(“plate.db”)
#
#  Get the code id for “MSC.Nastran”
i_return_value =                                @
   db_get_anal_code_id ( “MSC.Nastran”, i_analysis_code_id )
dump i_return_value
dump i_analysis_code_id
#
#  Get the two Job names and ids for this analysis code
i_max = 2
i_return_value =                                @
   db_get_jobnames_for_a_code                   @
      (  i_analysis_code_id,                    @
         i_max,                                 @
         sa_jobnames,                           @
         ia_job_name_ids,                       @
         sa_description,                        @
         ia_param_set_ids,                      @
         ia_status_array )
dump i_return_value
dump ia_job_name_ids
dump sa_jobnames
#
#  Get the id of the first job name
s_jobname = sa_jobnames(1)
i_return_value =                                 @
   db_get_id_given_job_name                      @
      (  s_jobname,                              @
         i_id )
dump i_return_value
dump i_id
 
#  Get the id of the second job name
s_jobname = sa_jobnames(2)
i_return_value =                                 @
   db_get_id_given_job_name                      @
      (  s_jobname,                              @
         i_id )
dump i_return_value
dump i_id
#---------------------------------------------------------------------
db_get_id_given_job_name_code
()
#  Purpose          :  This file provides an example of two calls to 
#                      the function db_get_id_given_job_name_code()
#
#                      This file opens the data base “plate.db”, 
#                      gets the array of job names for the code
#                      “MSC.Nastran”. For the two job names it
#                      gets the id.
#                       
#                      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 db_get_id_given_job_name_code()
#  has the following arguments:
#
#  db_get_id_given_job_name_code
#     (  acode,
#        jobname,
#        id )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_jobname[128]
INTEGER  i_id
INTEGER  i_return_value
INTEGER  i_acode, i_max
INTEGER  ia_job_name_ids(2)
STRING   sa_jobnames[128](2)
STRING   sa_description[512](2)
INTEGER  ia_param_set_ids(2)
INTEGER  ia_status_array(2)
#---------------------------------------------------------------------
#  Open the database “plate.db”
uil_file_open.go(“plate.db”)
#
#  Get the code id for “MSC.Nastran”
i_return_value =                                @
   db_get_anal_code_id( “MSC.Nastran”, i_acode )
dump i_return_value
dump i_acode
#
#  Get the two Job names and ids for this analysis code
i_max = 2
i_return_value =                                @
   db_get_jobnames_for_a_code                   @
      (  i_acode,                               @
         i_max,                                 @
         sa_jobnames,                           @
         ia_job_name_ids,                       @
         sa_description,                        @
         ia_param_set_ids,                      @
         ia_status_array )
dump i_return_value
dump ia_job_name_ids
dump sa_jobnames
#
#  Get the id of the first job name
s_jobname = sa_jobnames(1)
i_return_value =                                 @
   db_get_id_given_job_name_code                 @
      (  i_acode,                                @
         s_jobname,                              @
         i_id )
dump i_return_value
dump i_id
#
#  Get the id of the second job name
s_jobname = sa_jobnames(2)
i_return_value =                                 @
   db_get_id_given_job_name_code                 @
      (  i_acode,                                @
         s_jobname,                              @
         i_id )
dump i_return_value
dump i_id
#---------------------------------------------------------------------
db_get_id_given_load_case_name
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_id_given_load_case_name()
#
#                      This file opens a new data base “new.db”,
#                      creates a bar element, load/boundary condition
#                      set and a new load case by name 
#                      “New_Load_Case”. Then gets the load case id 
#                      for the newly created load case name.
#                      
#                      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_id_given_load_case_name()
#  has the following arguments:
#
#  db_get_id_given_load_case_name
#     (  load_case_name,
#        load_case_id )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_load_case_name[32]
INTEGER  i_load_case_id
INTEGER  i_return_value
STRING asm_create_grid_xyz_created_ids[VIRTUAL]
STRING sgm_transform_point_created_ids[VIRTUAL]
STRING fem_create_elemen_elems_created[VIRTUAL]
#---------------------------------------------------------------------
#  Open a new data base
uil_file_new.go( ““, “new.db” )
$? YES 36000002 
#
#  Create a point at location [0 0 0]
i_return_value =                                                  @
   asm_const_grid_xyz( “1”,                                       @
                       “[0 0 0]”,                                 @
                       “Coord 0”,                                 @
                       asm_create_grid_xyz_created_ids )
dump i_return_value
#
#  Create the second point by transforming
#  the first point through one unit along X direction.
i_return_value =                                                  @
   asm_transform_grid_translate( “2”,                             @
                                 “<1 0 0>”,                       @
                                 “Coord 0”,                       @
                                 1,                               @
                                 FALSE,                           @
                                 FALSE,                           @
                                 “[0 0 0]”,                       @
                                 sgm_transform_point_created_ids )
dump i_return_value
#
#  Create Bar element connecting two points
#
i_return_value =                                                  @
   fem_create_elems( “Bar “, “Bar2”, “1”, “Standard”,             @ 
                     TRUE, “Point 1 “, “Point 2 “, ““,            @
                     ““, ““, ““, ““, ““,                          @
                     fem_create_elemen_elems_created )
dump i_return_value
#
#  Create the load/boundary condition set “Fix” for fixing one 
#  end of the bar.
#
i_return_value =                                                  @
   loadsbcs_create( “Fix”, “Displacement”, “Nodal”,               @
                    ““, “Static”, [“Node 1”],                     @
                    “FEM”, “Coord 0”, 1., [“<0 0 0>”,             @
                    “<0 0 0>”], [““, ““] )
dump i_return_value
#
#  Create the load case “New_Load_Case” consisting of 
#  the load/boundary condition set “Fix”
#
i_return_value =                                                  @
   loadcase_create2( “New_Load_Case”, “Static”, ““,               @
                     1., [“Fix”], [0], [1.], ““,                  @
                     0., TRUE )
dump i_return_value
#
#  Get the id of the load case “New_Load_Case”
s_load_case_name = “New_Load_Case”
i_return_value =                                                  @
   db_get_id_given_load_case_name                                 @
      (  s_load_case_name,                                        @
         i_load_case_id )
dump i_return_value
dump i_load_case_id
#
sys_free_string ( asm_create_grid_xyz_created_ids )
sys_free_string ( sgm_transform_point_created_ids )
sys_free_string ( fem_create_elemen_elems_created )
#---------------------------------------------------------------------
db_get_id_given_step_name
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_id_given_step_name()
#
#                      This function returns analysis step id after
#                      accepting the analysis step name.
#
#                      Before running this session file run plate.ses
#                      to create plate.db. This database contains a
#                      model of a plate with two jobs created.
#
#                      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_id_given_step_name()
#  has the following arguments:
#
#  db_get_id_given_step_name
#     (  acode,
#        stepname,
#        id )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_acode
STRING   s_stepname[80]
INTEGER  i_id
INTEGER  i_return_value
INTEGER  i_count
STRING   sa_stepname[80](16)
INTEGER  ia_step_id(16)
STRING   sa_description[256](16)
INTEGER  ia_param_set_id(16)
#---------------------------------------------------------------------
#  Open the database “plate.db”
uil_file_open.go(“plate.db”)
 
#  To get the analysis code id for “MSC.Nastran” code.
i_return_value = db_get_anal_code_id(“MSC.Nastran”, i_acode)
dump i_return_value
 
#  Initialized to get maximum number of steps used in the database.
i_count = 16
 
i_return_value =                                 @
   db_get_analysis_steps                         @
      (  i_acode,                                @
         i_count,                                @
         sa_stepname,                            @
         ia_step_id,                             @
         sa_description,                         @
         ia_param_set_id )
dump i_return_value
#---------------------------------------------------------------------
#  Selecting the last step name
s_stepname = sa_stepname(i_count)
 
i_return_value =                                 @
   db_get_id_given_step_name                     @
      (  i_acode,                                @
         s_stepname,                             @
         i_id )
dump i_return_value
#  The step name is
dump s_stepname
#  The corresponding step id is
dump i_id
#---------------------------------------------------------------------
 
db_get_job_info
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_job_info()
#
#                      Before running this session file run plate.ses
#                      to create plate.db. This database contains a
#                      model of a plate with two jobs created.
#
#                      This illustration opens the data base 
#                      “plate.db”,gets the two jobname IDs and
#                      gets the information of these job names.
#
#                      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_job_info() has the following arguments:
#  db_get_job_info
#     (  analysis_code_id,
#        jobname_id,
#        jobname,
#        description,
#        param_set_id,
#        status )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_analysis_code_id, i_count, i_max
INTEGER  i_jobname_id
INTEGER  ia_job_name_ids(2)
STRING   s_jobname[128], sa_jobnames[128](2)
STRING   s_description[512], sa_description[512](2)
INTEGER  i_param_set_id, ia_param_set_ids(2)
INTEGER  i_status, ia_status_array(2)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “plate.db”
uil_file_open.go(“plate.db”)
#
#  Get the values of input parameters
#  Get the code id for “MSC.Nastran”
i_return_value =                                @
   db_get_anal_code_id                          @
      ( “MSC.Nastran”, i_analysis_code_id )
dump i_return_value
dump i_analysis_code_id
#
#  Get the two Job names and then ids for this analysis code
i_max = 2
 
i_return_value =                                @
   db_get_jobnames_for_a_code                   @
      (  i_analysis_code_id,                    @
         i_max,                                 @
         sa_jobnames,                           @
         ia_job_name_ids,                       @
         sa_description,                        @
         ia_param_set_ids,                      @
         ia_status_array )
dump i_return_value
dump ia_job_name_ids
dump ia_param_set_ids
dump ia_status_array
dump sa_description
#---------------------------------------------------------------------
#   Get the information of the jobs.
FOR ( i_count = 1 to 2 )
   i_jobname_id = ia_job_name_ids ( i_count )
   i_return_value =                              @
      db_get_job_info                            @
         (  i_analysis_code_id,                  @
            i_jobname_id,                        @
            s_jobname,                           @
            s_description,                       @
            i_param_set_id,                      @
            i_status )
   dump i_return_value
   dump s_jobname
   dump s_description
   dump i_param_set_id
   dump i_status
END FOR
#---------------------------------------------------------------------
db_get_job_name_given_id
()
#  Purpose          :  This file provides an example of two calls to 
#                      the function db_get_job_name_given_id()
#
#                      Before running this session file run plate.ses
#                      to create plate.db. This database contains a
#                      model of a plate with two jobs created.
#
#                      This illustration opens the database
#                      “plate.db”, gets the array of job name ids.
#                      For the first two ids gets the job names.
#
#                      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_job_name_given_id()
#  has the following arguments:
#
#  db_get_job_name_given_id
#     (  jobname,
#        id )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_name[32]
INTEGER  i_id
INTEGER  i_return_value
INTEGER  i_analysis_code_id, i_max
INTEGER  ia_job_name_ids(2)
STRING   sa_jobnames[128](2)
STRING   sa_description[512](2)
INTEGER  ia_param_set_ids(2)
INTEGER  ia_status_array(2)
#---------------------------------------------------------------------
#  Open the database “plate.db”
uil_file_open.go(“plate.db”)
#
#  Get the code id for “MSC.Nastran”
i_return_value =                                @
   db_get_anal_code_id ( “MSC.Nastran”, i_analysis_code_id )
dump i_return_value
dump i_analysis_code_id
#
#  Get the two Job names and ids for this analysis code
i_max = 2
i_return_value =                                @
   db_get_jobnames_for_a_code                   @
      (  i_analysis_code_id,                    @
         i_max,                                 @
         sa_jobnames,                           @
         ia_job_name_ids,                       @
         sa_description,                        @
         ia_param_set_ids,                      @
         ia_status_array )
dump i_return_value
dump ia_job_name_ids
dump sa_jobnames
#
#  Get the name of the first job id
i_id = ia_job_name_ids(1)
i_return_value =                                 @
   db_get_job_name_given_id                      @
      (  i_id,                                   @
         s_name )
dump i_return_value
dump s_name
#
#  Get the name of the second job id
i_id = ia_job_name_ids(2)
i_return_value =                                 @
   db_get_job_name_given_id                      @
      (  i_id,                                   @
         s_name )
dump i_return_value
dump s_name
#---------------------------------------------------------------------
db_get_jobname_list_entries
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_jobname_list_entries()
#
#                      This illustration opens the database plate.db
#                      and calls the functions to get all the job name
#                      IDs in the database. Then it calls the function
#                      to count the number of load cases associated 
#                      with the last job. Finally it displays the load
#                      cases counted already.
#
#                      Before running this session file run plate.ses
#                      to create plate.db. This database contains a
#                      model of a plate with two jobs created.
#
#                      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_jobname_list_entries()
#  has the following arguments:
#
#  db_get_jobname_list_entries
#     (  jobname_id,
#        count,
#        load_case_id,
#        step_id )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_jobname_id
INTEGER  i_count
INTEGER  iv_step_id(VIRTUAL)
INTEGER  iv_load_case_id(VIRTUAL)
INTEGER  i_return_value
 
INTEGER  i_num_lists
 
INTEGER  i_analysis_code_id
STRING   sv_jobname[80](VIRTUAL)
STRING   sv_description[256](VIRTUAL)
INTEGER  iv_jobname_id(VIRTUAL)
INTEGER  iv_param_set_id(VIRTUAL)
INTEGER  iv_status(VIRTUAL)
#---------------------------------------------------------------------
#  Open the database “plate.db”
uil_file_open.go(“plate.db”)
 
#  To get the analysis code id for “MSC.Nastran” code.
i_return_value = db_get_anal_code_id(“MSC.Nastran”,i_analysis_code_id)
dump i_return_value
 
#  Find out number of jobs in the model for memory allocation.
i_return_value =                                                     @
   db_count_job_names_for_a_code(i_analysis_code_id,i_count)
dump i_return_value
 
sys_allocate_array(sv_jobname,1,i_count)
sys_allocate_array(sv_description,1,i_count)
sys_allocate_array(iv_jobname_id,1,i_count)
sys_allocate_array(iv_param_set_id,1,i_count)
sys_allocate_array(iv_status,1,i_count)
 
i_return_value=                                                      @
   db_get_jobnames_for_a_code(i_analysis_code_id,i_count,sv_jobname, @
      iv_jobname_id ,sv_description,iv_param_set_id,iv_status)
dump i_return_value
#---------------------------------------------------------------------
#  Call the function to count the number of load cases associated with
#  the last job.
i_jobname_id = iv_jobname_id(i_count)
#
i_return_value =                                 @
   db_count_job_name_list_entry                  @
      (  i_jobname_id,                           @
         i_num_lists )
dump i_return_value
#  The number of load cases associated with the job are.
dump i_num_lists
#---------------------------------------------------------------------
#  Call the function to get the load case IDs of the last job.
i_count = i_num_lists
sys_allocate_array(iv_load_case_id,1,i_num_lists)
sys_allocate_array(iv_step_id,1,i_num_lists)
 
i_return_value =                                 @
   db_get_jobname_list_entries                   @
      (i_jobname_id,                             @
      i_count,                                   @
      iv_load_case_id,                           @
      iv_step_id)
dump i_return_value
#  The load case id and analysis step id associated with the job are.
dump iv_load_case_id,iv_step_id
 
# Free the memory
sys_free_array(iv_load_case_id)
sys_free_array(iv_step_id)
sys_free_array(sv_jobname)
sys_free_array(sv_description)
sys_free_array(iv_jobname_id)
sys_free_array(iv_param_set_id)
sys_free_array(iv_status)
#---------------------------------------------------------------------
db_get_jobnames_for_a_code
()
#  Purpose          :  This file provides an example of two calls to 
#                      the function db_get_jobnames_for_a_code()
#
#                      Before running this session file run plate.ses
#                      to create plate.db. This database contains a
#                      model of a plate with two jobs created.
#
#                      This file opens a database “plate.db” and gets
#                      the count of job names for “MSC.Nastran” code. 
#                      Then gets the details of all the job names.
#                      
#                      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_jobnames_for_a_code()
#  has the following arguments:
#
#  db_get_jobnames_for_a_code
#     (  analysis_code_id,
#        count,
#        jobname,
#        jobname_id,
#        description,
#        param_set_id,
#        status )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_analysis_code_id
INTEGER  i_count
STRING   sav_jobname[80](VIRTUAL)
INTEGER  iv_jobname_id(VIRTUAL)
STRING   sav_description[256](VIRTUAL)
INTEGER  iv_param_set_id(VIRTUAL)
INTEGER  iv_status(VIRTUAL)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “plate.db”
uil_file_open.go(“plate.db”)
#
#  Input parameters
#  Get the code id for “MSC.Nastran”
i_return_value =                                @
   db_get_anal_code_id( “MSC.Nastran”, i_analysis_code_id )
dump i_return_value
dump i_analysis_code_id
#
#  Get the count of job names(i_count) for this analysis code
i_return_value =                                @  
   db_count_job_names_for_a_code ( i_analysis_code_id, i_count )
dump i_return_value
dump i_count
#
SYS_ALLOCATE_ARRAY( iv_status, 1, i_count )
SYS_ALLOCATE_ARRAY( iv_param_set_id, 1, i_count )
SYS_ALLOCATE_ARRAY( iv_jobname_id, 1, i_count )
SYS_ALLOCATE_ARRAY( sav_description, 1, i_count )
SYS_ALLOCATE_ARRAY( sav_jobname, 1, i_count )
#
#  Get the array of job names 
i_return_value =                                 @
   db_get_jobnames_for_a_code                    @
      (  i_analysis_code_id,                     @
         i_count,                                @
         sav_jobname,                            @
         iv_jobname_id,                          @
         sav_description,                        @
         iv_param_set_id,                        @
         iv_status )
dump i_return_value
 
#  The output values
dump sav_jobname
dump iv_jobname_id
dump sav_description
dump iv_param_set_id
dump iv_status
#
#  Free the memory
sys_free_array ( sav_jobname )
sys_free_array ( iv_jobname_id )
sys_free_array ( sav_description )
sys_free_array ( iv_param_set_id )
sys_free_array ( iv_status )
#---------------------------------------------------------------------
db_get_last_jobname
()
#  Purpose          :  This file provides an example of two calls to 
#                      the function db_get_last_jobname()
#
#                      Before running this session file run plate.ses
#                      to create plate.db. This database contains a
#                      model of a plate with two jobs created.
#
#                      This illustration opens the database 
#                      “plate.db” and gets the array of job names
#                      for “MSC.Nastran”. Assigns first two job names
#                      as last job names in sequence. Each time gets 
#                      the last job name for verification.
#                      
#                      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_last_jobname() has the following arguments:
#  db_get_last_jobname
#     (  jobname )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_jobname[32]
INTEGER  i_return_value
INTEGER  i_analysis_code_id, i_max
INTEGER  ia_job_name_ids(2)
STRING   sa_jobnames[128](2)
STRING   sa_description[512](2)
INTEGER  ia_param_set_ids(2)
INTEGER  ia_status_array(2)
#---------------------------------------------------------------------
#  Open the database “plate.db”
uil_file_open.go(“plate.db”)
#
#  Get the code id for “MSC.Nastran”
i_return_value =                                @
   db_get_anal_code_id( “MSC.Nastran”, i_analysis_code_id )
dump i_return_value
dump i_analysis_code_id
#
#  Get the two Job names for this analysis code
i_max = 2
i_return_value =                                @
   db_get_jobnames_for_a_code                   @
      (  i_analysis_code_id,                    @
         i_max,                                 @
         sa_jobnames,                           @
         ia_job_name_ids,                       @
         sa_description,                        @
         ia_param_set_ids,                      @
         ia_status_array )
dump i_return_value
#  The Job names array 
dump sa_jobnames
#
#  Set the sa_jobnames(1) as the last job name
s_jobname = sa_jobnames(1)
i_return_value =                                 @
   db_assign_last_jobname                        @
      (  s_jobname )
dump i_return_value
#
#  Get the last job name
i_return_value =                                 @
   db_get_last_jobname(s_jobname)
dump i_return_value
dump s_jobname
#
#  Now set the sa_jobnames(2) as the last job name
s_jobname = sa_jobnames(2)
i_return_value =                                 @
   db_assign_last_jobname                        @
      (  s_jobname )
dump i_return_value
#
#  Now get the newly set last job name
i_return_value =                                 @
   db_get_last_jobname ( s_jobname )
dump i_return_value
dump s_jobname
#---------------------------------------------------------------------
db_get_next_anal_code
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_next_anal_code()
#
#                      This file opens a new database “new.db”
#                      and gets all the analysis code names from the
#                      database, in get all, get next method.
#
#                      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_next_anal_code() has the following arguments:
#  db_get_next_anal_code
#     (  name )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_name[32]
INTEGER  i_return_value
INTEGER  all_status
INTEGER  next_status = 0
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
#  Get all the analysis codes from the database
all_status = db_get_all_anal_codes()
dump all_status
#
#  Get the analysis code from the database
WHILE ( next_status == 0 )
   next_status =                                    @
      db_get_next_anal_code                         @
         (  s_name )
   dump next_status
   dump s_name
END WHILE
#---------------------------------------------------------------------
db_get_next_anal_type
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_next_anal_type()
#
#                      Demonstrate the use of ‘get_all’ and ‘get_next’
#                      method of retrieving data for analysis types.
#
#                      Before running this session file run plate.ses
#                      to create plate.db. This database contains a
#                      model of a plate with two jobs created.
#
#                      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_next_anal_type()
#  has the following arguments:
#
#  db_get_next_anal_type
#     (  name )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_name[128]
INTEGER  i_count,i_temp
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “plate.db”
uil_file_open.go(“plate.db”)
 
s_name=”MSC.Nastran”
#
i_return_value =                                 @
   db_get_all_anal_types                         @
      (  s_name )
dump i_return_value
#---------------------------------------------------------------------
#  Count the number of analysis types.
i_return_value = db_count_anal_types(s_name,i_count)
dump i_return_value
#---------------------------------------------------------------------
#  Sequentially accessing the analysis types
 
FOR(i_temp=1 TO i_count)
   s_name=”MSC.Nastran”
   i_return_value =                               @
      db_get_next_anal_type                       @
         (  s_name )
   dump i_return_value
   dump s_name
END FOR
#---------------------------------------------------------------------
db_get_next_job_name
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_next_job_name()
#
#                      Before running this session file run plate.ses
#                      to create plate.db. This database contains a
#                      model of a plate with two jobs created.
#
#                      This file opens a database “plate.db”
#                      and gets all the job names from the
#                      database, in get all, get next method.
#
#                      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_next_job_name() has the following arguments:
#  db_get_next_job_name
#     (  jobname )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_jobname[32]
INTEGER  all_status
INTEGER  next_status = 0
#---------------------------------------------------------------------
#  Open the database “plate.db”
uil_file_open.go(“plate.db”)
#
#  Get all the all the job names from the database
all_status = db_get_all_job_names ( )
dump all_status
#
#  Get the job names from the database
WHILE ( next_status == 0 )
   next_status =                                    @
      db_get_next_job_name                          @
         (  s_jobname )
   dump next_status
   dump s_jobname
END WHILE
#
#---------------------------------------------------------------------
db_get_param_set_ent_pcl
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_param_set_ent_pcl()
#
#                      Before running this session file run plate.ses
#                      to create plate.db. This database contains a
#                      model of a plate with two jobs created.
#
#                      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_param_set_ent_pcl()
#  has the following arguments:
#
#  db_get_param_set_ent_pcl
#     (  param_set_id,
#        count,
#        param_name,
#        param_type,
#        param_real,
#        param_char,
#        param_int )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_param_set_id
INTEGER  i_count
STRING   sv_param_name[80](VIRTUAL)
INTEGER  iv_param_type(VIRTUAL)
REAL     rv_param_real(VIRTUAL)
STRING   sv_param_char[256](VIRTUAL)
INTEGER  iv__param_int(VIRTUAL)
INTEGER  i_return_value
 
INTEGER  i_analysis_code_id
INTEGER  i_temp
STRING   sa_stepname[80](16)
INTEGER  ia_step_id(16)
STRING   sa_description[256](16)
INTEGER  ia_param_set_id(16)
#---------------------------------------------------------------------
#  Open the database “plate.db”
uil_file_open.go(“plate.db”)
 
#  To get the analysis code id for “MSC.Nastran” code.
i_return_value =db_get_anal_code_id(“MSC.Nastran”, i_analysis_code_id)
dump i_return_value
#---------------------------------------------------------------------
#  Initialized to get maximum number of steps used in the database.
i_count= 16
#
i_return_value =                                 @
   db_get_analysis_steps                         @
      (  i_analysis_code_id,                     @
         i_count,                                @
         sa_stepname,                            @
         ia_step_id,                             @
         sa_description,                         @
         ia_param_set_id )
dump i_return_value
 
#---------------------------------------------------------------------
#  Using the parameter set id for the first step.
i_param_set_id = ia_param_set_id(1)
#  Initialized to get all parameter entries from the database.
i_return_value = db_count_param_set_entries(i_param_set_id,i_count)
dump i_return_value,i_count
 
sys_allocate_array(sv_param_name,1,i_count)
sys_allocate_array(iv_param_type,1,i_count)
sys_allocate_array(rv_param_real,1,i_count)
sys_allocate_array(sv_param_char,1,i_count)
sys_allocate_array(iv__param_int,1,i_count)
#
i_return_value =                                 @
   db_get_param_set_ent_pcl                      @
      (  i_param_set_id,                         @
         i_count,                                @
         sv_param_name,                          @
         iv_param_type,                          @
         rv_param_real,                          @
         sv_param_char,                          @
         iv__param_int )
dump i_return_value,i_count
 
#  Displaying all the parameter entries in the set.
FOR (i_temp=1 TO i_count)
   dump sv_param_name(i_temp)
   dump iv_param_type(i_temp)
   dump rv_param_real(i_temp)
   dump sv_param_char(i_temp)
   dump iv__param_int(i_temp)
END FOR
 
sys_free_array(sv_param_name)
sys_free_array(iv_param_type)
sys_free_array(rv_param_real)
sys_free_array(sv_param_char)
sys_free_array(iv__param_int)
#---------------------------------------------------------------------
db_get_param_set_entries
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_param_set_entries()
#
#                      This session file explains how to get the 
#                      entries listed in a parameter set and shows
#                      how to get the related parameter set ID.
#
#                      Before running this session file run plate.ses
#                      to create plate.db. This database contains a 
#                      model of a plate with two jobs created.
#
#                      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_param_set_entries()
#  has the following arguments:
#
#  db_get_param_set_entries
#     (  param_set_id,
#        count,
#        param_name,
#        param_type,
#        param_real,
#        param_char,
#        param_int )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_param_set_id
INTEGER  i_count
STRING   sv_param_name[80](VIRTUAL)
INTEGER  iv_param_type(VIRTUAL)
REAL     rv_param_real(VIRTUAL)
STRING   sv_param_char[256](VIRTUAL)
INTEGER  iv_param_int(VIRTUAL)
INTEGER  i_return_value
 
INTEGER  i_analysis_code_id
INTEGER  i_temp
STRING   sa_stepname[80](16)
INTEGER  ia_step_id(16)
STRING   sa_description[256](16)
INTEGER  ia_param_set_id(16)
#---------------------------------------------------------------------
#  Open the database “plate.db”
uil_file_open.go(“plate.db”)
 
#  To get the analysis code id for “MSC.Nastran” code.
i_return_value=db_get_anal_code_id(“MSC.Nastran”, i_analysis_code_id)
dump i_return_value
#---------------------------------------------------------------------
#  Initialized to get maximum number of steps used in the database.
i_count = 16
#
i_return_value =                                 @
   db_get_analysis_steps                         @
      (  i_analysis_code_id,                     @
         i_count,                                @
         sa_stepname,                            @
         ia_step_id,                             @
         sa_description,                         @
         ia_param_set_id )
dump i_return_value
dump ia_param_set_id
#---------------------------------------------------------------------
#  Using the parameter set id for the first step.
i_param_set_id = ia_param_set_id(1)
#  Initialized to get all parameter entries from the database.
i_return_value = db_count_param_set_entries(i_param_set_id,i_count)
dump i_return_value,i_count
 
sys_allocate_array(sv_param_name,1,i_count)
sys_allocate_array(iv_param_type,1,i_count)
sys_allocate_array(rv_param_real,1,i_count)
sys_allocate_array(sv_param_char,1,i_count)
sys_allocate_array(iv_param_int,1,i_count)
 
i_return_value =                                 @
   db_get_param_set_entries                      @
      (  i_param_set_id,                         @
         i_count,                                @
         sv_param_name,                          @
         iv_param_type,                          @
         rv_param_real,                          @
         sv_param_char,                          @
         iv_param_int )
dump i_return_value,i_count
 
#  Display all the parameter entries in the set.
FOR (i_temp=1 TO i_count)
   dump sv_param_name(i_temp)
   dump iv_param_type(i_temp)
   dump rv_param_real(i_temp)
   dump sv_param_char(i_temp)
   dump iv_param_int(i_temp)
END FOR
 
sys_free_array(sv_param_name)
sys_free_array(iv_param_type)
sys_free_array(rv_param_real)
sys_free_array(sv_param_char)
sys_free_array(iv_param_int)
#---------------------------------------------------------------------
db_get_param_set_entry
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_param_set_entry()
#
#                      This session file displays the first parameter
#                      of the first parameter set id listed in the 
#                      analysis_step relation.
#
#                      Before running this session file run plate.ses
#                      to create plate.db. This database contains a
#                      model of a plate with two jobs created.
#
#                      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_param_set_entry()
#  has the following arguments:
#
#  db_get_param_set_entry
#     (  param_set_id,
#        param_name,
#        param_type,
#        param_real,
#        param_char,
#        param_int )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_param_set_id
STRING   s_param_name[80]
INTEGER  i_param_type
REAL     r_param_real
STRING   s_param_char[256]
INTEGER  i_param_int
INTEGER  i_return_value
 
INTEGER  i_count
STRING   sv_param_name[80](VIRTUAL)
INTEGER  iv_param_type(VIRTUAL)
REAL     rv_param_real(VIRTUAL)
STRING   sv_param_char[256](VIRTUAL)
INTEGER  iv_param_int(VIRTUAL)
 
INTEGER  i_analysis_code_id
INTEGER  i_temp
STRING   sa_stepname[80](16)
INTEGER  ia_step_id(16)
STRING   sa_description[256](16)
INTEGER  ia_param_set_id(16)
#---------------------------------------------------------------------
#  Open the database “plate.db”
uil_file_open.go(“plate.db”)
 
#  To get the analysis code id for “MSC.Nastran” code.
i_return_value =db_get_anal_code_id(“MSC.Nastran”, i_analysis_code_id)
dump i_return_value
#---------------------------------------------------------------------
#  Initialized to get maximum number of steps used in the database.
i_count= 16
#
i_return_value =                                 @
   db_get_analysis_steps                         @
      (  i_analysis_code_id,                     @
         i_count,                                @
         sa_stepname,                            @
         ia_step_id,                             @
         sa_description,                         @
         ia_param_set_id )
dump i_return_value
 
#---------------------------------------------------------------------
#  Using the parameter set id for the first step.
i_param_set_id=ia_param_set_id(1)
#  Initialized to get all parameter entries from the database.
i_return_value = db_count_param_set_entries(i_param_set_id,i_count)
dump i_return_value,i_count
 
sys_allocate_array(sv_param_name,1,i_count)
sys_allocate_array(iv_param_type,1,i_count)
sys_allocate_array(rv_param_real,1,i_count)
sys_allocate_array(sv_param_char,1,i_count)
sys_allocate_array(iv_param_int,1,i_count)
#
i_return_value =                                 @
   db_get_param_set_ent_pcl                      @
      (  i_param_set_id,                         @
         i_count,                                @
         sv_param_name,                          @
         iv_param_type,                          @
         rv_param_real,                          @
         sv_param_char,                          @
         iv_param_int )
dump i_return_value
 
#  Available parameter entries are.
dump sv_param_name
 
#---------------------------------------------------------------------
#  Displaying details for the first parameter name.
s_param_name=sv_param_name(1)
#
i_return_value =                                 @
   db_get_param_set_entry                        @
      (  i_param_set_id,                         @
         s_param_name,                           @
         i_param_type,                           @
         r_param_real,                           @
         s_param_char,                           @
         i_param_int )
dump i_return_value
 
#  Details for the first parameter name are.
dump i_param_set_id
dump s_param_name
dump i_param_type
dump r_param_real
dump s_param_char
dump i_param_int
 
sys_free_array(sv_param_name)
sys_free_array(iv_param_type)
sys_free_array(rv_param_real)
sys_free_array(sv_param_char)
sys_free_array(iv_param_int)
#---------------------------------------------------------------------
db_get_pset_matrix_entry
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_pset_matrix_entry()
#
#                      This session file shows how to add and retrieve
#                      the matrix listed in a parameter set as a entry
#
#                      Before running this session file run plate.ses
#                      to create plate.db. This database contains a
#                      model of a plate with two jobs created.
#
#                      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_pset_matrix_entry()
#  has the following arguments:
#
#  db_get_pset_matrix_entry
#     (  param_set_id,
#        param_name,
#        matrix )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_param_set_id
STRING   s_param_name[128]
INTEGER  i_nrows
INTEGER  i_ncols
REAL     rv_matrix(VIRTUAL)
INTEGER  i_return_value
 
INTEGER  i_count,i_temp
INTEGER  i_analysis_code_id
STRING   sa_stepname[80](16)
INTEGER  ia_step_id(16)
STRING   sa_description[256](16)
INTEGER  ia_param_set_id(16)
#---------------------------------------------------------------------
#  Open the database “plate.db”
uil_file_open.go(“plate.db”)
 
#  To get the analysis code id for “MSC.Nastran” code.
i_return_value =db_get_anal_code_id(“MSC.Nastran”, i_analysis_code_id)
dump i_return_value
#---------------------------------------------------------------------
#  Initialized to get maximum number of steps used in the database.
i_count = 16
#
i_return_value =                                 @
   db_get_analysis_steps                         @
      (  i_analysis_code_id,                     @
         i_count,                                @
         sa_stepname,                            @
         ia_step_id,                             @
         sa_description,                         @
         ia_param_set_id )
dump i_return_value
#---------------------------------------------------------------------
#  Using the parameter set id for the first step.
i_param_set_id=ia_param_set_id(1)
s_param_name=”pset_Session_example”
i_nrows=4
i_ncols=3
 
sys_allocate_array(rv_matrix,1,i_nrows*i_ncols)
FOR(i_temp=1 TO i_nrows*i_ncols)
   rv_matrix(i_temp)=i_temp/3.0
END FOR
#---------------------------------------------------------------------
#  Call the function to add a “parameter pset_Session_example”
i_return_value =                                 @
   db_create_pset_matrix_entry                   @
      (  i_param_set_id,                         @
         s_param_name,                           @
         i_nrows,                                @
         i_ncols,                                @
         rv_matrix )
dump i_return_value
 
sys_free_array(rv_matrix)
#---------------------------------------------------------------------
#  Call the function to get the size of the matrix.
 
i_return_value =                                 @
   db_get_pset_matrix_size                       @
      (  i_param_set_id,                         @
         s_param_name,                           @
         i_nrows,                                @
         i_ncols )
dump i_return_value
 
#  The size of the matrix is
dump i_nrows,i_ncols
#  Allocating memory to the array.
sys_allocate_array(rv_matrix,1,i_nrows*i_ncols)
#---------------------------------------------------------------------
#  Get the matrix.
 
i_return_value =                                 @
   db_get_pset_matrix_entry                      @
      (  i_param_set_id,                         @
         s_param_name,                           @
         rv_matrix )
dump i_return_value
 
#  The array is.
dump rv_matrix
 
sys_free_array(rv_matrix)
#---------------------------------------------------------------------
 
db_get_pset_matrix_size
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_pset_matrix_size()
#
#                      This session file shows how to add a matrix as
#                      a parameter set entry and to find the size of
#                      the real array listed in a parameter set.
#
#                      Before running this session file run plate.ses
#                      to create plate.db. This database contains a
#                      model of a plate with two jobs created.
#
#                      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_pset_matrix_size() has the following arguments:
#
#  db_get_pset_matrix_size
#     (  param_set_id,
#        param_name,
#        nrows,
#        ncols )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_param_set_id
STRING   s_param_name[128]
INTEGER  i_nrows
INTEGER  i_ncols
REAL     rv_matrix(VIRTUAL)
INTEGER  i_return_value
 
INTEGER  i_count,i_temp
INTEGER  i_analysis_code_id
STRING   sa_stepname[80](16)
INTEGER  ia_step_id(16)
STRING   sa_description[256](16)
INTEGER  ia_param_set_id(16)
#---------------------------------------------------------------------
#  Open the database “plate.db”
uil_file_open.go(“plate.db”)
 
#  To get the analysis code id for “MSC.Nastran” code.
i_return_value =db_get_anal_code_id(“MSC.Nastran”, i_analysis_code_id)
dump i_return_value
#---------------------------------------------------------------------
#  Initialized to get maximum number of steps used in the database.
i_count = 16
#
i_return_value =                                 @
   db_get_analysis_steps                         @
      (  i_analysis_code_id,                     @
         i_count,                                @
         sa_stepname,                            @
         ia_step_id,                             @
         sa_description,                         @
         ia_param_set_id )
dump i_return_value
#---------------------------------------------------------------------
#  Using the parameter set id for the first step.
i_param_set_id=ia_param_set_id(1)
s_param_name=”pset_Session_example”
i_nrows=4
i_ncols=3
 
sys_allocate_array(rv_matrix,1,i_nrows*i_ncols)
FOR(i_temp=1 TO i_nrows*i_ncols)
   rv_matrix(i_temp)=i_temp/3.0
END FOR
#---------------------------------------------------------------------
#  Call the function to add a “parameter pset_Session_example”
i_return_value =                                 @
   db_create_pset_matrix_entry                   @
      (  i_param_set_id,                         @
         s_param_name,                           @
         i_nrows,                                @
         i_ncols,                                @
         rv_matrix )
dump i_return_value
 
sys_free_array(rv_matrix)
#---------------------------------------------------------------------
#  Call the function to get the size of the matrix.
 
i_return_value =                                 @
   db_get_pset_matrix_size                       @
      (  i_param_set_id,                         @
         s_param_name,                           @
         i_nrows,                                @
         i_ncols )
dump i_return_value
 
#  The size of the matrix is
dump i_nrows,i_ncols
#  Allocating memory to the array.
sys_allocate_array(rv_matrix,1,i_nrows*i_ncols)
#---------------------------------------------------------------------
#  Get the matrix.
 
i_return_value =                                 @
   db_get_pset_matrix_entry                      @
      (  i_param_set_id,                         @
         s_param_name,                           @
         rv_matrix )
dump i_return_value
 
#  The array is.
dump rv_matrix
 
sys_free_array(rv_matrix)
#---------------------------------------------------------------------
db_get_step_info
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_step_info()
#
#                      This function gives information of a particular
#                      analysis_step.
#
#                      Before running this session file run plate.ses
#                      to create plate.db. This database contains a
#                      model of a plate with two jobs created.
#
#                      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_step_info() has the following arguments:
#
#  db_get_step_info
#     (  analysis_code_id,
#        step_id,
#        stepname,
#        description,
#        param_set_id )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_analysis_code_id
INTEGER  i_step_id
STRING   s_stepname[80]
STRING   s_description[256]
INTEGER  i_param_set_id
INTEGER  i_return_value
 
INTEGER  i_count
STRING   sa_stepname[80](16)
INTEGER  ia_step_id(16)
STRING   sa_description[256](16)
INTEGER  ia_param_set_id(16)
#---------------------------------------------------------------------
#  Open the database “plate.db”
uil_file_open.go(“plate.db”)
 
#  To get the analysis code id for “MSC.Nastran” code.
i_return_value= db_get_anal_code_id(“MSC.Nastran”, i_analysis_code_id)
dump i_return_value
#---------------------------------------------------------------------
#  Initialized to get maximum number of steps used in the database.
i_count= 16
#
i_return_value =                                 @
   db_get_analysis_steps                         @
      (  i_analysis_code_id,                     @
         i_count,                                @
         sa_stepname,                            @
         ia_step_id,                             @
         sa_description,                         @
         ia_param_set_id )
dump i_return_value
#---------------------------------------------------------------------
#  Call the function to get the information of last step.
i_step_id = ia_step_id(i_count)
#
i_return_value =                                 @
   db_get_step_info                              @
      (  i_analysis_code_id,                     @
         i_step_id,                              @
         s_stepname,                             @
         s_description,                          @
         i_param_set_id )
dump i_return_value
 
#  The step id, name, description and parameter set id in sequence are
dump i_step_id
dump s_stepname
dump s_description
dump i_param_set_id
#---------------------------------------------------------------------
 
db_get_steps_for_a_job
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_steps_for_a_job()
#
#                      This function returns the step information for
#                      the given analysis code id and jobname.
#
#                      Before running this session file run plate.ses
#                      to create plate.db. This database contains a
#                      model of a plate with two jobs created.
#
#                      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_steps_for_a_job()
#  has the following arguments:
#
#  db_get_steps_for_a_job
#     (  analysis_code_id,
#        jobname_id,
#        count,
#        stepname,
#        step_id,
#        description,
#        param_set_id )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_analysis_code_id
INTEGER  i_jobname_id
INTEGER  i_count,i_temp
STRING   sa_stepname[80](8)
STRING   s_jobname[80]
INTEGER  ia_step_id(8)
STRING   sa_description[256](8)
INTEGER  ia_param_set_id(8)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “plate.db”
uil_file_open.go(“plate.db”)
 
#  To get the analysis code id for “MSC.Nastran” code.
i_return_value=db_get_anal_code_id(“MSC.Nastran”, i_analysis_code_id)
dump i_return_value
 
#  To get the job name of the last job created.
i_return_value = db_get_last_jobname(s_jobname)
dump i_return_value
 
#  To get the job id of the last job created.
i_return_value = db_get_id_given_job_name_code                @
      (i_analysis_code_id,s_jobname,i_jobname_id)
dump i_return_value
 
#  To get number of steps associated with this job.
i_return_value = db_count_steps_for_a_job(i_analysis_code_id, @
      i_jobname_id,i_count)
dump i_return_value
#---------------------------------------------------------------------
#
i_return_value =                                 @
   db_get_steps_for_a_job                        @
      (  i_analysis_code_id,                     @
         i_jobname_id,                           @
         i_count,                                @
         sa_stepname,                            @
         ia_step_id,                             @
         sa_description,                         @
         ia_param_set_id )
 
dump i_return_value
 
#  The analysis steps are listed in sequence as- name, id, description
#  and parameter set id.
FOR (i_temp=1 TO i_count)
   dump sa_stepname(i_temp)
   dump ia_step_id(i_temp)
   dump sa_description(i_temp)
   dump ia_param_set_id(i_temp)
END FOR
#---------------------------------------------------------------------
db_set_at_for_ac
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_set_at_for_ac()
#
#                      This file opens a new data base “new.db” and
#                      and changes the default analysis type for
#                      the analysis code “MSC.Nastran”.
#                 
#                      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_set_at_ac() has the following arguments:
#  db_set_at_for_ac
#     (  anal_code,
#        anal_type )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_anal_code[32]
STRING   s_anal_type[32]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
#  Get the default analysis type for “MSC.Nastran”
s_anal_code = “MSC.Nastran”
i_return_value =                                 @
   db_get_at_for_ac(s_anal_code,s_anal_type)
dump i_return_value
dump s_anal_type
#
#  Change the default analysis type.
IF ( s_anal_type == “Structural” ) THEN
   s_anal_type = “Thermal”
ELSE
   s_anal_type = “Structural”
END IF
#
i_return_value =                                 @
   db_set_at_for_ac                              @
      (  s_anal_code,                            @
         s_anal_type )
dump i_return_value
 
#  Check the new default analysis type
i_return_value =                                 @
   db_get_at_for_ac(s_anal_code,s_anal_type)
dump i_return_value
dump s_anal_type
#---------------------------------------------------------------------
db_set_default_anal_code
()
#  Purpose          :  This file provides an example of two calls to 
#                      the function db_set_default_anal_code()
#
#                      The template database should support all
#                      analysis preferences for running this file.
#
#                      This file opens the new database “new.db” and
#                      sets the default analysis code as MSC.Nastran
#                      Using a function gets the default analysis 
#                      code. Again it changes the default analysis 
#                      code to “ABAQUS”. 
#
#                      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_set_default_anal_code() has the following
#  arguments: 
#  db_set_default_anal_code
#     (  name )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_name[32]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
#  Set the default analysis code name as “MSC.Nastran”  
i_return_value =                                 @
   db_set_default_anal_code                      @
      (  “MSC.Nastran” )
dump i_return_value
#
#  Get the default analysis code name
i_return_value =                                 @
   db_get_default_anal_code ( s_name )
dump i_return_value
dump s_name
#
#  Set the new default analysis code name as “ABAQUS”  
i_return_value =                                 @
   db_set_default_anal_code                      @
      (  “ABAQUS” )
dump i_return_value
#
#  Get the new default analysis code name
i_return_value =                                 @
   db_get_default_anal_code ( s_name )
dump i_return_value
dump s_name
#
#  The user can also verify the analysis preferences 
#  for the name of the default analysis code  
#---------------------------------------------------------------------
db_set_default_anal_type
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_set_default_anal_type()
#
#                      This file opens a new data base “new.db” and
#                      changes the default analysis type.
#
#                      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_set_default_anal_type() has the following 
#  arguments:
#  db_set_default_anal_type
#     (  name )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_name[32]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
#  Get the default analysis type
i_return_value =                                @
   db_get_default_anal_type(s_name)
dump i_return_value
dump s_name
 
#  Change the default analysis type 
IF ( s_name == “Structural” )  THEN
   s_name = “Thermal”
ELSE
   s_name = “Structural”
END IF
#
i_return_value =                                 @
   db_set_default_anal_type                      @
      (  s_name )
dump i_return_value
#
#  Get the default analysis type
i_return_value =                                 @
   db_get_default_anal_type  ( s_name )
dump i_return_value
dump s_name
#---------------------------------------------------------------------
 
db_set_model_file_suffix
()
#  Purpose          :  This file provides an example of two calls to 
#                      the function db_set_model_file_suffix()
#             
#                      This function sets the input file suffix for 
#                      the   given analysis code. This illustration
#                      opens the new database “new.db” and sets the
#                      suffix of the input file  as “.in” for the
#                      “MSC.Nastran” analysis code.
#
#                      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_set_model_file_suffix() has the following 
#  arguments:
#  db_set_model_file_suffix
#     (  name,
#        suffix )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_name[32]
STRING   s_suffix[6]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002 
 
#  The analysis code is “MSC.Nastran”
s_name = “MSC.Nastran”
#
#  Get the existing suffix of the model(input) file
i_return_value =                                         @
   db_get_model_file_suffix ( s_name, s_suffix )
dump i_return_value
dump s_suffix
 
#  Set the new suffix for the input file as “.in”
s_suffix = “.in”
#
i_return_value =                                         @
   db_set_model_file_suffix                              @
      (  s_name,                                         @
         s_suffix )
dump i_return_value
 
#  Get the new suffix of the model(input) file
i_return_value =                                         @
   db_get_model_file_suffix ( s_name, s_suffix )
dump i_return_value
dump s_suffix
 
#   The user can verify the suffix of the input file in
#   the preferences window also. 
#---------------------------------------------------------------------
 
db_set_pref
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_set_pref()
#
#                      This session file shows how to add a preference
#                      and reset the same.
#
#                      Before running this session file run plate.ses
#                      to create plate.db. This database contains a
#                      model of a plate with two jobs created.
#
#                      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_set_pref() has the following arguments:
#  db_set_pref
#     (  pref_id,
#        data_type,
#        int_pref,
#        log_pref,
#        real_pref,
#        char_pref )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_pref_id
INTEGER  i_data_type
INTEGER  i_int_pref
LOGICAL  l_log_pref
REAL     r_real_pref
STRING   s_char_pref[16]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “plate.db”
uil_file_open.go(“plate.db”)
 
#  Adding a preference_id which is not listed in ‘pref_names.i’ file
#  in P3_HOME/Customization directory.
i_pref_id = 105
 
#  Add the value of the Integer preference to 1234
#  i_data_type = 1  (Integer preference)
i_data_type = 1 
i_int_pref = 1234
i_return_value =                                  @
   db_add_pref                                    @
      (  i_pref_id,                               @
         i_data_type,                             @
         i_int_pref,                              @
         l_log_pref,                              @
         r_real_pref,                             @
         s_char_pref )
dump i_return_value
 
#  Get the value/data type of the added preference( ID is 105).
 
i_return_value =                                  @
   db_get_pref                                    @
      (  i_pref_id,                               @
         i_data_type,                             @
         i_int_pref,                              @
         l_log_pref,                              @
         r_real_pref,                             @
         s_char_pref )
dump i_return_value
 
#  The value of preferences for pref_id of 105.
dump s_char_pref 
dump i_int_pref
dump l_log_pref
dump r_real_pref
 
#---------------------------------------------------------------------
#  Set the value and data type of the preference ID 105 to a 
#  real value.
#  i_data_type = 3  (Real preference)
 
i_data_type = 3
r_real_pref=1.9845e2
#
i_return_value =                                 @
   db_set_pref                                   @
      (  i_pref_id,                              @
         i_data_type,                            @
         i_int_pref,                             @
         l_log_pref,                             @
         r_real_pref,                            @
         s_char_pref )
dump i_return_value
 
#---------------------------------------------------------------------
#  Get the value/data type of the preference ID 105.
 
i_return_value =                                  @
   db_get_pref                                    @
      (  i_pref_id,                               @
         i_data_type,                             @
         i_int_pref,                              @
         l_log_pref,                              @
         r_real_pref,                             @
         s_char_pref )
dump i_return_value
 
#  The value of preferences for pref_id of 105.
dump s_char_pref 
dump i_int_pref
dump l_log_pref
dump r_real_pref
 
#---------------------------------------------------------------------
db_set_results_file_suffix
()
#  Purpose          :  This file provides an example of a call to 
#                      the function db_set_results_file_suffix()
#
#                      This function is used to set the results file
#                      suffix for a particular analysis type. This
#                      session file opens the new data base “new.db”
#                      and sets the suffix of the results file for
#                      “MSC.Nastran” analysis code as “.res”.  The
#                      results file extension is dependent on the
#                      particular analysis code.    
#
#                      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_set_results_file_suffix()
#  has the following arguments:
#  db_set_results_file_suffix
#     (  name,
#        suffix )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_name[32]
STRING   s_suffix[6]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  The analysis code is “MSC.Nastran”
s_name = “MSC.Nastran”
 
#  Get the existing suffix for the results file
i_return_value =                                          @
   db_get_results_file_suffix( s_name, s_suffix )
dump i_return_value
dump s_suffix
 
#  Set the new suffix for the results file as “.res”
s_suffix = “.res”
#
i_return_value =                                          @
   db_set_results_file_suffix                             @
      (  s_name,                                          @
         s_suffix )
dump i_return_value
 
#  Get the new suffix for the results file
i_return_value =                                          @
   db_get_results_file_suffix( s_name, s_suffix )
dump i_return_value
dump s_suffix
 
#   Check for the suffix “.res” in analysis preferences 
#---------------------------------------------------------------------
db_update_analysis_step
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_update_analysis_step()
#
#                      This session file creates a analysis_step and 
#                      shows how to update the same.
#
#                      Before running this session file run plate.ses
#                      to create plate.db. This database contains a
#                      model of a plate with two jobs created.
#
#                      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_update_analysis_step() has the following arguments:
#
#  db_update_analysis_step
#     (  analysis_code_id,
#        analysis_step_id,
#        stepname,
#        stepdesc,
#        param_set_id )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_analysis_code_id
INTEGER  i_analysis_step_id
INTEGER  i_param_set_id
INTEGER  i_return_value
 
STRING   s_stepname[80]
STRING   s_stepdesc[256]
 
INTEGER  i_count,i_temp
STRING   sa_stepname[80](16)
INTEGER  ia_analysis_step_id(16)
STRING   sa_stepdesc[256](16)
INTEGER  ia_param_set_id(16)
#---------------------------------------------------------------------
#  Open the database “plate.db”
uil_file_open.go(“plate.db”)
 
#  To get the analysis code id for “MSC.Nastran” code.
i_return_value =db_get_anal_code_id(“MSC.Nastran”, i_analysis_code_id)
dump i_return_value
#---------------------------------------------------------------------
#  Creating analysis_step for “MSC.Nastran” analysis code.
s_stepname= “ pcl_example”
s_stepdesc= “Written as example for function db_create_analysis_step”
i_return_value =                                 @
   db_create_analysis_step                       @
      (  s_stepname,                             @
         s_stepdesc,                             @
         i_analysis_code_id,                     @
         i_analysis_step_id,                     @
         i_param_set_id )
dump i_return_value
#  The step id of the step created is
dump i_analysis_step_id
#  The parameter set id of the step created is
dump i_param_set_id
#---------------------------------------------------------------------
#  Initialized to get maximum number of steps used in the database.
i_count= 16
#
i_return_value =                                 @
   db_get_analysis_steps                         @
      (  i_analysis_code_id,                     @
         i_count,                                @
         sa_stepname,                            @
         ia_analysis_step_id,                    @
         sa_stepdesc,                            @
         ia_param_set_id )
dump i_return_value
 
#  The actual number of steps in the current data base are
dump i_count
#  The steps are
FOR (i_temp=1 TO i_count)
   dump sa_stepname(i_temp)
   dump ia_analysis_step_id(i_temp)
   dump sa_stepdesc(i_temp)
   dump ia_param_set_id(i_temp)
END FOR
#---------------------------------------------------------------------
#  Updating the previously created analysis_step.
s_stepname=”rev_pcl_example”
s_stepdesc=”Updated as example for function db_update_analysis_step”
i_return_value =                                 @
   db_update_analysis_step                       @
      (  i_analysis_code_id,                     @
         i_analysis_step_id,                     @
         s_stepname,                             @
         s_stepdesc,                             @
         i_param_set_id )
dump i_return_value
dump i_param_set_id
#---------------------------------------------------------------------
#  Initialized to get maximum number of steps used in the database.
i_count= 16
 
i_return_value =                                 @
   db_get_analysis_steps                         @
      (  i_analysis_code_id,                     @
         i_count,                                @
         sa_stepname,                            @
         ia_analysis_step_id,                    @
         sa_stepdesc,                            @
         ia_param_set_id )
dump i_return_value
 
#  The actual number of steps in the current data base are
dump i_count
#  The steps are 
FOR (i_temp=1 TO i_count)
   dump sa_stepname(i_temp)
   dump ia_analysis_step_id(i_temp)
   dump sa_stepdesc(i_temp)
   dump ia_param_set_id(i_temp)
END FOR
#---------------------------------------------------------------------
db_update_jobname_for_a_code
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_update_jobname_for_a_code()
#
#                      Before running this session file run plate.ses
#                      to create plate.db. This database contains a
#                      model of a plate with two jobs created.
#
#                      This illustration opens the database “plate.db”
#                      and creates the new job for “MSC.Nastran”, and
#                      gets it’s details. Again it changes the 
#                      job name, description and status and gets the
#                      updated details.
#
#                      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_update_jobname_for_a_code()
#  has the following arguments:
#
#  db_update_jobname_for_a_code
#     (  analysis_code_id,
#        jobname,
#        description,
#        status,
#        jobname_id,
#        param_set_id )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_analysis_code_id
STRING   s_jobname[32]
STRING   s_description[128]
INTEGER  i_status
INTEGER  i_jobname_id
INTEGER  i_param_set_id
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “plate.db”
uil_file_open.go(“plate.db”)
#
#  Get the analysis code id for “MSC.Nastran”
i_return_value =                                 @
   db_get_anal_code_id( “MSC.Nastran”, i_analysis_code_id )
dump i_return_value
dump i_analysis_code_id
#
#  Create the new job name for “MSC.Nastran”
#  The job name is “new_job”
   s_jobname = “new_job”
#  The description for the the new job
   s_description = “The new job for NASTRAN analysis code”
#  The status of the new job
   i_status = 0
i_return_value =                                 @
   db_create_job_name_for_a_code                 @ 
      (  i_analysis_code_id,                     @
         s_jobname,                              @
         s_description,                          @
         i_status,                               @
         i_jobname_id,                           @
         i_param_set_id )                         
dump i_return_value
dump i_jobname_id
#
#  Get the job info of the newly created job name
i_return_value =                                 @
   db_get_job_info                               @
      (  i_analysis_code_id,                     @
         i_jobname_id,                           @
         s_jobname,                              @
         s_description,                          @
         i_param_set_id,                         @
         i_status )
dump i_return_value
dump s_jobname
dump s_description
dump i_status
dump i_param_set_id
#
#  Change the name, description and the status of the job “new_job” 
s_jobname = “changed_name”
s_description = “This is the updated job name for the NASTRAN code”
i_status = 1
i_return_value =                                 @
   db_update_jobname_for_a_code                  @
      (  i_analysis_code_id,                     @
         s_jobname,                              @
         s_description,                          @
         i_status,                               @
         i_jobname_id,                           @
         i_param_set_id )
dump i_return_value
#  The param set id which was updated 
dump i_param_set_id
#
#  Get the job info of the updated job name
i_return_value =                                 @
   db_get_job_info                               @
      (  i_analysis_code_id,                     @
         i_jobname_id,                           @
         s_jobname,                              @
         s_description,                          @
         i_param_set_id,                         @
         i_status )
dump i_return_value
dump s_jobname
dump s_description
dump i_param_set_id
dump i_status
#---------------------------------------------------------------------
 
jobfile.close
()
#  Purpose          :  This function closes 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.close() has no arguments:
#
#---------------------------------------------------------------------
#  Variable Declarations
 
      INTEGER i_return_status = 1
      STRING filespec[128]
 
#---------------------------------------------------------------------
#  Open a new database "new.db"
 
  uil_file_new.go( "","new.db" )
        
#---------------------------------------------------------------------
#  Opens the jobfile
        
      i_return_status = jobfile.open( "new", "RESULTS" )
      dump i_return_status
#---------------------------------------------------------------------
#  Delete the old files - .bdf and .op2 files.
 
       msc_delete_old_files( "new", ".bdf", ".op2" )
 
#---------------------------------------------------------------------
#  Write the various parameter in the file
 
      jobfile.writec( "", "TRANSLATOR = pat3nas" )
      jobfile.writec( "JOBNAME", "new" )
      jobfile.writec( "", "" )
      jobfile.writec( "WT-MASS CONVERSION", "1.0" )
      jobfile.writei( "EXEC INPUT 0", 0 )
      jobfile.writec( "CASE WRITE", "ON" )
      jobfile.writei( "CASE INPUT 0", 0 )
      jobfile.writec( "", "END" )
 
#---------------------------------------------------------------------
#  Close the file new.jbr
        
        jobfile.close(  )
 
#---------------------------------------------------------------------
#  Checks the existence of the file new.jbr.  
#  This file name is obtained after the file is opened.
 
      file_build_fname("","new","jbr","O",filespec)
      dump filespec
 
#--------------------------------------------------------------------
#  Close the file new.db
 
      uil_file_close.goquit()
 
#--------------------------------------------------------------------
 
jobfile.create_matrix
()
#  Purpose          :  This function writes an real matrix of any
#                      size into the database.  The size of the 
#                      matrix is defined by the jobfile.writess()
#                      function.
#
#                      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_matrix()
#  has the following arguments:
#
#  jobfile.create_matrix
#     (  matrix_values,
#        num_values    )
#
#---------------------------------------------------------------------
#  Variable Decelerations
STRING  s_label[32]
INTEGER i_matrix_dim(2)
REAL    ra_values(2)
INTEGER i_num_vals
INTEGER i_param_set_id
STRING  s_param_name[128]
INTEGER i_nrows
INTEGER i_ncols
INTEGER i_size
REAL    rv_matrix_out(VIRTUAL)
INTEGER i_analysis_code_id
INTEGER i_count
INTEGER ia_jobname_id(1)
STRING  sa_jobname[80](1)
STRING  sa_description[512](1)
INTEGER ia_param_set_id(1)
INTEGER i_param_set_id
INTEGER ia_status(1)
INTEGER i_return_value
#---------------------------------------------------------------------
#  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.jba'.
 
     jobfile.open( "new", "ANALYZE" )
 
#---------------------------------------------------------------------
#  Deleting Old result and jobfiles.
 
   msc_delete_old_files( "new", ".bda", ".op2" )
 
#---------------------------------------------------------------------
#  Using the function jobfile.writeSS() to create the matrix
#  label and the size of the matrix.
 
s_label = "matrix_label"
i_matrix_dim(1) = 1
i_matrix_dim(2) = 2
 
    jobfile.writeSS                                    @
                  ( s_label,                           @
                    i_matrix_dim  )
 
#---------------------------------------------------------------------
#  Using the function jobfile.create_matrix() to writeSS() to 
#  create the matrix label and the matrix array.
 
i_num_vals = 2
ra_values  = [ 12.5 , -12.3 ]
 
i_return_value  =  jobfile.create_matrix               @
                         (    ra_values,               @
                              i_num_vals  )
 
dump i_return_value
#---------------------------------------------------------------------
#  Closing the jobfile.
 
      jobfile.close(  )
 
#---------------------------------------------------------------------
#  Getting the parameter set id corresponding to this matrix dump.
 
i_analysis_code_id = 1
i_count            = 1
 
i_return_value  =  db_get_jobnames_for_a_code          @
              (  i_analysis_code_id,                   @
                 i_count,                              @
                 sa_jobname,                           @
                 ia_jobname_id,                        @
                 sa_description,                       @
                 ia_param_set_id,                      @
                 ia_status  )
dump i_return_value
dump ia_param_set_id
#---------------------------------------------------------------------
#  Getting the matrix size.
 
i_param_set_id  =  ia_param_set_id(1)
s_param_name    =  "matrix_label"
 
i_return_value =                                       @
            db_get_pset_matrix_size                    @
               (  i_param_set_id,                      @
                  s_param_name,                        @
                  i_nrows,                             @
                  i_ncols )
dump i_nrows, i_ncols
i_size = i_nrows * i_ncols
#---------------------------------------------------------------------
#  Getting the matrix.
 
sys_allocate_array(rv_matrix_out,1,i_size)
 
i_return_value =                                       @
         db_get_pset_matrix_entry                      @
               (  i_param_set_id,                      @
                  s_param_name,                        @
                  rv_matrix_out   )
 
dump rv_matrix_out
#---------------------------------------------------------------------
sys_free_array(rv_matrix_out)
#  End of File.
 
jobfile.open
()
#  Purpose          :  This function opens the output file for deck 
#                      creation. It writes the parameters to be used 
#                      in the Results/Model data files.  This is used 
#                      if the MSC.Nastran preference is selected.
#                      The function returns a integer value '0' if 
#                      executed properly. the functions which are used
#                      subsequent to this function are the 
#                      msc_delete_old_files(), jobfile.writec, 
#                      jobfile.writef, jobfile.writei.  The file must 
#                      necessarily be close by the jobfile.close()
#                      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.open()
#  has the following arguments:
#
#  jobfile.open(
#     (  jobname,
#        job_type     )
#
#
#
#---------------------------------------------------------------------
#  Variable Declarations
 
      INTEGER i_return_status = 1
#---------------------------------------------------------------------
#  Open a new database "new.db"
 
      uil_file_new.go( "","new.db" )
        
#---------------------------------------------------------------------
#  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 parameter in the file
 
      jobfile.writec( "", "TRANSLATOR = pat3nas" )
      jobfile.writec( "DATABASE", "new.db" )
      jobfile.writec( "JOBNAME", "new" )
      jobfile.writec( "ANALYSIS TITLE", "")
      jobfile.writec( "", "" )
      jobfile.writec( "OBJECT", "Entire Model" )
      jobfile.writec( "METHOD", "Full Run" )
      jobfile.writec( "", "" )
      jobfile.writec( "MODEL SUFFIX", ".bdf" )
      jobfile.writec( "RESULTS SUFFIX", ".op2" )
      jobfile.writec( "", "" )
      jobfile.writec( "", "/*" )
      jobfile.writec( "", " * Translation Parameters" )
      jobfile.writec( "", " */" )
      jobfile.writec( "", "" )
      jobfile.writec( "DATA OUTPUT", "OP2 and Print" )
      jobfile.writec( "OUTPUT2 REQUESTS", "P3 Built In" )
      jobfile.writec( "OUTPUT2 FORMAT", "Binary" )
      jobfile.writec( "", "" )
      jobfile.writec( "", "/*" )
      jobfile.writec( "", " * Solution Parameters" )
      jobfile.writec( "", " */" )
      jobfile.writec( "", "" )
      jobfile.writec( "SOLUTION TYPE", "LINEAR STATIC" )
      jobfile.writei( "SOLUTION SEQUENCE", 101 )
      jobfile.writec( "DATABASE RUN", "ON" )
      jobfile.writec( "CYCLIC SYMMETRY", "OFF" )
      jobfile.writei( "BULK INPUT 0", 0 )
      jobfile.writec( "", "END" )
 
#---------------------------------------------------------------------
#  Close the file new.jbr
        
      jobfile.close()
 
#--------------------------------------------------------------------
#  Close the file new.db
 
      uil_file_close.goquit()
 
#--------------------------------------------------------------------
 
jobfile.set_job_status
()
#  Purpose          :  This function sets the job_status and the 
#                      description for a  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.
#
#                      This file will not close patran , hence user
#                      will have to close patran through the "File"
#                      "Quit" pulldow menus from the menu bar.
#
#  The function jobfile.set_job_status()
#  has the following arguments:
#
#  jobfile.set_job_status
#     (  i_job_status,
#        s_msg_string    )
#
#---------------------------------------------------------------------
#  Opening a new database 
 
    IF(!db_is_open()) THEN
        uil_file_new.go("","new.db")
    ENDIF
$? YES 36000002
 
#---------------------------------------------------------------------
#  Variable Decelerations
 
      INTEGER i_status =  2
      INTEGER i_job_status =  50
      LOGICAL l_status  = FALSE
      STRING s_msg_string[32] = "TEST MESSAGE"
 
#---------------------------------------------------------------------
#  Opening a jobfile.
 
      jobfile.open("new","ANALYZE")
 
#---------------------------------------------------------------------
#  Calling the function jobfile.set_job_status to set the job status 
#  value for the job.
 
      l_status = jobfile.set_job_status(i_job_status,s_msg_string)
 
dump l_status
#---------------------------------------------------------------------
#  Closing the jobfile.
 
i_status =  jobfile.close()
$? NO 50
 
dump i_status
#---------------------------------------------------------------------
#  End of File.
 
jobfile.writec
 
#  Purpose          :  This function write character strings in the  
#                      jobfile opened by the jobfile.open function. 
#                      The other eqvuivalents to this function are  
#                      jobfile.writei, jobfile.writef, 
#                      jobfile.write.spl. 
#
#
#                      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,
#        char_val     )
#
#
#
#---------------------------------------------------------------------
#  Variable Declarations
 
      INTEGER i_return_status = 1
#---------------------------------------------------------------------
#  Open a new database "new.db"
 
       uil_file_new.go( "","new.db" )
        
#---------------------------------------------------------------------
#  Opens the jobfile
        
      i_return_status = jobfile.open( "new", "RESULTS" )
      dump i_return_status
 
#
#---------------------------------------------------------------------
#  Delete the old files - .bdf and .op2 files.
 
     msc_delete_old_files( "new", ".bdf", ".op2" )
 
#---------------------------------------------------------------------
#Write the various parameter in the file
 
#---------------------------------------------------------------------
#  Using the jobfile.writec function to write text in the output file
#  The format is jobfile.writec("str_1","str_2 ") writes the following 
#  to the output file :  str_1 = str 2. 
#  for  jobfile.writec("",str_2), the output is str_2.
 
      jobfile.writec( "DATABASE", "new.db" )
      jobfile.writec( "JOBNAME", "new" )
      jobfile.writec( "ANALYSIS TITLE", "analysis of the new job")
      jobfile.writec( "", "" )
      jobfile.writec( "", "END" )
 
#---------------------------------------------------------------------
#  Close the file new.jbr
        
      jobfile.close(  )
 
#--------------------------------------------------------------------
#  Close the file new.db
 
      uil_file_close.goquit()
 
#--------------------------------------------------------------------
 
jobfile.writei
 
#  Purpose          :  This function write integer values in the jobfile 
#                      opened by the jobfile.open function. The other 
#                      eqvuivalents to this function are jobfile.writec, 
#                      jobfile.writer, jobfile.write_spl. 
#
#                      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.writei()
#  has the following arguments:
#
#  jobfile.writei(
#     (  label_str,
#        int_val     )
#
#
#
#---------------------------------------------------------------------
#  Variable Declarations
 
      INTEGER i_return_status = 1
#---------------------------------------------------------------------
#  Open a new database "new.db"
 
    uil_file_new.go( "","new.db" )
	
#---------------------------------------------------------------------
#  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" )
 
#---------------------------------------------------------------------
#  Using the jobfile.writei function to write text in the output file
#  The format is jobfile.writei("str_1","int") writes the following 
#  to the output file :  str_1 = int. 
 
 
      jobfile.writei( "SOLUTION SEQUENCE", 101 )
      jobfile.writei( "FMS INPUT 0", 0 )
      jobfile.writei( "EXEC INPUT 0", 0 )
      jobfile.writei( "CASE INPUT 0", 0 )
      jobfile.writei( "BULK INPUT 0", 0 )
      jobfile.writec( "", "END" )
 
#---------------------------------------------------------------------
#  Close the file new.jbr
	
      jobfile.close()
 
#--------------------------------------------------------------------
#  Close the file new.db
 
      uil_file_close.goquit()
 
#--------------------------------------------------------------------
 
jobfile.writer
 
#  Purpose          :  This function writes real values in the jobfile 
#                      opened by the jobfile.open function. The other 
#                      eqvuivalents to this function are jobfile.writei,
#                      jobfile.writec, jobfile.write.spl.
#
#                      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,
#        rl_val     )
#
#
#
#---------------------------------------------------------------------
#  Variable Declarations
 
      INTEGER i_return_status = 1
#---------------------------------------------------------------------
#  Open a new database "new.db"
 
      uil_file_new.go( "","new.db" )
        
#---------------------------------------------------------------------
#  Opens the jobfile
        
      i_return_status = jobfile.open( "new", "RESULTS" )
      dump i_return_status
#---------------------------------------------------------------------
#  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)       
 
#---------------------------------------------------------------------
      jobfile.writec( "", "END" )
 
#---------------------------------------------------------------------
#  Close the file new.jbr
        
      jobfile.close()
 
#--------------------------------------------------------------------
#  Close the file new.db
 
      uil_file_close.goquit()
 
#--------------------------------------------------------------------
 
jobfile.write_spl
 
#  Purpose          :  This function write character strings in the jobfile 
#                      opened by the jobfile.open function. The other eqvui-
#                      valents to this function are jobfile.writei, 
#                      jobfile.writer and jobfile.write.c. This function 
#                      writes pure string or string arrays as against the
#                      function jobfile.writec which inserts two strings with
#                      a "=" in between.  
#
#                      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.write_spl()
#  has the following arguments:
#
#  jobfile.write_spl(
#        label_str,
#        char_str     )
#
#
#
#---------------------------------------------------------------------
#  Variable Declarations
 
 
      INTEGER i_return_status = 1
      STRING  str[128](2)
      str(1) = "STRING_1"
      str(2) = "STRING_2"
 
#---------------------------------------------------------------------
#  Open a new database "new.db"
 
     uil_file_new.go( "","new.db" )
        
#---------------------------------------------------------------------
#  Opens the jobfile
        
      i_return_status = jobfile.open( "new", "RESULTS" )
      dump i_return_status
      
#---------------------------------------------------------------------
#  Delete the old files - .bdf and .op2 files.
 
      msc_delete_old_files( "new", ".bdf", ".op2" )
 
#---------------------------------------------------------------------
#  calling the function jobfile.write_spl
 
      jobfile.write_spl( "/* Writing character string arrays: %A% and %A% */ ", str)
 
#---------------------------------------------------------------------
#  Using the jobfile.writec function to write pure text in the output file
 
      jobfile.writec( "DATABASE", "new.db" )
      jobfile.writec( "JOBNAME", "new" )
      jobfile.writec( "ANALYSIS TITLE", "analysis of the new job")
      jobfile.writec( "", "" )
      jobfile.writec( "", "END" )
 
#---------------------------------------------------------------------
#  Close the file new.jbr
        
      jobfile.close()
 
#--------------------------------------------------------------------
#  Close the file new.db
 
      uil_file_close.goquit()
 
#--------------------------------------------------------------------
 
msc_delete_old_files
 
#  Purpose          :  This function follows the jobfile.open()
#                      function. It searches and deletes all previous
#                      versions of the model and results files to 
#                      avoid interference with the new jobname.
#
#
#                      This function can be run in batchmode by running 
#                      this session file from "File","Session","Play" 
#                      pulldown menus on the menu bar.
#
#
#  The function msc_delete_old_files()
#  has the following arguments:
#
#  msc_delete_old_files(
#     (  job_name,
#        model_suffix,
#        results_suffix   )   
#
#
#---------------------------------------------------------------------
#  Variable Declarations
 
      INTEGER i_return_status = 1
 
#---------------------------------------------------------------------
#  Open a new database "new.db"
 
       uil_file_new.go( "","new.db" )
#---------------------------------------------------------------------
#  Delete the old files - new.bdf and new.op2 files.
 
       i_return_status = msc_delete_old_files( "new", ".bdf", ".op2" )
$? YES 6022037
 
dump i_return_status
#--------------------------------------------------------------------
#  Close the file new.db
 
      uil_file_close.goquit()
 
#--------------------------------------------------------------------
 
mscnastran_anlyze_sub_create.available_callback
()
#  Purpose          :  The function mscnastran_analyze_sub_create.
#                      available_callback()  is  a  callback  to 
#                      "Available Subcases" list box in "Subcase Create"
#                      form. Execution of this function will display
#                      the corresponding subcase name in "Subcase Name"
#                      data box in "Sub Case Create" form.
#
#                      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 mscnastran_analyze_sub_create.available_callback()
#  has the following arguments:
#
#  mscnastran_analyze_sub_create.available_callback
#     (  INPUT:
#        INTEGER num_items,
#        STRING subcase_name[]()
#        OUTPUT:
#     ) 
#---------------------------------------------------------------------
# 
#  Opening a new database 
 
     uil_file_new.go("","new.db")
 
#---------------------------------------------------------------------
 
#  Displaying Analyis Application form
 
   ui_exec_function( "uil_app_analysis", "display" )
 
#--------------------------------------------------------------------
 
#  Displaying Subcase Create  form
 
   ui_exec_function( "mscnastran_analyze_sub_create", "display" )
 
#--------------------------------------------------------------------
 
#  Declaring and defining input arguents
 
   INTEGER num_items = 1
 
   STRING subcase_name[64](1) = ["new_subcase"]
 
#---------------------------------------------------------------------
 
 
#  Using the function mscnastran_analyze_sub_create.available_callback()
#  to apply callback to the "Available Subcases" list box in 
#  "Subcase Create" form.
   
    mscnastran_analyze_sub_create.available_callback(num_items,      @
                                                     subcase_name)
 
 
#---------------------------------------------------------------------
 
#  Using the function mscnastran_analyze_sub_create.get_subcase_name()
#  to check the subcase name in "Subcase Name" data box in 
#  "Subcase Create" form.
 
   STRING check_subcase_name[64]
 
   mscnastran_analyze_sub_create.get_subcase_name(check_subcase_name)
 
   dump check_subcase_name
 
#----------------------------------------------------------------------
 
#  End of File.
 
#---------------------------------------------------------------------
 
mscnastran_analyze_tp.get_version_number
()
#  Purpose          :  This function will get version number of MSC.Nastran.
#                      It does not  require input argument. It will give
#                      version number as output.
#
#                      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 mscnastran_analyze_tp.get_version_number()
#  has the following arguments:
#
#  mscnastran_analyze_tp.get_version_number
#     (  
#        REAL version_no
#     ) 
#---------------------------------------------------------------------
# 
#  Opening a new database 
 
     uil_file_new.go("","new.db")
 
 
     REAL version_no
 
#---------------------------------------------------------------------
#  Using the function mscnastran_analyze_tp.get_version_number() 
#  to get the version number of MSC.Nastran.
 
     mscnastran_analyze_tp.get_version_number(version_no)
 
     dump version_no
 
#---------------------------------------------------------------------
#  End of File.
 
mscnastran_job.associate_subcases
()
#  Purpose          :  This function will associate subcases to a job 
#                      for MSC.Nastran preference. It requires solution
#                      sequence number, name of the job, number of
#                      subcases and the name of subcases as input 
#                      arguments. It will return integer status
#                      which is zero on success.
#
#                      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 mscnastran_job.associate_subcases()
#  has the following arguments:
#
#  mscnastran_job.associate_subcases
#     (  INPUT: 
#        STRING sseq_str,
#        STRING jobname,
#        INTEGER num_subcases,
#        STRING subcase_names,
#        OUTPUT:
#        INTEGER status
#     ) 
#---------------------------------------------------------------------
# 
#  Opening a new database 
 
     uil_file_new.go("","new.db")
 
#---------------------------------------------------------------------
 
#  Displaying Analyis Application form
 
   ui_exec_function( "uil_app_analysis", "display" )
 
#--------------------------------------------------------------------
 
#  Declaring and defining input arguments
 
   STRING sseq_str[16] = "101" /* For linear static solution */
   STRING jobname[64] = "new_job"
   INTEGER num_subcases = 2
   STRING subcase_names[64](2) = ["Subcase_1","Subcase_2"]
 
#  Declaring output argument
  
   INTEGER status
 
#----------------------------------------------------------------------
 
# Using the Function mscnastran_subcase.create() to create the 
# subcases for MSC.Nastran preference.
 
             mscnastran_subcase.create(sseq_str,                    @
                                       subcase_names(1),            @
                                       "First subcase")
 
       mscnastran_subcase.create_char_param("LOAD CASE", "Default")
       
             mscnastran_subcase.create(sseq_str,                    @
                                       subcase_names(2),            @
                                       "Second subcase")
 
       mscnastran_subcase.create_char_param("LOAD CASE", "Default")
 
#---------------------------------------------------------------------
 
 
#  Creating new job file.
 
       jobfile.open(jobname,"ANALYZE NO JOBFILE")
 
#  Deleting Old result and jobfiles.
 
       msc_delete_old_files( jobname, ".bdf", ".op2" )
 
#  Closing the jobfile.
 
       jobfile.close()
 
#------------------------------------------------------------------------
 
# Using the Function mscnastran_job.associate_subcases() to associate
# subcases to a job for MSC.Nastran preferences.
 
    status = mscnastran_job.associate_subcases(sseq_str,             @
                                               jobname,              @
                                               num_subcases,         @
                                               subcase_names)
 
    dump status
 
 
#---------------------------------------------------------------------
 
#  End of File.
 
#---------------------------------------------------------------------
 
mscnastran_subcase.create
()
 
#  Purpose          :  This function will create subcase for 
#                      MSC.Nastran preference. It requires solution
#                      sequence value, name of the subcase and the
#                      subcase description as input arguments. It
#                      will return integer status which is zero on
#                      success.
#
#                      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 mscnastran_subcase.create()
#  has the following arguments:
#
#  mscnastran_subcase.create
#     (  INPUT: 
#        STRING sseq_str, 
#        STRING subcase_name,
#        STRING subcase_desc,
#        OUTPUT:
#        INTEGER status
#     ) 
#---------------------------------------------------------------------
# 
#  Opening a new database 
 
     uil_file_new.go("","new.db")
 
#---------------------------------------------------------------------
 
#  Displaying Analyis Application form
 
   ui_exec_function( "uil_app_analysis", "display" )
 
#--------------------------------------------------------------------
 
#  Declaring and defining input arguents
 
   STRING sseq_str[16] = "101" /* For linear static solution */
   STRING subcase_name[64] = "New_subcase"
   STRING subcase_desc[64] = "This is test subcase"
 
#  Declaring output argument
  
   INTEGER status
 
#----------------------------------------------------------------------
 
# Using the Function mscnastran_subcase.create() to create the 
# subcase for MSC.Nastran preference.
 
    status = mscnastran_subcase.create(sseq_str,                @
                                       subcase_name,            @
                                       subcase_desc)
 
    dump status
 
 
#---------------------------------------------------------------------
 
#  End of File.
 
#---------------------------------------------------------------------
 
mscnastran_subcase.create_char_param
()
#  Purpose          :  This function will load a character value for
#                      subcase parameter in to data base. It requires
#                      name of the subcase parameter and the value of
#                      the parameter.It will return integer status
#                      which is zero on success.
#
#                      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 mscnastran_subcase.create_char_param()
#  has the following arguments:
#
#  mscnastran_subcase.create_char_param
#     (  INPUT: 
#        STRING param_name,
#        STRING char_value,
#        OUTPUT:
#        INTEGER status
#     ) 
#---------------------------------------------------------------------
# 
#  Opening a new database 
 
     uil_file_new.go("","new.db")
 
#---------------------------------------------------------------------
 
#  Displaying Analyis Application form
 
   ui_exec_function( "uil_app_analysis", "display" )
 
#--------------------------------------------------------------------
 
#  Declaring and defining input arguents
 
   STRING param_name[32] = "LOAD CASE" 
   STRING char_value[64] = "Test_Load_Case"
 
#  Declaring output argument
  
   INTEGER status
 
#----------------------------------------------------------------------
 
# Using the function loadcase_create2() to create new load case.
 
             loadcase_create2(char_value,                        @
                              "static",                          @
                              "new load case",                   @
                              1.,[""],[0],                       @
                              [0.],"",0.,TRUE)
 
# Using the Function mscnastran_subcase.create() to create the 
# subcase for MSC.Nastran preference.
 
             mscnastran_subcase.create("101",                    @
                                       "Test",                   @
                                       "Test subcase")
 
#---------------------------------------------------------------------
 
 
# Using the function mscnastran_subcase.create_char_param() to load
# the subcase parameter "LOAD CASE" in to data base for Test subcase
 
 
   status = mscnastran_subcase.create_char_param(param_name,     @
                                                 char_value)
 
   dump status
 
#---------------------------------------------------------------------
#  End of File.
#---------------------------------------------------------------------
 
mscnastran_update.job
()
#  Purpose          :  This function will update old job to current
#                      format of  MSC.Nastran preference. It requires 
#                      name of the job as input argument. It will
#                      return integer status which is zero success.
#
#                      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 mscnastran_update.job()
#  has the following arguments:
#
#  mscnastran_update.job
#     (  INPUT: 
#        STRING jobname,
#        OUTPUT:
#        INTEGER status
#     ) 
#---------------------------------------------------------------------
# 
#  Opening a new database 
 
     uil_file_new.go("","new.db")
 
#---------------------------------------------------------------------
 
#  Displaying Analyis Application form
 
   ui_exec_function( "uil_app_analysis", "display" )
 
#--------------------------------------------------------------------
 
#  Declaring and defining input arguments
 
   STRING jobname[64] = "new_job"
 
#  Declaring output argument
  
   INTEGER status
 
#----------------------------------------------------------------------
 
#  Creating new job file.
 
       jobfile.open(jobname,"ANALYZE NO JOBFILE")
 
#  Deleting Old result and jobfiles.
 
       msc_delete_old_files( jobname, ".bdf", ".op2" )
 
   jobfile.writec( "JOBNAME", jobname )
   jobfile.writec( "OUTPUT2 REQUESTS", "P3 Built In" )
   jobfile.writei( "SOLUTION SEQUENCE", 106 )
 
 
#  Closing the jobfile.
 
   jobfile.close()
 
# Using the Function mscnastran_job.associate_subcases() to associate
# subcases to a job for MSC.Nastran preferences.
 
             mscnastran_job.associate_subcases("101",                @
					       jobname,              @
                                               1,                    @
                                               ["Default"])
 
             analysis_submit_2( "MSC.Nastran", jobname )
 
#------------------------------------------------------------------------
   
             status = mscnastran_update.job(jobname)
 
             dump status
 
#---------------------------------------------------------------------
 
#  End of File.
 
#---------------------------------------------------------------------
 
uil_app_analysis.change_current_branch
()
#  Purpose          :  This function changes the current branch of
#                      the option menu tree to new branch for the 
#                      analysis application. It requires number of
#                      menus in new branch(num_branches), label for
#                      each menu(labels) and flag(post_them) to 
#                      indicate if the menus are to be posted after
#                      they are set. The labels array must contain
#                      existing item labels.
#
#                      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 uil_app_analysis.change_current_branch()
#  has the following arguments:
#
#  uil_app_analysis.change_current_branch
#     (  INPUT: 
#        INTEGER num_branches,
#        STRING labels(),
#        LOGICAL post_them
#        OUTPUT:
#     ) 
#---------------------------------------------------------------------
# 
#  Opening a new database 
 
     uil_file_new.go("","new.db")
 
#---------------------------------------------------------------------
 
#  Displaying Analyis Application form
 
   ui_exec_function( "uil_app_analysis", "display" )
 
#--------------------------------------------------------------------
 
#  Declaring input arguents
 
   INTEGER num_branches
   STRING labels[32](4)
   LOGICAL post_them = TRUE
 
#----------------------------------------------------------------------
 
# Get the details in current branch of analysis application.
 
   INTEGER items(4)
 
   uil_app_analysis.get_current_branch(num_branches, items, labels)
 
   dump num_branches labels post_them
 
#----------------------------------------------------------------------
 
# Get the analysis code name.
 
   STRING   analysis_code_name[32]
 
   db_get_default_anal_code ( analysis_code_name )
 
# Defining new branch in analysis application.
 
IF( analysis_code_name == "MSC.Nastran" )THEN
    labels(2)="Read Output2"
    labels(3)="Result Entities"
    labels(4)="Translate"
END IF
 
# Using the Function uil_app_analysis.change_current_branch() to change
# the current branch of analysis application.
 
    uil_app_analysis.change_current_branch(num_branches, labels, post_them)
 
    dump labels
 
# Displaying the new branch of analysis application.
 
    ui_form_display( "uil_app_analysis" )
 
#---------------------------------------------------------------------
#  End of File.