Tutorial Toolkit Code Examples > Fields > 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_delete_field
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_delete_field()
#
#                      This function deletes the specified field from
#                      the database.
#
#                      In this example new database will be opened by
#                      name new.db and 2 fields,”field_1” & “field_2”
#                      are created. Then “field_2” is deleted.
#                      Deletion can be confirmed from the maximum id
#                      obtained before and after deletion
#
#                      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_field()
#  has the following arguments:
#
#  db_delete_field
#     (  id )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_id
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Create field “field_1”
i_return_value =                                                 @
   fields_create                                                 @
      (  “field_1”, “Spatial”, 1, “Scalar”, “Real”,              @
         “Coord 0”, ““, “Table”, 1, ““, “Y”, ““, ““, ““, ““,     @
         FALSE, [1., 2., 3., 4., 5., 6., 7., 8.], [0.], [0.],    @
         [[[10.]][[20.]][[30.]][[40.]][[50.]][[60.]][[70.]]      @
         [[80.]]]  )
dump i_return_value
 
#  Create field “field_2”
i_return_value =                                                 @
   fields_create                                                 @
      (  “field_2”, “Spatial”, 1, “Scalar”, “Real”,              @
         “Coord 0”, ““, “Function”, 1, “X”, ““, ““, “10*’X”,     @
         ““, ““, FALSE, [0.], [0.], [0.], [[[0.]]] )
dump i_return_value
 
#  Get the largest field id
i_return_value =                                                 @
   db_get_max_field                                              @
      (  i_id )
dump i_return_value
dump i_id
 
#  Delete the field with largest field id
i_return_value =                                                 @
   db_delete_field                                               @
      (  i_id )
dump i_return_value
 
#  Get the largest field id again.
i_return_value =                                                 @
   db_get_max_field                                              @
      (  i_id )
dump i_return_value
dump i_id
 
#  Note the change in maximum field ID.
#---------------------------------------------------------------------
db_delete_field_res
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_delete_field_res()
#
#                      This function deletes records in the field_res
#                      _elem table or field_res_node table in the
#                      database.
#
#                      In this example the spool.db database is opened
#                      and a new lbc field (“new_field_lbc”) is
#                      created. This function is called to delete the
#                      records in field_res_elem.
#                      As there is no function for reading field_res_
#                      elem or field_res_node, user can confirm the
#                      deletion by using QLI on spool.db before and
#                      after the calling of 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_delete_field_res()
#  has the following arguments:
#
#  db_delete_field_res
#     (  id )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_id
INTEGER  i_field_id
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_id
INTEGER  i_nvals = 4
INTEGER  ia_method(4)
INTEGER  ia_eid(4)
INTEGER  ia_elem_face(4)
INTEGER  ia_elem_edge(4)
INTEGER  ia_node_pos(4)
INTEGER  ia_nodeid(4)
REAL     ra_vals(4)
INTEGER  i_return_value
INTEGER  i_field_id
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Create an lbc field
i_return_value =                                                   @
   db_create_field_lbc                                             @
      (  i_field_id,”new_field_lbc”,0,0,124,4,[306,307,308,309],   @
         [1,1,1,1], [1,2,3,4], [4,2,1,3], [1.,2.,3.,4.] )
dump i_return_value
dump i_field_id
 
#  Delete records in “field_res_elem”
i_id           = i_field_id
i_return_value =                                                   @
   db_delete_field_res                                             @
      (  i_id )
dump i_return_value
#---------------------------------------------------------------------
db_get_all_field_names
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_all_field_names()
#
#                      This function gets all lbc object names from
#                      field table of database by get all, get next 
#                      method.
#
#                      In this example the spool database is opened
#                      and a new field (“new_field”) is created. Then
#                      this function is called to get records from
#                      field table. The records are then read one by
#                      one using function db_get_next_field_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_field_names()
#  has the following arguments:
#
#  db_get_all_field_names
#     (  object )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_object
INTEGER  i_id
STRING   s_name[32]
INTEGER  i_all_status
INTEGER  i_next_status
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Object Id of selected rows
#  i_object =  0(Spatial),1(Material),2(Non-spatial or time)
i_object = 0
 
#  Create field “new_field”
i_return_value =                                           @
   fields_create                                           @
      (  “new_field”, “Spatial”, 1, “Scalar”, “Real”,      @
         “Coord 0”, ““, “Function”, 1, “X”, ““, ““,        @
         “10*’X”, ““, ““, FALSE, [0.], [0.], [0.],         @
         [[[0.]]]  )
dump i_return_value
 
#  Get all the lbc object names
i_all_status =                                             @
   db_get_all_field_names                                  @
      (  i_object )
dump i_all_status
 
#  Get next lbc object names
WHILE ( i_next_status == 0 )
   i_next_status =                                         @
      db_get_next_field_name                               @
         (  i_id,                                          @
            s_name )
   dump i_next_status
   IF ( i_next_status == 0 ) THEN
      dump i_id
      dump s_name
   END IF
END WHILE
#---------------------------------------------------------------------
db_get_field_attrs
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_field_attrs()
#
#                      This function gets the attributes of specified
#                      field from database.
#
#                      In this example a new database is opened and
#                      a field of type “Spatial” is created. Then
#                      attributes of created field are obtained using
#                      this function.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_field_attrs()
#  has the following arguments:
#
#  db_get_field_attrs
#     (  id,
#        name,
#        object,
#        nvar,
#        ivar1,
#        ivar2,
#        ivar3 )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_id
STRING   s_name[32]
INTEGER  i_object
INTEGER  i_nvar
INTEGER  i_ivar1
INTEGER  i_ivar2
INTEGER  i_ivar3
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Create field “new_field”
i_return_value =                                                 @
   fields_create                                                 @
      (  “new_field”, “Spatial”, 1, “Scalar”, “Real”, “Coord 0”, @
         ““, “Table”, 1, ““, “Y”, ““, ““, ““, ““, FALSE, [1.,    @
         2., 3., 4., 5., 6., 7., 8.], [0.], [0.], [[[10.]][[20.]]@
         [[30.]][[40.]][[50.]][[60.]][[70.]][[80.]]]  )
