Tutorial Toolkit Code Examples > Geometry > 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.
 
app_db_get_ref_cid
()
#  Purpose          :  This file provides an example of a call to the
#                      function app_db_get_ref_cid()
#
#                      This function gets the default reference 
#                      coordinate frame from the database.This file
#                      opens a new database and creates three 
#                      coordinate frames i.e rectangular, cylindrical
#                      and spherical.Later it gets the default
#                      reference coordinate. MSC Patran has Coord 0 as
#                      the default global rectangular coordinate 
#                      frame. 
#
#                      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 app_db_get_ref_cid()
#  has the following arguments:
#
#  app_db_get_ref_cid
#     (  domesg,
#        cord_frame )
#
#---------------------------------------------------------------------
#  Variable Declarations
LOGICAL  l_domesg
STRING   sv_asm_create_cord_created_ids[VIRTUAL]
STRING   s_cord_frame[32]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Create Rectangular,Cylindrical and Spherical coordinate frames
#  respectively. 
asm_const_coord_3point( “100”, “Coord 0”, 1, “[0 0 0]”, “[0 0 1]”, @
“[1 0 0]”, sv_asm_create_cord_created_ids )
asm_const_coord_3point( “200”, “Coord 0”, 2, “[1 1 1]”, “[1 1 2]”, @
“[2 1 1]”, sv_asm_create_cord_created_ids )
asm_const_coord_3point( “300”, “Coord 0”, 3, “[2 2 2]”, “[2 2 3]”, @
“[3 2 2]”, sv_asm_create_cord_created_ids )
 
#  l_domesg = TRUE
l_domesg = TRUE
 
i_return_value =                                  @
   app_db_get_ref_cid                             @
      (  l_domesg,                                @
         s_cord_frame )
 
dump i_return_value
 
#  Default reference coordinate frame is
dump s_cord_frame
 
SYS_FREE_STRING(sv_asm_create_cord_created_ids)
#---------------------------------------------------------------------
 
asm_const_curve_2d_arc2point_v2
()
#  Purpose          :  This file provides an example of a call to the
#                      function asm_const_curve_2d_arc2point_v2()
#
#                      This function creates an arc from two points
#                      and center point or from start, end point and
#                      radius. 
#
#                      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 asm_const_curve_2d_arc2point_v2()
#  has the following arguments:
#
#  asm_const_curve_2d_arc2point_v2
#     (  output_ids,
#        num_curve,
#        arc_method,
#        radius,
#        create_center,
#        flip_center_point,
#        arc_angle,
#        plane_list,
#        center_point_list,
#        start_point_list,
#        end_point_list,
#        project_flag,
#        created_ids )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_output_ids[16]
INTEGER  i_num_curve
INTEGER  i_arc_method
REAL     r_radius
LOGICAL  l_create_center
LOGICAL  l_flip_center_point
INTEGER  i_arc_angle
STRING   s_plane_list[16]
STRING   s_center_point_list[16]
STRING   s_start_point_list[16]
STRING   s_end_point_list[16]
LOGICAL  l_project_flag
STRING   sv_created_ids[VIRTUAL]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
#---------------------------------------------------------------------
#  Variable Initialization
s_output_ids        = "1"
i_num_curve         = 2
i_arc_method        = 1
r_radius            = 0.0
l_create_center     = TRUE
l_flip_center_point = TRUE
i_arc_angle         = 1
s_plane_list        = "Coord 0.3"
s_center_point_list = "[0 0 0]" 
s_start_point_list  = "[1 0 0]"
s_end_point_list    = "[0 1 0]"
l_project_flag      = TRUE
#---------------------------------------------------------------------
#  Creating two curves in plane parallel to X-Y plane passing through
#  start point, center point and the end point.
 
i_return_value =                                 @
   asm_const_curve_2d_arc2point_v2               @
      (  s_output_ids,                           @
         i_num_curve,                            @
         i_arc_method,                           @
         r_radius,                               @
         l_create_center,                        @
         l_flip_center_point,                    @
         i_arc_angle,                            @
         s_plane_list,                           @
         s_center_point_list,                    @
         s_start_point_list,                     @
         s_end_point_list,                       @
         l_project_flag,                         @
         sv_created_ids )
dump i_return_value
dump sv_created_ids
 
sys_free_string(sv_created_ids)
#---------------------------------------------------------------------
 
asm_const_curve_2d_arc3point_v1
()
#  Purpose          :  This file provides an example of a call to the
#                      function asm_const_curve_2d_arc3point_v1()
#
#                      This function creates an arc-shaped or 
#                      parametric cubic curve in two dimensional 
#                      space, defined by a start point, midpoint 
#                      and an end point.
#
#                      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 asm_const_curve_2d_arc3point_v1()
#  has the following arguments:
#
#  sgm_const_curve_2d_arc3point_v1
#     (  output_ids,
#        num_curve,
#        create_center,
#        plane_list,
#        start_list,
#        mid_list,
#        end_list,
#        project_flag,
#        created_ids )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_output_ids[16]
INTEGER  i_num_curve
LOGICAL  l_create_center
STRING   s_plane_list[16]
STRING   s_start_list[16]
STRING   s_mid_list[16]
STRING   s_end_list[16]
LOGICAL  l_project_flag
STRING   sv_created_ids[VIRTUAL]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
#---------------------------------------------------------------------
#  Variable Initialization.
s_output_ids        = "1"
i_num_curve         = 1
l_create_center = TRUE
s_plane_list    = "Coord 0.3"
s_start_list    = "[0 0 1]"
s_mid_list      = "[1 4 1]"
s_end_list      = "[3 3 0]"
l_project_flag  =  TRUE
#---------------------------------------------------------------------
#  Creating two curves in plane from three points.
 
i_return_value =                                 @
   asm_const_curve_2d_arc3point_v1               @
      (  s_output_ids,                           @
         i_num_curve,                            @
         l_create_center,                        @
         s_plane_list,                           @
         s_start_list,                           @
         s_mid_list,                             @
         s_end_list,                             @
         l_project_flag,                         @
         sv_created_ids )
dump i_return_value
dump sv_created_ids
 
sys_free_string(sv_created_ids)
#---------------------------------------------------------------------
 
asm_const_curve_2d_circle_v1
()
#  Purpose          :  This file provides an example of a call to the
#                      function asm_const_curve_2d_circle_v1()
#
#                      This session file will create a new database by
#                      name "new.db" and call the above mentioned
#                      function and create two circles.
#
#                      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 asm_const_curve_2d_circle_v1()
#  has the following arguments:
#
#  asm_const_curve_2d_circle_v1
#     (  output_ids,
#        num_curves,
#        radius_method,
#        radius,
#        plane_list,
#        radius_point_list,
#        center_point_list,
#        project_flag,
#        created_ids )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_output_ids[16]
INTEGER  i_num_curves
INTEGER  i_radius_method
REAL     r_radius
STRING   s_plane_list[16]
STRING   s_radius_point_list[16]
STRING   s_center_point_list[16]
LOGICAL  l_project_flag
STRING   sv_created_ids[VIRTUAL]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
#---------------------------------------------------------------------
#  Enabling the curve and point labeling.
curve_label(TRUE)
point_label(TRUE)
#---------------------------------------------------------------------
#  Calling function to create two circles and project them on a plane.
#  Circles are created by giving radius value.
s_output_ids        = "#"
i_num_curves        = 5
i_radius_method     = 1
r_radius            = 1.45
s_plane_list        = "Coord 0.3"
s_center_point_list = "[0 0 3]"
l_project_flag      = TRUE
 
i_return_value =                                 @
   asm_const_curve_2d_circle_v1                  @
      (  s_output_ids,                           @
         i_num_curves,                           @
         i_radius_method,                        @
         r_radius,                               @
         s_plane_list,                           @
         s_radius_point_list,                    @
         s_center_point_list,                    @
         l_project_flag,                         @
         sv_created_ids )
dump i_return_value
dump sv_created_ids
 
sys_free_string(sv_created_ids)
#---------------------------------------------------------------------
 
asm_const_curve_project_v1
()
#  Purpose          :  This file provides an example of a call to the
#                      function asm_const_curve_project_v1()
#
#                      This session file will create a new database by
#                      name "new.db" and create a surface and a curve.
#                      The above mentioned function will project the 
#                      curve on the surface and create a curve.
#
#                      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 asm_const_curve_project_v1()
#  has the following arguments:
#
#  asm_const_curve_project_v1
#     (  output_ids,
#        curve_list,
#        entity_list,
#        entity_type,
#        delete_org,
#        project_method,
#        vector,
#        coord_frame,
#        ncvprj,
#        geotol,
#        created_ids )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_output_ids[16]
STRING   s_curve_list[16]
STRING   s_entity_list[16]
INTEGER  i_entity_type
LOGICAL  l_delete_org
INTEGER  i_project_method
STRING   s_vector[16]
STRING   s_coord_frame[16]
INTEGER  i_ncvprj
REAL     r_geotol
STRING   sv_created_ids[VIRTUAL]
INTEGER  i_return_value
STRING   sv_sgm_create_surface_crtd_ids[VIRTUAL]
STRING   sv_asm_line_3point_created_ids[VIRTUAL]
#---------------------------------------------------------------------
#  Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
#---------------------------------------------------------------------
#  Enabling curve and point label.
curve_label(TRUE)
point_label(TRUE)
#---------------------------------------------------------------------
#  Creating a surface by giving vertex points.
i_return_value =                                 @
   sgm_const_surface_vertex( "1", "[0 0 0]",     @
      "[4 1 -.5]", "[3.5 2.1 4]", "[-.5 3 2.2]", @
      sv_sgm_create_surface_crtd_ids )
dump i_return_value
#---------------------------------------------------------------------
#  Creating a curve by specifying three points.
i_return_value =                                 @
   asm_const_line_3point( "1", "[1 1 .5]",       @
      "[.4 -.2 1]", "[3 0 -.1]", 1, 0.5,         @
      sv_asm_line_3point_created_ids )
dump i_return_value
#---------------------------------------------------------------------
#  Changing view for proper view of the surface.
i_return_value = ga_view_aa_set( -20., 70., -160. )
dump i_return_value
#---------------------------------------------------------------------
#  Making the surface interior clear on the screen.
 
i_return_value = ga_display_lines_set( "general", 5 )
dump i_return_value
 
#---------------------------------------------------------------------
#  Creating a projected curve on the surface without deleting the old.
s_output_ids   = "#"
s_curve_list   = "Curve 1"
s_entity_list  = "Surface 1"
i_entity_type  = 1
l_delete_org   = FALSE
s_coord_frame  = "Coord 0"
i_ncvprj       = 2
r_geotol       = 0.0001
 
 
i_return_value =                                 @
   asm_const_curve_project_v1                    @
      (  s_output_ids,                           @
         s_curve_list,                           @
         s_entity_list,                          @
         i_entity_type,                          @
         l_delete_org,                           @
         i_project_method,                       @
         s_vector,                               @
         s_coord_frame,                          @
         i_ncvprj,                               @
         r_geotol,                               @
         sv_created_ids )
dump i_return_value
dump sv_created_ids
 
sys_free_string(sv_created_ids)
sys_free_string(sv_sgm_create_surface_crtd_ids)
sys_free_string(sv_asm_line_3point_created_ids)
#---------------------------------------------------------------------
 
asm_db_create_grid
()
#  Purpose          :  This file provides an example of a call to the
#                      function asm_db_create_grid()
#
#                      This file opens a new database "new.db" and
#                      creates a grid into the database.
#
#                      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 asm_db_create_grid()
#  has the following arguments:
#
#  asm_db_create_grid
#     (  xyz,
#        grid_label,
#        yes_to_all,
#        no_to_all,
#        yes_to_all_dup,
#        no_to_all_dup,
#        created_labels )
#
#---------------------------------------------------------------------
#  Variable Declarations
REAL    r_xyz(3)
INTEGER i_grid_label
LOGICAL l_yesall
LOGICAL l_noall
LOGICAL l_yesall_dup
LOGICAL l_noall_dup
REAL    r_xyz_out(3)
INTEGER i_return_value
#---------------------------------------------------------------------
#  Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
#---------------------------------------------------------------------
 
point_label(TRUE)
 
#---------------------------------------------------------------------
#  Creating the grid with the help of the point.
 
r_xyz          =  [0.5 1.5 0.5 ]
i_grid_label   =  0
l_yesall       =  TRUE
l_noall        =  FALSE
l_yesall_dup   =  FALSE
l_noall_dup    =  FALSE
i_return_value =  15
 
asm_db_create_grid(                                    @
                     r_xyz,                            @
                     i_grid_label,                     @
                     l_yesall,                         @
                     l_noall,                          @
                     l_yesall_dup,                     @
                     l_noall_dup,                      @
                     i_return_value ) 
 
dump i_grid_label
dump i_return_value
#---------------------------------------------------------------------
#  Getting back the point.
 
sgm_db_get_point(                                      @
                     i_grid_label,                     @
                     r_xyz_out,                        @
                     i_return_value ) 
dump r_xyz_out
dump i_return_value
#---------------------------------------------------------------------
 
asm_db_get_curve_geo
()
#  Purpose          :  This file provides an example of a call to the
#                      function asm_db_get_curve_geo()
#
#                      This function gets the geometric format of the
#                      curve.This file opens the database “spool.db”
#                      and gets the geometric coefficients for the
#                      curve with label = 1.This database has thirteen
#                      curves.
#
#                      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 asm_db_get_curve_geo()
#  has the following arguments:
#
#  asm_db_get_curve_geo
#     (  curve_id,
#        geo_coefs,
#        status )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_curve_id
REAL     ra_geo_coefs(12)
INTEGER  i_label
INTEGER  i_status
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  i_label = 1
i_label = 1
 
#  Get the internal db id for curve label = 1.
db_get_curve_id                                   @
   (  i_label,                                    @
      i_curve_id )
 
dump i_curve_id
 
asm_db_get_curve_geo                              @
   (  i_curve_id,                                 @
      ra_geo_coefs,                               @
      i_status )
 
dump i_status
 
#  Geometric coefficients of the curve are
dump ra_geo_coefs
 
#---------------------------------------------------------------------
asm_db_get_next_cord_label
()
#  Purpose          :  This file provides an example of a call to the
#                      function asm_db_get_next_cord_label()
#
#                      This function gets the next highest coordinate 
#                      label from the database.This file opens a new
#                      database and creates three coordinate frames 
#                      i.e rectangular, cylindrical and spherical.
#                      Later it gets the next highest coordinate
#                      label.The created coordinate frames have labels
#                      100,200 and 300 respectively. 
#
#                      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 asm_db_get_next_cord_label()
#  has the following arguments:
#
#  asm_db_get_next_cord_label
#     (  domessage,
#        integerlabel,
#        stringlabel )
#
#---------------------------------------------------------------------
#  Variable Declarations
LOGICAL  l_domessage
INTEGER  i_integerlabel
STRING   sv_asm_create_cord_created_ids[VIRTUAL]
STRING   s_stringlabel[32]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Create Rectangular,Cylindrical and Spherical coordinate frames
#  respectively. 
asm_const_coord_3point( “100”, “Coord 0”, 1, “[0 0 0]”, “[0 0 1]”, @
“[1 0 0]”, sv_asm_create_cord_created_ids )
asm_const_coord_3point( “200”, “Coord 0”, 2, “[1 1 1]”, “[1 1 2]”, @
“[2 1 1]”, sv_asm_create_cord_created_ids )
asm_const_coord_3point( “300”, “Coord 0”, 3, “[2 2 2]”, “[2 2 3]”, @
“[3 2 2]”, sv_asm_create_cord_created_ids )
 
i_return_value =                                  @
   asm_db_get_next_cord_label                     @
      (  l_domessage,                             @
         i_integerlabel,                          @
         s_stringlabel )
 
dump i_return_value
 
#  The next highest coordinate label is
dump i_integerlabel
dump s_stringlabel
 
SYS_FREE_STRING(sv_asm_create_cord_created_ids)
#---------------------------------------------------------------------
asm_db_get_next_grid_label
()
#  Purpose          :  This file provides an example of a call to the
#                      function asm_db_get_next_grid_label()
#                      on the menu bar.
#
#                      This function gets the next highest grid label
#                      from the database.This file opens a database
#                      “spool.db” and counts the number of grids and
#                      gets the ids of the grids.It later gets the
#                      next highest grid label from the database.
#                      This database has seven grids with grid
#                      labels 4 to 10.
#
#                      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 asm_db_get_next_grid_label()
#  has the following arguments:
#
#  asm_db_get_next_grid_label
#     (  domessage,
#        integerlabel,
#        stringlabel )
#
#---------------------------------------------------------------------
#  Variable Declarations
LOGICAL  l_domessage
INTEGER  i_integerlabel
STRING   s_stringlabel[64]
INTEGER  i_groupid,i_status,i_count(7),i_count_c
INTEGER  i_gridLabels( VIRTUAL )
REAL     r_xyzCoordinates( VIRTUAL )
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
# i_groupid = 1 (default  group)
i_groupid = 1
#  l_domessage = TRUE
l_domessage = TRUE
 
#  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)
 
dump i_count_c
dump i_status
 
#  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 )
 
#  Get the grid labels for the grids of the default group.
dump i_gridLabels
 
dump r_xyzCoordinates
dump i_status
 
i_return_value =                                  @
   asm_db_get_next_grid_label                     @
      (  l_domessage,                             @
         i_integerlabel,                          @
         s_stringlabel )
 
dump i_return_value
 
#  The next highest grid label is
dump i_integerlabel
dump s_stringlabel
 
SYS_FREE_ARRAY( i_gridLabels )
SYS_FREE_ARRAY( r_xyzCoordinates )
 
#---------------------------------------------------------------------
 
asm_db_get_next_hpat_label
()
#  Purpose          :  This file provides an example of a call to the
#                      function asm_db_get_next_hpat_label()
#
#                      This function gets the next unused hpat label
#                      from the database.This file opens a new 
#                      database “new.db” and creates two solid 
#                      entities with labels 4 and 5.It then gets the
#                      next unused hpat label from the database.
#
#                      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 asm_db_get_next_hpat_label()
#  has the following arguments:
#
#  asm_db_get_next_hpat_label
#     (  domessage,
#        integerlabel,
#        stringlabel )
#
#---------------------------------------------------------------------
#  Variable Declarations
LOGICAL  l_domessage
INTEGER  i_integerlabel
STRING   s_stringlabel[64]
STRING   sv_asm_create_hpat[VIRTUAL]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Create two solid entities.
asm_const_hpat_xyz( “4”, “<1 1 1>”, “[0 0 0]”, “Coord 0”,  @
sv_asm_create_hpat )
 
asm_const_hpat_xyz( “5”, “<2 2 2>”, “[0 0 0]”, “Coord 0”,  @
sv_asm_create_hpat )
 
#  l_domessage = TRUE
l_domessage = TRUE
 
i_return_value =                                  @
   asm_db_get_next_hpat_label                     @
      (  l_domessage,                             @
         i_integerlabel,                          @
         s_stringlabel )
 
dump i_return_value
 
#  The next unused hpat label is
dump i_integerlabel
dump s_stringlabel
 
SYS_FREE_STRING(sv_asm_create_hpat)
#---------------------------------------------------------------------
 
asm_db_get_next_line_label
()
#  Purpose          :  This file provides an example of a call to the
#                      function asm_db_get_next_line_label()
#
#                      This function gets the next highest line label
#                      from the database.This file opens the database
#                      “spool.db” and gets the next highest curve
#                      label from the database.This database has
#                      thirteen curves, ten of which are orphans,
#                      with ids 1 to 3.
#
#                      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 asm_db_get_next_line_label()
#  has the following arguments:
#
#  asm_db_get_next_line_label
#     (  domessage,
#        integerlabel,
#        stringlabel )
#
#---------------------------------------------------------------------
#  Variable Declarations
LOGICAL  l_domessage
INTEGER  i_integerlabel
STRING   s_stringlabel[64]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  l_domessage = TRUE
l_domessage = TRUE
 
i_return_value =                                  @
   asm_db_get_next_line_label                     @
      (  l_domessage,                             @
         i_integerlabel,                          @
         s_stringlabel )
 
dump i_return_value
 
#  The next highest curve label is
dump i_integerlabel
dump s_stringlabel
 
#---------------------------------------------------------------------
asm_db_get_next_patch_label
 
#  Purpose          :  This file provides an example of a call to the
#                      function asm_db_get_next_patch_label()
#
#                      This function gets the next highest patch label
#                      from the database.This file opens the database
#                      “spool.db” and gets the next highest patch 
#                      label from the database.This database has six
#                      surfaces with labels 1 to 6.
#
#                      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 asm_db_get_next_patch_label()
#  has the following arguments:
#
#  asm_db_get_next_patch_label
#     (  domessage,
#        integerlabel,
#        stringlabel )
#
#---------------------------------------------------------------------
#  Variable Declarations
LOGICAL  l_domessage
INTEGER  i_integerlabel
STRING   s_stringlabel[64]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  l_domessage = TRUE
l_domessage = TRUE
 
i_return_value =                                  @
   asm_db_get_next_patch_label                    @
      (  l_domessage,                             @
         i_integerlabel,                          @
         s_stringlabel )
dump i_return_value
 
#  The next highest patch label is
dump i_integerlabel
dump s_stringlabel
#---------------------------------------------------------------------
 
asm_u_coord_global_to_local
()
#  Purpose          :  This file provides an example of a call to the
#                      function asm_u_coord_global_to_local()
#
#                      This function transforms points from global
#                      coordinates to a local coordinate frame.
#                      This file transforms a given point from
#                      global coordinates to local coordinates.
#
#                      This file can be run by starting a session of
#                      MSC Patran, opening a new or existing database,
#                      and running this session file through the
#                      “File”,”Session”,”Play” pulldown menus
#                      on the menu bar.
#
#  The function asm_u_coord_global_to_local()
#  has the following arguments:
#
#  asm_u_coord_global_to_local
#     (  p,
#        t,
#        r,
#        itype,
#        npts )
#
#---------------------------------------------------------------------
#  Variable Declarations
REAL     ra_p(3) = [2, 3, 0]
REAL     ra_t(3) = [1, 1, 1]
REAL     ra_r(9) = [0, 1, 0, 1, 0, 0, 0, 0, 1]
INTEGER  i_itype
INTEGER  i_npts
#---------------------------------------------------------------------
#  The rotation matrix interchanges the x and y axis of the
#  present coordinate system to get the local coordinate system.
#  i_itype = 1 (rectangular coordinate frame )
i_itype = 1
#  i_npts = 1
i_npts = 1
 
asm_u_coord_global_to_local                       @
   (  ra_p,                                       @
      ra_t,                                       @
      ra_r,                                       @
      i_itype,                                    @
      i_npts )
 
#  The local coordinates of the points
dump ra_p
#--------------------------------------------------------------------- 
 
asm_u_coord_local_to_global
()
#  Purpose          :  This file provides an example of a call to the
#                      function asm_u_coord_local_to_global()
#
#                      This function transforms points from local
#                      coordinates to a global coordinate frame.
#                      This file transforms a given point from
#                      local coordinates to global coordinates.
#
#                      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 asm_u_coord_local_to_global()
#  has the following arguments:
#
#  asm_u_coord_local_to_global
#     (  p,
#        t,
#        r,
#        itype,
#        npts )
#
#---------------------------------------------------------------------
#  Variable Declarations
REAL     ra_p(3) = [2, 3, 0]
REAL     ra_t(3) = [1, 1, 1]
REAL     ra_r(9) = [0, 1, 0, 1, 0, 0, 0, 0, 1]
INTEGER  i_itype
INTEGER  i_npts
#---------------------------------------------------------------------
#  The rotation matrix interchanges the x and y axis of the
#  present coordinate system to get the local coordinate system.
#  i_itype = 1 (rectangular coordinate frame )
i_itype = 1
#  i_npts = 1
i_npts = 1
 
asm_u_coord_local_to_global                       @
   (  ra_p,                                       @
      ra_t,                                       @
      ra_r,                                       @
      i_itype,                                    @
      i_npts )
 
#  The global coordinates of the points
dump ra_p
#--------------------------------------------------------------------- 
 
curve_arc_to_parm
()
#  Purpose          :  This file provides an example of a call to the
#                      function curve_arc_to_parm()
#
#                      This function accepts an array of physical
#                      arclengths and computes their corresponding
#                      parameter values.
#
#                      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 curve_arc_to_parm()
#  has the following arguments:
#
#  curve_arc_to_parm
#     (  curve_label,
#        num_parameter,
#        arc_lengths,
#        parameter_values,
#        return_value           )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER i_curve_label
INTEGER i_num_parameter
REAL    ra_arc_length(VIRTUAL)
REAL    ra_parameter_values(VIRTUAL)
REAL    r_curve_length
STRING  asm_create_line_xyz_created_ids[VIRTUAL]
INTEGER i_return_value
#---------------------------------------------------------------------
#  Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
 
#---------------------------------------------------------------------
#  Creating the curve
 
i_return_value =                                       @
   asm_const_line_xyz                                  @
              (  "1",                                  @
                 "<1 1 0>",                            @
                 "[0 0 0]",                            @
                 "Coord 0",                            @
                 asm_create_line_xyz_created_ids )
 
dump i_return_value
#---------------------------------------------------------------------
#  Getting the curve length
 
i_curve_label = 1
 
i_return_value =                                       @
         sgm_get_curve_length(i_curve_label,           @
                            r_curve_length)
dump i_return_value, r_curve_length
#---------------------------------------------------------------------
#  Getting the parameter values for the curve for the
#  given arc lengths.
 
i_num_parameter  = 2
 
sys_allocate_array(ra_arc_length,1,i_num_parameter)
sys_allocate_array(ra_parameter_values,1,i_num_parameter)
 
ra_arc_length = [0.5, 1.4142134]
 
           curve_arc_to_parm                          @
              (  i_curve_label,                       @
                 i_num_parameter,                     @
                 ra_arc_length,                       @
                 ra_parameter_values,                 @
                 i_return_value              )
 
 
dump i_return_value
dump ra_parameter_values
#---------------------------------------------------------------------
sys_free_array(ra_arc_length)
sys_free_array(ra_parameter_values)
sys_free_string(asm_create_line_xyz_created_ids)
#---------------------------------------------------------------------
 
curve_parm_to_arc
()
#  Purpose          :  This file provides an example of a call to the
#                      function curve_parm_to_arc()
#
#                      This function accepts an array of parameter
#                      values and computes their corresponding
#                      physical arclengths.
#
#                      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 curve_parm_to_arc()
#  has the following arguments:
#
#  curve_parm_to_arc
#     (  curve_label,
#        num_parameter,
#        parameter_values,
#        arc_lengths,
#        return_value           )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER i_curve_label
INTEGER i_num_parameter
REAL    r_curve_length
REAL    ra_arc_length(VIRTUAL)
REAL    ra_parameter_values(VIRTUAL)
STRING  asm_create_line_xyz_created_ids[VIRTUAL]
INTEGER i_return_value
#---------------------------------------------------------------------
#  Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
 
