Tutorial Toolkit Code Examples > Loads and Boundary Conditions > 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_bulk_get_lbc_ds
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_bulk_get_lbc_ds()
#
#                      This function fetches unevaluated dynamic
#                      scalar lbc data attached to specified lbc
#
#                      In this example the spool database is opened.
#                      A transient load case(“trans_lc”) is then
#                      created and made as current load case. Then a
#                      non-spatial field(“trans_field”) is created.
#                      LBC(“trans_pressure”) of type pressure is
#                      created using “trans_field”. Then this
#                      function is called to evaluate dynamic scalar
#                      data of “trans_pressure”.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_bulk_get_lbc_ds()
#  has the following arguments:
#
#  db_bulk_get_lbc_ds
#    ( lbc_id,
#      max,
#      num_dyn_scalar,
#      data_id,
#      scalar_data_values,
#      sc_position,
#      sc_dyn,
#      scale_factor )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_lbc_id
INTEGER  i_max
INTEGER  i_num_dyn_scalar
INTEGER  ia_data_id(10)
REAL     ra_scalar_data_values(10)
INTEGER  ia_sc_position(10)
INTEGER  ia_sc_dyn(10)
REAL     ra_scale_factor(10)
INTEGER  i_return_value
INTEGER  ia_prior(4)
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Maximum number of dynamic scalar records
i_max = 10
 
#  Create load case “trans_lc”
i_return_value =                                                 @
   loadcase_create                                               @
      (  “trans_lc”,                                             @
         “Time Dependent”,                                       @
         ““,                                                     @
         [““],                                                   @
         ia_prior,                                               @
         ““,                                                     @
         0.,                                                     @
         TRUE )
dump i_return_value
 
#  Create field “trans_field”
i_return_value =                                                 @
   fields_create( “trans_field”, “Non-Spatial”, 1, “Scalar”,     @
                  “Real”, ““, ““, “Table”, 1, “t”, ““, ““, ““,   @
                  ““, ““, FALSE, [0., 1., 2., 3., 4., 5., 6.,    @
                  7., 8., 9., 10., 11., 12., 13., 14., 15., 16., @
                  17., 18., 19., 20.], [0.], [0.], [[[0.]]       @
                  [[10.]][[20.]][[30.]][[40.]][[50.]][[60.]]     @
                  [[70.]][[80.]][[90.]][[100.]][[110.]][[120.]]  @
                  [[130.]][[140.]][[150.]][[160.]][[170.]]       @
                  [[180.]][[190.]][[200.]] ] )
dump i_return_value
 
#  Created Load/BC set “trans_pressure”
i_return_value =                                                 @
   loadsbcs_create                                               @
      (  “trans_pressure”,                                       @
         “Pressure”,                                             @
         “Element Uniform”,                                      @
         “2D”,                                                   @
         “Time Dependent”,                                       @
         [“Surface 4”],                                          @
         “Geometry”,                                             @
         ““,                                                     @
         1.,                                                     @
         [“ 10”, “ 0”, “ 0”],                                    @
         [“f:trans_field”, ““, ““] )
dump i_return_value
 
#  Get the lbc id associated with “trans_pressure”
i_return_value =                                                 @
   db_get_lbc_id                                                 @
      (  “trans_pressure”,                                       @
         i_lbc_id )
dump i_return_value
 
#  Fetch unevaluated dynamic scalar lbc data attached to
#  “trans_pressure”
i_return_value =                                                 @
   db_bulk_get_lbc_ds                                            @
      (  i_lbc_id,                                               @
         i_max,                                                  @
         i_num_dyn_scalar,                                       @
         ia_data_id,                                             @
         ra_scalar_data_values,                                  @
         ia_sc_position,                                         @
         ia_sc_dyn,                                              @
         ra_scale_factor )
dump i_return_value
dump i_lbc_id
dump i_max
dump i_num_dyn_scalar
dump ia_data_id
dump ra_scalar_data_values
dump ia_sc_position
dump ia_sc_dyn
dump ra_scale_factor
#---------------------------------------------------------------------
#  Note the following regarding the output values.
#
#  1. LBC  5(“trans_pressure”) having a field id = 2 in ia_sc_dyn
#     as it is composed of time dependent field “trans_field”
#     (field_id =  2)
#
#  2. ia_data_id consisting of values 1 and 2 indicating top and
#     bottom pressure variable-id respectively.
#
#  Refer chapter 9.0 in MSC Patran User Manual - Part 9 (Vol. 4)
#  for more details
#---------------------------------------------------------------------
db_bulk_get_lbc_dv
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_bulk_get_lbc_dv()
#
#                      This function fetches unevaluated dynamic
#                      vector lbc data attached to specified lbc
#
#                      In this example the spool database is opened.
#                      A transient load case(“trans_lc”) is created
#                      and made as current load case. Then a
#                      non-spatial field(“trans_field”) is created.
#                      LBC(“trans_force”) of type force is created 
#                      using “trans_field”. Then this function is
#                      called to evaluate dynamic vector data of 
#                      “trans_force”.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_bulk_get_lbc_dv()
#  has the following arguments:
#
#  db_bulk_get_lbc_dv
#    ( lbc_id,
#      max,
#      num_dyn_vec,
#      data_id,
#      vec_data_values,
#      vec_position,
#      vec_dyn,
#      null_flag,
#      scale_factor )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_lbc_id
INTEGER  i_max
INTEGER  i_num_dyn_vec
INTEGER  ia_data_id(10)
REAL     raa_vec_data_values(10,3)
INTEGER  iaa_vec_position(10,3)
INTEGER  iaa_vec_dyn(10,3)
INTEGER  iaa_null_flag(10,3)
REAL     ra_scale_factor(10)
INTEGER  i_return_value
INTEGER  ia_prior(4)
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Maximum number of dynamic scalar records
i_max = 10
 
#  Create load case “trans_lc”
i_return_value =                                                 @
   loadcase_create                                               @
      (  “trans_lc”,                                             @
         “Time Dependent”,                                       @
         ““,                                                     @
         [““],                                                   @
         ia_prior,                                               @
         ““,                                                     @
         0.,                                                     @
         TRUE )
dump i_return_value
 
#  Create field “trans_field”
i_return_value =                                                 @
   fields_create( “trans_field”, “Non-Spatial”, 1, “Scalar”,     @
                  “Real”, ““, ““, “Table”, 1, “t”, ““, ““, ““,   @
                  ““, ““, FALSE, [0., 1., 2., 3., 4., 5., 6.,    @
                  7., 8., 9., 10., 11., 12., 13., 14., 15., 16., @
                  17., 18., 19., 20.], [0.], [0.], [[[0.]]       @
                  [[10.]][[20.]][[30.]][[40.]][[50.]][[60.]]     @
                  [[70.]][[80.]][[90.]][[100.]][[110.]][[120.]]  @
                  [[130.]][[140.]][[150.]][[160.]][[170.]]       @
                  [[180.]][[190.]][[200.]] ] )
dump i_return_value
 
#  Create Load/BC set “trans_force”
i_return_value =                                                 @
   loadsbcs_create                                               @
      (  “trans_force”,                                          @
         “Force”,                                                @
         “Nodal”,                                                @
         ““,                                                     @
         “Time Dependent”,                                       @
         [ “Point 8”],                                           @
         “Geometry”,                                             @
         “Coord 0”,                                              @
         1.,                                                     @
         [“<0 -1 0     >”, “<  0 0 0   >”],                      @
         [ “f:trans_field”, ““] )
dump i_return_value
 
#  Get the lbc id associated with “trans_force”
i_return_value =                                                 @
   db_get_lbc_id                                                 @
      (  “trans_force”,                                          @
         i_lbc_id )
dump i_return_value
 
#  Fetch unevaluated dynamic vector lbc data attached to
#  “trans_force”
i_return_value =                                                 @
   db_bulk_get_lbc_dv                                            @
      (  i_lbc_id,                                               @
         i_max,                                                  @
         i_num_dyn_vec,                                          @
         ia_data_id,                                             @
         raa_vec_data_values,                                    @
         iaa_vec_position,                                       @
         iaa_vec_dyn,                                            @
         iaa_null_flag,                                          @
         ra_scale_factor )
dump i_return_value
dump i_lbc_id
dump i_max
dump i_num_dyn_vec
dump ia_data_id
dump raa_vec_data_values
dump iaa_vec_position
dump iaa_vec_dyn
dump ra_scale_factor
#---------------------------------------------------------------------
#  Note the following regarding the output values.
#
#  1. LBC  5(“trans_force”) having a field id = 2 in iaa_vec_dyn
#     as it is composed of time dependent field “trans_field”
#     (field_id =  2)
#
#  2. ia_data_id consisting of values 1 and 2 indicating linear force
#     and moment variable-id respectively.
#
#  Refer chapter 9.0 in MSC Patran User Manual - Part 9 (Vol. 4)
#  for more details
#---------------------------------------------------------------------
db_bulk_get_lbc_ss
()
#  Purpose          :  This file provides an example of multiple calls
#                      to the function db_bulk_get_lbc_ss()
#
#                      This function fetches unevaluated static scalar
#                      lbc data attached to specified lbc
#
#                      In this example the spool database is opened
#                      and this function is called to get unevaluated
#                      static scalar lbc data for all the lbcs.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_bulk_get_lbc_ss()
#  has the following arguments:
#
#  db_bulk_get_lbc_ss
#    ( lbc_id,
#      max,
#      num_stat_scalar,
#      data_id,
#      scalar_data_values,
#      sc_position,
#      scale_factor )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_lbc_id
INTEGER  i_max
INTEGER  i_num_stat_scalar
INTEGER  ia_data_id(10)
REAL     ra_scalar_data_values(10)
INTEGER  ia_sc_position(10)
REAL     ra_scale_factor(10)
INTEGER  i_return_value
INTEGER  i_count
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
# Maximum number of static records passed
i_max = 10
 
#  Fetch unevaluated static scalar lbc data
FOR ( i_lbc_id = 1 TO 4 )
   i_return_value =                                  @
      db_bulk_get_lbc_ss                             @
         (  i_lbc_id,                                @
            i_max,                                   @
            i_num_stat_scalar,                       @
            ia_data_id,                              @
            ra_scalar_data_values,                   @
            ia_sc_position,                          @
            ra_scale_factor )
   dump i_return_value
   dump i_lbc_id
   dump i_num_stat_scalar
   dump ia_data_id
   dump ra_scalar_data_values
   dump ia_sc_position
   dump ra_scale_factor
   FOR ( i_count = 1 TO 10 )
      ia_data_id ( i_count ) = 0
      ra_scalar_data_values ( i_count ) = 0
      ia_sc_position ( i_count ) = 0
      ra_scale_factor ( i_count ) = 0
   END FOR 
END FOR
#---------------------------------------------------------------------
#  Note the following regarding the output values.
#
#  1. LBC  1(“fillet_pressure”) having a field id in variable
#     ia_sc_position, as it is composed of field 
#     “400_20_psi_transition” and ia_data_id = 2 representing
#      bottom pressure.
#
#  2. LBCs 2(“400_psi”) and 3(“20_psi”) containing values in
#     ra_scalar_data_values
#
#  3. LBC  4(“TZ_fixed”) having all entries zero as it is a vector
#     quantity
#
#  Refer chapter 9.0 in MSC Patran User Manual - Part 9 (Vol. 4)
#  for more details
#---------------------------------------------------------------------
db_bulk_get_lbc_sv
()
#  Purpose          :  This file provides an example of two calls 
#                      to the function db_bulk_get_lbc_sv()
#
#                      This function fetches unevaluated static vector
#                      lbc data attached to specified lbc
#
#                      In this example the spool database is opened
#                      and this function is called to get unevaluated
#                      static vector lbc data for all the lbcs.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_bulk_get_lbc_sv()
#  has the following arguments:
#
#  db_bulk_get_lbc_sv
#    ( lbc_id,
#      max,
#      num_stat_vec,
#      data_id,
#      vec_data_values,
#      vec_position,
#      vec_dyn,
#      scale_factor )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_lbc_id
INTEGER  i_max
INTEGER  i_num_stat_vec
INTEGER  ia_data_id(10)
REAL     raa_vec_data_values(10,3)
INTEGER  iaa_vec_position(10,3)
INTEGER  ia_vec_dyn(10,3)
REAL     ra_scale_factor(10)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
# Maximum number of static records passed
i_max = 10
 
