Tutorial Toolkit Code Examples > Group > 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.
 
asm_db_count_asm_in_group
()
#  Purpose          :  This file gives an example of a call to the
#                      function asm_db_count_asm_in_group()
#
#                      This function is used to get the number of
#                      MSC(MacNeal-Schwendler Corporation) entities
#                      that belong to a particular group.The function
#                      has no return type.
#
#                      This file opens a database spool.db which has
#                      two groups “default_group” and “fem_model”group
#                      This file counts for the number of grids,lines
#                      patch,hpat,co-ordinate frames,nodes and
#                      elements in default and fem_model group and
#                      gives the count of them.This database has seven
#                      grids,three lines,no patch, no hpat, one
#                      co-ordinate frame,600 nodes and 576 elements
#
#                      Before running this file the database should be
#                      created by running the session file “spool.ses”
#                      To run this session file,first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The asm_db_count_asm_in_group has the following arguments:
#  asm_db_count_asm_in_group
#     ( groupId,
#       count,
#       status )
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
INTEGER  i_groupId,i_status,i_count(7)
#  -------------------------------------------------------------------
#
# opening a existing database spool.db
uil_file_open.go(“spool.db”)
 
# i_groupId = 1 (default  group)
i_groupId = 1
 
 
# check the database for MSC entities in default group.
 
asm_db_count_asm_in_group                                     @
   ( i_groupId,                                               @
     i_count,                                                 @
     i_status )
# Checking the success of the call
dump i_status
 
# The number of MSC entities(grid,line,patch,hpat,coordinate frames,
# nodes,elements)  in default  group  are
dump i_count
 
# i_groupId = 2 (fem_model group)
i_groupId = 2
 
# check the database for MSC entities in fem_model group.
 
asm_db_count_asm_in_group                                     @
   ( i_groupId,                                               @
     i_count,                                                 @
     i_status )
 
# Checking the success of the call
dump i_status
 
# The number of MSC entities(grid,line,patch,hpat,coordinate frames,
# nodes,elements)  in fem_model group  are
dump i_count
 
#  -------------------------------------------------------------------
 
asm_db_get_grids_in_group
()
#  Purpose          :  This file gives an example of a call to the
#                      function asm_db_get_grids_in_group()
#
#                      This function is used to get the label and xyz
#                      coordinates for the MSC(MacNeal-Schwendler
#                      Corporation) grid entity that belongs to a
#                      particular group.The function has no
#                      return type.
#
#                      This file opens a database spool.db which has
#                      two groups “default_group” and “fem_model”group
#                      This file gets the labels and xyz coordinates
#                      of grids in the default group.The default group
#                      has seven grids.
#
#                      Before running this file the database should be
#                      created by running the session file “spool.ses”
#                      To run this session file,first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The asm_db_get_grids_in_group has the following arguments:
#  asm_db_get_grids_in_group
#     ( groupId,
#       gridLabels,
#       xyzCoordinates,
#       status )
#  -------------------------------------------------------------------
#  Variable Declaration
#
INTEGER  i_groupId,i_status,i_count(7),i_count_c
INTEGER  i_gridLabels( VIRTUAL )
REAL     r_xyzCoordinates( VIRTUAL )
#  -------------------------------------------------------------------
#
# opening the existing database spool.db
uil_file_open.go(“spool.db”)
 
# i_groupId = 1 (default  group)
i_groupId = 1
 
# check the database for MSC grid entity in default group.
asm_db_count_asm_in_group                                     @
   ( i_groupId,                                               @
     i_count,                                                 @
     i_status )
 
i_count_c = i_count(1)
 
#Allocate memory
SYS_ALLOCATE_ARRAY(i_gridLabels,1,i_count_c)
SYS_ALLOCATE_ARRAY(r_xyzCoordinates,1,3*i_count_c)
 
#  Get the labels and xyz coordinates for the grids.
asm_db_get_grids_in_group                                     @
   ( i_groupId,                                               @
     i_gridLabels,                                            @
     r_xyzCoordinates,                                        @
     i_status )
#
dump i_status
 
# Get the grid labels for the grids of the default group.
dump i_gridLabels
 
# Get the xyz coordinates  for the grids of the default group.
dump r_xyzCoordinates
 
SYS_FREE_ARRAY( i_gridLabels )
SYS_FREE_ARRAY( r_xyzCoordinates )
 
#  -------------------------------------------------------------------
 
asm_db_get_hpats_in_group
()
#  Purpose          :  This file gives an example of a call to the
#                      function asm_db_get_hpats_in_group()
#
#                      This function is used to get the label and xyz
#                      coordinates for the MSC(MacNeal-Schwendler
#                      Corporation) hpat entity that belongs to a
#                      particular group.The function also gets the
#                      vertex ids.The function has no return type.
#
#                      This file opens a  new database “new.db”
#                      It creates a solid  which results in
#                      creation of a hpat entity.Then this file gets
#                      the labels, vertex ids and xyz coordinates of
#                      hpats in the default group of the database
#                      new.db.
#
#                      To run this session file,first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The asm_db_get_hpats_in_group has the following arguments:
#  asm_db_get_hpats_in_group
#     ( groupid,
#       hpatlabels,
#       hpatvertexIds,
#       geometriccoeff,
#       status )
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
INTEGER  i_groupid,i_status
INTEGER  i_hpatlabels( 1 )
INTEGER  i_hpatvertexIds( 8 )
REAL     r_geometriccoeff(192)
STRING   s_asm_create_hpat[ VIRTUAL ]
#  -------------------------------------------------------------------
#
# opening a new database new.db
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
# Create a hpat entity in  the database
asm_const_hpat_xyz(“1”,”<1 1 1>”,”[0 0 0]”,”Coord 0”,        @
s_asm_create_hpat )
 
# i_groupid = 1 (default  group)
i_groupid = 1
 
 
# Get the labels ,vertex ids and xyz coordinates of the line entity.
asm_db_get_hpats_in_group                                     @
   ( i_groupid,                                               @
     i_hpatlabels,                                            @
     i_hpatvertexIds,                                         @
     r_geometriccoeff,                                        @
     i_status )
#
# Get the success or error code.
dump i_status
 
# Get the hpat labels for the hpats of the default group.
dump i_hpatlabels
 
# Get the hpat labels for the hpats of the default group.
dump i_hpatvertexIds
 
# Get the xyz coordinates  for the hpats of the default group.
dump r_geometriccoeff
 
SYS_FREE_STRING(s_asm_create_hpat )
 
#  -------------------------------------------------------------------
 
asm_db_get_lines_in_group
()
#  Purpose          :  This file gives an example of a call to the
#                      function asm_db_get_lines_in_group()
#
#                      This function is used to get the label and xyz
#                      coordinates for the MSC(MacNeal-Schwendler
#                      Corporation) line entity that belongs to a
#                      particular group.The function has no
#                      return type.
#
#                      This file opens a database spool.db which has
#                      two groups “default_group” and “fem_model”group
#                      This file gets the labels and xyz coordinates
#                      of lines in the default group.The default group
#                      has three lines.
#
#                      Before running this file the database should be
#                      created by running the session file “spool.ses”
#                      To run this session file,first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The asm_db_get_lines_in_group has the following arguments:
#  asm_db_get_lines_in_group
#     ( groupid,
#       linelabels,
#       geometriccoefficients,
#       status )
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
INTEGER  i_groupid,i_status,i_count(7),i_count_c
INTEGER  i_linelabels( VIRTUAL )
REAL     r_geometriccoefficients( VIRTUAL )
#  -------------------------------------------------------------------
#
# opening a existing database spool.db
uil_file_open.go(“spool.db”)
 
# i_groupid = 1 (default  group)
i_groupid = 1
 
# check the database for MSC line entity in default group.
asm_db_count_asm_in_group                                     @
   ( i_groupid,                                               @
     i_count,                                                 @
     i_status )
 
#i_count_c = i_count(2)
i_count_c = i_count(2)
 
#Allocate memory
SYS_ALLOCATE_ARRAY(i_linelabels,1,i_count_c)
 
# Each curve requires twelve spaces for the geometric coefficients.
SYS_ALLOCATE_ARRAY(r_geometriccoefficients,1,12*i_count_c)
 
# Get the labels and xyz coordinates of the line entity.
 
asm_db_get_lines_in_group                                     @
   ( i_groupid,                                               @
     i_linelabels,                                            @
     r_geometriccoefficients,                                 @
     i_status )
#
dump i_status
 
# Get the line labels for the lines of the default group.
dump i_linelabels
 
# Get the xyz coordinates  for the lines of the default group.
dump r_geometriccoefficients
 
SYS_FREE_ARRAY( i_linelabels )
SYS_FREE_ARRAY( r_geometriccoefficients )
 
#  -------------------------------------------------------------------
 
asm_db_get_patches_in_group
()
#  Purpose          :  This file gives an example of a call to the
#                      function asm_db_get_patches_in_group()
#
#                      This function is used to get the label and xyz
#                      coordinates for the MSC(MacNeal-Schwendler
#                      Corporation) patch entity that belongs to a
#                      particular group.The function has no return
#                      type.
#
#                      This file opens a  new database “new.db”
#                      It creates a surface which results in
#                      creation of a patch entity.Then this file gets
#                      the labels and xyz coordinates of patch in the
#                      default group of the database new.db.
#
#                      To run this session file,first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The asm_db_get_patches_in_group has the following arguments:
#  asm_db_get_patches_in_group
#     ( groupid,
#       patchlabels,
#       geometriccoefficients,
#       status )
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
INTEGER  i_groupid,i_status
INTEGER  i_patchlabels( 1 )
REAL     r_geometriccoefficients( 48 )
STRING   s_asm_create_patch[ VIRTUAL ]
#  -------------------------------------------------------------------
# opening a new database new.db
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
# Create a patch entity in  the database
asm_const_patch_xyz(“1”,”<1 1 0>”,”[0 0 0]”,”Coord 0”,        @
s_asm_create_patch )
 
# i_groupid = 1 (default  group)
i_groupid = 1
 
# Get the labels and xyz coordinates of the patch entity.
asm_db_get_patches_in_group                                   @
   ( i_groupid,                                               @
     i_patchlabels,                                           @
     r_geometriccoefficients,                                 @
     i_status )
#
# Check the success of the call
dump i_status
 
# Get the patch labels for the patches of the default group.
dump i_patchlabels
 
# Get the xyz coordinates  for the patches of the default group.
dump r_geometriccoefficients
 
SYS_FREE_STRING(s_asm_create_patch)
#  -------------------------------------------------------------------
 
count_orphan_elements
()
#  Purpose          :  This file gives an example of a call to the
#                      function count_orphan_elements()
#
#                      This function is used to get the number of
#                      elements entities that do not belong to any
#                      of the groups.This file opens a database
#                      spool.db.This database has two groups “default”
#                      group and “fem_model” group. The fem_model
#                      group has 600 node entities and 576 element
#                      entities.Elements 1 to 250 is removed from
#                      the fem_model group and the orphan elements
#                      are found.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      To run this session file,first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The count_orphan_elements has the following arguments:
#  count_orphan_elements
#     ( count )
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
INTEGER  i_count,i_grp_id
STRING   s_name[32]
INTEGER  i_return_value
#  -------------------------------------------------------------------
#
# opening a existing database spool.db
uil_file_open.go(“spool.db”)
 
i_grp_id = 2
 
# Count the number of elements already in the group.
# There should be 576 elements in the group.
db_count_elems_in_group(i_grp_id, i_count)
dump i_count
 
# Now remove the elements 1 to 250  from group two ( fem_model)
db_get_group_name( i_grp_id,s_name )
ga_group_entity_remove( s_name,”Element 1:250” )
 
# Count the number of elements again.
# There should be 326 elements in the group.
db_count_elems_in_group(i_grp_id, i_count)
dump i_count
 
# check the database for orphan elements
 
i_return_value =                                               @
   count_orphan_elements                                       @
      ( i_count )
#
dump i_return_value
# The number of orphan elements are
dump i_count
ga_group_entity_add( s_name,”Element 1:250” )
 
 
# Count the number of elements again.
# There should be 576 elements in the group.
db_count_elems_in_group(i_grp_id, i_count)
dump i_count
 
# Now remove the elements 1 to 576  from group two ( fem_model)
db_get_group_name( i_grp_id,s_name )
ga_group_entity_remove( s_name,”Element 1:576” )
 
# Count the number of elements again.
# There should be 0 elements in the group.
db_count_elems_in_group(i_grp_id, i_count)
dump i_count
 
# check the database for orphan elements
 
i_return_value =                                               @
   count_orphan_elements                                       @
      ( i_count )
#
dump i_return_value
# The number of orphan elements are
dump i_count
 
 
ga_group_entity_add( s_name,”Element 1:576” )
 
# Count the number of elements again.
# There should be 576 elements in the group.
db_count_elems_in_group(i_grp_id, i_count)
dump i_count
#  -------------------------------------------------------------------
 
count_orphan_nodes
()
#  Purpose          :  This file gives an example of a call to the
#                      function count_orphan_nodes()
#
#                      This function is used to get the number of
#                      node entities that do not belong to any of
#                      the groups.This file opens the database
#                      “spool.db”. This database has two groups
#                      “default”group and “fem_model”group.The
#                      fem_model group has 600 node entities and 576
#                      element entities.Node entities 1 to 300 is
#                      removed from the fem_model group and the
#                      orphan nodes are found
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      To run this session file,first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The count_orphan_nodes has the following arguments:
#  count_orphan_nodes
#     ( count )
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
INTEGER  i_count,i_grp_id
STRING   s_name[32]
INTEGER  i_return_value
#  -------------------------------------------------------------------
#
# opening a existing database spool.db
uil_file_open.go(“spool.db”)
 
i_grp_id = 2
 
# Count the number of nodes in the group.
# There should be 600 nodes in the group.
db_count_nodes_in_group(i_grp_id, i_count)
dump i_count
 
# Now remove the nodes 1 to 300  from  group two ( fem_model)
db_get_group_name( i_grp_id,s_name )
ga_group_entity_remove( s_name,”Node 1:300” )
 
# Count the number of nodes in the group.
# There should be 300 nodes in the group.
db_count_nodes_in_group(i_grp_id, i_count)
dump i_count
 
# check the database for orphan elements
 
i_return_value =                                               @
    count_orphan_nodes                                         @
       ( i_count )
#
dump i_return_value
# The number of orphan nodes are
dump i_count
 
ga_group_entity_add( s_name,”Node 1:300” )
 
# Count the number of nodes in the group.
# There should be 600 nodes in the group.
db_count_nodes_in_group(i_grp_id, i_count)
dump i_count
 
# Now remove the nodes 1 to 600  from  group two ( fem_model)
db_get_group_name( i_grp_id,s_name )
ga_group_entity_remove( s_name,”Node 1:600” )
 
# Count the number of nodes in the group.
# There should be 0 nodes in the group.
db_count_nodes_in_group(i_grp_id, i_count)
dump i_count
 
# check the database for orphan elements
 
i_return_value =                                               @
    count_orphan_nodes                                         @
       ( i_count )
#
dump i_return_value
# The number of orphan nodes are
dump i_count
 
ga_group_entity_add( s_name,”Node 1:600” )
 
# Count the number of nodes in the group.
# There should be 600 nodes in the group.
db_count_nodes_in_group(i_grp_id, i_count)
dump i_count
 
#  -------------------------------------------------------------------
 
db_add_mpc_to_group
()
 
#  Purpose          :  This file gives an example of a call to the 
#                      function db_add_mpc_to_group()
#
#                      This function adds a MPC (Multi point 
#                      constraint) entity to a particular group.
#                      This file opens a database mpc.db.
#
#                      Before running this session file run mpc.ses
#                      to create mpc.db
#
#                      To run this session file,first start
#                      a session of MSC Patran,then run the session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The db_add_mpc_to_group  has the following arguments:
#  db_add_mpc_to_group
#     ( mpc_id,
#       gid,
#       visible )
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
INTEGER  i_mpc_id, i_gid
STRING   s_name[32]
LOGICAL  l_visible
INTEGER  i_return_value
INTEGER  i_type,i_grp_id,i_count
#  -------------------------------------------------------------------
#  open the existing database mpc.db
 
uil_file_open.go(“mpc.db”)
# The database mpc.db has eight MPCs.
# There are five groups in the database mpc.db.
# There is one MPC entity in the second group.
# We add one more entity to it.
l_visible = TRUE 
i_gid = 2
db_get_group_name                                                 @
   ( i_gid,                                                       @
     s_name )
 
#i_type = 161 (mpc)
i_type = 161
# Count the MPC entity in the group.
db_count_entities_in_group                                        @
   ( s_name,                                                      @
     i_type,                                                      @
     i_count )
 
dump i_count
# i_mpc_id = 4 
 i_mpc_id = 4 
# Add a MPC entity to the group
i_return_value =                                                   @ 
   db_add_mpc_to_group                                             @
      ( i_mpc_id,                                                  @
        i_gid,                                                     @
        l_visible ) 
dump i_return_value
 
# Count the MPC entity in the group.
db_count_entities_in_group                                        @
   ( s_name,                                                      @
     i_type,                                                      @
     i_count )
# Compare the two counts and see the effect of addition
dump i_count
 
ga_group_entity_remove( s_name,”MPC 4:4”)
 
#  -------------------------------------------------------------------
 
db_count_entities_in_group
()
#  Purpose          :  This file gives an example of a call to the
#                      function db_count_entities_in_group()
#
#                      This function gives the count of a specified
#                      type of entity in a particular group.This file
#                      opens a database spool.db which has two groups
#                      “default group” and “fem_model” group.The
#                      fem_model group has 600 node entities and
#                      576 element entities.This file counts the
#                      node entities in the fem_model group.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      To run this session file,first start
#                      a session of MSC Patran,then run the session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The db_count_entities_in_group  has the following arguments:
#  db_count_entities_in_group
#     ( name
#       type
#       count )
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
INTEGER  i_name,i_count,i_type, i_grp_id
STRING   s_name[32]
INTEGER  i_return_value
 
#  -------------------------------------------------------------------
#  open the existing database spool.db
 
uil_file_open.go(“spool.db”)
# get the current group id (fem group)
db_get_current_group_id( i_grp_id )
db_get_group_name                                              @
   ( i_grp_id,                                                 @
     s_name )
 
#i_type = 123 (node)
i_type = 123
# counts the number of nodes.
i_return_value =                                                  @
   db_count_entities_in_group                                     @
      ( s_name,                                                   @
        i_type,                                                   @
        i_count )
 
dump i_return_value
# The group name.
dump s_name
# The count of nodes in the specified group.
dump i_count
 
#  -------------------------------------------------------------------
 