#---------------------------------------------------------------------
#  Creating the curve
 
i_return_value =                                       @
   asm_const_line_xyz                                  @
              (  "1",                                  @
                 "<1 1 0>",                            @
                 "[0 0 0]",                            @
                 "Coord 0",                            @
                 asm_create_line_xyz_created_ids )
 
dump i_return_value
#---------------------------------------------------------------------
#  Getting the curve length
 
i_curve_label = 1
 
i_return_value =                                       @
         sgm_get_curve_length(i_curve_label,           @
                            r_curve_length)
dump i_return_value, r_curve_length
#---------------------------------------------------------------------
#  Using the function to get the curve lengths for the 
#  given parameters.
 
i_num_parameter  = 2
 
sys_allocate_array(ra_arc_length,1,i_num_parameter)
sys_allocate_array(ra_parameter_values,1,i_num_parameter)
 
ra_parameter_values = [0.5, 1.00]
 
           curve_parm_to_arc                          @
              (  i_curve_label,                       @
                 i_num_parameter,                     @
                 ra_parameter_values,                 @
                 ra_arc_length,                       @
                 i_return_value              )
 
 
dump i_return_value
dump ra_arc_length
#---------------------------------------------------------------------
sys_free_array(ra_arc_length)
sys_free_array(ra_parameter_values)
sys_free_string(asm_create_line_xyz_created_ids)
#---------------------------------------------------------------------
 
db_check_coord_frame_exist
()
#  Purpose          :  This file provides an example of two calls to
#                      the function db_check_coord_frame_exist()
#
#                      This function checks to see if a coordinate
#                      frame exists in the database.This file
#                      opens a new database and creates three
#                      coordinate frames i.e rectangular, cylindrical
#                      and spherical.Later it checks to see if the
#                      coordinate frame with id = 100 and id = 500
#                      exists in the database.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_check_coord_frame_exist()
#  has the following arguments:
#
#  db_check_coord_frame_exist
#     (  id )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_id
LOGICAL  l_return_value
STRING   sv_asm_create_cord_created_ids[VIRTUAL]
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Create Rectangular,Cylindrical and Spherical coordinate frames
#  respectively.
asm_const_coord_3point( “100”, “Coord 0”, 1, “[0 0 0]”, “[0 0 1]”, @
“[1 0 0]”, sv_asm_create_cord_created_ids )
asm_const_coord_3point( “200”, “Coord 0”, 2, “[1 1 1]”, “[1 1 2]”, @
“[2 1 1]”, sv_asm_create_cord_created_ids )
asm_const_coord_3point( “300”, “Coord 0”, 3, “[2 2 2]”, “[2 2 3]”, @
“[3 2 2]”, sv_asm_create_cord_created_ids )
 
#  i_id = 100
i_id = 100
 
l_return_value =                                  @
   db_check_coord_frame_exist                     @
      (  i_id )
 
dump l_return_value
 
#  i_id = 500
i_id = 500
 
l_return_value =                                  @
   db_check_coord_frame_exist                     @
      (  i_id )
 
#  Note that the coordinate system with id = 500 doesn’t exist.
dump l_return_value
 
SYS_FREE_STRING(sv_asm_create_cord_created_ids)
#---------------------------------------------------------------------
 
db_count_coordinate_frame
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_count_coordinate_frame()
#
#                      This function gets the count of all the 
#                      coordinate frames in the database.This file
#                      opens a new database and creates three 
#                      coordinate frames i.e rectangular, cylindrical
#                      and spherical.Later it gets the count of these
#                      coordinate frames.The default coordinate frame
#                      coord 0 also exists in the database.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function db_count_coordinate_frame()
#  has the following arguments:
#
#  db_count_coordinate_frame
#     (  count )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_count
STRING   sv_asm_create_cord_created_ids[VIRTUAL]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Create Rectangular,Cylindrical and Spherical coordinate frames
#  respectively. 
asm_const_coord_3point( “100”, “Coord 0”, 1, “[0 0 0]”, “[0 0 1]”, @
“[1 0 0]”, sv_asm_create_cord_created_ids )
asm_const_coord_3point( “200”, “Coord 0”, 2, “[1 1 1]”, “[1 1 2]”, @
“[2 1 1]”, sv_asm_create_cord_created_ids )
asm_const_coord_3point( “300”, “Coord 0”, 3, “[2 2 2]”, “[2 2 3]”, @
“[3 2 2]”, sv_asm_create_cord_created_ids )
 
i_return_value =                                  @
   db_count_coordinate_frame                      @
      (  i_count )
 
dump i_return_value
 
#  The number of coordinate systems are
dump i_count
 
SYS_FREE_STRING(sv_asm_create_cord_created_ids)
#---------------------------------------------------------------------
db_count_curve
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_count_curve()
#
#                      This function counts all the curves in the
#                      database. This file opens a database “spool.db”
#                      and counts all the curves in the database. This
#                      database has thirteen curves.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#
#  The function db_count_curve()
#  has the following arguments:
#
#  db_count_curve
#     (  count )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_count
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
i_return_value =                                  @
   db_count_curve                                 @
      (  i_count )
dump i_return_value
 
#  The number of curves in the database are
dump i_count
 
#---------------------------------------------------------------------
db_count_curves_for_point
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_count_curves_for_point()
#
#                      This function counts all curves associated 
#                      with a specified point in the database.This 
#                      file opens a new database “new.db” and 
#                      creates  four curves to form  a square.Later
#                      it counts the number of curves associated with
#                      point with id=1.The curves have labels 1 to 4.
#                      There are 2 curves associated with the point 
#                      with id =1.The point with id = 1 is the 
#                      intersection of the curves with label 1 and 4.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function db_count_curves_for_point()
#  has the following arguments:
#
#  db_count_curves_for_point
#     (  id,
#        count )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_id
INTEGER  i_count
STRING   sv_asm_line_2point_created_ids[VIRTUAL]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Create a point and four lines
asm_const_line_2point( “1”, “[0 0 0]”, “[1 0 0]”, 0, ““, 50., 1,  @
sv_asm_line_2point_created_ids )
asm_const_line_2point( “2”, “[1 0 0]”, “[1 1 0]”, 0, ““, 50., 1,  @
sv_asm_line_2point_created_ids )
asm_const_line_2point( “3”, “[1 1 0]”, “[0 1 0]”, 0, ““, 50., 1,  @
sv_asm_line_2point_created_ids )
asm_const_line_2point( “4”, “[0 1 0]”, “[0 0 0]”, 0, ““, 50., 1,  @
sv_asm_line_2point_created_ids )
 
#  i_id = 1
i_id = 1
 
i_return_value =                                  @
   db_count_curves_for_point                      @
      (  i_id,                                    @
         i_count )
 
dump i_return_value
 
#  The number of curves associated with point label = 1.
dump i_count
 
SYS_FREE_STRING(sv_asm_line_2point_created_ids)
#---------------------------------------------------------------------
db_count_point
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_count_point()
#
#                      This function counts all the points in the
#                      database.This file opens a database “spool.db”
#                      and counts all the points in the database.This
#                      database has seven points.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#
#  The function db_count_point()
#  has the following arguments:
#
#  db_count_point
#     (  count )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_count
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
i_return_value =                                  @
   db_count_point                                 @
      (  i_count )
dump i_return_value
 
#  The number of points in the database are
dump i_count
 
#---------------------------------------------------------------------
db_count_solid
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_count_solid()
#
#                      This function counts all the solids in the 
#                      database.This file opens a new database 
#                      “new.db” and creates two solid entities.It then
#                      counts all the solids in the database.The 
#                      solids have the labels 4 and 5.
#                    
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function db_count_solid()
#  has the following arguments:
#
#  db_count_solid
#     (  count )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_count
INTEGER  i_return_value
STRING   sv_asm_create_hpat[VIRTUAL]
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Create two solid entities.
asm_const_hpat_xyz( “4”, “<1 1 1>”, “[0 0 0]”, “Coord 0”,  @
sv_asm_create_hpat )
 
asm_const_hpat_xyz( “5”, “<2 2 2>”, “[0 0 0]”, “Coord 0”,  @
sv_asm_create_hpat )
 
i_return_value =                                   @
   db_count_solid                                  @
      (  i_count )
dump i_return_value
 
#  The number of solids in the database are
dump i_count
SYS_FREE_STRING(sv_asm_create_hpat)
#---------------------------------------------------------------------
 
db_count_solids_for_surface
()
#  Purpose          :  This file provides an example of two calls to
#                      the function db_count_solids_for_surface()
#
#                      This function counts all the solids associated
#                      with a specified surface.This file opens a new
#                      database “new.db” and creates two solids with
#                      label 1 and 2.Later it gets the count of all 
#                      the solids associated with the surface with 
#                      id 1 and 4.The surface with id = 1 is the 
#                      common surface for both solids.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function db_count_solids_for_surface()
#  has the following arguments:
#
#  db_count_solids_for_surface
#     (  id,
#        count )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_id
INTEGER  i_count
STRING   sv_asm_create_hpat_xyz[VIRTUAL]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Create two solid entities
asm_const_hpat_xyz( “1”, “<1 1 1>”, “[0 0 0]”, “Coord 0”,  @
sv_asm_create_hpat_xyz)
asm_const_hpat_xyz( “2”, “<-1 1 1>”, “[0 0 0]”, “Coord 0”, @
sv_asm_create_hpat_xyz)
 
ga_view_aa_set( 23., -34., 0. )
uil_toolbar.labels_on(  )
 
#  i_id = 1
i_id = 1
 
i_return_value =                                  @
   db_count_solids_for_surface                    @
      (  i_id,                                    @
         i_count )
 
dump i_return_value
 
#  The number of solids associated with the surface with id =1
dump i_count
 
#  i_id = 4
i_id = 4
 
i_return_value =                                  @
   db_count_solids_for_surface                    @
      (  i_id,                                    @
         i_count )
 
dump i_return_value
 
#  The number of solids associated with the surface with id =4
dump i_count
SYS_FREE_STRING(sv_asm_create_hpat_xyz)
#---------------------------------------------------------------------
db_count_surface
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_count_surface()
#
#                      This function counts all the surfaces in the 
#                      database.This file opens a database “spool.db”
#                      and counts all the surfaces in the database.
#                      This database has six surfaces.
#                    
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#
#  The function db_count_surface()
#  has the following arguments:
#
#  db_count_surface
#     (  count )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_count
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
i_return_value =                                   @
   db_count_surface                                @
      (  i_count )
dump i_return_value
 
#  The number of surfaces in the database are
dump i_count
#---------------------------------------------------------------------
db_count_surfaces_for_edge
()
#  Purpose          :  This file provides an example of a call to 
#                      the function db_count_surfaces_for_edge()
#
#                      This function counts all surfaces associated
#                      with the specified edge in the database.This
#                      file opens a new database “new.db” and creates
#                      two surfaces. Later it counts the surfaces
#                      associated with edge with id 1.The edge with
#                      id = 1 is the intersection of the two surfaces.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function db_count_surfaces_for_edge()
#  has the following arguments:
#
#  db_count_surfaces_for_edge
#     (  id,
#        count )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_id
INTEGER  i_count
STRING   sv_asm_create_patch_xy[VIRTUAL]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Create two surfaces
asm_const_patch_xyz( “1”, “<1 1 0>”, “[0 0 0]”, “Coord 0”,  @
sv_asm_create_patch_xy)
asm_const_patch_xyz( “2”, “<0 1 1>”, “[0 0 0]”, “Coord 0”,  @
sv_asm_create_patch_xy)
 
uil_toolbar.labels_on(  )
ga_view_aa_set( 23., -34., 0. )
 
#  i_id = 1
i_id = 1
 
i_return_value =                                  @
   db_count_surfaces_for_edge                     @
      (  i_id,                                    @
         i_count )
 
dump i_return_value
 
#  The number of surfaces associated with label =1
dump i_count
 
SYS_FREE_STRING(sv_asm_create_patch_xy)
#---------------------------------------------------------------------
 
db_get_all_coord_frame_ids
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_all_coord_frame_ids()
#
#                      This function sets the db_get_next_coord_frame
#                      _ids to start at the beginning of a list of
#                      coordinate frames.This file opens a new 
#                      database “new.db” and creates a surface and
#                      four coordinate frames.It then uses the 
#                      function to start at the beginning of the
#                      list of created coordinate frames.Finally it
#                      gets the ids of this coordinate frames using
#                      the function db_get_next_coord_frame_ids().
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#
#  The function db_get_all_coord_frame_ids() has no arguments.
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_all_status
INTEGER  i_next_status =  0
INTEGER  i_id
STRING sv_asm_delete_any_deleted_ids[VIRTUAL]
STRING sv_asm_create_cord_3po_created[VIRTUAL]
STRING sv_asm_create_cord_nor_created[VIRTUAL]
STRING sv_asm_create_cord_axi_created[VIRTUAL]
STRING sv_asm_create_cord_eul_created[VIRTUAL]
STRING sv_asm_create_patch_xy_created[VIRTUAL]
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
ga_viewport_size_set( “default_viewport”, 3.0, 3.0, 1 )
ga_viewport_location_set( “default_viewport”, 0.0, 5.0, 1 )
 
#  Create a surface.
asm_const_patch_xyz( “4”, “<1 1 0>”, “[0 0 0]”, “Coord 0”,    @
sv_asm_create_patch_xy_created )
 
#  Create four coordinate frames with labels 2,3,4,5.
asm_const_coord_3point( “2”, “Coord 0”, 1, “[0 0 0]”,         @
“[0 0 1]”, “[1 0 0]”, sv_asm_create_cord_3po_created )
 
asm_const_coord_axis( “3”, “XY”, “Coord 0”, 1, “[0 0 0]”,     @
“[1 0 0]”, “[0 1 0]”, sv_asm_create_cord_axi_created )
 
asm_const_coord_euler( “4”, 3, 1, 3, 0., 0., 0.,              @
“Coord 0”, 1, “[0 0 0]”, sv_asm_create_cord_eul_created )
 
asm_const_coord_normal( “5”, “Surface 4 “, 1, “[0 0 0]”,      @
sv_asm_create_cord_nor_created )
 
#  Set db_get_next_coord_frame to start at the beginning
#  of the list of coordinate frames.
i_all_status = db_get_all_coord_frame_ids ( )
dump i_all_status
 
#  Get the next coordinate frame id. 
WHILE ( i_next_status == 0 )
	i_next_status = db_get_next_coord_frame_ids ( i_id )
   dump i_next_status
   dump i_id
END WHILE
 
asm_delete_coord( “coord 2:5”,sv_asm_delete_any_deleted_ids )
SYS_FREE_STRING( sv_asm_delete_any_deleted_ids )
SYS_FREE_STRING( sv_asm_create_cord_3po_created )
SYS_FREE_STRING( sv_asm_create_cord_nor_created )
SYS_FREE_STRING( sv_asm_create_cord_axi_created )
SYS_FREE_STRING( sv_asm_create_cord_eul_created )
SYS_FREE_STRING( sv_asm_create_patch_xy_created )
#---------------------------------------------------------------------
 
db_get_all_posted_coord
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_all_posted_coord()
#
#                      This function sets the db_get_next_posted_
#                      coord to start at the beginning of a list of
#                      posted coordinate frames.This file opens a
#                      new database “new.db” and creates a surface
#                      and four coordinate frames.It then uses the 
#                      function to start at the beginning of the
#                      list of posted coordinate frames.Finally it
#                      gets the ids of the next posted coordinate
#                      frames using the function
#                      db_get_next_posted_coord().
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#
#  The function db_get_all_posted_coord() has no arguments.
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_all_status
INTEGER  i_next_status =  0
INTEGER  i_id
STRING sv_asm_delete_any_deleted_ids[VIRTUAL]
STRING sv_asm_create_cord_3po_created[VIRTUAL]
STRING sv_asm_create_cord_nor_created[VIRTUAL]
STRING sv_asm_create_cord_axi_created[VIRTUAL]
STRING sv_asm_create_cord_eul_created[VIRTUAL]
STRING sv_asm_create_patch_xy_created[VIRTUAL]
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
ga_viewport_size_set( “default_viewport”, 3.0, 3.0, 1 )
ga_viewport_location_set( “default_viewport”, 0.0, 5.0, 1 )
 
#  Create a surface.
asm_const_patch_xyz( “4”, “<1 1 0>”, “[0 0 0]”, “Coord 0”,    @
sv_asm_create_patch_xy_created )
 
#  Create four coordinate frames with labels 2,3,4,5.
asm_const_coord_3point( “2”, “Coord 0”, 1, “[0 0 0]”,         @
“[0 0 1]”, “[1 0 0]”, sv_asm_create_cord_3po_created )
 
asm_const_coord_axis( “3”, “XY”, “Coord 0”, 1, “[0 0 0]”,     @
“[1 0 0]”, “[0 1 0]”, sv_asm_create_cord_axi_created )
 
asm_const_coord_euler( “4”, 3, 1, 3, 0., 0., 0.,              @
“Coord 0”, 1, “[0 0 0]”, sv_asm_create_cord_eul_created )
 
asm_const_coord_normal( “5”, “Surface 4 “, 1, “[0 0 0]”,      @
sv_asm_create_cord_nor_created )
 
#  Set db_get_next_posted_coord to start at the beginning
#  of the list of posted coordinate frames.
i_all_status = db_get_all_posted_coord ( )
dump i_all_status
 
#  Get the next posted coordinate frame id. 
WHILE ( i_next_status == 0 )
	i_next_status = db_get_next_posted_coord ( i_id )
   dump i_next_status
   dump i_id
END WHILE
 
asm_delete_coord( “coord 2:5”,sv_asm_delete_any_deleted_ids )
SYS_FREE_STRING( sv_asm_delete_any_deleted_ids )
SYS_FREE_STRING( sv_asm_create_cord_3po_created )
SYS_FREE_STRING( sv_asm_create_cord_nor_created )
SYS_FREE_STRING( sv_asm_create_cord_axi_created )
SYS_FREE_STRING( sv_asm_create_cord_eul_created )
SYS_FREE_STRING( sv_asm_create_patch_xy_created )
#---------------------------------------------------------------------
 
db_get_coord_frame_label
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_coord_frame_label()
#
#                      This function gets the label from the database
#                      given the id  of the coordinate frame.This file
#                      opens a new database and creates three 
#                      coordinate frames i.e rectangular, cylindrical
#                      and spherical.Later it gets label for the 
#                      coordinate frame with id = 100.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function db_get_coord_frame_label()
#  has the following arguments:
#
#  db_get_coord_frame_label
#     (  id,
#        label )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_id
INTEGER  i_label
STRING   sv_asm_create_cord_created_ids[VIRTUAL]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Create Rectangular,Cylindrical and Spherical coordinate frames
#  respectively. 
asm_const_coord_3point( “100”, “Coord 0”, 1, “[0 0 0]”, “[0 0 1]”, @
“[1 0 0]”, sv_asm_create_cord_created_ids )
asm_const_coord_3point( “200”, “Coord 0”, 2, “[1 1 1]”, “[1 1 2]”, @
“[2 1 1]”, sv_asm_create_cord_created_ids )
asm_const_coord_3point( “300”, “Coord 0”, 3, “[2 2 2]”, “[2 2 3]”, @
“[3 2 2]”, sv_asm_create_cord_created_ids )
 
#  i_id = 100
i_id = 100
 
i_return_value =                                  @
   db_get_coord_frame_label                       @
      (  i_id,                                    @
         i_label )
 
dump i_return_value
 
#  The label for coordinate frame with id = 100.
dump i_label
 
SYS_FREE_STRING(sv_asm_create_cord_created_ids)
#---------------------------------------------------------------------
 
db_get_current_coord
()
#  Purpose          :  This file provides an example of two calls to 
#                      the function db_get_current_coord()
#
#                      This function retrieves the current coordinate 
#                      frame from the database.This file opens a new 
#                      database and creates three coordinate frames 
#                      i.e rectangular, cylindrical and spherical.
#                      Later it gets the current coordinate frame.
#                      Further it sets the coordinate frame to 
#                      coordinate frame with label = 200 and gets the
#                      coordinate frame.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function db_get_current_coord()
#  has the following arguments:
#
#  db_get_current_coord
#     (  coord_label )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_coord_label
STRING   sv_asm_create_cord_created_ids[VIRTUAL]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Create Rectangular,Cylindrical and Spherical coordinate frames
#  respectively. 
asm_const_coord_3point( “100”, “Coord 0”, 1, “[0 0 0]”, “[0 0 1]”, @
“[1 0 0]”, sv_asm_create_cord_created_ids )
asm_const_coord_3point( “200”, “Coord 0”, 2, “[1 1 1]”, “[1 1 2]”, @
“[2 1 1]”, sv_asm_create_cord_created_ids )
asm_const_coord_3point( “300”, “Coord 0”, 3, “[2 2 2]”, “[2 2 3]”, @
“[3 2 2]”, sv_asm_create_cord_created_ids )
 
i_return_value =                                  @
   db_get_current_coord                           @
      (  i_coord_label )
 
dump i_return_value
 
#  The current coordinate frame is
dump i_coord_label
 
#  Set the coordinate frame label to 200.
db_set_current_coord(200)
 
i_return_value =                                  @
   db_get_current_coord                           @
      (  i_coord_label )
 
dump i_return_value
 
#  The current coordinate frame is
dump i_coord_label
 
SYS_FREE_STRING(sv_asm_create_cord_created_ids)
#---------------------------------------------------------------------
db_get_curve_coo_and_type
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_curve_coo_and_type()
#
#                      This function gets the geometric company of
#                      origin and the geometry type from the database
#                      given the id. This file opens the database
#                      “spool.db” and gets the geometric company and
#                      geometry type for the curve label = 1. This
#                      database has thirteen curves, ten of which are
#                      orphans, with labels 1 to 3.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_curve_coo_and_type()
#  has the following arguments:
#
#  db_get_curve_coo_and_type
#     (  id,
#        coo,
#        type )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_id
INTEGER  i_coo
INTEGER  i_type
INTEGER  i_label
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  i_label = 1
i_label = 1
 
#  Get the internal db id for curve label = 1.
db_get_curve_id                                   @
   (  i_label,                                    @
      i_id )
 
i_return_value =                                  @
   db_get_curve_coo_and_type                      @
      (  i_id,                                    @
         i_coo,                                   @
         i_type )
 
dump i_return_value
 
#  The geometric company of origin for the given curve label = 1
dump i_coo
 
#  The geometric type of data for the given curve label = 1
dump i_type
#---------------------------------------------------------------------
db_get_curve_id
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_curve_id()
#
#                      This function gets the curve id from the
#                      database given the curve label. A curve label
#                      is an external identifier while the curve id
#                      is an internal identifier value. A curve will
#                      always have one id but may have more that one
#                      label. This file opens the database “spool.db”
#                      and gets the curve id for the curve label 1.
#                      This database has thirteen curves, ten of which
#                      are orphans, with labels 1 to 3.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#
#  The function db_get_curve_id()
#  has the following arguments:
#
#  db_get_curve_id
#     (  label,
#        id )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_label
INTEGER  i_id
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  i_label = 1
i_label = 1
 
i_return_value =                                  @
   db_get_curve_id                                @
      (  i_label,                                 @
         i_id )
 
dump i_return_value
 
#  The curve id for the point label 1 is
dump i_id
#---------------------------------------------------------------------
 
db_get_curve_label
()
 
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_curve_label()
#
#                      This function gets the curve label from the
#                      database given the curve id. A curve label
#                      is an external identifier while the curve id
#                      is an internal identifier value. A curve will
#                      always have one id but may have more that one
#                      label. This file opens the database “spool.db”
#                      and gets the curve id for the curve label 1.
#                      This database has thirteen curves, ten of which
#                      are orphans, with labels 1 to 3.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_curve_label()
#  has the following arguments:
#
#  db_get_curve_label
#     (  id,
#        label )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_id
INTEGER  i_label
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  i_id = 4
i_id = 4
 
i_return_value =                                  @
   db_get_curve_label                             @
      (  i_id,                                    @
         i_label )
 
dump i_return_value
 
# The curve label for the curve id = 4 is
dump i_label
 
#---------------------------------------------------------------------
db_get_curves_for_point
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_curves_for_point()
#
#                      This function gets the ids of all curves 
#                      associated with a specified point.This file
#                      opens a new database “new.db” and creates 
#                      four curves with labels 1 to 4.Later it gets 
#                      the id of all the curves associated with the 
#                      point with id =1.The point with id = 1 is the
#                      intersection of the curves with label 1 and 4.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function db_get_curves_for_point()
#  has the following arguments:
#
#  db_get_curves_for_point
#     (  ptid,
#        count,
#        crvid )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_ptid
INTEGER  i_count
INTEGER  iv_crvid(VIRTUAL)
STRING   sv_asm_line_2point_created_ids[VIRTUAL]
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Create four lines
asm_const_line_2point( “1”, “[0 0 0]”, “[1 0 0]”, 0, ““, 50., 1,  @
sv_asm_line_2point_created_ids )
asm_const_line_2point( “2”, “[1 0 0]”, “[1 1 0]”, 0, ““, 50., 1,  @
sv_asm_line_2point_created_ids )
asm_const_line_2point( “3”, “[1 1 0]”, “[0 1 0]”, 0, ““, 50., 1,  @
sv_asm_line_2point_created_ids )
asm_const_line_2point( “4”, “[0 1 0]”, “[0 0 0]”, 0, ““, 50., 1,  @
sv_asm_line_2point_created_ids )
 
#  i_ptid = 1
i_ptid = 1
 
db_count_curves_for_point                         @
   (  i_ptid,                                     @
      i_count )
 
SYS_ALLOCATE_ARRAY(iv_crvid,1,i_count)     
 
db_get_curves_for_point                           @
   (  i_ptid,                                     @
      i_count,                                    @
      iv_crvid )
 
#  The ids of the various curves associated with the point
#   with label=1
dump iv_crvid
 
SYS_FREE_STRING(sv_asm_line_2point_created_ids)
SYS_FREE_ARRAY(iv_crvid)
#---------------------------------------------------------------------
 
db_get_geom_type
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_geom_type()
#
#                      This function returns the geometry type of a
#                      specific entity given the label and entity_type
#                      This file opens the database “spool.db” and
#                      gets the geometry type for the point entity in
#                      the database. This database has seven points
#                      with label 4 to 10.
#
#                      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.
#                      on the menu bar.
#
#  The function db_get_geom_type()
#  has the following arguments:
#
#  db_get_geom_type
#     (  id_label,
#        entity_type,
#        geom_type )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_id_label
INTEGER  i_entity_type
STRING   s_geom_type[64]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  i_id_label = 4
i_id_label = 4
#  i_entity_type = 1 (point)
i_entity_type = 1
 
i_return_value =                                  @
   db_get_geom_type                               @
      (  i_id_label,                              @
         i_entity_type,                           @
         s_geom_type )
 
dump i_return_value
 
