Tutorial Toolkit Code Examples > Introduction > Introduction
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX''">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX''">   
Introduction
This chapter provides code examples for the PCL function described in Volume 1. These examples are designed so that they can be cut and pasted into a file and, by following the instructions listed with each example, executed in MSC Patran.
db_get_p3_version
()
#  Purpose          :  This file gives an example of a call to the 
#                      function db_get_p3_version()
#
#                      This function queries the database for its 
#                      version number.
#
#                      To run this session file,first start
#                      a session of MSC Patran,open a database or
#                      start a new database,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function has the following arguments:
#                   db_get_p3_version
#                       ( p3_ver )
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
STRING  s_p3_ver[100]
INTEGER i_return_value
 
#  -------------------------------------------------------------------
 
i_return_value=                                  @
     db_get_p3_version                           @
         ( s_p3_ver)
 
dump s_p3_ver
dump i_return_value
 
#  -------------------------------------------------------------------
 
is_batch
()
#  Purpose          :  This file provides an example of a call to the 
#                      function is_batch()
#
#                      This function checks to see whether MSC Patran
#                      is running in batch mode or not.
#
#                      MSC Patran runs, by default, in graphics mode.
#                      In graphics mode, it displays user interface
#                      and graphics on the screen. When it is in batch
#                      mode no graphics appear on the screen.
#                      
#                      To run this session file start a session of
#                      MSC Patran,then click on “File”,”Session”
#                      “Play” pulldown menus on the menu bar.
#
#  This  function does not have arguments. But it has a LOGICAL return
#  type which informs whether MSC Patran is in batch mode or not.
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
LOGICAL l_status
 
#  -------------------------------------------------------------------
 
l_status=is_batch()
 
dump l_status
#  -------------------------------------------------------------------
 
user_db_close
()
#  Purpose          :  This file gives an example of a call to the 
#                      functions user_db_close()
#
#                      This function is called  by MSC Patran itself
#                      just before an existing  database is closed. 
#                      Hence explicit call to the function has not  
#                      been made in this session file.
#                      Instead, following instructions have been given
#                      so that the effect of the call to this function
#                      can be seen on a session file (history window).
#
#  Instructions     :  Keep the file usr_fns.pcl in the system path
#                      preferably in working directory.
#                      Append to your p3prolog.pcl file an instruction
#                      !!INPUT usr_fns.pcl 
#                      (or) Write a new file p3prolog.pcl in your 
#                      working directory with the above instruction in
#                      it.
#                      
#                      Now start a new session of MSC Patran.
#                      Start recording a new session file by selecting 
#                      “File”,”Session”,”record” pulldown menus and 
#                      enter the name “new.ses.01” in the “Recording 
#                      file” databox in the “Record Session File” form
#                      
#                      Open an  existing  database (OR) start a new 
#                      database.Then  close  the  database by “File”
#                      “Close”.Function user_db_close() will be called
#                      by MSC Patran with isquit=FALSE(Refer the function
#                      description).
#                      The instructions written in user_db_close()  in 
#                      usr_fns.pcl will be written to the history
#                      window.Again open any database and exit the
#                      MSC Patran while the database is open. Here MSC Patran 
#                      calls user_db_close()function with isquit=TRUE.
#                      Read the session file “new.ses.01” to find the 
#                      instructions written in it before closing the 
#                      database in the process of exiting MSC Patran.
#  -------------------------------------------------------------------
 
user_db_new
()
#  Purpose          :  This file gives an example of a call to the 
#                      functions user_db_new()
#
#                      This function is called  by MSC Patran itself
#                      just after a new database is created. Hence 
#                      explicit call to the function has not been 
#                      made in this session file.
#                      Instead, certain instructions have been given
#                      so that the effect of the call to this function
#                      can be seen on the session file.
#
#  Instructions     :  Keep the file usr_fns.pcl in the system path
#                      preferably in working directory.
#                      Append to your p3prolog.pcl file an instruction
#                      !!INPUT usr_fns.pcl 
#                      (or) write a new file p3prolog.pcl in your 
#                      working directory with the above instruction 
#                      in it.
# 
#                      Now start a new session of MSC Patran.
#                      Start recording a new session file by selecting 
#                      “File”,”Session”,”record” pulldown menus
#                      Enter the name “new.ses.01” in the “Recording 
#                      file” databox in the “Record Session File” form
#                      
#                      Open a new database.Function user_db_new() will
#                      be called by MSC Patran. The instructions written in 
#                      user_db_new()  in usr_fns.pcl will be written  
#                      to the history window.
#  -------------------------------------------------------------------
 