db_count_groups_for_entity
()
#  Purpose          :  This file gives an example of a call to the 
#                      function db_count_groups_for_entity()
#
#                      This function gives the count of all the groups 
#                      having a specified type of entity.This file 
#                      opens a database spool.db which has two groups
#                      “default group” and “fem_model” group. The 
#                      fem_model group has 600 node entities and 576
#                      element entities. This file counts the groups
#                      in which the node entity resides.
#                             
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      To run this session file,first start
#                      a session of MSC Patran,then run the session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The db_count_groups_for_entity  has the following arguments:
#  db_count_groups_for_entity
#     ( id
#       type
#       count )
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
INTEGER  i_count, i_type,i_id
INTEGER  i_return_value
 
#  -------------------------------------------------------------------
#  open the existing database spool.db
 
uil_file_open.go(“spool.db”)
 
#i_id = 1 
i_id = 1
 
#i_type = 123 (node)
i_type = 123
 
i_return_value =                                                  @
   db_count_groups_for_entity                                     @
      ( i_id,                                                     @
        i_type,                                                   @
        i_count )
 
dump i_return_value
# The node entity is only in the fem_model group. i.e. just one group.
dump i_count 
 
#  -------------------------------------------------------------------
 
db_count_groups_using_mpc
()
 
#  Purpose          :  This file gives an example of a call to the 
#                      function db_count_groups_using_mpc()
#                      
#                      This function is used to get the number of 
#                      groups using a list of ids of the  MPCs( Multi
#                      point constraints).This file opens a database
#                      mpc.db.
#
#                      Before running this session file run mpc.ses
#                      to create mpc.db
#
#                      To run this session file,first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The db_count_groups_using_mpc has the following arguments:
#  db_count_groups_using_mpc
#     ( nmpc,
#       mpcid,
#       ngroup,
#       flag )
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
INTEGER  i_nmpc,i_flag,i_mpcid( VIRTUAL ),i_ngroup( VIRTUAL )
INTEGER  i_return_value
 
#  -------------------------------------------------------------------
#
# opening a existing database mpc.db 
uil_file_open.go(“mpc.db”)
 
# The database mpc.db has five groups and eight MPCs. 
# First group and the third group has two entities ,the second has 
# one entity and the fourth has three entities.
# The fifth group has the entities of group two and group four.
# The entities are numbered in a serial order as per the groups.
 
# i_nmpc = 3
# i_mpcid = [4,3,6]
# memory allocation
SYS_ALLOCATE_ARRAY(i_mpcid,1,3)
SYS_ALLOCATE_ARRAY(i_ngroup,1,3)
 
i_nmpc = 3
i_mpcid = [4,3,6]
 
i_return_value =                                               @
   db_count_groups_using_mpc                                   @
      ( i_nmpc,                                                @ 
        i_mpcid,                                               @
        i_ngroup,                                              @
        i_flag )
#
dump i_return_value
dump i_flag
# the number of groups using MPC id 4,3,6.
dump i_ngroup
SYS_FREE_ARRAY(i_mpcid)
SYS_FREE_ARRAY(i_ngroup)
#  -------------------------------------------------------------------
 
db_count_orphan_curves
()
#  Purpose          :  This file gives an example of a call to the
#                      function db_count_orphan_curves()
#
#                      This function is used to get the number of
#                      curve entities that do not belong to any of
#                      the groups.
#                      This file opens a database spool.db which has
#                      two groups “default_group” and “fem_model”group
#                      The default_group has three curves and in the
#                      total model there are thirteen curves.This
#                      implies there are ten orphan curves.
#
#                      Before running this file the database should be
#                      created by running the session file “spool.ses”
#                      To run this session file,first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The db_count_orphan_curves has the following arguments:
#  db_count_orphan_curves
#     ( count )
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
INTEGER  i_count, i_grp_id
INTEGER  i_return_value
STRING   s_name[32]
#  -------------------------------------------------------------------
#
# opening the existing database spool.db
 
uil_file_open.go(“spool.db”)
 
# Count the number of curves in the database. There should be 13.
 
i_return_value =                                              @
   db_count_curve                                             @
      ( i_count )
 
dump i_return_value
dump i_count
 
# check the database for orphan curves.
 
i_return_value =                                              @
   db_count_orphan_curves                                     @
      ( i_count )
#
dump i_return_value
# The number of orphan curves are
dump i_count
 
i_grp_id = 1
 
# Now remove some of the curves from the group, increasing the
# number of orphan curves.
#
i_return_value = db_get_group_name( i_grp_id,s_name )
dump i_return_value
dump s_name
 
i_return_value = ga_group_entity_remove( s_name,”Curve 1:3” )
dump i_return_value
 
 
# Count the number of curves in the database. There should be 13.
 
i_return_value =                                              @
   db_count_curve                                             @
      ( i_count )
 
dump i_return_value
dump i_count
 
# check the database for orphan curves. There should now be 13
# orphan curves.
 
i_return_value =                                              @
   db_count_orphan_curves                                     @
      ( i_count )
#
dump i_return_value
# The number of orphan curves are
dump i_count
 
# Return the curves removed above to the group.
 
i_return_value = ga_group_entity_add( s_name,”Curve 1:3” )
dump i_return_value
 
# Count the number of curves in the database. There should be 13.
 
i_return_value =                                              @
   db_count_curve                                             @
      ( i_count )
 
dump i_return_value
dump i_count
 
# check the database for orphan curves. There should be 10
# orphan curves again.
 
i_return_value =                                              @
   db_count_orphan_curves                                     @
      ( i_count )
#
dump i_return_value
# The number of orphan curves are
dump i_count
 
#  -------------------------------------------------------------------
 
db_count_orphan_curves
()
#  Purpose          :  This file gives an example of a call to the
#                      function db_count_orphan_curves()
#
#                      This function is used to get the number of
#                      curve entities that do not belong to any of
#                      the groups.
#                      This file opens a database spool.db which has
#                      two groups “default_group” and “fem_model”group
#                      The default_group has three curves and in the
#                      total model there are thirteen curves.This
#                      implies there are ten orphan curves.
#
#                      Before running this file the database should be
#                      created by running the session file “spool.ses”
#                      To run this session file,first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The db_count_orphan_curves has the following arguments:
#  db_count_orphan_curves
#     ( count )
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
INTEGER  i_count, i_grp_id
INTEGER  i_return_value
STRING   s_name[32]
#  -------------------------------------------------------------------
#
# opening the existing database spool.db
 
uil_file_open.go(“spool.db”)
 
# Count the number of curves in the database. There should be 13.
 
i_return_value =                                              @
   db_count_curve                                             @
      ( i_count )
 
dump i_return_value
dump i_count
 
# check the database for orphan curves.
 
i_return_value =                                              @
   db_count_orphan_curves                                     @
      ( i_count )
#
dump i_return_value
# The number of orphan curves are
dump i_count
 
i_grp_id = 1
 
# Now remove some of the curves from the group, increasing the
# number of orphan curves.
#
i_return_value = db_get_group_name( i_grp_id,s_name )
dump i_return_value
dump s_name
 
i_return_value = ga_group_entity_remove( s_name,”Curve 1:3” )
dump i_return_value
 
 
# Count the number of curves in the database. There should be 13.
 
i_return_value =                                              @
   db_count_curve                                             @
      ( i_count )
 
dump i_return_value
dump i_count
 
# check the database for orphan curves. There should now be 13
# orphan curves.
 
i_return_value =                                              @
   db_count_orphan_curves                                     @
      ( i_count )
#
dump i_return_value
# The number of orphan curves are
dump i_count
 
# Return the curves removed above to the group.
 
i_return_value = ga_group_entity_add( s_name,”Curve 1:3” )
dump i_return_value
 
# Count the number of curves in the database. There should be 13.
 
i_return_value =                                              @
   db_count_curve                                             @
      ( i_count )
 
dump i_return_value
dump i_count
 
# check the database for orphan curves. There should be 10
# orphan curves again.
 
i_return_value =                                              @
   db_count_orphan_curves                                     @
      ( i_count )
#
dump i_return_value
# The number of orphan curves are
dump i_count
 
#  -------------------------------------------------------------------
 
db_count_orphan_mpcs
()
#  Purpose          :  This file gives an example of a call to the 
#                      function db_count_orphan_mpcs()
#                      
#                      This function is used to get the number of MPC
#                      (Multi point constraints) entities that do not
#                      belong to any of the groups.This file opens a 
#                      existing database mpc.db.
#
#                      Before running this session file run mpc.ses
#                      to create mpc.db
#
#                      To run this session file,first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The db_count_orphan_mpcs has the following arguments:
#  db_count_orphan_mpcs
#     ( count )
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
INTEGER  i_count,i_grp_id
STRING   s_name[32],s_name0[32] 
INTEGER  i_return_value
#  -------------------------------------------------------------------
#
# opening a existing database mpc.db 
uil_file_open.go(“mpc.db”)
 
# The database mpc.db has five groups and eight MPCs. 
# First group and the third group has two entities ,the second has 
# one entity and the fourth has three entities.
# The fifth group has the entities of group two and group four.
# the second group entity has id MPC 3:3
# check the database for orphan MPCs(first time)
 
i_return_value =                                               @
   db_count_orphan_mpcs                                        @
      ( i_count )
#
dump i_return_value
dump i_count
 
# Remove entity three from second group.Entity three is present in
#  both  second and fifth group.
i_grp_id = 2
db_get_group_name( i_grp_id,s_name )
ga_group_entity_remove( s_name,”MPC 3:3” )
 
# check the database for orphan MPCs(second time)
 
i_return_value =                                               @
   db_count_orphan_mpcs                                        @
      ( i_count )
#
dump i_return_value
dump i_count
 
# Now remove the entity three from group five also.
i_grp_id = 5
db_get_group_name( i_grp_id,s_name0 )
ga_group_entity_remove( s_name0,”MPC 3:3” )
 
# check the database for orphan MPCs(third  time)
 
i_return_value =                                               @
   db_count_orphan_mpcs                                        @
      ( i_count ) 
#
dump i_return_value
dump i_count
ga_group_entity_add( s_name,”MPC 3:3” )
ga_group_entity_add( s_name0,”MPC 3:3” )
 
#  -------------------------------------------------------------------
 
db_count_orphan_points
()
#  Purpose          :  This file gives an example of a call to the
#                      function db_count_orphan_points()
#
#                      This function is used to get the number of
#                      point entities that do not belong to any of
#                      the groups.
#                      This file opens a database spool.db which has
#                      two groups “default_group” and “fem_model”group
#                      The default_group has seven points(ids 4 to 10)
#                      and in the total model there are seven points
#                      This implies there are no  orphan points.So we
#                      delete two point entities and then search for
#                      these two orphan entities.
#
#                      Before running this file the database should be
#                      created by running the session file “spool.ses”
#                      To run this session file,first start a session
#                      of MSC Patran,then run this session file by
#                      “File”,”Session”,”Play” pulldown menus on the
#                      menu bar.
#
#  The db_count_orphan_points has the following arguments:
#  db_count_orphan_points
#     ( count )
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
INTEGER  i_count
INTEGER  i_return_value
#  -------------------------------------------------------------------
#
# opening a existing database spool.db
 
uil_file_open.go(“spool.db”)
 
# we remove two points from the default_group
ga_group_entity_remove(“default_group”,”Point 9:10”)
 
# check the database for orphan curves.
 
i_return_value =                                              @
   db_count_orphan_points                                     @
      ( i_count )
#
dump i_return_value
# the number of orphan points are
dump i_count
ga_group_entity_add(“default_group”,”Point 9:10”)
 
#  -------------------------------------------------------------------
 
db_count_orphan_solids
()
#  Purpose          :  This file gives an example of a call to the
#                      function db_count_orphan_solids()
#
#                      This function is used to get the number of
#                      solid entities that do not belong to any of
#                      the groups.
#                      This file opens a new database “new.db”
#                      and creates a solid in the default group
#                      and then removes the entity from the group.
#                      we then count for the orphan entities.
#                      If new.db is existing delete it before running
#                      this session file.
#
#                      To run this session file,first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The db_count_orphan_solids has the following arguments:
#  db_count_orphan_solids
#     ( count )
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
INTEGER  i_count
STRING   s_created_ids[VIRTUAL]
INTEGER  i_return_value
#  -------------------------------------------------------------------
#open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
SYS_ALLOCATE_STRING(s_created_ids,32)
#  Create a solid  in this new database
asm_const_hpat_xyz(“1”,”<1 1 1>”,”[0 0 0]”,”coord 0”,s_created_ids)
 
#  Remove this entity from the group.
ga_group_entity_remove(“default_group”,”Solid 1:1”)
 
# check the database for orphan solids.
 
i_return_value =                                              @
   db_count_orphan_solids                                     @
      ( i_count )
#
dump i_return_value
# The number of orphan solids are
dump i_count
SYS_FREE_STRING(s_created_ids)
 
#  -------------------------------------------------------------------
db_count_orphan_surfaces
()
#  Purpose          :  This file gives an example of a call to the
#                      function db_count_orphan_surfaces()
#
#                      This function is used to get the number of
#                      surface entities that does not belong to any of
#                      the groups.
#                      This file opens a database spool.db which has
#                      two groups “default_group” and “fem_model”group
#                      The default_group has six surfaces(ids 1 to 6)
#                      and in the total model there are six surfaces
#                      This implies there are no  orphan surfaces.So
#                      we delete two surface entities and then search
#                      for these two orphan entities.
#
#                      Before running this file the database should be
#                      created by running the session file “spool.ses”
#                      To run this session file,first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The db_count_orphan_surfaces has the following arguments:
#  db_count_orphans_surfaces
#     ( count )
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
INTEGER  i_count
INTEGER  i_return_value
#  -------------------------------------------------------------------
#
# opening a existing database spool.db
 
uil_file_open.go(“spool.db”)
 
# we remove two points from the default_group
ga_group_entity_remove(“default_group”,”Surface 3:4”)
 
# check the database for orphan curves.
 
i_return_value =                                              @
   db_count_orphan_surfaces                                   @
      ( i_count )
#
dump i_return_value
# the number of orphan surfaces are
dump i_count
ga_group_entity_add(“default_group”,”Surface 3:4”)
 
#  -------------------------------------------------------------------
 
db_get_group_name
()
#  Purpose          :  This file gives an example of a call to the 
#                      function db_get_group_name()
#
#                      This function gives the group name with the
#                      specified group id.This file opens a database
#                      spool.db which has two groups “default group”
#                      and “fem_model”group.The fem_model group has
#                      600 node entities and 576 element entities.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      To run this session file,first start
#                      a session of MSC Patran,then run the session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The db_get_group_name  has the following arguments:
#  db_get_group_name
#     ( grp_id
#       name )
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
INTEGER  i_grp_id
STRING   s_name[32]
INTEGER  i_return_value
 
#  -------------------------------------------------------------------
#  open the existing database spool.db
uil_file_open.go(“spool.db”)
# get the current group (fem_model group)
db_get_current_group_id( i_grp_id )
 
i_return_value =                                                  @
   db_get_group_name                                              @
      ( i_grp_id,                                                 @
        s_name )
#
dump i_return_value
# dumps the current group i.e fem_model
dump s_name
 
#  -------------------------------------------------------------------
 
db_get_groups_for_entity
()
#  Purpose          :  This file gives an example of a call to the 
#                      function db_get_groups_for_entity()
#
#                      This function gives all the group ids  
#                      having a specified entity type and id.
#                      This file opens a database spool.db which
#                      has two groups “default group” and the 
#                      “fem_model” group.The fem_model group has
#                      600 node entities and 576 element entities.
#                      This file finds the group ids having the node
#                      entity.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      To run this session file,first start
#                      a session of MSC Patran,then run the session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The db_get_groups_for_entity  has the following arguments:
#  db_get_groups_for_entity 
#     ( id,
#       type,
#       count, 
#       group_list )
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
INTEGER  i_count, i_type,i_id
INTEGER  i_group_list( VIRTUAL )
INTEGER  i_return_value
 
#  -------------------------------------------------------------------
#  open the existing database spool.db
 
uil_file_open.go(“spool.db”)
 
#i_id = 1 
i_id = 1
 
#i_type = 123 (node)
i_type = 123
 
# get the count of the groups having a id ‘1’ and type node.
# this will be used for allocation of memory to group_list.
db_count_groups_for_entity                                         @
   ( i_id,                                                         @
     i_type,                                                       @
     i_count )
 
SYS_ALLOCATE_ARRAY( i_group_list,1,i_count )
 
i_return_value =                                                  @
   db_get_groups_for_entity                                       @
      ( i_id,                                                     @
        i_type,                                                   @
        i_count,                                                  @
        i_group_list )
 
dump i_return_value
# group list contains the group id having node entity and entity id 1
# the fem_model group contains this entity and has the id =2. 
dump i_group_list 
SYS_FREE_ARRAY(i_group_list)
 
#  -------------------------------------------------------------------
 
db_get_groups_using_mpc
()
#  Purpose          :  This file gives an example of a call to the 
#                      function db_get_groups_using_mpc()
#                      
#                      This function is used to get the number of
#                      groups using a list of ids of the  MPCs(Multi
#                      point constraints).It also gets the ids of the
#                      groups for each MPC.It opens the existing 
#                      database mpc.db
#
#                      Before running this session file run mpc.ses
#                      to create mpc.db
#
#                      To run this session file,first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The db_get_groups_using_mpc has the following arguments:
#  db_get_groups_using_mpc
#     ( nmpc,
#       mpcid,
#       maxgrp,
#       ngroup,
#       gid )
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
INTEGER  i_nmpc,i_mpcid( VIRTUAL ),i_ngroup( VIRTUAL )
INTEGER  i_maxgrp,i_gid( VIRTUAL ) 
INTEGER  i_return_value
 
#  -------------------------------------------------------------------
#
# opening a existing database mpc.db 
uil_file_open.go(“mpc.db”)
 
# The database mpc.db has five groups and eight MPCs. 
# First group and the third group has two entities ,the second has 
# one entity and the fourth has three entities.
# The fifth group has the entities of group two and group four.
# The numbering of entities is serial as per the groups.
 
# i_nmpc = 3
# i_maxgrp = 2
# i_mpcid = [1,2,3]
# memory allocation
SYS_ALLOCATE_ARRAY(i_mpcid,1,3)
SYS_ALLOCATE_ARRAY(i_ngroup,1,3)
# array size for i_gid is  i_maxgrp x i_nmpc.
SYS_ALLOCATE_ARRAY(i_gid,1,6)
 
i_nmpc = 3
i_maxgrp = 2
i_mpcid = [1,2,3]
 
