Tutorial Toolkit Code Examples > Model > Introduction
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX''">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX''">   
Introduction
This chapter provides code examples for the PCL function described in Volume 1. These examples are designed so that they can be cut and pasted into a file and, by following the instructions listed with each example, executed in MSC Patran.
 
db_count_client_labels_by_type
()
#  Purpose          :  This file gives an example of a call to the 
#                      function db_count_client_labels_by_type()
#                      
#                      A table is provided in the database which
#                      is reserved for the use by user.
#                      The db_create_client_data() function writes the 
#                      information to this table.The function 
#                      db_count_client_labels_by_type() returns
#                      the number of all labels with a specified type.
#
#                      To run this session file,first start
#                      a session of MSC Patran, start a new  
#                      database,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The db_count_client_labels_by_type has the following arguments:
#  db_count_client_labels_by_type
#      ( client_type,
#        nbr_of_labels )
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
INTEGER  i_client_type,i_nbr_of_labels
INTEGER  i_id, i_client_type,                                  @
         i_num_logicals, i_num_integers, i_num_reals,          @
         i_num_strings, i_max_string_length
LOGICAL  l_logical_data(1)= [TRUE]
INTEGER  i_integer_data(1)=[1]
REAL     r_real_data(1)=[202.54]
STRING   s_string_data[25](1)=[“Geometric”]
INTEGER  i_return_value
#  -------------------------------------------------------------------
#  Create a client defined entity in the database.
#
#  i_client_label=101
#  i_client_type=1001
#  i_num_logicals=1
#  i_num_integers=1
#  i_num_reals=1
#  i_num_strings=1
#  i_max_string_length=25
#
i_client_label = 101
i_client_type  = 1001
i_num_logicals = 1
i_num_integers = 1
i_num_reals    = 1
i_num_strings  = 1
i_max_string_length = 25
 
i_return_value =                                               @
    db_create_client_data                                      @
       ( i_id,                                                 @
         i_client_label,                                       @
         i_client_type,                                        @
         i_num_logicals,                                       @
         i_num_integers,                                       @
         i_num_reals,                                          @
         i_num_strings,                                        @
         i_max_string_length,                                  @
         l_logical_data,                                       @
         i_integer_data,                                       @
         r_real_data,                                          @
         s_string_data )
 
# check for creation of the client data 
dump i_return_value
 
#  Data type of the client.
#  i_client_type=1001
 
 
i_return_value =                                               @
    db_count_client_labels_by_type                             @
       ( i_client_type,                                        @
         i_nbr_of_labels )
 
#
 
dump i_nbr_of_labels
dump i_return_value
 
# create another client data  with same client_type but different
# client label and check for the no of labels.
 
#  i_client_label = 102
i_client_label = 102
 
i_return_value =                                               @
    db_create_client_data                                      @
       ( i_id,                                                 @
         i_client_label,                                       @
         i_client_type,                                        @
         i_num_logicals,                                       @
         i_num_integers,                                       @
         i_num_reals,                                          @
         i_num_strings,                                        @
         i_max_string_length,                                  @
         l_logical_data,                                       @
         i_integer_data,                                       @
         r_real_data,                                          @
         s_string_data )
 
# check for creation of the client data 
dump i_return_value
 
# check for the no of created labels.In this example 
#  two labels are created.
 
i_return_value =                                               @
    db_count_client_labels_by_type                             @
       ( i_client_type,                                        @
         i_nbr_of_labels )
 
# check for the no of labels created 
dump i_nbr_of_labels
dump i_return_value
#  -------------------------------------------------------------------
 
 
db_count_general_field
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_count_general_field()
#
#                      This function returns the count of terms in a
#                      field. It returns a positive integer 
#                      indicating the status of the execution of the 
#                      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 db_count_general_field()
#  has the following arguments:
#
#  db_count_general_field
#     (  field_id,
#        count  )
#
#---------------------------------------------------------------------
#  Variable Declarations
 
      INTEGER fem_create_mesh_surfa_num_nodes
      INTEGER fem_create_mesh_surfa_num_elems
      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 int_status=5, int_field_id, int_count
      STRING str_field[10] = "field_1"
 
#----------------------------------------------------------------------
#  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" )
#---------------------------------------------------------------------
# Create Geometric entities
 
      int_status = asm_const_patch_xyz                       @
                    ( "1", "<2 5 0>", "[0 0 0]", "Coord 0",  @
                     asm_create_patch_xy_created_ids )
 
 