user_db_open
()
#  Purpose          :  This file gives an example of a call to the 
#                      functions user_db_open()
#
#                      This function is called  by MSC Patran itself
#                      just after an existing  database is opened. 
#                      Hence explicit call to the function has not 
#                      been made in this session file.
#                      Instead, certain instructions have been given
#                      so that the effect of the call to this function
#                      can be seen on a session file.
#
#  Instructions     :  Keep the file usr_fns.pcl in the system path
#                      preferably in working directory.
#                      Append to your p3prolog.pcl file an instruction
#                      !!INPUT usr_fns.pcl (or) Write a new file  
#                      p3prolog.pcl in your working directory with the
#                      above instruction in it.
#                      
#                      Now start a new session of MSC Patran.
#                      Start recording a new session file by selecting 
#                      “File”,”Session”,”record” pulldown menus. 
#                      Enter the name “new.ses.01” in the “Recording 
#                      file” databox in the “Record Session File” form
#                      
#                      Open  an  existing  database. Function 
#                      user_db_open()  will be  called  by MSC Patran. The
#                      instructions  written  in user_db_open()  in
#                      usr_fns.pcl will be  written to the history 
#                      window.
#  -------------------------------------------------------------------
 
user_quit
()
#  Purpose          :  This file gives an example of a call to the 
#                      functions user_quit()
#
#                      This function is called  by MSC Patran itself
#                      just before exit.Hence explicit call to the
#                      function has not made in this session file.
#                      Instead, certain instructions have been given
#                      so that the effect of the call to this function
#                      can be seen on the session file.
#
#  Instructions     :  Keep the file usr_fns.pcl in the system path
#                      preferably in working directory.
#                      Append your p3prolog.pcl file by a instruction
#                      !!INPUT usr_fns.pcl (or) Write a new file  
#                      p3prolog.pcl in your working directory with the
#                      above said instruction in it.
#                      
#                      Now start a new session of MSC Patran.
#                      Start recording a new session file by selecting 
#                      “File”,”Session”,”record” pulldown menus and 
#                      Enter the name “new.ses.01” in the “Recording 
#                      file” databox in the “Record Session File” form
#                      
#                      Quit MSC Patran, Open the session file “new.ses.01”
#                      The instructions written in user_quit()  in
#                      usr_fns.pcl will be written on that session 
#                      file in the process of quitting MSC Patran.
#  -------------------------------------------------------------------
 
user_start
()
#  Purpose          :  This file gives an example of a call to the 
#                      functions user_start()
#
#                      This function is called  by MSC Patran itself
#                      just after startup.Hence explicit call to the
#                      function has not made in this session file.
#                      Instead, certain instructions have been given
#                      so that the effect of the call to this function
#                      can be seen on standard output.
#
#                      Normally Function user_start() is called before
#                      default session file starts recording.Hence 
#                      commands are not recorded in the session file.
#
#  Instructions     :  Keep the file usr_fns.pcl in the system path
#                      preferably in working directory.
#                      Append to your p3prolog.pcl file an instruction
#                      !!INPUT usr_fns.pcl 
#                      (or) write a new p3prolog.pcl in your working 
#                      directory with the above instruction in it.
#                      
#                      Now start a new session of MSC Patran.
#                      The instructions written in user_start()  in
#                      usr_fns.pcl will be written on standard 
#                      output.
#  -------------------------------------------------------------------
 
utl_get_terse_version
()
#  Purpose          :  This file gives an example of a call to the 
#                      function utl_get_terse_version()
#
#                      This function queries the database for its 
#                      terse version number.
#
#                      To run this session file,first start
#                      a session of MSC Patran,open a database or
#                      start a new database,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function has the following arguments:
#                   utl_get_terse_version
#                       ( terse_version )
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
STRING  s_terse_version[100]
 
#  -------------------------------------------------------------------
 
     utl_get_terse_version                           @
         ( s_terse_version)
 
dump s_terse_version
 
#  -------------------------------------------------------------------
 
utl_query_version_level
()
#  Purpose          :  This file gives an example of a call to the 
#                      function utl_query_version_level()
#
#                      This function queries the database for its 
#                      version level code.
#                      Version level code is the number which informs
#                      whether the version is Alpha release or Beta
#                      release or Production release etc.
#
#                      To run this session file,first start
#                      a session of MSC Patran,open a database or
#                      start a new database,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
INTEGER i_return_value
 
#  -------------------------------------------------------------------
 
i_return_value =                                  @
     utl_query_version_level() 
 
dump i_return_value
 
#  -------------------------------------------------------------------