i_return_value =                                              @
   db_get_groups_using_mpc                                    @
      ( i_nmpc,                                               @ 
        i_mpcid,                                              @
        i_maxgrp,                                             @
        i_ngroup,                                             @
        i_gid )
#
 
dump i_return_value
# the number of groups using MPC id 1,2,3.
dump i_ngroup
# The ids of the groups contaning these MPC ids.There are two spaces 
# allocated for  groups per MPCs.
dump i_gid
SYS_FREE_ARRAY(i_mpcid)
SYS_FREE_ARRAY(i_ngroup)
SYS_FREE_ARRAY(i_gid)
 
#  -------------------------------------------------------------------
 
db_get_orphan_curves
()
#  Purpose          :  This file gives an example of a call to the
#                      function db_get_orphan_curves()
#
#                      This function is used to get the ids  of
#                      curve entities that do not belong to any of
#                      the groups.
#                      This file opens a database spool.db which has
#                      two groups “default_group” and “fem_model”group
#                      The default_group has three curves and in the
#                      total model there are thirteen curves.This
#                      implies there are ten orphan curves.
#
#                      Before running this file the database should be
#                      created by running the session file “spool.ses”
#                      To run this session file,first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The db_get_orphan_curves has the following arguments:
#  db_get_orphan_curves
#     ( count,
#       entity_id )
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
INTEGER  i_count
INTEGER  i_entity_id(VIRTUAL)
INTEGER  i_return_value
#  -------------------------------------------------------------------
#
# opening a existing database spool.db
 
uil_file_open.go(“spool.db”)
 
# check the database for orphan curves.
 
i_return_value =                                            @
   db_count_orphan_curves                                   @
      ( i_count )
 
dump i_return_value
dump i_count
 
#
# allocate memory
SYS_ALLOCATE_ARRAY(i_entity_id,1,i_count)
 
# get the ids of the orphan curves
i_return_value =                                            @
   db_get_orphan_curves                                     @
      ( i_count,                                            @
        i_entity_id )
dump i_return_value
 
# the ids of orphan curves are
dump i_entity_id
SYS_FREE_ARRAY(i_entity_id)
 
#  -------------------------------------------------------------------
 
db_get_orphan_mpcs
()
#  Purpose          :  This file gives an example of a call to the 
#                      function db_get_orphan_mpcs()
#                      
#                      This function is used to get the ids  of MPCs
#                      (Multi point constraints) entities that do not
#                      belong to any of the groups.This file opens a
#                      database mpc.db. 
#
#                      Before running this session file run mpc.ses
#                      to create mpc.db
#
#                      To run this session file,first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The db_get_orphan_mpcs has the following arguments:
#  db_get_orphan_mpcs
#     ( count 
#       entity_id )
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
INTEGER  i_count,i_grp_id
STRING   s_name[32]
INTEGER  i_entity_id( VIRTUAL ) 
INTEGER  i_return_value
#  -------------------------------------------------------------------
#
# opening a existing database mpc.db
 
uil_file_open.go(“mpc.db”)
 
# The database mpc.db has five groups and eight MPCs. 
# First group and the third group has two entities ,the second has 
# one entity and the fourth has three entities.
# The fifth group has the entities of group two and group four.
 
# Remove entity one and two from first group.
i_grp_id = 1 
db_get_group_name( i_grp_id,s_name )
ga_group_entity_remove( s_name,”MPC 1:2” )
 
# check the database for orphan MPCs
 
db_count_orphan_mpcs                                           @
   ( i_count )
#
dump i_count
 
# Allocate memory for entity ids.
SYS_ALLOCATE_ARRAY(i_entity_id,1,i_count)
 
# Get the  orphan MPCs
 
i_return_value =                                               @
   db_get_orphan_mpcs                                          @
      ( i_count,                                               @
        i_entity_id )
#
dump i_return_value
# Orphan entity ids are
dump i_entity_id
ga_group_entity_add( s_name,”MPC 1:2” )
SYS_FREE_ARRAY( i_entity_id )
 
#  -------------------------------------------------------------------
 
db_get_orphan_points
()
#  Purpose          :  This file gives an example of a call to the
#                      function db_get_orphan_points()
#
#                      This function is used to get the ids  of
#                      point entities that do not belong to any of
#                      the groups.
#                      This file opens a database spool.db which has
#                      two groups “default_group” and “fem_model”group
#                      The default_group has seven points(ids 4 to 10)
#                      and in the total model there are seven points
#                      This implies there are no  orphan points.So we
#                      delete two point entities and then search for
#                      these two orphan entities and get their ids.
#
#                      Before running this file the database should be
#                      created by running the session file “spool.ses”
#                      To run this session file,first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The db_get_orphan_points has the following arguments:
#  db_get_orphan_points
#     ( count
#       entity_id )
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
INTEGER  i_count
INTEGER  i_entity_id(VIRTUAL)
INTEGER  i_return_value
#  -------------------------------------------------------------------
#
# opening a existing database spool.db
 
uil_file_open.go(“spool.db”)
 
# we remove two points from the default_group
ga_group_entity_remove(“default_group”,”Point 9:10”)
 
# check the database for orphan curves.
db_count_orphan_points                                        @
   ( i_count )
#
# Allocate memory
SYS_ALLOCATE_ARRAY(i_entity_id,1,i_count)
 
i_return_value =                                              @
   db_get_orphan_points                                       @
      ( i_count,                                              @
        i_entity_id )
 
dump i_return_value
# get the ids of the orphan points
dump i_entity_id
 
SYS_FREE_ARRAY(i_entity_id)
ga_group_entity_add(“default_group”,”Point 9:10”)
 
#  -------------------------------------------------------------------
 
db_get_orphan_solids
()
#  Purpose          :  This file gives an example of a call to the
#                      function db_get_orphan_solids()
#
#                      This function is used to get the ids of
#                      solid entities that do not belong to any of
#                      the groups.
#                      This file opens a new database “new.db”
#                      and creates a solid in the default group
#                      and then removes the entity from the group.
#                      we then get the ids for the orphan entities.
#                      If new.db is existing, delete it before running
#                      this session file.
#
#                      To run this session file,first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The db_get_orphan_solids has the following arguments:
#  db_get_orphan_solids
#     ( count,
#       entity_id )
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
INTEGER  i_count
INTEGER  i_entity_id(VIRTUAL)
STRING   s_created_ids[VIRTUAL]
INTEGER  i_return_value
#  -------------------------------------------------------------------
#open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
SYS_ALLOCATE_STRING(s_created_ids,32)
 
# Create a solid  in this new database with id=101
asm_const_hpat_xyz(“101”,”<1 1 1>”,”[0 0 0]”,”coord 0”,s_created_ids)
 
# Remove this entity from the group.
ga_group_entity_remove(“default_group”,”Solid 101”)
 
# check the database for orphan solids.
db_count_orphan_solids                                        @
   ( i_count )
#
# allocate memory
SYS_ALLOCATE_ARRAY(i_entity_id,1,i_count)
 
# get the ids of orphan solids
i_return_value =                                              @
   db_get_orphan_solids                                       @
      ( i_count,                                              @
        i_entity_id )
 
dump i_return_value
# the ids  of orphan solids are
dump i_entity_id
 
SYS_FREE_STRING(s_created_ids)
SYS_FREE_ARRAY(i_entity_id)
 
#  -------------------------------------------------------------------
 
 
db_get_orphan_surfaces
()
#  Purpose          :  This file gives an example of a call to the
#                      function db_get_orphan_surfaces()
#
#                      This function is used to get the ids  of
#                      surface entities that does not belong to any of
#                      the groups.
#                      This file opens a database spool.db which has
#                      two groups “default_group” and “fem_model”group
#                      The default_group has six surfaces(ids 1 to 6)
#                      and in the total model there are six surfaces
#                      This implies there are no  orphan surfaces.So
#                      we delete two surface entities and then search
#                      for these two orphan entities and get their
#                      ids.
#
#                      Before running this file the database should be
#                      created by running the session file “spool.ses”
#                      To run this session file,first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The db_get_orphan_surfaces has the following arguments:
#  db_get_orphan_surfaces
#     ( count
#       entity_id )
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
INTEGER  i_count
INTEGER  i_entity_id(VIRTUAL)
INTEGER  i_return_value
#  -------------------------------------------------------------------
#
# opening a existing database spool.db
 
uil_file_open.go(“spool.db”)
 
# we remove two points from the default_group
ga_group_entity_remove(“default_group”,”Surface 3:4”)
 
# check the database for orphan surfaces.
db_count_orphan_surfaces                                      @
   ( i_count )
#
# Allocate memory
SYS_ALLOCATE_ARRAY(i_entity_id,1,i_count)
 
i_return_value =                                              @
   db_get_orphan_surfaces                                     @
      ( i_count,                                              @
        i_entity_id )
 
dump i_return_value
# get the ids of the orphan surfaces
dump i_entity_id
 
SYS_FREE_ARRAY(i_entity_id)
ga_group_entity_add(“default_group”,”Surface 3:4”)
 
#  -------------------------------------------------------------------
 
ga_group_color_get
()
#  Purpose          :  This file gives an example of a call to the
#                      function ga_group_color_get()
#
#                      This function gets the current color associated
#                      with the group.This file opens a database
#                      spool.db which has two groups “default_group”
#                      and “fem_model”group.This file gets the color
#                      associated with the fem_model group.It further
#                      sets the color from 0 to 15 and then gets the
#                      color set.The color changes can be viewed on
#                      the viewport.
#
#                      Before running this file the database should be
#                      created by running the session file “spool.ses”
#                      To run this session file, first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The ga_group_color_get has the following arguments:
#  ga_group_color_get
#     ( name
#       color )
#  -------------------------------------------------------------------
#  Variable Declaration
#
INTEGER  i_color
STRING   s_name[32]
INTEGER  i_return_value,i_var
#  -------------------------------------------------------------------
# opening a existing database spool.db
uil_file_open.go(“spool.db”)
 
# post the fem_model group.
uil_viewport_post_groups.posted_groups(“default_viewport”,1,  @
[“fem_model”])
 
# s_name=fem_model
s_name = “fem_model”
 
# get the present color associated with the group.
i_return_value =                                              @
   ga_group_color_get                                         @
      ( s_name,                                               @
        i_color )
 
dump i_return_value
dump i_color
 
coloring_method(2)
 
# Color is set and got for color range 0-15.
FOR (i_var = 0 TO 15  BY 1)
   ga_group_color_set                                         @
      ( s_name,                                               @
        i_var )
   ga_group_color_get                                         @
      ( s_name,                                               @
        i_color )
   dump i_color
END FOR
 
#  -------------------------------------------------------------------
 
ga_group_color_set
()
#  Purpose          :  This file gives an example of a call to the
#                      function ga_group_color_set()
#
#                      This function modifies the current color
#                      associated with the group.This file opens a
#                      database spool.db which has two groups
#                      “default_group” and “fem_model”group.This file
#                      sets the color associated with the fem_model
#                      group.It further sets the color from 0 to 15
#                      and then gets the color set.The color changes
#                      can be viewed on the viewport.
#
#                      Before running this file the database should be
#                      created by running the session file “spool.ses”
#                      To run this session file, first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The ga_group_color_set has the following arguments:
#  ga_group_color_set
#     ( name
#       color )
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
INTEGER  i_color
STRING   s_name[32]
INTEGER  i_return_value,i_var
#  -------------------------------------------------------------------
# opening the existing database spool.db
uil_file_open.go(“spool.db”)
 
# post the fem_model group.
uil_viewport_post_groups.posted_groups(“default_viewport”,1,  @
[“fem_model”])
 
# s_name=fem_model
s_name = “fem_model”
# i_color = 4
i_color = 4
 
# set the present color  associated with the group to 4 (BLUE).
i_return_value =                                              @
    ga_group_color_set                                        @
       ( s_name,                                              @
         i_color )
 
dump i_return_value
 
# Session file paused.Press “Resume” to continue.
sf_pause()
 
coloring_method(2)
 
# Color is set and got for color range 0-15.
FOR (i_var = 0 TO 15  BY 1)
   ga_group_color_set                                         @
      ( s_name,                                               @
        i_var )
   ga_group_color_get                                         @
      ( s_name,                                               @
        i_color )
   dump i_color
END FOR
 
#  -------------------------------------------------------------------
 
 
ga_group_current_get
()
#  Purpose          :  This file gives an example of a call to the
#                      function ga_group_current_get()
#
#                      This function gets the current group.This
#                      file opens a database  spool.db which has two
#                      groups “default_group” and “fem_model”group.
#                      This file gets the current group.It further
#                      sets the current group to “fem_model” group
#                      and then gets this group name.
#
#                      Before running this file the database should be
#                      created by running the session file “spool.ses”
#                      To run this session file, first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The ga_group_current_get has the following arguments:
#  ga_group_current_get
#     ( name )
#  -------------------------------------------------------------------
#  Variable Declaration
#
STRING   s_name[32]
INTEGER  i_return_value
#  -------------------------------------------------------------------
# opening a existing database spool.db
uil_file_open.go(“spool.db”)
 
# get the current  group.
i_return_value =                                              @
   ga_group_current_get                                       @
       ( s_name )
 
dump i_return_value
# current group name is
dump s_name
 
# s_name=fem_model
s_name = “fem_model”
 
# Set the group name to fem_model group.
ga_group_current_set                                          @
   ( s_name )
 
# get the current  group.
i_return_value =                                              @
   ga_group_current_get                                       @
       ( s_name )
 
dump i_return_value
# current group name is
dump s_name
 
ga_group_current_set                                          @
   ( “default_group” )
 
#  -------------------------------------------------------------------
 
ga_group_deform_get
()
#  Purpose          :  This file gives an example of two calls to the 
#                      function ga_group_deform_get()
#                      
#                      This function gets the deform flag associated 
#                      with the group.This file plays a session file
#                      ‘spool_res_deform.ses’ which displays the 
#                      deform plot.It then gets the flag associated
#                      with the deform plot.Later it sets the deform
#                      plot flag to ‘no display’ and gets the flag.
#                      This change of setting to ‘no display’ can be
#                      seen on the viewport.
#
#                      Before running this session file run spool.ses
#                      to create ‘spool.db’.Follow the instructions in
#                      spool.ses and create spool.op2 and spool.jbr.
#
#                      To run this session file, first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The ga_group_deform_get has the following arguments:
#  ga_group_deform_get
#     ( name,
#       flag )
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
STRING   s_name[32]
INTEGER  i_flag
INTEGER  i_return_value
#  -------------------------------------------------------------------
#  Open the database “spool.db” and read the results.
sf_play(“spool_res_deform.ses”)
 
coloring_method(2)
#  s_name=fem_model 
s_name = “fem_model”
 
#  Get the deform flag
i_return_value =                                              @
   ga_group_deform_get                                        @
      ( s_name,                                               @
        i_flag )
 
dump i_return_value
 
#  Deform flag is 
dump i_flag
 
#  Session file paused. Press “Resume” to continue..
sf_pause()
 
#  Set the  deform plot for no display
ga_group_deform_set                                           @
   ( s_name,                                                  @
     0 )
 
#  Get the deform flag
i_return_value =                                              @
   ga_group_deform_get                                        @
      ( s_name,                                               @
        i_flag )
 
dump i_return_value
 
#  Deform flag is 
dump i_flag
#  -------------------------------------------------------------------
 
ga_group_deform_set
()
#  Purpose          :  This file gives an example of a call to the 
#                      function ga_group_deform_set()
#                      
#                      This function sets the deform flag associated 
#                      with the group.This file plays a session file
#                      ‘spool_res_deform.ses’ which displays the 
#                      deform plot.It then gets the flag associated 
#                      with the deform plot.Later it sets the  deform
#                      plot flag to ‘no display’ and gets the flag.
#                      This change of setting to ‘no display’ can be
#                      seen on the viewport.
#
#                      Before running this session file run spool.ses
#                      to create ‘spool.db’.Follow the instructions in
#                      spool.ses and create spool.op2 and spool.jbr.
#
#                      created by running the session file “spool.ses”
#                      To run this session file, first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The ga_group_deform_set has the following arguments:
#  ga_group_deform_set
#     ( name,
#       flag )
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
STRING   s_name[32]
INTEGER  i_flag,i_flag_c
INTEGER  i_return_value
#  -------------------------------------------------------------------
#  Open the database “spool.db”
#uil_file_open.go(“spool.db”)
sf_play(“spool_res_deform.ses”)
 
coloring_method(2)
#  s_name=fem_model 
s_name = “fem_model”
 
#  Get the deform flag
ga_group_deform_get                                           @
   ( s_name,                                                  @
     i_flag_c )
 
#  Check the deform flag
dump i_flag_c
 
#  Session file paused. Press “Resume” to continue..
sf_pause()
 
#  Set the  deform plot for no display
# i_flag = 0
i_flag = 0
i_return_value =                                              @
   ga_group_deform_set                                        @
      ( s_name,                                               @
        i_flag )
 
dump i_return_value
 
#  Get the deform flag
ga_group_deform_get                                           @
   ( s_name,                                                  @
     i_flag_c )
 
#  Check the  deform flag  
dump i_flag_c
#  -------------------------------------------------------------------
 
ga_group_display_get
()
#  Purpose          :  This file gives an example of a call to the
#                      function ga_group_display_get()
#
#                      This function gets the display property list
#                      associated with the group.Two default sets are
#                      provided “general” and “simple”.By switching
#                      between these two, we can control the amount
#                      of display clutter.This file opens a database
#                      spool.db which has two groups “default_group”
#                      and “fem_model”group.This file gets the display
#                      name associated with the fem_model group.It
#                      then  sets the display name to “simple”and gets
#                      the current display name.The  change in the
#                      display can be viewed on the viewport.
#
#                      Before running this file the database should be
#                      created by running the session file “spool.ses”
#                      To run this session file, first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The ga_group_display_get has the following arguments:
#  ga_group_display_get
#     ( name,
#       dname )
#  -------------------------------------------------------------------
#  Variable Declaration
#
STRING   s_name[32],s_dname[32],s_dname_c[32]
INTEGER  i_return_value
#  -------------------------------------------------------------------
# opening a existing database spool.db
uil_file_open.go(“spool.db”)
 
# post the fem_model group.
uil_viewport_post_groups.posted_groups(“default_viewport”,1,  @
[“fem_model”])
 
# s_name=fem_model
s_name = “fem_model”
 
# get the present display name associated with the group.
i_return_value =                                              @
   ga_group_display_get                                       @
      ( s_name,                                               @
        s_dname_c )
 
dump i_return_value
dump s_dname_c
 
coloring_method(2)
 
# Change the display to “simple”.
# s_dname = simple
s_dname = “simple”
 
ga_group_display_set                                          @
   ( s_name,                                                  @
     s_dname )
 