#  The type of geometry for point entity is
dump s_geom_type
 
#---------------------------------------------------------------------
 
db_get_max_coord_label
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_max_coord_label()
#
#                      This function gets the largest coord label 
#                      from the database.This file opens a new 
#                      database and creates three coordinate frames
#                      i.e rectangular, cylindrical and spherical.
#                      Later it gets the highest coord label used.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function db_get_max_coord_label()
#  has the following arguments:
#
#  db_get_max_coord_label
#     (  label )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_label
STRING   sv_asm_create_cord_created_ids[VIRTUAL]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Create Rectangular,Cylindrical and Spherical coordinate frames
#  respectively. 
asm_const_coord_3point( “100”, “Coord 0”, 1, “[0 0 0]”, “[0 0 1]”, @
“[1 0 0]”, sv_asm_create_cord_created_ids )
asm_const_coord_3point( “200”, “Coord 0”, 2, “[1 1 1]”, “[1 1 2]”, @
“[2 1 1]”, sv_asm_create_cord_created_ids )
asm_const_coord_3point( “300”, “Coord 0”, 3, “[2 2 2]”, “[2 2 3]”, @
“[3 2 2]”, sv_asm_create_cord_created_ids )
 
i_return_value =                                  @
   db_get_max_coord_label                         @
      (  i_label )
 
dump i_return_value
 
#  The highest coord label used
dump i_label
 
SYS_FREE_STRING(sv_asm_create_cord_created_ids)
#---------------------------------------------------------------------
db_get_max_curve_label
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_max_curve_label()
#
#                      This function gets the largest curve label from
#                      the database. This file opens the database
#                      “spool.db” and gets the highest curve label
#                      used.This database contains thirteen curves,
#                      ten of which are orphans, with labels 1 to 3.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_max_curve_label()
#  has the following arguments:
#
#  db_get_max_curve_label
#     (  label )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_label
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
i_return_value =                                  @
   db_get_max_curve_label                         @
      (  i_label )
 
dump i_return_value
 
#  The highest curve label used is
dump i_label
 
#---------------------------------------------------------------------
db_get_max_point_label
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_max_point_label()
#
#                      This function gets the largest point label from
#                      the database. This file opens the database
#                      “spool.db” and gets the highest point label
#                      used.This database contains seven points with
#                      labels 4 to 10.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_max_point_label()
#  has the following arguments:
#
#  db_get_max_point_label
#     (  label )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_label
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
i_return_value =                                  @
   db_get_max_point_label                         @
      (  i_label )
 
dump i_return_value
 
#  The highest point label used is
dump i_label
 
#---------------------------------------------------------------------
db_get_max_solid_label
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_max_solid_label()
#
#                      This function gets the largest solid label from
#                      the database.This file opens a new  database 
#                      “new.db” and creates two solid entities.It then
#                      gets the highest solid label used.The solids 
#                      have the label 4 and 5.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function db_get_max_solid_label()
#  has the following arguments:
#
#  db_get_max_solid_label
#     (  label )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_label
STRING   sv_asm_create_hpat[VIRTUAL]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Create two solid entities.
asm_const_hpat_xyz( “4”, “<1 1 1>”, “[0 0 0]”, “Coord 0”,  @
sv_asm_create_hpat )
 
asm_const_hpat_xyz( “5”, “<2 2 2>”, “[0 0 0]”, “Coord 0”,  @
sv_asm_create_hpat )
 
i_return_value =                                  @
   db_get_max_solid_label                         @
      (  i_label )
 
dump i_return_value
 
#  The highest solid label used is
dump i_label
 
SYS_FREE_STRING(sv_asm_create_hpat)
#---------------------------------------------------------------------
 
db_get_max_surface_label
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_max_surface_label()
#
#                      This function gets the largest surface label 
#                      from the database.This file opens the database 
#                      “spool.db” and gets the highest surface label 
#                      used.This database contains six surfaces with
#                      labels 1 to 6.
#                      
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function db_get_max_surface_label()
#  has the following arguments:
#
#  db_get_max_surface_label
#     (  label )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_label
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
i_return_value =                                  @
   db_get_max_surface_label                       @
      (  i_label )
 
dump i_return_value
 
#  The highest surface label used is
dump i_label
#---------------------------------------------------------------------
db_get_min_coord_label
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_min_coord_label()
#
#                      This function gets the smallest coord label 
#                      from the database.This file opens a new 
#                      database and creates three coordinate frames
#                      i.e rectangular, cylindrical and spherical.
#                      Later it gets the lowest coord label used. 
#                      MSC Patran has Coord 0 as the default global
#                      rectangular coordinate frame. 
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function db_get_min_coord_label()
#  has the following arguments:
#
#  db_get_min_coord_label
#     (  label )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_label
STRING   sv_asm_create_cord_created_ids[VIRTUAL]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Create Rectangular,Cylindrical and Spherical coordinate frames
#  respectively. 
asm_const_coord_3point( “100”, “Coord 0”, 1, “[0 0 0]”, “[0 0 1]”, @
“[1 0 0]”, sv_asm_create_cord_created_ids )
asm_const_coord_3point( “200”, “Coord 0”, 2, “[1 1 1]”, “[1 1 2]”, @
“[2 1 1]”, sv_asm_create_cord_created_ids )
asm_const_coord_3point( “300”, “Coord 0”, 3, “[2 2 2]”, “[2 2 3]”, @
“[3 2 2]”, sv_asm_create_cord_created_ids )
 
i_return_value =                                  @
   db_get_min_coord_label                         @
      (  i_label )
 
dump i_return_value
 
#  The lowest coord label is
dump i_label
 
SYS_FREE_STRING(sv_asm_create_cord_created_ids)
#---------------------------------------------------------------------
db_get_min_curve_label
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_min_curve_label()
#
#                      This function gets the smallest curve label
#                      from the database. This file opens the database
#                      “spool.db” and gets the lowest curve label
#                      used.This database contains thirteen curves,
#                      ten of which are orphans, with labels 1 to 3.
#                      One of the orphan curves has the lowest label
#                      value of 1.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_min_curve_label()
#  has the following arguments:
#
#  db_get_min_curve_label
#     (  label )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_label
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
i_return_value =                                  @
   db_get_min_curve_label                         @
      (  i_label )
 
dump i_return_value
 
#  The lowest curve label used is
dump i_label
 
#---------------------------------------------------------------------
db_get_min_point_label
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_min_point_label()
#
#                      This function gets the smallest point label
#                      from the database. This file opens the database
#                      “spool.db” and gets the lowest point label
#                      used. This database contains seven points with
#                      labels 4 to 10.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_min_point_label()
#  has the following arguments:
#
#  db_get_min_point_label
#     (  label )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_label
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
i_return_value =                                  @
   db_get_min_point_label                         @
      (  i_label )
 
dump i_return_value
 
#  The lowest point label used is
dump i_label
 
#---------------------------------------------------------------------
 
db_get_min_solid_label
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_min_solid_label()
#
#                      This function gets the smallest solid label 
#                      from the database.This file opens a new 
#                      database “new.db” and creates two solid 
#                      entities.It then gets the lowest solid label 
#                      used.The solids have label 4 and 5.
#                      
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function db_get_min_solid_label()
#  has the following arguments:
#
#  db_get_min_solid_label
#     (  label )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_label
STRING   sv_asm_create_hpat[VIRTUAL]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Create two solid entities.
asm_const_hpat_xyz( “4”, “<1 1 1>”, “[0 0 0]”, “Coord 0”,  @
sv_asm_create_hpat )
 
asm_const_hpat_xyz( “5”, “<2 2 2>”, “[0 0 0]”, “Coord 0”,  @
sv_asm_create_hpat )
 
i_return_value =                                  @
   db_get_min_solid_label                         @
      (  i_label )
 
dump i_return_value
 
#  The lowest solid label used is
dump i_label
 
SYS_FREE_STRING(sv_asm_create_hpat)
#---------------------------------------------------------------------
db_get_min_surface_label
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_min_surface_label()
#
#                      This function gets the smallest surface label 
#                      from the database.This file opens the database 
#                      “spool.db” and gets the lowest surface label 
#                      used.This database contains six surfaces with
#                      labels 1 to 6.
#                      
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function db_get_min_surface_label()
#  has the following arguments:
#
#  db_get_min_surface_label
#     (  label )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_label
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
i_return_value =                                  @
   db_get_min_surface_label                       @
      (  i_label )
 
dump i_return_value
 
#  The lowest surface label used is
dump i_label
#---------------------------------------------------------------------
db_get_next_coord_frame_ids
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_next_coord_frame_ids()
#
#                      This function gets the next coordinate frame
#                      ids from the database.This file opens a new 
#                      database “new.db” and creates a surface and
#                      four coordinate frames.It then uses the 
#                      function db_get_all_coord_frame_ids() to start
#                      at the beginning of the list of created 
#                      coordinate frames.Finally it gets the ids of
#                      this coordinate frames using the function.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#
#  The function db_get__next_coord_frame_ids() has no arguments.
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_all_status
INTEGER  i_next_status =  0
INTEGER  i_id
STRING sv_asm_delete_any_deleted_ids[VIRTUAL]
STRING sv_asm_create_cord_3po_created[VIRTUAL]
STRING sv_asm_create_cord_nor_created[VIRTUAL]
STRING sv_asm_create_cord_axi_created[VIRTUAL]
STRING sv_asm_create_cord_eul_created[VIRTUAL]
STRING sv_asm_create_patch_xy_created[VIRTUAL]
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
ga_viewport_size_set( “default_viewport”, 3.0, 3.0, 1 )
ga_viewport_location_set( “default_viewport”, 0.0, 5.0, 1 )
 
#  Create a surface.
asm_const_patch_xyz( “4”, “<1 1 0>”, “[0 0 0]”, “Coord 0”,    @
sv_asm_create_patch_xy_created )
 
#  Create four coordinate frames with labels 2,3,4,5.
asm_const_coord_3point( “2”, “Coord 0”, 1, “[0 0 0]”,         @
“[0 0 1]”, “[1 0 0]”, sv_asm_create_cord_3po_created )
 
asm_const_coord_axis( “3”, “XY”, “Coord 0”, 1, “[0 0 0]”,     @
“[1 0 0]”, “[0 1 0]”, sv_asm_create_cord_axi_created )
 
asm_const_coord_euler( “4”, 3, 1, 3, 0., 0., 0.,              @
“Coord 0”, 1, “[0 0 0]”, sv_asm_create_cord_eul_created )
 
asm_const_coord_normal( “5”, “Surface 4 “, 1, “[0 0 0]”,      @
sv_asm_create_cord_nor_created )
 
#  Set db_get_next_coord_frame to start at the beginning
#  of the list of coordinate frames.
i_all_status = db_get_all_coord_frame_ids ( )
dump i_all_status
 
#  Get the next coordinate frame id. 
WHILE ( i_next_status == 0 )
	i_next_status = db_get_next_coord_frame_ids ( i_id )
   dump i_next_status
   dump i_id
END WHILE
 
asm_delete_coord( “coord 2:5”,sv_asm_delete_any_deleted_ids )
SYS_FREE_STRING( sv_asm_delete_any_deleted_ids )
SYS_FREE_STRING( sv_asm_create_cord_3po_created )
SYS_FREE_STRING( sv_asm_create_cord_nor_created )
SYS_FREE_STRING( sv_asm_create_cord_axi_created )
SYS_FREE_STRING( sv_asm_create_cord_eul_created )
SYS_FREE_STRING( sv_asm_create_patch_xy_created )
#---------------------------------------------------------------------
 
db_get_next_posted_coord
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_next_posted_coord()
#
#                      This function gets next posted coordinate
#                      frame ids from the database.This file opens a
#                      new database “new.db” and creates a surface
#                      and four coordinate frames.It then uses the 
#                      function db_get_all_posted_coord() to start at
#                      the beginning of the list of posted coordinate
#                      frames.Finally it gets the ids of the next
#                      posted coordinate frames using the function.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#
#  The function db_get_next_posted_coord() has no arguments.
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_all_status
INTEGER  i_next_status =  0
INTEGER  i_id
STRING sv_asm_delete_any_deleted_ids[VIRTUAL]
STRING sv_asm_create_cord_3po_created[VIRTUAL]
STRING sv_asm_create_cord_nor_created[VIRTUAL]
STRING sv_asm_create_cord_axi_created[VIRTUAL]
STRING sv_asm_create_cord_eul_created[VIRTUAL]
STRING sv_asm_create_patch_xy_created[VIRTUAL]
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
ga_viewport_size_set( “default_viewport”, 3.0, 3.0, 1 )
ga_viewport_location_set( “default_viewport”, 0.0, 5.0, 1 )
 
#  Create a surface.
asm_const_patch_xyz( “4”, “<1 1 0>”, “[0 0 0]”, “Coord 0”,    @
sv_asm_create_patch_xy_created )
 
#  Create four coordinate frames with labels 2,3,4,5.
asm_const_coord_3point( “2”, “Coord 0”, 1, “[0 0 0]”,         @
“[0 0 1]”, “[1 0 0]”, sv_asm_create_cord_3po_created )
 
asm_const_coord_axis( “3”, “XY”, “Coord 0”, 1, “[0 0 0]”,     @
“[1 0 0]”, “[0 1 0]”, sv_asm_create_cord_axi_created )
 
asm_const_coord_euler( “4”, 3, 1, 3, 0., 0., 0.,              @
“Coord 0”, 1, “[0 0 0]”, sv_asm_create_cord_eul_created )
 
asm_const_coord_normal( “5”, “Surface 4 “, 1, “[0 0 0]”,      @
sv_asm_create_cord_nor_created )
 
#  Set db_get_next_posted_coord to start at the beginning
#  of the list of posted coordinate frames.
i_all_status = db_get_all_posted_coord ( )
dump i_all_status
 
#  Get the next posted coordinate frame id. 
WHILE ( i_next_status == 0 )
	i_next_status = db_get_next_posted_coord ( i_id )
   dump i_next_status
   dump i_id
END WHILE
 
asm_delete_coord( “coord 2:5”,sv_asm_delete_any_deleted_ids )
SYS_FREE_STRING( sv_asm_delete_any_deleted_ids )
SYS_FREE_STRING( sv_asm_create_cord_3po_created )
SYS_FREE_STRING( sv_asm_create_cord_nor_created )
SYS_FREE_STRING( sv_asm_create_cord_axi_created )
SYS_FREE_STRING( sv_asm_create_cord_eul_created )
SYS_FREE_STRING( sv_asm_create_patch_xy_created )
#---------------------------------------------------------------------
 
db_get_point_association_count
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_point_association_count()
#
#                      This function returns the number of higher
#                      order entities associated with a point. This
#                      file opens the database “spool.db” and gets the
#                      number of higher order entities associated with
#                      the point label 6. This database has seven
#                      points with labels 4 to 10.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_point_association_count()
#  has the following arguments:
#
#  db_get_point_association_count
#     (  point_id,
#        assoc_count )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_point_id
INTEGER  i_label
INTEGER  i_assoc_count
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  i_label = 6
i_label = 6
 
db_get_point_id                                   @
   (  i_label,                                    @
      i_point_id )
 
dump i_point_id
 
i_return_value =                                  @
   db_get_point_association_count                 @
      (  i_point_id,                              @
         i_assoc_count )
 
dump i_return_value
 
#  The number of higher order entities associated with the point
#  having label = 6.
dump i_assoc_count
 
#---------------------------------------------------------------------
 
db_get_point_coo_and_type
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_point_coo_and_type()
#
#                      This function gets the geometric company of
#                      origin and the geometry type from the database
#                      given the id. This file opens the database
#                      “spool.db” and gets the geometric company and
#                      geometry type for the point label=6. This
#                      database has seven points with labels 4 to 10.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_point_coo_and_type()
#  has the following arguments:
#
#  db_get_point_coo_and_type
#     (  id,
#        coo,
#        type )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_id
INTEGER  i_coo
INTEGER  i_type
INTEGER  i_label
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  i_label = 6
i_label = 6
 
db_get_point_id                                   @
   (  i_label,                                    @
      i_id )
 
dump i_id
 
i_return_value =                                  @
   db_get_point_coo_and_type                      @
      (  i_id,                                    @
         i_coo,                                   @
         i_type )
 
dump i_return_value
 
#  The geometric company of origin for the given point label = 6
dump i_coo
 
#  The geometric type of data for the given point label = 6
dump i_type
 
#---------------------------------------------------------------------
 
db_get_point_id
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_point_id()
#
#                      This function gets the point id from the
#                      database given the point label. A point label
#                      is an external identifier while the point id
#                      is an internal identifier value. A point will
#                      always have one id but may have more that one
#                      label. This file opens the database “spool.db”
#                      and gets the point id for the point label 9.
#                      This database has seven points with labels 4
#                      to 10.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#
#  The function db_get_point_id()
#  has the following arguments:
#
#  db_get_point_id
#     (  label,
#        id )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_label
INTEGER  i_id
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  i_label = 9
i_label = 9
 
i_return_value =                                  @
   db_get_point_id                                @
      (  i_label,                                 @
         i_id )
 
dump i_return_value
 
#  The point id for the point label 9 is
dump i_id
 
#---------------------------------------------------------------------
db_get_point_label
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_point_label()
#
#                      This function gets the point label from the
#                      database given the point id. A point label
#                      is an external identifier while the point id
#                      is an internal identifier value. A point will
#                      always have one id but may have more that one
#                      label. This file opens the database “spool.db”
#                      and gets the point id for the point label 9.
#                      This database has seven points with labels 4
#                      to 10.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_point_label()
#  has the following arguments:
#
#  db_get_point_label
#     (  id,
#        label )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_id
INTEGER  i_label
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  i_id = 7
i_id = 7
 
i_return_value =                                  @
   db_get_point_label                             @
      (  i_id,                                    @
         i_label )
 
dump i_return_value
 
#  The point label for the point id = 7 is
dump i_label
 
#---------------------------------------------------------------------
db_get_solid_coo_and_type
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_solid_coo_and_type()
#
#                      This function gets the geometric company of
#                      origin and the geometry type from the database
#                      given the id.This file opens a new database
#                      “new.db” and creates two solid entities with 
#                      labels 4 and 5.It then  gets the geometric 
#                      company and geometry type for the solid 
#                      with label = 4.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function db_get_solid_coo_and_type()
#  has the following arguments:
#
#  db_get_solid_coo_and_type
#     (  id,
#        coo,
#        type )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_id
INTEGER  i_coo
INTEGER  i_label
INTEGER  i_type
STRING   sv_asm_create_hpat[VIRTUAL]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Create two solid entities.
asm_const_hpat_xyz( “4”, “<1 1 1>”, “[0 0 0]”, “Coord 0”,  @
sv_asm_create_hpat )
 
asm_const_hpat_xyz( “5”, “<2 2 2>”, “[0 0 0]”, “Coord 0”,  @
sv_asm_create_hpat )
 
#  i_label = 4
i_label = 4
 
#  Get the solid id for soid label = 1.
db_get_solid_id                                   @
   (  i_label,                                    @
      i_id )
 
i_return_value =                                  @
   db_get_solid_coo_and_type                      @
      (  i_id,                                    @
         i_coo,                                   @
         i_type )
 
dump i_return_value
 
#  The geometric company of origin for the given solid label = 4
dump i_coo
 
#  The geometric type of data for the given solid label = 4
dump i_type
 
SYS_FREE_STRING(sv_asm_create_hpat)
#---------------------------------------------------------------------
db_get_solid_id
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_solid_id()
#
#                      This function gets the solid id from the 
#                      database given the solid label.The surface
#                      label is the  external solid id while the 
#                      solid id is the internal surface id.This file
#                      opens a new database “new.db” and creates two
#                      solid entities with labels 4 and 5.It then gets
#                      the id for the solid with label 4.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function db_get_solid_id()
#  has the following arguments:
#
#  db_get_solid_id
#     (  label,
#        id )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_label
INTEGER  i_id
STRING   sv_asm_create_hpat[VIRTUAL]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Create two solid entities.
asm_const_hpat_xyz( “4”, “<1 1 1>”, “[0 0 0]”, “Coord 0”,  @
sv_asm_create_hpat )
 
asm_const_hpat_xyz( “5”, “<2 2 2>”, “[0 0 0]”, “Coord 0”,  @
sv_asm_create_hpat )
 
#  i_label = 4
i_label = 4
 
i_return_value =                                  @
   db_get_solid_id                                @
      (  i_label,                                 @
         i_id )
 
dump i_return_value
 
#  The solid id for the solid label 4 is
dump i_id
 
SYS_FREE_STRING(sv_asm_create_hpat)
#---------------------------------------------------------------------
db_get_solid_label
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_solid_label()
#
#                      This function gets the solid label from the
#                      database given the solid id.The surface label
#                      is the external solid id while the surface id
#                      is the internal solid id.This file opens a new
#                      database “new.db” and creates two solid 
#                      entities with labels 4 and 5.It then gets the
#                      label for the  solid with id  1.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function db_get_solid_label()
#  has the following arguments:
#
#  db_get_solid_label
#     (  id,
#        label )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_id
INTEGER  i_label
STRING   sv_asm_create_hpat[VIRTUAL]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Create two solid entities.
asm_const_hpat_xyz( “4”, “<1 1 1>”, “[0 0 0]”, “Coord 0”,  @
sv_asm_create_hpat )
 
asm_const_hpat_xyz( “5”, “<2 2 2>”, “[0 0 0]”, “Coord 0”,  @
sv_asm_create_hpat )
 
#  i_id = 1
i_id = 1
 
i_return_value =                                  @
   db_get_solid_label                             @
      (  i_id,                                    @
         i_label )
 
dump i_return_value
 
# The solid label for the solid id = 1 is
dump i_label
 
SYS_FREE_STRING(sv_asm_create_hpat)
#---------------------------------------------------------------------
db_get_solids_for_surface
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_solids_for_surface()
#
#                      This function gets the ids of  all the solids 
#                      associated with a specified surface.This file 
#                      opens a new database “new.db” and creates two
#                      solids with label 1 and 2.Later it gets the 
#                      ids of the solids associated with the surface
#                      with id  1.The surface with id = 1 is the 
#                      common surface for both the solids.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function db_get_solids_for_surface()
#  has the following arguments:
#
#  db_get_solids_for_surface
#     (  srfid,
#        count,
#        solid )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_srfid
INTEGER  i_label
INTEGER  i_count
INTEGER  iv_solid(VIRTUAL)
STRING   sv_asm_create_hpat_xyz[VIRTUAL]
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Create two solid entities
asm_const_hpat_xyz( “1”, “<1 1 1>”, “[0 0 0]”, “Coord 0”,  @
sv_asm_create_hpat_xyz)
asm_const_hpat_xyz( “2”, “<-1 1 1>”, “[0 0 0]”, “Coord 0”, @
sv_asm_create_hpat_xyz)
 
ga_view_aa_set( 23., -34., 0. )
uil_toolbar.labels_on(  )
 
#  Count the number of Solids associated to Surface ID = 1
#  i_srfid = 1
i_srfid = 1
db_count_solids_for_surface(  i_srfid,            @
                              i_count )
 
SYS_ALLOCATE_ARRAY(iv_solid,1,i_count)
 
db_get_solids_for_surface                         @
   (  i_srfid,                                    @
      i_count,                                    @
      iv_solid )
 
#  The ids of the solids associated with the surface with ID =1 are
dump iv_solid
 
SYS_FREE_ARRAY(iv_solid) 
SYS_FREE_STRING(sv_asm_create_hpat_xyz)
#---------------------------------------------------------------------
db_get_surface_coo_and_type
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_surface_coo_and_type()
#
#                      This function gets the geometric company of
#                      origin and the geometry type from the database
#                      given the id.This file opens the database
#                      “spool.db” and gets the geometric company and
#                      geometry type for the surface label = 1.This 
#                      database has six surfaces with labels 1 to 6.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function db_get_surface_coo_and_type()
#  has the following arguments:
#
#  db_get_surface_coo_and_type
#     (  id,
#        coo,
#        type )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_id
INTEGER  i_coo
INTEGER  i_label
INTEGER  i_type
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  i_label = 1
i_label = 1
 
#  Get the surface id for surface label = 1.
db_get_surface_id                                 @
   (  i_label,                                    @
      i_id )
 
i_return_value =                                  @
   db_get_surface_coo_and_type                    @
      (  i_id,                                    @
         i_coo,                                   @
         i_type )
 
dump i_return_value
 
#  The geometric company of origin for the given surface label = 1
dump i_coo
 
#  The geometric type of data for the given surface label = 1
dump i_type
#---------------------------------------------------------------------
db_get_surface_id
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_surface_id()
#
#                      This function gets the surface id from the 
#                      database given the surface label.The surface
#                      label is the  external surface id while the 
#                      surface id is the internal surface id.This file
#                      opens the database “spool.db” and gets the 
#                      surface id for the surface with label 1.This 
#                      database has six surfaces with labels 1 to 6.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#
#  The function db_get_surface_id()
#  has the following arguments:
#
#  db_get_surface_id
#     (  label,
#        id )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_label
INTEGER  i_id
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  i_label = 1
i_label = 1
 
i_return_value =                                  @
   db_get_surface_id                              @
      (  i_label,                                 @
         i_id )
 
dump i_return_value
 
#  The surface id for the surface label 1 is
dump i_id
#---------------------------------------------------------------------
db_get_surface_label
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_surface_label()
#
#                      This function gets the surface label from the
#                      database given the surface id.The surface label
#                      is the external surface id while the surface id
#                      is the internal surface id.This file opens the
#                      database “spool.db” and gets the surface label 
#                      for the surface id 1.This database has six 
#                      surfaces with labels 1 to 6.
#
#                      Before running this session file run spool.ses
#                      to create spool.db
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function db_get_surface_label()
#  has the following arguments:
#
#  db_get_surface_label
#     (  id,
#        label )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_id
INTEGER  i_label
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  i_id = 1
i_id = 1
 
i_return_value =                                  @
   db_get_surface_label                           @
      (  i_id,                                    @
         i_label )
 
dump i_return_value
 
# The surface label for the surface id = 1 is
dump i_label
#---------------------------------------------------------------------
db_get_surfaces_for_edge
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_surfaces_for_edge()
#
#                      This function gets the ids of all surfaces 
#                      associated with the specified edge.This
#                      file opens a new database “new.db” and creates
#                      two surfaces. Later it gets the ids of all the 
#                      surfaces associated with edge with id 1.The 
#                      edge with id = 1 is the intersection of the two
#                      surfaces.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function db_get_surfaces_for_edge()
#  has the following arguments:
#
#  db_get_surfaces_for_edge
#     (  edgid,
#        count,
#        srfid )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_edgid
INTEGER  i_count
INTEGER  iv_srfid(VIRTUAL)
STRING   sv_asm_create_patch_xy[VIRTUAL]
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Create two surfaces 
asm_const_patch_xyz( “1”, “<1 1 0>”, “[0 0 0]”, “Coord 0”,  @
sv_asm_create_patch_xy)
asm_const_patch_xyz( “2”, “<0 1 1>”, “[0 0 0]”, “Coord 0”,  @
sv_asm_create_patch_xy)
 
