Tutorial Toolkit Code Examples > Element Properties > 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.
 
bl_create_std_beam_section
()
#  Purpose          :  This function will create the standard beam
#                      section. This function require shape, name,
#                      number of dimensions, data types, dimension
#                      values and field ids for beam section as 
#                      input argument to this function and it will
#                      give id of beam section created.
#
#                      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 bl_create_std_beam_section()
#  has the following arguments:
#
#  bl_create_std_beam_section
#     (   INPUT:
#         STRING shape,
#         STRING name,
#         INTEGER ndim,
#         INTEGER data_types(),
#         REAL rvalues(),
#         INTEGER field_ids()
#         OUTPUT:
#         INTEGER id          
#     ) 
#---------------------------------------------------------------------
#
 
# Opening new database 
 
   IF(!db_is_open())THEN
       uil_file_new.go("", "new.db")
   END IF
$? YES 36000002
 
#  Creating field which is to be applied at last dimension 
#  of "T" section beam.
 
   fields_create( "S", "Spatial", 1,              @
                  "Scalar", "Real",               @ 
                  "Coord 0", "",                  @
                  "Table", 1, "X", "",            @
                  "", "", "", "",                 @ 
                  FALSE, [1., 2.],                @ 
                  [0.], [0.],                     @
                  [[[5.]][[10.]]] )          
 
 
#  Declaring and defining input arguments  
 
   STRING shape[4] = "T"
 
   STRING name[16] = "New_Beam"
 
   INTEGER ndim = 4
 
   INTEGER data_types(4) = [3,3,3,7]
 
   REAL rvalues(4) = [5.0,5.0,1.0,0.0]
 
   INTEGER field_ids(4) = [0,0,0,1]
 
#  Declaring output arguments  
 
   INTEGER id
 
   INTEGER status = 1
 
 
# Using the function bl_create_std_beam_section() we will create 
# the std "T" beam section and we will get id for this new beam 
 
  status = bl_create_std_beam_section(shape,                 @
                                      name,                  @
                                      ndim,                  @
                                      data_types,            @
                                      rvalues,               @
                                      field_ids,             @
                                      id)
 
 
    dump status
    dump id
 
#---------------------------------------------------------------------
 
#  End of File.
 
#---------------------------------------------------------------------
 
bl_get_std_beam_section_data
()
#  Purpose          :  This function will get the standard beam
#                      section data. This function require beam id
#                      and number of dimension as input arguments 
#                      and it will give data types, dimension
#                      values and field ids for beam section  
#
#                      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 bl_get_std_beam_section_data()
#  has the following arguments:
#
#  bl_get_std_beam_section_data
#     (   INPUT:
#         INTEGER id          
#         INTEGER ndim,
#         OUTPUT:
#         INTEGER data_types(),
#         REAL rvalues(),
#         INTEGER field_ids()
#     ) 
#---------------------------------------------------------------------
#
#
# Opening new database 
 
   IF(!db_is_open())THEN
      uil_file_new.go("", "new.db")
   END IF
$? YES 36000002
 
#  Creating field which is to be applied at last dimension 
#  of "T" section beam.
 
       fields_create( "S", "Spatial", 1,              @
                      "Scalar", "Real",               @ 
                      "Coord 0", "",                  @
                      "Table", 1, "X", "",            @ 
                      "", "", "", "", FALSE,          @ 
                      [1., 2.], [0.], [0.],           @
                      [[[5.]][[10.]]] )
 
 
#  Declaring and defining input arguments  
 
   INTEGER id
 
   INTEGER ndim = 4
 
#  Declaring output arguments  
 
   INTEGER data_types(4)
 
   REAL rvalues(4) 
 
   INTEGER field_ids(4) 
 
   INTEGER status = 1
 
 
# Using the function bl_create_std_beam_section() we 
# will create the std "T" beam section and we will get 
# id for this new beam. This id we will use as input
# argument to the function bl_get_std_beam_section_data()
 
    STRING shape_1[4] = "T"
    STRING name_1[16] = "New_Beam"
    INTEGER ndim_1 = 4
    INTEGER data_types_1(4) = [3,3,3,7]
    REAL rvalues_1(4) = [5.,5.,1.,0.]
    INTEGER field_ids_1(4) = [0,0,0,1]
 
    bl_create_std_beam_section(shape_1,                   @
                               name_1,                    @
                               ndim_1,                    @
                               data_types_1,              @
                               rvalues_1,                 @
                               field_ids_1,               @
                               id)
 
 
#   Using the function bl_get_std_beam_section_data()  
#   to get the standard beam section data.
 
    status = bl_get_std_beam_section_data(id,ndim,        @
                                          data_types,     @
                                          rvalues,        @
                                          field_ids)
 
 
    dump status
    dump data_types
    dump rvalues
    dump field_ids
 
 
#---------------------------------------------------------------------
 
#  End of File.
 
#---------------------------------------------------------------------
 
bl_modify_std_beam_section
()
#  Purpose          :  This function will modify the existing std. 
#                      beam section. This function require beam shape,
#                      existing beam name, new beam name, number of
#                      dimension, data types, dimension values and
#                      field ids for new beam as input arguments and
#                      it will give id of new beam as output.
#
#                      This file can be run by starting a session of
#                      MSC Patran,running this session file through 
#                      the "File","Session","Play" pulldown menus
#                      on the menu bar.
#
#  The function bl_modify_std_beam_section()
#  has the following arguments:
#
#  bl_modify_std_beam_section
#     (   INPUT:
#         STRING new_shape,
#         STRING old_name,
#         STRING new_name,
#         INTEGER ndim,
#         INTEGER data_types(),
#         REAL rvalues(),
#         INTEGER field_ids()
#         OUTPUT:
#         INTEGER id          
#     ) 
#---------------------------------------------------------------------
#
 
# Opening new database 
 
   IF(!db_is_open())THEN
       uil_file_new.go("", "new.db")
   END IF
$? YES 36000002
 
#  Creating field which is to be applied at last dimension 
#  of "T" section beam.
 
       fields_create( "S", "Spatial", 1,                    @
                      "Scalar", "Real",                     @
                      "Coord 0", "",                        @
                      "Table", 1, "X", "",                  @
                      "", "", "", "", FALSE,                @
                      [1., 2.], [0.], [0.],                 @
                      [[[5.]][[10.]]] )
 
 
#  Declaring and defining input arguments  
 
   STRING new_shape[4]="H"
 
   STRING old_name[16] = "Old_Beam"
 
   STRING new_name[16] = "New_Beam"
 
   INTEGER ndim = 4
 
   INTEGER data_types(4) = [3,3,3,7]
 
   REAL rvalues(4)= [5.,5.,1.,0.] 
 
   INTEGER field_ids(4) = [0,0,0,1] 
 
#  Declaring output arguments  
 
   INTEGER id
 
   INTEGER status = 1
 
 
# Using the function bl_create_std_beam_section() we 
# will create the std "T" beam section with name  
# old_name and then modify this beam section using 
# function bl_modify_std_beam_section().
 
    STRING shape_1[4] = "T"
    INTEGER ndim_1 = 4
    INTEGER data_types_1(4) = [3,3,3,7]
    REAL rvalues_1(4) = [5.,5.,1.,0.]
    INTEGER field_ids_1(4) = [0,0,0,1]
    INTEGER id_1
 
    bl_create_std_beam_section(shape_1,                      @
                               old_name,                     @
                               ndim_1,                       @
                               data_types_1,                 @
                               rvalues_1,                    @
                               field_ids_1,                  @
                               id_1)
 
 
#  Using the function bl_modify_std_beam_section() 
#  to modify the beam section
 
    status = bl_modify_std_beam_section(new_shape,           @
                                        old_name,            @
                                        new_name,            @
                                        ndim,                @
                                        data_types,          @
                                        rvalues,             @
                                        field_ids,           @
					id)
 
    dump status
    dump id
 
#---------------------------------------------------------------------
 
#  End of File.
 
#---------------------------------------------------------------------
 
blcomputeprincaxespoints
()
#  Purpose          :  This function calculates the principle axes vectors 
#                      for the beam section from the angle alpha(principle
#                      angle).It also scales the axes based on the beam  
#                      section points. This function requires principle 
#                      angle - alpha, number of points on section - npoints, 
#                      xy array of section points - points and xy location of 
#                      centroid - centroid as input arguments to this function 
#
#                      This file can be run by starting a session of
#                      MSC Patran,running corresponding session file
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar.
#                      
# 
#  The function blcomputeprincaxespoints()
#  has the following arguments:
#
#   blcomputeprincaxespoints
#     (INPUT:
#       REAL alpha,
#       INTEGER npoints,
#       REAL points(),
#       REAL centroid(),
#       OUTPUT:
#       REAL axis1(),
#       REAL axis2()
#     )
#
#------------------------------------------------------------------- 
 
#  Declaring and defining input arguments  
 
  REAL  alpha = 45.0
 
  INTEGER npoints = 4
 
  REAL points(8) = [1.,1.,-1.,1.,-1.,-1.,1.,-1.]
 
  REAL centroid(2) = [0.,0.]
 
#  Declaring output arguments  
 
  REAL princ_axis1(2), princ_axis2(2)
 
  INTEGER status = 1
 
#---------------------------------------------------------------------
 
# Using the function blcomputeprincaxespoints() to compute 
# the principle axes of beam section. 
 
    status=blcomputeprincaxespoints(alpha,           @
                                    npoints,         @
                                    points,          @
                                    centroid,        @
                                    princ_axis1,     @
                                    princ_axis2)
 
     dump princ_axis1
     dump princ_axis2
     dump status
 
#****************************************************************
 
# End of File 
 
#****************************************************************
 
blgetalpha
()
#  Purpose          :  This function calculates the principle angle 
#                      from the given properties of the beam section.
#                      This function requires beam type (1=basic,
#                      2=advanced) and array of beam section properties
#                      as input arguments to this function.
#
#                      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 blgetalpha()
#  has the following arguments:
#
#  blgetalpha
#     (   INPUT: 
#         INTEGER enttyp (1=basic,2=advanced),
#         REAL prop(),
#         OUTPUT:
#         REAL alpha(),
#     ) 
#---------------------------------------------------------------------
#
#  Declaring and defining input arguments  
 
  INTEGER enttyp = 2
 
  real prop(30) /* This we will get from blgetprop() function */
 
#  Declaring output arguments  
 
  REAL alpha
 
  INTEGER status = 1
 
 
# Using the function blgetprop() we will get 
# properties for the std "T" beam section 
 
  STRING shape[4] = "T"
  REAL dim(4) = [5,5,1,1] /* Dimension for T section */
  INTEGER ndim = 4
  INTEGER nprop
 
      blgetprop(enttyp,          @
                shape,           @
                dim,             @
                ndim,            @
                prop,            @
                nprop)
 
#---------------------------------------------------------------------
 
# Using the function blgetalpha() to compute 
# the principle angle of beam section. */
 
      status=blgetalpha(enttyp,  @
                        prop,    @
                        alpha)
 
      dump alpha
      dump status
 
#--------------------------------------------------------------------
 
#  End of File.
 
#---------------------------------------------------------------------
 
blgetbuttonicon
()
#  Purpose          :  This function gets the file system location
#                      of the button icon bitmap for a shape.
#                      This function requires beam shape and it 
#                      will give the corresponding path of the 
#                      button icon file.
#
#                      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 blgetbuttonicon()
#  has the following arguments:
#
#  blgetbuttonicon
#     (   INPUT: 
#         STRING shape,
#         OUTPUT:
#         STRING cdo(),
#     ) 
#---------------------------------------------------------------------
#
 
#  Declaring and defining input arguments  
 
  STRING shape[4] = "T"
 
#  Declaring output arguments  
 
  STRING cdo[64]
 
  INTEGER status = 1
 
#---------------------------------------------------------------------
 
# Using the function blgetbuttonicon() to get the file system 
# location of the button icon bitmap for a beam section shape 
 
    status=blgetbuttonicon(shape,cdo)
 
    dump cdo
    dump status
 
 
#---------------------------------------------------------------------
 
#  End of File.
 
#---------------------------------------------------------------------
 
blgetcenters
()
#   Purpose          :  This function calculates the centroid and 
#                       shear centre of beam section.
#                       This function requires beam type (1=basic,
#                       2=advanced), beam shape, array of dimensions
#                       and beam section properties as input arguments
#                       to this function 
# 
#                       This file can be run by starting a session of
#                       MSC Patran,running corresponding session file 
#                       through the "File","Session","Play" pulldown
#                       menus on the menu bar.
#                       
#  
#   The function blgetcenters()
#   has the following arguments:
# 
#    blgetcenters
#      (INPUT:
#       INTEGER enttyp (1=basic,2=advanced),
#       STRING shape[],
#       REAL dim(),
#       REAL prop(),
#       OUTPUT:
#       REAL centroid(),
#       REAL shear()
#      )
# 
# --------------------------------------------------------------------- 
 
 
#  Declaring and defining input arguments  
 
  INTEGER enttyp = 2
 
  STRING shape[4]="T"
 
  REAL dim(4)=[5,5,1,1]
 
  REAL prop(30) /* This we will get from blgetprop() function 
 
#  Declaring output arguments  
 
  REAL centroid(2)
 
  REAL shear(2)
 
  INTEGER status = 1
 
 
# Using the function blgetprop() we will get properties
# for the std "T" beam section 
 
  INTEGER ndim = 4
  INTEGER nprop
 
     blgetprop(enttyp,               @
               shape,                @
               dim,                  @
               ndim,                 @
               prop,                 @
               nprop)
 
#---------------------------------------------------------------------
 
# Using the function blgetcenters() to compute the 
# centroide and shear centre of beam section. 
 
     status=blgetcenters(enttyp,     @
                         shape,      @
                         dim,        @
                         prop,       @
                         centroid,   @
                         shear)
 
     dump status
     dump centroid
     dump shear
#---------------------------------------------------------------------
 
# End of File
 
#---------------------------------------------------------------------
 
blgetdimfieldid
()
#  Purpose          :  This function will give the dimension field 
#                      id This function requires beam section id 
#                      and dimension location as input arguments. 
#                      it will give field id as a output.
#
#                      This file can be run by starting a session 
#                      of MSC Patran, running this session file 
#                      through the "File","Session","Play" 
#                      pulldown menus on the menu bar.
#
#
#  The function blgetdimfieldid()
#  has the following arguments:
#
#  blgetdimfieldid
#     (   INPUT: 
#         INTEGER bsid,
#         INTEGER dim_loc,
#         OUTPUT:
#         INTEGER field_id          
#     ) 
#---------------------------------------------------------------------
#
 
# Opening new database 
 
    IF(!db_is_open())THEN
        uil_file_new.go("", "new.db")
    END IF
$? YES 36000002
 
#  In this session file we  will find the dimension field id
#  for std. beam section "T" using function blgetdimfieldid().
#  In this function we will create std "T" beam section using
#  function beam_section_create() and then we will get beam 
#  section id for this new beam section using function 
#  db_get_beam_section_id() which we will use in   
#  blgetdimfieldid() function
 
 
#  Declaring and defining input arguments  
 
   INTEGER bsid
 
   INTEGER dim_loc = 2
 
#  Declaring output arguments  
 
   INTEGER field_id
 
   INTEGER status = 1
 
 
# Using the function beam_section_create() we will create 
# the std "T" beam section and we will get bsid for this 
# new beam using function db_get_beam_section_id()
 
    STRING section_name[16] = "New_Beam"
 
    string shape[4] = "T"
 
#  Creating the field 
 
    fields_create( "S", "Spatial", 1, "Scalar",            @
                   "Real", "Coord 0", "",                  @
                   "Table", 1, "X", "", "", "",            @
                   "", "", FALSE, [1., 2.], [0.],          @
                   [0.],[[[1.]][[2.]]] )
 
 
    string dstring[32](4)
    dstring(1) = "5.0"
    dstring(2) = "5.0"
    dstring(3) = "f:S"       /* Applying this dim. through field "S" */
    dstring(4) = "1.0"
 
 
       beam_section_create(section_name,                      @
                       	   shape,                             @
                           dstring)
 
       db_get_beam_section_id(section_name,bsid)
 
#---------------------------------------------------------------------
 
# Using the function blgetdimfieldid() to get the dimension field id 
 
       status=blgetdimfieldid(bsid,                            @
       	                      dim_loc,                         @
                              field_id)
 
    dump status
    dump field_id
 
#---------------------------------------------------------------------
 