# Session file paused.Press “Resume” to continue.
sf_pause()
 
# get the present display name associated with the group.
i_return_value =                                              @
   ga_group_display_get                                       @
      ( s_name,                                               @
        s_dname_c )
 
dump i_return_value
dump s_dname_c
 
# Rechange the display to “general”.
# s_dname = general
s_dname = “general”
 
ga_group_display_set                                          @
   ( s_name,                                                  @
     s_dname )
 
#  -------------------------------------------------------------------
 
ga_group_elem_scalar_get
()
 
#  Purpose          :  This file provides an example of a call to the
#                      function ga_group_elem_scalar_get()
#
#                      This function is used to get a scalar element
#                      table associated with the group.This file opens
#                      a database spool.db which has two groups
#                      “default_group “and “fem_model”group.The 
#                      fem_model group has 600 node entities and 576 
#                      element entities. In this file  the function
#                      ga_elem_scalar_create() is used  to create the
#                      element scalar table.Later the scalar id of
#                      this table is got using the example function.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function ga_group_elem_scalar_get()
#  has the following arguments:
#
#  ga_group_elem_scalar_get
#     (  name,
#        scalar_id )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_title[64], s_cur_group[256],s_name[32]
INTEGER  i_nbr_elems
INTEGER  i_elem_ids(VIRTUAL)
INTEGER  i_nbr_values(VIRTUAL)
INTEGER  i_max_vals
REAL     r_scalars(VIRTUAL)
INTEGER  i_id, i_cur_group_id,i_scalar_id
INTEGER  i_index,i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
# s_name = “fem_model”
s_name = “fem_model”
 
ga_group_current_set(“fem_model”)
 
db_get_current_group_id(i_cur_group_id)
 
#  Get the number of elements in the current group
db_count_elems_in_group(i_cur_group_id,i_nbr_elems)
 
#  Allocate memory to virtual arrays
SYS_ALLOCATE_ARRAY(i_elem_ids,1,i_nbr_elems)
SYS_ALLOCATE_ARRAY(i_nbr_values,1,i_nbr_elems)
SYS_ALLOCATE_ARRAY(r_scalars,1,i_nbr_elems,1,1)
 
#  Get the IDs of the elements in the current group
db_get_elem_ids_in_group(i_nbr_elems,i_cur_group_id,i_elem_ids)
 
#  Create a scalar table
s_title = “A Scalar Table”
i_max_vals = 1
FOR (i_index=1 TO i_nbr_elems)
   i_nbr_values(i_index) = i_max_vals
   r_scalars(i_index,1) = i_index * i_index
END FOR
 
ga_elem_scalar_create                             @
   (  s_title,                                    @
      i_nbr_elems,                                @
      i_elem_ids,                                 @
      i_nbr_values,                               @
      i_max_vals,                                 @
      r_scalars,                                  @
      i_id )
 
#  The id of the element scalar table is 
dump i_id
 
#  Set this scalar table to be associated with the group.  
ga_group_elem_scalar_set                          @
   (  s_name,                                     @
      i_id)
 
i_return_value =                                  @
   ga_group_elem_scalar_get                       @
      (  s_name,                                  @
         i_scalar_id )
 
dump i_return_value
#  The Id of the scalar table got using the function
dump i_scalar_id
 
#  Release the memory
SYS_FREE_ARRAY(i_elem_ids)
SYS_FREE_ARRAY(i_nbr_values)
SYS_FREE_ARRAY(r_scalars)
 
ga_elem_scalar_delete( i_id )
#---------------------------------------------------------------------
 
ga_group_elem_scalar_set
()
#  Purpose          :  This file provides an example of a call to the
#                      function ga_group_elem_scalar_set()
#
#                      This function is used to get a scalar element
#                      table associated with the group.This file opens
#                      a database spool.db which has two groups
#                      “default_group “and “fem_model”group.The 
#                      fem_model group has 600 node entities and 576 
#                      element entities. In this file  the function
#                      ga_elem_scalar_create() is used  to create the
#                      element scalar table.Later the scalar id of the
#                      table is associated with the fem_model group 
#                      using the example function.Then the function
#                      ga_group_elem_scalar_get() gets the set scalar
#                      id
#
#                      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 ga_group_elem_scalar_set()
#  has the following arguments:
#
#  ga_group_elem_scalar_set
#     (  name,
#        scalar_id )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_title[64], s_cur_group[256],s_name[32]
INTEGER  i_nbr_elems
INTEGER  i_elem_ids(VIRTUAL)
INTEGER  i_nbr_values(VIRTUAL)
INTEGER  i_max_vals
REAL     r_scalars(VIRTUAL)
INTEGER  i_id, i_cur_group_id,i_scalar_id,i_scalar_id_c
INTEGER  i_index,i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
# s_name = “fem_model”
s_name = “fem_model”
 
ga_group_current_set(“fem_model”)
 
db_get_current_group_id(i_cur_group_id)
 
#  Get the number of elements in the current group
db_count_elems_in_group(i_cur_group_id,i_nbr_elems)
 
#  Allocate memory to virtual arrays
SYS_ALLOCATE_ARRAY(i_elem_ids,1,i_nbr_elems)
SYS_ALLOCATE_ARRAY(i_nbr_values,1,i_nbr_elems)
SYS_ALLOCATE_ARRAY(r_scalars,1,i_nbr_elems,1,1)
 
#  Get the IDs of the elements in the current group
db_get_elem_ids_in_group(i_nbr_elems,i_cur_group_id,i_elem_ids)
 
#  Create a scalar table
s_title = “A Scalar Table”
i_max_vals = 1
FOR (i_index=1 TO i_nbr_elems)
   i_nbr_values(i_index) = i_max_vals
   r_scalars(i_index,1) = i_index * i_index
END FOR
 
ga_elem_scalar_create                             @
   (  s_title,                                    @
      i_nbr_elems,                                @
      i_elem_ids,                                 @
      i_nbr_values,                               @
      i_max_vals,                                 @
      r_scalars,                                  @
      i_id )
 
#  The id of the element scalar table is 
dump i_id
 
#  Set this scalar table to be associated with the group.  
i_scalar_id = i_id
i_return_value =                                  @
   ga_group_elem_scalar_set                       @
      (  s_name,                                  @
         i_scalar_id )
 
dump i_return_value
 
#  Get the element scalar table id     
ga_group_elem_scalar_get                          @
   (  s_name,                                     @
      i_scalar_id_c)
 
#  The Id of the scalar table
dump i_scalar_id_c
 
#  Release the memory
SYS_FREE_ARRAY(i_elem_ids)
SYS_FREE_ARRAY(i_nbr_values)
SYS_FREE_ARRAY(r_scalars)
 
ga_elem_scalar_delete( i_id )
#---------------------------------------------------------------------
 
ga_group_entities_get
()
#
#  Purpose          :  This file gives an example of a call to the
#                      function ga_group_entities_get()
#
#                      This function gets the sorted list of entities
#                      contained in a group.This file opens a database
#                      spool.db which has two groups “default_group”
#                      and “fem_model”group.The database has 600 node
#                      entities.This file gets the sorted list of
#                      nodes from 101 to 120.Then we remove entity 105
#                      and 111 and get the sorted list of the node
#                      entity.
#
#                      Before running this file the database should be
#                      created by running the session file “spool.ses”
#                      To run this session file, first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The ga_group_entities_get has the following arguments:
#  ga_group_entities_get
#     ( name,
#       type,
#       range,
#       number,
#       entities )
#  -------------------------------------------------------------------
#  Variable Declaration
#
INTEGER  i_type,i_number,i_range(3)
STRING   s_name[32],s_entities[VIRTUAL]
INTEGER  i_return_value
#  -------------------------------------------------------------------
# opening the existing database spool.db
uil_file_open.go(“spool.db”)
 
# s_name=fem_model
s_name = “fem_model”
 
# i_type =123 (For NODE from file dbtypes.h)
i_type = 123
 
# i_number = 600 (total of 600 node entities)
i_number = 600
 
# i_range = [ 101,120,128 ] (node 101 to 120 )
 i_range = [ 101,120,128 ]
 
# get the sorted list of node entity associated with the group.
i_return_value =                                              @
   ga_group_entities_get                                      @
      ( s_name,                                               @
        i_type,                                               @
        i_range,                                              @
        i_number,                                             @
        s_entities )
 
dump i_return_value
dump s_entities
 
# Remove entity 105 and 111 from the group fem_model.
ga_group_entity_remove(“fem_model”,”node 105”)
ga_group_entity_remove(“fem_model”,”node 111”)
 
# get the sorted list of node entity associated with the group.
i_return_value =                                              @
   ga_group_entities_get                                      @
      ( s_name,                                               @
        i_type,                                               @
        i_range,                                              @
        i_number,                                             @
        s_entities )
 
dump i_return_value
dump s_entities
 
# add entity 105 and 111 to the group fem_model.
ga_group_entity_add(“fem_model”,”node 105”)
ga_group_entity_add(“fem_model”,”node 111”)
 
SYS_FREE_STRING( s_entities )
#  -------------------------------------------------------------------
 
ga_group_exist_get
()
#  Purpose          :  This file gives an example of a call to the
#                      function ga_group_exist_get()
#
#                      This function determines if the group with
#                      specified name exists.This file opens a
#                      database spool.db which has two groups
#                      “default_group”and “fem_model”group.This file
#                      gets the existence flag for fem_model group.
#                      It then gets the existence flag for an non-
#                      existent group.
#
#                      Before running this file the database should be
#                      created by running the session file “spool.ses”
#                      To run this session file, first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The ga_group_exist_get has the following arguments:
#  ga_group_exist_get
#     ( name
#       flag )
#  -------------------------------------------------------------------
#  Variable Declaration
#
INTEGER  i_flag
STRING   s_name[32]
INTEGER  i_return_value
#  -------------------------------------------------------------------
# opening the existing database spool.db
uil_file_open.go(“spool.db”)
 
# s_name=fem_model
s_name = “fem_model”
 
# get the existence flag for the group fem_model.
i_return_value =                                              @
   ga_group_exist_get                                         @
      ( s_name,                                               @
        i_flag )
 
dump i_return_value
dump i_flag
 
# s_name=non_existing_group
s_name = “non_existing_group”
 
# get the existence flag for non existing group .
i_return_value =                                              @
   ga_group_exist_get                                         @
      ( s_name,                                               @
        i_flag )
 
dump i_return_value
dump i_flag
 
#  -------------------------------------------------------------------
 
ga_group_groups_get
()
#  Purpose          :  This file gives an example of a call to the
#                      function ga_group_groups_get()
#
#                      This function gets the list of all the groups.
#                      This file opens a database spool.db which has
#                      two groups “default_group”and “fem_model”group.
#                      This file gets the list of all the groups in
#                      the database “spool.db”.
#
#                      Before running this file the database should be
#                      created by running the session file “spool.ses”
#                      To run this session file, first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The ga_group_groups_get has the following arguments:
#  ga_group_groups_get
#     ( group_list )
#  -------------------------------------------------------------------
#  Variable Declaration
#
STRING   s_group_list[32](4)
INTEGER  i_return_value
#  -------------------------------------------------------------------
# opening the existing database spool.db
uil_file_open.go(“spool.db”)
 
i_return_value =                                              @
   ga_group_groups_get                                        @
      ( s_group_list )
 
dump i_return_value
 
# The groups in the opened database are
dump s_group_list
 
#  -------------------------------------------------------------------
 
ga_group_label_get
()
#  Purpose          :  This file gives an example of a call to the
#                      function ga_group_label_get()
#
#                      This function gets the current label flag
#                      associated  with the group.This file opens a
#                      database spool.db which has two groups
#                      “default_group” and “fem_model”group.This file
#                      displays the labeled plot and gets the flag
#                      associated with the labeled plot  for the
#                      default group.Later it sets the current
#                      label flag to ‘no display’ and gets the flag.
#                      This change of setting to ‘no display’ can be
#                      seen on the viewport.
#
#                      Before running this file the database should be
#                      created by running the session file “spool.ses”
#                      To run this session file, first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The ga_group_label_get has the following arguments:
#  ga_group_label_get
#     ( name,
#       flag )
#  -------------------------------------------------------------------
#  Variable Declaration
#
STRING   s_name[32]
INTEGER  i_flag
INTEGER  i_return_value
#  -------------------------------------------------------------------
# opening the existing database spool.db
uil_file_open.go(“spool.db”)
 
uil_viewport_post_groups.posted_groups(“default_viewport”,1,  @
[“default_group”])
coloring_method(2)
 
# s_name = default_group
 s_name = “default_group”
 
ga_group_label_set(s_name,1)
 
# get the label flag
i_return_value =                                              @
   ga_group_label_get                                         @
      ( s_name,                                               @
        i_flag )
 
dump i_return_value
# Label flag is
dump i_flag
 
# Session file paused.Press “Resume” to continue.
sf_pause()
 
# Set the  label flag for no display
ga_group_label_set(s_name,0)
 
# get the  label flag
i_return_value =                                              @
   ga_group_label_get                                         @
      ( s_name,                                               @
        i_flag )
 
dump i_return_value
# Label flag is
dump i_flag
 
#  -------------------------------------------------------------------
 
ga_group_label_set
()
#  Purpose          :  This file gives an example of a call to the
#                      function ga_group_label_set()
#
#                      This function sets the label flag associated
#                      with the group to get whether labels to be
#                      displayed.This file opens a database spool.db
#                      which has two groups “default_group” and
#                      “fem_model”group.This file displays the labeled
#                      plot and gets the flag associated with the
#                      labeled plot  for the default group.Later it
#                      sets the current label flag to ‘no display’ and
#                      gets the flag.This change of setting to
#                      ‘no display’ can be seen on the viewport.
#
#                      Before running this file the database should be
#                      created by running the session file “spool.ses”
#                      To run this session file, first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The ga_group_label_set has the following arguments:
#  ga_group_label_set
#     ( name,
#       flag )
#  -------------------------------------------------------------------
#  Variable Declaration
#
STRING   s_name[32]
INTEGER  i_flag,i_flag_c
INTEGER  i_return_value
#  -------------------------------------------------------------------
# opening the existing database spool.db
uil_file_open.go(“spool.db”)
 
uil_viewport_post_groups.posted_groups(“default_viewport”,1,  @
[“default_group”])
coloring_method(2)
 
# s_name = default_group
 s_name = “default_group”
 
# Set the  label flag for display of labels.
# i_flag = 1
i_flag = 1
i_return_value =                                              @
   ga_group_label_set                                         @
      ( s_name,                                               @
        i_flag )
dump i_return_value
 
# get the label flag
ga_group_label_get                                            @
   ( s_name,                                                  @
     i_flag_c )
 
# Label flag is
dump i_flag_c
 
# Session file paused.Press “Resume” to continue.
sf_pause()
 
# Set the  label flag for no display
# i_flag = 0
i_flag = 0
 
i_return_value =                                              @
   ga_group_label_set                                         @
      ( s_name,                                               @
        i_flag )
dump i_return_value
 
# get the  label flag
ga_group_label_get                                            @
   ( s_name,                                                  @
     i_flag_c )
 
# Label flag is
dump i_flag_c
 
#  -------------------------------------------------------------------
 
ga_group_load_vector_get
()
#  Purpose          :  This file provides an example of a call to the
#                      function ga_group_load_vector_get()
#
#                      This function is used to get the load vector
#                      table associated with a group.This file opens
#                      the database “spool.db” and a load vector table
#                      is created.This table is then associated with 
#                      the group “fem_model” and later the id of the 
#                      vector table associated with the group is got
#                      using above function.
#
#                      Before running this session file run spool.ses
#                      to create spool.db. Follow the instructions in
#                      spool.ses and create spool.op2 and spool.jbr.
#
#                      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 ga_group_load_vector_get()
#  has the following arguments:
#
#  ga_group_load_vector_get
#     (  name,
#        vector_id )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_title[32],s_name[32]
INTEGER  i_comp_vect_flag,i_sym_flag,i_nvectors
INTEGER  ia_vect_ent_types(1), ia_vect_ent_ids(1)
REAL     ra_vect_locs(1),ra_normals(1)
INTEGER  ia_anchor_styles(1),ia_vect_types(1)
INTEGER  ia_vect_colors(1), ia_sub_ids(1)
INTEGER  i_vector_id, i_vector_id_old, i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Create a vector table
s_title = “Load Vector Table”   
i_comp_vect_flag = 0
i_sym_flag = 0
i_nvectors = 1
ia_vect_ent_types(1) = 123      /* from dbtypes.h */
ia_vect_ent_ids(1) =  10
ia_vect_types(1) = 1
ia_anchor_styles(1) = 1
ia_vect_colors(1) = 0
ia_sub_ids(1) = 0
ra_normals(1) = 150.0
 
ga_vector_create                                 @
   (  s_title,                                   @
      i_comp_vect_flag,                          @
      i_sym_flag,                                @
      i_nvectors,                                @
      ia_vect_ent_types,                         @
      ia_vect_ent_ids,                           @
      ra_vect_locs,                              @
      ra_normals,                                @
      ia_vect_types,                             @
      ia_anchor_styles,                          @
      ia_vect_colors,                            @
      ia_sub_ids,                                @
      i_vector_id_old )
 
dump i_vector_id_old
 
#  Associate the vector table with the group “fem_model”
#  s_name = “fem_model”
s_name = “fem_model”
ga_group_load_vector_set                          @ 
   (  s_name,                                     @
      i_vector_id_old )
 
i_return_value =                                  @
   ga_group_load_vector_get                       @ 
      (  s_name,                                  @
         i_vector_id )
 
dump i_return_value
dump i_vector_id
 
ga_vector_delete                                  @
   (  i_vector_id_old )
#---------------------------------------------------------------------
 
ga_group_load_vector_set
()
 
#  Purpose          :  This file provides an example of a call to the
#                      function ga_group_load_vector_set()
#
#                      This function is used to set the load vector
#                      table associated with a group.This file opens
#                      the database “spool.db” and a load vector table
#                      is created.This table is then associated with 
#                      the group “fem_model” and later the id of the 
#                      vector table associated with the group is got
#                      using function ga_group_load_vector_get().
#
#                      Before running this session file run spool.ses
#                      to create spool.db. Follow the instructions in
#                      spool.ses and create spool.op2 and spool.jbr.
#
#                      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 ga_group_load_vector_set()
#  has the following arguments:
#
#  ga_group_load_vector_set
#     (  name,
#        vector_id )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_title[32],s_name[32]
INTEGER  i_comp_vect_flag,i_sym_flag,i_nvectors
INTEGER  ia_vect_ent_types(1), ia_vect_ent_ids(1)
REAL     ra_vect_locs(1),ra_normals(1)
INTEGER  ia_anchor_styles(1),ia_vect_types(1)
INTEGER  ia_vect_colors(1), ia_sub_ids(1)
INTEGER  i_vector_id, i_vector_id_c, i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Create a vector table
s_title = “Load Vector Table”   
i_comp_vect_flag = 0
i_sym_flag = 0
i_nvectors = 1
ia_vect_ent_types(1) = 123      /* from dbtypes.h */
ia_vect_ent_ids(1) =  10
ia_vect_types(1) = 1
ia_anchor_styles(1) = 1
ia_vect_colors(1) = 0
ia_sub_ids(1) = 0
ra_normals(1) = 150.0
 