dump i_return_value
 
#  Get the id of the field
i_return_value =                                                 @
   db_get_field_id                                               @
      (  “new_field”,                                            @
         i_id )
dump i_return_value
dump i_id
 
#  Get the field attributes
i_return_value =                                                 @
   db_get_field_attrs                                            @
      (  i_id,                                                   @
         s_name,                                                 @
         i_object,                                               @
         i_nvar,                                                 @
         i_ivar1,                                                @
         i_ivar2,                                                @
         i_ivar3 )
dump i_return_value
dump s_name
dump i_object
dump i_nvar
dump i_ivar1
dump i_ivar2
dump i_ivar3
 
#  For details of field  attributes refer Chapter 9 of MSC Patran
#  Users manual ( Vol. 4 - Release 1.4 )
#---------------------------------------------------------------------
db_get_field_dfem
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_field_dfem()
#
#                      This function gets the details of specified lbc
#                      field from the database
#
#                      In this example the spool database is opened
#                      and a new lbc field (“new_field_lbc”) is
#                      created. Then this function is called to get
#                      lbc details of fields “400_20_psi_transition”
#                      and “new_field_lbc”.
#
#                      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_field_dfem() has the following arguments:
#
#  db_get_field_dfem
#     (  id,
#        nvals,
#        method,
#        eid,
#        elem_face,
#        elem_edge,
#        node_pos,
#        nodeid,
#        vals )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_id
INTEGER  i_nvals = 4
INTEGER  ia_method(4)
INTEGER  ia_eid(4)
INTEGER  ia_elem_face(4)
INTEGER  ia_elem_edge(4)
INTEGER  ia_node_pos(4)
INTEGER  ia_nodeid(4)
REAL     ra_vals(4)
INTEGER  i_return_value
INTEGER  i_field_id
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Create an lbc field
i_return_value =                                                   @
   db_create_field_lbc                                             @
      (  i_field_id,”new_field_lbc_a”,0,0,124,4,[306,307,308,309], @
         [1,1,1,1], [1,2,3,4], [4,2,1,3], [1.,2.,3.,4.] )
dump i_return_value
dump i_field_id
 
#  Get the lbc field details for field “400_20_psi_transition” and
#  “new_field_lbc_a”
FOR ( i_id = 1 TO 2 )
   i_return_value =                                                @
      db_get_field_dfem                                            @
         (  i_id,                                                  @
            i_nvals,                                               @
            ia_method,                                             @
            ia_eid,                                                @
            ia_elem_face,                                          @
            ia_elem_edge,                                          @
            ia_node_pos,                                           @
            ia_nodeid,                                             @
            ra_vals )
   dump i_return_value
   dump i_id
   dump i_nvals
   dump ia_method
   dump ia_eid
   dump ia_elem_face
   dump ia_elem_edge
   dump ia_node_pos
   dump ia_nodeid
   dump ra_vals
END FOR
#---------------------------------------------------------------------
db_get_field_id
()
#  Purpose          :  This file provides an example of 2 calls to the
#                      function db_get_field_id()
#
#                      This function gets the field id for a specified
#                      field name in the database.
#
#                      In this example the spool database is opened
#                      and this function is called to get the field id 
#                      of “400_20_psi_transition”.
#
#                      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_field_id()
#  has the following arguments:
#
#  db_get_field_id
#     (  name,
#        id )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_name[32]
INTEGER  i_id
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Get the id of the field
s_name = “400_20_psi_transition”
i_return_value =                                           @
   db_get_field_id                                         @
      (  s_name,                                           @
         i_id )
dump i_return_value
dump i_id
#---------------------------------------------------------------------
db_get_field_lbc
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_field_lbc()
#
#                      This session file will open a new database and
#                      will draw a surface meshed with QUAD4 elements.
#                      A spatial field will be created using FEM
#                      method associated with four nodes. The same
#                      field will be read back.
#
#                      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_field_lbc()
#  has the following arguments:
#
#  db_get_field_lbc
#     (  id,
#        nvals,
#        eid,
#        elem_face,
#        elem_edge,
#        node_pos,
#        vals )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_id
STRING   s_name[32]
INTEGER  i_type
INTEGER  i_ent_type
INTEGER  i_nvals
INTEGER  ia_eid(4)
INTEGER  ia_elem_face(4)
INTEGER  ia_elem_edge(4)
INTEGER  ia_node_pos(4)
REAL     ra_vals(4)
INTEGER  i_return_value
STRING   sv_asm_create_patch_xy_created[VIRTUAL]
INTEGER  i_fem_create_mesh_surfa_num_nd
INTEGER  i_fem_create_mesh_surfa_num_el
STRING   sv_fem_create_mesh_s_nodes_crt[VIRTUAL]
STRING   sv_fem_create_mesh_s_elems_crt[VIRTUAL]
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
#  Creating a Hpat surface.
i_return_value =                                                     @
   asm_const_patch_xyz( “1”, “<1 1 0>”, “[0 0 0]”, “Coord 0”,        @
      sv_asm_create_patch_xy_created )