#  End of File.
 
#---------------------------------------------------------------------
 
blgetdimvalue
 
#  Purpose          :  This function will give the dimension value.
#                      This function requires beam section id and
#                      dimension location as input arguments. It will
#                      give dimension value as a output.
#
#                      This file can be run by starting a session of
#                      MSC Patran,running this session file through  
#                      the "File","Session","Play" pulldown menus
#                      on the menu bar.
#
#
#  The function blgetdimvalue()
#  has the following arguments:
#
#  blgetdimvalue
#     (   INPUT: 
#         INTEGER bsid,
#         INTEGER dim_loc,
#         OUTPUT:
#         REAL value 
#     ) 
#---------------------------------------------------------------------
 
 
#Opening a new database
 
   IF(!db_is_open())THEN
      uil_file_new.go("", "new.db")
   END IF
$? YES 36000002
 
 
#  The function execute_function will find the dimension value
#  for std. beam section "T" using function blgetdimvalue().
#  In this function we will create std "T" beam section using
#  function beam_section_create() and we will get beam section id
#  for this new beam section using function db_get_beam_section_id()
#  which we will use in blgetdimvalue() function  
 
#  Declaring and defining input arguments  
 
  INTEGER bsid
 
  INTEGER dim_loc = 1
 
#  Declaring output arguments  
 
  REAL value
 
  INTEGER status = 1
 
 
# Using the function beam_section_create() we will create 
# the std "T" beam section and we will get bsid for this  
# new beam using function db_get_beam_section_id()
 
  STRING section_name[16] = "New_Beam"
 
  string shape[4] = "T"
 
  string dstring[32](4)
  dstring(1) = "5.0"
  dstring(2) = "5.0"
  dstring(3) = "1.0"
  dstring(4) = "1.0"
 
     beam_section_create(section_name,              @
                         shape,                     @
                         dstring)
 
     db_get_beam_section_id(section_name,           @
                            bsid)
 
#---------------------------------------------------------------------
 
# Using the function blgetdimvalue() to get the dimension field id 
 
     status=blgetdimvalue(bsid,                     @
                          dim_loc,                  @
                          value)
 
     dump status
     dump value
 
#---------------------------------------------------------------------
#  End of File.
#---------------------------------------------------------------------
 
blgetlabelicon
()
#  Purpose          :  This function gets the file system location of
#                      the label icon bitmap for a shape.
#                      This function requires beam shape and it will
#                      give the corresponding path of the label icon file.
#
#                      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 blgetlabelicon()
#  has the following arguments:
#
#  blgetlabelicon
#     (   INPUT: 
#         STRING shape,
#         OUTPUT:
#         STRING cdo(),
#     ) 
#---------------------------------------------------------------------
#
 
#  Declaring and defining input arguments  
 
   STRING shape[4] = "T"
 
#  Declaring output arguments  
 
   STRING cdo[64]
 
   INTEGER status = 1
 
#---------------------------------------------------------------------
 
# Using the function blgetlabelicon() to get file system
# location of the label icon bitmap for a shape. 
 
    status=blgetlabelicon(shape,cdo)
	
     dump cdo
     dump status
 
#---------------------------------------------------------------------
 
#  End of File.
#---------------------------------------------------------------------
 
blgetlabels
()
#  Purpose          :  This function gets the dimension labels for a given 
#                      shape.This function requires beam shape and it will
#                      give the corresponding dimension labels. 
#
#                      This file can be run by starting a session of
#                      MSC Patran,running this session file through 
#                      the "File","Session","Play" pulldown menus
#                      on the menu bar.
#
#
#  The function blgetlabels()
#  has the following arguments:
#
#  blgetlabels
#     (   INPUT: 
#         STRING shape,
#         OUTPUT:
#         STRING cdo(),
#     ) 
#---------------------------------------------------------------------
#
#
#  Declaring and defining input arguments  
 
   STRING shape[4] = "T"
 
#  Declaring output arguments  
 
   STRING cdo[64](4)
 
   INTEGER status = 1
 
#--------------------------------------------------------------------
 
# Using the function blgetlabels() to get dimension 
# labels for the "T" shape beam section. 
 
    status=blgetlabels(shape,cdo)
 
    dump cdo
    dump status
 
#---------------------------------------------------------------------
 
#  End of File.
 
#---------------------------------------------------------------------
 
blgetnumdimension
()
#  Purpose          :  This function gets the no. of dimension for a 
#                      given shape.
#                      This function requires beam shape and it will
#                      give the no. of dimension for that beam. 
#
#                      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 blgetnumdimension()
#  has the following arguments:
#
#  blgetnumdimension
#     (   INPUT: 
#         STRING shape,
#         OUTPUT:
#     ) 
#---------------------------------------------------------------------
 
#  Declaring and defining input arguments  
 
   STRING shape[4] = "T"
 
#  Declaring output arguments  
 
 
   INTEGER numdim
 
#---------------------------------------------------------------------
 
# Using the function blgetnumdimension() to get the 
# no. of dimension for given beam section. 
 
    numdim = blgetnumdimension(shape)
 
    dump numdim
 
#---------------------------------------------------------------------
 
#  End of File.
 
#---------------------------------------------------------------------
 
blgetnumplotpoints
()
#  Purpose          :  This function gets the number of total plot  
#                      points and loops used to draw a shape.
#                      This function requires beam, chord tolerance
#                      and it will give number of total plot 
#                      points and loops. 
#
#                      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 blgetnumplotpoints()
#  has the following arguments:
#
#  blgetnumplotpoints
#     (   INPUT: 
#         STRING shape,
#         REAL chord_tol,
#         OUTPUT:
#         INTEGER npoints,
#         INTEGER nloops
#     ) 
#---------------------------------------------------------------------
 
#  Declaring and defining input arguments  
 
   STRING shape[4] = "T"
 
   REAL chord_tol = 0.9
 
#  Declaring output arguments  
 
   INTEGER npoints
 
   INTEGER nloops
 
   INTEGER status
 
#---------------------------------------------------------------------
 
# Using the function blgetnumplotpoints() to get the number 
# of total plot points and loops for given beam section. 
 
      status =  blgetnumplotpoints(shape,          @
                                   chord_tol,      @
                                   npoints,        @
                                   nloops)
 
      dump npoints
      dump nloops
      dump status
 
#---------------------------------------------------------------------
 
#  End of File.
 
#---------------------------------------------------------------------
 
blgetnumplotpointsbyid
()
#  Purpose          :  This function gets the number of total plot
#                      points and loops used to draw a shape.
#                      This function requires beam section id and
#                      chord tolerance as input arguments. It will
#                      give number of total plot points and loops
#                      as a output.
#
#                      This file can be run by starting a session of
#                      MSC Patran,running this session file through 
#                      the "File","Session","Play" pulldown menus
#                      on the menu bar.
#
#
#  The function blgetnumplotpointsbyid()
#  has the following arguments:
#
#  blgetnumplotpointsbyid
#     (   INPUT: 
#	  INTEGER bsid,
#         REAL chord_tol,
#	  OUTPUT:
#         INTEGER npoints,
#         INTEGER nloops
#     ) 
#---------------------------------------------------------------------
 
#  Opening new data base
 
   IF(!db_is_open())THEN
      uil_file_new.go("", "new.db")
   END IF
$? YES 36000002
 
#  In this session file will find the number of total plot
#  points and loops for std beam  section "T" using function
#  blgetnumplotpontsbyid().
#  In this function we will create std "T" beam section using
#  function beam_section_create() and we will get beam section id
#  for this new beam section using function db_get_beam_section_id()
#  which we will use in blgetnumplotpontsbyid() function  */
 
#  Declaring and defining input arguments  */
 
   INTEGER bsid
 
   REAL chord_tol = 0.9
 
#  Declaring output arguments  */
 
   INTEGER npoints
 
   INTEGER nloops
 
   INTEGER status = 1
 
# Using the function beam_section_create() we will create the std "T"
# beam section and we will get bsid for this new beam using function
# db_get_beam_section_id()*/
 
  STRING section_name[16] = "New_Beam"
 
  string shape[4] = "T"
 
  string dstring[32](4)
  dstring(1) = "5.0"
  dstring(2) = "5.0"
  dstring(3) = "1.0"
  dstring(4) = "1.0"
 
  beam_section_create(section_name,                   @
		      shape,                          @
		      dstring)
 
  db_get_beam_section_id(section_name,bsid)
 
#---------------------------------------------------------------------*/
 
# Using the function blgetnumplotpointsbyid()to get the number 
# of total plot points and loops for given beam section. 
 
      status=blgetnumplotpointsbyid(bsid,             @
				    chord_tol,        @
				    npoints,          @
				    nloops)
 
      dump status
      dump npoints
      dump nloops
 
#---------------------------------------------------------------------
 
#  End of File.
 
#---------------------------------------------------------------------
 
blgetnumtypeinfo
()
#  Purpose          :  This function gets the number of section types
#                      the server supports,and the maximum number of
#                      dimensions for any section.
#                      This function does not require input argument 
#                      The output arguments are number of section types
#                      and maximum number of dimensions for any section.
#
#                      This file can be run by starting a session of
#                      MSC Patran, running corresponding session file 
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar.
#                      
# 
#  The function blgetnumtypeinfo()
#  has the following arguments:
#
#   blgetnumtypeinfo
#     (INPUT:
#      OUTPUT:
#       INTEGER nsect,
#       INTEGER ndimax
#     )
#
#--------------------------------------------------------------------- 
 
 
 
#  Declaring output arguments  
 
   INTEGER nsect
 
   INTEGER ndimax
 
   INTEGER status = 1
 
#---------------------------------------------------------------------
 
# Using the function blgetnumtypeinfo() to get nsect and ndimax 
 
     status=blgetnumtypeinfo(nsect,ndimax)
     
     dump nsect
     dump ndimax
     dump status
 
#---------------------------------------------------------------------
 
# End of File
 
#---------------------------------------------------------------------
 
blgetperim
()
#   Purpose          :  This function calculates the exterior perimeter 
#                       of beam section.
#                       This function requires beam shape and array of
#                       dimensions of beam section as input arguments
#                       to this function and it will give exterior
#                       perimeter of beam section as output.
# 
#                       This file can be run by starting a session of
#                       MSC Patran, running corresponding session file 
#                       through the "File","Session","Play" pulldown
#                       menus on the menu bar.
#                       
#  
#   The function blgetperim()
#   has the following arguments:
# 
#    blgetperim
#      (INPUT:
#       STRING shape[],
#       REAL dim(),
#       OUTPUT:
#       REAL perim
#      )
# 
# --------------------------------------------------------------------- 
#
#
#  Declaring and defining input arguments  
 
   STRING shape[4]="T"
 
   REAL dim(4)=[5,5,1,1]
 
#  Declaring output arguments  
 
   REAL perim
 
   INTEGER status = 1
 
#  Using the function blgetperim() to compute the 
#  centroide and shear centre of beam section. 
 
     status=blgetperim(shape,              @
                       dim,                @
                       perim)
 
     dump status
     dump perim
 
#---------------------------------------------------------------------
 
# End of File
 
#---------------------------------------------------------------------
 
blgetplotpoints
()
#  Purpose          :  This function gets the coord. of plot points and the
#                      number of points on each loop for a given section.
#                      This function requires beam shape, dimensions for
#                      beam section, number of tota plot points and loops.
#                      It will give coordinates of plot points for the 
#                      section and array of number of points on each loop
#
#                      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 blgetplotpoints()
#  has the following arguments:
#
#  blgetplotpoints
#     (   INPUT: 
#         STRING shape,
#         REAL dim()
#         INTEGER npoints,
#         INTEGER nloops,
#         OUTPUT:
#         REAL points(),
#         INTEGER nploop()
#     ) 
#---------------------------------------------------------------------
#
#  Declaring and defining input arguments  
 
   STRING shape[4] = "T"
 
   REAL dim(4) = [5,5,1,1]
 
   INTEGER npoints
 
   INTEGER nloops
 
#  Declaring output arguments  
 
   REAL points(9,2)
 
   INTEGER nploop(4)
 
   INTEGER status
 
#---------------------------------------------------------------------
 
# Using the function blgetnumplotpoints() to get the number of total
# plot points(npoints) and loops(nloops) for given beam section and
# this will be used as input arguments to the blgetplotpoints(). 
 
      REAL chord_tol = 0.9
 
      blgetnumplotpoints(shape,               @
                         chord_tol,           @
                         npoints,             @
                         nloops)
 
#--------------------------------------------------------------------
 
# Using the function blgetplotpoints() to get coordinates of plot points
# for the section and array of number of points on each loop.
 
   status = blgetplotpoints(shape,            @
                            dim,              @
                            npoints,          @
                            nloops,           @
                            points,           @
			    nploop)
 
      dump status
      dump points
      dump nploop
 
#---------------------------------------------------------------------
 
#  End of File.
 
#---------------------------------------------------------------------
 
blgetplotpointsbyid
()
 
#  Purpose          :  This function gets the coordinates of plot points 
#                      and the number of points on each loop for a given 
#                      beam section id,entity type, entity id and entity 
#                      parametric location.
#
#                      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 blgetplotpointsbyid()
#  has the following arguments:
#
#  blgetplotpointsbyid
#     (   INPUT:
#         INTEGER bsid        -Beam section id stored in db or region id for Abaqus
#                              beams.
#         INTEGER bmtype      -Beam type 1 = Bar, 2 = Beam or 3 for aero bodies. For
#                              Abaqus beams:
#                              1001 = Box section
#                              1002 = Circular section
#                              1003 = I section
#                              1004 = L section
#                              1005 = Pipe section
#                              1006 = Rectangular section
#                              1007 = Hex section
#                              1008 = Trapazoidal section
#                              1009 = Arbitrary section
#         INTEGER enttype     -Entity type, currently only type 124 is supported.
#         INTEGER entid       -Entity id.
#         INTEGER nparloc     -number of parametric locations.
#         REAL parloc(nparloc)       -1 dimensional parametric location on entity.
#         INTEGER nrmflg      -If 1 calculate normals.
#         INTEGER npoints     -no. of total plot points for one parametric loc.
#         INTEGER nloops      -number of loops for one parametric location.
#         OUTPUT:
#         REAL points(npoints*nparloc,nparloc),      
#                             -Coordinates of plot points for the section.
#                              One set of points per parametric locations.
#         INTEGER nploop(nloop)    -Array of number of points on each loop for
#                              1 parametric location.
#         REAL vec1s(nparloc,3)        -array of nparloc axis 1 orientation vectors.
#         REAL vec2s(nparloc,3)        -array of nparloc axis 2 orientation vectors.
#         REAL xyz(nparloc*3)          -array of evaluated xyz coordinates at the
#                              input parametric locations.
#     ) 
#---------------------------------------------------------------------
#
#    Opening a new database
     uil_file_new.go("","new.db")
#  Declaring and defining input arguments  
 
   INTEGER bsid
   INTEGER bmtype = 2
   INTEGER entype = 124
   INTEGER entid = 1
   INTEGER nparloc = 2
   REAL parloc(2)=[0.5,0.75]
   INTEGER nrmflg = 1
   INTEGER npoints = 9
   INTEGER nloops = 1
 
#  Declaring output arguments  
 
   REAL points(18,2)
   INTEGER nploop(1)
   REAL vec1s(2,3)
   REAL vec2s(2,3)
   REAL xyz(6)
   INTEGER status
 
#---------------------------------------------------------------------
 
#  Creating the line 
 
   STRING asm_create_line_xyz_created_ids[VIRTUAL]
   asm_const_line_xyz( "1", "<1 0 0>",                              @
		       "[0 0 0]", "Coord 0",                        @
                        asm_create_line_xyz_created_ids )
 
#  Creating one element on the line 
 
   INTEGER fem_create_mesh_curve_num_nodes
   INTEGER fem_create_mesh_curve_num_elems
   STRING fem_create_mesh_c_nodes_created[VIRTUAL]
   STRING fem_create_mesh_c_elems_created[VIRTUAL]
 
   fem_create_mesh_curv_1( "Curve 1", 16384, 1.,"Bar2",             @
                           "#", "#","Coord 0","Coord 0",            @ 
                            fem_create_mesh_curve_num_nodes,        @ 
                            fem_create_mesh_curve_num_elems,        @
                            fem_create_mesh_c_nodes_created,        @ 
                            fem_create_mesh_c_elems_created )
 