ga_vector_create                                 @
   (  s_title,                                   @
      i_comp_vect_flag,                          @
      i_sym_flag,                                @
      i_nvectors,                                @
      ia_vect_ent_types,                         @
      ia_vect_ent_ids,                           @
      ra_vect_locs,                              @
      ra_normals,                                @
      ia_vect_types,                             @
      ia_anchor_styles,                          @
      ia_vect_colors,                            @
      ia_sub_ids,                                @
      i_vector_id )
 
dump i_vector_id
 
#  Associate the vector table with the group “fem_model”
#  s_name = “fem_model”
s_name = “fem_model”
i_return_value =                                  @
   ga_group_load_vector_set                       @ 
      (  s_name,                                  @
         i_vector_id )
 
dump i_return_value
 
ga_group_load_vector_get                          @ 
   (  s_name,                                     @
      i_vector_id_c )
 
dump i_vector_id_c
 
ga_vector_delete                                  @
   (  i_vector_id )
#---------------------------------------------------------------------
 
ga_group_load_vector_set
()
#  Purpose          :  This file provides an example of a call to the
#                      function ga_group_load_vector_set()
#
#                      This function is used to set the load vector
#                      table associated with a group.This file opens
#                      the database “spool.db” and a load vector table
#                      is created.This table is then associated with
#                      the group “fem_model” and later the id of the
#                      vector table associated with the group is got
#                      using function ga_group_load_vector_get().
#
#                      Before running this session file run spool.ses
#                      to create spool.db. Follow the instructions in
#                      spool.ses and create spool.op2 and spool.jbr.
#
#                      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 ga_group_load_vector_set()
#  has the following arguments:
#
#  ga_group_load_vector_set
#     (  name,
#        vector_id )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_title[32],s_name[32]
INTEGER  i_comp_vect_flag,i_sym_flag,i_nvectors
INTEGER  ia_vect_ent_types(1), ia_vect_ent_ids(1)
REAL     ra_vect_locs(1),ra_normals(1)
INTEGER  ia_anchor_styles(1),ia_vect_types(1)
INTEGER  ia_vect_colors(1), ia_sub_ids(1)
INTEGER  i_vector_id, i_vector_id_c, i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
 
#  Create a vector table
s_title                 =  “Load Vector Table”
i_comp_vect_flag        =  0
i_sym_flag              =  0
i_nvectors              =  1
 
#  from dbtypes.h
ia_vect_ent_types(1)    =  123
 
ia_vect_ent_ids(1)      =  10
ia_vect_types(1)        =  1
ia_anchor_styles(1)     =  1
ia_vect_colors(1)       =  0
ia_sub_ids(1)           =  0
ra_normals(1)           =  150.0
 
 
i_return_value = ga_vector_create                @
   (  s_title,                                   @
      i_comp_vect_flag,                          @
      i_sym_flag,                                @
      i_nvectors,                                @
      ia_vect_ent_types,                         @
      ia_vect_ent_ids,                           @
      ra_vect_locs,                              @
      ra_normals,                                @
      ia_vect_types,                             @
      ia_anchor_styles,                          @
      ia_vect_colors,                            @
      ia_sub_ids,                                @
      i_vector_id )
 
dump i_return_value
dump i_vector_id
 
#  Associate the vector table with the group “fem_model”
s_name = “fem_model”
i_return_value =                                  @
   ga_group_load_vector_set                       @
      (  s_name,                                  @
         i_vector_id )
 
dump i_return_value
 
i_return_value = ga_group_load_vector_get         @
   (  s_name,                                     @
      i_vector_id_c )
 
dump i_return_value
dump i_vector_id_c
 
#---------------------------------------------------------------------
 
ga_group_load_vector_set
()
 
#  Purpose          :  This file provides an example of a call to the
#                      function ga_group_load_vector_set()
#
#                      This function is used to set the load vector
#                      table associated with a group.This file opens
#                      the database “spool.db” and a load vector table
#                      is created.This table is then associated with
#                      the group “fem_model” and later the id of the
#                      vector table associated with the group is got
#                      using function ga_group_load_vector_get().
#
#                      Before running this session file run spool.ses
#                      to create spool.db. Follow the instructions in
#                      spool.ses and create spool.op2 and spool.jbr.
#
#                      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 ga_group_load_vector_set()
#  has the following arguments:
#
#  ga_group_load_vector_set
#     (  name,
#        vector_id )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_title[32],s_name[32]
INTEGER  i_comp_vect_flag,i_sym_flag,i_nvectors
INTEGER  ia_vect_ent_types(1), ia_vect_ent_ids(1)
REAL     ra_vect_locs(1),ra_normals(1)
INTEGER  ia_anchor_styles(1),ia_vect_types(1)
INTEGER  ia_vect_colors(1), ia_sub_ids(1)
INTEGER  i_vector_id, i_vector_id_c, i_return_value
INTEGER  i_vector_id_b
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
 
#  Create a vector table
s_title                 =  “Load Vector Table”
i_comp_vect_flag        =  0
i_sym_flag              =  0
i_nvectors              =  1
 
#  from dbtypes.h
ia_vect_ent_types(1)    =  123
 
ia_vect_ent_ids(1)      =  10
ia_vect_types(1)        =  1
ia_anchor_styles(1)     =  1
ia_vect_colors(1)       =  0
ia_sub_ids(1)           =  0
ra_normals(1)           =  150.0
 
 
i_return_value = ga_vector_create                @
   (  s_title,                                   @
      i_comp_vect_flag,                          @
      i_sym_flag,                                @
      i_nvectors,                                @
      ia_vect_ent_types,                         @
      ia_vect_ent_ids,                           @
      ra_vect_locs,                              @
      ra_normals,                                @
      ia_vect_types,                             @
      ia_anchor_styles,                          @
      ia_vect_colors,                            @
      ia_sub_ids,                                @
      i_vector_id )
 
dump i_return_value
dump i_vector_id
 
# Create a second vector table, changing
# only the name.
s_title                 =  “Vector Table II”
 
i_return_value = ga_vector_create                @
   (  s_title,                                   @
      i_comp_vect_flag,                          @
      i_sym_flag,                                @
      i_nvectors,                                @
      ia_vect_ent_types,                         @
      ia_vect_ent_ids,                           @
      ra_vect_locs,                              @
      ra_normals,                                @
      ia_vect_types,                             @
      ia_anchor_styles,                          @
      ia_vect_colors,                            @
      ia_sub_ids,                                @
      i_vector_id_b )
 
dump i_return_value
dump i_vector_id_b
 
 
#  Associate the first vector table with the
#  group “fem_model”
 
s_name = “fem_model”
 
i_return_value =                                  @
   ga_group_load_vector_set                       @
      (  s_name,                                  @
         i_vector_id )
 
dump i_return_value
 
# Delete the original vector table associated
# with the group.
dump i_vector_id
IF ( (i_return_value == 0) && (i_vector_id > 1) ) THEN
 
   i_return_value = ga_vector_delete              @
      ( (i_vector_id - 1) )
 
   dump i_return_value
 
END IF
 
#  Associate the second vector table with the
#  group “fem_model”
 
s_name = “fem_model”
 
i_return_value =                                  @
   ga_group_load_vector_set                       @
      (  s_name,                                  @
         i_vector_id_b )
 
dump i_return_value
 
# Delete the first created vector table which is
# no longer associated with the group.
dump i_vector_id_b
IF ( (i_return_value == 0) && (i_vector_id_b > 1) ) THEN
 
   i_return_value = ga_vector_delete              @
      ( (i_vector_id_b - 1) )
 
   dump i_return_value
 
END IF
 
i_return_value = ga_group_load_vector_get         @
   (  s_name,                                     @
      i_vector_id_c )
 
dump i_return_value
dump i_vector_id_c
 
 
#---------------------------------------------------------------------
 
ga_group_nentities_get
()
#  Purpose          :  This file gives an example of a call to the
#                      function ga_group_nentities_get()
#
#                      This function gets the number of entities of a
#                      particular type contained in a specific group.
#                      This file opens a database spool.db which has
#                      two groups “default_group”and “fem_model”group.
#                      The fem_model group has 600 node entities and
#                      576 element entities.This file gets the no of
#                      entities of a type node in the fem_model group.
#
#                      Before running this file the database should be
#                      created by running the session file “spool.ses”
#                      To run this session file, first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The ga_group_nentities_get has the following arguments:
#  ga_group_nentities_get
#     ( name,
#       type,
#       number )
#  -------------------------------------------------------------------
#  Variable Declaration
#
STRING   s_name[32]
INTEGER  i_type,i_number
INTEGER  i_return_value
#  -------------------------------------------------------------------
# opening the existing database spool.db
uil_file_open.go(“spool.db”)
 
# s_name = “fem_model”
s_name = “fem_model”
 
# i_type = 123 (For entity node from dbtypes.h)
i_type = 123
 
i_return_value =                                              @
   ga_group_nentities_get                                     @
      ( s_name,                                               @
        i_type,                                               @
        i_number )
 
dump i_return_value
# The number of node entities in  group fem_model are
dump i_number
 
#  -------------------------------------------------------------------
 
ga_group_node_deform_set
()
#  Purpose          :  This file provides an example of a call to the
#                      function ga_group_node_deform_set()
#
#                      This function changes the current deform table
#                      associated with a group.This file opens the
#                      database “spool.ses” and creates a node deform
#                      table and associates this table with the
#                      fem_model group.
#
#                      Before running this session file run spool.ses
#                      to create spool.db. Follow the instructions in
#                      spool.ses and create spool.op2 and spool.jbr.
#
#                      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 ga_group_node_deform_set()
#  has the following arguments:
#
#  ga_group_node_deform_set
#     (  name,
#        deform_id )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_title[80]
INTEGER  i_nbr_nodes
INTEGER  i_ncases, iv_lcids(VIRTUAL),iv_nsub(VIRTUAL)
INTEGER  iv_node_ids(VIRTUAL)
REAL     rv_deform(VIRTUAL)
INTEGER  i_dtype,ia_minloc(6),ia_maxloc(6), ia_resids(5)
INTEGER  i_deform_id
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db” and read the deformation results
sf_play(“spool_res_deform.ses”)
 
#  Get the number of Load cases and their IDs
res_utl_get_loadcases(i_ncases,iv_lcids,iv_nsub)
 
#  Extract the deformation results from the database
#  Load case ID        = iv_lcids(1)
#  Sub case ID         = 1
#  Primary Result ID   = 2 ( Corresponds to deformation )
#  Secondary Result ID = 1
#  Layer ID            = 1
#  node_list           = “Node 1:#” (All nodes )
#  derivation          = ““
#  coord_id            = ““
ia_resids(1) = iv_lcids(1)
ia_resids(2) = 1
ia_resids(3) = 2
ia_resids(4) = 1
ia_resids(5) = 1
res_utl_extract_nodal_results(ia_resids,” Node 1:#”,””,””,       @
   i_dtype,i_nbr_nodes,iv_node_ids,rv_deform,ia_minloc,ia_maxloc)
 
#  Create a node deformation table
s_title =” Deformation Result”
ga_node_deform_create                             @
   (  s_title,                                    @
      i_nbr_nodes,                                @
      iv_node_ids,                                @
      rv_deform,                                  @
      i_deform_id )
 
dump i_return_value
dump i_deform_id
 
#  Associate this deform table with the fem_model group.
i_return_value =                                  @
   ga_group_node_deform_set                       @
      (  “fem_model”,                             @
         i_deform_id )
 
dump i_return_value
 
sys_free_array(iv_node_ids)
sys_free_array(rv_deform)
sys_free_array(iv_lcids)
sys_free_array(iv_nsub)
#---------------------------------------------------------------------
 
ga_group_node_deform_set
()
#  Purpose          :  This file provides an example of a call to the
#                      function ga_group_node_deform_set()
#
#                      This function changes the current deform table
#                      associated with a group.This file opens the
#                      database “spool.ses” and creates a node deform
#                      table and associates this table with the
#                      fem_model group.
#
#                      Before running this session file run spool.ses
#                      to create spool.db. Follow the instructions in
#                      spool.ses and create spool.op2 and spool.jbr.
#
#                      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 ga_group_node_deform_set()
#  has the following arguments:
#
#  ga_group_node_deform_set
#     (  name,
#        deform_id )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_title[80]
INTEGER  i_nbr_nodes
INTEGER  i_ncases, iv_lcids(VIRTUAL),iv_nsub(VIRTUAL)
INTEGER  iv_node_ids(VIRTUAL)
REAL     rv_deform(VIRTUAL)
INTEGER  i_dtype,ia_minloc(6),ia_maxloc(6), ia_resids(5)
INTEGER  i_deform_id
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db” and read the deformation results
sf_play(“spool_res_deform.ses”)
 
#  Get the number of Load cases and their IDs
i_return_value = res_utl_get_loadcases(i_ncases,iv_lcids,iv_nsub)
 
dump i_return_value
 
#  Extract the deformation results from the database
#  Load case ID        = iv_lcids(1)
#  Sub case ID         = 1
#  Primary Result ID   = 2 ( Corresponds to deformation )
#  Secondary Result ID = 1
#  Layer ID            = 1
#  node_list           = “Node 1:#” (All nodes )
#  derivation          = ““
#  coord_id            = ““
ia_resids(1) = iv_lcids(1)
ia_resids(2) = 1
ia_resids(3) = 2
ia_resids(4) = 1
ia_resids(5) = 1
 
i_return_value = res_utl_extract_nodal_results    @
   (ia_resids,” Node 1:#”,””,””,                  @
   i_dtype,i_nbr_nodes,iv_node_ids,rv_deform,     @
   ia_minloc,ia_maxloc)
 
dump i_return_value
 
#  Create a node deformation table
s_title =” Deformation Result”
i_return_value = ga_node_deform_create            @
   (  s_title,                                    @
      i_nbr_nodes,                                @
      iv_node_ids,                                @
      rv_deform,                                  @
      i_deform_id )
 
dump i_return_value
dump i_deform_id
 
#  Associate this deform table with the fem_model group.
i_return_value =                                  @
   ga_group_node_deform_set                       @
      (  “fem_model”,                             @
         i_deform_id )
 
dump i_return_value
 
sys_free_array(iv_node_ids)
sys_free_array(rv_deform)
sys_free_array(iv_lcids)
sys_free_array(iv_nsub)
#---------------------------------------------------------------------
 
ga_group_precision_get
()
#  Purpose          :  This file gives an example of a call to the
#                      function ga_group_precision_get()
#
#                      This function gets the current precision flag
#                      associated  with the group.This file opens a
#                      database spool.db which has two groups
#                      “default_group” and “fem_model”group.This file
#                      displays the precision plot and gets the flag
#                      associated  with the precision plot for the
#                      default group.Later it sets the current
#                      precision flag to ‘no precision’ and gets the
#                      flag.This function is used along with the style
#                      of plot.e.g. shaded/smooth uses high precision
#                      (1) and shaded/flat uses fast(0).
#
#                      Before running this file the database should be
#                      created by running the session file “spool.ses”
#                      To run this session file, first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The ga_group_precision_get has the following arguments:
#  ga_group_precision_get
#     ( name,
#       flag )
#  -------------------------------------------------------------------
#  Variable Declaration
#
STRING   s_name[32]
INTEGER  i_flag
INTEGER  i_return_value
#  -------------------------------------------------------------------
# opening the existing database spool.db
uil_file_open.go(“spool.db”)
 
uil_viewport_post_groups.posted_groups(“default_viewport”,1,  @
[“default_group”])
coloring_method(2)
 
# s_name = default_group
 s_name = “default_group”
 
ga_group_style_set(s_name,”SHADED”)
 
# The change of precision will show the change in the viewport.
ga_group_precision_set(s_name,1)
 
# get the precision flag
i_return_value =                                              @
   ga_group_precision_get                                     @
      ( s_name,                                               @
        i_flag )
 
dump i_return_value
# Precision flag is
dump i_flag
 
# Session file paused.Press “Resume” to continue.
sf_pause()
 
# Set the  precision flag for no display
ga_group_precision_set(s_name,0)
 
# get the  precision flag
i_return_value =                                              @
   ga_group_precision_get                                     @
      ( s_name,                                               @
        i_flag )
 
dump i_return_value
 
# Precision flag is
dump i_flag
 
ga_group_style_set(s_name,”WIREFRAME”)
 
#  -------------------------------------------------------------------
 
ga_group_result_vector_get
()
#  Purpose          :  This file provides an example of a call to the
#                      function ga_group_result_vector_get()
#
#                      This function is used to set the load vector
#                      table associated with a group.This file opens
#                      the database “spool.db” and deformation results
#                      are read from the database and a table is
#                      created.This table is then associated with the
#                      group “fem_model” and later the id of the 
#                      vector table associated with the group is got
#                      using above function.
#
#                      Before running this session file run spool.ses
#                      to create spool.db. Follow the instructions in
#                      spool.ses and create spool.op2 and spool.jbr.
#
#                      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 ga_group_result_vector_get()
#  has the following arguments:
#
#  ga_group_result_vector_get
#     (  name,
#        vector_id )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_title[32],s_name[32]
INTEGER  i_ncases, i_nbr_nodes, i_index
INTEGER  iv_lcids(VIRTUAL),iv_nsub(VIRTUAL), iv_node_ids(VIRTUAL)
REAL     rv_deform(VIRTUAL)
INTEGER  i_dtype,ia_minloc(6),ia_maxloc(6), ia_resids(5)
INTEGER  i_comp_vect_flag,i_sym_flag,i_nvectors
INTEGER  iv_vect_ent_types(VIRTUAL), iv_vect_ent_ids(VIRTUAL)
REAL     rv_vect_locs(VIRTUAL)
INTEGER  iv_vect_types(VIRTUAL), iv_anchor_styles(VIRTUAL)
INTEGER  iv_vect_colors(VIRTUAL), iv_sub_ids(VIRTUAL)
INTEGER  i_vector_id_old, i_vector_id,i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)
 