#  Fetch unevaluated static vector lbc data
FOR ( i_lbc_id = 3 TO 4 )
   i_return_value =                                  @
      db_bulk_get_lbc_sv                             @
         (  i_lbc_id,                                @
            i_max,                                   @
            i_num_stat_vec,                          @
            ia_data_id,                              @
            raa_vec_data_values,                     @
            iaa_vec_position,                        @
            ia_vec_dyn,                              @
            ra_scale_factor )
   dump i_return_value
   dump i_lbc_id
   dump i_num_stat_vec
   dump ia_data_id
   dump raa_vec_data_values
   dump iaa_vec_position
   dump ia_vec_dyn
   dump ra_scale_factor
END FOR
#---------------------------------------------------------------------
#  Note the following regarding the output values.
#
#  1. LBCs 3(“20_psi”) have all entries zero as they are scalars.
#
#  2. LBC  4(“TZ_fixed”) have ia_data_id = 1,2 representing 
#     translation vector and rotation vector respectively.
#     “raa_vec_data_values” consist of zeroes as spool is 
#     constrained in all degrees of freedom at Point 7.
#
#  Refer chapter 9.0 in MSC Patran User Manual - Part 9 (Vol. 4)
#  for more details
#---------------------------------------------------------------------
db_count_appl_geo_region
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_count_appl_geo_region()
#
#                      This function gets the number of application 
#                      region stored in the database by lbc_type_id
#                      
#                      In this example a new database is opened and
#                      number of application region for Pressure is
#                      obtained.
#
#                      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_appl_geo_region()
#  has the following arguments:
#
#  db_count_appl_geo_region
#    ( lbc_type_id,
#      count )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_lbc_type_id
INTEGER  i_count
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Pressure lbc_type_id
i_lbc_type_id = 8
 
# Get the number of application geometric region for Pressure 
i_return_value =                                  @
   db_count_appl_geo_region                       @
   ( i_lbc_type_id,                               @
     i_count )
dump i_return_value
dump i_count
#---------------------------------------------------------------------
 
db_count_lbc
()
#  Purpose          :  This file provides an example of 2 calls to the
#                      function db_count_lbc()
#
#                      This function gets the number of lbcs stored
#                      in the database.
#
#                      In this example the spool database is opened
#                      and the number of lbcs are verified before and
#                      after deleting the lbc,”400_psi” using this
#                      function.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_count_lbc() has the following arguments:
#
#  db_count_lbc
#    ( count ),
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_count
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Get number of lbcs
i_return_value =                                  @
   db_count_lbc                                   @
   ( i_count )
dump i_return_value
dump i_count
 
#---------------------------------------------------------------------
#  Follow the instructions below to display Loads/BCs in the graphic
#  Window.
#  Pick “Display”,”Load/BC/Elem Props..” from pull-down menus
#  Select “Show All” below Loads/BCs and “Apply”
#---------------------------------------------------------------------
#  Session file paused. Press “Resume” to continue..
sf_pause()
#---------------------------------------------------------------------
#  Delete lbc
i_return_value =                                  @
   loadsbcs_delete                                @
   ( [“400_psi”] )
 
#  Get number of lbcs
i_return_value =                                  @
   db_count_lbc                                   @
   ( i_count )
dump i_return_value
dump i_count
 
#  It can be observed that number of lbcs decreased by one due to
#  deletion
#---------------------------------------------------------------------
 
db_count_lbc_appl_region_entity
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_count_lbc_appl_region_entity()
#
#                      This function gets the count of entity in each
#                      application region and their ids for a
#                      specified lbc.
#
#                      In this example, the spool database is first 
#                      opened. Then the ids and number of entities in
#                      each application region  associated with  lbc,
#                      “400_psi” are obtained.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_count_lbc_appl_region_entity()
#  has the following arguments:
#
#  db_count_lbc_appl_region_entity
#    ( lbc_id,
#      app_reg_id,
#      count )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_lbc_id
INTEGER  ia_app_reg_id(2)
INTEGER  ia_count(2)
INTEGER  i_return_value
 
STRING   s_geo_str[16]
STRING   sv_app_list[VIRTUAL]
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  i_lbc_id = 2 for Pressure “400_psi”
i_lbc_id = 2
 
#  Get the number of entities in each application regions
i_return_value =                                     @
   db_count_lbc_appl_region_entity                   @
   ( i_lbc_id,                                       @
     ia_app_reg_id,                                  @
     ia_count )
dump i_return_value
dump ia_app_reg_id
dump ia_count
 
#  Get the application region entities details
i_return_value =                                     @
   loadsbcs_get_appl_region_list                     @
   ( i_lbc_id,                                       @ 
     ia_app_reg_id(1),                               @
     ia_count(1),                                    @ 
     s_geo_str,                                      @
     sv_app_list )
dump i_return_value
dump s_geo_str
dump sv_app_list
 
#  Free memory
sys_free_string ( sv_app_list )
#---------------------------------------------------------------------
db_count_lbc_types
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_count_lbc_types()
#
#                      This function gets the total number of distinct
#                      lbc types in the database.
#
#                      In this example a new database is opened and
#                      total number of distinct lbc types in the
#                      database is obtained.
#
#                      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_lbc_types()
#  has the following arguments:
#
#  db_count_lbc_types
#    ( num_of_lbc_type_ids ),
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_num_of_lbc_type_ids
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Get the total number of distinct lbc types in the database
i_return_value =                                  @
   db_count_lbc_types                             @
   ( i_num_of_lbc_type_ids )
dump i_return_value
dump i_num_of_lbc_type_ids
#---------------------------------------------------------------------
db_count_load_cases_with_lbc
()
#  Purpose          :  This file provides an example of multiple calls
#                      to the function db_count_load_cases_with_lbc()
#
#                      This function gets the number of load cases
#                      associated with lbc.
#
#                      In this example the spool database is opened 
#                      and a new load case,”new_lc” is created with 
#                      lbcs “fillet_pressure” and “400_psi”. Then the 
#                      number of load cases associated with each lbc 
#                      is verified.
#
#                      The given are the details of Load/BCs
#
#                         Load/BC name       ids  Associated load
#                                                 cases
#
#                         fillet_pressure     1   default,
#                                                 spool_loads,
#
#                         400_psi             2   default,
#                                                 spool_loads,
#
#                         20_psi              3   default,
#                                                 spool_loads
#                                                 new_lc
#
#                         TZ_fixed            4   default,
#                                                 spool_loads
#                                                 new_lc
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_count_load_cases_with_lbc()
#  has the following arguments:
#
#  db_count_load_cases_with_lbc
#    ( lbc_id,
#      num_load_cases )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_lbc_id
INTEGER  i_num_load_cases
INTEGER  i_return_value
 
INTEGER  i_prior(4)
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Create load case “new_lc”
i_return_value =                                  @
   loadcase_create                                @
   ( “new_lc”,                                    @
     “Static”,                                    @
     ““,                                          @
     [“TZ_fixed”, “20_psi”],                      @
     i_prior,                                     @
     ““,                                          @
     0.,                                          @
     FALSE )
dump i_return_value
 
#  Get the number of load case associated with lbcs
FOR ( i_lbc_id = 1 TO 4 )
   i_return_value =                               @
      db_count_load_cases_with_lbc                @
      ( i_lbc_id,                                 @
        i_num_load_cases )
   dump i_return_value
   dump i_lbc_id
   dump i_num_load_cases
END FOR
#---------------------------------------------------------------------
 
db_count_loads_for_element
()
#  Purpose          :  This file provides an example of multiple calls
#                      to the function db_count_loads_for_element()
#
#                      This function gets the number of loads and
#                      boundary conditions for an element.
#
#                      In this example the spool database is opened
#                      and a new lbc, “new_press” is created on
#                      elements from 56 to 60. Then the number of lbcs
#                      for elements from 51 to 60 is obtained.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_count_loads_for_element()
#  has the following arguments:
#
#  db_count_loads_for_element
#    ( elem_id,
#      num_lbc_associated )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_elem_id
INTEGER  i_num_lbc_associated
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Post group “fem_model”
uil_viewport_post_groups.posted_groups            @
   ( “default_viewport”,                          @
     1,                                           @
     [“fem_model”] )
 
#---------------------------------------------------------------------
#  Follow the instructions below to display Loads/BCs in the graphic
#  Window.
#  Pick “Display”,”Load/BC/Elem Props..” from pull-down menus
#  Select “Show All” below Loads/BCs and “Apply”
#  Ignore warnings if any.
#---------------------------------------------------------------------
#  Session file paused. Press “Resume” to continue..
sf_pause()
#---------------------------------------------------------------------
 
#  Display shaded model
uil_toolbar.shaded_smooth()
 
#  Create new lbc “new_press”
i_return_value =                                  @
   loadsbcs_create                                @
   ( “new_press”,                                 @
     “Pressure”,                                  @
     “Element Uniform”,                           @
     “2D”,                                        @
     “Static”,                                    @
     [“Element 56:60”],                           @
     “FEM”,                                       @
     ““,                                          @
     1.,                                          @
     [“ 0”, “ 200”,” 0”],                         @
     [““, ““, ““] )
dump i_return_value
 
#  Get the number of loads and boundary conditions for elements
#  with ids 51 to 55
FOR ( i_elem_id = 51 to 55 )
i_return_value =                                  @
   db_count_loads_for_element                     @
   ( i_elem_id,                                   @
     i_num_lbc_associated )
dump i_return_value
dump i_num_lbc_associated
END FOR
 
#  Get the number of loads and boundary conditions for elements
#  with ids 56 to 60
FOR ( i_elem_id = 56 to 60 )
i_return_value =                                  @
   db_count_loads_for_element                     @
   ( i_elem_id,                                   @
     i_num_lbc_associated )
dump i_return_value
dump i_num_lbc_associated
END FOR
 
#  It can be observed that elements from 56 to 60 having an lbc
#  associated with them.
#---------------------------------------------------------------------
db_delete_lbc
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_delete_lbc()
#
#                      In this example the number of lbcs are
#                      verified before and after deleting the lbc
#                      “400_psi”(lbc_id = 2) from database.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_delete_lbc()
#  has the following arguments:
#
#  db_delete_lbc
#    ( lbc_id ),
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_lbc_id
INTEGER  i_return_value
INTEGER  i_count
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Get number of lbcs
i_return_value = db_count_lbc ( i_count )
dump i_return_value
dump i_count
 
#  Delete lbc from database
#  Load “400_psi”
i_lbc_id = 2
i_return_value =                                  @
   db_delete_lbc                                  @
   ( i_lbc_id )
dump i_return_value
 
#  Get number of lbcs
i_return_value = db_count_lbc ( i_count )
dump i_return_value
dump i_count
 
#  It can be observed that number of lbcs decreased by one due to
#  deletion
#---------------------------------------------------------------------
 
db_delete_lbc_defn
()
#  Purpose          :  This function will delete the lbc type 
#                      definition from the database.
#                      This function requires lbc type id as
#                      input argument.
#
#                      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 db_delete_lbc_defn()
#  has the following arguments:
#
#  db_delete_lbc_defn
#     (  INPUT:
#        INTEGER lbc_type_id
#        OUTPUT:
#        INTEGER status
#     ) 
#---------------------------------------------------------------------
# 
#  Opening a new database 
 
     uil_file_new.go("","new.db")
 
#---------------------------------------------------------------------
 
#  Declaring and defining input arguents
 
   INTEGER lbc_type_id = 100
 
#  Declaring output argument
 
   INTEGER status
 
#----------------------------------------------------------------------
 
#  Using the function db_create_lbc_defn() to create the new
#  lbc definition.
 
    db_create_lbc_defn("New_lbc_defn",               @
		       "Displacement",               @
                       1,2,1,                        @
                       1,1,1,                        @
                       2,2,1,                        @
                       1,"","",                      @
                       1,1,1,1,                      @
                       lbc_type_id)
 
#-----------------------------------------------------------------------
 
 
#  Using the Function db_delete_lbc_defn() to delete the 
#  lbc definition created in previous step.
 
  status = db_delete_lbc_defn(lbc_type_id)
 
 
    dump status
 
#---------------------------------------------------------------------
 
#  End of File.
 