#  Creating the material
 
    material.create( "Analysis code ID", 1,                         @
                     "Analysis type ID", 1,                         @
                     "mat", 0,"Date: 10-Oct-00                      @
                     Time: 18:09:12", "Isotropic",                  @
                     1, "Directionality",                           @
                     1, "Linearity", 1,                             @ 
                     "Homogeneous", 0,                              @
                     "Linear Elastic", 1,                           @
                     "Model Options & IDs",                         @
                     ["", "", "", "", ""],                          @
                     [0, 0, 0, 0, 0],                               @
                     "Active Flag",                                 @
                     1, "Create", 10,                               @
                     "External Flag", FALSE,                        @
                     "Property IDs", ["", ""], [0],                 @
                     "Property Values", [""] )
 
#  Creating the beam section
 
   beam_section_create( "T_s", "T",                                 @
                        ["5","5","1","1"] )                         
 
#  Creating the element proprties
 
   elementprops_create( "T_sec", 11, 2, 42,                         @
                         1, 1, 20, [13, 39,                         @
                         6, 4042, 4043, 2047,                       @
                         2048, 4037, 4061],                         @
                         [5, 11, 2, 2, 2, 4, 4, 1, 6],              @
                         ["m:mat", "T_s",                           @
                         "<1 1 0>", "", "", "",                     @
                         "", "", ""], "Curve 1" )               
 
#   Using function we will get the beam section Id.
 
    db_get_beam_section_id("T_s", bsid)
 
#--------------------------------------------------------------------
 
#  Using the function blgetplotpointsbyid() to get the coordinates
#  of plot points on each loop for a given parametric loctions.
 
       status = blgetplotpointsbyid(bsid,bmtype,                    @
                                     entype,entid,                  @
                                     nparloc,parloc,                @
                                     nrmflg,npoints,                @
                                     nloops, points,                @
                                     nploop, vec1s,                 @
                                     vec2s,xyz)
 
    dump status
    dump points
    dump nploop
    dump vec1s
    dump vec2s
    dump xyz
 
#---------------------------------------------------------------------
 
#  End of File.
 
#---------------------------------------------------------------------
 
blgetplotpointsbyid2
()
#  Purpose          :  This function gets the coordinates of plot points 
#                      and the number of points on each loop for a given 
#                      beam section id,entity type, entity id and entity 
#                      parametric location.
#
#                      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 blgetplotpointsbyid2()
#  has the following arguments:
#
#  blgetplotpointsbyid2
#     (   INPUT:
#         INTEGER bsid        -Beam section id stored in db or region id for Abaqus
#                              beams.
#         INTEGER bmtype      -Beam type 1 = Bar, 2 = Beam or 3 for aero bodies. For
#                              Abaqus beams:
#                              1001 = Box section
#                              1002 = Circular section
#                              1003 = I section
#                              1004 = L section
#                              1005 = Pipe section
#                              1006 = Rectangular section
#                              1007 = Hex section
#                              1008 = Trapazoidal section
#                              1009 = Arbitrary section
#         INTEGER enttype     -Entity type, currently only type 124 is supported.
#         INTEGER entid       -Entity id.
#         INTEGER nparloc     -number of parametric locations.
#         REAL parloc(nparloc)       -1 dimensional parametric location on entity.
#         INTEGER nrmflg      -If 1 calculate normals.
#         INTEGER npoints     -no. of total plot points for one parametric loc.
#         INTEGER nloops      -number of loops for one parametric location.
#         INTEGER displaymode -If beam type = 1 or 2, this is flag 
#                              whether to process offsets.
#                              0 = do not process
#                              1 = process
#                              If beam type = 3, this flag whether slender only,
#                              interference only, both or none should display.
#                              0 = None
#                              1 = Slender
#                              2 = Interference
#                              3 = All
#         OUTPUT:
#         REAL points(npoints*nparloc,nparloc),      
#                             -Coordinates of plot points for the section.
#                              One set of points per parametric locations.
#         INTEGER nploop(nloop)    -Array of number of points on each loop for
#                              1 parametric location.
#         REAL vec1s(nparloc,3)        -array of nparloc axis 1 orientation vectors.
#         REAL vec2s(nparloc,3)        -array of nparloc axis 2 orientation vectors.
#         REAL xyz(nparloc*3)          -array of evaluated xyz coordinates at the
#                              input parametric locations.
#     ) 
#---------------------------------------------------------------------
#
 
#    Opening a new database
 
     uil_file_new.go("","new.db")
 
 
#  Declaring and defining input arguments  
 
   INTEGER bsid
   INTEGER bmtype = 2
   INTEGER entype = 124
   INTEGER entid = 1
   INTEGER nparloc = 2
   REAL parloc(2)=[0.5,0.75]
   INTEGER nrmflg = 1
   INTEGER npoints = 9
   INTEGER nloops = 1
   INTEGER dspmode = 0
 
#  Declaring output arguments  
 
   REAL points(18,2)
   INTEGER nploop(1)
   REAL vec1s(2,3)
   REAL vec2s(2,3)
   REAL xyz(6)
   INTEGER status
 
#---------------------------------------------------------------------
 
#  Creating the line 
 
   STRING asm_create_line_xyz_created_ids[VIRTUAL]
   asm_const_line_xyz( "1", "<1 0 0>",                              @
		       "[0 0 0]", "Coord 0",                        @
                        asm_create_line_xyz_created_ids )
 
#  Creating one element on the line 
 
   INTEGER fem_create_mesh_curve_num_nodes
   INTEGER fem_create_mesh_curve_num_elems
   STRING fem_create_mesh_c_nodes_created[VIRTUAL]
   STRING fem_create_mesh_c_elems_created[VIRTUAL]
 
   fem_create_mesh_curv_1( "Curve 1", 16384, 1.,"Bar2",             @
                           "#", "#","Coord 0","Coord 0",            @ 
                            fem_create_mesh_curve_num_nodes,        @ 
                            fem_create_mesh_curve_num_elems,        @
                            fem_create_mesh_c_nodes_created,        @ 
                            fem_create_mesh_c_elems_created )
 
#  Creating the material
 
    material.create( "Analysis code ID", 1,                         @
                     "Analysis type ID", 1,                         @
                     "mat", 0,"Date: 10-Oct-00                      @
                     Time: 18:09:12", "Isotropic",                  @
                     1, "Directionality",                           @
                     1, "Linearity", 1,                             @ 
                     "Homogeneous", 0,                              @
                     "Linear Elastic", 1,                           @
                     "Model Options & IDs",                         @
                     ["", "", "", "", ""],                          @
                     [0, 0, 0, 0, 0],                               @
                     "Active Flag",                                 @
                     1, "Create", 10,                               @
                     "External Flag", FALSE,                        @
                     "Property IDs", ["", ""], [0],                 @
                     "Property Values", [""] )
 
#  Creating the beam section
 
   beam_section_create( "T_s", "T",                                 @
                        ["5","5","1","1"] )                         
 
#  Creating the element proprties
 
   elementprops_create( "T_sec", 11, 2, 42,                         @
                         1, 1, 20, [13, 39,                         @
                         6, 4042, 4043, 2047,                       @
                         2048, 4037, 4061],                         @
                         [5, 11, 2, 2, 2, 4, 4, 1, 6],              @
                         ["m:mat", "T_s",                           @
                         "<1 1 0>", "", "", "",                     @
                         "", "", ""], "Curve 1" )               
 
#   Using function we will get the beam section Id.
 
    db_get_beam_section_id("T_s", bsid)
 
#--------------------------------------------------------------------
 
#  Using the function blgetplotpointsbyid2() to get the coordinates
#  of plot points on each loop for a given parametric loctions.
 
       status = blgetplotpointsbyid2(bsid,bmtype,                   @
                                     entype,entid,                  @
                                     nparloc,parloc,                @
                                     nrmflg,npoints,                @
                                     nloops,dspmode,                @
                                     points,nploop,                 @
                                     vec1s,vec2s,xyz)
 
    dump status
    dump points
    dump nploop
    dump vec1s
    dump vec2s
    dump xyz
 
#---------------------------------------------------------------------
 
#  End of File.
 
#---------------------------------------------------------------------
 
blgetprop
()
#   Purpose          :  This function will get the all properties 
#                       of beam section.
#                       This function requires beam type (1=basic,
#                       2=advanced), beam shape, array of dimensions
#                       and and number of dimension as input arguments
#                       to this function and it will give properties
#                       and number of properties as output.
# 
#                       This file can be run by starting a session of
#                       MSC Patran, running corresponding session file 
#                       through the "File","Session","Play" pulldown
#                       menus on the menu bar.
#                       
#  
#   The function blgetprop()
#   has the following arguments:
# 
#    blgetprop
#      (INPUT:
#       INTEGER enttyp (1=basic,2=advanced),
#       STRING shape[],
#       REAL dim(),
#       INTEGER ndim,
#       OUTPUT:
#       REAL prop(),
#       INTEGER nprop
#      )
# 
# --------------------------------------------------------------------- 
 
#  Declaring and defining input arguments  
 
   INTEGER enttyp = 2
 
   STRING shape[4]="T"
 
   REAL dim(4)=[5.0,5.0,1.0,1.0]
 
   INTEGER ndim = 4
 
#  Declaring output arguments  
 
   REAL prop(30)
 
   INTEGER nprop
 
   INTEGER status = 1
 
 
# Using the function blgetprop() to get properties for the std "T"
# beam section and number of properties.
 
     status =  blgetprop(enttyp,                @
                         shape,                 @
                         dim,                   @
                         ndim,                  @
                         prop,                  @
                         nprop)
 
     dump status
     dump prop
     dump nprop
 
#---------------------------------------------------------------------
 
# End of File
 
#---------------------------------------------------------------------
 
blgetproplabels
()
#   Purpose          :  This function will get the property labels 
#                       for a given beam entity type.
#                       This function requires beam type (1=basic,
#                       2=advanced) as input arguments and it will
#                       give property labels as a output.
# 
#                       This file can be run by starting a session of
#                       MSC Patran, running corresponding session file
#                       through the "File","Session","Play" pulldown
#                       menus on the menu bar.
#                       
#  
#   The function blgetproplabels()
#   has the following arguments:
# 
#    blgetproplabels
#      (INPUT:
#       INTEGER enttyp (1=basic,2=advanced),
#       OUTPUT:
#       STRING cdo[]()
#      )
# 
# --------------------------------------------------------------------- 
 
#  Declaring and defining input arguments  
 
   INTEGER enttyp = 2
 
#  Declaring output arguments  
 
   STRING cdo[8](30)
 
   INTEGER status = 1
 
# Using the function blgetproplabels() we will 
# get property labels for the beam section .
 
     status =  blgetproplabels(enttyp,cdo)
 
     dump status
     dump cdo
 
#---------------------------------------------------------------------
 
# End of File
 
#---------------------------------------------------------------------
 
blgettypeinfo
()
#  Purpose          :  This function gets the shape names, number of
#                      dimensions for each shape, and the number of
#                      dimensional constraints for each beam shape 
#                      available in patran. This function require
#                      beam type as input argument. 
#
#                      This file can be run by starting a session of
#                      MSC Patran, running corresponding session file
#                      through the "File","Session","Play" pulldown 
#                      menus on the menu bar.
#                      
# 
#  The function blgettypeinfo()
#  has the following arguments:
#
#   blgettypeinfo
#     (INPUT:
#      INTEGER entyp  (1= basic, 2=advanced)
#      OUTPUT:
#      STRING shapes[](),
#      INTEGER ndims(),
#      INTEGER nconsts()
#     )
#
#--------------------------------------------------------------------- 
 
#  Declaring and defining input arguments  
 
   INTEGER entyp = 2
 
#  Declaring output arguments  
 
   STRING shapes[8](20)
   INTEGER ndims(20)
   INTEGER nconsts(20)
 
   INTEGER status = 1
 
#---------------------------------------------------------------------
 
# Using the function blgettypeinfo() to get shapes, ndims and nconsts 
 
     status=blgettypeinfo(entyp,             @
                          shapes,            @
                          ndims,             @
                          nconsts)
     
     dump shapes
     dump ndims
     dump nconsts
     dump status
 
#---------------------------------------------------------------------
 
# End Of File
 
#---------------------------------------------------------------------
 
blmodifybeamdimension
()
#  Purpose          :  This function will modify the beam section 
#                      dimension. This function require beam section
#                      id, dmension location which is to be modified,
#                      value and field id.
#
#                      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 blmodifybeamdimension()
#  has the following arguments:
#
#  blmodifybeamdimension
#     (   INPUT:
#         INTEGER bsid,
#         INTEGER dimid,
#         REAL value,
#         INTEGER fid 
#	  OUTPUT:
#     ) 
#---------------------------------------------------------------------
#
 
# Opening new database 
 
   IF (!db_is_open())THEN
       uil_file_new.go("", "new.db")
   END IF
$? YES 36000002
 
 
#  Creating field which is to be applied at last dimension 
#  of "T" section beam while modifying the dimension.
 
       fields_create( "S", "Spatial", 1,              @
                      "Scalar", "Real",               @
                      "Coord 0", "",                  @
                      "Table", 1, "X", "",            @
                      "", "", "", "", FALSE,          @
                      [1., 2.], [0.], [0.],           @
                      [[[5.]][[10.]]] )
 
#  Declaring and defining input arguments  
 
   INTEGER bsid
 
   INTEGER dimid = 3
 
   REAL value = 6
 
   INTEGER fid = 1
 
#  Declaring output arguments  
 
   INTEGER status = 1
 
# Using the function bl_create_std_beam_section() to create 
# the std "T" beam section and id of this beam will be used   
# as input argument to the function blmodifybeamdimension().
 
    STRING name[16] = "New_Beam"
    STRING shape[4] = "T"
    INTEGER ndim = 4
    INTEGER data_types(4) = [3,3,3,7]
    REAL rvalues(4) = [5.,5.,1.,1.]
    INTEGER field_ids(4) = [0,0,0,0]
 
       bl_create_std_beam_section(shape,               @
                                  name,                @
                                  ndim,                @
                                  data_types,          @
                                  rvalues,             @
                                  field_ids,           @
                                  bsid)
 
#  Using the function blmodifybeamdimension() 
#  to modify the beam sec.dimension
 
       status = blmodifybeamdimension(bsid,            @
                                      dimid,           @
                                      value,           @
                                      fid)
 
    dump status
 
#---------------------------------------------------------------------
 
#  End of File.
 
#---------------------------------------------------------------------
 
db_associate_geo_to_region
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_associate_geo_to_region()
#
#                      This function associates a specified physical 
#                      property region to a geometric entity in  the
#                      database.This file opens a new database
#                      “new.db” and creates a physical property region
#                      with id = 9.It then creates a surface with 
#                      label = 1. Later it gets a count of the 
#                      geometric entities before and after the 
#                      association of the region to surface entity.
#
#                      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_associate_geo_to_region()
#  has the following arguments:
#
#  db_associate_geo_to_region
#     (  gid,
#        gtype,
#        gsid,
#        rid )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_gid
INTEGER  i_gtype
INTEGER  i_gsid
INTEGER  i_rid
INTEGER  ia_rid(1)
INTEGER  i_id  = 9
STRING   s_region_name[32] = [“REGION”]
INTEGER  i_elem_type = 1
INTEGER  i_geom_id = 1
INTEGER  i_condense_id = 1
INTEGER  i_form_id = 1
INTEGER  i_lam_id = 1
INTEGER  i_dof_set_id = 1
INTEGER  i_count_region
INTEGER  i_count
STRING   sv_asm_create_patch_xy[VIRTUAL]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Create a physical property region with id = 9
db_create_phys_prop_region                        @
   (  i_id,                                       @
      s_region_name,                              @
      i_elem_type,                                @
      i_geom_id,                                  @
      i_condense_id,                              @
      i_form_id,                                  @
      i_lam_id,                                   @
      i_dof_set_id )
 
#  Get the region ids
db_count_region_ids(i_count_region) 
db_get_all_region_ids(i_count_region,ia_rid)
i_rid = ia_rid(1)
 
#  Create a Surface with label = 1
asm_const_patch_xyz( “1”,”<1 1 0>”,”[0 0 0]”,”Coord 0”,     @
sv_asm_create_patch_xy )
 
#  Get surface id for surface label = 1.
db_get_surface_id( 1,i_gid)
#  i_gtype = 3  (surface)
i_gtype = 3 
i_gsid = 0
 
#  Count the number of entities associated with the physical 
#  property region.
db_count_geo_in_region                            @
   (  i_rid,                                      @
      i_count)