dump i_return_value
#---------------------------------------------------------------------
#  Meshing the plate with QUAD4 elements.
ui_exec_function( “mesh_seed_display_mgr”, “init” )
i_return_value =                                                     @
   fem_create_mesh_surf_2( “IsoMesh”, 0, “Surface 1 “, 1, [0.1],     @
      “Quad4”, “1”, “1”, “Coord 0”, “Coord 0”,                       @
      i_fem_create_mesh_surfa_num_nd, i_fem_create_mesh_surfa_num_el,@
      sv_fem_create_mesh_s_nodes_crt, sv_fem_create_mesh_s_elems_crt)
dump i_return_value
mesh_seed_display_mgr.erase(  )
#---------------------------------------------------------------------
#  Calling function to create a field which has values associated with 
#  four nodes.
i_id=1
s_name=”lbc_field”
i_type=1
i_ent_type=123
i_nvals=4
ia_eid=[1,2,3,4]
ra_vals=[10.,20.,30.,40.]
#
i_return_value =                                 @
   field_create_field_lbc                        @
      (  i_id,                                   @
         s_name,                                 @
         i_type,                                 @
         i_ent_type,                             @
         i_nvals,                                @
         ia_eid,                                 @
         ia_elem_face,                           @
         ia_elem_edge,                           @
         ia_node_pos,                            @
         ra_vals )
dump i_return_value
 
#---------------------------------------------------------------------
#  Calling function to read the field data.
i_nvals=4
ia_eid=[0,0,0,0]
ra_vals=[0.,0.,0.,0.]
#
i_return_value =                                 @
   db_get_field_lbc                              @
      (  i_id,                                   @
         i_nvals,                                @
         ia_eid,                                 @
         ia_elem_face,                           @
         ia_elem_edge,                           @
         ia_node_pos,                            @
         ra_vals )
dump i_return_value
dump i_nvals,ia_eid,ra_vals
#---------------------------------------------------------------------
db_get_field_lbc_type
()
#  Purpose          :  This file provides an example of multiple calls
#                      to the function db_get_field_lbc_type()
#
#                      This function gets the lbc type and object of
#                      an specified field from the database.
#
#                      In this example 3 fields of with different
#                      combination of lbc type and object are created.
#                      Then this function is called to get the object
#                      and type details of field.
#
#                      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_field_lbc_type()
#  has the following arguments:
#
#  db_get_field_lbc_type
#     (  id,
#        type,
#        object )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_id
INTEGER  i_type
INTEGER  i_object
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Create field “stat_field_1”
i_return_value =                                                 @
   fields_create                                                 @
      (  “stat_field_1”, “Spatial”, 1, “Scalar”, “Real”,         @
         “Coord 0”, ““, “Table”, 1, ““, “Y”, ““, ““, ““, ““,     @
         FALSE, [1., 2., 3., 4., 5., 6., 7., 8.], [0.], [0.],    @
         [[[10.]][[20.]][[30.]][[40.]][[50.]][[60.]][[70.]]      @
         [[80.]]]  )
dump i_return_value
 
#  Create field “stat_field_2”
i_return_value =                                                 @
   fields_create                                                 @
      (  “stat_field_2”, “Spatial”, 1, “Vector”, “Real”,         @
         “Coord 0”, ““, “Function”, 1, “X”, ““, ““, “10*’X”,     @
         “0”, “0”, FALSE, [0.], [0.], [0.], [[[0.]]] )
dump i_return_value
 
#  Create field “trans_field”
i_return_value =                                                 @
   fields_create                                                 @
      (  “trans_field”, “Non-Spatial”, 1, “Scalar”, “Real”,      @
         ““, ““, “Table”, 1, “t”, ““, ““, ““, ““, ““, FALSE,     @
         [1., 2., 3., 4., 5.], [0.], [0.], [[[10.]][[20.]][[30.]]@
         [[40.]][[50.]]] )
dump i_return_value
 
#  Get the lbc type id for field
FOR ( i_id = 1 TO 3 )
   i_return_value =                                              @
      db_get_field_lbc_type                                      @
         (  i_id,                                                @
            i_type,                                              @
            i_object )
   dump i_return_value
   dump i_id
   dump i_type
   dump i_object
END FOR
 
#  For object and type details of field attributes refer Part 9
#  Section 9.13 of MSC Patran Users manual ( Vol. 4 - Release 1.4 )
#---------------------------------------------------------------------
db_get_max_field_id
()
#  Purpose          :  This file provides an example of two calls to 
#                      the function db_get_max_field_id()
#
#                      This function gets the largest field id from
#                      the database.
#
#                      In this example the spool database is opened
#                      and a new field (“new_field”) is created. Then
#                      this function is called to get the largest
#                      field id.
#                      List of fields and their ids used in this
#                      example.
#                               400_20_psi_transition (id = 1)
#                               new_field (id = 2)
#
#                      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_max_field_id()
#  has the following arguments:
#
#  db_get_max_field
#     (  id )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_id
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Get the largest field id
i_return_value =                                           @
   db_get_max_field                                        @
      (  i_id )
dump i_return_value
dump i_id
 
#  Create field “new_field”
i_return_value =                                           @
   fields_create                                           @
      (  “new_field”, “Spatial”, 1, “Scalar”, “Real”,      @
         “Coord 0”, ““, “Function”, 1, “X”, ““, ““,        @
         “10*’X”, ““, ““, FALSE, [0.], [0.], [0.],         @
         [[[0.]]]  )
dump i_return_value
 
#  Get the largest field id
i_return_value =                                           @
   db_get_max_field                                        @
      (  i_id )
dump i_return_value
dump i_id
 