#---------------------------------------------------------------------
db_get_all_appl_geo_regions
()
#  Purpose          :  This file provides an example of multiple calls
#                      to the function db_get_all_appl_geo_regions()
#
#                      This function gets all the records in the
#                      LbcAppRegion table, for the specified lbc_id
#                      from the database.
#
#                      In this example the spool database is opened
#                      and list of application region and number of
#                      entities in them are obtained using function,
#                      db_count_lbc_appl_region_entity() for lbc,
#                      “fillet_pressure”. All the records are loaded
#                      in LbcAppRegion table by call to this function.
#                      The records are then read one by one using 
#                      function db_get_next_appl_geo_region().
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_all_appl_geo_regions()
#  has the following arguments:
#
#  db_get_all_appl_geo_regions
#    ( lbc_id ),
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_lbc_id
INTEGER  i_return_value
 
INTEGER  ia_app_reg_id(2)
INTEGER  ia_count(2)
INTEGER  i_index
INTEGER  i_app_reg_id
INTEGER  i_ent_type
INTEGER  i_ent_id
INTEGER  i_ent_sub_id
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  lbc_id for “fillet_pressure”
i_lbc_id = 1
 
#  Gets the number of entities in each application regions
i_return_value =                                  @
   db_count_lbc_appl_region_entity                @
   ( i_lbc_id,                                    @
     ia_app_reg_id,                               @
     ia_count )
dump i_return_value
 
#  Get all the application geometric region for the specified id
i_return_value =                                  @
   db_get_all_appl_geo_regions                    @
   ( i_lbc_id )
dump i_return_value
 
#  Get next record in lbc application region one by one
FOR (i_index = 1 TO ia_count(1))
   i_return_value =                               @
      db_get_next_appl_geo_region                 @
      ( i_app_reg_id,                             @
        i_ent_type,                               @
        i_ent_id,                                 @
        i_ent_sub_id )
   dump i_return_value
 
#  Application region id
dump i_app_reg_id
 
#  Entity type id
dump i_ent_type
 
#  Entity id
dump i_ent_id
 
#  Entity sub id ( if appropriate )
dump i_ent_sub_id
 