dump int_status
#---------------------------------------------------------------------
# Create Finite Element entities 
# 219 Nodes IDS = 1:219 
# 60 Elements IDS = 1:60
 
 
      ui_exec_function( "mesh_seed_display_mgr", "init" )
      mesh_seed_create( "Surface 1.2 1.4 ", 1, 4, 0., 0., 0. )
      mesh_seed_create( "Surface 1.1 1.3 ", 1, 15, 0., 0., 0. )
 
      int_status = fem_create_mesh_surf_3                    @
                     ( "IsoMesh", 0, "Surface 1 ", 1,        @
		       ["0.1"], "Quad8", "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 int_status
mesh_seed_display_mgr.erase(  )
 
#---------------------------------------------------------------------
#  Create a Field - 'field_1'
 
 
      int_status = fields_create_general                     @
                       ( "field_1",                          @
                       0, 5, 2, "Real", "Coord 0",           @
		       "", 3, 1, 2, 15 )
 
dump int_status
 
      int_status = fields_create_general_term                @
                      ( "field_1",                           @
		        0, 0, 0, 30,                         @
			" [  (  'X  +  'Y  )  *  'RAD ]" )
 
 
dump int_status
#---------------------------------------------------------------------
#  Getting the field_id for the field - 'field_1'
 
       int_status = db_get_field_id(str_field,int_field_id)
 
dump int_status, str_field, int_field_id
 
#---------------------------------------------------------------------
#  Using the function db_count_general_field() to get 
#             the number of terms_ids or  count in the field
 
 
       int_status = db_count_general_field                  @
                       (int_field_id, int_count)
 
dump int_status, int_field_id, int_count
 
#---------------------------------------------------------------------
#  Closing the file - new.db
 
      uil_file_close.goquit()
     
#---------------------------------------------------------------------
 
 
 
db_create_client_data
()
#  Purpose          :  This file gives an example of a call to the 
#                      function db_create_client_data()
#                      
#                      This function creates a client defined entity
#                      in the database. A table is provided in the 
#                      database which is reserved for the use by user.
#                      The db_create_client_data() function writes the 
#                      information to this table.
#
#                      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 db_create_client_data has the following arguments:
#  db_create_client_data
#       ( id,
#         client_label,
#         client_type,
#         num_logicals,
#         num_integers,
#         num_reals,
#         num_strings,
#         max_string_length,
#         p_logical_data,
#         p_integer_data,
#         p_real_data,
#         p_string_data )
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
INTEGER  i_id, i_client_label, i_client_type,                  @
         i_num_logicals, i_num_integers, i_num_reals,          @
         i_num_strings, i_max_string_length
LOGICAL  l_logical_data(1)= [TRUE]
INTEGER  i_integer_data(1)=[1]
REAL     r_real_data(1)=[202.54]
STRING   s_string_data[25](1)=[“Geometric”]
INTEGER  i_return_value
 
#  -------------------------------------------------------------------
#  Create a client defined entity in the database.
#
#  i_client_label=101
#  i_client_type=1001
#  i_num_logicals=1
#  i_num_integers=1
#  i_num_reals=1
#  i_num_strings=1
#  i_max_string_length=25
#
 
i_client_label = 101
i_client_type  = 1001
i_num_logicals = 1
i_num_integers = 1
i_num_reals    = 1
i_num_strings  = 1
i_max_string_length = 25
 
 
i_return_value =                                               @
    db_create_client_data                                      @
       ( i_id,                                                 @
         i_client_label,                                       @
         i_client_type,                                        @
         i_num_logicals,                                       @
         i_num_integers,                                       @
         i_num_reals,                                          @
         i_num_strings,                                        @
         i_max_string_length,                                  @
         l_logical_data,                                       @
         i_integer_data,                                       @
         r_real_data,                                          @
         s_string_data )
 
dump i_return_value
#  -------------------------------------------------------------------
 
db_delete_client_data
()
#  Purpose          :  This file gives an example of a call to the 
#                      function db_delete_client_data()
#                      
#                      This function deletes a client defined entity
#                      in the database. A table is provided in the 
#                      database which is reserved for the use by user.
#                      The db_create_client_data() function writes the 
#                      information to this table.The function
#                      db_delete_client_data deletes the client data
#                      from the database.
#
#                      To run this session file,first start
#                      a session of MSC Patran, start a new
#                      database,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The db_delete_client_data has the following arguments:
#  db_delete_client_data
#      ( label )
#                         
#  -------------------------------------------------------------------
#  Variable Declaration
#
INTEGER  i_id, i_client_label, i_client_type,                  @
         i_num_logicals, i_num_integers, i_num_reals,          @
         i_num_strings, i_max_string_length
LOGICAL  l_logical_data(1)= [TRUE]
INTEGER  i_integer_data(1)=[1]
REAL     r_real_data(1)=[202.54]
STRING   s_string_data[25](1)=[“Geometric”]
INTEGER  i_return_value
 
#  -------------------------------------------------------------------
#  Create a client defined entity in the database.
#
#  i_client_label=101
#  i_client_type=1001
#  i_num_logicals=1
#  i_num_integers=1
#  i_num_reals=1
#  i_num_strings=1
#  i_max_string_length=25
#
 
i_client_label = 101
i_client_type  = 1001
i_num_logicals = 1
i_num_integers = 1
i_num_reals    = 1
i_num_strings  = 1
i_max_string_length = 25
 
 
i_return_value =                                               @
    db_create_client_data                                      @
       ( i_id,                                                 @
         i_client_label,                                       @
         i_client_type,                                        @
         i_num_logicals,                                       @
         i_num_integers,                                       @
         i_num_reals,                                          @
         i_num_strings,                                        @
         i_max_string_length,                                  @
         l_logical_data,                                       @
         i_integer_data,                                       @
         r_real_data,                                          @
         s_string_data )
#
 
dump i_return_value
 
i_return_value =                                               @
      db_delete_client_data                                    @
         ( i_client_label )
 
# check the deletion of the client data.
dump i_return_value
# we will try to get the client id using the client label.
i_return_value =                                               @
      db_get_client_id_by_label                                @
         ( i_client_label,                                     @
           i_id )
dump i_return_value                                              
# -------------------------------------------------------------------
 
db_get_all_client_data
()
#  Purpose          :  This file gives an example of a call to the 
#                      function db_get_all_client_data()
#                      
#                      This function gets all related data 
#                      from the  a client defined entity
#                      in the database. A table is provided in the 
#                      database which is reserved for the use by user.
#                      The db_create_client_data() function writes the 
#                      information to this table.The function db_get 
#                      all_client_data() gets this  written data.
#
#                      To run this session file,first start
#                      a session of MSC Patran, start a new
#                      database,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The db_get_all_client_data has the following arguments:
#  db_get_all_client_data
#      ( id,
#        num_logicals,
#        num_integers,
#        num_reals,
#        num_strings,
#        max_string_length,
#        p_logical_data,
#        p_integer_data,
#        p_real_data,
#        p_string_data )
#
#  -------------------------------------------------------------------
#  Variable Declaration
# variables used for creating the client defined entity. 
#
INTEGER  i_id, i_num_logicals, i_num_integers, i_num_reals,    @
         i_num_strings, i_max_string_length
INTEGER  i_client_label, i_client_type                         
LOGICAL  l_logical_data(1)= [TRUE]
INTEGER  i_integer_data(1)=[1]
REAL     r_real_data(1)=[202.54]
STRING   s_string_data[25](1)=[“Geometric”]
 
# variables used for checking the function.
 
LOGICAL  l_c_logical_data(1)
INTEGER  i_c_integer_data(1)
REAL     r_c_real_data(1)
STRING   s_c_string_data[25](1)
 
INTEGER  i_return_value
 
#  -------------------------------------------------------------------
#  Create a client defined entity in the database.
#
#  i_client_label=101
#  i_client_type=1001
#  i_num_logicals=1
#  i_num_integers=1
#  i_num_reals=1
#  i_num_strings=1
#  i_max_string_length=25
#
 
i_client_label = 101
i_client_type  = 1001
i_num_logicals = 1
i_num_integers = 1
i_num_reals    = 1
i_num_strings  = 1
i_max_string_length = 25
 
 
i_return_value =                                               @
    db_create_client_data                                      @
       ( i_id,                                                 @
         i_client_label,                                       @
         i_client_type,                                        @
         i_num_logicals,                                       @
         i_num_integers,                                       @
         i_num_reals,                                          @
         i_num_strings,                                        @
         i_max_string_length,                                  @
         l_logical_data,                                       @
         i_integer_data,                                       @
         r_real_data,                                          @
         s_string_data )
#
 
dump i_return_value
 
 
i_return_value =                                               @
    db_get_all_client_data                                     @
       ( i_id,                                                 @
         i_num_logicals,                                       @
         i_num_integers,                                       @
         i_num_reals,                                          @
         i_num_strings,                                        @
         i_max_string_length,                                  @
         l_c_logical_data,                                     @
         i_c_integer_data,                                     @
         r_c_real_data,                                        @
         s_c_string_data )
 
# check for the data got from the function
 
dump l_c_logical_data
dump i_c_integer_data
dump r_c_real_data
dump s_c_string_data 
 
dump i_return_value
#  -------------------------------------------------------------------
 
db_get_client_data
()
#  Purpose          :  This file gives an example of a call to the 
#                      function db_get_client_data()
#                      
#                      This function gets client data entity 
#                      from the   client defined entity
#                      in the database. A table is provided in the 
#                      database which is reserved for the use by user.
#                      The db_create_client_data() function writes the 
#                      information to this table.The function db_get 
#                      _client_data() gets the client  data entity 
#                      given the client label.For this first a client
#                      data entity is created and then it is read  
#                      using the function db_get_client_data().
#
#                      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 db_get_all_client_data has the following arguments:
#  db_get_client_data
#     ( client_label, 
#       id,
#       client_type,
#       num_logicals,
#       num_integers,
#       num_reals,
#       num_strings,
#       max_string_length )
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
# variable declaration for data creation.
INTEGER  i_id, i_num_logicals, i_num_integers, i_num_reals,    @
         i_num_strings, i_max_string_length
INTEGER  i_client_label, i_client_type                         
LOGICAL  l_logical_data(1)= [TRUE]
INTEGER  i_integer_data(1)=[1]
REAL     r_real_data(1)=[202.54]
STRING   s_string_data[25](1)=[“Geometric”]
 
# variable declaration for data checking.
INTEGER  i_c_num_logicals, i_c_num_integers, i_c_num_reals,       @
         i_c_num_strings, i_c_max_string_length,i_c_client_type
 
INTEGER  i_return_value
#  -------------------------------------------------------------------
#  Create a client defined entity in the database.
#
#  i_client_label=101
#  i_client_type=1001
#  i_num_logicals=1
#  i_num_integers=1
#  i_num_reals=1
#  i_num_strings=1
#  i_max_string_length=25
#
 
i_client_label = 101
i_client_type  = 1001
i_num_logicals = 1
i_num_integers = 1
i_num_reals    = 1
i_num_strings  = 1
i_max_string_length = 25
 
 
i_return_value =                                               @
    db_create_client_data                                      @
       ( i_id,                                                 @
         i_client_label,                                       @
         i_client_type,                                        @
         i_num_logicals,                                       @
         i_num_integers,                                       @
         i_num_reals,                                          @
         i_num_strings,                                        @
         i_max_string_length,                                  @
         l_logical_data,                                       @
         i_integer_data,                                       @
         r_real_data,                                          @
         s_string_data )
#
 
dump i_return_value
 
 
i_return_value =                                               @
    db_get_client_data                                         @
       ( i_client_label,                                       @
         i_id,                                                 @
         i_c_client_type,                                      @     
         i_c_num_logicals,                                     @
         i_c_num_integers,                                     @
         i_c_num_reals,                                        @
         i_c_num_strings,                                      @
         i_c_max_string_length )
 
# check for the data got from the function
 
 
dump i_c_client_type
dump i_c_num_logicals
dump i_c_num_integers
dump i_c_num_reals
dump i_c_num_strings
dump i_c_max_string_length
 
dump i_return_value
#  -------------------------------------------------------------------
 
db_get_client_id_by_label
()
#  Purpose          :  This file gives an example of a call to the 
#                      function db_get_client_id_by_label()
#                      
#                      A table is provided in the database which
#                      is reserved for the use by user.
#                      The db_create_client_data() function writes the 
#                      information to this table.The function 
#                      db_get_client_id_by_label() returns the client
#                      id given the client_label.We first create a 
#                      client data entity and then use the function to
#                      get client id.
#
#                      To run this session file,first start
#                      a session of MSC Patran, start a new
#                      database,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The db_get_client_id_by_label has the following arguments:
#  db_get_client_id_by_label
#      ( client_label,
#        id )
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
INTEGER  i_client_label,i_nbr_of_labels
INTEGER  i_id, i_client_type,                                  @
         i_num_logicals, i_num_integers, i_num_reals,          @
         i_num_strings, i_max_string_length
LOGICAL  l_logical_data(1)= [TRUE]
INTEGER  i_integer_data(1)=[1]
REAL     r_real_data(1)=[202.54]
STRING   s_string_data[25](1)=[“Geometric”]
 
# variable to check the id.
INTEGER  i_c_id
INTEGER  i_return_value
 
#  -------------------------------------------------------------------
 
#  Create a client defined entity in the database.
#
#  i_client_label=101
#  i_client_type=1001
#  i_num_logicals=1
#  i_num_integers=1
#  i_num_reals=1
#  i_num_strings=1
#  i_max_string_length=1
#
 
i_client_label = 101
i_client_type  = 1001
i_num_logicals = 1
i_num_integers = 1
i_num_reals    = 1
i_num_strings  = 1
i_max_string_length = 1
 
 
i_return_value =                                               @
    db_create_client_data                                      @
       ( i_id,                                                 @
         i_client_label,                                       @
         i_client_type,                                        @
         i_num_logicals,                                       @
         i_num_integers,                                       @
         i_num_reals,                                          @
         i_num_strings,                                        @
         i_max_string_length,                                  @
         l_logical_data,                                       @
         i_integer_data,                                       @
         r_real_data,                                          @
         s_string_data )
 
# check for creation of the client data 
dump i_return_value
 
#  Data type of the client.
 
 
i_return_value =                                               @
    db_get_client_id_by_label                                  @
       ( i_client_label,                                       @
         i_c_id )
 
#
 
dump i_c_id
dump i_return_value
#  -------------------------------------------------------------------
 
db_get_client_label_by_id
()
#  Purpose          :  This file gives an example of a call to the 
#                      function db_get_client_label_by_id()
#                      
#                      A table is provided in the database which
#                      is reserved for the use by user.
#                      The function db_create_client_data() writes the 
#                      information to this table.The function 
#                      db_get_client_label_by_id() returns the client
#                      data given the client id.We first create a
#                      client data entity and then use the function
#                      to get client label.
#
#                      To run this session file,first start
#                      a session of MSC Patran, start a new
#                      database,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The db_get_client_label_by_id  has the following arguments:
#  db_get_client_label_by_id
#      ( id,
#        client_label )
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
INTEGER  i_client_label,i_nbr_of_labels
INTEGER  i_id, i_client_type,                                  @
         i_num_logicals, i_num_integers, i_num_reals,          @
         i_num_strings, i_max_string_length
LOGICAL  l_logical_data(1)= [TRUE]
INTEGER  i_integer_data(1)=[1]
REAL     r_real_data(1)=[202.54]
STRING   s_string_data[25](1)=[“Geometric”]
 
#  Variable Declaration for checking the output.
INTEGER  i_c_client_label,i_return_value
 
#  -------------------------------------------------------------------
 
#  Create a client defined entity in the database.
#
#  i_client_label=101
#  i_client_type=1001
#  i_num_logicals=1
#  i_num_integers=1
#  i_num_reals=1
#  i_num_strings=1
#  i_max_string_length=25
#
 
i_client_label = 101
i_client_type  = 1001
i_num_logicals = 1
i_num_integers = 1
i_num_reals    = 1
i_num_strings  = 1
i_max_string_length = 25
 
 
i_return_value =                                               @
    db_create_client_data                                      @
       ( i_id,                                                 @
         i_client_label,                                       @
         i_client_type,                                        @
         i_num_logicals,                                       @
         i_num_integers,                                       @
         i_num_reals,                                          @
         i_num_strings,                                        @
         i_max_string_length,                                  @
         l_logical_data,                                       @
         i_integer_data,                                       @
         r_real_data,                                          @
         s_string_data )
 
# check for creation of the client data 
dump i_return_value
 
#  Data type of the client.
 
 
i_return_value =                                               @
    db_get_client_label_by_id                                  @
       ( i_id,                                                 @
         i_c_client_label )                                 
 
#
 
dump i_c_client_label
dump i_return_value
#  -------------------------------------------------------------------
 
db_get_client_labels_by_type
()
#  Purpose          :  This file gives an example of a call to the 
#                      function db_get_client_labels_by_type()
#                      
#                      A table is provided in the database which
#                      is reserved for the use by user.
#                      The db_create_client_data() function writes the 
#                      information to this table.The function 
#                      db_get_client_labels_by_type() returns
#                      all the labels with a specified client type.
#
#                      To run this session file,first start
#                      a session of MSC Patran, start a new
#                      database,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The db_get_client_labels_by_type has the following arguments:
#  db_get_client_labels_by_type
#      ( client_type,
#        labels )
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
INTEGER  i_client_type,i_labels(5)
INTEGER  i_id, i_client_label,                                 @
         i_num_logicals, i_num_integers, i_num_reals,          @
         i_num_strings, i_max_string_length
LOGICAL  l_logical_data(1)= [TRUE]
INTEGER  i_integer_data(1)=[1]
REAL     r_real_data(1)=[202.54]
STRING   s_string_data[25](1)=[“Geometric”]
INTEGER  i_return_value
 
#  -------------------------------------------------------------------
 
#  Create a client defined entity in the database.
#
#  i_client_label=101
#  i_client_type=1001
#  i_num_logicals=1
#  i_num_integers=1
#  i_num_reals=1
#  i_num_strings=1
#  i_max_string_length=25
#
 
i_client_label = 101
i_client_type  = 1001
i_num_logicals = 1
i_num_integers = 1
i_num_reals    = 1
i_num_strings  = 1
i_max_string_length = 25
 
 
i_return_value =                                               @
    db_create_client_data                                      @
       ( i_id,                                                 @
         i_client_label,                                       @
         i_client_type,                                        @
         i_num_logicals,                                       @
         i_num_integers,                                       @
         i_num_reals,                                          @
         i_num_strings,                                        @
         i_max_string_length,                                  @
         l_logical_data,                                       @
         i_integer_data,                                       @
         r_real_data,                                          @
         s_string_data )
 
# check for creation of the client data 
dump i_return_value
 
#  Data type of the client.
#  i_client_type=1001
 
 
i_return_value =                                               @
    db_get_client_labels_by_type                               @
       ( i_client_type,                                        @
         i_labels )
 
#
 
dump i_labels
dump i_return_value
 
# create another client data  with same client_type but different
# client label and check for the labels.
 
#  i_client_label = 102
i_client_label = 102
 
 
 
i_return_value =                                               @
    db_create_client_data                                      @
       ( i_id,                                                 @
         i_client_label,                                       @
         i_client_type,                                        @
         i_num_logicals,                                       @
         i_num_integers,                                       @
         i_num_reals,                                          @
         i_num_strings,                                        @
         i_max_string_length,                                  @
         l_logical_data,                                       @
         i_integer_data,                                       @
         r_real_data,                                          @
         s_string_data )
 
# check for creation of the client data 
dump i_return_value
 
# check for the no of created labels.In this example 
#  two labels are created.
 
i_return_value =                                               @
    db_get_client_labels_by_type                               @
       ( i_client_type,                                        @
         i_labels )
 
# check for the no of labels created 
dump i_labels
dump i_return_value
#  -------------------------------------------------------------------
 
db_get_db_version
()
 
#  Purpose          :  This file gives an example of a call to the 
#                      function db_get_db_version()
#                      
#                      This function retrives the database version
#
#                      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 db_get_db_version has the following arguments:
#  db_get_db_version
#       ( db_ver )
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
INTEGER  i_return_value
STRING   s_db_ver[25]
 
#  -------------------------------------------------------------------
 
i_return_value =                                               @
    db_get_db_version                                          @
       ( s_db_ver ) 
 
dump i_return_value
dump s_db_ver
 
#  -------------------------------------------------------------------
 
db_get_general_field
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_general_field()
#
#                      This function returns the term_field_ids,
#                      term_function_types and field_datas from the 
#                      field forms, after supplying the field_id,
#                      term_id and the length of the field data.
#                      It returns a positive integer indicating the
#                      status of the execution of the 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 db_get_general_field()
#  has the following arguments:
#
#  db_get_general_field
#     (  field_id,
#        count,
#        term_id,
#        field_data_length,
#        term_field_id,
#        term_function_type,
#        field_data  )
#
#---------------------------------------------------------------------
#  Variable Declarations
 
      INTEGER fem_create_mesh_surfa_num_nodes
      INTEGER fem_create_mesh_surfa_num_elems
      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 int_status=5, int_field_id, int_count
      INTEGER int_term_id(virtual), int_field_data_length(virtual)
      INTEGER int_term_field_id, int_term_function_type
      STRING  str_field_data[64]
      STRING  str_field[10] = "field_1"
      
#----------------------------------------------------------------------
#  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" )
#---------------------------------------------------------------------
# Create Geometric entities
 
      int_status = asm_const_patch_xyz                       @
                    ( "1", "<2 5 0>", "[0 0 0]", "Coord 0",  @
                     asm_create_patch_xy_created_ids )
 
dump int_status
#---------------------------------------------------------------------
# Create Finite Element entities 
# 219 Nodes IDS = 1:219 
# 60 Elements IDS = 1:60
 
      ui_exec_function( "mesh_seed_display_mgr", "init" )
      mesh_seed_create( "Surface 1.2 1.4 ", 1, 4, 0., 0., 0. )
      mesh_seed_create( "Surface 1.1 1.3 ", 1, 15, 0., 0., 0. )
 
      int_status = fem_create_mesh_surf_3                    @
                     ( "IsoMesh", 0, "Surface 1 ", 1,        @
		       ["0.1"], "Quad8", "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 int_status
mesh_seed_display_mgr.erase(  )
#---------------------------------------------------------------------
#  Create a Field - 'field_1'
 
      int_status = fields_create_general                     @
                       ( "field_1",                          @
                       0, 5, 2, "Real", "Coord 0",           @
		       "", 3, 1, 2, 15 )
dump int_status
 
      int_status = fields_create_general_term                @
                      ( "field_1",                           @
		        0, 0, 0, 30,                         @
			" [  (  'X  +  'Y  )  *  'RAD ]" )
dump int_status
#---------------------------------------------------------------------
#  Getting the field_id for the field - 'field_1'
 
       int_status = db_get_field_id(str_field,int_field_id)
 
dump int_status
#---------------------------------------------------------------------
#  Getting the int_count for the filed_id  = 1
        int_status = db_count_general_field                  @
                       (int_field_id, int_count)
 
dump int_status
#---------------------------------------------------------------------
#  Getting term_ids and the field_data_lengths from the field_id
#     and the count
 
      sys_allocate_array(int_term_id , 1, int_count)
      sys_allocate_array(int_field_data_length , 1, int_count)
 
 
      int_status = db_get_general_field_length               @
                   (int_field_id,                            @
		    int_count,                               @
		    int_term_id,                             @
		    int_field_data_length  )
#---------------------------------------------------------------------
#  Getting the term_field_ids, term function type and field data
#  using the function db_get_general_field().
#  This function needs to be executed for each value of int_count
#  obtained from function db_count_general_field()
      int_status =  db_get_general_field(                    @
                        int_field_id,                        @
			int_term_id(int_count),              @
			int_field_data_length(int_count),    @
			int_term_field_id,                   @
                        int_term_function_type,              @
			str_field_data)
 
dump int_status, int_field_id, int_term_id
dump int_field_data_length,  int_term_field_id
dump int_term_function_type,  str_field_data
#---------------------------------------------------------------------
#  Closing the file - new.db
 
      uil_file_close.goquit()
     
#---------------------------------------------------------------------
#  End of File.
 
db_get_general_field_length
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_general_field_length()
#
#                      This function returns the term_ids and 
#                      field_data_lengths of the field_id from which 
#                      the length of field is required. It returns 
#                      a positive integer indicating the status of 
#                      the execution of the function, 0 for success.
#
#                      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_general_field_length()
#  has the following arguments:
#
#  db_get_general_field_length
#     (  field_id,
#        count,
#        term_id,
#        field_data_length  )
#
#---------------------------------------------------------------------
#  Variable Declarations
 
      INTEGER fem_create_mesh_surfa_num_nodes
      INTEGER fem_create_mesh_surfa_num_elems
      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 int_status=5, int_field_id, int_count
      INTEGER int_term_id(virtual), int_field_data_length(virtual)
      STRING str_field[10] = "field_1"
 
 
#----------------------------------------------------------------------
#  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" )
#---------------------------------------------------------------------
# Create Geometric entities
 
      int_status = asm_const_patch_xyz                       @
                    ( "1", "<2 5 0>", "[0 0 0]", "Coord 0",  @
                     asm_create_patch_xy_created_ids )
 
dump int_status
#---------------------------------------------------------------------
# Create Finite Element entities 
# 219 Nodes IDS = 1:219 
# 60 Elements IDS = 1:60
 
      ui_exec_function( "mesh_seed_display_mgr", "init" )
      mesh_seed_create( "Surface 1.2 1.4 ", 1, 4, 0., 0., 0. )
      mesh_seed_create( "Surface 1.1 1.3 ", 1, 15, 0., 0., 0. )
 
      int_status = fem_create_mesh_surf_3                    @
                     ( "IsoMesh", 0, "Surface 1 ", 1,        @
		       ["0.1"], "Quad8", "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 int_status
mesh_seed_display_mgr.erase(  )
#---------------------------------------------------------------------
#  Create a Field - 'field_1'
 
      int_status = fields_create_general                     @
                       ( "field_1",                          @
                       0, 5, 2, "Real", "Coord 0",           @
		       "", 3, 1, 2, 15 )
 
dump int_status
 
      int_status = fields_create_general_term                @
                      ( "field_1",                           @
		        0, 0, 0, 30,                         @
			" [  (  'X  +  'Y  )  *  'RAD ]" )
 
dump int_status
#---------------------------------------------------------------------
#  Getting the field_id for the field - 'field_1'
 
       int_status = db_get_field_id(str_field,int_field_id)
 
#---------------------------------------------------------------------
#
        int_status = db_count_general_field                  @
                       (int_field_id, int_count)
 
#---------------------------------------------------------------------
#  Using the function db_get_general_field_length() to get
#     term_ids and the field_data_lengths from the field_id
#     and the count
 
      sys_allocate_array(int_term_id , 1, int_count)
      sys_allocate_array(int_field_data_length , 1, int_count)
 
 
      int_status = db_get_general_field_length               @
                   (int_field_id,                            @
		    int_count,                               @
		    int_term_id,                             @
		    int_field_data_length  )
 
dump int_status, int_field_id, int_count
dump int_term_id, int_field_data_length
#---------------------------------------------------------------------
#  Closing the file - new.db
 
      uil_file_close.goquit()
     
#---------------------------------------------------------------------
 
db_get_model_file_suffix
()
#  Purpose          :  This file gives an example of a call to the 
#                      function db_get_model_file_suffix()
#                      This function gives the suffix associated with
#                      the named analysis code.                      
#
#                      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 db_create_client_data has the following arguments:
#  db_get_model_file_suffix
#       ( name,
#         suffix )
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
STRING   s_name[32]=”MSC.Nastran”
STRING   s_suffix[8]
INTEGER  i_return_value
 
#  -------------------------------------------------------------------
 
i_return_value =                                                 @
    db_get_model_file_suffix                                     @
       ( s_name,                                                 @
         s_suffix )
 
dump i_return_value
# check the suffix of model file associated with analysis code
#  ‘MSC.Nastran’
dump s_suffix
#  -------------------------------------------------------------------
 
db_get_next_client_entity_label
()
#  Purpose          :  This file gives an example of a call to the 
#                      function db_get_next_client_entity_label()
#                      
#                      A table is provided in the database which
#                      is reserved for the use by user.
#                      The db_create_client_data() function writes the 
#                      information to this table.The function 
#                      db_get_next_client_entity_label() returns
#                      the largest client entity label from the 
#                      database.
#
#                      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 db_get_next_client_entity_label  has the following arguments:
#  db_get_next_client_entity_label
#      ( label )
#                         
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
INTEGER  i_client_type,i_label
INTEGER  i_id, i_client_type,                                  @
         i_num_logicals, i_num_integers, i_num_reals,          @
         i_num_strings, i_max_ng_length
LOGICAL  l_logical_data(1)= [TRUE]
INTEGER  i_integer_data(1)=[1]
REAL     r_real_data(1)=[202.54]
STRING   s_string_data[25](1)=[“Geometric”]
INTEGER  i_return_value
 
#  -------------------------------------------------------------------
 
 
#  Create a client defined entity in the database.
#
#  i_client_label=101
#  i_client_type=1001
#  i_num_logicals=1
#  i_num_integers=1
#  i_num_reals=1
#  i_num_strings=1
#  i_max_string_length=25
#
 
i_client_label = 101
i_client_type  = 1001
i_num_logicals = 1
i_num_integers = 1
i_num_reals    = 1
i_num_strings  = 1
i_max_string_length = 25
 
 
i_return_value =                                               @
    db_create_client_data                                      @
       ( i_id,                                                 @
         i_client_label,                                       @
         i_client_type,                                        @
         i_num_logicals,                                       @
         i_num_integers,                                       @
         i_num_reals,                                          @
         i_num_strings,                                        @
         i_max_string_length,                                  @
         l_logical_data,                                       @
         i_integer_data,                                       @
         r_real_data,                                          @
         s_string_data )
 
# check for creation of the client data 
dump i_return_value
 
#  Data type of the client.
#  i_client_type=1001
 
 
i_return_value =                                               @
    db_get_next_client_entity_label                            @
         ( i_label )
 
#
 
dump i_label
dump i_return_value
 
# create another client data  with same client_type but different
# client label and check for the largest client entity label.
 
#  i_client_label = 102
i_client_label = 102
 
 
 
i_return_value =                                               @
    db_create_client_data                                      @
       ( i_id,                                                 @
         i_client_label,                                       @
         i_client_type,                                        @
         i_num_logicals,                                       @
         i_num_integers,                                       @
         i_num_reals,                                          @
         i_num_strings,                                        @
         i_max_string_length,                                  @
         l_logical_data,                                       @
         i_integer_data,                                       @
         r_real_data,                                          @
         s_string_data )
 
# check for creation of the client data 
dump i_return_value
 
# check for the no of created labels.In this example 
i_return_value =                                               @
    db_get_next_client_entity_label                            @
       ( i_label ) 
 
# check for the largest label created 
dump i_label
dump i_return_value
 
#  -------------------------------------------------------------------