#  It can be observed that i_id = 2 after “new_field” is created.
#---------------------------------------------------------------------
db_get_next_field_name
()
#  Purpose          :  This file provides an example of multiple calls
#                      to the function db_get_next_field_name()
#
#                      This function gets the next lbc object name
#                      from field table of database, by get all, get
#                      next method.
#
#                      In this example the spool database is opened
#                      and a new field (“new_field”) is created. Then
#                      the function db_get_all_field_names() is
#                      called to get records from field 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_field_name()
#  has the following arguments:
#
#  db_get_next_field_name
#     (  id,
#        name )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_object
INTEGER  i_id
STRING   s_name[32]
INTEGER  i_all_status
INTEGER  i_next_status
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Object Id of selected rows
#  i_object =  0(Spatial),1(Material),2(Non-spatial or time)
i_object = 0
 
#  Create field “new_field”
i_return_value =                                           @
   fields_create                                           @
      (  “new_field”, “Spatial”, 1, “Scalar”, “Real”,      @
         “Coord 0”, ““, “Function”, 1, “X”, ““, ““,        @
         “10*’X”, ““, ““, FALSE, [0.], [0.], [0.],         @
         [[[0.]]]  )
dump i_return_value
 
#  Get all the lbc object names
i_all_status =                                             @
   db_get_all_field_names                                  @
      (  i_object )
dump i_all_status
 
#  Get next lbc object names
WHILE ( i_next_status == 0 )
   i_next_status =                                         @
      db_get_next_field_name                               @
         (  i_id,                                          @
            s_name )
   dump i_next_status
   IF ( i_next_status == 0 ) THEN
      dump i_id
      dump s_name
   END IF
END WHILE
#---------------------------------------------------------------------
 
db_modify_field
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_modify_field()
#
#                      This session file will open a new database and
#                      will create a spatial field with PCL Function
#                      ‘x+(y*z)’. The same field will be modified by
#                      changing the function to ‘x-(y/2)+z’ and the
#                      modified field will be displayed. The 
#                      extrapolation option will also be modified from
#                      1 to 2.
#
#                      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_field() has the following arguments:
#
#  db_modify_field
#     (  id,
#        name,
#        object,
#        type,
#        etype,
#        eid,
#        extra_opt,
#        cid_type,
#        cid,
#        defn_type,
#        nvar,
#        ivar1,
#        ivar2,
#        ivar3,
#        fn1_size,
#        fn2_size,
#        fn3_size,
#        fn1,
#        fn2,
#        fn3,
#        lin_def,
#        nxvals,
#        nyvals,
#        nzvals,
#        xvals,
#        yvals,
#        zvals,
#        vals )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_id
STRING   s_name[32]
INTEGER  i_object
INTEGER  i_type
INTEGER  i_etype
INTEGER  i_eid
INTEGER  i_extra_opt
INTEGER  i_cid_type
INTEGER  i_cid
INTEGER  i_defn_type
INTEGER  i_nvar
INTEGER  i_ivar1
INTEGER  i_ivar2
INTEGER  i_ivar3
INTEGER  i_fn1_size
INTEGER  i_fn2_size
INTEGER  i_fn3_size
STRING   s_fn1[16]
STRING   s_fn2[16]
STRING   s_fn3[16]
LOGICAL  l_lin_def
INTEGER  i_nxvals
INTEGER  i_nyvals
INTEGER  i_nzvals
REAL     ra_xvals(8)
REAL     ra_yvals(8)
REAL     ra_zvals(8)
REAL     ra_vals(8)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
#  Creating scalar field with X Y and Z as variables and a single 
#  formula - x+(y*z) and extrapolation option as 1.
i_return_value =                                                     @
   fields_create( “sp_pcl_sca_r”, “Spatial”, 1, “Scalar”, “Real”,    @
      “Coord 0”, ““, “Function”, 3, “X”, “Y”, “Z”, “‘x+(‘y*’z)”, ““, @
      ““, FALSE, [0.], [0.], [0.], [ [[0.]]] )
dump i_return_value
 
i_return_value = db_get_field_id(“sp_pcl_sca_r”,i_id)
dump i_return_value,i_id
#---------------------------------------------------------------------
#  Calling function to read the data of the modified function.
i_return_value =                                 @
   db_get_field                                  @
      (  i_id,                                   @
         s_name,                                 @
         i_object,                               @
         i_type,                                 @
         i_etype,                                @
         i_eid,                                  @
         i_extra_opt,                            @
         i_cid_type,                             @
         i_cid,                                  @
         i_defn_type,                            @
         i_nvar,                                 @
         i_ivar1,                                @
         i_ivar2,                                @
         i_ivar3,                                @
         i_fn1_size,                             @
         i_fn2_size,                             @
         i_fn3_size,                             @
         l_lin_def,                              @
         i_nxvals,                               @
         i_nyvals,                               @
         i_nzvals )
dump i_return_value
 
dump i_id,s_name,i_object,i_type,i_extra_opt,i_cid_type,i_cid
dump i_defn_type,i_nvar,i_ivar1,i_ivar2,i_ivar3,i_fn1_size,l_lin_def
#---------------------------------------------------------------------
#  Modifying the field “sp_pcl_sca_r” and changing the function 
#  to -  x-(y/2)+z
s_name=”sp_pcl_sca_r”
i_object=0
i_type=0
i_extra_opt=2
i_cid_type=0
i_cid=0
i_defn_type=0
i_nvar=1
i_ivar1=1
i_ivar2=2
i_ivar3=3
i_fn1_size=13
s_fn1=”’x-(‘y/’2)+’z”
l_lin_def=FALSE
#
i_return_value =                                 @
   db_modify_field                               @
      (  i_id,                                   @
         s_name,                                 @
         i_object,                               @
         i_type,                                 @
         i_etype,                                @
         i_eid,                                  @
         i_extra_opt,                            @
         i_cid_type,                             @
         i_cid,                                  @
         i_defn_type,                            @
         i_nvar,                                 @
         i_ivar1,                                @
         i_ivar2,                                @
         i_ivar3,                                @
         i_fn1_size,                             @
         i_fn2_size,                             @
         i_fn3_size,                             @
         s_fn1,                                  @
         s_fn2,                                  @
         s_fn3,                                  @
         l_lin_def,                              @
         i_nxvals,                               @
         i_nyvals,                               @
         i_nzvals,                               @
         ra_xvals,                               @
         ra_yvals,                               @
         ra_zvals,                               @
         ra_vals )