END FOR
#---------------------------------------------------------------------
db_get_all_appl_reg_defns
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_all_appl_reg_defns()
#
#                      This function gets all application geometry
#                      region definitions for an lbc type definition 
#                      from the database in get all, get next method.
#
#                      In this example the spool database is opened
#                      and this function is called to load records
#                      into application geometry definition table.
#                      The records are then read one by one using
#                      function db_get_next_appl_reg_defn().
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_all_appl_reg_defns()
#  has the following arguments:
#
#  db_get_all_appl_reg_defns
#    ( lbc_type_id ),
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_lbc_type_id
INTEGER  i_seq_app_reg_id
INTEGER  i_all_status
INTEGER  i_next_status  = 0
STRING   s_label[32]
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Load type id = 8 (for pressure in CHAPTER 9 in MSC Patran
#  USER MANUAL (vol 4))
i_lbc_type_id = 8 
 
#  Get all application geometry region definition for an lbc_type
i_all_status =                                    @
   db_get_all_appl_reg_defns                      @
   ( i_lbc_type_id )
dump i_all_status
 
#  Get next application geometry region definition for an lbc_type
WHILE ( i_next_status == 0 )
   i_next_status =                                @
      db_get_next_appl_reg_defn                   @
      ( i_seq_app_reg_id,                         @
        s_label )
   dump i_next_status
   IF ( i_next_status == 0 ) THEN
      dump i_seq_app_reg_id
      dump s_label
   END IF
END WHILE
#---------------------------------------------------------------------
db_get_all_lbc_names
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_all_lbc_names()
#
#                      This function gets all LBC names and types from
#                      the database in get all, get next method.
#
#                      In this example the spool database is opened
#                      and this function is called to get all LBC
#                      names from database. Then the information about
#                      all the LBCs is retrieved using the function,
#                      db_get_next_lbc_name()
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_all_lbc_names() has no arguments.
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_lbc_id
STRING   s_lbc_name[32]
INTEGER  i_lbc_type_id
INTEGER  i_all_status
INTEGER  i_next_status
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Get all LBC names and types
i_all_status = db_get_all_lbc_names()
dump i_all_status
 
#  Get next lbc name and type from the database
WHILE ( i_next_status == 0 )
   i_next_status =                                   @
      db_get_next_lbc_name                           @
      ( i_lbc_id,                                    @
        s_lbc_name,                                  @
        i_lbc_type_id )
   dump i_next_status
   IF ( i_next_status == 0) THEN
      dump i_lbc_id
      dump s_lbc_name
      dump i_lbc_type_id
   END IF
END WHILE
#---------------------------------------------------------------------
db_get_all_lbc_names_by_type
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_all_lbc_names_by_type()
#
#                      This function gets all LBCs of specified type
#                      from database in get all, get next method.
#
#                      In this example the spool database is opened
#                      and this function is called to get all LBC
#                      names of type “Pressure” from database. Then
#                      the information about each LBC is retrieved 
#                      using the function,
#                      db_get_next_lbc_name_by_type()
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_all_lbc_names_by_type()
#  has the following arguments:
#
#  db_get_all_lbc_names_by_type
#    ( lbc_type_id ),
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_lbc_type_id
INTEGER  i_lbc_id
STRING   s_lbc_name[32]
INTEGER  i_all_status
INTEGER  i_next_status
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Get all lbcs of type “Pressure”
i_lbc_type_id = 8
i_all_status =                                    @
   db_get_all_lbc_names_by_type                   @
   ( i_lbc_type_id )
dump i_all_status
 
#  Get next lbc of type pressure from database
WHILE ( i_next_status == 0 )
   i_next_status =                                @
      db_get_next_lbc_name_by_type                @
      ( i_lbc_id,                                 @
        s_lbc_name )
   dump i_next_status
   IF ( i_next_status == 0 ) THEN
      dump i_lbc_id
      dump s_lbc_name
   END IF
END WHILE
#---------------------------------------------------------------------
db_get_all_lbc_type_defns
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_all_lbc_type_defns()
#
#                      This function gets all lbc type definitions
#                      from the database in get all, get next method.
#
#                      In this example the spool database is opened
#                      and this function is called to load records
#                      into lbc type table. The records are then read
#                      one by one using the function, 
#                      db_get_next_lbc_type_defn()
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_all_lbc_type_defns() has no arguments.
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_internal_lbc_id
STRING   s_lbc_name[32]
INTEGER  i_class_lbc
INTEGER  i_form
INTEGER  i_global_bc
INTEGER  i_flag_alt_cid
INTEGER  i_graphic_symbol
INTEGER  i_sv
INTEGER  i_null_vector
INTEGER  i_num_anal_code
INTEGER  ia_anal_code_ids(15)
INTEGER  i_default_color
INTEGER  i_color_box_id
INTEGER  i_anchor_style
INTEGER  i_all_status
INTEGER  i_next_status = 0
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Get all lbc type definitions from the database
i_all_status = db_get_all_lbc_type_defns()
dump i_all_status
 
#  Get next lbc type definition from the database.
WHILE ( i_next_status == 0 )
   i_next_status =                                   @
      db_get_next_lbc_type_defn                      @
      ( i_internal_lbc_id,                           @
        s_lbc_name,                                  @
        i_class_lbc,                                 @
        i_form,                                      @
        i_global_bc,                                 @
        i_flag_alt_cid,                              @
        i_graphic_symbol,                            @
        i_sv,                                        @
        i_null_vector,                               @
        i_num_anal_code,                             @
        ia_anal_code_ids,                            @
        i_default_color,                             @
        i_color_box_id,                              @
        i_anchor_style )
   dump i_next_status
   IF ( i_next_status == 0 ) THEN
      dump i_internal_lbc_id
      dump s_lbc_name
      dump i_class_lbc
      dump i_form
      dump i_global_bc
      dump i_flag_alt_cid
      dump i_graphic_symbol
      dump i_sv
      dump i_null_vector
      dump i_num_anal_code
      dump ia_anal_code_ids
      dump i_default_color
      dump i_color_box_id
      dump i_anchor_style
   END IF
END WHILE
#---------------------------------------------------------------------
 
db_get_all_lbc_type_names
 
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_all_lbc_type_names()
#
#                      This function gets all the lbc type names from 
#                      database in get all, get next method.
#
#                      In this example the spool database is opened
#                      and this function is called to load all names
#                      of lbc types in lbc type table from database.
#                      Then all the names of lbc types are obtained
#                      using the function,db_get_next_lbc_type_name().
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_all_lbc_type_names() has no arguments.
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_return_value
INTEGER  i_lbc_type_id
STRING   s_lbc_name[32]
INTEGER  i_return_value
INTEGER  i_all_status
INTEGER  i_next_status = 0
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Get all the names of lbc types
i_all_status = db_get_all_lbc_type_names()
dump i_all_status
 
#  Get next lbc type name
WHILE ( i_next_status == 0 )
   i_next_status =                                   @
      db_get_next_lbc_type_name                      @
      ( i_lbc_type_id,                               @
        s_lbc_name )
   dump i_next_status
   IF ( i_next_status == 0 ) THEN
      dump i_lbc_type_id
      dump s_lbc_name
   END IF
END WHILE
#---------------------------------------------------------------------
db_get_all_lbc_var_defns
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_all_lbc_var_defns()
#
#                      This function gets all lbc variables for an
#                      lbc type definition from database in get all,
#                      get next method.
#
#                      In this example the spool database is opened
#                      and this function is called to get all lbc
#                      variables of type “Pressure” from database.
#                      Then variable ids are obtained one by one 
#                      using the function, db_get_next_lbc_var_defn().
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_all_lbc_var_defns()
#  has the following arguments:
#
#  db_get_all_lbc_var_defns
#    ( lbc_type_id ),
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_lbc_type_id
INTEGER  i_category_id
INTEGER  i_elem_dim
INTEGER  i_all_status
INTEGER  i_next_status = 0
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Lbc type id for “Pressure”
i_lbc_type_id = 8
 
#  Get all the lbc variable for lbc type “Pressure”
i_all_status =                                    @
   db_get_all_lbc_var_defns                       @
   ( i_lbc_type_id )
dump i_all_status
 
#  Get the next lbc variable
WHILE ( i_next_status == 0 )
   i_next_status =                                @
      db_get_next_lbc_var_defn                    @
      ( i_category_id,                            @
        i_elem_dim )
   dump i_next_status
   IF ( i_next_status == 0 ) THEN
      dump i_category_id
      dump i_elem_dim
   END IF
END WHILE
#---------------------------------------------------------------------
db_get_all_lbcs_new
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_all_lbcs_new()
#
#                      This function sets up the data required to
#                      retrieve all the information about all the
#                      LBCs in the database.
#
#                      In this example the spool database is opened
#                      and this function is called to retrieve
#                      information about the LBCs in the database.
#                      Then the information about all of the LBCs are
#                      retrieved using the function 
#                      db_get_next_lbcs_new()
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_all_lbcs_new() has no arguments.
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_all_status
INTEGER  i_next_status = 0
INTEGER  i_lbc_struct_id
STRING   s_name[16]
INTEGER  i_lbc_type
INTEGER  i_category
INTEGER  ia_geo_fem(3)
INTEGER  i_alt_coord_frame
INTEGER  i_dyn_stat_flag
REAL     r_scale_factor
INTEGER  ia_targ_elem(3)
INTEGER  i_app_reg_couple
INTEGER  i_app_reg_order
INTEGER  i_equiv_flag
INTEGER  i_ac_mod_flag
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Set up the data required to retrieve all information about LBCs
i_all_status =                                       @
   db_get_all_lbcs_new()
dump i_all_status
 
#  Get the information about LBCs.
WHILE ( i_next_status == 0 )
   i_next_status =                                   @
      db_get_next_lbcs_new                           @
      ( i_lbc_struct_id,                             @
        s_name,                                      @
        i_lbc_type,                                  @
        i_category,                                  @
        ia_targ_elem,                                @
        i_alt_coord_frame,                           @
        i_dyn_stat_flag,                             @
        r_scale_factor,                              @
        ia_geo_fem,                                  @
        i_app_reg_couple,                            @
        i_app_reg_order,                             @
        i_equiv_flag,                                @
        i_ac_mod_flag )
   dump i_next_status
   IF ( i_next_status == 0 ) THEN
      dump i_lbc_struct_id
      dump s_name
      dump i_lbc_type
      dump i_category
      dump ia_targ_elem
      dump i_alt_coord_frame
      dump i_dyn_stat_flag
      dump r_scale_factor
      dump ia_geo_fem
      dump i_app_reg_couple
      dump i_app_reg_order
      dump i_equiv_flag
      dump i_ac_mod_flag
  END IF
END WHILE
#---------------------------------------------------------------------
db_get_lbc_id
()
#  Purpose          :  This file provides an example of 2 calls to the
#                      function db_get_lbc_id()
#
#                      This function gets the lbc_id associated with
#                      the specified lbc name
#
#                      In this example the spool database is opened
#                      and lbc id of Load/BC set “fillet_pressure” and
#                      “TZ_fixed” are obtained.
#
#                      The given are the details of lbcs present in
#                      spool.db
#
#                         Lbc name                id
#
#                         fillet_pressure          1
#                         400_psi                  2
#                         20_psi                   3
#                         TZ_fixed                 4
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_lbc_id() has the following arguments:
#
#  db_get_lbc_id
#    ( lbc_name,
#      lbc_id )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_lbc_name[32]
INTEGER  i_lbc_id
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Get the lbc id of Load/BC set “fillet_pressure”
s_lbc_name = “fillet_pressure”
i_return_value =                                  @
   db_get_lbc_id                                  @
   ( s_lbc_name,                                  @
     i_lbc_id )
dump i_return_value
dump i_lbc_id
 
#  Get the lbc id of Load/BC set “TZ_fixed”
s_lbc_name = “TZ_fixed”
i_return_value =                                  @
   db_get_lbc_id                                  @
   ( s_lbc_name,                                  @
     i_lbc_id )
dump i_return_value
dump i_lbc_id
#---------------------------------------------------------------------
db_get_lbc_name
()
#  Purpose          :  This file provides an example of 4 calls to the
#                      function db_get_lbc_name()
#
#                      This function gets the lbc name associated with
#                      the specified lbc name
#
#                      In this example the spool database is opened
#                      and lbc name for all the four Load/BC set
#                      present are obtained.
#
#                      The given are the details of lbcs present in
#                      spool.db
#
#                         Lbc name                Id
#
#                         fillet_pressure          1
#                         400_psi                  2
#                         20_psi                   3
#                         TZ_fixed                 4
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_lbc_name() has the following arguments:
#
#  db_get_lbc_name
#    ( lbc_id,
#      lbc_name )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_lbc_id
STRING   s_lbc_name[32]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Get the lbc name of Load/BC sets
FOR ( i_lbc_id = 1 TO 4 )
   i_return_value =                                  @
      db_get_lbc_name                                @
      ( i_lbc_id,                                    @
        s_lbc_name )
   dump i_return_value
   dump i_lbc_id
   dump s_lbc_name
END FOR
#---------------------------------------------------------------------
 
db_get_lbc_type_defn
()
#  Purpose          :  This file provides an example of 2 calls to the
#                      function db_get_lbc_type_defn()
#
#                      This function gets the lbc type definitions
#                      from the database given the lbc_type name.
#
#                      In this example a new database is opened and
#                      lbc_type definitions for “Pressure” and
#                      “Displacement” are obtained.
#
#                      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_lbc_type_defn()
#  has the following arguments:
#
#  db_get_lbc_type_defn
#     (  name,
#        id,
#        class,
#        form,
#        gbc,
#        cid,
#        g_sym,
#        sv,
#        nv,
#        nbr_ac,
#        an_code,
#        defcol,
#        cbid,
#        anstyl )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_name[32]
INTEGER  i_id
INTEGER  i_class
INTEGER  i_form
INTEGER  i_gbc
INTEGER  i_cid
INTEGER  i_g_sym
INTEGER  i_sv
INTEGER  i_nv
INTEGER  i_nbr_ac
INTEGER  ia_an_code(15)
INTEGER  i_defcol
INTEGER  i_cbid
INTEGER  i_anstyl
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Lbc type name
s_name = “Pressure”
 
#  Get the lbc type definition for “Pressure”
i_return_value =                                 @
   db_get_lbc_type_defn                          @
      (  s_name,                                 @
         i_id,                                   @
         i_class,                                @
         i_form,                                 @
         i_gbc,                                  @
         i_cid,                                  @
         i_g_sym,                                @
         i_sv,                                   @
         i_nv,                                   @
         i_nbr_ac,                               @
         ia_an_code,                             @
         i_defcol,                               @
         i_cbid,                                 @
         i_anstyl )
dump i_return_value
dump i_id
dump i_class
dump i_form
dump i_gbc
dump i_cid
dump i_g_sym
dump i_sv
dump i_nv
dump i_nbr_ac
dump ia_an_code
dump i_defcol
dump i_cbid
dump i_anstyl
 
#---------------------------------------------------------------------
#  Lbc type name
s_name = “Displacement”
 
#  Get the lbc type definition for “Displacement”
i_return_value =                                 @
   db_get_lbc_type_defn                          @
      (  s_name,                                 @
         i_id,                                   @
         i_class,                                @
         i_form,                                 @
         i_gbc,                                  @
         i_cid,                                  @
         i_g_sym,                                @
         i_sv,                                   @
         i_nv,                                   @
         i_nbr_ac,                               @
         ia_an_code,                             @
         i_defcol,                               @
         i_cbid,                                 @
         i_anstyl )
dump i_return_value
dump i_id
dump i_class
dump i_form
dump i_gbc
dump i_cid
dump i_g_sym
dump i_sv
dump i_nv
dump i_nbr_ac
dump ia_an_code
dump i_defcol
dump i_cbid
dump i_anstyl
#---------------------------------------------------------------------
#  Note the following regarding the output values.
#
#  i_class = 1 indicates structural analysis_type(class)
#
#  ia_an_code = 5 indicates MSC Patran FEA
#             = 1 indicates MSC.Nastran
#
#  Refer chapter 7 & 9 in MSC Patran User Manual - Part 9 (Vol. 4)
#  for more details
#---------------------------------------------------------------------
db_get_lbc_var_defn
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_lbc_var_defn()
#
#                      This function gets the lbc_type variable id
#                      from the database for specified detail of lbc
#                      type id along with label of variable.
#
#                      In this example a new database is opened and
#                      lbc_type variable id of label ‘Bot Surface
#                      Pressure’ is obtained after assigning
#                      suitable values for category type id and
#                      element dimension 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_lbc_var_defn()
#  has the following arguments:
#
#  db_get_lbc_var_defn
#     (  lbc_type_id,
#        lbc_category,
#        eldim,
#        label,
#        id )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_lbc_type_id
INTEGER  i_lbc_category
INTEGER  i_eldim
STRING   s_label[64]
INTEGER  ia_id(10)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Lbc type = 8 for pressure
i_lbc_type_id = 8
 
#  Category of lbc = 2 for element uniform application
i_lbc_category = 2
 
#  Dimensionality of the loaded elements = 2 for surface element
i_eldim = 2
 
#  Data label for lbc
s_label = “Bot Surf Pressure”
 
i_return_value =                                 @
   db_get_lbc_var_defn                           @
      (  i_lbc_type_id,                          @
         i_lbc_category,                         @
         i_eldim,                                @
         s_label,                                @
         ia_id )
dump i_return_value
dump ia_id
#---------------------------------------------------------------------
#  Following are valid load type variable id for Pressure
#  ia_id = 1 for Top surface pressure
#        = 2 for Bottom surface pressure
#        = 3 for Edge pressure
#---------------------------------------------------------------------
db_get_load_cases_with_lbc
()
#  Purpose          :  This file provides an example of multiple calls
#                      to the function db_get_load_cases_with_lbc()
#
#                      This function gets the ids of load cases
#                      associated with lbc.
#
#                      In this example the spool database is opened
#                      and a new load case,”new_lc” is created with
#                      lbcs “fillet_pressure” and “400_psi”. Then the
#                      ids of load cases associated with each lbc is
#                      obtained.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_load_cases_with_lbc()
#  has the following arguments:
#
#  db_get_load_cases_with_lbc
#     (  lbc_id,
#        num_loadcases,
#        loadcase_ids,
#        priority )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_lbc_id
INTEGER  i_num_loadcases
INTEGER  iv_loadcase_ids(VIRTUAL)
INTEGER  iv_priority(VIRTUAL)
INTEGER  i_return_value
INTEGER  ia_prior(4)
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Maximum number of load cases in database
i_num_loadcases = 3
 
#  Create load case “new_lc”
i_return_value =                                 @
   loadcase_create                               @
      (  “new_lc”,                               @
         “Static”,                               @
         ““,                                     @
         [“TZ_fixed”, “20_psi”],                 @
         ia_prior,                               @
         ““,                                     @
         0.,                                     @
         FALSE )
dump i_return_value
 
#  Allocate memory
i_return_value = sys_allocate_array(iv_loadcase_ids,1,i_num_loadcases)
dump i_return_value
 
i_return_value = sys_allocate_array(iv_priority,1,i_num_loadcases)
dump i_return_value
 
#  Get the load cases associated with lbc
FOR ( i_lbc_id = 1 TO 4)
   i_return_value =                              @
      db_count_load_cases_with_lbc               @
         (  i_lbc_id,                            @
            i_num_loadcases )
   dump i_return_value
   dump i_lbc_id
 
   i_return_value = sys_reallocate_array         @
                       (  iv_loadcase_ids,1,     @
                          i_num_loadcases)
   dump i_return_value
 
   i_return_value = sys_reallocate_array         @
                       (  iv_priority,1,         @
                          i_num_loadcases)
   dump i_return_value
 
   i_return_value =                              @
      db_get_load_cases_with_lbc                 @
         (  i_lbc_id,                            @
            i_num_loadcases,                     @
            iv_loadcase_ids,                     @
            iv_priority )
   dump i_return_value
   dump i_num_loadcases
   dump iv_loadcase_ids
   dump iv_priority
END FOR
 
#---------------------------------------------------------------------
#  Refer the following table regarding output values for each lbc.
#
#      Load/BC name     ids         Associated load cases(ids)
#
#      fillet_pressure  1      default(1),spool_loads(2)
#      400_psi          2      default(1),spool_loads(2)
#      20_psi           3      default(1),spool_loads(2),new_lc(3)
#      TZ_fixed         4      default(1),spool_loads(2),new_lc(3)
#---------------------------------------------------------------------
#  Free memory
sys_free_array(iv_loadcase_ids)
sys_free_array(iv_priority)
#---------------------------------------------------------------------
 
db_get_loads_for_element
()
#  Purpose          :  This file provides an example of multiple calls
#                      to the function db_get_loads_for_element()
#
#                      This function gets the loads and boundary
#                      conditions for an element.
#
#                      In this example the spool database is opened
#                      and a new lbc, “new_press” is created on
#                      elements from 56 to 60. Then the lbcs
#                      associated with  elements from 51 to 60 are
#                      obtained.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_loads_for_element()
#  has the following arguments:
#
#  db_get_loads_for_element
#     (  nbr_of_lbcs,
#        elem_id,
#        lbc )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_nbr_of_lbcs = 1
INTEGER  i_elem_id
INTEGER  iv_lbc(VIRTUAL)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Create new lbc “new_press” on elements 56 to 60
i_return_value =                                    @
   loadsbcs_create                                  @
      (  “new_press”,                               @
         “Pressure”,                                @
         “Element Uniform”,                         @
         “2D”,                                      @
         “Static”,                                  @
         [“Element 56:60”],                         @
         “FEM”,                                     @
         ““,                                        @
         1.,                                        @
         [“ 0”, “ 200”,” 0”],                       @
         [““, ““, ““] )
dump i_return_value
 
#  Allocate memory
i_return_value = sys_allocate_array(iv_lbc,0,i_nbr_of_lbcs)
dump i_return_value
 
#  Get the lbcs for an element
FOR ( i_elem_id = 51 to 60 )
   i_return_value =                                 @
      db_count_loads_for_element                    @
         (  i_elem_id,                              @
            i_nbr_of_lbcs )
   dump i_return_value
 
   i_return_value = sys_reallocate_array(iv_lbc,0,  @
                       i_nbr_of_lbcs)
   dump i_return_value
 
   i_return_value =                                 @
      db_get_loads_for_element                      @
         (  i_nbr_of_lbcs,                          @
            i_elem_id,                              @
            iv_lbc )
   dump i_return_value
   dump i_elem_id
   dump iv_lbc
END FOR
 
#  Free memory
sys_free_array(iv_lbc)
#---------------------------------------------------------------------
db_get_next_appl_geo_region
()
#  Purpose          :  This file provides an example of 2 calls to the
#                      function db_get_next_appl_geo_region()
#
#                      This function gets the next record in the
#                      LbcAppRegion table, for specified lbc_id from
#                      the database.
#
#                      In this example the spool database is opened
#                      and list of application region and number of
#                      entities in them are obtained using function,
#                      db_count_lbc_appl_region_entity() for lbc,
#                      “fillet_pressure”. The records in LbcAppRegion 
#                      table are then read one by one after a
#                      call to function db_get_all_appl_geo_regions()
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_next_appl_geo_region()
#  has the following arguments:
#
#  db_get_next_appl_geo_region
#    ( app_reg_id,
#      ent_type,
#      ent_id,
#      ent_sub_id )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_app_reg_id
INTEGER  i_ent_type
INTEGER  i_ent_id
INTEGER  i_ent_sub_id
INTEGER  i_return_value
 
INTEGER  i_lbc_id
INTEGER  ia_app_reg_id(2)
INTEGER  ia_count(2)
INTEGER  i_index
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  lbc_id for “fillet_pressure”
i_lbc_id = 1
 
#  Gets the number of entities in each application regions
i_return_value =                                  @
   db_count_lbc_appl_region_entity                @
   ( i_lbc_id,                                    @
     ia_app_reg_id,                               @
     ia_count )
dump i_return_value
 
#  Get all the application geometric region for the specified id
i_return_value =                                  @
   db_get_all_appl_geo_regions                    @
   ( i_lbc_id )
dump i_return_value
 
#  Get next record in lbc application region one by one
FOR (i_index = 1 TO ia_count(1))
   i_return_value =                               @
      db_get_next_appl_geo_region                 @
      ( i_app_reg_id,                             @
        i_ent_type,                               @
        i_ent_id,                                 @
        i_ent_sub_id )
   dump i_return_value
 
#  Application region id
dump i_app_reg_id
 
#  Entity type id
dump i_ent_type
 
#  Entity id
dump i_ent_id
 
#  Entity sub id ( if appropriate )
dump i_ent_sub_id
 
END FOR
#---------------------------------------------------------------------
db_get_next_appl_reg_defn
()
#  Purpose          :  This file provides an example of multiple calls
#                      to the function db_get_next_appl_reg_defn()
#
#                      This function gets next application geometry
#                      region definition for an lbc type definition
#                      from the database in get all, get next method.
#
#                      In this example the spool database is opened
#                      and the function,db_get_all_appl_reg_defns()
#                      is called to load records into application 
#                      geometry definition table. The records are then
#                      read one by one using this function.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_next_appl_reg_defn()
#  has the following arguments:
#
#  db_get_next_appl_reg_defn
#    ( seq_app_reg_id,
#      label )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_seq_app_reg_id
STRING   s_label[32]
INTEGER  i_all_status
INTEGER  i_next_status = 0
INTEGER  i_lbc_type_id
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Load type id = 8 (for pressure in CHAPTER 9 of MSC Patran
#  USER MANUAL (vol 4))
i_lbc_type_id = 8
 
#  Get all application geometry region definition for an lbc_type
i_all_status =                                    @
   db_get_all_appl_reg_defns                      @
   ( i_lbc_type_id )
dump i_all_status
 
#  Get next application geometry region definition for an lbc_type
WHILE ( i_next_status == 0 )
   i_next_status =                                @
      db_get_next_appl_reg_defn                   @
      ( i_seq_app_reg_id,                         @
        s_label )
   dump i_next_status
   IF ( i_next_status == 0 ) THEN
      dump i_seq_app_reg_id
      dump s_label
   END IF
END WHILE
#---------------------------------------------------------------------
db_get_next_lbc_name
()
#  Purpose          :  This file provides an example of multiple calls
#                      to the function db_get_next_lbc_name()
#
#                      This function gets next LBC name and type from
#                      the database in get all, get next method.
#
#                      In this example the spool database is opened
#                      and the function db_get_all_lbc_names() is
#                      called to get all LBC names from database. Then
#                      the information about all the LBCs is retrieved
#                      using this function
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_next_lbc_name()
#  has the following arguments:
#
#  db_get_next_lbc_name
#    ( lbc_id,
#      lbc_name,
#      lbc_type_id )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_lbc_id
STRING   s_lbc_name[32]
INTEGER  i_lbc_type_id
INTEGER  i_all_status
INTEGER  i_next_status
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Get all LBC names and types
i_all_status = db_get_all_lbc_names()
dump i_all_status
 
#  Get next lbc name and type from the database
WHILE ( i_next_status == 0 )
   i_next_status =                                   @
      db_get_next_lbc_name                           @
      ( i_lbc_id,                                    @
        s_lbc_name,                                  @
        i_lbc_type_id )
   dump i_next_status
   IF ( i_next_status == 0) THEN
      dump i_lbc_id
      dump s_lbc_name
      dump i_lbc_type_id
   END IF
END WHILE
#---------------------------------------------------------------------
db_get_next_lbc_name_by_type
()
#  Purpose          :  This file provides an example of multiple calls
#                      to the function db_get_next_lbc_name_by_type()
#
#                      This function gets the next LBC of specified
#                      type from database in get all, get next method.
#
#                      In this example the spool database is opened
#                      and the function, 
#                      db_get_all_lbc_names_by_type() is called to get
#                      all LBC names of type “Pressure” from database.
#                      Then the information about each LBC is
#                      retrieved using this function.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_next_lbc_name_by_type()
#  has the following arguments:
#
#  db_get_next_lbc_name_by_type
#    ( lbc_id,
#      lbc_name )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_lbc_type_id
INTEGER  i_lbc_id
STRING   s_lbc_name[32]
INTEGER  i_all_status
INTEGER  i_next_status
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Get all lbcs of type “Pressure”
i_lbc_type_id = 8
i_all_status =                                    @
   db_get_all_lbc_names_by_type                   @
   ( i_lbc_type_id )
dump i_all_status
 
#  Get next lbc of type pressure from database
WHILE ( i_next_status == 0 )
   i_next_status =                                @
      db_get_next_lbc_name_by_type                @
      ( i_lbc_id,                                 @
        s_lbc_name )
   dump i_next_status
   IF ( i_next_status == 0 ) THEN
      dump i_lbc_id
      dump s_lbc_name
   END IF
END WHILE
#---------------------------------------------------------------------
db_get_next_lbc_type_defn
()
#  Purpose          :  This file provides an example of multiple calls
#                      to the function db_get_next_lbc_type_defn()
#
#                      This function gets next lbc type definitions
#                      from the lbc type table in database by get all,
#                      get next method.
#
#                      In this example the spool database is opened
#                      and the function, db_get_all_lbc_type_defns()
#                      is called to load records into lbc type table.
#                      The records are then read one by one using
#                      this function.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_next_lbc_type_defn()
#  has the following arguments:
#
#  db_get_next_lbc_type_defn
#    ( internal_lbc_id,
#      lbc_name,
#      class_lbc,
#      form,
#      global_bc,
#      flag_alt_cid,
#      graphic_symbol,
#      sv,
#      null_vector,
#      num_anal_code,
#      anal_code_ids,
#      default_color,
#      color_box_id,
#      anchor_style )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_internal_lbc_id
STRING   s_lbc_name[32]
INTEGER  i_class_lbc
INTEGER  i_form
INTEGER  i_global_bc
INTEGER  i_flag_alt_cid
INTEGER  i_graphic_symbol
INTEGER  i_sv
INTEGER  i_null_vector
INTEGER  i_num_anal_code
INTEGER  ia_anal_code_ids(15)
INTEGER  i_default_color
INTEGER  i_color_box_id
INTEGER  i_anchor_style
INTEGER  i_all_status
INTEGER  i_next_status = 0
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Get all lbc type definitions from the database
i_all_status = db_get_all_lbc_type_defns()
dump i_all_status
 
#  Get next lbc type definition from the database.
WHILE ( i_next_status == 0 )
   i_next_status =                                   @
      db_get_next_lbc_type_defn                      @
      ( i_internal_lbc_id,                           @
        s_lbc_name,                                  @
        i_class_lbc,                                 @
        i_form,                                      @
        i_global_bc,                                 @
        i_flag_alt_cid,                              @
        i_graphic_symbol,                            @
        i_sv,                                        @
        i_null_vector,                               @
        i_num_anal_code,                             @
        ia_anal_code_ids,                            @
        i_default_color,                             @
        i_color_box_id,                              @
        i_anchor_style )
   dump i_next_status
   IF ( i_next_status == 0 ) THEN
      dump i_internal_lbc_id
      dump s_lbc_name
      dump i_class_lbc
      dump i_form
      dump i_global_bc
      dump i_flag_alt_cid
      dump i_graphic_symbol
      dump i_sv
      dump i_null_vector
      dump i_num_anal_code
      dump ia_anal_code_ids
      dump i_default_color
      dump i_color_box_id
      dump i_anchor_style
   END IF
END WHILE
#---------------------------------------------------------------------
db_get_next_lbc_type_name
()
#  Purpose          :  This file provides an example of multiple calls
#                      to the function db_get_next_lbc_type_name()
#
#                      This function gets the next lbc type name from
#                      database in get all, get next method.
#
#                      In this example the spool database is opened
#                      and the function,db_get_all_lbc_type_names()
#                      is called to load all names of lbc types in
#                      lbc type table from database. Then all the
#                      names of lbc types are obtained using this 
#                      function
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_next_lbc_type_name()
#  has the following arguments:
#
#  db_get_next_lbc_type_name
#    ( internal_lbc_id,
#      lbc_name )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_return_value
INTEGER  i_lbc_type_id
STRING   s_lbc_name[32]
INTEGER  i_return_value
INTEGER  i_all_status
INTEGER  i_next_status = 0
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Get all the names of lbc types
i_all_status = db_get_all_lbc_type_names()
dump i_all_status
 
#  Get next lbc type name
WHILE ( i_next_status == 0 )
   i_next_status =                                   @
      db_get_next_lbc_type_name                      @
      ( i_lbc_type_id,                               @
        s_lbc_name )
   dump i_next_status
   IF ( i_next_status == 0 ) THEN
      dump i_lbc_type_id
      dump s_lbc_name
   END IF
END WHILE
#---------------------------------------------------------------------
db_get_next_lbc_var_defn
()
#  Purpose          :  This file provides an example of multiple calls
#                      to the function db_get_next_lbc_var_defn()
#
#                      This function gets the next lbc variable for
#                      an lbc type definition from database in get
#                      all, get next method.
#
#                      In this example the spool database is opened
#                      and the function, db_get_all_lbc_var_defns()
#                      is called to get all lbc variables of type
#                      “Pressure” from database. Then variable ids
#                      are obtained one by one using this function.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_next_lbc_var_defn()
#  has the following arguments:
#
#  db_get_next_lbc_var_defn
#    ( category_id,
#      elem_dim )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_lbc_type_id
INTEGER  i_category_id
INTEGER  i_elem_dim
INTEGER  i_all_status
INTEGER  i_next_status = 0
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Lbc type id for “Pressure”
i_lbc_type_id = 8
 
#  Get all the lbc variable for lbc type “Pressure”
i_all_status =                                    @
   db_get_all_lbc_var_defns                       @
   ( i_lbc_type_id )
dump i_all_status
 
#  Get the next lbc variable
WHILE ( i_next_status == 0 )
   i_next_status =                                @
      db_get_next_lbc_var_defn                    @
      ( i_category_id,                            @
        i_elem_dim )
   dump i_next_status
   IF ( i_next_status == 0 ) THEN
      dump i_category_id
      dump i_elem_dim
   END IF
END WHILE
#---------------------------------------------------------------------
db_get_next_lbcs_new
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_next_lbcs_new()
#
#                      This function gets the information about LBCs
#                      in the database one structure at a time
#
#                      In this example the spool database is opened
#                      and the function, db_get_all_lbcs_new() is
#                      called to retrieve information about the LBCs
#                      in the database. Then the information about
#                      all of the LBCs are retrieved using this
#                      function.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_next_lbcs_new()
#  has the following arguments:
#
#  db_get_next_lbcs_new
#    ( lbc_struct_id,
#      name,
#      lbc_type,
#      category,
#      targ_elem,
#      coord_frame,
#      dyn_stat_flag,
#      scale_factor,
#      geo_fem,
#      app_reg_couple,
#      app_reg_order,
#      equiv_flag,
#      ac_mod_flag )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_all_status
INTEGER  i_next_status = 0
INTEGER  i_lbc_struct_id
STRING   s_name[16]
INTEGER  i_lbc_type
INTEGER  i_category
INTEGER  ia_geo_fem(3)
INTEGER  i_alt_coord_frame
INTEGER  i_dyn_stat_flag
REAL     r_scale_factor
INTEGER  ia_targ_elem(3)
INTEGER  i_app_reg_couple
INTEGER  i_app_reg_order
INTEGER  i_equiv_flag
INTEGER  i_ac_mod_flag
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Set up the data required to retrieve all information about LBCs
i_all_status =                                       @
   db_get_all_lbcs_new()
dump i_all_status
 
#  Get the information about LBCs.
WHILE ( i_next_status == 0 )
   i_next_status =                                   @
      db_get_next_lbcs_new                           @
      ( i_lbc_struct_id,                             @
        s_name,                                      @
        i_lbc_type,                                  @
        i_category,                                  @
        ia_targ_elem,                                @
        i_alt_coord_frame,                           @
        i_dyn_stat_flag,                             @
        r_scale_factor,                              @
        ia_geo_fem,                                  @
        i_app_reg_couple,                            @
        i_app_reg_order,                             @
        i_equiv_flag,                                @
        i_ac_mod_flag )
   dump i_next_status
   IF ( i_next_status == 0 ) THEN
      dump i_lbc_struct_id
      dump s_name
      dump i_lbc_type
      dump i_category
      dump ia_targ_elem
      dump i_alt_coord_frame
      dump i_dyn_stat_flag
      dump r_scale_factor
      dump ia_geo_fem
      dump i_app_reg_couple
      dump i_app_reg_order
      dump i_equiv_flag
      dump i_ac_mod_flag
   END IF
END WHILE
#---------------------------------------------------------------------
db_get_valid_cat_by_type
()
#  Purpose          :  This file provides an example of 2 calls to the
#                      function db_get_valid_cat_by_type()
#
#                      This function gets the valid category type for
#                      a specified lbc type. The maximum number of
#                      categories for a type is three.
#
#                      In this example a new database is created and
#                      valid category type ids of lbc type “Pressure”
#                      and “Force” are obtained.
#
#                      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_valid_cat_by_type()
#  has the following arguments:
#
#  db_get_valid_cat_by_type
#     (  typid,
#        cat )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_typid
INTEGER  ia_cat(3)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Lbc type = 8 for Pressure
i_typid = 8
 
#  Get all valid categories for Pressure
i_return_value =                                 @
   db_get_valid_cat_by_type                      @
      (  i_typid,                                @
         ia_cat )
dump i_return_value
dump ia_cat
 
#  Lbc type = 7 for Force
i_typid = 7
 
#  Get all valid categories for Pressure
i_return_value =                                 @
   db_get_valid_cat_by_type                      @
      (  i_typid,                                @
         ia_cat )
dump i_return_value
dump ia_cat
#---------------------------------------------------------------------
#  Following are valid category ids for application of lbcs
#  ia_cat = 1 indicates nodal application
#         = 2 indicates element uniform application
#         = 3 indicates element variable application
#---------------------------------------------------------------------
db_get_valid_eldim_by_type_cat
()
#  Purpose          :  This file provides an example of multiple calls 
#                      to the function db_get_valid_eldim_by_
#                      type_cat()
#
#                      This function gets the valid element dimension
#                      ids for specified lbc type and category type.
#
#                      In this example a new database is created and
#                      valid element dimension ids for lbc type
#                      “Pressure”, “Force” and “Displacement” are
#                      obtained.
#
#                      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_valid_eldim_by_type_cat()
#  has the following arguments:
#
#  db_get_valid_eldim_by_type_cat
#     (  typid,
#        cat,
#        eldim )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_typid
INTEGER  i_cat
INTEGER  ia_eldim(5)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Lbc type = 8 for Pressure
i_typid = 8
 
#  Get the valid element dimension ids
FOR ( i_cat = 2 TO 3 )
   i_return_value =                                 @
      db_get_valid_eldim_by_type_cat                @
         (  i_typid,                                @
            i_cat,                                  @
            ia_eldim )
   dump i_return_value
   dump i_cat
   dump ia_eldim
END FOR
#---------------------------------------------------------------------
#  Lbc type = 7 for Force
i_typid = 7
 
#  Get the valid element dimension ids
FOR ( i_cat = 1 TO 3 )
   i_return_value =                                 @
      db_get_valid_eldim_by_type_cat                @
         (  i_typid,                                @
            i_cat,                                  @
            ia_eldim )
   dump i_return_value
   dump i_cat
   dump ia_eldim
END FOR
#---------------------------------------------------------------------
#  Lbc type = 6 for Displacement
i_typid = 6
 
#  Get the valid element dimension ids
FOR ( i_cat = 1 TO 3 )
   i_return_value =                                 @
      db_get_valid_eldim_by_type_cat                @
         (  i_typid,                                @
            i_cat,                                  @
            ia_eldim )
   dump i_return_value
   dump i_cat
   dump ia_eldim
END FOR
#---------------------------------------------------------------------
#  Following are valid element dimension ids for application of lbcs
#  ia_eldim = 1 indicates line elements
#           = 2 indicates surface elements
#           = 3 indicates solid elements
#---------------------------------------------------------------------
db_get_valid_lbc_var_ids
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_valid_lbc_var_ids()
#
#                      This function gets all the lbc type variable
#                      id from the database for specified detail of
#                      lbc type id.
#
#                      In this example a new database is opened and
#                      variable ids of lbc_type “Pressure” is obtained
#                      after assigning suitable values for category
#                      type id and element dimension 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_valid_lbc_var_ids()
#  has the following arguments:
#
#  db_get_valid_lbc_var_ids
#     (  typid,
#        cat,
#        eldim,
#        count,
#        vid )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_typid
INTEGER  i_cat
INTEGER  i_eldim
INTEGER  i_count
INTEGER  ia_vid(10)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Lbc type id = 8 for Pressure
i_typid = 8
 
#  Category type id = 2 for element uniform
i_cat = 2
 
#  Element dimensionality id = 2 for surface elements
i_eldim = 2
 
#  Maximum storage for variable IDs
i_count = 10
 
#  Get all the valid element variable ids
i_return_value =                                 @
   db_get_valid_lbc_var_ids                      @
      (  i_typid,                                @
         i_cat,                                  @
         i_eldim,                                @
         i_count,                                @
         ia_vid )
dump i_return_value
dump i_count
dump ia_vid
#---------------------------------------------------------------------
#  Following are valid load type variable id for Pressure
#  ia_vid = 1 for Top surface pressure
#         = 2 for Bottom surface pressure
#         = 3 for Edge pressure
#---------------------------------------------------------------------
db_modify_load_case
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_modify_load_case()
#
#                      This function modifies the load case in the
#                      database
#
#                      In the following example the spool database is
#                      opened and the load case “spool_loads”,
#                      originally consisting of 4 lbcs is modified
#                      using this function into load case with same
#                      name consisting of only 2 lbcs. Number of lbcs
#                      in load case is verified before and after
#                      modification.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_modify_load_case()
#  has the following arguments:
#
#  db_modify_load_case
#     (  id
#        name,
#        type,
#        desc,
#        nbrlc,
#        lbc,
#        dlcname,
#        mv,
#        priority )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_id
STRING   s_name[32]
INTEGER  i_type
STRING   s_desc[64]
INTEGER  i_nbrlc
INTEGER  iv_lbc(VIRTUAL)
STRING   s_dlcname[32]
REAL     r_mv
INTEGER  ia_priority(4)
INTEGER  i_num_loads
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Id of the load case = 2 for “spool_loads”
i_id = 2
 
#  Name for modified lbc (retaining same name)
s_name = “spool_loads”
 
#  Load case type = 1 for static load case
i_type = 1
 
#  Description of load case
s_desc = “Modified load case”
 
#  Number of lbc attached to this new load case
i_nbrlc = 2
 
#  Load ids associated with load case
i_return_value = sys_allocate_array(iv_lbc,1,i_nbrlc)
dump i_return_value
iv_lbc = [3,4]
 
#  Name of dynamic load case from which this static load case is
#  derived. A blank string if not applicable.
s_dlcname = ““
 
#  Map variable
r_mv = 1.0
 
#  Number of lbcs in load case “spool_loads” before modification
i_return_value =                                 @
   db_count_lbc_by_load_case                     @
      (  s_name,                                 @
         i_num_loads )
dump i_return_value
dump i_num_loads
 
#  Modify load case
i_return_value =                                 @
   db_modify_load_case                           @
      (  i_id,                                   @
         s_name,                                 @
         i_type,                                 @
         s_desc,                                 @
         i_nbrlc,                                @
         iv_lbc,                                 @
         s_dlcname,                              @
         r_mv,                                   @
         ia_priority)
dump i_return_value
 
#  Number of lbcs in load case “spool_loads” after modification
i_return_value =                                 @
   db_count_lbc_by_load_case                     @
      (  s_name,                                 @
         i_num_loads )
dump i_return_value
dump i_num_loads
 
#  Free memory
sys_free_array(iv_lbc)
#---------------------------------------------------------------------
lbc_create
()
#  Purpose          :  This file provides an example of a call to the
#                      function lbc_create()
#
#                      This function creates a load/boundary condition
#                      set.
#
#                      In the following example the spool database is
#                      opened and a load(force) named “new_force” is
#                      added. No. of lbcs in the database is verified
#                      before and after addition.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function lbc_create()
#  has the following arguments:
#
#  lbc_create
#     (  name,
#        type_id,
#        cat_id,
#        dyn_flag,
#        num_ar,
#        ar_id,
#        aplist1,
#        aplist2,
#        fem_flag,
#        targ_elem,
#        lbc_sf,
#        cid_id,
#        no_data_flag,
#        num_dat,
#        var_id,
#        sv,
#        null_flag,
#        null_var,
#        datatype,
#        ivalue,
#        rvalue,
#        fldid,
#        dyn_fldid,
#        node_id )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_name[64]
INTEGER  i_type_id
INTEGER  i_cat_id
INTEGER  i_dyn_flag
INTEGER  i_num_ar
INTEGER  ia_ar_id(2)
STRING   s_aplist1[32]
STRING   s_aplist2[32]
INTEGER  ia_fem_flag(5)
INTEGER  ia_targ_elem(3)
REAL     r_lbc_sf
INTEGER  i_cid_id
INTEGER  i_no_data_flag
INTEGER  i_num_dat
INTEGER  ia_var_id(20)
INTEGER  ia_sv(20)
INTEGER  ia_null_flag(20)
INTEGER  iaa_null_var(20,3)
INTEGER  ia_datatype(20)
INTEGER  ia_ivalue(20)
REAL     raa_rvalue(20,3)
INTEGER  iaa_fldid(20,3)
INTEGER  iaa_dyn_fldid(20,3)
INTEGER  ia_node_id(20)
INTEGER  i_return_value
 
INTEGER  i_count1
INTEGER  i_count2
INTEGER  i_load_count
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Post the “default_group”
uil_viewport_post_groups.posted_groups            @
   ( “default_viewport”, 1, [“default_group”] )
 
#  Count number of Loads/BCs
i_return_value =                                  @
   db_count_lbc(i_load_count)
dump i_return_value
 
#  The number of LBCs in the database is
dump i_load_count
 
#  Follow the instructions below to display Loads/BCs in the graphic
#  Window.
#  Pick “Display”, “Load/BC/Elem Props..” from pull-down menus.
#  Select “Show All” below Loads/BCs and “Apply”
 
#  Session file paused. Press “Resume” to continue..
sf_pause()
#---------------------------------------------------------------------
#  Initializing the input variables 
 
#  Load id = 7 for force 8 for pressure
i_type_id = 7
 
#  Category id = 1 for nodal, 2 for Element Uniform,3 for Element var
i_cat_id = 1
 
#  Dynamic flag = FA_FALSE = 0 for static mode
i_dyn_flag = 0
 
#  Number of application region
i_num_ar = 1
 
#  Application region db ID
ia_ar_id(1) = 1
ia_ar_id(2) = 0
s_aplist1 = “Point 8”
 
#  FEM Flag = FA_TRUE if FEM entities
#  if applied to geometry flag = 0
#  if applied to fem flag = 1
#  flag(4)=app_reg_couple=0 for Mult., appl., region coupling action
#  flag(5)=app_reg_order=0 for  Mult., appl., region order action
 
ia_fem_flag=[0,0,0,0,0]
 
#  Target Element dimension = 0 for point, 1 for one-dimensional etc.
ia_targ_elem = [0,0,0]
 
#  Lbc Set Scale factor
r_lbc_sf = 1.0
 
#  Coordinate System ID
i_cid_id = 0
 
#  No_Data_Flag = FA_TRUE if no case is invalid
#  i_no_data_flag = FA_TRUE
i_no_data_flag = 1
 
#  Number of Input data variables : Forces in three direction
i_num_dat = 6
 
#  Input Variable data ID : Load variable id =1 of F1 F2 F3
#  2 for M1 M2 M3
#  Pressure : 1 for top, 2 for bottom, 3 for edge
 
FOR (i_count1 = 1 TO 3)
   ia_var_id(i_count1) = 1
END FOR
 
FOR (i_count1 = 4 TO 6)
   ia_var_id(i_count1) = 2
END FOR
 
#  Data is scalar or vector ( 2 if vector )
FOR (i_count1 = 1 TO 20  )
   ia_sv(i_count1) = 2
END FOR
 
#  Null vector flag = 1 if null allowed
FOR (i_count1 = 1 TO 20  )
   ia_null_flag(i_count1) = 0
END FOR
 
#  Flag indicating whether the vector component is null
#  flag = 0   interprets blank components as zeroes
#  flag = -1  interprets blank components as nulls
FOR (i_count1 = 1 TO 20  )
   FOR (i_count2 = 1 TO 3  )
      iaa_null_var(i_count1,i_count2) = 0 
   END FOR
END FOR
 
#  Datatypes = 1 for integer, 2 for logical, 3 for real
FOR (i_count1 = 1 TO 20  )
   ia_datatype(i_count1) = 3
END FOR
 
#  Integer values
FOR (i_count1 = 1 TO 20  )  
   ia_ivalue(i_count1) = 0
END FOR
 
#  Real values
FOR (i_count1 = 1 TO 20  ) 
   FOR (i_count2 = 1 TO 3  ) 
      raa_rvalue(i_count1,i_count2) = 0.0
   END FOR
END FOR
raa_rvalue(1,2) = -200.0
 
#  Field ID
FOR (i_count1 = 1 TO 20  )  
   FOR (i_count2 = 1 TO 3  )  
      iaa_fldid(i_count1,i_count2) = 0
   END FOR
END FOR
 
#  Dynamic field ID
FOR (i_count1 = 1 TO 20  )  
   FOR (i_count2 = 1 TO 3  )  
      iaa_dyn_fldid(i_count1,i_count2) = 0
   END FOR
END FOR
 
#  Node ID
FOR (i_count1 = 1 TO 20  )  
   ia_node_id(i_count1) = 6
END FOR
 
#  Create LBC.
i_return_value =                                  @
   lbc_create                                     @
      (  s_name,                                  @
         i_type_id,                               @
         i_cat_id,                                @
         i_dyn_flag,                              @
         i_num_ar,                                @
         ia_ar_id,                                @
         s_aplist1,                               @
         s_aplist2,                               @
         ia_fem_flag,                             @
         ia_targ_elem,                            @
         r_lbc_sf,                                @
         i_cid_id,                                @
         i_no_data_flag,                          @
         i_num_dat,                               @
         ia_var_id,                               @
         ia_sv,                                   @
         ia_null_flag,                            @
         iaa_null_var,                            @
         ia_datatype,                             @
         ia_ivalue,                               @
         raa_rvalue,                              @
         iaa_fldid,                               @
         iaa_dyn_fldid,                           @
         ia_node_id )
 
dump i_return_value
 
#  Count number of Loads/BCs
i_return_value =                                  @
   db_count_lbc(i_load_count)
dump i_return_value
 
#  The number of LBCs in the database is
dump i_load_count
#---------------------------------------------------------------------
lbc_delete
()
#  Purpose          :  This file provides an example of a call to the
#                      function lbc_delete()
#
#                      This functions deletes the loads and boundary 
#                      condition sets ( and their related association
#                      with application region, data, load case 
#                      association ) 
#
#                      In this example the spool database is
#                      opened and loads named “fillet_transition” and
#                      “400_psi” are deleted after a pause.
#                      Observation on list of Loads/BCs is made
#                      before and after deletion of loads.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function lbc_delete()
#  has the following arguments:
#
#  lbc_delete
#     (  count,
#        del_id,
#        update_graph )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_count
INTEGER  ia_del_id(2)
LOGICAL  l_update_graph
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Number of Loads and BC Sets to delete = 2
i_count = 2
 
#  Load/BC Set
ia_del_id = [1,2]
 
#  If TRUE, then update graphics
l_update_graph = TRUE
 
#  Follow the instructions below to display Loads/BCs in the graphic
#  Window.
#  Pick “Display”,”Load/BC/Elem Props..” from pull-down menus
#  Select “Show All” below Loads/BCs and “Apply”
 
#  It can be observed that the symbols  representing
#  “fillet_transition” and “400_psi” getting removed
#  on execution lbc_delete()
 
#  Session file paused. Press “Resume” to continue..
sf_pause()
#---------------------------------------------------------------------
#  Delete the LBCs
i_return_value =                                  @
   lbc_delete                                     @
      (  i_count,                                 @
         ia_del_id,                               @
         l_update_graph )
dump i_return_value
#---------------------------------------------------------------------
 
lbc_eval_fem_by_lc
()
#  Purpose          :  This file provides an example of a call to the
#                      function lbc_eval_fem_by_lc()
#
#                      Given a load case name it gets all the lbcs
#                      associated with it and checks to see if each
#                      lbc has any unevaluated fem_xx_lbcs. It also 
#                      creates the appropriate fem_xx_table in  the
#                      database.
#
#                      In this example the spool database is
#                      opened and fem_xx_table of load case “Default”
#                      is evaluated using this function.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function lbc_eval_fem_by_lc() has the following arguments:
#
#  lbc_eval_fem_by_lc
#     (  lc_name )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_lc_name[32]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Load case name
s_lc_name = “Default”
 
#  Evaluate Load/BC of load-case set at associated FEM entities.
i_return_value =                                  @
   lbc_eval_fem_by_lc                             @
      (  s_lc_name )
dump i_return_value
 
#  Comments generated on evaluation of load-case set at associated 
#  FEM entities can be observed.
#---------------------------------------------------------------------
lbc_eval_fem_lbc
()
#  Purpose          :  This file provides an example of a call to the
#                      function lbc_eval_fem_lbc()
#
#                      Given a lbc id , this function checks to see if
#                      each lbc has any unevaluated fem_xx_lbcs. If it
#                      does then create the appropriate fem_xx_table
#                      in the database.
#
#                      In this example the spool database is opened
#                      and fem_xx_table of load “fillet_pressure”
#                      is evaluated.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function lbc_eval_fem_lbc()
#  has the following arguments:
#
#  lbc_eval_fem_lbc
#     (  lbc_id )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_lbc_id
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  i_lbc_id = 1 for LBC “fillet_pressure” in spool.db
i_lbc_id = 1
 
#  Evaluate Load/BC set at associated FEM entities
i_return_value =                                  @
   lbc_eval_fem_lbc                               @
      (  i_lbc_id )
dump i_return_value
 
#  Comments generated on evaluation of Load/BC at associated
#  FEM entities can be observed.
#---------------------------------------------------------------------
lbc_get_sdbx_datatype
()
#  Purpose          :  This file provides an example of a call to the
#                      function lbc_get_sdbx_datatype()
#
#                      This function on input of lbc id, object,
#                      method target element type, geometry group; 
#                      returns the select databox datatype and label
#
#                      In this example the spool database is opened 
#                      and the select databox datatype and label for
#                      lbc “TZ_fixed” is obtained.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function lbc_get_sdbx_datatype()
#  has the following arguments:
#
#  lbc_get_sdbx_datatype
#     (  lbc_id,
#        obj_str,
#        meth_str,
#        targ_str,
#        geo_group,
#        sdbx_type,
#        sdbx_label )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_lbc_id
STRING   s_obj_str[32]
STRING   s_meth_str[32]
STRING   s_targ_str[32]
STRING   s_geo_group[32]
STRING   s_sdbx_type[32]
STRING   s_sdbx_label[32] 
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Load/BCs details
#  i_lbc_id = 4 for displacement
i_lbc_id = 4
s_obj_str = “Displacement”
s_meth_str = “Nodal”
s_geo_group = “Geometry”
 
#  Return databox datatype and label
i_return_value =                                  @
   lbc_get_sdbx_datatype                          @
      (  i_lbc_id,                                @
         s_obj_str,                               @
         s_meth_str,                              @
         s_targ_str,                              @
         s_geo_group,                             @
         s_sdbx_type,                             @
         s_sdbx_label )
dump i_return_value
dump s_sdbx_type
dump s_sdbx_label
#---------------------------------------------------------------------
lbc_gm
()
#  Purpose          :  This file provides an example of a call to the
#                      function lbc_gm()
#
#                      This function calls Loads/BCs Graphics Manager
#
#                      This illustration opens spool.db and fetches 
#                      group vector table id associated with 
#                      “default_group”. Then it calls lbc_gm() to 
#                      create a new group vector table. The id of 
#                      group vector table is verified again for 
#                      “default_group”.
#   
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function lbc_gm() has no arguments.
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_return_value
STRING   s_load_case_name[32]
STRING   s_group_name[32]
INTEGER  i_vector_id
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  s_group_name = “default_group”
s_group_name = “default_group”
 
#  Get the load vector table associated with the group 
i_return_value =                              @
   ga_group_load_vector_get                   @
      (  s_group_name,                        @
         i_vector_id )   
dump i_return_value
dump i_vector_id
 
#  Activate Loads/BC’s Graphics Manager
i_return_value = lbc_gm()
dump i_return_value
 
#  Get the load vector table associated with the group 
i_return_value =                             @
   ga_group_load_vector_get                  @
      (  s_group_name,                       @
         i_vector_id )
dump i_return_value
dump i_vector_id
 
#  It can be observed that the load vector table id increased by 1
#  which infers that a new Group Vector table is created and 
#  assigned to valid groups
#---------------------------------------------------------------------
lbc_graphics_defn
()
#  Purpose          :  This file provides an example of a call to the
#                      function lbc_graphics_defn()
#                     
#                      Given LBC type id, category id and target elem
#                      id it gets data in ss_lbc, sv_lbc, ds_lbc and
#                      /or dv_lbc table.
#
#                      In this example the spool database is
#                      opened and lbc,”TZ_fixed”  is used for
#                      getting data into its  ss_lbc, sv_lbc, ds_lbc 
#                      and/or dv_lbc table.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function lbc_graphics_defn()
#  has the following arguments:
#
#  lbc_graphics_defn
#     (  type_id,
#        cat_id,
#        targ_elem_id,
#        nvar,
#        varid,
#        vector_flag,
#        marker,
#        color,
#        anchor )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_type_id
INTEGER  i_cat_id
INTEGER  i_targ_elem_id
INTEGER  i_nvar
INTEGER  ia_varid(16)
INTEGER  ia_vector_flag(16)
INTEGER  ia_marker(16)
INTEGER  ia_color(16)
INTEGER  ia_anchor(16)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  LBC Type Id - disp, Force ( 6 for displacement )
i_type_id = 6
 
#  Category = 1 for Nodal, 2 for Elem Uniform, 3 for Element Var  
i_cat_id = 1
 
#  Target Element Dimension = 0 for point, 1 for one dimensional,..
i_targ_elem_id = 0
 
#  Get data in ss_lbc, sv_lbc, ds_lbc and/or dv_lbc table
i_return_value =                                  @
   lbc_graphics_defn                              @
      (  i_type_id,                               @
         i_cat_id,                                @
         i_targ_elem_id,                          @
         i_nvar,                                  @
         ia_varid,                                @
         ia_vector_flag,                          @
         ia_marker,                               @
         ia_color,                                @
         ia_anchor )
 
dump  i_return_value
dump  ia_varid
dump  ia_vector_flag
dump  ia_marker
dump  ia_color
dump  ia_anchor
#---------------------------------------------------------------------
lbc_lp_parse_sca
()
#  Purpose          :  This file provides an example of a call to the
#                      function lbc_lp_parse_sca()
#
#                      This function parses the data contained in the
#                      string s_dval and verifies the validity of data
#                      (real scalar or a scalar field)
#
#                      In this example a string containing real
#                      scalar values is given for parsing.
#
#                      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 lbc_lp_parse_sca() has the following arguments:
#
#  lbc_lp_parse_sca
#     (  dval,
#        datatype,
#        field_id,
#        null_flag,
#        rval )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_dval[64]
INTEGER  i_datatype
INTEGER  i_field_id
INTEGER  i_null_flag
REAL     r_rval
INTEGER  i_return_value
#---------------------------------------------------------------------
#  String containing the property
s_dval = “100.0”
 
#  Datatype = 3 to parse real values
i_datatype = 3
 
#  Parse the data contained in the string
i_return_value =                                  @
   lbc_lp_parse_sca                               @
      (  s_dval,                                  @
         i_datatype,                              @
         i_field_id,                              @
         i_null_flag,                             @
         r_rval )
dump    i_return_value
 
#  Field ID
dump    i_field_id
 
#  Flag indicating if data is NULL
dump    i_null_flag
 
#  Real value of RVAL
dump    r_rval
#---------------------------------------------------------------------
lbc_lp_parse_vec
()
#  Purpose          :  This file provides an example of a call to the
#                      function lbc_lp_parse_vec()
# 
#                      This function parses the data contained in the 
#                      string s_dval and verifies the validity of 
#                      data (real vector or a vector field)
#
#                      In this example a string containing real
#                      vector values is given for parsing
#
#                      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 lbc_lp_parse_vec() has the following arguments:
#
#  lbc_lp_parse_vec
#     (  dval,
#        field_id,
#        null_flag,
#        rval )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_dval[32]
INTEGER  ia_field_id(8)
INTEGER  ia_null_flag(8)
REAL     ra_rval(8)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  String containing the property
s_dval = “< 123.1, -45.6, 7.89>”
 
#  Parse the data contained in the string
i_return_value =                                  @
   lbc_lp_parse_vec                               @
      (  s_dval,                                  @
         ia_field_id,                             @
         ia_null_flag,                            @
         ra_rval )
dump i_return_value
 
#  Field IDs
dump ia_field_id
 
#  Flag to indicate NULL
dump ia_null_flag
 
#  Real value of DVAL
dump ra_rval
#---------------------------------------------------------------------
lbc_plot_markers
()
#  Purpose          :  This file provides an example of a call to the
#                      function lbc_plot_markers()
#
#                      This function creates the graphics marker table
#                      for display on groups
#
#                      In this example the spool database is opened
#                      and group vector table id associated with
#                      “default_group” is obtained. Then this function
#                      is called to create graphic marker tables for
#                      “default_group”.The id of group vector table is
#                      verified again for “default_group”.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function lbc_plot_markers() has the following arguments:
#
#  lbc_plot_markers
#     (  num_lbcs,
#        lbc_ids,
#        num_grps,
#        grp_ids )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_num_lbcs
INTEGER  ia_lbc_ids(4)
INTEGER  i_num_grps
INTEGER  ia_grp_ids(2)
INTEGER  i_return_value
STRING   s_group_name[16]
INTEGER  i_vector_id
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Get the load vector table associated with the group
i_return_value =                                  @
   ga_group_load_vector_get                       @
      (  “default_group”,                         @
         i_vector_id )
dump i_return_value
dump i_vector_id
 
#  Number of lbc Ids
#  num_lbcs = 4 (fillet_transition, 400_psi, 200_psi and TZ_fixed)
i_num_lbcs = 4
 
#  Lbc Ids to process
ia_lbc_ids = [1,2,3,4]
 
#  Number of groups
i_num_grps= 1
 
#  Group ID = 1 for “default_group”
ia_grp_ids = [1,0]
 
#  Create graphics marker tables for display on groups
i_return_value =                                  @
   lbc_plot_markers                               @
      (  i_num_lbcs,                              @
         ia_lbc_ids,                              @
         i_num_grps,                              @
         ia_grp_ids )
dump i_return_value
 
#  Get the load vector table associated with the “default_group”
i_return_value =                                  @
   ga_group_load_vector_get                       @
      (  “default_group”,                         @
         i_vector_id )
dump i_return_value
dump i_vector_id
 
#  It can be observed that the load vector table id increased by 1
#  which infers that a new Group Vector table is created for
#  “default_group”
#---------------------------------------------------------------------
 
lbc_show_plot_scalar
()
#  Purpose          :  This file provides an example of a call to the
#                      function lbc_show_plot_scalar()
#
#                      This function loads scalar graphics table for
#                      specified loads and boundary condition and
#                      assigns them to the specified groups . It is 
#                      also the main application routine for Loads/BCs
#                      show plot scalar option. 
#
#                      In this example the spool database is opened 
#                      and scalar plot for lbcs “fillet_transition”,
#                      “400_psi” and “200_psi” are displayed.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#
#  The function lbc_show_plot_scalar()
#  has the following arguments:
#
#  lbc_show_plot_scalar
#     (  type_name,
#        type_id,
#        dynamic_val,
#        var_name,
#        component,
#        num_lbcs,
#        lbc_ids,
#        num_grps,
#        group_ids )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_type_name[32]
INTEGER  i_type_id
REAL     r_dynamic_val
STRING   s_var_name[64]
STRING   s_component[64]
INTEGER  i_num_lbcs
INTEGER  ia_lbc_ids(3)
INTEGER  i_num_grps
INTEGER  ia_group_ids(1)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Details of loads for which scalar graphics table is loaded
s_type_name = “Pressure”
i_type_id = 8
r_dynamic_val = 0.0
s_var_name = “Bot Surf Pressure”
s_component = “Resultant”
i_num_lbcs = 3
ia_lbc_ids = [1,2,3]
i_num_grps = 1
ia_group_ids = [1]
 
#  Call the function to plot scalars on graphics window
i_return_value =                                  @
   lbc_show_plot_scalar                           @
      (  s_type_name,                             @
         i_type_id,                               @
         r_dynamic_val,                           @
         s_var_name,                              @
         s_component,                             @
         i_num_lbcs,                              @
         ia_lbc_ids,                              @
         i_num_grps,                              @
         ia_group_ids )
dump i_return_value
#---------------------------------------------------------------------
 
loadcase_create2
()
#  Purpose          :  This file provides an example of a call to the
#                      function loadcase_create2()
#
#                      This function creates a new loadcase in the 
#                      database.
#
#                      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 loadcase_create2()
#  has the following arguments:
#
#  loadcase_create2 ( loadcase_name,     @
#                     loadcase_type,     @
#                     loadcase_desp,     @
#                     scale_factor,      @
#                     lbcs_name,         @
#                     priorities,        @
#                     lbc_scales,        @
#                     dynamic_lc,        @  
#                     mv,                @
#                     make_current ) 
#
#---------------------------------------------------------------------
#  Variable Declarations
 
STRING    loadcase_name[32]    
STRING    loadcase_type[32]    
STRING    loadcase_desp[32]   
REAL      scale_factor     
STRING    lbcs_name[32](2)
INTEGER   priorities(2)
REAL      lbc_scales(2)     
STRING    dynamic_lc[32]
REAL      mv            
LOGICAL   make_current
INTEGER   i_return_value 
INTEGER   fem_create_mesh_solid_num_nodes
INTEGER   fem_create_mesh_solid_num_elems
STRING    fem_create_mesh_s_nodes_created[VIRTUAL]
STRING    fem_create_mesh_s_elems_created[VIRTUAL]
STRING    asm_create_hpat_xyz_created_ids[VIRTUAL]
 
#---------------------------------------------------------------------
# Open a new database
 
    IF( !db_is_open()) THEN
        uil_file_new.go( "", "new.db" )
    ENDIF
    
$? YES 36000002
 
#---------------------------------------------------------------------
# Create Geometric entities
 
asm_const_hpat_xyz( "1", "<10 10 10>", "[0 0 0]", "Coord 0",         @
                    asm_create_hpat_xyz_created_ids )
 
#---------------------------------------------------------------------
# Create Finite Element entities 
 
fem_create_mesh_sol_3( "IsoMesh", 0, "Solid 1 ", 1, [2.], "Hex8",    @
                       "1", "1", "Coord 0", "Coord 0",               @
                       fem_create_mesh_solid_num_nodes,              @
                       fem_create_mesh_solid_num_elems,              @
                       fem_create_mesh_s_nodes_created,              @
                       fem_create_mesh_s_elems_created )
 
#---------------------------------------------------------------------
# Create Displacement Boundary condition "New_disp"
 
loadsbcs_create2( "New_disp", "Displacement", "Nodal", "", "Static", @
                  [ "Node 6:216:6"], "FEM", "Coord 0", "1.",         @
                  ["<0 0 0     >", "<0 0  0     >"], [ "", ""] )
 
#---------------------------------------------------------------------
# Create Force Boundary condition "New_load"
 
loadsbcs_create2( "New_load", "Force", "Nodal", "", "Static",        @
                  ["Node 1:211:6"], "FEM", "Coord 0", "1.",          @
                  ["<0 0 -100     >", "<0 0 0     >"], ["", ""] )
 
#---------------------------------------------------------------------
# Argument Initialization.
 
loadcase_name     = "NEW LOAD CASE"
loadcase_type     = "Static" 
loadcase_desp     = "Example Load Case"        
scale_factor      = 1.0
lbcs_name(1)      = "New_disp"
lbcs_name(2)      = "New_load"
priorities(1)     = 0
priorities(2)     = 0
lbc_scales(1)     = 1.
lbc_scales(2)     = 1.
dynamic_lc        = ""
mv                = 0.
make_current      = TRUE
 
#---------------------------------------------------------------------
# New Load Case Created as a "NEW LOAD CASE"
 
i_return_value = loadcase_create2 ( loadcase_name,                   @
                                    loadcase_type,                   @
                                    loadcase_desp,                   @
                                    scale_factor,                    @
                                    lbcs_name,                       @
                                    priorities,                      @
                                    lbc_scales,                      @
                                    dynamic_lc,                      @
                                    mv,                              @
                                    make_current )
 
#---------------------------------------------------------------------
# Dump the return value of the function and its status
 
dump i_return_value
 
#---------------------------------------------------------------------
# closing the patran environment.
 
# uil_file_close.goquit(  )
 
#---------------------------------------------------------------------
#  End of File.
loadsbcs_get_appl_region_list
()
#  Purpose          :  This file provides an example of a call to the
#                      function loadsbcs_get_appl_region_list()
#
#                      This function gets the application region
#                      entities - types, ids, and sub-ids from
#                      the database.
#
#                      In this example the spool database is
#                      opened and details of application region for 
#                      lbc “400_psi” is obtained
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function loadsbcs_get_appl_region_list()
#  has the following arguments:
#
#  loadsbcs_get_appl_region_list
#     (  id,
#        region_id,
#        ent_count,
#        geo_str,
#        app_list )
#
#--------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_lbc_id
INTEGER  i_region_id
INTEGER  i_ent_count
STRING   s_geo_str[16]
STRING   sv_app_list[VIRTUAL]
INTEGER  i_return_value
 
INTEGER  ia_count(2) 
INTEGER  ia_region_ids(2)
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  i_lbc_id = 2 for Pressure “400_psi”
i_lbc_id = 2
 
#  Gets the ids of the application regions
i_return_value =                                  @
   db_count_lbc_appl_region_entity                @
      ( i_lbc_id,                                 @
        ia_region_ids,                            @
        ia_count )
i_region_id = ia_region_ids(1)
i_ent_count = ia_count(1)
 
#  Get the application region entities details
i_return_value =                                  @
   loadsbcs_get_appl_region_list                  @
      (  i_lbc_id,                                @
         i_region_id,                             @
         i_ent_count,                             @
         s_geo_str,                               @
         sv_app_list )
dump i_return_value
dump s_geo_str
dump sv_app_list
 
#  Free memory
sys_free_string(sv_app_list)
#---------------------------------------------------------------------
loadsbcs_lp_coord
()
#  Purpose          :  This file provides an example of a call to the
#                      function loadsbcs_lp_coord()
#
#                      This function returns the coordinate system id
#                      on input of the coordinate system list
#
#                      In this example a new database is opened and
#                      id of the default coordinate system “COORD 0”
#                      is obtained.
#
#                      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 loadsbcs_lp_coord() has the following arguments:
#
#  loadsbcs_lp_coord
#     (  cid_list,
#        cid_id )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_cid_list[32]
INTEGER  i_cid_id
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “spool.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Coordinate system list
s_cid_list = “COORD 0”
 
#  Get the Coordinate system id
i_return_value =                                  @
   loadsbcs_lp_coord                              @
      (  s_cid_list,                              @
         i_cid_id )
dump i_return_value
dump i_cid_id
#---------------------------------------------------------------------