dump i_count
 
i_return_value =                                  @
   db_associate_geo_to_region                     @
      (  i_gid,                                   @
         i_gtype,                                 @
         i_gsid,                                  @
         i_rid )
dump i_return_value
 
#  Count the number of entities associated with the physical 
#  property region.
db_count_geo_in_region                            @
   (  i_rid,                                      @
      i_count)
dump i_count
 
#  Check the count of entities before and after the association 
#  of the geometric entity.
 
SYS_FREE_STRING( sv_asm_create_patch_xy )
#---------------------------------------------------------------------
db_bulk_get_possible_dof_sets1
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_bulk_get_possible_dof_sets1()
#
#                      This function retrieves all possible values of 
#                      the dof set option for specified input options.
#                      This file opens a new database “new.db” and
#                      gets the number of dof set ids and dof set ids
#                      for the analysis code MSC.Nastran , analysis
#                      type STRUCTURAL and element type Mass.
#
#                      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_possible_dof_sets1()
#  has the following arguments:
#
#  db_bulk_get_possible_dof_sets1
#     (  etid,
#        atid,
#        acid,
#        nbr,
#        dsid )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_etid
INTEGER  i_atid
INTEGER  i_acid
INTEGER  i_nbr
INTEGER  ia_dsid(2)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  i_etid = 1 (MASS)
i_etid = 1
#  i_atid = 1 (STRUCTURAL)
i_atid = 1
#  i_acid = 1 (MSC.Nastran)
i_acid = 1
 
i_return_value =                                  @
   db_bulk_get_possible_dof_sets1                 @
      (  i_etid,                                  @
         i_atid,                                  @
         i_acid,                                  @
         i_nbr,                                   @
         ia_dsid )
dump i_return_value
 
#  The number of dof set ids that were found for the above
#  specified set of parameters are
dump i_nbr
#  The unique dof set ids that were found for the above
#  specified set of parameters are
dump ia_dsid
#---------------------------------------------------------------------
db_bulk_get_possible_dof_sets2
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_bulk_get_possible_dof_sets2()
#
#                      This function gets all possible values of
#                      degree of freedom sets for the specified input
#                      options.This file opens a new database
#                      “new.db” and gets the possible values of
#                      degree of freedom sets for the specified input
#                      options.
#
#                      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_possible_dof_sets2()
#  has the following arguments:
#
#  db_bulk_get_possible_dof_sets2
#     (  etid,
#        atid,
#        acid,
#        coc,
#        goc,
#        foc,
#        loc,
#        nbr,
#        dsid )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_etid
INTEGER  i_atid
INTEGER  i_acid
INTEGER  i_coc
INTEGER  i_goc
INTEGER  i_foc
INTEGER  i_loc
INTEGER  i_nbr
INTEGER  ia_dsid(4)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  The names and the ids of the element types,analysis code
#  analysis type,degree of freedom option,laminate option,
#  geometric option,formulation option,condensation option
#  are given in CHAPTER 7 of MSC Patran USER MANUAL (Vol 4).
#  i_etid = 51 (Element type shell)
i_etid = 51
#  i_atid = 1 (Analysis type STRUCTURAL)
i_atid = 1
#  i_acid = 1 (Analysis code MSC.Nastran)
i_acid = 1
#  i_goc = 25 (Geometric option N/A)
i_goc = 25
#  i_foc = 1  (Formulation option STANDARD FORMULATION)
i_foc = 1
#  i_loc = 1  (Laminate option HOMOGENEOUS)
i_loc = 1
#  i_coc = 35  ( Condensation option THIN SHELL )
i_coc = 35
i_return_value =                                  @
   db_bulk_get_possible_dof_sets2                 @
      (  i_etid,                                  @
         i_atid,                                  @
         i_acid,                                  @
         i_coc,                                   @
         i_goc,                                   @
         i_foc,                                   @
         i_loc,                                   @
         i_nbr,                                   @
         ia_dsid )
dump i_return_value
 
#  The number of dof set Ids that were found for the above
#  specified set of parameters are
dump i_nbr
#  The unique dof set Ids that were found for the above
#  specified set of parameters are
dump ia_dsid
#---------------------------------------------------------------------
db_bulk_get_possible_form_opts1
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_bulk_get_possible_form_opts1()
#
#                      This function retrieves all possible values of 
#                      the formulation option for specified input 
#                      options.This file opens a new database “new.db”
#                      and gets the number of formulation options and 
#                      its values for the analysis code MSC.Nastran ,
#                      analysis type STRUCTURAL and element type Mass.
#
#                      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_possible_form_opts1()
#  has the following arguments:
#
#  db_bulk_get_possible_form_opts1
#     (  etid,
#        atid,
#        acid,
#        nbr,
#        foc )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_etid
INTEGER  i_atid
INTEGER  i_acid
INTEGER  i_nbr
INTEGER  ia_foc(4)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  i_etid = 1 (MASS)
i_etid = 1
#  i_atid = 1 (STRUCTURAL)
i_atid = 1
#  i_acid = 1 (MSC.Nastran)
i_acid = 1
 
i_return_value =                                  @
   db_bulk_get_possible_form_opts1                @
      (  i_etid,                                  @
         i_atid,                                  @
         i_acid,                                  @
         i_nbr,                                   @
         ia_foc )
dump i_return_value
 
#  The number of formulation option codes that were found for
#  the above specified set of parameters are
dump i_nbr
#  The unique formulation option code values that were found for the 
#  above specified set of parameters are
dump ia_foc
#---------------------------------------------------------------------
db_bulk_get_possible_form_opts2
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_bulk_get_possible_form_opts2()
#
#                      This function gets all possible values of
#                      formulation option for the specified input
#                      options.This file opens a new database
#                      “new.db” and gets the possible values of
#                      formulation option for the specified input
#                      options.
#
#                      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_possible_form_opts2()
#  has the following arguments:
#
#  db_bulk_get_possible_form_opts2
#     (  etid,
#        atid,
#        acid,
#        goc,
#        coc,
#        loc,
#        nbr,
#        foc )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_etid
INTEGER  i_atid
INTEGER  i_acid
INTEGER  i_goc
INTEGER  i_coc
INTEGER  i_loc
INTEGER  i_nbr
INTEGER  ia_foc(4)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  The names and the ids of the element types,analysis code
#  analysis type,degree of freedom option,laminate option,
#  geometric option,formulation option,condensation option
#  are given in CHAPTER 7 of MSC Patran USER MANUAL (Vol 4).
#  i_etid = 51 (Element type shell)
i_etid = 51
#  i_atid = 1 (Analysis type STRUCTURAL)
i_atid = 1
#  i_acid = 1 (Analysis code MSC.Nastran)
i_acid = 1
#  i_goc = 25 (Geometric option N/A)
i_goc = 25
#  i_loc = 1  (Laminate option HOMOGENEOUS)
i_loc = 1
#  i_coc = 35  ( Condensation option THIN SHELL )
i_coc = 35 
 
i_return_value =                                  @
   db_bulk_get_possible_form_opts2                @
      (  i_etid,                                  @
         i_atid,                                  @
         i_acid,                                  @
         i_goc,                                   @
         i_coc,                                   @
         i_loc,                                   @
         i_nbr,                                   @
         ia_foc )
dump i_return_value
#  The number of formulation option codes found for the above
#  specified set of parameters.
dump i_nbr
#  The unique formulation option codes values found for the above
#  specified set of parameters.
dump ia_foc
#---------------------------------------------------------------------
db_bulk_get_possible_geo_opts1
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_bulk_get_possible_geo_opts1()
#
#                      This function retrieves all possible values of 
#                      the geometric option for specified input 
#                      options.This file opens a new database “new.db”
#                      and gets the number of geometric options and
#                      its values for the analysis code MSC.Nastran ,
#                      analysis type STRUCTURAL and element type Mass.
#
#                      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_possible_geo_opts1()
#  has the following arguments:
#
#  db_bulk_get_possible_geo_opts1
#     (  etid,
#        atid,
#        acid,
#        nbr,
#        goc )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_etid
INTEGER  i_atid
INTEGER  i_acid
INTEGER  i_nbr
INTEGER  ia_goc(2)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  i_etid = 1 (MASS)
i_etid = 1
#  i_atid = 1 (STRUCTURAL)
i_atid = 1
#  i_acid = 1 (MSC.Nastran)
i_acid = 1
 
i_return_value =                                  @
   db_bulk_get_possible_geo_opts1                 @
      (  i_etid,                                  @
         i_atid,                                  @
         i_acid,                                  @
         i_nbr,                                   @
         ia_goc )
dump i_return_value
 
#  The number of geometric option codes that were found for the above
#  specified set of parameters are
dump i_nbr
#  The unique geometric option code values that were found for the 
#  above specified set of parameters are
dump ia_goc
#---------------------------------------------------------------------
db_bulk_get_possible_lam_opts1
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_bulk_get_possible_lam_opts1()
#
#                      This function retrieves all possible values of 
#                      the laminate option for specified input 
#                      options.This file opens a new database “new.db”
#                      and gets the number of laminate options and
#                      its values for the analysis code MSC.Nastran ,
#                      analysis type STRUCTURAL and element type Mass.
#
#                      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_possible_lam_opts1()
#  has the following arguments:
#
#  db_bulk_get_possible_lam_opts1
#     (  etid,
#        atid,
#        acid,
#        nbr,
#        loc )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_etid
INTEGER  i_atid
INTEGER  i_acid
INTEGER  i_nbr
INTEGER  ia_loc(2)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  i_etid = 1 (MASS)
i_etid = 1
#  i_atid = 1 (STRUCTURAL)
i_atid = 1
#  i_acid = 1 (MSC.Nastran)
i_acid = 1
 
i_return_value =                                  @
   db_bulk_get_possible_lam_opts1                 @
      (  i_etid,                                  @
         i_atid,                                  @
         i_acid,                                  @
         i_nbr,                                   @
         ia_loc )
dump i_return_value
 
#  The number of laminate option codes that were found for the above
#  specified set of parameters are
dump i_nbr
#  The unique laminate option code values that were found for the 
#  above specified set of parameters are
dump ia_loc
#---------------------------------------------------------------------
db_bulk_get_possible_lam_opts2
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_bulk_get_possible_lam_opts2()
#
#                      This function gets all possible values of
#                      laminate options for the specified input
#                      options.This file opens a new database
#                      “new.db” and gets the possible values of
#                      laminate options for the specified input
#                      options.
#
#                      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_possible_lam_opts2()
#  has the following arguments:
#
#  db_bulk_get_possible_lam_opts2
#     (  etid,
#        atid,
#        acid,
#        goc,
#        coc,
#        nbr,
#        loc )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_etid
INTEGER  i_atid
INTEGER  i_acid
INTEGER  i_goc
INTEGER  i_coc
INTEGER  i_nbr
INTEGER  ia_loc(4)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  The names and the ids of the element types,analysis code
#  analysis type,degree of freedom option,laminate option,
#  geometric option,formulation option,condensation option
#  are given in CHAPTER 7 of MSC Patran USER MANUAL (Vol 4).
#  i_etid = 51 (Element type shell)
i_etid = 51
#  i_atid = 1 (Analysis type STRUCTURAL)
i_atid = 1
#  i_acid = 1 (Analysis code MSC.Nastran)
i_acid = 1
#  i_goc = 25 (Geometric option N/A)
i_goc = 25
#  i_coc = 35  ( Condensation option THIN SHELL )
i_coc = 35
i_return_value =                                  @
   db_bulk_get_possible_lam_opts2                 @
      (  i_etid,                                  @
         i_atid,                                  @
         i_acid,                                  @
         i_goc,                                   @
         i_coc,                                   @
         i_nbr,                                   @
         ia_loc )
dump i_return_value
#  The number of laminate option codes found for the above
#  specified set of parameters.
dump i_nbr
#  The unique laminate option codes values found for the above
#  specified set of parameters.
dump ia_loc
#---------------------------------------------------------------------
db_bulk_get_possible_matl_dirs
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_bulk_get_possible_matl_dirs()
#
#                      This function gets the possible values of 
#                      material directionality option for the 
#                      specified input options.This file opens a
#                      new database “new.db” and gets the possible
#                      values of material directionality option for
#                      the specified input optons.
#
#                      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_possible_matl_dirs()
#  has the following arguments:
#
#  db_bulk_get_possible_matl_dirs
#     (  etid,
#        atid,
#        acid,
#        goc,
#        foc,
#        loc,
#        dsid,
#        coc,
#        mlc,
#        nbr,
#        mdc )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_etid
INTEGER  i_atid
INTEGER  i_acid
INTEGER  i_goc
INTEGER  i_foc
INTEGER  i_loc
INTEGER  i_dsid
INTEGER  i_coc
INTEGER  i_mlc
INTEGER  i_nbr
INTEGER  ia_mdc(8)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  The names and the ids of the element types,analysis code
#  analysis type,degree of freedom option,laminate option,
#  geometric option,formulation option,condensation option
#  are given in CHAPTER 7 of MSC Patran USER MANUAL (Vol 4).
#  i_etid = 51 (Element type SHELL)
i_etid = 51
#  i_atid = 1 (Analysis type STRUCTURAL)
i_atid = 1
#  i_acid = 1 (Analysis code MSC.Nastran)
i_acid = 1
#  i_goc = 25 (Geometric option N/A)
i_goc = 25
#  i_foc = 1  (Formulation option STANDARD FORMULATION)
i_foc = 1
#  i_loc = 1  (Laminate option HOMOGENEOUS)
i_loc = 1
#  i_dsid = 20 (Dof set name UX,UY,UZ,RX,RY,RZ)
i_dsid = 20
#  i_coc = 35  ( Condensation option THIN SHELL )
i_coc = 35
#  i_mlc = 1  ( Material linearity  LINEARLY ELASTIC)
i_mlc = 1
 
i_return_value =                                  @
   db_bulk_get_possible_matl_dirs                 @
      (  i_etid,                                  @
         i_atid,                                  @
         i_acid,                                  @
         i_goc,                                   @
         i_foc,                                   @
         i_loc,                                   @
         i_dsid,                                  @
         i_coc,                                   @
         i_mlc,                                   @
         i_nbr,                                   @
         ia_mdc )
dump i_return_value
 
#  The number of material directionality codes found for the above
#  specified set of parameters.
dump i_nbr
#  The unique material directionality code values found for the above
#  specified set of parameters.
dump ia_mdc
#---------------------------------------------------------------------
db_bulk_get_possible_matl_lins
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_bulk_get_possible_matl_lins()
#
#                      This function gets all possible values of
#                      material linearity codes for the specified 
#                      input options.This file opens a new database
#                      “new.db” and gets the possible values of
#                      material linearity codes for the specified
#                      input options.
#
#                      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_possible_matl_lins()
#  has the following arguments:
#
#  db_bulk_get_possible_matl_lins
#     (  etid,
#        atid,
#        acid,
#        goc,
#        foc,
#        loc,
#        dsid,
#        coc,
#        mdc,
#        nbr,
#        mlc )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_etid
INTEGER  i_atid
INTEGER  i_acid
INTEGER  i_goc
INTEGER  i_foc
INTEGER  i_loc
INTEGER  i_dsid
INTEGER  i_coc
INTEGER  i_mdc
INTEGER  i_nbr
INTEGER  ia_mlc(4)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  The names and the ids of the element types,analysis code
#  analysis type,degree of freedom option,laminate option,
#  geometric option,formulation option,condensation option
#  are given in CHAPTER 7 of MSC Patran USER MANUAL (Vol 4).
#  i_etid = 51 (Element type shell)
i_etid = 51
#  i_atid = 1 (Analysis type STRUCTURAL)
i_atid = 1
#  i_acid = 1 (Analysis code MSC.Nastran)
i_acid = 1
#  i_goc = 25 (Geometric option N/A)
i_goc = 25
#  i_foc = 1  (Formulation option STANDARD FORMULATION)
i_foc = 1
#  i_loc = 1  (Laminate option HOMOGENEOUS)
i_loc = 1
#  i_dsid = 20 (Dof set name UX,UY,UZ,RX,RY,RZ)
i_dsid = 20
#  i_coc = 35  ( Condensation option THIN SHELL )
i_coc = 35
#  i_mdc = 1  ( Material directionality code ISOTROPIC )
i_mdc = 1
i_return_value =                                  @
   db_bulk_get_possible_matl_lins                 @
      (  i_etid,                                  @
         i_atid,                                  @
         i_acid,                                  @
         i_goc,                                   @
         i_foc,                                   @
         i_loc,                                   @
         i_dsid,                                  @
         i_coc,                                   @
         i_mdc,                                   @
         i_nbr,                                   @
         ia_mlc )