dump i_return_value
 
#---------------------------------------------------------------------
#  Calling function to read the data of the modified function.
s_name=””
i_nvar=0
i_fn1_size=0
 
i_return_value =                                 @
   db_get_field                                  @
      (  i_id,                                   @
         s_name,                                 @
         i_object,                               @
         i_type,                                 @
         i_etype,                                @
         i_eid,                                  @
         i_extra_opt,                            @
         i_cid_type,                             @
         i_cid,                                  @
         i_defn_type,                            @
         i_nvar,                                 @
         i_ivar1,                                @
         i_ivar2,                                @
         i_ivar3,                                @
         i_fn1_size,                             @
         i_fn2_size,                             @
         i_fn3_size,                             @
         l_lin_def,                              @
         i_nxvals,                               @
         i_nyvals,                               @
         i_nzvals )
dump i_return_value
 
dump i_id,s_name,i_object,i_type,i_extra_opt,i_cid_type,i_cid
dump i_defn_type,i_nvar,i_ivar1,i_ivar2,i_ivar3,i_fn1_size,l_lin_def
#---------------------------------------------------------------------
field_create_field_lbc
()
#  Purpose          :  This file provides an example of a call to the
#                      function field_create_field_lbc()
#
#                      This session file will open a new database and
#                      will draw a surface meshed with QUAD4 elements.
#                      A spatial field will be created using FEM
#                      method associated with four nodes. The same
#                      field will be read back.
#
#                      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 field_create_field_lbc()
#  has the following arguments:
#
#  field_create_field_lbc
#     (  id,
#        name,
#        type,
#        ent_type,
#        nvals,
#        eid,
#        elem_face,
#        elem_edge,
#        node_pos,
#        vals )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_id
STRING   s_name[32]
INTEGER  i_type
INTEGER  i_ent_type
INTEGER  i_nvals
INTEGER  ia_eid(4)
INTEGER  ia_elem_face(4)
INTEGER  ia_elem_edge(4)
INTEGER  ia_node_pos(4)
REAL     ra_vals(4)
INTEGER  i_return_value
STRING   sv_asm_create_patch_xy_created[VIRTUAL]
INTEGER  i_fem_create_mesh_surfa_num_nd
INTEGER  i_fem_create_mesh_surfa_num_el
STRING   sv_fem_create_mesh_s_nodes_crt[VIRTUAL]
STRING   sv_fem_create_mesh_s_elems_crt[VIRTUAL]
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
#  Creating a Hpat surface.
i_return_value =                                                     @
   asm_const_patch_xyz( “1”, “<1 1 0>”, “[0 0 0]”, “Coord 0”,        @
      sv_asm_create_patch_xy_created )
dump i_return_value
#---------------------------------------------------------------------
#  Meshing the plate with QUAD4 elements.
ui_exec_function( “mesh_seed_display_mgr”, “init” )
i_return_value =                                                     @
   fem_create_mesh_surf_2( “IsoMesh”, 0, “Surface 1 “, 1, [0.1],     @
      “Quad4”, “1”, “1”, “Coord 0”, “Coord 0”,                       @
      i_fem_create_mesh_surfa_num_nd, i_fem_create_mesh_surfa_num_el,@
      sv_fem_create_mesh_s_nodes_crt, sv_fem_create_mesh_s_elems_crt)
dump i_return_value
mesh_seed_display_mgr.erase(  )
#---------------------------------------------------------------------
#  Calling function to create a field which has values associated with 
#  four nodes.
i_id=1
s_name=”lbc_field”
i_type=1
i_ent_type=123
i_nvals=4
ia_eid=[1,2,3,4]
ra_vals=[10.,20.,30.,40.]
#
i_return_value =                                 @
   field_create_field_lbc                        @
      (  i_id,                                   @
         s_name,                                 @
         i_type,                                 @
         i_ent_type,                             @
         i_nvals,                                @
         ia_eid,                                 @
         ia_elem_face,                           @
         ia_elem_edge,                           @
         ia_node_pos,                            @
         ra_vals )
dump i_return_value
 
#---------------------------------------------------------------------
#  Calling function to read the field data.
i_nvals=4
ia_eid=[0,0,0,0]
ra_vals=[0.,0.,0.,0.]
#
i_return_value =                                 @
   db_get_field_lbc                              @
      (  i_id,                                   @
         i_nvals,                                @
         ia_eid,                                 @
         ia_elem_face,                           @
         ia_elem_edge,                           @
         ia_node_pos,                            @
         ra_vals )
dump i_return_value
dump i_nvals,ia_eid,ra_vals
#---------------------------------------------------------------------
 
fields_create_general_term
()
#  Purpose          :  This file provides an example of a call to the
#                      function fields_create_general_term()
#
#                      This function creates a term for a general field 
#                      in the database.
#
#                      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 fields_create_general_term()
#  has the following arguments:
#
#  fields_create_general_term( field_name,                           @
#                              term_field_id,                        @
#                              term_type,                            @
#                              term_id,                              @  
#                              data_length,                          @
#                              data ) 
#
#---------------------------------------------------------------------
#  Variable Declarations
 
STRING    field_name[32]    
INTEGER   term_field_id
INTEGER   term_type
INTEGER   term_id
INTEGER   data_length   
STRING    data[32]
 