uil_toolbar.labels_on(  )
ga_view_aa_set( 23., -34., 0. )
 
#  i_edgid = 1
i_edgid = 1
 
db_count_surfaces_for_edge                        @
   (  i_edgid,                                    @
      i_count )
 
SYS_ALLOCATE_ARRAY(iv_srfid,1,i_count)
 
db_get_surfaces_for_edge                          @
   (  i_edgid,                                    @
      i_count,                                    @
      iv_srfid )
 
#  The  ids of surfaces associated with curve with label = 1 are
dump iv_srfid
 
SYS_FREE_STRING(sv_asm_create_patch_xy)
SYS_FREE_ARRAY(iv_srfid)
#---------------------------------------------------------------------
 
sgm_associate_nodes_curve
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_associate_nodes_curve()
#
#                      This file opens a new database "new.db" 
#                      It creates an arc and nodes in the database and 
#                      associates the nodes to the curve.
#
#                      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 sgm_associate_nodes_curve()
#  has the following arguments:
#
#  sgm_associate_nodes_curve
#     (  node_list,
#        curve_list      )
#
#---------------------------------------------------------------------
#  Variable Declarations
 
STRING  fem_create_nodes__nodes_created[VIRTUAL]
STRING  asm_create_line_xyz_created_ids[VIRTUAL]
STRING  s_node_list[32]
STRING  s_curve_list[32]
INTEGER i_return_value
#---------------------------------------------------------------------
#  Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
#---------------------------------------------------------------------
#  Creating the nodes.
 
i_return_value =                                       @
   fem_create_nodes_1                                  @
              (  "Coord 0",                            @
                 "Coord 0",                            @
                 2,                                    @
                 "#",                                  @
                 "[0 0 0 ]",                           @
                 fem_create_nodes__nodes_created  )
 
dump i_return_value
 
i_return_value =                                       @
   fem_create_nodes_1                                  @
              (  "Coord 0",                            @
                 "Coord 0",                            @
                 2,                                    @
                 "#",                                  @
                 "[0.5 0.5 0 ]",                       @
                 fem_create_nodes__nodes_created  )
 
dump i_return_value
 
i_return_value =                                       @
   fem_create_nodes_1                                  @
              (  "Coord 0",                            @
                 "Coord 0",                            @
                 2,                                    @
                 "#",                                  @
                 "[1.0 1.0 0 ]",                       @
                 fem_create_nodes__nodes_created  )
 
dump i_return_value
#---------------------------------------------------------------------
#  Creating the curve
 
i_return_value =                                       @
   asm_const_line_xyz                                  @
              (  "1",                                  @
                 "<1 1 0>",                            @
                 "[0 0 0]",                            @
                 "Coord 0",                            @
                 asm_create_line_xyz_created_ids )
 
dump i_return_value
#---------------------------------------------------------------------
#  Associating the nodes with the curve.
 
s_node_list  = "Node 1:3"
s_curve_list = "Curve 1"
 
i_return_value = sgm_associate_nodes_curve(           @
                          s_node_list,                @
                          s_curve_list     )
 
dump i_return_value
#---------------------------------------------------------------------
sys_free_string(asm_create_line_xyz_created_ids)
#---------------------------------------------------------------------
 
sgm_const_curve_project_v1
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_const_curve_project_v1()
#
#                      This session file will create a new database by
#                      name "new.db" and create a surface and a curve.
#                      The above mentioned function will project the 
#                      curve on the surface and create a curve.
#
#                      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 sgm_const_curve_project_v1()
#  has the following arguments:
#
#  sgm_const_curve_project_v1
#     (  output_ids,
#        curve_list,
#        entity_list,
#        entity_type,
#        delete_org,
#        project_method,
#        vector,
#        coord_frame,
#        prjtol,
#        created_ids )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_output_ids[16]
STRING   s_curve_list[16]
STRING   s_entity_list[16]
INTEGER  i_entity_type
LOGICAL  l_delete_org
INTEGER  i_project_method
STRING   s_vector[16]
STRING   s_coord_frame[16]
REAL     r_prjtol
STRING   sv_created_ids[VIRTUAL]
INTEGER  i_return_value
STRING   sv_sgm_create_surface_crtd_ids[VIRTUAL]
STRING   sv_asm_line_3point_created_ids[VIRTUAL]
#---------------------------------------------------------------------
#  Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
#---------------------------------------------------------------------
#  Enabling curve and point label.
curve_label(TRUE)
point_label(TRUE)
#---------------------------------------------------------------------
#  Creating a surface by giving vertex points.
i_return_value =                                 @
   sgm_const_surface_vertex( "1", "[0 0 0]",     @
      "[4 1 -.5]", "[3.5 2.1 4]", "[-.5 3 2.2]", @
      sv_sgm_create_surface_crtd_ids )
dump i_return_value
#---------------------------------------------------------------------
#  Creating a curve by specifying three points.
i_return_value =                                 @
   asm_const_line_3point( "1", "[1 1 .5]",       @
      "[.4 -.2 1]", "[3 0 -.1]", 1, 0.5,         @
      sv_asm_line_3point_created_ids )
dump i_return_value
#---------------------------------------------------------------------
#  Changing view for proper view of the surface.
i_return_value = ga_view_aa_set( -20., 70., -160. )
dump i_return_value
#---------------------------------------------------------------------
#  Making the surface interior clear on the screen.
 
i_return_value = ga_display_lines_set( "general", 5 )
 
dump i_return_value
#---------------------------------------------------------------------
#  Creating a projected curve on the surface without deleting the old.
s_output_ids   = "#"
s_curve_list   = "Curve 1"
s_entity_list  = "Surface 1"
i_entity_type  =  1
l_delete_org   = FALSE
s_coord_frame  = "Coord 0"
r_prjtol       = 1e-05
 
i_return_value =                                 @
   sgm_const_curve_project_v1                    @
      (  s_output_ids,                           @
         s_curve_list,                           @
         s_entity_list,                          @
         i_entity_type,                          @
         l_delete_org,                           @
         i_project_method,                       @
         s_vector,                               @
         s_coord_frame,                          @
         r_prjtol,                               @
         sv_created_ids )
dump i_return_value
dump sv_created_ids
#---------------------------------------------------------------------
sys_free_string(sv_created_ids)
sys_free_string(sv_sgm_create_surface_crtd_ids)
sys_free_string(sv_asm_line_3point_created_ids)
#---------------------------------------------------------------------
 
sgm_construct_solid_brep
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_construct_solid_brep()
#
#                      In this illustration, a new database is opened.
#                      6 surfaces are created and solid through it is 
#                      created using the function 
#                      sgm_construct_solid_brep().
#
#                      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 sgm_construct_solid_brep()
#  has the following arguments:
#
#    sgm_construct_solid_brep
#     (   output_ids,
#         surface_list,
#         delete_surface,
#         created_ids  )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_output_ids[32]
STRING   s_surface_list[32]
LOGICAL  l_delete_surface
STRING   sv_asm_patch_created_ids[VIRTUAL]
STRING   sv_created_ids[VIRTUAL]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database
uil_file_new.go( "", "new.db" )
$? YES 36000002
#---------------------------------------------------------------------
#  Show the labels of the surfaces and solids.
surface_label(TRUE)
solid_label(TRUE)
#---------------------------------------------------------------------
ga_view_aa_set(23.,-34.,0.)
uil_toolbar.shaded_smooth( )
#---------------------------------------------------------------------
#  Create the  patches.
i_return_value =                                 @
   asm_const_patch_xyz( "1", "<1 1 0>",          @
      "[0 0 0]", "Coord 0",                      @
      sv_asm_patch_created_ids )
 
i_return_value =                                 @
   asm_const_patch_xyz( "2", "<1 0 1>",          @
      "[0 0 0]", "Coord 0",                      @
      sv_asm_patch_created_ids )
 
i_return_value =                                 @
   asm_const_patch_xyz( "3", "<0 1 1>",          @
      "[0 0 0]", "Coord 0",                      @
      sv_asm_patch_created_ids )
 
i_return_value =                                 @
   asm_const_patch_xyz( "4", "<0 1 1>",          @
      "[1 0 0]", "Coord 0",                      @
      sv_asm_patch_created_ids )
 
i_return_value =                                 @
   asm_const_patch_xyz( "5", "<1 0 1>",          @
      "[0 1 0]", "Coord 0",                      @
      sv_asm_patch_created_ids )
 
i_return_value =                                 @
   asm_const_patch_xyz( "6", "<1 1 0>",          @
      "[0 0 1]", "Coord 0",                      @
      sv_asm_patch_created_ids )
 
#---------------------------------------------------------------------
#  Create the solid from the surfaces.
 
s_output_ids      =  "1"
s_surface_list    =  "Surface 1:6"
l_delete_surface  =  FALSE
 
i_return_value =                                 @
    sgm_construct_solid_brep(                    @
                    s_output_ids,                @
                    s_surface_list,              @
                    l_delete_surface,            @
                    sv_created_ids  )
dump i_return_value
dump sv_created_ids
#---------------------------------------------------------------------
sys_free_string( sv_created_ids )
sys_free_string( sv_asm_patch_created_ids)
#---------------------------------------------------------------------~
 
sgm_construct_solid_volume
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_construct_solid_volume()
#
#                      In this illustration, a new database is opened.
#                      6 surfaces are created and solid through it is 
#                      created using the function 
#                      sgm_construct_solid_volume().
#
#                      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 sgm_construct_solid_volume()
#  has the following arguments:
#
#    sgm_construct_solid_volume
#     (   output_ids,
#         surface_list,
#         delete_surface,
#         created_ids  )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_output_ids[32]
STRING   s_surface_list[32]
LOGICAL  l_delete_surface
STRING   sv_asm_patch_created_ids[VIRTUAL]
STRING   sv_created_ids[VIRTUAL]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database
uil_file_new.go( "", "new.db" )
$? YES 36000002
#---------------------------------------------------------------------
#  Show the labels of the surfaces and solids.
surface_label(TRUE)
solid_label(TRUE)
#---------------------------------------------------------------------
ga_view_aa_set(23.,-34.,0.)
uil_toolbar.shaded_smooth( )
#---------------------------------------------------------------------
#  Create the  patches.
 
i_return_value =                                 @
   asm_const_patch_xyz( "1", "<1 1 0>",          @
      "[0 0 0]", "Coord 0",                      @
      sv_asm_patch_created_ids )
 
i_return_value =                                 @
   asm_const_patch_xyz( "2", "<1 0 1>",          @
      "[0 0 0]", "Coord 0",                      @
      sv_asm_patch_created_ids )
 
i_return_value =                                 @
   asm_const_patch_xyz( "3", "<0 1 1>",          @
      "[0 0 0]", "Coord 0",                      @
      sv_asm_patch_created_ids )
 
i_return_value =                                 @
   asm_const_patch_xyz( "4", "<0 1 1>",          @
      "[1 0 0]", "Coord 0",                      @
      sv_asm_patch_created_ids )
 
i_return_value =                                 @
   asm_const_patch_xyz( "5", "<1 0 1>",          @
      "[0 1 0]", "Coord 0",                      @
      sv_asm_patch_created_ids )
 
i_return_value =                                 @
   asm_const_patch_xyz( "6", "<1 1 0>",          @
      "[0 0 1]", "Coord 0",                      @
      sv_asm_patch_created_ids )
#---------------------------------------------------------------------
#  Create the solid from the surfaces.
 
s_output_ids      =  "1"
s_surface_list    =  "Surface 1:6"
l_delete_surface  =  FALSE
 
i_return_value =                                 @
    sgm_construct_solid_volume(                  @
                    s_output_ids,                @
                    s_surface_list,              @
                    l_delete_surface,            @
                    sv_created_ids  )
dump i_return_value
dump sv_created_ids
#---------------------------------------------------------------------
sys_free_string( sv_created_ids )
sys_free_string( sv_asm_patch_created_ids)
#---------------------------------------------------------------------
 
sgm_create_curve_on_surface
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_create_curve_on_surface()
#
#                      This file opens a new database "new.db" and
#                      creates a surface and then with the blob of
#                      the surface, the function creates a parametric
#                      curve on the surface.  It gets the blob of the 
#                      new curve created.
#
#                      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 sgm_create_curve_on_surface()
#  has the following arguments:
#
#  sgm_create_curve_on_surface
#     (  direction,
#        param_value,
#        surface_blob,
#        curve_blob )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_surface_id
INTEGER  i_label
STRING   asm_create_patch_xy_created_ids[VIRTUAL]
INTEGER  i_entitytype
INTEGER  i_blobsize
INTEGER  i_curve_blob_size
INTEGER  i_direction
REAL     r_param_value
REAL     rv_surface_blob(VIRTUAL)
REAL     ra_curve_blob_out(VIRTUAL)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
 
i_return_value =                                 @
   ga_view_aa_set( 23., -34., 0. )
dump i_return_value
#---------------------------------------------------------------------
#  Enabling the surface and the solid labels.
 
solid_label(TRUE)
surface_label(TRUE)
#---------------------------------------------------------------------
#  Creating a Surface.
 
i_return_value = asm_const_patch_xyz(            @
                     "1",                        @
                     "<1 1 0>",                  @
                     "[0 0 0]",                  @
                     "Coord 0",                  @
                     asm_create_patch_xy_created_ids )
#---------------------------------------------------------------------
#  Get the surface id for surface label = 1.
i_label = 1
 
db_get_surface_id                                @
   (  i_label,                                   @
      i_surface_id )
 
dump i_surface_id
 
#  i_entitytype = 3 (surface)
i_entitytype = 3
#---------------------------------------------------------------------
#  Get the surface blob size.
sgm_db_get_blob_size                             @
   (  i_entitytype,                              @
      i_surface_id,                              @
      i_blobsize,                                @
      i_return_value )
 
dump i_return_value
 
SYS_ALLOCATE_ARRAY(rv_surface_blob,1,i_blobsize)
#---------------------------------------------------------------------
#  Get the surface blob.
sgm_db_get_surface                               @
   (  i_surface_id,                              @
      i_blobsize,                                @
      rv_surface_blob,                           @
      i_return_value )
dump i_return_value
#---------------------------------------------------------------------
#  Defining the size of the curve blob
i_curve_blob_size = i_blobsize + 50
sys_allocate_array(ra_curve_blob_out, 1, i_curve_blob_size)
#---------------------------------------------------------------------
#  Get the curve blob.
 
i_direction = 2
r_param_value  =  0.3
 
i_return_value =                                 @
   sgm_create_curve_on_surface                   @
      (  i_direction,                            @
         r_param_value,                          @
         rv_surface_blob,                        @
         ra_curve_blob_out )
dump i_return_value
dump ra_curve_blob_out
#---------------------------------------------------------------------
sys_free_array(rv_surface_blob)
sys_free_array(ra_curve_blob_out)
#---------------------------------------------------------------------
 
sgm_create_surface_composite_c
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_create_surface_composite_c()
#
#                      In this illustration, a new database is opened
#                      3 surfaces are created. Then the function is 
#                      called to create the composite surface using 
#                      the created surfaces.
#
#                      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 sgm_create_surface_composite_c()
#  has the following arguments:
#
#  sgm_create_surface_composite_c
#     (  output_labels,
#        surface_list,
#        flag,
#        gaptol,
#        delete_cons,
#        implicit_topology,
#        created_labels )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_output_labels[128]
STRING   s_surface_list[128]
INTEGER  i_flag
REAL     r_cleantol
REAL     r_gaptol
INTEGER  i_curve_start_label
INTEGER  i_loop_id
STRING   s_add_list[128]
STRING   s_remove_list[128]
STRING   s_inner_loop_list[128]
STRING   s_vertex_list[128]
LOGICAL  l_delete_cons
LOGICAL  l_implicit_topology
STRING   sv_created_labels[VIRTUAL]
INTEGER  i_return_value
INTEGER  seg
INTEGER  status
INTEGER  flag1
REAL     tol1
STRING   sv_asm_create_grid_xyz_creat_id[VIRTUAL]
STRING   sv_asm_line_3point_creat_id[VIRTUAL]
STRING   sv_sgm_surface_2curve_creat_id[VIRTUAL]
STRING   sv_asm_create_patch_xy_creat_id[VIRTUAL]
STRING   sv_sgm_transform_surf_creat_id[VIRTUAL]
#---------------------------------------------------------------------
#  Open a new database
uil_file_new.go( "", "new.db" )
$? YES 36000002
#---------------------------------------------------------------------
#  Show the labels of the surfaces
surface_label(TRUE)
#---------------------------------------------------------------------
#  Create a patch (Surface).
i_return_value =                                 @
   asm_const_patch_xyz( "1", "<10 10 0>",        @
      "[0 0 0]", "Coord 0",                      @
      sv_asm_create_patch_xy_creat_id )
dump i_return_value
#---------------------------------------------------------------------
#  Create 3 points
i_return_value =                                 @
   asm_const_grid_xyz                            @
      ( "", "[2 15 0][5 13 0][8 15 0]",          @
        "Coord 0",                               @
        sv_asm_create_grid_xyz_creat_id )
dump i_return_value
#---------------------------------------------------------------------
#  Create one line passing through the 3 points created.
i_return_value =                                 @
   asm_const_line_3point( "1", "Point 5 ",       @
      "Point 6 ", "Point 7 ", 1, 0.5,            @
      sv_asm_line_3point_creat_id )
dump i_return_value
#---------------------------------------------------------------------
#  Create the surface using the two curves.
i_return_value =                                 @
   sgm_const_surface_2curve( "2",                @
      "Surface 1.2", "Curve 1 ",                 @
      sv_sgm_surface_2curve_creat_id )
dump i_return_value
#---------------------------------------------------------------------
#  Mirror the surface
i_return_value =                                 @
   sgm_transform_mirror( "3", "surface",         @
      "Coord 0.2", 5.0, TRUE, FALSE,             @
      "Surface 2 ", sv_sgm_transform_surf_creat_id )
dump i_return_value
#---------------------------------------------------------------------
#  Create the composite surface using Surface 3 1 2.  Surface 4 will
#  be created in place of Surfaces 3 1 2 and the old surfaces are 
#  deleted.
#
s_output_labels= "4"
s_surface_list = "Surface 3 1 2"
i_flag = 0
r_cleantol = 0.1
r_gaptol = 0.005
i_curve_start_label = 5
i_loop_id = 1
s_add_list = ""
s_remove_list = ""
s_inner_loop_list = ""
s_vertex_list = ""
l_delete_cons = TRUE
l_implicit_topology = TRUE
 
  if (!sgm_create_surface_comptrim.is_inter_active() ) then
     flag1 = i_flag + 0x0100
     status =  sgm_reg_get_free_edge_list(s_surface_list,s_inner_loop_list,flag1,@
               i_curve_start_label, tol1)
     flag1 = 0x0100 
     status = sgm_reg_mod_free_edge_list( s_add_list,s_remove_list,seg,flag1)
     if (l_implicit_topology) then
        status = sgm_reg_load_vertex_list(" ",i_flag)
     else
        status = sgm_reg_load_vertex_list(s_vertex_list,i_flag)
     end if
     flag1 = i_flag + 0x0100
     status = sgm_create_surface_comptrim.check_cb(r_cleantol,flag1, i_loop_id )
  end if
 
i_return_value =                                 @
   sgm_create_surface_composite_c                @
      (  s_output_labels,                        @
         s_surface_list,                         @
         i_flag,                                 @
         r_gaptol,                               @
         l_delete_cons,                          @
         l_implicit_topology,                    @
         sv_created_labels )
$? YES 38000219
dump i_return_value
#---------------------------------------------------------------------
#  Created Labels
dump sv_created_labels
 
#  Observe the Surface 4 created
#---------------------------------------------------------------------
sys_free_string( sv_created_labels )
sys_free_string( sv_asm_line_3point_creat_id )
sys_free_string( sv_asm_create_grid_xyz_creat_id )
sys_free_string( sv_sgm_surface_2curve_creat_id )
sys_free_string( sv_asm_create_patch_xy_creat_id )
sys_free_string( sv_sgm_transform_surf_creat_id )
#---------------------------------------------------------------------
 
sgm_create_surface_comptrim_v1
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_create_surface_comptrim_v1()
#
#                      In this illustration, a new database is opened.
#                      A surface and 5 curves are created. Four curves
#                      are converted into a composite curve. Then the
#                      function is called to create a trimmed surface
#                      between the composite curve and the fifth 
#                      circular curve.
#
#                      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 sgm_create_surface_comptrim_v1()
#  has the following arguments:
#
#    sgm_create_surface_comptrim_v1
#     (   output_ids,
#         surface_list,
#         curvo_list,
#         curvi_list,
#         gap_dist,
#         delete_surface,
#         delete_ocurve,
#         delete_icurve,
#         implicit_topo,
#         created_ids  )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_output_ids[128]
STRING   s_surface_list[32]
STRING   s_curveo_list[128]
STRING   s_curvei_list[128]
REAL     r_gap_dist
LOGICAL  l_delete_surface
LOGICAL  l_delete_ocurve
LOGICAL  l_delete_icurve
LOGICAL  l_implicit_topo
STRING   sv_created_ids[VIRTUAL]
INTEGER  i_return_value
INTEGER  i_sgm_create_curve_aut_segt_id
STRING   sv_asm_create_patch_xy_creat_id[VIRTUAL]
STRING   sv_asm_create_grid_xyz_creat_id[VIRTUAL]
STRING   sv_asm_line_2point_creat_id[VIRTUAL]
STRING   sv_sgm_create_curve_2d_creat_id[VIRTUAL]
STRING   sv_sgm_creat_cur_creat_curve_id[VIRTUAL]
#---------------------------------------------------------------------
#  Open a new database
uil_file_new.go( "", "new.db" )
$? YES 36000002
#---------------------------------------------------------------------
#  Show the labels of the surfaces and curves.
surface_label(TRUE)
curve_label(TRUE)
#---------------------------------------------------------------------
#  Create a patch.
i_return_value =                                 @
   asm_const_patch_xyz( "1", "<10 10 0>",        @
      "[0 0 0]", "Coord 0",                      @
      sv_asm_create_patch_xy_creat_id )
dump i_return_value
#---------------------------------------------------------------------
#  Create 4 points.
i_return_value =                                 @
   asm_const_grid_xyz( "", "[5 0 0] [0 5 0] "//  @
      "[5 10 0][10 5 0]",                        @
      "Coord 0", sv_asm_create_grid_xyz_creat_id )
dump i_return_value
#---------------------------------------------------------------------
#  Create 4 curves.
i_return_value =                                 @
   asm_const_line_2point( "", "Point 5:8 ",      @
      "Point 6 7 8 5", 0, "", 50., 1,            @
      sv_asm_line_2point_creat_id )
dump i_return_value
#---------------------------------------------------------------------
#  Create a circular curve.
i_return_value =                                 @
   sgm_const_curve_2d_circle_v1( "", 1, 1.,      @
      "Coord 0.3", "", "[5 5 0]", TRUE ,         @
      sv_sgm_create_curve_2d_creat_id )
dump i_return_value
#---------------------------------------------------------------------
#  Convert the Curve 1:4 into a chain curve.
i_return_value =                                 @
   sgm_create_curve_chain_v1( "10",              @
   " Curve 1:4", TRUE,                           @
   i_sgm_create_curve_aut_segt_id,               @
   sv_sgm_creat_cur_creat_curve_id )
$? YES 38000217
dump i_return_value
#---------------------------------------------------------------------
#  Call the function to create a trimmed surface inside the Surface 1
#  with Curve 10 as outer boundary trim curve and Curve 5 as inner
#  boundary trim curve.
#
s_output_ids     = "2"
s_surface_list   = "Surface 1"
s_curveo_list    = "Curve 10"
s_curvei_list    = "Curve 5"
r_gap_dist       =  0.0
l_delete_surface = TRUE
l_delete_ocurve  = TRUE
l_delete_icurve  = TRUE
l_implicit_topo  = TRUE
 
i_return_value =                                 @
   sgm_create_surface_comptrim_v1                @
      (  s_output_ids,                           @
         s_surface_list,                         @
         s_curveo_list,                          @
         s_curvei_list,                          @
         r_gap_dist,                             @
         l_delete_surface,                       @
         l_delete_ocurve,                        @
         l_delete_icurve,                        @
         l_implicit_topo,                        @
         sv_created_ids )
$? YES 38000217
$? YES 38000217
$? YES 38000219
dump i_return_value
 
#  Created surface is 
dump sv_created_ids
#---------------------------------------------------------------------
sys_free_string( sv_created_ids )
sys_free_string( sv_asm_create_patch_xy_creat_id )
sys_free_string( sv_asm_create_grid_xyz_creat_id )
sys_free_string( sv_asm_line_2point_creat_id )
sys_free_string( sv_sgm_create_curve_2d_creat_id )
sys_free_string( sv_sgm_creat_cur_creat_curve_id )
#---------------------------------------------------------------------
 
sgm_create_surface_from_elems1
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_create_surface_from_elems1()
#
#                      This function creates surface from elements.
#
#                      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 sgm_create_surface_from_elems1()
#  has the following arguments:
#
#  sgm_create_surface_from_elems1
#     (  surface_label_val,
#        elem_list,
#        preview,
#        node_list,
#        inner_loop_option,
#        inner_loop_nodes,
#        delete_orig,
#        smoother_option,
#        corner_node_ids,
#        deleted_ids,
#        created_label  )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING  fem_create_nodes__nodes_created[VIRTUAL]
STRING  fem_create_elemen_elems_created[VIRTUAL]
INTEGER surface_label_val
STRING  s_element_list[32]
INTEGER i_preview
STRING  s_node_list[32]
INTEGER i_inner_loop_option
STRING  s_inner_loop_nodes[32]
LOGICAL l_delete_original
INTEGER i_smoother_option
INTEGER sgm_create_surf_corner_node_ids(4)
STRING  sgm_create_surface__deleted_ids[VIRTUAL]
STRING  sgm_create_surfac_created_label[VIRTUAL]
INTEGER i_return_value
#---------------------------------------------------------------------
#  Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
#---------------------------------------------------------------------
#  Creating four nodes.
 
i_return_value = fem_create_nodes_1(                    @
                     "Coord 0",                         @
                     "Coord 0",                         @
                     2,                                 @
                     "#",                               @
                     " [0 0 0]",                        @
                     fem_create_nodes__nodes_created )
dump i_return_value
 
i_return_value = fem_create_nodes_1(                    @
                     "Coord 0",                         @
                     "Coord 0",                         @
                     2,                                 @
                     "#",                               @
                     " [1 0 0]",                        @
                     fem_create_nodes__nodes_created )
dump i_return_value
 
i_return_value = fem_create_nodes_1(                    @
                     "Coord 0",                         @
                     "Coord 0",                         @
                     2,                                 @
                     "#",                               @
                     " [1 1 0]",                        @
                     fem_create_nodes__nodes_created )