dump i_return_value
#  The number of material linearity codes found for
#  the above specified set of parameters.
dump i_nbr
#  The unique material linearity codes values found for
#  the above specified set of parameters.
dump ia_mlc
#---------------------------------------------------------------------
db_bulk_get_selected_etops_mat
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_bulk_get_selected_etops_mat()
#
#                      This function gets all possible values of
#                      element topologies for the specified input
#                      options.This file opens a new database
#                      “new.db” and gets the possible values of
#                      element topologies for the specified input
#                      options.
#
#                      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_selected_etops_mat()
#  has the following arguments:
#
#  db_bulk_get_selected_etops_mat
#     (  etid,
#        atid,
#        acid,
#        goc,
#        foc,
#        loc,
#        dsid,
#        coc,
#        nbr,
#        etop )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_etid
INTEGER  i_atid
INTEGER  i_acid
INTEGER  i_goc
INTEGER  i_foc
INTEGER  i_loc
INTEGER  i_dsid
INTEGER  i_coc
INTEGER  i_nbr
INTEGER  ia_etop(8)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  The names and the ids of the element types,analysis code
#  analysis type,degree of freedom option,laminate option,
#  geometric option,formulation option,condensation option
#  are given in CHAPTER 7 of MSC Patran USER MANUAL (Vol 4).
#  i_etid = 51 (Element type shell)
i_etid = 51
#  i_atid = 1 (Analysis type STRUCTURAL)
i_atid = 1
#  i_acid = 1 (Analysis code MSC.Nastran)
i_acid = 1
#  i_goc = 25 (Geometric option N/A)
i_goc = 25
#  i_foc = 1  (Formulation option STANDARD FORMULATION)
i_foc = 1
#  i_loc = 1  (Laminate option HOMOGENEOUS)
i_loc = 1
#  i_dsid = 20 (Dof set name UX,UY,UZ,RX,RY,RZ)
i_dsid = 20
#  i_coc = 35  ( Condensation option THIN SHELL )
i_coc = 35
i_return_value =                                  @  
   db_bulk_get_selected_etops_mat                 @
      (  i_etid,                                  @
         i_atid,                                  @
         i_acid,                                  @
         i_goc,                                   @
         i_foc,                                   @
         i_loc,                                   @
         i_dsid,                                  @
         i_coc,                                   @
         i_nbr,                                   @
         ia_etop )
dump i_return_value
 
#  The number of element topologies that were found for the
#  above specified set of parameters are
dump i_nbr
#  The unique element topologies values that were found for the
#  above specified set of parameters are
dump ia_etop
#---------------------------------------------------------------------
db_count_elem_type
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_count_elem_type()
#
#                      This function gets the count of the number
#                      of distinct element types for each element
#                      dimensionality,given a specified analysis
#                      code and analysis type.This file opens a new 
#                      database “new.db” and counts the distinct
#                      element types for each dimensionality for 
#                      analysis code MSC.Nastran and analysis type
#                      STRUCTURAL.
#
#                      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_elem_type()
#  has the following arguments:
#
#  db_count_elem_type
#     (  acid,
#        atid,
#        etcnt )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_acid
INTEGER  i_atid
INTEGER  ia_etcnt(4)
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  i_acid = 1  ( Analysis code is MSC.Nastran )
i_acid = 1
#  i_atid = 1  ( Analysis type is STRUCTURAL )
i_atid = 1
 
db_count_elem_type                                @
   (  i_acid,                                     @
      i_atid,                                     @
      ia_etcnt )
 
#  The count of element types (one for each dimensionality)
dump ia_etcnt
#---------------------------------------------------------------------
 
db_count_elements_in_region_exp
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_count_elements_in_region_exp()
#
#                      The function gets the number of elements in 
#                      a specified region in the database.This 
#                      file opens a new database “new.db” and
#                      creates a property region with id = 9
#                      Later it creates four elements with ids
#                      1,2,3 and 4.Then it associates the elements
#                      with id = 2 and id = 3 to the property
#                      region.Later it counts and gets the elements
#                      in this region.
#
#                      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_elements_in_region_exp()
#  has the following arguments:
#
#  db_count_elements_in_region_exp
#     (  rid,
#        count )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_count
INTEGER  i_rid
INTEGER  iv_eid(VIRTUAL)
INTEGER  ia_rid(1)
INTEGER  i_count_region
STRING   sv_fem_create_elems_created[VIRTUAL]
INTEGER  i_id = 9
STRING   s_region_name[32] = [“REGION”]
INTEGER  i_elem_type = 1
INTEGER  i_geom_id = 1
INTEGER  i_condense_id = 1
INTEGER  i_form_id = 1
INTEGER  i_lam_id = 1
INTEGER  i_dof_set_id = 1
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Create a physical property region with id = 9
i_return_value =                                  @
   db_create_phys_prop_region                     @
      (  i_id,                                    @
         s_region_name,                           @
         i_elem_type,                             @
         i_geom_id,                               @
         i_condense_id,                           @
         i_form_id,                               @      
         i_lam_id,                                @
         i_dof_set_id )
dump i_return_value
 
#  Create four elements.
fem_create_elems(“Bar”,”Bar2”,”1”,”standard”      @
   ,TRUE,”[0 0 0]”,”[1 0 0]”,””,””,””,””,””,””,   @
   sv_fem_create_elems_created)
fem_create_elems(“Bar”,”Bar2”,”2”,”standard”      @
   ,TRUE,”[1 0 0]”,”[1 1 0]”,””,””,””,””,””,””,   @
   sv_fem_create_elems_created)
fem_create_elems(“Bar”,”Bar2”,”3”,”standard”      @
   ,TRUE,”[1 1 0]”,”[0 1 0]”,””,””,””,””,””,””,   @
   sv_fem_create_elems_created)
fem_create_elems(“Bar”,”Bar2”,”4”,”standard”      @
   ,TRUE,”[0 1 0]”,”[0 0 0]”,””,””,””,””,””,””,   @
   sv_fem_create_elems_created)
 
#  Get the region ids
i_return_value = db_count_region_ids(i_count_region) 
dump i_return_value
i_return_value = db_get_all_region_ids(i_count_region,ia_rid)
dump i_return_value
i_rid = ia_rid(1)
 
#  Associate the elements with id = 2 and 3 to the property region.
i_return_value = db_associate_element_to_region(2,i_rid)
dump i_return_value
i_return_value = db_associate_element_to_region(3,i_rid)
dump i_return_value
 
#  Count the number of elements associated with the physical 
#  property region.
i_return_value =                                  @
   db_count_elements_in_region_exp                @
      (  i_rid,                                   @
         i_count )
dump i_return_value
 
#  The number of the elements associated with the region.
dump i_count
 
SYS_ALLOCATE_ARRAY(iv_eid,1,i_count)
 
#  Get all elements for the physical property region
i_return_value =                                  @
   db_get_elements_in_region_exp                  @
      (  i_count,                                 @
         i_rid,                                   @
         iv_eid )
dump i_return_value
 
#  The ids of the elements associated with the region.
dump iv_eid
 
SYS_FREE_ARRAY(iv_eid)
SYS_FREE_STRING(sv_fem_create_elems_created)
#---------------------------------------------------------------------
db_count_etop_for_a_code
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_count_etop_for_a_code()
#
#                      This function gives a count of element 
#                      topologies based on the analysis code and type.
#                      This file opens a new database “new.db” and
#                      counts the element topologies for the analysis 
#                      code MSC.Nastran and analysis type STRUCTURAL.
#
#                      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_etop_for_a_code()
#  has the following arguments:
#
#  db_count_etop_for_a_code
#     (  acid,
#        atid,
#        count )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_acid
INTEGER  i_atid
INTEGER  i_count
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  i_acid = 1  ( Analysis code is MSC.Nastran )
i_acid = 1
#  i_atid = 1  ( Analysis type is STRUCTURAL )
i_atid = 1
 
i_return_value =                                  @
   db_count_etop_for_a_code                       @
      (  i_acid,                                  @
         i_atid,                                  @
         i_count )
dump i_return_value
 
#  The count of element topologies for analysis code MSC.Nastran
#  and analysis type STRUCTURAL is
dump i_count 
#---------------------------------------------------------------------
db_count_geo_in_region
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_count_geo_in_region()
#
#                      This function gets the count of entities 
#                      associated with a physical property region in 
#                      the database.This file opens the database 
#                      “spool.db” and gets the number of regions and
#                      the region ids.Later it gets the count of 
#                      entities associated with this region id.The
#                      spool database has one region and has six 
#                      surfaces associated with this 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_count_geo_in_region()
#  has the following arguments:
#
#  db_count_geo_in_region
#     (  rid,
#        count )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_rid
INTEGER  ia_rid(1)
INTEGER  i_count
INTEGER  i_count_region
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Get the region ids
db_count_region_ids(i_count_region) 
db_get_all_region_ids(i_count_region,ia_rid)
i_rid = ia_rid(1)
 
#  Count the number of entities associated with the physical 
#  property region.
i_return_value =                                  @
   db_count_geo_in_region                         @
      (  i_rid,                                   @
         i_count )
dump i_return_value
 
#  The count of geometric entities in the region are.
dump i_count
#---------------------------------------------------------------------
db_create_analysis_elements
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_create_analysis_elements()
#
#                      This function stores a set of analysis element
#                      relationship.This file opens a new database 
#                      “new.db” and gets the set of analysis elements
#                      relationship for analysis code MSC.Nastran and 
#                      analysis code STRUCTURAL.It then deletes the 
#                      analysis elements relationship and further
#                      creates a new element analysis relationship.
#                      Finally it gets the newly created element
#                      analysis relationship.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function db_create_analysis_elements()
#  has the following arguments:
#
#  db_create_analysis_elements
#     (  acid,
#        atid,
#        etcnt,
#        etids,
#        etnames )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_acid
INTEGER  i_atid
INTEGER  i_etcnt
INTEGER  ia_etids(2)
STRING   sa_etnames[32](2)
INTEGER  ia_etids_c(4)
INTEGER  iv_etids_c(VIRTUAL)
STRING   sv_etnames_c[32](VIRTUAL)
INTEGER  iv_etids_c1(VIRTUAL)
STRING   sv_etnames_c1[32](VIRTUAL)
INTEGER  i_etcntmax
INTEGER  i_etcntfound
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  i_acid = 1 (Analysis code MSC.Nastran )
i_acid = 1 
#  i_atid = 1 (Analysis type STRUCTURAL )
i_atid = 1 
 
db_count_elem_type                                @
   (  i_acid,                                     @
      i_atid,                                     @
      ia_etids_c )
#  Adding the element type of each dimensionality to get 
#  the maximum number of element types.
i_etcntmax = ia_etids_c(1) + ia_etids_c(2) +      @
ia_etids_c(3) + ia_etids_c(4)
 
SYS_ALLOCATE_ARRAY(iv_etids_c,1,i_etcntmax )
SYS_ALLOCATE_ARRAY(sv_etnames_c,1,i_etcntmax )
 
#  Get the set of analysis element relation
i_return_value =                                  @
   db_get_analysis_elements                       @
      (  i_acid,                                  @
         i_atid,                                  @
         i_etcntmax,                              @
         i_etcntfound,                            @
         iv_etids_c,                              @
         sv_etnames_c )
dump i_return_value
 
#  The element type ids retrived
dump iv_etids_c
#  The element type names related to corresponding ids
dump sv_etnames_c
 
#  Delete the set of analysis elements relation
i_return_value =                                  @
   db_delete_analysis_elements                    @
      (  i_acid,                                  @
         i_atid,                                  @
         i_etcntmax,                              @
         iv_etids_c )
dump i_return_value
 
#  Create the set of analysis element relation
i_etcnt = 2
ia_etids = [ 1,2 ]
sa_etnames(1) = “GSSL”
sa_etnames(2) = “MSC”
i_return_value =                                  @
   db_create_analysis_elements                    @
      (  i_acid,                                  @
         i_atid,                                  @
         i_etcnt,                                 @
         ia_etids,                                @
         sa_etnames )
dump i_return_value
 
#  Get the set of analysis element relation
i_etcntmax = 2
SYS_ALLOCATE_ARRAY(iv_etids_c1,1,i_etcntmax )
SYS_ALLOCATE_ARRAY(sv_etnames_c1,1,i_etcntmax )
i_return_value =                                  @
   db_get_analysis_elements                       @
      (  i_acid,                                  @
         i_atid,                                  @
         i_etcntmax,                              @
         i_etcntfound,                            @
         iv_etids_c1,                             @
         sv_etnames_c1 )
dump i_return_value
 
#  The number of elements found
dump i_etcntfound
#  The element type ids retrived
dump iv_etids_c1
#  The element type names related to corresponding ids
dump sv_etnames_c1
SYS_FREE_ARRAY(iv_etids_c)
SYS_FREE_ARRAY(sv_etnames_c)
SYS_FREE_ARRAY(iv_etids_c1)
SYS_FREE_ARRAY(sv_etnames_c1)
#---------------------------------------------------------------------
db_create_anl_elm_summary
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_create_anl_elm_summary()
#
#                      This function stores an analysis element 
#                      summary relationship.This file opens a new 
#                      database “new.db” and gets the present summary
#                      for analysis code MSC.Nastran and analysis
#                      type STRUCTURAL.Later it deletes this summary
#                      and creates a new summary.Finally it gets this
#                      new summary.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function db_create_anl_elm_summary()
#  has the following arguments:
#
#  db_create_anl_elm_summary
#     (  acid,
#        atid,
#        etcnt )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_acid
INTEGER  i_atid
INTEGER  ia_etcnt(4)
INTEGER  ia_etcnt_c(4)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  i_acid = 1 (MSC.Nastran)
i_acid = 1 
#  i_atid = 1 (STRUCTURAL)
i_atid = 1
 
i_return_value =                                  @
   db_get_anl_elm_summary                         @
      (  i_acid,                                  @
         i_atid,                                  @
         ia_etcnt_c )
dump i_return_value
 
#  The count of element types one for each element dimensionality.
dump ia_etcnt_c
 
#  Delete the analysis summary
i_return_value =                                  @
   db_delete_anl_elm_summary                      @
      (  i_acid,                                  @
         i_atid )
dump i_return_value
 
#  Create a new elm summary
#  ia_etcnt = [ 5,5,5,5 ]
ia_etcnt = [ 5,5,5,5 ]
 
i_return_value =                                  @
   db_create_anl_elm_summary                      @
      (  i_acid,                                  @
         i_atid,                                  @
         ia_etcnt )
dump i_return_value
 
i_return_value =                                  @
   db_get_anl_elm_summary                         @
      (  i_acid,                                  @
         i_atid,                                  @
         ia_etcnt_c )
dump i_return_value
 
#  The count of element types one for each element dimensionality.
dump ia_etcnt_c
#  Note the difference in summary before and after creation.
#---------------------------------------------------------------------
db_create_phys_prop_set_defn
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_create_phys_prop_set_defn()
#
#                      This function creates a physical property set
#                      entry into the database.This file opens a new
#                      database “new.db” and creates a physical
#                      property set with id= 8 and set name “GSSL”.
#                      It includes the three physical properties with
#                      property ids 1,6,7.Later it gets this physical
#                      property definition using the function
#                      db_get_phys_prop_set_defn().
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function db_create_phys_prop_set_defn()
#  has the following arguments:
#
#  db_create_phys_prop_set_defn
#     (  id,
#        name,
#        num,
#        ppids )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_id
STRING   s_name[32],s_name_c[32]
INTEGER  i_num,i_num_c
INTEGER  ia_ppids(3),ia_ppids_c(3)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
i_id = 8
s_name = “GSSL”
i_num = 3
ia_ppids = [1,6,7]
 
i_return_value =                                  @
   db_create_phys_prop_set_defn                   @
      (  i_id,                                    @
         s_name,                                  @
         i_num,                                   @
         ia_ppids )
dump i_return_value
 
#  Get the physical property set definition 
db_get_phys_prop_set_defn                         @
   (  i_id,                                       @
      s_name_c,                                   @
      i_num_c,                                    @
      ia_ppids_c )
 