STRING    asm_create_hpat_xyz_created_ids[VIRTUAL] 
INTEGER   i_return_value 
#---------------------------------------------------------------------
# Open a new database
 
    IF( !db_is_open()) THEN
        uil_file_new.go( "", "new.db" )
    ENDIF
 
$? YES 36000002
#---------------------------------------------------------------------
# Set the "ABAQUS" prefrence for analysis. 
 
uil_pref_analysis.set_analysis_pref( "ABAQUS", "Structural",         @
                                     ".inp", ".fil" )
#---------------------------------------------------------------------
# Create the two 3D Solids. 
 
asm_const_hpat_xyz( "1", "<1 1 1>", "[0 0 0][1 0 0]", "Coord 0",     @
                     asm_create_hpat_xyz_created_ids )
#---------------------------------------------------------------------
# Create Field for contact LBCs in ABAQUS as "._Lbc_contact_lbc1"
 
fields_create_general( "._Lbc_contact_lbc1", 2, 5, 2,                @
                       "Real", "Coord 0", "",                        @
                       0, 0, 0, 0 )
#---------------------------------------------------------------------
# Argument Initialization.
 
field_name       =  "._Lbc_contact_lbc1"
term_field_id    =  0
term_type        =  0
term_id          =  0
data_length      =  17
data             =  "[1_contact_lbc()]"
 
#---------------------------------------------------------------------
# Create Term for the  Field name "._Lbc_contact_lbc1"
 
fields_create_general_term ( field_name,                             @
                             term_field_id,                          @
                             term_type,                              @
                             term_id,                                @
                             data_length,                            @
                             data)
#---------------------------------------------------------------------
# Argument Initialization.
 
field_name       =  "._Lbc_contact_lbc1" 
term_field_id    =  0
term_type        =  1
term_id          =  1
data_length      =  152
data             =  "contact_lbc(22|12|13|14|15|16|"              // @
                    "19|20|21|22|23|24|25|26|27|28|29|30|31|33|3" // @
                    "5|53|54|1|3|1|1|2|1|1|2|0.02|"               // @
                    "450.|0.|0.|0.|0.|0.|0.|0.|0.0049999999|0.|0."// @
                    "|2|2)" 
#---------------------------------------------------------------------
# Create Term for the  Field name "._Lbc_contact_lbc1"
 
i_return_value = fields_create_general_term ( field_name,            @
                                              term_field_id,         @
                                              term_type,             @
                                              term_id,               @
                                              data_length,           @
                                              data)
#---------------------------------------------------------------------
# Create the contact deform-deform LBCs. 
 
loadsbcs_create2( "contact_lbc", "Contact[Deform-Deform]",           @
                  "Element Uniform",                                 @
                  "3D,3D", "Static", ["Solid 1.2", "Solid 2.1"],     @
                  "Geometry,1,1", "Coord 0", "1.",                   @
                  ["1.", "1.", "", "", "", "", "", "",               @
                  "", "f:._Lbc_contact_lbc1"], ["", "",              @
                  "", "", "", "", "", "", "", ""] )
#---------------------------------------------------------------------
# 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.
field_fem_const_eval
()
#  Purpose          :  This file provides an example of a call to the
#                      function field_fem_const_eval()
#
#                      This session file will open a new database and
#                      will draw a surface meshed with QUAD4 elements.
#                      The function will be called for five locations
#                      which are intermediate to three elements and on
#                      the element boundary at two locations.
#
#                      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 field_fem_const_eval()
#  has the following arguments:
#
#  field_fem_const_eval
#     (  gid,
#        numint,
#        nindep,
#        intrpl,
#        extrap,
#        maxnod,
#        cnst,
#        eids,
#        geoloc,
#        offflg )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_gid
INTEGER  i_numint
INTEGER  i_nindep
REAL     ra_intrpl(5,3)
INTEGER  i_extrap
INTEGER  i_maxnod
REAL     ra_cnst(5,4)
INTEGER  ia_eids(5)
REAL     ra_geoloc(5,3)
INTEGER  ia_offflg(5)
INTEGER  i_return_value
STRING   sv_asm_create_patch_xy_created[VIRTUAL]
INTEGER  i_fem_create_mesh_surfa_num_nd
INTEGER  i_fem_create_mesh_surfa_num_el
STRING   sv_fem_create_mesh_s_nodes_crt[VIRTUAL]
STRING   sv_fem_create_mesh_s_elems_crt[VIRTUAL]
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
#  Creating a Hpat surface.
i_return_value =                                                     @
   asm_const_patch_xyz( “1”, “<5 1 0>”, “[0 0 0]”, “Coord 0”,        @
      sv_asm_create_patch_xy_created )
dump i_return_value
#---------------------------------------------------------------------
#  Meshing the plate with QUAD4 elements.
ui_exec_function( “mesh_seed_display_mgr”, “init” )
i_return_value =                                                     @
   fem_create_mesh_surf_2( “IsoMesh”, 0, “Surface 1 “, 1, [0.2],     @
      “Quad4”, “1”, “1”, “Coord 0”, “Coord 0”,                       @
      i_fem_create_mesh_surfa_num_nd, i_fem_create_mesh_surfa_num_el,@
      sv_fem_create_mesh_s_nodes_crt, sv_fem_create_mesh_s_elems_crt)
dump i_return_value
mesh_seed_display_mgr.erase(  )
#---------------------------------------------------------------------
i_gid=1
i_numint=5
i_nindep=3
ra_intrpl=[[0.,0.,0.][.25,.25,0.][.5,.5,0.][.75,.75,0.][1., 1.,0.]]
i_extrap=1
i_maxnod=4
#
i_return_value =                                 @
   field_fem_const_eval                          @
      (  i_gid,                                  @
         i_numint,                               @
         i_nindep,                               @
         ra_intrpl,                              @
         i_extrap,                               @
         i_maxnod,                               @
         ra_cnst,                                @
         ia_eids,                                @
         ra_geoloc,                              @
         ia_offflg )