#  Get the number of Load cases and their IDs
res_utl_get_loadcases(i_ncases,iv_lcids,iv_nsub)
 
#  Extract the stress results from the database
#  Load case ID        = iv_lcids(1)
#  Sub case ID         = 1
#  Primary Result ID   = 2 ( Corresponds to deformation ) 
#  Secondary Result ID = 1
#  Layer ID            = 1
#  node_list           = “Node 1:#” (All nodes )
#  derivation          = ““
#  coord_id            = ““
ia_resids(1) = iv_lcids(1)
ia_resids(2) = 1
ia_resids(3) = 3
ia_resids(4) = 1
ia_resids(5) = 2
res_utl_extract_nodal_results(ia_resids,” Node 1:#”,””,””,          @
   i_dtype,i_nbr_nodes,iv_node_ids,rv_deform,ia_minloc,ia_maxloc)
 
#  Create a vector table
s_title = “Vector Table”   
i_comp_vect_flag = 0
i_sym_flag = 0
i_nvectors = i_nbr_nodes
 
sys_allocate_array(iv_vect_ent_types,1,i_nvectors)
sys_allocate_array(iv_vect_ent_ids,1,i_nvectors)
sys_allocate_array(rv_vect_locs,1,i_nvectors,1,3)
sys_allocate_array(iv_vect_types,1,i_nvectors)
sys_allocate_array(iv_anchor_styles,1,i_nvectors)
sys_allocate_array(iv_vect_colors,1,i_nvectors)
sys_allocate_array(iv_sub_ids,1,i_nvectors)
 
FOR(i_index = 1 TO i_nvectors)
   iv_vect_ent_types(i_index) = 123      /* from dbtypes.h */
   iv_vect_ent_ids(i_index) = iv_node_ids(i_index)
   iv_vect_types(i_index) = 1
   iv_anchor_styles(i_index) = 1
   iv_vect_colors(i_index) = 0
   iv_sub_ids(i_index) = 0
END FOR
 
ga_vector_create                                 @
   (  s_title,                                   @
      i_comp_vect_flag,                          @
      i_sym_flag,                                @
      i_nvectors,                                @
      iv_vect_ent_types,                         @
      iv_vect_ent_ids,                           @
      rv_vect_locs,                              @
      rv_deform,                                 @
      iv_vect_types,                             @
      iv_anchor_styles,                          @
      iv_vect_colors,                            @
      iv_sub_ids,                                @
      i_vector_id_old )
 
dump i_vector_id_old
 
#  Associate the vector table with the group “fem_model”
#  s_name = “fem_model”
s_name = “fem_model”
ga_group_result_vector_set                        @ 
   (  s_name,                                     @
      i_vector_id_old )
 
i_return_value =                                  @
   ga_group_result_vector_get                     @ 
      (  s_name,                                  @
         i_vector_id )
 
dump i_return_value
dump i_vector_id
 
ga_vector_delete                                  @
   (  i_vector_id_old )
 
sys_free_array(iv_vect_ent_types)
sys_free_array(iv_vect_ent_ids)
sys_free_array(rv_vect_locs)
sys_free_array(iv_vect_types)
sys_free_array(iv_anchor_styles)
sys_free_array(iv_vect_colors)
sys_free_array(iv_sub_ids)
sys_free_array(iv_lcids)
sys_free_array(iv_nsub)
sys_free_array(iv_node_ids)
sys_free_array(rv_deform)
#---------------------------------------------------------------------
 
ga_group_result_vector_get
()
#  Purpose          :  This file provides an example of a call to the
#                      function ga_group_result_vector_get()
#
#                      This function is used to set the load vector
#                      table associated with a group.This file opens
#                      the database “spool.db” and deformation results
#                      are read from the database and a table is
#                      created.This table is then associated with the
#                      group “fem_model” and later the id of the
#                      vector table associated with the group is got
#                      using above function.
#
#                      Before running this session file run spool.ses
#                      to create spool.db. Follow the instructions in
#                      spool.ses and create spool.op2 and spool.jbr.
#
#                      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 ga_group_result_vector_get()
#  has the following arguments:
#
#  ga_group_result_vector_get
#     (  name,
#        vector_id )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_title[32],s_name[32]
INTEGER  i_ncases, i_nbr_nodes, i_index
INTEGER  iv_lcids(VIRTUAL),iv_nsub(VIRTUAL), iv_node_ids(VIRTUAL)
REAL     rv_deform(VIRTUAL)
INTEGER  i_dtype,ia_minloc(6),ia_maxloc(6), ia_resids(5)
INTEGER  i_comp_vect_flag,i_sym_flag,i_nvectors
INTEGER  iv_vect_ent_types(VIRTUAL), iv_vect_ent_ids(VIRTUAL)
REAL     rv_vect_locs(VIRTUAL)
INTEGER  iv_vect_types(VIRTUAL), iv_anchor_styles(VIRTUAL)
INTEGER  iv_vect_colors(VIRTUAL), iv_sub_ids(VIRTUAL)
INTEGER  i_vector_id_old, i_vector_id,i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)
 
#  Get the number of Load cases and their IDs
i_return_value = res_utl_get_loadcases(i_ncases,iv_lcids,iv_nsub)
 
dump i_return_value
 
#  Extract the stress results from the database
#  Load case ID        = iv_lcids(1)
#  Sub case ID         = 1
#  Primary Result ID   = 2 ( Corresponds to deformation )
#  Secondary Result ID = 1
#  Layer ID            = 1
#  node_list           = “Node 1:#” (All nodes )
#  derivation          = ““
#  coord_id            = ““
ia_resids(1) = iv_lcids(1)
ia_resids(2) = 1
ia_resids(3) = 3
ia_resids(4) = 1
ia_resids(5) = 2
i_return_value = res_utl_extract_nodal_results   @
   (ia_resids,” Node 1:#”,””,””,                 @
   i_dtype,i_nbr_nodes,iv_node_ids,rv_deform,    @
   ia_minloc,ia_maxloc)
 
#  Create a vector table
s_title           =  “Vector Table”
i_comp_vect_flag  =  0
i_sym_flag        =  0
i_nvectors        =  i_nbr_nodes
 
sys_allocate_array(iv_vect_ent_types,1,i_nvectors)
sys_allocate_array(iv_vect_ent_ids,1,i_nvectors)
sys_allocate_array(rv_vect_locs,1,i_nvectors,1,3)
sys_allocate_array(iv_vect_types,1,i_nvectors)
sys_allocate_array(iv_anchor_styles,1,i_nvectors)
sys_allocate_array(iv_vect_colors,1,i_nvectors)
sys_allocate_array(iv_sub_ids,1,i_nvectors)
 
FOR(i_index = 1 TO i_nvectors)
   iv_vect_ent_types(i_index)    = 123      /* from dbtypes.h */
   iv_vect_ent_ids(i_index)      = iv_node_ids(i_index)
   iv_vect_types(i_index)        = 1
   iv_anchor_styles(i_index)     = 1
   iv_vect_colors(i_index)       = 0
   iv_sub_ids(i_index)           = 0
END FOR
 
i_return_value = ga_vector_create                @
   (  s_title,                                   @
      i_comp_vect_flag,                          @
      i_sym_flag,                                @
      i_nvectors,                                @
      iv_vect_ent_types,                         @
      iv_vect_ent_ids,                           @
      rv_vect_locs,                              @
      rv_deform,                                 @
      iv_vect_types,                             @
      iv_anchor_styles,                          @
      iv_vect_colors,                            @
      iv_sub_ids,                                @
      i_vector_id_old )
 
dump i_return_value
dump i_vector_id_old
 
#  Associate the vector table with the group “fem_model”
#  s_name = “fem_model”
s_name = “fem_model”
i_return_value = ga_group_result_vector_set       @
   (  s_name,                                     @
      i_vector_id_old )
 
dump i_return_value
 
i_return_value =                                  @
   ga_group_result_vector_get                     @
      (  s_name,                                  @
         i_vector_id )
 
dump i_return_value
dump i_vector_id
 
sys_free_array(iv_vect_ent_types)
sys_free_array(iv_vect_ent_ids)
sys_free_array(rv_vect_locs)
sys_free_array(iv_vect_types)
sys_free_array(iv_anchor_styles)
sys_free_array(iv_vect_colors)
sys_free_array(iv_sub_ids)
sys_free_array(iv_lcids)
sys_free_array(iv_nsub)
sys_free_array(iv_node_ids)
sys_free_array(rv_deform)
 
#---------------------------------------------------------------------
 
ga_group_result_vector_set
()
#  Purpose          :  This file provides an example of a call to the
#                      function ga_group_result_vector_set()
#
#                      This function is used to set the load vector
#                      table associated with a group.This file opens
#                      the database “spool.db” and deformation results
#                      are read from the database and a table is
#                      created.This table is then associated with the
#                      group “fem_model” and later the id of the 
#                      vector table associated with the group is got
#                      using function ga_group_result_vector_get().
#
#                      Before running this session file run spool.ses
#                      to create spool.db. Follow the instructions in
#                      spool.ses and create spool.op2 and spool.jbr.
#
#                      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 ga_group_result_vector_set()
#  has the following arguments:
#
#  ga_group_result_vector_set
#     (  name,
#        vector_id )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_title[32],s_name[32]
INTEGER  i_ncases, i_nbr_nodes, i_index
INTEGER  iv_lcids(VIRTUAL),iv_nsub(VIRTUAL), iv_node_ids(VIRTUAL)
REAL     rv_deform(VIRTUAL)
INTEGER  i_dtype,ia_minloc(6),ia_maxloc(6), ia_resids(5)
INTEGER  i_comp_vect_flag,i_sym_flag,i_nvectors
INTEGER  iv_vect_ent_types(VIRTUAL), iv_vect_ent_ids(VIRTUAL)
REAL     rv_vect_locs(VIRTUAL)
INTEGER  iv_vect_types(VIRTUAL), iv_anchor_styles(VIRTUAL)
INTEGER  iv_vect_colors(VIRTUAL), iv_sub_ids(VIRTUAL)
INTEGER  i_vector_id, i_vector_id_c, i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)
 
#  Get the number of Load cases and their IDs
res_utl_get_loadcases(i_ncases,iv_lcids,iv_nsub)
 
#  Extract the stress results from the database
#  Load case ID        = iv_lcids(1)
#  Sub case ID         = 1
#  Primary Result ID   = 2 ( Corresponds to deformation ) 
#  Secondary Result ID = 1
#  Layer ID            = 1
#  node_list           = “Node 1:#” (All nodes )
#  derivation          = ““
#  coord_id            = ““
ia_resids(1) = iv_lcids(1)
ia_resids(2) = 1
ia_resids(3) = 3
ia_resids(4) = 1
ia_resids(5) = 2
res_utl_extract_nodal_results(ia_resids,” Node 1:#”,””,””,          @
   i_dtype,i_nbr_nodes,iv_node_ids,rv_deform,ia_minloc,ia_maxloc)
 
#  Create a vector table
s_title = “Vector Table”   
i_comp_vect_flag = 0
i_sym_flag = 0
i_nvectors = i_nbr_nodes
 
sys_allocate_array(iv_vect_ent_types,1,i_nvectors)
sys_allocate_array(iv_vect_ent_ids,1,i_nvectors)
sys_allocate_array(rv_vect_locs,1,i_nvectors,1,3)
sys_allocate_array(iv_vect_types,1,i_nvectors)
sys_allocate_array(iv_anchor_styles,1,i_nvectors)
sys_allocate_array(iv_vect_colors,1,i_nvectors)
sys_allocate_array(iv_sub_ids,1,i_nvectors)
 
FOR(i_index = 1 TO i_nvectors)
   iv_vect_ent_types(i_index) = 123      /* from dbtypes.h */
   iv_vect_ent_ids(i_index) = iv_node_ids(i_index)
   iv_vect_types(i_index) = 1
   iv_anchor_styles(i_index) = 1
   iv_vect_colors(i_index) = 0
   iv_sub_ids(i_index) = 0
END FOR
 
ga_vector_create                                 @
   (  s_title,                                   @
      i_comp_vect_flag,                          @
      i_sym_flag,                                @
      i_nvectors,                                @
      iv_vect_ent_types,                         @
      iv_vect_ent_ids,                           @
      rv_vect_locs,                              @
      rv_deform,                                 @
      iv_vect_types,                             @
      iv_anchor_styles,                          @
      iv_vect_colors,                            @
      iv_sub_ids,                                @
      i_vector_id )
 
dump i_vector_id
 
#  Associate the vector table with the group “fem_model”
#  s_name = “fem_model”
s_name = “fem_model”
i_return_value =                                  @
   ga_group_result_vector_set                     @ 
      (  s_name,                                  @
         i_vector_id )
 
dump i_return_value
 
ga_group_result_vector_get                        @ 
   (  s_name,                                     @
      i_vector_id_c )
 
dump i_vector_id_c
 
ga_vector_delete                                  @
   (  i_vector_id )
 
sys_free_array(iv_vect_ent_types)
sys_free_array(iv_vect_ent_ids)
sys_free_array(rv_vect_locs)
sys_free_array(iv_vect_types)
sys_free_array(iv_anchor_styles)
sys_free_array(iv_vect_colors)
sys_free_array(iv_sub_ids)
sys_free_array(iv_lcids)
sys_free_array(iv_nsub)
sys_free_array(iv_node_ids)
sys_free_array(rv_deform)
#---------------------------------------------------------------------
 
ga_group_result_vector_set
()
#  Purpose          :  This file provides an example of a call to the
#                      function ga_group_result_vector_set()
#
#                      This function is used to set the load vector
#                      table associated with a group.This file opens
#                      the database “spool.db” and deformation results
#                      are read from the database and a table is
#                      created.This table is then associated with the
#                      group “fem_model” and later the id of the
#                      vector table associated with the group is got
#                      using function ga_group_result_vector_get().
#
#                      Before running this session file run spool.ses
#                      to create spool.db. Follow the instructions in
#                      spool.ses and create spool.op2 and spool.jbr.
#
#                      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 ga_group_result_vector_set()
#  has the following arguments:
#
#  ga_group_result_vector_set
#     (  name,
#        vector_id )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_title[32],s_name[32]
INTEGER  i_ncases, i_nbr_nodes, i_index
INTEGER  iv_lcids(VIRTUAL),iv_nsub(VIRTUAL), iv_node_ids(VIRTUAL)
REAL     rv_deform(VIRTUAL)
INTEGER  i_dtype,ia_minloc(6),ia_maxloc(6), ia_resids(5)
INTEGER  i_comp_vect_flag,i_sym_flag,i_nvectors
INTEGER  iv_vect_ent_types(VIRTUAL), iv_vect_ent_ids(VIRTUAL)
REAL     rv_vect_locs(VIRTUAL)
INTEGER  iv_vect_types(VIRTUAL), iv_anchor_styles(VIRTUAL)
INTEGER  iv_vect_colors(VIRTUAL), iv_sub_ids(VIRTUAL)
INTEGER  i_vector_id, i_vector_id_c, i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)
 
#  Get the number of Load cases and their IDs
i_return_value = res_utl_get_loadcases(i_ncases,iv_lcids,iv_nsub)
 
dump i_return_value
 
#  Extract the stress results from the database
#  Load case ID        = iv_lcids(1)
#  Sub case ID         = 1
#  Primary Result ID   = 2 ( Corresponds to deformation )
#  Secondary Result ID = 1
#  Layer ID            = 1
#  node_list           = “Node 1:#” (All nodes )
#  derivation          = ““
#  coord_id            = ““
ia_resids(1) = iv_lcids(1)
ia_resids(2) = 1
ia_resids(3) = 3
ia_resids(4) = 1
ia_resids(5) = 2
i_return_value = res_utl_extract_nodal_results(ia_resids,” Node 1:#”,””,””,          @
   i_dtype,i_nbr_nodes,iv_node_ids,rv_deform,ia_minloc,ia_maxloc)
 
dump i_return_value
 
#  Create a vector table
s_title = “Vector Table”
i_comp_vect_flag = 0
i_sym_flag = 0
i_nvectors = i_nbr_nodes
 
sys_allocate_array(iv_vect_ent_types,1,i_nvectors)
sys_allocate_array(iv_vect_ent_ids,1,i_nvectors)
sys_allocate_array(rv_vect_locs,1,i_nvectors,1,3)
sys_allocate_array(iv_vect_types,1,i_nvectors)
sys_allocate_array(iv_anchor_styles,1,i_nvectors)
sys_allocate_array(iv_vect_colors,1,i_nvectors)
sys_allocate_array(iv_sub_ids,1,i_nvectors)
 
FOR(i_index = 1 TO i_nvectors)
   iv_vect_ent_types(i_index) = 123      /* from dbtypes.h */
   iv_vect_ent_ids(i_index) = iv_node_ids(i_index)
   iv_vect_types(i_index) = 1
   iv_anchor_styles(i_index) = 1
   iv_vect_colors(i_index) = 0
   iv_sub_ids(i_index) = 0
END FOR
 
i_return_value = ga_vector_create                @
   (  s_title,                                   @
      i_comp_vect_flag,                          @
      i_sym_flag,                                @
      i_nvectors,                                @
      iv_vect_ent_types,                         @
      iv_vect_ent_ids,                           @
      rv_vect_locs,                              @
      rv_deform,                                 @
      iv_vect_types,                             @
      iv_anchor_styles,                          @
      iv_vect_colors,                            @
      iv_sub_ids,                                @
      i_vector_id )
 
dump i_return_value
dump i_vector_id
 
#  Associate the vector table with the group “fem_model”
#  s_name = “fem_model”
s_name = “fem_model”
i_return_value =                                  @
   ga_group_result_vector_set                     @
      (  s_name,                                  @
         i_vector_id )
 
dump i_return_value
 
i_return_value = ga_group_result_vector_get       @
   (  s_name,                                     @
      i_vector_id_c )
 
dump i_return_value
dump i_vector_id_c
 
sys_free_array(iv_vect_ent_types)
sys_free_array(iv_vect_ent_ids)
sys_free_array(rv_vect_locs)
sys_free_array(iv_vect_types)
sys_free_array(iv_anchor_styles)
sys_free_array(iv_vect_colors)
sys_free_array(iv_sub_ids)
sys_free_array(iv_lcids)
sys_free_array(iv_nsub)
sys_free_array(iv_node_ids)
sys_free_array(rv_deform)
 
#---------------------------------------------------------------------
 