#  The name of the physical property set
dump s_name_c
#  The number of physical property values associated with this set
dump i_num_c
#  The Ids of physical property values associated with this set
dump ia_ppids_c
#---------------------------------------------------------------------
db_create_selected_etype
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_create_selected_etype()
#
#                      This function creates a selected element type
#                      entry in the database.This file opens a new
#                      database “new.db” and gets the summary of 
#                      analysis elements for analysis type STRUCTURAL
#                      and analysis code MSC.Nastran.It then creates
#                      an entry for element type rotary inertia in the
#                      database using the above function.Finally it 
#                      re-creates the summary table and checks the
#                      analysis elements summary to show the entry 
#                      of the element type rotary inertia.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function db_create_selected_etype()
#  has the following arguments:
#
#  db_create_selected_etype
#     (  atid,
#        acid,
#        geopcd,
#        copcd,
#        fopcd,
#        lopcd,
#        etopid,
#        dofsetid,
#        mlcd,
#        mdcd,
#        etypid )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_atid
INTEGER  i_acid
INTEGER  i_geopcd
INTEGER  i_copcd
INTEGER  i_fopcd
INTEGER  i_lopcd
INTEGER  i_etopid
INTEGER  i_dofsetid
INTEGER  i_mlcd
INTEGER  i_mdcd
INTEGER  i_etypid
INTEGER  ia_etcnt(4)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  i_acid = 1 ( Analysis code is MSC.Nastran )
i_acid = 1
#  i_atid = 1 ( Analysis type is Structural  )
i_atid = 1
 
#  Get the analysis element summary.
db_get_anl_elm_summary                            @ 
   (  i_acid,                                     @ 
      i_atid,                                     @
      ia_etcnt )
#  The element summary is
dump ia_etcnt
 
i_geopcd = 1
i_copcd = 1
i_fopcd = 1
i_lopcd = 1
i_etopid = 1
i_dofsetid = 1
i_mlcd = 1
i_mdcd = 1
 
#  Add the element type rotary inertia which is Zero dimensional.
#  i_etypid = 2  
i_etypid = 2
i_return_value =                                  @
   db_create_selected_etype                       @
      (  i_atid,                                  @
         i_acid,                                  @
         i_geopcd,                                @
         i_copcd,                                 @
         i_fopcd,                                 @
         i_lopcd,                                 @
         i_etopid,                                @
         i_dofsetid,                              @
         i_mlcd,                                  @
         i_mdcd,                                  @
         i_etypid )
 
dump i_return_value
 
#  Recreate the summary table.
elementprops_def_create.make_elem_summary()
 
#  Get the analysis element summary.
db_get_anl_elm_summary                            @ 
   (  i_acid,                                     @ 
      i_atid,                                     @
      ia_etcnt )
#  The element summary is
dump ia_etcnt
#  Note the first dimensional value of the element summary 
#  before and after creation.
#---------------------------------------------------------------------
db_delete_analysis_elements
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_delete_analysis_elements()
#
#                      This function removes a set of analysis element
#                      relationship.This file opens a new database 
#                      “new.db” and gets the set of analysis elements
#                      relationship for analysis code MSC.Nastran and 
#                      analysis code STRUCTURAL.It then deletes the 
#                      analysis elements relationship and further
#                      it tries to  get the element analysis 
#                      relationship and the error message generated is
#                      shown.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function db_delete_analysis_elements()
#  has the following arguments:
#
#  db_delete_analysis_elements
#     (  acid,
#        atid,
#        etcnt,
#        etids )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_acid
INTEGER  i_atid
INTEGER  i_etcnt
INTEGER  ia_etids_c(4)
INTEGER  iv_etids(VIRTUAL)
STRING   sv_etnames[32](VIRTUAL)
STRING   s_err_msg[32]
INTEGER  i_etcntmax
INTEGER  i_etcntfound
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  i_acid = 1 (Analysis code MSC.Nastran )
i_acid = 1 
#  i_atid = 1 (Analysis type STRUCTURAL )
i_atid = 1 
 
db_count_elem_type                                @
   (  i_acid,                                     @
      i_atid,                                     @
      ia_etids_c )
 
#  Adding the element type of each dimensionality to get 
#  the maximum number of element types.
i_etcntmax = ia_etids_c(1) + ia_etids_c(2) +      @
ia_etids_c(3) + ia_etids_c(4)
 
SYS_ALLOCATE_ARRAY(iv_etids,1,i_etcntmax )
SYS_ALLOCATE_ARRAY(sv_etnames,1,i_etcntmax )
 
#  Get the set of analysis element relation
i_return_value =                                  @
   db_get_analysis_elements                       @
      (  i_acid,                                  @
         i_atid,                                  @
         i_etcntmax,                              @
         i_etcntfound,                            @
         iv_etids,                                @
         sv_etnames )
dump i_return_value
 
#  The element type ids retrived
dump iv_etids
#  The element type names related to corresponding ids
dump sv_etnames
 
#  Delete the set of analysis elements relation
i_etcnt = i_etcntmax
i_return_value =                                  @
   db_delete_analysis_elements                    @
      (  i_acid,                                  @
         i_atid,                                  @
         i_etcnt,                                 @
         iv_etids )
dump i_return_value
 
#  Get the set of analysis element relation
i_return_value =                                  @
   db_get_analysis_elements                       @
      (  i_acid,                                  @
         i_atid,                                  @
         i_etcntmax,                              @
         i_etcntfound,                            @
         iv_etids,                                @
         sv_etnames )
dump i_return_value
 
#  The Error message generated due to retrieving the set of
#  analysis element relationship which was deleted.
msg_get_string(i_return_value,s_err_msg)
dump s_err_msg
 
SYS_FREE_ARRAY(iv_etids)
SYS_FREE_ARRAY(sv_etnames)
#---------------------------------------------------------------------
db_delete_anl_elm_summary
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_delete_anl_elm_summary()
#
#                      This function removes an analysis element 
#                      summary relationship.This file opens a new 
#                      database “new.db” and gets the present summary
#                      for analysis code MSC.Nastran and analysis
#                      type STRUCTURAl.Later it deletes this summary
#                      and tries to gets the summary.The error code
#                      generated due to missing summary is shown.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function db_delete_anl_elm_summary()
#  has the following arguments:
#
#  db_delete_anl_elm_summary
#     (  acid,
#        atid )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_acid
INTEGER  i_atid
INTEGER  ia_etcnt(4)
STRING   s_msg[64]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  i_acid = 1 (MSC.Nastran)
i_acid = 1 
#  i_atid = 1 (STRUCTURAL)
i_atid = 1
 
i_return_value =                                  @
   db_get_anl_elm_summary                         @
      (  i_acid,                                  @
         i_atid,                                  @
         ia_etcnt )
dump i_return_value
 
#  The count of element types one for each element dimensionality.
dump ia_etcnt
 
#  Delete the analysis summary
i_return_value =                                  @
   db_delete_anl_elm_summary                      @
      (  i_acid,                                  @
         i_atid )
dump i_return_value
 
i_return_value =                                  @
   db_get_anl_elm_summary                         @
      (  i_acid,                                  @
         i_atid,                                  @
         ia_etcnt )
dump i_return_value
 
#  Since the summary is deleted the error code is generated
#  when trying to get the summary.The message is
msg_get_string(i_return_value,s_msg)
dump s_msg
#---------------------------------------------------------------------
db_delete_phys_prop_region
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_delete_phys_prop_region()
#
#                      This function deletes the specified physical 
#                      property region from the database.This file
#                      opens a new database “new.db” and creates 
#                      a physical property region with id = 9.It then
#                      associates the element property word with id =1
#                      to the created property region.Finally it 
#                      deletes the physical property region.The count
#                      of no of regions and properties are made at
#                      appropriate places.
#
#                      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_phys_prop_region()
#  has the following arguments:
#
#  db_delete_phys_prop_region
#     (  id )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_id  = 9
STRING   s_region_name[32] = [“REGION”]
INTEGER  i_elem_type = 1
INTEGER  i_geom_id = 1
INTEGER  i_condense_id = 1
INTEGER  i_form_id = 1
INTEGER  i_lam_id = 1
INTEGER  i_dof_set_id = 1
INTEGER  i_count_region
INTEGER  i_count_props
INTEGER  i_word_id = 1
INTEGER  i_material_id
INTEGER  i_data_type
INTEGER  i_integer_val
REAL     ra_real_val(3) = [1,0,0]
STRING   s_character_val[32] =[“ “]
INTEGER  i_node_id
INTEGER  i_coord_id
INTEGER  i_field_id = 0
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Create a physical property region with id = 9
db_create_phys_prop_region                        @
   (  i_id,                                       @
      s_region_name,                              @
      i_elem_type,                                @
      i_geom_id,                                  @
      i_condense_id,                              @
      i_form_id,                                  @
      i_lam_id,                                   @
      i_dof_set_id )
 
#  No of regions are
db_count_region_ids(i_count_region) 
dump i_count_region
 
#  Associate a element property word with id = 1 to the property 
#  region created.
db_create_phys_prop_value                         @
   (  i_id,                                       @
      i_word_id,                                  @
      i_material_id,                              @
      i_data_type,                                @
      i_integer_val,                              @
      ra_real_val,                                @  
      s_character_val,                            @  
      i_node_id,                                  @
      i_coord_id,                                 @
      i_field_id )
 
#  No of physical props in the property region are
db_count_props(i_id,i_count_props)
dump i_count_props
 
i_return_value =                                  @
   db_delete_phys_prop_region                     @
      (  i_id )
dump i_return_value
 
#  No of regions after deletion are
db_count_region_ids(i_count_region) 
dump i_count_region
#  No of physical props in the property region after deletion are
db_count_props(i_id,i_count_props)
dump i_count_props
#---------------------------------------------------------------------
db_get_a_phys_prop_w_nord
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_a_phys_prop_w_nord()
#
#                      This function creates an allowable physical
#                      property entry in the database.This file opens
#                      a new database “new.db” and creates a allowable
#                      entry for physical property “DOF at node 1” 
#                      using analysis code MSC.Nastran and set id = 1.
#
#                      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_a_phys_prop_w_nord()
#  has the following arguments:
#
#  db_get_a_phys_prop_w_nord
#     (  acid,
#        ppid,
#        defid,
#        alias,
#        rflag,
#        atypes,
#        dtype,
#        nord,
#        aival,
#        arval,
#        acval )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_acid
INTEGER  i_ppid
INTEGER  i_defid
STRING   s_alias[64]
INTEGER  i_rflag
INTEGER  ia_atypes(10)
INTEGER  i_dtype
INTEGER  i_nord
STRING   s_aival[32]
STRING   s_arval[32]
STRING   s_acval[32]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  i_acid = 1  ( Analysis code is MSC.Nastran )
i_acid = 1
#  i_ppid = 7  (Id for property “Dof at Node 1”)
i_ppid = 7
#  i_defid = 1
i_defid = 1
 
i_return_value =                                  @
   db_get_a_phys_prop_w_nord                      @
      (  i_acid,                                  @
         i_ppid,                                  @
         i_defid,                                 @
         s_alias,                                 @
         i_rflag,                                 @
         ia_atypes,                               @
         i_dtype,                                 @
         i_nord,                                  @
         s_aival,                                 @
         s_arval,                                 @
         s_acval )
dump i_return_value
 
#  The alias to be used is
dump s_alias
#  Flag indicating the requirement of the property is
dump i_rflag
#  Allowable types for this physical property is
dump ia_atypes
#  Default type for this property is
dump i_dtype
#  PCL function used for validating integer values
dump s_aival
#  PCL function used for validating real values
dump s_arval
#  PCL function used for validating character values
dump s_acval
#---------------------------------------------------------------------
db_get_all_dof_set_names
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_all_dof_set_names()
#
#                      This function sets the next db_get_next_dof set 
#                      code names and ids to start at the beginning of
#                      the list of dof code names.This file opens a 
#                      new database “new.db” and sets the db_get_next
#                      _dof set names to start at the beginning of the
#                      list of dof set code names and ids from the
#                      database. Later it gets these names and ids.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#
#  The function db_get_all_dof_set_names() has no arguments
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_name[32]
STRING   s_msg[64]
INTEGER  i_id
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
i_return_value = db_get_all_dof_set_names()
dump i_return_value
 
WHILE( i_return_value == 0 )
   i_return_value =                                 @
      db_get_next_dof_set_names                     @
         (  s_name,                                 @
            i_id )
   IF( i_return_value == 0 ) THEN
      dump s_name
      dump i_id
   ELSE
      dump i_return_value
      msg_get_string(i_return_value,s_msg)
      dump s_msg
   END IF
END WHILE
#---------------------------------------------------------------------
db_get_all_elem_defn
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_all_elem_defn()
#
#                      This function sets the db_get_next_elem_defn
#                      to the start of the element type and element
#                      id table.This file opens a new database 
#                      “new.db” and sets the db_get_next_elem_defn 
#                      to the start of the element type and element
#                      id table.Later it gets these element types
#                      and ids.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function db_get_all_elem_defn()
#  has the following arguments:
#
#  db_get_all_elem_defn
#     (  acid,
#        atid,
#        eldim )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_acid
INTEGER  i_atid
INTEGER  i_eldim
INTEGER  i_etype_id
STRING   s_msg[64]
STRING   s_ename[32]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  i_acid = 1 (Analysis code MSC.Nastran)
i_acid = 1
#  i_atid = 1 (Analysis type STRUCTURAL)
i_atid = 1
#  i_eldim = 0 (Dimensionality is ZERO dimension)
i_eldim = 0
 
i_return_value =                                 @
   db_get_all_elem_defn                          @
      (  i_acid,                                 @
         i_atid,                                 @
         i_eldim )
dump i_return_value
 
WHILE( i_return_value == 0 )
   i_return_value =                              @
      db_get_next_elem_defn                      @
         (  i_etype_id,                          @
            s_ename )
   IF( i_return_value == 0 ) THEN
      dump s_ename
      dump i_etype_id
   ELSE
      dump i_return_value
      msg_get_string(i_return_value,s_msg)
      dump s_msg
   END IF
END WHILE
#---------------------------------------------------------------------
 
db_get_all_form_opt_code_names
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_all_form_opt_code_names()
#
#                      This function sets the db_get_next_form_opt_
#                      code names to start at the beginning of the
#                      list of formulation option code names and id
#                      from the database.This file opens a new
#                      database “new.db” and sets the db_get_ next
#                      _form_opt_code names to start at the beginning
#                      of the list of formulation option code names
#                      and ids from the database. Later it gets these
#                      names and ids.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function db_all_next_form_opt_code_names() has no arguments
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_name[32]
STRING   s_msg[64]
INTEGER  i_id
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
i_return_value = db_get_all_form_opt_code_names()
dump i_return_value
 
WHILE( i_return_value == 0 )
   i_return_value =                                 @
      db_get_next_form_opt_code_names               @
         (  s_name,                                 @
            i_id )
   IF( i_return_value == 0 ) THEN
      dump s_name
      dump i_id
   ELSE
      dump i_return_value
      msg_get_string(i_return_value,s_msg)
      dump s_msg
   END IF
END WHILE
#---------------------------------------------------------------------
db_get_all_geo_opt_code_names
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_all_next_geo_opt_code_names()
#
#                      This function sets the db_get_next_geo_opt_code
#                      names to start at the beginning of the list
#                      of geometric option code names and id from
#                      the database.This file opens a new database
#                      “new.db” and sets the db_get_next_geo_opt_
#                      code names to start at the beginning of the
#                      list of geometric option code names and ids
#                      from the database. Later it gets these names
#                      and ids.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function db_get_all_geo_opt_code_names()has no arguments
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_name[32]
STRING   s_msg[64]
INTEGER  i_id
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
i_return_value = db_get_all_geo_opt_code_names()
dump i_return_value
 
WHILE( i_return_value == 0 )
   i_return_value =                                 @
      db_get_next_geo_opt_code_names                @
         (  s_name,                                 @
            i_id )
   IF( i_return_value == 0 ) THEN
      dump s_name
      dump i_id
   ELSE
      dump i_return_value
      msg_get_string(i_return_value,s_msg)
      dump s_msg
   END IF
END WHILE
#---------------------------------------------------------------------
db_get_all_lam_opt_code_names
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_all_next_lam_opt_code_names()
#
#                      This function sets the db_get_next_lam_opt_code
#                      names to start at the beginning of the list
#                      of lamination option code names and id from
#                      the database.This file opens a new database
#                      “new.db” and sets the db_get_next_lam_opt_
#                      code names to start at the beginning of the
#                      list of lamination option code names and ids
#                      from the database. Later it gets these names
#                      and ids.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function db_get_all_lam_opt_code_names() has no arguments
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_name[32]
STRING   s_msg[64]
INTEGER  i_id
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
i_return_value = db_get_all_lam_opt_code_names()
dump i_return_value
 