dump i_return_value
dump ra_cnst,ia_eids,ra_geoloc,ia_offflg
#---------------------------------------------------------------------
fld_cre_fem_res_sca
()
#  Purpose          :  This file provides an example of a call to the
#                      function fld_cre_fem_res_sca()
#
#                      This session file will open a database field.db
#                      which has analysis results imported.
#                      The results for constrained forces will be
#                      displayed as a scalar plot and a Tabular
#                      Spatial field will be created. The field will
#                      be used for creating a ‘field_res_elem’ table.
#
#                      Before running this session file run ‘field.ses’
#                      to create ‘field.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 fld_cre_fem_res_sca()
#  has the following arguments:
#
#  fld_cre_fem_res_sca
#     (  fid,
#        grpid,
#        scalid )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_fid
INTEGER  i_grpid
INTEGER  i_scalid
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the “field.db” database.
uil_file_open.go( “field.db”)
#---------------------------------------------------------------------
#  Generating scalar results for Constraint Forces.
res_init_fringe_plot(  )
 
res_create_fringe_plot_rec3( 1, 2, 1, 1, 1, 1, 0, 0, 1., ““, 1, 1,@
      3, 23, 1, 1, 0., 30, 0, 1 )
 
res_make_fringe_plot( 1, [1], [1], [““], [0.], [                  @
      “Default, Static  Subcase: Constraint Forces,             “ // @
      “Translational (VEC-MAG) -MSC.Nastran”] )
 
#---------------------------------------------------------------------
#  Creating Spatial field using Tabular method.
i_return_value =                                                     @
   fields_create( “tab”, “Spatial”, 1, “Scalar”, “Real”, “Coord 0”,  @
      ““, “Table”, 1, “X”, ““, ““, ““, ““, ““, FALSE, [0.1,          @
      0.40000001, 0.69999999], [0.], [0.], [[[1.]][[3.]][[5.]]] )
dump i_return_value
 
i_return_value = db_get_field_id(“tab”,i_fid)
dump i_return_value,i_fid
#---------------------------------------------------------------------
#  Scalar element table is created and
#  associated with the Default_group.
 
i_return_value =                                                     @
   ga_elem_scalar_create(“sclr_elm_tabl”,4,[1,5,19,25],[1,1,1,1],1,  @
      [1.2,2.3,3.4,4.5],i_scalid)
dump i_return_value,i_scalid
 
i_return_value = ga_group_elem_scalar_set(“default_group”,i_scalid)
dump i_return_value
#---------------------------------------------------------------------
#  For Default_group ID is 1.
i_grpid        = 1
#
i_return_value =                                 @
   fld_cre_fem_res_sca                           @
      (  i_fid,                                  @
         i_grpid,                                @
         i_scalid )
dump i_return_value
 
#---------------------------------------------------------------------
#  To confirm the creation of the table user should refer to Query
#  Language Interpreter(QLI).
#---------------------------------------------------------------------
#  End Of File
fld_cre_fem_res_vec
()
#  Purpose          :  This file provides an example of a call to the
#                      function fld_cre_fem_res_vec()
#
#                      This session file will open a database field.db
#                      which has analysis results imported for a plate
#                      The results for constrained forces will be
#                      displayed as a vector plot and a Tabular
#                      Spatial field will be created. The field will
#                      be used for creating a ‘field_res_node’ table.
#
#                      Before running this session file run ‘field.ses’
#                      to create ‘field.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 fld_cre_fem_res_vec() has the following arguments:
#
#  fld_cre_fem_res_vec
#     (  fid,
#        vecid,
#        elmflg )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_fid
INTEGER  i_vecid
INTEGER  i_elmflg
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the “field.db” database.
uil_file_open.go( “field.db”)
#---------------------------------------------------------------------
#  Generating vector results for Constraint Forces.
res_init_vector_plot(  )
 
res_create_vector_plot_rec( 1, 1, 3, [27, 28, 29, 0, 0, 0], [1, 1,@
      1], 1, 1, 0, 0, 1, 0., 2, 1, 1, 1 )
 
res_make_vector_plot( 1, [1], [2], [““], [0.], [                  @
      “Default, Static Subcase: Constraint Forces,               “// @
      “Translational -MSC.Nastran”] )
#---------------------------------------------------------------------
#  Creating Spatial field using Tabular method.
i_return_value =                                                     @
   fields_create( “tab”, “Spatial”, 1, “Scalar”, “Real”, “Coord 0”,  @
      ““, “Table”, 1, “X”, ““, ““, ““, ““, ““, FALSE, [0.1,          @
      0.40000001, 0.69999999], [0.], [0.], [[[1.]][[3.]][[5.]]] )
dump i_return_value
 
i_return_value = db_get_field_id(“tab”,i_fid)
dump i_return_value,i_fid
#---------------------------------------------------------------------
#  Vector table is created.
 
i_return_value =                                                     @
   ga_vector_create(“vect_tbl”,1,1,4,[123,123,123,123],[1,5,15,19],  @
      [[0.] [0.] [0.] [0.]],[[.1,.1,.1] [.2,.2,.2] [.3,.3,.3] [.25,  @
      .25,.25]],[1,1,1,1],[1,1,1,1],[0,0,0,0],[0],i_vecid)
dump i_return_value,i_vecid
#---------------------------------------------------------------------
#
i_return_value =                                 @
   fld_cre_fem_res_vec                           @
      (  i_fid,                                  @
         i_vecid,                                @
         i_elmflg )
dump i_return_value
 