dump i_return_value
 
i_return_value = fem_create_nodes_1(                    @
                     "Coord 0",                         @
                     "Coord 0",                         @
                     2,                                 @
                     "#",                               @
                     " [0 1 0]",                        @
                     fem_create_nodes__nodes_created )
dump i_return_value
#---------------------------------------------------------------------
#  Creating element.
 
i_return_value =  fem_create_elems_1(                   @
                     "Quad",                            @
                     "Quad4",                           @
                     "1",                               @
                     "Standard",                        @
                     2,                                 @
                     "Node 1","Node 2","Node 3",        @
                     "Node 4", "", "", "", "",          @
                     fem_create_elemen_elems_created )
dump i_return_value
#---------------------------------------------------------------------
#  Putting on the labels.
 
point_label(TRUE)
curve_label(TRUE)
node_label(TRUE)
quad_elem_label( TRUE )
#---------------------------------------------------------------------
#  Creating the surface from the element in it's place by using 
#  the function sgm_create_surface_from_elems1().
 
surface_label_val    =  1
s_element_list       =  "Elm 1"
i_preview            =  0
s_node_list          =  ""
i_inner_loop_option  =  0
s_inner_loop_nodes   =  ""
l_delete_original    =  FALSE
i_smoother_option    =  1
 
i_return_value =  sgm_create_surface_from_elems1(       @
                     surface_label_val ,                @
                     s_element_list,                    @
                     i_preview,                         @
                     s_node_list,                       @
                     i_inner_loop_option,               @
                     s_inner_loop_nodes,                @
                     l_delete_original,                 @
                     i_smoother_option,                 @
                     sgm_create_surf_corner_node_ids,   @
                     sgm_create_surface__deleted_ids,   @
                     sgm_create_surfac_created_label   )
 
dump i_return_value
dump sgm_create_surf_corner_node_ids
dump sgm_create_surface__deleted_ids
dump sgm_create_surfac_created_label
#---------------------------------------------------------------------
sys_free_string(sgm_create_surface__deleted_ids)
sys_free_string(sgm_create_surfac_created_label)
#---------------------------------------------------------------------
 
sgm_curve_convert_s_to_u
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_curve_convert_s_to_u()
#
#                      This routine determines the corresponding
#                      coordinates for various input values of percent
#                      arclength along the curve.
#
#                      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 sgm_curve_convert_s_to_u()
#  has the following arguments:
#
#  sgm_curve_convert_s_to_u
#     (  curve_data,
#        num_points,
#        s,
#        u,
#        status   )
#
#---------------------------------------------------------------------
#  Variable Declarations
 
REAL     ra_curve_data(VIRTUAL)
INTEGER  i_num_points
REAL     ra_u(VIRTUAL)
REAL     ra_s(2)
INTEGER  i_surface_id
INTEGER  i_label
STRING   asm_create_patch_xy_created_ids[VIRTUAL]
INTEGER  i_entitytype
INTEGER  i_blobsize
INTEGER  i_curve_blob_size
INTEGER  i_direction
REAL     r_param_value
REAL     rv_surface_blob(VIRTUAL)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
 
i_return_value =                                 @
   ga_view_aa_set( 23., -34., 0. )
dump i_return_value
 
solid_label(TRUE)
surface_label(TRUE)
#---------------------------------------------------------------------
#  Creating a Surface.
 
i_return_value = asm_const_patch_xyz(            @
                     "1",                        @
                     "<1 1 0>",                  @
                     "[0 0 0]",                  @
                     "Coord 0",                  @
                     asm_create_patch_xy_created_ids )
#---------------------------------------------------------------------
#  Get the surface id for surface label = 1.
i_label = 1
 
db_get_surface_id                                @
   (  i_label,                                   @
      i_surface_id )
 
dump i_surface_id
 
#  i_entitytype = 3 (surface)
i_entitytype = 3
#---------------------------------------------------------------------
#  Get the surface blob size.
sgm_db_get_blob_size                              @
   (  i_entitytype,                               @
      i_surface_id,                               @
      i_blobsize,                                 @
      i_return_value )
 
dump i_return_value
 
SYS_ALLOCATE_ARRAY(rv_surface_blob,1,i_blobsize)
#---------------------------------------------------------------------
#  Get the surface blob.
sgm_db_get_surface                                @
   (  i_surface_id,                               @
      i_blobsize,                                 @
      rv_surface_blob,                            @
      i_return_value )
dump i_return_value
#---------------------------------------------------------------------
#  Defining the size of the curve blob
i_curve_blob_size = i_blobsize + 50
sys_allocate_array(ra_curve_data, 1, i_curve_blob_size)
#---------------------------------------------------------------------
#  Get the curve blob.
 
i_direction = 2
r_param_value  =  0.3
 
i_return_value =                                  @
   sgm_create_curve_on_surface                    @
      (  i_direction,                             @
         r_param_value,                           @
         rv_surface_blob,                         @
         ra_curve_data )
dump i_return_value
#---------------------------------------------------------------------
# Using the function to convert the coordinates.
 
i_num_points  =  2
ra_s          =  [1.0, 0.2]
 
sys_allocate_array(ra_u,1,i_num_points)
 
   sgm_curve_convert_s_to_u                       @
      (  ra_curve_data,                           @
         i_num_points,                            @
         ra_s,                                    @
         ra_u,                                    @
         i_return_value              )
 
dump i_return_value
dump ra_u
#---------------------------------------------------------------------
sys_free_array(rv_surface_blob)
sys_free_array(ra_curve_data)
#---------------------------------------------------------------------
 
sgm_curve_convert_u_to_s
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_curve_convert_u_to_s()
#
#                      This function determines the corresponding 
#                      arclength coordinates for various input values 
#                      of parametric coordinates along the curve.
#
#                      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 sgm_curve_convert_u_to_s()
#  has the following arguments:
#
#  sgm_curve_convert_u_to_s
#     (  curve_data,
#        num_points,
#        u,
#        s,
#        status   )
#
#---------------------------------------------------------------------
#  Variable Declarations
 
REAL     ra_curve_data(VIRTUAL)
INTEGER  i_num_points
REAL     ra_s(VIRTUAL)
REAL     ra_u(2)
INTEGER  i_surface_id
INTEGER  i_label
STRING   asm_create_patch_xy_created_ids[VIRTUAL]
INTEGER  i_entitytype
INTEGER  i_blobsize
INTEGER  i_curve_blob_size
INTEGER  i_direction
REAL     r_param_value
REAL     rv_surface_blob(VIRTUAL)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
 
i_return_value =                                 @
   ga_view_aa_set( 23., -34., 0. )
dump i_return_value
 
solid_label(TRUE)
surface_label(TRUE)
#---------------------------------------------------------------------
#  Creating a Surface.
 
i_return_value = asm_const_patch_xyz(            @
                     "1",                        @
                     "<1 1 0>",                  @
                     "[0 0 0]",                  @
                     "Coord 0",                  @
                     asm_create_patch_xy_created_ids )
#---------------------------------------------------------------------
#  Get the surface id for surface label = 1.
i_label = 1
 
db_get_surface_id                                @
   (  i_label,                                   @
      i_surface_id )
 
dump i_surface_id
 
#  i_entitytype = 3 (surface)
i_entitytype = 3
#---------------------------------------------------------------------
#  Get the surface blob size.
sgm_db_get_blob_size                             @
   (  i_entitytype,                              @
      i_surface_id,                              @
      i_blobsize,                                @
      i_return_value )
 
dump i_return_value
 
SYS_ALLOCATE_ARRAY(rv_surface_blob,1,i_blobsize)
#---------------------------------------------------------------------
#  Get the surface blob.
sgm_db_get_surface                               @
   (  i_surface_id,                              @
      i_blobsize,                                @
      rv_surface_blob,                           @
      i_return_value )
dump i_return_value
#---------------------------------------------------------------------
#  Defining the size of the curve blob
i_curve_blob_size = i_blobsize + 50
sys_allocate_array(ra_curve_data, 1, i_curve_blob_size)
#---------------------------------------------------------------------
#  Get the curve blob.
 
i_direction = 2
r_param_value  =  0.3
 
i_return_value =                                 @
   sgm_create_curve_on_surface                   @
      (  i_direction,                            @
         r_param_value,                          @
         rv_surface_blob,                        @
         ra_curve_data )
dump i_return_value
#---------------------------------------------------------------------
# Using the function to convert the coordinates.
 
i_num_points  =  2
ra_u          =  [1.0, 0.2]
 
sys_allocate_array(ra_s,1,i_num_points)
   sgm_curve_convert_u_to_s                      @
      (  ra_curve_data,                          @
         i_num_points,                           @
         ra_u,                                   @
         ra_s,                                   @
         i_return_value              )
 
dump i_return_value
dump ra_s
#---------------------------------------------------------------------
sys_free_array(rv_surface_blob)
sys_free_array(ra_curve_data)
#---------------------------------------------------------------------
sgm_curve_evaluate
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_curve_evaluate()
#
#                      This function is a high level traffic cop for
#                      curve evaluation. This file opens the database
#                      “spool.ses” and gets the geometric description
#                      of the curve with label = 1 using the function
#                      sgm_db_get_curve. Later it uses the function
#                      sgm_curve_evaluate to get the output table for
#                      parametric coordinate 0.3 and the control flag
#                      set to 0.
#
#                      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 sgm_curve_evaluate()
#  has the following arguments:
#
#  sgm_curve_evaluate
#     (  s,
#        ui,
#        in,
#        pd,
#        irc )
#
#---------------------------------------------------------------------
#  Variable Declarations
REAL     ra_s(VIRTUAL)
REAL     r_ui
INTEGER  i_in
REAL     ra_pd(1,3)
INTEGER  i_curveid
INTEGER  i_blobsize
INTEGER  i_entitytype
INTEGER  i_label
INTEGER  i_status
INTEGER  i_irc
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  r_ui = 0.3
r_ui = 0.3
#  i_in = 0
i_in = 0
 
#  i_label = 1
i_label = 1
 
#  Get the internal db id for curve label = 1.
db_get_curve_id                                   @
   (  i_label,                                    @
      i_curveid )
 
dump i_curveid
 
#  i_entitytype = 2 (curve)
i_entitytype = 2
 
#  Get the blob size.
sgm_db_get_blob_size                              @
   (  i_entitytype,                               @
      i_curveid,                                  @
      i_blobsize,                                 @
      i_status )
 
dump i_blobsize
dump i_status
 
SYS_ALLOCATE_ARRAY(ra_s,1,i_blobsize)
 
sgm_db_get_curve                                  @
   (  i_curveid,                                  @
      i_blobsize,                                 @
      ra_s,                                       @
      i_status )
 
dump ra_s
dump i_status
 
sgm_curve_evaluate                                @
   (  ra_s,                                       @
      r_ui,                                       @
      i_in,                                       @
      ra_pd,                                      @
      i_irc )
 
dump i_irc
dump r_ui
dump i_in
dump i_irc
 
#  Output data table
dump ra_pd
 
#---------------------------------------------------------------------
sgm_db_get_blob_size
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_db_get_blob_size()
#
#                      This function finds the size of the blob for
#                      an entity type. This file opens the  database
#                      “spool.db” and gets the size of blob for the
#                      curve entity type. This database has thirteen
#                      curves, ten of which are orphans, with labels
#                      1 to 3.
#
#                      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.
#                      on the menu bar.
#
#  The function sgm_db_get_blob_size()
#  has the following arguments:
#
#  sgm_db_get_blob_size
#     (  entitytype,
#        entityid,
#        blobsize,
#        status )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_entitytype
INTEGER  i_entityid
INTEGER  i_label
INTEGER  i_blobsize
INTEGER  i_status
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  i_entitytype = 2 (curve)
i_entitytype = 2
 
#  Find the internal id for curve label = 1.
i_label = 1.
db_get_curve_id                                   @
   (  i_label,                                    @
      i_entityid )
 
dump i_entityid
 
sgm_db_get_blob_size                              @
   (  i_entitytype,                               @
      i_entityid,                                 @
      i_blobsize,                                 @
      i_status )
 
#  Error status
dump i_status
 
#  Size of blob is
dump i_blobsize
 
#---------------------------------------------------------------------
sgm_db_get_company_of_origin
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_db_get_company_of_origin()
#
#                      This function gets the company of origin and
#                      the type for a specific entity given the id
#                      of the entity.This file opens a database
#                      “spool.db” and gets the company of origin and
#                      type for the point entity. This database has
#                      seven points with id label 4 to 10.
#
#                      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 sgm_db_get_company_of_origin()
#  has the following arguments:
#
#  sgm_db_get_company_of_origin
#     (  dbtype,
#        entityid,
#        compoforg,
#        geometrytype,
#        status )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_dbtype
INTEGER  i_entityid
INTEGER  i_label
INTEGER  i_compoforg
INTEGER  i_geometrytype
INTEGER  i_status
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  i_dbtype = 1
i_dbtype = 1
 
#  Find the internal id for point label = 4.
i_label = 4.
db_get_point_id                                   @
   (  i_label,                                    @
      i_entityid )
 
dump i_entityid
 
sgm_db_get_company_of_origin                      @
   (  i_dbtype,                                   @
      i_entityid,                                 @
      i_compoforg,                                @
      i_geometrytype,                             @
      i_status )
 
#  Error Status
dump i_status
 
#  The company of origin is
dump i_compoforg
 
#  The geometry type is
dump i_geometrytype
 
#---------------------------------------------------------------------
sgm_db_get_curve
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_db_get_curve()
#
#                      This function gets the geometric definition of
#                      a curve from the database. This file opens a
#                      database “spool.db” and gets the geometric
#                      definition of the curve with label = 1. This
#                      database has thirteen curves, ten of which are
#                      orphans, with labels 1 to 3.
#
#                      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 sgm_db_get_curve()
#  has the following arguments:
#
#  sgm_db_get_curve
#     (  curveid,
#        blobsize,
#        blob,
#        status )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_curveid
INTEGER  i_blobsize
INTEGER  i_entitytype
INTEGER  i_label
REAL     ra_blob(VIRTUAL)
INTEGER  i_status
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  i_label = 1
i_label = 1
 
#  Get the internal  id for curve label = 1.
db_get_curve_id                                   @
   (  i_label,                                    @
      i_curveid )
 
dump i_curveid
 
#  i_entitytype = 2 (curve)
i_entitytype = 2
 
#  Get the blob size.
sgm_db_get_blob_size                              @
   (  i_entitytype,                               @
      i_curveid,                                  @
      i_blobsize,                                 @
      i_status )
 
dump i_blobsize
dump i_status
 
SYS_ALLOCATE_ARRAY(ra_blob,1,i_blobsize)
 
sgm_db_get_curve                                  @
   (  i_curveid,                                  @
      i_blobsize,                                 @
      ra_blob,                                    @
      i_status )
 
dump i_status
 
#  The Geometric description of the curve with label = 1 is
dump ra_blob
 
SYS_FREE_ARRAY(ra_blob)
#---------------------------------------------------------------------
sgm_db_get_edge_vertex_ids
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_db_get_edge_vertex_ids()
#
#                      This function gets the vertex ids for an edge
#                      given the id of the edge.This file opens a 
#                      new database “new.db” and creates four curves 
#                      with label 1 to 4.Later it gets the vertex ids
#                      for edge with label = 3.
#
#                      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 sgm_db_get_edge_vertex_ids()
#  has the following arguments:
#
#  sgm_db_get_edge_vertex_ids
#     (  edgeid,
#        vertexids )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_edgeid
INTEGER  i_label
INTEGER  ia_vertexids(2)
STRING   sv_asm_line_2point_created_ids[VIRTUAL]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Create four curves
asm_const_line_2point( “1”, “[0 0 0]”, “[1 0 0]”, 0, ““, 50., 1,  @
sv_asm_line_2point_created_ids )
asm_const_line_2point( “2”, “[1 0 0]”, “[1 1 0]”, 0, ““, 50., 1,  @
sv_asm_line_2point_created_ids )
asm_const_line_2point( “3”, “[1 1 0]”, “[0 1 0]”, 0, ““, 50., 1,  @
sv_asm_line_2point_created_ids )
asm_const_line_2point( “4”, “[0 1 0]”, “[0 0 0]”, 0, ““, 50., 1,  @
sv_asm_line_2point_created_ids )
 
#  Get the edge id for edge label = 3.
#  i_label = 3
i_label = 3
db_get_curve_id(  i_label,                        @
                  i_edgeid )
 
i_return_value =                                  @
   sgm_db_get_edge_vertex_ids                     @
      (  i_edgeid,                                @
         ia_vertexids )
 
dump i_return_value
 
#  The vertex ids for edge with label = 3 are
dump ia_vertexids
 
SYS_FREE_STRING(sv_asm_line_2point_created_ids)
#---------------------------------------------------------------------
sgm_db_get_gen_body_face_ids
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_db_get_gen_body_face_ids()
#
#                      This function gets the face ids for a solid
#                      given the solid id.This file opens a new
#                      database “new.db” and creates two solids with
#                      label 1 and 2.Later it gets the face ids for 
#                      the solid with the label 1.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function sgm_db_get_gen_body_face_ids()
#  has the following arguments:
#
#  sgm_db_get_gen_body_face_ids
#     (  bodyid,
#        numberfaces,
#        faceids,
#        faceorients,
#        facesense,
#        status )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_bodyid
INTEGER  i_label
INTEGER  i_numberfaces
INTEGER  iv_faceids(VIRTUAL)
INTEGER  iv_faceorients(VIRTUAL)
INTEGER  iv_facesense(VIRTUAL)
STRING   sv_asm_create_hpat_xyz[VIRTUAL]
INTEGER  i_status
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Create two solid enities
asm_const_hpat_xyz( “1”, “<1 1 1>”, “[0 0 0]”, “Coord 0”,  @
sv_asm_create_hpat_xyz)
asm_const_hpat_xyz( “2”, “<-1 1 1>”, “[0 0 0]”, “Coord 0”, @
sv_asm_create_hpat_xyz)
 
ga_view_aa_set( 23., -34., 0. )
uil_toolbar.labels_on(  )
 
#  Get the id of the surface for label = 1
#  i_label = 1
i_label = 1
db_get_solid_id                                   @
   ( i_label,                                     @
     i_bodyid )
 
#  Get the number of faces for the  body with label =1
sgm_db_get_num_faces_body( i_bodyid,              @ 
                           i_numberfaces,         @
                           i_status )
 
SYS_ALLOCATE_ARRAY(iv_faceids,1,i_numberfaces)
SYS_ALLOCATE_ARRAY(iv_faceorients,1,i_numberfaces)
SYS_ALLOCATE_ARRAY(iv_facesense,1,i_numberfaces)
 
sgm_db_get_gen_body_face_ids                      @
   (  i_bodyid,                                   @
      i_numberfaces,                              @
      iv_faceids,                                 @
      iv_faceorients,                             @
      iv_facesense,                               @
      i_status )
 
dump i_status
 
#  The ids for the faces of the body are
dump iv_faceids
 
#  The orientations of the faces of the body are
dump iv_faceorients
 
#  The sense of the normals are
dump iv_facesense
 
SYS_FREE_ARRAY(iv_faceids) 
SYS_FREE_ARRAY(iv_faceorients) 
SYS_FREE_ARRAY(iv_facesense) 
SYS_FREE_STRING(sv_asm_create_hpat_xyz)
#---------------------------------------------------------------------
 
sgm_db_get_gen_body_vertex_ids
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_db_get_gen_body_vertex_ids()
#
#                      This function gets the vertex ids for a solid
#                      given the solid id.This file opens a new
#                      database “new.db” and creates two solids with
#                      label 1 and 2.Later it gets the vertex ids for 
#                      the solid with the label 1.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function sgm_db_get_gen_body_vertex_ids()
#  has the following arguments:
#
#  sgm_db_get_gen_body_vertex_ids
#     (  bodyid,
#        numvert,
#        vertexids,
#        status )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_label
INTEGER  i_bodyid
INTEGER  i_numvert
INTEGER  iv_vertexids(VIRTUAL)
STRING   sv_asm_create_hpat_xyz[VIRTUAL]
INTEGER  i_status
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Create two solid entities
asm_const_hpat_xyz( “1”, “<1 1 1>”, “[0 0 0]”, “Coord 0”,  @
sv_asm_create_hpat_xyz)
asm_const_hpat_xyz( “2”, “<-1 1 1>”, “[0 0 0]”, “Coord 0”, @
sv_asm_create_hpat_xyz)
 
ga_view_aa_set( 23., -34., 0. )
uil_toolbar.labels_on(  )
 
#  Get the id of the solid with label =1
#  i_label = 1
i_label = 1
db_get_solid_id(  i_label,                        @
                  i_bodyid )
 
sgm_db_get_num_vertices_body( i_bodyid,           @
                              i_numvert,          @
                              i_status )
 
dump i_numvert
SYS_ALLOCATE_ARRAY(iv_vertexids,1,i_numvert)
sgm_db_get_gen_body_vertex_ids                    @
   (  i_bodyid,                                   @
      i_numvert,                                  @
      iv_vertexids,                               @
      i_status )
 
dump i_status
 
#  The vertex ids for solid with label =1 are
dump iv_vertexids
 
SYS_FREE_ARRAY(iv_vertexids) 
SYS_FREE_STRING(sv_asm_create_hpat_xyz)
#---------------------------------------------------------------------
sgm_db_get_gen_face_edge_ids
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_db_get_gen_face_edge_ids()
#
#                      This function gets the loop ids,edge ids and
#                      orientations for a surface.This file opens a
#                      new database “new.db” and creates two surfaces
#                      with labels 1 and 2.Later it gets the loop ids,
#                      edge ids and edge orientations for the surface 
#                      with label = 2.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function sgm_db_get_gen_face_edge_ids()
#  has the following arguments:
#
#  sgm_db_get_gen_face_edge_ids
#     (  surfaceid,
#        numberloops,
#        numberedges,
#        loopids,
#        edgeids,
#        edgeorients )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_label
INTEGER  ia_numegloop(8)
LOGICAL  l_getedges = FALSE
INTEGER  i_status
INTEGER  i_surfaceid
INTEGER  i_numberloops
INTEGER  i_numberedges
INTEGER  iv_loopids(VIRTUAL)
INTEGER  iv_edgeids(VIRTUAL)
INTEGER  iv_edgeorients(VIRTUAL)
STRING   sv_asm_create_patch_xy[VIRTUAL]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Create two surfaces
asm_const_patch_xyz( “1”, “<1 1 0>”, “[0 0 0]”, “Coord 0”,  @
sv_asm_create_patch_xy)
asm_const_patch_xyz( “2”, “<0 1 1>”, “[0 0 0]”, “Coord 0”,  @
sv_asm_create_patch_xy)
 
uil_toolbar.labels_on(  )
ga_view_aa_set( 23., -34., 0. )
 
#  Get the id for surface label = 1.
#  i_label = 1
i_label = 1
db_get_surface_id(  i_label,                      @
                    i_surfaceid )
 
#  Get the number of edges and number of loops for the surface 
#  with label = 1.
sgm_db_get_num_loops_face( i_surfaceid,           @
                           l_getedges,            @
                           i_numberloops,         @
                           i_numberedges,         @
                           ia_numegloop,          @
                           i_status )
 
SYS_ALLOCATE_ARRAY(iv_loopids,1,i_numberedges)
SYS_ALLOCATE_ARRAY(iv_edgeids,1,i_numberedges)
SYS_ALLOCATE_ARRAY(iv_edgeorients,1,i_numberedges)
 
i_return_value =                                  @
   sgm_db_get_gen_face_edge_ids                   @
      (  i_surfaceid,                             @
         i_numberloops,                           @
         i_numberedges,                           @
         iv_loopids,                              @
         iv_edgeids,                              @
         iv_edgeorients )
 
dump i_return_value 
 
#  Loop handle for each edge are 
dump iv_loopids
#  The ids of edge are
dump iv_edgeids
#  The orientations of the edge are
dump iv_edgeorients
 
SYS_FREE_ARRAY(iv_loopids)
SYS_FREE_ARRAY(iv_edgeids)
SYS_FREE_ARRAY(iv_edgeorients)
SYS_FREE_STRING(sv_asm_create_patch_xy)
#---------------------------------------------------------------------
sgm_db_get_gen_face_vertex_ids
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_db_get_gen_face_vertex_ids()
#
#                      This function gets the vertex ids for a surface 
#                      given an id.This file opens a new database
#                      “new.db” and creates two surfaces with labels
#                      1 and 2.Later it gets the vertex ids for
#                      surface with label = 2.The created surfaces are
#                      square surfaces with 4 vertices.
#
#                      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 sgm_db_get_gen_face_vertex_ids()
#  has the following arguments:
#
#  sgm_db_get_gen_face_vertex_ids
#     (  surfaceid,
#        numberverts,
#        vertexids )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_surfaceid
INTEGER  i_label
INTEGER  i_numberverts
INTEGER  iv_vertexids(VIRTUAL)
STRING   sv_asm_create_patch_xy[VIRTUAL]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Create two surfaces
asm_const_patch_xyz( “1”, “<1 1 0>”, “[0 0 0]”, “Coord 0”,  @
sv_asm_create_patch_xy)
asm_const_patch_xyz( “2”, “<0 1 1>”, “[0 0 0]”, “Coord 0”,  @
sv_asm_create_patch_xy)
 
ga_view_aa_set( 23., -34., 0. )
uil_toolbar.labels_on(  )
 
#  i_label = 2
i_label = 2
 
db_get_surface_id( i_label,                       @
                   i_surfaceid )
 
#  i_numberverts = 4
i_numberverts = 4
 
SYS_ALLOCATE_ARRAY(iv_vertexids,1,i_numberverts)
i_return_value =                                  @
   sgm_db_get_gen_face_vertex_ids                 @
      (  i_surfaceid,                             @
         i_numberverts,                           @
         iv_vertexids )
 
dump i_return_value
 
#  The vertex ids for the surface with label = 2 are
dump iv_vertexids
 
SYS_FREE_ARRAY(iv_vertexids)
SYS_FREE_STRING(sv_asm_create_patch_xy)
#---------------------------------------------------------------------
sgm_db_get_num_edges_face
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_db_get_num_edges_face()
#
#                      This function gets the number of edges for the
#                      specified surface.This file opens a new
#                      database “new.db” and creates two surfaces with
#                      labels 1 and 2.Later it gets the number of
#                      edges for surface with label = 1.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function sgm_db_get_num_edges_face()
#  has the following arguments:
#
#  sgm_db_get_num_edges_face
#     (  surfaceid,
#        numberfaces )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_surfaceid
INTEGER  i_label
INTEGER  i_numberfaces
STRING   sv_asm_create_patch_xy[VIRTUAL]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Create two surfaces
asm_const_patch_xyz( “1”, “<1 1 0>”, “[0 0 0]”, “Coord 0”,  @
sv_asm_create_patch_xy)
asm_const_patch_xyz( “2”, “<0 1 1>”, “[0 0 0]”, “Coord 0”,  @
sv_asm_create_patch_xy)
 