WHILE( i_return_value == 0 )
   i_return_value =                                 @
      db_get_next_lam_opt_code_names                @
         (  s_name,                                 @
            i_id )
   IF( i_return_value == 0 ) THEN
      dump s_name
      dump i_id
   ELSE
      dump i_return_value
      msg_get_string(i_return_value,s_msg)
      dump s_msg
   END IF
END WHILE
#---------------------------------------------------------------------
db_get_all_pp_ids_and_names
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_all_pp_ids_and_names()
#
#                      This function sets the db_get_next_pp_ids_and
#                      _names to the start of the list of the physical
#                      property.This file opens the database
#                      “spool.db” and sets the db_get_next_pp_ids_and
#                      _names to the start of the list of the physical
#                      property words.Later it gets the ids,names and
#                      datatypes of the physical property words in the
#                      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_get_all_pp_ids_and_names() has no arguments
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_pp_id
STRING   s_pp_name[32]
STRING   s_msg[64]
INTEGER  i_datatype
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
i_return_value = db_get_all_pp_ids_and_names()
dump i_return_value
 
WHILE( i_return_value == 0 )
   i_return_value =                                 @
      db_get_next_pp_ids_and_names                  @
         (  i_pp_id,                                @
            s_pp_name,                              @
            i_datatype )
   IF( i_return_value == 0 ) THEN
      dump i_pp_id
      dump s_pp_name
      dump i_datatype
   ELSE
      msg_get_string(i_return_value,s_msg)
      dump s_msg
   END IF
END WHILE
#---------------------------------------------------------------------
db_get_allowable_phys_prop
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_allowable_phys_prop()
#
#                      This function creates an allowable physical
#                      property entry in the database.This file opens
#                      a new database “new.db” and creates a allowable
#                      entry for physical property “DOF at node 1” 
#                      using analysis code MSC.Nastran.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function db_get_allowable_phys_prop()
#  has the following arguments:
#
#  db_get_allowable_phys_prop
#     (  acid,
#        ppid,
#        alias,
#        rflag,
#        atypes,
#        dtype,
#        nord,
#        aival,
#        arval,
#        acval )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_acid
INTEGER  i_ppid
STRING   s_alias[64]
INTEGER  i_rflag
INTEGER  ia_atypes(10)
INTEGER  i_dtype
INTEGER  i_nord
STRING   s_aival[32]
STRING   s_arval[32]
STRING   s_acval[32]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  i_acid = 1  ( Analysis code is MSC.Nastran )
i_acid = 1
#  i_ppid = 7  (Id for property “Dof at Node 1”)
i_ppid = 7
 
i_return_value =                                  @
   db_get_allowable_phys_prop                     @
      (  i_acid,                                  @
         i_ppid,                                  @
         s_alias,                                 @
         i_rflag,                                 @
         ia_atypes,                               @
         i_dtype,                                 @
         i_nord,                                  @
         s_aival,                                 @
         s_arval,                                 @
         s_acval )
dump i_return_value
 
#  The alias to be used is
dump s_alias
#  Flag indicating the requirement of the property is
dump i_rflag
#  Allowable types for this physical property is
dump ia_atypes
#  Default type for this property is
dump i_dtype
#  pcl function used for validating integer values
dump s_aival
#  pcl function used for validating real values
dump s_arval
#  pcl function used for validating character values
dump s_acval
#---------------------------------------------------------------------
db_get_analysis_elements
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_analysis_elements()
#
#                      This function retrieves a set of analysis
#                      element relationship.This file opens a new
#                      database “new.db” and gets the set of analysis
#                      elements relationship for analysis code 
#                      MSC.Nastran and analysis code STRUCTURAL.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function db_get_analysis_elements()
#  has the following arguments:
#
#  db_get_analysis_elements
#     (  acid,
#        atid,
#        etcntmax,
#        etcntfound,
#        etids,
#        etnames )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_acid
INTEGER  i_atid
INTEGER  i_etcnt
INTEGER  ia_etids_c(4)
INTEGER  iv_etids(VIRTUAL)
STRING   sv_etnames[32](VIRTUAL)
INTEGER  i_etcntmax
INTEGER  i_etcntfound
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  i_acid = 1 (Analysis code MSC.Nastran )
i_acid = 1 
#  i_atid = 1 (Analysis type STRUCTURAL )
i_atid = 1 
 
db_count_elem_type                                @
   (  i_acid,                                     @
      i_atid,                                     @
      ia_etids_c )
 
#  Adding the element type of each dimensionality to get 
#  the maximum number of element types.
i_etcntmax = ia_etids_c(1) + ia_etids_c(2) +      @
ia_etids_c(3) + ia_etids_c(4)
 
SYS_ALLOCATE_ARRAY(iv_etids,1,i_etcntmax )
SYS_ALLOCATE_ARRAY(sv_etnames,1,i_etcntmax )
 
#  Get the set of analysis element relationship 
i_return_value =                                  @
   db_get_analysis_elements                       @
      (  i_acid,                                  @
         i_atid,                                  @
         i_etcntmax,                              @
         i_etcntfound,                            @
         iv_etids,                                @
         sv_etnames )
dump i_return_value
 
#  The number of elements found
dump i_etcntfound
#  The element type ids retrived
dump iv_etids
#  The element type names related to corresponding ids
dump sv_etnames
 
SYS_FREE_ARRAY(iv_etids)
SYS_FREE_ARRAY(sv_etnames)
#---------------------------------------------------------------------
db_get_anl_elm_summary
()
#  Purpose          :  This file provides an example of two calls to
#                      the function db_get_anl_elem_summary()
#
#                      This function retrieves an analysis element 
#                      summary relationship.This file opens a new 
#                      database “new.db” and gets the present summary
#                      for analysis code MSC.Nastran and analysis
#                      type STRUCTURAl.Later it deletes this summary
#                      and creates a new summary.Finally it gets this
#                      new summary.
#
#                      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_anl_elem_summary()
#  has the following arguments:
#
#  db_get_anl_elem_summary
#     (  acid,
#        atid,
#        etcnt )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_acid
INTEGER  i_atid
INTEGER  ia_etcnt(4)
INTEGER  ia_etcnt_c(4)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  i_acid = 1 (MSC.Nastran)
i_acid = 1 
#  i_atid = 1 (STRUCTURAL)
i_atid = 1
 
i_return_value =                                  @
   db_get_anl_elm_summary                         @
      (  i_acid,                                  @
         i_atid,                                  @
         ia_etcnt )
dump i_return_value
 
#  The count of element types one for each element dimensionality.
dump ia_etcnt
 
#  Delete the analysis summary
i_return_value =                                  @
   db_delete_anl_elm_summary                      @
      (  i_acid,                                  @
         i_atid )
dump i_return_value
 
#  Create a new elm summary
#  ia_etcnt_c = [ 5,5,5,5 ]
ia_etcnt_c = [ 5,5,5,5 ]
 
i_return_value =                                  @
   db_create_anl_elm_summary                      @
      (  i_acid,                                  @
         i_atid,                                  @
         ia_etcnt_c )
dump i_return_value
 
i_return_value =                                  @
   db_get_anl_elm_summary                         @
      (  i_acid,                                  @
         i_atid,                                  @
         ia_etcnt )
dump i_return_value
 
#  The count of element types one for each element dimensionality.
dump ia_etcnt
#  Note the difference in summary before and after creation.
#---------------------------------------------------------------------
 
db_get_elements_in_region_exp
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_elements_in_region_exp()
#
#                      The function gets the element ids for a
#                      specified region from the database.This 
#                      file opens a new database “new.db” and
#                      creates a property region with id = 9
#                      Later it creates four elements with ids
#                      1,2,3 and 4.Then it associates the elements
#                      with id = 2 and id = 3 to the property
#                      region.Later it gets the elements in 
#                      this region.
#
#                      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_elements_in_region_exp()
#  has the following arguments:
#
#  db_get_elements_in_region_exp
#     (  count,
#        rid,
#        eid )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_count
INTEGER  i_rid
INTEGER  iv_eid(VIRTUAL)
INTEGER  ia_rid(1)
INTEGER  i_count_region
STRING   sv_fem_create_elems_created[VIRTUAL]
INTEGER  i_id = 9
STRING   s_region_name[32] = [“REGION”]
INTEGER  i_elem_type = 1
INTEGER  i_geom_id = 1
INTEGER  i_condense_id = 1
INTEGER  i_form_id = 1
INTEGER  i_lam_id = 1
INTEGER  i_dof_set_id = 1
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Create a physical property region with id = 9
i_return_value =                                  @
   db_create_phys_prop_region                     @
      (  i_id,                                    @
         s_region_name,                           @
         i_elem_type,                             @
         i_geom_id,                               @
         i_condense_id,                           @
         i_form_id,                               @
         i_lam_id,                                @
         i_dof_set_id )
dump i_return_value
 
#  Create four elements.
fem_create_elems(“Bar”,”Bar2”,”1”,”standard”      @
   ,TRUE,”[0 0 0]”,”[1 0 0]”,””,””,””,””,””,””,   @
   sv_fem_create_elems_created)
fem_create_elems(“Bar”,”Bar2”,”2”,”standard”      @
   ,TRUE,”[1 0 0]”,”[1 1 0]”,””,””,””,””,””,””,   @
   sv_fem_create_elems_created)
fem_create_elems(“Bar”,”Bar2”,”3”,”standard”      @
   ,TRUE,”[1 1 0]”,”[0 1 0]”,””,””,””,””,””,””,   @
   sv_fem_create_elems_created)
fem_create_elems(“Bar”,”Bar2”,”4”,”standard”      @
   ,TRUE,”[0 1 0]”,”[0 0 0]”,””,””,””,””,””,””,   @
   sv_fem_create_elems_created)
 
#  Get the region ids
i_return_value = db_count_region_ids(i_count_region) 
dump i_return_value
i_return_value = db_get_all_region_ids(i_count_region,ia_rid)
dump i_return_value
i_rid = ia_rid(1)
 
#  Associate the elements with id = 2 and 3 to the property region.
i_return_value = db_associate_element_to_region(2,i_rid)
dump i_return_value
i_return_value = db_associate_element_to_region(3,i_rid)
dump i_return_value
 
#  Count the number of elements associated with the physical 
#  property region.
i_return_value =                                  @
   db_count_elements_in_region_exp                @
      (  i_rid,                                   @
         i_count )
dump i_return_value
 
SYS_ALLOCATE_ARRAY(iv_eid,1,i_count)
 
#  Get all elements for the physical property region
i_return_value =                                  @
   db_get_elements_in_region_exp                  @
      (  i_count,                                 @
         i_rid,                                   @
         iv_eid )
dump i_return_value
 
#  The ids of the elements associated with the region.
dump iv_eid
 
SYS_FREE_ARRAY(iv_eid)
SYS_FREE_STRING(sv_fem_create_elems_created)
#---------------------------------------------------------------------
db_get_etop_for_a_code
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_etop_for_a_code()
#
#                      This function retrieves a set of element 
#                      topology ids  based on the analysis code and
#                      type.This file opens a new database “new.db”
#                      and gets the element topology ids for the
#                      analysis code MSC.Nastran and analysis type
#                      STRUCTURAL.
#
#                      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_etop_for_a_code()
#  has the following arguments:
#
#  db_get_etop_for_a_code
#     (  acid,
#        atid,
#        count,
#        etids )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_acid
INTEGER  i_atid
INTEGER  i_count
INTEGER  iv_etids(VIRTUAL)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  i_acid = 1  ( Analysis code is MSC.Nastran )
i_acid = 1
#  i_atid = 1  ( Analysis type is STRUCTURAL )
i_atid = 1
 
db_count_etop_for_a_code                          @
   (  i_acid,                                     @
      i_atid,                                     @
      i_count )
 
SYS_ALLOCATE_ARRAY(iv_etids,1,i_count)
 
i_return_value =                                  @
   db_get_etop_for_a_code                         @
      (  i_acid,                                  @
         i_atid,                                  @
         i_count,                                 @
         iv_etids )
dump i_return_value
 
#  The element topology ids for analysis code MSC.Nastran
#  and analysis type STRUCTURAL are
dump iv_etids
SYS_FREE_ARRAY(iv_etids)
#---------------------------------------------------------------------
db_get_geo_in_region
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_geo_in_region()
#
#                      This function gets all the geometric entities 
#                      associated with a physical property region in 
#                      the database.This file opens the database 
#                      “spool.db” and gets the number of regions and
#                      the region ids.Later it gets the count of 
#                      entities associated with this region id and 
#                      gets these geometric entities.The spool 
#                      database has one region and has six surfaces 
#                      associated with this 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_geo_in_region() has the following arguments:
#
#  db_get_geo_in_region
#     (  count,
#        rid,
#        gid,
#        gtype,
#        gsid )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_count
INTEGER  i_rid
INTEGER  iv_gid(VIRTUAL)
INTEGER  iv_gtype(VIRTUAL)
INTEGER  iv_gsid(VIRTUAL)
INTEGER  ia_rid(1)
INTEGER  i_count_region
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Get the region ids
i_return_value = db_count_region_ids(i_count_region) 
dump i_return_value
i_return_value = db_get_all_region_ids(i_count_region,ia_rid)
dump i_return_value
i_rid = ia_rid(1)
 
#  Count the number of entities associated with the physical 
#  property region.
i_return_value =                                  @
   db_count_geo_in_region                         @
      (  i_rid,                                   @
         i_count )
dump i_return_value
 
SYS_ALLOCATE_ARRAY(iv_gid,1,i_count)
SYS_ALLOCATE_ARRAY(iv_gtype,1,i_count)
SYS_ALLOCATE_ARRAY(iv_gsid,1,i_count)
 
#  Get all geometric entities for the physical property region
i_return_value =                                  @
   db_get_geo_in_region                           @
      (  i_count,                                 @
         i_rid,                                   @
         iv_gid,                                  @
         iv_gtype,                                @
         iv_gsid )
dump i_return_value
 
#  The ids of the geometric entities associated with the region.
dump iv_gid
#  The type of the geometric entities associated with the region.
dump iv_gtype
#  The sub-ids of the geometric entities associated with the region.
dump iv_gsid
 
SYS_FREE_ARRAY(iv_gid)
SYS_FREE_ARRAY(iv_gtype)
SYS_FREE_ARRAY(iv_gsid)
#---------------------------------------------------------------------
db_get_next_dof_set_names
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_next_dof_set_names()
#
#                      This function gets the next dof set code names
#                      and id from the database.This file opens a new
#                      database “new.db” and sets the db_get_next_dof
#                      set names to start at the beginning of the list
#                      of dof set code names and ids from the
#                      database. Later it gets these names and ids.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function db_get_next_dof_set_names()
#  has the following arguments:
#
#  db_get_next_dof_set_names
#     (  name,
#        id )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_name[32]
STRING   s_msg[64]
INTEGER  i_id
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
i_return_value = db_get_all_dof_set_names()
dump i_return_value
 
WHILE( i_return_value == 0 )
   i_return_value =                                 @
      db_get_next_dof_set_names                     @
         (  s_name,                                 @
            i_id )
   IF( i_return_value == 0 ) THEN
      dump s_name
      dump i_id
   ELSE
      dump i_return_value
      msg_get_string(i_return_value,s_msg)
      dump s_msg
   END IF
END WHILE
#---------------------------------------------------------------------
 
db_get_next_elem_defn
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_next_elem_defn()
#
#                      This function gets all the definitions for all
#                      requested elements.This file opens a new 
#                      database “new.db” and sets the db_get_next_
#                      elem_defn to the start of the element type
#                      and element id table.Later it gets these 
#                      element types and ids.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function db_get_next_elem_defn() has the following arguments:
#
#  db_get_next_elem_defn
#     (  i_etype_id,
#        s_ename )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_acid
INTEGER  i_atid
INTEGER  i_eldim
INTEGER  i_etype_id
STRING   s_ename[32]
STRING   s_msg[64]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  i_acid = 1 (Analysis code MSC.Nastran)
i_acid = 1
#  i_atid = 1 (Analysis type STRUCTURAL)
i_atid = 1
#  i_eldim = 0 (Dimensionality is ZERO dimension)
i_eldim = 0
 