#---------------------------------------------------------------------
#  To confirm the creation of the table user should refer to Query
#  Language Interpreter(QLI).
#---------------------------------------------------------------------
#  End Of File
fld_evl_get_maxnod_for_group
()
#  Purpose          :  This file provides an example of a call to the
#                      function fld_evl_get_maxnod_for_group()
#
#                      This function gets the maximum number of nodes
#                      for any element in a specified group.
#
#                      In this example the spool database is opened.
#                      Then the maximum number of nodes for any
#                      elements present in group “fem_model” is 
#                      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 fld_evl_get_maxnod_for_group()
#  has the following arguments:
#
#  fld_evl_get_maxnod_for_group
#     (  gid,
#        maxnod )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_gid
INTEGER  i_maxnod
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Get the group id
i_return_value =                                 @
   db_get_group_id                               @
      (  “fem_model”,                            @
         i_gid  )
dump i_return_value
 
#  Get the maximum number of nodes for any element in group
i_return_value =                                 @
   fld_evl_get_maxnod_for_group                  @
      (  i_gid,                                  @
         i_maxnod )
dump i_return_value
dump i_gid
dump i_maxnod
#---------------------------------------------------------------------
get_field_values
()
#  Purpose          :  This file provides an example of a call to the
#                      function get_field_values()
#
#                      This session file will open a new database and 
#                      draw surface. A spatial field will be created 
#                      with tabular input and parametric coordinate 
#                      frame. Values for three locations will be 
#                      calculated for the field.
#
#                      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 get_field_values()
#  has the following arguments:
#
#  get_field_values
#     (  field_id,
#        num_evals,
#        eval_dim,
#        field_dim,
#        eval_points,
#        field_values )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_field_id
INTEGER  i_num_evals
INTEGER  i_eval_dim
INTEGER  i_field_dim
REAL     ra_eval_points(3,1)
REAL     ra_field_values(3,1)
INTEGER  i_return_value
STRING   sv_asm_create_patch_xy_crtd_ids[VIRTUAL]
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
#  Creating a Hpat surface.
i_return_value =                                                     @
   asm_const_patch_xyz( “1”, “<1 1 0>”, “[0 0 0]”, “Coord 0”,        @
      sv_asm_create_patch_xy_crtd_ids )
dump i_return_value
#---------------------------------------------------------------------
#  Creating a spatial tabular field on parametric coordinate system.
i_return_value =                                                     @
   fields_create( “sp_tb_para_c1”, “Spatial”, 1, “Scalar”,           @
      “Parametric”, ““, “Surface 1.1”, “Table”, 1, “C1”, ““, ““, ““, @
      ““, ““, FALSE, [0.1, 0.25, 0.45, 0.55, 0.8], [0.], [0.],       @
      [[[1.]][[3.]][[2.]][[-45.]][[6.]] ] )
dump i_return_value
 
i_return_value =                                                     @
   db_get_field_id(“sp_tb_para_c1”,i_field_id)
dump i_field_id,i_return_value
#---------------------------------------------------------------------
#  Evaluating the field value at three different locations.
i_num_evals=3
i_eval_dim=1
i_field_dim=1
ra_eval_points=[0.,0.5,1.0 ]
#
i_return_value =                                 @
   get_field_values                              @
      (  i_field_id,                             @
         i_num_evals,                            @
         i_eval_dim,                             @
         i_field_dim,                            @
         ra_eval_points,                         @
         ra_field_values )
dump i_return_value
dump ra_field_values
#---------------------------------------------------------------------
get_field_values_no_trans
()
#  Purpose          :  This file provides an example of a call to the
#                      function get_field_values_no_trans()
#
#                      This session file will open a new database and
#                      draw surface. A spatial field will be created
#                      with tabular input and parametric coordinate
#                      frame. Values for three locations will be
#                      calculated for the field.
#
#                      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 get_field_values_no_trans()
#  has the following arguments:
#
#  get_field_values_no_trans
#     (  field_id,
#        num_evals,
#        eval_dim,
#        field_dim,
#        eval_points,
#        field_values )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_field_id
INTEGER  i_num_evals
INTEGER  i_eval_dim
INTEGER  i_field_dim
REAL     ra_eval_points(3,1)
REAL     ra_field_values(3,1)
INTEGER  i_return_value
STRING   sv_asm_create_patch_xy_crtd_ids[VIRTUAL]
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
#  Creating a Hpat surface.
i_return_value =                                                     @
   asm_const_patch_xyz( “1”, “<1 1 0>”, “[0 0 0]”, “Coord 0”,        @
      sv_asm_create_patch_xy_crtd_ids )
dump i_return_value
#---------------------------------------------------------------------
#  Creating a spatial tabular field on parametric coordinate system.
i_return_value =                                                     @
   fields_create( “sp_tb_para_c1”, “Spatial”, 1, “Scalar”,           @
      “Parametric”, ““, “Surface 1.1”, “Table”, 1, “C1”, ““, ““, ““, @
      ““, ““, FALSE, [0.1, 0.25, 0.45, 0.55, 0.8], [0.], [0.],       @
      [[[1.]][[3.]][[2.]][[-45.]][[6.]] ] )
dump i_return_value
 
i_return_value =                                                     @
   db_get_field_id(“sp_tb_para_c1”,i_field_id)
dump i_field_id,i_return_value
#---------------------------------------------------------------------
#  Evaluating the field value at three different locations.
i_num_evals=3
i_eval_dim=1
i_field_dim=1
ra_eval_points=[0.,0.5,1.0 ]
#
i_return_value =                                 @
   get_field_values_no_trans                     @
      (  i_field_id,                             @
         i_num_evals,                            @
         i_eval_dim,                             @
         i_field_dim,                            @
         ra_eval_points,                         @
         ra_field_values )
dump i_return_value
dump ra_field_values
#---------------------------------------------------------------------