ga_view_aa_set( 23., -34., 0. )
uil_toolbar.labels_on(  )
 
#  Get the id for surface with label = 1.
#  i_label = 1
i_label = 1
db_get_surface_id( i_label,                       @
                   i_surfaceid )
 
i_return_value =                                  @
   sgm_db_get_num_edges_face                      @
      (  i_surfaceid,                             @
         i_numberfaces )
 
dump i_return_value
 
#  The number of edges for the surface are
dump i_numberfaces
 
SYS_FREE_STRING(sv_asm_create_patch_xy)
#---------------------------------------------------------------------
sgm_db_get_num_faces_body
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_db_get_num_faces_body()
#
#                      This function gets the number of faces for a 
#                      general body.This file opens a new database 
#                      “new.db” and creates two solids with labels
#                      1 and 2.Later it gets the number of faces 
#                      for the solid with label = 2.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function sgm_db_get_num_faces_body()
#  has the following arguments:
#
#  sgm_db_get_num_faces_body
#     (  bodyid,
#        numberfaces,
#        status )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_label
INTEGER  i_bodyid
INTEGER  i_numberfaces
INTEGER  i_status
STRING   sv_asm_create_hpat_xyz[VIRTUAL]
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Create two solid entities
asm_const_hpat_xyz( “1”, “<1 1 1>”, “[0 0 0]”, “Coord 0”,  @
sv_asm_create_hpat_xyz)
asm_const_hpat_xyz( “2”, “<-1 1 1>”, “[0 0 0]”, “Coord 0”,  @
sv_asm_create_hpat_xyz)
 
ga_view_aa_set( 23., -34., 0. )
uil_toolbar.labels_on(  )
 
#  Get the id for the surface with label = 2
#  i_label = 2
i_label = 2
db_get_solid_id(  i_label,                        @
                  i_bodyid )
 
sgm_db_get_num_faces_body                         @
   (  i_bodyid,                                   @
      i_numberfaces,                              @
      i_status )
 
dump i_status
 
#  The number of faces for the solid with label = 2
dump i_numberfaces
 
SYS_FREE_STRING(sv_asm_create_hpat_xyz)
#---------------------------------------------------------------------
sgm_db_get_num_loops_face
()
#  Purpose          :  This file provides an example of two call to 
#                      the function sgm_db_get_num_loops_face()
#
#                      This function gets the number of loops for the 
#                      surface and total number of edges.It also gets
#                      the number of edges per loop.This file opens
#                      the database “spool.db” and gets the number of
#                      loops ,the total number of edges and the number
#                      of edges per loop for surface with label=1.This
#                      database has six surfaces with labels 1 to 6.
#                      
#                      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 sgm_db_get_num_loops_face()
#  has the following arguments:
#
#  sgm_db_get_num_loops_face
#     (  surfaceid,
#        getedges,
#        numloops,
#        numedges,
#        numegploop,
#        status )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_surfaceid
LOGICAL  l_getedges
INTEGER  i_label
INTEGER  i_numloops
INTEGER  i_numedges
INTEGER  iv_numegploop(VIRTUAL)
INTEGER  i_status
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  i_label = 1
i_label = 1
 
db_get_surface_id                                 @
   (  i_label,                                    @
      i_surfaceid )
 
#  Get the number of loops for the surface and the total no of edges.
#  l_getedges = FALSE
l_getedges = FALSE
 
sgm_db_get_num_loops_face                         @
   (  i_surfaceid,                                @
      l_getedges,                                 @
      i_numloops,                                 @   
      i_numedges,                                 @   
      iv_numegploop,                              @
      i_status )
 
dump i_status
 
#  The number of loops are
dump i_numloops
 
#  Total  number of edges are
dump i_numedges
 
SYS_ALLOCATE_ARRAY(iv_numegploop,1,i_numloops)
 
#  Get the number of edges per loop.
#  l_getedges = TRUE
l_getedges = TRUE
 
sgm_db_get_num_loops_face                         @
   (  i_surfaceid,                                @
      l_getedges,                                 @
      i_numloops,                                 @
      i_numedges,                                 @
      iv_numegploop,                              @
      i_status )
 
dump i_status
 
#  Number of edges per loop are
dump iv_numegploop
 
SYS_FREE_ARRAY(iv_numegploop)
#---------------------------------------------------------------------
sgm_db_get_num_vertices_body
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_db_get_num_vertices_body()
#
#                      This function gets the number of vertices for
#                      a general body.This file opens a new database
#                      “new.db” and creates two solids entities with 
#                      labels 4 and 5.It then gets the number of 
#                      vertices for the solid with label = 4.
#
#                      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.
#                      on the menu bar.
#
#  The function sgm_db_get_num_vertices_body()
#  has the following arguments:
#
#  sgm_db_get_num_vertices_body
#     (  bodyid,
#        numvert,
#        status )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_bodyid
INTEGER  i_label
INTEGER  i_numvert
INTEGER  i_status
STRING   sv_asm_create_hpat[VIRTUAL]
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Create two solid entities.
asm_const_hpat_xyz( “4”, “<1 1 1>”, “[0 0 0]”, “Coord 0”,  @
sv_asm_create_hpat )
 
asm_const_hpat_xyz( “5”, “<2 2 2>”, “[0 0 0]”, “Coord 0”,  @
sv_asm_create_hpat )
 
#  i_label = 4
i_label = 4
 
db_get_solid_id                                   @
   (  i_label,                                    @
      i_bodyid )
 
sgm_db_get_num_vertices_body                      @
   (  i_bodyid,                                   @
      i_numvert,                                  @
      i_status )
dump i_status
 
#  The number of vertices for the body with label = 4 are
dump i_numvert
 
SYS_FREE_STRING(sv_asm_create_hpat)
#---------------------------------------------------------------------
sgm_db_get_point
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_db_get_point()
#
#                      This function gets the geometric definition of
#                      a point from the database. This file opens a
#                      database “spool.db” and gets the global
#                      coordinates of the point with label=9. This
#                      database has seven points with labels 4 to 10.
#
#                      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 sgm_db_get_point()
#  has the following arguments:
#
#  sgm_db_get_point
#     (  pointid,
#        xyz,
#        status )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_pointid
INTEGER  i_label
REAL     ra_xyz(3)
INTEGER  i_status
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  i_label = 9
i_label = 9
 
db_get_point_id                                   @
   (  i_label,                                    @
      i_pointid )
 
dump i_pointid
 
sgm_db_get_point                                  @
   (  i_pointid,                                  @
      ra_xyz,                                     @
      i_status )
 
dump i_status
 
#  The Global coordinates of the point with label = 9 is
dump ra_xyz
 
#---------------------------------------------------------------------
 
sgm_db_get_solid
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_db_get_solid()
#
#                      This function gets the geometric definition of
#                      a solid from the database.This file opens a 
#                      new database “new.db” and creates two solid 
#                      entities.It then gets the geometric description
#                      of the solid with label = 1.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function sgm_db_get_solid()
#  has the following arguments:
#
#  sgm_db_get_solid
#     (  solidid,
#        blobsize,
#        blob,
#        status )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_solidid
INTEGER  i_blobsize
INTEGER  i_label
INTEGER  i_entitytype
REAL     rv_blob(VIRTUAL)
STRING   sv_asm_create_hpat[VIRTUAL]
INTEGER  i_status
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Create two solid entities.
asm_const_hpat_xyz( “1”, “<1 1 1>”, “[0 0 0]”, “Coord 0”,  @
sv_asm_create_hpat )
 
asm_const_hpat_xyz( “2”, “<2 2 2>”, “[0 0 0]”, “Coord 0”,  @
sv_asm_create_hpat )
 
#  i_label = 1
i_label = 1
 
#  Get the solid id for solid label = 1.
db_get_solid_id                                   @
   (  i_label,                                    @
      i_solidid )
 
#  i_entitytype = 4 (solid)
i_entitytype = 4
 
#  Get the blob size.
sgm_db_get_blob_size                              @
   (  i_entitytype,                               @
      i_solidid,                                  @
      i_blobsize,                                 @
      i_status )
 
SYS_ALLOCATE_ARRAY(rv_blob,1,i_blobsize)
 
sgm_db_get_solid                                  @
   (  i_solidid,                                  @
      i_blobsize,                                 @
      rv_blob,                                    @
      i_status )
 
dump i_status
 
#  The Global description of the solid with label = 1 is
dump rv_blob
 
SYS_FREE_STRING(sv_asm_create_hpat)
SYS_FREE_ARRAY(rv_blob)
#---------------------------------------------------------------------
sgm_db_get_surface
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_db_get_surface()
#
#                      This function gets the geometric definition of
#                      a surface from the database.This file opens a 
#                      database “spool.db” and gets the geometric 
#                      description of the surface with label = 1.This 
#                      database has six surfaces with labels 1 to 6.
#
#                      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 sgm_db_get_surface()
#  has the following arguments:
#
#  sgm_db_get_surface
#     (  surfaceid,
#        blobsize,
#        blob,
#        status )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_surfaceid
INTEGER  i_blobsize
INTEGER  i_label
INTEGER  i_entitytype
REAL     rv_blob(VIRTUAL)
INTEGER  i_status
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  i_label = 1
i_label = 1
 
#  Get the surface id for surface label = 1.
db_get_surface_id                                 @
   (  i_label,                                    @
      i_surfaceid )
 
#  i_entitytype = 3 (surface)
i_entitytype = 3
 
#  Get the blob size.
sgm_db_get_blob_size                              @
   (  i_entitytype,                               @
      i_surfaceid,                                @
      i_blobsize,                                 @
      i_status )
 
SYS_ALLOCATE_ARRAY(rv_blob,1,i_blobsize)
 
sgm_db_get_surface                                @
   (  i_surfaceid,                                @
      i_blobsize,                                 @
      rv_blob,                                    @
      i_status )
 
dump i_status
 
#  The Global description of the surface with label = 1 is
dump rv_blob
 
SYS_FREE_ARRAY(rv_blob)
#---------------------------------------------------------------------
sgm_db_modify_entity_label
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_db_modify_entity_label()
#
#                      This function modifies the label of an existing
#                      geometric entity. This file opens a new database
#                      “new.db” and creates a point entity. It then
#                      gets the id of the point and assigns the label
#                      100.
#
#                      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 sgm_db_modify_entity_label()
#  has the following arguments:
#
#  sgm_db_modify_entity_label
#     (  entitytype,
#        entityid,
#        newlabel )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_entitytype
INTEGER  i_entityid
INTEGER  i_newlabel
INTEGER  i_return_value
STRING   s_members[VIRTUAL],s_group[32],sv_asm_create_grid[VIRTUAL]
INTEGER  i_groupid
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
ga_viewport_size_set( “default_viewport”, 3.5, 3.5, 1 )
ga_viewport_location_set( “default_viewport”, 0.0, 5.0, 1 )
 
#  Create a point entity with id=1.
asm_const_grid_xyz                               @
   (  “1”,                                       @
      “[0 0 0]”,                                 @
      “coord 0”,                                 @
      sv_asm_create_grid )
 
#  i_entitytype = 1
i_entitytype = 1
#  i_entityid = 1
i_entityid = 1
#  i_groupid = 1
i_groupid = 1
#  i_newlabel = 100
i_newlabel = 100
 
 
#  Get the current group name.
db_get_current_group_id                           @
   (  i_groupid )
 
dump i_groupid
 
db_get_group_name                                 @
   (  i_groupid,                                  @
      s_group )
 
dump s_group
 
SYS_ALLOCATE_STRING(s_members,32)
 
#  Get the id of the point entity created.
uil_entity_group_members_get                      @
   (  s_group,                                    @
      i_entitytype,                               @
      s_members )
 
dump s_members
 
i_return_value =                                  @
   sgm_db_modify_entity_label                     @
      (  i_entitytype,                            @
         i_entityid,                              @
         i_newlabel )
 
dump i_return_value
 
#  Get the new id of the point entity.
uil_entity_group_members_get                      @
   (  s_group,                                    @
      i_entitytype,                               @
      s_members )
 
dump s_members
 
SYS_FREE_STRING( sv_asm_create_grid )
SYS_FREE_STRING( s_members )
#---------------------------------------------------------------------
 
sgm_edit_brep_break_plane_v1
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_edit_brep_break_plane_v1()
#
#                      This file opens a new database "new.db" and
#                      creates a solid and a plane. It breaks
#                      the surface along the plane using the above 
#                      function.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the  "File","Session","Play" pulldown
#                      menus on the menu bar.
#
#
#  The function sgm_edit_brep_break_plane_v1()
#  has the following arguments:
#
#  sgm_edit_brep_break_plane_v1
#     (  output_ids,
#        solid_list,
#        plane_list,
#        delete_flag,
#        created_ids )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_output_ids[VIRTUAL]
STRING   s_solid_list[32]
STRING   s_plane_list[32]
LOGICAL  l_delete_flag
STRING   sv_created_ids[VIRTUAL]
STRING   sv_asm_create_hpat_xyz_created[VIRTUAL]
STRING   sv_sgm_create_plane_3p_created[VIRTUAL]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
 
solid_label(TRUE)
i_return_value =                                 @
   ga_view_aa_set( 23., -34., 0. )
dump i_return_value
#---------------------------------------------------------------------
#  Create a Solid.
i_return_value =                                 @
   asm_const_hpat_xyz( "1", "<1 1 1>",           @
      "[0 0 0]", "Coord 0",                      @
      sv_asm_create_hpat_xyz_created )
dump i_return_value
#---------------------------------------------------------------------
#  Create a Plane.
i_return_value =                                 @
   sgm_const_plane_3point( "1", "[0.5 0.5 0.5]", @
      "[0.85 0.25 0.25]", "[0.25 0.25 0.85]",    @
      sv_sgm_create_plane_3p_created )
dump i_return_value
#---------------------------------------------------------------------
#  Break the solid with a plane.
 
s_output_ids  = "5"
s_solid_list  = "solid 1"
s_plane_list  = "plane 1"
l_delete_flag = FALSE
 
i_return_value =                                 @
   sgm_edit_brep_break_plane_v1                  @
      (  s_output_ids,                           @
         s_solid_list,                           @
         s_plane_list,                           @
         l_delete_flag,                          @
         sv_created_ids )
dump i_return_value
dump sv_created_ids
 
#---------------------------------------------------------------------
sys_free_string(sv_created_ids)
sys_free_string(sv_asm_create_hpat_xyz_created)
sys_free_string(sv_sgm_create_plane_3p_created)
#---------------------------------------------------------------------
 
sgm_edit_brep_break_surface_v1
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_edit_brep_break_surface_v1()
#
#                      This file opens a new database "new.db" and
#                      creates a solid and a surface. Later it breaks
#                      the solid along the surface using the above 
#                      function.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the "File","Session","Play" pulldown 
#                      menus on the menu bar.
#
#  The function sgm_edit_brep_break_surface_v1()
#  has the following arguments:
#
#  sgm_edit_brep_break_surface_v1
#     (  output_ids,
#        solid_list,
#        surface_list,
#        delete_flag,
#        created_ids )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_output_ids[16]
STRING   s_solid_list[32]
STRING   s_surface_list[32]
LOGICAL  l_delete_flag
STRING   sv_created_ids[VIRTUAL]
STRING   sv_asm_create_hpat_xyz_created[VIRTUAL]
STRING   sv_asm_create_patch_xy_created[VIRTUAL]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
 
i_return_value =                                 @
   ga_view_aa_set( 23., -34., 0. )
dump i_return_value
 
solid_label(TRUE)
#---------------------------------------------------------------------
#  Create a Solid.
i_return_value =                                 @
   asm_const_hpat_xyz( "1", "<1 1 1>",           @
      "[0 0 0]", "Coord 0",                      @
      sv_asm_create_hpat_xyz_created )
dump i_return_value
#---------------------------------------------------------------------
#  Create a Surface.
i_return_value =                                 @
   asm_const_patch_xyz( "1", "<1 1.5 1.2>",      @
      "[0.3 0 -0.5]", "Coord 0",                 @
      sv_asm_create_patch_xy_created )
dump i_return_value
 
#---------------------------------------------------------------------
#  Break the solid with a surface.
 
s_output_ids   = "5"
s_solid_list   = "solid 1"
s_surface_list = "surface 1"
l_delete_flag  = FALSE
 
 
i_return_value =                                 @
   sgm_edit_brep_break_surface_v1                @
      (  s_output_ids,                           @
         s_solid_list,                           @
         s_surface_list,                         @
         l_delete_flag,                          @
         sv_created_ids )
dump i_return_value
dump sv_created_ids
#---------------------------------------------------------------------
sys_free_string(sv_created_ids)
sys_free_string(sv_asm_create_hpat_xyz_created)
sys_free_string(sv_asm_create_patch_xy_created)
#---------------------------------------------------------------------
 
sgm_edit_point_equivalence
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_edit_point_equivalence()
#
#                      This session file will create a new database by
#                      name "new.db".  This function checks the
#                      equivalence of two points and deletes one of the
#                      duplicate points.
#
#                      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 sgm_edit_point_equivalence()
#  has the following arguments:
#
#  sgm_edit_point_equivalence
#     (  point_list,
#        created_ids )
#
#---------------------------------------------------------------------
#  Variable Declarations
 
STRING   s_point_list[16]
STRING   asm_create_grid_xyz_created_ids[VIRTUAL]
STRING   sv_created_ids[VIRTUAL]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
#---------------------------------------------------------------------
#  Enabling the point labeling.
 
point_label(TRUE)
#---------------------------------------------------------------------
#  Creating two points at the same location.
 
i_return_value =                                 @
    asm_const_grid_xyz(                          @
           "1", "[1 1  0]", "Coord 0",           @
           asm_create_grid_xyz_created_ids )
dump i_return_value
 
i_return_value =                                 @
    asm_const_grid_xyz(                          @
           "2", "[1 1  0]", "Coord 0",           @
           asm_create_grid_xyz_created_ids )
$? YES 1000034
dump i_return_value
 
#---------------------------------------------------------------------
#  Using the function to combine the two equivalent points
#  to get a single point at that place.
 
s_point_list = "Point 1 2"
 
i_return_value =                                 @
   sgm_edit_point_equivalence                    @
      (  s_point_list,                           @
         sv_created_ids )
 
dump i_return_value
dump sv_created_ids
#---------------------------------------------------------------------
sys_free_string(sv_created_ids)
sys_free_string(asm_create_grid_xyz_created_ids)
#---------------------------------------------------------------------
 
sgm_edit_solid_break
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_edit_solid_break()
#
#                      This session file will create a new database by
#                      name "new.db". A solid is created and it is 
#                      broken by a point.
#
#                      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 sgm_edit_solid_break()
#  has the following arguments:
#
#  sgm_edit_solid_break
#       ( output_ids,
#         option_type,
#         point_list,
#         parameters,
#         delete_orig,
#         solid_list,
#         created_ids )
#
#---------------------------------------------------------------------
#  Variable Declarations
 
STRING   s_output_ids[16]
INTEGER  i_option_type
STRING   s_point_list[16]
REAL     r_parameters(3)
LOGICAL  l_delete_orig
STRING   s_solid_list[16]
STRING   asm_create_grid_xyz_created_ids[VIRTUAL]
STRING   asm_create_hpat_xyz_created_ids[VIRTUAL]
STRING   sv_created_ids[VIRTUAL]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
#---------------------------------------------------------------------
#  Enabling the point labeling.
 
point_label(TRUE)
Solid_label(TRUE)
#---------------------------------------------------------------------
#  Creating a point.
 
i_return_value =                                 @
    asm_const_grid_xyz(                          @
           "1", "[0.5 0.5 0.5]", "Coord 0",      @
           asm_create_grid_xyz_created_ids )
dump i_return_value
#---------------------------------------------------------------------
#  Creating a Solid.
 
i_return_value =                                 @
    asm_const_hpat_xyz(                          @
           "1", "<1 1 1>", "[0 0 0]", "Coord 0", @
           asm_create_grid_xyz_created_ids )
dump i_return_value
 
#---------------------------------------------------------------------
#  Using the function to break the solid 1 by point 1
 
s_output_ids   =  "2"
i_option_type  =  1
s_point_list   =  "Point 1"
r_parameters   =  [ 0. 0. 0.]
l_delete_orig  =  FALSE
s_solid_list   =  "Solid 1"
 
i_return_value =                                 @
   sgm_edit_solid_break                          @
               ( s_output_ids,                   @
                 i_option_type,                  @
                 s_point_list,                   @
                 r_parameters,                   @
                 l_delete_orig,                  @
                 s_solid_list,                   @
                 sv_created_ids )
 
dump i_return_value
dump sv_created_ids
#---------------------------------------------------------------------
sys_free_string(sv_created_ids)
sys_free_string(asm_create_grid_xyz_created_ids)
sys_free_string(asm_create_hpat_xyz_created_ids)
#---------------------------------------------------------------------
 
sgm_edit_solid_refit_v1
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_edit_solid_refit_v1()
#
#                      This file opens a new database "new.db" and
#                      creates a solid.  It then fits this solid with 
#                      a  duplicate solid in its place.
#
#                      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 sgm_edit_solid_refit_v1()
#  has the following arguments:
#
#  sgm_edit_solid_refit_v1
#     (  output_ids,
#        tolerance,
#        type_option,
#        delete_orig,
#        solid_list,
#        created_labels )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_output_ids[16]
REAL     r_tolerance
LOGICAL  l_type_option
LOGICAL  l_delete_orig
STRING   s_solid_list[16]
STRING   sv_created_labels[VIRTUAL]
STRING   asm_create_hpat_xyz_created_ids[VIRTUAL]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
 
#---------------------------------------------------------------------
#  Creating a Solid.
 
i_return_value = asm_const_hpat_xyz(                   @
                     "1",                              @
                     "<1 1 1>",                        @
                     "[0 0 0]",                        @
                     "Coord 0",                        @
                     asm_create_hpat_xyz_created_ids )
 
dump i_return_value
#---------------------------------------------------------------------
 
   ga_view_aa_set( 23., -34., 0. )
 
solid_label(TRUE)
surface_label(TRUE)
#---------------------------------------------------------------------
#  Creating the next solid on this solid 1.
 
s_output_ids  =  "5"
r_tolerance   =  1e-5
l_type_option =  TRUE
l_delete_orig =  FALSE
s_solid_list  =  "solid 1"
 
i_return_value =                                       @
   sgm_edit_solid_refit_v1                             @
                    (  s_output_ids,                   @
                       r_tolerance,                    @
                       l_type_option,                  @
                       l_delete_orig,                  @
                       s_solid_list,                   @
                       sv_created_labels )
$? YES 1000034
dump i_return_value
dump sv_created_labels
#---------------------------------------------------------------------
sys_free_string(asm_create_hpat_xyz_created_ids)
sys_free_string(sv_created_labels)
#---------------------------------------------------------------------
 
sgm_edit_solid_reverse
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_edit_solid_reverse()
#
#                      This file opens a new database "new.db" and
#                      creates a solid.  It then reverses the solid
#                      with respect to it's parametric direction.
#
#                      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 sgm_edit_solid_reverse()
#  has the following arguments:
#
#  sgm_edit_solid_reverse
#     (  solid_list,
#        created_labels )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_solid_list[16]
STRING   sv_created_labels[VIRTUAL]
STRING   asm_create_hpat_xyz_created_ids[VIRTUAL]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
 
#---------------------------------------------------------------------
#  putting on the parametric direction set.
 
   ga_display_parametric_set("general",1)
 
#---------------------------------------------------------------------
#  Creating a Solid.
 
i_return_value = asm_const_hpat_xyz(                   @
                     "1",                              @
                     "<1 1 1>",                        @
                     "[0 0 0]",                        @
                     "Coord 0",                        @
                     asm_create_hpat_xyz_created_ids )
 
dump i_return_value
#---------------------------------------------------------------------
 
   ga_view_aa_set( 23., -34., 0. )
 
solid_label(TRUE)
 
#---------------------------------------------------------------------
#  Reversing the solid with respect to it's parametric 
#  direction.  Watch the direction of the parametric 
#  direction set display.
 
s_solid_list     =   "solid 1"
 
i_return_value =                                       @
   sgm_edit_solid_reverse                              @
                    (  s_solid_list,                   @
                       sv_created_labels )
$? YES 1000034
dump i_return_value
dump sv_created_labels
repaint_graphics()
#---------------------------------------------------------------------
sys_free_string(asm_create_hpat_xyz_created_ids)
sys_free_string(sv_created_labels)
#---------------------------------------------------------------------
 
sgm_edit_surface_edge_match
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_edit_surface_edge_match()
#
#                      This file opens a new database "new.db" and
#                      creates two surfaces witha gap in between.
#                      This function closes the gap between the two
#                      curves and matches the gap between them.
#
#
#                      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 sgm_edit_surface_edge_match()
#  has the following arguments:
#
#  sgm_edit_surface_edge_match
#     (  option,
#        surface_list_1,
#        surface_list_2,
#        delete_orig,
#        created_labels )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_option
STRING   s_surface_list_1[32]
STRING   s_surface_list_2[32]
LOGICAL  l_delete_orig
STRING   sv_created_labels[VIRTUAL]
STRING   asm_create_grid_xyz_created_ids[VIRTUAL]
STRING   asm_line_2point_created_ids[VIRTUAL]
STRING   sgm_create_curve_2d_created_ids[VIRTUAL]
STRING   sgm_surface_4edge_created_ids[VIRTUAL]
INTEGER  i_return_value
INTEGER  i_surface_id(VIRTUAL)
INTEGER  i_edge_id
INTEGER  i_count
#---------------------------------------------------------------------
#  Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
 
#---------------------------------------------------------------------
#  Setting the graphics.
 
point_label( TRUE )
surface_label( TRUE )
curve_label( TRUE )
ga_view_aa_set( 23., -34., 0. )
#---------------------------------------------------------------------
#  Creating the points.
 
i_return_value = asm_const_grid_xyz(                   @
                     "1",                              @
                     "[0 0 0]",                        @
                     "Coord 0",                        @
                     asm_create_grid_xyz_created_ids )
 
i_return_value = asm_const_grid_xyz(                   @
                     "2",                              @
                     "[1 0 0]",                        @
                     "Coord 0",                        @
                     asm_create_grid_xyz_created_ids )
 
i_return_value = asm_const_grid_xyz(                   @
                     "3",                              @
                     "[1 1 0]",                        @
                     "Coord 0",                        @
                     asm_create_grid_xyz_created_ids )
 
i_return_value = asm_const_grid_xyz(                   @
                     "4",                              @
                     "[0 1 0]",                        @
                     "Coord 0",                        @
                     asm_create_grid_xyz_created_ids )
 
i_return_value = asm_const_grid_xyz(                   @
                     "5",                              @
                     "[1 0 0]",                        @
                     "Coord 0",                        @
                     asm_create_grid_xyz_created_ids )
$? YES 1000034
 