i_return_value =                                 @
   db_get_all_elem_defn                          @
      (  i_acid,                                 @
         i_atid,                                 @
         i_eldim )
dump i_return_value
 
WHILE( i_return_value == 0 )
   i_return_value =                              @
      db_get_next_elem_defn                      @
         (  i_etype_id,                          @
            s_ename )
   IF( i_return_value == 0 ) THEN
      dump s_ename
      dump i_etype_id
   ELSE
      dump i_return_value
      msg_get_string(i_return_value,s_msg)
      dump s_msg
   END IF
END WHILE
#---------------------------------------------------------------------
 
db_get_next_form_opt_code_names
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_next_form_opt_code_names()
#
#                      This function gets the next formulation option
#                      code names and id from the database.This file
#                      opens a new database “new.db” and sets the db_
#                      get_next_form_opt_code names to start at the
#                      beginning of the list of formulation option 
#                      code names and ids from the database. Later it
#                      gets these names and ids.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function db_get_next_form_opt_code_names()
#  has the following arguments:
#
#  db_get_next_form_opt_code_names
#     (  name,
#        id )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_name[32]
STRING   s_msg[64]
INTEGER  i_id
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
i_return_value = db_get_all_form_opt_code_names()
dump i_return_value
 
WHILE( i_return_value == 0 )
   i_return_value =                                 @
      db_get_next_form_opt_code_names               @
         (  s_name,                                 @
            i_id )
   IF( i_return_value == 0 ) THEN
      dump s_name
      dump i_id
   ELSE
      dump i_return_value
      msg_get_string(i_return_value,s_msg)
      dump s_msg
   END IF
END WHILE
#---------------------------------------------------------------------
db_get_next_geo_opt_code_names
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_next_geo_opt_code_names()
#
#                      This function gets the next geometric option 
#                      code names and id from the database.This file
#                      opens a new database “new.db” and sets the db_
#                      get_next_geo_opt_code names to start at the
#                      beginning of the list of geometric option code
#                      names and ids from the database. Later it gets
#                      these names and ids.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function db_get_next_geo_opt_code_names()
#  has the following arguments:
#
#  db_get_next_geo_opt_code_names
#     (  name,
#        id )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_name[32]
STRING   s_msg[64]
INTEGER  i_id
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
i_return_value = db_get_all_geo_opt_code_names()
dump i_return_value
 
WHILE( i_return_value == 0 )
   i_return_value =                                 @
      db_get_next_geo_opt_code_names                @
         (  s_name,                                 @
            i_id )
   IF( i_return_value == 0 ) THEN
      dump s_name
      dump i_id
   ELSE
      dump i_return_value
      msg_get_string(i_return_value,s_msg)
      dump s_msg
   END IF
END WHILE
#---------------------------------------------------------------------
db_get_next_lam_opt_code_names
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_next_lam_opt_code_names()
#
#                      This function gets the next lamination option
#                      code names and id from the database.This file
#                      opens a new database “new.db” and sets the db_
#                      get_next_lam_opt_code names to start at the
#                      beginning of the list of lamination option 
#                      code names and ids from the database. Later it
#                      gets these names and ids.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function db_get_next_lam_opt_code_names()
#  has the following arguments:
#
#  db_get_next_lam_opt_code_names
#     (  name,
#        id )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_name[32]
STRING   s_msg[64]
INTEGER  i_id
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
i_return_value = db_get_all_lam_opt_code_names()
dump i_return_value
 
WHILE( i_return_value == 0 )
   i_return_value =                                 @
      db_get_next_lam_opt_code_names                @
         (  s_name,                                 @
            i_id )
   IF( i_return_value == 0 ) THEN
      dump s_name
      dump i_id
   ELSE
      dump i_return_value
      msg_get_string(i_return_value,s_msg)
      dump s_msg
   END IF
END WHILE
#---------------------------------------------------------------------
db_get_next_pp_ids_and_names
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_next_pp_ids_and_names()
#
#                      This function gets the id,name and the datatype
#                      of the physical property used in the database.
#                      This file opens the database “spool.db” and
#                      sets the db_get_next_pp_ids_and_names to the 
#                      start of the list of the physical property
#                      words.Later it gets the ids,names and datatypes
#                      of the physical property words in the 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_get_next_pp_ids_and_names()
#  has the following arguments:
#
#  db_get_next_pp_ids_and_names
#     (  pp_id,
#        pp_name,
#        datatype )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_pp_id
STRING   s_pp_name[32]
STRING   s_msg[64]
INTEGER  i_datatype
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
i_return_value = db_get_all_pp_ids_and_names()
dump i_return_value
 
WHILE( i_return_value == 0 )
   i_return_value =                                 @
      db_get_next_pp_ids_and_names                  @
         (  i_pp_id,                                @
            s_pp_name,                              @
            i_datatype )
   IF( i_return_value == 0 ) THEN
      dump i_pp_id
      dump s_pp_name
      dump i_datatype
   ELSE
      dump i_return_value
      msg_get_string(i_return_value,s_msg)
      dump s_msg
   END IF
END WHILE
#---------------------------------------------------------------------
db_get_phys_prop_set_defn
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_phys_prop_set_defn()
#
#                      This function gets the physical property 
#                      definition from the  database.This file opens 
#                      a new database “new.db” and creates a physical
#                      property set with id= 8 and set name “GSSL”.
#                      It includes the three physical properties with
#                      property ids 1,6,7.Later it gets this physical
#                      property definition using the above 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_phys_prop_set_defn()
#  has the following arguments:
#
#  db_get_phys_prop_set_defn
#     (  id,
#        name,
#        num,
#        ppids )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_id
STRING   s_name[32],s_name_c[32]
INTEGER  i_num,i_num_c
INTEGER  ia_ppids(3),ia_ppids_c(3)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
i_id = 8
s_name_c = “GSSL”
i_num_c = 3
ia_ppids_c = [1,6,7]
 
db_create_phys_prop_set_defn                      @
   (  i_id,                                       @
      s_name_c,                                   @
      i_num_c,                                    @
      ia_ppids_c )
 
#  Get the physical property set definition 
i_return_value =                                  @
   db_get_phys_prop_set_defn                      @
      (  i_id,                                    @
         s_name,                                  @
         i_num,                                   @
         ia_ppids )
 
dump i_return_value
 
#  The name of the physical property set
dump s_name
#  The number of physical property values associated with this set
dump i_num
#  The Ids of physical property values associated with this set
dump ia_ppids
#---------------------------------------------------------------------
db_get_region_for_geometry
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_region_for_geometry()
#
#                      This function gets the region id given the 
#                      entity type and entity id.This file opens the
#                      database “spool.db” and gets the region id for
#                      surface entity with label = 1.
#
#                      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_region_for_geometry()
#  has the following arguments:
#
#  db_get_region_for_geometry
#     (  entity_type,
#        entity_id,
#        rid )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_entity_type
INTEGER  i_entity_id
INTEGER  i_label
INTEGER  i_rid
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  i_entity_type = 3 (surface)
i_entity_type = 3 
 
#  Get the id of surface with label = 1
#  i_label = 1
i_label = 1
db_get_surface_id                                 @
   ( i_label,                                     @
     i_entity_id )
 
i_return_value =                                  @
   db_get_region_for_geometry                     @
      (  i_entity_type,                           @
         i_entity_id,                             @
         i_rid )
dump i_return_value
 
#  The Region id for the entity type surface with label = 1 is
dump i_rid
#---------------------------------------------------------------------
db_get_region_ids_and_names
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_region_ids_and_names()
#
#                      This function gets all region ids and names 
#                      from the database.This file opens the database
#                      “spool.db” and counts the number of regions.
#                      Later it gets the region ids and region names.
#
#                      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_region_ids_and_names()
#  has the following arguments:
#
#  db_get_region_ids_and_names
#     (  count,
#        rid,
#        name )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_count
INTEGER  iv_rid(VIRTUAL)
STRING   sv_name[64](VIRTUAL)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Get the number of region ids in the database.
db_count_region_ids(i_count)
 
SYS_ALLOCATE_ARRAY(iv_rid,1,i_count)
SYS_ALLOCATE_ARRAY(sv_name,1,i_count)
 
i_return_value =                                  @
   db_get_region_ids_and_names                    @
      (  i_count,                                 @
         iv_rid,                                  @
         sv_name )
dump i_return_value
 
#  The region ids are
dump iv_rid
#  The region names are
dump sv_name
 
SYS_FREE_ARRAY(iv_rid)
SYS_FREE_ARRAY(sv_name)
#---------------------------------------------------------------------
db_get_selected_prop_set
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_selected_prop_set()
#
#                      This function gets a field in the database.This
#                      file opens a new database “new.db” and 
#                      associates property set id =4023 to the element
#                      with all it attributes = 1.Later it gets the
#                      property set id using the above 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_selected_prop_set()
#  has the following arguments:
#
#  db_get_selected_prop_set
#     (  atid,
#        acid,
#        geopcd,
#        copcd,
#        fopcd,
#        lopcd,
#        etopid,
#        dofsetid,
#        physprop )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_atid
INTEGER  i_acid
INTEGER  i_geopcd
INTEGER  i_copcd
INTEGER  i_fopcd
INTEGER  i_lopcd
INTEGER  i_etopid
INTEGER  i_dofsetid
INTEGER  i_physprop,i_physprop_c
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Define the element attributes.
i_atid = 1
i_acid = 1
i_geopcd = 1
i_copcd = 1
i_fopcd = 1
i_lopcd = 1
i_etopid = 1
i_dofsetid = 1
 
#  Define the set id.
#  i_physprop_c = 4023 (stan. Equi. Sec. [CQUAD4/PCOMP])
i_physprop_c = 4023
 
#  Associate property set to an element set defined by above 
#  element attributes.
db_create_selected_prop_set                       @
   (  i_atid,                                     @
      i_acid,                                     @
      i_geopcd,                                   @
      i_copcd,                                    @
      i_fopcd,                                    @
      i_lopcd,                                    @
      i_etopid,                                   @
      i_dofsetid,                                 @
      i_physprop_c )
 
#  Get the id of the property set.
i_return_value =                                  @
   db_get_selected_prop_set                       @
      (  i_atid,                                  @
         i_acid,                                  @
         i_geopcd,                                @
         i_copcd,                                 @
         i_fopcd,                                 @
         i_lopcd,                                 @
         i_etopid,                                @
         i_dofsetid,                              @
         i_physprop )
dump i_return_value
 
#  The Id of the associated physical property set is
dump i_physprop
#---------------------------------------------------------------------
db_set_comp_lam
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_set_comp_lam()
#
#                      This session file will open a new database
#                      by name ‘new.db’ with default options and will
#                      add two definitions of 2d orthotropic material
#                      and one definition of composite laminate.
#                      For material property ids refer User’s Manual
#                      Part 9, Section 7.5 to 7.7
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_set_comp_lam() has the following arguments:
#
#  db_set_comp_lam
#     (  mat_name,
#        num_plies,
#        ply_names,
#        thicknesses,
#        orientations,
#        iconven,
#        offset,
#        offset_def )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_mat_name[32]
INTEGER  i_num_plies
STRING   sv_ply_names[VIRTUAL]
REAL     ra_thicknesses(5)
REAL     ra_orientations(5)
INTEGER  i_iconven
REAL     r_offset
LOGICAL  l_offset_def
INTEGER  i_return_value
INTEGER  iv_ply_names(VIRTUAL)
REAL     rv_thicks(VIRTUAL)
REAL     rv_orients(VIRTUAL)
INTEGER  i_num_def
INTEGER  i_iconv
STRING   s_offset_string[32]
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
#  Creating 2d orthotropic materials for laminate plies. The material
#  names are “2dort1” and “2dort2”.
 
i_return_value =                                                     @
   material.create( “Analysis code ID”, 1, “Analysis type ID”, 1,    @
   “2dort1”, 0, “Date: 08-Aug-97           Time: 12:11:28”,          @
   “2d Orthotropic”, 5, “Directionality”, 4, “Linearity”, 1,         @
   “Homogeneous”, 0, “Linear Elastic”, 1, “Model Options & IDs”,     @
   [““, ““, ““, ““, ““], [0, 0, 0, 0, 0], “Active Flag”, 1, “Create”,@
   10, “External Flag”, FALSE, “Property IDs”, [“Elastic Modulus”,   @
   “Elastic Modulus 22”, “Poisson Ratio”, “Shear Modulus”,           @
   “Shear Modulus 23”, “Shear Modulus 31”], [2, 3, 5, 8, 9, 10, 0],  @
   “Property Values”, [“2e6”, “2e6”, “.33”, “2e7”, “3e7”, “4e6”, ““])
dump i_return_value
 
i_return_value =                                                     @
   material.create( “Analysis code ID”, 1, “Analysis type ID”, 1,    @
   “2dort2”, 0, “Date: 08-Aug-97           Time: 12:11:28”,          @
   “2d Orthotropic”, 5, “Directionality”, 4, “Linearity”, 1,         @
   “Homogeneous”, 0, “Linear Elastic”, 1, “Model Options & IDs”,     @
   [““, ““, ““, ““, ““], [0, 0, 0, 0, 0], “Active Flag”, 1, “Create”,@
   10, “External Flag”, FALSE, “Property IDs”, [“Elastic Modulus”,   @
   “Elastic Modulus 22”, “Poisson Ratio”, “Shear Modulus”,           @
   “Shear Modulus 23”, “Shear Modulus 31”], [2, 3, 5, 8, 9, 10, 0],  @
   “Property Values”,[“2e6”,”2e5”,”.4”,”2e8”,”2.7e7”,”3.7e6”,””] )
dump i_return_value
 
#  Creating laminate composite lam1, with ‘Total’ as stacking sequence.
i_return_value =                                                     @
   mat_create_lam( “lam1”, ““, 1, [“2dort1”, “2dort2”, “2dort1”,     @
   “2dort2”, “2dort1”], [0.1, 0.12, 0.1, 0.12, 0.1],                 @
   [0., 30., 60., 90., 120.], 5, “10”, “Create” )
dump i_return_value
 
#---------------------------------------------------------------------
#  Loading the laminate definition data for ‘lam1’
s_mat_name     = “lam1”
#  Number of plies are 5
i_num_plies    = 5
#
i_return_value =                                 @
   mat_lam_load_defn_show                        @
      (  s_mat_name,                             @
         i_num_plies,                            @
         iv_ply_names,                           @
         rv_thicks,                              @
         rv_orients,                             @
         i_num_def,                              @
         i_iconv,                                @
         s_offset_string )
dump i_return_value
#  The laminate definition data is
dump iv_ply_names,rv_thicks,rv_orients,i_num_def,i_iconv
dump s_offset_string
#---------------------------------------------------------------------
#  Resetting the laminate properties of the laminate material.
s_mat_name = “lam1”
i_num_plies = 5
sys_allocate_string(sv_ply_names,32*i_num_plies)
#
# Each ply name must be in a field of 32 characters, with
# spaces being used to pad the empty space in the field
#                 0        1         2         3    3
#                 12345678901234567890123456789012345
sv_ply_names   = “2dort1                          “      // @
                 “2dort2                          “      // @
                 “2dort1                          “      // @
                 “2dort2                          “      // @
                 “2dort1                          “
 
ra_thicknesses = [0.2, 0.22, 0.2, 0.22, 0.2]
ra_orientations = [0., 30., 60., 90., 120.]
i_iconven = 1
r_offset = 20.0
l_offset_def = true
#
i_return_value =                                 @
   db_set_comp_lam                               @
      (  s_mat_name,                             @
         i_num_plies,                            @
         sv_ply_names,                           @
         ra_thicknesses,                         @
         ra_orientations,                        @
         i_iconven,                              @
         r_offset,                               @
         l_offset_def )
dump i_return_value
#---------------------------------------------------------------------
#  Loading the laminate definition data for ‘lam1’
s_mat_name     = “lam1”
#  Number of plies are 5
i_num_plies    = 5
#
i_return_value =                                 @
   mat_lam_load_defn_show                        @
      (  s_mat_name,                             @
         i_num_plies,                            @
         iv_ply_names,                           @
         rv_thicks,                              @
         rv_orients,                             @
         i_num_def,                              @
         i_iconv,                                @
         s_offset_string )
dump i_return_value
#  The laminate definition data is
dump iv_ply_names,rv_thicks,rv_orients,i_num_def,i_iconv
dump s_offset_string
#---------------------------------------------------------------------