ga_group_selectable_get
()
#  Purpose          :  This file gives an example of a call to the
#                      function ga_group_selectable_get()
#
#                      This function gets the current selectable flag
#                      associated  with the group.This file opens a
#                      database spool.db which has two groups
#                      “default_group” and “fem_model”group.This file
#                      displays the selectable plot and gets the flag
#                      associated with the  plot  for the default
#                      group.Later it sets the current selectable flag
#                      to ‘unselect’ and gets the flag.This change of
#                      setting can be identified by cursor selecting
#                      any entity before and after the setting.
#
#                      Before running this file the database should be
#                      created by running the session file “spool.ses”
#                      To run this session file, first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The ga_group_label_get has the following arguments:
#  ga_group_label_get
#     ( name,
#       flag )
#  -------------------------------------------------------------------
#  Variable Declaration
#
STRING   s_name[32]
INTEGER  i_flag
INTEGER  i_return_value
#  -------------------------------------------------------------------
# opening the existing database spool.db
uil_file_open.go(“spool.db”)
 
uil_viewport_post_groups.posted_groups(“default_viewport”,1,  @
[“default_group”])
coloring_method(2)
 
# s_name = default_group
 s_name = “default_group”
 
ga_group_selectable_set(s_name,1)
 
# get the selectable flag
i_return_value =                                              @
   ga_group_selectable_get                                    @
      ( s_name,                                               @
        i_flag )
 
dump i_return_value
# Selectable flag is
dump i_flag
 
# Observe that the entities can be cursor selected
# by using “Group”,”Modify” pulldown menu.
 
# Session file paused.Press “Resume” to continue.
sf_pause()
 
# Set the  selectable flag for unselecting entities.
ga_group_selectable_set(s_name,0)
 
# get the  selectable flag
i_return_value =                                              @
   ga_group_selectable_get                                    @
      ( s_name,                                               @
        i_flag )
 
dump i_return_value
# Selectable flag is
dump i_flag
 
# Observe that the entities cannot be cursor selected
# by using “Group”,”Modify” pulldown menu.
 
# Session file paused.Press “Resume” to continue.
sf_pause()
 
ga_group_selectable_set(s_name,1)
 
#  -------------------------------------------------------------------
 
ga_group_selectable_set
()
#  Purpose          :  This file gives an example of a call to the
#                      function ga_group_selectable_set()
#
#                      This function gets the current selectable flag
#                      associated  with the group.This file opens a
#                      database spool.db which has two groups
#                      “default_group” and “fem_model”group.This file
#                      displays the selectable plot and gets the flag
#                      associated with the  plot  for the default
#                      group.Later it sets the current selectable flag
#                      to ‘unselect’ and gets the flag.This change of
#                      setting can be identified by cursor selecting
#                      any entity before and after the setting.
#
#                      Before running this file the database should be
#                      created by running the session file “spool.ses”
#                      To run this session file, first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The ga_group_label_set has the following arguments:
#  ga_group_label_set
#     ( name,
#       flag )
#  -------------------------------------------------------------------
#  Variable Declaration
#
STRING   s_name[32]
INTEGER  i_flag,i_flag_c
INTEGER  i_return_value
#  -------------------------------------------------------------------
# opening the existing database spool.db
uil_file_open.go(“spool.db”)
 
uil_viewport_post_groups.posted_groups(“default_viewport”,1,  @
[“default_group”])
coloring_method(2)
 
# s_name = default_group
 s_name = “default_group”
 
# i_flag = 1
i_flag = 1
 
# Set the selectable flag
i_return_value =                                              @
   ga_group_selectable_set                                    @
      ( s_name,                                               @
        i_flag )
 
dump i_return_value
 
# Get the selectable flag
ga_group_selectable_get(s_name,i_flag_c)
 
# Selectable flag is
dump i_flag_c
 
# Observe that the entities can be cursor selected
# by using “Group”,”Modify” pulldown menu.
 
# Session file paused.Press “Resume” to continue.
sf_pause()
 
# Set the  selectable flag for unselecting entities.
# i_flag = 0
i_flag = 0
 
i_return_value =                                              @
   ga_group_selectable_set                                    @
      ( s_name,                                               @
        i_flag )
 
dump i_return_value
 
# get the  selectable flag
ga_group_selectable_get(s_name,i_flag_c)
 
# Selectable flag is
dump i_flag_c
 
# Observe that the entities cannot be cursor selected
# by using “Group”,”Modify” pulldown menu.
 
# Session file paused.Press “Resume” to continue.
sf_pause()
 
ga_group_selectable_set(s_name,1)
 
#  -------------------------------------------------------------------
 
ga_group_style_get
()
#  Purpose          :  This file gives an example of a call to the
#                      function ga_group_style_get()
#
#                      This function gets the current render style
#                      associated  with the group.This file opens a
#                      database spool.db which has two groups
#                      “default_group” and “fem_model”group.This file
#                      displays the wireframe plot and gets the style
#                      associated with the wireframe plot  for the
#                      default group.Later it sets the plot to
#                      “shaded” and gets the style.The  change of
#                      setting from wireframe to shaded can seen on
#                      the viewport.
#
#                      Before running this file the database should be
#                      created by running the session file “spool.ses”
#                      To run this session file, first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The ga_group_style_get has the following arguments:
#  ga_group_style_get
#     ( name,
#       style )
#  -------------------------------------------------------------------
#  Variable Declaration
#
STRING   s_name[32],s_style[32]
INTEGER  i_return_value
#  -------------------------------------------------------------------
# opening the existing database spool.db
uil_file_open.go(“spool.db”)
 
uil_viewport_post_groups.posted_groups(“default_viewport”,1,  @
[“default_group”])
coloring_method(2)
 
# s_name = default_group
 s_name = “default_group”
 
# set the style to wire frame.
ga_group_style_set(s_name,”WIREFRAME”)
 
# get the render style
i_return_value =                                              @
   ga_group_style_get                                         @
      ( s_name,                                               @
        s_style )
 
dump i_return_value
# Render style is
dump s_style
 
# Session file paused.Press “Resume” to continue.
sf_pause()
 
# Change  the  render  style to SHADED
ga_group_style_set(s_name,”SHADED”)
 
# get the  render style
i_return_value =                                              @
   ga_group_style_get                                         @
      ( s_name,                                               @
        s_style )
 
dump i_return_value
# Render style is
dump s_style
 
# Session file paused.Press “Resume” to continue.
sf_pause()
 
# reset the style to wireframe.
ga_group_style_set(s_name,”WIREFRAME”)
 
#  -------------------------------------------------------------------
 
ga_group_style_set
()
#  Purpose          :  This file gives an example of a call to the
#                      function ga_group_style_set()
#
#                      This function  modifies the  render style
#                      associated  with the group.This file opens a
#                      database spool.db which has two groups
#                      “default_group” and “fem_model”group.This file
#                      displays the wireframe plot and gets the style
#                      associated with the wireframe plot  for the
#                      default group.Later it sets the plot to
#                      “shaded” and gets the style.The  change of
#                      setting from wireframe to shaded can seen on
#                      the viewport.
#
#                      Before running this file the database should be
#                      created by running the session file “spool.ses”
#                      To run this session file, first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The ga_group_style_set has the following arguments:
#  ga_group_style_set
#     ( name,
#       style )
#  -------------------------------------------------------------------
#  Variable Declaration
#
STRING   s_name[32],s_style[32],s_style_c[32]
INTEGER  i_return_value
#  -------------------------------------------------------------------
# opening the existing database spool.db
uil_file_open.go(“spool.db”)
uil_viewport_post_groups.posted_groups(“default_viewport”,1,  @
[“default_group”])
coloring_method(2)
 
# s_name = default_group
 s_name = “default_group”
 
# set the style to wire frame.
# s_style = “WIREFRAME”
s_style = “WIREFRAME”
 
i_return_value =                                              @
   ga_group_style_set                                         @
      (s_name,                                                @
       s_style )
 
dump i_return_value
 
# get the render style
ga_group_style_get                                            @
   ( s_name,                                                  @
     s_style_c )
 
# Render style is
dump s_style_c
 
# Session file paused.Press “Resume” to continue.
sf_pause()
 
# Change  the  render  style to SHADED
# s_style = “SHADED”
s_style = “SHADED”
 
i_return_value =                                              @
   ga_group_style_set                                         @
      (s_name,                                                @
       s_style )
 
dump i_return_value
 
# get the  render style
ga_group_style_get                                            @
   ( s_name,                                                  @
     s_style_c )
 
# Render style is
dump s_style_c
 
# Session file paused.Press “Resume” to continue.
sf_pause()
 
# reset the style to wireframe.
ga_group_style_set(s_name,”WIREFRAME”)
 
#  -------------------------------------------------------------------
ga_group_vector_load_get
()
#  Purpose          :  This file gives an example of a call to the
#                      function ga_group_vector_load_get()
#
#                      This function gets the load vector flag
#                      associated  with the group.This file opens a
#                      database spool.db which has two groups
#                      “default_group” and “fem_model”group.This file
#                      displays the load vector plot and gets the flag
#                      associated with load vector plot for the
#                      default group.Later it sets the  load vector
#                      plot flag to ‘no display’ and gets the flag.
#                      This change of setting to ‘no display’ can be
#                      seen on the viewport.
#
#                      Before running this file the database should be
#                      created by running the session file “spool.ses”
#                      To run this session file, first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The ga_group_vector_load_get has the following arguments:
#  ga_group_vector_load_get
#     ( name,
#       flag )
#  -------------------------------------------------------------------
#  Variable Declaration
#
STRING   s_name[32]
INTEGER  i_flag
INTEGER  i_return_value
#  -------------------------------------------------------------------
# opening a existing database spool.db
uil_file_open.go(“spool.db”)
 
uil_viewport_post_groups.posted_groups(“default_viewport”,1,  @
[“default_group”])
coloring_method(2)
 
# Displaying the load vectors
loadsbcs_plot_markers( [“20_psi”], [“default_group”])
 
# s_name = default_group
 s_name = “default_group”
 
# Get the load vector flag
i_return_value =                                              @
   ga_group_vector_load_get                                   @
      ( s_name,                                               @
        i_flag )
 
dump i_return_value
# Load vector flag is
dump i_flag
 
# Session file paused.Press “Resume” to continue.
sf_pause()
 
# Set the  load vector plot for no display
ga_group_vector_load_set(s_name,0)
 
# Get the load vector flag
i_return_value =                                              @
   ga_group_vector_load_get                                   @
      ( s_name,                                               @
        i_flag )
 
dump i_return_value
# Load vector flag is
dump i_flag
 
#  -------------------------------------------------------------------
 
ga_group_vector_load_set
()
#  Purpose          :  This file gives an example of a call to the
#                      function ga_group_load_result_set()
#
#                      This function sets the load vector flag
#                      associated  with the group.This file opens a
#                      database  spool.db which has two groups
#                      “default_group” and “fem_model”group.This file
#                      displays load vector plot and gets the flag
#                      associated with load vector plot for default
#                      group.Later it sets the load vector plot flag
#                      to ‘no display’ and gets the flag.This change
#                      of setting to ‘no display’ can be seen on the
#                      viewport.
#
#                      Before running this file the database should be
#                      created by running the session file “spool.ses”
#                      To run this session file, first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The ga_group_vector_load_set has the following arguments:
#  ga_group_vector_load_set
#     ( name,
#       flag )
#  -------------------------------------------------------------------
#  Variable Declaration
#
STRING   s_name[32]
INTEGER  i_flag,i_flag_c
INTEGER  i_return_value
#  -------------------------------------------------------------------
# opening the existing database spool.db
uil_file_open.go(“spool.db”)
 
uil_viewport_post_groups.posted_groups(“default_viewport”,1,  @
[“default_group”])
coloring_method(2)
 
# Displaying the load vectors
loadsbcs_plot_markers( [“20_psi”], [“default_group”])
 
# s_name=default_group
 s_name = “default_group”
 
# get the load vector flag
ga_group_vector_load_get                                      @
   ( s_name,                                                  @
     i_flag_c )
 
# Check the load vector flag
dump i_flag_c
 
# Session file paused.Press “Resume” to continue.
sf_pause()
 
# Set the  load vector plot for no display
# i_flag = 0
i_flag = 0
i_return_value =                                              @
   ga_group_vector_load_set                                   @
      ( s_name,                                               @
        i_flag )
 
dump i_return_value
 
# get the load vector flag
ga_group_vector_load_get                                      @
   ( s_name,                                                  @
     i_flag_c )
 
#Check the load vector flag
dump i_flag_c
 
#  -------------------------------------------------------------------
 
ga_group_vector_result_get
()
#  Purpose          :  This file gives an example of a call to the 
#                      function ga_group_vector_result_get()
#                      
#                      This function gets the result vector flag 
#                      associated  with the group.This file plays
#                      the session file ‘spool_res_vector.ses’ which
#                      displays the result vector plot.It then gets
#                      the flag associated with result vector plot. 
#                      Later it sets the  result vector plot flag to 
#                      ‘no display’ and gets the flag.This change of
#                      setting to ‘no display’ can be seen on the
#                      viewport.
#
#                      Before running this session file run spool.ses
#                      to create ‘spool.db’.Follow the instructions in
#                      spool.ses and create spool.op2 and spool.jbr.
#
#                      To run this session file, first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The ga_group_vector_result_get has the following arguments:
#  ga_group_vector_result_get
#     ( name,
#       flag )
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
STRING   s_name[32]
INTEGER  i_flag
INTEGER  i_return_value
#  -------------------------------------------------------------------
#  Open the database “spool.db” and reads the results.
sf_play(“spool_res_vector.ses”)
 
coloring_method(2)
# s_name = fem_model
s_name = “fem_model”
 
#  Get the result vector flag
i_return_value =                                              @
   ga_group_vector_result_get                                 @
      ( s_name,                                               @
        i_flag )
 
dump i_return_value
 
#  Result vector flag is 
dump i_flag
 
#  Session file paused. Press “Resume” to continue..
sf_pause()
 
#  Set the  result vector plot for no display
ga_group_vector_result_set(s_name,0)
 
#  Get the result vector flag
i_return_value =                                              @
   ga_group_vector_result_get                                 @
      ( s_name,                                               @
        i_flag )
 
dump i_return_value
 
#  Result vector flag is 
dump i_flag
#  -------------------------------------------------------------------
 
ga_group_vector_result_get
()
#  Purpose          :  This file gives an example of a call to the
#                      function ga_group_vector_result_get()
#
#                      This function gets the result vector flag
#                      associated  with the group.This file plays
#                      the session file ‘spool_res_vector.ses’ which
#                      displays the result vector plot.It then gets
#                      the flag associated with result vector plot.
#                      Later it sets the  result vector plot flag to
#                      ‘no display’ and gets the flag.This change of
#                      setting to ‘no display’ can be seen on the
#                      viewport.
#
#                      Before running this session file run spool.ses
#                      to create ‘spool.db’.Follow the instructions in
#                      spool.ses and create spool.op2 and spool.jbr.
#
#                      To run this session file, first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The ga_group_vector_result_get has the following arguments:
#  ga_group_vector_result_get
#     ( name,
#       flag )
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
STRING   s_name[32]
INTEGER  i_flag, i_method
INTEGER  i_return_value
INTEGER  i_preference_id, i_data_type, i_preference
LOGICAL  l_preference
REAL     r_preference
STRING   s_preference[32]
#  -------------------------------------------------------------------
#  Open the database “spool.db” and reads the results.
sf_play(“spool_res_vector.ses”)
 
i_preference_id      =  501
i_data_type          =  1
 
# The i_preference value is the “method”
i_preference         =  2
 
# These arguments can be set to anything as
# they are not used with i_data_type set to 1.
l_preference         =  TRUE
r_preference         =  2.0
s_preference         =  “empty”
 
i_return_value = db_set_pref (i_preference_id, i_data_type,   @
   i_preference, l_preference, r_preference, s_preference)
 
# s_name = fem_model
s_name = “fem_model”
 
#  Get the result vector flag
i_return_value =                                              @
   ga_group_vector_result_get                                 @
      ( s_name,                                               @
        i_flag )
 
dump i_return_value
 
#  The result vector flag should be set to 1.
#  It’s current value is:
dump i_flag
 
#  Set the  result vector plot for no display
i_return_value = ga_group_vector_result_set(s_name,0)
 
dump i_return_value
 
#  Get the result vector flag
i_return_value =                                              @
   ga_group_vector_result_get                                 @
      ( s_name,                                               @
        i_flag )
 
dump i_return_value
 
#  The result vector flag should be set to 0.
#  It’s current value is:
dump i_flag
 
#  -------------------------------------------------------------------
 
ga_group_vector_result_set
()
 
#  Purpose          :  This file gives an example of a call to the 
#                      function ga_group_vector_result_set()
#                      
#                      This function sets the result vector flag 
#                      associated  with the group.This file plays
#                      the session file ‘spool_res_vector.ses’ which
#                      displays result vector plot.It then gets the 
#                      flag associated with result vector plot for 
#                      Later it sets the result vector plot flag to
#                      ‘no display’ and gets the flag.This change of
#                      setting to ‘no display’ can be seen on the
#                      viewport.
#
#                      Before running this session file run spool.ses
#                      to create ‘spool.db’.Follow the instructions in
#                      spool.ses and create spool.op2 and spool.jbr.
#
#                      To run this session file, first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The ga_group_vector_result_set has the following arguments:
#  ga_group_vector_result_set
#     ( name,
#       flag )
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
STRING   s_name[32]
INTEGER  i_flag,i_flag_c
INTEGER  i_return_value
#  -------------------------------------------------------------------
#  Open the database “spool.db” and reads the results.
sf_play(“spool_res_vector.ses”)
 
coloring_method(2)
#  s_name=fem_model 
s_name = “fem_model”
 
#  Get the result vector flag
ga_group_vector_result_get                                    @
   ( s_name,                                                  @
     i_flag_c )
 
#  Check the result vector flag
dump i_flag_c
 
#  Session file paused. Press “Resume” to continue..
sf_pause()
 
#  Set the  result vector plot for no display
# i_flag = 0
i_flag = 0
i_return_value =                                              @
   ga_group_vector_result_set                                 @
      ( s_name,                                               @
        i_flag )
 
dump i_return_value
 
#  Get the result vector flag
ga_group_vector_result_get                                    @
   ( s_name,                                                  @
     i_flag_c )
 
#  Check the result vector flag  
dump i_flag_c
#  -------------------------------------------------------------------
 