i_return_value = asm_const_grid_xyz(                   @
                     "6",                              @
                     "[2 0 0]",                        @
                     "Coord 0",                        @
                     asm_create_grid_xyz_created_ids )
 
 
i_return_value = asm_const_grid_xyz(                   @
                     "7",                              @
                     "[2 1 0]",                        @
                     "Coord 0",                        @
                     asm_create_grid_xyz_created_ids )
 
i_return_value = asm_const_grid_xyz(                   @
                     "8",                              @
                     "[1 1 0]",                        @
                     "Coord 0",                        @
                     asm_create_grid_xyz_created_ids )
$? YES 1000034
 
i_return_value = asm_const_grid_xyz(                   @
                     "9",                              @
                     "[1.007 0.5 0]",                  @
                     "Coord 0",                        @
                     asm_create_grid_xyz_created_ids )
#---------------------------------------------------------------------
#  Creating the straight curves.
 
i_return_value = asm_const_line_2point(                @
                     "1", "Point 1","Point 2",         @
                     0, "", 50., 1,                    @
                     asm_line_2point_created_ids )
 
 
i_return_value = asm_const_line_2point(                @
                     "2", "Point 3","Point 4",         @
                     0, "", 50., 1,                    @
                     asm_line_2point_created_ids )
 
i_return_value = asm_const_line_2point(                @
                     "3", "Point 4","Point 1",         @
                     0, "", 50., 1,                    @
                     asm_line_2point_created_ids )
 
i_return_value = asm_const_line_2point(                @
                     "4", "Point 2","Point 3",         @
                     0, "", 50., 1,                    @
                     asm_line_2point_created_ids )
 
i_return_value = asm_const_line_2point(                @
                     "5", "Point 5","Point 6",         @
                     0, "", 50., 1,                    @
                     asm_line_2point_created_ids )
 
i_return_value = asm_const_line_2point(                @
                     "6", "Point 6","Point 7",         @
                     0, "", 50., 1,                    @
                     asm_line_2point_created_ids )
 
i_return_value = asm_const_line_2point(                @
                     "7", "Point 7","Point 8",         @
                     0, "", 50., 1,                    @
                     asm_line_2point_created_ids )
#---------------------------------------------------------------------
#  Creating the arc from three points.
 
i_return_value = sgm_const_curve_2d_arc3point_v2(      @
                     "8", FALSE,"Coord 0.3", "Point 8",@
                     "Point 9", "Point 5",FALSE,       @
                     sgm_create_curve_2d_created_ids  )
 
#---------------------------------------------------------------------
#  Creating the surfaces
 
i_return_value = sgm_const_surface_4edge(              @
                     "1", "Curve 1", "Curve 2",        @
                     "Curve 3", "Curve 4",             @
                     sgm_surface_4edge_created_ids )
 
i_return_value = sgm_const_surface_4edge(              @
                     "2", "Curve 5", "Curve 6",        @
                     "Curve 7", "Curve 8",             @
                     sgm_surface_4edge_created_ids )
 
#---------------------------------------------------------------------
#  Checking the surfaces associated with the curve 8
 
i_edge_id = 8
 
i_return_value = db_count_surfaces_for_edge(           @
                     i_edge_id,                        @
                     i_count        )
dump i_count
sys_allocate_array(i_surface_id,1,i_count)
i_return_value = db_get_surfaces_for_edge(             @
                     i_edge_id,                        @
                     i_count,                          @
                     i_surface_id   )
dump i_return_value
dump i_surface_id
#---------------------------------------------------------------------
#  Using the function sgm_edit_surface_edge_match() to match the
#  edge between the two surfaces.
 
i_option           =  2
s_surface_list_1   =  "Surface 1"
s_surface_list_2   =  "Surface 2"
l_delete_orig      =  FALSE
 
i_return_value =                                       @
   sgm_edit_surface_edge_match                         @
                    (  i_option,                       @
                       s_surface_list_1,               @
                       s_surface_list_2,               @
                       l_delete_orig,                  @
                       sv_created_labels )
$? YESFORALL 38001105
dump i_return_value
dump sv_created_labels
#---------------------------------------------------------------------
#  Checking the surfaces associated with the curve 9.
 
i_edge_id = 9
 
i_return_value = db_count_surfaces_for_edge(           @
                     i_edge_id,                        @
                     i_count        )
dump i_count
sys_allocate_array(i_surface_id,1,i_count)
i_return_value = db_get_surfaces_for_edge(             @
                     i_edge_id,                        @
                     i_count,                          @
                     i_surface_id   )
dump i_return_value
dump i_surface_id
#---------------------------------------------------------------------
sys_free_string(sv_created_labels)
sys_free_string(asm_create_grid_xyz_created_ids)
sys_free_string(asm_line_2point_created_ids)
sys_free_string(sgm_create_curve_2d_created_ids)
sys_free_string(sgm_surface_4edge_created_ids)
sys_free_array(i_surface_id)
#---------------------------------------------------------------------
 
sgm_edit_surface_sew
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_edit_surface_sew()
#
#                      This file opens a new database "new.db" and
#                      creates two surface with a gap in between them.
#                      This function sews the gap between them and the 
#                      common curve gets associated with both these 
#                      curves.
#
#                      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 sgm_edit_surface_sew()
#  has the following arguments:
#
#  sgm_edit_surface_sew
#     (  surface_list,
#        created_labels )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_surface_list[32]
STRING   sv_created_labels[VIRTUAL]
STRING   asm_create_grid_xyz_created_ids[VIRTUAL]
STRING   asm_line_2point_created_ids[VIRTUAL]
STRING   sgm_create_curve_2d_created_ids[VIRTUAL]
STRING   sgm_surface_4edge_created_ids[VIRTUAL]
INTEGER  i_return_value
INTEGER  i_surface_id(VIRTUAL)
INTEGER  i_edge_id
INTEGER  i_count
#---------------------------------------------------------------------
#  Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
 
#---------------------------------------------------------------------
#  Setting the graphics.
 
point_label( TRUE )
surface_label( TRUE )
curve_label( TRUE )
ga_view_aa_set( 23., -34., 0. )
#---------------------------------------------------------------------
#  Creating the points.
 
i_return_value = asm_const_grid_xyz(                   @
                     "1",                              @
                     "[0 0 0]",                        @
                     "Coord 0",                        @
                     asm_create_grid_xyz_created_ids )
 
i_return_value = asm_const_grid_xyz(                   @
                     "2",                              @
                     "[1 0 0]",                        @
                     "Coord 0",                        @
                     asm_create_grid_xyz_created_ids )
 
i_return_value = asm_const_grid_xyz(                   @
                     "3",                              @
                     "[1 1 0]",                        @
                     "Coord 0",                        @
                     asm_create_grid_xyz_created_ids )
 
i_return_value = asm_const_grid_xyz(                   @
                     "4",                              @
                     "[0 1 0]",                        @
                     "Coord 0",                        @
                     asm_create_grid_xyz_created_ids )
 
i_return_value = asm_const_grid_xyz(                   @
                     "5",                              @
                     "[1 0 0]",                        @
                     "Coord 0",                        @
                     asm_create_grid_xyz_created_ids )
$? YES 1000034
 
i_return_value = asm_const_grid_xyz(                   @
                     "6",                              @
                     "[2 0 0]",                        @
                     "Coord 0",                        @
                     asm_create_grid_xyz_created_ids )
 
 
i_return_value = asm_const_grid_xyz(                   @
                     "7",                              @
                     "[2 1 0]",                        @
                     "Coord 0",                        @
                     asm_create_grid_xyz_created_ids )
 
i_return_value = asm_const_grid_xyz(                   @
                     "8",                              @
                     "[1 1 0]",                        @
                     "Coord 0",                        @
                     asm_create_grid_xyz_created_ids )
$? YES 1000034
 
i_return_value = asm_const_grid_xyz(                   @
                     "9",                              @
                     "[1.007 0.5 0]",                  @
                     "Coord 0",                        @
                     asm_create_grid_xyz_created_ids )
#---------------------------------------------------------------------
#  Creating the straight curves.
 
i_return_value = asm_const_line_2point(                @
                     "1", "Point 1","Point 2",         @
                     0, "", 50., 1,                    @
                     asm_line_2point_created_ids )
 
 
i_return_value = asm_const_line_2point(                @
                     "2", "Point 3","Point 4",         @
                     0, "", 50., 1,                    @
                     asm_line_2point_created_ids )
 
i_return_value = asm_const_line_2point(                @
                     "3", "Point 4","Point 1",         @
                     0, "", 50., 1,                    @
                     asm_line_2point_created_ids )
 
i_return_value = asm_const_line_2point(                @
                     "4", "Point 2","Point 3",         @
                     0, "", 50., 1,                    @
                     asm_line_2point_created_ids )
 
i_return_value = asm_const_line_2point(                @
                     "5", "Point 5","Point 6",         @
                     0, "", 50., 1,                    @
                     asm_line_2point_created_ids )
 
i_return_value = asm_const_line_2point(                @
                     "6", "Point 6","Point 7",         @
                     0, "", 50., 1,                    @
                     asm_line_2point_created_ids )
 
i_return_value = asm_const_line_2point(                @
                     "7", "Point 7","Point 8",         @
                     0, "", 50., 1,                    @
                     asm_line_2point_created_ids )
#---------------------------------------------------------------------
#  Creating the arc from three points.
 
i_return_value = sgm_const_curve_2d_arc3point_v2(      @
                     "8", FALSE,"Coord 0.3", "Point 8",@
                     "Point 9", "Point 5",FALSE,       @
                     sgm_create_curve_2d_created_ids  )
 
#---------------------------------------------------------------------
#  Creating the surfaces
 
i_return_value = sgm_const_surface_4edge(              @
                     "1", "Curve 1", "Curve 2",        @
                     "Curve 3", "Curve 4",             @
                     sgm_surface_4edge_created_ids )
 
i_return_value = sgm_const_surface_4edge(              @
                     "2", "Curve 5", "Curve 6",        @
                     "Curve 7", "Curve 8",             @
                     sgm_surface_4edge_created_ids )
 
#---------------------------------------------------------------------
#  Checking the surfaces associated with the curve 8
 
i_edge_id = 8
 
i_return_value = db_count_surfaces_for_edge(           @
                     i_edge_id,                        @
                     i_count        )
dump i_count
sys_allocate_array(i_surface_id,1,i_count)
i_return_value = db_get_surfaces_for_edge(             @
                     i_edge_id,                        @
                     i_count,                          @
                     i_surface_id   )
dump i_return_value
dump i_surface_id
#---------------------------------------------------------------------
#  Using the function sgm_edit_surface_sew() to sew the gap 
#  between the two surfaces.
 
s_surface_list   =  "Surface 1 2"
 
 
i_return_value =                                       @
   sgm_edit_surface_sew                                @
                    (  s_surface_list,                 @
                       sv_created_labels )
$?YESFORALL 38001105
dump i_return_value
dump sv_created_labels
#---------------------------------------------------------------------
#  Checking the surfaces associated with the curve 9.
 
i_edge_id = 9
 
i_return_value = db_count_surfaces_for_edge(           @
                     i_edge_id,                        @
                     i_count        )
dump i_count
sys_allocate_array(i_surface_id,1,i_count)
i_return_value = db_get_surfaces_for_edge(             @
                     i_edge_id,                        @
                     i_count,                          @
                     i_surface_id   )
dump i_return_value
dump i_surface_id
#---------------------------------------------------------------------
sys_free_string(sv_created_labels)
sys_free_string(asm_create_grid_xyz_created_ids)
sys_free_string(asm_line_2point_created_ids)
sys_free_string(sgm_create_curve_2d_created_ids)
sys_free_string(sgm_surface_4edge_created_ids)
sys_free_array(i_surface_id)
#---------------------------------------------------------------------
 
sgm_get_arc_center_radius
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_get_arc_center_radius()
#
#                      This file opens a new database "new.db" 
#                      It creates an arc in the database and gets the.
#                      center and radius for this arc.
#
#                      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 sgm_get_arc_center_radius()
#  has the following arguments:
#
#  sgm_get_arc_center_radius
#     (  arc_id,
#        start_point,
#        center_point,
#        radius     )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER i_arc_id
REAL    r_start_point(3)
REAL    r_center_point(3)
REAL    r_radius
STRING  sgm_create_curve_2d_created_ids[VIRTUAL]
INTEGER i_return_value
#---------------------------------------------------------------------
#  Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
#---------------------------------------------------------------------
#  Creating the arc
 
i_return_value =                                       @
   sgm_const_curve_2d_arc2point_v2                     @
              (  "1",                                  @
                  1,                                   @
                  0,                                   @
                  TRUE,                                @
                  FALSE,                               @
                  1,                                   @
                  "Coord 0.3",                         @
                  "[0 0 0]",                           @
                  "[5 0 0]",                           @
                  "[0 -0.5 0]",                        @
                  FALSE,                               @
                  sgm_create_curve_2d_created_ids )
 
#---------------------------------------------------------------------
#  Getting the start point, center and the radius for
#  this arc.
 
i_arc_id  = 1
 
i_return_value = sgm_get_arc_center_radius(            @
                     i_arc_id,                         @
                     r_start_point,                    @
                     r_center_point,                   @
                     r_radius ) 
dump i_return_value
dump r_start_point
dump r_center_point
dump r_radius
#---------------------------------------------------------------------
sys_free_string(sgm_create_curve_2d_created_ids)
#---------------------------------------------------------------------
#  End of File.
 
sgm_get_close_points
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_get_close_points()
#
#                      This file opens a new database "new.db" and
#                      creates a point in the database.  This function
#                      gets the points around this points within a 
#                      specified distance.
#
#                      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 sgm_get_close_points()
#  has the following arguments:
#
#  sgm_get_close_points
#     (  point_location,
#        tolerance,
#        num_only,
#        vertices_only,
#        sort,
#        num_point,
#        point_ids,
#        distances     )
#
#---------------------------------------------------------------------
#  Variable Declarations
REAL    r_point_location(3)
REAL    r_tolerance
INTEGER i_num_only
INTEGER i_vertices_only
INTEGER i_sort_option
INTEGER i_num_points
INTEGER iv_point_ids(VIRTUAL)
REAL    rv_distances(VIRTUAL)
STRING  asm_create_grid_xyz_created_ids[VIRTUAL]
INTEGER i_return_value
#---------------------------------------------------------------------
#  Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
#---------------------------------------------------------------------
#  Creating the points
 
i_return_value =                                       @
   asm_const_grid_xyz                                  @
              (  "1",                                  @
                  "[1 0 0]",                           @
                  "Coord 0",                           @
                  asm_create_grid_xyz_created_ids  )
 
dump i_return_value
 
i_return_value =                                       @
   asm_const_grid_xyz                                  @
              (   "2",                                 @
                  "[1.05 0 0]",                        @
                  "Coord 0",                           @
                  asm_create_grid_xyz_created_ids  )
 
dump i_return_value
 
i_return_value =                                       @
   asm_const_grid_xyz                                  @
              (   "3",                                 @
                  "[1.002 0 0]",                       @
                  "Coord 0",                           @
                  asm_create_grid_xyz_created_ids  )
$? YESFORALL 1000034
dump i_return_value
 
i_return_value =                                       @
   asm_const_grid_xyz                                  @
              (   "4",                                 @
                  "[0.99 0 0]",                        @
                  "Coord 0",                           @
                  asm_create_grid_xyz_created_ids  )
 
dump i_return_value
#---------------------------------------------------------------------
#  Using the function to get the close points around this point.
 
r_point_location =  [1.0 0.0 0.0]
r_tolerance      =  0.05
i_num_only       =  0
i_vertices_only  =  0
i_sort_option    =  1
 
i_return_value = sgm_get_close_points(                @
                     r_point_location,                @
                     r_tolerance,                     @
                     i_num_only,                      @
                     i_vertices_only,                 @
                     i_sort_option,                   @
                     i_num_points,                    @
                     iv_point_ids,                    @
                     rv_distances            ) 
dump i_return_value
dump i_num_points
#---------------------------------------------------------------------
sys_allocate_array(iv_point_ids,1,i_num_points)
sys_allocate_array(rv_distances,1,i_num_points)
#---------------------------------------------------------------------
i_return_value = sgm_get_close_points(                @
                     r_point_location,                @
                     r_tolerance,                     @
                     i_num_only,                      @
                     i_vertices_only,                 @
                     i_sort_option,                   @
                     i_num_points,                    @
                     iv_point_ids,                    @
                     rv_distances            )
 
dump i_return_value
dump i_num_points
dump iv_point_ids
dump rv_distances
#---------------------------------------------------------------------
sys_free_array(iv_point_ids)
sys_free_array(rv_distances)
sys_free_string(asm_create_grid_xyz_created_ids)
#---------------------------------------------------------------------
sgm_get_curve_length
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_get_curve_length()
#
#                      This function gets the length of the curve
#                      given the curve id. This file opens the database
#                      “spool.db” and gets the length of the curve for
#                      curve label=1. This database has thirteen curves,
#                      ten of which are orphans, with labels 1 to 3.
#
#                      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 sgm_get_curve_length()
#  has the following arguments:
#
#  sgm_get_curve_length
#     (  curveid,
#        length )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_curveid
INTEGER  i_label
REAL     r_length
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  i_label = 1
i_label = 1
 
#  Get the internal db id for curve label = 1.
db_get_curve_id                                   @
   (  i_label,                                    @
      i_curveid )
 
dump i_curveid
 
i_return_value =                                  @
   sgm_get_curve_length                           @
      (  i_curveid,                               @
         r_length )
 
dump i_return_value
 
#  The length of the curve is
dump r_length
 
#---------------------------------------------------------------------
sgm_get_solid_volume
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_get_solid_volume()
#
#                      This function gets the volume of the solid.This
#                      file opens a new database “new.db” and creates
#                      two solid entities.It then gets the solid
#                      volume for the solid with label =1.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function sgm_get_solid_volume()
#  has the following arguments:
#
#  sgm_get_solid_volume
#     (  solid,
#        volume )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_solid
INTEGER  i_label
REAL     r_volume
STRING   sv_asm_create_hpat[VIRTUAL]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Create two solid entities.
asm_const_hpat_xyz( “1”, “<1 1 1>”, “[0 0 0]”, “Coord 0”,  @
sv_asm_create_hpat )
 
asm_const_hpat_xyz( “2”, “<2 2 2>”, “[0 0 0]”, “Coord 0”,  @
sv_asm_create_hpat )
 
#  i_label = 1
i_label = 1
 
#  Get the solid id for solid label = 1.
db_get_solid_id                                            @
   (  i_label,                                             @
      i_solid )
 
i_return_value =                                           @
   sgm_get_solid_volume                                    @
      (  i_solid,                                          @
         r_volume )
 
dump i_return_value
 
#  The volume of Solid with label =1 is
dump r_volume
 
SYS_FREE_STRING(sv_asm_create_hpat)
#---------------------------------------------------------------------
sgm_get_surface_area
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_get_surface_area()
#
#                      This function gets the area of the surface.This
#                      file opens a database “spool.db” and gets the 
#                      surface area for the surface with label =1.This
#                      database has six surfaces with labels 1 to 6.
#
#                      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 sgm_get_surface_area()
#  has the following arguments:
#
#  sgm_get_surface_area
#     (  surfid,
#        area )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_surfid
REAL     r_area
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  i_label = 1
i_label = 1
 
#  Get the surface id for surface label = 1.
db_get_surface_id                                 @
   (  i_label,                                    @
      i_surfid )
 
i_return_value =                                  @
   sgm_get_surface_area                           @
      (  i_surfid,                                @
         r_area )
 
dump i_return_value
 
#  The area of Surface with label =1 is
dump r_area
#---------------------------------------------------------------------
 
sgm_incongruent_geom_display
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_incongruent_geom_display()
#
#                      This function creates a graphics display list
#                      for curves and surfaces and display all unique
#                      points and solids. This file opens a new database
#                      “new.db” and creates some incongruent geometry
#                      with three surfaces. It then uses the above
#                      function to display the unique points.
#
#                      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 sgm_incongruent_geom_display() has no arguments.
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_return_value
STRING   s_asm_create_patch[VIRTUAL]
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
ga_viewport_size_set( “default_viewport”, 3.5, 3.5, 1 )
ga_viewport_location_set( “default_viewport”, 0.0, 5.0, 1 )
 
#  Create three surfaces
asm_const_patch_xyz               @
   (  “1”,                        @
      “<1 2 0>”,                  @
      “[0 0 0]”,                  @
      “Coord 0”,                  @
      s_asm_create_patch )
 
asm_const_patch_xyz               @
   (  “2”,                        @
      “<1 1 0>”,                  @
      “[1 1 0]”,                  @
      “Coord 0”,                  @
      s_asm_create_patch )
 
asm_const_patch_xyz               @
   (  “3”,                        @
      “<1 -1 0>”,                 @
      “[1 1 0]”,                  @
      “Coord 0”,                  @
      s_asm_create_patch )
 
#  Verify the list of surfaces for existence of free edges
#  between adjacent surfaces.
sgm_verify_surface_boundary(  “Surface 1:3”,      @
                              0.005,              @
                              1 )
 
i_return_value = sgm_incongruent_geom_display()
 
dump i_return_value
 
#---------------------------------------------------------------------
sgm_incongruent_geom_exist
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_incongruent_geom_exist()
#                      on the menu bar.
#
#                      This function initialises the geometry list.
#
#                      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 sgm_incongruent_geom_exist() has no arguments.
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   sv_asm_create_patch[VIRTUAL]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
ga_viewport_size_set( “default_viewport”, 3.5, 3.5, 1 )
ga_viewport_location_set( “default_viewport”, 0.0, 5.0, 1 )
 
#  Create three surfaces
asm_const_patch_xyz               @
   (  “1”,                        @
      “<1 2 0>”,                  @
      “[0 0 0]”,                  @
      “Coord 0”,                  @
      sv_asm_create_patch )
 
asm_const_patch_xyz               @
   (  “2”,                        @
      “<1 1 0>”,                  @
      “[1 1 0]”,                  @
      “Coord 0”,                  @
      sv_asm_create_patch )
 
asm_const_patch_xyz               @
   (  “3”,                        @
      “<1 -1 0>”,                 @
      “[1 1 0]”,                  @
      “Coord 0”,                  @
      sv_asm_create_patch )
 
i_return_value = sgm_incongruent_geom_exist()
 
dump i_return_value
 
#---------------------------------------------------------------------
sgm_incongruent_geom_seg_exit
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_incongruent_geom_seg_exit()
#
#                      This function deletes the segment list to clear
#                      graphics.This file opens a new database
#                      “new.db” and creates an incongruent geometry
#                      with three surfaces.It then uses the function
#                      sgm_incongruent_geom_display to display unique
#                      points.Later the above function is used to
#                      clear graphics.
#
#                      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 sgm_incongruent_geom_seg_exit() has no arguments.
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_return_value
STRING   s_asm_create_patch[VIRTUAL]
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
ga_viewport_size_set( “default_viewport”, 3.5, 3.5, 1 )
ga_viewport_location_set( “default_viewport”, 0.0, 5.0, 1 )
 
#  Create three surfaces
asm_const_patch_xyz               @
   (  “1”,                        @
      “<1 2 0>”,                  @
      “[0 0 0]”,                  @
      “Coord 0”,                  @
      s_asm_create_patch )
 
asm_const_patch_xyz               @
   (  “2”,                        @
      “<1 1 0>”,                  @
      “[1 1 0]”,                  @
      “Coord 0”,                  @
      s_asm_create_patch )
 
asm_const_patch_xyz               @
   (  “3”,                        @
      “<1 -1 0>”,                 @
      “[1 1 0]”,                  @
      “Coord 0”,                  @
      s_asm_create_patch )
 
#  Verify the list of surfaces for existence of free edges
#  between adjacent surfaces.
sgm_verify_surface_boundary(  “Surface 1:3”,      @
                              0.005,              @
                              1 )
 
#  Display the unique points
sgm_incongruent_geom_display()
 
#  Session file paused. Press “Resume” to continue..
sf_pause()
 
i_return_value = sgm_incongruent_geom_seg_exit()
 
dump i_return_value
 
#---------------------------------------------------------------------
 
sgm_nearest_point_on_curve
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_nearest_point_on_curve()
#
#                      This file opens a new database "new.db" 
#                      It creates an arc in the database and gets the
#                      nearest point to a given location on the curve.
#
#                      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 sgm_nearest_point_on_curve()
#  has the following arguments:
#
#  sgm_nearest_point_on_curve
#     (  point_location,
#        curve_data,
#        parameter,
#        out_point_location     )
#
#---------------------------------------------------------------------
#  Variable Declarations
 
INTEGER i_label = 1
INTEGER i_curve_id
INTEGER i_blob_size
REAL    rv_blob(VIRTUAL)
REAL    ra_point_location(3)
REAL    r_parameter
REAL    ra_curve_data_out(3)
STRING  sgm_create_curve_2d_created_ids[VIRTUAL]
INTEGER i_return_value
#---------------------------------------------------------------------
#  Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
#---------------------------------------------------------------------
#  Creating the arc
 
i_return_value =                                       @
   sgm_const_curve_2d_arc2point_v2                     @
              (  "1",                                  @
                  1,                                   @
                  0,                                   @
                  TRUE,                                @
                  FALSE,                               @
                  1,                                   @
                  "Coord 0.3",                         @
                  "[0 0 0]",                           @
                  "[-4 3.5 0]",                        @
                  "[4 -0.5 0]",                        @
                  FALSE,                               @
                  sgm_create_curve_2d_created_ids )
 
db_get_curve_id(i_label, i_curve_id)
#---------------------------------------------------------------------
#  Getting the blob size.
 
        sgm_db_get_blob_size(                          @
                   2,                                  @
                   i_curve_id,                         @
                   i_blob_size,                        @
                   i_return_value        )
 
dump i_return_value
 
sys_allocate_array(rv_blob,1,i_blob_size)
#---------------------------------------------------------------------
#  Getting the curve blob.
 
       sgm_db_get_curve(                               @
                   i_curve_id,                         @
                   i_blob_size,                        @
                   rv_blob,                            @
                   i_return_value)
 
dump i_return_value
#---------------------------------------------------------------------
#  Using the function to get the point on the curve.
 
ra_point_location = [1.0 0.0 0.0]
r_parameter       =  0.15
 
i_return_value = sgm_nearest_point_on_curve(           @
                          ra_point_location,           @
                          rv_blob,                     @
                          r_parameter,                 @
                          ra_curve_data_out    )
 
dump i_return_value
dump r_parameter
dump ra_curve_data_out
#---------------------------------------------------------------------
sys_free_array(rv_blob)
sys_free_string(sgm_create_curve_2d_created_ids)
#---------------------------------------------------------------------
 
sgm_nearest_point_on_curve_aea
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_nearest_point_on_curve_aea()
#
#                      This file opens a new database "new.db" 
#                      It creates an arc in the database and gets the
#                      nearest point to a given location on the curve.
#
#                      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 sgm_nearest_point_on_curve_aea()
#  has the following arguments:
#
#  sgm_nearest_point_on_curve_aea
#     (  point_location,
#        curve_data,
#        parameter,
#        out_point_location     )
#
#---------------------------------------------------------------------
#  Variable Declarations
 
INTEGER i_label = 1
INTEGER i_curve_id
INTEGER i_blob_size
REAL    rv_blob(VIRTUAL)
REAL    ra_point_location(3)
REAL    r_parameter
REAL    ra_curve_data_out(3)
STRING  sgm_create_curve_2d_created_ids[VIRTUAL]
INTEGER i_return_value
#---------------------------------------------------------------------
#  Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
#---------------------------------------------------------------------
#  Creating the arc
 
i_return_value =                                       @
   sgm_const_curve_2d_arc2point_v2                     @
              (  "1",                                  @
                  1,                                   @
                  0,                                   @
                  TRUE,                                @
                  FALSE,                               @
                  1,                                   @
                  "Coord 0.3",                         @
                  "[0 0 0]",                           @
                  "[-4 3.5 0]",                        @
                  "[4 -0.5 0]",                        @
                  FALSE,                               @
                  sgm_create_curve_2d_created_ids )
 
db_get_curve_id(i_label, i_curve_id)
 
#---------------------------------------------------------------------
#  Getting the blob size.
 
        sgm_db_get_blob_size(                          @
                   2,                                  @
                   i_curve_id,                         @
                   i_blob_size,                        @
                   i_return_value        )
 
dump i_return_value
 
sys_allocate_array(rv_blob,1,i_blob_size)
#---------------------------------------------------------------------
#  Getting the curve blob.
 
       sgm_db_get_curve(                               @
                   i_curve_id,                         @
                   i_blob_size,                        @
                   rv_blob,                            @
                   i_return_value)
 
dump i_return_value
#---------------------------------------------------------------------
#  Using the function to get the nearest point on the curve.
 
ra_point_location = [1.0 0.0 0.0]
r_parameter       = 0.15
 
i_return_value = sgm_nearest_point_on_curve_aea(       @
                          ra_point_location,           @
                          rv_blob,                     @
                          r_parameter,                 @
                          ra_curve_data_out    )
 
dump i_return_value
dump r_parameter
dump ra_curve_data_out
#---------------------------------------------------------------------
sys_free_array(rv_blob)
sys_free_string(sgm_create_curve_2d_created_ids)
#---------------------------------------------------------------------
sgm_node_on_curve
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_node_on_curve()
#
#                      This function gets the nodes close to the given
#                      curves within the geometric tolerance. This file
#                      opens the database “spool.db” and gets the
#                      number of nodes ,the id list of these nodes and
#                      the list of node parameter close to the curve
#                      with label = 1 and with a geometric tolerance
#                      0.004.This database has thirteen curves, ten
#                      of which are orphans, and six hundred nodes.
#                      Curves have labels 1 to 3 and nodes have label
#                      1 to 600.
#
#                      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 sgm_node_on_curve()
#  has the following arguments:
#
#  sgm_node_on_curve
#     (  geotol,
#        num_crvs,
#        crv_id_lis,
#        list_size
#        init_flag
#        num_nodes,
#        node_id_list
#        node_u_list )
#
#---------------------------------------------------------------------
#  Variable Declarations
REAL     r_geotol
INTEGER  i_num_crvs
INTEGER  i_label,i_id
INTEGER  i_list_size
INTEGER  i_init_flag
INTEGER  ia_crv_id_lis(1)
INTEGER  iv_num_nodes(VIRTUAL)
INTEGER  iv_node_id_list(VIRTUAL)
REAL     rv_node_u_list(VIRTUAL)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Get the id for curve label = 1.
#  i_label = 1
i_label = 1
db_get_curve_id                                   @
   (  i_label,                                    @
      i_id )
 
ia_crv_id_lis(1) = i_id
 
SYS_ALLOCATE_ARRAY(iv_num_nodes,1,32)
SYS_ALLOCATE_ARRAY(iv_node_id_list,1,32)
SYS_ALLOCATE_ARRAY(rv_node_u_list,1,32)
 
 
#  r_geotol = 0.004
r_geotol = 0.004
#  i_num_crvs = 1
i_num_crvs = 1
#  i_list_size = 32
i_list_size = 32
#  i_init_flag = 0
i_init_flag = 0
 
 
i_return_value =                                  @
   sgm_node_on_curve                              @
      (  r_geotol,                                @
         i_num_crvs,                              @
         ia_crv_id_lis,                           @
         i_list_size,                             @
         i_init_flag,                             @
         iv_num_nodes,                            @
         iv_node_id_list,                         @
         rv_node_u_list )
 
dump i_return_value
 
#  The number of nodes found to be close to the  curve with label = 1.
dump iv_num_nodes
 
#  The id list of nodes close to the curve with label = 1.
dump iv_node_id_list
 
#  The list of node parameter close to the curve with label = 1.
dump rv_node_u_list
 
SYS_FREE_ARRAY(iv_num_nodes)
SYS_FREE_ARRAY(iv_node_id_list)
SYS_FREE_ARRAY(rv_node_u_list)
 
#---------------------------------------------------------------------
sgm_node_on_point
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_node_on_point()
#
#                      This function gets the nodes close to the given
#                      points within the geometric tolerance. This file
#                      opens the database “spool.db” and gets the
#                      number of nodes and the id list of these nodes
#                      close to the point with label=9 and with a
#                      geometric tolerance 0.004. This database has
#                      seven points and six hundred nodes.Points have
#                      labels 4 to 10 and nodes have labels 1 to 600.
#
#                      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 sgm_node_on_point()
#  has the following arguments:
#
#  sgm_node_on_point
#     (  geotol,
#        num_pts,
#        pt_id_list,
#        num_nodes,
#        node_id_list )
#
#---------------------------------------------------------------------
#  Variable Declarations
REAL     r_geotol
INTEGER  i_num_pts
INTEGER  i_label,i_id
INTEGER  ia_pt_id_list(1)
INTEGER  iv_num_nodes(VIRTUAL)
INTEGER  iv_node_id_list(VIRTUAL)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Get the id for label = 9.
#  i_label = 9
i_label = 9
db_get_point_id                                   @
   (  i_label,                                    @
      i_id )
 
ia_pt_id_list(1) = i_id
 
#  r_geotol = 0.004
r_geotol = 0.004
#  i_num_pts = 1
i_num_pts = 1
 
SYS_ALLOCATE_ARRAY(iv_num_nodes,1,32)
SYS_ALLOCATE_ARRAY(iv_node_id_list,1,32)
 
i_return_value =                                  @
   sgm_node_on_point                              @
      (  r_geotol,                                @
         i_num_pts,                               @
         ia_pt_id_list,                           @
         iv_num_nodes,                            @
         iv_node_id_list )
 
dump i_return_value
 
#  The number of nodes found to be close to the  point with id = 4.
dump iv_num_nodes
 
#  The id list of nodes close to the point with id = 4.
dump iv_node_id_list
 
SYS_FREE_ARRAY(iv_num_nodes)
SYS_FREE_ARRAY(iv_node_id_list)
 
#---------------------------------------------------------------------
 
sgm_node_on_surface
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_node_on_surface()
#
#                      This function gets the nodes close to the given
#                      surfaces within the geometric tolerance.This 
#                      file opens the database “spool.db” and gets the
#                      number of nodes ,the id list of these nodes and
#                      the list of node parameter close to the surface
#                      with label = 1 and with a geometric tolerance
#                      0.004.This database has six surfaces and six
#                      hundred nodes.
#
#                      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 sgm_node_on_surface()
#  has the following arguments:
#
#  sgm_node_on_surface
#     (  geotol,
#        num_surs,
#        sur_id_list,
#        list_size
#        init_flag
#        num_nodes,
#        node_id_list,
#        node_uv_list )
#
#---------------------------------------------------------------------
#  Variable Declarations
REAL     r_geotol
INTEGER  i_num_surs
INTEGER  i_label
INTEGER  i_id
INTEGER  i_list_size
INTEGER  i_init_flag
INTEGER  ia_sur_id_list(1)
INTEGER  iv_num_nodes(VIRTUAL)
INTEGER  iv_node_id_list(VIRTUAL)
REAL     rv_node_uv_list(VIRTUAL)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  i_label = 1
i_label = 1
 
db_get_surface_id                                 @
   (  i_label,                                    @
      i_id )
 
ia_sur_id_list(1) = i_id
 
#  r_geotol = 0.004
r_geotol = 0.004
#  i_num_surs = 1
i_num_surs = 1
#  i_list_size = 128
i_list_size = 128
#  i_init_flag = 0
i_init_flag = 0
 
SYS_ALLOCATE_ARRAY(iv_num_nodes,1,4)
SYS_ALLOCATE_ARRAY(iv_node_id_list,1,128)
SYS_ALLOCATE_ARRAY(rv_node_uv_list,1,256)
 
i_return_value =                                  @
   sgm_node_on_surface                            @
      (  r_geotol,                                @
         i_num_surs,                              @
         ia_sur_id_list,                          @
         i_list_size,                             @
         i_init_flag,                             @
         iv_num_nodes,                            @
         iv_node_id_list,                         @
         rv_node_uv_list )
 
dump i_return_value
 
#  The number of nodes found to be close to the  surface with
#  label = 1.
dump iv_num_nodes
 
#  The id list of nodes close to the surface with label = 1.
dump iv_node_id_list
 
#  The list of node parameter close to the surface with label = 1.
dump rv_node_uv_list
 
SYS_FREE_ARRAY(iv_num_nodes)
SYS_FREE_ARRAY(iv_node_id_list)
SYS_FREE_ARRAY(rv_node_uv_list)
#---------------------------------------------------------------------
 
sgm_show_angle_between_curves
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_show_angle_between_curves()
#
#                      This file opens a new database "new.db" 
#                      It creates an two curves in the database
#                      The function gets the angle between the 
#                      two curves.
#
#                      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 sgm_show_angle_between_curves()
#  has the following arguments:
#
#  sgm_show_angle_between_curves
#     (  curve_list_1,
#        curve_list_2,
#        segment_id,
#        marker_type,
#        marker_color,
#        marker_size,
#        angle            )
#
#---------------------------------------------------------------------
#  Variable Declarations
 
STRING  asm_create_line_xyz_created_ids[VIRTUAL]
STRING  s_curve_list_1[32]
STRING  s_curve_list_2[32]
INTEGER i_segment_id
INTEGER i_marker_type
INTEGER i_marker_color
INTEGER i_marker_size
STRING  s_angle_out[32]
INTEGER i_return_value
#---------------------------------------------------------------------
#  Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
#---------------------------------------------------------------------
#  Creating the curves.
 
i_return_value =                                       @
   asm_const_line_xyz                                  @
              (  "1",                                  @
                 "<1.0 0 0>",                          @
                 "[0 0 0]",                            @
                 "Coord 0",                            @
                 asm_create_line_xyz_created_ids )
 
dump i_return_value
 
i_return_value =                                       @
   asm_const_line_xyz                                  @
              (  "2",                                  @
                 "<1 1 0>",                            @
                 "[0 0 0]",                            @
                 "Coord 0",                            @
                 asm_create_line_xyz_created_ids )
 
dump i_return_value
 
#---------------------------------------------------------------------
#  Creating the segment
 
i_segment_id   =  1
 
i_return_value =                                       @
            gm_segment_create(                         @
                  i_segment_id        )
 
dump i_return_value
#---------------------------------------------------------------------
#  Getting the angle between the nodes.
 
s_curve_list_1 = "Curve 1"
s_curve_list_2 = "Curve 2"
i_marker_type  =  5
i_marker_color =  6
i_marker_size  =  50
 
i_return_value =                                       @
          sgm_show_angle_between_curves                @
            (    s_curve_list_1,                       @
                 s_curve_list_2,                       @
                 i_segment_id,                         @
                 i_marker_type,                        @
                 i_marker_color,                       @
                 i_marker_size,                        @
                 s_angle_out    )
 
 
dump i_return_value
dump s_angle_out
#---------------------------------------------------------------------
sys_free_string(asm_create_line_xyz_created_ids)
#---------------------------------------------------------------------
sgm_show_surface_normals
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_show_surface_normals()
#
#                      This function calculates and shows the surface 
#                      normals.This file opens the database “spool.db”
#                      and creates a segment.Later it calculates and 
#                      shows the surface normals at the interior and
#                      boundary for surface with labels 1 and 4 with 
#                      vector density 10 and vector length 2.0.This
#                      database has six surfaces.
#
#                      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 sgm_show_surface_normals()
#  has the following arguments:
#
#  sgm_show_surface_normals
#     (  surflist,
#        scaled,
#        numsurf,
#        segid,
#        redflag,
#        vecdens,
#        veclen )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_surflist[128]
LOGICAL  l_scaled
INTEGER  i_numsurf
INTEGER  i_segid
INTEGER  i_redflag
INTEGER  i_vecdens
REAL     r_veclen
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  Create a segment
gm_segment_create(i_segid)
 
#  s_surflist = “surface 1 4”
s_surflist = “surface 1 4”
#  l_scaled = FALSE
l_scaled = FALSE
#  i_numsurf = 2
i_numsurf = 2
#  i_redflag = 0
i_redflag = 0
#  i_vecdens = 10
i_vecdens = 10
#  r_veclen  = 2. 
r_veclen  = 2. 
 
i_return_value =                                  @
   sgm_show_surface_normals                       @
      (  s_surflist,                              @
         l_scaled,                                @
         i_numsurf,                               @
         i_segid,                                 @
         i_redflag,                               @
         i_vecdens,                               @
         r_veclen )
 
dump i_return_value
 
#  Session file paused. Press “Resume” to continue..
sf_pause()
 
#  Delete the created segment
gm_segment_delete(i_segid)
#---------------------------------------------------------------------
sgm_solid_evaluate
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_solid_evaluate()
#
#                      This function plays as traffic cop for low
#                      level solid evaluators.This file opens a new
#                      database “new.db” and creates two solids with
#                      label 1 and 2.It then gets the geometric
#                      description of the solid with label =1 using 
#                      the function sgm_db_get_solid.Later it uses 
#                      the function sgm_solid_evaluate to get the 
#                      output table for parametric coordinates 0.3 and
#                      the derivative flag set to 0.
#
#                      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 sgm_solid_evaluate()
#  has the following arguments:
#
#  sgm_solid_evaluate
#     (  s,
#        ui,
#        vi,
#        wi,
#        in,
#        pd,
#        irc )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_solidid,i_label,i_blobsize,i_status,i_entitytype
REAL     rv_s(VIRTUAL)
REAL     r_ui
REAL     r_vi
REAL     r_wi
INTEGER  i_in
REAL     ra_pd(1,3)
INTEGER  i_irc
STRING   sv_asm_create_hpat[VIRTUAL]
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Create two solid entities.
asm_const_hpat_xyz( “1”, “<1 1 1>”, “[0 0 0]”, “Coord 0”,  @
sv_asm_create_hpat )
 
asm_const_hpat_xyz( “2”, “<2 2 2>”, “[0 0 0]”, “Coord 0”,  @
sv_asm_create_hpat )
 
#  r_ui = 0.3
r_ui = 0.3
#  r_vi = 0.3
r_vi = 0.3
#  r_wi = 0.3
r_wi = 0.3
#  i_in = 0
i_in = 0
 
#  i_label = 1
i_label = 1
 
#  Get the internal  id for solid label = 1.
db_get_solid_id                                   @
   (  i_label,                                    @
      i_solidid )
 
#  i_entitytype = 4 (solid)
i_entitytype = 4
 
#  Get the blob size.
sgm_db_get_blob_size                              @
   (  i_entitytype,                               @
      i_solidid,                                  @
      i_blobsize,                                 @
      i_status )
 
SYS_ALLOCATE_ARRAY(rv_s,1,i_blobsize)
 
sgm_db_get_solid                                  @
   (  i_solidid,                                  @
      i_blobsize,                                 @
      rv_s,                                       @
      i_status )
 
sgm_solid_evaluate                                @
   (  rv_s,                                       @
      r_ui,                                       @
      r_vi,                                       @
      r_wi,                                       @
      i_in,                                       @
      ra_pd,                                      @
      i_irc )
 
dump i_irc
 
#  Output data table
dump ra_pd
 
SYS_FREE_ARRAY(rv_s)
SYS_FREE_STRING(sv_asm_create_hpat)
#---------------------------------------------------------------------
sgm_surface_evaluate
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_surface_evaluate()
#
#                      This function is a high level traffic cop for 
#                      low level surface evaluators.This file opens 
#                      the database “spool.db” and gets the geometric
#                      description of the surface with label =1 using 
#                      the function sgm_db_get_surface.Later it uses 
#                      the function sgm_surface_evaluate to get the 
#                      output table for parametric coordinates 0.3 and
#                      the control flag set to 0.
#
#                      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 sgm_surface_evaluate()
#  has the following arguments:
#
#  sgm_surface_evaluate
#     (  s,
#        ui,
#        vi,
#        in,
#        pd,
#        irc )
#
#---------------------------------------------------------------------
#  Variable Declarations
REAL     rv_s(VIRTUAL)
REAL     r_ui
REAL     r_vi
INTEGER  i_in
REAL     ra_pd(1,3)
INTEGER  i_surfaceid
INTEGER  i_blobsize
INTEGER  i_entitytype
INTEGER  i_label
INTEGER  i_status
INTEGER  i_irc
#---------------------------------------------------------------------
#  Open the database “spool.db”
uil_file_open.go(“spool.db”)
 
#  r_ui = 0.3
r_ui = 0.3
#  r_vi = 0.3
r_vi = 0.3
#  i_in = 0
i_in = 0
 
#  i_label = 1
i_label = 1
 
#  Get the internal id for surface label = 1.
db_get_surface_id                                 @
   (  i_label,                                    @
      i_surfaceid )
 
#  i_entitytype = 3 (surface)
i_entitytype = 3
 
#  Get the blob size.
sgm_db_get_blob_size                              @
   (  i_entitytype,                               @
      i_surfaceid,                                @
      i_blobsize,                                 @
      i_status )
 
SYS_ALLOCATE_ARRAY(rv_s,1,i_blobsize)
sgm_db_get_surface                                @
   (  i_surfaceid,                                @
      i_blobsize,                                 @
      rv_s,                                       @
      i_status )
 
sgm_surface_evaluate                              @
   (  rv_s,                                       @
      r_ui,                                       @
      r_vi,                                       @
      i_in,                                       @
      ra_pd,                                      @
      i_irc )
 
dump i_irc
 
#  Output data table
dump ra_pd
 
SYS_FREE_ARRAY(rv_s)
#---------------------------------------------------------------------
sgm_u_calc_mscale_mat
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_u_calc_mscale_mat()
#
#                      This function calculates the transformation
#                      matrix for a mscale transformation.
#
#                      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 sgm_u_calc_mscale_mat()
#  has the following arguments:
#
#  sgm_u_calc_mscale_mat
#     (  coord_org,
#        coord_rmat,
#        translation,
#        scale,
#        axis_base,
#        axis_tip,
#        rotation_angle,
#        tmat )
#
#---------------------------------------------------------------------
#  Variable Declarations
REAL     ra_coord_org(3)      =  [0, 0, 0]
REAL     ra_coord_rmat(9)     =  [1, 0, 0, 0, 1, 0, 0, 0, 1]
REAL     ra_translation(3)    =  [1, 1, 1]
REAL     ra_scale(3)          =  [1, 1, 1]
REAL     ra_axis_base(3)      =  [0, 0, 0]
REAL     ra_axis_tip(3)       =  [0, 0, 1]
REAL     r_rotation_angle     =  30
REAL     ra_tmat(16)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  The transformation matrix is calculated for
#  translation vector=[1,1,1] and scaling factor
#  =[1,1,1] for a rotation angle of 30 degrees
#  about the z axis.
 
i_return_value =                                  @
   sgm_u_calc_mscale_mat                          @
      (  ra_coord_org,                            @
         ra_coord_rmat,                           @
         ra_translation,                          @
         ra_scale,                                @
         ra_axis_base,                            @
         ra_axis_tip,                             @
         r_rotation_angle,                        @
         ra_tmat )
 
dump i_return_value
 
#  The transformation matrix is
dump ra_tmat
#---------------------------------------------------------------------
sgm_verify_solid_brep
()
#  Purpose          :  This file provides an example of a call to the
#                      function sgm_verify_solid_brep()
#                       
#                      This function maintains the widgets for the
#                      sgm verify solid brep command.This file opens
#                      a new database “new.db” and creates a b-rep
#                      solid.Later it uses the above function.
#                    
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function sgm_verify_solid_brep()
#  has the following arguments:
#
#  sgm_verify_solid_brep
#     (  surfacelist,
#        verify_tol )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_count
INTEGER  i_return_value
REAL     r_verify_tol
INTEGER  i_return_value
STRING   sv_asm_create_patch_xy_created[VIRTUAL]
STRING   sv_sgm_create_solid_br_created[VIRTUAL]
STRING   sa_surfacelist[32]
STRING   sv_asm_create_hpat[VIRTUAL]
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
ga_view_aa_set( -67., 0., -34. )
ga_view_aa_set( 23., -34., 0. )
 
#  Create a b-rep solid
asm_const_patch_xyz( “1”, “<1 1 0>”, “[0 0 0]”, “Coord 0”,       @
sv_asm_create_patch_xy_created )
asm_const_patch_xyz( “2”, “<0 1 1>”, “[0 0 0]”, “Coord 0”,       @
sv_asm_create_patch_xy_created )
asm_const_patch_xyz( “3”, “<1 0 1>”, “[0 0 0]”, “Coord 0”,       @
sv_asm_create_patch_xy_created )
asm_const_patch_xyz( “4”, “<0 1 1>”, “[1 0 0]”, “Coord 0”,       @
sv_asm_create_patch_xy_created )
asm_const_patch_xyz( “5”, “<1 1 0>”, “[0 0 1]”, “Coord 0”,       @
sv_asm_create_patch_xy_created )
asm_const_patch_xyz( “6”, “<1 0 1>”, “[0 1 0]”, “Coord 0”,       @
sv_asm_create_patch_xy_created )
 
sgm_construct_solid_brep( “1”, “Surface 1:6 “, FALSE,            @
sv_sgm_create_solid_br_created )
 
uil_app_asm.get_form_id()
 
sa_surfacelist = “surface 1:6”
r_verify_tol = 0.005
i_return_value =                                  @
   sgm_verify_solid_brep                          @
      (  sa_surfacelist,                          @
         r_verify_tol )
dump i_return_value
 
SYS_FREE_STRING(sv_asm_create_patch_xy_created )
SYS_FREE_STRING(sv_sgm_create_solid_br_created )
#---------------------------------------------------------------------
transform_pts
()
#  Purpose          :  This file provides an example of a call to the
#                      function transform_pts()
#
#                      This function transforms the points from global
#                      system to local system with the given id of the
#                      local coordinate system.This file opens a new
#                      database “new.db” and creates a cylindrical 
#                      coordinate system.It then transforms the point
#                      [3,4,2] from default rectangular coordinate
#                      system to the created cylindrical coordinate
#                      system. 
#
#                      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 transform_pts() has the following arguments:
#
#  transform_pts
#     (  cid,
#        cidtyp,
#        npts,
#        points )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_cid
INTEGER  i_cidtyp
INTEGER  i_npts
REAL     ra_points(3,1)
STRING   sv_asm_create_cord_created_ids[VIRTUAL]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  Create a cylindrical coordinate system with origin at [0,0,0],
#  axis 3 as [0,0,1] and a point on plane 1-3 as [1,0,0].
asm_const_coord_3point( “1”, “Coord 0”, 2, “[0 0 0]”, “[0 0 1]”, @
“[1 0 0]”, sv_asm_create_cord_created_ids )
 
#  ra_points = [[3.0][4.0][2.0]]
ra_points = [[3.0][4.0][2.0]]
#  i_npts = 1
i_npts = 1
#  i_cid = 1
i_cid = 1
 
i_return_value =                                  @
   transform_pts                                  @
      (  i_cid,                                   @
         i_cidtyp,                                @
         i_npts,                                  @
         ra_points )
 
dump i_return_value
 
#  The type of coordinate system is
dump i_cidtyp
 
#  Values of the coordinates of the points in cylindrical system are
dump ra_points
 
#  The z coordinate remains the same.The first radial coordinate is 
#  the squareroot of the sum of the squares of the x and y coordinates
#  of the rectangular coordinate system.The second rotation coordinate
#  is the inverse tan of (y/x) .
 
SYS_FREE_STRING(sv_asm_create_cord_created_ids)
#---------------------------------------------------------------------
 
xy_curve_num_points_get
()
#  Purpose          :  This function will get the number of points
#                      on the curve and yonly flag which is TRUE if
#                      the curve uses only y values and FALSE if 
#                      curve uses both xy values. This function 
#                      require curve name as input argument.
#
#                      This file can be run by starting a session of
#                      MSC Patran,running this session file through 
#                      the "File","Session","Play" pulldown menus
#                      on the menu bar.
#
#
#  The function xy_curve_num_points_get()
#  has the following arguments:
#
#  xy_curve_num_points_get
#     (  INPUT: 
#        STRING curve_name,
#        OUTPUT:
#        LOGICAL yonly,
#        INTEGER npoints
#        INTEGER status
#     ) 
#---------------------------------------------------------------------
# 
#  Opening a new database 
 
     uil_file_new.go("","new.db")
 
#---------------------------------------------------------------------
 
#  Declaring and defining input arguents
 
   STRING curve_name[64] = "New_Curve"
 
#  Declaring output argument
 
   LOGICAL yonly
 
   INTEGER npoints
 
   INTEGER status
 
#----------------------------------------------------------------------
 
#  Using the function xy_window_create() to create the window.
 
         xy_window_create("XY_Window",                 @
                           2.5,3.5,                    @
                           5.0,5.0)
 
#  Using the function xy_curve_create to create new curve.
 
   STRING text[32] = "Viscosity"
   INTEGER colour = 3
 
         xy_curve_create(curve_name,                   @
			 text,colour)
 
#  Using the function xy_curve_data_set to set the data to this curve.
 
   LOGICAL yonly_flag = FALSE
   INTEGER points = 5
   REAL x_array(5) = [1.0,3.0,6.0,8.0,9.0]
   REAL y_array(5) = [2.0,8.0,4.0,9.0,5.0]
 
         xy_curve_data_set(curve_name,                 @
                           yonly_flag,                 @
                           points,                     @
                           x_array,                    @
                           y_array)
 
#-----------------------------------------------------------------------
 
#  Using the Function xy_curve_num_points_get() to get yonly and npoints.
 
 
         status = xy_curve_num_points_get(curve_name,  @
                                          yonly,       @
                                          npoints)
 
    dump status
    dump yonly
    dump npoints
 
#---------------------------------------------------------------------
 
#  End of File.
 
#---------------------------------------------------------------------