ga_group_vector_result_set
()
#  Purpose          :  This file gives an example of a call to the
#                      function ga_group_vector_result_set()
#
#                      This function sets the result vector flag
#                      associated  with the group.This file plays
#                      the session file ‘spool_res_vector.ses’ which
#                      displays result vector plot.It then gets the
#                      flag associated with result vector plot for
#                      Later it sets the result vector plot flag to
#                      ‘no display’ and gets the flag.This change of
#                      setting to ‘no display’ can be seen on the
#                      viewport.
#
#                      Before running this session file run spool.ses
#                      to create ‘spool.db’.Follow the instructions in
#                      spool.ses and create spool.op2 and spool.jbr.
#
#                      To run this session file, first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The ga_group_vector_result_set has the following arguments:
#  ga_group_vector_result_set
#     ( name,
#       flag )
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
STRING   s_name[32]
INTEGER  i_flag, i_method
INTEGER  i_return_value
INTEGER  i_preference_id, i_data_type, i_preference
LOGICAL  l_preference
REAL     r_preference
STRING   s_preference[32]
#  -------------------------------------------------------------------
#  Open the database “spool.db” and reads the results.
sf_play(“spool_res_vector.ses”)
 
i_preference_id      =  501
i_data_type          =  1
 
# The i_preference value is the “method”
i_preference         =  2
 
# These arguments can be set to anything as
# they are not used with i_data_type set to 1.
l_preference         =  TRUE
r_preference         =  2.0
s_preference         =  “empty”
 
i_return_value = db_set_pref (i_preference_id, i_data_type,   @
   i_preference, l_preference, r_preference, s_preference)
 
# s_name = fem_model
s_name = “fem_model”
 
#  Get the result vector flag
i_return_value =                                              @
   ga_group_vector_result_get                                 @
      ( s_name,                                               @
        i_flag )
 
dump i_return_value
 
#  The result vector flag should be set to 1.
#  It’s current value is:
dump i_flag
 
#  Set the  result vector plot for no display
i_return_value = ga_group_vector_result_set(s_name,0)
 
dump i_return_value
 
#  Get the result vector flag
i_return_value =                                              @
   ga_group_vector_result_get                                 @
      ( s_name,                                               @
        i_flag )
 
dump i_return_value
 
#  The result vector flag should be set to 0.
#  It’s current value is:
dump i_flag
 
#  -------------------------------------------------------------------
 
ga_groups_load_vector_set
()
#  Purpose          :  This file provides an example of a call to the
#                      function ga_groups_load_vector_set()
#
#                      This function is used to set the load vector
#                      table associated with multiple groups.This file
#                      opens the database “spool.db” and a load vector
#                      table is created.This table is then associated 
#                      with both the groups in the “spool.db” database
#                      i.e. “fem_model” and “default_group”.Later 
#                      the id of the vector table associated with both
#                      the groups is got using function ga_group_load_
#                      vector_get().
#
#                      Before running this session file run spool.ses
#                      to create spool.db. Follow the instructions in
#                      spool.ses and create spool.op2 and spool.jbr.
#
#                      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 ga_groups_load_vector_set()
#  has the following arguments:
#
#  ga_groups_load_vector_set
#     (  ngroups,
#        group_ids,
#        vector_id )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_title[32],s_name[32]
INTEGER  i_ngroups, ia_group_ids(2)
INTEGER  i_comp_vect_flag,i_sym_flag,i_nvectors
INTEGER  ia_vect_ent_types(1), ia_vect_ent_ids(1)
REAL     ra_vect_locs(1),ra_normals(1)
INTEGER  ia_anchor_styles(1),ia_vect_types(1)
INTEGER  ia_vect_colors(1), ia_sub_ids(1)
INTEGER  i_vector_id, i_vector_id_c, i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Create a vector table
s_title = “Load Vector Table”   
i_comp_vect_flag = 0
i_sym_flag = 0
i_nvectors = 1
ia_vect_ent_types(1) = 123      /* from dbtypes.h */
ia_vect_ent_ids(1) =  10
ia_vect_types(1) = 1
ia_anchor_styles(1) = 1
ia_vect_colors(1) = 0
ia_sub_ids(1) = 0
ra_normals(1) = 150.0
 
ga_vector_create                                 @
   (  s_title,                                   @
      i_comp_vect_flag,                          @
      i_sym_flag,                                @
      i_nvectors,                                @
      ia_vect_ent_types,                         @
      ia_vect_ent_ids,                           @
      ra_vect_locs,                              @
      ra_normals,                                @
      ia_vect_types,                             @
      ia_anchor_styles,                          @
      ia_vect_colors,                            @
      ia_sub_ids,                                @
      i_vector_id )
 
dump i_vector_id
 
#  Associate the vector table with the groups “default_group”
#  and “fem_model”
#  i_ngroups = 2
i_ngroups = 2
#  ia_group_ids = [1,2]
ia_group_ids = [1,2]
i_return_value =                                  @
   ga_groups_load_vector_set                      @ 
      (  i_ngroups,                               @
         ia_group_ids,                            @
         i_vector_id )
 
dump i_return_value
 
#  Check for association of vector table with the default group
#  s_name = “default_group”
s_name = “default_group”
ga_group_load_vector_get                          @ 
   (  s_name,                                     @
      i_vector_id_c )
 
dump i_vector_id_c
 
#  Check for association of vector table with the fem_model group
#  s_name = “fem_model”
s_name = “fem_model”
ga_group_load_vector_get                          @ 
   (  s_name,                                     @
      i_vector_id_c )
 
dump i_vector_id_c
 
ga_vector_delete                                  @
   (  i_vector_id )
#---------------------------------------------------------------------
 
ga_groups_load_vector_set
()
#  Purpose          :  This file provides an example of a call to the
#                      function ga_groups_load_vector_set()
#
#                      This function is used to set the load vector
#                      table associated with multiple groups.This file
#                      opens the database “spool.db” and a load vector
#                      table is created.This table is then associated
#                      with both the groups in the “spool.db” database
#                      i.e. “fem_model” and “default_group”.Later
#                      the id of the vector table associated with both
#                      the groups is got using function ga_group_load_
#                      vector_get().
#
#                      Before running this session file run spool.ses
#                      to create spool.db. Follow the instructions in
#                      spool.ses and create spool.op2 and spool.jbr.
#
#                      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 ga_groups_load_vector_set()
#  has the following arguments:
#
#  ga_groups_load_vector_set
#     (  ngroups,
#        group_ids,
#        vector_id )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_title[32],s_name[32]
INTEGER  i_ngroups, ia_group_ids(2)
INTEGER  i_comp_vect_flag,i_sym_flag,i_nvectors
INTEGER  ia_vect_ent_types(1), ia_vect_ent_ids(1)
REAL     ra_vect_locs(1),ra_normals(1)
INTEGER  ia_anchor_styles(1),ia_vect_types(1)
INTEGER  ia_vect_colors(1), ia_sub_ids(1)
INTEGER  i_vector_id, i_vector_id_c, i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Create a vector table
s_title = “Load Vector Table”
i_comp_vect_flag = 0
i_sym_flag = 0
i_nvectors = 1
ia_vect_ent_types(1) = 123      /* from dbtypes.h */
ia_vect_ent_ids(1) =  10
ia_vect_types(1) = 1
ia_anchor_styles(1) = 1
ia_vect_colors(1) = 0
ia_sub_ids(1) = 0
ra_normals(1) = 150.0
 
i_return_value = ga_vector_create                @
   (  s_title,                                   @
      i_comp_vect_flag,                          @
      i_sym_flag,                                @
      i_nvectors,                                @
      ia_vect_ent_types,                         @
      ia_vect_ent_ids,                           @
      ra_vect_locs,                              @
      ra_normals,                                @
      ia_vect_types,                             @
      ia_anchor_styles,                          @
      ia_vect_colors,                            @
      ia_sub_ids,                                @
      i_vector_id )
 
dump i_return_value
dump i_vector_id
 
#  Associate the vector table with the groups “default_group”
#  and “fem_model”
#  i_ngroups = 2
i_ngroups = 2
#  ia_group_ids = [1,2]
ia_group_ids = [1,2]
i_return_value =                                  @
   ga_groups_load_vector_set                      @
      (  i_ngroups,                               @
         ia_group_ids,                            @
         i_vector_id )
 
dump i_return_value
 
#  Check for association of vector table with the default group
#  s_name = “default_group”
s_name = “default_group”
i_return_value = ga_group_load_vector_get         @
   (  s_name,                                     @
      i_vector_id_c )
 
dump i_return_value
dump i_vector_id_c
 
#  Check for association of vector table with the fem_model group
#  s_name = “fem_model”
s_name = “fem_model”
i_return_value = ga_group_load_vector_get         @
   (  s_name,                                     @
      i_vector_id_c )
 
dump i_return_value
dump i_vector_id_c
 
#---------------------------------------------------------------------
 
get_orphan_elements
()
#  Purpose          :  This file gives an example of a call to the 
#                      function count_orphan_elements()
#                      
#                      This function is used to get the list  of 
#                      element entities that do not belong to any 
#                      of the groups.This file opens a database 
#                      spool.db.This database has two groups 
#                      “default”group and “fem_model” group.The 
#                      fem_model group has 600 node entities and
#                      576 element entities.Element 1 to 250 is
#                      removed from the fem_model group and the 
#                      orphan elements are got for in this file.
#           
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      To run this session file,first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The get_orphan_elements has the following arguments:
#  get_orphan_elements
#     ( count,
#       idlist )
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
INTEGER  i_count,i_grp_id,i_idlist( VIRTUAL )
STRING   s_name[32] 
INTEGER  i_return_value
#  -------------------------------------------------------------------
#
# opening a existing database spool.db 
uil_file_open.go(“spool.db”)
 
# Now remove the elements 1 to 250  from group group two ( fem_model)
i_grp_id = 2
db_get_group_name( i_grp_id,s_name )
ga_group_entity_remove( s_name,”Element 1:250” )
 
# check the database for orphan elements
 
count_orphan_elements                                          @
   ( i_count )
#
# Allocate memory
SYS_ALLOCATE_ARRAY( i_idlist,1,i_count)
 
# list the orphan elements
 
i_return_value =                                               @
   get_orphan_elements                                         @
      ( i_count,                                               @
        i_idlist )
 
dump i_return_value
# The list of orphan elements
dump i_idlist
 
ga_group_entity_add( s_name,”Element 1:250” )
SYS_FREE_ARRAY(i_idlist )
 
#  -------------------------------------------------------------------
 
get_orphan_nodes
()
#  Purpose          :  This file gives an example of a call to the 
#                      function count_orphan_nodes()
#                      
#                      This function is used to get the list  of node 
#                      entities that do not belong to any of the
#                      groups.This file opens a database spool.db
#                      This database has two groups “default”group
#                      and “fem_model” group. The fem_model group 
#                      has 600 node entities and 576 element entities
#                      Node 1 to 300 are removed from the fem_model
#                      group and the orphan nodes are got for in this 
#                      file.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      To run this session file,first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The get_orphan_nodes has the following arguments:
#  get_orphan_nodes
#     ( count,
#       idlist )
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
INTEGER  i_count,i_grp_id,i_idlist( VIRTUAL )
STRING   s_name[32] 
INTEGER  i_return_value
#  -------------------------------------------------------------------
#
# opening a existing database spool.db 
uil_file_open.go(“spool.db”)
 
 
# Now remove the nodes 1 to 300  from  group two ( fem_model)
i_grp_id = 2
db_get_group_name( i_grp_id,s_name )
ga_group_entity_remove( s_name,”Node 1:300” )
 
 
# check the database for orphan Nodes
 
count_orphan_nodes                                             @
   ( i_count )
#
# Allocate memory
SYS_ALLOCATE_ARRAY( i_idlist,1,i_count)
 
# list the orphan nodes 
 
i_return_value =                                               @
   get_orphan_nodes                                            @
      ( i_count,                                               @
        i_idlist )
 
dump i_return_value
# The list of orphan  nodes
dump i_idlist
 
ga_group_entity_add( s_name,”Node 1:300” )
SYS_FREE_ARRAY( i_idlist )
 
#  -------------------------------------------------------------------
 
sgm_db_count_iges_in_group
()
#  Purpose          :  This file gives an example of a call to the
#                      function sgm_db_count_iges_in_group()
#
#                      This function counts all the IGES entity types
#                      in a group.There are fifteen IGES entity types
#                      that can be counted.
#
#                      This file opens a database spool.db which has
#                      two groups “default_group” and “fem_model”group
#                      This file counts for all the IGES entity types
#                      in the default group.The default group has six
#                      surface of revolution IGES entity type.
#
#                      Before running this file the database should be
#                      created by running the session file “spool.ses”
#                      To run this session file,first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The sgm_db_count_iges_in_group has the following arguments:
#  sgm_db_count_iges_in_group
#     ( groupid,
#       count )
#  -------------------------------------------------------------------
#  Variable Declaration
#
INTEGER   i_groupid,i_count(15)
INTEGER   i_return_value
#  -----------------------------------------------------------------
# opening the existing database spool.db
uil_file_open.go(“spool.db”)
 
# i_groupid = 1 (default  group)
i_groupid = 1
 
# check the database for IGES entities in default group.
i_return_value =                                              @
   sgm_db_count_iges_in_group                                 @
      ( i_groupid,                                            @
        i_count )
#
dump i_return_value
 
# the number of IGES entity type in default  group  are
dump i_count
 
#  -------------------------------------------------------------------
sgm_db_get_iges_in_group
()
#  Purpose          :  This file gives an example of a call to the
#                      function sgm_db_get_iges_in_group()
#
#                      This function gets the entity ids of a
#                      particular IGES entity type in a group.There
#                      are fifteen IGES entity types.
#
#                      This file opens a database spool.db which has
#                      two groups “default_group” and “fem_model”group
#                      This file counts for all the IGES entity types
#                      in the default group.The default group has six
#                      surface of revolution IGES entity type.Then the
#                      file gets the entity ids for the surface of
#                      revolution entity type.
#
#                      Before running this file the database should be
#                      created by running the session file “spool.ses”
#                      To run this session file,first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The sgm_db_get_iges_in_group has the following arguments:
#  sgm_db_get_iges_in_group
#     ( groupid,
#       typecode,
#       entityids )
#  -------------------------------------------------------------------
#  Variable Declaration
#
INTEGER   i_groupid,i_typecode,i_count(15)
INTEGER   i_entityids( VIRTUAL)
INTEGER   i_return_value
#  -----------------------------------------------------------------
# opening the existing database spool.db
uil_file_open.go(“spool.db”)
 
# i_groupid = 1 (default  group)
i_groupid = 1
 
# check the database for IGES entities in default group.
sgm_db_count_iges_in_group                                    @
   ( i_groupid,                                               @
     i_count )
 
# Allocate memory
# i_count(12) is the count of  surface of revolution IGES entity.
SYS_ALLOCATE_ARRAY(i_entityids,1,i_count(12))
 
#i_typecode=1004 (Type code for surface of revolution entity).
i_typecode = 1004
 
# Get the ids of surface of revolution IGES entity.
i_return_value =                                              @
   sgm_db_get_iges_in_group                                   @
      ( i_groupid,                                            @
        i_typecode,                                           @
        i_entityids )
#
dump i_return_value
 
# The ids of the surface of revolution  IGES entity type are
dump i_entityids
 
SYS_FREE_ARRAY(i_entityids)
 
#  -------------------------------------------------------------------
 
sgm_db_get_iges_in_group
()
#  Purpose          :  This file gives an example of a call to the
#                      function sgm_db_get_iges_in_group()
#
#                      This function gets the entity ids of a
#                      particular IGES entity type in a group.There
#                      are fifteen IGES entity types.
#
#                      This file opens a database spool.db which has
#                      two groups “default_group” and “fem_model”group
#                      This file counts for all the IGES entity types
#                      in the default group.The default group has six
#                      surface of revolution IGES entity type.Then the
#                      file gets the entity ids for the surface of
#                      revolution entity type.
#
#                      Before running this file the database should be
#                      created by running the session file “spool.ses”
#                      To run this session file,first start
#                      a session of MSC Patran,then run this session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The sgm_db_get_iges_in_group has the following arguments:
#  sgm_db_get_iges_in_group
#     ( groupid,
#       typecode,
#       entityids )
#  -------------------------------------------------------------------
#  Variable Declaration
#
INTEGER   i_groupid,i_typecode,i_count(15), i_item_count
INTEGER   i_entityids( VIRTUAL)
INTEGER   i_return_value
#  -----------------------------------------------------------------
# opening the existing database spool.db
uil_file_open.go(“spool.db”)
 
# i_groupid = 1 (default  group)
i_groupid = 1
 
# check the database for IGES entities in default group.
sgm_db_count_iges_in_group                                    @
   ( i_groupid,                                               @
     i_count )
 
# Allocate memory
# i_count(12) is the count of  surface of revolution IGES entity.
SYS_ALLOCATE_ARRAY(i_entityids,1,i_count(12))
 
#i_typecode=1004 (Type code for surface of revolution entity).
i_typecode = 1004
 
# Get the ids of surface of revolution IGES entity.
i_return_value =                                              @
   sgm_db_get_iges_in_group                                   @
      ( i_groupid,                                            @
        i_typecode,                                           @
        i_entityids,                                          @
        i_item_count )
#
dump i_item_count
dump i_entityids
 
dump i_return_value
 
# The ids of the surface of revolution  IGES entity type are
dump i_entityids
 
SYS_FREE_ARRAY(i_entityids)
 
#  -------------------------------------------------------------------
 
uil_entity_group_members_get
()
#  Purpose          :  This file gives an example of a call to the 
#                      function uil_entity_group_members_get()
#
#                      This function gives the members of a particular
#                      group having a specific entity type.This file
#                      opens database spool.db which has two groups
#                      “default group” and “fem_model”group .The 
#                      fem_model group has 600 node entities and 576
#                      element entities.This file gets the group 
#                      members of entity node type from the fem_model
#                      group.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      To run this session file,first start
#                      a session of MSC Patran,then run the session
#                      file by “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The uil_entity_group_members_get  has the following arguments:
#  uil_entity_group_members_get 
#     ( group,
#       entity_type,
#       members )
#
#  -------------------------------------------------------------------
#  Variable Declaration
#
INTEGER  i_entity_type,i_grp_id
STRING   s_group[32]
STRING   s_members[VIRTUAL]
INTEGER  i_return_value
 
#  -------------------------------------------------------------------
#  open the existing database spool.db
 
uil_file_open.go(“spool.db”)
 
 
#i_entity_type = 123 (node)
i_entity_type = 123
 
# Allocate memory
SYS_ALLOCATE_STRING( s_members,32)
 
db_get_current_group_id                                           @
   ( i_grp_id )
 
 
db_get_group_name                                                 @
   ( i_grp_id,                                                    @
     s_group )   
 
i_return_value =                                                  @
   uil_entity_group_members_get                                   @
      ( s_group,                                                  @
        i_entity_type,                                            @
        s_members )
 
dump i_return_value
# gets the group members of node type from fem_model group.
dump s_members 
 
SYS_FREE_STRING(s_members)
#  -------------------------------------------------------------------