You are on page 1of 1410

C O N T E N T S

MSC.Acumen Toolkit
MSC.Acumen,
Volume
Examples
Code2:
Code Examples MSC.Acumen Tool-
kit, Code Examples

CHAPTER
1
Introduction ■ Introduction, 2
• db_get_p3_version, 2
• is_batch, 2
• user_db_close, 3
• user_db_new, 3
• user_db_open, 4
• user_quit, 5
• user_start, 5
• utl_get_terse_version, 6
• utl_query_version_level, 6

2
Model ■ Introduction, 8
• db_count_client_labels_by_type, 8
• db_count_general_field, 10
• db_create_client_data, 11
• db_delete_client_data, 13
• db_get_all_client_data, 14
• db_get_client_data, 16
• db_get_client_id_by_label, 18
• db_get_client_label_by_id, 19
• db_get_client_labels_by_type, 21
• db_get_db_version, 23
• db_get_general_field, 23
• db_get_general_field_length, 25
• db_get_model_file_suffix, 27
• db_get_next_client_entity_label, 28

3
Files ■ Introduction, 32
• file_is_directory, 32
• get_current_dir, 32
• jou_file_write, 33
• neutral_export2, 33
• nf_write, 34
• nf_write2, 36
• p3_ps_get_xmt, 37
• set_current_dir, 38
Main Index
• sf_write_disable, 39
• ugi_export_iges_v1, 40
• ugi_import_iges_v3, 41
• ui_form_to_frame, 43
• ui_framemaker, 44
• uil_file_open.open_db, 46
• utl_is_locked_file, 47
• utl_lock_file, 48
• utl_unlock_file, 49

4
Graphics ■ Introduction, 52
• clip_plane_ar_calc, 52
• clip_plane_zoom_calc, 53
• db_get_current_viewport_id, 55
• end_vrml_animation, 55
• ga_clip_plane_clip_planes_get, 58
• ga_clip_plane_create, 59
• ga_clip_plane_delete, 60
• ga_clip_plane_direction_get, 61
• ga_clip_plane_direction_set, 62
• ga_clip_plane_icon_get, 63
• ga_clip_plane_icon_set, 64
• ga_clip_plane_location_get, 65
• ga_clip_plane_location_set, 66
• ga_clip_plane_movement_get, 67
• ga_clip_plane_movement_set, 69
• ga_clip_plane_nclip_planes_get, 70
• ga_clip_plane_nposted_get, 71
• ga_clip_plane_post, 72
• ga_clip_plane_posted_get, 73
• ga_clip_plane_unpost, 75
• ga_clip_plane_up_set, 76
• ga_elem_scalar_create, 77
• ga_elem_scalar_single_create, 79
• ga_error, 80
• ga_light_attenuation_get, 81
• ga_light_attenuation_set, 82
• ga_light_color_get, 83
• ga_light_color_set, 84
• ga_light_create, 85
• ga_light_delete, 86
• ga_light_direction_get, 87
• ga_light_direction_set, 89
• ga_light_icon_get, 90
• ga_light_icon_set, 91
• ga_light_intensity_get, 92
• ga_light_intensity_set, 93
• ga_light_lights_get, 94
• ga_light_location_get, 95
• ga_light_location_set, 96
• ga_light_movement_get, 97
• ga_light_movement_set, 98
Main Index
• ga_light_nlights_get, 100
• ga_light_nposted_get, 100
• ga_light_post, 101
• ga_light_posted_get, 102
• ga_light_type_get, 103
• ga_light_type_set, 104
• ga_light_unpost, 105
• ga_lookup_colors_get, 107
• ga_lookup_colors_set, 108
• ga_lookup_create, 110
• ga_lookup_current_get, 111
• ga_lookup_current_set, 112
• ga_lookup_delete, 113
• ga_lookup_ncolors_get, 114
• ga_lookup_ntables_get, 115
• ga_lookup_rename, 116
• ga_lookup_tables_get, 117
• ga_node_deform_create, 118
• ga_range_contour_get, 119
• ga_range_contour_set, 120
• ga_range_create, 122
• ga_range_delete, 124
• ga_range_exist_get, 126
• ga_range_nranges_get, 127
• ga_range_nvalues_get, 127
• ga_range_ranges_get, 128
• ga_range_rename, 129
• ga_range_startend_set, 131
• ga_range_threshold_set, 133
• ga_range_values_get, 135
• ga_range_values_set, 136
• ga_spectrum_colors_get, 138
• ga_spectrum_colors_set, 139
• ga_spectrum_continuous_get, 141
• ga_spectrum_continuous_set, 142
• ga_spectrum_create, 143
• ga_spectrum_current_get, 145
• ga_spectrum_current_set, 145
• ga_spectrum_delete, 147
• ga_spectrum_interpolation_get, 148
• ga_spectrum_interpolation_set, 149
• ga_spectrum_ncolors_get, 151
• ga_spectrum_nspectrums_get, 151
• ga_spectrum_rename, 152
• ga_spectrum_spectrums_get, 153
• ga_title_color_get, 154
• ga_title_color_set, 155
• ga_title_create, 157
• ga_title_delete, 158
• ga_title_font_size_get, 159
• ga_title_font_size_set, 160
• ga_title_list_get, 161
• ga_title_loc_get, 162
• ga_title_loc_set, 163
Main Index
• ga_title_nposted_get, 164
• ga_title_num_get, 165
• ga_title_posted_get, 166
• ga_title_rename, 167
• ga_vector_create, 168
• ga_vector_get, 170
• ga_vector_number_get, 173
• ga_view_normal_get, 175
• gm_conv_device_to_subject, 176
• gm_convert_name, 177
• gm_database_current, 178
• gm_draw_entity, 178
• gm_fit_view, 179
• gm_fullcolor_mode, 180
• gm_graphics_off, 181
• gm_graphics_on, 181
• gm_hilight_clear, 182
• gm_hilight_entity, 183
• gm_hilight_string, 184
• gm_hilight_widget, 185
• gm_lookup_write, 186
• gm_mpeg_pause_recording, 187
• gm_mpeg_resume_recording, 189
• gm_mpeg_start_recording, 191
• gm_mpeg_stop_recording, 193
• gm_viewport_hardware_mode_get, 195
• gm_viewport_hardware_mode_set, 195
• gm_viewport_id_to_name, 196
• gm_viewport_limits_get, 197
• gm_viewport_ncolors_get, 198
• gm_viewport_refresh_off, 198
• gm_viewport_refresh_on, 199
• gm_viewport_refresh_status, 200
• gm_viewport_view_corners, 200
• gm_visibility_all, 202
• gm_visibility_widget, 202
• gm_write_image, 203
• gm_write_vrml, 205
• ga_lookup_create, 207
• ga_lookup_current_set, 208
• ga_lookup_delete, 209
• ga_range_create, 211
• ga_range_delete, 212
• ga_spectrum_colors_set, 214
• ga_spectrum_continuous_set, 216
• ga_spectrum_create, 217
• ga_spectrum_current_set, 218
• ga_spectrum_delete, 220
• ga_spectrum_interpolation_set, 221
• ga_title_create, 223
• ga_title_delete, 224
• start_vrml_animation, 226
• verify_boundaries_display_mgr.erase, 229
• verify_boundaries_display_mgr.initialize, 229
Main Index
• verify_boundaries_display_mgr.plot, 230

5
User Interface ■ Introduction, 234
• app_count_list, 234
• app_count_list, 235
• app_db_err_msg, 237
• app_ids_to_vstring, 238
• app_int_array_to_vstring, 240
• appcode, 241
• asm_u_coord_global_to_local, 241
• asm_u_lp_get_entity_label, 242
• asm_u_lp_get_point, 243
• asm_u_lp_get_vector, 244
• lp_eval_cleanup, 246
• lp_geometry_text, 247
• lp_keyword_text, 248
• msg_format_string, 249
• msg_get_application, 251
• msg_string_more, 252
• msg_to_file, 253
• msg_to_string, 254
• notemessage.text, 256
• ui_add_help, 256
• ui_clear_focus, 258
• ui_exec_command, 259
• ui_form_delete, 259
• ui_form_exists, 260
• ui_form_is_displayed, 262
• ui_form_is_displayed, 263
• ui_get_client, 265
• ui_get_help, 265
• ui_get_server, 267
• ui_graph_create, 267
• ui_graph_create, 268
• ui_is_initialized, 269
• ui_register_help, 269
• ui_sys_command, 271
• ui_sys_return, 272
• ui_text_select, 272
• ui_text_select, 273
• ui_wid_exit, 275
• ui_wid_hide_forms, 275
• ui_wid_restore_widget, 276
• ui_wid_save_widget, 278
• uid_get_border_sizes, 280
• uid_get_font_heights, 281
• uid_get_screen_info, 281
• uid_set_sys_pix, 282
• uil_app_analysis.get_real_name, 283
• uil_pcntcomplete.close, 284
• uil_pcntcomplete.initlz, 284
Main Index
• uil_primary.get_menubar_id, 285
• uil_utils_listbox.append_list, 286
• uil_utils_listbox.create_list, 287
• uil_utils_listbox.delete_item, 288
• uil_utils_listbox.delete_item_list, 290
• uil_utils_listbox.delete_selected, 291
• uil_utils_listbox.get_all, 293
• uil_utils_listbox.get_selected, 294
• uil_utils_listbox.get_unselected, 296
• uil_utils_listbox.select, 297
• uil_utils_listbox.select_all, 299
• uil_utils_listbox.select_list, 300
• uil_utils_listbox.select_none, 301
• user_message, 303

6
Group ■ Introduction, 306
• asm_db_count_asm_in_group, 306
• asm_db_get_grids_in_group, 307
• asm_db_get_hpats_in_group, 308
• asm_db_get_lines_in_group, 309
• asm_db_get_patches_in_group, 311
• count_orphan_elements, 312
• count_orphan_nodes, 313
• db_add_mpc_to_group, 315
• db_count_entities_in_group, 316
• db_count_groups_for_entity, 317
• db_count_groups_using_mpc, 318
• db_count_orphan_curves, 319
• db_count_orphan_curves, 320
• db_count_orphan_mpcs, 322
• db_count_orphan_points, 323
• db_count_orphan_solids, 324
• db_count_orphan_surfaces, 325
• db_get_group_name, 326
• db_get_groups_for_entity, 327
• db_get_groups_using_mpc, 328
• db_get_orphan_curves, 329
• db_get_orphan_mpcs, 330
• db_get_orphan_points, 331
• db_get_orphan_solids, 332
• db_get_orphan_surfaces, 333
• ga_group_color_get, 334
• ga_group_color_set, 335
• ga_group_current_get, 336
• ga_group_deform_get, 337
• ga_group_deform_set, 338
• ga_group_display_get, 339
• ga_group_elem_scalar_get, 341
• ga_group_elem_scalar_set, 342
• ga_group_entities_get, 344
• ga_group_exist_get, 345
Main Index
• ga_group_groups_get, 346
• ga_group_label_get, 347
• ga_group_label_set, 348
• ga_group_load_vector_get, 349
• ga_group_load_vector_set, 351
• ga_group_load_vector_set, 352
• ga_group_load_vector_set, 354
• ga_group_nentities_get, 356
• ga_group_node_deform_set, 357
• ga_group_node_deform_set, 358
• ga_group_precision_get, 360
• ga_group_result_vector_get, 361
• ga_group_result_vector_get, 363
• ga_group_result_vector_set, 365
• ga_group_result_vector_set, 367
• ga_group_selectable_get, 369
• ga_group_selectable_set, 371
• ga_group_style_get, 372
• ga_group_style_set, 373
• ga_group_vector_load_get, 375
• ga_group_vector_load_set, 376
• ga_group_vector_result_get, 377
• ga_group_vector_result_get, 378
• ga_group_vector_result_set, 380
• ga_group_vector_result_set, 381
• ga_groups_load_vector_set, 382
• ga_groups_load_vector_set, 384
• get_orphan_elements, 386
• get_orphan_nodes, 387
• sgm_db_count_iges_in_group, 388
• sgm_db_get_iges_in_group, 389
• sgm_db_get_iges_in_group, 390
• uil_entity_group_members_get, 391

7
Geometry ■ Introduction, 394
• app_db_get_ref_cid, 394
• asm_const_curve_2d_arc2point_v2, 395
• asm_const_curve_2d_arc3point_v1, 396
• asm_const_curve_2d_circle_v1, 397
• asm_const_curve_project_v1, 398
• asm_db_create_grid, 400
• asm_db_get_curve_geo, 401
• asm_db_get_next_cord_label, 402
• asm_db_get_next_grid_label, 403
• asm_db_get_next_hpat_label, 405
• asm_db_get_next_line_label, 406
• asm_db_get_next_patch_label, 406
• asm_u_coord_global_to_local, 407
• asm_u_coord_local_to_global, 408
• curve_arc_to_parm, 409
• curve_parm_to_arc, 410
Main Index
• db_check_coord_frame_exist, 412
• db_count_coordinate_frame, 413
• db_count_curve, 413
• db_count_curves_for_point, 414
• db_count_point, 415
• db_count_solid, 416
• db_count_solids_for_surface, 417
• db_count_surface, 418
• db_count_surfaces_for_edge, 418
• db_get_all_coord_frame_ids, 419
• db_get_all_posted_coord, 421
• db_get_coord_frame_label, 422
• db_get_current_coord, 423
• db_get_curve_coo_and_type, 424
• db_get_curve_id, 425
• db_get_curve_label, 426
• db_get_curves_for_point, 426
• db_get_geom_type, 428
• db_get_max_coord_label, 429
• db_get_max_curve_label, 429
• db_get_max_point_label, 430
• db_get_max_solid_label, 431
• db_get_max_surface_label, 432
• db_get_min_coord_label, 432
• db_get_min_curve_label, 433
• db_get_min_point_label, 434
• db_get_min_solid_label, 435
• db_get_min_surface_label, 435
• db_get_next_coord_frame_ids, 436
• db_get_next_posted_coord, 437
• db_get_point_association_count, 439
• db_get_point_coo_and_type, 440
• db_get_point_id, 441
• db_get_point_label, 441
• db_get_solid_coo_and_type, 442
• db_get_solid_id, 443
• db_get_solid_label, 444
• db_get_solids_for_surface, 445
• db_get_surface_coo_and_type, 446
• db_get_surface_id, 447
• db_get_surface_label, 448
• db_get_surfaces_for_edge, 449
• sgm_associate_nodes_curve, 450
• sgm_const_curve_project_v1, 451
• sgm_construct_solid_brep, 453
• sgm_construct_solid_volume, 454
• sgm_create_curve_on_surface, 456
• sgm_create_surface_composite_c, 458
• sgm_create_surface_comptrim_v1, 460
• sgm_create_surface_from_elems1, 462
• sgm_curve_convert_s_to_u, 464
• sgm_curve_convert_u_to_s, 466
• sgm_curve_evaluate, 468
• sgm_db_get_blob_size, 470
Main Index
• sgm_db_get_company_of_origin, 471
• sgm_db_get_curve, 472
• sgm_db_get_edge_vertex_ids, 473
• sgm_db_get_gen_body_face_ids, 474
• sgm_db_get_gen_body_vertex_ids, 476
• sgm_db_get_gen_face_edge_ids, 477
• sgm_db_get_gen_face_vertex_ids, 478
• sgm_db_get_num_edges_face, 479
• sgm_db_get_num_faces_body, 480
• sgm_db_get_num_loops_face, 481
• sgm_db_get_num_vertices_body, 483
• sgm_db_get_point, 484
• sgm_db_get_solid, 485
• sgm_db_get_surface, 486
• sgm_db_modify_entity_label, 487
• sgm_edit_brep_break_plane_v1, 489
• sgm_edit_brep_break_surface_v1, 490
• sgm_edit_point_equivalence, 491
• sgm_edit_solid_break, 492
• sgm_edit_solid_refit_v1, 494
• sgm_edit_solid_reverse, 495
• sgm_edit_surface_edge_match, 496
• sgm_edit_surface_sew, 500
• sgm_get_arc_center_radius, 503
• sgm_get_close_points, 504
• sgm_get_curve_length, 506
• sgm_get_solid_volume, 507
• sgm_get_surface_area, 508
• sgm_incongruent_geom_display, 509
• sgm_incongruent_geom_exist, 510
• sgm_incongruent_geom_seg_exit, 510
• sgm_nearest_point_on_curve, 512
• sgm_nearest_point_on_curve_aea, 513
• sgm_node_on_curve, 515
• sgm_node_on_point, 516
• sgm_node_on_surface, 518
• sgm_show_angle_between_curves, 519
• sgm_show_surface_normals, 521
• sgm_solid_evaluate, 522
• sgm_surface_evaluate, 524
• sgm_u_calc_mscale_mat, 525
• sgm_verify_solid_brep, 526
• transform_pts, 527
• xy_curve_num_points_get, 528

8
Finite Element ■ Introduction, 532
Model • db_count_elem_topology_codes, 532
• db_count_elem_w_topology, 532
• db_count_elems_for_geo, 533
• db_count_elems_using_node, 534
• db_count_mpcs_using_node, 535
Main Index
• db_count_nodes_for_geometry, 536
• db_count_nodes_in_mpc, 537
• db_count_unref_nodes, 538
• db_count_valid_dofs_f_mpc_type, 539
• db_count_valid_mpc_types, 539
• db_get_all_valid_dof_f_mpc_type, 540
• db_get_all_valid_mpc_type, 541
• db_get_dep_nodes_in_sub_mpc, 542
• db_get_dof_id, 544
• db_get_dof_name, 544
• db_get_elem_config_ntl, 545
• db_get_elem_dimens, 547
• db_get_elem_for_geo_type_and_id, 547
• db_get_elem_nodes, 548
• db_get_elem_shape_for_id, 549
• db_get_elem_top_name, 550
• db_get_elem_topology_codes, 551
• db_get_elem_topos_for_geom, 551
• db_get_elem_verification_parms, 552
• db_get_elems, 553
• db_get_elems_by_lbc, 554
• db_get_elems_using_nodes, 555
• db_get_etop_for_a_code, 556
• db_get_indep_nodes_in_sub_mpc, 557
• db_get_max_elem_id, 558
• db_get_max_node_id, 559
• db_get_mesh_params, 560
• db_get_min_elem_id, 561
• db_get_min_node_id, 561
• db_get_mpc_type_id, 562
• db_get_mpc_type_name, 563
• db_get_next_elem_id, 564
• db_get_next_mpc_id, 564
• db_get_next_node_id, 565
• db_get_next_valid_mpc_type, 566
• db_get_nodal_association, 567
• db_get_node, 568
• db_get_nodes_by_lbc, 568
• db_get_nodes_for_geometry, 569
• db_get_nodes_in_mpc, 570
• db_get_nxt_valid_dof_f_mpc_type, 571
• db_get_unreferenced_node_ids, 573
• db_get_valid_mpc_ids_in_group, 573
• db_update_elem_ids, 574
• db_update_elem_types, 576
• db_validate_mpc, 577
• db_verify_nodes_exist, 578
• fem_create_mesh_sol_3, 579
• fem_get_elem_assoc_groups, 580
• fem_get_elem_ids, 581
• fem_get_mpc_assoc_groups, 582
• fem_get_mpc_assoc_nodes, 583
• fem_get_mpc_ids, 584
• fem_get_node_assoc_groups, 585
Main Index
• fem_get_node_ids, 586
• fem_seed_display_dir_arrows, 587
• fem_u_get_free_edges, 588
• fem_u_get_free_faces, 590
• list_get_node_ass_el_edge, 592
• list_get_node_ass_el_face, 593
• list_get_node_ass_elem, 594
• list_get_node_ass_geo, 595
• list_get_node_ass_group, 597
• list_get_node_ass_mpc, 598
• list_get_node_att_fringe, 600
• list_get_node_att_value, 602
• move_mesh, 603
• move_mesh_1, 605

9
Load Cases ■ Introduction, 608
• db_activate_load_case, 608
• db_delete_load_case, 609
• db_find_load_case_id, 610
• db_get_lc_id_given_job_seq, 611

10
Element ■ Introduction, 616
Properties • bl_create_std_beam_section, 616
• bl_get_std_beam_section_data, 617
• bl_modify_std_beam_section, 619
• blcomputeprincaxespoints, 621
• blgetalpha, 622
• blgetbuttonicon, 623
• blgetcenters, 624
• blgetdimfieldid, 625
• blgetdimvalue, 626
• blgetlabelicon, 628
• blgetlabels, 629
• blgetnumdimension, 629
• blgetnumplotpoints, 630
• blgetnumplotpointsbyid, 631
• blgetnumtypeinfo, 633
• blgetperim, 633
• blgetplotpoints, 634
• blgetplotpointsbyid, 636
• blgetplotpointsbyid2, 638
• blgetprop, 641
• blgetproplabels, 642
• blgettypeinfo, 643
• blmodifybeamdimension, 644
• db_associate_geo_to_region, 645
• db_bulk_get_possible_dof_sets1, 647
• db_bulk_get_possible_dof_sets2, 648

Main Index
• db_bulk_get_possible_form_opts1, 649
• db_bulk_get_possible_form_opts2, 650
• db_bulk_get_possible_geo_opts1, 651
• db_bulk_get_possible_lam_opts1, 652
• db_bulk_get_possible_lam_opts2, 653
• db_bulk_get_possible_matl_dirs, 654
• db_bulk_get_possible_matl_lins, 656
• db_bulk_get_selected_etops_mat, 657
• db_count_elem_type, 659
• db_count_elements_in_region_exp, 660
• db_count_etop_for_a_code, 661
• db_count_geo_in_region, 662
• db_create_analysis_elements, 663
• db_create_anl_elm_summary, 665
• db_create_phys_prop_set_defn, 666
• db_create_selected_etype, 667
• db_delete_analysis_elements, 669
• db_delete_anl_elm_summary, 671
• db_delete_phys_prop_region, 672
• db_get_a_phys_prop_w_nord, 673
• db_get_all_dof_set_names, 675
• db_get_all_elem_defn, 675
• db_get_all_form_opt_code_names, 677
• db_get_all_geo_opt_code_names, 677
• db_get_all_lam_opt_code_names, 678
• db_get_all_pp_ids_and_names, 679
• db_get_allowable_phys_prop, 680
• db_get_analysis_elements, 681
• db_get_anl_elm_summary, 682
• db_get_elements_in_region_exp, 684
• db_get_etop_for_a_code, 685
• db_get_geo_in_region, 686
• db_get_next_dof_set_names, 688
• db_get_next_elem_defn, 689
• db_get_next_form_opt_code_names, 690
• db_get_next_geo_opt_code_names, 690
• db_get_next_lam_opt_code_names, 691
• db_get_next_pp_ids_and_names, 692
• db_get_phys_prop_set_defn, 693
• db_get_region_for_geometry, 694
• db_get_region_ids_and_names, 695
• db_get_selected_prop_set, 696
• db_set_comp_lam, 697

11
Loads and ■ Introduction, 702
Boundary • db_bulk_get_lbc_ds, 702
Conditions • db_bulk_get_lbc_dv, 704
• db_bulk_get_lbc_ss, 706
• db_bulk_get_lbc_sv, 707
• db_count_appl_geo_region, 709
• db_count_lbc, 710
Main Index
• db_count_lbc_appl_region_entity, 711
• db_count_lbc_types, 712
• db_count_load_cases_with_lbc, 712
• db_count_loads_for_element, 714
• db_delete_lbc, 715
• db_delete_lbc_defn, 716
• db_get_all_appl_geo_regions, 717
• db_get_all_appl_reg_defns, 718
• db_get_all_lbc_names, 719
• db_get_all_lbc_names_by_type, 720
• db_get_all_lbc_type_defns, 721
• db_get_all_lbc_type_names, 723
• db_get_all_lbc_var_defns, 723
• db_get_all_lbcs_new, 724
• db_get_lbc_id, 726
• db_get_lbc_name, 727
• db_get_lbc_type_defn, 728
• db_get_lbc_var_defn, 730
• db_get_load_cases_with_lbc, 731
• db_get_loads_for_element, 733
• db_get_next_appl_geo_region, 734
• db_get_next_appl_reg_defn, 735
• db_get_next_lbc_name, 736
• db_get_next_lbc_name_by_type, 737
• db_get_next_lbc_type_defn, 738
• db_get_next_lbc_type_name, 740
• db_get_next_lbc_var_defn, 741
• db_get_next_lbcs_new, 742
• db_get_valid_cat_by_type, 743
• db_get_valid_eldim_by_type_cat, 744
• db_get_valid_lbc_var_ids, 746
• db_modify_load_case, 747
• lbc_create, 749
• lbc_delete, 752
• lbc_eval_fem_by_lc, 754
• lbc_eval_fem_lbc, 754
• lbc_get_sdbx_datatype, 755
• lbc_gm, 756
• lbc_graphics_defn, 757
• lbc_lp_parse_sca, 758
• lbc_lp_parse_vec, 759
• lbc_plot_markers, 760
• lbc_show_plot_scalar, 762
• loadcase_create2, 763
• loadsbcs_get_appl_region_list, 765
• loadsbcs_lp_coord, 766

12
Materials ■ Introduction, 768
• db_bulk_get_possible_cond_opts1, 768
• db_bulk_get_possible_cond_opts2, 769
• db_bulk_get_possible_dof_sets, 770
Main Index
• db_count_materials, 771
• db_count_options, 773
• db_create_mtl_allowable_magics, 774
• db_delete_material, 775
• db_delete_material_property, 776
• db_delete_matl_const_model, 778
• db_get_all_allow_matl_prop_cnt, 779
• db_get_all_allowable_matl_prop, 780
• db_get_all_cond_opt_code_names, 782
• db_get_all_lam_opt_code_names, 782
• db_get_all_material_names, 783
• db_get_allowable_matl_prop, 785
• db_get_allowable_matl_prop_cnt, 786
• db_get_comp_hal, 787
• db_get_comp_sfc, 789
• db_get_constitutive_model, 792
• db_get_material_id_from_name, 793
• db_get_material_name_from_id, 794
• db_get_matl_category, 795
• db_get_matl_prop_alias, 797
• db_get_matl_prop_defn, 798
• db_get_mtl_allowable_magic_cnt, 800
• db_get_mtl_allowable_magics, 801
• db_get_mtl_magics, 802
• db_get_mtl_magics_count, 804
• db_get_mtl_magics_defn, 805
• db_get_mtl_magics_options, 806
• db_get_next_cond_opt_code_names, 808
• db_get_next_lam_opt_code_names, 808
• db_get_next_material_name, 809
• db_get_valid_const_models, 811
• db_get_valid_const_models_count, 812
• db_get_valid_mtl_categories, 813
• db_get_valid_mtl_category_cnt, 814
• db_mo_const_models_specified, 815
• db_modify_material, 817
• db_modify_matl_prop_value, 819
• engin_cons_to_elastic_matrix, 820
• get_qab_from_engin_cons, 821
• mat_2d_ani_to_2d_ort, 822
• mat_3d_ani_to_3d_ort, 823
• mat_hal_load_defn_show, 824
• mat_lam_load_defn_show, 826
• mat_load_show, 828
• mat_mix_load_defn_show, 830
• mat_sfc_load_defn_show, 832
• material.namedelete, 834
• n21_cons_to_sym_6x6_matrix, 836
• p3cm.close_2, 837
• p3cm.create_book_layup2, 838
• P3cm.create_laminates_layup_2, 841
• p3cm.create_layup_add_2, 844
• p3cm.create_material_add, 846
• p3cm.create_ply_add_2, 848
Main Index
• p3cm.create_results_failure, 850
• p3cm.create_results_mid_sort, 852
• p3cm.create_results_sort, 853
• p3cm.delete_laminates, 855
• p3cm.delete_material_name, 856
• p3cm.delete_ply_name, 858
• p3cm.delete_propsets, 859
• p3cm.import_model_file_2, 861
• p3cm.import_plies_file_2, 862
• p3cm.modify_material, 864
• p3cm.modify_ply, 865
• p3cm.new, 868
• p3cm.set_offsets, 869
• p3cm.open, 870
• p3cm.save_as_2, 871
• p3cm.set_export_options_2, 873
• p3cm.set_graphics_options_2, 874
• p3cm.set_tolerance, 876
• p3cm.show_laminate, 877
• p3cm.show_layup_exploded, 880
• p3cm.show_ply, 881

13
Analysis ■ Introduction, 884
• analysis_get.pset_for_job, 884
• analysis_import, 885
• analysis_main.job_name_lbox, 889
• analysis_main.user_function, 890
• analysis_submit, 892
• analysis_submit_2, 896
• db_assign_last_jobname, 900
• db_count_all_job_name_ids, 901
• db_count_anal_codes, 902
• db_count_anal_types, 902
• db_count_analysis_steps, 903
• db_count_job_name_list_entry, 904
• db_count_job_names_for_a_code, 905
• db_count_param_set_entries, 906
• db_count_steps_for_a_job, 907
• db_create_analysis_step, 908
• db_create_job_name, 910
• db_create_job_name_for_a_code, 911
• db_create_job_name_list, 912
• db_create_job_name_list_entry, 913
• db_create_param_set_entry, 915
• db_create_pset_matrix_entry, 917
• db_delete_analysis_step_id, 919
• db_delete_job_name, 921
• db_delete_job_name_list, 922
• db_delete_param_set_entries, 924
• db_delete_param_set_entry, 926
• db_get_all_anal_codes, 928
Main Index
• db_get_all_anal_types, 929
• db_get_all_job_name_ids, 930
• db_get_all_job_names, 931
• db_get_anal_code_id, 931
• db_get_anal_code_name, 932
• db_get_anal_type_id, 933
• db_get_anal_type_name, 934
• db_get_analysis_steps, 935
• db_get_at_for_ac, 936
• db_get_default_anal_code, 936
• db_get_default_anal_type, 937
• db_get_id_given_job_name, 937
• db_get_id_given_job_name_code, 939
• db_get_id_given_load_case_name, 940
• db_get_id_given_step_name, 941
• db_get_job_info, 943
• db_get_job_name_given_id, 944
• db_get_jobname_list_entries, 945
• db_get_jobnames_for_a_code, 947
• db_get_last_jobname, 948
• db_get_next_anal_code, 949
• db_get_next_anal_type, 950
• db_get_next_job_name, 951
• db_get_param_set_ent_pcl, 952
• db_get_param_set_entries, 953
• db_get_param_set_entry, 955
• db_get_pset_matrix_entry, 957
• db_get_pset_matrix_size, 959
• db_get_step_info, 960
• db_get_steps_for_a_job, 962
• db_set_at_for_ac, 963
• db_set_default_anal_code, 964
• db_set_default_anal_type, 965
• db_set_model_file_suffix, 966
• db_set_pref, 967
• db_set_results_file_suffix, 968
• db_update_analysis_step, 969
• db_update_jobname_for_a_code, 971
• jobfile.close, 973
• jobfile.create_matrix, 974
• jobfile.open, 976
• jobfile.set_job_status, 977
• jobfile.writec, 978
• jobfile.writei, 979
• jobfile.writer, 980
• jobfile.write_spl, 981
• msc_delete_old_files, 982
• mscnastran_anlyze_sub_create.available_callback, 983
• mscnastran_analyze_tp.get_version_number, 984
• mscnastran_job.associate_subcases, 985
• mscnastran_subcase.create, 987
• mscnastran_subcase.create_char_param, 988
• mscnastran_update.job, 989
• uil_app_analysis.change_current_branch, 990
Main Index
14
Fields ■ Introduction, 994
• db_delete_field, 994
• db_delete_field_res, 995
• db_get_all_field_names, 996
• db_get_field_attrs, 997
• db_get_field_dfem, 998
• db_get_field_id, 1000
• db_get_field_lbc, 1000
• db_get_field_lbc_type, 1002
• db_get_max_field_id, 1003
• db_get_next_field_name, 1004
• db_modify_field, 1006
• field_create_field_lbc, 1009
• fields_create_general_term, 1011
• field_fem_const_eval, 1012
• fld_cre_fem_res_sca, 1014
• fld_cre_fem_res_vec, 1015
• fld_evl_get_maxnod_for_group, 1016
• get_field_values, 1017
• get_field_values_no_trans, 1018

15
Results ■ Introduction, 1022
• db_count_result_types_for_elem, 1022
• db_get_elem_scalar_name, 1023
• db_get_results_file_suffix, 1025
• jobfile.create_jobname, 1026
• jobfile.create_param, 1026
• jobfile.eval_list, 1028
• jobfile.write_array_as_list, 1029
• jobfile.write_element_list, 1030
• jobfile.write_integer_list, 1031
• jobfile.write_node_list, 1033
• jobfile.write_real_list, 1034
• jobfile.write_stream, 1035
• jobfile.write_string, 1036
• jobfile.writer, 1037
• jobfile.writeS1, 1038
• jobfile.writeS2, 1039
• jobfile.writeS3, 1040
• jobfile.writeS4, 1041
• jobfile.writeSS, 1042
• rdm_result_minmax_get, 1043
• res_db_cgetlayerposids, 1045
• res_db_cgetrescases, 1046
• res_utl_create_elem_result, 1048
• res_utl_extract_elem_history2, 1051
• res_utl_extract_elem_results2, 1054
• res_utl_extract_nodal_history2, 1056
• res_utl_extract_nodal_results2, 1059
Main Index
• res_utl_transform_nodal_results, 1062
• vki_db_getresid, 1064
• xy_curve_results_set_wnd, 1066

16
Preferences ■ Introduction, 1070
• db_add_pref, 1070
• db_get_pref, 1071
• pref_anal_get, 1073
• pref_anal_set, 1074
• pref_confirm_get, 1075
• pref_display_method_get, 1076
• pref_entity_dp_get, 1077
• pref_entity_dp_set, 1078
• pref_entity_set, 1079
• pref_env_get_integer, 1081
• pref_env_get_logical, 1082
• pref_env_get_real, 1083
• pref_env_get_string, 1084
• pref_fa_get, 1084
• pref_fa_set, 1086
• pref_geo_cid_int_string, 1087
• pref_geo_cid_string_int, 1088
• pref_geo_get, 1089
• pref_get_anal_attributes, 1090
• pref_get_anal_code_count, 1090
• pref_get_anal_type_count, 1091
• pref_get_next_anal_code, 1092
• pref_get_next_anal_type, 1093
• pref_global_get, 1094
• pref_graphics_get, 1094
• pref_graphics_marker_data_get, 1096

17
Utilities ■ Introduction, 1100
• array_copy_real, 1100
• array_del_zero_int, 1101
• array_fill_int, 1101
• array_fill_zero_int, 1102
• array_fill_zero_real, 1103
• array_real_fill_null, 1104
• array_sort_and_del_dupl_int, 1104
• ga_entities_string_format, 1105
• ga_entity_get_by_type, 1106
• math_get_no_data_null, 1108
• math_is_no_data_null, 1108
• math_mat_add, 1109
• math_mat_invert, 1110
• math_mat_mult, 1111
• math_mat_transp_in_place, 1112

Main Index
• math_vec_len, 1112
• math_vec_norm, 1113
• mth_vec_add, 1114
• mth_vec_cross_prod, 1115
• mth_vec_dot_prod, 1115
• mth_vec_length, 1116
• mth_vec_scale, 1117
• rpc_add_server, 1118
• rpc_call, 1119
• rpc_clear_output, 1121
• rpc_get_bool_array, 1123
• rpc_get_boolean, 1125
• rpc_get_command, 1127
• rpc_get_int_array, 1128
• rpc_get_integer, 1130
• rpc_get_real, 1132
• rpc_get_real_array, 1134
• rpc_get_status, 1135
• rpc_get_string, 1137
• rpc_init_client, 1139
• rpc_inquire_count, 1140
• rpc_inquire_item, 1142
• rpc_put_bool_array, 1144
• rpc_put_boolean, 1146
• rpc_put_command, 1148
• rpc_put_int_array, 1150
• rpc_put_integer, 1151
• rpc_put_real, 1153
• rpc_put_real_array, 1155
• rpc_put_status, 1157
• rpc_put_string, 1158
• rpc_timeout, 1160
• string_newline_count, 1161
• string_newline_position, 1162
• timer_off, 1163
• timer_on, 1164
• uil_list_union_expr, 1164
• util_equal_real, 1165
• util_real_equal_null, 1167
• util_rounder, 1167

18
Support Files ■ Introduction, 1170

Main Index
Main Index
MSC.Acumen, Volume 2: Code Examples

CHAPTER
Introduction
1
■ Introduction

Main Index
2
Code Examples

1.1 Introduction
This chapter provides code examples for the PCL function described in Volume 1. These
examples are designed so that they can be cut and pasted into a file and, by following the
instructions listed with each example, executed in MSC.Patran.

db_get_p3_version ()

# Purpose : This file gives an example of a call to the


# function db_get_p3_version()
#
# This function queries the database for its
# version number.
#
# To run this session file,first start
# a session of MSC.Patran,open a database or
# start a new database,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function has the following arguments:
# db_get_p3_version
# ( p3_ver )
#
# -------------------------------------------------------------------
# Variable Declaration
#
STRING s_p3_ver[100]
INTEGER i_return_value

# -------------------------------------------------------------------

i_return_value= @
db_get_p3_version @
( s_p3_ver)

dump s_p3_ver
dump i_return_value

# -------------------------------------------------------------------

is_batch ()

# Purpose : This file provides an example of a call to the


# function is_batch()
#
# This function checks to see whether MSC.Patran
# is running in batch mode or not.
#
# MSC.Patran runs, by default, in graphics mode.
# In graphics mode, it displays user interface
# and graphics on the screen. When it is in batch
# mode no graphics appear on the screen.
#
# To run this session file start a session of
# MSC.Patran,then click on “File”,”Session”
# “Play” pulldown menus on the menu bar.
#
# This function does not have arguments. But it has a LOGICAL return
# type which informs whether MSC.Patran is in batch mode or not.
#
Main Index
CHAPTER 1 3
Introduction

# -------------------------------------------------------------------
# Variable Declaration
#
LOGICAL l_status

# -------------------------------------------------------------------

l_status=is_batch()

dump l_status
# -------------------------------------------------------------------

user_db_close ()

# Purpose : This file gives an example of a call to the


# functions user_db_close()
#
# This function is called by MSC.Patran itself
# just before an existing database is closed.
# Hence explicit call to the function has not
# been made in this session file.
# Instead, following instructions have been given
# so that the effect of the call to this function
# can be seen on a session file (history window).
#
# Instructions : Keep the file usr_fns.pcl in the system path
# preferably in working directory.
# Append to your p3prolog.pcl file an instruction
# !!INPUT usr_fns.pcl
# (or) Write a new file p3prolog.pcl in your
# working directory with the above instruction in
# it.
#
# Now start a new session of MSC.Patran.
# Start recording a new session file by selecting
# “File”,”Session”,”record” pulldown menus and
# enter the name “new.ses.01” in the “Recording
# file” databox in the “Record Session File” form
#
# Open an existing database (OR) start a new
# database.Then close the database by “File”
# “Close”.Function user_db_close() will be called
# by MSC.Patran with isquit=FALSE(Refer the function
# description).
# The instructions written in user_db_close() in
# usr_fns.pcl will be written to the history
# window.Again open any database and exit the
# MSC.Patran while the database is open. Here MSC.Patran
# calls user_db_close()function with isquit=TRUE.
# Read the session file “new.ses.01” to find the
# instructions written in it before closing the
# database in the process of exiting MSC.Patran.
# -------------------------------------------------------------------

user_db_new ()

# Purpose : This file gives an example of a call to the


# functions user_db_new()
#
# This function is called by MSC.Patran itself
# just after a new database is created. Hence
# explicit call to the function has not been
# made in this session file.
Main Index
4
Code Examples

# Instead, certain instructions have been given


# so that the effect of the call to this function
# can be seen on the session file.
#
# Instructions : Keep the file usr_fns.pcl in the system path
# preferably in working directory.
# Append to your p3prolog.pcl file an instruction
# !!INPUT usr_fns.pcl
# (or) write a new file p3prolog.pcl in your
# working directory with the above instruction
# in it.
#
# Now start a new session of MSC.Patran.
# Start recording a new session file by selecting
# “File”,”Session”,”record” pulldown menus
# Enter the name “new.ses.01” in the “Recording
# file” databox in the “Record Session File” form
#
# Open a new database.Function user_db_new() will
# be called by MSC.Patran. The instructions written in
# user_db_new() in usr_fns.pcl will be written
# to the history window.
# -------------------------------------------------------------------

user_db_open ()

# Purpose : This file gives an example of a call to the


# functions user_db_open()
#
# This function is called by MSC.Patran itself
# just after an existing database is opened.
# Hence explicit call to the function has not
# been made in this session file.
# Instead, certain instructions have been given
# so that the effect of the call to this function
# can be seen on a session file.
#
# Instructions : Keep the file usr_fns.pcl in the system path
# preferably in working directory.
# Append to your p3prolog.pcl file an instruction
# !!INPUT usr_fns.pcl (or) Write a new file
# p3prolog.pcl in your working directory with the
# above instruction in it.
#
# Now start a new session of MSC.Patran.
# Start recording a new session file by selecting
# “File”,”Session”,”record” pulldown menus.
# Enter the name “new.ses.01” in the “Recording
# file” databox in the “Record Session File” form
#
# Open an existing database. Function
# user_db_open() will be called by MSC.Patran. The
# instructions written in user_db_open() in
# usr_fns.pcl will be written to the history
# window.
# -------------------------------------------------------------------

Main Index
CHAPTER 1 5
Introduction

user_quit ()

# Purpose : This file gives an example of a call to the


# functions user_quit()
#
# This function is called by MSC.Patran itself
# just before exit.Hence explicit call to the
# function has not made in this session file.
# Instead, certain instructions have been given
# so that the effect of the call to this function
# can be seen on the session file.
#
# Instructions : Keep the file usr_fns.pcl in the system path
# preferably in working directory.
# Append your p3prolog.pcl file by a instruction
# !!INPUT usr_fns.pcl (or) Write a new file
# p3prolog.pcl in your working directory with the
# above said instruction in it.
#
# Now start a new session of MSC.Patran.
# Start recording a new session file by selecting
# “File”,”Session”,”record” pulldown menus and
# Enter the name “new.ses.01” in the “Recording
# file” databox in the “Record Session File” form
#
# Quit MSC.Patran, Open the session file “new.ses.01”
# The instructions written in user_quit() in
# usr_fns.pcl will be written on that session
# file in the process of quitting MSC.Patran.
# -------------------------------------------------------------------

user_start ()

# Purpose : This file gives an example of a call to the


# functions user_start()
#
# This function is called by MSC.Patran itself
# just after startup.Hence explicit call to the
# function has not made in this session file.
# Instead, certain instructions have been given
# so that the effect of the call to this function
# can be seen on standard output.
#
# Normally Function user_start() is called before
# default session file starts recording.Hence
# commands are not recorded in the session file.
#
# Instructions : Keep the file usr_fns.pcl in the system path
# preferably in working directory.
# Append to your p3prolog.pcl file an instruction
# !!INPUT usr_fns.pcl
# (or) write a new p3prolog.pcl in your working
# directory with the above instruction in it.
#
# Now start a new session of MSC.Patran.
# The instructions written in user_start() in
# usr_fns.pcl will be written on standard
# output.
# -------------------------------------------------------------------

Main Index
6
Code Examples

utl_get_terse_version ()

# Purpose : This file gives an example of a call to the


# function utl_get_terse_version()
#
# This function queries the database for its
# terse version number.
#
# To run this session file,first start
# a session of MSC.Patran,open a database or
# start a new database,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function has the following arguments:
# utl_get_terse_version
# ( terse_version )
#
# -------------------------------------------------------------------
# Variable Declaration
#
STRING s_terse_version[100]

# -------------------------------------------------------------------

utl_get_terse_version @
( s_terse_version)

dump s_terse_version

# -------------------------------------------------------------------

utl_query_version_level ()

# Purpose : This file gives an example of a call to the


# function utl_query_version_level()
#
# This function queries the database for its
# version level code.
# Version level code is the number which informs
# whether the version is Alpha release or Beta
# release or Production release etc.
#
# To run this session file,first start
# a session of MSC.Patran,open a database or
# start a new database,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_return_value

# -------------------------------------------------------------------

i_return_value = @
utl_query_version_level()

dump i_return_value

# -------------------------------------------------------------------

Main Index
MSC.Acumen, Volume 2: Code Exampleskl

CHAPTER
Model
2
■ Introduction

Main Index
610
Code Examples

2.1 Introduction
This chapter provides code examples for the PCL function described in Volume 1. These
examples are designed so that they can be cut and pasted into a file and, by following the
instructions listed with each example, executed in MSC.Patran.

db_count_client_labels_by_type ()

# Purpose : This file gives an example of a call to the


# function db_count_client_labels_by_type()
#
# A table is provided in the database which
# is reserved for the use by user.
# The db_create_client_data() function writes the
# information to this table.The function
# db_count_client_labels_by_type() returns
# the number of all labels with a specified type.
#
# To run this session file,first start
# a session of MSC.Patran, start a new
# database,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The db_count_client_labels_by_type has the following arguments:
# db_count_client_labels_by_type
# ( client_type,
# nbr_of_labels )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_client_type,i_nbr_of_labels
INTEGER i_id, i_client_type, @
i_num_logicals, i_num_integers, i_num_reals, @
i_num_strings, i_max_string_length
LOGICAL l_logical_data(1)= [TRUE]
INTEGER i_integer_data(1)=[1]
REAL r_real_data(1)=[202.54]
STRING s_string_data[25](1)=[“Geometric”]
INTEGER i_return_value
# -------------------------------------------------------------------
# Create a client defined entity in the database.
#
# i_client_label=101
# i_client_type=1001
# i_num_logicals=1
# i_num_integers=1
# i_num_reals=1
# i_num_strings=1
# i_max_string_length=25
#
i_client_label = 101
i_client_type = 1001
i_num_logicals = 1
i_num_integers = 1
i_num_reals = 1
i_num_strings = 1
i_max_string_length = 25

i_return_value = @
db_create_client_data @
Main Index ( i_id, @
CHAPTER 2 611
Model

i_client_label, @
i_client_type, @
i_num_logicals, @
i_num_integers, @
i_num_reals, @
i_num_strings, @
i_max_string_length, @
l_logical_data, @
i_integer_data, @
r_real_data, @
s_string_data )

# check for creation of the client data


dump i_return_value

# Data type of the client.


# i_client_type=1001

i_return_value = @
db_count_client_labels_by_type @
( i_client_type, @
i_nbr_of_labels )

dump i_nbr_of_labels
dump i_return_value

# create another client data with same client_type but different


# client label and check for the no of labels.

# i_client_label = 102
i_client_label = 102

i_return_value = @
db_create_client_data @
( i_id, @
i_client_label, @
i_client_type, @
i_num_logicals, @
i_num_integers, @
i_num_reals, @
i_num_strings, @
i_max_string_length, @
l_logical_data, @
i_integer_data, @
r_real_data, @
s_string_data )

# check for creation of the client data


dump i_return_value

# check for the no of created labels.In this example


# two labels are created.

i_return_value = @
db_count_client_labels_by_type @
( i_client_type, @
i_nbr_of_labels )

# check for the no of labels created


dump i_nbr_of_labels
dump i_return_value
# -------------------------------------------------------------------

Main Index
612
Code Examples

db_count_general_field ()

# Purpose : This file provides an example of a call to the


# function db_count_general_field()
#
# This function returns the count of terms in a
# field. It returns a positive integer
# indicating the status of the execution of 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_count_general_field()
# has the following arguments:
#
# db_count_general_field
# ( field_id,
# count )
#
#---------------------------------------------------------------------
# Variable Declarations

INTEGER fem_create_mesh_surfa_num_nodes
INTEGER fem_create_mesh_surfa_num_elems
STRING asm_create_patch_xy_created_ids[VIRTUAL]
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]

integer int_status=5, int_field_id, int_count


STRING str_field[10] = "field_1"

#----------------------------------------------------------------------
# Open a new database
if(!db_is_open())THEN
uil_file_new.go("","new.db")
$? YES 36000002
endif
#----------------------------------------------------------------------
# Setting the preference to MSC.Nastran.

uil_pref_analysis.set_analysis_pref( "MSC.Nastran", @
"Structural", @
"", @
".op2" )
#---------------------------------------------------------------------
# Create Geometric entities

int_status = asm_const_patch_xyz @
( "1", "<2 5 0>", "[0 0 0]", "Coord 0", @
asm_create_patch_xy_created_ids )

dump int_status
#---------------------------------------------------------------------
# Create Finite Element entities
# 219 Nodes IDS = 1:219
# 60 Elements IDS = 1:60

ui_exec_function( "mesh_seed_display_mgr", "init" )


mesh_seed_create( "Surface 1.2 1.4 ", 1, 4, 0., 0., 0. )
Main Index
CHAPTER 2 613
Model

mesh_seed_create( "Surface 1.1 1.3 ", 1, 15, 0., 0., 0. )

int_status = fem_create_mesh_surf_3 @
( "IsoMesh", 0, "Surface 1 ", 1, @
["0.1"], "Quad8", "1", @
"1", "Coord 0", "Coord 0", @
fem_create_mesh_surfa_num_nodes, @
fem_create_mesh_surfa_num_elems, @
fem_create_mesh_s_nodes_created, @
fem_create_mesh_s_elems_created )
dump int_status
mesh_seed_display_mgr.erase( )

#---------------------------------------------------------------------
# Create a Field - 'field_1'

int_status = fields_create_general @
( "field_1", @
0, 5, 2, "Real", "Coord 0", @
"", 3, 1, 2, 15 )

dump int_status

int_status = fields_create_general_term @
( "field_1", @
0, 0, 0, 30, @
" [ ( 'X + 'Y ) * 'RAD ]" )

dump int_status
#---------------------------------------------------------------------
# Getting the field_id for the field - 'field_1'

int_status = db_get_field_id(str_field,int_field_id)

dump int_status, str_field, int_field_id

#---------------------------------------------------------------------
# Using the function db_count_general_field() to get
# the number of terms_ids or count in the field

int_status = db_count_general_field @
(int_field_id, int_count)

dump int_status, int_field_id, int_count

#---------------------------------------------------------------------
# Closing the file - new.db

uil_file_close.goquit()

#---------------------------------------------------------------------

db_create_client_data ()

# Purpose : This file gives an example of a call to the


# function db_create_client_data()
#
# This function creates a client defined entity
# in the database. A table is provided in the
# database which is reserved for the use by user.
# The db_create_client_data() function writes the
# information to this table.
Main Index
614
Code Examples

#
# To run this session file,first start
# a session of MSC.Patran,open a database or
# start a new database,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The db_create_client_data has the following arguments:
# db_create_client_data
# ( id,
# client_label,
# client_type,
# num_logicals,
# num_integers,
# num_reals,
# num_strings,
# max_string_length,
# p_logical_data,
# p_integer_data,
# p_real_data,
# p_string_data )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_id, i_client_label, i_client_type, @
i_num_logicals, i_num_integers, i_num_reals, @
i_num_strings, i_max_string_length
LOGICAL l_logical_data(1)= [TRUE]
INTEGER i_integer_data(1)=[1]
REAL r_real_data(1)=[202.54]
STRING s_string_data[25](1)=[“Geometric”]
INTEGER i_return_value

# -------------------------------------------------------------------
# Create a client defined entity in the database.
#
# i_client_label=101
# i_client_type=1001
# i_num_logicals=1
# i_num_integers=1
# i_num_reals=1
# i_num_strings=1
# i_max_string_length=25
#

i_client_label = 101
i_client_type = 1001
i_num_logicals = 1
i_num_integers = 1
i_num_reals = 1
i_num_strings = 1
i_max_string_length = 25

i_return_value = @
db_create_client_data @
( i_id, @
i_client_label, @
i_client_type, @
i_num_logicals, @
i_num_integers, @
i_num_reals, @
i_num_strings, @
i_max_string_length, @
l_logical_data, @
i_integer_data, @
Main Index
CHAPTER 2 615
Model

r_real_data, @
s_string_data )

dump i_return_value
# -------------------------------------------------------------------

db_delete_client_data ()

# Purpose : This file gives an example of a call to the


# function db_delete_client_data()
#
# This function deletes a client defined entity
# in the database. A table is provided in the
# database which is reserved for the use by user.
# The db_create_client_data() function writes the
# information to this table.The function
# db_delete_client_data deletes the client data
# from the database.
#
# To run this session file,first start
# a session of MSC.Patran, start a new
# database,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The db_delete_client_data has the following arguments:
# db_delete_client_data
# ( label )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_id, i_client_label, i_client_type, @
i_num_logicals, i_num_integers, i_num_reals, @
i_num_strings, i_max_string_length
LOGICAL l_logical_data(1)= [TRUE]
INTEGER i_integer_data(1)=[1]
REAL r_real_data(1)=[202.54]
STRING s_string_data[25](1)=[“Geometric”]
INTEGER i_return_value

# -------------------------------------------------------------------
# Create a client defined entity in the database.
#
# i_client_label=101
# i_client_type=1001
# i_num_logicals=1
# i_num_integers=1
# i_num_reals=1
# i_num_strings=1
# i_max_string_length=25
#

i_client_label = 101
i_client_type = 1001
i_num_logicals = 1
i_num_integers = 1
i_num_reals = 1
i_num_strings = 1
i_max_string_length = 25

i_return_value = @
db_create_client_data @
( i_id, @
Main Index
616
Code Examples

i_client_label, @
i_client_type, @
i_num_logicals, @
i_num_integers, @
i_num_reals, @
i_num_strings, @
i_max_string_length, @
l_logical_data, @
i_integer_data, @
r_real_data, @
s_string_data )
#

dump i_return_value

i_return_value = @
db_delete_client_data @
( i_client_label )

# check the deletion of the client data.


dump i_return_value
# we will try to get the client id using the client label.
i_return_value = @
db_get_client_id_by_label @
( i_client_label, @
i_id )
dump i_return_value
# -------------------------------------------------------------------

db_get_all_client_data ()

# Purpose : This file gives an example of a call to the


# function db_get_all_client_data()
#
# This function gets all related data
# from the a client defined entity
# in the database. A table is provided in the
# database which is reserved for the use by user.
# The db_create_client_data() function writes the
# information to this table.The function db_get
# all_client_data() gets this written data.
#
# To run this session file,first start
# a session of MSC.Patran, start a new
# database,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The db_get_all_client_data has the following arguments:
# db_get_all_client_data
# ( id,
# num_logicals,
# num_integers,
# num_reals,
# num_strings,
# max_string_length,
# p_logical_data,
# p_integer_data,
# p_real_data,
# p_string_data )
#
# -------------------------------------------------------------------
# Variable Declaration
# variables used for creating the client defined entity.
#
Main Index
CHAPTER 2 617
Model

INTEGER i_id, i_num_logicals, i_num_integers, i_num_reals, @


i_num_strings, i_max_string_length
INTEGER i_client_label, i_client_type
LOGICAL l_logical_data(1)= [TRUE]
INTEGER i_integer_data(1)=[1]
REAL r_real_data(1)=[202.54]
STRING s_string_data[25](1)=[“Geometric”]

# variables used for checking the function.

LOGICAL l_c_logical_data(1)
INTEGER i_c_integer_data(1)
REAL r_c_real_data(1)
STRING s_c_string_data[25](1)

INTEGER i_return_value

# -------------------------------------------------------------------
# Create a client defined entity in the database.
#
# i_client_label=101
# i_client_type=1001
# i_num_logicals=1
# i_num_integers=1
# i_num_reals=1
# i_num_strings=1
# i_max_string_length=25
#

i_client_label = 101
i_client_type = 1001
i_num_logicals = 1
i_num_integers = 1
i_num_reals = 1
i_num_strings = 1
i_max_string_length = 25

i_return_value = @
db_create_client_data @
( i_id, @
i_client_label, @
i_client_type, @
i_num_logicals, @
i_num_integers, @
i_num_reals, @
i_num_strings, @
i_max_string_length, @
l_logical_data, @
i_integer_data, @
r_real_data, @
s_string_data )
#

dump i_return_value

i_return_value = @
db_get_all_client_data @
( i_id, @
i_num_logicals, @
i_num_integers, @
i_num_reals, @
i_num_strings, @
i_max_string_length, @
l_c_logical_data, @
i_c_integer_data, @
Main Index
618
Code Examples

r_c_real_data, @
s_c_string_data )

# check for the data got from the function

dump l_c_logical_data
dump i_c_integer_data
dump r_c_real_data
dump s_c_string_data

dump i_return_value
# -------------------------------------------------------------------

db_get_client_data ()

# Purpose : This file gives an example of a call to the


# function db_get_client_data()
#
# This function gets client data entity
# from the client defined entity
# in the database. A table is provided in the
# database which is reserved for the use by user.
# The db_create_client_data() function writes the
# information to this table.The function db_get
# _client_data() gets the client data entity
# given the client label.For this first a client
# data entity is created and then it is read
# using the function db_get_client_data().
#
# To run this session file,first start
# a session of MSC.Patran,open a database or
# start a new database,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The db_get_all_client_data has the following arguments:
# db_get_client_data
# ( client_label,
# id,
# client_type,
# num_logicals,
# num_integers,
# num_reals,
# num_strings,
# max_string_length )
#
# -------------------------------------------------------------------
# Variable Declaration
#
# variable declaration for data creation.
INTEGER i_id, i_num_logicals, i_num_integers, i_num_reals, @
i_num_strings, i_max_string_length
INTEGER i_client_label, i_client_type
LOGICAL l_logical_data(1)= [TRUE]
INTEGER i_integer_data(1)=[1]
REAL r_real_data(1)=[202.54]
STRING s_string_data[25](1)=[“Geometric”]

# variable declaration for data checking.


INTEGER i_c_num_logicals, i_c_num_integers, i_c_num_reals, @
i_c_num_strings, i_c_max_string_length,i_c_client_type

INTEGER i_return_value
# -------------------------------------------------------------------
# Create a client defined entity in the database.
Main Index
CHAPTER 2 619
Model

#
# i_client_label=101
# i_client_type=1001
# i_num_logicals=1
# i_num_integers=1
# i_num_reals=1
# i_num_strings=1
# i_max_string_length=25
#

i_client_label = 101
i_client_type = 1001
i_num_logicals = 1
i_num_integers = 1
i_num_reals = 1
i_num_strings = 1
i_max_string_length = 25

i_return_value = @
db_create_client_data @
( i_id, @
i_client_label, @
i_client_type, @
i_num_logicals, @
i_num_integers, @
i_num_reals, @
i_num_strings, @
i_max_string_length, @
l_logical_data, @
i_integer_data, @
r_real_data, @
s_string_data )
#

dump i_return_value

i_return_value = @
db_get_client_data @
( i_client_label, @
i_id, @
i_c_client_type, @
i_c_num_logicals, @
i_c_num_integers, @
i_c_num_reals, @
i_c_num_strings, @
i_c_max_string_length )

# check for the data got from the function

dump i_c_client_type
dump i_c_num_logicals
dump i_c_num_integers
dump i_c_num_reals
dump i_c_num_strings
dump i_c_max_string_length

dump i_return_value
# -------------------------------------------------------------------

Main Index
620
Code Examples

db_get_client_id_by_label ()

# Purpose : This file gives an example of a call to the


# function db_get_client_id_by_label()
#
# A table is provided in the database which
# is reserved for the use by user.
# The db_create_client_data() function writes the
# information to this table.The function
# db_get_client_id_by_label() returns the client
# id given the client_label.We first create a
# client data entity and then use the function to
# get client id.
#
# To run this session file,first start
# a session of MSC.Patran, start a new
# database,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The db_get_client_id_by_label has the following arguments:
# db_get_client_id_by_label
# ( client_label,
# id )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_client_label,i_nbr_of_labels
INTEGER i_id, i_client_type, @
i_num_logicals, i_num_integers, i_num_reals, @
i_num_strings, i_max_string_length
LOGICAL l_logical_data(1)= [TRUE]
INTEGER i_integer_data(1)=[1]
REAL r_real_data(1)=[202.54]
STRING s_string_data[25](1)=[“Geometric”]

# variable to check the id.


INTEGER i_c_id
INTEGER i_return_value

# -------------------------------------------------------------------

# Create a client defined entity in the database.


#
# i_client_label=101
# i_client_type=1001
# i_num_logicals=1
# i_num_integers=1
# i_num_reals=1
# i_num_strings=1
# i_max_string_length=1
#

i_client_label = 101
i_client_type = 1001
i_num_logicals = 1
i_num_integers = 1
i_num_reals = 1
i_num_strings = 1
i_max_string_length = 1

i_return_value = @
db_create_client_data @
Main Index
CHAPTER 2 621
Model

( i_id, @
i_client_label, @
i_client_type, @
i_num_logicals, @
i_num_integers, @
i_num_reals, @
i_num_strings, @
i_max_string_length, @
l_logical_data, @
i_integer_data, @
r_real_data, @
s_string_data )

# check for creation of the client data


dump i_return_value

# Data type of the client.

i_return_value = @
db_get_client_id_by_label @
( i_client_label, @
i_c_id )

dump i_c_id
dump i_return_value
# -------------------------------------------------------------------

db_get_client_label_by_id ()

# Purpose : This file gives an example of a call to the


# function db_get_client_label_by_id()
#
# A table is provided in the database which
# is reserved for the use by user.
# The function db_create_client_data() writes the
# information to this table.The function
# db_get_client_label_by_id() returns the client
# data given the client id.We first create a
# client data entity and then use the function
# to get client label.
#
# To run this session file,first start
# a session of MSC.Patran, start a new
# database,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The db_get_client_label_by_id has the following arguments:
# db_get_client_label_by_id
# ( id,
# client_label )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_client_label,i_nbr_of_labels
INTEGER i_id, i_client_type, @
i_num_logicals, i_num_integers, i_num_reals, @
i_num_strings, i_max_string_length
LOGICAL l_logical_data(1)= [TRUE]
INTEGER i_integer_data(1)=[1]
REAL r_real_data(1)=[202.54]
Main Index
622
Code Examples

STRING s_string_data[25](1)=[“Geometric”]

# Variable Declaration for checking the output.


INTEGER i_c_client_label,i_return_value

# -------------------------------------------------------------------

# Create a client defined entity in the database.


#
# i_client_label=101
# i_client_type=1001
# i_num_logicals=1
# i_num_integers=1
# i_num_reals=1
# i_num_strings=1
# i_max_string_length=25
#

i_client_label = 101
i_client_type = 1001
i_num_logicals = 1
i_num_integers = 1
i_num_reals = 1
i_num_strings = 1
i_max_string_length = 25

i_return_value = @
db_create_client_data @
( i_id, @
i_client_label, @
i_client_type, @
i_num_logicals, @
i_num_integers, @
i_num_reals, @
i_num_strings, @
i_max_string_length, @
l_logical_data, @
i_integer_data, @
r_real_data, @
s_string_data )

# check for creation of the client data


dump i_return_value

# Data type of the client.

i_return_value = @
db_get_client_label_by_id @
( i_id, @
i_c_client_label )

dump i_c_client_label
dump i_return_value
# -------------------------------------------------------------------

Main Index
CHAPTER 2 623
Model

db_get_client_labels_by_type ()

# Purpose : This file gives an example of a call to the


# function db_get_client_labels_by_type()
#
# A table is provided in the database which
# is reserved for the use by user.
# The db_create_client_data() function writes the
# information to this table.The function
# db_get_client_labels_by_type() returns
# all the labels with a specified client type.
#
# To run this session file,first start
# a session of MSC.Patran, start a new
# database,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The db_get_client_labels_by_type has the following arguments:
# db_get_client_labels_by_type
# ( client_type,
# labels )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_client_type,i_labels(5)
INTEGER i_id, i_client_label, @
i_num_logicals, i_num_integers, i_num_reals, @
i_num_strings, i_max_string_length
LOGICAL l_logical_data(1)= [TRUE]
INTEGER i_integer_data(1)=[1]
REAL r_real_data(1)=[202.54]
STRING s_string_data[25](1)=[“Geometric”]
INTEGER i_return_value

# -------------------------------------------------------------------

# Create a client defined entity in the database.


#
# i_client_label=101
# i_client_type=1001
# i_num_logicals=1
# i_num_integers=1
# i_num_reals=1
# i_num_strings=1
# i_max_string_length=25
#

i_client_label = 101
i_client_type = 1001
i_num_logicals = 1
i_num_integers = 1
i_num_reals = 1
i_num_strings = 1
i_max_string_length = 25

i_return_value = @
db_create_client_data @
( i_id, @
i_client_label, @
i_client_type, @
i_num_logicals, @
i_num_integers, @
Main Index
624
Code Examples

i_num_reals, @
i_num_strings, @
i_max_string_length, @
l_logical_data, @
i_integer_data, @
r_real_data, @
s_string_data )

# check for creation of the client data


dump i_return_value

# Data type of the client.


# i_client_type=1001

i_return_value = @
db_get_client_labels_by_type @
( i_client_type, @
i_labels )

dump i_labels
dump i_return_value

# create another client data with same client_type but different


# client label and check for the labels.

# i_client_label = 102
i_client_label = 102

i_return_value = @
db_create_client_data @
( i_id, @
i_client_label, @
i_client_type, @
i_num_logicals, @
i_num_integers, @
i_num_reals, @
i_num_strings, @
i_max_string_length, @
l_logical_data, @
i_integer_data, @
r_real_data, @
s_string_data )

# check for creation of the client data


dump i_return_value

# check for the no of created labels.In this example


# two labels are created.

i_return_value = @
db_get_client_labels_by_type @
( i_client_type, @
i_labels )

# check for the no of labels created


dump i_labels
dump i_return_value
# -------------------------------------------------------------------

Main Index
CHAPTER 2 625
Model

db_get_db_version ()

# Purpose : This file gives an example of a call to the


# function db_get_db_version()
#
# This function retrives the database version
#
# To run this session file,first start
# a session of MSC.Patran,open a database or
# start a new database,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The db_get_db_version has the following arguments:
# db_get_db_version
# ( db_ver )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_return_value
STRING s_db_ver[25]

# -------------------------------------------------------------------

i_return_value = @
db_get_db_version @
( s_db_ver )

dump i_return_value
dump s_db_ver

# -------------------------------------------------------------------

db_get_general_field ()

# Purpose : This file provides an example of a call to the


# function db_get_general_field()
#
# This function returns the term_field_ids,
# term_function_types and field_datas from the
# field forms, after supplying the field_id,
# term_id and the length of the field data.
# It returns a positive integer indicating the
# status of the execution of 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_general_field()
# has the following arguments:
#
# db_get_general_field
# ( field_id,
# count,
# term_id,
# field_data_length,
# term_field_id,
# term_function_type,
# field_data )
Main Index
626
Code Examples

#
#---------------------------------------------------------------------
# Variable Declarations

INTEGER fem_create_mesh_surfa_num_nodes
INTEGER fem_create_mesh_surfa_num_elems
STRING asm_create_patch_xy_created_ids[VIRTUAL]
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]

INTEGER int_status=5, int_field_id, int_count


INTEGER int_term_id(virtual), int_field_data_length(virtual)
INTEGER int_term_field_id, int_term_function_type
STRING str_field_data[64]
STRING str_field[10] = "field_1"

#----------------------------------------------------------------------
# Open a new database
if(!db_is_open())THEN
uil_file_new.go("","new.db")
$? YES 36000002
endif
#----------------------------------------------------------------------
# Setting the preference to MSC.Nastran.

uil_pref_analysis.set_analysis_pref( "MSC.Nastran", @
"Structural", @
"", @
".op2" )
#---------------------------------------------------------------------
# Create Geometric entities

int_status = asm_const_patch_xyz @
( "1", "<2 5 0>", "[0 0 0]", "Coord 0", @
asm_create_patch_xy_created_ids )

dump int_status
#---------------------------------------------------------------------
# Create Finite Element entities
# 219 Nodes IDS = 1:219
# 60 Elements IDS = 1:60

ui_exec_function( "mesh_seed_display_mgr", "init" )


mesh_seed_create( "Surface 1.2 1.4 ", 1, 4, 0., 0., 0. )
mesh_seed_create( "Surface 1.1 1.3 ", 1, 15, 0., 0., 0. )

int_status = fem_create_mesh_surf_3 @
( "IsoMesh", 0, "Surface 1 ", 1, @
["0.1"], "Quad8", "1", @
"1", "Coord 0", "Coord 0", @
fem_create_mesh_surfa_num_nodes, @
fem_create_mesh_surfa_num_elems, @
fem_create_mesh_s_nodes_created, @
fem_create_mesh_s_elems_created )
dump int_status
mesh_seed_display_mgr.erase( )
#---------------------------------------------------------------------
# Create a Field - 'field_1'

int_status = fields_create_general @
( "field_1", @
0, 5, 2, "Real", "Coord 0", @
"", 3, 1, 2, 15 )
dump int_status

int_status = fields_create_general_term @
( "field_1", @
Main Index
CHAPTER 2 627
Model

0, 0, 0, 30, @
" [ ( 'X + 'Y ) * 'RAD ]" )
dump int_status
#---------------------------------------------------------------------
# Getting the field_id for the field - 'field_1'

int_status = db_get_field_id(str_field,int_field_id)

dump int_status
#---------------------------------------------------------------------
# Getting the int_count for the filed_id = 1
int_status = db_count_general_field @
(int_field_id, int_count)

dump int_status
#---------------------------------------------------------------------
# Getting term_ids and the field_data_lengths from the field_id
# and the count

sys_allocate_array(int_term_id , 1, int_count)
sys_allocate_array(int_field_data_length , 1, int_count)

int_status = db_get_general_field_length @
(int_field_id, @
int_count, @
int_term_id, @
int_field_data_length )
#---------------------------------------------------------------------
# Getting the term_field_ids, term function type and field data
# using the function db_get_general_field().
# This function needs to be executed for each value of int_count
# obtained from function db_count_general_field()
int_status = db_get_general_field( @
int_field_id, @
int_term_id(int_count), @
int_field_data_length(int_count), @
int_term_field_id, @
int_term_function_type, @
str_field_data)

dump int_status, int_field_id, int_term_id


dump int_field_data_length, int_term_field_id
dump int_term_function_type, str_field_data
#---------------------------------------------------------------------
# Closing the file - new.db

uil_file_close.goquit()

#---------------------------------------------------------------------
# End of File.

db_get_general_field_length ()

# Purpose : This file provides an example of a call to the


# function db_get_general_field_length()
#
# This function returns the term_ids and
# field_data_lengths of the field_id from which
# the length of field is required. It returns
# a positive integer indicating the status of
# the execution of the function, 0 for success.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
Main Index
628
Code Examples

# through the "File","Session","Play" pulldown


# menus on the menu bar.
#
#
# The function db_get_general_field_length()
# has the following arguments:
#
# db_get_general_field_length
# ( field_id,
# count,
# term_id,
# field_data_length )
#
#---------------------------------------------------------------------
# Variable Declarations

INTEGER fem_create_mesh_surfa_num_nodes
INTEGER fem_create_mesh_surfa_num_elems
STRING asm_create_patch_xy_created_ids[VIRTUAL]
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]

INTEGER int_status=5, int_field_id, int_count


INTEGER int_term_id(virtual), int_field_data_length(virtual)
STRING str_field[10] = "field_1"

#----------------------------------------------------------------------
# Open a new database
if(!db_is_open())THEN
uil_file_new.go("","new.db")
$? YES 36000002
endif
#----------------------------------------------------------------------
# Setting the preference to MSC.Nastran.

uil_pref_analysis.set_analysis_pref( "MSC.Nastran", @
"Structural", @
"", @
".op2" )
#---------------------------------------------------------------------
# Create Geometric entities

int_status = asm_const_patch_xyz @
( "1", "<2 5 0>", "[0 0 0]", "Coord 0", @
asm_create_patch_xy_created_ids )

dump int_status
#---------------------------------------------------------------------
# Create Finite Element entities
# 219 Nodes IDS = 1:219
# 60 Elements IDS = 1:60

ui_exec_function( "mesh_seed_display_mgr", "init" )


mesh_seed_create( "Surface 1.2 1.4 ", 1, 4, 0., 0., 0. )
mesh_seed_create( "Surface 1.1 1.3 ", 1, 15, 0., 0., 0. )

int_status = fem_create_mesh_surf_3 @
( "IsoMesh", 0, "Surface 1 ", 1, @
["0.1"], "Quad8", "1", @
"1", "Coord 0", "Coord 0", @
fem_create_mesh_surfa_num_nodes, @
fem_create_mesh_surfa_num_elems, @
fem_create_mesh_s_nodes_created, @
fem_create_mesh_s_elems_created )
dump int_status
mesh_seed_display_mgr.erase( )
Main Index
CHAPTER 2 629
Model

#---------------------------------------------------------------------
# Create a Field - 'field_1'

int_status = fields_create_general @
( "field_1", @
0, 5, 2, "Real", "Coord 0", @
"", 3, 1, 2, 15 )

dump int_status

int_status = fields_create_general_term @
( "field_1", @
0, 0, 0, 30, @
" [ ( 'X + 'Y ) * 'RAD ]" )

dump int_status
#---------------------------------------------------------------------
# Getting the field_id for the field - 'field_1'

int_status = db_get_field_id(str_field,int_field_id)

#---------------------------------------------------------------------
#
int_status = db_count_general_field @
(int_field_id, int_count)

#---------------------------------------------------------------------
# Using the function db_get_general_field_length() to get
# term_ids and the field_data_lengths from the field_id
# and the count

sys_allocate_array(int_term_id , 1, int_count)
sys_allocate_array(int_field_data_length , 1, int_count)

int_status = db_get_general_field_length @
(int_field_id, @
int_count, @
int_term_id, @
int_field_data_length )

dump int_status, int_field_id, int_count


dump int_term_id, int_field_data_length
#---------------------------------------------------------------------
# Closing the file - new.db

uil_file_close.goquit()

#---------------------------------------------------------------------

db_get_model_file_suffix ()

# Purpose : This file gives an example of a call to the


# function db_get_model_file_suffix()
# This function gives the suffix associated with
# the named analysis code.
#
# To run this session file,first start
# a session of MSC.Patran,open a database or
# start a new database,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The db_create_client_data has the following arguments:
# db_get_model_file_suffix
Main Index
630
Code Examples

# ( name,
# suffix )
#
# -------------------------------------------------------------------
# Variable Declaration
#
STRING s_name[32]=”MSC.Nastran”
STRING s_suffix[8]
INTEGER i_return_value

# -------------------------------------------------------------------

i_return_value = @
db_get_model_file_suffix @
( s_name, @
s_suffix )

dump i_return_value
# check the suffix of model file associated with analysis code
# ‘MSC.Nastran’
dump s_suffix
# -------------------------------------------------------------------

db_get_next_client_entity_label ()

# Purpose : This file gives an example of a call to the


# function db_get_next_client_entity_label()
#
# A table is provided in the database which
# is reserved for the use by user.
# The db_create_client_data() function writes the
# information to this table.The function
# db_get_next_client_entity_label() returns
# the largest client entity label from the
# database.
#
# To run this session file,first start
# a session of MSC.Patran,open a database or
# start a new database,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The db_get_next_client_entity_label has the following arguments:
# db_get_next_client_entity_label
# ( label )
#
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_client_type,i_label
INTEGER i_id, i_client_type, @
i_num_logicals, i_num_integers, i_num_reals, @
i_num_strings, i_max_ng_length
LOGICAL l_logical_data(1)= [TRUE]
INTEGER i_integer_data(1)=[1]
REAL r_real_data(1)=[202.54]
STRING s_string_data[25](1)=[“Geometric”]
INTEGER i_return_value

# -------------------------------------------------------------------

# Create a client defined entity in the database.


#
Main Index
CHAPTER 2 631
Model

# i_client_label=101
# i_client_type=1001
# i_num_logicals=1
# i_num_integers=1
# i_num_reals=1
# i_num_strings=1
# i_max_string_length=25
#

i_client_label = 101
i_client_type = 1001
i_num_logicals = 1
i_num_integers = 1
i_num_reals = 1
i_num_strings = 1
i_max_string_length = 25

i_return_value = @
db_create_client_data @
( i_id, @
i_client_label, @
i_client_type, @
i_num_logicals, @
i_num_integers, @
i_num_reals, @
i_num_strings, @
i_max_string_length, @
l_logical_data, @
i_integer_data, @
r_real_data, @
s_string_data )

# check for creation of the client data


dump i_return_value

# Data type of the client.


# i_client_type=1001

i_return_value = @
db_get_next_client_entity_label @
( i_label )

dump i_label
dump i_return_value

# create another client data with same client_type but different


# client label and check for the largest client entity label.

# i_client_label = 102
i_client_label = 102

i_return_value = @
db_create_client_data @
( i_id, @
i_client_label, @
i_client_type, @
i_num_logicals, @
i_num_integers, @
i_num_reals, @
i_num_strings, @
i_max_string_length, @
Main Index
632
Code Examples

l_logical_data, @
i_integer_data, @
r_real_data, @
s_string_data )

# check for creation of the client data


dump i_return_value

# check for the no of created labels.In this example


i_return_value = @
db_get_next_client_entity_label @
( i_label )

# check for the largest label created


dump i_label
dump i_return_value

# -------------------------------------------------------------------

Main Index
MSC.Acumen, Volume 2: Code Examples

CHAPTER
Files
3
■ Introduction

Main Index
634
Code Examples

3.1 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.

file_is_directory ()

# Purpose : This file provides two example calls to the


# function file_is_directory()
#
# This function is used to check whether a
# given path is valid directory.
#
# The function file_is_directory()
# has the following arguments:
#
# file_is_directory
# (dirname )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_dirname[128]
INTEGER i_return_value
#---------------------------------------------------------------------
#
# Checks if “/usr/bin” is a valid directory name
s_dirname = “/usr/bin”
i_return_value = @
file_is_directory @
( s_dirname )
dump i_return_value

# Paused. Press resume to continue...


sf_pause()

# date is an executable commonly found in /usr/bin


# Checks if “/usr/bin/date” is a valid directory name
s_dirname = “/usr/bin/date”
i_return_value = @
file_is_directory @
( s_dirname )
dump i_return_value
#---------------------------------------------------------------------

get_current_dir ()

# Purpose : This file provides an example of a call to the


# function get_current_dir()
#
# This function is used to get the current
# directory.
#
#
# The function get_current_dir()
# has the following arguments:
#
# get_current_dir
# (dirname )
#
#---------------------------------------------------------------------
Main Index
CHAPTER 3 635
Files

# Variable Declarations
STRING s_dirname[128]
INTEGER i_return_value
#---------------------------------------------------------------------
# Get the current directory
i_return_value = @
get_current_dir @
( s_dirname )
dump i_return_value
dump s_dirname
#---------------------------------------------------------------------

jou_file_write ()

# Purpose : This file provides an example of a call to the


# function jou_file_write()
#
# To write a string to ONLY to the journal file
# (not to the session file).
#
# 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 jou_file_write()
# has the following arguments:
#
# jou_file_write
# ( astring )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_astring[128]
#---------------------------------------------------------------------
# Write a string to the journal file.
s_astring = “# This line WILL be written to the journal file.”
jou_file_write @
(s_astring )

#---------------------------------------------------------------------

neutral_export2 ()

# Purpose : This file provides an example of a call to the


# function neutral_export2()
#
# This function is used to export data to a
# MSC.Patran 2.5 neutral file, applying the specified
# entity and group filters first.
#
# 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 neutral_export2()
# has the following arguments:
Main Index
636
Code Examples

#
# neutral_export2
# ( fname,
# title,
# entflag,
# grpall,
# ngroups,
# grids )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_fname[128]
STRING s_title[128]
LOGICAL la_entflag(35)=[TRUE , TRUE , TRUE , @
TRUE , TRUE , TRUE , TRUE , TRUE , FALSE, @
TRUE , TRUE , FALSE, FALSE, TRUE , TRUE , @
TRUE , TRUE , FALSE, TRUE , TRUE , TRUE , @
TRUE , TRUE , TRUE , FALSE, FALSE, FALSE, @
FALSE, FALSE, FALSE, FALSE, TRUE , TRUE , @
FALSE, FALSE ]
LOGICAL l_grpall
INTEGER i_ngroups
INTEGER ia_grids(2)=[1,2]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Assign values to variables


# s_fname = “spool.neutral” : Neutral file to write
# s_title = “MSC.Patran 2.5 Neutral File” : Title
# l_grpall = TRUE : Export all groups
# i_ngroups = 2 : Number of groups

s_fname = “spool.neutral”
s_title = “MSC.Patran 2.5 Neutral File “
l_grpall = TRUE
i_ngroups = 2

# -------------------------------------------------------------------
# Now export MSC.Patran data to a MSC.Patran 2.5 neutral file.
#
i_return_value = @
neutral_export2 @
(s_fname, @
s_title, @
la_entflag, @
l_grpall, @
i_ngroups, @
ia_grids )
dump i_return_value

# Close the database “spool.db”


uil_file_close.go()
#---------------------------------------------------------------------

nf_write ()

# Purpose : This file provides two examples of calls to


# the function nf_write()
#
# This function writes a MSC.Patran 2.5 format
# neutral file from the open database. Uses
# PFEA translator as a base, adds new Phase I
# If PFEA is TRUE writes only a PFEA neutral
Main Index
CHAPTER 3 637
Files

# file.
#
# 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 nf_write()
# has the following arguments:
#
# nf_write
# ( fname,
# title,
# pfea )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_fname[128]
STRING s_title[128]
LOGICAL l_pfea
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Export to a MSC.Patran 2.5 neutral file


# s_fname = “spool.nopfea.neutral” : File name to export to
# s_title = “MSC.Patran 2.5 Neutral file” : Title
# l_pfea = FALSE : Export all

s_fname = “spool.neutral”
s_title = “MSC.Patran 2.5 Neutral file”
l_pfea = FALSE
i_return_value = @
nf_write @
(s_fname, @
s_title, @
l_pfea )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Export to a MSC.Patran 2.5 neutral file (only PFEA)


# s_fname = “spool.pfea.neutral” : File name to export to
# s_title = “MSC.Patran 2.5 (PFEA) Neutral file” : Title
# l_pfea = FALSE : Export only PFEA

s_fname = “spool.pfea.neutral”
s_title = “MSC.Patran 2.5 (PFEA) Neutral file”
l_pfea = TRUE
i_return_value = @
nf_write @
( s_fname, @
s_title, @
l_pfea )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Close the database “spool.db”


uil_file_close.go()
#---------------------------------------------------------------------

Main Index
638
Code Examples

nf_write2 ()

# Purpose : This file provides an example of a call to the


# function nf_write2()
#
# This function is used to write MSC.Patran 2.5
# format neutral file from the open MSC.Patran database.
# Uses PFEA translator as a base, adds new
# Phase I. If pfea is TRUE exports only a
# PFEA neutral file.
#
# 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 nf_write2()
# has the following arguments:
#
# nf_write2
# (pname,
# title,
# pfea,
# entflag,
# grp_all,
# ngroups,
# grids )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_pname[128]
STRING s_title[128]
LOGICAL l_pfea
LOGICAL la_entflag(35)=[TRUE , TRUE , TRUE , @
TRUE , TRUE , TRUE , TRUE , FALSE, FALSE, @
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, @
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, @
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, @
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, @
FALSE, FALSE ]
LOGICAL l_grp_all
INTEGER i_ngroups = 2
INTEGER ia_grids(2)=[1,2]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# s_pname = “spool.pfea.neutral2” : File name to export to


# s_title = “MSC.Patran 2.5 Neutral File” : Title
# l_pfea = TRUE : only PFEA neutral file
# l_grp_all = TRUE : All groups

s_pname = “spool.pfea.neutral2”
s_title = “PFEA Neutral File”
l_pfea = TRUE
l_grp_all = TRUE

i_return_value = @
nf_write2 @
(s_pname, @
s_title, @
Main Index
CHAPTER 3 639
Files

l_pfea, @
la_entflag, @
l_grp_all, @
i_ngroups, @
ia_grids )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Close the database “spool.db”


uil_file_close.go()
#---------------------------------------------------------------------

p3_ps_get_xmt ()

# Purpose : This function gets the filename for importing the


# model from other applications. This functions
# imports model from a UG file.
#
# A UG file "clip.prt" is used in this session file.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file with
# the "File","Session","Play" pulldown menus
# on the menu bar.
#
# The function p3_ps_get_xmt()
# has the following arguments:
#
# p3_ps_get_xmt
# (
# filename )
#
#---------------------------------------------------------------------
# Variable Decleration

INTEGER uil_file_import_paras_num_parts
INTEGER i_status
STRING filename[1024](1)
#---------------------------------------------------------------------
# Open a database

IF(!db_is_open())THEN
uil_file_new.go("","new.db")
$? YES 36000002
ENDIF
#---------------------------------------------------------------------
# The following 2 functions are required to initialise the function
# p3_ps_get_xmt().

uil_db_commit( "Unigraphics Model Access Command" )

p3_ps_open_ug_v2( "clip.prt", @
[1, 1], [0], @
["Attributes", "2", "*", @
"*", "I", "0","Components", "0"], @
uil_file_import_paras_num_parts )

#---------------------------------------------------------------------
# Using the function p3_ps_get_xmt() to get the filename from
# the current directory.

i_status = p3_ps_get_xmt(filename)
Main Index
640
Code Examples

dump filename

#----------------------------------------------------------------------
# End of file

set_current_dir ()

# Purpose : This file provides two example calls to the


# function set_current_dir()
#
# This function is used to set the current
# directory.
#
# The function set_current_dir()
# has the following arguments:
#
# set_current_dir
# ( dirname )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_dirname[128],s_savedir[128]
INTEGER i_return_value
#---------------------------------------------------------------------
# Save the current working directory.
i_return_value = @
get_current_dir @
(s_savedir )

# Set the current directory to /usr/bin


s_dirname = “/usr/bin”
i_return_value = @
set_current_dir @
(s_dirname )
dump i_return_value

# Paused. Press resume to continue...


sf_pause()

s_dirname=””
i_return_value = @
get_current_dir @
(s_dirname )
dump s_dirname

# Paused. Press resume to continue...


sf_pause()

# Set the current directory to /notadir


s_dirname = “/notadir”
i_return_value = @
set_current_dir @
(s_dirname )
dump i_return_value

# Paused. Press resume to continue...


sf_pause()

s_dirname=””
i_return_value = @
get_current_dir @
(s_dirname )
dump s_dirname

# Set the current directory back to initial directory.


Main Index
CHAPTER 3 641
Files

i_return_value = @
set_current_dir @
(s_savedir )
dump i_return_value
dump s_savedir
#---------------------------------------------------------------------

sf_write_disable ()

# Purpose : This file provides an example of a call to the


# function sf_write_disable()
#
# This function controls whether the next PCL
# function gets written to the session file.
#
# 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.
#
# File “pclfunc.pcl” should be available.
#
#
# The function sf_write_disable()
# has the following arguments:
#
# sf_write_disable
# (alogical)
#
#---------------------------------------------------------------------
# Variable Declarations
LOGICAL l_alogical
#---------------------------------------------------------------------
# Compile pclfunc.pcl to get pclfunc.plb
# This file contains two functions pcl_func1() and pcl_func2()
# pcl_func1() calls pcl_func2().
# These functions use ui_write() to write a message to session file.
!!COMPILE pclfunc.pcl
# Add pclfunc.plb to LIBRARY
!!LIBRARY ADD pclfunc.plb

# Enable recording PCL function calls.


l_alogical = FALSE
sf_write_disable(l_alogical )

# Call pcl_func1()
pcl_func1()

# Disable recording PCL function calls.


l_alogical = TRUE
sf_write_disable(l_alogical )

# Call pcl_func1()
pcl_func1()

!!LIBRARY REMOVE pclfunc.plb


#---------------------------------------------------------------------

Main Index
642
Code Examples

ugi_export_iges_v1 ()

# Purpose : This file gives an example of a call to the


# function ugi_export_iges_v1()
#
# This function exports MSC.Patran geometry to IGES
# standard.
#
# 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 ugi_export_iges_v1 has the following arguments:
# ugi_export_iges_v1
# ( filename,
# start_section,
# nlpos,
# nlknt,
# product_id,
# author,
# author_org,
# model_units,
# entity_toggle_values,
# all_groups,
# ngroups,
# group_ids,
# patran_summary,
# iges_summary )
#
#---------------------------------------------------------------------
# Variable Declaration and initialisation.
#
STRING sv_created_ids[VIRTUAL]
STRING s_filename[64],s_start_section[128]
INTEGER ia_nlpos(2) = [45, 90]
INTEGER i_nlknt
STRING s_product_id[64]
STRING s_author[32]
STRING s_author_org[32]
STRING s_model_units[16]
LOGICAL la_entity_toggle_values(35) = [TRUE, TRUE, TRUE, @
TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, @
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, @
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, @
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, @
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, @
FALSE, FALSE ]
LOGICAL l_all_groups
INTEGER i_ngroups
INTEGER ia_group_ids(2)=[1,2]
INTEGER ia_patran_summary(7)
INTEGER ia_iges_summary(20)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Now export MSC.Patran geometry to the IGES standard.


#
# s_filename[64] = “spool_igs”
# s_start_section[128] = “MSC.Patran generated IGES file”
Main Index
CHAPTER 3 643
Files

# i_nlknt = 2
# s_product_id[64] = “MSC.Patran IGES Export”
# s_author[32] = “Sudarshan N Mogasale”
# s_author_org[32] = “GSSL,Pune,India”
# s_model_units[16] = “cm”
# l_all_groups = TRUE
# i_ngroups = 2

s_filename = “spool_igs”
s_start_section = “MSC.Patran generated IGES file”
i_nlknt = 2
s_product_id = “MSC.Patran IGES Export”
s_author = “Sudarshan N Mogasale”
s_author_org = “GSSL,Pune,India”
s_model_units = “cm”
l_all_groups = TRUE
i_ngroups = 2

i_return_value = @
ugi_export_iges_v1 @
( s_filename, @
s_start_section, @
ia_nlpos, @
i_nlknt, @
s_product_id, @
s_author, @
s_author_org, @
s_model_units, @
la_entity_toggle_values, @
l_all_groups, @
i_ngroups, @
ia_group_ids, @
ia_patran_summary, @
ia_iges_summary )

dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Close the database “spool.db”


uil_file_close.go()
#---------------------------------------------------------------------

ugi_import_iges_v3 ()

# Purpose : This file provides an example of a call to the


# function ugi_import_iges_v3()
#
# This session file will be imported the IGES
# format file "geometry.igs.01" in a new
# database named "new.db".
#
# 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 ugi_import_iges_v3()
# has the following arguments:
#
# [REF: ugiblt.tmpl]
Main Index
644
Code Examples

#
# ugi_import_iges_v3 (filname, @
# ipref142, @
# group_name, @
# entity_toggle_values, @
# color_toggle_values, @
# color_definition_method, @
# color_definition_values, @
# all_levels, @
# level_numbers, @
# num_groups, @
# group_ids, @
# group_entity_values, @
# group_color_values, @
# level_pointers, @
# group_levels, @
# uil_file_import_ige_scale_model, @
# uil_file_import_iges_i_summary, @
# uil_file_import_iges_p_summary )
#
#---------------------------------------------------------------------
# Variable Decleration

STRING filname[32]
INTEGER ipref142
STRING group_name[32]
LOGICAL entity_toggle_values(35)
LOGICAL color_toggle_values(10)
STRING color_definition_method[8]
STRING color_definition_values[8]
LOGICAL all_levels
STRING level_numbers[8]
INTEGER num_groups
INTEGER group_ids(1)
LOGICAL group_entity_values(1,1)
LOGICAL group_color_values(1,1)
INTEGER level_pointers(1)
INTEGER group_levels(1)
REAL uil_file_import_ige_scale_model
INTEGER uil_file_import_iges_i_summary(50)
INTEGER uil_file_import_iges_p_summary(8)
integer i_return_value
string msg[512]

#---------------------------------------------------------------------
# Opening a new data base

IF( !db_is_open()) THEN


uil_file_new.go( "", "new.db" )
ENDIF

$? YES 36000002

#---------------------------------------------------------------------
# Argument Initialization

filname = "geometry.igs.01"
ipref142 = 0
group_name = "default_group"
entity_toggle_values = [TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, @
TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, @
TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, @
FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, @
FALSE, FALSE, FALSE, FALSE, FALSE, @
FALSE, FALSE, @
Main Index
CHAPTER 3 645
Files

FALSE, FALSE, FALSE, FALSE]

color_toggle_values = [TRUE, TRUE, TRUE, TRUE, TRUE, @


TRUE, TRUE, TRUE, TRUE, FALSE ]

color_definition_method = "all"
color_definition_values = ""
all_levels = TRUE
level_numbers = ""
num_groups = 0
group_ids = 0
group_entity_values(1,1) = FALSE
group_color_values(1,1) = FALSE
level_pointers(1) = 0
group_levels(1) = 0

#---------------------------------------------------------------------
# Importing all the entities from file "geometry.igs.01"

i_return_value = @
ugi_import_iges_v3 ( filname, @
ipref142, @
group_name, @
entity_toggle_values, @
color_toggle_values, @
color_definition_method, @
color_definition_values, @
all_levels, @
level_numbers, @
num_groups, @
group_ids, @
group_entity_values, @
group_color_values, @
level_pointers, @
group_levels, @
uil_file_import_ige_scale_model, @
uil_file_import_iges_i_summary, @
uil_file_import_iges_p_summary )

msg_get_string(i_return_value, msg)

#---------------------------------------------------------------------
# Dumped all the outputs and status of the function.

dump uil_file_import_ige_scale_model
dump uil_file_import_iges_i_summary
dump uil_file_import_iges_p_summary
dump i_return_value
dump msg

#---------------------------------------------------------------------
# Closing the patran environment.

# uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

ui_form_to_frame ()

# Purpose : This file provides an example of a call to the


# function ui_form_to_frame()
#
# This function is used to create a FrameMaker
# (tm) file which contains the currently
Main Index
646
Code Examples

# displayed form of class name to the specified


# scale.
#
# The message.pcl file contains code to create
# a medium width quarter height sized form
# which containins a text widget for the message
# and a push button to acknowledge and remove the
# form.
#
# The message.pob file used below can be created
# from messag.pcl by using the C preprocessor
# to expand the symbols defined in the included
# files. See the “Part 9: PCL and Customization”
# manual for more information.
#
# A command similar to the following can be used
# to generate the message.pob file:
#
# cpp -I$P3_HOME/customisation message.pcl message.pob
#
# The function ui_form_to_frame()
# has the following arguments:
#
# ui_form_to_frame
# (classname,
# scale )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_classname[32]
REAL r_scale
#---------------------------------------------------------------------
# Compile message.pob and add message.plb to LIBRARY
!!COMPILE message.pob
!!LIBRARY ADD message.plb

message(“ This form showing this message will be saved as MSG.mif”)


s_classname=”MSG”
r_scale = 1.0
ui_form_to_frame(s_classname, r_scale )
#---------------------------------------------------------------------

ui_framemaker ()

# Purpose : This file provides examples of calls to the


# function ui_framemaker()
#
# This function is used to automate creation of
# FrameMaker(tm) files.
#
# The message.pcl file contains code to create
# a medium width quarter height sized form
# which containins a text widget for the message
# and a push button to acknowledge and remove the
# form.
#
# The message.pob file used below can be created
# from messag.pcl by using the C preprocessor
# to expand the symbols defined in the included
# files. See the “Part 9: PCL and Customization”
# manual for more information.
#
# A command similar to the following can be used
# to generate the message.pob file:
#
Main Index
CHAPTER 3 647
Files

# cpp -I$P3_HOME/customisation message.pcl message.pob


#
#
# The function ui_framemaker()
# has the following arguments:
#
# ui_framemaker
# (option,
# scale )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_classname[32]
INTEGER i_option
REAL r_scale
#---------------------------------------------------------------------
# Compile message.pcl and add resulting message.plb to LIBRARY
!!COMPILE pclfunc.pob
!!LIBRARY ADD message.plb

r_scale = 1.0
i_option = 1
# With i_option =1 the displayed form name will be echoed to
# the history window, which can be used in ui_form_to_frame()
# function.
ui_framemaker @
(i_option, @
r_scale )

message( “The name of the form (MSG) showing this “ // @


“message will be echoed to the history window.”)

s_classname=”MSG”
ui_form_to_frame @
(s_classname, @
r_scale )

# Paused. Press resume to continue..


sf_pause()

i_option = 2
# With i_option =2, whenever a form is displayed using
# ui_form_display() the name will be echoed to History window,
# and a call is automatically made to ui_form_to_frame() function.
ui_framemaker @
(i_option, @
r_scale )

message( “The name of the form (MSG) showing this “ // @


“message will be echoed to the history “ // @
“window and will be automatically “ // @
“saved as MSG.mif”)

i_option = 0
# With i_option =0, ui_form_display() reverts back to normal
# operation.
ui_framemaker @
(i_option, @
r_scale )

message( “The name of the form (MSG) showing this “ // @


“message will NOT be echoed to the history “ // @
“window and will NOT be “ // @
“saved as MSG.mif”)
#---------------------------------------------------------------------

Main Index
648
Code Examples

uil_file_open.open_db ()

# Purpose : This file provides an example of a call to the


# function uil_file_open.open_db()
#
# This function is used to open a database and
# set some initial parameters.
#
# 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 uil_file_open.open_db()
# has the following arguments:
#
# uil_file_open.open_db
# (name,
# newdb )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[128],s_newdb[128],s_olddb[128]
LOGICAL l_newdb
LOGICAL l_dbexists,l_return_value
INTEGER i_return_value
#---------------------------------------------------------------------
# Close any existing database.
l_dbexists= db_is_open()
if(l_dbexists) then
db_name_get(s_olddb)
uil_file_close.go()
end if
dump l_dbexists

# Now no database is open


l_return_value=db_is_open()
dump l_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Create and then close the “new.db” database.


s_name=”new.db”
uil_file_new.go(““, “./new.db”)
$? YES 36000002
ga_viewport_size_set( “default_viewport”, 2.5, 2.5, 1 )
ga_viewport_location_set( “default_viewport”, 0.0, 7.0, 1 )
uil_file_close.go()

# Open the existing “new.db” database.


l_newdb=FALSE
i_return_value = @
uil_file_open.open_db @
( s_name, @
l_newdb )
dump i_return_value

# Check the existing database


l_return_value=db_is_open()
dump l_return_value
db_name_get(s_newdb)
dump s_newdb

# Session file paused. Press “Resume” to continue..


Main Index
CHAPTER 3 649
Files

sf_pause()

# Close the temporary database


uil_file_close.go()

# Open the original database(if any).


if(l_dbexists)then
s_name=s_olddb
l_newdb=FALSE
i_return_value = @
uil_file_open.open_db @
(s_name, @
l_newdb )
dump i_return_value
end if
#--------------------------------------------------------------------

utl_is_locked_file ()

# Purpose : This file provides an example of a call to the


# function utl_is_locked_file()
#
# This function is used to determine if the
# indicated file is currently locked.
#
# 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 utl_is_locked_file()
# has the following arguments:
#
# utl_is_locked_file
# (filename )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_filename[128]
INTEGER i_return_value
#---------------------------------------------------------------------
# Get the database name and check whether it is locked.
db_name_get(s_filename)
i_return_value = @
utl_is_locked_file @
(s_filename )
dump i_return_value
dump s_filename

# Session file paused. Press “Resume” to continue..


sf_pause()

# Lock the database file


i_return_value = @
utl_lock_file @
(s_filename )
dump i_return_value
dump s_filename

# Get the database name and check whether it is locked.


i_return_value = @
utl_is_locked_file @
(s_filename )
Main Index
650
Code Examples

dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Unlock the database file


i_return_value = utl_unlock_file()
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Check the locked file


i_return_value = @
utl_is_locked_file @
(s_filename )
dump i_return_value
dump s_filename

#---------------------------------------------------------------------

utl_lock_file ()

# Purpose : This file provides an example of a call to the


# function utl_lock_file()
#
# This function is used to set an advisory
# lock on the indicated file.
#
# 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 utl_lock_file()
# has the following arguments:
#
# utl_lock_file
# (filename )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_filename[128]
INTEGER i_return_value
#---------------------------------------------------------------------
# Get the database name and check whether it is locked.
db_name_get(s_filename)
i_return_value = @
utl_is_locked_file @
(s_filename )
dump i_return_value
dump s_filename

# Session file paused. Press “Resume” to continue..


sf_pause()

# Temporarily Unlock the database file


i_return_value = utl_unlock_file()
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()
Main Index
CHAPTER 3 651
Files

# Check if the file locked


i_return_value = @
utl_is_locked_file @
(s_filename )
dump i_return_value
dump s_filename

# Session file paused. Press “Resume” to continue..


sf_pause()

# Lock the database file


i_return_value = @
utl_lock_file @
(s_filename )
dump i_return_value
dump s_filename
#---------------------------------------------------------------------

utl_unlock_file ()

# Purpose : This file provides an example of a call to the


# function utl_unlock_file()
#
# 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 utl_unlock_file() has no arguments.
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_filename[128]
INTEGER i_return_value
#---------------------------------------------------------------------
# Get the database name and check whether it is locked.
db_name_get(s_filename)
i_return_value = @
utl_is_locked_file @
(s_filename )
dump i_return_value
dump s_filename

# Session file paused. Press “Resume” to continue..


sf_pause()

# Temporarily Unlock the database file


i_return_value = utl_unlock_file()
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Check if the file locked


i_return_value = @
utl_is_locked_file @
(s_filename )
dump i_return_value
dump s_filename

# Session file paused. Press “Resume” to continue..


sf_pause()
Main Index
652
Code Examples

# Lock the database file again


i_return_value = @
utl_lock_file @
(s_filename )
dump i_return_value
dump s_filename
#---------------------------------------------------------------------

Main Index
MSC.Acumen, Volume 2: Code Examples

CHAPTER
Graphics
4
■ Introduction

Main Index
654
Code Examples

4.1 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.

clip_plane_ar_calc ()

# Purpose : This file provides an example of a call to the


# function clip_plane_ar_calc()
#
# This function updates the specified clipping
# plane’s data to reflect the axes relative
# rotations about the x,y and z axes.
#
# In this example, a clipping plane is created
# and posted for viewing. Then relative
# rotations about the x,y and z axes for
# clipping plane are specified. The new
# direction and up-vector values, obtained are
# then set to the clipping plane and viewed
# again.
#
# 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 clip_plane_ar_calc()
# has the following arguments:
#
# clip_plane_ar_calc
# ( name,
# rotx,
# roty,
# rotz,
# new_dir,
# new_up )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[16]
REAL r_rotx
REAL r_roty
REAL r_rotz
REAL ra_new_dir(3)
REAL ra_new_up(3)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Post the “default_group”


uil_viewport_post_groups.posted_groups( @
“default_viewport”, 1, [“default_group”] )

# Make shaded display of model


uil_toolbar.shaded_smooth( )

Main Index # Name of the arbitrary clipping plane


CHAPTER 4 655
Graphics

s_name = “Clipping_Plane_1”

# Create an arbitrary clipping plane


ga_clip_plane_create(s_name)

# Post the clipping plane


ga_clip_plane_post(s_name)

# Set the axes relative rotations about the x,y and z axes.
r_rotx = 45.0
r_roty = 45.0
r_rotz = 0.0
i_return_value = @
clip_plane_ar_calc @
( s_name, @
r_rotx, @
r_roty, @
r_rotz, @
ra_new_dir, @
ra_new_up )
dump i_return_value

# New direction of clipping plane


dump ra_new_dir

# New up-vector of clipping plane


dump ra_new_up

# Session file paused. Press “Resume” to continue..


sf_pause()

# Set the new direction and up-vector values


ga_clip_plane_direction_set(s_name, ra_new_dir,TRUE)
ga_clip_plane_up_set(s_name, ra_new_up )

# Session file paused. Press “Resume” to continue..


sf_pause()

# Delete the clipping plane


ga_clip_plane_delete(s_name)

# Make wireframe display of model


uil_toolbar.wireframe( )
#---------------------------------------------------------------------

clip_plane_zoom_calc ()

# Purpose : This file provides an example of a call to the


# function clip_plane_zoom_calc()
#
# This function updates the specified clipping
# plane’s location point, to reflect zooming.
#
# In this example, a clipping plane is created
# and posted for viewing. The zoom factor is
# then specified. The new location value,
# obtained are then set to the clipping plane
# and viewed again.
#
# 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
Main Index
656
Code Examples

# menus on the menu bar.


#
# The function clip_plane_zoom_calc()
# has the following arguments:
#
# clip_plane_zoom_calc
# ( name,
# factor,
# new_loc )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
REAL r_factor
REAL ra_new_loc(3)
REAL ra_value(3)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Post the “default_group”


uil_viewport_post_groups.posted_groups( @
“default_viewport”, 1, [“default_group”] )

# Make shaded display of model


uil_toolbar.shaded_smooth( )

# Name of the arbitrary clipping plane


s_name = “Clipping_Plane_1”

# Create an arbitrary clipping plane


ga_clip_plane_create(s_name)

# Post the clipping plane


ga_clip_plane_post(s_name)

# Set the zoom-factor


r_factor = 1.5
i_return_value = @
clip_plane_zoom_calc @
( s_name, @
r_factor, @
ra_new_loc )
dump i_return_value

# New location of clipping plane


dump ra_new_loc

# Session file paused. Press “Resume” to continue..


sf_pause()

# Set the location of the clipping plane


ga_clip_plane_location_set(s_name, ra_new_loc)

# Session file paused. Press “Resume” to continue..


sf_pause()

# Delete the clipping plane


ga_clip_plane_delete(s_name)

# Make wireframe display of model


uil_toolbar.wireframe( )
#---------------------------------------------------------------------

Main Index
CHAPTER 4 657
Graphics

db_get_current_viewport_id ()

# Purpose : This file provides an example of a call to the


# function db_get_current_viewport_id()
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_current_viewport_id()
# has the following arguments:
#
# db_get_current_viewport_id
# ( vp_id )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_vp_id
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Get the ID of the current viewport


i_return_value = @
db_get_current_viewport_id @
( i_vp_id )
dump i_return_value, i_vp_id

#---------------------------------------------------------------------

end_vrml_animation ()

# Purpose : This function closes the file opened by


# start_vrml_animation function. It has no
# returns conditions
#
# 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 end_vrml_animation()
# has no arguments:
#---------------------------------------------------------------------
# Variable Declarations

INTEGER fem_create_mesh_surfa_num_nodes
INTEGER fem_create_mesh_surfa_num_elems
INTEGER int_status
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]
STRING asm_create_patch_xy_created_ids[VIRTUAL]
INTEGER res_create_demo_mcid
INTEGER res_create_demo_scid
INTEGER res_create_demo_rcid
INTEGER res_create_demo_layerposid
INTEGER res_create_demo_rtid
Main Index
658
Code Examples

STRING filename[256] = "animate.wrl"


#----------------------------------------------------------------------
# Open a new database
if(!db_is_open())THEN
uil_file_new.go("","new.db")
$? YES 36000002
endif

#----------------------------------------------------------------------
# Setting the preference to MSC.Nastran.

uil_pref_analysis.set_analysis_pref( "MSC.Nastran", @
"Structural", @
"", @
".op2" )

#----------------------------------------------------------------------
# Create the surface 1

int_status = asm_const_patch_xyz( @
"1", @
"<1 1 0>", @
"[0 0 0]", @
"Coord 0", @
asm_create_patch_xy_created_ids )
dump int_status
#----------------------------------------------------------------------
# Create the finite elements
# Create 121 nodes and 100 elements for Surface 1.

ui_exec_function( "mesh_seed_display_mgr", "init" )

int_status = fem_create_mesh_surf_3( @
"IsoMesh", @
16384, @
"Surface 1", @
1, @
["0.1"], @
"Quad4", @
"#", @
"#", @
"Coord 0", @
"Coord 0", @
fem_create_mesh_surfa_num_nodes, @
fem_create_mesh_surfa_num_elems, @
fem_create_mesh_s_nodes_created, @
fem_create_mesh_s_elems_created )

mesh_seed_display_mgr.erase( )

dump int_status
#----------------------------------------------------------------------
# Creating a dummy Result case for demonstration of
# animation.

db_drop_res_index( )

res_db_create_loadcase_c( "Default case", @


1, @
"Created by MSC.Patran for demo results",@
res_create_demo_mcid )

res_db_create_subcase_c( 2, @
"demo", @
res_create_demo_scid, @
res_create_demo_rcid )
Main Index
CHAPTER 4 659
Graphics

res_db_createlayerpos_c( 0, @
0, @
res_create_demo_layerposid )

res_db_create_restype_c( "Nodal Vector", @


"Demo Result1", @
2, 1, @
"By MSC.Patran For Demo Results", @
0, @
res_create_demo_rtid )
res_create_demoresult2( 3, 1, 1., 1, 1, 1, @
[0, 0, 0, 0], @
2, 0, 0, 0 )
$# Demo result done

#----------------------------------------------------------------------
# Starting the animation recording.

start_vrml_animation(filename,"Increment")

#----------------------------------------------------------------------
# The animation parameters are defined here

db_post_results_load( )
res_display_tool_unpost( "Deformation", @
"default_Deformation" )

res_data_load_dbresult( 0, @
"Nodal", @
"Scalar", @
"Default case", @
"demo", @
"Nodal Vector", @
"Demo Result1", @
"(NON-LAYERED)", @
"XX", @
"Default", @
"DeriveAverage", @
"All", @
"ShapeFunc" )
res_data_title( 0, "Nodal", "Scalar",1, @
["Default case, demo: Nodal Vector,Demo Result1-(NON-LAYERED) (XX)"] )

res_display_fringe_create( "", "FreeFaces", 0, [""], 12, @


["Range:Fri_default_Fringe", "RangeOverwrite:ON", @
"FringeStyle:Discrete/Smooth", "Shade:None", @
"ElemEdge:FreeEdge,Blue,Solid,1", "Shrink:0", @
"TitleDisplay:OFF", "MinMaxDisplay:OFF", "ValueDisplay:OFF", @
"Filter:None","ScaleFactor:1.", @
"LabelStyle:Exponential, 12, White, 3"], @
TRUE )
res_display_fringe_post( "", 0, "Nodal", TRUE, FALSE )
res_display_tool_animate_scale( "Modal", "Fringe", "", 0. )
res_display_anim_setup_2d( 30, "Linear", "" )
res_display_anim_run( 10 )
res_display_anim_clear( )

#----------------------------------------------------------------------
# Using the function end_vrml_animation to stop the animation.

end_vrml_animation()

#----------------------------------------------------------------------
# Closing the file new.db
Main Index
660
Code Examples

uil_file_close.goquit()

# End of file
#----------------------------------------------------------------------

ga_clip_plane_clip_planes_get ()

# Purpose : This file provides an example of a call to the


# function ga_clip_plane_clip_planes_get()
#
# This function gets the list of arbitrary
# clipping planes available in the database.
#
# In this example, three clipping planes are
# created and then posted to default viewport.
# Then the list of clipping planes is obtained.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
#
# The function ga_clip_plane_clip_planes_get()
# has the following arguments:
#
# ga_clip_plane_clip_planes_get
# ( clip_plane_list ),
#
#---------------------------------------------------------------------
# Variable Declarations
STRING saa_clip_plane_list[16](3) = [““,””,””]
INTEGER i_return_value
INTEGER i_count
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Post the “default_group”


uil_viewport_post_groups.posted_groups( @
“default_viewport”, 1, [“default_group”] )

# Make shaded display of model


uil_toolbar.shaded_smooth( )

# Create new clipping planes


ga_clip_plane_create(“Clipping_Plane_1”)
ga_clip_plane_create(“Clipping_Plane_2”)
ga_clip_plane_create(“Clipping_Plane_3”)

# Post the clipping plane


ga_clip_plane_post(“Clipping_Plane_1”)
ga_clip_plane_post(“Clipping_Plane_2”)
ga_clip_plane_post(“Clipping_Plane_3”)

# Get the list of clipping planes


i_return_value = @
ga_clip_plane_clip_planes_get @
( saa_clip_plane_list )
dump i_return_value
dump saa_clip_plane_list
Main Index
CHAPTER 4 661
Graphics

# Session file paused. Press “Resume” to continue..


sf_pause()

# Delete the clipping plane


FOR ( i_count = 1 TO 3 )
ga_clip_plane_delete(saa_clip_plane_list(i_count))
END FOR

# Make wireframe display of model


uil_toolbar.wireframe( )
#---------------------------------------------------------------------

ga_clip_plane_create

# Purpose : This file provides an example of a call to the


# function ga_clip_plane_create()
#
# This function creates an arbitrary clipping
# plane.
#
# In this example, a clipping plane is created
# and then posted for viewing.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_clip_plane_create()
# has the following arguments:
#
# ga_clip_plane_create
# ( name ),
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[16]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Post the “default_group”


uil_viewport_post_groups.posted_groups( @
“default_viewport”, 1, [“default_group”] )

# Make shaded display of model


uil_toolbar.shaded_smooth( )

# Name of the arbitrary clipping plane


s_name = “Clipping_Plane_1”

# Create an arbitrary clipping plane


i_return_value = @
ga_clip_plane_create @
( s_name )
dump i_return_value

# Post the clipping plane


ga_clip_plane_post(s_name)
Main Index
662
Code Examples

# Session file paused. Press “Resume” to continue..


sf_pause()

# Delete the clipping plane


ga_clip_plane_delete(s_name)

# Make wireframe display of model


uil_toolbar.wireframe( )
#---------------------------------------------------------------------

ga_clip_plane_delete ()

# Purpose : This file provides an example of a call to the


# function ga_clip_plane_delete()
#
# This function deletes the specified clipping
# plane.
#
# In this example, a clipping plane is created
# and then posted for viewing. The clipping plane
# is then deleted in the end.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_clip_plane_delete()
# has the following arguments:
#
# ga_clip_plane_delete
# ( name ),
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[16]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Post the “default_group”


uil_viewport_post_groups.posted_groups( @
“default_viewport”, 1, [“default_group”] )

# Make shaded display of model


uil_toolbar.shaded_smooth( )

# Name of the arbitrary clipping plane


s_name = “Clipping_Plane_1”

# Create an arbitrary clipping plane


ga_clip_plane_create(s_name)

# Post the clipping plane


ga_clip_plane_post(s_name)

# Session file paused. Press “Resume” to continue..


sf_pause()

# Delete the clipping plane


i_return_value = @
Main Index
CHAPTER 4 663
Graphics

ga_clip_plane_delete @
( s_name )
dump i_return_value

# Make wireframe display of model


uil_toolbar.wireframe( )
#---------------------------------------------------------------------

ga_clip_plane_direction_get ()

# Purpose : This file provides an example of a call to the


# function ga_clip_plane_direction_get()
#
# This function gets the specified arbitrary
# clipping plane direction.
#
# In this example, a clipping plane is created
# and then posted for viewing. The clipping
# plane’s direction is then obtained.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_clip_plane_direction_get()
# has the following arguments:
#
# ga_clip_plane_direction_get
# ( name,
# value )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[16]
REAL ra_value(3)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Post the “default_group”


uil_viewport_post_groups.posted_groups( @
“default_viewport”, 1, [“default_group”] )

# Make shaded display of model


uil_toolbar.shaded_smooth( )

# Name of the arbitrary clipping plane


s_name = “Clipping_Plane_1”

# Create an arbitrary clipping plane


ga_clip_plane_create(s_name)

# Post the clipping plane


ga_clip_plane_post(s_name)

# Get the direction of clipping plane


i_return_value = @
ga_clip_plane_direction_get @
( s_name, @
ra_value )
Main Index
664
Code Examples

dump i_return_value
dump ra_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Delete the clipping plane


ga_clip_plane_delete(s_name)

# Make wireframe display of model


uil_toolbar.wireframe( )
#---------------------------------------------------------------------

ga_clip_plane_direction_set ()

# Purpose : This file provides an example of a call to the


# function ga_clip_plane_direction_set()
#
# This function sets the arbitrary clipping
# plane direction.
#
# In this example, a clipping plane is created
# and posted for viewing. The direction of the
# clipping is then changed using this function
# and viewed again.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_clip_plane_direction_set()
# has the following arguments:
#
# ga_clip_plane_direction_set
# ( name,
# value,
# up_flag )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[16]
REAL ra_value(3)
LOGICAL l_up_flag
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Post the “default_group”


uil_viewport_post_groups.posted_groups( @
“default_viewport”, 1, [“default_group”] )

# Make shaded display of model


uil_toolbar.shaded_smooth( )

# Name of the arbitrary clipping plane


s_name = “Clipping_Plane_1”

# Create an arbitrary clipping plane


ga_clip_plane_create(s_name)
Main Index
CHAPTER 4 665
Graphics

# Post the clipping plane


ga_clip_plane_post(s_name)

# Session file paused. Press “Resume” to continue..


sf_pause()

# Set the direction of the clipping plane


ra_value = [0.0 , -1.0, -1.0]
l_up_flag = TRUE
i_return_value = @
ga_clip_plane_direction_set @
( s_name, @
ra_value, @
l_up_flag )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Delete the clipping plane


ga_clip_plane_delete(s_name)

# Make wireframe display of model


uil_toolbar.wireframe( )
#---------------------------------------------------------------------

ga_clip_plane_icon_get ()

# Purpose : This file provides an example of a call to the


# function ga_clip_plane_icon_get()
#
# This function gets the status whether the
# clipping plane icon is displayed or not.
#
# In this example, a clipping plane is created
# and then posted for viewing. Then the check for
# the existence of icon is carried out.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_clip_plane_icon_get()
# has the following arguments:
#
# ga_clip_plane_icon_get
# ( name,
# value )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[16]
INTEGER i_value
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Post the “default_group”


uil_viewport_post_groups.posted_groups( @
“default_viewport”, 1, [“default_group”] )
Main Index
666
Code Examples

# Make shaded display of model


uil_toolbar.shaded_smooth( )

# Name of the arbitrary clipping plane


s_name = “Clipping_Plane_1”

# Create an arbitrary clipping plane


ga_clip_plane_create(s_name)

# Post the clipping plane


ga_clip_plane_post(s_name)

# Get the status for icon display


i_return_value = @
ga_clip_plane_icon_get @
( s_name, @
i_value )
dump i_return_value
dump i_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Delete the clipping plane


ga_clip_plane_delete(s_name)

# Make wireframe display of model


uil_toolbar.wireframe( )
#---------------------------------------------------------------------

ga_clip_plane_icon_set ()

# Purpose : This file provides an example of a call to the


# function ga_clip_plane_icon_set()
#
# This function sets the status for display of
# clipping plane.
#
# In this example, a clipping plane is created
# and then posted for viewing. Then the icon is
# hidden by setting i_value = 0 and viewed again.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_clip_plane_icon_set()
# has the following arguments:
#
# ga_clip_plane_icon_set
# ( name,
# value )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[16]
INTEGER i_value
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
Main Index
CHAPTER 4 667
Graphics

uil_file_open.go(“spool.db”)

# Post the “default_group”


uil_viewport_post_groups.posted_groups( @
“default_viewport”, 1, [“default_group”] )

# Make shaded display of model


uil_toolbar.shaded_smooth( )

# Name of the arbitrary clipping plane


s_name = “Clipping_Plane_1”

# Create an arbitrary clipping plane


ga_clip_plane_create(s_name)

# Post the clipping plane


ga_clip_plane_post(s_name)

# Session file paused. Press “Resume” to continue..


sf_pause()

# Set the status for icon display


# Hide the icon
i_value = 0
i_return_value = @
ga_clip_plane_icon_set @
( s_name, @
i_value )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Delete the clipping plane


ga_clip_plane_delete(s_name)

# Make wireframe display of model


uil_toolbar.wireframe( )
#---------------------------------------------------------------------

ga_clip_plane_location_get ()

# Purpose : This file provides an example of a call to the


# function ga_clip_plane_location_get()
#
# This function gets the specified arbitrary
# clipping plane location.
#
# In this example, a clipping plane is created
# and then posted for viewing. The clipping
# plane’s location is then obtained.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_clip_plane_location_get()
# has the following arguments:
#
# ga_clip_plane_location_get
# ( name,
Main Index
668
Code Examples

# value )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[16]
REAL ra_value(3)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Post the “default_group”


uil_viewport_post_groups.posted_groups( @
“default_viewport”, 1, [“default_group”] )

# Make shaded display of model


uil_toolbar.shaded_smooth( )

# Name of the arbitrary clipping plane


s_name = “Clipping_Plane_1”

# Create an arbitrary clipping plane


ga_clip_plane_create(s_name)

# Post the clipping plane


ga_clip_plane_post(s_name)

# Get the location of clipping plane


i_return_value = @
ga_clip_plane_location_get @
( s_name, @
ra_value )
dump i_return_value
dump ra_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Delete the clipping plane


ga_clip_plane_delete(s_name)

# Make wireframe display of model


uil_toolbar.wireframe( )
#---------------------------------------------------------------------

ga_clip_plane_location_set ()

# Purpose : This file provides an example of a call to the


# function ga_clip_plane_location_set()
#
# This function sets the arbitrary clipping
# plane location.
#
# In this example, a clipping plane is created
# and posted for viewing. The location of the
# clipping plane is then changed using this
# function and viewed again.
#
# 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.
Main Index
CHAPTER 4 669
Graphics

#
# The function ga_clip_plane_location_set()
# has the following arguments:
#
# ga_clip_plane_location_set
# ( name,
# value )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[16]
REAL ra_value(3)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Post the “default_group”


uil_viewport_post_groups.posted_groups( @
“default_viewport”, 1, [“default_group”] )

# Make shaded display of model


uil_toolbar.shaded_smooth( )

# Name of the arbitrary clipping plane


s_name = “Clipping_Plane_1”

# Create an arbitrary clipping plane


ga_clip_plane_create(s_name)

# Post the clipping plane


ga_clip_plane_post(s_name)

# Session file paused. Press “Resume” to continue..


sf_pause()

# Set the location of the clipping plane


ra_value = [0.0 , 0.0, 0.0]
i_return_value = @
ga_clip_plane_location_set @
( s_name, @
ra_value )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Delete the clipping plane


ga_clip_plane_delete(s_name)

# Make wireframe display of model


uil_toolbar.wireframe( )
#---------------------------------------------------------------------

ga_clip_plane_movement_get ()

# Purpose : This file provides an example of a call to the


# function ga_clip_plane_movement_get()
#
# This function gets the status whether the
# clipping plane moves along with the model or
# not. If the flag value is zero then clipping
# plane doesn’t move with the model and moves
# if flag value is non-zero.
#
Main Index
670
Code Examples

# In this example, a clipping plane is created


# and then posted for viewing. Movement of
# clipping plane, if any, on rotation of the
# model is then observed by rotating the model
# along X-Y axis.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_clip_plane_movement_get()
# has the following arguments:
#
# ga_clip_plane_movement_get
# ( name,
# value )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[16]
INTEGER i_value
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Post the “default_group”


uil_viewport_post_groups.posted_groups( @
“default_viewport”, 1, [“default_group”] )

# Make shaded display of model


uil_toolbar.shaded_smooth( )

# Name of the arbitrary clipping plane


s_name = “Clipping_Plane_1”

# Create an arbitrary clipping plane


ga_clip_plane_create(s_name)

# Post the clipping plane


ga_clip_plane_post(s_name)

# Get flag value for clipping plane movement along with the model
i_return_value = @
ga_clip_plane_movement_get @
( s_name, @
i_value )
dump i_return_value
dump i_value

# Rotate the model.(Use Mouse Rotate XY)


# It can be observed that clipping plane remaining stationery
# while the model is rotated, as i_value = 0.

# Session file paused. Press “Resume” to continue..


sf_pause()

# Delete the clipping plane


ga_clip_plane_delete(s_name)

# Make wireframe display of model


uil_toolbar.wireframe( )
#---------------------------------------------------------------------

Main Index
CHAPTER 4 671
Graphics

ga_clip_plane_movement_set ()

# Purpose : This file provides an example of a call to the


# function ga_clip_plane_movement_set()
#
# This function sets the status whether the
# clipping plane is to be rotated along with the
# model or not.
#
# In this example, a clipping plane is created
# and then posted for viewing. The flag value
# is set as 1, for the movement of clipping plane
# along with the rotation of model. The effects
# on clipping plane movement is then observed,
# by rotating the model along X-Y axis.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_clip_plane_movement_set()
# has the following arguments:
#
# ga_clip_plane_movement_set
# ( name,
# value )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[16]
INTEGER i_value
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Post the “default_group”


uil_viewport_post_groups.posted_groups( @
“default_viewport”, 1, [“default_group”] )

# Make shaded display of model


uil_toolbar.shaded_smooth( )

# Name of the arbitrary clipping plane


s_name = “Clipping_Plane_1”

# Create an arbitrary clipping plane


ga_clip_plane_create(s_name)

# Post the clipping plane


ga_clip_plane_post(s_name)

# Get the status of the movement of clipping plane with model


ga_clip_plane_movement_get(s_name, i_value )

# Flag value
dump i_value

# Rotate the model.(Use Mouse Rotate XY)


# It can be observed that clipping plane remaining stationery
# while the model is rotated, as i_value = 0.
Main Index
672
Code Examples

# Session file paused. Press “Resume” to continue..


sf_pause()

# Change the status for the clipping plane allowing it to move along
# with the model.
i_value = 1
i_return_value = @
ga_clip_plane_movement_set @
( s_name, @
i_value )
dump i_return_value

# Rotate the model.(Use Mouse Rotate XY)


# It can be observed that the clipping plane getting rotated along
# with the model, as i_value is non-zero.

# Session file paused. Press “Resume” to continue..


sf_pause()

# Delete the clipping plane


ga_clip_plane_delete(s_name)

# Make wireframe display of model


uil_toolbar.wireframe( )
#---------------------------------------------------------------------

ga_clip_plane_nclip_planes_get ()

# Purpose : This file provides an example of a call to the


# function ga_clip_plane_nclip_planes_get()
#
# This function gets the number of arbitrary
# clipping planes available in the database.
#
# In this example, three clipping planes are
# created and then posted to default viewport.
# Then the number of clipping planes is obtained.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_clip_plane_nclip_planes_get()
# has the following arguments:
#
# ga_clip_plane_nclip_planes_get
# ( naclips ),
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_naclips
STRING saa_clip_plane_list[16](3)
INTEGER i_count
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Post the “default_group”


uil_viewport_post_groups.posted_groups( @
Main Index
CHAPTER 4 673
Graphics

“default_viewport”, 1, [“default_group”] )

# Make shaded display of model


uil_toolbar.shaded_smooth( )

# Initialize saa_clip_plane_list
saa_clip_plane_list = [“Clipping_Plane_1” , @
“Clipping_Plane_2” , @
“Clipping_Plane_3” ]

# Create new clipping planes


FOR ( i_count = 1 TO 3 )
ga_clip_plane_create(saa_clip_plane_list(i_count))
END FOR

# Post the clipping plane


FOR ( i_count = 1 TO 3 )
ga_clip_plane_post(saa_clip_plane_list(i_count))
END FOR

# Get the number of clipping planes


i_return_value = @
ga_clip_plane_nclip_planes_get @
( i_naclips )
dump i_return_value
dump i_naclips

# Session file paused. Press “Resume” to continue..


sf_pause()

# Delete the clipping plane


FOR ( i_count = 1 TO 3 )
ga_clip_plane_delete(saa_clip_plane_list(i_count))
END FOR

# Make wireframe display of model


uil_toolbar.wireframe( )
#---------------------------------------------------------------------

ga_clip_plane_nposted_get ()

# Purpose : This file provides an example of a call to the


# function ga_clip_plane_nposted_get()
#
# This function gets the number of arbitrary
# clipping planes posted to default view port.
#
# In this example, 3 clipping planes are created
# and only 2 are posted to default viewport.
# Then the number of clipping planes posted is
# obtained.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_clip_plane_nposted_get()
# has the following arguments:
#
# ga_clip_plane_nposted_get
# ( naclips ),
Main Index
674
Code Examples

#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_naclips
STRING saa_clip_plane_list[16](3)
INTEGER i_count
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Post the “default_group”


uil_viewport_post_groups.posted_groups( @
“default_viewport”, 1, [“default_group”] )

# Make shaded display of model


uil_toolbar.shaded_smooth( )

# Initialize saa_clip_plane_list
saa_clip_plane_list = [“Clipping_Plane_1” , @
“Clipping_Plane_2” , @
“Clipping_Plane_3” ]

# Create new clipping planes


FOR ( i_count = 1 TO 3 )
ga_clip_plane_create(saa_clip_plane_list(i_count))
END FOR

# Post only the first 2 clipping plane


FOR ( i_count = 1 TO 2 )
ga_clip_plane_post(saa_clip_plane_list(i_count))
END FOR

# Get the number of posted clipping planes


i_return_value = @
ga_clip_plane_nposted_get @
( i_naclips )
dump i_return_value
dump i_naclips

# Session file paused. Press “Resume” to continue..


sf_pause()

# Delete the clipping plane


FOR ( i_count = 1 TO 3 )
ga_clip_plane_delete(saa_clip_plane_list(i_count))
END FOR

# Make wireframe display of model


uil_toolbar.wireframe( )
#---------------------------------------------------------------------

ga_clip_plane_post ()

# Purpose : This file provides an example of a call to the


# function ga_clip_plane_post()
#
# This function posts an arb., clipping plane.
#
# In this example, a clipping plane is created
# and then posted for viewing.
#
# Before running this session file run spool.ses
# to create spool.db
#
Main Index
CHAPTER 4 675
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 ga_clip_plane_post()
# has the following arguments:
#
# ga_clip_plane_post
# ( name ),
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[16]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Post the “default_group”


uil_viewport_post_groups.posted_groups( @
“default_viewport”, 1, [“default_group”] )

# Make shaded display of model


uil_toolbar.shaded_smooth( )

# Name of the arbitrary clipping plane


s_name = “Clipping_Plane_1”

# Create an arbitrary clipping plane


ga_clip_plane_create (s_name)

# Session file paused. Press “Resume” to continue..


sf_pause()

# Post the clipping plane


i_return_value = @
ga_clip_plane_post @
( s_name )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Delete the clipping plane


ga_clip_plane_delete(s_name)

# Make wireframe display of model


uil_toolbar.wireframe( )
#---------------------------------------------------------------------

ga_clip_plane_posted_get ()

# Purpose : This file provides an example of a call to the


# function ga_clip_plane_posted_get()
#
# This function gets the list of arbitrary
# clipping planes posted to default view port.
#
# In this example, 3 clipping planes are created
# and only 2 are posted to default viewport.
# Then the list of clipping planes posted is
# obtained.
#
# Before running this session file run spool.ses
Main Index
676
Code Examples

# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_clip_plane_posted_get()
# has the following arguments:
#
# ga_clip_plane_posted_get
# ( clip_plane_list ),
#
#---------------------------------------------------------------------
# Variable Declarations
STRING saa_clip_plane_list[16](3)
STRING saa_cp_post_list[16](3)
INTEGER i_count
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Post the “default_group”


uil_viewport_post_groups.posted_groups( @
“default_viewport”, 1, [“default_group”] )

# Make shaded display of model


uil_toolbar.shaded_smooth( )

# Initialize saa_clip_plane_list
saa_clip_plane_list = [“Clipping_Plane_1” , @
“Clipping_Plane_2” , @
“Clipping_Plane_3” ]

# Create new clipping planes


FOR ( i_count = 1 TO 3 )
ga_clip_plane_create(saa_clip_plane_list(i_count))
END FOR

# Post only the first 2 clipping plane


FOR ( i_count = 1 TO 2 )
ga_clip_plane_post(saa_clip_plane_list(i_count))
END FOR

# Get the list of posted clipping planes


i_return_value = @
ga_clip_plane_posted_get @
( saa_cp_post_list )
dump i_return_value
dump saa_cp_post_list

# Session file paused. Press “Resume” to continue..


sf_pause()

# Delete the clipping plane


FOR ( i_count = 1 TO 3 )
ga_clip_plane_delete(saa_clip_plane_list(i_count))
END FOR

# Make wireframe display of model


uil_toolbar.wireframe( )
#---------------------------------------------------------------------

Main Index
CHAPTER 4 677
Graphics

ga_clip_plane_unpost ()

# Purpose : This file provides an example of a call to the


# function ga_clip_plane_unpost()
#
# This function unposts the specified arbitrary
# clipping plane from current viewport.
#
# In this example, a clipping plane is created
# and then posted for viewing. After a pause the
# the the clipping plane is unposted.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_clip_plane_unpost()
# has the following arguments:
#
# ga_clip_plane_unpost
# ( name ),
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[16]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Post the “default_group”


uil_viewport_post_groups.posted_groups( @
“default_viewport”, 1, [“default_group”] )

# Make shaded display of model


uil_toolbar.shaded_smooth( )

# Name of the arbitrary clipping plane


s_name = “Clipping_Plane_1”

# Create an arbitrary clipping plane


ga_clip_plane_create ( s_name )
dump i_return_value

# Post the clipping plane


ga_clip_plane_post(s_name)

# Session file paused. Press “Resume” to continue..


sf_pause()

# Unpost the clipping plane


i_return_value = @
ga_clip_plane_unpost @
( s_name )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Delete the clipping plane


ga_clip_plane_delete(s_name)
Main Index
678
Code Examples

# Make wireframe display of model


uil_toolbar.wireframe( )
#---------------------------------------------------------------------

ga_clip_plane_up_set ()

# Purpose : This file provides an example of a call to the


# function ga_clip_plane_up_set()
#
# This function sets the up-vector values for
# specified clipping plane.
#
# In this example, a clipping plane is created
# and posted for viewing. The up-vector values
# of the clipping plane are then changed using
# this function and viewed again.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_clip_plane_up_set()
# has the following arguments:
#
# ga_clip_plane_up_set
# ( name,
# value )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[16]
REAL ra_value(3)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Post the “default_group”


uil_viewport_post_groups.posted_groups( @
“default_viewport”, 1, [“default_group”] )

# Make shaded display of model


uil_toolbar.shaded_smooth( )

# Name of the arbitrary clipping plane


s_name = “Clipping_Plane_1”

# Create an arbitrary clipping plane


ga_clip_plane_create(s_name)

# Post the clipping plane


ga_clip_plane_post(s_name)

# Get the up-vector values of the clipping plane


ga_clip_plane_up_get ( s_name, ra_value )
dump ra_value

# Session file paused. Press “Resume” to continue..


sf_pause()
Main Index
CHAPTER 4 679
Graphics

# Set the up-vector values of the clipping plane


ra_value = [1.0 , 1.0, 0.0]
i_return_value = @
ga_clip_plane_up_set @
( s_name, @
ra_value )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Delete the clipping plane


ga_clip_plane_delete(s_name)

# Make wireframe display of model


uil_toolbar.wireframe( )
#---------------------------------------------------------------------

ga_elem_scalar_create ()

# Purpose : This file provides an example of a call to the


# function ga_elem_scalar_create()
#
# This function is used to create a scalar
# element table.
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_elem_scalar_create()
# has the following arguments:
#
# ga_elem_scalar_create
# ( title,
# nbr_elems,
# elem_ids,
# nbr_values,
# max_vals,
# scalars,
# id )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_title[32],s_group_name[32]
INTEGER i_ncases, iv_lcids(VIRTUAL),iv_nsub(VIRTUAL),ia_resids(5)
INTEGER i_dtype,i_resloc,i_nbr_elems,iv_elem_ids(VIRTUAL)
INTEGER iv_nbr_values(VIRTUAL),ia_minloc(6),ia_maxloc(6)
INTEGER i_max_vals
INTEGER i_id
INTEGER i_index,i_return_value
REAL rv_scalars(VIRTUAL)
#---------------------------------------------------------------------
# Open the database “spool.db” and read the deformation results
sf_play(“spool_res.ses”)

# Get the number of Load cases and their IDs


i_return_value = @
res_utl_get_loadcases(i_ncases,iv_lcids,iv_nsub)
dump i_return_value
Main Index
680
Code Examples

dump i_ncases,iv_lcids,iv_nsub

# Extract the deformation results from the database


# Load case ID = iv_lcids(1)
# Sub case ID = 1
# Primary Result ID = 2 (Corresponds to deformation )
# Secondary Result ID = 1
# Layer ID = 1
# elem_list = “Element 1:#” (All elements )
# location = “C” (Centroid )
# derivation = “MAG” (Magnitude: Vector to Scalar)
# c_id = ““
ia_resids(1) = iv_lcids(1)
ia_resids(2) = 1
ia_resids(3) = 2
ia_resids(4) = 1
ia_resids(5) = 1
i_return_value = @
res_utl_extract_elem_results(ia_resids,”Element 1:#”,”MAG”,”C”, @
““,i_dtype,i_resloc,i_nbr_elems,iv_elem_ids,iv_nbr_values, @
rv_scalars, ia_minloc,ia_maxloc)

dump i_return_value

# Create a scalar table


s_title = “A Scalar Table”
i_max_vals = 1 /* Only at the Centroid */

i_return_value = @
ga_elem_scalar_create @
( s_title, @
i_nbr_elems, @
iv_elem_ids, @
iv_nbr_values, @
i_max_vals, @
rv_scalars, @
i_id )
dump i_return_value, i_id

# Set the current scalar element table associated with the


# group “fem_model”
s_group_name = “fem_model”
i_return_value = @
ga_group_elem_scalar_set @
( s_group_name, @
i_id )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

sys_free_array(iv_lcids)
sys_free_array(iv_nsub)
sys_free_array(iv_elem_ids)
sys_free_array(iv_nbr_values)
sys_free_array(rv_scalars)

# Close the database “spool.db”


uil_file_close.go()
#---------------------------------------------------------------------

Main Index
CHAPTER 4 681
Graphics

ga_elem_scalar_single_create ()

# Purpose : This file provides an example of a call to the


# function ga_elem_scalar_single_create()
#
# This function is used to create a scalar
# element table with a single value per element.
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_elem_scalar_single_create()
# has the following arguments:
#
# ga_elem_scalar_single_create
# ( title,
# nbr_elems,
# elem_ids,
# nbr_nodes,
# scalars,
# id )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_title[32],s_group_name[32]
INTEGER i_ncases, iv_lcids(VIRTUAL),iv_nsub(VIRTUAL),ia_resids(5)
INTEGER i_dtype,i_resloc,i_nbr_elems,iv_elem_ids(VIRTUAL)
INTEGER iv_nbr_values(VIRTUAL),ia_minloc(6),ia_maxloc(6)
INTEGER iv_nbr_nodes(VIRTUAL)
INTEGER i_id
INTEGER i_index,i_return_value
REAL rv_scalars(VIRTUAL)
#---------------------------------------------------------------------
# Open the database “spool.db” and read the deformation results
sf_play(“spool_res.ses”)

# Get the number of Load cases and their IDs


i_return_value = @
res_utl_get_loadcases(i_ncases,iv_lcids,iv_nsub)
dump i_return_value
dump i_ncases,iv_lcids,iv_nsub

# Extract the deformation results from the database


# Load case ID = iv_lcids(1)
# Sub case ID = 1
# Primary Result ID = 2 (Corresponds to deformation )
# Secondary Result ID = 1
# Layer ID = 1
# elem_list = “Element 1:#” (All elements )
# location = “C” (Centroid )
# derivation = “MAG” (Magnitude: Vector to Scalar)
# c_id = ““
ia_resids(1) = iv_lcids(1)
ia_resids(2) = 1
ia_resids(3) = 2
ia_resids(4) = 1
ia_resids(5) = 1
i_return_value = @
res_utl_extract_elem_results(ia_resids,”Element 1:#”,”MAG”,”C”, @
Main Index
682
Code Examples

““,i_dtype,i_resloc,i_nbr_elems,iv_elem_ids,iv_nbr_values, @
rv_scalars, ia_minloc,ia_maxloc)

dump i_return_value

sys_allocate_array(iv_nbr_nodes,1,i_nbr_elems)

FOR(i_index = 1 TO i_nbr_elems)
iv_nbr_nodes(i_index) = 4 /* QUAD4 elements */
END FOR

# Create a scalar table with a single value per element


s_title = “Scalar Table (Single)”
i_return_value = @
ga_elem_scalar_single_create @
( s_title, @
i_nbr_elems, @
iv_elem_ids, @
iv_nbr_nodes, @
rv_scalars, @
i_id )
dump i_return_value, i_id

# Set the current scalar element table associated with the


# group “fem_model”
s_group_name = “fem_model”
i_return_value = @
ga_group_elem_scalar_set @
( s_group_name, @
i_id )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

sys_free_array(iv_lcids)
sys_free_array(iv_nsub)
sys_free_array(iv_elem_ids)
sys_free_array(iv_nbr_values)
sys_free_array(iv_nbr_nodes)
sys_free_array(rv_scalars)

# Close the database “spool.db”


uil_file_close.go()
#---------------------------------------------------------------------

ga_error ()

# Purpose : This file provides two example calls to the


# function ga_error()
#
# This function indicates whether the last call
# to the Graphics application raised an error
# condition or not.
#
# 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 ga_error() has no arguments.
#
#---------------------------------------------------------------------
Main Index
CHAPTER 4 683
Graphics

# Variable Declarations
LOGICAL l_return_value
#---------------------------------------------------------------------
#
# Post the default_group.
uil_viewport_post_groups.posted_groups(“default_viewport”, @
1,[“default_group”])

l_return_value = ga_error()
dump l_return_value

# Post a non existing group to simulate an error.


uil_viewport_post_groups.posted_groups(“default_viewport”, @
1,[“non_existing_group”])

l_return_value = ga_error()
dump l_return_value
#---------------------------------------------------------------------

ga_light_attenuation_get ()

# Purpose : This file provides an example of a call to the


# function ga_light_attenuation_get()
#
# This function is used to get the attenuation
# of light.
#
# Make “sphere.ses” available in the current
# directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_light_attenuation_get()
# has the following arguments:
#
# ga_light_attenuation_get
# ( name,
# value )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32],sav_light_list[32](VIRTUAL)
REAL r_value
INTEGER i_nlights,i_return_value
#---------------------------------------------------------------------
# The file “sphere.ses” opens a new database and creates a spherical
# surface in it.
sf_play(“sphere.ses”)

# Get the number of lights posted to the graphics window


i_return_value = @
ga_light_nposted_get @
( i_nlights )
dump i_return_value
dump i_nlights

sys_allocate_array(sav_light_list,1,i_nlights)
# Get the list of lights posted to the graphics window
i_return_value = @
ga_light_posted_get @
( sav_light_list )
dump i_return_value
Main Index
684
Code Examples

dump sav_light_list

# Get the attenuation of the first posted light


s_name = sav_light_list(1)
i_return_value = @
ga_light_attenuation_get @
( s_name, @
r_value )
dump i_return_value
dump r_value

sys_free_array(sav_light_list)

#---------------------------------------------------------------------

ga_light_attenuation_set ()

# Purpose : This file provides an example of two calls


# to the function ga_range_rename()
#
# This function is used to set the attenuation
# of light.
#
# Make “sphere.ses” available in the current
# directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_light_attenuation_set()
# has the following arguments:
#
# ga_light_attenuation_set
# ( name,
# value )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32],sav_light_list[32](VIRTUAL)
REAL r_value,r_old_value
INTEGER i_nlights,i_return_value
#---------------------------------------------------------------------
# The file “sphere.ses” opens a new database and creates a spherical
# surface in it.
sf_play(“sphere.ses”)

# Get the number of lights posted to the graphics window


i_return_value = @
ga_light_nposted_get @
( i_nlights )
dump i_return_value
dump i_nlights

# Get the list of lights posted to the graphics window


sys_allocate_array(sav_light_list,1,i_nlights)
i_return_value = @
ga_light_posted_get @
( sav_light_list )
dump i_return_value
dump sav_light_list

# Get the attenuation of the first light posted


s_name = sav_light_list(1)
Main Index
CHAPTER 4 685
Graphics

i_return_value = @
ga_light_attenuation_get @
( s_name, @
r_old_value )
dump i_return_value
dump r_old_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Set the attenuation of the first light posted


r_value = 0.5
i_return_value = @
ga_light_attenuation_set @
( s_name, @
r_value )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Set the attenuation to original value


r_value =r_old_value
i_return_value = @
ga_light_attenuation_set @
( s_name, @
r_value )
dump i_return_value

sys_free_array(sav_light_list)
#---------------------------------------------------------------------

ga_light_color_get ()

# Purpose : This file provides an example of a call to the


# function ga_light_color_get()
#
# This function is used to get the color
# of light.
#
# Make “sphere.ses” available in the current
# directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_light_color_get()
# has the following arguments:
#
# ga_light_color_get
# ( name,
# value )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32],sav_light_list[32](VIRTUAL)
INTEGER i_value,i_nlights,i_return_value
#---------------------------------------------------------------------
# The file “sphere.ses” opens a new database and creates a spherical
# surface in it.
sf_play(“sphere.ses”)

# Get the number of lights posted to the graphics window


Main Index
686
Code Examples

i_return_value = @
ga_light_nposted_get @
( i_nlights )
dump i_return_value
dump i_nlights

sys_allocate_array(sav_light_list,1,i_nlights)

# Get the list of lights posted to the graphics window


i_return_value = @
ga_light_posted_get @
( sav_light_list )
dump i_return_value
dump sav_light_list

# Get the color of the first light posted


s_name = sav_light_list(1)
i_return_value = @
ga_light_color_get @
( s_name, @
i_value )
dump i_return_value
dump i_value

sys_free_array(sav_light_list)
#---------------------------------------------------------------------

ga_light_color_set ()

# Purpose : This file provides an example of two calls


# to the function ga_range_rename()
#
# This function is used to set the color
# of a light.
#
# Make “sphere.ses” available in the current
# directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_light_color_set()
# has the following arguments:
#
# ga_light_color_set
# ( name,
# value )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32],sav_light_list[32](VIRTUAL)
INTEGER i_value,i_old_value,i_nlights,i_return_value
#---------------------------------------------------------------------
# The file “sphere.ses” opens a new database and creates a spherical
# surface in it.
sf_play(“sphere.ses”)

# Get the number of lights posted to the graphics window


i_return_value = @
ga_light_nposted_get @
( i_nlights )
dump i_return_value
dump i_nlights
Main Index
CHAPTER 4 687
Graphics

sys_allocate_array(sav_light_list,1,i_nlights)

# Get the list of lights


i_return_value = @
ga_light_posted_get @
( sav_light_list )
dump i_return_value
dump sav_light_list

# Get the color of the first light posted


s_name = sav_light_list(1)
i_return_value = @
ga_light_color_get @
( s_name, @
i_old_value )
dump i_return_value
dump i_old_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Set the color of the first light posted


i_value = 1
i_return_value = @
ga_light_color_set @
( s_name, @
i_value )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Set the color of the light to original value


i_value = i_old_value
i_return_value = @
ga_light_color_set @
( s_name, @
i_value )
dump i_return_value

sys_free_array(sav_light_list)
#---------------------------------------------------------------------

ga_light_create ()

# Purpose : This file provides an example of a call to the


# function ga_light_create()
#
# This function is used to create a light source.
#
# Make “sphere.ses” available in the current
# directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_light_create()
# has the following arguments:
#
# ga_light_create
# ( name )
#
Main Index
688
Code Examples

#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_nlights,i_return_value
STRING s_name[32],sav_light_list[32](VIRTUAL)
#---------------------------------------------------------------------
# The file “sphere.ses” opens a new database and creates a spherical
# surface in it.
sf_play(“sphere.ses”)

# Create a new light source


s_name=”directional_new”
i_return_value = @
ga_light_create @
( s_name )
dump i_return_value

# Get the number of lights present in the databases


i_return_value = @
ga_light_nlights_get @
( i_nlights )
dump i_return_value
dump i_nlights

sys_allocate_array(sav_light_list,1,i_nlights)

# Get the list of lights


i_return_value = @
ga_light_lights_get @
( sav_light_list )
dump i_return_value
dump sav_light_list

# Session file paused. Press “Resume” to continue..


sf_pause()

# Delete the new light source


s_name=”directional_new”
i_return_value = @
ga_light_delete @
( s_name )
dump i_return_value

sys_free_array(sav_light_list)
#---------------------------------------------------------------------

ga_light_delete ()

# Purpose : This file provides an example of a call to the


# function ga_light_delete()
#
# This function is used to delete a light source.
#
# Make “sphere.ses” available in the current
# directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_light_delete()
# has the following arguments:
#
# ga_light_delete
# ( name )
Main Index
CHAPTER 4 689
Graphics

#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_nlights,i_return_value
STRING s_name[32],sav_light_list[32](VIRTUAL)
#---------------------------------------------------------------------
# The file “sphere.ses” opens a new database and creates a spherical
# surface in it.
sf_play(“sphere.ses”)

# Create a new light source


s_name=”directional_new”
i_return_value = @
ga_light_create @
( s_name )
dump i_return_value

# Get the number of lights present in the databases


i_return_value = @
ga_light_nlights_get @
( i_nlights )
dump i_return_value
dump i_nlights

sys_allocate_array(sav_light_list,1,i_nlights)

# Get the list of lights


i_return_value = @
ga_light_lights_get @
( sav_light_list )
dump i_return_value
dump sav_light_list

# Delete the light source


s_name=”directional_new”
i_return_value = @
ga_light_delete @
( s_name )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Get the list of lights


i_return_value = @
ga_light_lights_get @
( sav_light_list )
dump i_return_value
dump sav_light_list

sys_free_array(sav_light_list)
#---------------------------------------------------------------------

ga_light_direction_get ()

# Purpose : This file provides an example of two calls to


# the function ga_light_direction_get()
#
# This function is used to get the direction
# of light.
#
# Make “sphere.ses” available in the current
# directory.
#
# This file can be run by starting a session of
Main Index
690
Code Examples

# MSC.Patran, and running this session file


# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_light_direction_get()
# has the following arguments:
#
# ga_light_direction_get
# ( name,
# value )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32],sav_light_list[32](VIRTUAL)
REAL ra_value(3)
INTEGER i_nlights,i_return_value
#---------------------------------------------------------------------
# The file “sphere.ses” opens a new database and creates a spherical
# surface in it.
sf_play(“sphere.ses”)

# Get the number of lights posted to the graphics window


i_return_value = @
ga_light_nposted_get @
( i_nlights )
dump i_return_value
dump i_nlights

sys_allocate_array(sav_light_list,1,i_nlights)

# Get the list of lights


i_return_value = @
ga_light_posted_get @
( sav_light_list )
dump i_return_value
dump sav_light_list

# Get the direction of the first light posted


s_name = sav_light_list(1)
i_return_value = @
ga_light_direction_get @
( s_name, @
ra_value )
dump i_return_value
dump ra_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Get the direction of the second light posted


s_name = sav_light_list(2)
i_return_value = @
ga_light_direction_get @
( s_name, @
ra_value )
dump i_return_value
dump ra_value

sys_free_array(sav_light_list)
#---------------------------------------------------------------------

Main Index
CHAPTER 4 691
Graphics

ga_light_direction_set ()

# Purpose : This file provides an example of two calls


# to the function ga_range_rename()
#
# This function is used to set the direction
# of light.
#
# Make “sphere.ses” available in the current
# directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_light_direction_set()
# has the following arguments:
#
# ga_light_direction_set
# ( name,
# value )
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32],sav_light_list[32](VIRTUAL)
REAL ra_value(3),ra_old_value(3)
INTEGER i_nlights,i_return_value
#---------------------------------------------------------------------
# The file “sphere.ses” opens a new database and creates a spherical
# surface in it.
sf_play(“sphere.ses”)

# Get the number of lights posted to the graphics window


i_return_value = @
ga_light_nposted_get @
( i_nlights )
dump i_return_value
dump i_nlights

sys_allocate_array(sav_light_list,1,i_nlights)

# Get the list of lights


i_return_value = @
ga_light_posted_get @
( sav_light_list )
dump i_return_value
dump sav_light_list

# Get the direction of the first light posted


s_name = sav_light_list(1)
i_return_value = @
ga_light_direction_get @
( s_name, @
ra_old_value )
dump i_return_value
dump ra_old_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Set the direction of the first light posted


ra_value = [1.,-1.,1.]
i_return_value = @
ga_light_direction_set @
( s_name, @
Main Index
692
Code Examples

ra_value )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Set the direction to original value


i_return_value = @
ga_light_direction_set @
( s_name, @
ra_old_value)
dump i_return_value

sys_free_array(sav_light_list)
#---------------------------------------------------------------------

ga_light_icon_get ()

# Purpose : This file provides an example of a call to the


# function ga_light_icon_get()
#
# This function is used to get the light icon
# display status.
#
# Make “sphere.ses” available in the current
# directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_light_icon_get()
# has the following arguments:
#
# ga_light_icon_get
# ( name,
# value )
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32],sav_light_list[32](VIRTUAL)
INTEGER i_value,i_nlights,i_return_value
#---------------------------------------------------------------------
# The file “sphere.ses” opens a new database and creates a spherical
# surface in it.
sf_play(“sphere.ses”)

# Get the number of lights posted to the graphics window


i_return_value = @
ga_light_nposted_get @
( i_nlights )
dump i_return_value
dump i_nlights

sys_allocate_array(sav_light_list,1,i_nlights)

# Get the list of posted lights


i_return_value = @
ga_light_posted_get @
( sav_light_list )
dump i_return_value
dump sav_light_list

# Get icon display status of the first light posted


s_name = sav_light_list(1)
Main Index
CHAPTER 4 693
Graphics

i_return_value = @
ga_light_icon_get @
( s_name, @
i_value )
dump i_return_value
dump i_value

sys_free_array(sav_light_list)
#---------------------------------------------------------------------

ga_light_icon_set ()

# Purpose : This file provides an example of two calls


# to the function ga_range_rename()
#
# This function is used to set the light icon
# display status.
#
# Make “sphere.ses” available in the current
# directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_light_icon_set()
# has the following arguments:
#
# ga_light_icon_set
# ( name,
# value )
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32],sav_light_list[32](VIRTUAL)
INTEGER i_value,i_old_value,i_nlights,i_return_value
#---------------------------------------------------------------------
# The file “sphere.ses” opens a new database and creates a spherical
# surface in it.
sf_play(“sphere.ses”)

# Get the number of lights posted to the graphics window


i_return_value = @
ga_light_nposted_get @
( i_nlights )
dump i_return_value
dump i_nlights
sys_allocate_array(sav_light_list,1,i_nlights)

# Get the list of the posted lights


i_return_value = @
ga_light_posted_get @
( sav_light_list )
dump i_return_value
dump sav_light_list

# Get the icon display status of the first light posted


s_name = sav_light_list(1)
i_return_value = @
ga_light_icon_get @
( s_name, @
i_old_value )
dump i_return_value
dump i_old_value
Main Index
694
Code Examples

# Session file paused. Press “Resume” to continue..


sf_pause()

# Set the icon display status ON


i_value = 1
i_return_value = @
ga_light_icon_set @
( s_name, @
i_value )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Set the icon display status to original value


i_value = i_old_value
i_return_value = @
ga_light_icon_set @
( s_name, @
i_value )
dump i_return_value

sys_free_array(sav_light_list)
#---------------------------------------------------------------------

ga_light_intensity_get ()

# Purpose : This file provides an example of a call to the


# function ga_light_intensity_get()
#
# This function is used to get the intensity
# of light.
#
# Make “sphere.ses” available in the current
# directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_light_intensity_get()
# has the following arguments:
#
# ga_light_intensity_get
# ( name,
# value )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32],sav_light_list[32](VIRTUAL)
REAL r_value
INTEGER i_nlights,i_return_value
#---------------------------------------------------------------------
# The file “sphere.ses” opens a new database and creates a spherical
# surface in it.
sf_play(“sphere.ses”)

# Get the number of lights posted to the graphics window


i_return_value = @
ga_light_nposted_get @
( i_nlights )
dump i_return_value
dump i_nlights
Main Index
CHAPTER 4 695
Graphics

sys_allocate_array(sav_light_list,1,i_nlights)

# Get the list of lights


i_return_value = @
ga_light_posted_get @
( sav_light_list )
dump i_return_value
dump sav_light_list

# Get the intensity of the first light posted


s_name = sav_light_list(1)
i_return_value = @
ga_light_intensity_get @
( s_name, @
r_value )
dump i_return_value
dump r_value

sys_free_array(sav_light_list)
#---------------------------------------------------------------------

ga_light_intensity_set ()

# Purpose : This file provides an example of two calls


# to the function ga_range_rename()
#
# This function is used to set the intensity
# of light.
#
# Make “sphere.ses” available in the current
# directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_light_intensity_set()
# has the following arguments:
#
# ga_light_intensity_set
# ( name,
# value )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32],sav_light_list[32](VIRTUAL)
REAL r_value,r_old_value
INTEGER i_nlights,i_return_value
#---------------------------------------------------------------------
# The file “sphere.ses” opens a new database and creates a spherical
# surface in it.
sf_play(“sphere.ses”)

# Get the number of lights posted to the graphics window


i_return_value = @
ga_light_nposted_get @
( i_nlights )
dump i_return_value
dump i_nlights

sys_allocate_array(sav_light_list,1,i_nlights)

# Get the list of posted lights


i_return_value = @
Main Index
696
Code Examples

ga_light_posted_get @
( sav_light_list )
dump i_return_value
dump sav_light_list

# Get the intensity of the first light posted


s_name = sav_light_list(1)
i_return_value = @
ga_light_intensity_get @
( s_name, @
r_old_value )
dump i_return_value
dump r_old_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Set the intensity of the first light posted


r_value = 0.5
i_return_value = @
ga_light_intensity_set @
( s_name, @
r_value )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Set the intensity back to original value


r_value =r_old_value
i_return_value = @
ga_light_intensity_set @
( s_name, @
r_value )
dump i_return_value

sys_free_array(sav_light_list)
#---------------------------------------------------------------------

ga_light_lights_get ()

# Purpose : This file provides an example of a call to the


# function ga_light_lights_get()
#
# This example is used to get the list of names
# od lights present in the database.
#
# Make “sphere.ses” available in the current
# directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_light_lights_get()
# has the following arguments:
#
# ga_light_lights_get
# ( light_list )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING sav_light_list[32](VIRTUAL)
INTEGER i_nlights
Main Index
CHAPTER 4 697
Graphics

INTEGER i_return_value
#---------------------------------------------------------------------
# The file “sphere.ses” opens a new database and creates a spherical
# surface in it.
sf_play(“sphere.ses”)

# Get the number of lights present in the databases


i_return_value = @
ga_light_nlights_get @
( i_nlights )
dump i_return_value
dump i_nlights

sys_allocate_array(sav_light_list,1,i_nlights)

# Get the list of lights


i_return_value = @
ga_light_lights_get @
( sav_light_list )
dump i_return_value
dump sav_light_list

sys_free_array(sav_light_list)
#---------------------------------------------------------------------

ga_light_location_get ()

# Purpose : This file provides an example of a call to the


# function ga_light_location_get()
#
# This function is used to get the location
# of a light.
#
# Make “sphere.ses” available in the current
# directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_light_location_get()
# has the following arguments:
#
# ga_light_location_get
# ( name,
# value )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32],sav_light_list[32](VIRTUAL)
REAL ra_value(3)
INTEGER i_nlights,i_return_value
#---------------------------------------------------------------------
# The file “sphere.ses” opens a new database and creates a spherical
# surface in it.
sf_play(“sphere.ses”)

# Get the number of lights posted to the graphics window


i_return_value = @
ga_light_nposted_get @
( i_nlights )
dump i_return_value
dump i_nlights
Main Index
698
Code Examples

sys_allocate_array(sav_light_list,1,i_nlights)

# Get the list of posted lights


i_return_value = @
ga_light_posted_get @
( sav_light_list )
dump i_return_value
dump sav_light_list

# Get the location of the first light posted


s_name = sav_light_list(1)
i_return_value = @
ga_light_location_get @
( s_name, @
ra_value )
dump i_return_value
dump ra_value

sys_free_array(sav_light_list)
#---------------------------------------------------------------------

ga_light_location_set ()

# Purpose : This file provides an example of two calls


# to the function ga_range_rename()
#
# This function is used to set the location
# of a light.
#
# Make “sphere.ses” available in the current
# directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_light_location_set()
# has the following arguments:
#
# ga_light_location_set
# ( name,
# value )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32],sav_light_list[32](VIRTUAL)
REAL ra_value(3),ra_old_value(3)
INTEGER i_nlights,i_return_value
#---------------------------------------------------------------------
# The file “sphere.ses” opens a new database and creates a spherical
# surface in it.
sf_play(“sphere.ses”)

# Get the number of lights posted to the graphics window


i_return_value = @
ga_light_nposted_get @
( i_nlights )
dump i_return_value
dump i_nlights

sys_allocate_array(sav_light_list,1,i_nlights)

# Get the list of posted lights


i_return_value = @
Main Index
CHAPTER 4 699
Graphics

ga_light_posted_get @
( sav_light_list )
dump i_return_value
dump sav_light_list

# Get the location of the first light posted


s_name = sav_light_list(1)
i_return_value = @
ga_light_location_get @
( s_name, @
ra_old_value )
dump i_return_value
dump ra_old_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Set the location of the first light posted


ra_value = [1.,-1.,1.]
i_return_value = @
ga_light_location_set @
( s_name, @
ra_value )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Set the location to original value


ra_value =ra_old_value
i_return_value = @
ga_light_location_set @
( s_name, @
ra_value )
dump i_return_value

sys_free_array(sav_light_list)
#---------------------------------------------------------------------

ga_light_movement_get ()

# Purpose : This file provides an example of a call to the


# function ga_light_movement_get()
#
# This function is used to get the movement
# status of light.
#
# Make “sphere.ses” available in the current
# directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_light_movement_get()
# has the following arguments:
#
# ga_light_movement_get
# ( name,
# value )
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32],sav_light_list[32](VIRTUAL)
INTEGER i_value,i_nlights,i_return_value
Main Index
700
Code Examples

#---------------------------------------------------------------------
# The file “sphere.ses” opens a new database and creates a spherical
# surface in it.
sf_play(“sphere.ses”)

# Get the number of lights posted to the graphics window


i_return_value = @
ga_light_nposted_get @
( i_nlights )
dump i_return_value
dump i_nlights

sys_allocate_array(sav_light_list,1,i_nlights)

# Get the list of lights


i_return_value = @
ga_light_posted_get @
( sav_light_list )
dump i_return_value
dump sav_light_list

# Get movement status of the first posted light


s_name = sav_light_list(1)
i_return_value = @
ga_light_movement_get @
( s_name, @
i_value )
dump i_return_value
dump i_value

sys_free_array(sav_light_list)
#---------------------------------------------------------------------

ga_light_movement_set ()

# Purpose : This file provides an example of three calls


# to the function ga_range_rename()
#
# This function is used to set the movement
# status of light.
#
# Make “sphere.ses” available in the current
# directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_light_movement_set()
# has the following arguments:
#
# ga_light_movement_set
# ( name,
# value )
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32],sav_light_list[32](VIRTUAL)
INTEGER i_value,i_old_value,i_nlights,i_return_value
#---------------------------------------------------------------------
# The file “sphere.ses” opens a new database and creates a spherical
# surface in it.
sf_play(“sphere.ses”)

# Get the number of lights posted to the graphics window


Main Index
CHAPTER 4 701
Graphics

i_return_value = @
ga_light_nposted_get @
( i_nlights )
dump i_return_value
dump i_nlights

sys_allocate_array(sav_light_list,1,i_nlights)

# Get the list of lights


i_return_value = @
ga_light_posted_get @
( sav_light_list )
dump i_return_value
dump sav_light_list

# Get the movement status for the first light posted


s_name = sav_light_list(1)
i_return_value = @
ga_light_movement_get @
( s_name, @
i_old_value )
dump i_return_value
dump i_old_value

# Set the movement status to OFF


i_value = 0
i_return_value = @
ga_light_movement_set @
( s_name, @
i_value )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

ga_view_aa_set(-157.,34.,0.)

# Session file paused. Press “Resume” to continue..


sf_pause()

ga_view_aa_set(23.,-34.,0.)

# Session file paused. Press “Resume” to continue..


sf_pause()

# Set the movement status to ON


i_value = 1
i_return_value = @
ga_light_movement_set @
( s_name, @
i_value )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

ga_view_aa_set(-157.,34.,0.)

# Session file paused. Press “Resume” to continue..


sf_pause()

ga_view_aa_set(23.,-34.,0.)

# Session file paused. Press “Resume” to continue..


sf_pause()

# Set the movement status back to old value


Main Index
702
Code Examples

i_value = i_old_value
i_return_value = @
ga_light_movement_set @
( s_name, @
i_value )
dump i_return_value

sys_free_array(sav_light_list)
#---------------------------------------------------------------------

ga_light_nlights_get ()

# Purpose : This file provides an example of a call to the


# function ga_light_nlights_get()
#
# This function is used to get the number of
# lights present in the database.
#
# Make “sphere.ses” available in the current
# directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_light_nlights_get()
# has the following arguments:
#
# ga_light_nlights_get
# ( nlights )
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_nlights
INTEGER i_return_value
#---------------------------------------------------------------------
# The file “sphere.ses” opens a new database and creates a spherical
# surface in it.
sf_play(“sphere.ses”)

# Get the number of lights present in the database


i_return_value = @
ga_light_nlights_get @
( i_nlights )
dump i_return_value
dump i_nlights
#---------------------------------------------------------------------

ga_light_nposted_get ()

# Purpose : This file provides an example of a call to the


# function ga_light_nposted_get()
#
# This function is used to get the number of
# lights posted to the graphics window.
#
# Make “sphere.ses” available in the current
# directory.
#
# 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.
Main Index
CHAPTER 4 703
Graphics

#
# The function ga_light_nposted_get()
# has the following arguments:
#
# ga_light_nposted_get
# ( nlights )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_nlights
INTEGER i_return_value
#---------------------------------------------------------------------
# The file “sphere.ses” opens a new database and creates a spherical
# surface in it.
sf_play(“sphere.ses”)

# Get the number of lights posted to the graphics window


i_return_value = @
ga_light_nposted_get @
( i_nlights )
dump i_return_value
dump i_nlights
#---------------------------------------------------------------------

ga_light_post ()

# Purpose : This file provides an example of a call to the


# function ga_light_post()
#
# This function is used to post a light source
# to the graphics window.
#
# Make “sphere.ses” available in the current
# directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_light_post()
# has the following arguments:
#
# ga_light_post
# ( name )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_return_value
REAL r_loc(3),r_dir(3),r_int,r_att
INTEGER i_clr,i_move
STRING s_name[32],s_type[32]
#---------------------------------------------------------------------
# The file “sphere.ses” opens a new database and creates a spherical
# surface in it.
sf_play(“sphere.ses”)

# Create a new light source


s_name=”directional_new”
i_return_value = @
ga_light_create @
( s_name )
dump i_return_value

# Initialise attributes of the new light


Main Index
704
Code Examples

# r_loc=[1.,-1.,1.] : location [x,y,z]


# r_dir=[1.,-1.,-1.] : direction
# r_int= 0.8 : Intensity (0.0-1.0)
# r_att= 0.0 : No Attenuation
# s_type = “directional” : Directional
# i_clr = 5 : color
# i_move = 0 : Don’t move with
# : model
r_loc=[1.,-1.,1.]
r_dir=[1.,-1.,-1.]
r_int= 0.8
r_att= 0.0
s_type = “directional”
i_clr = 5
i_move = 0

s_name=”directional_new”
ga_light_location_set(s_name,r_loc)
ga_light_direction_set(s_name,r_dir)
ga_light_attenuation_set(s_name,r_att)
ga_light_intensity_set(s_name,r_int)
ga_light_color_set(s_name,i_clr)
ga_light_movement_set(s_name,i_move)
ga_light_type_set(s_name,s_type)

i_return_value = @
ga_light_post @
( s_name )
dump i_return_value

# Paused. Press resume to continue.


sf_pause()

# Unpost the light


i_return_value = @
ga_light_unpost @
( s_name )
dump i_return_value

# Delete the new light source


s_name=”directional_new”
i_return_value = @
ga_light_delete @
( s_name )
dump i_return_value
#---------------------------------------------------------------------

ga_light_posted_get ()

# Purpose : This file provides an example of a call to the


# function ga_light_posted_get()
#
# This example is used to get the list of names
# of lights posted to the graphics window.
#
# Make “sphere.ses” available in the current
# directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_light_posted_get()
# has the following arguments:
Main Index
CHAPTER 4 705
Graphics

#
# ga_light_posted_get
# ( light_list )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING sav_light_list[32](VIRTUAL)
INTEGER i_nlights
INTEGER i_return_value
#---------------------------------------------------------------------
# The file “sphere.ses” opens a new database and creates a spherical
# surface in it.
sf_play(“sphere.ses”)

# Get the number of lights posted to the graphics window


i_return_value = @
ga_light_nposted_get @
( i_nlights )
dump i_return_value
dump i_nlights
sys_allocate_array(sav_light_list,1,i_nlights)

# Get the list of posted lights


i_return_value = @
ga_light_posted_get @
( sav_light_list )
dump i_return_value
dump sav_light_list

sys_free_array(sav_light_list)
#---------------------------------------------------------------------

ga_light_type_get ()

# Purpose : This file provides an example of two calls to


# the function ga_light_type_get()
#
# This function is used to get the type
# of light source.
#
# Make “sphere.ses” available in the current
# directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_light_type_get()
# has the following arguments:
#
# ga_light_type_get
# ( name,
# value )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32],sav_light_list[32](VIRTUAL)
STRING s_value[32]
INTEGER i_nlights,i_return_value
#---------------------------------------------------------------------
# The file “sphere.ses” opens a new database and creates a spherical
# surface in it.
sf_play(“sphere.ses”)
Main Index
706
Code Examples

# Get the number of lights posted to the graphics window


i_return_value = @
ga_light_nposted_get @
( i_nlights )
dump i_return_value
dump i_nlights

sys_allocate_array(sav_light_list,1,i_nlights)

# Get the list of posted lights


i_return_value = @
ga_light_posted_get @
( sav_light_list )
dump i_return_value
dump sav_light_list

# Get the type of first posted light source


s_name = sav_light_list(1)
i_return_value = @
ga_light_type_get @
( s_name, @
s_value )
dump i_return_value
dump s_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Get the type of second posted light source


s_name = sav_light_list(2)
i_return_value = @
ga_light_type_get @
( s_name, @
s_value )
dump i_return_value
dump s_value

sys_free_array(sav_light_list)
#---------------------------------------------------------------------

ga_light_type_set ()

# Purpose : This file provides an example of two calls


# to the function ga_range_rename()
#
# This function is used to set the type
# of light.
#
# Make “sphere.ses” available in the current
# directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_light_type_set()
# has the following arguments:
#
# ga_light_type_set
# ( name,
# value )
#
#---------------------------------------------------------------------
# Variable Declarations
Main Index
CHAPTER 4 707
Graphics

STRING s_name[32],sav_light_list[32](VIRTUAL)
STRING s_value[32],s_old_value[32]
INTEGER i_nlights,i_return_value
#---------------------------------------------------------------------
# The file “sphere.ses” opens a new database and creates a spherical
# surface in it.
sf_play(“sphere.ses”)

# Get the number of lights posted to the graphics window


i_return_value = @
ga_light_nposted_get @
( i_nlights )
dump i_return_value
dump i_nlights

sys_allocate_array(sav_light_list,1,i_nlights)

# Get the list of posted lights


i_return_value = @
ga_light_posted_get @
( sav_light_list )
dump i_return_value
dump sav_light_list

# Get the type of the first posted light source


s_name = sav_light_list(1)
i_return_value = @
ga_light_type_get @
( s_name, @
s_old_value )
dump i_return_value
dump s_old_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Set the type of the first light source to “AMBIENT”


s_value = “AMBIENT”
i_return_value = @
ga_light_type_set @
( s_name, @
s_value )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Set the type back to original value


s_value = s_old_value
i_return_value = @
ga_light_type_set @
( s_name, @
s_value )
dump i_return_value

sys_free_array(sav_light_list)
#---------------------------------------------------------------------

ga_light_unpost ()

# Purpose : This file provides an example of a call to the


# function ga_light_unpost()
#
# This function is used to unpost a posted
# light source.
Main Index
708
Code Examples

#
# Make “sphere.ses” available in the current
# directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_light_unpost()
# has the following arguments:
#
# ga_light_unpost
# ( name )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_return_value
REAL r_loc(3),r_dir(3),r_int,r_att
INTEGER i_clr,i_move
STRING s_name[32],s_type[32]
#---------------------------------------------------------------------
# The file “sphere.ses” opens a new database and creates a spherical
# surface in it.
sf_play(“sphere.ses”)

# Create a new light source


s_name=”directional_new”
i_return_value = @
ga_light_create @
( s_name )
dump i_return_value

# Initialise attributes
# r_loc=[1.,-1.,1.] : location [x,y,z]
# r_dir=[1.,-1.,-1.] : direction
# r_int= 0.8 : Intensity (0.0-1.0)
# r_att= 0.0 : No Attenuation
# s_type = “DIRECTIONAL” : Directional
# i_clr = 5 : color
# i_move = 0 : Don’t move with
# : model
r_loc=[1.,-1.,1.]
r_dir=[1.,-1.,-1.]
r_int= 0.8
r_att= 0.0
s_type = “DIRECTIONAL”
i_clr = 5
i_move = 0

s_name=”directional_new”
ga_light_location_set(s_name,r_loc)
ga_light_direction_set(s_name,r_dir)
ga_light_attenuation_set(s_name,r_att)
ga_light_intensity_set(s_name,r_int)
ga_light_color_set(s_name,i_clr)
ga_light_movement_set(s_name,i_move)
ga_light_type_set(s_name,s_type)

i_return_value = @
ga_light_post @
( s_name )
dump i_return_value

# Paused. Press resume to continue.


sf_pause()
Main Index
CHAPTER 4 709
Graphics

# Unpost the new light source


i_return_value = @
ga_light_unpost @
( s_name )
dump i_return_value

# Delete the new light source


s_name=”directional_new”
i_return_value = @
ga_light_delete @
( s_name )
dump i_return_value
#---------------------------------------------------------------------

ga_lookup_colors_get ()

# Purpose : This file provides an example of a call to the


# function ga_lookup_colors_get()
#
# This function is used to get the RGB components
# of the colors in a lookup table(LUT).
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_lookup_colors_get() has the following arguments:
# ga_lookup_colors_get
# ( name,
# rgb )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
REAL ra_rgb(VIRTUAL)
INTEGER i_number,i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Get the current color lookup table


i_return_value = @
ga_lookup_current_get @
( s_name )
dump s_name

# Get the number of colors defined in the current lookup table


i_return_value = @
ga_lookup_ncolors_get @
( s_name, @
i_number )
dump i_number

SYS_ALLOCATE_ARRAY(ra_rgb,1,i_number,1,3)

# Get the RGB components of the colors in the current lookup table
i_return_value = @
ga_lookup_colors_get @
( s_name, @
ra_rgb )
dump i_return_value
Main Index
710
Code Examples

dump ra_rgb

SYS_FREE_ARRAY(ra_rgb)

# Session file paused. Press “Resume” to continue..


sf_pause()

# Close the database “spool.db”


uil_file_close.go()
#---------------------------------------------------------------------

ga_lookup_colors_set ()

# Purpose : This file provides two examples to the


# function ga_lookup_colors_set()
#
# This function is used to set the RGB components
# of the colors in a lookup table.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_lookup_colors_set()
# has the following arguments:
#
# ga_lookup_colors_set
# ( name,
# offset,
# number,
# rgb )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
REAL ra_rgb(VIRTUAL)
INTEGER i_offset,i_number
INTEGER i_index,i_comp
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Get the current color lookup table


i_return_value = @
ga_lookup_current_get @
( s_name )

# Get the number of colors defined in the current lookup table


i_return_value = @
ga_lookup_ncolors_get @
( s_name, @
i_number )
dump i_number

SYS_ALLOCATE_ARRAY(ra_rgb,1,i_number,1,3)

# Get the RGB components of the colors in the current lookup table
i_return_value = @
ga_lookup_colors_get @
( s_name, @
Main Index
CHAPTER 4 711
Graphics

ra_rgb )
dump i_return_value
dump ra_rgb

# Reverse the colors in the lookup table


FOR(i_comp = 1 to 3)
FOR(i_index=1 to i_number)
ra_rgb(i_index,i_comp)= 1 - ra_rgb(i_index,i_comp)
END FOR
END FOR
dump ra_rgb

# Set the RGB components of the colors in the current lookup table
i_offset = 0
i_return_value = @
ga_lookup_colors_set @
( s_name, @
i_offset, @
i_number, @
ra_rgb )
dump i_return_value

# Get the RGB components of the colors in the current lookup table
i_return_value = @
ga_lookup_colors_get @
( s_name, @
ra_rgb )
dump i_return_value
dump ra_rgb

# Session file paused. Press “Resume” to continue..


sf_pause()

# Reverse the colors in the lookup table


FOR(i_comp = 1 to 3)
FOR(i_index=1 to i_number)
ra_rgb(i_index,i_comp)= 1 - ra_rgb(i_index,i_comp)
END FOR
END FOR
dump ra_rgb

# Reset the RGB components of the colors in the current lookup table
i_offset =0
i_return_value = @
ga_lookup_colors_set @
( s_name, @
i_offset, @
i_number, @
ra_rgb )
dump i_return_value

SYS_FREE_ARRAY(ra_rgb)

# Session file paused. Press “Resume” to continue..


sf_pause()

# Close the database “spool.db”


uil_file_close.go()
#---------------------------------------------------------------------

Main Index
712
Code Examples

ga_lookup_create ()

# Purpose : This file provides an example of a call to the


# function ga_lookup_create()
#
# This function is used to create a new color
# lookup table
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_lookup_create()
# has the following arguments:
#
# ga_lookup_create
# ( name,
# number,
# rgb )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32],s_old_name[32]
INTEGER i_number
REAL ra_rgb(8,3)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Get the current color lookup table


i_return_value = @
ga_lookup_current_get @
( s_old_name )

# Create a new color lookup table


s_name = “new_8colors”
i_number = 8
ra_rgb = [ @
[0.0, 0.0, 0.0] [1.0, 0.0, 0.0] [0.0, 1.0, 0.0] [0.0, 0.0, 1.0] @
[1.0, 1.0, 0.0] [0.0, 1.0, 1.0] [1.0, 0.0, 1.0] [1.0, 1.0, 1.0] ]

i_return_value = @
ga_lookup_create @
( s_name, @
i_number, @
ra_rgb )
dump i_return_value

# Set the new color lookup table


i_return_value = @
ga_lookup_current_set @
( s_name )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Set the old color lookup table


i_return_value = @
ga_lookup_current_set @
Main Index
CHAPTER 4 713
Graphics

( s_old_name )
dump i_return_value

# Delete the created color table


i_return_value = @
ga_lookup_delete @
( s_name )
dump i_return_value

# Close the database “spool.db”


uil_file_close.go()
#---------------------------------------------------------------------

ga_lookup_current_get ()

# Purpose : This file provides an example of a call to the


# function ga_lookup_current_get()
#
# This function is used to get the current color
# lookup table.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_lookup_current_get()
# has the following arguments:
#
# ga_lookup_current_get
# ( name )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Get the current color lookup table


i_return_value = @
ga_lookup_current_get @
( s_name )
dump i_return_value
dump s_name

# Session file paused. Press “Resume” to continue..


sf_pause()

# Close the database “spool.db”


uil_file_close.go()
#---------------------------------------------------------------------

Main Index
714
Code Examples

ga_lookup_current_set ()

# Purpose : This file provides an example of a call to the


# function ga_lookup_current_set()
#
# This function is used to set the current
# color lookup table
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_lookup_current_set()
# has the following arguments:
#
# ga_lookup_current_set
# ( name )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32],s_old_name[32]
INTEGER i_number
REAL ra_rgb(8,3)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Get the current color lookup table


i_return_value = @
ga_lookup_current_get @
( s_old_name )

# Create a new color lookup table


s_name = “new_8colors”
i_number = 8
ra_rgb = [ @
[0.0, 0.0, 0.0] [1.0, 0.0, 0.0] [0.0, 1.0, 0.0] [0.0, 0.0, 1.0] @
[1.0, 1.0, 0.0] [0.0, 1.0, 1.0] [1.0, 0.0, 1.0] [1.0, 1.0, 1.0] ]

i_return_value = @
ga_lookup_create @
( s_name, @
i_number, @
ra_rgb )
dump i_return_value

# Set the new color lookup table


i_return_value = @
ga_lookup_current_set @
( s_name )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Set the old color lookup table


i_return_value = @
ga_lookup_current_set @
( s_old_name )
dump i_return_value
Main Index
CHAPTER 4 715
Graphics

# Delete the created color table


i_return_value = @
ga_lookup_delete @
( s_name )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Close the database “spool.db”


uil_file_close.go()
#---------------------------------------------------------------------

ga_lookup_delete ()

# Purpose : This file provides an example of a call to the


# function ga_lookup_delete()
#
# This function is used to delete a color
# lookup table
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_lookup_delete()
# has the following arguments:
#
# ga_lookup_delete
# ( name )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32],s_old_name[32]
INTEGER i_number
REAL ra_rgb(8,3)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Get the current color lookup table


i_return_value = @
ga_lookup_current_get @
( s_old_name )

# Create a new color lookup table


s_name = “new_8colors”
i_number = 8
ra_rgb = [ @
[0.0, 0.0, 0.0] [1.0, 0.0, 0.0] [0.0, 1.0, 0.0] [0.0, 0.0, 1.0] @
[1.0, 1.0, 0.0] [0.0, 1.0, 1.0] [1.0, 0.0, 1.0] [1.0, 1.0, 1.0] ]

i_return_value = @
ga_lookup_create @
( s_name, @
i_number, @
ra_rgb )
dump i_return_value
Main Index
716
Code Examples

# Set the new color lookup table


i_return_value = @
ga_lookup_current_set @
( s_name )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Set the old color lookup table


i_return_value = @
ga_lookup_current_set @
( s_old_name )
dump i_return_value

# Delete the created color table


i_return_value = @
ga_lookup_delete @
( s_name )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Close the database “spool.db”


uil_file_close.go()
#---------------------------------------------------------------------

ga_lookup_ncolors_get ()

# Purpose : This file provides an example of a call to the


# function ga_lookup_ncolors_get()
#
# This function is used to get the number of
# colors defined in a color lookup table (LUT).
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_lookup_ncolors_get()
# has the following arguments:
#
# ga_lookup_ncolors_get
# ( name,
# number )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
INTEGER i_number
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Get the current color lookup table


i_return_value = @
ga_lookup_current_get @
( s_name )
dump i_return_value
Main Index
CHAPTER 4 717
Graphics

dump s_name

# Get the number of colors defined in the current lookup table


i_return_value = @
ga_lookup_ncolors_get @
( s_name, @
i_number )
dump i_return_value
dump i_number

# Session file paused. Press “Resume” to continue..


sf_pause()

# Close the database “spool.db”


uil_file_close.go()
#---------------------------------------------------------------------

ga_lookup_ntables_get ()

# Purpose : This file provides an example of a call to the


# function ga_lookup_ntables_get()
#
# This function is used to get the number of
# color lookup tables (LUTs) in the database.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_lookup_ntables_get()
# has the following arguments:
#
# ga_lookup_ntables_get
# ( ntables )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_ntables
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Get the number of lookup tables in the database


i_return_value = @
ga_lookup_ntables_get @
( i_ntables )
dump i_return_value
dump i_ntables

# Session file paused. Press “Resume” to continue..


sf_pause()

# Close the database “spool.db”


uil_file_close.go()
#---------------------------------------------------------------------

Main Index
718
Code Examples

ga_lookup_rename ()

# Purpose : This file provides two examples to the


# function ga_lookup_rename()
#
# This function is used to rename an existing
# color lookup table (LUT)
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_lookup_rename()
# has the following arguments:
#
# ga_lookup_rename
# ( old_name,
# new_name )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_old_name[32], s_new_name[32],s_name[32]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Get the current color lookup table


i_return_value = @
ga_lookup_current_get @
( s_name )
dump s_name

s_old_name = s_name
s_new_name = “New_LUT”

# Rename the current color lookup table


i_return_value = @
ga_lookup_rename @
( s_old_name, @
s_new_name )
dump i_return_value

# Get the current color lookup table


s_name = ““
i_return_value = @
ga_lookup_current_get @
( s_name )
dump s_name

# Restore the name of the current color lookup table


s_new_name = s_old_name
s_old_name = s_name

i_return_value = @
ga_lookup_rename @
( s_old_name, @
s_new_name )
dump i_return_value

# Get the current color lookup table


s_name = ““
i_return_value = @
Main Index
CHAPTER 4 719
Graphics

ga_lookup_current_get @
( s_name )
dump s_name

# Session file paused. Press “Resume” to continue..


sf_pause()

# Close the database “spool.db”


uil_file_close.go()
#---------------------------------------------------------------------

ga_lookup_tables_get ()

# Purpose : This file provides an example of a call to the


# function ga_lookup_tables_get()
#
# This function is used to get the list of
# color lookup tables (LUTs) in the database.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_lookup_tables_get()
# has the following arguments:
#
# ga_lookup_tables_get
# ( tables )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING sa_tables[32](VIRTUAL)
INTEGER i_ntables
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Get the number of LUTs present in the database


i_return_value = @
ga_lookup_ntables_get @
( i_ntables )

SYS_ALLOCATE_ARRAY(sa_tables,1,i_ntables)

# Get the list of LUTs present in the database


i_return_value = @
ga_lookup_tables_get @
( sa_tables )
dump i_return_value
dump sa_tables

SYS_FREE_ARRAY(sa_tables)

# Session file paused. Press “Resume” to continue..


sf_pause()

# Close the database “spool.db”


uil_file_close.go()
#---------------------------------------------------------------------

Main Index
720
Code Examples

ga_node_deform_create ()

# Purpose : This file provides an example of a call to the


# function ga_node_deform_create()
#
# This function creates a node deformation table.
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
#
# The function ga_node_deform_create()
# has the following arguments:
#
# ga_node_deform_create
# ( title,
# nbr_nodes,
# node_ids,
# deform,
# id )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_title[80]
INTEGER i_nbr_nodes
INTEGER i_ncases, iv_lcids(VIRTUAL),iv_nsub(VIRTUAL)
INTEGER iv_node_ids(VIRTUAL)
REAL rv_deform(VIRTUAL)
INTEGER i_dtype,ia_minloc(6),ia_maxloc(6), ia_resids(5)
INTEGER i_id
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db” and read the deformation results
sf_play(“spool_res_deform.ses”)

# Get the number of Load cases and their IDs


i_return_value = @
res_utl_get_loadcases(i_ncases,iv_lcids,iv_nsub)
dump i_return_value
dump i_ncases,iv_lcids,iv_nsub

# Extract the deformation results from the database


# Load case ID = iv_lcids(1)
# Sub case ID = 1
# Primary Result ID = 2 ( Corresponds to deformation )
# Secondary Result ID = 1
# Layer ID = 1
# node_list = “Node 1:#” (All nodes )
# derivation = ““
# coord_id = ““
ia_resids(1) = iv_lcids(1)
ia_resids(2) = 1
ia_resids(3) = 2
ia_resids(4) = 1
ia_resids(5) = 1
i_return_value = @
res_utl_extract_nodal_results(ia_resids,” Node 1:#”,””,””, @
i_dtype,i_nbr_nodes,iv_node_ids,rv_deform,ia_minloc,ia_maxloc)

Main Index
CHAPTER 4 721
Graphics

dump i_return_value

# Create a node deformation table


s_title =” Deformation Result”
i_return_value = @
ga_node_deform_create @
( s_title, @
i_nbr_nodes, @
iv_node_ids, @
rv_deform, @
i_id )
dump i_return_value, i_id

i_return_value = @
ga_group_node_deform_set @
( “fem_model”, @
i_id )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

sys_free_array(iv_node_ids)
sys_free_array(rv_deform)
sys_free_array(iv_lcids)
sys_free_array(iv_nsub)

# Close the database “spool.db”


uil_file_close.go()
#---------------------------------------------------------------------

ga_range_contour_get ()

# Purpose : This file provides an example of a call to the


# function ga_range_contour_get()
#
# In this file first the number of ranges and
# the list of ranges in the database are found.
# Then it is found whether the first range is
# will be displayed using contour values or
# fringe values (display type flag).
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
# Make “spool_res.ses” available in the current
# working directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_range_contour_get() has the following arguments:
#
# ga_range_contour_get
# ( name,
# flag )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
STRING sav_ranges[32](VIRTUAL)
INTEGER i_flag, i_nranges
INTEGER i_return_value
Main Index
722
Code Examples

#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)

# Get the number of ranges in the database


i_return_value = @
ga_range_nranges_get @
( i_nranges )
dump i_return_value

# Number of ranges
dump i_nranges

sys_allocate_array(sav_ranges,1,i_nranges)

# Get the list of ranges in the database


i_return_value = @
ga_range_ranges_get @
( sav_ranges )
dump i_return_value

# List of ranges
dump sav_ranges

# Get the display type flag of the first range


s_name = sav_ranges(1)
i_return_value = @
ga_range_contour_get @
( s_name, @
i_flag )
dump i_return_value

# Display type flag


# Flag = 1 if contour values are displayed
# Flag = 0 if fringe values are displayed
dump i_flag

# Session file paused. Press “Resume” to continue..


sf_pause()

# Close the database “spool.db”


uil_file_close.go()
sys_free_array(sav_ranges)
#---------------------------------------------------------------------

ga_range_contour_set ()

# Purpose : This file provides an example of two calls


# to the function ga_range_contour_set()
#
# In this file first the number of ranges and
# the list of ranges in the database are found.
# The display type flag( whether the range
# will be displayed using contour values or
# fringe values) of the first range is saved.
# It is set to display using contour values.
# It is inspected and the saved value is reset.
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
# Make “spool_res.ses” available in the current
# working directory.
#
# This file can be run by starting a session of
Main Index
CHAPTER 4 723
Graphics

# MSC.Patran, and running this session file


# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
#
# The function ga_range_contour_set() has the following arguments:
#
# ga_range_contour_set
# ( name,
# flag )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
STRING sav_ranges[32](VIRTUAL)
INTEGER i_flag, i_old_flag, i_nranges
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)

# Get the number of ranges in the database


i_return_value = @
ga_range_nranges_get @
( i_nranges )
dump i_return_value

# Number of ranges
dump i_nranges

sys_allocate_array(sav_ranges,1,i_nranges)

# Get the list of ranges in the database


i_return_value = @
ga_range_ranges_get @
( sav_ranges )
dump i_return_value

# List of ranges
dump sav_ranges

s_name = sav_ranges(1)

# Get the display type flag for the first range.


i_flag = 0
i_return_value = @
ga_range_contour_get @
( s_name, @
i_old_flag )
dump i_return_value, i_old_flag

# Toggle the display type flag for the first range.


i_flag = 1 - i_old_flag
i_return_value = @
ga_range_contour_set @
( s_name, @
i_flag )
dump i_return_value

# Get the display type flag for the first range.


i_flag = 0
i_return_value = @
ga_range_contour_get @
( s_name, @
i_flag )
dump i_return_value, i_flag
Main Index
724
Code Examples

# Session file paused. Press “Resume” to continue..


sf_pause()

# Set the old display type flag for the first range.
i_flag = i_old_flag
i_return_value = @
ga_range_contour_set @
( s_name, @
i_flag )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Close the database “spool.db”


uil_file_close.go()

sys_free_array(sav_ranges)
#---------------------------------------------------------------------

ga_range_create

# Purpose : This file provides an example of a call to the


# function ga_range_create()
#
# In this file a range is created and it’s
# sub-ranges are set using start and end values.
# The sub-range values are displayed and finally
# the range is deleted.
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
# Make “spool_res.ses” available in the current
# working directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_range_create() has the following arguments:
#
# ga_range_create
# ( name,
# number )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32],s_old_name[32]
STRING sav_ranges[32](VIRTUAL)
INTEGER i_nranges
INTEGER i_number
REAL r_start,r_end
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)

# Get the number of ranges in the database


i_return_value = @
ga_range_nranges_get @
( i_nranges )
dump i_return_value, i_nranges
Main Index
CHAPTER 4 725
Graphics

sys_allocate_array(sav_ranges,1,i_nranges)

# Get the list of ranges in the database


i_return_value = @
ga_range_ranges_get @
( sav_ranges )
dump i_return_value, sav_ranges

s_old_name = sav_ranges(1)

# Session file paused. Press “Resume” to continue..


sf_pause()

# Create a new range


s_name = “New Range”
i_number = 15
i_return_value = @
ga_range_create @
( s_name, @
i_number )
dump i_return_value

# Set the subranges using start and end values


r_start = 100000
r_end = 0
i_return_value = @
ga_range_startend_set @
( s_name, @
r_start, @
r_end )

# Post the range


ga_viewport_range_set(““,s_name)

# Session file paused. Press “Resume” to continue..


sf_pause()

# Get the number of ranges in the database


i_return_value = @
ga_range_nranges_get @
( i_nranges )
dump i_return_value, i_nranges

sys_free_array(sav_ranges)
sys_allocate_array(sav_ranges,1,i_nranges)

# Get the list of ranges in the database


i_return_value = @
ga_range_ranges_get @
( sav_ranges )
dump i_return_value, sav_ranges

# Session file paused. Press “Resume” to continue..


sf_pause()

# Post the old range


ga_viewport_range_set(““,s_old_name)

# Delete the range


i_return_value = @
ga_range_delete @
( s_name )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()
Main Index
726
Code Examples

# Close the database “spool.db”


uil_file_close.go()

sys_free_array(sav_ranges)
#---------------------------------------------------------------------

ga_range_delete ()

# Purpose : This file provides an example of a call to the


# function ga_range_delete()
#
# In this file a range is created and it’s
# sub-ranges are set using start and end values
# the sub-range values are displayed and finally
# the range is deleted.
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
# Make “spool_res.ses” available in the current
# working directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_range_delete() has the following arguments:
# ga_range_delete
# ( name )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32],s_old_name[32]
STRING sav_ranges[32](VIRTUAL)
INTEGER i_nranges
INTEGER i_number
REAL r_start,r_end
REAL ra_from(15),ra_to(15),ra_mid(15)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)

# Get the number of ranges in the database


i_return_value = @
ga_range_nranges_get @
( i_nranges )
dump i_return_value, i_nranges

sys_allocate_array(sav_ranges,1,i_nranges)

# Get the list of ranges in the database


i_return_value = @
ga_range_ranges_get @
( sav_ranges )
dump i_return_value, sav_ranges

s_old_name = sav_ranges(1)

# Create a new range


s_name = “New Range”
i_number = 15
i_return_value = @
ga_range_create @
Main Index
CHAPTER 4 727
Graphics

( s_name, @
i_number )
dump i_return_value

# Set the subranges using start and end values


r_start = 100000
r_end = 0
i_return_value = @
ga_range_startend_set @
( s_name, @
r_start, @
r_end )

# Post the range


ga_viewport_range_set(““,s_name)

# Session file paused. Press “Resume” to continue..


sf_pause()

# Get the number of ranges in the database


i_return_value = @
ga_range_nranges_get @
( i_nranges )
dump i_return_value, i_nranges

sys_free_array(sav_ranges)
sys_allocate_array(sav_ranges,1,i_nranges)

# Get the list of ranges in the database


i_return_value = @
ga_range_ranges_get @
( sav_ranges )
dump i_return_value, sav_ranges

# Session file paused. Press “Resume” to continue..


sf_pause()

# Post the old range


ga_viewport_range_set(““,s_old_name)

# Delete the new range


i_return_value = @
ga_range_delete @
( s_name )
dump i_return_value

# Get the list of ranges in the database


i_return_value = @
ga_range_ranges_get @
( sav_ranges )
dump i_return_value, sav_ranges

# Session file paused. Press “Resume” to continue..


sf_pause()

# Close the database “spool.db”


uil_file_close.go()

sys_free_array(sav_ranges)
#---------------------------------------------------------------------

Main Index
728
Code Examples

ga_range_exist_get ()

# Purpose : This file provides an example of two calls


# to the function ga_range_exist_get()
#
# In this file first the number of ranges and
# the list of ranges in the database are found.
# Then it is tested whether the first range is
# existing. Then a non existing name is passed
# and the return flag is checked.
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
# Make “spool_res.ses” available in the current
# working directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_range_exist_get()
# has the following arguments:
#
# ga_range_exist_get
# ( name,
# flag )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
INTEGER i_flag
STRING sav_ranges[32](VIRTUAL)
INTEGER i_nranges
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)

# Get the number of ranges in the database


i_return_value = @
ga_range_nranges_get @
( i_nranges )
dump i_return_value, i_nranges

sys_allocate_array(sav_ranges,1,i_nranges)

# Get the list of ranges in the database


i_return_value = @
ga_range_ranges_get @
( sav_ranges )
dump i_return_value, sav_ranges

# Check for the existence of the first range


s_name = sav_ranges(1)
i_return_value = @
ga_range_exist_get @
( s_name, @
i_flag )
dump i_return_value, i_flag

# Check for the existence of a non existing range


s_name = “Non existing range”
i_return_value = @
Main Index
CHAPTER 4 729
Graphics

ga_range_exist_get @
( s_name, @
i_flag )
dump i_return_value, i_flag

#---------------------------------------------------------------------

ga_range_nranges_get ()

# Purpose : This file provides an example of a call to the


# function ga_range_nranges_get()
#
# In this file the number of ranges in the
# database are found.
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
# Make “spool_res.ses” available in the current
# working directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_range_nranges_get()
# has the following arguments:
#
# ga_range_nranges_get
# ( nranges )
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_nranges
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)

# Get the number of ranges in the database


i_return_value = @
ga_range_nranges_get @
( i_nranges )
dump i_return_value, i_nranges

# Session file paused. Press “Resume” to continue..


sf_pause()

# Close the database “spool.db”


uil_file_close.go()
#---------------------------------------------------------------------

ga_range_nvalues_get ()

# Purpose : This file provides an example of a call to the


# function ga_range_nvalues_get()
#
# In this file first the number of ranges and
# the list of ranges in the database are found.
# Then the number of sub-ranges defined in the
# first range is found.
#
# Before running this session file run spool.ses
Main Index
730
Code Examples

# to create spool.db. Follow the instructions in


# spool.ses and create spool.op2 and spool.jbr.
# Make “spool_res.ses” available in the current
# working directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_range_nvalues_get() has the following arguments:
#
# ga_range_nvalues_get
# ( name,
# number )
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
INTEGER i_number
STRING sav_ranges[32](VIRTUAL)
INTEGER i_nranges
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)

# Get the number of ranges in the database


i_return_value = @
ga_range_nranges_get @
( i_nranges )
dump i_return_value, i_nranges

sys_allocate_array(sav_ranges,1,i_nranges)

# Get the list of ranges in the database


i_return_value = @
ga_range_ranges_get @
( sav_ranges )
dump i_return_value, sav_ranges

# Get the number of sub-ranges in the first range


s_name = sav_ranges(1)
i_return_value = @
ga_range_nvalues_get @
( s_name, @
i_number )
dump i_return_value, i_number

# Session file paused. Press “Resume” to continue..


sf_pause()

# Close the database “spool.db”


uil_file_close.go()

sys_free_array(sav_ranges)
#---------------------------------------------------------------------

ga_range_ranges_get ()

# Purpose : This file provides an example of a call to the


# function ga_range_ranges_get()
#
# In this file the number of ranges and then
# the list of ranges in the database are found.
#
Main Index
CHAPTER 4 731
Graphics

# Before running this session file run spool.ses


# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
# Make “spool_res.ses” available in the current
# working directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_range_ranges_get()
# has the following arguments:
#
# ga_range_ranges_get
# ( ranges )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING sav_ranges[32](VIRTUAL)
INTEGER i_nranges
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)

# Get the number of ranges in the database


i_return_value = @
ga_range_nranges_get @
( i_nranges )
dump i_return_value, i_nranges

sys_allocate_array(sav_ranges,1,i_nranges)

# Get the list of ranges in the database


i_return_value = @
ga_range_ranges_get @
( sav_ranges )
dump i_return_value, sav_ranges

# Session file paused. Press “Resume” to continue..


sf_pause()

# Close the database “spool.db”


uil_file_close.go()

sys_free_array(sav_ranges)
#---------------------------------------------------------------------

ga_range_rename ()

# Purpose : This file provides an example of two calls


# to the function ga_range_rename()
#
# In this file first the number of ranges and
# the list of ranges in the database are found.
# Then the name of the the first range is
# saved and it is renamed, finally restoring
# it’s name.
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
# Make “spool_res.ses” available in the current
# working directory.
Main Index
732
Code Examples

#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_range_rename() has the following arguments:
#
# ga_range_rename
# ( old_name,
# new_name )
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32],s_old_name[32], s_new_name[32]
STRING sav_ranges[32](VIRTUAL)
INTEGER i_nranges
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)

# Get the number of ranges in the database


i_return_value = @
ga_range_nranges_get @
( i_nranges )
dump i_return_value, i_nranges

sys_allocate_array(sav_ranges,1,i_nranges)

# Get the list of ranges in the database


i_return_value = @
ga_range_ranges_get @
( sav_ranges )
dump i_return_value, sav_ranges

# Session file paused. Press “Resume” to continue..


sf_pause()

# Save the first range name


s_name = sav_ranges(1)

# Rename the first range


s_old_name = sav_ranges(1)
s_new_name = “New Name”

i_return_value = @
ga_range_rename @
( s_old_name, @
s_new_name )
dump i_return_value

# Get the list of ranges in the database


i_return_value = @
ga_range_ranges_get @
( sav_ranges )
dump i_return_value, sav_ranges

# Paused. Press resume to continue..


sf_pause()

# Restore the name of the first range


s_old_name = sav_ranges(1)
s_new_name = s_name

i_return_value = @
ga_range_rename @
( s_old_name, @
Main Index
CHAPTER 4 733
Graphics

s_new_name )
dump i_return_value

# Get the list of ranges in the database


i_return_value = @
ga_range_ranges_get @
( sav_ranges )
dump i_return_value, sav_ranges

# Session file paused. Press “Resume” to continue..


sf_pause()

# Close the database “spool.db”


uil_file_close.go()

sys_free_array(sav_ranges)
#---------------------------------------------------------------------

ga_range_startend_set ()

# Purpose : This file provides an example of a call to the


# function ga_range_startend_set()
#
# In this file first the number of ranges and
# the list of ranges in the database are found.
# Then the sub-ranges in the first range are
# found. The sub-ranges are set using start and
# end values and are displayed.
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
# Make “spool_res.ses” available in the current
# working directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_range_startend_set()
# has the following arguments:
#
# ga_range_startend_set
# ( name,
# start,
# end )
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
REAL r_start, r_end
REAL ra_from(VIRTUAL),ra_to(VIRTUAL),ra_mid(VIRTUAL)
REAL ra_old_from(VIRTUAL),ra_old_to(VIRTUAL),ra_old_mid(VIRTUAL)
INTEGER i_number
STRING sav_ranges[32](VIRTUAL)
INTEGER i_nranges
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)

# Get the number of ranges in the database


i_return_value = @
ga_range_nranges_get @
( i_nranges )
Main Index
734
Code Examples

dump i_return_value, i_nranges

sys_allocate_array(sav_ranges,1,i_nranges)

# Get the list of ranges in the database


i_return_value = @
ga_range_ranges_get @
( sav_ranges )
dump i_return_value, sav_ranges

# Get the number of sub-ranges in the first range


s_name = sav_ranges(1)
i_return_value = @
ga_range_nvalues_get @
( s_name, @
i_number )
dump i_return_value, i_number

sys_allocate_array(ra_from,1,i_number)
sys_allocate_array(ra_to,1,i_number)
sys_allocate_array(ra_mid,1,i_number)
sys_allocate_array(ra_old_from,1,i_number)
sys_allocate_array(ra_old_to,1,i_number)
sys_allocate_array(ra_old_mid,1,i_number)

# Get the sub-ranges in the first range


i_return_value = @
ga_range_values_get @
( s_name, @
ra_old_from, @
ra_old_to, @
ra_old_mid )
dump i_return_value,ra_old_from,ra_old_to,ra_old_mid

# Session file paused. Press “Resume” to continue..


sf_pause()

# Set the sub-ranges taking start and end


r_start = 100000
r_end = 0
i_return_value = @
ga_range_startend_set @
( s_name, @
r_start, @
r_end )
dump i_return_value

# Get the sub-ranges in the first range


i_return_value = @
ga_range_values_get @
( s_name, @
ra_from, @
ra_to, @
ra_mid )
dump i_return_value,ra_from,ra_to,ra_mid

# Session file paused. Press “Resume” to continue..


sf_pause()

# Reset the sub-ranges in the first range to the old values


i_return_value = @
ga_range_values_set @
( s_name, @
ra_old_from, @
ra_old_to, @
ra_old_mid )
dump i_return_value
Main Index
CHAPTER 4 735
Graphics

# Close the database “spool.db”


uil_file_close.go()

sys_free_array(ra_from)
sys_free_array(ra_to)
sys_free_array(ra_mid)
sys_free_array(ra_old_from)
sys_free_array(ra_old_to)
sys_free_array(ra_old_mid)
sys_free_array(sav_ranges)
#---------------------------------------------------------------------

ga_range_threshold_set ()

# Purpose : This file provides an example of a call to the


# function ga_range_threshold_set()
#
# In this file first the number of ranges and
# the list of ranges in the database are found.
# Then the sub_ranges in the first range are
# found. The sub-ranges are set using start,
# end and threshold values and are shown.
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
# Make “spool_res.ses” available in the current
# working directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_range_threshold_set() has the following arguments:
#
# ga_range_threshold_set
# ( name,
# start,
# end,
# sthf,
# sth,
# ethf,
# eth )
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
STRING sav_ranges[32](VIRTUAL)
REAL r_start, r_end, r_sth, r_eth
INTEGER i_sthf, i_ethf
REAL ra_from(VIRTUAL),ra_to(VIRTUAL),ra_mid(VIRTUAL)
REAL ra_old_from(VIRTUAL),ra_old_to(VIRTUAL),ra_old_mid(VIRTUAL)
INTEGER i_number
INTEGER i_nranges
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)

# Get the number of ranges in the database


i_return_value = @
ga_range_nranges_get @
( i_nranges )
dump i_return_value, i_nranges
Main Index
736
Code Examples

sys_allocate_array(sav_ranges,1,i_nranges)

# Get the list of ranges in the database


i_return_value = @
ga_range_ranges_get @
( sav_ranges )
dump i_return_value, sav_ranges

# Get the number of sub-ranges in the first range


s_name = sav_ranges(1)
i_return_value = @
ga_range_nvalues_get @
( s_name, @
i_number )
dump i_return_value, i_number

sys_allocate_array(ra_from,1,i_number)
sys_allocate_array(ra_to,1,i_number)
sys_allocate_array(ra_mid,1,i_number)
sys_allocate_array(ra_old_from,1,i_number)
sys_allocate_array(ra_old_to,1,i_number)
sys_allocate_array(ra_old_mid,1,i_number)

# Get the sub-ranges in the first range


i_return_value = @
ga_range_values_get @
( s_name, @
ra_old_from, @
ra_old_to, @
ra_old_mid )
dump i_return_value,ra_old_from,ra_old_to,ra_old_mid

# Session file paused. Press “Resume” to continue..


sf_pause()

# Set the sub-ranges taking start, end and start thresholds


r_start = 100000.0
r_end = 0
i_sthf = 1
r_sth = 10000.0
i_ethf = 1
r_eth = 0.0

ga_viewport_range_set(““,s_name)
i_return_value = @
ga_range_threshold_set @
( s_name, @
r_start, @
r_end, @
i_sthf, @
r_sth, @
i_ethf, @
r_eth )
dump i_return_value

# Get the sub-ranges in the first range


i_return_value = @
ga_range_values_get @
( s_name, @
ra_from, @
ra_to, @
ra_mid )
dump i_return_value,ra_from,ra_to,ra_mid

# Session file paused. Press “Resume” to continue..


sf_pause()
Main Index
CHAPTER 4 737
Graphics

# Reset the sub-ranges in the first range to the old values


i_return_value = @
ga_range_values_set @
( s_name, @
ra_old_from, @
ra_old_to, @
ra_old_mid )
dump i_return_value

# Close the database “spool.db”


uil_file_close.go()

sys_free_array(ra_from)
sys_free_array(ra_to)
sys_free_array(ra_mid)
sys_free_array(ra_old_from)
sys_free_array(ra_old_to)
sys_free_array(ra_old_mid)
sys_free_array(sav_ranges)
#---------------------------------------------------------------------

ga_range_values_get ()

# Purpose : This file provides an example of a call to the


# function ga_range_values_get()
#
# In this file first the number of ranges and
# the list of ranges in the database are found.
# Then the number of sub-ranges in the first
# range and then the sub-ranges are found.
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
# Make “spool_res.ses” available in the current
# working directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_range_values_get() has the following arguments:
#
# ga_range_values_get
# ( name,
# from,
# to,
# mid )
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
REAL ra_from(VIRTUAL),ra_to(VIRTUAL),ra_mid(VIRTUAL)
INTEGER i_number
STRING sav_ranges[32](VIRTUAL)
INTEGER i_nranges
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)

# Get the number of ranges in the database


i_return_value = @
ga_range_nranges_get @
Main Index
738
Code Examples

( i_nranges )
dump i_return_value, i_nranges

sys_allocate_array(sav_ranges,1,i_nranges)

# Get the list of ranges in the database


i_return_value = @
ga_range_ranges_get @
( sav_ranges )
dump i_return_value, sav_ranges

# Get the number of sub-ranges in the first range


s_name = sav_ranges(1)
i_return_value = @
ga_range_nvalues_get @
( s_name, @
i_number )
dump i_return_value, i_number

sys_allocate_array(ra_from,1,i_number)
sys_allocate_array(ra_to,1,i_number)
sys_allocate_array(ra_mid,1,i_number)

# Get the sub-ranges in the first range


i_return_value = @
ga_range_values_get @
( s_name, @
ra_from, @
ra_to, @
ra_mid )
dump i_return_value,ra_from,ra_to,ra_mid

# Session file paused. Press “Resume” to continue..


sf_pause()

# Close the database “spool.db”


uil_file_close.go()

sys_free_array(ra_from)
sys_free_array(ra_to)
sys_free_array(ra_mid)
sys_free_array(sav_ranges)
#---------------------------------------------------------------------

ga_range_values_set ()

# Purpose : This file provides two calls to the


# function ga_range_values_set()
#
# In this file first the number of ranges and
# the list of ranges in the database are found.
# Then the sub-ranges in the first range are
# found. Then theses ranges are set and the
# modified sub-ranges are displayed.
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
# Make “spool_res.ses” available in the current
# working directory.
#
# 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.
Main Index
CHAPTER 4 739
Graphics

#
#
# The function ga_range_values_set() has the following arguments:
#
# ga_range_values_set
# ( name,
# from,
# to,
# mid )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
REAL ra_from(VIRTUAL),ra_to(VIRTUAL),ra_mid(VIRTUAL)
REAL ra_old_from(VIRTUAL),ra_old_to(VIRTUAL),ra_old_mid(VIRTUAL)
INTEGER i_number
STRING sav_ranges[32](VIRTUAL)
INTEGER i_nranges, i_index
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)

# Get the number of ranges in the database


i_return_value = @
ga_range_nranges_get @
( i_nranges )
dump i_return_value, i_nranges

sys_allocate_array(sav_ranges,1,i_nranges)

# Get the list of ranges in the database


i_return_value = @
ga_range_ranges_get @
( sav_ranges )
dump i_return_value, sav_ranges

# Get the number of sub-ranges in the first range


s_name = sav_ranges(1)
i_return_value = @
ga_range_nvalues_get @
( s_name, @
i_number )
dump i_return_value, i_number

sys_allocate_array(ra_from,1,i_number)
sys_allocate_array(ra_to,1,i_number)
sys_allocate_array(ra_mid,1,i_number)
sys_allocate_array(ra_old_from,1,i_number)
sys_allocate_array(ra_old_to,1,i_number)
sys_allocate_array(ra_old_mid,1,i_number)

# Get the sub-ranges in the first range


i_return_value = @
ga_range_values_get @
( s_name, @
ra_old_from, @
ra_old_to, @
ra_old_mid )
dump i_return_value,ra_old_from,ra_old_to,ra_old_mid

# Session file paused. Press “Resume” to continue..


sf_pause()

FOR(i_index= 1 TO i_number)
ra_from(i_index) = (i_index-1) * 10000
ra_to(i_index) = (i_index) * 10000
Main Index
740
Code Examples

ra_mid(i_index) = (ra_from(i_index) + ra_to(i_index))/2.0


END FOR

# Set the sub-ranges in the first range


i_return_value = @
ga_range_values_set @
( s_name, @
ra_from, @
ra_to, @
ra_mid )
dump i_return_value

# Clear the arrays


FOR(i_index= 1 TO i_number)
ra_from(i_index) = 0.0
ra_to(i_index) = 0.0
ra_mid(i_index) = 0.0
END FOR

# Get the sub-ranges in the first range


i_return_value = @
ga_range_values_get @
( s_name, @
ra_from, @
ra_to, @
ra_mid )
dump i_return_value,ra_from,ra_to,ra_mid

# Session file paused. Press “Resume” to continue..


sf_pause()

# Reset the sub-ranges in the first range to old values


i_return_value = @
ga_range_values_set @
( s_name, @
ra_old_from, @
ra_old_to, @
ra_old_mid )
dump i_return_value

# Close the database “spool.db”


uil_file_close.go()

sys_free_array(ra_from)
sys_free_array(ra_to)
sys_free_array(ra_mid)
sys_free_array(ra_old_from)
sys_free_array(ra_old_to)
sys_free_array(ra_old_mid)
sys_free_array(sav_ranges)
#---------------------------------------------------------------------

ga_spectrum_colors_get ()

# Purpose : This file provides an example of a call to the


# function ga_spectrum_colors_get()
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
# Make “spool_res.ses” available in the current
# working directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
Main Index
CHAPTER 4 741
Graphics

# through the “File”,”Session”,”Play” pulldown


# menus on the menu bar.
#
# The function ga_spectrum_colors_get()
# has the following arguments:
#
# ga_spectrum_colors_get
# ( name,
# colors )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
INTEGER iv_colors(VIRTUAL)
INTEGER i_return_value
INTEGER i_number
#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)

# Get the current spectrum


i_return_value = @
ga_spectrum_current_get @
( s_name )
dump i_return_value
dump s_name

# Get the number of colors in the current spectrum


i_return_value = @
ga_spectrum_ncolors_get @
( s_name, @
i_number)
dump i_return_value
dump i_number

sys_allocate_array(iv_colors,1,i_number)

# Get the colors in the current spectrum


i_return_value = @
ga_spectrum_colors_get @
( s_name, @
iv_colors )
dump i_return_value
dump iv_colors

# Session file paused. Press “Resume” to continue..


sf_pause()

sys_free_array(iv_colors)

# Close the database “spool.db”


uil_file_close.go()
#---------------------------------------------------------------------

ga_spectrum_colors_set ()

# Purpose : This file provides an example of a call to the


# function ga_spectrum_colors_set()
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
# Make “spool_res.ses” available in the current
# working directory.
#
Main Index
742
Code Examples

# This file can be run by starting a session of


# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_spectrum_colors_set()
# has the following arguments:
#
# ga_spectrum_colors_set
# ( name,
# offset,
# number,
# colors )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
INTEGER iv_old_colors(VIRTUAL),ia_colors(16)
INTEGER i_old_number,i_number
INTEGER i_offset
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)

# Get the current spectrum


i_return_value = @
ga_spectrum_current_get @
( s_name )
dump i_return_value
dump s_name

# Get the number of colors in the current spectrum


i_return_value = @
ga_spectrum_ncolors_get @
( s_name, @
i_old_number)
dump i_return_value
dump i_old_number

sys_allocate_array(iv_old_colors,1,i_old_number)

# Get the colors in the current spectrum


i_return_value = @
ga_spectrum_colors_get @
( s_name, @
iv_old_colors )
dump i_return_value
dump iv_old_colors

# Set the colors in the current spectrum


i_offset =0
i_number =16
ia_colors =[0,15,1,14,2,13,3,12,4,11,5,10,6,9,7,8]
i_return_value = @
ga_spectrum_colors_set @
( s_name, @
i_offset, @
i_number, @
ia_colors )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Set the original colors in the current spectrum


i_offset =0
Main Index
CHAPTER 4 743
Graphics

i_number =i_old_number
i_return_value = @
ga_spectrum_colors_set @
( s_name, @
i_offset, @
i_number, @
iv_old_colors )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Close the database “spool.db”


uil_file_close.go()
#---------------------------------------------------------------------

ga_spectrum_continuous_get ()

# Purpose : This file provides an example of a call to the


# function ga_spectrum_continuous_get()
#
# This function is used to get the continuous
# tone flag of a spectrum.
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
# Make “spool_res.ses” available in the current
# working directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_spectrum_continuous_get()
# has the following arguments:
#
# ga_spectrum_continuous_get
# ( name,
# value )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
INTEGER i_value
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)

# Get the current spectrum


i_return_value = @
ga_spectrum_current_get @
( s_name )
dump i_return_value
dump s_name

# Get the continuous tone flag of the current spectrum


i_return_value = @
ga_spectrum_continuous_get @
( s_name, @
i_value )
dump i_return_value
dump i_value
Main Index
744
Code Examples

# Session file paused. Press “Resume” to continue..


sf_pause()

# Close the database “spool.db”


uil_file_close.go()
#---------------------------------------------------------------------

ga_spectrum_continuous_set ()

# Purpose : This file provides an example of two calls to


# the function ga_spectrum_continuous_set().
#
# This function is used to set the continuous
# tone flag of a spectrum.
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
# Make “spool_res.ses” available in the current
# working directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_spectrum_continuous_set()
# has the following arguments:
#
# ga_spectrum_continuous_set
# ( name,
# value )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
INTEGER i_old_value,i_value
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)

# Get the current spectrum


i_return_value = @
ga_spectrum_current_get @
( s_name )
dump i_return_value
dump s_name

# Get the continuous tone flag of the current spectrum


i_return_value = @
ga_spectrum_continuous_get @
( s_name, @
i_old_value )
dump i_return_value
dump i_old_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Set the continuous tone flag of the current spectrum


i_value = 1
i_return_value = @
ga_spectrum_continuous_set @
Main Index
CHAPTER 4 745
Graphics

( s_name, @
i_value )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Set the continuous tone flag of the current spectrum to it’s


# old value
i_value = i_old_value
i_return_value = @
ga_spectrum_continuous_set @
( s_name, @
i_value )
dump i_return_value

# Close the database “spool.db”


uil_file_close.go()
#---------------------------------------------------------------------

ga_spectrum_create ()

# Purpose : This file provides an example of a call to the


# function ga_spectrum_create()
#
# This function is used to create a spectrum.
# In this file first the current spectrum is
# saved, then a new spectrum is created and
# made current, finally restoring the original
# spectrum and deleting the new spectrum.
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
# Make “spool_res.ses” available in the current
# working directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_spectrum_create() has the following arguments:
#
# ga_spectrum_create
# ( name,
# number,
# colors )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_old_name[32],s_name[32]
STRING sav_spectrums[32](VIRTUAL)
INTEGER i_nspectrums
INTEGER i_number
INTEGER ia_colors(16)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)

# Get the number of spectrums in the database


i_return_value = @
ga_spectrum_nspectrums_get @
( i_nspectrums )
Main Index
746
Code Examples

dump i_return_value
dump i_nspectrums

sys_allocate_array(sav_spectrums,1,i_nspectrums)

i_return_value = @
ga_spectrum_spectrums_get @
( sav_spectrums )
dump i_return_value
dump sav_spectrums

# Get the current spectrum


i_return_value = @
ga_spectrum_current_get @
( s_old_name )
dump i_return_value

# Create a spectrum
s_name = “new_spectrum”
i_number = 16
ia_colors= [0,15,1,14,2,13,3,12,4,11,5,10,6,9,7,8]
i_return_value = @
ga_spectrum_create @
( s_name, @
i_number, @
ia_colors )
dump i_return_value

# Make the new spectrum as current spectrum


i_return_value = @
ga_spectrum_current_set @
( s_name )

# Get the number of spectrums in the database


i_return_value = @
ga_spectrum_nspectrums_get @
( i_nspectrums )
dump i_return_value
dump i_nspectrums

sys_free_array(sav_spectrums)
sys_allocate_array(sav_spectrums,1,i_nspectrums)

i_return_value = @
ga_spectrum_spectrums_get @
( sav_spectrums )
dump i_return_value
dump sav_spectrums

# Session file paused. Press “Resume” to continue..


sf_pause()

# Restore the old spectrum


i_return_value = @
ga_spectrum_current_set @
( s_old_name )

# Delete the created spectrum


i_return_value = @
ga_spectrum_delete @
( s_name )

dump i_return_value
# Session file paused. Press “Resume” to continue..
sf_pause()

sys_free_array(sav_spectrums)
Main Index
CHAPTER 4 747
Graphics

# Close the database “spool.db”


uil_file_close.go()

#---------------------------------------------------------------------

ga_spectrum_current_get ()

# Purpose : This file provides an example of a call to the


# function ga_spectrum_current_get()
#
# This function is used to get the current
# spectrum.
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
# Make “spool_res.ses” available in the current
# working directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_spectrum_current_get()
# has the following arguments:
#
# ga_spectrum_current_get
# ( name )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)

i_return_value = @
ga_spectrum_current_get @
( s_name )
dump i_return_value
dump s_name

# Session file paused. Press “Resume” to continue..


sf_pause()

# Close the database “spool.db”


uil_file_close.go()
#---------------------------------------------------------------------

ga_spectrum_current_set ()

# Purpose : This file provides an example of a call to the


# function ga_spectrum_current_set()
#
# This function is used to set the current
# spectrum.
# In this file first the current spectrum is
# saved, then a new spectrum is created and
# made current, finally restoring the original
# spectrum and deleting the new spectrum.
Main Index
748
Code Examples

#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
# Make “spool_res.ses” available in the current
# working directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_spectrum_current_set()
# has the following arguments:
#
# ga_spectrum_current_set
# ( name )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_old_name[32],s_name[32]
INTEGER i_number
INTEGER ia_colors(16)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)

# Get the current spectrum


i_return_value = @
ga_spectrum_current_get @
( s_old_name )
dump i_return_value

# Create a spectrum
s_name = “new_spectrum”
i_number = 16
ia_colors= [0,15,1,14,2,13,3,12,4,11,5,10,6,9,7,8]
i_return_value = @
ga_spectrum_create @
( s_name, @
i_number, @
ia_colors )
dump i_return_value

# Make the new spectrum as current spectrum


i_return_value = @
ga_spectrum_current_set @
( s_name )

# Session file paused. Press “Resume” to continue..


sf_pause()

# Restore the old spectrum


i_return_value = @
ga_spectrum_current_set @
( s_old_name )

# Delete the created spectrum


i_return_value = @
ga_spectrum_delete @
( s_name )

dump i_return_value
# Session file paused. Press “Resume” to continue..
sf_pause()
Main Index
CHAPTER 4 749
Graphics

# Close the database “spool.db”


uil_file_close.go()
#---------------------------------------------------------------------

ga_spectrum_delete ()

# Purpose : This file provides an example of a call to the


# function ga_spectrum_delete()
#
# This function is used to delete a spectrum.
# In this file first the current spectrum is
# saved, then a new spectrum is created and
# made current, finally restoring the original
# spectrum and deleting the new spectrum.
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
# Make “spool_res.ses” available in the current
# working directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_spectrum_delete()
# has the following arguments:
#
# ga_spectrum_delete
# ( name )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_old_name[32],s_name[32]
STRING sav_spectrums[32](VIRTUAL)
INTEGER i_nspectrums
INTEGER i_number
INTEGER ia_colors(16)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)

# Get the current spectrum


i_return_value = @
ga_spectrum_current_get @
( s_old_name )
dump i_return_value

# Create a spectrum
s_name = “new_spectrum”
i_number = 16
ia_colors= [0,15,1,14,2,13,3,12,4,11,5,10,6,9,7,8]
i_return_value = @
ga_spectrum_create @
( s_name, @
i_number, @
ia_colors )
dump i_return_value

# Make the new spectrum as current spectrum


i_return_value = @
ga_spectrum_current_set @
( s_name )
Main Index
750
Code Examples

# Get the number of spectrums in the database


i_return_value = @
ga_spectrum_nspectrums_get @
( i_nspectrums )
dump i_return_value
dump i_nspectrums

sys_allocate_array(sav_spectrums,1,i_nspectrums)

# Get the list of spectrums in the database


i_return_value = @
ga_spectrum_spectrums_get @
( sav_spectrums )
dump i_return_value
dump sav_spectrums

# Session file paused. Press “Resume” to continue..


sf_pause()

# Restore the old spectrum


i_return_value = @
ga_spectrum_current_set @
( s_old_name )

# Delete the created spectrum


i_return_value = @
ga_spectrum_delete @
( s_name )

dump i_return_value

# Get the number of spectrums in the database


i_return_value = @
ga_spectrum_nspectrums_get @
( i_nspectrums )
dump i_return_value
dump i_nspectrums

sys_free_array(sav_spectrums)
sys_allocate_array(sav_spectrums,1,i_nspectrums)

i_return_value = @
ga_spectrum_spectrums_get @
( sav_spectrums )
dump i_return_value
dump sav_spectrums

# Session file paused. Press “Resume” to continue..


sf_pause()

sys_free_array(sav_spectrums)

# Close the database “spool.db”


uil_file_close.go()

#---------------------------------------------------------------------

ga_spectrum_interpolation_get ()

# Purpose : This file provides an example of a call to the


# function ga_spectrum_interpolation_get()
#
# This function is used to get the interpolation
# factor of a spectrum.
Main Index
CHAPTER 4 751
Graphics

#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
# Make “spool_res.ses” available in the current
# working directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_spectrum_interpolation_get()
# has the following arguments:
#
# ga_spectrum_interpolation_get
# ( name,
# factor )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
REAL r_factor
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)

# Get the current spectrum


i_return_value = @
ga_spectrum_current_get @
( s_name )
dump i_return_value
dump s_name

# Get the interpolation factor of the current spectrum


i_return_value = @
ga_spectrum_interpolation_get @
( s_name, @
r_factor )
dump i_return_value
dump r_factor

# Session file paused. Press “Resume” to continue..


sf_pause()

# Close the database “spool.db”


uil_file_close.go()
#---------------------------------------------------------------------

ga_spectrum_interpolation_set ()

# Purpose : This file provides an example of two calls to


# the function ga_spectrum_interpolation_set()
#
# This function is used to set the interpolation
# factor of a spectrum.
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
# Make “spool_res.ses” available in the current
# working directory.
#
# This file can be run by starting a session of
Main Index
752
Code Examples

# MSC.Patran, and running this session file


# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_spectrum_interpolation_set()
# has the following arguments:
#
# ga_spectrum_interpolation_set
# ( name,
# factor )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
REAL r_old_factor,r_factor
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)

# Get the current spectrum


i_return_value = @
ga_spectrum_current_get @
( s_name )
dump i_return_value
dump s_name

# Get the interpolation factor of the current spectrum


i_return_value = @
ga_spectrum_interpolation_get @
( s_name, @
r_old_factor )
dump i_return_value
dump r_old_factor

# Session file paused. Press “Resume” to continue..


sf_pause()

# Set the interpolation factor of the current spectrum


r_factor = 4.0
i_return_value = @
ga_spectrum_interpolation_set @
( s_name, @
r_factor )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Set the interpolation factor of the current spectrum to it’s


# old value
r_factor = r_old_factor
i_return_value = @
ga_spectrum_interpolation_set @
( s_name, @
r_factor )
dump i_return_value

# Close the database “spool.db”


uil_file_close.go()
#---------------------------------------------------------------------

Main Index
CHAPTER 4 753
Graphics

ga_spectrum_ncolors_get ()

# Purpose : This file provides an example of a call to the


# function ga_spectrum_ncolors_get()
#
# This function is used to get the number of
# colors in a given spectrum.
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
# Make “spool_res.ses” available in the current
# working directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_spectrum_ncolors_get()
# has the following arguments:
#
# ga_spectrum_ncolors_get
# ( name,
# number )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
INTEGER i_number
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)

# Get the name of the current spectrum


i_return_value = @
ga_spectrum_current_get @
( s_name )
dump i_return_value, s_name

# Get the number of colors in the current spectrum


i_return_value = @
ga_spectrum_ncolors_get @
( s_name, @
i_number )
dump i_return_value,i_number

# Session file paused. Press “Resume” to continue..


sf_pause()

# Close the database “spool.db”


uil_file_close.go()
#---------------------------------------------------------------------

ga_spectrum_nspectrums_get ()

# Purpose : This file provides an example of a call to the


# function ga_spectrum_nspectrums_get()
#
# This function is used to get the number of
# spectrums in the database.
#
Main Index
754
Code Examples

# Before running this session file run spool.ses


# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
# Make “spool_res.ses” available in the current
# working directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_spectrum_nspectrums_get()
# has the following arguments:
#
# ga_spectrum_nspectrums_get
# ( nspectrums )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_nspectrums
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)

# Get the number of spectrums in the database


i_return_value = @
ga_spectrum_nspectrums_get @
( i_nspectrums )
dump i_return_value
dump i_nspectrums

# Session file paused. Press “Resume” to continue..


sf_pause()

# Close the database “spool.db”


uil_file_close.go()
#---------------------------------------------------------------------

ga_spectrum_rename ()

# Purpose : This file provides an example of two calls


# to the function ga_spectrum_rename()
#
# This function is used to rename a spectrum.
# In this file first the current spectrum is
# found and it is renamed, finally restoring
# it’s name.
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
# Make “spool_res.ses” available in the current
# working directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_spectrum_rename()
# has the following arguments:
#
# ga_spectrum_rename
# ( old_name,
Main Index
CHAPTER 4 755
Graphics

# new_name )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32], s_old_name[32], s_new_name[32]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)

# Get the current spectrum


i_return_value = @
ga_spectrum_current_get @
( s_name )
dump i_return_value
dump s_name

# Session file paused. Press “Resume” to continue..


sf_pause()

# Rename the current spectrum


s_old_name = s_name
s_new_name = “new_spectrum_name”
i_return_value = @
ga_spectrum_rename @
( s_old_name, @
s_new_name )
dump i_return_value

# Get the current spectrum


i_return_value = @
ga_spectrum_current_get @
( s_name )
dump i_return_value
dump s_name

# Session file paused. Press “Resume” to continue..


sf_pause()

# Restore the spectrum name


s_new_name = s_old_name
s_old_name = s_name
i_return_value = @
ga_spectrum_rename @
( s_old_name, @
s_new_name )
dump i_return_value

# Close the database “spool.db”


uil_file_close.go()
#---------------------------------------------------------------------

ga_spectrum_spectrums_get ()

# Purpose : This file provides an example of a call to the


# function ga_spectrum_spectrums_get()
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
# Make “spool_res.ses” available in the current
# working directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
Main Index
756
Code Examples

# through the “File”,”Session”,”Play” pulldown


# menus on the menu bar.
#
# The function ga_spectrum_spectrums_get()
# has the following arguments:
#
# ga_spectrum_spectrums_get
# ( spectrums )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_nspectrums
STRING sav_spectrums[32](VIRTUAL)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)

# Get the number of spectrums in the database


i_return_value = @
ga_spectrum_nspectrums_get @
( i_nspectrums )
dump i_return_value
dump i_nspectrums

sys_allocate_array(sav_spectrums,1,i_nspectrums)

i_return_value = @
ga_spectrum_spectrums_get @
( sav_spectrums )
dump i_return_value
dump sav_spectrums

# Session file paused. Press “Resume” to continue..


sf_pause()

sys_free_array(sav_spectrums)

# Close the database “spool.db”


uil_file_close.go()
#---------------------------------------------------------------------

ga_title_color_get ()

# Purpose : This file provides an example of a call to the


# function ga_title_color_get()
#
# This function is used to get the color of
# a title.
# In this file first the number of the titles
# posted and then the list of titles are found.
# The color of the first title posted is get.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_title_color_get()
# has the following arguments:
#
# ga_title_color_get
# ( name,
# color )
#
Main Index
CHAPTER 4 757
Graphics

#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[256]
STRING sav_list[256](VIRTUAL)
INTEGER i_posted
INTEGER i_color
INTEGER i_return_value
#---------------------------------------------------------------------
# This file opens the database “new.db” and creates some titles
sf_play(“titles.ses”)

# Get the number of titles posted


i_return_value = @
ga_title_nposted_get @
( i_posted )
dump i_return_value
dump i_posted

sys_allocate_array(sav_list,1,i_posted)

# Get the list of titles posted


i_return_value = @
ga_title_posted_get @
( sav_list )
dump i_return_value
dump sav_list

# Get the color of the first title posted


s_name = sav_list(1)
i_return_value = @
ga_title_color_get @
( s_name, @
i_color )
dump i_return_value
dump i_color

# Session file paused. Press “Resume” to continue..


sf_pause()

sys_free_array(sav_list)

# Close the database “new.db”


uil_file_close.go()
#---------------------------------------------------------------------

ga_title_color_set ()

# Purpose : This file provides an example of two calls


# to the function ga_title_color_set()
#
# This function is used to set the color of
# a title.
#
# In this file first the number of the titles
# posted and then the list of titles are found.
# The color of the first title posted is set.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_title_color_set()
# has the following arguments:
#
Main Index
758
Code Examples

# ga_title_color_set
# ( name,
# color )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[256]
STRING sav_list[256](VIRTUAL)
INTEGER i_posted
INTEGER i_index
INTEGER i_color
INTEGER i_return_value
#---------------------------------------------------------------------
# This file opens the database “new.db” and creates some titles
sf_play(“titles.ses”)

# Get the number of titles posted


i_return_value = @
ga_title_nposted_get @
( i_posted )
dump i_return_value
dump i_posted

sys_allocate_array(sav_list,1,i_posted)

# Get the list of titles posted


i_return_value = @
ga_title_posted_get @
( sav_list )
dump i_return_value
dump sav_list

# Change the color of the first title posted


s_name = sav_list(1)
dump s_name
i_color = 1
i_return_value = @
ga_title_color_set @
( s_name, @
i_color )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Change the color of the first title posted


s_name = sav_list(1)
dump s_name
i_color = 4
i_return_value = @
ga_title_color_set @
( s_name, @
i_color )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

sys_free_array(sav_list)

# Close the database “new.db”


uil_file_close.go()
#---------------------------------------------------------------------

Main Index
CHAPTER 4 759
Graphics

ga_title_create ()

# Purpose : This file provides an example of a call to the


# function ga_title_create()
#
# This function is used to create a title.
# In this file a title is created, posted to the
# current viewport, and finally deleted.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_title_create()
# has the following arguments:
#
# ga_title_create
# ( name,
# x,
# y,
# color,
# font_size )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
REAL r_x
REAL r_y
INTEGER i_color
INTEGER i_font_size
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “new.db”
uil_file_open.go(“new.db”)

# Create a title at the centre


s_name = “New Title”
r_x = 50
r_y = 50
i_color = 1
# Choose 12 point Font
i_font_size = 2
i_return_value = @
ga_title_create @
( s_name, @
r_x, @
r_y, @
i_color, @
i_font_size )
dump i_return_value

# Post the title to the current viewport


i_return_value = @
ga_viewport_title_post @
( ““, @
s_name )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Delete the title created


i_return_value = @
ga_title_delete @
Main Index
760
Code Examples

( s_name )

# Close the database “new.db”


uil_file_close.go()
#---------------------------------------------------------------------

ga_title_delete ()

# Purpose : This file provides an example of a call to the


# function ga_title_delete()
#
# This function is used to delete a title.
# In this file a title is created, posted to the
# current viewport, and finally deleted.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_title_delete() has the following arguments:
#
# ga_title_delete
# ( name )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
REAL r_x
REAL r_y
INTEGER i_color
INTEGER i_font_size
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “new.db”
uil_file_open.go(“new.db”)

# Create a title at the centre


s_name = “New Title”
r_x = 50
r_y = 50
i_color = 7
# Choose 12 point Font
i_font_size = 2
i_return_value = @
ga_title_create @
( s_name, @
r_x, @
r_y, @
i_color, @
i_font_size )
dump i_return_value

# Post the title to the current viewport


i_return_value = @
ga_viewport_title_post @
( ““, @
s_name )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Delete the title created


i_return_value = @
Main Index
CHAPTER 4 761
Graphics

ga_title_delete @
( s_name )

# Close the database “new.db”


uil_file_close.go()
#---------------------------------------------------------------------

ga_title_font_size_get ()

# Purpose : This file provides an example of a call to the


# function ga_title_font_size_get()
#
# This function is used to get the font size of
# a title.
#
# In this file first the number of the titles
# posted and then the list of titles are found.
# The font size of the first title posted is get.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_title_font_size_get()
# has the following arguments:
#
# ga_title_font_size_get
# ( name,
# font_size )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[256]
STRING sav_list[256](VIRTUAL)
INTEGER i_posted
INTEGER i_size
INTEGER i_return_value
#---------------------------------------------------------------------
# This file opens the database “new.db” and creates some titles
sf_play(“titles.ses”)

# Get the number of titles posted


i_return_value = @
ga_title_nposted_get @
( i_posted )
dump i_return_value
dump i_posted

sys_allocate_array(sav_list,1,i_posted)

# Get the list of titles posted


i_return_value = @
ga_title_posted_get @
( sav_list )
dump i_return_value
dump sav_list

# Get the font_size of the first title posted


s_name = sav_list(1)
i_return_value = @
ga_title_font_size_get @
( s_name, @
i_size )
dump i_return_value
Main Index
762
Code Examples

dump i_size

# Session file paused. Press “Resume” to continue..


sf_pause()

sys_free_array(sav_list)

# Close the database “new.db”


uil_file_close.go()
#---------------------------------------------------------------------

ga_title_font_size_set ()

# Purpose : This file provides an example of two calls


# to the function ga_title_font_size_set()
#
# This function is used to set the font size of
# a title.
#
# In this file first the number of the titles
# posted and then the list of titles are found.
# The font size of the first title posted is set.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_title_font_size_set()
# has the following arguments:
#
# ga_title_font_size_set
# ( name,
# font_size )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[256]
STRING sav_list[256](VIRTUAL)
INTEGER i_posted
INTEGER i_size
INTEGER i_return_value
#---------------------------------------------------------------------
# This file opens the database “new.db” and creates some titles
sf_play(“titles.ses”)

# Get the number of titles posted


i_return_value = @
ga_title_nposted_get @
( i_posted )
dump i_return_value
dump i_posted

sys_allocate_array(sav_list,1,i_posted)

# Get the list of titles posted


i_return_value = @
ga_title_posted_get @
( sav_list )
dump i_return_value
dump sav_list

# Session file paused. Press “Resume” to continue...


sf_pause()
Main Index
CHAPTER 4 763
Graphics

# Change the font_size of the first title posted


s_name = sav_list(1)
dump s_name
i_size = 2
i_return_value = @
ga_title_font_size_set @
( s_name, @
i_size )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Change the font_size of the first title posted


s_name = sav_list(1)
dump s_name
i_size = 4
i_return_value = @
ga_title_font_size_set @
( s_name, @
i_size )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

sys_free_array(sav_list)

# Close the database “new.db”


uil_file_close.go()
#---------------------------------------------------------------------

ga_title_list_get ()

# Purpose : This file provides an example of a call to the


# function ga_title_list_get()
#
# This function is used to get the list of
# “Titles” in the database.
# In this file first the number of titles in the
# database is found and then the list of titles
# is found.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_title_list_get()
# has the following arguments:
#
# ga_title_list_get
# ( list )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING sav_list[256](VIRTUAL)
INTEGER i_ntitles
INTEGER i_return_value
#---------------------------------------------------------------------
# This file opens the database “new.db” and creates some titles
sf_play(“titles.ses”)

# Get the number of titles in the database


i_return_value = @
Main Index
764
Code Examples

ga_title_num_get @
( i_ntitles )
dump i_return_value
dump i_ntitles

sys_allocate_array(sav_list,1,i_ntitles)

# Get the list of the titles in the database


i_return_value = @
ga_title_list_get @
( sav_list )
dump i_return_value
dump sav_list

# Session file paused. Press “Resume” to continue..


sf_pause()

sys_free_array(sav_list)

# Close the database “new.db”


uil_file_close.go()
#---------------------------------------------------------------------

ga_title_loc_get ()

# Purpose : This file provides an example of a call to the


# function ga_title_loc_get()
#
# This function is used to get the location of
# a title.
#
# In this file first the number of the titles
# posted and then the list of titles are found.
# The location of the first title posted is get.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_title_loc_get()
# has the following arguments:
#
# ga_title_loc_get
# ( name,
# x_pcnt,
# y_pcnt )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[256]
STRING sav_list[256](VIRTUAL)
INTEGER i_posted
REAL r_xpcnt,r_ypcnt
INTEGER i_return_value
#---------------------------------------------------------------------
# This file opens the database “new.db” and creates some titles
sf_play(“titles.ses”)

# Get the number of titles posted


i_return_value = @
ga_title_nposted_get @
( i_posted )
dump i_return_value
dump i_posted
Main Index
CHAPTER 4 765
Graphics

sys_allocate_array(sav_list,1,i_posted)

# Get the list of titles posted


i_return_value = @
ga_title_posted_get @
( sav_list )
dump i_return_value
dump sav_list

# Get the location of the first title posted


s_name = sav_list(1)
i_return_value = @
ga_title_loc_get @
( s_name, @
r_xpcnt, @
r_ypcnt )
dump i_return_value
# The location of first title in percentage is
dump r_xpcnt, r_ypcnt

# Session file paused. Press “Resume” to continue..


sf_pause()

sys_free_array(sav_list)

# Close the database “new.db”


uil_file_close.go()
#---------------------------------------------------------------------

ga_title_loc_set ()

# Purpose : This file provides an example of two calls


# to the function ga_title_loc_set()
#
# This function is used to set the location of
# a title.
#
# In this file first the number of the titles
# posted and then the list of titles are found.
# The location of the first title posted is set.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_title_loc_set()
# has the following arguments:
#
# ga_title_loc_set
# ( name,
# xpcnt,
# ypcnt )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[256]
STRING sav_list[256](VIRTUAL)
INTEGER i_posted
INTEGER i_index
REAL r_xpcnt,r_ypcnt
INTEGER i_return_value
#---------------------------------------------------------------------
# This file opens the database “new.db” and creates some titles
Main Index
766
Code Examples

sf_play(“titles.ses”)

# Get the number of titles posted


i_return_value = @
ga_title_nposted_get @
( i_posted )
dump i_return_value
dump i_posted

sys_allocate_array(sav_list,1,i_posted)

# Get the list of titles posted


i_return_value = @
ga_title_posted_get @
( sav_list )
dump i_return_value
dump sav_list

# Change the location of the first title posted to top left


s_name = sav_list(1)
dump s_name
r_xpcnt = 10
r_ypcnt = 10
i_return_value = @
ga_title_loc_set @
( s_name, @
r_xpcnt, @
r_ypcnt )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Change the location of the first title posted to bottom right


s_name = sav_list(1)
dump s_name
r_xpcnt = 90
r_ypcnt = 90
i_return_value = @
ga_title_loc_set @
( s_name, @
r_xpcnt, @
r_ypcnt )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

sys_free_array(sav_list)

# Close the database “new.db”


uil_file_close.go()
#---------------------------------------------------------------------

ga_title_nposted_get ()

# Purpose : This file provides an example of a call to the


# function ga_title_nposted_get()
#
# This function is used to get the number of
# titles currently posted.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
Main Index
CHAPTER 4 767
Graphics

# menus on the menu bar.


#
# The function ga_title_nposted_get()
# has the following arguments:
#
# ga_title_nposted_get
# ( nposted )
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_nposted
INTEGER i_return_value
#---------------------------------------------------------------------
# This file opens the database “new.db” and creates some titles
sf_play(“titles.ses”)

i_return_value = @
ga_title_nposted_get @
( i_nposted )
dump i_return_value
dump i_nposted

# Session file paused. Press “Resume” to continue..


sf_pause()

# Close the database “new.db”


uil_file_close.go()
#---------------------------------------------------------------------

ga_title_num_get ()

# Purpose : This file provides an example of a call to the


# function ga_title_num_get()
#
# This functuion is used to get the number of
# “Titles” 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 ga_title_num_get()
# has the following arguments:
#
# ga_title_num_get
# ( ntitles )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_ntitles
INTEGER i_return_value
#---------------------------------------------------------------------
# This file opens the database “new.db” and creates some titles
sf_play(“titles.ses”)

i_return_value = @
ga_title_num_get @
( i_ntitles )
dump i_return_value
dump i_ntitles

# Session file paused. Press “Resume” to continue..


sf_pause()

# Close the database “new.db”


Main Index
768
Code Examples

uil_file_close.go()
#---------------------------------------------------------------------

ga_title_posted_get ()

# Purpose : This file provides an example of a call to the


# function ga_title_posted_get()
#
# This function is used to get the list of
# titles currently posted.
# In this file first the number of titles posted
# is found and then the list of titles posted
# is found.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_title_posted_get()
# has the following arguments:
#
# ga_title_posted_get
# ( list )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING sav_list[256](VIRTUAL)
INTEGER i_posted
INTEGER i_return_value
#---------------------------------------------------------------------
# This file opens the database “new.db” and creates some titles
sf_play(“titles.ses”)

# Get the number of titles posted


i_return_value = @
ga_title_nposted_get @
( i_posted )
dump i_return_value
dump i_posted

sys_allocate_array(sav_list,1,i_posted)

# Get the list of titles posted


i_return_value = @
ga_title_posted_get @
( sav_list )
dump i_return_value
dump sav_list

# Session file paused. Press “Resume” to continue..


sf_pause()

sys_free_array(sav_list)

# Close the database “new.db”


uil_file_close.go()
#---------------------------------------------------------------------

Main Index
CHAPTER 4 769
Graphics

ga_title_rename ()

# Purpose : This file provides an example of a call to the


# function ga_title_rename()
#
# This function is used to rename a title.
# In this file a title is created, posted to the
# current viewport,renamed and finally deleted.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_title_rename()
# has the following arguments:
#
# ga_title_rename
# ( old_name,
# new_name )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32],s_new_name[32],s_old_name[32]
REAL r_x
REAL r_y
INTEGER i_color
INTEGER i_font_size
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “new.db”
uil_file_open.go(“new.db”)

# Create a title near top left corner


s_name = “Old Title”
r_x = 5
r_y = 5
i_color = 1
# Choose 12 point Font
i_font_size = 2
i_return_value = @
ga_title_create @
( s_name, @
r_x, @
r_y, @
i_color, @
i_font_size )
dump i_return_value

# Post the title to the current viewport


i_return_value = @
ga_viewport_title_post @
( ““, @
s_name )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Rename the newly created Title


s_old_name = s_name
s_new_name = “New Title”
i_return_value = @
ga_title_rename @
( s_old_name, @
Main Index
770
Code Examples

s_new_name )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Delete the title created


s_name = s_new_name
i_return_value = @
ga_title_delete @
( s_name )

# Close the database “new.db”


uil_file_close.go()
#---------------------------------------------------------------------

ga_vector_create ()

# Purpose : This file provides an example of a call to the


# function ga_vector_create()
#
# This function is used to create a vector table.
# In this file the deformation results are read
# from the database and a table is created.
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_vector_create()
# has the following arguments:
#
# ga_vector_create
# ( title,
# comp_vect_flag,
# sym_flag,
# nvectors,
# vect_ent_types,
# vect_ent_ids,
# vect_locs,
# normals,
# vect_types,
# anchor_styles,
# vect_colors,
# sub_ids,
# id )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_title[32]
INTEGER i_ncases, i_nbr_nodes, i_index
INTEGER iv_lcids(VIRTUAL),iv_nsub(VIRTUAL), iv_node_ids(VIRTUAL)
REAL rv_deform(VIRTUAL)
INTEGER i_dtype,ia_minloc(6),ia_maxloc(6), ia_resids(5)
INTEGER i_comp_vect_flag,i_sym_flag,i_nvectors
INTEGER iv_vect_ent_types(VIRTUAL), iv_vect_ent_ids(VIRTUAL)
REAL rv_vect_locs(VIRTUAL)
INTEGER iv_vect_types(VIRTUAL), iv_anchor_styles(VIRTUAL)
INTEGER iv_vect_colors(VIRTUAL), iv_sub_ids(VIRTUAL)
INTEGER i_id, i_return_value
Main Index
CHAPTER 4 771
Graphics

#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)

# Get the number of Load cases and their IDs


i_return_value = @
res_utl_get_loadcases(i_ncases,iv_lcids,iv_nsub)
dump i_return_value
dump i_ncases,iv_lcids,iv_nsub

# Extract the stress results from the database


# Load case ID = iv_lcids(1)
# Sub case ID = 1
# Primary Result ID = 2 ( Corresponds to deformation )
# Secondary Result ID = 1
# Layer ID = 1
# node_list = “Node 1:#” (All nodes )
# derivation = ““
# coord_id = ““
ia_resids(1) = iv_lcids(1)
ia_resids(2) = 1
ia_resids(3) = 3
ia_resids(4) = 1
ia_resids(5) = 2
i_return_value = @
res_utl_extract_nodal_results(ia_resids,” Node 1:#”,””,””, @
i_dtype,i_nbr_nodes,iv_node_ids,rv_deform,ia_minloc,ia_maxloc)

dump i_return_value

# Create a vector table


s_title = “Vector Table”
i_comp_vect_flag = 0
i_sym_flag = 0
i_nvectors = i_nbr_nodes

sys_allocate_array(iv_vect_ent_types,1,i_nvectors)
sys_allocate_array(iv_vect_ent_ids,1,i_nvectors)
sys_allocate_array(rv_vect_locs,1,i_nvectors,1,3)
sys_allocate_array(iv_vect_types,1,i_nvectors)
sys_allocate_array(iv_anchor_styles,1,i_nvectors)
sys_allocate_array(iv_vect_colors,1,i_nvectors)
sys_allocate_array(iv_sub_ids,1,i_nvectors)

FOR(i_index = 1 TO i_nvectors)
iv_vect_ent_types(i_index) = 123 /* from dbtypes.h */
iv_vect_ent_ids(i_index) = iv_node_ids(i_index)
iv_vect_types(i_index) = 1
iv_anchor_styles(i_index) = 1
iv_vect_colors(i_index) = 0
iv_sub_ids(i_index) = 0
END FOR

i_return_value = @
ga_vector_create @
( s_title, @
i_comp_vect_flag, @
i_sym_flag, @
i_nvectors, @
iv_vect_ent_types, @
iv_vect_ent_ids, @
rv_vect_locs, @
rv_deform, @
iv_vect_types, @
iv_anchor_styles, @
iv_vect_colors, @
iv_sub_ids, @
Main Index
772
Code Examples

i_id )
dump i_return_value, i_id

# Session file paused. Press “Resume” to continue..


sf_pause()

# Associate the vector table with the group “fem_model”


i_return_value = @
ga_group_result_vector_set @
( “fem_model”, @
i_id )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

sys_free_array(iv_vect_ent_types)
sys_free_array(iv_vect_ent_ids)
sys_free_array(rv_vect_locs)
sys_free_array(iv_vect_types)
sys_free_array(iv_anchor_styles)
sys_free_array(iv_vect_colors)
sys_free_array(iv_sub_ids)
sys_free_array(iv_lcids)
sys_free_array(iv_nsub)
sys_free_array(iv_node_ids)
sys_free_array(rv_deform)

# Close the database “spool.db”


uil_file_close.go()
#---------------------------------------------------------------------

ga_vector_get ()

# Purpose : This file provides an example of a call to the


# function ga_vector_get()
#
# This function is used to get a vector table.
# In this file the deformation results are read
# from the database and a table is created and
# then deleted.
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
#
# The function ga_vector_get()
# has the following arguments:
#
# ga_vector_get
# ( id,
# title,
# comp_vect_flag,
# sym_flag,
# vect_ent_types,
# vect_ent_ids,
# vect_locs,
# normals,
# vect_types,
Main Index
CHAPTER 4 773
Graphics

# anchor_styles,
# vect_colors,
# sub_ids )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_title[32]
INTEGER i_ncases, i_nbr_nodes, i_index
INTEGER iv_lcids(VIRTUAL),iv_nsub(VIRTUAL), iv_node_ids(VIRTUAL)
REAL rv_deform(VIRTUAL)
INTEGER i_dtype,ia_minloc(6),ia_maxloc(6), ia_resids(5)
INTEGER i_comp_vect_flag,i_sym_flag,i_nvectors
INTEGER iv_vect_ent_types(VIRTUAL), iv_vect_ent_ids(VIRTUAL)
REAL rv_vect_locs(VIRTUAL)
INTEGER iv_vect_types(VIRTUAL), iv_anchor_styles(VIRTUAL)
INTEGER iv_vect_colors(VIRTUAL), iv_sub_ids(VIRTUAL)
INTEGER i_id, i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)

# Get the number of Load cases and their IDs


i_return_value = @
res_utl_get_loadcases(i_ncases,iv_lcids,iv_nsub)
dump i_return_value
dump i_ncases,iv_lcids,iv_nsub

# Extract the stress results from the database


# Load case ID = iv_lcids(1)
# Sub case ID = 1
# Primary Result ID = 2 ( Corresponds to deformation )
# Secondary Result ID = 1
# Layer ID = 1
# node_list = “Node 1:#” (All nodes )
# derivation = ““
# coord_id = ““
ia_resids(1) = iv_lcids(1)
ia_resids(2) = 1
ia_resids(3) = 3
ia_resids(4) = 1
ia_resids(5) = 2
i_return_value = @
res_utl_extract_nodal_results(ia_resids,” Node 1:#”,””,””, @
i_dtype,i_nbr_nodes,iv_node_ids,rv_deform,ia_minloc,ia_maxloc)

dump i_return_value

# Create a vector table


s_title = “Vector Table”
i_comp_vect_flag = 0
i_sym_flag = 0
i_nvectors = i_nbr_nodes

sys_allocate_array(iv_vect_ent_types,1,i_nvectors)
sys_allocate_array(iv_vect_ent_ids,1,i_nvectors)
sys_allocate_array(rv_vect_locs,1,i_nvectors,1,3)
sys_allocate_array(iv_vect_types,1,i_nvectors)
sys_allocate_array(iv_anchor_styles,1,i_nvectors)
sys_allocate_array(iv_vect_colors,1,i_nvectors)
sys_allocate_array(iv_sub_ids,1,i_nvectors)

FOR(i_index = 1 TO i_nvectors)
iv_vect_ent_types(i_index) = 123 /* from dbtypes.h */
iv_vect_ent_ids(i_index) = iv_node_ids(i_index)
iv_vect_types(i_index) = 1
iv_anchor_styles(i_index) = 1
iv_vect_colors(i_index) = 0
Main Index
774
Code Examples

iv_sub_ids(i_index) = 0
END FOR

i_return_value = @
ga_vector_create @
( s_title, @
i_comp_vect_flag, @
i_sym_flag, @
i_nvectors, @
iv_vect_ent_types, @
iv_vect_ent_ids, @
rv_vect_locs, @
rv_deform, @
iv_vect_types, @
iv_anchor_styles, @
iv_vect_colors, @
iv_sub_ids, @
i_id )
dump i_return_value, i_id

# Session file paused. Press “Resume” to continue..


sf_pause()

# Associate the vector table with the group “fem_model”


i_return_value = @
ga_group_result_vector_set @
( “fem_model”, @
i_id )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

sys_free_array(iv_vect_ent_types)
sys_free_array(iv_vect_ent_ids)
sys_free_array(rv_vect_locs)
sys_free_array(rv_deform)
sys_free_array(iv_vect_types)
sys_free_array(iv_anchor_styles)
sys_free_array(iv_vect_colors)
sys_free_array(iv_sub_ids)

# Get the number of vectors in the table


i_nvectors = 0
i_return_value = @
ga_vector_number_get @
( i_id, @
i_nvectors )
dump i_return_value, i_nvectors

sys_allocate_array(iv_vect_ent_types,1,i_nvectors)
sys_allocate_array(iv_vect_ent_ids,1,i_nvectors)
sys_allocate_array(rv_vect_locs,1,i_nvectors,1,3)
sys_allocate_array(rv_deform,1,i_nvectors,1,3)
sys_allocate_array(iv_vect_types,1,i_nvectors)
sys_allocate_array(iv_anchor_styles,1,i_nvectors)
sys_allocate_array(iv_vect_colors,1,i_nvectors)
sys_allocate_array(iv_sub_ids,1,i_nvectors)

# Get the vector table


i_return_value = @
ga_vector_get @
( i_id, @
s_title, @
i_comp_vect_flag, @
i_sym_flag, @
iv_vect_ent_types, @
Main Index
CHAPTER 4 775
Graphics

iv_vect_ent_ids, @
rv_vect_locs, @
rv_deform, @
iv_vect_types, @
iv_anchor_styles, @
iv_vect_colors, @
iv_sub_ids )
dump i_return_value
dump s_title, i_comp_vect_flag,i_sym_flag

# Session file paused. Press “Resume” to continue..


sf_pause()

sys_free_array(iv_vect_ent_types)
sys_free_array(iv_vect_ent_ids)
sys_free_array(rv_vect_locs)
sys_free_array(iv_vect_types)
sys_free_array(iv_anchor_styles)
sys_free_array(iv_vect_colors)
sys_free_array(iv_sub_ids)
sys_free_array(iv_lcids)
sys_free_array(iv_nsub)
sys_free_array(iv_node_ids)
sys_free_array(rv_deform)

# Close the database “spool.db”


uil_file_close.go()
#---------------------------------------------------------------------

ga_vector_number_get ()

# Purpose : This file provides an example of a call to the


# function ga_vector_number_get()
#
# This function is used to get the number of
# vectors in a data table. In this file the
# deformation results are read from the database
# and a table is created and then deleted.
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_vector_number_get()
# has the following arguments:
#
# ga_vector_number_get
# ( id,
# nvectors )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_title[32]
INTEGER i_ncases, i_nbr_nodes, i_index
INTEGER iv_lcids(VIRTUAL),iv_nsub(VIRTUAL), iv_node_ids(VIRTUAL)
REAL rv_deform(VIRTUAL)
INTEGER i_dtype,ia_minloc(6),ia_maxloc(6), ia_resids(5)
INTEGER i_comp_vect_flag,i_sym_flag,i_nvectors
INTEGER iv_vect_ent_types(VIRTUAL), iv_vect_ent_ids(VIRTUAL)
REAL rv_vect_locs(VIRTUAL)
Main Index
776
Code Examples

INTEGER iv_vect_types(VIRTUAL), iv_anchor_styles(VIRTUAL)


INTEGER iv_vect_colors(VIRTUAL), iv_sub_ids(VIRTUAL)
INTEGER i_id, i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)

# Get the number of Load cases and their IDs


i_return_value = @
res_utl_get_loadcases(i_ncases,iv_lcids,iv_nsub)
dump i_return_value
dump i_ncases,iv_lcids,iv_nsub

# Extract the stress results from the database


# Load case ID = iv_lcids(1)
# Sub case ID = 1
# Primary Result ID = 2 ( Corresponds to deformation )
# Secondary Result ID = 1
# Layer ID = 1
# node_list = “Node 1:#” (All nodes )
# derivation = ““
# coord_id = ““
ia_resids(1) = iv_lcids(1)
ia_resids(2) = 1
ia_resids(3) = 3
ia_resids(4) = 1
ia_resids(5) = 2
i_return_value = @
res_utl_extract_nodal_results(ia_resids,” Node 1:#”,””,””, @
i_dtype,i_nbr_nodes,iv_node_ids,rv_deform,ia_minloc,ia_maxloc)

dump i_return_value

# Create a vector table


s_title = “Vector Table”
i_comp_vect_flag = 0
i_sym_flag = 0
i_nvectors = i_nbr_nodes

sys_allocate_array(iv_vect_ent_types,1,i_nvectors)
sys_allocate_array(iv_vect_ent_ids,1,i_nvectors)
sys_allocate_array(rv_vect_locs,1,i_nvectors,1,3)
sys_allocate_array(iv_vect_types,1,i_nvectors)
sys_allocate_array(iv_anchor_styles,1,i_nvectors)
sys_allocate_array(iv_vect_colors,1,i_nvectors)
sys_allocate_array(iv_sub_ids,1,i_nvectors)

FOR(i_index = 1 TO i_nvectors)
iv_vect_ent_types(i_index) = 123 /* from dbtypes.h */
iv_vect_ent_ids(i_index) = iv_node_ids(i_index)
iv_vect_types(i_index) = 1
iv_anchor_styles(i_index) = 1
iv_vect_colors(i_index) = 0
iv_sub_ids(i_index) = 0
END FOR

i_return_value = @
ga_vector_create @
( s_title, @
i_comp_vect_flag, @
i_sym_flag, @
i_nvectors, @
iv_vect_ent_types, @
iv_vect_ent_ids, @
rv_vect_locs, @
rv_deform, @
iv_vect_types, @
Main Index
CHAPTER 4 777
Graphics

iv_anchor_styles, @
iv_vect_colors, @
iv_sub_ids, @
i_id )
dump i_return_value, i_id

# Session file paused. Press “Resume” to continue..


sf_pause()

# Associate the vector table with the group “fem_model”


i_return_value = @
ga_group_result_vector_set @
( “fem_model”, @
i_id )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Get the number of vectors in the table


i_nvectors = 0
i_return_value = @
ga_vector_number_get @
( i_id, @
i_nvectors )
dump i_return_value, i_nvectors

# Session file paused. Press “Resume” to continue..


sf_pause()

sys_free_array(iv_vect_ent_types)
sys_free_array(iv_vect_ent_ids)
sys_free_array(rv_vect_locs)
sys_free_array(iv_vect_types)
sys_free_array(iv_anchor_styles)
sys_free_array(iv_vect_colors)
sys_free_array(iv_sub_ids)
sys_free_array(iv_lcids)
sys_free_array(iv_nsub)
sys_free_array(iv_node_ids)
sys_free_array(rv_deform)

# Close the database “spool.db”


uil_file_close.go()
#---------------------------------------------------------------------

ga_view_normal_get ()

# Purpose : This file provides an example of a call to the


# function ga_view_normal_get()
#
# This file opens a new database "new.db".
# It changes the view to isometric and uses
# this function to get the view vector.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the "File","Session","Play" pulldown
# menus on the menu bar.
#
# The function ga_view_normal_get()
# has the following arguments:
#
# ga_view_normal_get
# ( viewport,
Main Index
778
Code Examples

# view_vector )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_viewport[16]
REAL ra_vector(3)
INTEGER i_return_value = 5
#---------------------------------------------------------------------
# Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002

#---------------------------------------------------------------------
# Setting the view to isometric.

ga_view_aa_set( 23., -34., 0. )

#---------------------------------------------------------------------
# Getting the view vector.

s_viewport = ""

i_return_value = @
ga_view_normal_get @
( s_viewport, @
ra_vector )

dump i_return_value
dump ra_vector
#---------------------------------------------------------------------

gm_conv_device_to_subject ()

# Purpose : This file provides an example of a call to the


# function gm_conv_device_to_subject()
#
# This function is used to convert from device
# space to subject space.
#
# 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 gm_conv_device_to_subject()
# has the following arguments:
#
# gm_conv_device_to_subject
# ( vp_id,
# dev_pt,
# sub_pt )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_vp_id
INTEGER ia_dev_pt(2)
REAL ra_sub_pt(3)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)
Main Index
CHAPTER 4 779
Graphics

# Get the ID of the current viewport


i_return_value = @
db_get_current_viewport_id @
( i_vp_id )
dump i_return_value, i_vp_id

# Get the subject point corresponding to [100,100] (in pixels)


ia_dev_pt = [100,100]
i_return_value = @
gm_conv_device_to_subject @
( i_vp_id, @
ia_dev_pt, @
ra_sub_pt )
dump i_return_value, ra_sub_pt
#---------------------------------------------------------------------

gm_convert_name ()

# Purpose : This file provides an example of a call to the


# function gm_convert_name()
#
# This function is used to remove the directory
# specification from the database name.
#
# 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 gm_convert_name()
# has the following arguments:
#
# gm_convert_name
# ( orig_name,
# new_name )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_orig_name[128]
STRING s_new_name[128]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “spool.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# Get the database name(full path)


i_return_value = @
db_name_get @
( s_orig_name )
dump i_return_value,s_orig_name

# Get the stripped name( only file name)


gm_convert_name @
( s_orig_name, @
s_new_name )
dump s_new_name

s_orig_name=”/one/two/three/four”

# Get the stripped name( only file name)


gm_convert_name @
( s_orig_name, @
s_new_name )
Main Index
780
Code Examples

dump s_new_name

#---------------------------------------------------------------------

gm_database_current ()

# Purpose : This file provides an example of a call to the


# function gm_database_current()
#
# This function is used to get the current
# database from the graphics manager.
#
# 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 gm_database_current()
# has no arguments.
#
# gm_database_current
# ( dbname )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_dbname[128]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

i_return_value = @
gm_database_current @
( s_dbname )
dump i_return_value, s_dbname

#---------------------------------------------------------------------

gm_draw_entity ()

# Purpose : This file provides an example of a call to the


# function gm_draw_entity()
#
# This function draws an entity in the segment
# or current viewport.
#
# 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 gm_draw_entity()
# has the following arguments:
#
# gm_draw_entity ( segment_id, @
# color_id, @
# entity_type, @
# entity_id)
#
#---------------------------------------------------------------------
Main Index
CHAPTER 4 781
Graphics

# Variable Declarations

STRING asm_create_patch_xy_created_ids[VIRTUAL]
INTEGER segment_id
INTEGER color_id
INTEGER entity_type
INTEGER entity_id
INTEGER i_return_value

#---------------------------------------------------------------------
# Open a new data base.

uil_file_new.go( "", "new.db" )

#---------------------------------------------------------------------
# Create a 2-D patch.

asm_const_patch_xyz( "1", "<1 1 0>", "[0 0 0]", "Coord 0", @


asm_create_patch_xy_created_ids )

#---------------------------------------------------------------------
# Argument Initialization.

color_id = 5
entity_type = 3
entity_id = 1

#---------------------------------------------------------------------
# Create the segment id.

gm_segment_create(segment_id)

#---------------------------------------------------------------------
# Draw the selected entity.

i_return_value = gm_draw_entity ( segment_id, @


color_id, @
entity_type, @
entity_id)

#---------------------------------------------------------------------
# Dump the output of the function

dump i_return_value

#---------------------------------------------------------------------
# closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

gm_fit_view ()

# Purpose : This file provides an example of a call to the


# function gm_fit_view()
#
# This function is used make fit view.
#
# 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
Main Index
782
Code Examples

# through the “File”,”Session”,”Play” pulldown


# menus on the menu bar.
#
# The function gm_fit_view()
# has the following arguments:
#
# gm_fit_view
# ( flag )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_flag
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Session file paused. Press “Resume” to continue..


sf_pause()

# Zoom in to the viewport to simulate lack of fit


ga_view_zoom_set(2)

# Session file paused. Press “Resume” to continue..


sf_pause()

# Make a fit view


i_flag = 1
i_return_value = @
gm_fit_view @
( i_flag )
dump i_return_value
#---------------------------------------------------------------------

gm_fullcolor_mode ()

# Purpose : This file provides an example of a call to the


# function gm_fullcolor_mode()
#
# This function is used to find whether the
# device is in full color mode or not.
#
# 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 gm_fullcolor_mode() has no arguments.
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

i_return_value = gm_fullcolor_mode()
dump i_return_value

#---------------------------------------------------------------------

Main Index
CHAPTER 4 783
Graphics

gm_graphics_off ()

# Purpose : This file provides an example of a call to the


# function gm_graphics_off()
#
# This function is used to shutdown the graphics.
# Executing this function will close the database
# and free all colors.
#
# 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 gm_graphics_off() has no arguments.
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Session file paused. Press “Resume” to continue..


sf_pause()

# Shutdown the graphics


i_return_value = gm_graphics_off()
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Restore the graphics ( loads last database and allocated colors)


i_return_value = gm_graphics_on()
dump i_return_value

#---------------------------------------------------------------------

gm_graphics_on ()

# Purpose : This file provides an example of a call to the


# function gm_graphics_on()
#
# 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 gm_graphics_on() has no arguments.
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)
Main Index
784
Code Examples

# Session file paused. Press “Resume” to continue..


sf_pause()

# Shutdown the graphics


i_return_value = gm_graphics_off()
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Restore the graphics ( loads last database and allocated colors)


i_return_value = gm_graphics_on()
dump i_return_value

#---------------------------------------------------------------------

gm_hilight_clear ()

# Purpose : This file provides an example of a call to the


# function gm_hilight_clear()
#
# This function is used to unhilight all of the
# hilighted entities.
#
# The hilight.pcl file is used to create
# a single width quarter height sized form
# containing a select frame, a selectdatabox and
# a button.
#
# The hilight.pob file used below can be created
# from hilight.pcl by using the C preprocessor
# to expand the symbols defined in the included
# files. See the “Part 9: PCL and Customization”
# manual for more information.
#
# A command similar to the following can be used
# to generate the hilight.pob file:
#
# cpp -I$P3_HOME/customisation hilight.pcl hilight.pob
# 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 gm_hilight_clear() has no arguments.
#
#---------------------------------------------------------------------
# Variable Declarations
WIDGET w_wid_id
INTEGER i_color
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Compile hilight.pob to get hilight.plb


!!COMPILE hilight.pob
# Add hilight.plb to library
!!LIBRARY ADD hilight.plb

ui_exec_function(“hilight”, “display”)
Main Index
CHAPTER 4 785
Graphics

# Get the widget ID of the selectdatabox


hilight.get_select_id(w_wid_id)
dump w_wid_id

# Set the value of the selectdatabox


ui_wid_set(w_wid_id,”VALUE”,”Surface 1:3”)

# Session file paused. Press “Resume” to continue..


sf_pause()

# Hilight the entities listed in the selectdatabox


i_color= -1 /* Use preference color */
i_return_value = @
gm_hilight_widget @
( w_wid_id, @
i_color )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Unhilight all hilighted entities


i_return_value = gm_hilight_clear()
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Hide the form


ui_form_hide(“hilight”)

#---------------------------------------------------------------------

gm_hilight_entity ()

# Purpose : This file provides an example of two calls to


# the function gm_hilight_entity()
#
# This function is used to hilight an entity.
#
# 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 gm_hilight_entity()
# has the following arguments:
#
# gm_hilight_entity
# ( type,
# id,
# color )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_type
INTEGER i_id
INTEGER i_color
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)
Main Index
786
Code Examples

# Highlight surfaces 1 and 2


i_type = 3 /* from dbtypes.h */
i_id = 1
i_color= -1 /* Highlight using preference color */
gm_hilight_entity @
( i_type, @
i_id, @
i_color )

i_id = 2
gm_hilight_entity @
( i_type, @
i_id, @
i_color )

# Session file paused. Press “Resume” to continue..


sf_pause()

# Unhighlight surface 1
i_id = 1
i_color= 0
gm_hilight_entity @
( i_type, @
i_id, @
i_color )
#---------------------------------------------------------------------

gm_hilight_string ()

# Purpose : This file provides an example of a call to the


# function gm_hilight_string()
#
# This function hilights all the selected entities.
#
# 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 gm_hilight_string()
# has the following arguments:
#
# gm_hilight_string (entities, color_id )
#
#---------------------------------------------------------------------
# Variable Declarations

STRING asm_create_patch_xy_created_ids[VIRTUAL]
INTEGER color_id
STRING entities[80]
INTEGER i_return_value

#---------------------------------------------------------------------
# Open a new data base.

uil_file_new.go( "", "new.db" )

#---------------------------------------------------------------------
# Create a 2-D patch.

asm_const_patch_xyz( "1", "<1 1 0>", @


"[0 0 0]", "Coord 0", @
asm_create_patch_xy_created_ids )
Main Index
CHAPTER 4 787
Graphics

#---------------------------------------------------------------------
# Argument Initialization.

entities = "Surface 1"


color_id = 1

#---------------------------------------------------------------------
# Hilight all the selected entities.

gm_hilight_string ( entities, color_id)

#---------------------------------------------------------------------
# closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

gm_hilight_widget ()

# Purpose : This file provides an example of a call to the


# function gm_hilight_widget()
#
# This function is used to hilight all of the
# entities in the selectdatabox.
#
# The hilight.pcl file is used to create
# a single width quarter height sized form
# containing a select frame, a selectdatabox and
# a button.
#
# The hilight.pob file used below can be created
# from hilight.pcl by using the C preprocessor
# to expand the symbols defined in the included
# files. See the “Part 9: PCL and Customization”
# manual for more information.
#
# A command similar to the following can be used
# to generate the hilight.pob file:
#
# cpp -I$P3_HOME/customisation hilight.pcl hilight.pob
# 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 gm_hilight_widget()
# has the following arguments:
#
# gm_hilight_widget
# ( wid_id,
# color )
#
#---------------------------------------------------------------------
# Variable Declarations
WIDGET w_wid_id
INTEGER i_color
#---------------------------------------------------------------------
# Open the database “spool.db”
Main Index
788
Code Examples

uil_file_open.go(“spool.db”)

# Compile hilight.pob to get hilight.plb


!!COMPILE hilight.pob
# Add hilight.plb to library
!!LIBRARY ADD hilight.plb

ui_exec_function(“hilight”,”display”)

# Get the widget ID of the selectdatabox


hilight.get_select_id(w_wid_id)
dump w_wid_id

# Set the value of the selectdatabox


ui_wid_set(w_wid_id,”VALUE”,”Element 1:100”)

# Session file paused. Press “Resume” to continue..


sf_pause()

# Hilight the entities listed in the selectdatabox


i_color= -1 /* Use preference color */
gm_hilight_widget @
( w_wid_id, @
i_color )

# Session file paused. Press “Resume” to continue..


sf_pause()

# Unhilight the entities listed in the selectdatabox


i_color= 0
gm_hilight_widget @
( w_wid_id, @
i_color )

# Session file paused. Press “Resume” to continue..


sf_pause()

# Hide the form


ui_form_hide(“hilight”)
#---------------------------------------------------------------------

gm_lookup_write ()

# Purpose : This file provides an example of a call to the


# function gm_lookup_write()
#
# 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 gm_lookup_write()
# has the following arguments:
#
# gm_lookup_write
# ( start,
# ncolors,
# colors )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_start
Main Index
CHAPTER 4 789
Graphics

INTEGER i_ncolors
REAL ra_colors(16,3)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Create the color array


ra_colors = [[0.0,0.0,0.0][0.5,0.0,0.0][0.0,0.5,0.0][0.0,0.0,0.5] @
[0.5,0.5,0.0][0.0,0.5,0.5][0.5,0.0,0.5][0.5,0.5,0.5] @
[0.8,0.8,0.8][1.0,0.0,0.0][0.0,1.0,0.0][0.0,0.0,1.0] @
[1.0,1.0,0.0][0.0,1.0,1.0][1.0,0.0,1.0][1.0,1.0,1.0]]
i_start = 1
i_ncolors = 16

i_return_value = @
gm_lookup_write @
( i_start, @
i_ncolors, @
ra_colors )
dump i_return_value

#---------------------------------------------------------------------

gm_mpeg_pause_recording ()

# Purpose : This file contains an example of a call to the


# following function:
#
# 1. gm_mpeg_start_recording()
# 2. gm_mpeg_pause_recording()
# 3. gm_mpeg_resume_recording()
# 4. gm_mpeg_stop_recording()
#
# These functions are for the recording of .mpeg
# images file. gm_mpeg_start_recording function
# starts recording. Rest three functions are
# void functions. These functions do not contain any
# input/output arguments and return value etc.
#
# 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 gm_mpeg_start_recording()
# has the following arguments:
#
# gm_mpeg_start_recording ( file_name, @
# file_version, @
# x, @
# y, @
# width, @
# height, @
# quality, @
# maxframes)
#
#---------------------------------------------------------------------
# Variable Declarations

STRING asm_create_patch_xy_created_ids[VIRTUAL]
STRING asm_delete_any_deleted_ids[VIRTUAL]
STRING file_name[80]
STRING file_version[80]
Main Index
790
Code Examples

REAL x
REAL y
REAL width
REAL height
INTEGER quality
INTEGER maxframes
INTEGER i_return_value

#---------------------------------------------------------------------
# Open a new data base.

uil_file_new.go( "", "new.db" )

#---------------------------------------------------------------------
# Argument Initialization.

file_name = "./new.mpg"
file_version = "Increment"
x = 0.
y = 0.
width = 1.0
height = 1.0
quality = 90
maxframes = 1000

#---------------------------------------------------------------------
# Start the recording of .mpeg images file named "./new.mpg".

i_return_value = gm_mpeg_start_recording(file_name, @
file_version, @
x, @
y, @
width, @
height, @
quality, @
maxframes)

#---------------------------------------------------------------------
# Dump the output of the function

dump i_return_value

#---------------------------------------------------------------------
# Create a 2-D patch.

ga_viewport_location_set( "default_viewport", @
0.049213, 3.592520, 1 )

asm_const_patch_xyz( "1", "<1 1 0>", "[0 0 0]", "Coord 0", @


asm_create_patch_xy_created_ids )

ga_view_aa_set( -157., 34, -180. )

#---------------------------------------------------------------------
# Pause the recording .mpeg images file named "./new.mpg".

gm_mpeg_pause_recording( )

#---------------------------------------------------------------------
# Create the second 2-D patch.

ga_view_aa_set( 178.170273, -38.784752, -148.256989 )

asm_const_patch_xyz( "2", "<1 1 0>", "[ 10 0 0]", @


"Coord 0", @
asm_create_patch_xy_created_ids )
Main Index
CHAPTER 4 791
Graphics

#---------------------------------------------------------------------
# Resume the recording .mpeg images file named "./new.mpg".

gm_mpeg_resume_recording( )

#---------------------------------------------------------------------
# Delete the second 2-D patch.

asm_delete_surface( "Surface 2", asm_delete_any_deleted_ids )

#---------------------------------------------------------------------
# Stop the recording .mpeg images file named "./new.mpg".

gm_mpeg_stop_recording( )

#---------------------------------------------------------------------
# closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

gm_mpeg_resume_recording ()

# Purpose : This file contains an example of a call to the


# following function:
#
# 1. gm_mpeg_start_recording()
# 2. gm_mpeg_pause_recording()
# 3. gm_mpeg_resume_recording()
# 4. gm_mpeg_stop_recording()
#
# These functions are for the recording of .mpeg
# images file. gm_mpeg_start_recording function
# starts recording. Rest three functions are
# void functions. These functions do not contain any
# input/output arguments and return value etc.
#
# 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 gm_mpeg_start_recording()
# has the following arguments:
#
# gm_mpeg_start_recording ( file_name, @
# file_version, @
# x, @
# y, @
# width, @
# height, @
# quality, @
# maxframes)
#
#---------------------------------------------------------------------
# Variable Declarations

STRING asm_create_patch_xy_created_ids[VIRTUAL]
STRING asm_delete_any_deleted_ids[VIRTUAL]
STRING file_name[80]
STRING file_version[80]
REAL x
Main Index
792
Code Examples

REAL y
REAL width
REAL height
INTEGER quality
INTEGER maxframes
INTEGER i_return_value

#---------------------------------------------------------------------
# Open a new data base.

uil_file_new.go( "", "new.db" )

#---------------------------------------------------------------------
# Argument Initialization.

file_name = "./new.mpg"
file_version = "Increment"
x = 0.
y = 0.
width = 1.0
height = 1.0
quality = 90
maxframes = 1000

#---------------------------------------------------------------------
# Start the recording of .mpeg images file named "./new.mpg".

i_return_value = gm_mpeg_start_recording(file_name, @
file_version, @
x, @
y, @
width, @
height, @
quality, @
maxframes)

#---------------------------------------------------------------------
# Dump the output of the function

dump i_return_value

#---------------------------------------------------------------------
# Create a 2-D patch.

ga_viewport_location_set( "default_viewport", @
0.049213, 3.592520, 1 )

asm_const_patch_xyz( "1", "<1 1 0>", "[0 0 0]", "Coord 0", @


asm_create_patch_xy_created_ids )

ga_view_aa_set( -157., 34, -180. )

#---------------------------------------------------------------------
# Pause the recording .mpeg images file named "./new.mpg".

gm_mpeg_pause_recording( )

#---------------------------------------------------------------------
# Create the second 2-D patch.

ga_view_aa_set( 178.170273, -38.784752, -148.256989 )

asm_const_patch_xyz( "2", "<1 1 0>", "[ 10 0 0]", @


"Coord 0", @
asm_create_patch_xy_created_ids )

#---------------------------------------------------------------------
Main Index
CHAPTER 4 793
Graphics

# Resume the recording .mpeg images file named "./new.mpg".

gm_mpeg_resume_recording( )

#---------------------------------------------------------------------
# Delete the second 2-D patch.

asm_delete_surface( "Surface 2", asm_delete_any_deleted_ids )

#---------------------------------------------------------------------
# Stop the recording .mpeg images file named "./new.mpg".

gm_mpeg_stop_recording( )

#---------------------------------------------------------------------
# closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

gm_mpeg_start_recording ()

# Purpose : This file contains an example of a call to the


# following function:
#
# 1. gm_mpeg_start_recording()
# 2. gm_mpeg_pause_recording()
# 3. gm_mpeg_resume_recording()
# 4. gm_mpeg_stop_recording()
#
# These functions are for the recording of .mpeg
# images file. gm_mpeg_start_recording function
# starts recording. Rest three functions are
# void functions. These functions do not contain any
# input/output arguments and return value etc.
#
# 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 gm_mpeg_start_recording()
# has the following arguments:
#
# gm_mpeg_start_recording ( file_name, @
# file_version, @
# x, @
# y, @
# width, @
# height, @
# quality, @
# maxframes)
#
#---------------------------------------------------------------------
# Variable Declarations

STRING asm_create_patch_xy_created_ids[VIRTUAL]
STRING asm_delete_any_deleted_ids[VIRTUAL]
STRING file_name[80]
STRING file_version[80]
REAL x
REAL y
Main Index
794
Code Examples

REAL width
REAL height
INTEGER quality
INTEGER maxframes
INTEGER i_return_value

#---------------------------------------------------------------------
# Open a new data base.

uil_file_new.go( "", "new.db" )

#---------------------------------------------------------------------
# Argument Initialization.

file_name = "./new.mpg"
file_version = "Increment"
x = 0.
y = 0.
width = 1.0
height = 1.0
quality = 90
maxframes = 1000

#---------------------------------------------------------------------
# Start the recording of .mpeg images file named "./new.mpg".

i_return_value = gm_mpeg_start_recording(file_name, @
file_version, @
x, @
y, @
width, @
height, @
quality, @
maxframes)

#---------------------------------------------------------------------
# Dump the output of the function

dump i_return_value

#---------------------------------------------------------------------
# Create a 2-D patch.

ga_viewport_location_set( "default_viewport", @
0.049213, 3.592520, 1 )

asm_const_patch_xyz( "1", "<1 1 0>", "[0 0 0]", "Coord 0", @


asm_create_patch_xy_created_ids )

ga_view_aa_set( -157., 34, -180. )

#---------------------------------------------------------------------
# Pause the recording .mpeg images file named "./new.mpg".

gm_mpeg_pause_recording( )

#---------------------------------------------------------------------
# Create the second 2-D patch.

ga_view_aa_set( 178.170273, -38.784752, -148.256989 )

asm_const_patch_xyz( "2", "<1 1 0>", "[ 10 0 0]", @


"Coord 0", @
asm_create_patch_xy_created_ids )

#---------------------------------------------------------------------
# Resume the recording .mpeg images file named "./new.mpg".
Main Index
CHAPTER 4 795
Graphics

gm_mpeg_resume_recording( )

#---------------------------------------------------------------------
# Delete the second 2-D patch.

asm_delete_surface( "Surface 2", asm_delete_any_deleted_ids )

#---------------------------------------------------------------------
# Stop the recording .mpeg images file named "./new.mpg".

gm_mpeg_stop_recording( )

#---------------------------------------------------------------------
# closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

gm_mpeg_stop_recording ()

# Purpose : This file contains an example of a call to the


# following function:
#
# 1. gm_mpeg_start_recording()
# 2. gm_mpeg_pause_recording()
# 3. gm_mpeg_resume_recording()
# 4. gm_mpeg_stop_recording()
#
# These functions are for the recording of .mpeg
# images file. gm_mpeg_start_recording function
# starts recording. Rest three functions are
# void functions. These functions do not contain any
# input/output arguments and return value etc.
#
# 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 gm_mpeg_start_recording()
# has the following arguments:
#
# gm_mpeg_start_recording ( file_name, @
# file_version, @
# x, @
# y, @
# width, @
# height, @
# quality, @
# maxframes)
#
#---------------------------------------------------------------------
# Variable Declarations

STRING asm_create_patch_xy_created_ids[VIRTUAL]
STRING asm_delete_any_deleted_ids[VIRTUAL]
STRING file_name[80]
STRING file_version[80]
REAL x
REAL y
REAL width
Main Index
796
Code Examples

REAL height
INTEGER quality
INTEGER maxframes
INTEGER i_return_value

#---------------------------------------------------------------------
# Open a new data base.

uil_file_new.go( "", "new.db" )

#---------------------------------------------------------------------
# Argument Initialization.

file_name = "./new.mpg"
file_version = "Increment"
x = 0.
y = 0.
width = 1.0
height = 1.0
quality = 90
maxframes = 1000

#---------------------------------------------------------------------
# Start the recording of .mpeg images file named "./new.mpg".

i_return_value = gm_mpeg_start_recording(file_name, @
file_version, @
x, @
y, @
width, @
height, @
quality, @
maxframes)

#---------------------------------------------------------------------
# Dump the output of the function

dump i_return_value

#---------------------------------------------------------------------
# Create a 2-D patch.

ga_viewport_location_set( "default_viewport", @
0.049213, 3.592520, 1 )

asm_const_patch_xyz( "1", "<1 1 0>", "[0 0 0]", "Coord 0", @


asm_create_patch_xy_created_ids )

ga_view_aa_set( -157., 34, -180. )

#---------------------------------------------------------------------
# Pause the recording .mpeg images file named "./new.mpg".

gm_mpeg_pause_recording( )

#---------------------------------------------------------------------
# Create the second 2-D patch.

ga_view_aa_set( 178.170273, -38.784752, -148.256989 )

asm_const_patch_xyz( "2", "<1 1 0>", "[ 10 0 0]", @


"Coord 0", @
asm_create_patch_xy_created_ids )

#---------------------------------------------------------------------
# Resume the recording .mpeg images file named "./new.mpg".
Main Index
CHAPTER 4 797
Graphics

gm_mpeg_resume_recording( )

#---------------------------------------------------------------------
# Delete the second 2-D patch.

asm_delete_surface( "Surface 2", asm_delete_any_deleted_ids )

#---------------------------------------------------------------------
# Stop the recording .mpeg images file named "./new.mpg".

gm_mpeg_stop_recording( )

#---------------------------------------------------------------------
# closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

gm_viewport_hardware_mode_get ()

# Purpose : This file provides an example of a call to the


# function gm_viewport_hardware_mode_get()
#
# This function is used to get the hardware
# drawing mode of viewports.
#
# 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 gm_viewport_hardware_mode_get()
# has the following arguments:
#
# gm_viewport_hardware_mode_get
# ( hard_flag )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_hard_flag
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

gm_viewport_hardware_mode_get @
( i_hard_flag )

dump i_return_value, i_hard_flag

#---------------------------------------------------------------------

gm_viewport_hardware_mode_set ()

# Purpose : This file provides an example of two calls


# to function gm_viewport_hardware_mode_set()
#
# This function is used to set the hardware
# drawing mode of viewports.
Main Index
798
Code Examples

#
# 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 gm_viewport_hardware_mode_set()
# has the following arguments:
#
# gm_viewport_hardware_mode_set
# ( hard_flag )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_hard_flag
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Set hardware mode to ON


i_hard_flag = 1
gm_viewport_hardware_mode_set @
( i_hard_flag )

# Session file paused. Press “Resume” to continue..


sf_pause()

# Set hardware mode to OFF


i_hard_flag = 0
gm_viewport_hardware_mode_set @
( i_hard_flag )

#---------------------------------------------------------------------

gm_viewport_id_to_name ()

# Purpose : This file provides an example of a call to the


# function gm_viewport_id_to_name()
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function gm_viewport_id_to_name()
# has the following arguments:
#
# gm_viewport_id_to_name
# ( id,
# name )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_id
STRING s_name[128]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)
Main Index
CHAPTER 4 799
Graphics

# Get the ID of the current viewport


i_return_value = @
db_get_current_viewport_id @
( i_id )
dump i_return_value, i_id

# Get the name of the current viewport


i_return_value = @
gm_viewport_id_to_name @
( i_id, @
s_name )
dump i_return_value, s_name

#---------------------------------------------------------------------

gm_viewport_limits_get ()

# Purpose : This file provides an example of a call to the


# function gm_viewport_limits_get()
#
# This function is used to determine the limits
# of the model in View Space.
#
# 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 gm_viewport_limits_get()
# has the following arguments:
#
# gm_viewport_limits_get
# ( persp,
# limits )
#
#---------------------------------------------------------------------
# Variable Declarations
LOGICAL l_persp
REAL ra_limits(6)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)
ga_view_aa_set(23.,56.,0.)

# Get the limits of the model (min/max X,Y and Z co-ordinates)


# skip perspective
l_persp = TRUE
i_return_value = @
gm_viewport_limits_get @
( l_persp, @
ra_limits )
dump i_return_value, ra_limits

# use perspective settings


l_persp = FALSE
i_return_value = @
gm_viewport_limits_get @
( l_persp, @
ra_limits )
dump i_return_value, ra_limits
Main Index
800
Code Examples

#---------------------------------------------------------------------

gm_viewport_ncolors_get ()

# Purpose : This file provides an example of a call to the


# function gm_viewport_ncolors_get()
#
# This function is used to get the number of
# colors used by graphics manager.
#
# 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 gm_viewport_ncolors_get()
# has the following arguments:
#
# gm_viewport_ncolors_get
# ( ncolors )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_ncolors
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

gm_viewport_ncolors_get @
( i_ncolors )
dump i_ncolors

#---------------------------------------------------------------------

gm_viewport_refresh_off ()

# Purpose : This file provides an example of a call to the


# function gm_viewport_refresh_off()
#
# This function is used to turn OFF automatic
# viewport refresh.
#
# 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 gm_viewport_refresh_off() has no arguments.
#
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Show wireframe model


uil_toolbar.wireframe()
repaint_graphics()
Main Index
CHAPTER 4 801
Graphics

# Turn automatic viewport refresh to OFF


gm_viewport_refresh_off()

# Select shaded model


uil_toolbar.shaded_smooth()

# Session file paused. Press “Resume” to continue..


sf_pause()

# Force repaint
repaint_graphics()

# Select wireframe model


uil_toolbar.wireframe()

# Session file paused. Press “Resume” to continue..


sf_pause()

# Force repaint
repaint_graphics()
#---------------------------------------------------------------------

gm_viewport_refresh_on ()

# Purpose : This file provides an example of a call to the


# function gm_viewport_refresh_on()
#
# This function is used to turn ON automatic
# viewport refresh.
#
# 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 gm_viewport_refresh_on() has no arguments.
#
#---------------------------------------------------------------------
# Variable Declarations
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Show wireframe model


uil_toolbar.wireframe()
repaint_graphics()

# Turn automatic viewport refresh to ON


gm_viewport_refresh_on()

# Select shaded model


uil_toolbar.shaded_smooth()

# Session file paused. Press “Resume” to continue..


sf_pause()

# Select wireframe model


uil_toolbar.wireframe()

# Session file paused. Press “Resume” to continue..


sf_pause()
#---------------------------------------------------------------------

Main Index
802
Code Examples

gm_viewport_refresh_status ()

# Purpose : This file provides an example of a call to the


# function gm_viewport_refresh_status()
#
# This function is used to return the current
# viewport refresh status.
#
# 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 gm_viewport_refresh_status() has no arguments.
#
#---------------------------------------------------------------------
# Variable Declarations
LOGICAL l_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Turn automatic viewport refresh to OFF


gm_viewport_refresh_off()

# Findout the current status of refresh mode


l_return_value = gm_viewport_refresh_status()
dump l_return_value

# Turn automatic viewport refresh to ON


gm_viewport_refresh_on()

# Findout the current status of refresh mode


l_return_value = gm_viewport_refresh_status()
dump l_return_value
#---------------------------------------------------------------------

gm_viewport_view_corners ()

# Purpose : This file provides an example of a call to the


# function gm_viewport_view_corners()
#
# This function is used to calculate the centre
# and zoom for viewport given two corners of
# a rectangle.
#
# 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 gm_viewport_view_corners()
# has the following arguments:
#
# gm_viewport_view_corners
# ( id,
# ul,
Main Index
CHAPTER 4 803
Graphics

# lr,
# cent_x,
# cent_y,
# zoom )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_id
INTEGER ia_ul(2), ia_br(2)
INTEGER i_ulx,i_uly,i_brx,i_bry,i_ppi
REAL r_cent_x, r_cent_y, r_zoom
REAL r_width, r_height
INTEGER i_return_value
STRING s_name[32]
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Get screen Info


uid_get_screen_info(i_ulx,i_uly,i_brx,i_bry,i_ppi)

# Get the ID of the current viewport


i_return_value = @
db_get_current_viewport_id @
( i_id )
dump i_return_value, i_id

# Get the name of the current viewport


i_return_value = @
gm_viewport_id_to_name @
( i_id, @
s_name )
dump i_return_value, s_name

# Get the width and height of the current viewport


i_return_value = @
ga_viewport_size_get @
( s_name, @
r_width, @
r_height )
dump i_return_value, r_width, r_height

# Zoom to the centre


ia_ul(1) = r_width *i_ppi/2 -20
ia_ul(2) = r_height*i_ppi/2 -20
ia_br(1) = r_width *i_ppi/2 +20
ia_br(2) = r_height*i_ppi/2 +20

i_return_value = @
gm_viewport_view_corners @
( i_id, @
ia_ul, @
ia_br, @
r_cent_x, @
r_cent_y, @
r_zoom )
dump i_return_value, r_cent_x, r_cent_y, r_zoom

# Zoom in
ga_view_center_set(r_cent_x,r_cent_y)
ga_view_zoom_set(r_zoom)
#---------------------------------------------------------------------

Main Index
804
Code Examples

gm_visibility_all ()

# Purpose : This file provides an example of two calls to


# the function gm_visibility_all()
#
# This function is used to set the visibility
# status of all widgets.
#
# 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 gm_visibility_all()
# has the following arguments:
#
# gm_visibility_all
# ( vstat )
#
#---------------------------------------------------------------------
# Variable Declarations
LOGICAL l_vstat
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Session file paused. Press “Resume” to continue..


sf_pause()

# Set visibility status of all objects to FALSE


l_vstat = FALSE
i_return_value = @
gm_visibility_all @
( l_vstat )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Set visibility status of all objects to TRUE


l_vstat = TRUE
i_return_value = @
gm_visibility_all @
( l_vstat )
dump i_return_value

#---------------------------------------------------------------------

gm_visibility_widget ()

# Purpose : This file provides an example of a call to the


# function gm_visibility_widget()
#
# This function is used to set visibility status
# of all the objects listed in the string.
#
# Before running this session file run spool.ses
# to create spool.db
#
Main Index
CHAPTER 4 805
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 gm_visibility_widget()
# has the following arguments:
#
# gm_visibility_widget
# ( entity_list,
# visibility )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_entity_list[128]
LOGICAL l_visibility
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Make sure that all objects are visible


gm_visibility_all(TRUE)

# Session file paused. Press “Resume” to continue..


sf_pause()

# Set the visibility of “Element 1:200” to FALSE


s_entity_list = “Element 1:200”
l_visibility = FALSE
i_return_value = @
gm_visibility_widget @
( s_entity_list, @
l_visibility )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

gm_visibility_all(TRUE)
#---------------------------------------------------------------------

gm_write_image ()

# Purpose : This function prints the output window to


# a 'ppm' or a 'bmp' file. It returns a
# status 0 for success and 1 for failure.
#
# This file can be run from the MSC.Patran window
# by running this session file through the
# "File","Session","Play" pulldown menus
# on the menu bar.
#
#
# The function gm_write_image()
# has the following arguments:
#
# gm_write_image
# ( imagetype,
# filename,
# version_option,
# xpcnt,
# ypcnt,
# widthpcnt,
# heightpcnt,
Main Index
806
Code Examples

# quality )
#
#---------------------------------------------------------------------
# Variable Declarations

STRING asm_create_patch_xy_created_ids[VIRTUAL]
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]
INTEGER fem_create_mesh_surfa_num_nodes
INTEGER fem_create_mesh_surfa_num_elems
INTEGER i_return_value
#----------------------------------------------------------------------
# Open a new database
if(!db_is_open())THEN
uil_file_new.go("","new.db")
$? YES 36000002
endif
#----------------------------------------------------------------------
# Setting the preference to MSC.Nastran.

uil_pref_analysis.set_analysis_pref( "MSC.Nastran", @
"Structural", @
"", @
".op2" )
#----------------------------------------------------------------------
# Create the geometry - SURFACE 1
#
i_return_value = asm_const_patch_xyz @
( "1", @
"<1 1 0>", @
"[0 0 0]", @
"Coord 0", @
asm_create_patch_xy_created_ids )

dump i_return_value
#----------------------------------------------------------------------
# Create finite element entities
# Creating 36 nodes and 25 elements for Surface 1.

ui_exec_function( "mesh_seed_display_mgr", "init" )

mesh_seed_create( "Surface 1.4 1.3 1.2 1.1 ", @


1, 5, 0., 0., 0. )

i_return_value = fem_create_mesh_surf_3( @
"IsoMesh", @
0, @
"Surface 1 ", @
1, @
["0.2"], @
"Quad4", @
"1", @
"1", @
"Coord 0", @
"Coord 0", @
fem_create_mesh_surfa_num_nodes, @
fem_create_mesh_surfa_num_elems, @
fem_create_mesh_s_nodes_created, @
fem_create_mesh_s_elems_created )

dump i_return_value

mesh_seed_display_mgr.erase( )
#----------------------------------------------------------------------
# Create loads/boundary conditions
# Creating set 'fixed_nodes' on L.H.S. of the model
Main Index
CHAPTER 4 807
Graphics

# Creating set of forces 'Loads_at_ends', Force of 50 units downwards.

i_return_value = loadsbcs_create2( @
"fixed_nodes", @
"Displacement", @
"Nodal", @
"", @
"Static", @
[" Node 1 31"], @
"FEM", @
"Coord 0", @
"1.", @
["<0,0,0>", @
"<0,0,0>"], @
["", ""] )

dump i_return_value

i_return_value = loadsbcs_create2( @
"Load_at_ends", @
"Force", @
"Nodal", @
"", @
"Static", @
[" Node 36 6"], @
"FEM", @
"Coord 0", @
"1.", @
["<0,-50,0>", @
"<0,0,0>"], @
["", ""] )

dump i_return_value
#----------------------------------------------------------------------
# Using the function gm_write_image() to dump the output of the
# window into a file image_0.bmp

i_return_value = gm_write_image( @
"ppm", @
"image.ppm", @
"", @
0, @
0, @
1, @
1, @
0 )

dump i_return_value
#----------------------------------------------------------------------
# Closing the file new.db

uil_file_close.goquit()

#----------------------------------------------------------------------
# End of file

gm_write_vrml

# Purpose : This function copies the image from the


# screen into a "vrml" format. It returns an
# integer value for the execution status:
# 1 for success, 0 for failure.
# The function requires filename and the option
Main Index
808
Code Examples

# for filename version.


#
# 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 gm_write_vrml()
# has the following arguments:
#
# gm_write_vrml
# ( filename,
# Version_logic )
#---------------------------------------------------------------------
# Variable Declarations

INTEGER fem_create_mesh_surfa_num_nodes
INTEGER fem_create_mesh_surfa_num_elems
INTEGER int_status
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]
STRING asm_create_patch_xy_created_ids[VIRTUAL]
STRING filename[256] = "image.wrl"
#----------------------------------------------------------------------
# Open a new database
if(!db_is_open())THEN
uil_file_new.go("","new.db")
$? YES 36000002
endif
#----------------------------------------------------------------------
# Setting the preference to MSC.Nastran.

uil_pref_analysis.set_analysis_pref( "MSC.Nastran", @
"Structural", @
"", @
".op2" )
#----------------------------------------------------------------------
# Create the surface 1

int_status = asm_const_patch_xyz( @
"1", @
"<1 1 0>", @
"[0 0 0]", @
"Coord 0", @
asm_create_patch_xy_created_ids )
dump int_status
#----------------------------------------------------------------------
# Create the finite elements
# Create 121 nodes and 100 elements for Surface 1.

ui_exec_function( "mesh_seed_display_mgr", "init" )

int_status = fem_create_mesh_surf_3( @
"IsoMesh", @
16384, @
"Surface 1", @
1, @
["0.1"], @
"Quad4", @
"#", @
"#", @
"Coord 0", @
"Coord 0", @
fem_create_mesh_surfa_num_nodes, @
fem_create_mesh_surfa_num_elems, @
fem_create_mesh_s_nodes_created, @
Main Index
CHAPTER 4 809
Graphics

fem_create_mesh_s_elems_created )

mesh_seed_display_mgr.erase( )

dump int_status
#----------------------------------------------------------------------
# Using the function gm_write_vrml() to send the output of screen to
# the file image_0.wrl
# The function returns 1 for success and 0 for failure

int_status = gm_write_vrml(filename,"Overwrite")

dump int_status
#----------------------------------------------------------------------
# Closing the file "new.db"

uil_file_close.goquit()

# End of file
#----------------------------------------------------------------------

ga_lookup_create ()

# Purpose : This file provides an example of a call to the


# function ga_lookup_create()
#
# This function is used to create a new color
# lookup table
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_lookup_create()
# has the following arguments:
#
# ga_lookup_create
# ( name,
# number,
# rgb )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
STRING sa_tables[32](VIRTUAL)
INTEGER i_number
INTEGER i_ntables
REAL ra_rgb(8,3)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Create a new color lookup table


s_name = “new_8colors”
i_number = 8
ra_rgb = [ @
[0.0, 0.0, 0.0] [1.0, 0.0, 0.0] [0.0, 1.0, 0.0] [0.0, 0.0, 1.0] @
[1.0, 1.0, 0.0] [0.0, 1.0, 1.0] [1.0, 0.0, 1.0] [1.0, 1.0, 1.0] ]

i_return_value = @
Main Index
810
Code Examples

ga_lookup_create @
( s_name, @
i_number, @
ra_rgb )
dump i_return_value

# Get the number of LUTs present in the database


i_return_value = @
ga_lookup_ntables_get @
( i_ntables )

SYS_ALLOCATE_ARRAY(sa_tables,1,i_ntables)

# Get the list of LUTs present in the database


i_return_value = @
ga_lookup_tables_get @
( sa_tables )
dump i_return_value
dump sa_tables

SYS_FREE_ARRAY(sa_tables)

# Session file paused. Press “Resume” to continue..


sf_pause()

# Delete the created color table


i_return_value = @
ga_lookup_delete @
( s_name )
dump i_return_value

# Close the database “spool.db”


uil_file_close.go()
#---------------------------------------------------------------------

ga_lookup_current_set ()

# Purpose : This file provides an example of a call to the


# function ga_lookup_current_set()
#
# This function is used to set the current
# color lookup table
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_lookup_current_set()
# has the following arguments:
#
# ga_lookup_current_set
# ( name )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32],s_old_name[32],s_new_name[32]
INTEGER i_number
REAL ra_rgb(8,3)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
Main Index
CHAPTER 4 811
Graphics

uil_file_open.go(“spool.db”)

# Get the current color lookup table


i_return_value = @
ga_lookup_current_get @
( s_old_name )

# Create a new color lookup table


s_name = “new_8colors”
i_number = 8
ra_rgb = [ @
[0.0, 0.0, 0.0] [1.0, 0.0, 0.0] [0.0, 1.0, 0.0] [0.0, 0.0, 1.0] @
[1.0, 1.0, 0.0] [0.0, 1.0, 1.0] [1.0, 0.0, 1.0] [1.0, 1.0, 1.0] ]

i_return_value = @
ga_lookup_create @
( s_name, @
i_number, @
ra_rgb )
dump i_return_value

# Set the new color lookup table


i_return_value = @
ga_lookup_current_set @
( s_name )
dump i_return_value

# Get the current color lookup table


i_return_value = @
ga_lookup_current_get @
( s_new_name )
dump i_return_value
dump s_new_name

# Session file paused. Press “Resume” to continue..


sf_pause()

# Set the old color lookup table


i_return_value = @
ga_lookup_current_set @
( s_old_name )
dump i_return_value

# Delete the created color table


i_return_value = @
ga_lookup_delete @
( s_name )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Close the database “spool.db”


uil_file_close.go()
#---------------------------------------------------------------------

ga_lookup_delete ()

# Purpose : This file provides an example of a call to the


# function ga_lookup_delete()
#
# This function is used to delete a color
# lookup table
#
# Before running this session file run spool.ses
Main Index
812
Code Examples

# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_lookup_delete()
# has the following arguments:
#
# ga_lookup_delete
# ( name )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
STRING sa_tables[32](VIRTUAL)
INTEGER i_number
INTEGER i_ntables
REAL ra_rgb(8,3)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Create a new color lookup table


s_name = “new_8colors”
i_number = 8
ra_rgb = [ @
[0.0, 0.0, 0.0] [1.0, 0.0, 0.0] [0.0, 1.0, 0.0] [0.0, 0.0, 1.0] @
[1.0, 1.0, 0.0] [0.0, 1.0, 1.0] [1.0, 0.0, 1.0] [1.0, 1.0, 1.0] ]

i_return_value = @
ga_lookup_create @
( s_name, @
i_number, @
ra_rgb )
dump i_return_value

# Get the number of LUTs present in the database


i_return_value = @
ga_lookup_ntables_get @
( i_ntables )

SYS_ALLOCATE_ARRAY(sa_tables,1,i_ntables)

# Get the list of LUTs present in the database


i_return_value = @
ga_lookup_tables_get @
( sa_tables )
dump i_return_value
dump sa_tables

SYS_FREE_ARRAY(sa_tables)

# Session file paused. Press “Resume” to continue..


sf_pause()

# Delete the created color table


i_return_value = @
ga_lookup_delete @
( s_name )
dump i_return_value

# Get the number of LUTs present in the database


i_return_value = @
ga_lookup_ntables_get @
( i_ntables )
Main Index
CHAPTER 4 813
Graphics

SYS_ALLOCATE_ARRAY(sa_tables,1,i_ntables)

# Get the list of LUTs present in the database


i_return_value = @
ga_lookup_tables_get @
( sa_tables )
dump i_return_value
dump sa_tables

SYS_FREE_ARRAY(sa_tables)

# Session file paused. Press “Resume” to continue..


sf_pause()

# Close the database “spool.db”


uil_file_close.go()
#---------------------------------------------------------------------

ga_range_create ()

# Purpose : This file provides an example of a call to the


# function ga_range_create()
#
# In this file a range is created, it’s existence
# in the database is verified, it is deleted from
# the database, and it’s non-existence in the
# database is verified.
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
# Make “spool_res.ses” available in the current
# working directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_range_create() has the following arguments:
#
# ga_range_create
# ( name,
# number )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
STRING sav_ranges[32](VIRTUAL)
INTEGER i_nranges
INTEGER i_number
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)

# Create a new range


s_name = “New Range”
i_number = 15
i_return_value = @
ga_range_create @
( s_name, @
i_number )
dump i_return_value

Main Index
814
Code Examples

# Get the number of ranges in the database


i_return_value = @
ga_range_nranges_get @
( i_nranges )
dump i_return_value, i_nranges

sys_allocate_array(sav_ranges,1,i_nranges)

# Get the list of ranges in the database


i_return_value = @
ga_range_ranges_get @
( sav_ranges )
dump i_return_value, sav_ranges

sys_free_array(sav_ranges)

# Session file paused. Press “Resume” to continue..


sf_pause()

# Delete the range


i_return_value = @
ga_range_delete @
( s_name )
dump i_return_value

# Get the number of ranges in the database


i_return_value = @
ga_range_nranges_get @
( i_nranges )
dump i_return_value, i_nranges

sys_allocate_array(sav_ranges,1,i_nranges)

# Get the list of ranges in the database


i_return_value = @
ga_range_ranges_get @
( sav_ranges )
dump i_return_value, sav_ranges

#---------------------------------------------------------------------

ga_range_delete ()

# Purpose : This file provides an example of a call to the


# function ga_range_delete()
#
# In this file a range is created, it’s existence
# in the database is verified, it is deleted from
# the database, and it’s non-existence in the
# database is verified.
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
# Make “spool_res.ses” available in the current
# working directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_range_delete() has the following arguments:
# ga_range_delete
# ( name )
Main Index
CHAPTER 4 815
Graphics

#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
STRING sav_ranges[32](VIRTUAL)
INTEGER i_nranges
INTEGER i_number
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)

# Create a new range


s_name = “New Range”
i_number = 15
i_return_value = @
ga_range_create @
( s_name, @
i_number )
dump i_return_value

# Get the number of ranges in the database


i_return_value = @
ga_range_nranges_get @
( i_nranges )
dump i_return_value, i_nranges

sys_allocate_array(sav_ranges,1,i_nranges)

# Get the list of ranges in the database


i_return_value = @
ga_range_ranges_get @
( sav_ranges )
dump i_return_value, sav_ranges

sys_free_array(sav_ranges)

# Session file paused. Press “Resume” to continue..


sf_pause()

# Delete the new range


i_return_value = @
ga_range_delete @
( s_name )
dump i_return_value

# Get the number of ranges in the database


i_return_value = @
ga_range_nranges_get @
( i_nranges )
dump i_return_value, i_nranges

sys_allocate_array(sav_ranges,1,i_nranges)

# Get the list of ranges in the database


i_return_value = @
ga_range_ranges_get @
( sav_ranges )
dump i_return_value, sav_ranges

#---------------------------------------------------------------------

Main Index
816
Code Examples

ga_spectrum_colors_set ()

# Purpose : This file provides an example of a call to the


# function ga_spectrum_colors_set()
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
# Make “spool_res.ses” available in the current
# working directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_spectrum_colors_set()
# has the following arguments:
#
# ga_spectrum_colors_set
# ( name,
# offset,
# number,
# colors )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
INTEGER iv_old_colors(VIRTUAL),ia_colors(16)
INTEGER iv_colors(VIRTUAL)
INTEGER i_old_number,i_number,iv_number
INTEGER i_offset
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)

# Get the current spectrum


i_return_value = @
ga_spectrum_current_get @
( s_name )
dump i_return_value
dump s_name

# Get the number of colors in the current spectrum


i_return_value = @
ga_spectrum_ncolors_get @
( s_name, @
i_old_number)
dump i_return_value
dump i_old_number

sys_allocate_array(iv_old_colors,1,i_old_number)

# Get the colors in the current spectrum


i_return_value = @
ga_spectrum_colors_get @
( s_name, @
iv_old_colors )
dump i_return_value
dump iv_old_colors

# Observe the original color settings.


# Session file paused. Press “Resume” to continue..
sf_pause()
Main Index
CHAPTER 4 817
Graphics

# Set the colors in the current spectrum


i_offset =0
i_number =16
ia_colors =[0,15,1,14,2,13,3,12,4,11,5,10,6,9,7,8]
i_return_value = @
ga_spectrum_colors_set @
( s_name, @
i_offset, @
i_number, @
ia_colors )
dump i_return_value

# Get the number of colors in the current spectrum


i_return_value = @
ga_spectrum_ncolors_get @
( s_name, @
iv_number)
dump i_return_value
dump iv_number

sys_allocate_array(iv_colors,1,iv_number)

# Get the colors in the current spectrum


i_return_value = @
ga_spectrum_colors_get @
( s_name, @
iv_colors )
dump i_return_value
dump iv_colors

sys_free_array(iv_colors)

# Observe the changed color settings.


# Session file paused. Press “Resume” to continue
# and restore the original color settings.
sf_pause()

# Set the original colors in the current spectrum


i_offset =0
i_number =i_old_number
i_return_value = @
ga_spectrum_colors_set @
( s_name, @
i_offset, @
i_number, @
iv_old_colors )
dump i_return_value

# Get the number of colors in the current spectrum


i_return_value = @
ga_spectrum_ncolors_get @
( s_name, @
iv_number)
dump i_return_value
dump iv_number

sys_allocate_array(iv_colors,1,iv_number)

# Get the colors in the current spectrum


i_return_value = @
ga_spectrum_colors_get @
( s_name, @
iv_colors )
dump i_return_value
Main Index
818
Code Examples

dump iv_colors

#---------------------------------------------------------------------

ga_spectrum_continuous_set ()

# Purpose : This file provides an example of two calls to


# the function ga_spectrum_continuous_set().
#
# This function is used to set the continuous
# tone flag of a spectrum.
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
# Make “spool_res.ses” available in the current
# working directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_spectrum_continuous_set()
# has the following arguments:
#
# ga_spectrum_continuous_set
# ( name,
# value )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
INTEGER i_old_value,i_value
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)

# Get the current spectrum


i_return_value = @
ga_spectrum_current_get @
( s_name )
dump i_return_value
dump s_name

# Get the continuous tone flag of the current spectrum


i_return_value = @
ga_spectrum_continuous_get @
( s_name, @
i_old_value )
dump i_return_value
dump i_old_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Set the continuous tone flag of the current spectrum


i_value = 1
i_return_value = @
ga_spectrum_continuous_set @
( s_name, @
i_value )
dump i_return_value
Main Index
CHAPTER 4 819
Graphics

# Session file paused. Press “Resume” to continue..


sf_pause()

# Get the continuous tone flag of the current spectrum


i_value = 0
i_return_value = @
ga_spectrum_continuous_get @
( s_name, @
i_value )
dump i_return_value
dump i_value

# Set the continuous tone flag of the current spectrum to it’s


# old value
i_value = i_old_value
i_return_value = @
ga_spectrum_continuous_set @
( s_name, @
i_value )
dump i_return_value

#---------------------------------------------------------------------

ga_spectrum_create ()

# Purpose : This file provides an example of a call to the


# function ga_spectrum_create()
#
# In this file a spectrum is created, it’s
# existence in the database is verified, it is
# deleted from the database, and it’s
# non-existence in the database is verified.
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
# Make “spool_res.ses” available in the current
# working directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_spectrum_create() has the following arguments:
#
# ga_spectrum_create
# ( name,
# number,
# colors )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
STRING sav_spectrums[32](VIRTUAL)
INTEGER i_nspectrums
INTEGER i_number
INTEGER ia_colors(16)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)

# Create a spectrum
s_name = “new_spectrum”
i_number = 16
Main Index
820
Code Examples

ia_colors= [0,15,1,14,2,13,3,12,4,11,5,10,6,9,7,8]
i_return_value = @
ga_spectrum_create @
( s_name, @
i_number, @
ia_colors )
dump i_return_value

# Get the number of spectrums in the database


i_return_value = @
ga_spectrum_nspectrums_get @
( i_nspectrums )
dump i_return_value
dump i_nspectrums

sys_allocate_array(sav_spectrums,1,i_nspectrums)

i_return_value = @
ga_spectrum_spectrums_get @
( sav_spectrums )
dump i_return_value
dump sav_spectrums

sys_free_array(sav_spectrums)

# Session file paused. Press “Resume” to continue..


sf_pause()

# Delete the created spectrum


i_return_value = @
ga_spectrum_delete @
( s_name )
dump i_return_value

# Get the number of spectrums in the database


i_return_value = @
ga_spectrum_nspectrums_get @
( i_nspectrums )
dump i_return_value
dump i_nspectrums

sys_allocate_array(sav_spectrums,1,i_nspectrums)

i_return_value = @
ga_spectrum_spectrums_get @
( sav_spectrums )
dump i_return_value
dump sav_spectrums

# Session file paused. Press “Resume” to continue..


sf_pause()

sys_free_array(sav_spectrums)

# Close the database “spool.db”


uil_file_close.go()

#---------------------------------------------------------------------

ga_spectrum_current_set ()

# Purpose : This file provides an example of a call to the


# function ga_spectrum_current_set()
#
# This function is used to set the current
# spectrum.
Main Index
CHAPTER 4 821
Graphics

# In this file first the current spectrum is


# saved, then a new spectrum is created and
# made current, finally restoring the original
# spectrum and deleting the new spectrum.
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
# Make “spool_res.ses” available in the current
# working directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_spectrum_current_set()
# has the following arguments:
#
# ga_spectrum_current_set
# ( name )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_old_name[32],s_name[32]
INTEGER i_number
INTEGER ia_colors(16)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)

# Get the current spectrum


i_return_value = @
ga_spectrum_current_get @
( s_old_name )
dump i_return_value, s_old_name

# Create a spectrum
s_name = “new_spectrum”
i_number = 16
ia_colors= [0,15,1,14,2,13,3,12,4,11,5,10,6,9,7,8]
i_return_value = @
ga_spectrum_create @
( s_name, @
i_number, @
ia_colors )
dump i_return_value

# Make the new spectrum as current spectrum


i_return_value = @
ga_spectrum_current_set @
( s_name )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Get the current spectrum


s_name = ““
i_return_value = @
ga_spectrum_current_get @
( s_name )
dump i_return_value, s_name

# Restore the old spectrum


i_return_value = @
ga_spectrum_current_set @
Main Index
822
Code Examples

( s_old_name )
dump i_return_value

# Delete the created spectrum


i_return_value = @
ga_spectrum_delete @
( s_name )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Close the database “spool.db”


uil_file_close.go()
#---------------------------------------------------------------------

ga_spectrum_delete ()

# Purpose : This file provides an example of a call to the


# function ga_spectrum_delete()
#
# This function is used to delete a spectrum.
# In this file a spectrum is created, it’s
# existence in the database is verified, it is
# deleted from the database, and it’s
# non-existence in the database is verified.
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
# Make “spool_res.ses” available in the current
# working directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_spectrum_delete()
# has the following arguments:
#
# ga_spectrum_delete
# ( name )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
STRING sav_spectrums[32](VIRTUAL)
INTEGER i_nspectrums
INTEGER i_number
INTEGER ia_colors(16)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)

# Create a spectrum
s_name = “new_spectrum”
i_number = 16
ia_colors= [0,15,1,14,2,13,3,12,4,11,5,10,6,9,7,8]
i_return_value = @
ga_spectrum_create @
( s_name, @
i_number, @
ia_colors )
Main Index
CHAPTER 4 823
Graphics

dump i_return_value

# Get the number of spectrums in the database


i_return_value = @
ga_spectrum_nspectrums_get @
( i_nspectrums )
dump i_return_value
dump i_nspectrums

sys_allocate_array(sav_spectrums,1,i_nspectrums)

# Get the list of spectrums in the database


i_return_value = @
ga_spectrum_spectrums_get @
( sav_spectrums )
dump i_return_value
dump sav_spectrums

sys_free_array(sav_spectrums)

# Session file paused. Press “Resume” to continue..


sf_pause()

# Delete the created spectrum


i_return_value = @
ga_spectrum_delete @
( s_name )
dump i_return_value

# Get the number of spectrums in the database


i_return_value = @
ga_spectrum_nspectrums_get @
( i_nspectrums )
dump i_return_value
dump i_nspectrums

sys_allocate_array(sav_spectrums,1,i_nspectrums)

i_return_value = @
ga_spectrum_spectrums_get @
( sav_spectrums )
dump i_return_value
dump sav_spectrums

# Session file paused. Press “Resume” to continue..


sf_pause()

sys_free_array(sav_spectrums)

# Close the database “spool.db”


uil_file_close.go()

#---------------------------------------------------------------------

ga_spectrum_interpolation_set ()

# Purpose : This file provides an example of two calls to


# the function ga_spectrum_interpolation_set()
#
# This function is used to set the interpolation
# factor of a spectrum.
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
Main Index
824
Code Examples

# Make “spool_res.ses” available in the current


# working directory.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_spectrum_interpolation_set()
# has the following arguments:
#
# ga_spectrum_interpolation_set
# ( name,
# factor )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
REAL r_old_factor,r_factor
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)

# Get the current spectrum


i_return_value = @
ga_spectrum_current_get @
( s_name )
dump i_return_value
dump s_name

# Get the interpolation factor of the current spectrum


i_return_value = @
ga_spectrum_interpolation_get @
( s_name, @
r_old_factor )
dump i_return_value
dump r_old_factor

# Session file paused. Press “Resume” to continue..


sf_pause()

# Set the interpolation factor of the current spectrum


r_factor = 4.0
i_return_value = @
ga_spectrum_interpolation_set @
( s_name, @
r_factor )
dump i_return_value

# Get the interpolation factor of the current spectrum


r_factor = 0.0
i_return_value = @
ga_spectrum_interpolation_get @
( s_name, @
r_factor )
dump i_return_value
dump r_factor

# Session file paused. Press “Resume” to continue..


sf_pause()

# Set the interpolation factor of the current spectrum to it’s


# old value
r_factor = r_old_factor
i_return_value = @
ga_spectrum_interpolation_set @
Main Index
CHAPTER 4 825
Graphics

(s_name, @
r_factor )
dump i_return_value

# Close the database “spool.db”


uil_file_close.go()
#---------------------------------------------------------------------

ga_title_create ()

# Purpose : This file provides an example of a call to the


# function ga_title_create()
#
# This function is used to create a title.
# In this file a title is created, verify it’s
# existence in the database, remove it from the
# database, and verify that it no longer 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 ga_title_create()
# has the following arguments:
#
# ga_title_create
# ( name,
# x,
# y,
# color,
# font_size )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
STRING sav_list[256](VIRTUAL)
REAL r_x
REAL r_y
INTEGER i_color
INTEGER i_font_size
INTEGER i_ntitles
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “new.db”
uil_file_open.go(“new.db”)

# Create a title at the centre


s_name = “New Title”
r_x = 50
r_y = 50
i_color = 1
# Choose 12 point Font
i_font_size = 2
i_return_value = @
ga_title_create @
( s_name, @
r_x, @
r_y, @
i_color, @
i_font_size )
dump i_return_value

# Get the number of titles in the database


Main Index
826
Code Examples

i_return_value = @
ga_title_num_get @
( i_ntitles )
dump i_return_value
dump i_ntitles

sys_allocate_array(sav_list,1,i_ntitles)

# Get the list of the titles in the database


i_return_value = @
ga_title_list_get @
( sav_list )
dump i_return_value
dump sav_list

sys_free_array(sav_list)

# Post the title to the current viewport


i_return_value = @
ga_viewport_title_post @
( ““, @
s_name )
dump i_return_value

# Session file paused. Press “Resume” to continue..


sf_pause()

# Delete the title created


i_return_value = @
ga_title_delete @
( s_name )
dump i_return_value

# Get the number of titles in the database


# There should be zero titles in the database -
# one was created and then one was deleted.
i_return_value = @
ga_title_num_get @
( i_ntitles )
dump i_return_value
dump i_ntitles

# Post the title to the current viewport


i_return_value = @
ga_viewport_title_post @
( ““, @
s_name )
dump i_return_value

#---------------------------------------------------------------------

ga_title_delete ()

# Purpose : This file provides an example of a call to the


# function ga_title_delete()
#
# This function is used to delete a title.
# In this file a title is created, verify it’s
# existence in the database, remove it from the
# database, and verify that it no longer 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
Main Index
CHAPTER 4 827
Graphics

# menus on the menu bar.


#
# The function ga_title_delete() has the following arguments:
#
# ga_title_delete
# ( name )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
STRING sav_list[256](VIRTUAL)
REAL r_x
REAL r_y
INTEGER i_color
INTEGER i_font_size
INTEGER i_ntitles
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “new.db”
uil_file_open.go(“new.db”)

# Create a title at the centre


s_name = “New Title”
r_x = 50
r_y = 50
i_color = 7
# Choose 12 point Font
i_font_size = 2
i_return_value = @
ga_title_create @
( s_name, @
r_x, @
r_y, @
i_color, @
i_font_size )
dump i_return_value

# Post the title to the current viewport


i_return_value = @
ga_viewport_title_post @
( ““, @
s_name )
dump i_return_value

# Get the number of titles in the database


i_return_value = @
ga_title_num_get @
( i_ntitles )
dump i_return_value
dump i_ntitles

sys_allocate_array(sav_list,1,i_ntitles)

# Get the list of the titles in the database


i_return_value = @
ga_title_list_get @
( sav_list )
dump i_return_value
dump sav_list

sys_free_array(sav_list)

# Session file paused. Press “Resume” to continue..


sf_pause()

# Delete the title created


# The title displayed in the viewport should be deleted.
Main Index
828
Code Examples

i_return_value = @
ga_title_delete @
( s_name )
dump i_return_value

# Get the number of titles in the database


# The number of titles returned should be zero.
i_return_value = @
ga_title_num_get @
( i_ntitles )
dump i_return_value
dump i_ntitles

# Post the title to the current viewport


i_return_value = @
ga_viewport_title_post @
( ““, @
s_name )
dump i_return_value

#---------------------------------------------------------------------

start_vrml_animation ()

# Purpose : This function copies the animation from the


# screen into a VRML format. It has no
# returns conditions. This session files
# requires nastran preference to be loaded
# with Patran.
#
# 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 start_vrml_animation()
# has the following arguments:
#
# start_vrml_animation
# ( filename,
# Version_logic )
#---------------------------------------------------------------------
# Variable Declarations

INTEGER fem_create_mesh_surfa_num_nodes
INTEGER fem_create_mesh_surfa_num_elems
INTEGER int_status
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]
STRING asm_create_patch_xy_created_ids[VIRTUAL]
INTEGER res_create_demo_mcid
INTEGER res_create_demo_scid
INTEGER res_create_demo_rcid
INTEGER res_create_demo_layerposid
INTEGER res_create_demo_rtid
STRING filename[256] = "animate.wrl"
#----------------------------------------------------------------------
# Open a new database
if(!db_is_open())THEN
uil_file_new.go("","new.db")
$? YES 36000002
endif
#----------------------------------------------------------------------
# Setting the preference to MSC.Nastran.
Main Index
CHAPTER 4 829
Graphics

uil_pref_analysis.set_analysis_pref( "MSC.Nastran", @
"Structural", @
"", @
".op2" )

#----------------------------------------------------------------------
# Create the surface 1

int_status = asm_const_patch_xyz( @
"1", @
"<1 1 0>", @
"[0 0 0]", @
"Coord 0", @
asm_create_patch_xy_created_ids )
dump int_status
#----------------------------------------------------------------------
# Create the finite elements
# Create 121 nodes and 100 elements for Surface 1.

ui_exec_function( "mesh_seed_display_mgr", "init" )

int_status = fem_create_mesh_surf_3( @
"IsoMesh", @
16384, @
"Surface 1", @
1, @
["0.1"], @
"Quad4", @
"#", @
"#", @
"Coord 0", @
"Coord 0", @
fem_create_mesh_surfa_num_nodes, @
fem_create_mesh_surfa_num_elems, @
fem_create_mesh_s_nodes_created, @
fem_create_mesh_s_elems_created )

mesh_seed_display_mgr.erase( )

dump int_status
#----------------------------------------------------------------------
# Creating a dummy Result case for demonstration of
# animation.

db_drop_res_index( )

res_db_create_loadcase_c( "Default case", @


1, @
"Created by MSC.Patran for demo results",@
res_create_demo_mcid )

res_db_create_subcase_c( 2, @
"demo", @
res_create_demo_scid, @
res_create_demo_rcid )

res_db_createlayerpos_c( 0, @
0, @
res_create_demo_layerposid )

res_db_create_restype_c( "Nodal Vector", @


"Demo Result1", @
2, 1, @
Main Index
830
Code Examples

"By MSC.Patran For Demo Results", @


0, @
res_create_demo_rtid )
res_create_demoresult2( 3, 1, 1., 1, 1, 1, @
[0, 0, 0, 0], @
2, 0, 0, 0 )
$# Demo result done

#----------------------------------------------------------------------
# Using the function start_vrml_animation to start the animation recording

start_vrml_animation(filename,"Increment")

#----------------------------------------------------------------------
# The animation parameters are defined here

db_post_results_load( )
res_display_tool_unpost( "Deformation", @
"default_Deformation" )

res_data_load_dbresult( 0, @
"Nodal", @
"Scalar", @
"Default case", @
"demo", @
"Nodal Vector", @
"Demo Result1", @
"(NON-LAYERED)", @
"XX", @
"Default", @
"DeriveAverage", @
"All", @
"ShapeFunc" )
res_data_title( 0, "Nodal", "Scalar",1, @
["Default case, demo: Nodal Vector,Demo Result1-(NON-LAYERED) (XX)"] )

res_display_fringe_create( "", "FreeFaces", 0, [""], 12, @


["Range:Fri_default_Fringe", "RangeOverwrite:ON", @
"FringeStyle:Discrete/Smooth", "Shade:None", @
"ElemEdge:FreeEdge,Blue,Solid,1", "Shrink:0", @
"TitleDisplay:OFF", "MinMaxDisplay:OFF", "ValueDisplay:OFF", @
"Filter:None","ScaleFactor:1.", @
"LabelStyle:Exponential, 12, White, 3"], @
TRUE )
res_display_fringe_post( "", 0, "Nodal", TRUE, FALSE )
res_display_tool_animate_scale( "Modal", "Fringe", "", 0. )
res_display_anim_setup_2d( 30, "Linear", "" )
res_display_anim_run( 10 )
res_display_anim_clear( )

#----------------------------------------------------------------------
# Ending the animation.

end_vrml_animation()

#----------------------------------------------------------------------
# Closing the file new.db

uil_file_close.goquit()

# End of file
#----------------------------------------------------------------------

Main Index
CHAPTER 4 831
Graphics

verify_boundaries_display_mgr.erase ()

# Purpose : This file provides an example of a call to the


# function
# verify_boundaries_display_mgr.erase()
#
# This function is used to erase the free
# boundary display by resetting graphics
# properties.
#
# 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 verify_boundaries_display_mgr.erase()
# has no arguments.
#---------------------------------------------------------------------
# Variable declaration
STRING s_displ_type[32]
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Initialise the verify_boundaries_display manager.


verify_boundaries_display_mgr.initialize()

# Plot the free edges


s_displ_type=”Free_Edges”
verify_boundaries_display_mgr.plot(s_displ_type)

# Session file paused. Press “Resume” to continue..


sf_pause()

# Erase the free edges plot


verify_boundaries_display_mgr.erase()

# Plot the free surfaces


s_displ_type=”Free_Faces”
verify_boundaries_display_mgr.plot(s_displ_type)

# Session file paused. Press “Resume” to continue..


sf_pause()

# Erase the free surfaces plot


verify_boundaries_display_mgr.erase()

# Close the database “spool.db”


uil_file_close.go()
#---------------------------------------------------------------------

verify_boundaries_display_mgr.initialize ()

# Purpose : This file provides an example of a call to the


# function
# verify_boundaries_display_mgr.initialize()
#
# This function is used to save graphics
# properties associated with the current group
#
Main Index
832
Code Examples

# 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 verify_boundaries_display_mgr.initialize()
# has no arguments.
#---------------------------------------------------------------------
# Variable declaration
STRING s_displ_type[32]
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Initialise the verify_boundaries_display manager.


verify_boundaries_display_mgr.initialize()

# Plot the free edges


s_displ_type=”Free_Edges”
verify_boundaries_display_mgr.plot(s_displ_type)

# Session file paused. Press “Resume” to continue..


sf_pause()

# Erase the free edges plot


verify_boundaries_display_mgr.erase()

# Plot the free surfaces


s_displ_type=”Free_Faces”
verify_boundaries_display_mgr.plot(s_displ_type)

# Session file paused. Press “Resume” to continue..


sf_pause()

# Erase the free surfaces plot


verify_boundaries_display_mgr.erase()

# Close the database “spool.db”


uil_file_close.go()
#---------------------------------------------------------------------

verify_boundaries_display_mgr.plot ()

# Purpose : This file provides an example of a call to the


# function
# verify_boundaries_display_mgr.plot()
#
# This function is used to plot the free
# boundaries by changing the display properties.
#
# 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 verify_boundaries_display_mgr.plot(displ_type)
# has the following arguments.
#
# verify_boundaries_display_mgr.plot
Main Index
CHAPTER 4 833
Graphics

# (displ_type)
#
#---------------------------------------------------------------------
# Variable declaration
STRING s_displ_type[32]
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Initialise the verify_boundaries_display manager.


verify_boundaries_display_mgr.initialize()

# Plot the free edges


s_displ_type=”Free_Edges”
verify_boundaries_display_mgr.plot(s_displ_type)

# Session file paused. Press “Resume” to continue..


sf_pause()

# Erase the free edges plot


verify_boundaries_display_mgr.erase()

# Plot the free surfaces


s_displ_type=”Free_Faces”
verify_boundaries_display_mgr.plot(s_displ_type)

# Session file paused. Press “Resume” to continue..


sf_pause()

# Erase the free surfaces plot


verify_boundaries_display_mgr.erase()

# Close the database “spool.db”


uil_file_close.go()
#---------------------------------------------------------------------

Main Index
834
Code Examples

Main Index
MSC.Acumen, Volume 2: Code Examples

CHAPTER
User Interface
5
■ Introduction

Main Index
836
Code Examples

5.1 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_count_list ()

# Purpose : This file gives an example of three calls to


# the function app_count_list()
#
# A list containing 6 points, 4 curves and
# 25 nodes is passed to the function. In the
# first call, list processor is asked to count
# the number of points in the list. In the
# second call, it is asked to count the number
# of curves and in the final call, it is asked
# to count the number of nodes in the list.
#
# Before running this file the database should be
# created by running the session file “cube.ses”
# To run this session file, first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function has the following arguments:
# app_count_list
# ( type
# list
# domesg
# status )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_type,i_status
STRING s_list[128]
LOGICAL l_domesg
INTEGER i_return_value
# -------------------------------------------------------------------
# opening the existing database cube.db
uil_file_open.go(“cube.db”)

# -------------------------------------------------------------------
# Calling the function with item type LP_SUBLIST_POINT. List
# processor will count the points in the input list.
# The relevant integer value for the particular item type can be
# found in file “lpenums.i”
#
i_type = 4 /* For LP_SUBLIST_POINT from “lpenums.i” */
s_list = “Node 1:25 Point 1:6 Curve 1:4”
l_domesg = TRUE

i_return_value = @
app_count_list @
( i_type, @
s_list, @
l_domesg, @
i_status )

# Checking the status(Success) of List processor


Main Index dump i_status
CHAPTER 5 837
User Interface

# The number of points in the in put list(i.e)s_list


dump i_return_value

# Session file paused. Observe number of points dumped and press


# “Resume” to continue.
sf_pause()
# -------------------------------------------------------------------
# Calling the function with item type LP_SUBLIST_CURVE. List
# processor will count the number of curves in the list supplied.
#
i_type = 8 /* For LP_SUBLIST_CURVE from “lpenums.i” */

i_return_value = @
app_count_list @
( i_type, @
s_list, @
l_domesg, @
i_status )

# Checking the status(Success) of List processor


dump i_status

# The number of curves in the in put list(i.e)s_list


dump i_return_value

# Session file paused. Observe number of curves dumped and press


# “Resume” to continue.
sf_pause()

# -------------------------------------------------------------------
# Calling the function with item type LP_SUBLIST_NODE. List
# processor will count the number of NODES in the list supplied.
#
i_type = 512 /* For LP_SUBLIST_NODE from “lpenums.i” */

i_return_value = @
app_count_list @
( i_type, @
s_list, @
l_domesg, @
i_status )

# Checking the status(Success) of List processor


dump i_status

# The number of nodes in the in put list(i.e)s_list


dump i_return_value

# Observe number of curves dumped.


# -------------------------------------------------------------------

app_count_list ()

# Purpose : This file gives an example of three calls to


# the function app_count_list()
#
# A list containing 6 points, 4 curves and
# 25 nodes is passed to the function. In the
# first call, list processor is asked to count
# the number of points in the list. In the
# second call, it is asked to count the number
# of curves and in the final call, it is asked
# to count the number of nodes in the list.
#
Main Index
838
Code Examples

# Before running this file the database should be


# created by running the session file “cube.ses”
# To run this session file, first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function has the following arguments:
# app_count_string
# ( type
# list
# domesg
# status )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_type,i_status
STRING s_list[128]
LOGICAL l_domesg
INTEGER i_return_value
# -------------------------------------------------------------------
# opening the existing database cube.db
uil_file_open.go(“cube.db”)

# -------------------------------------------------------------------
# Calling the function with item type LP_SUBLIST_POINT. List
# processor will count the points in the input list.
# The relevant integer value for the particular item type can be
# found in file “lpenums.i”
#
i_type = 4 /* For LP_SUBLIST_POINT from “lpenums.i” */
s_list = “Node 1:25 Point 1:6 Curve 1:4”
l_domesg = TRUE

i_return_value = @
app_count_list @
( i_type, @
s_list, @
l_domesg, @
i_status )

# Checking the status(Success) of List processor


dump i_status

# The number of points in the in put list(i.e)s_list


dump i_return_value

# Session file paused. Observe number of points dumped and press


# “Resume” to continue.
sf_pause()
# -------------------------------------------------------------------
# Calling the function with item type LP_SUBLIST_CURVE. List
# processor will count the number of curves in the list supplied.
#
i_type = 8 /* For LP_SUBLIST_CURVE from “lpenums.i” */

i_return_value = @
app_count_list @
( i_type, @
s_list, @
l_domesg, @
i_status )

# Checking the status(Success) of List processor


dump i_status
Main Index
CHAPTER 5 839
User Interface

# The number of curves in the in put list(i.e)s_list


dump i_return_value

# Session file paused. Observe number of curves dumped and press


# “Resume” to continue.
sf_pause()

# -------------------------------------------------------------------
# Calling the function with item type LP_SUBLIST_NODE. List
# processor will count the number of NODES in the list supplied.
#
i_type = 512 /* For LP_SUBLIST_NODE from “lpenums.i” */

i_return_value = @
app_count_list @
( i_type, @
s_list, @
l_domesg, @
i_status )

# Checking the status(Success) of List processor


dump i_status

# The number of nodes in the in put list(i.e)s_list


dump i_return_value

# Observe number of curves dumped.


# -------------------------------------------------------------------

app_db_err_msg ()

# Purpose : This file gives an example of a call to the


# function app_db_err_msg()
#
# In this file, a standard error message code
# is used. The app_db_err_msg() function
# will show a error message form upon being
# called with this error code.
#
# To run this session file,start a session of
# MSC.Patran, run the session file by “File”,
# “Session”,”Play” pulldown menus on the menu
# bar.
#
# The function has the following arguments:
# app_db_err_msg
# ( msgcode
# ints
# reals
# chars
# string )
#
# -------------------------------------------------------------------
# Variable Declaration
#
LOGICAL l_domesg
STRING s_db_routine[64], s_caller[64]
INTEGER i_status, i_id, DISPLAYMETHOD

# -------------------------------------------------------------------
# Call the function with db_routine=db_get_pref(), status code
# 13000088 and id=DISPLAYMETHOD. Id of the item causing error can be
# found in the file “P3_HOME/customization/pref_names.i”. In this
# file, DISPLAYMETHOD has been defined a value of 501.
# ( When db_get_pref() is called with pref_id=DISPLAYMETHOD, if
Main Index
840
Code Examples

# preference is not found, then MSC.Patran gives the return value of


# 13000088. Refer Chapter 16,Section 16.1 of MSC.Develop Manual
# for db_get_pref() function )
#

l_domesg = TRUE
s_db_routine = “db_get_pref”
s_caller = “uil_primary.default_graphics”
i_status = 13000088 /* return value of db_get_pref() */
DISPLAYMETHOD = 501 /* from “pref_names.i” */
i_id = DISPLAYMETHOD

app_db_err_msg @
( l_domesg, @
s_db_routine, @
s_caller, @
i_status, @
i_id )
# -------------------------------------------------------------------

app_ids_to_vstring ()

# Purpose : This file gives an example of three calls to


# the function app_ids_to_vstring()
#
# A id array containing 4 ids is passed to the
# function. In the first call to the function,
# LpCURVE is selected as the list processor
# type. In the subsequent calls, LpLINE and
# LpSURFACE is selected as List processor type.
# List processor will process the input array
# and output a string according to its type.
#
# To run this session file, Start a session of
# MSC.Patran, run the session file by “File”,
# “Session”,”Play” pulldown menus on the menu
# bar.
#
# The function has the following arguments:
# app_ids_to_vstring
# ( idarray
# numval
# type
# appstr )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_idarray(4)=[1, 2, 3, 5] /* 4 id values supplied as input */
INTEGER i_numval,i_type
STRING s_appstr[VIRTUAL]
INTEGER i_return_value

# -------------------------------------------------------------------
# Calling the function with List Processor type LpCURVE. List
# processor will consider input idarray as array of Curve ids.
# The relevant integer value for the particular List Processor type
# can be found in file “lpkeywords.i”
#
i_numval=4 /* Number of id values supplied */
i_type = 3 /* For LpCURVE from “lpkeywords.i” */

i_return_value = @
app_ids_to_vstring @
( i_idarray, @
Main Index
CHAPTER 5 841
User Interface

i_numval, @
i_type, @
s_appstr )

# Checking the success of the command


dump i_return_value

# Dumping the string created by the List Processor


dump s_appstr

# Session file paused. Observe the string created by List Processor


# and press “Resume” to continue.
sf_pause()
# -------------------------------------------------------------------
# Calling the function with List Processor type LpLINE. List
# processor will consider input idarray as array of Line ids.
#
i_type = 4 /* For LpLINE from “lpkeywords.i” */

i_return_value = @
app_ids_to_vstring @
( i_idarray, @
i_numval, @
i_type, @
s_appstr )

# Checking the success of the command


dump i_return_value

# Dumping the string created by the List Processor


dump s_appstr

# Session file paused. Observe the string created by List Processor


# and press “Resume” to continue.
sf_pause()

# -------------------------------------------------------------------
# Calling the function with List Processor type LpSURFACE. List
# processor will consider input idarray as array of Surface ids.
#
i_type = 5 /* For LpSURFACE from “lpkeywords.i” */

i_return_value = @
app_ids_to_vstring @
( i_idarray, @
i_numval, @
i_type, @
s_appstr )

# Checking the success of the command


dump i_return_value

# Dumping the string created by the List Processor


dump s_appstr

sys_free_string(s_appstr)
# -------------------------------------------------------------------

Main Index
842
Code Examples

app_int_array_to_vstring ()

# Purpose : This file gives an example of two calls to


# the function app_int_array_to_vstring()
#
# A id array containing 4 ids is passed to the
# function. In the first call to the function,
# “Point” is sent as prefix. In the second call
# to the function,”Line” is sent as prefix. The
# list processor will prepend this prefix to the
# id array and create the output string.
#
# To run this session file, Start a session of
# MSC.Patran, run the session file by “File”,
# “Session”,”Play” pulldown menus on the menu
# bar.
#
# The function has the following arguments:
# app_int_array_to_vstring
# ( prefix
# numval
# inlist
# virtsym )
#
# -------------------------------------------------------------------
# Variable Declaration
#
STRING s_prefix[8]
INTEGER i_inlist(4)=[1, 2, 3, 4] /* 4 id values supplied as input */
INTEGER i_numval
STRING s_virtsym[VIRTUAL]
INTEGER i_return_value

# -------------------------------------------------------------------
# Calling the function with prefix = “Point”
#
s_prefix=”Point”
i_numval=4 /* Number of id values supplied */

i_return_value = @
app_int_array_to_vstring @
( s_prefix, @
i_numval, @
i_inlist, @
s_virtsym )

# Checking the success of the command


dump i_return_value

# Dumping the string created by the List Processor


dump s_virtsym

# Session file paused. Observe the string created by List Processor


# and press “Resume” to continue.
sf_pause()
# -------------------------------------------------------------------
# Calling the function with prefix = “Line”
#
s_prefix=”Line”

i_return_value = @
app_int_array_to_vstring @
( s_prefix, @
i_numval, @
i_inlist, @
Main Index
CHAPTER 5 843
User Interface

s_virtsym )

# Checking the success of the command


dump i_return_value

# Dumping the string created by the List Processor


dump s_virtsym

sys_free_string(s_virtsym)
# -------------------------------------------------------------------

appcode ()

# Purpose : This file gives an example of a call to the


# function appcode()
#
# In this example, an error code 1000001 has
# been passed as argument. The function returns
# 1000000 showing that the error occured from
# application 1000000 (i.e ASM)
#
# To run this session file,first start
# a session of MSC.Patran,open a database or
# start a new database,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function has the following arguments:
# appcode
# ( status )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_status = 1000001
INTEGER i_return_value

# -------------------------------------------------------------------

i_return_value = @
appcode @
( i_status )

dump i_return_value

# -------------------------------------------------------------------

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, and running this session file
# through the "File","Session","Play" pulldown
# menus on the menu bar.
#
# The function asm_u_coord_global_to_local()
Main Index
844
Code Examples

# 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
#----------------------------------------------------------------------
# Setting the preference to MSC.Nastran.

uil_pref_analysis.set_analysis_pref( "MSC.Nastran", @
"Structural", @
"", @
".op2" )

#---------------------------------------------------------------------
# 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
#---------------------------------------------------------------------
# Closes the Patran Environment

uil_file_close.goquit()

#---------------------------------------------------------------------
# End of File.

asm_u_lp_get_entity_label ()
# Purpose : This file provides an example of a call to the
# function asm_u_lp_get_entity_label()
#
# 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_lp_get_entity_label() has the following
# arguments:
# asm_u_lp_get_entity_label
# ( label_handle,
# list,
# last_supplied_label,
# domesg,
Main Index
CHAPTER 5 845
User Interface

# label,
# status )
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_label_handle
STRING s_list[128]
LOGICAL l_last_supplied_label,l_domesg
INTEGER i_label, i_status
INTEGER i_method,i_count
INTEGER i_return_value
#---------------------------------------------------------------------
# Call lp_eval() to initialize the list processor with
# LP_EVAL_FOR_TOKENS as evaluation method.

s_list = “10 2.345 6 9.455”

# Use the LP_EVAL_FOR_TOKENS evaluation method.


# from lpenum.i for LP_EVAL_FOR_TOKENS
i_method = 3

i_return_value = lp_eval(s_list, i_method, i_label_handle)


dump i_return_value

l_last_supplied_label = FALSE
l_domesg = TRUE

i_count = 0

WHILE ((i_return_value == 0) && (i_count < 4))


asm_u_lp_get_entity_label @
(i_label_handle, @
s_list, @
l_last_supplied_label, @
l_domesg, @
i_label, @
i_status)

dump i_count
dump i_status
dump i_label
write (“ “)

i_count = i_count + 1

END WHILE

lp_eval_cleanup(i_label_handle)

#---------------------------------------------------------------------

asm_u_lp_get_point ()

# Purpose : This file gives an example of two calls to


# the function asm_u_lp_get_point()
#
# This file will open a new database and creates
# a point in it. Then, it calls the function
# asm_u_lp_get_point() to get the coordinates of
# the created point.
#
# To run this session file, Start a session of
# MSC.Patran, run the session file by “File”,
# “Session”,”Play” pulldown menus on the menu
# bar.
#
# The function has the following arguments:
Main Index
846
Code Examples

# asm_u_lp_get_point
# ( point_list
# do_message
# point_coords
# status )
#
# -------------------------------------------------------------------
# Variable Declaration
#
STRING s_point_list[32]
LOGICAL l_do_message
REAL r_point_coords(3)
INTEGER i_status
STRING asm_create_grid_xyz_created_ids[VIRTUAL]

# -------------------------------------------------------------------
# Open a new database. Creating FOUR points by calling the function
# asm_const_grid_xyz(). Function assigns default id numbers to the
# created points.
#
uil_file_new.go(““,”new.db”)
$? YES 36000002

asm_const_grid_xyz @
( ““, @
“[5 10 0]”, @
“Coord 0”, @
asm_create_grid_xyz_created_ids )
# -------------------------------------------------------------------
# Call the function with point_list=”Point 1” to get the coordinates
# of the point 1.
#
s_point_list=”Point 1”
l_do_message=TRUE

asm_u_lp_get_point @
( s_point_list, @
l_do_message, @
r_point_coords, @
i_status )

# Checking the success of the command


dump i_status

# Dumping the string created by the List Processor


dump r_point_coords

# Observe the coordinates given by List Processor.


# Session file paused.Press “Resume” to continue.
sf_pause()

# Closing the database..


uil_file_close.go()
# -------------------------------------------------------------------

asm_u_lp_get_vector ()

# Purpose : This file gives an example of a call to the


# function asm_u_lp_get_vector()
#
# This file will open a new database and create a
# vector in it.Then it calls asm_u_lp_get_vector
# to get the coordinates of the vector.
#
# To run this session file, Start a session of
Main Index
CHAPTER 5 847
User Interface

# MSC.Patran, run the session file by “File”,


# “Session”,”Play” pulldown menus on the menu
# bar.
#
# The function has the following arguments:
# asm_u_lp_get_vector
# ( vector
# do_message
# vector_coords
# status )
#
# -------------------------------------------------------------------
# Variable Declaration
#
STRING s_vector[32]
LOGICAL l_do_message
REAL r_vector_coords(3)
INTEGER i_status
STRING sgm_create_vector_m_created_ids[VIRTUAL]

# -------------------------------------------------------------------
# Open a new database. Create a VECTOR by calling the function
# sgm_const_vector_magnitude().
#
uil_file_new.go(““,”new.db”)
$? YES 36000002

sgm_const_vector_magnitude @
( “1”, @
“1.0”, @
“<4 2 4>”, @
“[0 0 0]”, @
“Coord 0”, @
sgm_create_vector_m_created_ids )

sf_pause()
# -------------------------------------------------------------------
# Call the function with vector list “Vector 1” to get the
# coordinates of the Vector 1.
#
s_vector=”Vector 1”
l_do_message=TRUE

asm_u_lp_get_vector @
( s_vector, @
l_do_message, @
r_vector_coords, @
i_status )

# Checking the success of the command


dump i_status

# Dumping the string created by the List Processor


dump r_vector_coords

# Observe the coordinates given by List Processor.


# Close the database.
uil_file_close.go()

# Free the memory of virtual array.


sys_free_string(sgm_create_vector_m_created_ids)
# -------------------------------------------------------------------

Main Index
848
Code Examples

lp_eval_cleanup ()

# Purpose : This file gives an example of a call to


# the function lp_eval_cleanup()
#
# A simple list processor operation is selected
# to see when lp_eval_cleanup() should be called.
# First, list processor is initialized by calling
# the function lp_eval(). A small list is passed
# to the list processor. Number of Points and
# number of Nodes are counted by calling the
# function lp_sublist_count(). Finally,memory
# occupied by list processor is freed by calling
# lp_eval_cleanup()
#
# To run this session file, Start a session of
# MSC.Patran, run the session file by “File”,
# “Session”,”Play” pulldown menus on the menu
# bar.
#
# The function has the following arguments:
# lp_eval_cleanup
# ( handle )
# -------------------------------------------------------------------
# Variable Declaration
INTEGER i_handle, i_count
INTEGER i_method, i_filter
STRING s_list[32]
INTEGER i_return_value

# -------------------------------------------------------------------
# Initializing List Processor to process a List.
#
s_list=”Point 1 3 5 8 9 Node 1:10” /* Input list */
i_method=4 /* from lpenums.i for LP_EVAL_FOR_ID */

i_return_value = @
lp_eval @
( s_list, @
i_method, @
i_handle )

# Count the number of points in the input list by calling the


# function lp_sublist_count(). This function requires a filter to
# evaluate the list.To count the points LP_SUBLIST_POINT is selected
# as the filter.
#
i_filter=4 /* from lpenums.i for LP_SUBLIST_POINT */

i_return_value = @
lp_sublist_count @
( i_handle, @
i_filter, @
i_count )

# The number of Points in the input list is


dump i_count

# Count the number of Nodes in the input list by calling the


# function lp_sublist_count(). This function requires a filter to
# evaluate the list.To count the Nodes LP_SUBLIST_NODE is selected
# as the filter.
#
i_filter=512 /* from lpenums.i for LP_SUBLIST_NODE */

Main Index
CHAPTER 5 849
User Interface

i_return_value = @
lp_sublist_count @
( i_handle, @
i_filter, @
i_count )

# The number of Nodes in the input list is


dump i_count

# After finishing the list processor operations, memory should be


# freed by calling lp_eval_cleanup().
#
i_return_value = @
lp_eval_cleanup @
( i_handle )

# Checking the success of function


dump i_return_value

# -------------------------------------------------------------------

lp_geometry_text ()

# Purpose : This file gives an example of two calls to


# the function lp_geometry_text()
#
# In the first call to the function,POINT is
# selected as the geometry type. In the next
# call, GRID is selected as geometry type.
#
# To run this session file, Start a session of
# MSC.Patran, run the session file by “File”,
# “Session”,”Play” pulldown menus on the menu
# bar.
#
# The function has the following arguments:
# lp_geometry_text
# ( geo_keyword,
# geo_id_count,
# geo_id_list,
# text_len_max,
# text )
#
# -------------------------------------------------------------------
# Variable Declaration
INTEGER i_geo_keyword
INTEGER i_geo_id_list(4)=[1, 2, 3, 4]
INTEGER i_geo_id_count
INTEGER i_text_len_max
STRING s_text[VIRTUAL]
INTEGER i_return_value

# -------------------------------------------------------------------
# Calling the function with geometry type “Point”. geo_keyword for
# point from “lpkeywords.i” is 1.
#
i_geo_keyword=1 /* from lpkeywords.i for LpPOINT */
i_geo_id_count=4 /* Number of id values supplied */
i_text_len_max=32

i_return_value = @
lp_geometry_text @
( i_geo_keyword, @
i_geo_id_count, @
i_geo_id_list, @
Main Index
850
Code Examples

i_text_len_max, @
s_text )

# Checking the success of the command


dump i_return_value

# Dumping the string created by the List Processor


dump s_text

# Session file paused. Observe the string created by List Processor


# and press “Resume” to continue.
sf_pause()
# -------------------------------------------------------------------
# Calling the function with geometry type “Grid”. “geo_keyword” for
# point from “lpkeywords.i” is 2.
#
i_geo_keyword=2 /* from lpkeywords.i for LpGRID */

i_return_value = @
lp_geometry_text @
( i_geo_keyword, @
i_geo_id_count, @
i_geo_id_list, @
i_text_len_max, @
s_text )

# Checking the success of the command


dump i_return_value

# Dumping the string created by the List Processor


dump s_text

# Observe the string created by List Processor


# -------------------------------------------------------------------

lp_keyword_text ()

# Purpose : This file gives an example of two calls to


# the function lp_keyword_text()
#
# In the first call to the function,LpPOINT
# is selected as the Keyword and LpGEOMETRY is
# selected as Family. In the second call,
# LpNODE is selected as Keyword and
# LpFINITE_ELEMENT is selected as Family.
# The function gives the keyword which MSC.Patran
# uses to describe the entity.
#
# To run this session file, Start a session of
# MSC.Patran, run the session file by “File”,
# “Session”,”Play” pulldown menus on the menu
# bar.
#
# The function has the following arguments:
# lp_keyword_text
# ( keyword,
# family,
# text )
#
# -------------------------------------------------------------------
# Variable Declaration
INTEGER i_keyword
INTEGER i_family
Main Index
CHAPTER 5 851
User Interface

STRING s_text[32]
INTEGER i_return_value

# -------------------------------------------------------------------
# Calling the function with family “LpGEOMETRY” and keyword “LpPOINT”
# Both from “lpkeywords.i”
#
i_keyword=1 /* from lpkeywords.i for LpPOINT */
i_family =3 /* from lpkeywords.i for LpGEOMETRY */

i_return_value = @
lp_keyword_text @
( i_keyword, @
i_family, @
s_text )

# Checking the success of the command


dump i_return_value

# Dumping the string created by the List Processor


dump s_text

# Session file paused. Observe the string created by List Processor


# and press “Resume” to continue.
sf_pause()
# -------------------------------------------------------------------
# Calling the function with family “LpFINITE_ELEMENT” and keyword
# “LpNODE”. Both from “lpkeywords.i”
#
i_keyword=1 /* from lpkeywords.i for LpNODE */
i_family =4 /* from lpkeywords.i for LpFINITE_ELEMENT */

i_return_value = @
lp_keyword_text @
( i_keyword, @
i_family, @
s_text )

# Checking the success of the command


dump i_return_value

# Dumping the string created by the List Processor


dump s_text

# Observe the string created by List Processor


# -------------------------------------------------------------------

msg_format_string ()

# Purpose : This file gives an example of two calls to the


# function msg_format_string()
#
# In the first call to the function, standard
# MSC.Patran message has been called. In the second
# call to the function, an user message has been
# called from the file “user_message.database”.
#
# To run this session file, first place the file
# “user_messages.database” in the MSC.Patran path,
# preferably in the current directory.
# Start a session of MSC.Patran, run the session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function has the following arguments:
Main Index
852
Code Examples

# msg_format_string
# ( msgcode
# ints
# reals
# chars
# string )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_msgcode,i_ints(1)
REAL r_reals(1)
STRING s_chars[128],s_op_string[128]
INTEGER i_return_value

# -------------------------------------------------------------------
# Call the standard MSC.Patran message(from messages.database)
# To know the message related to i_msgcode, call msg_get_string()
# as follows.
# i_msgcode=36000003 (From utility FILE)
#

i_msgcode=36000003
msg_get_string(i_msgcode,s_op_string)
dump s_op_string
# Session file paused. Observe the string and press “Resume” to
# continue.
sf_pause()

# Now format the message.


# i_ints(1)=0
# r_reals(1)=0.0
# s_chars=”new.db”
#

i_ints(1)=0
r_reals(1)=0.0
s_chars=”new.db”

i_return_value = @
msg_format_string @
( i_msgcode, @
i_ints, @
r_reals, @
s_chars, @
s_op_string )

dump i_return_value
dump s_op_string
# Compare this formatted output with the previous one.
# Press “Resume” to continue session file.
sf_pause()
# -------------------------------------------------------------------
# Call the user message from user_message.database
# Again to know the message related to i_msgcode, call
# msg_get_string() as follows.
# i_msgcode=1000000001
#

i_msgcode=1000000001
msg_get_string(i_msgcode,s_op_string)
dump s_op_string

# Session file paused. Observe the string and press “Resume” to


# continue.
sf_pause()
Main Index
CHAPTER 5 853
User Interface

# Now format the message.


# i_ints(1)=10
# r_reals(1)=10.0
# s_chars=”new.db”
#

i_ints(1)=10
r_reals(1)=10.0
s_chars=”new.db”

i_return_value = @
msg_format_string @
( i_msgcode, @
i_ints, @
r_reals, @
s_chars, @
s_op_string )

dump i_return_value
dump s_op_string

# Compare this formatted output with the previous one.


# -------------------------------------------------------------------

msg_get_application ()

# Purpose : This file gives an example of a call to the


# function msg_get_application()
#
# In this example, a message code 36000001 has
# been passed as argument. The function returns
# 36000000 showing that the message occured from
# application 36000000 (i.e FILE)
#
# To run this session file,select “File”,
# “Session”,”Play” pulldown menus on the menu
# bar.
#
# The function has the following arguments:
# msg_get_application
# ( msgcode )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_msgcode = 36000001
INTEGER i_return_value

# -------------------------------------------------------------------

i_return_value = @
msg_get_application @
( i_msgcode )

dump i_return_value

# -------------------------------------------------------------------

Main Index
854
Code Examples

msg_string_more ()

# Purpose : This file gives an example of a call to the


# function msg_string_more()
#
# The call to the function uses standard MSC.Patran
# messages from the file “messages.database”
#
# To run this session file, Start a session of
# MSC.Patran, run the session file by “File”,
# “Session”,”Play”pulldown menus on the menu bar.
#
# The function has the following arguments:
# msg_string_more
# ( string )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_msgcode,i_msgtype,i_appcode,i_ints(1)
REAL r_reals(1)
STRING s_chars[128],s_op_string[128]
INTEGER i_return_value

# -------------------------------------------------------------------
# Call the message with msg_code=36000001 from the messages.database
# Format the message using the following parameters.
# i_msgcode=36000001
# i_msgtype=4 ( value 4 stands for error message )
# i_appcode=36000000
# i_ints(1)=0
# r_reals(1)=0.0
# s_chars=”new.db”
#

i_msgcode=36000001
i_msgtype=4
i_appcode=36000000
i_ints(1)=10
r_reals(1)=10.0
s_chars=”new.db”

# To see what message is there for msg_code=36000001 call


# msg_to_form() function. It displays the message.Note the
# message and Press O.K to proceed.

msg_to_form @
( i_msgcode, @
i_msgtype, @
i_appcode, @
i_ints, @
r_reals, @
s_chars )

i_return_value = @
msg_to_string @
( i_msgcode, @
i_msgtype, @
i_appcode, @
i_ints, @
r_reals, @
s_chars, @
s_op_string )

dump i_return_value
Main Index
CHAPTER 5 855
User Interface

dump s_op_string

# Compare this output with the message form displayed earlier.


# Also note that the return value shows the number of characters
# left in the string. To get it, call the function msg_string_more().
# Dump the string to see the string.

WHILE ( 0 != i_return_value )
i_return_value = @
msg_string_more @
( s_op_string )

dump i_return_value
dump s_op_string
END WHILE
# Note that function msg_string_more() gets the next piece of message
# string till the end of the message.
# -------------------------------------------------------------------

msg_to_file ()

# Purpose : This file gives an example of a call to the


# function msg_to_file()
#
# The call to the function uses standard MSC.Patran
# messages from the file “messages.database”
# It writes this message to a file “msg.file”
#
# To run this session file, Start a session of
# MSC.Patran, run the session file by “File”,
# “Session”,”Play”pulldown menus on the menu bar.
#
# The function has the following arguments:
# msg_to_file
# ( msgcode
# msgtype
# appcode
# ints
# reals
# chars
# maxout
# unit )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_msgcode,i_msgtype,i_appcode,i_ints(1),i_chan
REAL r_reals(1)
STRING s_chars[128]
INTEGER i_maxout, i_return_value

# -------------------------------------------------------------------
# Call the message with msg_code=36000001 from the messages.database
# Format the message using the following parameters.
# i_msgcode=36000001
# i_msgtype=4 ( value 4 stands for error message )
# i_appcode=36000000
# i_ints(1)=0
# r_reals(1)=0.0
# s_chars=”new.db”
# i_maxout = 1
#

i_msgcode=36000001
i_msgtype=4
Main Index
856
Code Examples

i_appcode=36000000
i_ints(1)=0
r_reals(1)=0.0
s_chars=”new.db”
i_maxout = 1

# To see what message is there for msg_code=36000001 call


# msg_to_form() function. It displays the message.Note the
# message and Press O.K to proceed.

msg_to_form @
( i_msgcode, @
i_msgtype, @
i_appcode, @
i_ints, @
r_reals, @
s_chars )

i_return_value=text_open(“msg.file”,”NOWA”,0,0,i_chan)
dump i_return_value

i_return_value = @
msg_to_file @
( i_msgcode, @
i_msgtype, @
i_appcode, @
i_ints, @
r_reals, @
s_chars, @
i_maxout, @
i_chan )

dump i_return_value
text_close(i_chan,””)

# -------------------------------------------------------------------

msg_to_string ()

# Purpose : This file gives an example of a call to the


# function msg_to_string()
#
# The call to the function uses standard MSC.Patran
# messages from the file “messages.database”
#
# To run this session file, Start a session of
# MSC.Patran, run the session file by “File”,
# “Session”,”Play”pulldown menus on the menu bar.
#
# The function has the following arguments:
# msg_to_string
# ( msgcode
# msgtype
# appcode
# ints
# reals
# chars
# string )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_msgcode,i_msgtype,i_appcode,i_ints(1)
REAL r_reals(1)
Main Index
CHAPTER 5 857
User Interface

STRING s_chars[128],s_op_string[128]
INTEGER i_return_value

# -------------------------------------------------------------------
# Call the message with msg_code=36000001 from the messages.database
# Format the message using the following parameters.
# i_msgcode=36000001
# i_msgtype=4 ( value 4 stands for error message )
# i_appcode=36000000
# i_ints(1)=0
# r_reals(1)=0.0
# s_chars=”new.db”
#

i_msgcode=36000001
i_msgtype=4
i_appcode=36000000
i_ints(1)=10
r_reals(1)=10.0
s_chars=”new.db”

# To see what message is there for msg_code=36000001 call


# msg_to_form() function. It displays the message.Note the
# message and Press O.K to proceed.

msg_to_form @
( i_msgcode, @
i_msgtype, @
i_appcode, @
i_ints, @
r_reals, @
s_chars )

i_return_value = @
msg_to_string @
( i_msgcode, @
i_msgtype, @
i_appcode, @
i_ints, @
r_reals, @
s_chars, @
s_op_string )

dump i_return_value
dump s_op_string

# Compare this output with the message form displayed earlier.


# Also note that the return value shows the number of characters
# left in the string. To get it, call the function msg_string_more().
# Dump the string to see the string.

WHILE ( 0 != i_return_value )
i_return_value = @
msg_string_more @
( s_op_string )

dump i_return_value
dump s_op_string
END WHILE

# -------------------------------------------------------------------

Main Index
858
Code Examples

notemessage.text ()

# Purpose : This file gives an example of a call to the


# function notemessage.text()
#
# In this example, a warning message form has
# been created.
#
# To run this session file, first start
# a session of MSC.Patran, run this session file
# by “File”,”Session”,”Play” pulldown menus on
# the menu bar.
#
# The function has the following arguments:
# notemessage.text
# ( label
# message )
#
# -------------------------------------------------------------------
# Variable Declaration
#
STRING s_label[64], s_message[128]

# -------------------------------------------------------------------
# Assign values to the variables.
# s_label = “Warning”
# s_message = “You are closing the current database.” // @
# “Do you really want to?”
#
s_label = “Warning”
s_message = “You are closing the current database.” // @
“ Do you really want to?”

notemessage.text @
( s_label, s_message )

# -------------------------------------------------------------------

ui_add_help ()

# Purpose : This file provides an example of a call to the


# function ui_add_help()
#
# A medium width half height sized form,
# “USER_FORM”, which contains a List box widget
# is created using user_form.pcl. A help file is
# created and added to the help record.
#
# The user_form.pcl contains a include file.
# To expand the symbols defined in the included
# file and to create a file “user_form.pob”
# C preprocessor should be used. A command line
# command such as:
#
# cpp -I$P3_HOME/customization user_form.pcl user_form.pob
#
# can be used to generate a file user_form.pob.
# See the Part 9:PCL and Customization Chapter 3
# C Preprocessor for more information.
#
# This file can be run by starting a session of
# MSC.Patran and running this session file
# through the “File”,”Session”,”Play” pulldown
Main Index
CHAPTER 5 859
User Interface

# menus on the menu bar.


#
# The function uil_utils_listbox.select_list() has the following
# arguments:
# ui_add_help
# ( keyword,
# path,
# marker )
#---------------------------------------------------------------------
# Variable Declarations
WIDGET wa_wid_ids(VIRTUAL),w_form_id
STRING s_keyword[16], s_path[32], s_marker[16]
STRING s_info[128]
INTEGER i_return_value
#---------------------------------------------------------------------
# Compile and make the functions in user_form.pob available to MSC.Patran

!!COMPILE user_form.pob user_form.plb


!!LIBRARY ADD user_form.plb

# Create a form “USER_FORM”, by executing the “display” function


# using ui_exec_function()

ui_exec_function(“USER_FORM”,”display”)

# Call the function get_widget_ids()to get the widget id of the list


# box widget. This function is in user_form.pcl
#
USER_FORM.get_widget_ids(wa_wid_ids)

# As the function call informs, the form widget is the first


# element in wa_wid_ids. Assigning this value to w_form_id
#
w_form_id = wa_wid_ids(1)

#---------------------------------------------------------------------
# Create a frame maker file by calling ui_form_to_frame().This will
# create a file “USER_FORM.mif” in the working directory. To execute
# this function, USER_FORM should be displayed.

ui_form_to_frame(“USER_FORM”)

# Register the help for “USER_FORM” widget using “user_form_help” as


# the keyword.

s_keyword = “user_form_help”
ui_register_help( w_form_id,s_keyword )

# Add a record to the help table, providing the connection between


# keyword and the help file.Here the help file “USER_FORM.mif” is
# in the working directory.

s_path = “./USER_FORM.mif”
s_marker = “framemaker_hypertext_marker”

i_return_value = @
ui_add_help @
( s_keyword, @
s_path, @
s_marker )

# Checking the success of function call


dump i_return_value

s_info = “Click on USER FORM and Press F1 to”// @


“ see the help file just created”
ui_write(s_info)
Main Index
860
Code Examples

# After seeing the help file, Press “OK” to delete the form.
sys_free_array(wa_wid_ids)

#---------------------------------------------------------------------

ui_clear_focus ()

# Purpose : This file provides an example of a call to the


# function ui_clear_focus()
#
# In this file, a medium width half height sized
# form, “USER_FORM”, which contains a databox
# widget is created using user_form.pcl.
#
# The user_form.pcl contains an include file.
# To expand the symbols defined in the included
# file and to create a file “user_form.pob”
# C preprocessor should be used. A command line
# command such as : cpp -I$P3_HOME/customization
# user_form.pcl user_form.pob can be used to
# generate a file user_form.pob.
# See the Part 9:PCL and Customization Chapter 3
# C Preprocessor for more information.
#
# 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 ui_clear_focus() has the following arguments:
# ui_clear_focus
# ( wid )
#---------------------------------------------------------------------
# Variable Declarations
WIDGET w_wid_ids(VIRTUAL),w_wid
INTEGER i_return_value
#---------------------------------------------------------------------
# Compile and make the functions in user_form.pob available to MSC.Patran

!!COMPILE user_form.pob user_form.plb


!!LIBRARY ADD user_form.plb

# Create a form “USER_FORM”, by executing the “display” function


# using ui_exec_function()

ui_exec_function(“USER_FORM”, “display”)
# The form “USER_FORM” is displayed.
# Press “Resume” to continue.
sf_pause()
#---------------------------------------------------------------------
# Call the function get_widget_ids()to get the widget id of the
# databox widget. This function is in user_form.pcl
#
USER_FORM.get_widget_ids(w_wid_ids)

# As the function call informs, the databox widget is the fifth


# element in w_wid_ids. Assigning this value to w_wid
#
w_wid = w_wid_ids(5)

# Setting the focus on databox widget:


ui_set_focus(w_wid)

# Session file paused.


Main Index
CHAPTER 5 861
User Interface

# Observe the form displayed. Note that the focus is on databox


# widget and it is active.
# Press “Resume” to continue.
sf_pause()
#---------------------------------------------------------------------
# Clear the focus on databox widget by calling the function.
#
ui_clear_focus @
( w_wid )

#---------------------------------------------------------------------

ui_exec_command ()

# Purpose : This file provides an example of a call to the


# function ui_exec_command()
#
# 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 ui_exec_command() has the following arguments:
# ui_exec_command
# ( cmd )
#---------------------------------------------------------------------
# Variable Declarations
STRING s_cmd[128],s_stat[32]
#---------------------------------------------------------------------
# Run a ui_write() command using ui_exec_command().
#
s_stat=”Welcome to MSC.Patran”
s_cmd = “ui_write(s_stat)”
ui_exec_command @
( s_cmd )
#---------------------------------------------------------------------

ui_form_delete ()
# Purpose : This file provides an example of a call to the
# function ui_form_delete()
#
# First a medium width half height sized form,
# “USER_FORM”, which contains several widgets is
# created using user_form.pcl. Then the form is
# deleted using ui_form_delete().
#
# The user_form.pcl contains a include file.
# To expand the symbols defined in the included
# file and to create a file “user_form.pob”
# C preprocessor should be used. A command line
# command such as : cpp -I$P3_HOME/customization
# user_form.pcl user_form.pob can be used to
# generate a file user_form.pob.
# See the Part 9:PCL and Customization Chapter 3
# C Preprocessor for more information.
#
# 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.
#
Main Index
862
Code Examples

# The function ui_form_delete() has the following arguments:


# ui_form_delete
# ( class )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_class[128]
#---------------------------------------------------------------------
# Compile and make the functions in user_form.pob available to MSC.Patran

!!COMPILE user_form.pob user_form.plb


!!LIBRARY ADD user_form.plb

# Create a form “USER_FORM”, by executing the “display” function


# using ui_exec_function()

ui_exec_function(“USER_FORM”, “display”)
# Session file paused to observe the form.
# Press “Resume” to continue.
sf_pause()
#---------------------------------------------------------------------
# Delete the form by calling ui_form_delete()
#

s_class = “USER_FORM”

ui_form_delete @
( s_class )
#---------------------------------------------------------------------

ui_form_exists ()
# Purpose : This file provides an example of a call to the
# function ui_form_exists()
#
# First a medium width half height sized form,
# “USER_FORM”, which contains several widgets is
# created using user_form.pcl.Then the function
# ui_form_exists() is called to check whether
# the form exists.
#
# The user_form.pcl contains an include file.
# To expand the symbols defined in the included
# file and to create a file “user_form.pob”
# C preprocessor should be used. A command line
# command such as : cpp -I$P3_HOME/customization
# user_form.pcl user_form.pob can be used to
# generate a file user_form.pob.
# See the Part 9:PCL and Customization Chapter 3
# C Preprocessor for more information.
#
# 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 ui_form_exists() has the following arguments:
# ui_form_exists
# ( class )
#---------------------------------------------------------------------
# Variable Declarations
STRING s_class[128]
LOGICAL l_return_value
#---------------------------------------------------------------------
# Compile and make the functions in user_form.pob available to MSC.Patran
Main Index
CHAPTER 5 863
User Interface

!!COMPILE user_form.pob user_form.plb


!!LIBRARY ADD user_form.plb

s_class = “USER_FORM”

#---------------------------------------------------------------------
# Call the function ui_form_exits() with s_class=”USER_FORM” to check
# whether the USER_CLASS exists or not.
#

l_return_value = @
ui_form_exists @
( s_class )

dump l_return_value

IF (l_return_value == TRUE) THEN


ui_write(“ USER_FORM exists.”)
ELSE
ui_write(“ USER_FORM does not exist.”)
END IF

# Create a form “USER_FORM”, by executing the “display” function


# using ui_exec_function()

ui_exec_function( s_class, “display”)


#---------------------------------------------------------------------
# Call the function ui_form_exits() with s_class=”USER_FORM” to check
# whether the USER_CLASS exists or not.
#

l_return_value = @
ui_form_exists @
( s_class )

dump l_return_value

IF (l_return_value == TRUE) THEN


ui_write(“ USER_FORM exists.”)
ELSE
ui_write(“ USER_FORM does not exist.”)
END IF

# Session file paused to see the result of the call.


# Press “Resume” to continue.
sf_pause()
#---------------------------------------------------------------------
# Delete the USER_FORM by calling function ui_wid_exit().

ui_wid_exit()

#---------------------------------------------------------------------
# Call the function ui_form_exists() to check whether USER_FORM
# exists now.

l_return_value = @
ui_form_exists @
( s_class )

dump l_return_value

IF (l_return_value == TRUE) THEN


ui_write(“ USER_FORM exists”)
ELSE
ui_write(“ USER_FORM does not exist.”)
END IF
#---------------------------------------------------------------------
Main Index
864
Code Examples

ui_form_is_displayed ()

# Purpose : This file provides an example of a call to the


# function ui_form_is_displayed()
#
# First a medium width half height sized form,
# “USER_FORM”, which contains a text widget is
# created using user_form.pcl. Then the function
# ui_form_is_displayed() is called to check
# whether the form is displayed or not. Finally
# form is hidden and this function is called.
#
# The user_form.pcl contains a include file.
# To expand the symbols defined in the included
# file and to create a file “user_form.pob”
# C preprocessor should be used. A command line
# command such as : cpp -I$P3_HOME/customization
# user_form.pcl user_form.pob can be used to
# generate a file user_form.pob.
# See the Part 9:PCL and Customization Chapter 3
# C Preprocessor for more information.
#
# 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 ui_form_is_displayed() has the following arguments:
# ui_form_is_displayed
# ( class )
#---------------------------------------------------------------------
# Variable Declarations
STRING s_class[100]
LOGICAL l_return_value
#---------------------------------------------------------------------
# Compile and make the functions in user_form.pob available to MSC.Patran

!!COMPILE user_form.pob user_form.plb


!!LIBRARY ADD user_form.plb

s_class = “USER_FORM”

# Check to see whether USER_FORM is displayed.


l_return_value = @
ui_form_is_displayed @
( s_class )

dump l_return_value

IF (l_return_value == TRUE) THEN


ui_write(“ Form USER_FORM is displayed.”)
ELSE
ui_write(“ Form USER_FORM is NOT displayed.”)
END IF

# Create a form “USER_FORM”, by executing the “display” function


# using ui_exec_function()

ui_exec_function(s_class, “display”)

#---------------------------------------------------------------------
# Call the function to check whether the form is displayed or not.
#

l_return_value = @
Main Index
CHAPTER 5 865
User Interface

ui_form_is_displayed @
( s_class )

dump l_return_value

IF (l_return_value == TRUE) THEN


ui_write(“ Form USER_FORM is displayed.”)
ELSE
ui_write(“ Form USER_FORM is NOT displayed.”)
END IF

# Session file paused to observe the result of the function call.


# Press “Resume” to continue.
sf_pause()
#---------------------------------------------------------------------
# Hide the form.
ui_form_hide(s_class)

# Check to see whether USER_FORM is displayed.


l_return_value = @
ui_form_is_displayed @
( s_class )

dump l_return_value

IF (l_return_value == TRUE) THEN


ui_write(“ Form USER_FORM is displayed.”)
ELSE
ui_write(“ Form USER_FORM is NOT displayed.”)
END IF

# Delete the form.


ui_form_delete(s_class)

# Check to see whether USER_FORM is displayed.


l_return_value = @
ui_form_is_displayed @
( s_class )

dump l_return_value

IF (l_return_value == TRUE) THEN


ui_write(“ Form USER_FORM is displayed.”)
ELSE
ui_write(“ Form USER_FORM is NOT displayed.”)
END IF

#---------------------------------------------------------------------

ui_form_is_displayed ()

# Purpose : This file provides an example of a call to the


# function ui_form_is_displayed()
#
# First a medium width half height sized form,
# “USER_FORM”, which contains a text widget is
# created using user_form.pcl.Then the function
# ui_form_is_displayed() is called to check
# whether the form is displayed or not. Finally
# form is hided and this function is called.
#
# The user_form.pcl contains a include file.
# To expand the symbols defined in the included
# file and to create a file “user_form.pob”
# C preprocessor should be used. A command line
Main Index
866
Code Examples

# command such as : cpp -I$P3_HOME/customization


# user_form.pcl user_form.pob can be used to
# generate a file user_form.pob.
# See the Part 9:PCL and Customization Chapter 3
# C Preprocessor for more information.
#
# 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 ui_form_is_displayed() has the following arguments:
# ui_form_is_displayed
# ( class )
#---------------------------------------------------------------------
# Variable Declarations
STRING s_class[100]
LOGICAL l_return_value
#---------------------------------------------------------------------
# Compile and make the functions in user_form.pob available to MSC.Patran

!!COMPILE user_form.pob user_form.plb


!!LIBRARY ADD user_form.plb

# Create a form “USER_FORM”, by executing the “display” function


# using ui_exec_function()

ui_exec_function(“USER_FORM”, “display”)
#---------------------------------------------------------------------
# Call the function to check whether the form is displayed or not.
#
s_class = “user_form”

l_return_value = @
ui_form_is_displayed @
( s_class )

IF (l_return_value == TRUE) THEN


ui_write(“ Form USER_FORM is displayed “)
ELSE
ui_write(“ Form USER_FORM is NOT displayed “)
END IF

# Session file paused to observe the result of the function call.


# Press “Resume” to continue.
sf_pause()
#---------------------------------------------------------------------
# Hide the form.
ui_form_hide(s_class)

# Check to see whether USER_FORM is displayed.


l_return_value = @
ui_form_is_displayed @
( s_class )

IF (l_return_value == TRUE) THEN


ui_write(“ Form USER_FORM is displayed “)
ELSE
ui_write(“ Form USER_FORM is NOT displayed “)
END IF

# Delete the form.


ui_form_delete(s_class)
#---------------------------------------------------------------------

Main Index
CHAPTER 5 867
User Interface

ui_get_client ()

# Purpose : This file provides an example of a call to the


# function ui_get_client()
#
# 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 ui_get_client() has the following arguments:
# ui_get_client
# ( client_info )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_client_info[100]
#---------------------------------------------------------------------
# Get the client information by calling the function ui_get_client()
#
ui_get_client @
( s_client_info )

# The X Client is
dump s_client_info
#---------------------------------------------------------------------

ui_get_help ()

# Purpose : This file provides an example of a call to the


# function ui_get_help()
#
# A medium width half height sized form,
# “USER_FORM”, which contains a List box widget
# is created using user_form.pcl.A help file is
# created and registered for the “USER_FORM”.
# ui_get_help() is called to get the keyword
# registered for the “USER_FORM”. Finally, the
# help file is added to the help record.
#
# The user_form.pcl contains a include file.
# To expand the symbols defined in the included
# file and to create a file “user_form.pob”
# C preprocessor should be used. A command line
# command such as : cpp -I$P3_HOME/customization
# user_form.pcl user_form.pob can be used to
# generate a file user_form.pob.
# See the Part 9:PCL and Customization Chapter 3
# C Preprocessor for more information.
#
# 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 uil_utils_listbox.select_list()has the following
# arguments:
# ui_get_help
# ( wid,
# help )
#---------------------------------------------------------------------
# Variable Declarations
WIDGET wa_wid_ids(VIRTUAL),w_wid
Main Index
868
Code Examples

STRING s_help[16], s_path[32], s_marker[16]


STRING s_info[128]
INTEGER i_return_value
#---------------------------------------------------------------------
# Compile and make the functions in user_form.pob available to MSC.Patran

!!COMPILE user_form.pob user_form.plb


!!LIBRARY ADD user_form.plb

# Create a form “USER_FORM”, by executing the “display” function


# using ui_exec_function()

ui_exec_function(“USER_FORM”,”display”)

# Call the function get_widget_ids()to get the widget id of the list


# box widget. This function is in user_form.pcl
#
USER_FORM.get_widget_ids(wa_wid_ids)

# As the function call informs, the form widget is the first


# element in wa_wid_ids. Assigning this value to w_wid
#
w_wid = wa_wid_ids(1)

#---------------------------------------------------------------------
# Create a frame maker file by calling ui_form_to_frame().This will
# create a file “USER_FORM.mif” in the working directory. To execute
# this function, USER_FORM should be displayed.

ui_form_to_frame(“USER_FORM”)

# Register the help for “USER_FORM” widget using “user_form_help” as


# the keyword.

s_help = “user_form_help”

ui_register_help @
( w_wid, @
s_help )

# Get the help keyword registered for “USER_FORM” by calling


# ui_get_help() function.

s_help = ““

ui_get_help @
( w_wid, @
s_help )

# Dump s_help to see the key word registered.


dump s_help

#---------------------------------------------------------------------
# Add a record to the help table, providing the connection between
# keyword and the help file.Here the help file “USER_FORM.mif” is
# in the working directory.

s_path = “./USER_FORM.mif”
s_marker = “hypertext_marker”

i_return_value = @
ui_add_help @
( s_help, @
s_path, @
s_marker )

# Checking the success of function call


Main Index
CHAPTER 5 869
User Interface

dump i_return_value

s_info = “Click on USER FORM and Press F1 to”// @


“see the help file just created”
ui_write(s_info)

#---------------------------------------------------------------------

ui_get_server ()

# Purpose : This file provides an example of a call to the


# function ui_get_server()
#
# 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 ui_get_server() has the following arguments:
# ui_get_server
# ( server_info )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_server_info[100]
#---------------------------------------------------------------------
# Get the X server information by calling ui_get_server()
#
ui_get_server @
( s_server_info )

# X Server is:
dump s_server_info
#---------------------------------------------------------------------

ui_graph_create ()

# Purpose : This file provides an example of a call to the


# function ui_graph_create()
#
# A small width half height sized form,
# “USER_GRAPH”, which contains a GRAPHICS widget
# is created using user_graph.pcl.The functon
# call to ui_graph_create() can be seen in
# user_graph.pcl
#
# The user_form.pcl contains a include file.
# To expand the symbols defined in the included
# file and to create a file “user_form.pob”
# C preprocessor should be used. A command line
# command such as : cpp -I$P3_HOME/customization
# user_form.pcl user_form.pob can be used to
# generate a file user_form.pob.
# See the Part 9:PCL and Customization Chapter 3
# C Preprocessor for more information.
#
# 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.
#
# Note : Since the parameters to this function requires
Main Index
870
Code Examples

# precompilation to expand the symbolic values,


# function has NOT been called in this session
# file. Instead, a function call can be found
# in file “user_graph.pcl”
#
# The function ui_graph_create() has the following arguments:
# ui_graph_create
# ( parent,
# name,
# x,
# y,
# width,
# height )
#
#---------------------------------------------------------------------
# Compile and make the functions in user_graph.pob available to
# MSC.Patran

!!COMPILE user_graph.pob user_graph.plb


!!LIBRARY ADD user_graph.plb

# Create a form “USER_GRAPH”, by executing the “display” function


# using ui_exec_function()

ui_exec_function(“USER_GRAPH”, “display”)

# Press “OK” to delete the USER GRAPH


#---------------------------------------------------------------------

ui_graph_create ()

# Purpose : This file provides an example of a call to the


# function ui_graph_create()
#
# A small width half height sized form,
# “USER_GRAPH”, which contains a GRAPHICS widget
# is created using user_graph.pcl.The functon
# call to ui_graph_create() can be seen in
# user_graph.pcl
#
# The user_form.pcl contains a include file.
# To expand the symbols defined in the included
# file and to create a file “user_form.pob”
# C preprocessor should be used. A command line
# command such as : cpp -I$P3_HOME/customization
# user_form.pcl user_form.pob can be used to
# generate a file user_form.pob.
# See the Part 9:PCL and Customization Chapter 3
# C Preprocessor for more information.
#
# 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.
#
# Note : Since the parameters to this function requires
# precompilation to expand the symbolic values,
# function has NOT been called in this session
# file. Instead, a function call can be found
# in file “user_graph.pcl”
#
# The function ui_graph_create() has the following arguments:
# ui_graph_create
# ( parent,
Main Index
CHAPTER 5 871
User Interface

# name,
# x,
# y,
# width,
# height )
#
#---------------------------------------------------------------------
# Compile and make the functions in user_graph.pob available to
# MSC.Patran

!!COMPILE user_graph.pob user_graph.plb


!!LIBRARY ADD user_graph.plb

# 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 form “USER_GRAPH”, by executing the “display” function


# using ui_exec_function()

ui_exec_function(“USER_GRAPH”, “display”)

# Press “OK” to delete the USER GRAPH


#---------------------------------------------------------------------

ui_is_initialized ()

# Purpose : This file provides an example of a call to the


# function ui_is_initialized()
#
# 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 ui_is_initialized() has no arguments.
#---------------------------------------------------------------------
# Variable Declarations
LOGICAL l_is_initialised
#---------------------------------------------------------------------
# Check to see user interface has been initialised or not.
#
l_is_initialised = ui_is_initialized()

dump l_is_initialised
#---------------------------------------------------------------------

ui_register_help ()

# Purpose : This file provides an example of a call to the


# function ui_register_help()
#
# A medium width half height sized form,
# “USER_FORM”, which contains a List box widget
# is created using user_form.pcl.A help file is
# created and registered for the USER_FORM
# This help file is added to the help record.
#
# The user_form.pcl contains a include file.
Main Index
872
Code Examples

# To expand the symbols defined in the included


# file and to create a file “user_form.pob”
# C preprocessor should be used. A command line
# command such as : cpp -I$P3_HOME/customization
# user_form.pcl user_form.pob can be used to
# generate a file user_form.pob.
# See the Part 9:PCL and Customization Chapter 3
# C Preprocessor for more information.
#
# 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 uil_utils_listbox.select_list()has the following
# arguments:
# ui_register_help
# ( wid,
# help )
#---------------------------------------------------------------------
# Variable Declarations
WIDGET wa_wid_ids(VIRTUAL),w_wid
STRING s_help[16], s_path[32], s_marker[16]
STRING s_info[128]
INTEGER i_return_value
#---------------------------------------------------------------------
# Compile and make the functions in user_form.pob available to MSC.Patran

!!COMPILE user_form.pob user_form.plb


!!LIBRARY ADD user_form.plb

# Create a form “USER_FORM”, by executing the “display” function


# using ui_exec_function()

ui_exec_function(“USER_FORM”,”display”)

# Call the function get_widget_ids()to get the widget id of the list


# box widget. This function is in user_form.pcl
#
USER_FORM.get_widget_ids(wa_wid_ids)

# As the function call informs, the form widget is the first


# element in wa_wid_ids. Assigning this value to w_wid
#
w_wid = wa_wid_ids(1)

#---------------------------------------------------------------------
# Create a frame maker file by calling ui_form_to_frame().This will
# create a file “USER_FORM.mif” in the working directory. To execute
# this function, USER_FORM should be displayed.

ui_form_to_frame(“USER_FORM”)

# Register the help for “USER_FORM” widget using “user_form_help” as


# the keyword.

s_help = “user_form_help”

ui_register_help @
( w_wid, @
s_help )

#---------------------------------------------------------------------
# Add a record to the help table, providing the connection between
# keyword and the help file.Here the help file “USER_FORM.mif” is
# in the working directory.
Main Index
CHAPTER 5 873
User Interface

s_path = “./USER_FORM.mif”
s_marker = “hypertext_marker”

i_return_value = @
ui_add_help @
( s_help, @
s_path, @
s_marker )

# Checking the success of function call


dump i_return_value

s_info = “Click on USER FORM and Press F1 to” // @


“ see the help file just created”

ui_write(s_info)

#---------------------------------------------------------------------

ui_sys_command ()

# Purpose : This file provides an example of a call to the


# function ui_sys_command()
#
# The file calls the function to execute the
# system command “ls”. This will list all the
# files/directories present in current directory
# on the standard output.
#
# 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 ui_sys_command() has the following arguments:
# ui_sys_command
# ( cmd )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_cmd[128]
LOGICAL l_return_value
#---------------------------------------------------------------------
# Run the system command “ls” inside MSC.Patran
#
s_cmd = “ls”

xf_write_stdout(“Executing ls command from MSC.Patran “)


xf_write_stdout(“-----------------------------------------------”)

l_return_value = @
ui_sys_command @
( s_cmd )

xf_write_stdout(“-----------------------------------------------”)

# Checking the success of function:( “False” means Successful. )


dump l_return_value

# Output of the system command is seen in the Standard Output.


#---------------------------------------------------------------------

Main Index
874
Code Examples

ui_sys_return ()

# Purpose : This file provides an example of a call to the


# function ui_sys_return()
#
# 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 ui_sys_return() has no arguments.
#---------------------------------------------------------------------
# Upon calling,the function return to operating system command prompt
#
ui_sys_return()
#---------------------------------------------------------------------

ui_text_select ()

# Purpose : This file provides an example of a call to the


# function ui_text_select()
#
# First a medium width half height sized form,
# “USER_FORM”, which contains a text widget is
# created using user_form.pob. User is requested
# to cursor select the text in the text widget.
# Then the function ui_text_select()is called to
# output the selected text and its position in
# the history window.
#
# The user_form.pob contains an include file.
# To expand the symbols defined in the included
# file and to create a file “user_form.pob”
# C preprocessor should be used. A command line
# command such as : cpp -I$P3_HOME/customization
# user_form.pcl user_form.pob can be used to
# generate a file user_form.pob.
# See the Part 9:PCL and Customization Chapter 3
# C Preprocessor for more information.
#
# 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 ui_text_select() has the following arguments:
# ui_text_select
# ( textwid,
# left,
# right,
# vstr )
#---------------------------------------------------------------------
# Variable Declarations
WIDGET w_wid_ids(VIRTUAL), w_textwid
INTEGER i_left
INTEGER i_right
STRING s_vstr[128]
#---------------------------------------------------------------------
# Compile and make the functions in user_form.pob available to MSC.Patran

!!COMPILE user_form.pob user_form.plb


!!LIBRARY ADD user_form.plb

Main Index
CHAPTER 5 875
User Interface

# Create a form “USER_FORM”, by executing the “display” function


# using ui_exec_function()

ui_exec_function(“USER_FORM”, “display”)
#---------------------------------------------------------------------
# The form “USER_FORM” is displayed.Cursor select the text in the
# text widget. Press “Resume” to continue the session file.
sf_pause()

# Call the function get_widget_ids()to get the widget id of the text


# widget. This function is in user_form.pob
#
USER_FORM.get_widget_ids(w_wid_ids)

# As the function call informs, the text widget is the second element
# in w_wid_ids. Assigning this value to w_textwid
#
w_textwid = w_wid_ids(2)

#---------------------------------------------------------------------
# Call the function to return the text selected and its left and
# right position in the string in which it resides.
#
ui_text_select @
( w_textwid, @
i_left, @
i_right, @
s_vstr )

# The selected text is:


dump s_vstr
# The position of the selected text in the string from left is:
dump i_left
# The position of the selected text in the string from right is:
dump i_right

sys_free_array(w_wid_ids)
# Press “OK” to delete the form “USER_FORM”.
#---------------------------------------------------------------------

ui_text_select ()

# Purpose : This file provides an example of a call to the


# function ui_text_select()
#
# First a medium width half height sized form,
# “USER_FORM”, which contains a text widget is
# created using user_form.pob. User is requested
# to cursor select the text in the text widget.
# Then the function ui_text_select()is called to
# output the selected text and its position in
# the history window.
#
# The user_form.pob contains an include file.
# To expand the symbols defined in the included
# file and to create a file “user_form.pob”
# C preprocessor should be used. A command line
# command such as : cpp -I $P3_HOME/customization
# user_form.pcl user_form.pob can be used to
# generate a file user_form.pob.
# See the Part 9:PCL and Customization Chapter 3
# C Preprocessor for more information.
#
# This file can be run by starting a session of
# MSC.Patran and running this session file
Main Index
876
Code Examples

# through the “File”,”Session”,”Play” pulldown


# menus on the menu bar.
#
# The function ui_text_select() has the following arguments:
# ui_text_select
# ( textwid,
# left,
# right,
# vstr )
#---------------------------------------------------------------------
# Variable Declarations
WIDGET w_wid_ids(VIRTUAL), w_textwid
INTEGER i_left
INTEGER i_right
STRING s_vstr[VIRTUAL]
#---------------------------------------------------------------------
# Compile and make the functions in user_form.pob available to MSC.Patran

!!COMPILE user_form.pob user_form.plb


!!LIBRARY ADD user_form.plb

# Create a form “USER_FORM”, by executing the “display” function


# using ui_exec_function()

ui_exec_function(“USER_FORM”, “display”)
#---------------------------------------------------------------------
# The form “USER_FORM” is displayed.Cursor select the text in the
# text widget. Press “Resume” to continue the session file.
sf_pause()

# Call the function get_widget_ids()to get the widget id of the text


# widget. This function is in user_form.pob
#
USER_FORM.get_widget_ids(w_wid_ids)

# As the function call informs, the text widget is the second element
# in w_wid_ids. Assigning this value to w_textwid
#
w_textwid = w_wid_ids(2)

# Allocate storage for the string used as a return value for


# the ui_text_select function.
ui_wid_get_vstring(w_textwid, “VALUE”, s_vstr)

dump str_length(s_vstr)

#---------------------------------------------------------------------
# Call the function to return the text selected and its left and
# right position in the string in which it resides.
#
ui_text_select @
( w_textwid, @
i_left, @
i_right, @
s_vstr )

# The selected text is:


dump s_vstr
# The position of the selected text in the string from left is:
dump i_left
# The position of the selected text in the string from right is:
dump i_right

sys_free_array(w_wid_ids)
sys_free_string(s_vstr)

# Execute the function user_form.exit() to delete the form.


Main Index
CHAPTER 5 877
User Interface

#
#---------------------------------------------------------------------

ui_wid_exit ()

# Purpose : This file provides an example of a call to the


# function ui_wid_exit()
#
# First a medium width half height sized form,
# “USER_FORM”, which contains several widgets is
# created using user_form.pcl.Then the function
# ui_wid_exit()is called to exit the USER_FORM
#
# The user_form.pcl contains an include file.
# To expand the symbols defined in the included
# file and to create a file “user_form.pob”
# C preprocessor should be used. A command line
# command such as : cpp -I$P3_HOME/customization
# user_form.pcl user_form.pob can be used to
# generate the file user_form.pob.
# See the Part 9:PCL and Customization Chapter 3
# C Preprocessor for more information.
#
# 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 ui_wid_exit() has no arguments:
#---------------------------------------------------------------------
# Compile and make the functions in user_form.pob available to MSC.Patran

!!COMPILE user_form.pob user_form.plb


!!LIBRARY ADD user_form.plb

# Create a form “USER_FORM”, by executing the “display” function


# using ui_exec_function()

ui_exec_function(“USER_FORM”, “display”)
#---------------------------------------------------------------------
# Session file paused. Observe the form and press “Resume” to
# continue.
sf_pause()

# ui_wid_exit() function is called to execute the exit function in all


# of the displayed windows. USER_FORM displayed has an exit() function
# in its class USER_FORM. This function in turn calls a function
# ui_form_delete() to exit the USER_FORM.

ui_wid_exit()

#---------------------------------------------------------------------

ui_wid_hide_forms ()

# Purpose : This file provides an example of a call to the


# function ui_wid_hide_forms()
#
# First a medium width half height sized form,
# “USER_FORM”, which contains sseveral widgets is
# created using user_form.pcl.Then the function
# ui_wid_hide_forms() is called to hide the non
# modal form.Finally ui_form_display() is called
Main Index
878
Code Examples

# to display the form “USER_FORM”


#
# The user_form.pcl contains a include file.
# To expand the symbols defined in the included
# file and to create a file “user_form.pob”
# C preprocessor should be used. A command line
# command such as : cpp -I$P3_HOME/customization
# user_form.pcl user_form.pob can be used to
# generate a file user_form.pob.
# See the Part 9:PCL and Customization Chapter 3
# C Preprocessor for more information.
#
# 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 ui_wid_hide_forms() has the following arguments:
# ui_wid_hide_forms
# ( parm )
#---------------------------------------------------------------------
# Variable Declarations
STRING s_parm[128]
#---------------------------------------------------------------------
# Compile and make the functions in user_form.pob available to MSC.Patran

!!COMPILE user_form.pob user_form.plb


!!LIBRARY ADD user_form.plb

# Create a form “USER_FORM”, by executing the “display” function


# using ui_exec_function()

ui_exec_function(“USER_FORM”, “display”)
# Session file paused to notice the form. Press “Resume” to continue.
sf_pause()
#---------------------------------------------------------------------
# Calling the function with s_parm=”NONMODAL” to hide all non modal
# forms. Note that form “USER_FORM” is an non modal form.
#
s_parm = “NONMODAL”
ui_wid_hide_forms @
( s_parm )

# Session file paused to observe that the form “USER_FORM” is hided,


# but not deleted. Press “Resume” to continue.
sf_pause()
#---------------------------------------------------------------------
# To display “USER_FORM” again, call the function ui_form_display().

ui_form_display(“USER_FORM”)

#---------------------------------------------------------------------

ui_wid_restore_widget ()

# Purpose : This file provides an example of a call to the


# function ui_wid_restore_widget()
#
# First a medium width half height sized form,
# “USER_FORM”, which contains several widget is
# created using user_form.pcl.Initial value is
# set in Text widget and List box widget.The
# values are saved and changed afterwards.
# Original values are restored by calling
# ui_wid_restore_widget().
Main Index
CHAPTER 5 879
User Interface

#
# The user_form.pcl contains a include file.
# To expand the symbols defined in the included
# file and to create a file “user_form.pob”
# C preprocessor should be used. A command line
# command such as : cpp -I$P3_HOME/customization
# user_form.pcl user_form.pob can be used to
# generate a file user_form.pob.
# See the Part 9:PCL and Customization Chapter 3
# C Preprocessor for more information.
#
# 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 ui_wid_save_widget() has the following arguments:
# ui_wid_restore_widget
# ( wid )
#
#---------------------------------------------------------------------
# Variable Declarations
WIDGET wa_wid_ids(VIRTUAL),w_wid,w_lbox_id,w_text_id
LOGICAL l_return_value
STRING sa_list[16](2) = [“First”,”Second”]
INTEGER i_listcnt
#---------------------------------------------------------------------
# Compile and make the functions in user_form.pob available to MSC.Patran
!!COMPILE user_form.pob user_form.plb
!!LIBRARY ADD user_form.plb

# Create a form “USER_FORM”, by executing the “display” function


# using ui_exec_function()

ui_exec_function(“USER_FORM”, “display”)

# The form “USER_FORM” is displayed. Call the function


# get_widget_ids()to get the widget id of all the widgets. This
# function is in user_form.pcl
#
USER_FORM.get_widget_ids(wa_wid_ids)

# As the function call informs, the form widget is the first element
# in wa_wid_ids. Similarly, list box widget is the forth element in
# wa_wid_ids.Assigning these values
#
w_wid = wa_wid_ids(1)
w_text_id = wa_wid_ids(2)
w_lbox_id = wa_wid_ids(4)

# Create a list of items in the list box.


i_listcnt = 2
uil_utils_listbox.create_list @
( w_lbox_id, @
sa_list, @
i_listcnt )

# Save the values of USER_FORM and its child widget by calling


# function ui_wid_save_widget() with w_wid as the argument.

l_return_value = @
ui_wid_save_widget @
( w_wid )

dump l_return_value

# Session file paused to observe the widgets and their values.


Main Index
880
Code Examples

# Press “Resume” to continue.

sf_pause()
#---------------------------------------------------------------------
# Change the values of the widgets.
# New text is set in text widget. List box items deleted.

ui_wid_set @
( w_text_id, @
“VALUE”, @
“Changed Text” )

uil_utils_listbox.delete_item_list @
( w_lbox_id, @
i_listcnt, @
sa_list)

# Session file paused to observe the widgets and their values.


# Press “Resume” to continue.

sf_pause()
#---------------------------------------------------------------------
# Restore the original values of USER_FORM
l_return_value = @
ui_wid_restore_widget @
( w_wid )

dump l_return_value

# Observe the Widgets and their values.


# Press “OK” to delete the form “USER_FORM”
sys_free_array(wa_wid_ids)
#---------------------------------------------------------------------

ui_wid_save_widget ()

# Purpose : This file provides an example of a call to the


# function ui_wid_save_widget()
#
# A medium width half height sized form,
# “USER_FORM”, which contains several widgets is
# created using user_form.pcl.Initial value is
# set in Text widget and List box widget. This
# value is saved using ui_wid_save(). Values are
# changed. Finally, values are restored.
#
# The user_form.pcl contains a include file.
# To expand the symbols defined in the included
# file and to create a file “user_form.pob”
# C preprocessor should be used. A command line
# command such as : cpp -I$P3_HOME/customization
# user_form.pcl user_form.pob can be used to
# generate a file user_form.pob.
# See the Part 9:PCL and Customization Chapter 3
# C Preprocessor for more information.
#
# 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 ui_wid_save_widget() has the following arguments:
# ui_wid_save_widget
# ( wid )
#
Main Index
CHAPTER 5 881
User Interface

#---------------------------------------------------------------------
# Variable Declarations
WIDGET wa_wid_ids(VIRTUAL),w_wid,w_lbox_id,w_text_id
LOGICAL l_return_value
STRING sa_list[16](2) = [“First”,”Second”]
INTEGER i_listcnt
#---------------------------------------------------------------------
# Compile and make the functions in user_form.pob available to MSC.Patran

!!COMPILE user_form.pob user_form.plb


!!LIBRARY ADD user_form.plb

# Create a form “USER_FORM”, by executing the “display” function


# using ui_exec_function()

ui_exec_function(“USER_FORM”, “display”)

# The form “USER_FORM” is displayed. Call the function


# get_widget_ids()to get the widget id of all the widgets. This
# function is in user_form.pcl
#
USER_FORM.get_widget_ids(wa_wid_ids)

# As the function call informs, the form widget is the first element
# in wa_wid_ids. Similarly, list box widget is the forth element in
# wa_wid_ids.Assigning these values
#
w_wid = wa_wid_ids(1)
w_text_id = wa_wid_ids(2)
w_lbox_id = wa_wid_ids(4)

# Create a list of items in the list box.


i_listcnt = 2
uil_utils_listbox.create_list @
( w_lbox_id, @
sa_list, @
i_listcnt )

# Save the values of USER_FORM and its child widget by calling


# function ui_wid_save_widget() with w_wid as the argument.

l_return_value = @
ui_wid_save_widget @
( w_wid )

dump l_return_value

# Session file paused to observe the widgets and their values.


# Press “Resume” to continue.

sf_pause()
#---------------------------------------------------------------------
# Change the values of the widgets.
# New text is set in text widget. List box items deleted.

ui_wid_set @
( w_text_id, @
“VALUE”, @
“Changed Text” )

uil_utils_listbox.delete_item_list @
( w_lbox_id, @
i_listcnt, @
sa_list)

# Session file paused to observe the widgets and their values.


# Press “Resume” to continue.
Main Index
882
Code Examples

sf_pause()
#---------------------------------------------------------------------
# Restore the original values of USER_FORM
l_return_value = @
ui_wid_restore_widget @
( w_wid )

dump l_return_value

# Observe the Widgets and their values.


# Press “OK” to delete the form “USER_FORM”
sys_free_array(wa_wid_ids)
#---------------------------------------------------------------------

uid_get_border_sizes ()

# Purpose : This file gives an example of a call to the


# function uid_get_border_sizes()
#
# This function gives the size of the borders
# in all the four directions for a specific
# type of window.
#
# To run this session file,first start a session
# of MSC.Patran, then run this session file by
# “File”,”Session”,”Play” pulldown menus on the
# menu bar.
#
# The function has the following arguments:
# uid_get_border_sizes
# ( type,
# pos_is_frame,
# leftoffset,
# topoffset,
# rightoffset,
# bottomoffset )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_type
LOGICAL l_pos_is_frame
INTEGER i_leftoffset,i_topoffset
INTEGER i_rightoffset,i_bottomoffset
# -------------------------------------------------------------------
# Call the function to get the information of dialog window.
i_type = 0 /* For dialog window */

uid_get_border_sizes @
( i_type, @
l_pos_is_frame, @
i_leftoffset, @
i_topoffset, @
i_rightoffset, @
i_bottomoffset )

# Setting of PositionIsFrame
dump l_pos_is_frame

# Thickness of left border in Pixels


dump i_leftoffset

# Thickness of right border in Pixels


dump i_rightoffset
Main Index
CHAPTER 5 883
User Interface

# Thickness of top border in Pixels


dump i_topoffset

# Thickness of bottom border in Pixels


dump i_bottomoffset

# -------------------------------------------------------------------

uid_get_font_heights ()

# Purpose : This file gives an example of a call to the


# function uid_get_font_heights()
#
# This function gives the size of the fonts in
# pixels.
#
# To run this session file,first start a session
# of MSC.Patran, then run this session file by
# “File”,”Session”,”Play” pulldown menus on the
# menu bar.
#
# The function has the following arguments:
# uid_get_font_heights
# ( font_h,
# textfont_ht,
# spreadfont_h )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_font_h
INTEGER i_textfont_h
INTEGER i_spreadfont_h
# -------------------------------------------------------------------
# Call the function to get the information of font heights

uid_get_font_heights @
( i_font_h, @
i_textfont_h, @
i_spreadfont_h )

# Font height in pixels


dump i_font_h

# Text font height in pixels


dump i_textfont_h

# Spread sheet font height in pixels


dump i_spreadfont_h

# -------------------------------------------------------------------

uid_get_screen_info ()

# Purpose : This file gives an example of a call to the


# function uid_get_screen_info()
#
# This function gives the screen size in pixels
# and pixels per inch.
#
# To run this session file,first start
# a session of MSC.Patran,open a database or
Main Index
884
Code Examples

# start a new database,then run this session


# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function has the following arguments:
# uid_get_screen_info
# ( xpix,
# ypix,
# xpixperinch,
# ypixperinch )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_xpix,i_ypix
INTEGER i_xpixperinch,i_ypixperinch
INTEGER i_value
# -------------------------------------------------------------------
# Call the function to get the screen information.

uid_get_screen_info @
( i_xpix, @
i_ypix, @
i_xpixperinch, @
i_ypixperinch, @
i_value )

# Setting of screen size is


dump i_xpix
dump i_ypix
dump i_xpixperinch
dump i_ypixperinch
dump i_value
# -------------------------------------------------------------------

uid_set_sys_pix ()

# Purpose : This file provides an example of a call to the


# function uid_set_sys_pix()
#
# This function sets the pixel per inch and
# display factor for the monitor.
#
# 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 uid_set_sys_pix()
# has the following arguments:
#
# uid_set_sys_pix
# ( pix_per_inch,
# new_disp_factor )
#
#---------------------------------------------------------------------
# Variable Declarations
REAL r_pix_per_inch
REAL r_new_disp_factor
#---------------------------------------------------------------------
# Set the monitor pixels per inch and display factor
#
r_pix_per_inch=81.0
r_new_disp_factor=1.0
Main Index
CHAPTER 5 885
User Interface

uid_set_sys_pix @
( r_pix_per_inch, @
r_new_disp_factor )

#---------------------------------------------------------------------

INTEGER i_xpix,i_ypix
INTEGER i_xpixperinch,i_ypixperinch
INTEGER i_value
# -------------------------------------------------------------------
# Call the function to get the screen information.

uid_get_screen_info @
( i_xpix, @
i_ypix, @
i_xpixperinch, @
i_ypixperinch, @
i_value )

# Setting of screen size is


dump i_xpix
dump i_ypix
dump i_xpixperinch
dump i_ypixperinch
dump i_value

uil_app_analysis.get_real_name

# Purpose : This file provides an example of a call to the


# function uil_app_analysis.get_real_name().
#
# This file opens a database spool.db which has
# an analysis code name of “MSC.Nastran” and an
# analysis type of “mscnastran”.
#
# This function gets the real name of analysis
# preference.
#
# 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 uil_app_analysis.get_real_name()
# has the following arguments:
#
# uil_app_analysis.get_real_name
# ( user_name,
# real_name )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_user_name[100]
STRING s_real_name[100]
INTEGER i_return_value
#---------------------------------------------------------------------
#
# opening the existing database spool.db

uil_file_open.go(“spool.db”)

# Get the user name of current analysis code by calling


Main Index
886
Code Examples

# db_get_default_anal_code().
#
db_get_default_anal_code( s_user_name )
# The current analysis code name is
dump s_user_name

# Call the function to get real name of the Analysis preference.

i_return_value = @
uil_app_analysis.get_real_name @
( s_user_name, @
s_real_name )

# Real name of the analysis type is


dump s_real_name

# Number of characters in s_real_name is


dump i_return_value
#---------------------------------------------------------------------

uil_pcntcomplete.close

# Purpose : This function create the percentage complete


# ruler in the patran environment.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file with
# the "File","Session","Play" pulldown menus
# on the menu bar.
#
# The function uil_pcntcomplete.close()
# has no arguments.
#
#---------------------------------------------------------------------
# Variable Initialization
#---------------------------------------------------------------------

STRING label[15] = "My_scale"

#---------------------------------------------------------------------
# Initializing the scale.

uil_pcntcomplete.initlz(label)

uil_pcntcomplete.update(40.0)

#---------------------------------------------------------------------
# Using the function uil_pcntcomplete.close() to close the scale.

uil_pcntcomplete.close()

#----------------------------------------------------------------------
# End of file

uil_pcntcomplete.initlz

# Purpose : This function create the percentage complete


# ruler in the patran environment.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file with
# the "File","Session","Play" pulldown menus
# on the menu bar.
Main Index
CHAPTER 5 887
User Interface

#
# The function uil_pcntcomplete.initlz()
# has the following arguments:
#
# uil_pcntcomplete.initlz
# (
# label )
#
#---------------------------------------------------------------------
# Variable Initialization
#---------------------------------------------------------------------

STRING label[15] = "My_scale"

#---------------------------------------------------------------------
# Using the function uil_pcntcomplete.initlz() to start the ruler
# scale.

uil_pcntcomplete.initlz(label)

uil_pcntcomplete.update(40.0)

#---------------------------------------------------------------------
# Closes the scale to be used for the label 'My_scale'.

# uil_pcntcomplete.close()

#----------------------------------------------------------------------
# End of file

uil_primary.get_menubar_id ()

# Purpose : This file provides an example of a call to the


# function uil_primary.get_menubar_id()
#
# This function returns the widget id of the
# main menu bar.
#
# 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 uil_primary.get_menubar_id() has no arguments.
#
#---------------------------------------------------------------------
# Variable Declarations
WIDGET w_return_value
#---------------------------------------------------------------------
# Get the widget id of the main menu bar.
#
w_return_value = @
uil_primary.get_menubar_id()

dump w_return_value
#---------------------------------------------------------------------

Main Index
888
Code Examples

uil_utils_listbox.append_list ()

# Purpose : This file provides an example of a call to the


# function uil_utils_listbox.append_list()
#
# A medium width half height sized form,
# “USER_FORM”, which contains a List box widget
# is created using user_form.pcl.A list is
# created using uil_utils_listbox.create_list()
# Then the list is appended by calling the
# function uil_utils_listbox.append_list().
#
# The user_form.pcl contains a include file.
# To expand the symbols defined in the included
# file and to create a file “user_form.pob”
# C preprocessor should be used. A command line
# command such as : cpp -I$P3_HOME/customization
# user_form.pcl user_form.pob can be used to
# generate a file user_form.pob.
# See the Part 9:PCL and Customization Chapter 3
# C Preprocessor for more information.
#
# 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 uil_utils_listbox.append_list() has the following
# arguments:
# uil_utils_listbox.append_list
# ( lbox_id,
# labellist,
# listcnt )
#---------------------------------------------------------------------
# Variable Declarations
WIDGET wa_wid_ids(VIRTUAL), w_lbox_id
STRING sa_labellist_c[8](2) = [“List 1”, “List 2”]
STRING sa_labellist[8](1) = [“List 3”]
INTEGER i_listcnt
#---------------------------------------------------------------------
# Compile and make the functions in user_form.pob available to MSC.Patran

!!COMPILE user_form.pob user_form.plb


!!LIBRARY ADD user_form.plb

# Create a form “USER_FORM”, by executing the “display” function


# using ui_exec_function()

ui_exec_function(“USER_FORM”, “display”)

# Call the function get_widget_ids()to get the widget id of the list


# box widget. This function is in user_form.pcl
#
USER_FORM.get_widget_ids(wa_wid_ids)

# As the function call informs, the list box widget is the forth
# element in wa_wid_ids. Assigning this value to w_lbox_id
#
w_lbox_id = wa_wid_ids(4)
#---------------------------------------------------------------------
# Create a list by calling the function.
#
i_listcnt = 2
uil_utils_listbox.create_list @
( w_lbox_id, @
Main Index
CHAPTER 5 889
User Interface

sa_labellist_c, @
i_listcnt )
# Session file paused to observe the List box widget in USER_FORM
# Press “Resume” to continue.
sf_pause()
#---------------------------------------------------------------------
# Append the list by calling uil_utils_listbox.append_list().
#
i_listcnt = 1
uil_utils_listbox.append_list @
( w_lbox_id, @
sa_labellist, @
i_listcnt )

# Session file paused to observe the List box widget in USER_FORM


# Press “Resume” to continue.
sf_pause()

sys_free_array(wa_wid_ids)
# Press “OK” to delete the USER_FORM
#---------------------------------------------------------------------

uil_utils_listbox.create_list ()

# Purpose : This file provides an example of a call to the


# function uil_utils_listbox.create_list()
#
# A medium width half height sized form,
# “USER_FORM”, which contains a List box widget
# is created using user_form.pcl.A list is
# created using uil_utils_listbox.create_list()
#
# The user_form.pcl contains a include file.
# To expand the symbols defined in the included
# file and to create a file “user_form.pob”
# C preprocessor should be used. A command line
# command such as : cpp -I$P3_HOME/customization
# user_form.pcl user_form.pob can be used to
# generate a file user_form.pob.
# See the Part 9:PCL and Customization Chapter 3
# C Preprocessor for more information.
#
# 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 uil_utils_listbox.create_list()
# has the following arguments:
#
# uil_utils_listbox.create_list
# ( lbox_id,
# labellist,
# listcnt )
#
#---------------------------------------------------------------------
# Variable Declarations
WIDGET wa_wid_ids(VIRTUAL), w_lbox_id
STRING sa_labellist[16](2)= [“List 1”,”List 2”]
INTEGER i_listcnt
#---------------------------------------------------------------------
# Compile and make the functions in user_form.pob available to MSC.Patran

!!COMPILE user_form.pob user_form.plb


!!LIBRARY ADD user_form.plb
Main Index
890
Code Examples

# Create a form “USER_FORM”, by executing the “display” function


# using ui_exec_function()

ui_exec_function(“USER_FORM”, “display”)

# Session file paused to observe the List box widget in USER_FORM


# Press “Resume” to continue.
sf_pause()
#---------------------------------------------------------------------
# Call the function get_widget_ids()to get the widget id of the list
# box widget. This function is in user_form.pcl
#
USER_FORM.get_widget_ids(wa_wid_ids)

# As the function call informs, the list box widget is the forth
# element in wa_wid_ids. Assigning this value to w_lbox_id
#
w_lbox_id = wa_wid_ids(4)
#---------------------------------------------------------------------
# Create a list by calling the function.
#
i_listcnt = 2

uil_utils_listbox.create_list @
( w_lbox_id, @
sa_labellist, @
i_listcnt )
# Session file paused to observe the List box widget in USER_FORM
# Press “Resume” to continue.
sf_pause()

sys_free_array(wa_wid_ids)
#---------------------------------------------------------------------

uil_utils_listbox.delete_item ()

# Purpose : This file provides an example of a call to the


# function uil_utils_listbox.delete_item()
#
# A medium width half height sized form,
# “USER_FORM”, which contains a List box widget
# is created using user_form.pcl.A list is
# created using uil_utils_listbox.create_list()
# One of the list is deleted using the function
# uil_utils_listbox.delete_item()
#
# The user_form.pcl contains a include file.
# To expand the symbols defined in the included
# file and to create a file “user_form.pob”
# C preprocessor should be used. A command line
# command such as : cpp -I$P3_HOME/customization
# user_form.pcl user_form.pob can be used to
# generate a file user_form.pob.
# See the Part 9:PCL and Customization Chapter 3
# C Preprocessor for more information.
#
# 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 uil_utils_listbox.delete_item()has the following
# arguments:
# uil_utils_listbox.delete_item
Main Index
CHAPTER 5 891
User Interface

# ( lbox_id,
# name )
#---------------------------------------------------------------------
# Variable Declarations
WIDGET wa_wid_ids(VIRTUAL),w_lbox_id
INTEGER i_listcnt
STRING sa_labellist[8](3)=[“List 1”,”List 2”,”List 3”]
STRING s_name[16]
LOGICAL l_return_value
#---------------------------------------------------------------------
# Compile and make the functions in user_form.pob available to MSC.Patran

!!COMPILE user_form.pob user_form.plb


!!LIBRARY ADD user_form.plb

# Create a form “USER_FORM”, by executing the “display” function


# using ui_exec_function()

ui_exec_function(“USER_FORM”, “display”)

# Call the function get_widget_ids()to get the widget id of the list


# box widget. This function is in user_form.pcl
#
USER_FORM.get_widget_ids(wa_wid_ids)

# As the function call informs, the list box widget is the forth
# element in wa_wid_ids. Assigning this value to w_lbox_id
#
w_lbox_id = wa_wid_ids(4)
#---------------------------------------------------------------------
# Create a list by calling the function.
#
i_listcnt = 3

uil_utils_listbox.create_list @
( w_lbox_id, @
sa_labellist, @
i_listcnt )

# Session file paused to observe the List box widget in USER_FORM


# Press “Resume” to continue.
sf_pause()
#---------------------------------------------------------------------
# Delete the item “List 3” from the List items in list box widget.
#
s_name = “List 3”

l_return_value = @
uil_utils_listbox.delete_item @
( w_lbox_id, @
s_name )

# Checking the success of the function call


dump l_return_value

# Observe the List box Widget to note that “List 3” is deleted.


# Press “OK” to delete the form.
sys_free_array(wa_wid_ids)
#---------------------------------------------------------------------

Main Index
892
Code Examples

uil_utils_listbox.delete_item_list ()

# Purpose : This file provides an example of a call to the


# function uil_utils_listbox.delete_item_list()
#
# A medium width half height sized form,
# “USER_FORM”, which contains a List box widget
# is created using user_form.pcl.A list is
# created using uil_utils_listbox.create_list()
# A portion of List items are deleted by calling
# the function uil_utils_listbox.delete_item_
# list().
#
# The user_form.pcl contains a include file.
# To expand the symbols defined in the included
# file and to create a file “user_form.pob”
# C preprocessor should be used. A command line
# command such as : cpp -I$P3_HOME/customization
# user_form.pcl user_form.pob can be used to
# generate a file user_form.pob.
# See the Part 9:PCL and Customization Chapter 3
# C Preprocessor for more information.
#
# 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 uil_utils_listbox.delete_item_list()has the following
# arguments:
# uil_utils_listbox.delete_item_list
# ( lbox_id,
# nitems
# itemlist )
#---------------------------------------------------------------------
# Variable Declarations
WIDGET wa_wid_ids(VIRTUAL),w_lbox_id
INTEGER i_listcnt, i_nitems
STRING sa_labellist[8](3) = [“List 1”,”List 2”,”List 3”]
STRING sa_itemlist[8](2) = [“List 1”, “List 3”]
LOGICAL l_return_value
#---------------------------------------------------------------------
# Compile and make the functions in user_form.pob available to MSC.Patran

!!COMPILE user_form.pob user_form.plb


!!LIBRARY ADD user_form.plb

# Create a form “USER_FORM”, by executing the “display” function


# using ui_exec_function()

ui_exec_function(“USER_FORM”, “display”)

# Call the function get_widget_ids()to get the widget id of the list


# box widget. This function is in user_form.pcl
#
USER_FORM.get_widget_ids(wa_wid_ids)

# As the function call informs, the list box widget is the forth
# element in wa_wid_ids. Assigning this value to w_lbox_id
#
w_lbox_id = wa_wid_ids(4)
#---------------------------------------------------------------------
# Create a list by calling the function.
#
i_listcnt = 3
Main Index
CHAPTER 5 893
User Interface

uil_utils_listbox.create_list @
( w_lbox_id, @
sa_labellist, @
i_listcnt )

# Session file paused to observe the List box widget in USER_FORM


# Press “Resume” to continue.
sf_pause()
#---------------------------------------------------------------------
# Delete the items “List 1” and “List 3” from the list items in
# list box widget.

i_nitems = 2

l_return_value = @
uil_utils_listbox.delete_item_list @
( w_lbox_id, @
i_nitems , @
sa_itemlist)

dump l_return_value

# Observe the item deleted and remaining in the List Box widget.
# Press “OK” to delete the form.
sys_free_array(wa_wid_ids)
#---------------------------------------------------------------------

uil_utils_listbox.delete_selected ()

# Purpose : This file provides an example of a call to the


# function uil_utils_listbox.delete_selected()
#
# A medium width half height sized form,
# “USER_FORM”, which contains a List box widget
# is created using user_form.pcl.A list is
# created using uil_utils_listbox.create_list()
# A portion of List items are selected by calling
# the function uil_utils_listbox.select_list()
# Function uil_utils_listbox.delete_selected() is
# called to delete the selected items.
#
# The user_form.pcl contains a include file.
# To expand the symbols defined in the included
# file and to create a file “user_form.pob”
# C preprocessor should be used. A command line
# command such as : cpp -I$P3_HOME/customization
# user_form.pcl user_form.pob can be used to
# generate a file user_form.pob.
# See the Part 9:PCL and Customization Chapter 3
# C Preprocessor for more information.
#
# 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 uil_utils_listbox.delete_selected()has the following
# arguments:
# uil_utils_listbox.delete_selected
# ( lbox_id )
#---------------------------------------------------------------------
# Variable Declarations
WIDGET wa_wid_ids(VIRTUAL),w_lbox_id
INTEGER i_listcnt
Main Index
894
Code Examples

STRING sa_labellist_c[8](3) = [“List 1”,”List 2”,”List 3”]


STRING sa_labellist[8](2) = [“List 2”, “List 3”]
LOGICAL l_return_value
#---------------------------------------------------------------------
# Compile and make the functions in user_form.pob available to MSC.Patran

!!COMPILE user_form.pob user_form.plb


!!LIBRARY ADD user_form.plb

# Create a form “USER_FORM”, by executing the “display” function


# using ui_exec_function()

ui_exec_function(“USER_FORM”, “display”)

# Call the function get_widget_ids()to get the widget id of the list


# box widget. This function is in user_form.pcl
#
USER_FORM.get_widget_ids(wa_wid_ids)

# As the function call informs, the list box widget is the forth
# element in wa_wid_ids. Assigning this value to w_lbox_id
#
w_lbox_id = wa_wid_ids(4)
#---------------------------------------------------------------------
# Create a list by calling the function.
#
i_listcnt = 3

uil_utils_listbox.create_list @
( w_lbox_id, @
sa_labellist_c, @
i_listcnt )

# Session file paused to observe the List box widget in USER_FORM


# Press “Resume” to continue.
sf_pause()
#---------------------------------------------------------------------
# Select “List 2” and “List 3” from the List items in list box
# widget.

i_listcnt = 2

l_return_value = @
uil_utils_listbox.select_list @
( w_lbox_id, @
sa_labellist, @
i_listcnt )

dump l_return_value

# Session file stopped to observe the selected items in the List Box
# Widget.Press “Resume” to continue.
sf_pause()
#---------------------------------------------------------------------
# Get the selected items in the list box.

uil_utils_listbox.delete_selected @
( w_lbox_id )

# Observe that “List 2” and “List 3” are deleted.


# Press “OK” to delete the form.
sys_free_array(wa_wid_ids)
#---------------------------------------------------------------------

Main Index
CHAPTER 5 895
User Interface

uil_utils_listbox.get_all ()

# Purpose : This file provides an example of a call to the


# function uil_utils_listbox.get_all()
#
# A medium width half height sized form,
# “USER_FORM”, which contains a List box widget
# is created using user_form.pcl.A list is
# created using uil_utils_listbox.create_list()
#
# The user_form.pcl contains a include file.
# To expand the symbols defined in the included
# file and to create a file “user_form.pob”
# C preprocessor should be used. A command line
# command such as : cpp -I$P3_HOME/customization
# user_form.pcl user_form.pob can be used to
# generate a file user_form.pob.
# See the Part 9:PCL and Customization Chapter 3
# C Preprocessor for more information.
#
# 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 uil_utils_listbox.get_all()has the following arguments
# uil_utils_listbox.get_all
# ( lbox_id,
# items,
# num )
#---------------------------------------------------------------------
# Variable Declarations
WIDGET wa_wid_ids(VIRTUAL),w_lbox_id
INTEGER i_listcnt, i_num
STRING sa_labellist_c[8](3) = [“List 1”,”List 2”,”List 3”]
STRING svv_items[VIRTUAL](VIRTUAL)
LOGICAL l_return_value
#---------------------------------------------------------------------
# Compile and make the functions in user_form.pob available to MSC.Patran

!!COMPILE user_form.pob user_form.plb


!!LIBRARY ADD user_form.plb

# Create a form “USER_FORM”, by executing the “display” function


# using ui_exec_function()

ui_exec_function(“USER_FORM”, “display”)

# Call the function get_widget_ids()to get the widget id of the list


# box widget. This function is in user_form.pcl
#
USER_FORM.get_widget_ids(wa_wid_ids)

# As the function call informs, the list box widget is the forth
# element in wa_wid_ids. Assigning this value to w_lbox_id
#
w_lbox_id = wa_wid_ids(4)
#---------------------------------------------------------------------
# Create a list by calling the function.
#
i_listcnt = 3

uil_utils_listbox.create_list @
( w_lbox_id, @
sa_labellist_c, @
Main Index
896
Code Examples

i_listcnt )

# Session file paused to observe the List box widget in USER_FORM


# Press “Resume” to continue.
sf_pause()
#---------------------------------------------------------------------
# Get all the items in the listbox by calling uil_utils_listbox_get_
# all().

sys_allocate_string(svv_items, 16)
sys_allocate_array(svv_items,1,3)

uil_utils_listbox.get_all @
( w_lbox_id, @
svv_items, @
i_num )

# The number of items in the Listbox Widget


dump i_num
# The items are
dump svv_items

# Press “OK” to delete the form.


sys_free_array(wa_wid_ids)
sys_free_array(svv_items)

#---------------------------------------------------------------------

uil_utils_listbox.get_selected ()

# Purpose : This file provides an example of a call to the


# function uil_utils_listbox.get_selected()
#
# A medium width half height sized form,
# “USER_FORM”, which contains a List box widget
# is created using user_form.pcl.A list is
# created using uil_utils_listbox.create_list()
# A portion of List items are selected by calling
# the function uil_utils_listbox.select_list()
# Function uil_utils_listbox.get_selected() is
# called to output the selected items.
#
# The user_form.pcl contains a include file.
# To expand the symbols defined in the included
# file and to create a file “user_form.pob”
# C preprocessor should be used. A command line
# command such as : cpp -I$P3_HOME/customization
# user_form.pcl user_form.pob can be used to
# generate a file user_form.pob.
# See the Part 9:PCL and Customization Chapter 3
# C Preprocessor for more information.
#
# 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 uil_utils_listbox.get_selected()has the following
# arguments:
# uil_utils_listbox.get_selected
# ( lbox_id,
# items,
# num )
#---------------------------------------------------------------------
# Variable Declarations
Main Index
CHAPTER 5 897
User Interface

WIDGET wa_wid_ids(VIRTUAL),w_lbox_id
INTEGER i_listcnt, i_num
STRING sa_labellist_c[8](3) = [“List 1”,”List 2”,”List 3”]
STRING sa_labellist[8](2) = [“List 2”, “List 3”]
STRING sav_items[16](VIRTUAL)
LOGICAL l_return_value
#---------------------------------------------------------------------
# Compile and make the functions in user_form.pob available to MSC.Patran

!!COMPILE user_form.pob user_form.plb


!!LIBRARY ADD user_form.plb

# Create a form “USER_FORM”, by executing the “display” function


# using ui_exec_function()

ui_exec_function(“USER_FORM”, “display”)

# Call the function get_widget_ids()to get the widget id of the list


# box widget. This function is in user_form.pcl
#
USER_FORM.get_widget_ids(wa_wid_ids)

# As the function call informs, the list box widget is the forth
# element in wa_wid_ids. Assigning this value to w_lbox_id
#
w_lbox_id = wa_wid_ids(4)
#---------------------------------------------------------------------
# Create a list by calling the function.
#
i_listcnt = 3

uil_utils_listbox.create_list @
( w_lbox_id, @
sa_labellist_c, @
i_listcnt )

# Session file paused to observe the List box widget in USER_FORM


# Press “Resume” to continue.
sf_pause()
#---------------------------------------------------------------------
# Select “List 2” and “List 3” from the List items in list box
# widget.

i_listcnt = 2

l_return_value = @
uil_utils_listbox.select_list @
( w_lbox_id, @
sa_labellist, @
i_listcnt )

dump l_return_value

# Session file stopped to observe the selected items in the List Box
# Widget.Press “Resume” to continue.
sf_pause()
#---------------------------------------------------------------------
# Get the selected items in the list box.

uil_utils_listbox.get_selected @
( w_lbox_id, @
sav_items, @
i_num )

# Number of selected items are


dump i_num
# Selected items are
Main Index
898
Code Examples

dump sav_items

# Press “OK” to delete the form.


sys_free_array(wa_wid_ids)
#---------------------------------------------------------------------

uil_utils_listbox.get_unselected ()

# Purpose : This file provides an example of a call to the


# function uil_utils_listbox.get_unselected()
#
# A medium width half height sized form,
# “USER_FORM”, which contains a List box widget
# is created using user_form.pcl.A list is
# created using uil_utils_listbox.create_list()
# A portion of List items are selected by calling
# the function uil_utils_listbox.select_list()
# Function uil_utils_listbox.get_unselected() is
# called to output the unselected items.
#
# The user_form.pcl contains a include file.
# To expand the symbols defined in the included
# file and to create a file “user_form.pob”
# C preprocessor should be used. A command line
# command such as : cpp -I$P3_HOME/customization
# user_form.pcl user_form.pob can be used to
# generate a file user_form.pob.
# See the Part 9:PCL and Customization Chapter 3
# C Preprocessor for more information.
#
# 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 uil_utils_listbox.get_unselected()has the following
# arguments:
# uil_utils_listbox.get_unselected
# ( lbox_id,
# item,
# num )
#---------------------------------------------------------------------
# Variable Declarations
WIDGET wa_wid_ids(VIRTUAL),w_lbox_id
INTEGER i_listcnt, i_num
STRING sa_labellist_c[8](3) = [“List 1”,”List 2”,”List 3”]
STRING sa_labellist[8](2) = [“List 2”, “List 3”]
STRING sav_items[16](VIRTUAL)
LOGICAL l_return_value
#---------------------------------------------------------------------
# Compile and make the functions in user_form.pob available to MSC.Patran

!!COMPILE user_form.pob user_form.plb


!!LIBRARY ADD user_form.plb

# Create a form “USER_FORM”, by executing the “display” function


# using ui_exec_function()

ui_exec_function(“USER_FORM”, “display”)

# Call the function get_widget_ids()to get the widget id of the list


# box widget. This function is in user_form.pcl
#
USER_FORM.get_widget_ids(wa_wid_ids)
Main Index
CHAPTER 5 899
User Interface

# As the function call informs, the list box widget is the forth
# element in wa_wid_ids. Assigning this value to w_lbox_id
#
w_lbox_id = wa_wid_ids(4)
#---------------------------------------------------------------------
# Create a list by calling the function.
#
i_listcnt = 3

uil_utils_listbox.create_list @
( w_lbox_id, @
sa_labellist_c, @
i_listcnt )

# Session file paused to observe the List box widget in USER_FORM


# Press “Resume” to continue.
sf_pause()
#---------------------------------------------------------------------
# Select “List 2” and “List 3” from the List items in list box
# widget.

i_listcnt = 2

l_return_value = @
uil_utils_listbox.select_list @
( w_lbox_id, @
sa_labellist, @
i_listcnt )

dump l_return_value

# Session file stopped to observe the selected and unselected items


# in the List Box Widget.Press “Resume” to continue.
sf_pause()
#---------------------------------------------------------------------
# Get the unselected items in the list box.

uil_utils_listbox.get_unselected @
( w_lbox_id, @
sav_items, @
i_num )

# Number of unselected items are


dump i_num
# Unselected items are
dump sav_items

# Press “OK” to delete the form.


sys_free_array(wa_wid_ids)
#---------------------------------------------------------------------

uil_utils_listbox.select ()

# Purpose : This file provides an example of a call to the


# function uil_utils_listbox.select()
#
# A medium width half height sized form,
# “USER_FORM”, which contains a List box widget
# is created using user_form.pcl.A list is
# created using uil_utils_listbox.create_list()
# One of the list is selected using the function
# uil_utils_listbox.select()
#
# The user_form.pcl contains a include file.
# To expand the symbols defined in the included
Main Index
900
Code Examples

# file and to create a file “user_form.pob”


# C preprocessor should be used. A command line
# command such as : cpp -I$P3_HOME/customization
# user_form.pcl user_form.pob can be used to
# generate a file user_form.pob.
# See the Part 9:PCL and Customization Chapter 3
# C Preprocessor for more information.
#
# 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 uil_utils_listbox.select()has the following arguments:
# uil_utils_listbox.select
# ( lbox_id,
# label )
#---------------------------------------------------------------------
# Variable Declarations
WIDGET wa_wid_ids(VIRTUAL),w_lbox_id
INTEGER i_listcnt
STRING sa_labellist[8](3)=[“List 1”,”List 2”,”List 3”]
STRING s_label[16]
LOGICAL l_return_value
#---------------------------------------------------------------------
# Compile and make the functions in user_form.pob available to MSC.Patran

!!COMPILE user_form.pob user_form.plb


!!LIBRARY ADD user_form.plb

# Create a form “USER_FORM”, by executing the “display” function


# using ui_exec_function()

ui_exec_function(“USER_FORM”, “display”)

# Call the function get_widget_ids()to get the widget id of the list


# box widget. This function is in user_form.pcl
#
USER_FORM.get_widget_ids(wa_wid_ids)

# As the function call informs, the list box widget is the forth
# element in wa_wid_ids. Assigning this value to w_lbox_id
#
w_lbox_id = wa_wid_ids(4)
#---------------------------------------------------------------------
# Create a list by calling the function.
#
i_listcnt = 3

uil_utils_listbox.create_list @
( w_lbox_id, @
sa_labellist, @
i_listcnt )

# Session file paused to observe the List box widget in USER_FORM


# Press “Resume” to continue.
sf_pause()
#---------------------------------------------------------------------
# Select (Highlight) “List 3” from the List items in list box widget.
#
s_label = “List 3”

l_return_value = @
uil_utils_listbox.select @
( w_lbox_id, @
s_label )
Main Index
CHAPTER 5 901
User Interface

dump l_return_value
# Press “OK” to delete the form.
sys_free_array(wa_wid_ids)
#---------------------------------------------------------------------

uil_utils_listbox.select_all ()

# Purpose : This file provides an example of a call to the


# function uil_utils_listbox.select_all()
#
# A medium width half height sized form,
# “USER_FORM”, which contains a List box widget
# is created using user_form.pcl.A list is
# created using uil_utils_listbox.create_list()
# Full List items are selected by calling the
# function uil_utils_listbox.select_all()
#
# The user_form.pcl contains a include file.
# To expand the symbols defined in the included
# file and to create a file “user_form.pob”
# C preprocessor should be used. A command line
# command such as : cpp -I$P3_HOME/customization
# user_form.pcl user_form.pob can be used to
# generate a file user_form.pob.
# See the Part 9:PCL and Customization Chapter 3
# C Preprocessor for more information.
#
# 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 uil_utils_listbox.select_all()has the following
# arguments:
# uil_utils_listbox.select_all
# ( lbox_id )
#---------------------------------------------------------------------
# Variable Declarations

WIDGET wa_wid_ids(VIRTUAL),w_lbox_id
INTEGER i_listcnt
STRING sa_labellist[8](3) = [“List 1”,”List 2”,”List 3”]
LOGICAL l_return_value
#---------------------------------------------------------------------
# Compile and make the functions in user_form.pob available to MSC.Patran

!!COMPILE user_form.pob user_form.plb


!!LIBRARY ADD user_form.plb

# Create a form “USER_FORM”, by executing the “display” function


# using ui_exec_function()

ui_exec_function(“USER_FORM”, “display”)

# Call the function get_widget_ids()to get the widget id of the list


# box widget. This function is in user_form.pcl
#
USER_FORM.get_widget_ids(wa_wid_ids)

# As the function call informs, the list box widget is the forth
# element in wa_wid_ids. Assigning this value to w_lbox_id
#
w_lbox_id = wa_wid_ids(4)
#---------------------------------------------------------------------
# Create a list by calling the function.
Main Index
902
Code Examples

#
i_listcnt = 3

uil_utils_listbox.create_list @
( w_lbox_id, @
sa_labellist, @
i_listcnt )

# Session file paused to observe the List box widget in USER_FORM


# Press “Resume” to continue.
sf_pause()
#---------------------------------------------------------------------
# Select (Highlight) all the items in the List box in the List box
# widget.

uil_utils_listbox.select_all @
( w_lbox_id )

# Press “OK” to delete the form.


sys_free_array(wa_wid_ids)
#---------------------------------------------------------------------

uil_utils_listbox.select_list ()

# Purpose : This file provides an example of a call to the


# function uil_utils_listbox.select_list()
#
# A medium width half height sized form,
# “USER_FORM”, which contains a List box widget
# is created using user_form.pcl.A list is
# created using uil_utils_listbox.create_list()
# A portion of List items are selected by calling
# the function uil_utils_listbox.select_list()
#
# The user_form.pcl contains a include file.
# To expand the symbols defined in the included
# file and to create a file “user_form.pob”
# C preprocessor should be used. A command line
# command such as : cpp -I$P3_HOME/customization
# user_form.pcl user_form.pob can be used to
# generate a file user_form.pob.
# See the Part 9:PCL and Customization Chapter 3
# C Preprocessor for more information.
#
# 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 uil_utils_listbox.select_list()has the following
# arguments:
# uil_utils_listbox.select_list
# ( lbox_id,
# label
# listcnt )
#---------------------------------------------------------------------
# Variable Declarations
WIDGET wa_wid_ids(VIRTUAL),w_lbox_id
INTEGER i_listcnt
STRING sa_labellist_c[8](3) = [“List 1”,”List 2”,”List 3”]
STRING sa_labellist[8](2) = [“List 2”, “List 3”]
LOGICAL l_return_value
#---------------------------------------------------------------------
# Compile and make the functions in user_form.pob available to MSC.Patran
Main Index
CHAPTER 5 903
User Interface

!!COMPILE user_form.pob user_form.plb


!!LIBRARY ADD user_form.plb

# Create a form “USER_FORM”, by executing the “display” function


# using ui_exec_function()

ui_exec_function(“USER_FORM”, “display”)

# Call the function get_widget_ids()to get the widget id of the list


# box widget. This function is in user_form.pcl
#
USER_FORM.get_widget_ids(wa_wid_ids)

# As the function call informs, the list box widget is the forth
# element in wa_wid_ids. Assigning this value to w_lbox_id
#
w_lbox_id = wa_wid_ids(4)
#---------------------------------------------------------------------
# Create a list by calling the function.
#
i_listcnt = 3

uil_utils_listbox.create_list @
( w_lbox_id, @
sa_labellist_c, @
i_listcnt )

# Session file paused to observe the List box widget in USER_FORM


# Press “Resume” to continue.
sf_pause()
#---------------------------------------------------------------------
# Select (Highlight) “List 2” and “List 3” from the List items in
# list box widget.

i_listcnt = 2

l_return_value = @
uil_utils_listbox.select_list @
( w_lbox_id, @
sa_labellist, @
i_listcnt )

dump l_return_value
# Press “OK” to delete the form.
sys_free_array(wa_wid_ids)
#---------------------------------------------------------------------

uil_utils_listbox.select_none ()

# Purpose : This file provides an example of a call to the


# function uil_utils_listbox.select_list()
#
# A medium width half height sized form,
# “USER_FORM”, which contains a List box widget
# is created using user_form.pcl.A list is
# created using uil_utils_listbox.create_list()
# A portion of List items are selected by calling
# the function uil_utils_listbox.select_list()
# Selection is cleared by calling the function
# uil_utils_listbox.select_none()
#
# The user_form.pcl contains a include file.
# To expand the symbols defined in the included
# file and to create a file “user_form.pob”
# C preprocessor should be used. A command line
Main Index
904
Code Examples

# command such as : cpp -I$P3_HOME/customization


# user_form.pcl user_form.pob can be used to
# generate a file user_form.pob.
# See the Part 9:PCL and Customization Chapter 3
# C Preprocessor for more information.
#
# 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 uil_utils_listbox.select_none()has the following
# arguments:
# uil_utils_listbox.select_none
# ( lbox_id )
#---------------------------------------------------------------------
# Variable Declarations
WIDGET wa_wid_ids(VIRTUAL),w_lbox_id
INTEGER i_listcnt
STRING sa_labellist[8](3) = [“List 1”,”List 2”,”List 3”]
LOGICAL l_return_value
#---------------------------------------------------------------------
# Compile and make the functions in user_form.pob available to MSC.Patran

!!COMPILE user_form.pob user_form.plb


!!LIBRARY ADD user_form.plb

# Create a form “USER_FORM”, by executing the “display” function


# using ui_exec_function()

ui_exec_function(“USER_FORM”, “display”)

# Call the function get_widget_ids()to get the widget id of the list


# box widget. This function is in user_form.pcl
#
USER_FORM.get_widget_ids(wa_wid_ids)

# As the function call informs, the list box widget is the forth
# element in wa_wid_ids. Assigning this value to w_lbox_id
#
w_lbox_id = wa_wid_ids(4)
#---------------------------------------------------------------------
# Create a list by calling the function.
#
i_listcnt = 3

uil_utils_listbox.create_list @
( w_lbox_id, @
sa_labellist, @
i_listcnt )

# Session file paused to observe the List box widget in USER_FORM


# Press “Resume” to continue.
sf_pause()
#---------------------------------------------------------------------
# Select (Highlight) all the items from the List items in list box
# widget.

l_return_value = @
uil_utils_listbox.select_list @
( w_lbox_id, @
sa_labellist, @
i_listcnt )

dump l_return_value
# Session file paused to observe the selected items in list box
# widget. Press “Resume to continue”
Main Index
CHAPTER 5 905
User Interface

sf_pause()
#---------------------------------------------------------------------
# Clear all selected (Highlighted) items in the list box.

l_return_value = @
uil_utils_listbox.select_none @
( w_lbox_id )

# Check the success of function call


dump l_return_value

# Press “OK” to delete the form.


sys_free_array(wa_wid_ids)
#---------------------------------------------------------------------

user_message ()

# Purpose : This file gives an example of a call to the


# function user_message()
#
# The call to the function uses standard MSC.Patran
# messages from the file “messages.database”
#
# To run this session file, Start a session of
# MSC.Patran, run the session file by “File”,
# “Session”,”Play”pulldown menus on the menu bar.
#
# The function has the following arguments:
# user_message
# ( type
# appcode
# appname
# message )
#
# -------------------------------------------------------------------
# Variable Declaration
#
STRING s_type[16], s_appname[64], s_message[128]
INTEGER i_appcode
INTEGER i_return_value

# -------------------------------------------------------------------
# Call the user_message() with following parameters :
# s_type = “C_YN_Y”
# i_appcode=1000000101
# s_appname=”FILE”
# s_message = “Database does not exist. Do you wish to “ // @
# “ create a new database? “
#
s_type = “C_YN_Y”
i_appcode = 1000000101
s_appname = “FILE”
s_message = “Database does not exist. Do you wish to “ // @
“ create a new database? “

i_return_value = @
user_message @
( s_type, @
i_appcode, @
s_appname, @
s_message )

dump i_return_value
Main Index
906
Code Examples

# Note that the i_return_value depends upon your answer YES/NO to the
# question in the form displayed.This can be used further in any
# application.( A sample is given below )

IF ( 1== i_return_value ) THEN


ui_write(“ You have selected YES in the form “)
ELSE
ui_write(“ You have selected NO in the form “)
END IF

# -------------------------------------------------------------------

10000000000 Example Customization


10000000001 There are %I% elements with %F% average length in database
%A%

Main Index
MSC.Acumen, Volume 2: Code Examples

CHAPTER
Group
6
■ Introduction

Main Index
908
Code Examples

6.1 Introduction
This chapter provides code examples for the PCL function described in Volume 1. These
examples are designed so that they can be cut and pasted into a file and, by following the
instructions listed with each example, executed in MSC.Patran.

asm_db_count_asm_in_group ()

# Purpose : This file gives an example of a call to the


# function asm_db_count_asm_in_group()
#
# This function is used to get the number of
# MSC(MacNeal-Schwendler Corporation) entities
# that belong to a particular group.The function
# has no return type.
#
# This file opens a database spool.db which has
# two groups “default_group” and “fem_model”group
# This file counts for the number of grids,lines
# patch,hpat,co-ordinate frames,nodes and
# elements in default and fem_model group and
# gives the count of them.This database has seven
# grids,three lines,no patch, no hpat, one
# co-ordinate frame,600 nodes and 576 elements
#
# Before running this file the database should be
# created by running the session file “spool.ses”
# To run this session file,first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The asm_db_count_asm_in_group has the following arguments:
# asm_db_count_asm_in_group
# ( groupId,
# count,
# status )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_groupId,i_status,i_count(7)
# -------------------------------------------------------------------
#
# opening a existing database spool.db
uil_file_open.go(“spool.db”)

# i_groupId = 1 (default group)


i_groupId = 1

# check the database for MSC entities in default group.

asm_db_count_asm_in_group @
( i_groupId, @
i_count, @
i_status )
# Checking the success of the call
dump i_status

# The number of MSC entities(grid,line,patch,hpat,coordinate frames,


# nodes,elements) in default group are
Main Index dump i_count
CHAPTER 6 909
Group

# i_groupId = 2 (fem_model group)


i_groupId = 2

# check the database for MSC entities in fem_model group.

asm_db_count_asm_in_group @
( i_groupId, @
i_count, @
i_status )

# Checking the success of the call


dump i_status

# The number of MSC entities(grid,line,patch,hpat,coordinate frames,


# nodes,elements) in fem_model group are
dump i_count

# -------------------------------------------------------------------

asm_db_get_grids_in_group ()

# Purpose : This file gives an example of a call to the


# function asm_db_get_grids_in_group()
#
# This function is used to get the label and xyz
# coordinates for the MSC(MacNeal-Schwendler
# Corporation) grid entity that belongs to a
# particular group.The function has no
# return type.
#
# This file opens a database spool.db which has
# two groups “default_group” and “fem_model”group
# This file gets the labels and xyz coordinates
# of grids in the default group.The default group
# has seven grids.
#
# Before running this file the database should be
# created by running the session file “spool.ses”
# To run this session file,first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The asm_db_get_grids_in_group has the following arguments:
# asm_db_get_grids_in_group
# ( groupId,
# gridLabels,
# xyzCoordinates,
# status )
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_groupId,i_status,i_count(7),i_count_c
INTEGER i_gridLabels( VIRTUAL )
REAL r_xyzCoordinates( VIRTUAL )
# -------------------------------------------------------------------
#
# opening the existing database spool.db
uil_file_open.go(“spool.db”)

# i_groupId = 1 (default group)


i_groupId = 1

# check the database for MSC grid entity in default group.


Main Index
910
Code Examples

asm_db_count_asm_in_group @
( i_groupId, @
i_count, @
i_status )

i_count_c = i_count(1)

#Allocate memory
SYS_ALLOCATE_ARRAY(i_gridLabels,1,i_count_c)
SYS_ALLOCATE_ARRAY(r_xyzCoordinates,1,3*i_count_c)

# Get the labels and xyz coordinates for the grids.


asm_db_get_grids_in_group @
( i_groupId, @
i_gridLabels, @
r_xyzCoordinates, @
i_status )
#
dump i_status

# Get the grid labels for the grids of the default group.
dump i_gridLabels

# Get the xyz coordinates for the grids of the default group.
dump r_xyzCoordinates

SYS_FREE_ARRAY( i_gridLabels )
SYS_FREE_ARRAY( r_xyzCoordinates )

# -------------------------------------------------------------------

asm_db_get_hpats_in_group ()

# Purpose : This file gives an example of a call to the


# function asm_db_get_hpats_in_group()
#
# This function is used to get the label and xyz
# coordinates for the MSC(MacNeal-Schwendler
# Corporation) hpat entity that belongs to a
# particular group.The function also gets the
# vertex ids.The function has no return type.
#
# This file opens a new database “new.db”
# It creates a solid which results in
# creation of a hpat entity.Then this file gets
# the labels, vertex ids and xyz coordinates of
# hpats in the default group of the database
# new.db.
#
# To run this session file,first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The asm_db_get_hpats_in_group has the following arguments:
# asm_db_get_hpats_in_group
# ( groupid,
# hpatlabels,
# hpatvertexIds,
# geometriccoeff,
# status )
#
# -------------------------------------------------------------------
# Variable Declaration
#
Main Index
CHAPTER 6 911
Group

INTEGER i_groupid,i_status
INTEGER i_hpatlabels( 1 )
INTEGER i_hpatvertexIds( 8 )
REAL r_geometriccoeff(192)
STRING s_asm_create_hpat[ VIRTUAL ]
# -------------------------------------------------------------------
#
# opening a new database new.db
uil_file_new.go(““,”new.db”)
$? YES 36000002

# Create a hpat entity in the database


asm_const_hpat_xyz(“1”,”<1 1 1>”,”[0 0 0]”,”Coord 0”, @
s_asm_create_hpat )

# i_groupid = 1 (default group)


i_groupid = 1

# Get the labels ,vertex ids and xyz coordinates of the line entity.
asm_db_get_hpats_in_group @
( i_groupid, @
i_hpatlabels, @
i_hpatvertexIds, @
r_geometriccoeff, @
i_status )
#
# Get the success or error code.
dump i_status

# Get the hpat labels for the hpats of the default group.
dump i_hpatlabels

# Get the hpat labels for the hpats of the default group.
dump i_hpatvertexIds

# Get the xyz coordinates for the hpats of the default group.
dump r_geometriccoeff

SYS_FREE_STRING(s_asm_create_hpat )

# -------------------------------------------------------------------

asm_db_get_lines_in_group ()

# Purpose : This file gives an example of a call to the


# function asm_db_get_lines_in_group()
#
# This function is used to get the label and xyz
# coordinates for the MSC(MacNeal-Schwendler
# Corporation) line entity that belongs to a
# particular group.The function has no
# return type.
#
# This file opens a database spool.db which has
# two groups “default_group” and “fem_model”group
# This file gets the labels and xyz coordinates
# of lines in the default group.The default group
# has three lines.
#
# Before running this file the database should be
# created by running the session file “spool.ses”
# To run this session file,first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
Main Index
912
Code Examples

# menus on the menu bar.


#
# The asm_db_get_lines_in_group has the following arguments:
# asm_db_get_lines_in_group
# ( groupid,
# linelabels,
# geometriccoefficients,
# status )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_groupid,i_status,i_count(7),i_count_c
INTEGER i_linelabels( VIRTUAL )
REAL r_geometriccoefficients( VIRTUAL )
# -------------------------------------------------------------------
#
# opening a existing database spool.db
uil_file_open.go(“spool.db”)

# i_groupid = 1 (default group)


i_groupid = 1

# check the database for MSC line entity in default group.


asm_db_count_asm_in_group @
( i_groupid, @
i_count, @
i_status )

#i_count_c = i_count(2)
i_count_c = i_count(2)

#Allocate memory
SYS_ALLOCATE_ARRAY(i_linelabels,1,i_count_c)

# Each curve requires twelve spaces for the geometric coefficients.


SYS_ALLOCATE_ARRAY(r_geometriccoefficients,1,12*i_count_c)

# Get the labels and xyz coordinates of the line entity.

asm_db_get_lines_in_group @
( i_groupid, @
i_linelabels, @
r_geometriccoefficients, @
i_status )
#
dump i_status

# Get the line labels for the lines of the default group.
dump i_linelabels

# Get the xyz coordinates for the lines of the default group.
dump r_geometriccoefficients

SYS_FREE_ARRAY( i_linelabels )
SYS_FREE_ARRAY( r_geometriccoefficients )

# -------------------------------------------------------------------

Main Index
CHAPTER 6 913
Group

asm_db_get_patches_in_group ()

# Purpose : This file gives an example of a call to the


# function asm_db_get_patches_in_group()
#
# This function is used to get the label and xyz
# coordinates for the MSC(MacNeal-Schwendler
# Corporation) patch entity that belongs to a
# particular group.The function has no return
# type.
#
# This file opens a new database “new.db”
# It creates a surface which results in
# creation of a patch entity.Then this file gets
# the labels and xyz coordinates of patch in the
# default group of the database new.db.
#
# To run this session file,first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The asm_db_get_patches_in_group has the following arguments:
# asm_db_get_patches_in_group
# ( groupid,
# patchlabels,
# geometriccoefficients,
# status )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_groupid,i_status
INTEGER i_patchlabels( 1 )
REAL r_geometriccoefficients( 48 )
STRING s_asm_create_patch[ VIRTUAL ]
# -------------------------------------------------------------------
# opening a new database new.db
uil_file_new.go(““,”new.db”)
$? YES 36000002

# Create a patch entity in the database


asm_const_patch_xyz(“1”,”<1 1 0>”,”[0 0 0]”,”Coord 0”, @
s_asm_create_patch )

# i_groupid = 1 (default group)


i_groupid = 1

# Get the labels and xyz coordinates of the patch entity.


asm_db_get_patches_in_group @
( i_groupid, @
i_patchlabels, @
r_geometriccoefficients, @
i_status )
#
# Check the success of the call
dump i_status

# Get the patch labels for the patches of the default group.
dump i_patchlabels

# Get the xyz coordinates for the patches of the default group.
dump r_geometriccoefficients

SYS_FREE_STRING(s_asm_create_patch)
# -------------------------------------------------------------------
Main Index
914
Code Examples

count_orphan_elements ()

# Purpose : This file gives an example of a call to the


# function count_orphan_elements()
#
# This function is used to get the number of
# elements entities that do not belong to any
# of the groups.This file opens a database
# spool.db.This database has two groups “default”
# group and “fem_model” group. The fem_model
# group has 600 node entities and 576 element
# entities.Elements 1 to 250 is removed from
# the fem_model group and the orphan elements
# are found.
#
# Before running this session file run spool.ses
# to create spool.db
#
# To run this session file,first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The count_orphan_elements has the following arguments:
# count_orphan_elements
# ( count )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_count,i_grp_id
STRING s_name[32]
INTEGER i_return_value
# -------------------------------------------------------------------
#
# opening a existing database spool.db
uil_file_open.go(“spool.db”)

i_grp_id = 2

# Count the number of elements already in the group.


# There should be 576 elements in the group.
db_count_elems_in_group(i_grp_id, i_count)
dump i_count

# Now remove the elements 1 to 250 from group two ( fem_model)


db_get_group_name( i_grp_id,s_name )
ga_group_entity_remove( s_name,”Element 1:250” )

# Count the number of elements again.


# There should be 326 elements in the group.
db_count_elems_in_group(i_grp_id, i_count)
dump i_count

# check the database for orphan elements

i_return_value = @
count_orphan_elements @
( i_count )
#
dump i_return_value
# The number of orphan elements are
dump i_count
ga_group_entity_add( s_name,”Element 1:250” )

Main Index
CHAPTER 6 915
Group

# Count the number of elements again.


# There should be 576 elements in the group.
db_count_elems_in_group(i_grp_id, i_count)
dump i_count

# Now remove the elements 1 to 576 from group two ( fem_model)


db_get_group_name( i_grp_id,s_name )
ga_group_entity_remove( s_name,”Element 1:576” )

# Count the number of elements again.


# There should be 0 elements in the group.
db_count_elems_in_group(i_grp_id, i_count)
dump i_count

# check the database for orphan elements

i_return_value = @
count_orphan_elements @
( i_count )
#
dump i_return_value
# The number of orphan elements are
dump i_count

ga_group_entity_add( s_name,”Element 1:576” )

# Count the number of elements again.


# There should be 576 elements in the group.
db_count_elems_in_group(i_grp_id, i_count)
dump i_count
# -------------------------------------------------------------------

count_orphan_nodes ()

# Purpose : This file gives an example of a call to the


# function count_orphan_nodes()
#
# This function is used to get the number of
# node entities that do not belong to any of
# the groups.This file opens the database
# “spool.db”. This database has two groups
# “default”group and “fem_model”group.The
# fem_model group has 600 node entities and 576
# element entities.Node entities 1 to 300 is
# removed from the fem_model group and the
# orphan nodes are found
#
# Before running this session file run spool.ses
# to create spool.db
#
# To run this session file,first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The count_orphan_nodes has the following arguments:
# count_orphan_nodes
# ( count )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_count,i_grp_id
Main Index
916
Code Examples

STRING s_name[32]
INTEGER i_return_value
# -------------------------------------------------------------------
#
# opening a existing database spool.db
uil_file_open.go(“spool.db”)

i_grp_id = 2

# Count the number of nodes in the group.


# There should be 600 nodes in the group.
db_count_nodes_in_group(i_grp_id, i_count)
dump i_count

# Now remove the nodes 1 to 300 from group two ( fem_model)


db_get_group_name( i_grp_id,s_name )
ga_group_entity_remove( s_name,”Node 1:300” )

# Count the number of nodes in the group.


# There should be 300 nodes in the group.
db_count_nodes_in_group(i_grp_id, i_count)
dump i_count

# check the database for orphan elements

i_return_value = @
count_orphan_nodes @
( i_count )
#
dump i_return_value
# The number of orphan nodes are
dump i_count

ga_group_entity_add( s_name,”Node 1:300” )

# Count the number of nodes in the group.


# There should be 600 nodes in the group.
db_count_nodes_in_group(i_grp_id, i_count)
dump i_count

# Now remove the nodes 1 to 600 from group two ( fem_model)


db_get_group_name( i_grp_id,s_name )
ga_group_entity_remove( s_name,”Node 1:600” )

# Count the number of nodes in the group.


# There should be 0 nodes in the group.
db_count_nodes_in_group(i_grp_id, i_count)
dump i_count

# check the database for orphan elements

i_return_value = @
count_orphan_nodes @
( i_count )
#
dump i_return_value
# The number of orphan nodes are
dump i_count

ga_group_entity_add( s_name,”Node 1:600” )

# Count the number of nodes in the group.


# There should be 600 nodes in the group.
db_count_nodes_in_group(i_grp_id, i_count)
dump i_count

# -------------------------------------------------------------------
Main Index
CHAPTER 6 917
Group

db_add_mpc_to_group ()

# Purpose : This file gives an example of a call to the


# function db_add_mpc_to_group()
#
# This function adds a MPC (Multi point
# constraint) entity to a particular group.
# This file opens a database mpc.db.
#
# Before running this session file run mpc.ses
# to create mpc.db
#
# To run this session file,first start
# a session of MSC.Patran,then run the session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The db_add_mpc_to_group has the following arguments:
# db_add_mpc_to_group
# ( mpc_id,
# gid,
# visible )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_mpc_id, i_gid
STRING s_name[32]
LOGICAL l_visible
INTEGER i_return_value
INTEGER i_type,i_grp_id,i_count
# -------------------------------------------------------------------
# open the existing database mpc.db

uil_file_open.go(“mpc.db”)
# The database mpc.db has eight MPCs.
# There are five groups in the database mpc.db.
# There is one MPC entity in the second group.
# We add one more entity to it.
l_visible = TRUE
i_gid = 2
db_get_group_name @
( i_gid, @
s_name )

#i_type = 161 (mpc)


i_type = 161
# Count the MPC entity in the group.
db_count_entities_in_group @
( s_name, @
i_type, @
i_count )

dump i_count
# i_mpc_id = 4
i_mpc_id = 4
# Add a MPC entity to the group
i_return_value = @
db_add_mpc_to_group @
( i_mpc_id, @
i_gid, @
l_visible )
dump i_return_value

# Count the MPC entity in the group.


Main Index
918
Code Examples

db_count_entities_in_group @
( s_name, @
i_type, @
i_count )
# Compare the two counts and see the effect of addition
dump i_count

ga_group_entity_remove( s_name,”MPC 4:4”)

# -------------------------------------------------------------------

db_count_entities_in_group ()

# Purpose : This file gives an example of a call to the


# function db_count_entities_in_group()
#
# This function gives the count of a specified
# type of entity in a particular group.This file
# opens a database spool.db which has two groups
# “default group” and “fem_model” group.The
# fem_model group has 600 node entities and
# 576 element entities.This file counts the
# node entities in the fem_model group.
#
# Before running this session file run spool.ses
# to create spool.db
#
# To run this session file,first start
# a session of MSC.Patran,then run the session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The db_count_entities_in_group has the following arguments:
# db_count_entities_in_group
# ( name
# type
# count )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_name,i_count,i_type, i_grp_id
STRING s_name[32]
INTEGER i_return_value

# -------------------------------------------------------------------
# open the existing database spool.db

uil_file_open.go(“spool.db”)
# get the current group id (fem group)
db_get_current_group_id( i_grp_id )
db_get_group_name @
( i_grp_id, @
s_name )

#i_type = 123 (node)


i_type = 123
# counts the number of nodes.
i_return_value = @
db_count_entities_in_group @
( s_name, @
i_type, @
i_count )

dump i_return_value
Main Index
CHAPTER 6 919
Group

# The group name.


dump s_name
# The count of nodes in the specified group.
dump i_count

# -------------------------------------------------------------------

db_count_groups_for_entity ()

# Purpose : This file gives an example of a call to the


# function db_count_groups_for_entity()
#
# This function gives the count of all the groups
# having a specified type of entity.This file
# opens a database spool.db which has two groups
# “default group” and “fem_model” group. The
# fem_model group has 600 node entities and 576
# element entities. This file counts the groups
# in which the node entity resides.
#
# Before running this session file run spool.ses
# to create spool.db
#
# To run this session file,first start
# a session of MSC.Patran,then run the session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The db_count_groups_for_entity has the following arguments:
# db_count_groups_for_entity
# ( id
# type
# count )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_count, i_type,i_id
INTEGER i_return_value

# -------------------------------------------------------------------
# open the existing database spool.db

uil_file_open.go(“spool.db”)

#i_id = 1
i_id = 1

#i_type = 123 (node)


i_type = 123

i_return_value = @
db_count_groups_for_entity @
( i_id, @
i_type, @
i_count )

dump i_return_value
# The node entity is only in the fem_model group. i.e. just one group.
dump i_count

# -------------------------------------------------------------------

Main Index
920
Code Examples

db_count_groups_using_mpc ()

# Purpose : This file gives an example of a call to the


# function db_count_groups_using_mpc()
#
# This function is used to get the number of
# groups using a list of ids of the MPCs( Multi
# point constraints).This file opens a database
# mpc.db.
#
# Before running this session file run mpc.ses
# to create mpc.db
#
# To run this session file,first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The db_count_groups_using_mpc has the following arguments:
# db_count_groups_using_mpc
# ( nmpc,
# mpcid,
# ngroup,
# flag )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_nmpc,i_flag,i_mpcid( VIRTUAL ),i_ngroup( VIRTUAL )
INTEGER i_return_value

# -------------------------------------------------------------------
#
# opening a existing database mpc.db
uil_file_open.go(“mpc.db”)

# The database mpc.db has five groups and eight MPCs.


# First group and the third group has two entities ,the second has
# one entity and the fourth has three entities.
# The fifth group has the entities of group two and group four.
# The entities are numbered in a serial order as per the groups.

# i_nmpc = 3
# i_mpcid = [4,3,6]
# memory allocation
SYS_ALLOCATE_ARRAY(i_mpcid,1,3)
SYS_ALLOCATE_ARRAY(i_ngroup,1,3)

i_nmpc = 3
i_mpcid = [4,3,6]

i_return_value = @
db_count_groups_using_mpc @
( i_nmpc, @
i_mpcid, @
i_ngroup, @
i_flag )
#
dump i_return_value
dump i_flag
# the number of groups using MPC id 4,3,6.
dump i_ngroup
SYS_FREE_ARRAY(i_mpcid)
SYS_FREE_ARRAY(i_ngroup)
# -------------------------------------------------------------------
Main Index
CHAPTER 6 921
Group

db_count_orphan_curves ()

# Purpose : This file gives an example of a call to the


# function db_count_orphan_curves()
#
# This function is used to get the number of
# curve entities that do not belong to any of
# the groups.
# This file opens a database spool.db which has
# two groups “default_group” and “fem_model”group
# The default_group has three curves and in the
# total model there are thirteen curves.This
# implies there are ten orphan curves.
#
# Before running this file the database should be
# created by running the session file “spool.ses”
# To run this session file,first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The db_count_orphan_curves has the following arguments:
# db_count_orphan_curves
# ( count )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_count, i_grp_id
INTEGER i_return_value
STRING s_name[32]
# -------------------------------------------------------------------
#
# opening the existing database spool.db

uil_file_open.go(“spool.db”)

# Count the number of curves in the database. There should be 13.

i_return_value = @
db_count_curve @
( i_count )

dump i_return_value
dump i_count

# check the database for orphan curves.

i_return_value = @
db_count_orphan_curves @
( i_count )
#
dump i_return_value
# The number of orphan curves are
dump i_count

i_grp_id = 1

# Now remove some of the curves from the group, increasing the
# number of orphan curves.
#
i_return_value = db_get_group_name( i_grp_id,s_name )
dump i_return_value
dump s_name

Main Index
922
Code Examples

i_return_value = ga_group_entity_remove( s_name,”Curve 1:3” )


dump i_return_value

# Count the number of curves in the database. There should be 13.

i_return_value = @
db_count_curve @
( i_count )

dump i_return_value
dump i_count

# check the database for orphan curves. There should now be 13


# orphan curves.

i_return_value = @
db_count_orphan_curves @
( i_count )
#
dump i_return_value
# The number of orphan curves are
dump i_count

# Return the curves removed above to the group.

i_return_value = ga_group_entity_add( s_name,”Curve 1:3” )


dump i_return_value

# Count the number of curves in the database. There should be 13.

i_return_value = @
db_count_curve @
( i_count )

dump i_return_value
dump i_count

# check the database for orphan curves. There should be 10


# orphan curves again.

i_return_value = @
db_count_orphan_curves @
( i_count )
#
dump i_return_value
# The number of orphan curves are
dump i_count

# -------------------------------------------------------------------

db_count_orphan_curves ()

# Purpose : This file gives an example of a call to the


# function db_count_orphan_curves()
#
# This function is used to get the number of
# curve entities that do not belong to any of
# the groups.
# This file opens a database spool.db which has
# two groups “default_group” and “fem_model”group
# The default_group has three curves and in the
# total model there are thirteen curves.This
# implies there are ten orphan curves.
#
Main Index
CHAPTER 6 923
Group

# Before running this file the database should be


# created by running the session file “spool.ses”
# To run this session file,first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The db_count_orphan_curves has the following arguments:
# db_count_orphan_curves
# ( count )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_count, i_grp_id
INTEGER i_return_value
STRING s_name[32]
# -------------------------------------------------------------------
#
# opening the existing database spool.db

uil_file_open.go(“spool.db”)

# Count the number of curves in the database. There should be 13.

i_return_value = @
db_count_curve @
( i_count )

dump i_return_value
dump i_count

# check the database for orphan curves.

i_return_value = @
db_count_orphan_curves @
( i_count )
#
dump i_return_value
# The number of orphan curves are
dump i_count

i_grp_id = 1

# Now remove some of the curves from the group, increasing the
# number of orphan curves.
#
i_return_value = db_get_group_name( i_grp_id,s_name )
dump i_return_value
dump s_name

i_return_value = ga_group_entity_remove( s_name,”Curve 1:3” )


dump i_return_value

# Count the number of curves in the database. There should be 13.

i_return_value = @
db_count_curve @
( i_count )

dump i_return_value
dump i_count

# check the database for orphan curves. There should now be 13


# orphan curves.
Main Index
924
Code Examples

i_return_value = @
db_count_orphan_curves @
( i_count )
#
dump i_return_value
# The number of orphan curves are
dump i_count

# Return the curves removed above to the group.

i_return_value = ga_group_entity_add( s_name,”Curve 1:3” )


dump i_return_value

# Count the number of curves in the database. There should be 13.

i_return_value = @
db_count_curve @
( i_count )

dump i_return_value
dump i_count

# check the database for orphan curves. There should be 10


# orphan curves again.

i_return_value = @
db_count_orphan_curves @
( i_count )
#
dump i_return_value
# The number of orphan curves are
dump i_count

# -------------------------------------------------------------------

db_count_orphan_mpcs ()

# Purpose : This file gives an example of a call to the


# function db_count_orphan_mpcs()
#
# This function is used to get the number of MPC
# (Multi point constraints) entities that do not
# belong to any of the groups.This file opens a
# existing database mpc.db.
#
# Before running this session file run mpc.ses
# to create mpc.db
#
# To run this session file,first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The db_count_orphan_mpcs has the following arguments:
# db_count_orphan_mpcs
# ( count )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_count,i_grp_id
STRING s_name[32],s_name0[32]
INTEGER i_return_value
# -------------------------------------------------------------------
#
Main Index
CHAPTER 6 925
Group

# opening a existing database mpc.db


uil_file_open.go(“mpc.db”)

# The database mpc.db has five groups and eight MPCs.


# First group and the third group has two entities ,the second has
# one entity and the fourth has three entities.
# The fifth group has the entities of group two and group four.
# the second group entity has id MPC 3:3
# check the database for orphan MPCs(first time)

i_return_value = @
db_count_orphan_mpcs @
( i_count )
#
dump i_return_value
dump i_count

# Remove entity three from second group.Entity three is present in


# both second and fifth group.
i_grp_id = 2
db_get_group_name( i_grp_id,s_name )
ga_group_entity_remove( s_name,”MPC 3:3” )

# check the database for orphan MPCs(second time)

i_return_value = @
db_count_orphan_mpcs @
( i_count )
#
dump i_return_value
dump i_count

# Now remove the entity three from group five also.


i_grp_id = 5
db_get_group_name( i_grp_id,s_name0 )
ga_group_entity_remove( s_name0,”MPC 3:3” )

# check the database for orphan MPCs(third time)

i_return_value = @
db_count_orphan_mpcs @
( i_count )
#
dump i_return_value
dump i_count
ga_group_entity_add( s_name,”MPC 3:3” )
ga_group_entity_add( s_name0,”MPC 3:3” )

# -------------------------------------------------------------------

db_count_orphan_points ()

# Purpose : This file gives an example of a call to the


# function db_count_orphan_points()
#
# This function is used to get the number of
# point entities that do not belong to any of
# the groups.
# This file opens a database spool.db which has
# two groups “default_group” and “fem_model”group
# The default_group has seven points(ids 4 to 10)
# and in the total model there are seven points
# This implies there are no orphan points.So we
# delete two point entities and then search for
# these two orphan entities.
Main Index
926
Code Examples

#
# Before running this file the database should be
# created by running the session file “spool.ses”
# To run this session file,first start a session
# of MSC.Patran,then run this session file by
# “File”,”Session”,”Play” pulldown menus on the
# menu bar.
#
# The db_count_orphan_points has the following arguments:
# db_count_orphan_points
# ( count )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_count
INTEGER i_return_value
# -------------------------------------------------------------------
#
# opening a existing database spool.db

uil_file_open.go(“spool.db”)

# we remove two points from the default_group


ga_group_entity_remove(“default_group”,”Point 9:10”)

# check the database for orphan curves.

i_return_value = @
db_count_orphan_points @
( i_count )
#
dump i_return_value
# the number of orphan points are
dump i_count
ga_group_entity_add(“default_group”,”Point 9:10”)

# -------------------------------------------------------------------

db_count_orphan_solids ()

# Purpose : This file gives an example of a call to the


# function db_count_orphan_solids()
#
# This function is used to get the number of
# solid entities that do not belong to any of
# the groups.
# This file opens a new database “new.db”
# and creates a solid in the default group
# and then removes the entity from the group.
# we then count for the orphan entities.
# If new.db is existing delete it before running
# this session file.
#
# To run this session file,first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The db_count_orphan_solids has the following arguments:
# db_count_orphan_solids
# ( count )
#
# -------------------------------------------------------------------
# Variable Declaration
Main Index
CHAPTER 6 927
Group

#
INTEGER i_count
STRING s_created_ids[VIRTUAL]
INTEGER i_return_value
# -------------------------------------------------------------------
#open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

SYS_ALLOCATE_STRING(s_created_ids,32)
# Create a solid in this new database
asm_const_hpat_xyz(“1”,”<1 1 1>”,”[0 0 0]”,”coord 0”,s_created_ids)

# Remove this entity from the group.


ga_group_entity_remove(“default_group”,”Solid 1:1”)

# check the database for orphan solids.

i_return_value = @
db_count_orphan_solids @
( i_count )
#
dump i_return_value
# The number of orphan solids are
dump i_count
SYS_FREE_STRING(s_created_ids)

# -------------------------------------------------------------------

db_count_orphan_surfaces ()

# Purpose : This file gives an example of a call to the


# function db_count_orphan_surfaces()
#
# This function is used to get the number of
# surface entities that does not belong to any of
# the groups.
# This file opens a database spool.db which has
# two groups “default_group” and “fem_model”group
# The default_group has six surfaces(ids 1 to 6)
# and in the total model there are six surfaces
# This implies there are no orphan surfaces.So
# we delete two surface entities and then search
# for these two orphan entities.
#
# Before running this file the database should be
# created by running the session file “spool.ses”
# To run this session file,first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The db_count_orphan_surfaces has the following arguments:
# db_count_orphans_surfaces
# ( count )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_count
INTEGER i_return_value
# -------------------------------------------------------------------
#
# opening a existing database spool.db
Main Index
928
Code Examples

uil_file_open.go(“spool.db”)

# we remove two points from the default_group


ga_group_entity_remove(“default_group”,”Surface 3:4”)

# check the database for orphan curves.

i_return_value = @
db_count_orphan_surfaces @
( i_count )
#
dump i_return_value
# the number of orphan surfaces are
dump i_count
ga_group_entity_add(“default_group”,”Surface 3:4”)

# -------------------------------------------------------------------

db_get_group_name ()

# Purpose : This file gives an example of a call to the


# function db_get_group_name()
#
# This function gives the group name with the
# specified group id.This file opens a database
# spool.db which has two groups “default group”
# and “fem_model”group.The fem_model group has
# 600 node entities and 576 element entities.
#
# Before running this session file run spool.ses
# to create spool.db
#
# To run this session file,first start
# a session of MSC.Patran,then run the session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The db_get_group_name has the following arguments:
# db_get_group_name
# ( grp_id
# name )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_grp_id
STRING s_name[32]
INTEGER i_return_value

# -------------------------------------------------------------------
# open the existing database spool.db
uil_file_open.go(“spool.db”)
# get the current group (fem_model group)
db_get_current_group_id( i_grp_id )

i_return_value = @
db_get_group_name @
( i_grp_id, @
s_name )
#
dump i_return_value
# dumps the current group i.e fem_model
dump s_name

# -------------------------------------------------------------------
Main Index
CHAPTER 6 929
Group

db_get_groups_for_entity ()

# Purpose : This file gives an example of a call to the


# function db_get_groups_for_entity()
#
# This function gives all the group ids
# having a specified entity type and id.
# This file opens a database spool.db which
# has two groups “default group” and the
# “fem_model” group.The fem_model group has
# 600 node entities and 576 element entities.
# This file finds the group ids having the node
# entity.
#
# Before running this session file run spool.ses
# to create spool.db
#
# To run this session file,first start
# a session of MSC.Patran,then run the session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The db_get_groups_for_entity has the following arguments:
# db_get_groups_for_entity
# ( id,
# type,
# count,
# group_list )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_count, i_type,i_id
INTEGER i_group_list( VIRTUAL )
INTEGER i_return_value

# -------------------------------------------------------------------
# open the existing database spool.db

uil_file_open.go(“spool.db”)

#i_id = 1
i_id = 1

#i_type = 123 (node)


i_type = 123

# get the count of the groups having a id ‘1’ and type node.
# this will be used for allocation of memory to group_list.
db_count_groups_for_entity @
( i_id, @
i_type, @
i_count )

SYS_ALLOCATE_ARRAY( i_group_list,1,i_count )

i_return_value = @
db_get_groups_for_entity @
( i_id, @
i_type, @
i_count, @
i_group_list )

dump i_return_value
# group list contains the group id having node entity and entity id 1
Main Index
930
Code Examples

# the fem_model group contains this entity and has the id =2.
dump i_group_list
SYS_FREE_ARRAY(i_group_list)

# -------------------------------------------------------------------

db_get_groups_using_mpc ()

# Purpose : This file gives an example of a call to the


# function db_get_groups_using_mpc()
#
# This function is used to get the number of
# groups using a list of ids of the MPCs(Multi
# point constraints).It also gets the ids of the
# groups for each MPC.It opens the existing
# database mpc.db
#
# Before running this session file run mpc.ses
# to create mpc.db
#
# To run this session file,first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The db_get_groups_using_mpc has the following arguments:
# db_get_groups_using_mpc
# ( nmpc,
# mpcid,
# maxgrp,
# ngroup,
# gid )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_nmpc,i_mpcid( VIRTUAL ),i_ngroup( VIRTUAL )
INTEGER i_maxgrp,i_gid( VIRTUAL )
INTEGER i_return_value

# -------------------------------------------------------------------
#
# opening a existing database mpc.db
uil_file_open.go(“mpc.db”)

# The database mpc.db has five groups and eight MPCs.


# First group and the third group has two entities ,the second has
# one entity and the fourth has three entities.
# The fifth group has the entities of group two and group four.
# The numbering of entities is serial as per the groups.

# i_nmpc = 3
# i_maxgrp = 2
# i_mpcid = [1,2,3]
# memory allocation
SYS_ALLOCATE_ARRAY(i_mpcid,1,3)
SYS_ALLOCATE_ARRAY(i_ngroup,1,3)
# array size for i_gid is i_maxgrp x i_nmpc.
SYS_ALLOCATE_ARRAY(i_gid,1,6)

i_nmpc = 3
i_maxgrp = 2
i_mpcid = [1,2,3]

i_return_value = @
Main Index
CHAPTER 6 931
Group

db_get_groups_using_mpc @
( i_nmpc, @
i_mpcid, @
i_maxgrp, @
i_ngroup, @
i_gid )
#

dump i_return_value
# the number of groups using MPC id 1,2,3.
dump i_ngroup
# The ids of the groups contaning these MPC ids.There are two spaces
# allocated for groups per MPCs.
dump i_gid
SYS_FREE_ARRAY(i_mpcid)
SYS_FREE_ARRAY(i_ngroup)
SYS_FREE_ARRAY(i_gid)

# -------------------------------------------------------------------

db_get_orphan_curves ()

# Purpose : This file gives an example of a call to the


# function db_get_orphan_curves()
#
# This function is used to get the ids of
# curve entities that do not belong to any of
# the groups.
# This file opens a database spool.db which has
# two groups “default_group” and “fem_model”group
# The default_group has three curves and in the
# total model there are thirteen curves.This
# implies there are ten orphan curves.
#
# Before running this file the database should be
# created by running the session file “spool.ses”
# To run this session file,first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The db_get_orphan_curves has the following arguments:
# db_get_orphan_curves
# ( count,
# entity_id )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_count
INTEGER i_entity_id(VIRTUAL)
INTEGER i_return_value
# -------------------------------------------------------------------
#
# opening a existing database spool.db

uil_file_open.go(“spool.db”)

# check the database for orphan curves.

i_return_value = @
db_count_orphan_curves @
( i_count )

dump i_return_value
Main Index
932
Code Examples

dump i_count

#
# allocate memory
SYS_ALLOCATE_ARRAY(i_entity_id,1,i_count)

# get the ids of the orphan curves


i_return_value = @
db_get_orphan_curves @
( i_count, @
i_entity_id )
dump i_return_value

# the ids of orphan curves are


dump i_entity_id
SYS_FREE_ARRAY(i_entity_id)

# -------------------------------------------------------------------

db_get_orphan_mpcs ()

# Purpose : This file gives an example of a call to the


# function db_get_orphan_mpcs()
#
# This function is used to get the ids of MPCs
# (Multi point constraints) entities that do not
# belong to any of the groups.This file opens a
# database mpc.db.
#
# Before running this session file run mpc.ses
# to create mpc.db
#
# To run this session file,first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The db_get_orphan_mpcs has the following arguments:
# db_get_orphan_mpcs
# ( count
# entity_id )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_count,i_grp_id
STRING s_name[32]
INTEGER i_entity_id( VIRTUAL )
INTEGER i_return_value
# -------------------------------------------------------------------
#
# opening a existing database mpc.db

uil_file_open.go(“mpc.db”)

# The database mpc.db has five groups and eight MPCs.


# First group and the third group has two entities ,the second has
# one entity and the fourth has three entities.
# The fifth group has the entities of group two and group four.

# Remove entity one and two from first group.


i_grp_id = 1
db_get_group_name( i_grp_id,s_name )
ga_group_entity_remove( s_name,”MPC 1:2” )
Main Index
CHAPTER 6 933
Group

# check the database for orphan MPCs

db_count_orphan_mpcs @
( i_count )
#
dump i_count

# Allocate memory for entity ids.


SYS_ALLOCATE_ARRAY(i_entity_id,1,i_count)

# Get the orphan MPCs

i_return_value = @
db_get_orphan_mpcs @
( i_count, @
i_entity_id )
#
dump i_return_value
# Orphan entity ids are
dump i_entity_id
ga_group_entity_add( s_name,”MPC 1:2” )
SYS_FREE_ARRAY( i_entity_id )

# -------------------------------------------------------------------

db_get_orphan_points ()

# Purpose : This file gives an example of a call to the


# function db_get_orphan_points()
#
# This function is used to get the ids of
# point entities that do not belong to any of
# the groups.
# This file opens a database spool.db which has
# two groups “default_group” and “fem_model”group
# The default_group has seven points(ids 4 to 10)
# and in the total model there are seven points
# This implies there are no orphan points.So we
# delete two point entities and then search for
# these two orphan entities and get their ids.
#
# Before running this file the database should be
# created by running the session file “spool.ses”
# To run this session file,first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The db_get_orphan_points has the following arguments:
# db_get_orphan_points
# ( count
# entity_id )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_count
INTEGER i_entity_id(VIRTUAL)
INTEGER i_return_value
# -------------------------------------------------------------------
#
# opening a existing database spool.db

uil_file_open.go(“spool.db”)
Main Index
934
Code Examples

# we remove two points from the default_group


ga_group_entity_remove(“default_group”,”Point 9:10”)

# check the database for orphan curves.


db_count_orphan_points @
( i_count )
#
# Allocate memory
SYS_ALLOCATE_ARRAY(i_entity_id,1,i_count)

i_return_value = @
db_get_orphan_points @
( i_count, @
i_entity_id )

dump i_return_value
# get the ids of the orphan points
dump i_entity_id

SYS_FREE_ARRAY(i_entity_id)
ga_group_entity_add(“default_group”,”Point 9:10”)

# -------------------------------------------------------------------

db_get_orphan_solids ()

# Purpose : This file gives an example of a call to the


# function db_get_orphan_solids()
#
# This function is used to get the ids of
# solid entities that do not belong to any of
# the groups.
# This file opens a new database “new.db”
# and creates a solid in the default group
# and then removes the entity from the group.
# we then get the ids for the orphan entities.
# If new.db is existing, delete it before running
# this session file.
#
# To run this session file,first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The db_get_orphan_solids has the following arguments:
# db_get_orphan_solids
# ( count,
# entity_id )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_count
INTEGER i_entity_id(VIRTUAL)
STRING s_created_ids[VIRTUAL]
INTEGER i_return_value
# -------------------------------------------------------------------
#open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

SYS_ALLOCATE_STRING(s_created_ids,32)

# Create a solid in this new database with id=101


asm_const_hpat_xyz(“101”,”<1 1 1>”,”[0 0 0]”,”coord 0”,s_created_ids)
Main Index
CHAPTER 6 935
Group

# Remove this entity from the group.


ga_group_entity_remove(“default_group”,”Solid 101”)

# check the database for orphan solids.


db_count_orphan_solids @
( i_count )
#
# allocate memory
SYS_ALLOCATE_ARRAY(i_entity_id,1,i_count)

# get the ids of orphan solids


i_return_value = @
db_get_orphan_solids @
( i_count, @
i_entity_id )

dump i_return_value
# the ids of orphan solids are
dump i_entity_id

SYS_FREE_STRING(s_created_ids)
SYS_FREE_ARRAY(i_entity_id)

# -------------------------------------------------------------------

db_get_orphan_surfaces ()

# Purpose : This file gives an example of a call to the


# function db_get_orphan_surfaces()
#
# This function is used to get the ids of
# surface entities that does not belong to any of
# the groups.
# This file opens a database spool.db which has
# two groups “default_group” and “fem_model”group
# The default_group has six surfaces(ids 1 to 6)
# and in the total model there are six surfaces
# This implies there are no orphan surfaces.So
# we delete two surface entities and then search
# for these two orphan entities and get their
# ids.
#
# Before running this file the database should be
# created by running the session file “spool.ses”
# To run this session file,first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The db_get_orphan_surfaces has the following arguments:
# db_get_orphan_surfaces
# ( count
# entity_id )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_count
INTEGER i_entity_id(VIRTUAL)
INTEGER i_return_value
# -------------------------------------------------------------------
#
# opening a existing database spool.db
Main Index
936
Code Examples

uil_file_open.go(“spool.db”)

# we remove two points from the default_group


ga_group_entity_remove(“default_group”,”Surface 3:4”)

# check the database for orphan surfaces.


db_count_orphan_surfaces @
( i_count )
#
# Allocate memory
SYS_ALLOCATE_ARRAY(i_entity_id,1,i_count)

i_return_value = @
db_get_orphan_surfaces @
( i_count, @
i_entity_id )

dump i_return_value
# get the ids of the orphan surfaces
dump i_entity_id

SYS_FREE_ARRAY(i_entity_id)
ga_group_entity_add(“default_group”,”Surface 3:4”)

# -------------------------------------------------------------------

ga_group_color_get ()

# Purpose : This file gives an example of a call to the


# function ga_group_color_get()
#
# This function gets the current color associated
# with the group.This file opens a database
# spool.db which has two groups “default_group”
# and “fem_model”group.This file gets the color
# associated with the fem_model group.It further
# sets the color from 0 to 15 and then gets the
# color set.The color changes can be viewed on
# the viewport.
#
# Before running this file the database should be
# created by running the session file “spool.ses”
# To run this session file, first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The ga_group_color_get has the following arguments:
# ga_group_color_get
# ( name
# color )
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_color
STRING s_name[32]
INTEGER i_return_value,i_var
# -------------------------------------------------------------------
# opening a existing database spool.db
uil_file_open.go(“spool.db”)

# post the fem_model group.


uil_viewport_post_groups.posted_groups(“default_viewport”,1, @
[“fem_model”])
Main Index
CHAPTER 6 937
Group

# s_name=fem_model
s_name = “fem_model”

# get the present color associated with the group.


i_return_value = @
ga_group_color_get @
( s_name, @
i_color )

dump i_return_value
dump i_color

coloring_method(2)

# Color is set and got for color range 0-15.


FOR (i_var = 0 TO 15 BY 1)
ga_group_color_set @
( s_name, @
i_var )
ga_group_color_get @
( s_name, @
i_color )
dump i_color
END FOR

# -------------------------------------------------------------------

ga_group_color_set ()

# Purpose : This file gives an example of a call to the


# function ga_group_color_set()
#
# This function modifies the current color
# associated with the group.This file opens a
# database spool.db which has two groups
# “default_group” and “fem_model”group.This file
# sets the color associated with the fem_model
# group.It further sets the color from 0 to 15
# and then gets the color set.The color changes
# can be viewed on the viewport.
#
# Before running this file the database should be
# created by running the session file “spool.ses”
# To run this session file, first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The ga_group_color_set has the following arguments:
# ga_group_color_set
# ( name
# color )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_color
STRING s_name[32]
INTEGER i_return_value,i_var
# -------------------------------------------------------------------
# opening the existing database spool.db
uil_file_open.go(“spool.db”)

# post the fem_model group.


uil_viewport_post_groups.posted_groups(“default_viewport”,1, @
Main Index
938
Code Examples

[“fem_model”])

# s_name=fem_model
s_name = “fem_model”
# i_color = 4
i_color = 4

# set the present color associated with the group to 4 (BLUE).


i_return_value = @
ga_group_color_set @
( s_name, @
i_color )

dump i_return_value

# Session file paused.Press “Resume” to continue.


sf_pause()

coloring_method(2)

# Color is set and got for color range 0-15.


FOR (i_var = 0 TO 15 BY 1)
ga_group_color_set @
( s_name, @
i_var )
ga_group_color_get @
( s_name, @
i_color )
dump i_color
END FOR

# -------------------------------------------------------------------

ga_group_current_get ()

# Purpose : This file gives an example of a call to the


# function ga_group_current_get()
#
# This function gets the current group.This
# file opens a database spool.db which has two
# groups “default_group” and “fem_model”group.
# This file gets the current group.It further
# sets the current group to “fem_model” group
# and then gets this group name.
#
# Before running this file the database should be
# created by running the session file “spool.ses”
# To run this session file, first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The ga_group_current_get has the following arguments:
# ga_group_current_get
# ( name )
# -------------------------------------------------------------------
# Variable Declaration
#
STRING s_name[32]
INTEGER i_return_value
# -------------------------------------------------------------------
# opening a existing database spool.db
uil_file_open.go(“spool.db”)

# get the current group.


Main Index
CHAPTER 6 939
Group

i_return_value = @
ga_group_current_get @
( s_name )

dump i_return_value
# current group name is
dump s_name

# s_name=fem_model
s_name = “fem_model”

# Set the group name to fem_model group.


ga_group_current_set @
( s_name )

# get the current group.


i_return_value = @
ga_group_current_get @
( s_name )

dump i_return_value
# current group name is
dump s_name

ga_group_current_set @
( “default_group” )

# -------------------------------------------------------------------

ga_group_deform_get ()

# Purpose : This file gives an example of two calls to the


# function ga_group_deform_get()
#
# This function gets the deform flag associated
# with the group.This file plays a session file
# ‘spool_res_deform.ses’ which displays the
# deform plot.It then gets the flag associated
# with the deform plot.Later it sets the deform
# plot flag to ‘no display’ and gets the flag.
# This change of setting to ‘no display’ can be
# seen on the viewport.
#
# Before running this session file run spool.ses
# to create ‘spool.db’.Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
#
# To run this session file, first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The ga_group_deform_get has the following arguments:
# ga_group_deform_get
# ( name,
# flag )
#
# -------------------------------------------------------------------
# Variable Declaration
#
STRING s_name[32]
INTEGER i_flag
INTEGER i_return_value
# -------------------------------------------------------------------
# Open the database “spool.db” and read the results.
Main Index
940
Code Examples

sf_play(“spool_res_deform.ses”)

coloring_method(2)
# s_name=fem_model
s_name = “fem_model”

# Get the deform flag


i_return_value = @
ga_group_deform_get @
( s_name, @
i_flag )

dump i_return_value

# Deform flag is
dump i_flag

# Session file paused. Press “Resume” to continue..


sf_pause()

# Set the deform plot for no display


ga_group_deform_set @
( s_name, @
0 )

# Get the deform flag


i_return_value = @
ga_group_deform_get @
( s_name, @
i_flag )

dump i_return_value

# Deform flag is
dump i_flag
# -------------------------------------------------------------------

ga_group_deform_set ()

# Purpose : This file gives an example of a call to the


# function ga_group_deform_set()
#
# This function sets the deform flag associated
# with the group.This file plays a session file
# ‘spool_res_deform.ses’ which displays the
# deform plot.It then gets the flag associated
# with the deform plot.Later it sets the deform
# plot flag to ‘no display’ and gets the flag.
# This change of setting to ‘no display’ can be
# seen on the viewport.
#
# Before running this session file run spool.ses
# to create ‘spool.db’.Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
#
# created by running the session file “spool.ses”
# To run this session file, first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The ga_group_deform_set has the following arguments:
# ga_group_deform_set
# ( name,
# flag )
Main Index
CHAPTER 6 941
Group

#
# -------------------------------------------------------------------
# Variable Declaration
#
STRING s_name[32]
INTEGER i_flag,i_flag_c
INTEGER i_return_value
# -------------------------------------------------------------------
# Open the database “spool.db”
#uil_file_open.go(“spool.db”)
sf_play(“spool_res_deform.ses”)

coloring_method(2)
# s_name=fem_model
s_name = “fem_model”

# Get the deform flag


ga_group_deform_get @
( s_name, @
i_flag_c )

# Check the deform flag


dump i_flag_c

# Session file paused. Press “Resume” to continue..


sf_pause()

# Set the deform plot for no display


# i_flag = 0
i_flag = 0
i_return_value = @
ga_group_deform_set @
( s_name, @
i_flag )

dump i_return_value

# Get the deform flag


ga_group_deform_get @
( s_name, @
i_flag_c )

# Check the deform flag


dump i_flag_c
# -------------------------------------------------------------------

ga_group_display_get ()

# Purpose : This file gives an example of a call to the


# function ga_group_display_get()
#
# This function gets the display property list
# associated with the group.Two default sets are
# provided “general” and “simple”.By switching
# between these two, we can control the amount
# of display clutter.This file opens a database
# spool.db which has two groups “default_group”
# and “fem_model”group.This file gets the display
# name associated with the fem_model group.It
# then sets the display name to “simple”and gets
# the current display name.The change in the
# display can be viewed on the viewport.
#
# Before running this file the database should be
# created by running the session file “spool.ses”
Main Index
942
Code Examples

# To run this session file, first start


# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The ga_group_display_get has the following arguments:
# ga_group_display_get
# ( name,
# dname )
# -------------------------------------------------------------------
# Variable Declaration
#
STRING s_name[32],s_dname[32],s_dname_c[32]
INTEGER i_return_value
# -------------------------------------------------------------------
# opening a existing database spool.db
uil_file_open.go(“spool.db”)

# post the fem_model group.


uil_viewport_post_groups.posted_groups(“default_viewport”,1, @
[“fem_model”])

# s_name=fem_model
s_name = “fem_model”

# get the present display name associated with the group.


i_return_value = @
ga_group_display_get @
( s_name, @
s_dname_c )

dump i_return_value
dump s_dname_c

coloring_method(2)

# Change the display to “simple”.


# s_dname = simple
s_dname = “simple”

ga_group_display_set @
( s_name, @
s_dname )

# Session file paused.Press “Resume” to continue.


sf_pause()

# get the present display name associated with the group.


i_return_value = @
ga_group_display_get @
( s_name, @
s_dname_c )

dump i_return_value
dump s_dname_c

# Rechange the display to “general”.


# s_dname = general
s_dname = “general”

ga_group_display_set @
( s_name, @
s_dname )

# -------------------------------------------------------------------

Main Index
CHAPTER 6 943
Group

ga_group_elem_scalar_get ()

# Purpose : This file provides an example of a call to the


# function ga_group_elem_scalar_get()
#
# This function is used to get a scalar element
# table associated with the group.This file opens
# a database spool.db which has two groups
# “default_group “and “fem_model”group.The
# fem_model group has 600 node entities and 576
# element entities. In this file the function
# ga_elem_scalar_create() is used to create the
# element scalar table.Later the scalar id of
# this table is got using the example function.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_group_elem_scalar_get()
# has the following arguments:
#
# ga_group_elem_scalar_get
# ( name,
# scalar_id )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_title[64], s_cur_group[256],s_name[32]
INTEGER i_nbr_elems
INTEGER i_elem_ids(VIRTUAL)
INTEGER i_nbr_values(VIRTUAL)
INTEGER i_max_vals
REAL r_scalars(VIRTUAL)
INTEGER i_id, i_cur_group_id,i_scalar_id
INTEGER i_index,i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# s_name = “fem_model”
s_name = “fem_model”

ga_group_current_set(“fem_model”)

db_get_current_group_id(i_cur_group_id)

# Get the number of elements in the current group


db_count_elems_in_group(i_cur_group_id,i_nbr_elems)

# Allocate memory to virtual arrays


SYS_ALLOCATE_ARRAY(i_elem_ids,1,i_nbr_elems)
SYS_ALLOCATE_ARRAY(i_nbr_values,1,i_nbr_elems)
SYS_ALLOCATE_ARRAY(r_scalars,1,i_nbr_elems,1,1)

# Get the IDs of the elements in the current group


db_get_elem_ids_in_group(i_nbr_elems,i_cur_group_id,i_elem_ids)

# Create a scalar table


s_title = “A Scalar Table”
i_max_vals = 1
Main Index
944
Code Examples

FOR (i_index=1 TO i_nbr_elems)


i_nbr_values(i_index) = i_max_vals
r_scalars(i_index,1) = i_index * i_index
END FOR

ga_elem_scalar_create @
( s_title, @
i_nbr_elems, @
i_elem_ids, @
i_nbr_values, @
i_max_vals, @
r_scalars, @
i_id )

# The id of the element scalar table is


dump i_id

# Set this scalar table to be associated with the group.


ga_group_elem_scalar_set @
( s_name, @
i_id)

i_return_value = @
ga_group_elem_scalar_get @
( s_name, @
i_scalar_id )

dump i_return_value
# The Id of the scalar table got using the function
dump i_scalar_id

# Release the memory


SYS_FREE_ARRAY(i_elem_ids)
SYS_FREE_ARRAY(i_nbr_values)
SYS_FREE_ARRAY(r_scalars)

ga_elem_scalar_delete( i_id )
#---------------------------------------------------------------------

ga_group_elem_scalar_set ()

# Purpose : This file provides an example of a call to the


# function ga_group_elem_scalar_set()
#
# This function is used to get a scalar element
# table associated with the group.This file opens
# a database spool.db which has two groups
# “default_group “and “fem_model”group.The
# fem_model group has 600 node entities and 576
# element entities. In this file the function
# ga_elem_scalar_create() is used to create the
# element scalar table.Later the scalar id of the
# table is associated with the fem_model group
# using the example function.Then the function
# ga_group_elem_scalar_get() gets the set scalar
# id
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
Main Index
CHAPTER 6 945
Group

# The function ga_group_elem_scalar_set()


# has the following arguments:
#
# ga_group_elem_scalar_set
# ( name,
# scalar_id )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_title[64], s_cur_group[256],s_name[32]
INTEGER i_nbr_elems
INTEGER i_elem_ids(VIRTUAL)
INTEGER i_nbr_values(VIRTUAL)
INTEGER i_max_vals
REAL r_scalars(VIRTUAL)
INTEGER i_id, i_cur_group_id,i_scalar_id,i_scalar_id_c
INTEGER i_index,i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# s_name = “fem_model”
s_name = “fem_model”

ga_group_current_set(“fem_model”)

db_get_current_group_id(i_cur_group_id)

# Get the number of elements in the current group


db_count_elems_in_group(i_cur_group_id,i_nbr_elems)

# Allocate memory to virtual arrays


SYS_ALLOCATE_ARRAY(i_elem_ids,1,i_nbr_elems)
SYS_ALLOCATE_ARRAY(i_nbr_values,1,i_nbr_elems)
SYS_ALLOCATE_ARRAY(r_scalars,1,i_nbr_elems,1,1)

# Get the IDs of the elements in the current group


db_get_elem_ids_in_group(i_nbr_elems,i_cur_group_id,i_elem_ids)

# Create a scalar table


s_title = “A Scalar Table”
i_max_vals = 1
FOR (i_index=1 TO i_nbr_elems)
i_nbr_values(i_index) = i_max_vals
r_scalars(i_index,1) = i_index * i_index
END FOR

ga_elem_scalar_create @
( s_title, @
i_nbr_elems, @
i_elem_ids, @
i_nbr_values, @
i_max_vals, @
r_scalars, @
i_id )

# The id of the element scalar table is


dump i_id

# Set this scalar table to be associated with the group.


i_scalar_id = i_id
i_return_value = @
ga_group_elem_scalar_set @
( s_name, @
i_scalar_id )

dump i_return_value
Main Index
946
Code Examples

# Get the element scalar table id


ga_group_elem_scalar_get @
( s_name, @
i_scalar_id_c)

# The Id of the scalar table


dump i_scalar_id_c

# Release the memory


SYS_FREE_ARRAY(i_elem_ids)
SYS_FREE_ARRAY(i_nbr_values)
SYS_FREE_ARRAY(r_scalars)

ga_elem_scalar_delete( i_id )
#---------------------------------------------------------------------

ga_group_entities_get ()

#
# Purpose : This file gives an example of a call to the
# function ga_group_entities_get()
#
# This function gets the sorted list of entities
# contained in a group.This file opens a database
# spool.db which has two groups “default_group”
# and “fem_model”group.The database has 600 node
# entities.This file gets the sorted list of
# nodes from 101 to 120.Then we remove entity 105
# and 111 and get the sorted list of the node
# entity.
#
# Before running this file the database should be
# created by running the session file “spool.ses”
# To run this session file, first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The ga_group_entities_get has the following arguments:
# ga_group_entities_get
# ( name,
# type,
# range,
# number,
# entities )
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_type,i_number,i_range(3)
STRING s_name[32],s_entities[VIRTUAL]
INTEGER i_return_value
# -------------------------------------------------------------------
# opening the existing database spool.db
uil_file_open.go(“spool.db”)

# s_name=fem_model
s_name = “fem_model”

# i_type =123 (For NODE from file dbtypes.h)


i_type = 123

# i_number = 600 (total of 600 node entities)


i_number = 600
Main Index
CHAPTER 6 947
Group

# i_range = [ 101,120,128 ] (node 101 to 120 )


i_range = [ 101,120,128 ]

# get the sorted list of node entity associated with the group.
i_return_value = @
ga_group_entities_get @
( s_name, @
i_type, @
i_range, @
i_number, @
s_entities )

dump i_return_value
dump s_entities

# Remove entity 105 and 111 from the group fem_model.


ga_group_entity_remove(“fem_model”,”node 105”)
ga_group_entity_remove(“fem_model”,”node 111”)

# get the sorted list of node entity associated with the group.
i_return_value = @
ga_group_entities_get @
( s_name, @
i_type, @
i_range, @
i_number, @
s_entities )

dump i_return_value
dump s_entities

# add entity 105 and 111 to the group fem_model.


ga_group_entity_add(“fem_model”,”node 105”)
ga_group_entity_add(“fem_model”,”node 111”)

SYS_FREE_STRING( s_entities )
# -------------------------------------------------------------------

ga_group_exist_get ()

# Purpose : This file gives an example of a call to the


# function ga_group_exist_get()
#
# This function determines if the group with
# specified name exists.This file opens a
# database spool.db which has two groups
# “default_group”and “fem_model”group.This file
# gets the existence flag for fem_model group.
# It then gets the existence flag for an non-
# existent group.
#
# Before running this file the database should be
# created by running the session file “spool.ses”
# To run this session file, first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The ga_group_exist_get has the following arguments:
# ga_group_exist_get
# ( name
# flag )
# -------------------------------------------------------------------
# Variable Declaration
#
Main Index
948
Code Examples

INTEGER i_flag
STRING s_name[32]
INTEGER i_return_value
# -------------------------------------------------------------------
# opening the existing database spool.db
uil_file_open.go(“spool.db”)

# s_name=fem_model
s_name = “fem_model”

# get the existence flag for the group fem_model.


i_return_value = @
ga_group_exist_get @
( s_name, @
i_flag )

dump i_return_value
dump i_flag

# s_name=non_existing_group
s_name = “non_existing_group”

# get the existence flag for non existing group .


i_return_value = @
ga_group_exist_get @
( s_name, @
i_flag )

dump i_return_value
dump i_flag

# -------------------------------------------------------------------

ga_group_groups_get ()

# Purpose : This file gives an example of a call to the


# function ga_group_groups_get()
#
# This function gets the list of all the groups.
# This file opens a database spool.db which has
# two groups “default_group”and “fem_model”group.
# This file gets the list of all the groups in
# the database “spool.db”.
#
# Before running this file the database should be
# created by running the session file “spool.ses”
# To run this session file, first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The ga_group_groups_get has the following arguments:
# ga_group_groups_get
# ( group_list )
# -------------------------------------------------------------------
# Variable Declaration
#
STRING s_group_list[32](4)
INTEGER i_return_value
# -------------------------------------------------------------------
# opening the existing database spool.db
uil_file_open.go(“spool.db”)

i_return_value = @
ga_group_groups_get @
Main Index
CHAPTER 6 949
Group

( s_group_list )

dump i_return_value

# The groups in the opened database are


dump s_group_list

# -------------------------------------------------------------------

ga_group_label_get ()

# Purpose : This file gives an example of a call to the


# function ga_group_label_get()
#
# This function gets the current label flag
# associated with the group.This file opens a
# database spool.db which has two groups
# “default_group” and “fem_model”group.This file
# displays the labeled plot and gets the flag
# associated with the labeled plot for the
# default group.Later it sets the current
# label flag to ‘no display’ and gets the flag.
# This change of setting to ‘no display’ can be
# seen on the viewport.
#
# Before running this file the database should be
# created by running the session file “spool.ses”
# To run this session file, first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The ga_group_label_get has the following arguments:
# ga_group_label_get
# ( name,
# flag )
# -------------------------------------------------------------------
# Variable Declaration
#
STRING s_name[32]
INTEGER i_flag
INTEGER i_return_value
# -------------------------------------------------------------------
# opening the existing database spool.db
uil_file_open.go(“spool.db”)

uil_viewport_post_groups.posted_groups(“default_viewport”,1, @
[“default_group”])
coloring_method(2)

# s_name = default_group
s_name = “default_group”

ga_group_label_set(s_name,1)

# get the label flag


i_return_value = @
ga_group_label_get @
( s_name, @
i_flag )

dump i_return_value
# Label flag is
dump i_flag
Main Index
950
Code Examples

# Session file paused.Press “Resume” to continue.


sf_pause()

# Set the label flag for no display


ga_group_label_set(s_name,0)

# get the label flag


i_return_value = @
ga_group_label_get @
( s_name, @
i_flag )

dump i_return_value
# Label flag is
dump i_flag

# -------------------------------------------------------------------

ga_group_label_set ()

# Purpose : This file gives an example of a call to the


# function ga_group_label_set()
#
# This function sets the label flag associated
# with the group to get whether labels to be
# displayed.This file opens a database spool.db
# which has two groups “default_group” and
# “fem_model”group.This file displays the labeled
# plot and gets the flag associated with the
# labeled plot for the default group.Later it
# sets the current label flag to ‘no display’ and
# gets the flag.This change of setting to
# ‘no display’ can be seen on the viewport.
#
# Before running this file the database should be
# created by running the session file “spool.ses”
# To run this session file, first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The ga_group_label_set has the following arguments:
# ga_group_label_set
# ( name,
# flag )
# -------------------------------------------------------------------
# Variable Declaration
#
STRING s_name[32]
INTEGER i_flag,i_flag_c
INTEGER i_return_value
# -------------------------------------------------------------------
# opening the existing database spool.db
uil_file_open.go(“spool.db”)

uil_viewport_post_groups.posted_groups(“default_viewport”,1, @
[“default_group”])
coloring_method(2)

# s_name = default_group
s_name = “default_group”

# Set the label flag for display of labels.


# i_flag = 1
i_flag = 1
Main Index
CHAPTER 6 951
Group

i_return_value = @
ga_group_label_set @
( s_name, @
i_flag )
dump i_return_value

# get the label flag


ga_group_label_get @
( s_name, @
i_flag_c )

# Label flag is
dump i_flag_c

# Session file paused.Press “Resume” to continue.


sf_pause()

# Set the label flag for no display


# i_flag = 0
i_flag = 0

i_return_value = @
ga_group_label_set @
( s_name, @
i_flag )
dump i_return_value

# get the label flag


ga_group_label_get @
( s_name, @
i_flag_c )

# Label flag is
dump i_flag_c

# -------------------------------------------------------------------

ga_group_load_vector_get ()

# Purpose : This file provides an example of a call to the


# function ga_group_load_vector_get()
#
# This function is used to get the load vector
# table associated with a group.This file opens
# the database “spool.db” and a load vector table
# is created.This table is then associated with
# the group “fem_model” and later the id of the
# vector table associated with the group is got
# using above function.
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_group_load_vector_get()
# has the following arguments:
#
# ga_group_load_vector_get
# ( name,
# vector_id )
Main Index
952
Code Examples

#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_title[32],s_name[32]
INTEGER i_comp_vect_flag,i_sym_flag,i_nvectors
INTEGER ia_vect_ent_types(1), ia_vect_ent_ids(1)
REAL ra_vect_locs(1),ra_normals(1)
INTEGER ia_anchor_styles(1),ia_vect_types(1)
INTEGER ia_vect_colors(1), ia_sub_ids(1)
INTEGER i_vector_id, i_vector_id_old, i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Create a vector table


s_title = “Load Vector Table”
i_comp_vect_flag = 0
i_sym_flag = 0
i_nvectors = 1
ia_vect_ent_types(1) = 123 /* from dbtypes.h */
ia_vect_ent_ids(1) = 10
ia_vect_types(1) = 1
ia_anchor_styles(1) = 1
ia_vect_colors(1) = 0
ia_sub_ids(1) = 0
ra_normals(1) = 150.0

ga_vector_create @
( s_title, @
i_comp_vect_flag, @
i_sym_flag, @
i_nvectors, @
ia_vect_ent_types, @
ia_vect_ent_ids, @
ra_vect_locs, @
ra_normals, @
ia_vect_types, @
ia_anchor_styles, @
ia_vect_colors, @
ia_sub_ids, @
i_vector_id_old )

dump i_vector_id_old

# Associate the vector table with the group “fem_model”


# s_name = “fem_model”
s_name = “fem_model”
ga_group_load_vector_set @
( s_name, @
i_vector_id_old )

i_return_value = @
ga_group_load_vector_get @
( s_name, @
i_vector_id )

dump i_return_value
dump i_vector_id

ga_vector_delete @
( i_vector_id_old )
#---------------------------------------------------------------------

Main Index
CHAPTER 6 953
Group

ga_group_load_vector_set ()

# Purpose : This file provides an example of a call to the


# function ga_group_load_vector_set()
#
# This function is used to set the load vector
# table associated with a group.This file opens
# the database “spool.db” and a load vector table
# is created.This table is then associated with
# the group “fem_model” and later the id of the
# vector table associated with the group is got
# using function ga_group_load_vector_get().
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_group_load_vector_set()
# has the following arguments:
#
# ga_group_load_vector_set
# ( name,
# vector_id )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_title[32],s_name[32]
INTEGER i_comp_vect_flag,i_sym_flag,i_nvectors
INTEGER ia_vect_ent_types(1), ia_vect_ent_ids(1)
REAL ra_vect_locs(1),ra_normals(1)
INTEGER ia_anchor_styles(1),ia_vect_types(1)
INTEGER ia_vect_colors(1), ia_sub_ids(1)
INTEGER i_vector_id, i_vector_id_c, i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Create a vector table


s_title = “Load Vector Table”
i_comp_vect_flag = 0
i_sym_flag = 0
i_nvectors = 1
ia_vect_ent_types(1) = 123 /* from dbtypes.h */
ia_vect_ent_ids(1) = 10
ia_vect_types(1) = 1
ia_anchor_styles(1) = 1
ia_vect_colors(1) = 0
ia_sub_ids(1) = 0
ra_normals(1) = 150.0

ga_vector_create @
( s_title, @
i_comp_vect_flag, @
i_sym_flag, @
i_nvectors, @
ia_vect_ent_types, @
ia_vect_ent_ids, @
ra_vect_locs, @
ra_normals, @
ia_vect_types, @
Main Index
954
Code Examples

ia_anchor_styles, @
ia_vect_colors, @
ia_sub_ids, @
i_vector_id )

dump i_vector_id

# Associate the vector table with the group “fem_model”


# s_name = “fem_model”
s_name = “fem_model”
i_return_value = @
ga_group_load_vector_set @
( s_name, @
i_vector_id )

dump i_return_value

ga_group_load_vector_get @
( s_name, @
i_vector_id_c )

dump i_vector_id_c

ga_vector_delete @
( i_vector_id )
#---------------------------------------------------------------------

ga_group_load_vector_set ()

# Purpose : This file provides an example of a call to the


# function ga_group_load_vector_set()
#
# This function is used to set the load vector
# table associated with a group.This file opens
# the database “spool.db” and a load vector table
# is created.This table is then associated with
# the group “fem_model” and later the id of the
# vector table associated with the group is got
# using function ga_group_load_vector_get().
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_group_load_vector_set()
# has the following arguments:
#
# ga_group_load_vector_set
# ( name,
# vector_id )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_title[32],s_name[32]
INTEGER i_comp_vect_flag,i_sym_flag,i_nvectors
INTEGER ia_vect_ent_types(1), ia_vect_ent_ids(1)
REAL ra_vect_locs(1),ra_normals(1)
INTEGER ia_anchor_styles(1),ia_vect_types(1)
INTEGER ia_vect_colors(1), ia_sub_ids(1)
INTEGER i_vector_id, i_vector_id_c, i_return_value
Main Index
CHAPTER 6 955
Group

#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Create a vector table


s_title = “Load Vector Table”
i_comp_vect_flag = 0
i_sym_flag = 0
i_nvectors = 1

# from dbtypes.h
ia_vect_ent_types(1) = 123

ia_vect_ent_ids(1) = 10
ia_vect_types(1) = 1
ia_anchor_styles(1) = 1
ia_vect_colors(1) = 0
ia_sub_ids(1) = 0
ra_normals(1) = 150.0

i_return_value = ga_vector_create @
( s_title, @
i_comp_vect_flag, @
i_sym_flag, @
i_nvectors, @
ia_vect_ent_types, @
ia_vect_ent_ids, @
ra_vect_locs, @
ra_normals, @
ia_vect_types, @
ia_anchor_styles, @
ia_vect_colors, @
ia_sub_ids, @
i_vector_id )

dump i_return_value
dump i_vector_id

# Associate the vector table with the group “fem_model”


s_name = “fem_model”
i_return_value = @
ga_group_load_vector_set @
( s_name, @
i_vector_id )

dump i_return_value

i_return_value = ga_group_load_vector_get @
( s_name, @
i_vector_id_c )

dump i_return_value
dump i_vector_id_c

#---------------------------------------------------------------------

Main Index
956
Code Examples

ga_group_load_vector_set ()

# Purpose : This file provides an example of a call to the


# function ga_group_load_vector_set()
#
# This function is used to set the load vector
# table associated with a group.This file opens
# the database “spool.db” and a load vector table
# is created.This table is then associated with
# the group “fem_model” and later the id of the
# vector table associated with the group is got
# using function ga_group_load_vector_get().
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_group_load_vector_set()
# has the following arguments:
#
# ga_group_load_vector_set
# ( name,
# vector_id )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_title[32],s_name[32]
INTEGER i_comp_vect_flag,i_sym_flag,i_nvectors
INTEGER ia_vect_ent_types(1), ia_vect_ent_ids(1)
REAL ra_vect_locs(1),ra_normals(1)
INTEGER ia_anchor_styles(1),ia_vect_types(1)
INTEGER ia_vect_colors(1), ia_sub_ids(1)
INTEGER i_vector_id, i_vector_id_c, i_return_value
INTEGER i_vector_id_b
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Create a vector table


s_title = “Load Vector Table”
i_comp_vect_flag = 0
i_sym_flag = 0
i_nvectors = 1

# from dbtypes.h
ia_vect_ent_types(1) = 123

ia_vect_ent_ids(1) = 10
ia_vect_types(1) = 1
ia_anchor_styles(1) = 1
ia_vect_colors(1) = 0
ia_sub_ids(1) = 0
ra_normals(1) = 150.0

i_return_value = ga_vector_create @
( s_title, @
i_comp_vect_flag, @
i_sym_flag, @
Main Index
CHAPTER 6 957
Group

i_nvectors, @
ia_vect_ent_types, @
ia_vect_ent_ids, @
ra_vect_locs, @
ra_normals, @
ia_vect_types, @
ia_anchor_styles, @
ia_vect_colors, @
ia_sub_ids, @
i_vector_id )

dump i_return_value
dump i_vector_id

# Create a second vector table, changing


# only the name.
s_title = “Vector Table II”

i_return_value = ga_vector_create @
( s_title, @
i_comp_vect_flag, @
i_sym_flag, @
i_nvectors, @
ia_vect_ent_types, @
ia_vect_ent_ids, @
ra_vect_locs, @
ra_normals, @
ia_vect_types, @
ia_anchor_styles, @
ia_vect_colors, @
ia_sub_ids, @
i_vector_id_b )

dump i_return_value
dump i_vector_id_b

# Associate the first vector table with the


# group “fem_model”

s_name = “fem_model”

i_return_value = @
ga_group_load_vector_set @
( s_name, @
i_vector_id )

dump i_return_value

# Delete the original vector table associated


# with the group.
dump i_vector_id
IF ( (i_return_value == 0) && (i_vector_id > 1) ) THEN

i_return_value = ga_vector_delete @
( (i_vector_id - 1) )

dump i_return_value

END IF

# Associate the second vector table with the


# group “fem_model”

s_name = “fem_model”

i_return_value = @
Main Index
958
Code Examples

ga_group_load_vector_set @
( s_name, @
i_vector_id_b )

dump i_return_value

# Delete the first created vector table which is


# no longer associated with the group.
dump i_vector_id_b
IF ( (i_return_value == 0) && (i_vector_id_b > 1) ) THEN

i_return_value = ga_vector_delete @
( (i_vector_id_b - 1) )

dump i_return_value

END IF

i_return_value = ga_group_load_vector_get @
( s_name, @
i_vector_id_c )

dump i_return_value
dump i_vector_id_c

#---------------------------------------------------------------------

ga_group_nentities_get ()

# Purpose : This file gives an example of a call to the


# function ga_group_nentities_get()
#
# This function gets the number of entities of a
# particular type contained in a specific group.
# This file opens a database spool.db which has
# two groups “default_group”and “fem_model”group.
# The fem_model group has 600 node entities and
# 576 element entities.This file gets the no of
# entities of a type node in the fem_model group.
#
# Before running this file the database should be
# created by running the session file “spool.ses”
# To run this session file, first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The ga_group_nentities_get has the following arguments:
# ga_group_nentities_get
# ( name,
# type,
# number )
# -------------------------------------------------------------------
# Variable Declaration
#
STRING s_name[32]
INTEGER i_type,i_number
INTEGER i_return_value
# -------------------------------------------------------------------
# opening the existing database spool.db
uil_file_open.go(“spool.db”)

# s_name = “fem_model”
s_name = “fem_model”
Main Index
CHAPTER 6 959
Group

# i_type = 123 (For entity node from dbtypes.h)


i_type = 123

i_return_value = @
ga_group_nentities_get @
( s_name, @
i_type, @
i_number )

dump i_return_value
# The number of node entities in group fem_model are
dump i_number

# -------------------------------------------------------------------

ga_group_node_deform_set ()

# Purpose : This file provides an example of a call to the


# function ga_group_node_deform_set()
#
# This function changes the current deform table
# associated with a group.This file opens the
# database “spool.ses” and creates a node deform
# table and associates this table with the
# fem_model group.
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
#
# The function ga_group_node_deform_set()
# has the following arguments:
#
# ga_group_node_deform_set
# ( name,
# deform_id )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_title[80]
INTEGER i_nbr_nodes
INTEGER i_ncases, iv_lcids(VIRTUAL),iv_nsub(VIRTUAL)
INTEGER iv_node_ids(VIRTUAL)
REAL rv_deform(VIRTUAL)
INTEGER i_dtype,ia_minloc(6),ia_maxloc(6), ia_resids(5)
INTEGER i_deform_id
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db” and read the deformation results
sf_play(“spool_res_deform.ses”)

# Get the number of Load cases and their IDs


res_utl_get_loadcases(i_ncases,iv_lcids,iv_nsub)

# Extract the deformation results from the database


# Load case ID = iv_lcids(1)
# Sub case ID = 1
# Primary Result ID = 2 ( Corresponds to deformation )
Main Index
960
Code Examples

# Secondary Result ID = 1
# Layer ID = 1
# node_list = “Node 1:#” (All nodes )
# derivation = ““
# coord_id = ““
ia_resids(1) = iv_lcids(1)
ia_resids(2) = 1
ia_resids(3) = 2
ia_resids(4) = 1
ia_resids(5) = 1
res_utl_extract_nodal_results(ia_resids,” Node 1:#”,””,””, @
i_dtype,i_nbr_nodes,iv_node_ids,rv_deform,ia_minloc,ia_maxloc)

# Create a node deformation table


s_title =” Deformation Result”
ga_node_deform_create @
( s_title, @
i_nbr_nodes, @
iv_node_ids, @
rv_deform, @
i_deform_id )

dump i_return_value
dump i_deform_id

# Associate this deform table with the fem_model group.


i_return_value = @
ga_group_node_deform_set @
( “fem_model”, @
i_deform_id )

dump i_return_value

sys_free_array(iv_node_ids)
sys_free_array(rv_deform)
sys_free_array(iv_lcids)
sys_free_array(iv_nsub)
#---------------------------------------------------------------------

ga_group_node_deform_set ()

# Purpose : This file provides an example of a call to the


# function ga_group_node_deform_set()
#
# This function changes the current deform table
# associated with a group.This file opens the
# database “spool.ses” and creates a node deform
# table and associates this table with the
# fem_model group.
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
#
# The function ga_group_node_deform_set()
# has the following arguments:
#
# ga_group_node_deform_set
# ( name,
Main Index
CHAPTER 6 961
Group

# deform_id )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_title[80]
INTEGER i_nbr_nodes
INTEGER i_ncases, iv_lcids(VIRTUAL),iv_nsub(VIRTUAL)
INTEGER iv_node_ids(VIRTUAL)
REAL rv_deform(VIRTUAL)
INTEGER i_dtype,ia_minloc(6),ia_maxloc(6), ia_resids(5)
INTEGER i_deform_id
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db” and read the deformation results
sf_play(“spool_res_deform.ses”)

# Get the number of Load cases and their IDs


i_return_value = res_utl_get_loadcases(i_ncases,iv_lcids,iv_nsub)

dump i_return_value

# Extract the deformation results from the database


# Load case ID = iv_lcids(1)
# Sub case ID = 1
# Primary Result ID = 2 ( Corresponds to deformation )
# Secondary Result ID = 1
# Layer ID = 1
# node_list = “Node 1:#” (All nodes )
# derivation = ““
# coord_id = ““
ia_resids(1) = iv_lcids(1)
ia_resids(2) = 1
ia_resids(3) = 2
ia_resids(4) = 1
ia_resids(5) = 1

i_return_value = res_utl_extract_nodal_results @
(ia_resids,” Node 1:#”,””,””, @
i_dtype,i_nbr_nodes,iv_node_ids,rv_deform, @
ia_minloc,ia_maxloc)

dump i_return_value

# Create a node deformation table


s_title =” Deformation Result”
i_return_value = ga_node_deform_create @
( s_title, @
i_nbr_nodes, @
iv_node_ids, @
rv_deform, @
i_deform_id )

dump i_return_value
dump i_deform_id

# Associate this deform table with the fem_model group.


i_return_value = @
ga_group_node_deform_set @
( “fem_model”, @
i_deform_id )

dump i_return_value

sys_free_array(iv_node_ids)
sys_free_array(rv_deform)
sys_free_array(iv_lcids)
sys_free_array(iv_nsub)
#---------------------------------------------------------------------
Main Index
962
Code Examples

ga_group_precision_get ()

# Purpose : This file gives an example of a call to the


# function ga_group_precision_get()
#
# This function gets the current precision flag
# associated with the group.This file opens a
# database spool.db which has two groups
# “default_group” and “fem_model”group.This file
# displays the precision plot and gets the flag
# associated with the precision plot for the
# default group.Later it sets the current
# precision flag to ‘no precision’ and gets the
# flag.This function is used along with the style
# of plot.e.g. shaded/smooth uses high precision
# (1) and shaded/flat uses fast(0).
#
# Before running this file the database should be
# created by running the session file “spool.ses”
# To run this session file, first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The ga_group_precision_get has the following arguments:
# ga_group_precision_get
# ( name,
# flag )
# -------------------------------------------------------------------
# Variable Declaration
#
STRING s_name[32]
INTEGER i_flag
INTEGER i_return_value
# -------------------------------------------------------------------
# opening the existing database spool.db
uil_file_open.go(“spool.db”)

uil_viewport_post_groups.posted_groups(“default_viewport”,1, @
[“default_group”])
coloring_method(2)

# s_name = default_group
s_name = “default_group”

ga_group_style_set(s_name,”SHADED”)

# The change of precision will show the change in the viewport.


ga_group_precision_set(s_name,1)

# get the precision flag


i_return_value = @
ga_group_precision_get @
( s_name, @
i_flag )

dump i_return_value
# Precision flag is
dump i_flag

# Session file paused.Press “Resume” to continue.


sf_pause()

# Set the precision flag for no display


ga_group_precision_set(s_name,0)
Main Index
CHAPTER 6 963
Group

# get the precision flag


i_return_value = @
ga_group_precision_get @
( s_name, @
i_flag )

dump i_return_value

# Precision flag is
dump i_flag

ga_group_style_set(s_name,”WIREFRAME”)

# -------------------------------------------------------------------

ga_group_result_vector_get ()

# Purpose : This file provides an example of a call to the


# function ga_group_result_vector_get()
#
# This function is used to set the load vector
# table associated with a group.This file opens
# the database “spool.db” and deformation results
# are read from the database and a table is
# created.This table is then associated with the
# group “fem_model” and later the id of the
# vector table associated with the group is got
# using above function.
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_group_result_vector_get()
# has the following arguments:
#
# ga_group_result_vector_get
# ( name,
# vector_id )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_title[32],s_name[32]
INTEGER i_ncases, i_nbr_nodes, i_index
INTEGER iv_lcids(VIRTUAL),iv_nsub(VIRTUAL), iv_node_ids(VIRTUAL)
REAL rv_deform(VIRTUAL)
INTEGER i_dtype,ia_minloc(6),ia_maxloc(6), ia_resids(5)
INTEGER i_comp_vect_flag,i_sym_flag,i_nvectors
INTEGER iv_vect_ent_types(VIRTUAL), iv_vect_ent_ids(VIRTUAL)
REAL rv_vect_locs(VIRTUAL)
INTEGER iv_vect_types(VIRTUAL), iv_anchor_styles(VIRTUAL)
INTEGER iv_vect_colors(VIRTUAL), iv_sub_ids(VIRTUAL)
INTEGER i_vector_id_old, i_vector_id,i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)

# Get the number of Load cases and their IDs


res_utl_get_loadcases(i_ncases,iv_lcids,iv_nsub)
Main Index
964
Code Examples

# Extract the stress results from the database


# Load case ID = iv_lcids(1)
# Sub case ID = 1
# Primary Result ID = 2 ( Corresponds to deformation )
# Secondary Result ID = 1
# Layer ID = 1
# node_list = “Node 1:#” (All nodes )
# derivation = ““
# coord_id = ““
ia_resids(1) = iv_lcids(1)
ia_resids(2) = 1
ia_resids(3) = 3
ia_resids(4) = 1
ia_resids(5) = 2
res_utl_extract_nodal_results(ia_resids,” Node 1:#”,””,””, @
i_dtype,i_nbr_nodes,iv_node_ids,rv_deform,ia_minloc,ia_maxloc)

# Create a vector table


s_title = “Vector Table”
i_comp_vect_flag = 0
i_sym_flag = 0
i_nvectors = i_nbr_nodes

sys_allocate_array(iv_vect_ent_types,1,i_nvectors)
sys_allocate_array(iv_vect_ent_ids,1,i_nvectors)
sys_allocate_array(rv_vect_locs,1,i_nvectors,1,3)
sys_allocate_array(iv_vect_types,1,i_nvectors)
sys_allocate_array(iv_anchor_styles,1,i_nvectors)
sys_allocate_array(iv_vect_colors,1,i_nvectors)
sys_allocate_array(iv_sub_ids,1,i_nvectors)

FOR(i_index = 1 TO i_nvectors)
iv_vect_ent_types(i_index) = 123 /* from dbtypes.h */
iv_vect_ent_ids(i_index) = iv_node_ids(i_index)
iv_vect_types(i_index) = 1
iv_anchor_styles(i_index) = 1
iv_vect_colors(i_index) = 0
iv_sub_ids(i_index) = 0
END FOR

ga_vector_create @
( s_title, @
i_comp_vect_flag, @
i_sym_flag, @
i_nvectors, @
iv_vect_ent_types, @
iv_vect_ent_ids, @
rv_vect_locs, @
rv_deform, @
iv_vect_types, @
iv_anchor_styles, @
iv_vect_colors, @
iv_sub_ids, @
i_vector_id_old )

dump i_vector_id_old

# Associate the vector table with the group “fem_model”


# s_name = “fem_model”
s_name = “fem_model”
ga_group_result_vector_set @
( s_name, @
i_vector_id_old )

i_return_value = @
ga_group_result_vector_get @
Main Index
CHAPTER 6 965
Group

( s_name, @
i_vector_id )

dump i_return_value
dump i_vector_id

ga_vector_delete @
( i_vector_id_old )

sys_free_array(iv_vect_ent_types)
sys_free_array(iv_vect_ent_ids)
sys_free_array(rv_vect_locs)
sys_free_array(iv_vect_types)
sys_free_array(iv_anchor_styles)
sys_free_array(iv_vect_colors)
sys_free_array(iv_sub_ids)
sys_free_array(iv_lcids)
sys_free_array(iv_nsub)
sys_free_array(iv_node_ids)
sys_free_array(rv_deform)
#---------------------------------------------------------------------

ga_group_result_vector_get ()

# Purpose : This file provides an example of a call to the


# function ga_group_result_vector_get()
#
# This function is used to set the load vector
# table associated with a group.This file opens
# the database “spool.db” and deformation results
# are read from the database and a table is
# created.This table is then associated with the
# group “fem_model” and later the id of the
# vector table associated with the group is got
# using above function.
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_group_result_vector_get()
# has the following arguments:
#
# ga_group_result_vector_get
# ( name,
# vector_id )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_title[32],s_name[32]
INTEGER i_ncases, i_nbr_nodes, i_index
INTEGER iv_lcids(VIRTUAL),iv_nsub(VIRTUAL), iv_node_ids(VIRTUAL)
REAL rv_deform(VIRTUAL)
INTEGER i_dtype,ia_minloc(6),ia_maxloc(6), ia_resids(5)
INTEGER i_comp_vect_flag,i_sym_flag,i_nvectors
INTEGER iv_vect_ent_types(VIRTUAL), iv_vect_ent_ids(VIRTUAL)
REAL rv_vect_locs(VIRTUAL)
INTEGER iv_vect_types(VIRTUAL), iv_anchor_styles(VIRTUAL)
INTEGER iv_vect_colors(VIRTUAL), iv_sub_ids(VIRTUAL)
INTEGER i_vector_id_old, i_vector_id,i_return_value
Main Index
966
Code Examples

#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)

# Get the number of Load cases and their IDs


i_return_value = res_utl_get_loadcases(i_ncases,iv_lcids,iv_nsub)

dump i_return_value

# Extract the stress results from the database


# Load case ID = iv_lcids(1)
# Sub case ID = 1
# Primary Result ID = 2 ( Corresponds to deformation )
# Secondary Result ID = 1
# Layer ID = 1
# node_list = “Node 1:#” (All nodes )
# derivation = ““
# coord_id = ““
ia_resids(1) = iv_lcids(1)
ia_resids(2) = 1
ia_resids(3) = 3
ia_resids(4) = 1
ia_resids(5) = 2
i_return_value = res_utl_extract_nodal_results @
(ia_resids,” Node 1:#”,””,””, @
i_dtype,i_nbr_nodes,iv_node_ids,rv_deform, @
ia_minloc,ia_maxloc)

# Create a vector table


s_title = “Vector Table”
i_comp_vect_flag = 0
i_sym_flag = 0
i_nvectors = i_nbr_nodes

sys_allocate_array(iv_vect_ent_types,1,i_nvectors)
sys_allocate_array(iv_vect_ent_ids,1,i_nvectors)
sys_allocate_array(rv_vect_locs,1,i_nvectors,1,3)
sys_allocate_array(iv_vect_types,1,i_nvectors)
sys_allocate_array(iv_anchor_styles,1,i_nvectors)
sys_allocate_array(iv_vect_colors,1,i_nvectors)
sys_allocate_array(iv_sub_ids,1,i_nvectors)

FOR(i_index = 1 TO i_nvectors)
iv_vect_ent_types(i_index) = 123 /* from dbtypes.h */
iv_vect_ent_ids(i_index) = iv_node_ids(i_index)
iv_vect_types(i_index) = 1
iv_anchor_styles(i_index) = 1
iv_vect_colors(i_index) = 0
iv_sub_ids(i_index) = 0
END FOR

i_return_value = ga_vector_create @
( s_title, @
i_comp_vect_flag, @
i_sym_flag, @
i_nvectors, @
iv_vect_ent_types, @
iv_vect_ent_ids, @
rv_vect_locs, @
rv_deform, @
iv_vect_types, @
iv_anchor_styles, @
iv_vect_colors, @
iv_sub_ids, @
i_vector_id_old )

dump i_return_value
Main Index
CHAPTER 6 967
Group

dump i_vector_id_old

# Associate the vector table with the group “fem_model”


# s_name = “fem_model”
s_name = “fem_model”
i_return_value = ga_group_result_vector_set @
( s_name, @
i_vector_id_old )

dump i_return_value

i_return_value = @
ga_group_result_vector_get @
( s_name, @
i_vector_id )

dump i_return_value
dump i_vector_id

sys_free_array(iv_vect_ent_types)
sys_free_array(iv_vect_ent_ids)
sys_free_array(rv_vect_locs)
sys_free_array(iv_vect_types)
sys_free_array(iv_anchor_styles)
sys_free_array(iv_vect_colors)
sys_free_array(iv_sub_ids)
sys_free_array(iv_lcids)
sys_free_array(iv_nsub)
sys_free_array(iv_node_ids)
sys_free_array(rv_deform)

#---------------------------------------------------------------------

ga_group_result_vector_set ()

# Purpose : This file provides an example of a call to the


# function ga_group_result_vector_set()
#
# This function is used to set the load vector
# table associated with a group.This file opens
# the database “spool.db” and deformation results
# are read from the database and a table is
# created.This table is then associated with the
# group “fem_model” and later the id of the
# vector table associated with the group is got
# using function ga_group_result_vector_get().
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_group_result_vector_set()
# has the following arguments:
#
# ga_group_result_vector_set
# ( name,
# vector_id )
#
#---------------------------------------------------------------------
# Variable Declarations
Main Index
968
Code Examples

STRING s_title[32],s_name[32]
INTEGER i_ncases, i_nbr_nodes, i_index
INTEGER iv_lcids(VIRTUAL),iv_nsub(VIRTUAL), iv_node_ids(VIRTUAL)
REAL rv_deform(VIRTUAL)
INTEGER i_dtype,ia_minloc(6),ia_maxloc(6), ia_resids(5)
INTEGER i_comp_vect_flag,i_sym_flag,i_nvectors
INTEGER iv_vect_ent_types(VIRTUAL), iv_vect_ent_ids(VIRTUAL)
REAL rv_vect_locs(VIRTUAL)
INTEGER iv_vect_types(VIRTUAL), iv_anchor_styles(VIRTUAL)
INTEGER iv_vect_colors(VIRTUAL), iv_sub_ids(VIRTUAL)
INTEGER i_vector_id, i_vector_id_c, i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)

# Get the number of Load cases and their IDs


res_utl_get_loadcases(i_ncases,iv_lcids,iv_nsub)

# Extract the stress results from the database


# Load case ID = iv_lcids(1)
# Sub case ID = 1
# Primary Result ID = 2 ( Corresponds to deformation )
# Secondary Result ID = 1
# Layer ID = 1
# node_list = “Node 1:#” (All nodes )
# derivation = ““
# coord_id = ““
ia_resids(1) = iv_lcids(1)
ia_resids(2) = 1
ia_resids(3) = 3
ia_resids(4) = 1
ia_resids(5) = 2
res_utl_extract_nodal_results(ia_resids,” Node 1:#”,””,””, @
i_dtype,i_nbr_nodes,iv_node_ids,rv_deform,ia_minloc,ia_maxloc)

# Create a vector table


s_title = “Vector Table”
i_comp_vect_flag = 0
i_sym_flag = 0
i_nvectors = i_nbr_nodes

sys_allocate_array(iv_vect_ent_types,1,i_nvectors)
sys_allocate_array(iv_vect_ent_ids,1,i_nvectors)
sys_allocate_array(rv_vect_locs,1,i_nvectors,1,3)
sys_allocate_array(iv_vect_types,1,i_nvectors)
sys_allocate_array(iv_anchor_styles,1,i_nvectors)
sys_allocate_array(iv_vect_colors,1,i_nvectors)
sys_allocate_array(iv_sub_ids,1,i_nvectors)

FOR(i_index = 1 TO i_nvectors)
iv_vect_ent_types(i_index) = 123 /* from dbtypes.h */
iv_vect_ent_ids(i_index) = iv_node_ids(i_index)
iv_vect_types(i_index) = 1
iv_anchor_styles(i_index) = 1
iv_vect_colors(i_index) = 0
iv_sub_ids(i_index) = 0
END FOR

ga_vector_create @
( s_title, @
i_comp_vect_flag, @
i_sym_flag, @
i_nvectors, @
iv_vect_ent_types, @
iv_vect_ent_ids, @
rv_vect_locs, @
rv_deform, @
Main Index
CHAPTER 6 969
Group

iv_vect_types, @
iv_anchor_styles, @
iv_vect_colors, @
iv_sub_ids, @
i_vector_id )

dump i_vector_id

# Associate the vector table with the group “fem_model”


# s_name = “fem_model”
s_name = “fem_model”
i_return_value = @
ga_group_result_vector_set @
( s_name, @
i_vector_id )

dump i_return_value

ga_group_result_vector_get @
( s_name, @
i_vector_id_c )

dump i_vector_id_c

ga_vector_delete @
( i_vector_id )

sys_free_array(iv_vect_ent_types)
sys_free_array(iv_vect_ent_ids)
sys_free_array(rv_vect_locs)
sys_free_array(iv_vect_types)
sys_free_array(iv_anchor_styles)
sys_free_array(iv_vect_colors)
sys_free_array(iv_sub_ids)
sys_free_array(iv_lcids)
sys_free_array(iv_nsub)
sys_free_array(iv_node_ids)
sys_free_array(rv_deform)
#---------------------------------------------------------------------

ga_group_result_vector_set ()

# Purpose : This file provides an example of a call to the


# function ga_group_result_vector_set()
#
# This function is used to set the load vector
# table associated with a group.This file opens
# the database “spool.db” and deformation results
# are read from the database and a table is
# created.This table is then associated with the
# group “fem_model” and later the id of the
# vector table associated with the group is got
# using function ga_group_result_vector_get().
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_group_result_vector_set()
# has the following arguments:
Main Index
970
Code Examples

#
# ga_group_result_vector_set
# ( name,
# vector_id )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_title[32],s_name[32]
INTEGER i_ncases, i_nbr_nodes, i_index
INTEGER iv_lcids(VIRTUAL),iv_nsub(VIRTUAL), iv_node_ids(VIRTUAL)
REAL rv_deform(VIRTUAL)
INTEGER i_dtype,ia_minloc(6),ia_maxloc(6), ia_resids(5)
INTEGER i_comp_vect_flag,i_sym_flag,i_nvectors
INTEGER iv_vect_ent_types(VIRTUAL), iv_vect_ent_ids(VIRTUAL)
REAL rv_vect_locs(VIRTUAL)
INTEGER iv_vect_types(VIRTUAL), iv_anchor_styles(VIRTUAL)
INTEGER iv_vect_colors(VIRTUAL), iv_sub_ids(VIRTUAL)
INTEGER i_vector_id, i_vector_id_c, i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)

# Get the number of Load cases and their IDs


i_return_value = res_utl_get_loadcases(i_ncases,iv_lcids,iv_nsub)

dump i_return_value

# Extract the stress results from the database


# Load case ID = iv_lcids(1)
# Sub case ID = 1
# Primary Result ID = 2 ( Corresponds to deformation )
# Secondary Result ID = 1
# Layer ID = 1
# node_list = “Node 1:#” (All nodes )
# derivation = ““
# coord_id = ““
ia_resids(1) = iv_lcids(1)
ia_resids(2) = 1
ia_resids(3) = 3
ia_resids(4) = 1
ia_resids(5) = 2
i_return_value = res_utl_extract_nodal_results(ia_resids,” Node 1:#”,””,””,
@
i_dtype,i_nbr_nodes,iv_node_ids,rv_deform,ia_minloc,ia_maxloc)

dump i_return_value

# Create a vector table


s_title = “Vector Table”
i_comp_vect_flag = 0
i_sym_flag = 0
i_nvectors = i_nbr_nodes

sys_allocate_array(iv_vect_ent_types,1,i_nvectors)
sys_allocate_array(iv_vect_ent_ids,1,i_nvectors)
sys_allocate_array(rv_vect_locs,1,i_nvectors,1,3)
sys_allocate_array(iv_vect_types,1,i_nvectors)
sys_allocate_array(iv_anchor_styles,1,i_nvectors)
sys_allocate_array(iv_vect_colors,1,i_nvectors)
sys_allocate_array(iv_sub_ids,1,i_nvectors)

FOR(i_index = 1 TO i_nvectors)
iv_vect_ent_types(i_index) = 123 /* from dbtypes.h */
iv_vect_ent_ids(i_index) = iv_node_ids(i_index)
iv_vect_types(i_index) = 1
iv_anchor_styles(i_index) = 1
iv_vect_colors(i_index) = 0
Main Index
CHAPTER 6 971
Group

iv_sub_ids(i_index) = 0
END FOR

i_return_value = ga_vector_create @
( s_title, @
i_comp_vect_flag, @
i_sym_flag, @
i_nvectors, @
iv_vect_ent_types, @
iv_vect_ent_ids, @
rv_vect_locs, @
rv_deform, @
iv_vect_types, @
iv_anchor_styles, @
iv_vect_colors, @
iv_sub_ids, @
i_vector_id )

dump i_return_value
dump i_vector_id

# Associate the vector table with the group “fem_model”


# s_name = “fem_model”
s_name = “fem_model”
i_return_value = @
ga_group_result_vector_set @
( s_name, @
i_vector_id )

dump i_return_value

i_return_value = ga_group_result_vector_get @
( s_name, @
i_vector_id_c )

dump i_return_value
dump i_vector_id_c

sys_free_array(iv_vect_ent_types)
sys_free_array(iv_vect_ent_ids)
sys_free_array(rv_vect_locs)
sys_free_array(iv_vect_types)
sys_free_array(iv_anchor_styles)
sys_free_array(iv_vect_colors)
sys_free_array(iv_sub_ids)
sys_free_array(iv_lcids)
sys_free_array(iv_nsub)
sys_free_array(iv_node_ids)
sys_free_array(rv_deform)

#---------------------------------------------------------------------

ga_group_selectable_get ()

# Purpose : This file gives an example of a call to the


# function ga_group_selectable_get()
#
# This function gets the current selectable flag
# associated with the group.This file opens a
# database spool.db which has two groups
# “default_group” and “fem_model”group.This file
# displays the selectable plot and gets the flag
# associated with the plot for the default
# group.Later it sets the current selectable flag
# to ‘unselect’ and gets the flag.This change of
Main Index
972
Code Examples

# setting can be identified by cursor selecting


# any entity before and after the setting.
#
# Before running this file the database should be
# created by running the session file “spool.ses”
# To run this session file, first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The ga_group_label_get has the following arguments:
# ga_group_label_get
# ( name,
# flag )
# -------------------------------------------------------------------
# Variable Declaration
#
STRING s_name[32]
INTEGER i_flag
INTEGER i_return_value
# -------------------------------------------------------------------
# opening the existing database spool.db
uil_file_open.go(“spool.db”)

uil_viewport_post_groups.posted_groups(“default_viewport”,1, @
[“default_group”])
coloring_method(2)

# s_name = default_group
s_name = “default_group”

ga_group_selectable_set(s_name,1)

# get the selectable flag


i_return_value = @
ga_group_selectable_get @
( s_name, @
i_flag )

dump i_return_value
# Selectable flag is
dump i_flag

# Observe that the entities can be cursor selected


# by using “Group”,”Modify” pulldown menu.

# Session file paused.Press “Resume” to continue.


sf_pause()

# Set the selectable flag for unselecting entities.


ga_group_selectable_set(s_name,0)

# get the selectable flag


i_return_value = @
ga_group_selectable_get @
( s_name, @
i_flag )

dump i_return_value
# Selectable flag is
dump i_flag

# Observe that the entities cannot be cursor selected


# by using “Group”,”Modify” pulldown menu.

# Session file paused.Press “Resume” to continue.


sf_pause()
Main Index
CHAPTER 6 973
Group

ga_group_selectable_set(s_name,1)

# -------------------------------------------------------------------

ga_group_selectable_set ()

# Purpose : This file gives an example of a call to the


# function ga_group_selectable_set()
#
# This function gets the current selectable flag
# associated with the group.This file opens a
# database spool.db which has two groups
# “default_group” and “fem_model”group.This file
# displays the selectable plot and gets the flag
# associated with the plot for the default
# group.Later it sets the current selectable flag
# to ‘unselect’ and gets the flag.This change of
# setting can be identified by cursor selecting
# any entity before and after the setting.
#
# Before running this file the database should be
# created by running the session file “spool.ses”
# To run this session file, first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The ga_group_label_set has the following arguments:
# ga_group_label_set
# ( name,
# flag )
# -------------------------------------------------------------------
# Variable Declaration
#
STRING s_name[32]
INTEGER i_flag,i_flag_c
INTEGER i_return_value
# -------------------------------------------------------------------
# opening the existing database spool.db
uil_file_open.go(“spool.db”)

uil_viewport_post_groups.posted_groups(“default_viewport”,1, @
[“default_group”])
coloring_method(2)

# s_name = default_group
s_name = “default_group”

# i_flag = 1
i_flag = 1

# Set the selectable flag


i_return_value = @
ga_group_selectable_set @
( s_name, @
i_flag )

dump i_return_value

# Get the selectable flag


ga_group_selectable_get(s_name,i_flag_c)

# Selectable flag is
dump i_flag_c
Main Index
974
Code Examples

# Observe that the entities can be cursor selected


# by using “Group”,”Modify” pulldown menu.

# Session file paused.Press “Resume” to continue.


sf_pause()

# Set the selectable flag for unselecting entities.


# i_flag = 0
i_flag = 0

i_return_value = @
ga_group_selectable_set @
( s_name, @
i_flag )

dump i_return_value

# get the selectable flag


ga_group_selectable_get(s_name,i_flag_c)

# Selectable flag is
dump i_flag_c

# Observe that the entities cannot be cursor selected


# by using “Group”,”Modify” pulldown menu.

# Session file paused.Press “Resume” to continue.


sf_pause()

ga_group_selectable_set(s_name,1)

# -------------------------------------------------------------------

ga_group_style_get ()

# Purpose : This file gives an example of a call to the


# function ga_group_style_get()
#
# This function gets the current render style
# associated with the group.This file opens a
# database spool.db which has two groups
# “default_group” and “fem_model”group.This file
# displays the wireframe plot and gets the style
# associated with the wireframe plot for the
# default group.Later it sets the plot to
# “shaded” and gets the style.The change of
# setting from wireframe to shaded can seen on
# the viewport.
#
# Before running this file the database should be
# created by running the session file “spool.ses”
# To run this session file, first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The ga_group_style_get has the following arguments:
# ga_group_style_get
# ( name,
# style )
# -------------------------------------------------------------------
# Variable Declaration
#
STRING s_name[32],s_style[32]
Main Index
CHAPTER 6 975
Group

INTEGER i_return_value
# -------------------------------------------------------------------
# opening the existing database spool.db
uil_file_open.go(“spool.db”)

uil_viewport_post_groups.posted_groups(“default_viewport”,1, @
[“default_group”])
coloring_method(2)

# s_name = default_group
s_name = “default_group”

# set the style to wire frame.


ga_group_style_set(s_name,”WIREFRAME”)

# get the render style


i_return_value = @
ga_group_style_get @
( s_name, @
s_style )

dump i_return_value
# Render style is
dump s_style

# Session file paused.Press “Resume” to continue.


sf_pause()

# Change the render style to SHADED


ga_group_style_set(s_name,”SHADED”)

# get the render style


i_return_value = @
ga_group_style_get @
( s_name, @
s_style )

dump i_return_value
# Render style is
dump s_style

# Session file paused.Press “Resume” to continue.


sf_pause()

# reset the style to wireframe.


ga_group_style_set(s_name,”WIREFRAME”)

# -------------------------------------------------------------------

ga_group_style_set ()

# Purpose : This file gives an example of a call to the


# function ga_group_style_set()
#
# This function modifies the render style
# associated with the group.This file opens a
# database spool.db which has two groups
# “default_group” and “fem_model”group.This file
# displays the wireframe plot and gets the style
# associated with the wireframe plot for the
# default group.Later it sets the plot to
# “shaded” and gets the style.The change of
# setting from wireframe to shaded can seen on
# the viewport.
#
Main Index
976
Code Examples

# Before running this file the database should be


# created by running the session file “spool.ses”
# To run this session file, first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The ga_group_style_set has the following arguments:
# ga_group_style_set
# ( name,
# style )
# -------------------------------------------------------------------
# Variable Declaration
#
STRING s_name[32],s_style[32],s_style_c[32]
INTEGER i_return_value
# -------------------------------------------------------------------
# opening the existing database spool.db
uil_file_open.go(“spool.db”)
uil_viewport_post_groups.posted_groups(“default_viewport”,1, @
[“default_group”])
coloring_method(2)

# s_name = default_group
s_name = “default_group”

# set the style to wire frame.


# s_style = “WIREFRAME”
s_style = “WIREFRAME”

i_return_value = @
ga_group_style_set @
(s_name, @
s_style )

dump i_return_value

# get the render style


ga_group_style_get @
( s_name, @
s_style_c )

# Render style is
dump s_style_c

# Session file paused.Press “Resume” to continue.


sf_pause()

# Change the render style to SHADED


# s_style = “SHADED”
s_style = “SHADED”

i_return_value = @
ga_group_style_set @
(s_name, @
s_style )

dump i_return_value

# get the render style


ga_group_style_get @
( s_name, @
s_style_c )

# Render style is
dump s_style_c
Main Index
CHAPTER 6 977
Group

# Session file paused.Press “Resume” to continue.


sf_pause()

# reset the style to wireframe.


ga_group_style_set(s_name,”WIREFRAME”)

# -------------------------------------------------------------------

ga_group_vector_load_get ()

# Purpose : This file gives an example of a call to the


# function ga_group_vector_load_get()
#
# This function gets the load vector flag
# associated with the group.This file opens a
# database spool.db which has two groups
# “default_group” and “fem_model”group.This file
# displays the load vector plot and gets the flag
# associated with load vector plot for the
# default group.Later it sets the load vector
# plot flag to ‘no display’ and gets the flag.
# This change of setting to ‘no display’ can be
# seen on the viewport.
#
# Before running this file the database should be
# created by running the session file “spool.ses”
# To run this session file, first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The ga_group_vector_load_get has the following arguments:
# ga_group_vector_load_get
# ( name,
# flag )
# -------------------------------------------------------------------
# Variable Declaration
#
STRING s_name[32]
INTEGER i_flag
INTEGER i_return_value
# -------------------------------------------------------------------
# opening a existing database spool.db
uil_file_open.go(“spool.db”)

uil_viewport_post_groups.posted_groups(“default_viewport”,1, @
[“default_group”])
coloring_method(2)

# Displaying the load vectors


loadsbcs_plot_markers( [“20_psi”], [“default_group”])

# s_name = default_group
s_name = “default_group”

# Get the load vector flag


i_return_value = @
ga_group_vector_load_get @
( s_name, @
i_flag )

dump i_return_value
# Load vector flag is
dump i_flag
Main Index
978
Code Examples

# Session file paused.Press “Resume” to continue.


sf_pause()

# Set the load vector plot for no display


ga_group_vector_load_set(s_name,0)

# Get the load vector flag


i_return_value = @
ga_group_vector_load_get @
( s_name, @
i_flag )

dump i_return_value
# Load vector flag is
dump i_flag

# -------------------------------------------------------------------

ga_group_vector_load_set ()

# Purpose : This file gives an example of a call to the


# function ga_group_load_result_set()
#
# This function sets the load vector flag
# associated with the group.This file opens a
# database spool.db which has two groups
# “default_group” and “fem_model”group.This file
# displays load vector plot and gets the flag
# associated with load vector plot for default
# group.Later it sets the load vector plot flag
# to ‘no display’ and gets the flag.This change
# of setting to ‘no display’ can be seen on the
# viewport.
#
# Before running this file the database should be
# created by running the session file “spool.ses”
# To run this session file, first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The ga_group_vector_load_set has the following arguments:
# ga_group_vector_load_set
# ( name,
# flag )
# -------------------------------------------------------------------
# Variable Declaration
#
STRING s_name[32]
INTEGER i_flag,i_flag_c
INTEGER i_return_value
# -------------------------------------------------------------------
# opening the existing database spool.db
uil_file_open.go(“spool.db”)

uil_viewport_post_groups.posted_groups(“default_viewport”,1, @
[“default_group”])
coloring_method(2)

# Displaying the load vectors


loadsbcs_plot_markers( [“20_psi”], [“default_group”])

# s_name=default_group
s_name = “default_group”
Main Index
CHAPTER 6 979
Group

# get the load vector flag


ga_group_vector_load_get @
( s_name, @
i_flag_c )

# Check the load vector flag


dump i_flag_c

# Session file paused.Press “Resume” to continue.


sf_pause()

# Set the load vector plot for no display


# i_flag = 0
i_flag = 0
i_return_value = @
ga_group_vector_load_set @
( s_name, @
i_flag )

dump i_return_value

# get the load vector flag


ga_group_vector_load_get @
( s_name, @
i_flag_c )

#Check the load vector flag


dump i_flag_c

# -------------------------------------------------------------------

ga_group_vector_result_get ()

# Purpose : This file gives an example of a call to the


# function ga_group_vector_result_get()
#
# This function gets the result vector flag
# associated with the group.This file plays
# the session file ‘spool_res_vector.ses’ which
# displays the result vector plot.It then gets
# the flag associated with result vector plot.
# Later it sets the result vector plot flag to
# ‘no display’ and gets the flag.This change of
# setting to ‘no display’ can be seen on the
# viewport.
#
# Before running this session file run spool.ses
# to create ‘spool.db’.Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
#
# To run this session file, first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The ga_group_vector_result_get has the following arguments:
# ga_group_vector_result_get
# ( name,
# flag )
#
# -------------------------------------------------------------------
# Variable Declaration
#
STRING s_name[32]
INTEGER i_flag
Main Index
980
Code Examples

INTEGER i_return_value
# -------------------------------------------------------------------
# Open the database “spool.db” and reads the results.
sf_play(“spool_res_vector.ses”)

coloring_method(2)
# s_name = fem_model
s_name = “fem_model”

# Get the result vector flag


i_return_value = @
ga_group_vector_result_get @
( s_name, @
i_flag )

dump i_return_value

# Result vector flag is


dump i_flag

# Session file paused. Press “Resume” to continue..


sf_pause()

# Set the result vector plot for no display


ga_group_vector_result_set(s_name,0)

# Get the result vector flag


i_return_value = @
ga_group_vector_result_get @
( s_name, @
i_flag )

dump i_return_value

# Result vector flag is


dump i_flag
# -------------------------------------------------------------------

ga_group_vector_result_get ()

# Purpose : This file gives an example of a call to the


# function ga_group_vector_result_get()
#
# This function gets the result vector flag
# associated with the group.This file plays
# the session file ‘spool_res_vector.ses’ which
# displays the result vector plot.It then gets
# the flag associated with result vector plot.
# Later it sets the result vector plot flag to
# ‘no display’ and gets the flag.This change of
# setting to ‘no display’ can be seen on the
# viewport.
#
# Before running this session file run spool.ses
# to create ‘spool.db’.Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
#
# To run this session file, first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The ga_group_vector_result_get has the following arguments:
# ga_group_vector_result_get
# ( name,
Main Index
CHAPTER 6 981
Group

# flag )
#
# -------------------------------------------------------------------
# Variable Declaration
#
STRING s_name[32]
INTEGER i_flag, i_method
INTEGER i_return_value
INTEGER i_preference_id, i_data_type, i_preference
LOGICAL l_preference
REAL r_preference
STRING s_preference[32]
# -------------------------------------------------------------------
# Open the database “spool.db” and reads the results.
sf_play(“spool_res_vector.ses”)

i_preference_id = 501
i_data_type = 1

# The i_preference value is the “method”


i_preference = 2

# These arguments can be set to anything as


# they are not used with i_data_type set to 1.
l_preference = TRUE
r_preference = 2.0
s_preference = “empty”

i_return_value = db_set_pref (i_preference_id, i_data_type, @


i_preference, l_preference, r_preference, s_preference)

# s_name = fem_model
s_name = “fem_model”

# Get the result vector flag


i_return_value = @
ga_group_vector_result_get @
( s_name, @
i_flag )

dump i_return_value

# The result vector flag should be set to 1.


# It’s current value is:
dump i_flag

# Set the result vector plot for no display


i_return_value = ga_group_vector_result_set(s_name,0)

dump i_return_value

# Get the result vector flag


i_return_value = @
ga_group_vector_result_get @
( s_name, @
i_flag )

dump i_return_value

# The result vector flag should be set to 0.


# It’s current value is:
dump i_flag

# -------------------------------------------------------------------

Main Index
982
Code Examples

ga_group_vector_result_set ()

# Purpose : This file gives an example of a call to the


# function ga_group_vector_result_set()
#
# This function sets the result vector flag
# associated with the group.This file plays
# the session file ‘spool_res_vector.ses’ which
# displays result vector plot.It then gets the
# flag associated with result vector plot for
# Later it sets the result vector plot flag to
# ‘no display’ and gets the flag.This change of
# setting to ‘no display’ can be seen on the
# viewport.
#
# Before running this session file run spool.ses
# to create ‘spool.db’.Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
#
# To run this session file, first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The ga_group_vector_result_set has the following arguments:
# ga_group_vector_result_set
# ( name,
# flag )
#
# -------------------------------------------------------------------
# Variable Declaration
#
STRING s_name[32]
INTEGER i_flag,i_flag_c
INTEGER i_return_value
# -------------------------------------------------------------------
# Open the database “spool.db” and reads the results.
sf_play(“spool_res_vector.ses”)

coloring_method(2)
# s_name=fem_model
s_name = “fem_model”

# Get the result vector flag


ga_group_vector_result_get @
( s_name, @
i_flag_c )

# Check the result vector flag


dump i_flag_c

# Session file paused. Press “Resume” to continue..


sf_pause()

# Set the result vector plot for no display


# i_flag = 0
i_flag = 0
i_return_value = @
ga_group_vector_result_set @
( s_name, @
i_flag )

dump i_return_value

# Get the result vector flag


Main Index
CHAPTER 6 983
Group

ga_group_vector_result_get @
( s_name, @
i_flag_c )

# Check the result vector flag


dump i_flag_c
# -------------------------------------------------------------------

ga_group_vector_result_set ()

# Purpose : This file gives an example of a call to the


# function ga_group_vector_result_set()
#
# This function sets the result vector flag
# associated with the group.This file plays
# the session file ‘spool_res_vector.ses’ which
# displays result vector plot.It then gets the
# flag associated with result vector plot for
# Later it sets the result vector plot flag to
# ‘no display’ and gets the flag.This change of
# setting to ‘no display’ can be seen on the
# viewport.
#
# Before running this session file run spool.ses
# to create ‘spool.db’.Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
#
# To run this session file, first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The ga_group_vector_result_set has the following arguments:
# ga_group_vector_result_set
# ( name,
# flag )
#
# -------------------------------------------------------------------
# Variable Declaration
#
STRING s_name[32]
INTEGER i_flag, i_method
INTEGER i_return_value
INTEGER i_preference_id, i_data_type, i_preference
LOGICAL l_preference
REAL r_preference
STRING s_preference[32]
# -------------------------------------------------------------------
# Open the database “spool.db” and reads the results.
sf_play(“spool_res_vector.ses”)

i_preference_id = 501
i_data_type = 1

# The i_preference value is the “method”


i_preference = 2

# These arguments can be set to anything as


# they are not used with i_data_type set to 1.
l_preference = TRUE
r_preference = 2.0
s_preference = “empty”

i_return_value = db_set_pref (i_preference_id, i_data_type, @


i_preference, l_preference, r_preference, s_preference)
Main Index
984
Code Examples

# s_name = fem_model
s_name = “fem_model”

# Get the result vector flag


i_return_value = @
ga_group_vector_result_get @
( s_name, @
i_flag )

dump i_return_value

# The result vector flag should be set to 1.


# It’s current value is:
dump i_flag

# Set the result vector plot for no display


i_return_value = ga_group_vector_result_set(s_name,0)

dump i_return_value

# Get the result vector flag


i_return_value = @
ga_group_vector_result_get @
( s_name, @
i_flag )

dump i_return_value

# The result vector flag should be set to 0.


# It’s current value is:
dump i_flag

# -------------------------------------------------------------------

ga_groups_load_vector_set ()

# Purpose : This file provides an example of a call to the


# function ga_groups_load_vector_set()
#
# This function is used to set the load vector
# table associated with multiple groups.This file
# opens the database “spool.db” and a load vector
# table is created.This table is then associated
# with both the groups in the “spool.db” database
# i.e. “fem_model” and “default_group”.Later
# the id of the vector table associated with both
# the groups is got using function ga_group_load_
# vector_get().
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_groups_load_vector_set()
# has the following arguments:
#
# ga_groups_load_vector_set
# ( ngroups,
# group_ids,
Main Index
CHAPTER 6 985
Group

# vector_id )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_title[32],s_name[32]
INTEGER i_ngroups, ia_group_ids(2)
INTEGER i_comp_vect_flag,i_sym_flag,i_nvectors
INTEGER ia_vect_ent_types(1), ia_vect_ent_ids(1)
REAL ra_vect_locs(1),ra_normals(1)
INTEGER ia_anchor_styles(1),ia_vect_types(1)
INTEGER ia_vect_colors(1), ia_sub_ids(1)
INTEGER i_vector_id, i_vector_id_c, i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Create a vector table


s_title = “Load Vector Table”
i_comp_vect_flag = 0
i_sym_flag = 0
i_nvectors = 1
ia_vect_ent_types(1) = 123 /* from dbtypes.h */
ia_vect_ent_ids(1) = 10
ia_vect_types(1) = 1
ia_anchor_styles(1) = 1
ia_vect_colors(1) = 0
ia_sub_ids(1) = 0
ra_normals(1) = 150.0

ga_vector_create @
( s_title, @
i_comp_vect_flag, @
i_sym_flag, @
i_nvectors, @
ia_vect_ent_types, @
ia_vect_ent_ids, @
ra_vect_locs, @
ra_normals, @
ia_vect_types, @
ia_anchor_styles, @
ia_vect_colors, @
ia_sub_ids, @
i_vector_id )

dump i_vector_id

# Associate the vector table with the groups “default_group”


# and “fem_model”
# i_ngroups = 2
i_ngroups = 2
# ia_group_ids = [1,2]
ia_group_ids = [1,2]
i_return_value = @
ga_groups_load_vector_set @
( i_ngroups, @
ia_group_ids, @
i_vector_id )

dump i_return_value

# Check for association of vector table with the default group


# s_name = “default_group”
s_name = “default_group”
ga_group_load_vector_get @
( s_name, @
i_vector_id_c )
Main Index
986
Code Examples

dump i_vector_id_c

# Check for association of vector table with the fem_model group


# s_name = “fem_model”
s_name = “fem_model”
ga_group_load_vector_get @
( s_name, @
i_vector_id_c )

dump i_vector_id_c

ga_vector_delete @
( i_vector_id )
#---------------------------------------------------------------------

ga_groups_load_vector_set ()

# Purpose : This file provides an example of a call to the


# function ga_groups_load_vector_set()
#
# This function is used to set the load vector
# table associated with multiple groups.This file
# opens the database “spool.db” and a load vector
# table is created.This table is then associated
# with both the groups in the “spool.db” database
# i.e. “fem_model” and “default_group”.Later
# the id of the vector table associated with both
# the groups is got using function ga_group_load_
# vector_get().
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function ga_groups_load_vector_set()
# has the following arguments:
#
# ga_groups_load_vector_set
# ( ngroups,
# group_ids,
# vector_id )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_title[32],s_name[32]
INTEGER i_ngroups, ia_group_ids(2)
INTEGER i_comp_vect_flag,i_sym_flag,i_nvectors
INTEGER ia_vect_ent_types(1), ia_vect_ent_ids(1)
REAL ra_vect_locs(1),ra_normals(1)
INTEGER ia_anchor_styles(1),ia_vect_types(1)
INTEGER ia_vect_colors(1), ia_sub_ids(1)
INTEGER i_vector_id, i_vector_id_c, i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Create a vector table


s_title = “Load Vector Table”
i_comp_vect_flag = 0
i_sym_flag = 0
Main Index
CHAPTER 6 987
Group

i_nvectors = 1
ia_vect_ent_types(1) = 123 /* from dbtypes.h */
ia_vect_ent_ids(1) = 10
ia_vect_types(1) = 1
ia_anchor_styles(1) = 1
ia_vect_colors(1) = 0
ia_sub_ids(1) = 0
ra_normals(1) = 150.0

i_return_value = ga_vector_create @
( s_title, @
i_comp_vect_flag, @
i_sym_flag, @
i_nvectors, @
ia_vect_ent_types, @
ia_vect_ent_ids, @
ra_vect_locs, @
ra_normals, @
ia_vect_types, @
ia_anchor_styles, @
ia_vect_colors, @
ia_sub_ids, @
i_vector_id )

dump i_return_value
dump i_vector_id

# Associate the vector table with the groups “default_group”


# and “fem_model”
# i_ngroups = 2
i_ngroups = 2
# ia_group_ids = [1,2]
ia_group_ids = [1,2]
i_return_value = @
ga_groups_load_vector_set @
( i_ngroups, @
ia_group_ids, @
i_vector_id )

dump i_return_value

# Check for association of vector table with the default group


# s_name = “default_group”
s_name = “default_group”
i_return_value = ga_group_load_vector_get @
( s_name, @
i_vector_id_c )

dump i_return_value
dump i_vector_id_c

# Check for association of vector table with the fem_model group


# s_name = “fem_model”
s_name = “fem_model”
i_return_value = ga_group_load_vector_get @
( s_name, @
i_vector_id_c )

dump i_return_value
dump i_vector_id_c

#---------------------------------------------------------------------

Main Index
988
Code Examples

get_orphan_elements ()

# Purpose : This file gives an example of a call to the


# function count_orphan_elements()
#
# This function is used to get the list of
# element entities that do not belong to any
# of the groups.This file opens a database
# spool.db.This database has two groups
# “default”group and “fem_model” group.The
# fem_model group has 600 node entities and
# 576 element entities.Element 1 to 250 is
# removed from the fem_model group and the
# orphan elements are got for in this file.
#
# Before running this session file run spool.ses
# to create spool.db
#
# To run this session file,first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The get_orphan_elements has the following arguments:
# get_orphan_elements
# ( count,
# idlist )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_count,i_grp_id,i_idlist( VIRTUAL )
STRING s_name[32]
INTEGER i_return_value
# -------------------------------------------------------------------
#
# opening a existing database spool.db
uil_file_open.go(“spool.db”)

# Now remove the elements 1 to 250 from group group two ( fem_model)
i_grp_id = 2
db_get_group_name( i_grp_id,s_name )
ga_group_entity_remove( s_name,”Element 1:250” )

# check the database for orphan elements

count_orphan_elements @
( i_count )
#
# Allocate memory
SYS_ALLOCATE_ARRAY( i_idlist,1,i_count)

# list the orphan elements

i_return_value = @
get_orphan_elements @
( i_count, @
i_idlist )

dump i_return_value
# The list of orphan elements
dump i_idlist

ga_group_entity_add( s_name,”Element 1:250” )


SYS_FREE_ARRAY(i_idlist )
Main Index
CHAPTER 6 989
Group

# -------------------------------------------------------------------

get_orphan_nodes ()

# Purpose : This file gives an example of a call to the


# function count_orphan_nodes()
#
# This function is used to get the list of node
# entities that do not belong to any of the
# groups.This file opens a database spool.db
# This database has two groups “default”group
# and “fem_model” group. The fem_model group
# has 600 node entities and 576 element entities
# Node 1 to 300 are removed from the fem_model
# group and the orphan nodes are got for in this
# file.
#
# Before running this session file run spool.ses
# to create spool.db
#
# To run this session file,first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The get_orphan_nodes has the following arguments:
# get_orphan_nodes
# ( count,
# idlist )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_count,i_grp_id,i_idlist( VIRTUAL )
STRING s_name[32]
INTEGER i_return_value
# -------------------------------------------------------------------
#
# opening a existing database spool.db
uil_file_open.go(“spool.db”)

# Now remove the nodes 1 to 300 from group two ( fem_model)


i_grp_id = 2
db_get_group_name( i_grp_id,s_name )
ga_group_entity_remove( s_name,”Node 1:300” )

# check the database for orphan Nodes

count_orphan_nodes @
( i_count )
#
# Allocate memory
SYS_ALLOCATE_ARRAY( i_idlist,1,i_count)

# list the orphan nodes

i_return_value = @
get_orphan_nodes @
( i_count, @
i_idlist )

dump i_return_value
Main Index
990
Code Examples

# The list of orphan nodes


dump i_idlist

ga_group_entity_add( s_name,”Node 1:300” )


SYS_FREE_ARRAY( i_idlist )

# -------------------------------------------------------------------

sgm_db_count_iges_in_group ()

# Purpose : This file gives an example of a call to the


# function sgm_db_count_iges_in_group()
#
# This function counts all the IGES entity types
# in a group.There are fifteen IGES entity types
# that can be counted.
#
# This file opens a database spool.db which has
# two groups “default_group” and “fem_model”group
# This file counts for all the IGES entity types
# in the default group.The default group has six
# surface of revolution IGES entity type.
#
# Before running this file the database should be
# created by running the session file “spool.ses”
# To run this session file,first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The sgm_db_count_iges_in_group has the following arguments:
# sgm_db_count_iges_in_group
# ( groupid,
# count )
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_groupid,i_count(15)
INTEGER i_return_value
# -----------------------------------------------------------------
# opening the existing database spool.db
uil_file_open.go(“spool.db”)

# i_groupid = 1 (default group)


i_groupid = 1

# check the database for IGES entities in default group.


i_return_value = @
sgm_db_count_iges_in_group @
( i_groupid, @
i_count )
#
dump i_return_value

# the number of IGES entity type in default group are


dump i_count

# -------------------------------------------------------------------

Main Index
CHAPTER 6 991
Group

sgm_db_get_iges_in_group ()

# Purpose : This file gives an example of a call to the


# function sgm_db_get_iges_in_group()
#
# This function gets the entity ids of a
# particular IGES entity type in a group.There
# are fifteen IGES entity types.
#
# This file opens a database spool.db which has
# two groups “default_group” and “fem_model”group
# This file counts for all the IGES entity types
# in the default group.The default group has six
# surface of revolution IGES entity type.Then the
# file gets the entity ids for the surface of
# revolution entity type.
#
# Before running this file the database should be
# created by running the session file “spool.ses”
# To run this session file,first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The sgm_db_get_iges_in_group has the following arguments:
# sgm_db_get_iges_in_group
# ( groupid,
# typecode,
# entityids )
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_groupid,i_typecode,i_count(15)
INTEGER i_entityids( VIRTUAL)
INTEGER i_return_value
# -----------------------------------------------------------------
# opening the existing database spool.db
uil_file_open.go(“spool.db”)

# i_groupid = 1 (default group)


i_groupid = 1

# check the database for IGES entities in default group.


sgm_db_count_iges_in_group @
( i_groupid, @
i_count )

# Allocate memory
# i_count(12) is the count of surface of revolution IGES entity.
SYS_ALLOCATE_ARRAY(i_entityids,1,i_count(12))

#i_typecode=1004 (Type code for surface of revolution entity).


i_typecode = 1004

# Get the ids of surface of revolution IGES entity.


i_return_value = @
sgm_db_get_iges_in_group @
( i_groupid, @
i_typecode, @
i_entityids )
#
dump i_return_value

# The ids of the surface of revolution IGES entity type are


dump i_entityids
Main Index
992
Code Examples

SYS_FREE_ARRAY(i_entityids)

# -------------------------------------------------------------------

sgm_db_get_iges_in_group ()

# Purpose : This file gives an example of a call to the


# function sgm_db_get_iges_in_group()
#
# This function gets the entity ids of a
# particular IGES entity type in a group.There
# are fifteen IGES entity types.
#
# This file opens a database spool.db which has
# two groups “default_group” and “fem_model”group
# This file counts for all the IGES entity types
# in the default group.The default group has six
# surface of revolution IGES entity type.Then the
# file gets the entity ids for the surface of
# revolution entity type.
#
# Before running this file the database should be
# created by running the session file “spool.ses”
# To run this session file,first start
# a session of MSC.Patran,then run this session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The sgm_db_get_iges_in_group has the following arguments:
# sgm_db_get_iges_in_group
# ( groupid,
# typecode,
# entityids )
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_groupid,i_typecode,i_count(15), i_item_count
INTEGER i_entityids( VIRTUAL)
INTEGER i_return_value
# -----------------------------------------------------------------
# opening the existing database spool.db
uil_file_open.go(“spool.db”)

# i_groupid = 1 (default group)


i_groupid = 1

# check the database for IGES entities in default group.


sgm_db_count_iges_in_group @
( i_groupid, @
i_count )

# Allocate memory
# i_count(12) is the count of surface of revolution IGES entity.
SYS_ALLOCATE_ARRAY(i_entityids,1,i_count(12))

#i_typecode=1004 (Type code for surface of revolution entity).


i_typecode = 1004

# Get the ids of surface of revolution IGES entity.


i_return_value = @
sgm_db_get_iges_in_group @
( i_groupid, @
i_typecode, @
i_entityids, @
Main Index
CHAPTER 6 993
Group

i_item_count )
#
dump i_item_count
dump i_entityids

dump i_return_value

# The ids of the surface of revolution IGES entity type are


dump i_entityids

SYS_FREE_ARRAY(i_entityids)

# -------------------------------------------------------------------

uil_entity_group_members_get ()

# Purpose : This file gives an example of a call to the


# function uil_entity_group_members_get()
#
# This function gives the members of a particular
# group having a specific entity type.This file
# opens database spool.db which has two groups
# “default group” and “fem_model”group .The
# fem_model group has 600 node entities and 576
# element entities.This file gets the group
# members of entity node type from the fem_model
# group.
#
# Before running this session file run spool.ses
# to create spool.db
#
# To run this session file,first start
# a session of MSC.Patran,then run the session
# file by “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The uil_entity_group_members_get has the following arguments:
# uil_entity_group_members_get
# ( group,
# entity_type,
# members )
#
# -------------------------------------------------------------------
# Variable Declaration
#
INTEGER i_entity_type,i_grp_id
STRING s_group[32]
STRING s_members[VIRTUAL]
INTEGER i_return_value

# -------------------------------------------------------------------
# open the existing database spool.db

uil_file_open.go(“spool.db”)

#i_entity_type = 123 (node)


i_entity_type = 123

# Allocate memory
SYS_ALLOCATE_STRING( s_members,32)

db_get_current_group_id @
( i_grp_id )
Main Index
994
Code Examples

db_get_group_name @
( i_grp_id, @
s_group )

i_return_value = @
uil_entity_group_members_get @
( s_group, @
i_entity_type, @
s_members )

dump i_return_value
# gets the group members of node type from fem_model group.
dump s_members

SYS_FREE_STRING(s_members)
# -------------------------------------------------------------------

Main Index
MSC.Acumen, Volume 2: Code Examples

CHAPTER
Geometry
7
■ Introduction

Main Index
996
Code Examples

7.1 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

Main Index # Default reference coordinate frame is


CHAPTER 7 997
Geometry

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
Main Index
998
Code Examples

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]
Main Index
CHAPTER 7 999
Geometry

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,
Main Index
1000
Code Examples

# 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.
#
Main Index
CHAPTER 7 1001
Geometry

# 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.
Main Index
1002
Code Examples

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
Main Index
CHAPTER 7 1003
Geometry

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.
Main Index
1004
Code Examples

#
# 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 )
Main Index
CHAPTER 7 1005
Geometry

#
#---------------------------------------------------------------------
# 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,
Main Index
1006
Code Examples

# 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 )

#---------------------------------------------------------------------

Main Index
CHAPTER 7 1007
Geometry

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)
#---------------------------------------------------------------------

Main Index
1008
Code Examples

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
Main Index
CHAPTER 7 1009
Geometry

# 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,
Main Index
1010
Code Examples

# 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
Main Index
CHAPTER 7 1011
Geometry

# 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 )
Main Index
1012
Code Examples

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
Main Index
CHAPTER 7 1013
Geometry

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)
#---------------------------------------------------------------------

Main Index
1014
Code Examples

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)
#---------------------------------------------------------------------

Main Index
CHAPTER 7 1015
Geometry

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
Main Index
1016
Code Examples

# 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
Main Index
CHAPTER 7 1017
Geometry

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”
Main Index
1018
Code Examples

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)
#---------------------------------------------------------------------

Main Index
CHAPTER 7 1019
Geometry

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 )
Main Index
1020
Code Examples

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
Main Index
CHAPTER 7 1021
Geometry

# 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
Main Index
1022
Code Examples

# 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 )
#---------------------------------------------------------------------

Main Index
CHAPTER 7 1023
Geometry

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

Main Index
1024
Code Examples

# 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 @
Main Index
CHAPTER 7 1025
Geometry

( 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.


Main Index
1026
Code Examples

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, @
Main Index
CHAPTER 7 1027
Geometry

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
#---------------------------------------------------------------------
Main Index
1028
Code Examples

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
Main Index
CHAPTER 7 1029
Geometry

# 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)
#---------------------------------------------------------------------

Main Index
1030
Code Examples

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

#---------------------------------------------------------------------

Main Index
CHAPTER 7 1031
Geometry

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.
#
Main Index
1032
Code Examples

# 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”)
Main Index
CHAPTER 7 1033
Geometry

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)
#---------------------------------------------------------------------

Main Index
1034
Code Examples

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:
Main Index
CHAPTER 7 1035
Geometry

#
# 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
Main Index
1036
Code Examples

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

#---------------------------------------------------------------------

Main Index
CHAPTER 7 1037
Geometry

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
Main Index
1038
Code Examples

# 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]
#---------------------------------------------------------------------
Main Index
CHAPTER 7 1039
Geometry

# 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.
#
#
Main Index
1040
Code Examples

# 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 )
#---------------------------------------------------------------------

Main Index
CHAPTER 7 1041
Geometry

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

#---------------------------------------------------------------------

Main Index
1042
Code Examples

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

#---------------------------------------------------------------------

Main Index
CHAPTER 7 1043
Geometry

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
Main Index
1044
Code Examples

# 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()
Main Index
CHAPTER 7 1045
Geometry

# 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
Main Index
1046
Code Examples

# 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:
Main Index
CHAPTER 7 1047
Geometry

#
# 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 )
#
Main Index
1048
Code Examples

#---------------------------------------------------------------------
# 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
Main Index
CHAPTER 7 1049
Geometry

# ( 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 )
Main Index
1050
Code Examples

#
#---------------------------------------------------------------------
# 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 = @
Main Index
CHAPTER 7 1051
Geometry

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)
Main Index
1052
Code Examples

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, @
"#", @
Main Index
CHAPTER 7 1053
Geometry

"[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,
Main Index
1054
Code Examples

# 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 @
Main Index
CHAPTER 7 1055
Geometry

( 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>", @
Main Index
1056
Code Examples

"[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:
Main Index
CHAPTER 7 1057
Geometry

#
# 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( @
Main Index
1058
Code Examples

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.
Main Index
CHAPTER 7 1059
Geometry

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)
#---------------------------------------------------------------------

Main Index
1060
Code Examples

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", @
Main Index
CHAPTER 7 1061
Geometry

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

Main Index
1062
Code Examples

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
Main Index
CHAPTER 7 1063
Geometry

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
Main Index
1064
Code Examples

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]
Main Index
CHAPTER 7 1065
Geometry

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
Main Index
1066
Code Examples

#---------------------------------------------------------------------
# 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 )
Main Index
CHAPTER 7 1067
Geometry

#
#---------------------------------------------------------------------
# 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, @
Main Index
1068
Code Examples

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 )
#
Main Index
CHAPTER 7 1069
Geometry

#---------------------------------------------------------------------
# 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 )
Main Index
1070
Code Examples

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
Main Index
CHAPTER 7 1071
Geometry

# ( 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 )
Main Index
1072
Code Examples

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, @
Main Index
CHAPTER 7 1073
Geometry

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
Main Index
1074
Code Examples

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, @
Main Index
CHAPTER 7 1075
Geometry

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”
Main Index
1076
Code Examples

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)
Main Index
CHAPTER 7 1077
Geometry

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)
#---------------------------------------------------------------------

Main Index
1078
Code Examples

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 )

Main Index
CHAPTER 7 1079
Geometry

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. )
Main Index
1080
Code Examples

# 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,
Main Index
CHAPTER 7 1081
Geometry

# 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.
Main Index
1082
Code Examples

#
# 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()
Main Index
CHAPTER 7 1083
Geometry

# 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
Main Index
1084
Code Examples

# 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, @
Main Index
CHAPTER 7 1085
Geometry

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 )
Main Index
1086
Code Examples

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

#---------------------------------------------------------------------

Main Index
CHAPTER 7 1087
Geometry

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)
Main Index
1088
Code Examples

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)
Main Index
CHAPTER 7 1089
Geometry

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 )
Main Index
1090
Code Examples

# 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 )
#---------------------------------------------------------------------

Main Index
CHAPTER 7 1091
Geometry

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"
Main Index
1092
Code Examples

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.
Main Index
CHAPTER 7 1093
Geometry

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]
Main Index
1094
Code Examples

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,
Main Index
CHAPTER 7 1095
Geometry

# 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
Main Index
1096
Code Examples

#---------------------------------------------------------------------
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.
Main Index
CHAPTER 7 1097
Geometry

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", @
Main Index
1098
Code Examples

"<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]
Main Index
CHAPTER 7 1099
Geometry

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 )
Main Index
1100
Code Examples

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( @
Main Index
CHAPTER 7 1101
Geometry

"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)
#---------------------------------------------------------------------

Main Index
1102
Code Examples

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]", @
Main Index
CHAPTER 7 1103
Geometry

"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", @
Main Index
1104
Code Examples

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
Main Index
CHAPTER 7 1105
Geometry

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, @
Main Index
1106
Code Examples

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
Main Index
CHAPTER 7 1107
Geometry

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
#---------------------------------------------------------------------
Main Index
1108
Code Examples

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, @
Main Index
CHAPTER 7 1109
Geometry

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 )
Main Index
1110
Code Examples

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
#---------------------------------------------------------------------
Main Index
CHAPTER 7 1111
Geometry

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

#---------------------------------------------------------------------

Main Index
1112
Code Examples

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
Main Index
CHAPTER 7 1113
Geometry

# “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

#---------------------------------------------------------------------

Main Index
1114
Code Examples

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, @
Main Index
CHAPTER 7 1115
Geometry

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)
Main Index
1116
Code Examples

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
#---------------------------------------------------------------------
Main Index
CHAPTER 7 1117
Geometry

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

Main Index
1118
Code Examples

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()
Main Index
CHAPTER 7 1119
Geometry

# 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)

#---------------------------------------------------------------------

Main Index
1120
Code Examples

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
Main Index
CHAPTER 7 1121
Geometry

# 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 )
#
#---------------------------------------------------------------------
Main Index
1122
Code Examples

# 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 )
Main Index
CHAPTER 7 1123
Geometry

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
Main Index
1124
Code Examples

# 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)
Main Index
CHAPTER 7 1125
Geometry

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)
#---------------------------------------------------------------------
Main Index
1126
Code Examples

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 )

Main Index
CHAPTER 7 1127
Geometry

# 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]
Main Index
1128
Code Examples

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
Main Index
CHAPTER 7 1129
Geometry

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
Main Index
1130
Code Examples

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,
Main Index
CHAPTER 7 1131
Geometry

# 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
Main Index
1132
Code Examples

#---------------------------------------------------------------------

# End of File.

#---------------------------------------------------------------------

Main Index
MSC.Acumen, Volume 2: Code Examples

CHAPTER
Finite Element Model
8
■ Introduction

Main Index
1134
Code Examples

8.1 Introduction
This chapter provides code examples for the PCL function described in Volume 1. These
examples are designed so that they can be cut and pasted into a file and, by following the
instructions listed with each example, executed in MSC.Patran.

db_count_elem_topology_codes ()

# Purpose : This file provides an example of a call to the


# function db_count_elem_topology_codes()
#
# This file opens fem1.db and calls the function
# to get total number of topologies currently
# defined in the system.
#
# Before running this session file, run fem1.ses
# to create fem1.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_elem_topology_codes()
# has the following arguments:
#
# db_count_elem_topology_codes
# ( ntop )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_ntop
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “fem1.db”
uil_file_open.go(“fem1.db”)

# Call the function to count the number of element topologies


# currently defined in the system.
#
i_return_value = @
db_count_elem_topology_codes @
( i_ntop )
dump i_return_value

# Number of Topologies defined in the system is


dump i_ntop
#---------------------------------------------------------------------

db_count_elem_w_topology ()

# Purpose : This file provides an example of a call to the


# function db_count_elem_w_topology()
#
# This file opens fem1.db and calls the function
# to get number of elements in element topologies
# 25 to 28. There are 16 elements of topology id
# 28 in the fem1.db.
#
# Before running this session file, run fem1.ses
# to create fem1.db
Main Index
CHAPTER 8 1135
Finite Element Model

#
# This file can be run by starting a session of
# MSC.Patran and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_count_elem_w_topology()
# has the following arguments:
# db_count_elem_w_topology
# ( ntop,
# top,
# nelem )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_ntop
INTEGER ia_top(4)
INTEGER ia_nelem(4)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “fem1.db”
uil_file_open.go(“fem1.db”)

# Look for the topologies 25,26,27,28


i_ntop = 4
ia_top = [25,26,27,28]

i_return_value = @
db_count_elem_w_topology @
( i_ntop, @
ia_top, @
ia_nelem )
dump i_return_value
# Number of elements in topologies 25,26,27,28 are
dump ia_nelem
#---------------------------------------------------------------------

db_count_elems_for_geo ()

# Purpose : This file provides an example of a call to the


# function db_count_elems_for_geo()
#
# This file opens fem1.db and calls the function
# to get number of elements that have geometry as
# SOLID and id 1. fem1.db contains 16 such
# elements.
#
# Before running this session file, run fem1.ses
# to create fem1.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_elems_for_geo() has the following arguments:
# db_count_elems_for_geo
# ( geo_type,
# geo_id,
# nbr_of_elements )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_geo_type
INTEGER i_geo_id
Main Index
1136
Code Examples

INTEGER i_nbr_of_elements
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “fem1.db”
uil_file_open.go(“fem1.db”)

# Call the function db_count_elems_for_geo() to get the number of


# elements that have SOLID as geometry type and 1 as geometry id.
#

i_geo_type = 4 /* For SOLID from dbtypes.h */


i_geo_id = 1

i_return_value = @
db_count_elems_for_geo @
( i_geo_type, @
i_geo_id, @
i_nbr_of_elements )
dump i_return_value

# Number of elements in the SOLID of id = 1 is


dump i_nbr_of_elements
#---------------------------------------------------------------------

db_count_elems_using_node ()

# Purpose : This file provides an example of a call to the


# function db_count_elems_using_node()
#
# This file opens fem3.db and calls the function
# to get the number of elements associated with
# the Nodes 1:20.
#
# Before running this session file, run fem3.ses
# to create fem3.db. The fem3.db contains 9
# Quad elements, 2 LBCs, 1 MPC, 21 nodes , a
# surface and 2 lines on that surface. It also
# contains 2 groups.
#
# 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_elems_using_node()
# has the following arguments:
# db_count_elems_using_node
# ( nnode,
# nid,
# nelem,
# fflag )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_nnode
INTEGER ia_nid(20)
INTEGER ia_nelem(20)
INTEGER i_fflag
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem3.db
uil_file_open.go(“fem3.db”)

# Call the function to get the number of elements associated with


# the array of Nodes 1:20
Main Index
CHAPTER 8 1137
Finite Element Model

#
i_nnode = 20
ia_nid = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]

i_return_value = @
db_count_elems_using_node @
( i_nnode, @
ia_nid, @
ia_nelem, @
i_fflag )
dump i_return_value

# The number of elements associated with the nodes


dump ia_nelem
# Flag indicating if any of the node in the list was found not
# associated to element(i.e. unreferenced).
dump i_fflag
#---------------------------------------------------------------------

db_count_mpcs_using_node ()

# Purpose : This file provides an example of a call to the


# function db_count_mpcs_using_node()
#
# This file opens fem3.db and calls the function
# to get the number of MPCs associated with the
# nodes 1:20.
#
# Before running this session file, run fem3.ses
# to create fem3.db. The fem3.db contains 9
# Quad elements, 2 LBCs, 1 MPC, 21 nodes , a
# surface and 2 lines on that surface. It also
# contains 2 groups.
#
# 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_mpcs_using_node() has the following
# arguments:
# db_count_mpcs_using_node
# ( nnode,
# nid,
# nmpc,
# nnode )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_nnode
INTEGER ia_nid(20)
INTEGER ia_nmpc(20)
INTEGER i_fflag
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem3.db
uil_file_open.go(“fem3.db”)

# Call the function to count the number of MPCs associated to the


# Nodes 1:20
#
i_nnode = 20
ia_nid = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]

i_return_value = @
Main Index
1138
Code Examples

db_count_mpcs_using_node @
( i_nnode, @
ia_nid, @
ia_nmpc, @
i_fflag )
dump i_return_value

# Number of MPCs associated to the Nodes


dump ia_nmpc
# Flag indicating whether any of the node in the List is not
# associated to any MPC in the database.
dump i_fflag
#---------------------------------------------------------------------

db_count_nodes_for_geometry ()

# Purpose : This file provides an example of a call to the


# function db_count_nodes_for_geometry()
#
# This file opens fem1.db and calls the function
# to get the number of nodes present in the
# Surface 1 (Solid 1.1) of Solid 1.
#
# Before running this session file, run fem1.ses
# to create fem1.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_nodes_for_geometry()
# has the following arguments:
#
# db_count_nodes_for_geometry
# ( geoType,
# geoId,
# parentType,
# parentId,
# nodeCount )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_geoType,i_count
INTEGER i_geoId,ia_orphan(1)
INTEGER i_parentType
INTEGER i_parentId
INTEGER i_nodeCount
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem1.db
uil_file_open.go(“fem1.db”)

# Call the function with geotype = Surface and ParentType = Solid


# Patran generates 6 orphan surfaces when it creates the SOLID.
# To get the internal Id of the Surface “Solid 1.1” and to assign
# it to i_geoid, call the function db_get_orphan_surfaces() and
# db_get_surface_id().

db_count_orphan_surfaces(i_count)
db_get_orphan_surfaces(i_count,ia_orphan)
db_get_surface_id(ia_orphan(1), i_geoId)
dump i_geoId

i_geoType = 3 /* for SURFACE from dbtypes.h */


Main Index
CHAPTER 8 1139
Finite Element Model

i_parentType = 4 /* for SOLID from dbtypes.h */


i_parentId = 1

i_return_value = @
db_count_nodes_for_geometry @
( i_geoType, @
i_geoId, @
i_parentType, @
i_parentId, @
i_nodeCount )
dump i_return_value

# Number of nodes associated with the first surface of Solid 1 is


dump i_nodeCount
#---------------------------------------------------------------------

db_count_nodes_in_mpc ()

# Purpose : This file provides an example of a call to the


# function db_count_nodes_in_mpc()
#
# This file opens fem3.db and calls the function
# to count the nodes in MPC 1.
#
# Before running this session file, run fem3.ses
# to create fem3.db. The fem3.db contains 9
# Quad elements, 2 LBCs, 1 MPC, 21 nodes , a
# surface and 2 lines on that surface. It also
# contains 2 groups.
#
# 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_nodes_in_mpc()
# has the following arguments:
# db_count_nodes_in_mpc
# ( nmpc,
# mpcid,
# nnode,
# fflag )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_nmpc
INTEGER ia_mpcid(8)
INTEGER ia_nnode(8)
INTEGER i_fflag
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem3.db
uil_file_open.go(“fem3.db”)

# Get the number of MPCs in the database.


i_return_value = @
db_count_mpcs( i_nmpc )
dump i_return_value

# Get the IDs of the MPCs


i_return_value = @
db_get_mpc_ids @
( i_nmpc, @
ia_mpcid )
dump i_return_value
Main Index
1140
Code Examples

# Call the function to get the nodes in the MPCs


#
i_return_value = @
db_count_nodes_in_mpc @
( i_nmpc, @
ia_mpcid, @
ia_nnode, @
i_fflag )
dump i_return_value

# Number of nodes in each MPC


dump ia_nnode
# Error flag
dump i_fflag
#---------------------------------------------------------------------

db_count_unref_nodes ()

# Purpose : This file provides an example of a call to the


# function db_count_unref_nodes()
#
# This file opens fem3.db and calls the function
# to count the unreferenced nodes.
#
# Before running this session file, run fem3.ses
# to create fem3.db. The fem3.db contains 9
# Quad elements, 2 LBCs, 1 MPC, 21 nodes , a
# surface and 2 lines on that surface. It
# contains 4 unreferenced nodes.
#
# 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_unref_nodes() has the following arguments:
# db_count_unref_nodes
# ( nbr_unref_node )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_nbr_unref_node
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem3.db
uil_file_open.go(“fem3.db”)

# Call the function to count the Unreferenced Nodes in the database.


#
i_return_value = @
db_count_unref_nodes @
( i_nbr_unref_node )
dump i_return_value

# The number of Unreferenced nodes are


dump i_nbr_unref_node
#---------------------------------------------------------------------

Main Index
CHAPTER 8 1141
Finite Element Model

db_count_valid_dofs_f_mpc_type ()

# Purpose : This file provides an example of a call to the


# function db_count_valid_dofs_f_mpc_type()
#
# This file opens fem2.db and calls the function
# to get the number of Valid Degree of Freedoms
# of MPC type “Explicit”
#
# Before running this session file, run fem2.ses
# to create fem2.db. The fem2.db contains 32
# Quad elements, 1 MPC(with 3 Sub-MPCs and 2
# LBCs.
#
# 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_valid_dofs_f_mpc_type()
# has the following arguments:
#
# db_count_valid_dofs_f_mpc_type
# ( mpc_type_id,
# num_dofs )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_mpc_type_name[16]
INTEGER i_mpc_type_id
INTEGER i_num_dofs
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem2.db
uil_file_open.go(“fem2.db”)

# Get the ID of the MPC type “Explicit”


s_mpc_type_name = “Explicit”
i_return_value = @
db_get_mpc_type_id @
( s_mpc_type_name, @
i_mpc_type_id )
dump i_mpc_type_id

# Get the number of Valid Degree Of Freedoms for MPC type “Explicit”
i_return_value = @
db_count_valid_dofs_f_mpc_type @
( i_mpc_type_id, @
i_num_dofs )
dump i_return_value

# Valid DOFs for MPC type “Explicit” is


dump i_num_dofs
#---------------------------------------------------------------------

db_count_valid_mpc_types ()

# Purpose : This file provides an example of a call to the


# function db_count_valid_mpc_types()
#
# This file opens fem2.db and calls the function
# to get the number of valid MPC type ids.
#
Main Index
1142
Code Examples

# Before running this session file, run fem2.ses


# to create fem2.db. The fem2.db contains 32
# Quad elements, 1 MPC(with 3 Sub-MPCs and 2
# LBCs.
#
# 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_valid_mpc_types()
# has the following arguments:
# db_count_valid_mpc_types
# ( numtypes )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_numtypes
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem2.db
uil_file_open.go(“fem2.db”)

# Call the function to get the number of Valid MPC type ids.
#
i_return_value = @
db_count_valid_mpc_types @
( i_numtypes )
dump i_return_value

# The number of valid MPC type ids for the current analysis code and
# type is
dump i_numtypes
#---------------------------------------------------------------------

db_get_all_valid_dof_f_mpc_type ()

# Purpose : This file provides an example of a call to the


# function db_get_all_valid_dof_f_mpc_type()
#
# This file opens fem2.db and calls the function
# db_count_valid_dofs_f_mpc_type() to get the
# number of DOFs for the MPC type “Explicit”. It
# calls db_get_all_valid_dof_f_mpc_type() to get
# all the valid DOF. Then it calls the function
# db_get_nxt_valid_dof_f_mpc_type() to get the
# name and id of valid DOFs.
#
# Before running this session file, run fem2.ses
# to create fem2.db. The fem2.db contains 32
# Quad elements, 1 MPC(with 3 Sub-MPCs and 2
# LBCs.
#
# 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_valid_dof_f_mpc_type()
# has the following arguments:
# db_get_all_valid_dof_f_mpc_type
# ( mpc_type_id )
#---------------------------------------------------------------------
# Variable Declarations
STRING s_mpc_type_name[16]
Main Index
CHAPTER 8 1143
Finite Element Model

INTEGER i_num_dofs,i_count
INTEGER i_mpc_type_id
INTEGER i_dof_id
STRING s_dof_name[16]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem2.db
uil_file_open.go(“fem2.db”)

# Get the ID of the MPC type “Explicit”


s_mpc_type_name = “Explicit”
i_return_value = @
db_get_mpc_type_id @
( s_mpc_type_name, @
i_mpc_type_id )

# Get the number of Valid Degree Of Freedoms for MPC type “Explicit”
i_return_value = @
db_count_valid_dofs_f_mpc_type @
( i_mpc_type_id, @
i_num_dofs )

# Call the function to get all the valid DOF for the MPC type
# “Explicit”. This function should be called before the call
# to the function db_get_nxt_valid_dof_f_mpc_type().
#
i_return_value = @
db_get_all_valid_dof_f_mpc_type @
( i_mpc_type_id )
dump i_return_value

# Get the DOF ID and name for the MPC type “Explicit”
FOR ( i_count = 1 TO i_num_dofs )
i_return_value = @
db_get_nxt_valid_dof_f_mpc_type @
( i_mpc_type_id, @
i_dof_id, @
s_dof_name )
dump i_dof_id
dump s_dof_name
END FOR
#---------------------------------------------------------------------

db_get_all_valid_mpc_type ()

# Purpose : This file provides an example of a call to the


# function db_get_all_valid_mpc_type()
#
# This file opens fem2.db and calls the function
# db_count_valid_mpc_types() to get the number
# of valid MPC types. Then it calls db_get_all_
# valid_mpc_type() to make available all the
# valid MPC types. Function db_get_next_valid_
# mpc_type() is called to get the MPC type ID
# and name.
#
# Before running this session file, run fem2.ses
# to create fem2.db. The fem2.db contains 32
# Quad elements, 1 MPC(with 3 Sub-MPCs and 2
# LBCs.
#
# 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.
Main Index
1144
Code Examples

#
# The function db_get_all_valid_mpc_type() has no arguments.
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_numtypes, i_count
INTEGER i_mpc_type_id
STRING s_mpc_type_name[16]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem2.db
uil_file_open.go(“fem2.db”)

# Get the number of valid mpc types for the default analysis type
# and code.
i_return_value = @
db_count_valid_mpc_types @
( i_numtypes )

# Get all the valid MPC types in the database


#
i_return_value = @
db_get_all_valid_mpc_type()
dump i_return_value

FOR ( i_count = 1 TO i_numtypes )


i_return_value = @
db_get_next_valid_mpc_type @
( i_mpc_type_id, @
s_mpc_type_name )
dump i_mpc_type_id
dump s_mpc_type_name
END FOR
#---------------------------------------------------------------------

db_get_dep_nodes_in_sub_mpc ()

# Purpose : This file provides an example of a call to the


# function db_get_dep_nodes_in_sub_mpc()
#
# This file opens fem2.db and calls the
# functions to get the first MPC ID, first
# Sub-MPC ID in the first MPC and the maximum
# number of nodes associated to the MPCs.
# Then it calls the function to get the IDs of
# the dependent nodes in the first Sub-MPC.
#
# Before running this session file, run fem2.ses
# to create fem2.db. The fem2.db contains 32
# Quad elements, 1 MPC(with 3 Sub-MPCs and 2
# LBCs.
#
# 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_dep_nodes_in_sub_mpc()
# has the following arguments:
# db_get_dep_nodes_in_sub_mpc
# ( mpc_id,
# sub_mpc_id,
# maxnode,
# nnode,
# nid )
#
Main Index
CHAPTER 8 1145
Finite Element Model

#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_num_mpcs
INTEGER ia_mpc_ids(8)
INTEGER iv_id_symbol(VIRTUAL)
INTEGER i_mpc_id
INTEGER i_sub_mpc_id
INTEGER i_maxnode
INTEGER i_nnode
INTEGER ia_nid(8)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem2.db
uil_file_open.go(“fem2.db”)

# Count the number of MPCs in the database


i_return_value = @
db_count_mpcs @
( i_num_mpcs )

# Get the MPC ids


i_return_value = @
db_get_mpc_ids @
( i_num_mpcs, @
ia_mpc_ids )

i_mpc_id = ia_mpc_ids(1)

# Get all the SUB MPCs.


i_return_value = @
db_get_all_sub_mpc @
( i_mpc_id )

# Get the first Sub MPC ID


i_return_value = @
db_get_next_sub_mpc @
( i_mpc_id, @
i_sub_mpc_id )

# Get the Maximum number of nodes which may be returned for the
# Sub-MPC
i_return_value = @
fem_get_mpc_assoc_nodes @
( i_num_mpcs, @
ia_mpc_ids, @
i_maxnode, @
iv_id_symbol )

# Call the function to get the dependent nodes in first Sub MPC.
i_return_value = @
db_get_dep_nodes_in_sub_mpc @
( i_mpc_id, @
i_sub_mpc_id, @
i_maxnode, @
i_nnode, @
ia_nid )
dump i_return_value

# The number of nodes using the Sub-MPC


dump i_nnode
# IDs of the dependent nodes for the Sub-MPC
dump ia_nid

sys_free_array( iv_id_symbol )
#---------------------------------------------------------------------

Main Index
1146
Code Examples

db_get_dof_id ()

# Purpose : This file provides an example of a call to the


# function db_get_dof_id()
#
# This file opens fem2.db and calls the function
# to get the ID of the DOF “UX”.
#
# Before running this session file, run fem2.ses
# to create fem2.db. The fem2.db contains 32
# Quad elements, 1 MPC(with 3 Sub-MPCs and 2
# LBCs.
#
# 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_dof_id() has the following arguments:
# db_get_dof_id
# ( dof_name,
# dof_id )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_dof_name[16]
INTEGER i_dof_id
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem2.db
uil_file_open.go(“fem2.db”)

# Call the function to get the ID of DOF “UX”. List of the available
# DOF can be referred in Chapter 7 of MSC.Patran Users Manual Vol 4.
#
s_dof_name = “UX”

i_return_value = @
db_get_dof_id @
( s_dof_name, @
i_dof_id )
dump i_return_value

# Id of DOF “UX” is
dump i_dof_id
#---------------------------------------------------------------------

db_get_dof_name ()

# Purpose : This file provides an example of a call to the


# function db_get_dof_name()
#
# This file opens fem2.db and calls the function
# to get the name of DOF whose ID is 7
#
# Before running this session file, run fem2.ses
# to create fem2.db. The fem2.db contains 32
# Quad elements, 1 MPC(with 3 Sub-MPCs and 2
# LBCs.
#
# This file can be run by starting a session of
# MSC.Patran and running this session file
# through the “File”,”Session”,”Play” pulldown
Main Index
CHAPTER 8 1147
Finite Element Model

# menus on the menu bar.


#
# The function db_get_dof_name() has the following arguments:
# db_get_dof_name
# ( dof_id,
# dof_name )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_dof_id
STRING s_dof_name[128]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem2.db
uil_file_open.go(“fem2.db”)

# Call the function to get the name of DOF whose ID is 7.


# List containing DOF and their IDs can be referred in Chapter 7 of
# MSC.Patran Users Manual Volume 4
#
i_dof_id = 7

i_return_value = @
db_get_dof_name @
( i_dof_id, @
s_dof_name )
dump i_return_value

# The name of the DOF whose ID is 7


dump s_dof_name
#---------------------------------------------------------------------

db_get_elem_config_ntl ()

# Purpose : This file provides an example of a call to the


# function db_get_elem_config_ntl()
#
# This file opens fem1.db and calls the function
# db_get_region_definition() to get the various
# IDs stored in the default configuration code.
# Then it calls db_get_elem_config_ntl() to get
# the ID of the default configuration.
#
# Before running this session file, run fem1.ses
# to create fem1.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_elem_config_ntl() has the following
# arguments:
# db_get_elem_config_ntl
# ( atid,
# acid,
# geopcd,
# copcd,
# fopcd,
# lopcd,
# etopcd,
# dofsetid,
# matlcode,
# matdcode,
# config )
Main Index
1148
Code Examples

#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_set_name[32]
INTEGER i_num_region
INTEGER ia_region_ids(1)
INTEGER i_gener_elem_type
INTEGER i_lay_id
INTEGER i_mat_dir
INTEGER i_atid
INTEGER i_acid
INTEGER i_geopcd
INTEGER i_copcd
INTEGER i_fopcd
INTEGER i_lopcd
INTEGER i_etopcd
INTEGER i_dofsetid
INTEGER i_matlcode
INTEGER i_matdcode
INTEGER i_config
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem1.db
uil_file_open.go(“fem1.db”)

# To get the ids of the different parameters, call the function


# db_get_region_definition().

# Get number of regions.


db_count_region_ids(i_num_region)

# Get IDs of all the regions.


db_get_all_region_ids(i_num_region, ia_region_ids)

i_return_value = @
db_get_region_definition @
( ia_region_ids(1), @
s_set_name, @
i_gener_elem_type, @
i_dofsetid, @
i_copcd, @
i_geopcd, @
i_fopcd, @
i_lopcd, @
i_lay_id, @
i_matlcode, @
i_matdcode, @
i_mat_dir )
#---------------------------------------------------------------------
# Call the function to get the ID of the associated configuration
# IDs of the Analysis Type and Code can be referred from Chapter 7
# of MSC.Patran User Manual, Volume 4. IDs of the Element topology
# can be referred from Chapter 9 of the same Manual.
#
i_atid = 1 /* for Analysis type “Structural Analysis” */
i_acid = 1 /* for Analysis Code “MSC.Nastran” */
i_etopcd = 28 /* for “Hex8” element */

i_return_value = @
db_get_elem_config_ntl @
( i_atid, @
i_acid, @
i_geopcd, @
i_copcd, @
i_fopcd, @
i_lopcd, @
i_etopcd, @
Main Index
CHAPTER 8 1149
Finite Element Model

i_dofsetid, @
i_matlcode, @
i_matdcode, @
i_config )
dump i_return_value
dump i_config
#---------------------------------------------------------------------

db_get_elem_dimens ()

# Purpose : This file provides an example of a call to the


# function db_get_elem_dimens()
#
# This file opens fem1.db and calls the function
# to get the element dimensionality of topology
# id 28 (i.e.) Hex8.
#
# Before running this session file, run fem1.ses
# to create fem1.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_elem_dimens() has the following arguments:
# db_get_elem_dimens
# ( top_id,
# dimen )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_top_id
INTEGER i_dimen
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem1.db
uil_file_open.go(“fem1.db”)

# Get the element dimensionality of Hex8 element (Topology ID 28).


#
i_top_id = 28

i_return_value = @
db_get_elem_dimens @
( i_top_id, @
i_dimen )
dump i_return_value

# The element Dimensionality of Topology Id 28 is


dump i_dimen
#---------------------------------------------------------------------

db_get_elem_for_geo_type_and_id ()

# Purpose : This file provides an example of a call to the


# function db_get_elem_for_geo_type_and_id()
#
# This file opens fem1.db and calls the function
# to get all the element ID’s having geometry
# type SOLID and ID 1.
#
# Before running this session file, run fem1.ses
Main Index
1150
Code Examples

# to create fem1.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_elem_for_geo_type_and_id()
# has the following arguments:
# db_get_elem_for_geo_type_and_id
# ( geo_type,
# geo_id,
# nbr_of_elements,
# element )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_geo_type
INTEGER i_geo_id
INTEGER i_nbr_of_elements
INTEGER ia_element(16)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem1.db
uil_file_open.go(“fem1.db”)

# Get the element IDs that have geometry type “SOLID” and geometry
# ID 1
#
i_geo_type = 4 /* for SOLID from dbtypes.h */
i_geo_id = 1
i_nbr_of_elements = 16

i_return_value = @
db_get_elem_for_geo_type_and_id @
( i_geo_type, @
i_geo_id, @
i_nbr_of_elements, @
ia_element )
dump i_return_value

# Array of element ids :


dump ia_element
#---------------------------------------------------------------------

db_get_elem_nodes ()

# Purpose : This file provides an example of a call to the


# function db_get_elem_nodes()
#
# This file opens fem3.db and calls the function
# to retrieve the node IDs associated with
# Element 1.
#
# Before running this session file, run fem3.ses
# to create fem3.db. The fem3.db contains 9
# Quad elements, 2 LBCs, 1 MPC, 21 nodes , a
# surface and 2 lines on that surface. It also
# contains 2 groups.
#
# 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.
#
Main Index
CHAPTER 8 1151
Finite Element Model

# The function db_get_elem_nodes() has the following arguments:


# db_get_elem_nodes
# ( eid,
# numnode,
# nid )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_eid
INTEGER i_numnode
INTEGER ia_nid(4)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem3.db
uil_file_open.go(“fem3.db”)

# Call the function to retrieve the node IDs associated with


# Element 1
#
i_eid = 1

i_return_value = @
db_get_elem_nodes @
( i_eid, @
i_numnode, @
ia_nid )
dump i_return_value

# The number of nodes associated with Element 1


dump i_numnode
# The Node IDs associated with Element 1
dump ia_nid
#---------------------------------------------------------------------

db_get_elem_shape_for_id ()

# Purpose : This file provides an example of a call to the


# function db_get_elem_shape_for_id()
#
# This file opens fem1.db and calls the function
# to get shape codes for element 1 and 2.
#
# Before running this session file, run fem1.ses
# to create fem1.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_elem_shape_for_id()
# has the following arguments:
# db_get_elem_shape_for_id
# ( nelem,
# eid,
# shape )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_nelem
INTEGER ia_eid(2)
INTEGER ia_shape(2)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem1.db
Main Index
1152
Code Examples

uil_file_open.go(“fem1.db”)

# Get the shape code for Element 1 and 2


#
i_nelem = 2
ia_eid = [1,2]

i_return_value = @
db_get_elem_shape_for_id @
( i_nelem, @
ia_eid, @
ia_shape )
dump i_return_value

# The array of shape codes is


dump ia_shape
#---------------------------------------------------------------------

db_get_elem_top_name ()

# Purpose : This file provides an example of a call to the


# function db_get_elem_top_name()
#
# This file opens fem1.db and calls the function
# to get the name of the topology ID 28.
#
# Before running this session file, run fem1.ses
# to create fem1.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_elem_top_name() has the following arguments:
# db_get_elem_top_name
# ( id,
# name )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_id
STRING s_name[128]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem1.db
uil_file_open.go(“fem1.db”)

# Get the element topology name of Hex8 (i.e.) topology id = 28


i_id = 28

i_return_value = @
db_get_elem_top_name @
( i_id, @
s_name )
dump i_return_value

# The topology name is


dump s_name
#---------------------------------------------------------------------

Main Index
CHAPTER 8 1153
Finite Element Model

db_get_elem_topology_codes ()

# Purpose : This file provides an example of a call to the


# function db_get_elem_topology_codes()
#
# This file opens fem1.db and calls the function
# to get the element topology IDs defined in the
# database.
#
# Before running this session file, run fem1.ses
# to create fem1.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_elem_topology_codes()
# has the following arguments:
# db_get_elem_topology_codes
# ( ntop,
# top )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_ntop
INTEGER ia_top(64)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem1.db
uil_file_open.go(“fem1.db”)

# Get the number of element topologies defined in the database.


db_count_elem_topology_codes(i_ntop)

# Call the function to get the IDs of these topologies


#
i_return_value = @
db_get_elem_topology_codes @
( i_ntop, @
ia_top )
dump i_return_value

# Array of element topology IDs is


dump ia_top
#---------------------------------------------------------------------

db_get_elem_topos_for_geom ()

# Purpose : This file provides an example of a call to the


# function db_get_elem_topos_for_geom()
#
# This file opens fem1.db and calls the function
# to get the topology IDs in use for geometry
# type SOLID and ID 1.
#
# Before running this session file, run fem1.ses
# to create fem1.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.
Main Index
1154
Code Examples

#
# The function db_get_elem_topos_for_geom()
# has the following arguments:
# db_get_elem_topos_for_geom
# ( geo_id,
# geo_type,
# n_tops,
# top_ids )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_geo_id
INTEGER i_geo_type
INTEGER i_n_tops
INTEGER ia_top_ids(8)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem1.db
uil_file_open.go(“fem1.db”)

# Get the Topology IDs currently in use that match geometry type
# SOLID and geometry ID 1
#
i_geo_type = 4 /* for SOLID from dbtypes.h */
i_geo_id = 1

i_return_value = @
db_get_elem_topos_for_geom @
( i_geo_id, @
i_geo_type, @
i_n_tops, @
ia_top_ids )
dump i_return_value

# Number of topologies found


dump i_n_tops
# Array of topology IDs
dump ia_top_ids
#---------------------------------------------------------------------

db_get_elem_verification_parms ()

# Purpose : This file provides an example of a call to the


# function db_get_elem_verification_parms()
#
# In this file, the threshold value of aspect
# ratio(triangular element) for “MSC.Nastran”
# is retrived.
#
# Before running this session file, run fem1.ses
# to create fem1.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_elem_verification_parms()
# has the following arguments:
# db_get_elem_verification_parms
# ( analysis_code_name,
# test_id,
# threshold )
#
#---------------------------------------------------------------------
Main Index
CHAPTER 8 1155
Finite Element Model

# Variable Declarations
STRING s_analysis_code_name[128]
INTEGER i_test_id
REAL r_threshold
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem1.db
uil_file_open.go(“fem1.db”)

# Get the threshold value of aspect ratio for “MSC.Nastran”


#
s_analysis_code_name = “MSC.Nastran”

# Test id of aspect ratio is 1 ( Refer section 7.11 of Chapter 7 of


# MSC.Patran USERs MANUAL, Volume 4 )
i_test_id = 1

i_return_value = @
db_get_elem_verification_parms @
( s_analysis_code_name, @
i_test_id, @
r_threshold )
dump i_return_value

# The threshold value is


dump r_threshold
#---------------------------------------------------------------------

db_get_elems ()

# Purpose : This file provides an example of a call to the


# function db_get_elems()
#
# This file opens fem1.db and calls the function
# to get all information about element 1 and 2.
# fem1.db contains 16 elements.
#
# Before running this session file, run fem1.ses
# to create fem1.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_elems() has the following arguments:
# db_get_elems
# ( nelem,
# maxnode,
# eid,
# etop,
# gtype,
# gid,
# econ )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_nelem
INTEGER i_maxnode
INTEGER ia_eid(2)
INTEGER ia_etop(2)
INTEGER ia_gtype(2)
INTEGER ia_gid(2)
INTEGER ia_econ(2, 8)
INTEGER i_return_value
Main Index
1156
Code Examples

#---------------------------------------------------------------------
# Open the database “fem1.db”
uil_file_open.go(“fem1.db”)

# Get the information of the element 1 and 2.


i_nelem = 2
i_maxnode = 8
ia_eid = [1,2]

i_return_value = @
db_get_elems @
( i_nelem, @
i_maxnode, @
ia_eid, @
ia_etop, @
ia_gtype, @
ia_gid, @
ia_econ )
dump i_return_value

# The element topology array is


dump ia_etop
# Associated geometry array is
dump ia_gtype
# Associated geometry IDs array is
dump ia_gid
# Array of node ids belong to each element
dump ia_econ
#---------------------------------------------------------------------

db_get_elems_by_lbc ()

# Purpose : This file provides an example of a call to the


# function db_get_elems_by_lbc()
#
# This file opens fem1.db and calls the function
# to get all the elements associated with
# “new_load”. fem1.db contains 16 elements and
# two lbc’s.
#
# Before running this session file, run fem1.ses
# to create fem1.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_elems_by_lbc()
# has the following arguments:
#
# db_get_elems_by_lbc
# ( lbc_id,
# max_elem,
# nelem,
# eid )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_lbc_id
INTEGER i_max_elem
INTEGER i_nelem
INTEGER ia_eid(8)
INTEGER i_return_value
#---------------------------------------------------------------------
Main Index
CHAPTER 8 1157
Finite Element Model

# Open the database fem1.db


uil_file_open.go(“fem1.db”)

# Get the id of the lbc “elem_lbc”


db_get_lbc_id(“new_load”, i_lbc_id)
dump i_lbc_id

# Call the function to get the number of elements and their ids
# associated with the lbc “new_load”

i_max_elem = 8

i_return_value = @
db_get_elems_by_lbc @
( i_lbc_id, @
i_max_elem, @
i_nelem, @
ia_eid )
dump i_return_value

# Number of elements found associated with “new_load”


dump i_nelem
# Ids of the elements associated to “new_load”
dump ia_eid
#---------------------------------------------------------------------

db_get_elems_using_nodes ()

# Purpose : This file provides an example of a call to the


# function db_get_elems_using_nodes()
#
# This file opens fem3.db and calls the function
# to retrieve the list of elements associated
# with Nodes 1:16
#
# Before running this session file, run fem3.ses
# to create fem3.db. The fem3.db contains 9
# Quad elements, 2 LBCs, 1 MPC, 21 nodes , a
# surface and 2 lines on that surface. It also
# contains 2 groups.
#
# 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_elems_using_nodes() has the following
# arguments:
# db_get_elems_using_nodes
# ( nnode,
# nid,
# mxelem,
# nelem,
# eid )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_nnode
INTEGER ia_nid(16)
INTEGER i_mxelem
INTEGER ia_nelem(16)
INTEGER ia_eid(64)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem3.db
Main Index
1158
Code Examples

uil_file_open.go(“fem3.db”)

# Call the function to retrieve the list of elements associated with


# Nodes 1:16 in the database.
#
i_nnode = 16
ia_nid = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]
i_mxelem = 4

i_return_value = @
db_get_elems_using_nodes @
( i_nnode, @
ia_nid, @
i_mxelem, @
ia_nelem, @
ia_eid )
dump i_return_value

# Number of elements associated with the Nodes 1:16


dump ia_nelem
# Ids of all the elements referencing Nodes 1:16
dump ia_eid
#---------------------------------------------------------------------

db_get_etop_for_a_code ()

# Purpose : This file provides an example of a call to the


# function db_get_etop_for_a_code()
#
# This function retrieves a set of element
# topology ids based on the analysis code and
# type.This file opens a new database “new.db”
# and gets the element topology ids for the
# analysis code MSC.Nastran and analysis type
# STRUCTURAL.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_etop_for_a_code()
# has the following arguments:
#
# db_get_etop_for_a_code
# ( acid,
# atid,
# count,
# etids )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_acid
INTEGER i_atid
INTEGER i_count
INTEGER iv_etids(VIRTUAL)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# i_acid = 1 ( Analysis code is MSC.Nastran )


i_acid = 1
# i_atid = 1 ( Analysis type is STRUCTURAL )
Main Index
CHAPTER 8 1159
Finite Element Model

i_atid = 1

db_count_etop_for_a_code @
( i_acid, @
i_atid, @
i_count )

SYS_ALLOCATE_ARRAY(iv_etids,1,i_count)

i_return_value = @
db_get_etop_for_a_code @
( i_acid, @
i_atid, @
i_count, @
iv_etids )
dump i_return_value

# The element topology ids for analysis code MSC.Nastran


# and analysis type STRUCTURAL are
dump iv_etids
SYS_FREE_ARRAY(iv_etids)
#---------------------------------------------------------------------

db_get_indep_nodes_in_sub_mpc ()

# Purpose : This file provides an example of a call to the


# function db_get_indep_nodes_in_sub_mpc()
#
# This file opens fem2.db and calls the
# functions to get the first MPC ID, first
# Sub-MPC ID in the first MPC and the maximum
# number of nodes associated to the MPCs.
# Then it calls the function to get the IDs of
# the independent nodes in the first Sub-MPC.
#
# Before running this session file, run fem2.ses
# to create fem2.db. The fem2.db contains 32
# Quad elements, 1 MPC(with 3 Sub-MPCs and 2
# LBCs.
#
# 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_indep_nodes_in_sub_mpc()
# has the following arguments:
# db_get_indep_nodes_in_sub_mpc
# ( mpc_id,
# sub_mpc_id,
# maxnode,
# nnode,
# nid )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_num_mpcs
INTEGER ia_mpc_ids(8)
INTEGER iv_id_symbol(VIRTUAL)
INTEGER i_mpc_id
INTEGER i_sub_mpc_id
INTEGER i_maxnode
INTEGER i_nnode
INTEGER ia_nid(8)
INTEGER i_return_value
Main Index
1160
Code Examples

#---------------------------------------------------------------------
# Open the database fem2.db
uil_file_open.go(“fem2.db”)

# Count the number of MPCs in the database


i_return_value = @
db_count_mpcs @
( i_num_mpcs )

# Get the MPC ids


i_return_value = @
db_get_mpc_ids @
( i_num_mpcs, @
ia_mpc_ids )

i_mpc_id = ia_mpc_ids(1)

# Get all the SUB MPCs.


i_return_value = @
db_get_all_sub_mpc @
( i_mpc_id )

# Get the first Sub MPC ID


i_return_value = @
db_get_next_sub_mpc @
( i_mpc_id, @
i_sub_mpc_id )

# Get the Maximum number of nodes which may be returned for the
# Sub-MPC
i_return_value = @
fem_get_mpc_assoc_nodes @
( i_num_mpcs, @
ia_mpc_ids, @
i_maxnode, @
iv_id_symbol )

# Call the function to get the independent nodes in first Sub MPC.
i_return_value = @
db_get_indep_nodes_in_sub_mpc @
( i_mpc_id, @
i_sub_mpc_id, @
i_maxnode, @
i_nnode, @
ia_nid )
dump i_return_value

# The number of nodes using the Sub-MPC


dump i_nnode
# IDs of the independent nodes for the Sub-MPC
dump ia_nid

sys_free_array( iv_id_symbol )
#---------------------------------------------------------------------

db_get_max_elem_id ()

# Purpose : This file provides an example of a call to the


# function db_get_max_elem_id()
#
# This file opens fem1.db and calls the function
# to get maximum element id. fem1.db contains
# 16 elements.
#
# Before running this session file, run fem1.ses
Main Index
CHAPTER 8 1161
Finite Element Model

# to create fem1.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_elem_id() has the following arguments:
# db_get_max_elem_id
# ( id )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_id
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem1.db
uil_file_open.go(“fem1.db”)

i_return_value = @
db_get_max_elem_id @
( i_id )
dump i_return_value

# The Maximum element id in use is


dump i_id
#---------------------------------------------------------------------

db_get_max_node_id ()

# Purpose : This file provides an example of a call to the


# function db_get_max_node_id()
#
# This file opens fem3.db and calls the function
# to get the Largest Node Id in the database.
#
# Before running this session file, run fem3.ses
# to create fem3.db. The fem3.db contains 9
# Quad elements, 2 LBCs, 1 MPC, 21 nodes , a
# surface and 2 lines on that surface. It also
# contains 2 groups.
#
# 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_node_id() has the following arguments:
# db_get_max_node_id
# ( id )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_id
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem3.db
uil_file_open.go(“fem3.db”)

# Call the function to get the Largest Node ID


#
i_return_value = @
db_get_max_node_id @
( i_id )
dump i_return_value
Main Index
1162
Code Examples

# The largest Node ID is


dump i_id
#---------------------------------------------------------------------

db_get_mesh_params

# Purpose : This file provides an example of a call to the


# function db_get_mesh_params()
#
# This file opens fem3.db and calls the function
# to get the definition of an edge mesh.
#
# Before running this session file, run fem3.ses
# to create fem3.db. The fem3.db contains 9
# Quad elements, 2 LBCs, 1 MPC, 21 nodes , a
# surface and 2 lines on that surface. It also
# contains 2 groups.
#
# 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_mesh_params() has the following arguments:
# db_get_mesh_params
# ( wmesh,
# mshcyc,
# relaxm,
# tolmsh,
# dgmesh,
# itrngl )
#
#---------------------------------------------------------------------
# Variable Declarations
REAL r_wmesh
INTEGER i_mshcyc
REAL r_relaxm
REAL r_tolmsh
INTEGER i_dgmesh
INTEGER i_itrngl
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem3.db
uil_file_open.go(“fem3.db”)

# Call the function to get the definition of an edge mesh from the
# database
#
i_return_value = @
db_get_mesh_params @
( r_wmesh, @
i_mshcyc, @
r_relaxm, @
r_tolmsh, @
i_dgmesh, @
i_itrngl )
dump i_return_value

# The unique internal line identifying the mesh to be retrieved


dump r_wmesh
# The number of elements on the edge
dump i_mshcyc
# The mesh relaxm of the edge
dump r_relaxm
Main Index
CHAPTER 8 1163
Finite Element Model

# The tolmsh of the edge


dump r_tolmsh
# The number of meshes on the edge
dump i_dgmesh
# True if the edge has been itrngled
dump i_itrngl
#---------------------------------------------------------------------

db_get_min_elem_id ()

# Purpose : This file provides an example of a call to the


# function db_get_min_elem_id()
#
# This file opens fem1.db and calls the function
# to get minimum element id. fem1.db contains
# 16 elements. Id 1 is the minimum id.
#
# Before running this session file, run fem1.ses
# to create fem1.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_elem_id()
# has the following arguments:
#
# db_get_min_elem_id
# ( id )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_id
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem1.db
uil_file_open.go(“fem1.db”)
#
i_return_value = @
db_get_min_elem_id @
( i_id )
dump i_return_value
# Minimum element id in use is
dump i_id
#---------------------------------------------------------------------

db_get_min_node_id ()

# Purpose : This file provides an example of a call to the


# function db_get_min_node_id()
#
# This file opens fem3.db and calls the function
# to get the smallest Node ID in the database.
#
# Before running this session file, run fem3.ses
# to create fem3.db. The fem3.db contains 9
# Quad elements, 2 LBCs, 1 MPC, 21 nodes , a
# surface and 2 lines on that surface. It also
# contains 2 groups.
#
# This file can be run by starting a session of
# MSC.Patran and running this session file
Main Index
1164
Code Examples

# through the “File”,”Session”,”Play” pulldown


# menus on the menu bar.
#
# The function db_get_min_node_id() has the following arguments:
# db_get_min_node_id
# ( id )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_id
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem3.db
uil_file_open.go(“fem3.db”)

# Call the function to get the smallest ID of the Nodes in the


# database.
#
i_return_value = @
db_get_min_node_id @
( i_id )
dump i_return_value

# The smallest Node ID is


dump i_id
#---------------------------------------------------------------------

db_get_mpc_type_id ()

# Purpose : This file provides an example of a call to the


# function db_get_mpc_type_id()
#
# This file opens fem2.db and calls the function
# to get the id of MPC type “Explicit”
#
# Before running this session file, run fem2.ses
# to create fem2.db. The fem2.db contains 32
# Quad elements, 1 MPC(with 3 Sub-MPCs and 2
# LBCs.
#
# 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_mpc_type_id() has the following arguments:
# db_get_mpc_type_id
# ( mpc_type_name,
# mpc_type_id )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_mpc_type_name[128]
INTEGER i_mpc_type_id
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem2.db
uil_file_open.go(“fem2.db”)

# Get the ID of the MPC type “Explicit”


# List of MPCs and their IDs can be referred in Chapter 7 of
# MSC.Patran Users Manual, Volume 4.
#
s_mpc_type_name = “Explicit”
Main Index
CHAPTER 8 1165
Finite Element Model

i_return_value = @
db_get_mpc_type_id @
( s_mpc_type_name, @
i_mpc_type_id )
dump i_return_value

# The ID of the MPC type “Explicit” is


dump i_mpc_type_id
#---------------------------------------------------------------------

db_get_mpc_type_name ()

# Purpose : This file provides an example of a call to the


# function db_get_mpc_type_name()
#
# This file opens fem2.db and calls the function
# to get the name of the MPC type whose ID is 1.
#
# Before running this session file, run fem2.ses
# to create fem2.db. The fem2.db contains 32
# Quad elements, 1 MPC(with 3 Sub-MPCs and 2
# LBCs.
#
# 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.
#
# This file can be run by starting a session of
# MSC.Patran, opening a new or existing database,
# and running this session file through the
# “File”,”Session”,”Play” pulldown menus
# on the menu bar.
#
# The function db_get_mpc_type_name()
# has the following arguments:
#
# db_get_mpc_type_name
# ( mpc_type_id,
# mpc_type_name )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_mpc_type_id
STRING s_mpc_type_name[128]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem2.db
uil_file_open.go(“fem2.db”)

# Call the function to get the name of MPC type whose ID is 1.


# List of MPC types and the IDs can be referred in Chapter 7 of
# MSC.Patran Users Manual, Volume 4.
#
i_mpc_type_id = 1

i_return_value = @
db_get_mpc_type_name @
( i_mpc_type_id, @
s_mpc_type_name )
dump i_return_value

# The name of the MPC Type is


dump s_mpc_type_name
#---------------------------------------------------------------------
Main Index
1166
Code Examples

db_get_next_elem_id ()

# Purpose : This file provides an example of a call to the


# function db_get_next_elem_id()
#
# This file opens fem1.db and calls the function
# to get the next available element id. The
# fem1.db contains 16 elements.
#
# Before running this session file, run fem1.ses
# to create fem1.db
#
# This file can be run by starting a session of
# MSC.Patran and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_next_elem_id()
# has the following arguments:
# db_get_next_elem_id
# ( id )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_id
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem1.db
uil_file_open.go(“fem1.db”)

i_return_value = @
db_get_next_elem_id @
( i_id )
dump i_return_value

# The next element id available is


dump i_id

#---------------------------------------------------------------------

db_get_next_mpc_id ()

# Purpose : This file provides an example of a call to the


# function db_get_next_mpc_id()
#
# This file opens fem2.db and calls the function
# to get the next available mpc id.
#
# Before running this session file, run fem2.ses
# to create fem2.db. The fem2.db contains 32
# Quad elements, 1 MPC(with 3 Sub-MPCs) and 2
# LBCs.
#
# 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_mpc_id()
# has the following arguments:
#
# db_get_next_mpc_id
# ( next_id )
Main Index
CHAPTER 8 1167
Finite Element Model

#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_next_id
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem2.db
uil_file_open.go(“fem2.db”)

# Call the function to get the next mpc id


#
i_return_value = @
db_get_next_mpc_id @
( i_next_id )
dump i_return_value
# The next MPC Id is
dump i_next_id
#---------------------------------------------------------------------

db_get_next_node_id ()

# Purpose : This file provides an example of a call to the


# function db_get_next_node_id()
#
# This file opens fem3.db and calls the function
# to get the next available node id.
#
# Before running this session file, run fem3.ses
# to create fem3.db. The fem3.db contains 9
# Quad elements, 2 LBCs, 1 MPC, 21 nodes , a
# surface and 2 lines on that surface. It also
# contains 2 groups.
#
# 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_node_id() has the following arguments:
# db_get_next_node_id
# ( id )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_id
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem3.db
uil_file_open.go(“fem3.db”)

# Call the function db_get_max_node_id() to get the Largest Node Id


i_return_value = @
db_get_max_node_id (i_id)

# Largest Node ID is
dump i_id

# Call the function to get the next available Node ID.


#
i_return_value = @
db_get_next_node_id @
( i_id )
dump i_return_value

# Next available Node ID is


Main Index
1168
Code Examples

dump i_id
#---------------------------------------------------------------------

db_get_next_valid_mpc_type ()

# Purpose : This file provides an example of a call to the


# function db_get_next_valid_mpc_type()
#
# This file opens fem2.db and calls the function
# db_count_valid_mpc_types() to get the number
# of valid MPC types. Then it calls db_get_all_
# valid_mpc_type() to make available all the
# valid MPC types. Function db_get_next_valid_
# mpc_type() is called to get the MPC type ID
# and name.
#
# Before running this session file, run fem2.ses
# to create fem2.db. The fem2.db contains 32
# Quad elements, 1 MPC(with 3 Sub-MPCs and 2
# LBCs.
#
# 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_valid_mpc_type() has the following
# arguments.
# db_get_next_valid_mpc_type
# ( mpc_type_id,
# mpc_type_name )
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_numtypes, i_count
INTEGER i_mpc_type_id
STRING s_mpc_type_name[16]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem2.db
uil_file_open.go(“fem2.db”)

# Get the number of valid mpc types for the default analysis type
# and code.
i_return_value = @
db_count_valid_mpc_types @
( i_numtypes )

# Get all the valid MPC types in the database


#
i_return_value = @
db_get_all_valid_mpc_type()
dump i_return_value

FOR ( i_count = 1 TO i_numtypes )


i_return_value = @
db_get_next_valid_mpc_type @
( i_mpc_type_id, @
s_mpc_type_name )
dump i_return_value
dump i_mpc_type_id
dump s_mpc_type_name
END FOR
#---------------------------------------------------------------------

Main Index
CHAPTER 8 1169
Finite Element Model

db_get_nodal_association ()

# Purpose : This file provides an example of a call to the


# function db_get_nodal_association()
#
# This file opens fem3.db and calls the function
# to get the array of geometry IDs and Types
# associated with nodes 1:16.
#
# Before running this session file, run fem3.ses
# to create fem3.db. The fem3.db contains 9
# Quad elements, 2 LBCs, 1 MPC, 21 nodes , a
# surface and 2 lines on that surface. It also
# contains 2 groups.
#
# 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_nodal_association()
# has the following arguments:
#
# db_get_nodal_association
# ( nnode,
# nid,
# gid,
# gtype )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_nnode
INTEGER ia_nid(16)
INTEGER ia_gid(16)
INTEGER ia_gtype(16)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem3.db
uil_file_open.go(“fem3.db”)

# Call the function to get the array of Geometry IDs and Geometry
# Types of Node IDs 1:16
#
i_nnode = 16
ia_nid = [ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 ]

i_return_value = @
db_get_nodal_association @
( i_nnode, @
ia_nid, @
ia_gid, @
ia_gtype )
dump i_return_value

# IDs of the Geometry associated to Node 1:16 are


dump ia_gid
# Array of the Geometry types associated to Node 1:16 are
dump ia_gtype
#---------------------------------------------------------------------

Main Index
1170
Code Examples

db_get_node ()

# Purpose : This file provides an example of a call to the


# function db_get_node()
#
# This file opens fem3.db and calls the function
# to get the XYZ coordinates of Node Id 17.
#
# Before running this session file, run fem3.ses
# to create fem3.db. The fem3.db contains 9
# Quad elements, 2 LBCs, 1 MPC, 21 nodes , a
# surface and 2 lines on that surface. It also
# contains 2 groups.
#
# 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_node() has the following arguments:
# db_get_node
# ( id,
# xyz )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_id
REAL ra_xyz(3)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem3.db
uil_file_open.go(“fem3.db”)

# Call the function to get the coordinates of Node 17


#
i_id = 17

i_return_value = @
db_get_node @
( i_id, @
ra_xyz )
dump i_return_value

# Coordinates of Node 17 are


dump ra_xyz
#---------------------------------------------------------------------

db_get_nodes_by_lbc ()

# Purpose : This file provides an example of a call to the


# function db_get_nodes_by_lbc()
#
# This file opens fem3.db and calls the function
# to get the Nodes associated with LBC 1. There
# are two LBCs in the database with IDs 1 and 2.
#
# Before running this session file, run fem3.ses
# to create fem3.db. The fem3.db contains 9
# Quad elements, 2 LBCs, 1 MPC, 21 nodes , a
# surface and 2 lines on that surface. It also
# contains 2 groups.
#
# This file can be run by starting a session of
Main Index
CHAPTER 8 1171
Finite Element Model

# MSC.Patran and running this session file


# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_nodes_by_lbc() has the following arguments:
# db_get_nodes_by_lbc
# ( lbc_id,
# max_node,
# nnode,
# nid )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_lbc_id
INTEGER i_max_node
INTEGER i_nnode
INTEGER ia_nid(8)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem3.db
uil_file_open.go(“fem3.db”)

# Get the nodes associated with the LBC 1


#
i_lbc_id = 1
i_max_node = 8

i_return_value = @
db_get_nodes_by_lbc @
( i_lbc_id, @
i_max_node, @
i_nnode, @
ia_nid )
dump i_return_value

# Number of Nodes associated with LBC 1 is


dump i_nnode
# IDs of the Nodes associated with LBC 1
dump ia_nid
#---------------------------------------------------------------------

db_get_nodes_for_geometry ()

# Purpose : This file provides an example of a call to the


# function db_get_nodes_for_geometry()
#
# This file opens fem3.db and calls the function
# to get the number of nodes present in the
# Line 1 of Surface 1
#
# Before running this session file, run fem3.ses
# to create fem3.db. The fem3.db contains 9
# Quad elements, 2 LBCs, 1 MPC, 21 nodes , a
# surface and 2 lines on that surface. It also
# contains 2 groups.
#
# 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_nodes_for_geometry()
# has the following arguments:
#
# db_get_nodes_for_geometry
Main Index
1172
Code Examples

# ( geo_type,
# geo_id,
# parent_type,
# parent_id,
# nnode,
# nids,
# ncoord )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_geo_type
INTEGER i_geo_id
INTEGER i_parent_type
INTEGER i_parent_id
INTEGER i_nnode
INTEGER ia_nids(8)
REAL ra_ncoord(16)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem3.db
uil_file_open.go(“fem3.db”)

# Call the function to get the nodes associated with the geotype
# Curve with ID 1 of parent type Surface with ID 1. There 2 Curves
# associated to the Parent Surface 1 in the database.
#
i_geo_id = 1
i_geo_type = 2 /* for CURVE from dbtypes.h */
i_parent_id = 1
i_parent_type = 3 /* for SURFACE from dbtypes.h */

i_return_value = @
db_get_nodes_for_geometry @
( i_geo_type, @
i_geo_id, @
i_parent_type, @
i_parent_id, @
i_nnode, @
ia_nids, @
ra_ncoord )
dump i_return_value

# Number of nodes found


dump i_nnode
# IDs of the Nodes found
dump ia_nids
# Coordinates of the Nodes found
dump ra_ncoord
#---------------------------------------------------------------------

db_get_nodes_in_mpc ()

# Purpose : This file provides an example of a call to the


# function db_get_nodes_in_mpc()
#
# This file opens fem3.db and calls the function
# to retrieve all nodes associated with the MPCs
#
# Before running this session file, run fem3.ses
# to create fem3.db. The fem3.db contains 9
# Quad elements, 2 LBCs, 1 MPC, 21 nodes , a
# surface and 2 lines on that surface. It also
# contains 2 groups.
#
# This file can be run by starting a session of
Main Index
CHAPTER 8 1173
Finite Element Model

# MSC.Patran and running this session file


# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_nodes_in_mpc() has the following arguments:
#
# db_get_nodes_in_mpc
# ( nmpc,
# mpcid,
# mxnode,
# nnode,
# nid )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_nmpc
INTEGER ia_mpcid(2)
INTEGER i_mxnode
INTEGER ia_nnode(2)
INTEGER ia_nid(10)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem3.db
uil_file_open.go(“fem3.db”)

# Get the number of MPCs in the database


i_return_value = @
db_count_mpcs( i_nmpc )
dump i_return_value

# Get the IDs of the MPCs in the database


i_return_value = @
db_get_mpc_ids @
( i_nmpc, @
ia_mpcid )
dump i_return_value

# Call the function to return the list of all the nodes associated
# with the MPCs.
#
i_mxnode = 5

i_return_value = @
db_get_nodes_in_mpc @
( i_nmpc, @
ia_mpcid, @
i_mxnode, @
ia_nnode, @
ia_nid )
dump i_return_value

# The number of nodes using each MPC


dump ia_nnode
# IDs of the Nodes for each MPC
dump ia_nid
#---------------------------------------------------------------------

db_get_nxt_valid_dof_f_mpc_type ()

# Purpose : This file provides an example of a call to the


# function db_get_nxt_valid_dof_f_mpc_type()
#
# This file opens fem2.db and calls the function
# db_count_valid_dofs_f_mpc_type() to get the
# number of DOFs for the MPC type “Explicit”. It
Main Index
1174
Code Examples

# calls db_get_all_valid_dof_f_mpc_type() to get


# all the valid DOF. Then it calls the function
# to get the name and id of valid DOFs.
#
# Before running this session file, run fem2.ses
# to create fem2.db. The fem2.db contains 32
# Quad elements, 1 MPC(with 3 Sub-MPCs and 2
# LBCs.
#
# 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_nxt_valid_dof_f_mpc_type() has the following
# arguments:
# db_get_nxt_valid_dof_f_mpc_type
# ( i_mpc_type_id,
# i_dof_id,
# s_dof_name )
#---------------------------------------------------------------------
# Variable Declarations
STRING s_mpc_type_name[16]
INTEGER i_num_dofs,i_count
INTEGER i_mpc_type_id
INTEGER i_dof_id
STRING s_dof_name[16]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem2.db
uil_file_open.go(“fem2.db”)

# Get the ID of the MPC type “Explicit”


s_mpc_type_name = “Explicit”
i_return_value = @
db_get_mpc_type_id @
( s_mpc_type_name, @
i_mpc_type_id )

# Get the number of Valid Degree Of Freedoms for MPC type “Explicit”
i_return_value = @
db_count_valid_dofs_f_mpc_type @
( i_mpc_type_id, @
i_num_dofs )

# Call the function to get all the valid DOF for the MPC type
# “Explicit”. This function should be called before the call
# to the function db_get_nxt_valid_dof_f_mpc_type().
#
i_return_value = @
db_get_all_valid_dof_f_mpc_type @
( i_mpc_type_id )
dump i_return_value

# Get the next DOF ID and name for the MPC type “Explicit”
FOR ( i_count = 1 TO i_num_dofs )
i_return_value = @
db_get_nxt_valid_dof_f_mpc_type @
( i_mpc_type_id, @
i_dof_id, @
s_dof_name )
dump i_return_value
dump i_dof_id
dump s_dof_name
END FOR
#---------------------------------------------------------------------
Main Index
CHAPTER 8 1175
Finite Element Model

db_get_unreferenced_node_ids ()

# Purpose : This file provides an example of a call to the


# function db_get_unreferenced_node_ids()
#
# This file opens fem3.db and calls the function
# to get the unreferenced node IDs from the
# database.
#
# Before running this session file, run fem3.ses
# to create fem3.db. The fem3.db contains 9
# Quad elements, 2 LBCs, 1 MPC, 21 nodes , a
# surface and 2 lines on that surface. It
# contains 4 unreferenced nodes.
#
# 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_unreferenced_node_ids() has the following
# arguments:
# db_get_unreferenced_node_ids
# ( nnode,
# nunref,
# nid )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_nnode
INTEGER i_nunref
INTEGER ia_nid(8)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem3.db
uil_file_open.go(“fem3.db”)

# Call the function to count the number of nodes.


i_return_value = @
db_count_nodes( i_nnode )
#
i_return_value = @
db_get_unreferenced_node_ids @
( i_nnode, @
i_nunref, @
ia_nid )
dump i_return_value

# The number of unreferenced nodes found


dump i_nunref
# IDs of the Unreferenced nodes
dump ia_nid
#---------------------------------------------------------------------

db_get_valid_mpc_ids_in_group ()
# Purpose : This file provides an example of a call to the
# function db_get_valid_mpc_ids_in_group()
#
# This file opens fem2.db and calls the function
# db_get_current_group_id() to get the current
# group id. Then it gets the number of valid
# MPCs in the group. Finally,it calls the
# function to get the IDs of those MPCs.
#
Main Index
1176
Code Examples

# Before running this session file, run fem2.ses


# to create fem2.db. The fem2.db contains 32
# Quad elements, 1 MPC(with 3 Sub-MPCs and 2
# LBCs.
#
# This file can be run by starting a session of
# MSC.Patran and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_valid_mpc_ids_in_group()
# has the following arguments:
# db_get_valid_mpc_ids_in_group
# ( gid,
# nmpc,
# numval,
# mpcid )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_gid
INTEGER i_nmpc
INTEGER i_numval
INTEGER ia_mpcid(8)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem2.db
uil_file_open.go(“fem2.db”)

# Get the ID of the current group


i_return_value = @
db_get_current_group_id @
( i_gid )

# Get the number of MPCs in the current group


i_return_value = @
db_count_valid_mpc_types @
( i_nmpc )

# Get the IDs of the MPCs in the current group.


i_return_value = @
db_get_valid_mpc_ids_in_group @
( i_gid, @
i_nmpc, @
i_numval, @
ia_mpcid )
dump i_return_value

# The actual number of valid MPCs


dump i_numval
# The MPC IDs
dump ia_mpcid
#---------------------------------------------------------------------

db_update_elem_ids ()

# Purpose : This file provides an example of a call to the


# function db_update_elem_ids()
#
# This file opens fem1.db and calls the function
# to update element ID of the maximum element id.
# Finally it sets the ID to its original value.
# fem1.db contains 16 elements.
#
# Before running this session file, run fem1.ses
Main Index
CHAPTER 8 1177
Finite Element Model

# to create fem1.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_update_elem_ids() has the following arguments:
# db_update_elem_ids
# ( numelem,
# old_id,
# new_id )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_numelem, i_id, ia_old_id(1)
INTEGER ia_new_id(1), i_return_value
#---------------------------------------------------------------------
# Open the database “fem1.db”
uil_file_open.go(“fem1.db”)

# Get the Maximum Element id in the database.


i_return_value = db_get_max_elem_id(i_id)

# Maximum element id is
dump i_id

# Change the id of the Maximum id to a new value (i.e. i_id + 10)


# by calling the function db_update_elem_ids()

ia_old_id = i_id
i_id = i_id + 10
ia_new_id = i_id
i_numelem = 1

i_return_value = @
db_update_elem_ids @
( i_numelem, @
ia_old_id, @
ia_new_id )

dump i_return_value

# Verify the function by again calling db_get_max_elem_id()


i_return_value = db_get_max_elem_id(i_id)
# Maximum element id is
dump i_id

# Change the Maximum id to the old value itself.


ia_new_id = ia_old_id
ia_old_id = i_id

i_return_value = @
db_update_elem_ids @
( i_numelem, @
ia_old_id, @
ia_new_id )

dump i_return_value
#---------------------------------------------------------------------

Main Index
1178
Code Examples

db_update_elem_types ()

# Purpose : This file provides an example of a call to the


# function db_update_elem_types()
#
# This file opens fem1.db and calls the function
# db_get_elems() to get all information about
# element 1. Then it updates the element into
# “Hex20” and calls the function db_get_elems()
# to get the information. fem1.db contains 16
# elements.
#
# Before running this session file, run fem1.ses
# to create fem1.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_update_elem_types() has the following arguments:
# db_update_elem_types
# ( nelem,
# mxnode,
# eid,
# etop,
# econ )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_nelem
INTEGER i_maxnode
INTEGER ia_eid(1)
INTEGER ia_etop(1)
INTEGER ia_econ(1,20)
INTEGER ia_gtype(1)
INTEGER ia_gid(1)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “fem1.db”
uil_file_open.go(“fem1.db”)

# Get the information of the Element 1.


i_nelem = 1
i_maxnode = 8
ia_eid = [1]

i_return_value = @
db_get_elems @
( i_nelem, @
i_maxnode, @
ia_eid, @
ia_etop, @
ia_gtype, @
ia_gid, @
ia_econ )
dump i_return_value

# The element topology of Elem 1 is


dump ia_etop
# Array of node ids belong to Element 1 is
dump ia_econ
#---------------------------------------------------------------------
# Update the Element 1 to have a topology Hex20 (Id = 20). Hex20 will
# have 20 nodes.
Main Index
CHAPTER 8 1179
Finite Element Model

#
ia_etop(1) = 20
i_maxnode = 20

i_return_value = @
db_update_elem_types @
( i_nelem, @
i_maxnode, @
ia_eid, @
ia_etop, @
ia_econ )
dump i_return_value
#---------------------------------------------------------------------
# Get the information of the Element 1 again.
#
i_return_value = @
db_get_elems @
( i_nelem, @
i_maxnode, @
ia_eid, @
ia_etop, @
ia_gtype, @
ia_gid, @
ia_econ )
dump i_return_value

# The element topology of Elem 1 is


dump ia_etop
# Array of node ids belong to Element 1 is
dump ia_econ
#---------------------------------------------------------------------

db_validate_mpc ()

# Purpose : This file provides an example of a call to the


# function db_validate_mpc()
#
# This file opens fem2.db and calls the function
# to validate the first MPC in the database.
#
# Before running this session file, run fem2.ses
# to create fem2.db. The fem2.db contains 32
# Quad elements, 1 MPC(with 3 Sub-MPCs and 2
# LBCs.
#
# 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_validate_mpc() has the following arguments:
# db_validate_mpc
# ( mpc_id,
# valid_flag )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_nmpc
INTEGER ia_idmpcs(8)
INTEGER i_mpc_id
LOGICAL l_valid_flag
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem2.db
uil_file_open.go(“fem2.db”)
Main Index
1180
Code Examples

# Count the number of MPCs in the database.


i_return_value = @
db_count_mpcs(i_nmpc)

# Get the IDs of the MPCs


i_return_value = @
db_get_mpc_ids( i_nmpc, ia_idmpcs )

# Validate the first MPC in the database.


#
i_mpc_id = ia_idmpcs(1)

i_return_value = @
db_validate_mpc @
( i_mpc_id, @
l_valid_flag )
dump i_return_value
# Dump to see whether MPC is VALID or not.
# The first MPC should be valid or TRUE
dump l_valid_flag

# Check and invalid MPC id.


#
i_mpc_id = i_nmpc + 1

i_return_value = @
db_validate_mpc @
( i_mpc_id, @
l_valid_flag )
dump i_return_value
# Dump to see whether MPC is VALID or not.
# This MPC should be invalid or FALSE
dump l_valid_flag

#---------------------------------------------------------------------

db_verify_nodes_exist ()

# Purpose : This file provides an example of a call to the


# function db_verify_nodes_exist()
#
# This file opens fem3.db and calls the function
# to verify an array of Node Ids for the
# existence of the nodes in the database.
#
# Before running this session file, run fem3.ses
# to create fem3.db. The fem3.db contains 9
# Quad elements, 2 LBCs, 1 MPC, 21 nodes , a
# surface and 2 lines on that surface. It also
# contains 2 groups.
#
# 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_verify_nodes_exist() has the following arguments:
# db_verify_nodes_exist
# ( nnode,
# nid,
# exist )
#
#---------------------------------------------------------------------
# Variable Declarations
Main Index
CHAPTER 8 1181
Finite Element Model

INTEGER i_nnode
INTEGER ia_nid(4)
INTEGER ia_exist(4)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem3.db
uil_file_open.go(“fem3.db”)

# Call the function to verify the Node list [1,2,50,51]


#
i_nnode = 4
ia_nid = [1,2,50,51]

i_return_value = @
db_verify_nodes_exist @
( i_nnode, @
ia_nid, @
ia_exist )
dump i_return_value

# Array of integers indicating the presense of Node in the database


dump ia_exist
#---------------------------------------------------------------------

fem_create_mesh_sol_3 ()

# Purpose : This file provides an example of a call to the


# function fem_create_mesh_sol_3()
#
# This function creates Finite Element mesh on
# solids and returns the FEM data for the solid.
# It returns an integer status of zero on
# successful completion.
#
# 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 fem_create_mesh_sol_3()
# has the following arguments:
#
# fem_create_mesh_sol_3
# (mesher_pick,
# flag,
# solid_list,
# num_val,
# val_array,
# elem_topo,
# node_list,
# elem_list,
# a_coord_frame,
# r_coord_frame,
# num_nodes,
# elem_nodes,
# nodes_created,
# elems_created )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER fem_create_mesh_solid_num_nodes
INTEGER fem_create_mesh_solid_num_elems
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]
Main Index
1182
Code Examples

STRING asm_create_hpat_xyz_created_ids[VIRTUAL]
INTEGER int_status
#----------------------------------------------------------------------
# Open a new database
if(!db_is_open())THEN
uil_file_new.go("","new.db")
$? YES 36000002
endif
#----------------------------------------------------------------------
# Setting the preference to MSC.Nastran.

uil_pref_analysis.set_analysis_pref( "MSC.Nastran", @
"Structural", @
"", @
".op2" )
#---------------------------------------------------------------------
# Create Geometric entities

asm_const_hpat_xyz( "1", @
"<10 10 10>", @
"[0 0 0]", @
"Coord 0", @
asm_create_hpat_xyz_created_ids )
#---------------------------------------------------------------------
# Create Finite Element entities using the function
# fem_create_mesh_sol_3 to create 216 nodes and 125 elements
# for the Solid 1

int_status = fem_create_mesh_sol_3( "IsoMesh", @


0, @
"Solid 1 ", @
1, @
[2.], @
"Hex8", @
"1", @
"1", @
"Coord 0", @
"Coord 0", @
fem_create_mesh_solid_num_nodes,@
fem_create_mesh_solid_num_elems,@
fem_create_mesh_s_nodes_created,@
fem_create_mesh_s_elems_created )

dump int_status
#---------------------------------------------------------------------
# Closing the file new.db

# uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of file.

fem_get_elem_assoc_groups ()

# Purpose : This file provides an example of a call to the


# function fem_get_elem_assoc_groups()
#
# This file opens fem1.db and calls the function
# to get all groups associated with element Id’s
# 1 to 4. fem1.db contains only one group.
#
# Before running this session file, run fem1.ses
# to create fem1.db
#
# This file can be run by starting a session of
Main Index
CHAPTER 8 1183
Finite Element Model

# MSC.Patran and running this session file


# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function fem_get_elem_assoc_groups()
# has the following arguments:
#
# fem_get_elem_assoc_groups
# ( nelem,
# idelems,
# ngroups,
# id_symbols )
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_nelem
INTEGER ia_idelems(4)
INTEGER i_ngroups
INTEGER iv_id_symbols(VIRTUAL)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem1.db
uil_file_open.go(“fem1.db”)

# Call the function to get the group id of the element 1 to 4


i_nelem = 4
ia_idelems=[1, 2, 3, 4]

i_return_value = @
fem_get_elem_assoc_groups @
( i_nelem, @
ia_idelems, @
i_ngroups, @
iv_id_symbols )
dump i_return_value

# Number of groups associated with elements 1 to 4


dump i_ngroups
# Associated group IDs are
dump iv_id_symbols

sys_free_array( iv_id_symbols )
#---------------------------------------------------------------------

fem_get_elem_ids ()

# Purpose : This file provides an example of a call to the


# function fem_get_elem_ids()
#
# This file opens fem1.db and calls the function
# to get the element ids present in the database.
# fem1.db contains 16 elements.
#
# Before running this session file, run fem1.ses
# to create fem1.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 fem_get_elem_ids() has the following arguments:
# fem_get_elem_ids
# ( entity_list,
# nelem,
# idelem_symbol,
Main Index
1184
Code Examples

# notfound,
# noexist_symbol )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_entity_list[128]
INTEGER i_nelem
INTEGER iav_idelem_symbol(VIRTUAL)
INTEGER i_notfound
INTEGER iav_noexist_symbol(VIRTUAL)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “fem1.db”
uil_file_open.go(“fem1.db”)

# Extract the array of existing element ids from the following entity
# list by calling the function fem_get_elem_ids()
#
s_entity_list=”Elm 1:18”

i_return_value = @
fem_get_elem_ids @
( s_entity_list, @
i_nelem, @
iav_idelem_symbol, @
i_notfound, @
iav_noexist_symbol )

dump i_return_value

# Number of Existing element ids


dump i_nelem
# Array of sorted element ids
dump iav_idelem_symbol
# Number of elements that were not found
dump i_notfound
# Array of sorted nonexistent ids
dump iav_noexist_symbol

sys_free_array( iav_idelem_symbol )
sys_free_array( iav_noexist_symbol )
#---------------------------------------------------------------------

fem_get_mpc_assoc_groups ()

# Purpose : This file provides an example of a call to the


# function fem_get_mpc_assoc_groups()
#
# This file opens fem2.db and calls the function
# db_count_mpcs() to get the number of MPCs in
# the database. Then it calls the function to
# get the list of groups associated with the
# MPCs.
#
# Before running this session file, run fem2.ses
# to create fem2.db. The fem2.db contains 32
# Quad elements, 1 MPC(with 3 Sub-MPCs and 2
# LBCs.
#
# 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 fem_get_mpc_assoc_groups() has the following
# arguments:
Main Index
CHAPTER 8 1185
Finite Element Model

# fem_get_mpc_assoc_groups
# ( nmpc,
# idmpcs,
# ngroups,
# assoc_group_ids )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_nmpc
INTEGER ia_idmpcs(8)
INTEGER i_ngroups
INTEGER iv_assoc_group_ids(VIRTUAL)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem2.db
uil_file_open.go(“fem2.db”)

# Count the number of MPCs in the database.


i_return_value = @
db_count_mpcs(i_nmpc)

# Get the IDs of the MPCs


i_return_value = @
db_get_mpc_ids( i_nmpc, ia_idmpcs )

# Get the list of all the groups associated with the MPCs.
i_return_value = @
fem_get_mpc_assoc_groups @
( i_nmpc, @
ia_idmpcs, @
i_ngroups, @
iv_assoc_group_ids )
dump i_return_value

# Number of unique groups associated with MPCs


dump i_ngroups
# Array of IDs of the groups associated to MPCs
dump iv_assoc_group_ids

sys_free_array( iv_assoc_group_ids )
#---------------------------------------------------------------------

fem_get_mpc_assoc_nodes ()

# Purpose : This file provides an example of a call to the


# function fem_get_mpc_assoc_nodes()
#
# This file opens fem2.db and calls the function
# db_get_mpc_ids() to get the id of the existing
# MPC. Then it calls the function to get the
# associated node list.
#
# Before running this session file, run fem2.ses
# to create fem2.db. The fem2.db contains 32
# Quad elements, 1 MPC(with 3 Sub-MPCs) and 2
# LBCs.
#
# 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 fem_get_mpc_assoc_nodes() has the following arguments:
# fem_get_mpc_assoc_nodes
# ( nmpc,
# idmpcs,
Main Index
1186
Code Examples

# nnodes,
# id_symbols )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_nmpc
INTEGER ia_idmpcs(8)
INTEGER i_nnodes
INTEGER iv_id_symbols(VIRTUAL)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem2.db
uil_file_open.go(“fem2.db”)

# Count the number of MPCs in the database.


i_return_value = @
db_count_mpcs(i_nmpc)

# Number of MPCs in the database is


dump i_nmpc

# Get the IDs of the MPCs


i_return_value = @
db_get_mpc_ids( i_nmpc, ia_idmpcs )

# Get the list of all associated nodes with the MPCs


i_return_value = @
fem_get_mpc_assoc_nodes @
( i_nmpc, @
ia_idmpcs, @
i_nnodes, @
iv_id_symbols )
dump i_return_value

# Number of Nodes associated with MPCs


dump i_nnodes
# Associated Nodes are
dump iv_id_symbols

sys_free_array(iv_id_symbols)
#---------------------------------------------------------------------

fem_get_mpc_ids ()

# Purpose : This file provides an example of a call to the


# function fem_get_mpc_ids()
#
# This file opens fem2.db and calls the function
# to extract the array of existing MPC IDs from
# the list supplied.
#
# Before running this session file, run fem2.ses
# to create fem2.db. The fem2.db contains 32
# Quad elements, 1 MPC(with 3 Sub-MPCs and 2
# LBCs.
#
# 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 fem_get_mpc_ids() has the following arguments:
# fem_get_mpc_ids
# ( entity_list,
# nmpc,
# nempc,
Main Index
CHAPTER 8 1187
Finite Element Model

# idmpc_symbol,
# notfound,
# idnoexist_symbol )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_entity_list[128]
INTEGER i_nempc
INTEGER iv_idmpc_symbol(VIRTUAL)
INTEGER i_notfound
INTEGER iv_idnoexist_symbol(VIRTUAL)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem2.db
uil_file_open.go(“fem2.db”)

# Call the function with a MPC list which contains few existing
# and few nonexisting MPCs.
#
s_entity_list = “Mpc 1 2 3”

i_return_value = @
fem_get_mpc_ids @
( s_entity_list, @
i_nempc, @
iv_idmpc_symbol, @
i_notfound, @
iv_idnoexist_symbol )
dump i_return_value

# Number of existing MPCs in the list passed is


dump i_nempc
# Array containing IDs of existing MPCs in the list passed
dump iv_idmpc_symbol
# Number of non existing MPCs in the list passed is
dump i_notfound
# Array containing IDs of non existing MPCs in the list passed
dump iv_idnoexist_symbol

sys_free_array(iv_idmpc_symbol)
sys_free_array(iv_idnoexist_symbol)
#---------------------------------------------------------------------

fem_get_node_assoc_groups ()

# Purpose : This file provides an example of a call to the


# function fem_get_node_assoc_groups()
#
# This file opens fem3.db and calls the function
# to get the number of groups and their ids
# which are associated to the Nodes 1 & 20.
#
# Before running this session file, run fem3.ses
# to create fem3.db. The fem3.db contains 9
# Quad elements, 2 LBCs, 1 MPC, 21 nodes , a
# surface and 2 lines on that surface. It also
# contains 2 groups.
#
# 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 fem_get_node_assoc_groups()
# has the following arguments:
Main Index
1188
Code Examples

# fem_get_node_assoc_groups
# ( nnode,
# idnodes,
# ngroups,
# id_symbol )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_nnode
INTEGER ia_idnodes(2)
INTEGER i_ngroups
INTEGER iv_id_symbol(VIRTUAL)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem3.db
uil_file_open.go(“fem3.db”)

# Call the function to get the groups associated to the Nodes 1,20.
#
i_nnode = 2
ia_idnodes = [ 1,20 ]

i_return_value = @
fem_get_node_assoc_groups @
( i_nnode, @
ia_idnodes, @
i_ngroups, @
iv_id_symbol )
dump i_return_value

# Number of groups associated with nodes


dump i_ngroups
# Associated group IDs
dump iv_id_symbol

sys_free_array(iv_id_symbol)
#---------------------------------------------------------------------

fem_get_node_ids ()

# Purpose : This file provides an example of a call to the


# function fem_get_node_ids()
#
# This file opens fem3.db and calls the function
# to extract the array of existing Node IDs
# from the list of IDs supplied.
#
# Before running this session file, run fem3.ses
# to create fem3.db. The fem3.db contains 9
# Quad elements, 2 LBCs, 1 MPC, 21 nodes , a
# surface and 2 lines on that surface. It also
# contains 2 groups.
#
# 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 fem_get_node_ids() has the following arguments:
# fem_get_node_ids
# ( entity_list,
# nenode,
# id_node_symbol,
# notfound,
# id_noexist_symbol )
Main Index
CHAPTER 8 1189
Finite Element Model

#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_entity_list[32]
INTEGER i_nenode
INTEGER iv_id_node_symbol(VIRTUAL)
INTEGER i_notfound
INTEGER iv_id_noexist_symbol(VIRTUAL)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem3.db
uil_file_open.go(“fem3.db”)

# Extract the existing Node Ids from the ID list [1,2,50,51]


#
s_entity_list = “Node 1 2 50 51”

i_return_value = @
fem_get_node_ids @
( s_entity_list, @
i_nenode, @
iv_id_node_symbol, @
i_notfound, @
iv_id_noexist_symbol )
dump i_return_value

# Number of Existing Node IDs


dump i_nenode
# Existing Node IDs are
dump iv_id_node_symbol
# Number of Nodes that were not found
dump i_notfound
# Nonexistent Node IDs in the List supplied are
dump iv_id_noexist_symbol

sys_free_array(iv_id_node_symbol)
sys_free_array(iv_id_noexist_symbol)
#---------------------------------------------------------------------

fem_seed_display_dir_arrows ()

# Purpose : This file provides an example of a call to the


# function fem_seed_display_dir_arrows()
#
# This file opens fem3.db and calls the function
# gm_segment_create() to create a segment. Then
# it calls the function to display the direction
# arrows on all visible curves.
#
# Before running this session file, run fem3.ses
# to create fem3.db. The fem3.db contains 9
# Quad elements, 2 LBCs, 1 MPC, 21 nodes , a
# surface and 2 lines on that surface. It also
# contains 2 groups.
#
# 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 fem_seed_display_dir_arrows()
# has the following arguments:
# fem_seed_display_dir_arrows
# ( arrow_segment )
#
#---------------------------------------------------------------------
Main Index
1190
Code Examples

# Variable Declarations
INTEGER i_arrow_segment
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem3.db
uil_file_open.go(“fem3.db”)

# Create a segment.
i_return_value = @
gm_segment_create ( i_arrow_segment )
dump i_return_value

# Note that the curves in default viewport doesnot have direction


# arrows.
# Session file paused to observe the viewport. Press “Resume” to
# continue..
sf_pause()
#---------------------------------------------------------------------
# Call the function to display the direction arrows on all visible
# curves.
#
i_return_value = @
fem_seed_display_dir_arrows @
( i_arrow_segment )
dump i_return_value

# Note the direction arrows on the curves.


#---------------------------------------------------------------------

fem_u_get_free_edges ()

# Purpose : This file provides an example of a call to the


# function fem_u_get_free_edges()
#
# This file opens fem1.db and calls the function
# to get all the free edges in the database.
#
# Before running this session file, run fem1.ses
# to create fem1.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 fem_u_get_free_edges()
# has the following arguments:
# fem_u_get_free_edges
# ( el_ids,
# max_nodes,
# max_per_edge,
# max_edges,
# nels,
# el_con,
# el_shape,
# el_nodes,
# edge_el_ids,
# edge_ids,
# free_edges )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER ia_el_ids(16)
INTEGER i_max_nodes
INTEGER i_max_per_edge
Main Index
INTEGER i_max_edges
CHAPTER 8 1191
Finite Element Model

INTEGER i_nels
INTEGER ia_el_con(128)
INTEGER ia_el_shape(16)
INTEGER ia_el_nodes(16)
INTEGER ia_edge_el_ids(192)
INTEGER ia_edge_ids(192)
INTEGER i_free_edges
INTEGER i_return_value
INTEGER ia_etop(16)
INTEGER ia_gtype(16)
INTEGER ia_gid(16)
#---------------------------------------------------------------------
# Open the database “fem1.db”
uil_file_open.go(“fem1.db”)

# Get the information of the 16 elements in the database.


i_nels = 16
i_max_nodes = 8
ia_el_ids = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]

i_return_value = @
db_get_elems @
( i_nels, @
i_max_nodes, @
ia_el_ids, @
ia_etop, @
ia_gtype, @
ia_gid, @
ia_el_con )
dump i_return_value
#---------------------------------------------------------------------
# Get the Element Shape Array
# Each Hex 8 Element has 2 nodes per edge, 12 edges and 8 nodes.
i_max_per_edge = 2
i_max_edges = 12
ia_el_nodes=[8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8]

i_return_value = @
db_get_elem_shape_for_id @
( i_nels, @
ia_el_ids, @
ia_el_shape )
#---------------------------------------------------------------------
# Get the free edges in the database.
#
i_return_value = @
fem_u_get_free_edges @
( ia_el_ids, @
i_max_nodes, @
i_max_per_edge, @
i_max_edges, @
i_nels, @
ia_el_con, @
ia_el_shape, @
ia_el_nodes, @
ia_edge_el_ids, @
ia_edge_ids, @
i_free_edges )
dump i_return_value

# Associated element id is
dump ia_edge_el_ids
# Free edge id is
dump ia_edge_ids
# Number of free edges
dump i_free_edges
#---------------------------------------------------------------------

Main Index
1192
Code Examples

fem_u_get_free_faces ()

# Purpose : This file provides an example of a call to the


# function fem_u_get_free_faces()
#
# This file opens fem1.db and calls the function
# to get all the free faces in the database.
#
# Before running this session file, run fem1.ses
# to create fem1.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 fem_u_get_free_faces()
# has the following arguments:
# fem_u_get_free_faces
# ( el_ids,
# max_nodes,
# max_per_face,
# max_faces,
# nels,
# el_con,
# el_shape,
# el_nodes,
# face_el_ids,
# face_ids,
# free_faces )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER ia_el_ids(VIRTUAL)
INTEGER i_max_nodes
INTEGER i_max_per_face
INTEGER i_max_faces
INTEGER i_nels
INTEGER iaa_econ(VIRTUAL)
INTEGER ia_el_con(VIRTUAL)
INTEGER ia_el_shape(VIRTUAL)
INTEGER ia_el_nodes(VIRTUAL)
INTEGER ia_face_el_ids(VIRTUAL)
INTEGER ia_face_ids(VIRTUAL)
INTEGER i_free_faces
INTEGER i_return_value
INTEGER ia_etop(VIRTUAL)
INTEGER ia_gtype(VIRTUAL)
INTEGER ia_gid(VIRTUAL)
INTEGER i_array_size
#---------------------------------------------------------------------
# Open the database “fem1.db”
uil_file_open.go(“fem1.db”)

# Get the information of the 16 elements in the database.


i_nels = 16
i_max_nodes = 8

SYS_ALLOCATE_ARRAY (ia_el_ids, 1, i_nels)


SYS_ALLOCATE_ARRAY (ia_etop, 1, i_nels)
SYS_ALLOCATE_ARRAY (ia_gtype, 1, i_nels)
SYS_ALLOCATE_ARRAY (ia_gid, 1, i_nels)

ia_el_ids = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]

Main Index
CHAPTER 8 1193
Finite Element Model

SYS_ALLOCATE_ARRAY( iaa_econ, 1, i_nels, 1, i_max_nodes)

i_return_value = @
db_get_elems @
( i_nels, @
i_max_nodes, @
ia_el_ids, @
ia_etop, @
ia_gtype, @
ia_gid, @
iaa_econ )
dump i_return_value
#---------------------------------------------------------------------
# Get the Element Shape Array
# Each Hex 8 Element has 4 nodes in each face, 12 faces and 8 nodes.

i_max_per_face = 4
i_max_faces = 12

SYS_ALLOCATE_ARRAY( ia_el_nodes, 1, i_nels )

ia_el_nodes = [8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8]

SYS_ALLOCATE_ARRAY( ia_el_shape, 1, i_nels )

i_return_value = @
db_get_elem_shape_for_id @
( i_nels, @
ia_el_ids, @
ia_el_shape )
#---------------------------------------------------------------------
# Get the free faces in the database.
#
SYS_ALLOCATE_ARRAY( ia_el_con, 1, ( i_nels * i_max_nodes ) )
SYS_ALLOCATE_ARRAY( ia_el_nodes, 1, i_nels )

ia_el_nodes = [8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8]

ia_el_con = iaa_econ

i_array_size = i_max_faces * i_nels

dump i_array_size

SYS_ALLOCATE_ARRAY( ia_face_el_ids, 1, i_array_size )


SYS_ALLOCATE_ARRAY( ia_face_ids, 1, i_array_size )

i_return_value = @
fem_u_get_free_faces @
( ia_el_ids, @
i_max_nodes, @
i_max_per_face, @
i_max_faces, @
i_nels, @
ia_el_con, @
ia_el_shape, @
ia_el_nodes, @
ia_face_el_ids, @
ia_face_ids, @
i_free_faces )
dump i_return_value

# Associated element id is
dump ia_face_el_ids
# Free face id is
dump ia_face_ids
# Number of free faces
Main Index
1194
Code Examples

dump i_free_faces

#---------------------------------------------------------------------

list_get_node_ass_el_edge ()

# Purpose : This file provides an example of a call to the


# function list_get_node_ass_el_edge()
#
# This function gets nodes associated to
# specified element edge.
#
# 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 list_get_node_ass_el_edge()
# has the following arguments:
#
# list_get_node_ass_el_edge (elem_edge_list, @
# node_list )
#
#---------------------------------------------------------------------
# Variable Declarations

STRING asm_create_patch_xy_created_ids[VIRTUAL]
INTEGER fem_create_mesh_surfa_num_nodes
INTEGER fem_create_mesh_surfa_num_elems
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]
STRING elem_edge_list[80]
STRING node_list[virtual]
INTEGER i_return_value

#---------------------------------------------------------------------
# Open a new data base.

IF( !db_is_open()) THEN


uil_file_new.go( "", "new.db" )
ENDIF

$? YES 36000002

#---------------------------------------------------------------------
# Create a 2-D patch.

asm_const_patch_xyz( "1", "<1 1 0>", "[0 0 0]", "Coord 0", @


asm_create_patch_xy_created_ids )

#---------------------------------------------------------------------
# Create a Fem mesh for this patch.

fem_create_mesh_surf_3( "IsoMesh", 16384, "Surface 1", 1, @


["0.1"], "Quad4", "#", "#", "Coord 0", @
"Coord 0", @
fem_create_mesh_surfa_num_nodes, @
fem_create_mesh_surfa_num_elems, @
fem_create_mesh_s_nodes_created, @
fem_create_mesh_s_elems_created )

#---------------------------------------------------------------------
# Argument Initialization.

elem_edge_list = "Elm 1.1.3, 4.1.1, 9.1.2"


Main Index
CHAPTER 8 1195
Finite Element Model

#---------------------------------------------------------------------
# Get nodes associated to specified element edge.

i_return_value = list_get_node_ass_el_edge(elem_edge_list, @
node_list)

#---------------------------------------------------------------------
# Dump the output of the function

dump node_list
dump i_return_value

#---------------------------------------------------------------------
# closing the patran environment.

# uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

list_get_node_ass_el_face ()

# Purpose : This file provides an example of a call to the


# function list_get_node_ass_el_face()
#
# This function gets all nodes associated to
# specified element faces.
#
# 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 list_get_node_ass_el_face()
# has the following arguments:
#
# list_get_node_ass_el_face (elem_face_list, node_list )
#
#---------------------------------------------------------------------
# Variable Declarations

STRING asm_create_hpat_xyz_created_ids[VIRTUAL]
INTEGER fem_create_mesh_solid_num_nodes
INTEGER fem_create_mesh_solid_num_elems
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]
STRING elem_face_list[80]
STRING node_list[virtual]
INTEGER i_return_value

#---------------------------------------------------------------------
# Open a new data base.

IF( !db_is_open()) THEN


uil_file_new.go( "", "new.db" )
ENDIF

$? YES 36000002

#---------------------------------------------------------------------
# Create a 3-D solid.

asm_const_hpat_xyz( "1", "<1 1 1>", "[0 0 0]", "Coord 0", @


Main Index
1196
Code Examples

asm_create_hpat_xyz_created_ids )

#---------------------------------------------------------------------
# Create a Fem mesh for this solid.

fem_create_mesh_sol_3( "IsoMesh", 16384, "Solid 1", 1, [0.1], @


"Hex8", "#", "#", "Coord 0", "Coord 0", @
fem_create_mesh_solid_num_nodes, @
fem_create_mesh_solid_num_elems, @
fem_create_mesh_s_nodes_created, @
fem_create_mesh_s_elems_created )

#---------------------------------------------------------------------
# Argument Initialization.

elem_face_list = "Elm 50.3, 70.1, 100.3"

#---------------------------------------------------------------------
# Get all nodes associated to specified element faces

i_return_value = list_get_node_ass_el_face(elem_face_list, @
node_list)

#---------------------------------------------------------------------
# Dump the output of the function

dump node_list
dump i_return_value

#---------------------------------------------------------------------
# closing the patran environment.

# uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.
#---------------------------------------------------------------------

list_get_node_ass_elem ()

# Purpose : This file provides an example of a call to the


# function list_get_node_ass_elem()
#
# This function gets all nodes associated to
# the specified elements.
#
# 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 list_get_node_ass_elem()
# has the following arguments:
#
# list_get_node_ass_elem (elem_list, node_list )
#
#---------------------------------------------------------------------
# Variable Declarations

STRING asm_create_patch_xy_created_ids[VIRTUAL]
INTEGER fem_create_mesh_surfa_num_nodes
INTEGER fem_create_mesh_surfa_num_elems
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]
STRING elem_list[80]
Main Index
CHAPTER 8 1197
Finite Element Model

STRING node_list[virtual]
INTEGER i_return_value

#---------------------------------------------------------------------
# Open a new data base.

IF( !db_is_open()) THEN


uil_file_new.go( "", "new.db" )
ENDIF

$? YES 36000002

#---------------------------------------------------------------------
# Create a 2-D patch.

asm_const_patch_xyz( "1", "<1 1 0>", "[0 0 0]", "Coord 0", @


asm_create_patch_xy_created_ids)

#---------------------------------------------------------------------
# Create a Fem mesh for this patch.

fem_create_mesh_surf_3( "IsoMesh", 16384, "Surface 1", 1, ["0.1"], @


"Quad4", "#", "#", "Coord 0", "Coord 0", @
fem_create_mesh_surfa_num_nodes, @
fem_create_mesh_surfa_num_elems, @
fem_create_mesh_s_nodes_created, @
fem_create_mesh_s_elems_created )

#---------------------------------------------------------------------
# Argument Initialization.

elem_list = "Elm 1:100"

#---------------------------------------------------------------------
# Get all nodes associated to specified elements.

i_return_value = list_get_node_ass_elem(elem_list, @
node_list)

#---------------------------------------------------------------------
# Dump the output of the function

dump node_list
dump i_return_value

#---------------------------------------------------------------------
# closing the patran environment.

# uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

list_get_node_ass_geo ()

# Purpose : This file provides an example of a call to the


# function list_get_node_ass_geo()
#
# This function gets all nodes associated
# to specified geometry.
#
# This file can be run by starting a session of
# MSC.Patran, running this session file through the
Main Index
1198
Code Examples

# "File","Session","Play" pulldown menus


# on the menu bar.
#
# The function list_get_node_ass_geo()
# has the following arguments:
#
# list_get_node_ass_geo (ent_list, node_list )
#
#---------------------------------------------------------------------
# Variable Declarations

STRING asm_create_patch_xy_created_ids[VIRTUAL]
INTEGER fem_create_mesh_surfa_num_nodes
INTEGER fem_create_mesh_surfa_num_elems
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]

string ent_list[80]
string node_list[virtual]
integer i_return_value

#---------------------------------------------------------------------
# Open a new data base.

IF( !db_is_open()) THEN


uil_file_new.go( "", "new.db" )
ENDIF

$? YES 36000002

#---------------------------------------------------------------------
# Create a 2-D patch.

asm_const_patch_xyz( "1", "<1 1 0>", "[0 0 0]", "Coord 0", @


asm_create_patch_xy_created_ids )

#---------------------------------------------------------------------
# Create a Fem mesh for this patch.

fem_create_mesh_surf_3( "IsoMesh", 16384, "Surface 1", 1, ["0.1"], @


"Quad4", "#", "#", "Coord 0", "Coord 0", @
fem_create_mesh_surfa_num_nodes, @
fem_create_mesh_surfa_num_elems, @
fem_create_mesh_s_nodes_created, @
fem_create_mesh_s_elems_created )

#---------------------------------------------------------------------
# Argument Initialization.

ent_list = "Surface 1"

#---------------------------------------------------------------------
# Get all nodes associated to specified geometry.

i_return_value = list_get_node_ass_geo(ent_list, node_list)

#---------------------------------------------------------------------
# Dump the output of the function

dump node_list
dump i_return_value

#---------------------------------------------------------------------
# closing the patran environment.
Main Index
CHAPTER 8 1199
Finite Element Model

# uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

list_get_node_ass_group ()

# Purpose : This file provides an example of a call to the


# function list_get_node_ass_group()
#
# This function gets all nodes associated to
# specified groups.
#
# 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 list_get_node_ass_group()
# has the following arguments:
#
# list_get_node_ass_group (num, group_list, node_list )
#
#---------------------------------------------------------------------
# Variable Declarations

STRING asm_create_patch_xy_created_ids[VIRTUAL]
INTEGER fem_create_mesh_surfa_num_nodes
INTEGER fem_create_mesh_surfa_num_elems
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]
INTEGER num
STRING group_list[80](2)
STRING node_list[virtual]
INTEGER i_return_value

#---------------------------------------------------------------------
# Open a new data base.

IF( !db_is_open()) THEN


uil_file_new.go( "", "new.db" )
ENDIF

$? YES 36000002

#---------------------------------------------------------------------
# Create a 2-D patch.

asm_const_patch_xyz( "1", "<1 1 0>", "[0 0 0]", "Coord 0", @


asm_create_patch_xy_created_ids )

#---------------------------------------------------------------------
# Create a Fem mesh for this patch.

fem_create_mesh_surf_3( "IsoMesh", 16384, "Surface 1", 1, ["0.1"], @


"Quad4","#", "#", "Coord 0", "Coord 0", @
fem_create_mesh_surfa_num_nodes, @
fem_create_mesh_surfa_num_elems, @
fem_create_mesh_s_nodes_created, @
fem_create_mesh_s_elems_created )

#---------------------------------------------------------------------
# Create first group "group1".
Main Index
1200
Code Examples

ga_group_create( "group1" )

ga_group_entity_add( "group1", @
"Point 1 2 Surface 1 Node 1:4 12:15 23:26 3" // @
"4:37 45:48 56:59 67:70 78:81 89:92 100:103" // @
"111:114 Elm 1:4 11:14 21:24 31" // @
":34 41:44 51:54 61:64 71:74 81:84 91:94" )

ga_group_current_set( "group1" )

#---------------------------------------------------------------------
# Create second group "group2".

ga_group_create( "group2" )

ga_group_entity_add( "group2", @
"Point 3 4 Surface 1 Node 9:11 20:22 31:33 " // @
"42:44 53:55 64:66 75:77 86:88 97:99 108:110" // @
"119:121 Elm 8:10 18:20 28:30 " // @
"38:40 48:50 58:60 68:70 78:80 88:90 98:100" )

ga_group_current_set( "group2" )

#---------------------------------------------------------------------
# Argument Initialization.

num = 2
group_list(1) = "group1"
group_list(2) = "group2"

#---------------------------------------------------------------------
# Get all nodes associated to specified groups.

i_return_value = list_get_node_ass_group(num, @
group_list, @
node_list)

#---------------------------------------------------------------------
# Dump the output of the function

dump node_list
dump i_return_value

#---------------------------------------------------------------------
# closing the patran environment.

# uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

list_get_node_ass_mpc ()

# Purpose : This file provides an example of a call to the


# function list_get_node_ass_mpc()
#
# This function gets all nodes associated to
# the specified mpcs.
#
# 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.
Main Index
CHAPTER 8 1201
Finite Element Model

#
# The function list_get_node_ass_mpc()
# has the following arguments:
#
# list_get_node_ass_mpc (mpc_list, node_list )
#
#---------------------------------------------------------------------
# Variable Declarations

STRING asm_create_patch_xy_created_ids[VIRTUAL]
INTEGER fem_create_mesh_surfa_num_nodes
INTEGER fem_create_mesh_surfa_num_elems
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]

STRING mpc_list[80]
STRING node_list[virtual]
INTEGER i_return_value

#---------------------------------------------------------------------
# Open a new data base.

IF( !db_is_open()) THEN


uil_file_new.go( "", "new.db" )
ENDIF

$? YES 36000002

#---------------------------------------------------------------------
# Create a 2-D patch.

asm_const_patch_xyz( "1", "<1 1 0>", "[0 0 0]", "Coord 0", @


asm_create_patch_xy_created_ids )

#---------------------------------------------------------------------
# Create a Fem mesh for this patch.

fem_create_mesh_surf_3( "IsoMesh", 16384, "Surface 1", 1, ["0.1"], @


"Quad4","#", "#", "Coord 0", "Coord 0", @
fem_create_mesh_surfa_num_nodes, @
fem_create_mesh_surfa_num_elems, @
fem_create_mesh_s_nodes_created, @
fem_create_mesh_s_elems_created )

#---------------------------------------------------------------------
# Create one "Rigid (Fixed)" mpc.

fem_create_mpc_nodal2(1, "Rigid (Fixed)", 0., 2, [TRUE, FALSE], @


["0", "0"],["Node 1:111:11","Node 11:121:11"], @
["", ""] )

#---------------------------------------------------------------------
# Create one "Explicit" mpc.

fem_create_mpc_nodal2(2, "Explicit", 0., 2, [TRUE, FALSE], @


["0.", "1.0"], ["Node 112:120", "Node 2:10"], @
["UX", "UX"] )

#---------------------------------------------------------------------
# Argument Initialization.

mpc_list = "Mpc 1:2"

#---------------------------------------------------------------------
# Get Nodes associated to mpcs.
Main Index
1202
Code Examples

i_return_value = list_get_node_ass_mpc(mpc_list, @
node_list)

#---------------------------------------------------------------------
# Dump the output of the function

dump node_list
dump i_return_value

#---------------------------------------------------------------------
# closing the patran environment.

# uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

list_get_node_att_fringe ()

# Purpose : This file provides an example of a call to the


# function list_get_node_att_fringe()
#
# This function gets all nodes with a specified fringe
range.
#
# Before running this session file run spool.ses and
# create result file spool.op2 as per the instructions
# given in it. Import this result file spool.op2 into
# spool.db.
#
# 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 list_get_node_att_fringe()
# has the following arguments:
#
# list_get_node_att_fringe(val, @
# act, @
# tol, @
# group, @
# node_list)
#
#---------------------------------------------------------------------
# Variable Declarations

REAL val(2)
STRING act[80]
REAL tol
string group[32]
STRING node_list[virtual]
INTEGER i_return_value

#---------------------------------------------------------------------
# Open the file "spool.db"

uil_file_open.go( "./spool.db" )

#---------------------------------------------------------------------
# Create the fringe plot for NEW RESULT CASE, Displacement

res_data_load_dbresult( 0, "Nodal", "Scalar", "spool_loads", @


"Static Subcase", "NEW RESULT CASE", @
"Displacement", "(NON-LAYERED)", "", @
Main Index
CHAPTER 8 1203
Finite Element Model

"AsIs", @
"DeriveAverage", "All", @
"ShapeFunc", "", 0. )

res_data_title( 0, "Nodal", "Scalar", 1, @


["spool_loads, Static Subcase, @
NEW RESULT CASE, Displacement, (NON-LAYERED)"] )

res_display_fringe_create( "", "FreeFaces", 0, [""], 12, @


["Range:Fri_default_Fringe", @
"RangeOverwrite:ON", @
"FringeStyle:Discrete/Smooth", @
"Shade:None", @
"ElemEdge:FreeEdge,Blue,Solid,1", @
"Shrink:0","TitleDisplay:ON", @
"MinMaxDisplay:ON", "ValueDisplay:OFF", @
"Filter:None", "TitleDisplay:ON", @
"MinMaxDisplay:ON", "ValueDisplay:OFF", @
"Filter:None", "ScaleFactor:1.", @
"LabelStyle:Exponential, @
12, White, 3"], TRUE )

res_display_fringe_post( "", 0, "Nodal", TRUE, TRUE )

#---------------------------------------------------------------------
# Argument Initialization.

val(1) = 0.0194
val(2) = 0.234
act = "range"
tol = 0.005
group = "fem_model"

#---------------------------------------------------------------------
# Get all nodes with a specified fringe range

i_return_value = list_get_node_att_fringe(val, @
act, @
tol, @
group, @
node_list)

#---------------------------------------------------------------------
# Dump the output of the function

dump node_list
dump i_return_value

#---------------------------------------------------------------------
# closing the patran environment.

# uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

Main Index
1204
Code Examples

list_get_node_att_value ()

# Purpose : This file provides an example of a call to the


# function list_get_node_att_value()
#
# This function gets all nodes with a
# specified coordinate value.
#
# 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 list_get_node_att_value()
# has the following arguments:
#
# list_get_node_att_value(val_xyz, @
# val_log, @
# act, @
# tol, @
# coord, @
# group, @
# node_list)
#
#---------------------------------------------------------------------
# Variable Declarations

STRING asm_create_patch_xy_created_ids[VIRTUAL]
INTEGER fem_create_mesh_surfa_num_nodes
INTEGER fem_create_mesh_surfa_num_elems
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]

REAL val_xyz(3)
LOGICAL val_log(3)
STRING act[80](3)
REAL tol(3)
STRING coord[32]
LOGICAL group
STRING node_list[virtual]
INTEGER i_return_value

#---------------------------------------------------------------------
# Open a new data base.

IF( !db_is_open()) THEN


uil_file_new.go( "", "new.db" )
ENDIF

$? YES 36000002

#---------------------------------------------------------------------
# Create a 2-D patch.

asm_const_patch_xyz( "1", "<1 1 0>", "[0 0 0]", "Coord 0", @


asm_create_patch_xy_created_ids )

#---------------------------------------------------------------------
# Create a Fem mesh for this patch.

fem_create_mesh_surf_3( "IsoMesh", 16384, "Surface 1", 1, ["0.05"], @


"Quad4", "#", "#", "Coord 0", "Coord 0", @
fem_create_mesh_surfa_num_nodes, @
fem_create_mesh_surfa_num_elems, @
Main Index
CHAPTER 8 1205
Finite Element Model

fem_create_mesh_s_nodes_created, @
fem_create_mesh_s_elems_created )

#---------------------------------------------------------------------
# Argument Initialization.

val_xyz(1) = 0.0
val_log(1) = TRUE
act(1) = "equal"
tol(1) = 0.005
coord = "coord 0"
group = TRUE

#---------------------------------------------------------------------
# Get all nodes with a specified coordinate value

i_return_value = list_get_node_att_value(val_xyz, @
val_log, @
act, @
tol, @
coord, @
group, @
node_list)

#---------------------------------------------------------------------
# Dump the output of the function

dump node_list
dump i_return_value

#---------------------------------------------------------------------
# closing the patran environment.

# uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

move_mesh ()

# Purpose : This file provides an example of a call to the


# function move_mesh()
#
# This function moves the finite element entities
# - vertex nodes, edge nodes and the face nodes
# from one surface to another. The size of the
# two surfaces should be equal and the user
# tolerance should be atleast equal to the normal
# distance between the two surface.
#
# 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 move_mesh()
# has the following arguments:
#
# move_mesh
# ( Surface_id2,
# Surface_id1,
# usertol )
#
#---------------------------------------------------------------------
Main Index
1206
Code Examples

# Variable Declarations

INTEGER fem_create_mesh_surfa_num_nodes
INTEGER fem_create_mesh_surfa_num_elems
INTEGER int_status
STRING asm_create_patch_xy_created_ids[VIRTUAL]
STRING sgm_transform_surf__created_ids[VIRTUAL]
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]
#----------------------------------------------------------------------
# Open a new database
if(!db_is_open())THEN
uil_file_new.go("","new.db")
$? YES 36000002
endif
#----------------------------------------------------------------------
# Setting the preference to MSC.Nastran.

uil_pref_analysis.set_analysis_pref( "MSC.Nastran", @
"Structural", @
"", @
".op2" )
#---------------------------------------------------------------------
# Creating a Surface 1
#
int_status = asm_const_patch_xyz( @
"1", @
"<1 1 0>", @
"[0 0 0]", @
"Coord 0", @
asm_create_patch_xy_created_ids )
dump int_status
#---------------------------------------------------------------------
# Making a copy of the surface - Surface 2

int_status = sgm_transform_translate( @
"2", @
"surface", @
"<0 0 0.5>", @
"Coord 0", @
1, @
FALSE, @
"Surface 1", @
sgm_transform_surf__created_ids )
dump int_status
#---------------------------------------------------------------------
# Meshing the Surface 1 with quad4 elements
# creating 36 nodes and 25 elements for Surface 1.

ui_exec_function( "mesh_seed_display_mgr", "init" )

int_status = fem_create_mesh_surf_3( @
"IsoMesh", @
16384, @
"Surface 1", @
1, @
["0.2"], @
"Quad4", @
"#", @
"#", @
"Coord 0", @
"Coord 0", @
fem_create_mesh_surfa_num_nodes, @
fem_create_mesh_surfa_num_elems, @
fem_create_mesh_s_nodes_created, @
fem_create_mesh_s_elems_created )
Main Index
CHAPTER 8 1207
Finite Element Model

dump int_status
#---------------------------------------------------------------------
# Using the function move mesh to move mesh from surface 1
# to Surface 2.

int_status = move_mesh(2,1,0.5)

dump int_status
#---------------------------------------------------------------------
# Closing the file new.db

uil_file_close.goquit( )
#---------------------------------------------------------------------

move_mesh_1 ()

# Purpose : This file provides an example of a call to the


# function move_mesh_1()
#
# This function moves the finite element entities
# - vertex nodes, edge nodes and the face nodes
# from one surface to another. The size of the
# two surfaces should be equal and the user
# tolerance should be atleast equal to the normal
# distance between the two surface.
#
# 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 move_mesh_1()
# has the following arguments:
#
# move_mesh_1
# ( Surface2,
# Surface1,
# usertol )
#
#---------------------------------------------------------------------
# Variable Declarations

INTEGER fem_create_mesh_surfa_num_nodes
INTEGER fem_create_mesh_surfa_num_elems
INTEGER int_status
STRING asm_create_patch_xy_created_ids[VIRTUAL]
STRING sgm_transform_surf__created_ids[VIRTUAL]
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]
#----------------------------------------------------------------------
# Open a new database
if(!db_is_open())THEN
uil_file_new.go("","new.db")
$? YES 36000002
endif
#----------------------------------------------------------------------
# Setting the preference to MSC.Nastran.

uil_pref_analysis.set_analysis_pref( "MSC.Nastran", @
"Structural", @
"", @
".op2" )
#---------------------------------------------------------------------
# Creating a Surface 1
Main Index
1208
Code Examples

#
int_status = asm_const_patch_xyz( @
"1", @
"<1 1 0>", @
"[0 0 0]", @
"Coord 0", @
asm_create_patch_xy_created_ids )
dump int_status
#---------------------------------------------------------------------
# Making a copy of the surface - Surface 2

int_status = sgm_transform_translate( @
"2", @
"surface", @
"<0 0 0.5>", @
"Coord 0", @
1, @
FALSE, @
"Surface 1", @
sgm_transform_surf__created_ids )
dump int_status
#---------------------------------------------------------------------
# Meshing the Surface 1 with quad4 elements
# creating 36 nodes and 25 elements for Surface 1.

ui_exec_function( "mesh_seed_display_mgr", "init" )

int_status = fem_create_mesh_surf_3( @
"IsoMesh", @
16384, @
"Surface 1", @
1, @
["0.2"], @
"Quad4", @
"#", @
"#", @
"Coord 0", @
"Coord 0", @
fem_create_mesh_surfa_num_nodes, @
fem_create_mesh_surfa_num_elems, @
fem_create_mesh_s_nodes_created, @
fem_create_mesh_s_elems_created )
dump int_status
#---------------------------------------------------------------------
# Using the function move_mesh_1 to move mesh from surface 1
# to Surface 2.

int_status = move_mesh_1("Surface 2","Surface 1",0.5)

dump int_status
#---------------------------------------------------------------------
# Closing the file new.db

uil_file_close.goquit( )
#---------------------------------------------------------------------

Main Index
MSC.Acumen, Volume 2: Code Examples

CHAPTER
Load Cases
9
■ Introduction

Main Index
1210
Code Examples

9.1 Introduction
This chapter provides code examples for the PCL function described in Volume 1. These
examples are designed so that they can be cut and pasted into a file and, by following the
instructions listed with each example, executed in MSC.Patran.

db_activate_load_case ()

# Purpose : This file provides an example of 2 calls to the


# function db_activate_load_case()
#
# This function activates the specified load
# case.
#
# In this example, a load case (new_lc1) is
# created. Then the load case is activated by
# using this function. The name of the active
# load case is verified before and after
# activation by using the function
# db_get_active_load_case().
#
# 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_activate_load_case()
# has the following arguments:
#
# db_activate_load_case
# ( lc_name ),
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_lc_name[16]
STRING s_active_lc[16]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Create load Case “new_lc1”


loadcase_create2( “new_lc1”, “Static”, ““, 1., @
[“TZ_fixed”, “400_psi”], [0, 0] @
, [1., 1.], ““, 0., FALSE )

# Get active load_case


db_get_active_load_case(s_active_lc)
dump s_active_lc

# Session file paused. Press “Resume” to continue..


sf_pause()

# Activate load case “new_lc1”


s_lc_name = “new_lc1”
i_return_value = @
db_activate_load_case @
( s_lc_name )
dump i_return_value
Main Index
CHAPTER 9 1211
Load Cases

# Get active load_case


db_get_active_load_case(s_active_lc)
dump s_active_lc

# Session file paused. Press “Resume” to continue..


sf_pause()

# Activate load case “spool_loads”


s_lc_name = “spool_loads”
i_return_value = @
db_activate_load_case @
( s_lc_name )
dump i_return_value

# Delete load Case “new_lc1”


loadcase_delete( “new_lc1”, FALSE )
#---------------------------------------------------------------------

db_delete_load_case ()

# Purpose : This file provides an example of a call to the


# function db_delete_load_case()
#
# This function deletes the specified load case.
#
# In this example, a load case (new_lc1) is
# created. Then the load case is deleted after
# a pause. Observation on list of available load
# cases is carried out before and after deletion
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_delete_load_case()
# has the following arguments:
#
# db_delete_load_case
# ( lc_name ),
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_lc_name[16]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Create load Case “new_lc1”


s_lc_name = “new_lc1”
loadcase_create2( s_lc_name, “Static”, ““, 1., @
[“TZ_fixed”, “400_psi”], [0, 0] @
, [1., 1.], ““, 0., FALSE )

# Activate “Load Cases” of Application radio button and observe


# the names of available load cases

# Session file paused. Press “Resume” to continue..


sf_pause()

# Delete load Case “new_lc1”


Main Index
1212
Code Examples

i_return_value = @
db_delete_load_case @
( s_lc_name )
dump i_return_value

# It can be observed that the load case “new_lc1” getting removed


# the list of available load cases
#---------------------------------------------------------------------

db_find_load_case_id ()

# Purpose : This file provides an example of 2 calls to the


# function db_find_load_case_id()
#
# This function gets the load case ids from the
# database in one structure.
#
# In this example, 2 load cases (new_lc1,new_lc2)
# are created. Then the model is submitted for
# analysis as indicated in comments.
#
# The given are the details of load-cases used in
# this example.
#
# Load case name id Sequence no.
# for analysis
#
# Default 1 1
# spool_loads 2 4
# new_lc1 3 2
# new_lc2 4 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_find_load_case_id()
# has the following arguments:
#
# db_find_load_case_id
# ( job_name,
# lc_seq_no,
# lc_id )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_job_name[16]
INTEGER i_lc_seq_no
INTEGER i_lc_id
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Create load Case “new_lc1”


loadcase_create2( “new_lc1”, “Static”, ““, 1., @
[“TZ_fixed”, “400_psi”], [0, 0] @
, [1., 1.], ““, 0., FALSE )

# Create load Case “new_lc2”


loadcase_create2( “new_lc2”, “Static”, ““, 1., @
Main Index
CHAPTER 9 1213
Load Cases

[“TZ_fixed”, “400_psi”, @
“fillet_pressure”], [0, 0, 0], @
[1., 1., 1.], ““, 0., FALSE )

#---------------------------------------------------------------------
# Submit the model for analysis in MSC.Nastran by following the
# given steps
#
# 1. Pick “MSC.Nastran” from “Preferences”, “Analysis...”
# from Pulldown menus. Press “O.K” button.
#
# 2. Pick “Analysis” from Application radio buttons and
# perform the following operations in the form.
# (a)Give job-name as “spool”
# (b)Select “Subcase Select” for fixing solution sequence
# (c)Select the load cases(as sub-cases) in following order
# “default”,”new_lc1”, “new_lc2”,”spool_loads”
# (d)Press “Apply”
#
# Note : Permit deletion of earlier existing job files if any.
# Ignore the Warnings if any.
#
#---------------------------------------------------------------------
# Session file paused. Press “Resume” to continue..
sf_pause()

# Get the load case id


s_job_name = “spool”
i_lc_seq_no = 1
i_return_value = @
db_find_load_case_id @
( s_job_name, @
i_lc_seq_no, @
i_lc_id )
dump i_return_value
dump i_lc_id

# Get the load case id


i_lc_seq_no = 2
i_return_value = @
db_find_load_case_id @
( s_job_name, @
i_lc_seq_no, @
i_lc_id )
dump i_return_value
dump i_lc_id

#---------------------------------------------------------------------

db_get_lc_id_given_job_seq ()

# Purpose : This file provides an example of 2 calls to the


# function db_get_lc_id_given_job_seq()
#
# This function gets the load case ids from the
# database in one structure for a given
# analysis id.
#
# In this example, 2 load cases(new_lc1,new_lc2)
# are created. Then the model is submitted for
# analysis as indicated in comments.
#
# The given are the details of load-cases used in
# this example.
#
Main Index
1214
Code Examples

# Load case name id Sequence no.


# for analysis
#
# Default 1 1
# spool_loads 2 4
# new_lc1 3 2
# new_lc2 4 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_lc_id_given_job_seq()
# has the following arguments:
#
# db_get_lc_id_given_job_seq
# ( ac_id,
# job_name,
# lc_seq,
# lc_id )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_ac_id
INTEGER i_at_id
STRING s_job_name[16]
INTEGER i_lc_seq
INTEGER i_lc_id
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Create load Case “new_lc1”


loadcase_create2( “new_lc1”, “Static”, ““, 1., @
[“TZ_fixed”, “400_psi”], [0, 0] @
, [1., 1.], ““, 0., FALSE )

# Create load Case “new_lc2”


loadcase_create2( “new_lc2”, “Static”, ““, 1., @
[“TZ_fixed”, “400_psi”, @
“fillet_pressure”], [0, 0, 0], @
[1., 1., 1.], ““, 0., FALSE )

#---------------------------------------------------------------------
# Submit the model for analysis in MSC.Nastran by following the
# given steps
#
# 1. Pick “MSC.Nastran” from “Preferences”, “Analysis...”
# from Pulldown menus.
#
# 2. Pick “Analysis” from Application radio buttons and
# perform the following operations in the form.
# (a)Give job-name as “spool”
# (b)Select “Subcase Select” for fixing solution sequence
# (c)Select the load cases(as sub-cases) in following order
# “new_lc1”, “new_lc2”,”spool_loads”
# (d)Press “Apply”
#
# Note : Permit deletion of earlier existing job files if any.
# Ignore the warnings if any.
#---------------------------------------------------------------------
Main Index
CHAPTER 9 1215
Load Cases

# Session file paused. Press “Resume” to continue..


sf_pause()

# Get the analysis code and type id


ep_u_get_at_and_ac(i_at_id,i_ac_id)

# Get the load case id


s_job_name = “spool”
i_lc_seq = 1
i_return_value = @
db_get_lc_id_given_job_seq @
( i_ac_id, @
s_job_name, @
i_lc_seq, @
i_lc_id )
dump i_return_value
dump i_lc_id

# Get the load case id


i_lc_seq = 2
i_return_value = @
db_get_lc_id_given_job_seq @
( i_ac_id, @
s_job_name, @
i_lc_seq, @
i_lc_id )
dump i_return_value
dump i_lc_id

#---------------------------------------------------------------------

Main Index
1216
Code Examples

Main Index
MSC.Acumen, Volume 2: Code Examples

CHAPTER
Element Properties
10
■ Introduction

Main Index
1218
Code Examples

10.1 Introduction
This chapter provides code examples for the PCL function described in Volume 1. These
examples are designed so that they can be cut and pasted into a file and, by following the
instructions listed with each example, executed in MSC.Patran.

bl_create_std_beam_section ()

# Purpose : This function will create the standard beam


# section. This function require shape, name,
# number of dimensions, data types, dimension
# values and field ids for beam section as
# input argument to this function and it will
# give id of beam section created.
#
# This file can be run by starting a session of
# MSC.Patran, running this session file through
# the "File","Session","Play" pulldown menus
# on the menu bar.
#
#
# The function bl_create_std_beam_section()
# has the following arguments:
#
# bl_create_std_beam_section
# ( INPUT:
# STRING shape,
# STRING name,
# INTEGER ndim,
# INTEGER data_types(),
# REAL rvalues(),
# INTEGER field_ids()
# OUTPUT:
# INTEGER id
# )
#---------------------------------------------------------------------
#

# Opening new database

IF(!db_is_open())THEN
uil_file_new.go("", "new.db")
END IF
$? YES 36000002

# Creating field which is to be applied at last dimension


# of "T" section beam.

fields_create( "S", "Spatial", 1, @


"Scalar", "Real", @
"Coord 0", "", @
"Table", 1, "X", "", @
"", "", "", "", @
FALSE, [1., 2.], @
[0.], [0.], @
[[[5.]][[10.]]] )

# Declaring and defining input arguments

STRING shape[4] = "T"

Main Index STRING name[16] = "New_Beam"


CHAPTER 10 1219
Element Properties

INTEGER ndim = 4

INTEGER data_types(4) = [3,3,3,7]

REAL rvalues(4) = [5.0,5.0,1.0,0.0]

INTEGER field_ids(4) = [0,0,0,1]

# Declaring output arguments

INTEGER id

INTEGER status = 1

# Using the function bl_create_std_beam_section() we will create


# the std "T" beam section and we will get id for this new beam

status = bl_create_std_beam_section(shape, @
name, @
ndim, @
data_types, @
rvalues, @
field_ids, @
id)

dump status
dump id

#---------------------------------------------------------------------

# End of File.

#---------------------------------------------------------------------

bl_get_std_beam_section_data ()

# Purpose : This function will get the standard beam


# section data. This function require beam id
# and number of dimension as input arguments
# and it will give data types, dimension
# values and field ids for beam section
#
# This file can be run by starting a session of
# MSC.Patran, opening a new or existing database,
# and running this session file through the
# "File","Session","Play" pulldown menus
# on the menu bar.
#
#
# The function bl_get_std_beam_section_data()
# has the following arguments:
#
# bl_get_std_beam_section_data
# ( INPUT:
# INTEGER id
# INTEGER ndim,
# OUTPUT:
# INTEGER data_types(),
# REAL rvalues(),
# INTEGER field_ids()
# )
#---------------------------------------------------------------------
Main Index
1220
Code Examples

#
#
# Opening new database

IF(!db_is_open())THEN
uil_file_new.go("", "new.db")
END IF
$? YES 36000002

# Creating field which is to be applied at last dimension


# of "T" section beam.

fields_create( "S", "Spatial", 1, @


"Scalar", "Real", @
"Coord 0", "", @
"Table", 1, "X", "", @
"", "", "", "", FALSE, @
[1., 2.], [0.], [0.], @
[[[5.]][[10.]]] )

# Declaring and defining input arguments

INTEGER id

INTEGER ndim = 4

# Declaring output arguments

INTEGER data_types(4)

REAL rvalues(4)

INTEGER field_ids(4)

INTEGER status = 1

# Using the function bl_create_std_beam_section() we


# will create the std "T" beam section and we will get
# id for this new beam. This id we will use as input
# argument to the function bl_get_std_beam_section_data()

STRING shape_1[4] = "T"


STRING name_1[16] = "New_Beam"
INTEGER ndim_1 = 4
INTEGER data_types_1(4) = [3,3,3,7]
REAL rvalues_1(4) = [5.,5.,1.,0.]
INTEGER field_ids_1(4) = [0,0,0,1]

bl_create_std_beam_section(shape_1, @
name_1, @
ndim_1, @
data_types_1, @
rvalues_1, @
field_ids_1, @
id)

# Using the function bl_get_std_beam_section_data()


# to get the standard beam section data.

status = bl_get_std_beam_section_data(id,ndim, @
data_types, @
rvalues, @
field_ids)
Main Index
CHAPTER 10 1221
Element Properties

dump status
dump data_types
dump rvalues
dump field_ids

#---------------------------------------------------------------------

# End of File.

#---------------------------------------------------------------------

bl_modify_std_beam_section ()

# Purpose : This function will modify the existing std.


# beam section. This function require beam shape,
# existing beam name, new beam name, number of
# dimension, data types, dimension values and
# field ids for new beam as input arguments and
# it will give id of new beam as output.
#
# This file can be run by starting a session of
# MSC.Patran,running this session file through
# the "File","Session","Play" pulldown menus
# on the menu bar.
#
# The function bl_modify_std_beam_section()
# has the following arguments:
#
# bl_modify_std_beam_section
# ( INPUT:
# STRING new_shape,
# STRING old_name,
# STRING new_name,
# INTEGER ndim,
# INTEGER data_types(),
# REAL rvalues(),
# INTEGER field_ids()
# OUTPUT:
# INTEGER id
# )
#---------------------------------------------------------------------
#

# Opening new database

IF(!db_is_open())THEN
uil_file_new.go("", "new.db")
END IF
$? YES 36000002

# Creating field which is to be applied at last dimension


# of "T" section beam.

fields_create( "S", "Spatial", 1, @


"Scalar", "Real", @
"Coord 0", "", @
"Table", 1, "X", "", @
"", "", "", "", FALSE, @
[1., 2.], [0.], [0.], @
[[[5.]][[10.]]] )

# Declaring and defining input arguments


Main Index
1222
Code Examples

STRING new_shape[4]="H"

STRING old_name[16] = "Old_Beam"

STRING new_name[16] = "New_Beam"

INTEGER ndim = 4

INTEGER data_types(4) = [3,3,3,7]

REAL rvalues(4)= [5.,5.,1.,0.]

INTEGER field_ids(4) = [0,0,0,1]

# Declaring output arguments

INTEGER id

INTEGER status = 1

# Using the function bl_create_std_beam_section() we


# will create the std "T" beam section with name
# old_name and then modify this beam section using
# function bl_modify_std_beam_section().

STRING shape_1[4] = "T"


INTEGER ndim_1 = 4
INTEGER data_types_1(4) = [3,3,3,7]
REAL rvalues_1(4) = [5.,5.,1.,0.]
INTEGER field_ids_1(4) = [0,0,0,1]
INTEGER id_1

bl_create_std_beam_section(shape_1, @
old_name, @
ndim_1, @
data_types_1, @
rvalues_1, @
field_ids_1, @
id_1)

# Using the function bl_modify_std_beam_section()


# to modify the beam section

status = bl_modify_std_beam_section(new_shape, @
old_name, @
new_name, @
ndim, @
data_types, @
rvalues, @
field_ids, @
id)

dump status
dump id

#---------------------------------------------------------------------

# End of File.

#---------------------------------------------------------------------

Main Index
CHAPTER 10 1223
Element Properties

blcomputeprincaxespoints ()

# Purpose : This function calculates the principle axes vectors


# for the beam section from the angle alpha(principle
# angle).It also scales the axes based on the beam
# section points. This function requires principle
# angle - alpha, number of points on section - npoints,
# xy array of section points - points and xy location of
# centroid - centroid as input arguments to this function
#
# This file can be run by starting a session of
# MSC.Patran,running corresponding session file
# through the "File","Session","Play" pulldown
# menus on the menu bar.
#
#
# The function blcomputeprincaxespoints()
# has the following arguments:
#
# blcomputeprincaxespoints
# (INPUT:
# REAL alpha,
# INTEGER npoints,
# REAL points(),
# REAL centroid(),
# OUTPUT:
# REAL axis1(),
# REAL axis2()
# )
#
#-------------------------------------------------------------------

# Declaring and defining input arguments

REAL alpha = 45.0

INTEGER npoints = 4

REAL points(8) = [1.,1.,-1.,1.,-1.,-1.,1.,-1.]

REAL centroid(2) = [0.,0.]

# Declaring output arguments

REAL princ_axis1(2), princ_axis2(2)

INTEGER status = 1

#---------------------------------------------------------------------

# Using the function blcomputeprincaxespoints() to compute


# the principle axes of beam section.

status=blcomputeprincaxespoints(alpha, @
npoints, @
points, @
centroid, @
princ_axis1, @
princ_axis2)

dump princ_axis1
dump princ_axis2
dump status

#****************************************************************
Main Index
1224
Code Examples

# End of File

#****************************************************************

blgetalpha ()

# Purpose : This function calculates the principle angle


# from the given properties of the beam section.
# This function requires beam type (1=basic,
# 2=advanced) and array of beam section properties
# as input arguments to this function.
#
# This file can be run by starting a session of
# MSC.Patran, running this session file through
# the "File","Session","Play" pulldown menus
# on the menu bar.
#
#
# The function blgetalpha()
# has the following arguments:
#
# blgetalpha
# ( INPUT:
# INTEGER enttyp (1=basic,2=advanced),
# REAL prop(),
# OUTPUT:
# REAL alpha(),
# )
#---------------------------------------------------------------------
#
# Declaring and defining input arguments

INTEGER enttyp = 2

real prop(30) /* This we will get from blgetprop() function */

# Declaring output arguments

REAL alpha

INTEGER status = 1

# Using the function blgetprop() we will get


# properties for the std "T" beam section

STRING shape[4] = "T"


REAL dim(4) = [5,5,1,1] /* Dimension for T section */
INTEGER ndim = 4
INTEGER nprop

blgetprop(enttyp, @
shape, @
dim, @
ndim, @
prop, @
nprop)

#---------------------------------------------------------------------

# Using the function blgetalpha() to compute


# the principle angle of beam section. */

status=blgetalpha(enttyp, @
Main Index
CHAPTER 10 1225
Element Properties

prop, @
alpha)

dump alpha
dump status

#--------------------------------------------------------------------

# End of File.

#---------------------------------------------------------------------

blgetbuttonicon ()

# Purpose : This function gets the file system location


# of the button icon bitmap for a shape.
# This function requires beam shape and it
# will give the corresponding path of the
# button icon file.
#
# This file can be run by starting a session of
# MSC.Patran,running this session file through
# the "File","Session","Play" pulldown menus
# on the menu bar.
#
#
# The function blgetbuttonicon()
# has the following arguments:
#
# blgetbuttonicon
# ( INPUT:
# STRING shape,
# OUTPUT:
# STRING cdo(),
# )
#---------------------------------------------------------------------
#

# Declaring and defining input arguments

STRING shape[4] = "T"

# Declaring output arguments

STRING cdo[64]

INTEGER status = 1

#---------------------------------------------------------------------

# Using the function blgetbuttonicon() to get the file system


# location of the button icon bitmap for a beam section shape

status=blgetbuttonicon(shape,cdo)

dump cdo
dump status

#---------------------------------------------------------------------

# End of File.

#---------------------------------------------------------------------
Main Index
1226
Code Examples

blgetcenters ()

# Purpose : This function calculates the centroid and


# shear centre of beam section.
# This function requires beam type (1=basic,
# 2=advanced), beam shape, array of dimensions
# and beam section properties as input arguments
# to this function
#
# This file can be run by starting a session of
# MSC.Patran,running corresponding session file
# through the "File","Session","Play" pulldown
# menus on the menu bar.
#
#
# The function blgetcenters()
# has the following arguments:
#
# blgetcenters
# (INPUT:
# INTEGER enttyp (1=basic,2=advanced),
# STRING shape[],
# REAL dim(),
# REAL prop(),
# OUTPUT:
# REAL centroid(),
# REAL shear()
# )
#
# ---------------------------------------------------------------------

# Declaring and defining input arguments

INTEGER enttyp = 2

STRING shape[4]="T"

REAL dim(4)=[5,5,1,1]

REAL prop(30) /* This we will get from blgetprop() function

# Declaring output arguments

REAL centroid(2)

REAL shear(2)

INTEGER status = 1

# Using the function blgetprop() we will get properties


# for the std "T" beam section

INTEGER ndim = 4
INTEGER nprop

blgetprop(enttyp, @
shape, @
dim, @
ndim, @
prop, @
nprop)

#---------------------------------------------------------------------
Main Index
CHAPTER 10 1227
Element Properties

# Using the function blgetcenters() to compute the


# centroide and shear centre of beam section.

status=blgetcenters(enttyp, @
shape, @
dim, @
prop, @
centroid, @
shear)

dump status
dump centroid
dump shear
#---------------------------------------------------------------------

# End of File

#---------------------------------------------------------------------

blgetdimfieldid ()

# Purpose : This function will give the dimension field


# id This function requires beam section id
# and dimension location as input arguments.
# it will give field id as a output.
#
# This file can be run by starting a session
# of MSC.Patran, running this session file
# through the "File","Session","Play"
# pulldown menus on the menu bar.
#
#
# The function blgetdimfieldid()
# has the following arguments:
#
# blgetdimfieldid
# ( INPUT:
# INTEGER bsid,
# INTEGER dim_loc,
# OUTPUT:
# INTEGER field_id
# )
#---------------------------------------------------------------------
#

# Opening new database

IF(!db_is_open())THEN
uil_file_new.go("", "new.db")
END IF
$? YES 36000002

# In this session file we will find the dimension field id


# for std. beam section "T" using function blgetdimfieldid().
# In this function we will create std "T" beam section using
# function beam_section_create() and then we will get beam
# section id for this new beam section using function
# db_get_beam_section_id() which we will use in
# blgetdimfieldid() function

# Declaring and defining input arguments

INTEGER bsid
Main Index
1228
Code Examples

INTEGER dim_loc = 2

# Declaring output arguments

INTEGER field_id

INTEGER status = 1

# Using the function beam_section_create() we will create


# the std "T" beam section and we will get bsid for this
# new beam using function db_get_beam_section_id()

STRING section_name[16] = "New_Beam"

string shape[4] = "T"

# Creating the field

fields_create( "S", "Spatial", 1, "Scalar", @


"Real", "Coord 0", "", @
"Table", 1, "X", "", "", "", @
"", "", FALSE, [1., 2.], [0.], @
[0.],[[[1.]][[2.]]] )

string dstring[32](4)
dstring(1) = "5.0"
dstring(2) = "5.0"
dstring(3) = "f:S" /* Applying this dim. through field "S" */
dstring(4) = "1.0"

beam_section_create(section_name, @
shape, @
dstring)

db_get_beam_section_id(section_name,bsid)

#---------------------------------------------------------------------

# Using the function blgetdimfieldid() to get the dimension field id

status=blgetdimfieldid(bsid, @
dim_loc, @
field_id)

dump status
dump field_id

#---------------------------------------------------------------------

# End of File.

#---------------------------------------------------------------------

blgetdimvalue

# Purpose : This function will give the dimension value.


# This function requires beam section id and
# dimension location as input arguments. It will
# give dimension value as a output.
#
# This file can be run by starting a session of
Main Index
CHAPTER 10 1229
Element Properties

# MSC.Patran,running this session file through


# the "File","Session","Play" pulldown menus
# on the menu bar.
#
#
# The function blgetdimvalue()
# has the following arguments:
#
# blgetdimvalue
# ( INPUT:
# INTEGER bsid,
# INTEGER dim_loc,
# OUTPUT:
# REAL value
# )
#---------------------------------------------------------------------

#Opening a new database

IF(!db_is_open())THEN
uil_file_new.go("", "new.db")
END IF
$? YES 36000002

# The function execute_function will find the dimension value


# for std. beam section "T" using function blgetdimvalue().
# In this function we will create std "T" beam section using
# function beam_section_create() and we will get beam section id
# for this new beam section using function db_get_beam_section_id()
# which we will use in blgetdimvalue() function

# Declaring and defining input arguments

INTEGER bsid

INTEGER dim_loc = 1

# Declaring output arguments

REAL value

INTEGER status = 1

# Using the function beam_section_create() we will create


# the std "T" beam section and we will get bsid for this
# new beam using function db_get_beam_section_id()

STRING section_name[16] = "New_Beam"

string shape[4] = "T"

string dstring[32](4)
dstring(1) = "5.0"
dstring(2) = "5.0"
dstring(3) = "1.0"
dstring(4) = "1.0"

beam_section_create(section_name, @
shape, @
dstring)

db_get_beam_section_id(section_name, @
bsid)

#---------------------------------------------------------------------
Main Index
1230
Code Examples

# Using the function blgetdimvalue() to get the dimension field id

status=blgetdimvalue(bsid, @
dim_loc, @
value)

dump status
dump value

#---------------------------------------------------------------------
# End of File.
#---------------------------------------------------------------------

blgetlabelicon ()

# Purpose : This function gets the file system location of


# the label icon bitmap for a shape.
# This function requires beam shape and it will
# give the corresponding path of the label icon file.
#
# This file can be run by starting a session of
# MSC.Patran,running this session file through
# the "File","Session","Play" pulldown menus
# on the menu bar.
#
#
# The function blgetlabelicon()
# has the following arguments:
#
# blgetlabelicon
# ( INPUT:
# STRING shape,
# OUTPUT:
# STRING cdo(),
# )
#---------------------------------------------------------------------
#

# Declaring and defining input arguments

STRING shape[4] = "T"

# Declaring output arguments

STRING cdo[64]

INTEGER status = 1

#---------------------------------------------------------------------

# Using the function blgetlabelicon() to get file system


# location of the label icon bitmap for a shape.

status=blgetlabelicon(shape,cdo)

dump cdo
dump status

#---------------------------------------------------------------------

# End of File.
#---------------------------------------------------------------------

Main Index
CHAPTER 10 1231
Element Properties

blgetlabels ()

# Purpose : This function gets the dimension labels for a given


# shape.This function requires beam shape and it will
# give the corresponding dimension labels.
#
# This file can be run by starting a session of
# MSC.Patran,running this session file through
# the "File","Session","Play" pulldown menus
# on the menu bar.
#
#
# The function blgetlabels()
# has the following arguments:
#
# blgetlabels
# ( INPUT:
# STRING shape,
# OUTPUT:
# STRING cdo(),
# )
#---------------------------------------------------------------------
#
#
# Declaring and defining input arguments

STRING shape[4] = "T"

# Declaring output arguments

STRING cdo[64](4)

INTEGER status = 1

#--------------------------------------------------------------------

# Using the function blgetlabels() to get dimension


# labels for the "T" shape beam section.

status=blgetlabels(shape,cdo)

dump cdo
dump status

#---------------------------------------------------------------------

# End of File.

#---------------------------------------------------------------------

blgetnumdimension ()

# Purpose : This function gets the no. of dimension for a


# given shape.
# This function requires beam shape and it will
# give the no. of dimension for that beam.
#
# This file can be run by starting a session of
# MSC.Patran,running this session file through
# the "File","Session","Play" pulldown menus
# on the menu bar.
#
# The function blgetnumdimension()
Main Index
1232
Code Examples

# has the following arguments:


#
# blgetnumdimension
# ( INPUT:
# STRING shape,
# OUTPUT:
# )
#---------------------------------------------------------------------

# Declaring and defining input arguments

STRING shape[4] = "T"

# Declaring output arguments

INTEGER numdim

#---------------------------------------------------------------------

# Using the function blgetnumdimension() to get the


# no. of dimension for given beam section.

numdim = blgetnumdimension(shape)

dump numdim

#---------------------------------------------------------------------

# End of File.

#---------------------------------------------------------------------

blgetnumplotpoints ()

# Purpose : This function gets the number of total plot


# points and loops used to draw a shape.
# This function requires beam, chord tolerance
# and it will give number of total plot
# points and loops.
#
# This file can be run by starting a session of
# MSC.Patran,running this session file through
# the "File","Session","Play" pulldown menus
# on the menu bar.
#
#
# The function blgetnumplotpoints()
# has the following arguments:
#
# blgetnumplotpoints
# ( INPUT:
# STRING shape,
# REAL chord_tol,
# OUTPUT:
# INTEGER npoints,
# INTEGER nloops
# )
#---------------------------------------------------------------------

# Declaring and defining input arguments

STRING shape[4] = "T"

REAL chord_tol = 0.9


Main Index
CHAPTER 10 1233
Element Properties

# Declaring output arguments

INTEGER npoints

INTEGER nloops

INTEGER status

#---------------------------------------------------------------------

# Using the function blgetnumplotpoints() to get the number


# of total plot points and loops for given beam section.

status = blgetnumplotpoints(shape, @
chord_tol, @
npoints, @
nloops)

dump npoints
dump nloops
dump status

#---------------------------------------------------------------------

# End of File.

#---------------------------------------------------------------------

blgetnumplotpointsbyid ()

# Purpose : This function gets the number of total plot


# points and loops used to draw a shape.
# This function requires beam section id and
# chord tolerance as input arguments. It will
# give number of total plot points and loops
# as a output.
#
# This file can be run by starting a session of
# MSC.Patran,running this session file through
# the "File","Session","Play" pulldown menus
# on the menu bar.
#
#
# The function blgetnumplotpointsbyid()
# has the following arguments:
#
# blgetnumplotpointsbyid
# ( INPUT:
# INTEGER bsid,
# REAL chord_tol,
# OUTPUT:
# INTEGER npoints,
# INTEGER nloops
# )
#---------------------------------------------------------------------

# Opening new data base

IF(!db_is_open())THEN
uil_file_new.go("", "new.db")
END IF
$? YES 36000002

# In this session file will find the number of total plot


Main Index
1234
Code Examples

# points and loops for std beam section "T" using function
# blgetnumplotpontsbyid().
# In this function we will create std "T" beam section using
# function beam_section_create() and we will get beam section id
# for this new beam section using function db_get_beam_section_id()
# which we will use in blgetnumplotpontsbyid() function */

# Declaring and defining input arguments */

INTEGER bsid

REAL chord_tol = 0.9

# Declaring output arguments */

INTEGER npoints

INTEGER nloops

INTEGER status = 1

# Using the function beam_section_create() we will create the std "T"


# beam section and we will get bsid for this new beam using function
# db_get_beam_section_id()*/

STRING section_name[16] = "New_Beam"

string shape[4] = "T"

string dstring[32](4)
dstring(1) = "5.0"
dstring(2) = "5.0"
dstring(3) = "1.0"
dstring(4) = "1.0"

beam_section_create(section_name, @
shape, @
dstring)

db_get_beam_section_id(section_name,bsid)

#---------------------------------------------------------------------*/

# Using the function blgetnumplotpointsbyid()to get the number


# of total plot points and loops for given beam section.

status=blgetnumplotpointsbyid(bsid, @
chord_tol, @
npoints, @
nloops)

dump status
dump npoints
dump nloops

#---------------------------------------------------------------------

# End of File.

#---------------------------------------------------------------------

Main Index
CHAPTER 10 1235
Element Properties

blgetnumtypeinfo ()

# Purpose : This function gets the number of section types


# the server supports,and the maximum number of
# dimensions for any section.
# This function does not require input argument
# The output arguments are number of section types
# and maximum number of dimensions for any section.
#
# This file can be run by starting a session of
# MSC.Patran, running corresponding session file
# through the "File","Session","Play" pulldown
# menus on the menu bar.
#
#
# The function blgetnumtypeinfo()
# has the following arguments:
#
# blgetnumtypeinfo
# (INPUT:
# OUTPUT:
# INTEGER nsect,
# INTEGER ndimax
# )
#
#---------------------------------------------------------------------

# Declaring output arguments

INTEGER nsect

INTEGER ndimax

INTEGER status = 1

#---------------------------------------------------------------------

# Using the function blgetnumtypeinfo() to get nsect and ndimax

status=blgetnumtypeinfo(nsect,ndimax)

dump nsect
dump ndimax
dump status

#---------------------------------------------------------------------

# End of File

#---------------------------------------------------------------------

blgetperim ()

# Purpose : This function calculates the exterior perimeter


# of beam section.
# This function requires beam shape and array of
# dimensions of beam section as input arguments
# to this function and it will give exterior
# perimeter of beam section as output.
#
# This file can be run by starting a session of
Main Index
1236
Code Examples

# MSC.Patran, running corresponding session file


# through the "File","Session","Play" pulldown
# menus on the menu bar.
#
#
# The function blgetperim()
# has the following arguments:
#
# blgetperim
# (INPUT:
# STRING shape[],
# REAL dim(),
# OUTPUT:
# REAL perim
# )
#
# ---------------------------------------------------------------------
#
#
# Declaring and defining input arguments

STRING shape[4]="T"

REAL dim(4)=[5,5,1,1]

# Declaring output arguments

REAL perim

INTEGER status = 1

# Using the function blgetperim() to compute the


# centroide and shear centre of beam section.

status=blgetperim(shape, @
dim, @
perim)

dump status
dump perim

#---------------------------------------------------------------------

# End of File

#---------------------------------------------------------------------

blgetplotpoints ()

# Purpose : This function gets the coord. of plot points and the
# number of points on each loop for a given section.
# This function requires beam shape, dimensions for
# beam section, number of tota plot points and loops.
# It will give coordinates of plot points for the
# section and array of number of points on each loop
#
# This file can be run by starting a session of
# MSC.Patran,running this session file through
# the "File","Session","Play" pulldown menus
# on the menu bar.
#
#
# The function blgetplotpoints()
# has the following arguments:
#
Main Index
CHAPTER 10 1237
Element Properties

# blgetplotpoints
# ( INPUT:
# STRING shape,
# REAL dim()
# INTEGER npoints,
# INTEGER nloops,
# OUTPUT:
# REAL points(),
# INTEGER nploop()
# )
#---------------------------------------------------------------------
#
# Declaring and defining input arguments

STRING shape[4] = "T"

REAL dim(4) = [5,5,1,1]

INTEGER npoints

INTEGER nloops

# Declaring output arguments

REAL points(9,2)

INTEGER nploop(4)

INTEGER status

#---------------------------------------------------------------------

# Using the function blgetnumplotpoints() to get the number of total


# plot points(npoints) and loops(nloops) for given beam section and
# this will be used as input arguments to the blgetplotpoints().

REAL chord_tol = 0.9

blgetnumplotpoints(shape, @
chord_tol, @
npoints, @
nloops)

#--------------------------------------------------------------------

# Using the function blgetplotpoints() to get coordinates of plot points


# for the section and array of number of points on each loop.

status = blgetplotpoints(shape, @
dim, @
npoints, @
nloops, @
points, @
nploop)

dump status
dump points
dump nploop

#---------------------------------------------------------------------

# End of File.

#---------------------------------------------------------------------

Main Index
1238
Code Examples

blgetplotpointsbyid ()

# Purpose : This function gets the coordinates of plot points


# and the number of points on each loop for a given
# beam section id,entity type, entity id and entity
# parametric location.
#
# This file can be run by starting a session of
# MSC.Patran,running this session file through
# the "File","Session","Play" pulldown menus
# on the menu bar.
#
# The function blgetplotpointsbyid()
# has the following arguments:
#
# blgetplotpointsbyid
# ( INPUT:
# INTEGER bsid -Beam section id stored in db or region id for
Abaqus
# beams.
# INTEGER bmtype -Beam type 1 = Bar, 2 = Beam or 3 for aero bodies.
For
# Abaqus beams:
# 1001 = Box section
# 1002 = Circular section
# 1003 = I section
# 1004 = L section
# 1005 = Pipe section
# 1006 = Rectangular section
# 1007 = Hex section
# 1008 = Trapazoidal section
# 1009 = Arbitrary section
# INTEGER enttype -Entity type, currently only type 124 is
supported.
# INTEGER entid -Entity id.
# INTEGER nparloc -number of parametric locations.
# REAL parloc(nparloc) -1 dimensional parametric location on
entity.
# INTEGER nrmflg -If 1 calculate normals.
# INTEGER npoints -no. of total plot points for one parametric loc.
# INTEGER nloops -number of loops for one parametric location.
# OUTPUT:
# REAL points(npoints*nparloc,nparloc),
# -Coordinates of plot points for the section.
# One set of points per parametric locations.
# INTEGER nploop(nloop) -Array of number of points on each loop for
# 1 parametric location.
# REAL vec1s(nparloc,3) -array of nparloc axis 1 orientation
vectors.
# REAL vec2s(nparloc,3) -array of nparloc axis 2 orientation
vectors.
# REAL xyz(nparloc*3) -array of evaluated xyz coordinates at
the
# input parametric locations.
# )
#---------------------------------------------------------------------
#
# Opening a new database
uil_file_new.go("","new.db")
# Declaring and defining input arguments

INTEGER bsid
INTEGER bmtype = 2
INTEGER entype = 124
INTEGER entid = 1
INTEGER nparloc = 2
Main Index REAL parloc(2)=[0.5,0.75]
CHAPTER 10 1239
Element Properties

INTEGER nrmflg = 1
INTEGER npoints = 9
INTEGER nloops = 1

# Declaring output arguments

REAL points(18,2)
INTEGER nploop(1)
REAL vec1s(2,3)
REAL vec2s(2,3)
REAL xyz(6)
INTEGER status

#---------------------------------------------------------------------

# Creating the line

STRING asm_create_line_xyz_created_ids[VIRTUAL]
asm_const_line_xyz( "1", "<1 0 0>", @
"[0 0 0]", "Coord 0", @
asm_create_line_xyz_created_ids )

# Creating one element on the line

INTEGER fem_create_mesh_curve_num_nodes
INTEGER fem_create_mesh_curve_num_elems
STRING fem_create_mesh_c_nodes_created[VIRTUAL]
STRING fem_create_mesh_c_elems_created[VIRTUAL]

fem_create_mesh_curv_1( "Curve 1", 16384, 1.,"Bar2", @


"#", "#","Coord 0","Coord 0", @
fem_create_mesh_curve_num_nodes, @
fem_create_mesh_curve_num_elems, @
fem_create_mesh_c_nodes_created, @
fem_create_mesh_c_elems_created )

# Creating the material

material.create( "Analysis code ID", 1, @


"Analysis type ID", 1, @
"mat", 0,"Date: 10-Oct-00 @
Time: 18:09:12", "Isotropic", @
1, "Directionality", @
1, "Linearity", 1, @
"Homogeneous", 0, @
"Linear Elastic", 1, @
"Model Options & IDs", @
["", "", "", "", ""], @
[0, 0, 0, 0, 0], @
"Active Flag", @
1, "Create", 10, @
"External Flag", FALSE, @
"Property IDs", ["", ""], [0], @
"Property Values", [""] )

# Creating the beam section

beam_section_create( "T_s", "T", @


["5","5","1","1"] )

# Creating the element proprties

elementprops_create( "T_sec", 11, 2, 42, @


1, 1, 20, [13, 39, @
6, 4042, 4043, 2047, @
2048, 4037, 4061], @
[5, 11, 2, 2, 2, 4, 4, 1, 6], @
Main Index
1240
Code Examples

["m:mat", "T_s", @
"<1 1 0>", "", "", "", @
"", "", ""], "Curve 1" )

# Using function we will get the beam section Id.

db_get_beam_section_id("T_s", bsid)

#--------------------------------------------------------------------

# Using the function blgetplotpointsbyid() to get the coordinates


# of plot points on each loop for a given parametric loctions.

status = blgetplotpointsbyid(bsid,bmtype, @
entype,entid, @
nparloc,parloc, @
nrmflg,npoints, @
nloops, points, @
nploop, vec1s, @
vec2s,xyz)

dump status
dump points
dump nploop
dump vec1s
dump vec2s
dump xyz

#---------------------------------------------------------------------

# End of File.

#---------------------------------------------------------------------

blgetplotpointsbyid2 ()

# Purpose : This function gets the coordinates of plot points


# and the number of points on each loop for a given
# beam section id,entity type, entity id and entity
# parametric location.
#
# This file can be run by starting a session of
# MSC.Patran,running this session file through
# the "File","Session","Play" pulldown menus
# on the menu bar.
#
#
# The function blgetplotpointsbyid2()
# has the following arguments:
#
# blgetplotpointsbyid2
# ( INPUT:
# INTEGER bsid -Beam section id stored in db or region id for
Abaqus
# beams.
# INTEGER bmtype -Beam type 1 = Bar, 2 = Beam or 3 for aero bodies.
For
# Abaqus beams:
# 1001 = Box section
# 1002 = Circular section
# 1003 = I section
# 1004 = L section
# 1005 = Pipe section
# 1006 = Rectangular section
# 1007 = Hex section
Main Index
CHAPTER 10 1241
Element Properties

# 1008 = Trapazoidal section


# 1009 = Arbitrary section
# INTEGER enttype -Entity type, currently only type 124 is
supported.
# INTEGER entid -Entity id.
# INTEGER nparloc -number of parametric locations.
# REAL parloc(nparloc) -1 dimensional parametric location on
entity.
# INTEGER nrmflg -If 1 calculate normals.
# INTEGER npoints -no. of total plot points for one parametric loc.
# INTEGER nloops -number of loops for one parametric location.
# INTEGER displaymode -If beam type = 1 or 2, this is flag
# whether to process offsets.
# 0 = do not process
# 1 = process
# If beam type = 3, this flag whether slender only,
# interference only, both or none should display.
# 0 = None
# 1 = Slender
# 2 = Interference
# 3 = All
# OUTPUT:
# REAL points(npoints*nparloc,nparloc),
# -Coordinates of plot points for the section.
# One set of points per parametric locations.
# INTEGER nploop(nloop) -Array of number of points on each loop for
# 1 parametric location.
# REAL vec1s(nparloc,3) -array of nparloc axis 1 orientation
vectors.
# REAL vec2s(nparloc,3) -array of nparloc axis 2 orientation
vectors.
# REAL xyz(nparloc*3) -array of evaluated xyz coordinates at
the
# input parametric locations.
# )
#---------------------------------------------------------------------
#

# Opening a new database

uil_file_new.go("","new.db")

# Declaring and defining input arguments

INTEGER bsid
INTEGER bmtype = 2
INTEGER entype = 124
INTEGER entid = 1
INTEGER nparloc = 2
REAL parloc(2)=[0.5,0.75]
INTEGER nrmflg = 1
INTEGER npoints = 9
INTEGER nloops = 1
INTEGER dspmode = 0

# Declaring output arguments

REAL points(18,2)
INTEGER nploop(1)
REAL vec1s(2,3)
REAL vec2s(2,3)
REAL xyz(6)
INTEGER status

#---------------------------------------------------------------------

# Creating the line


Main Index
1242
Code Examples

STRING asm_create_line_xyz_created_ids[VIRTUAL]
asm_const_line_xyz( "1", "<1 0 0>", @
"[0 0 0]", "Coord 0", @
asm_create_line_xyz_created_ids )

# Creating one element on the line

INTEGER fem_create_mesh_curve_num_nodes
INTEGER fem_create_mesh_curve_num_elems
STRING fem_create_mesh_c_nodes_created[VIRTUAL]
STRING fem_create_mesh_c_elems_created[VIRTUAL]

fem_create_mesh_curv_1( "Curve 1", 16384, 1.,"Bar2", @


"#", "#","Coord 0","Coord 0", @
fem_create_mesh_curve_num_nodes, @
fem_create_mesh_curve_num_elems, @
fem_create_mesh_c_nodes_created, @
fem_create_mesh_c_elems_created )

# Creating the material

material.create( "Analysis code ID", 1, @


"Analysis type ID", 1, @
"mat", 0,"Date: 10-Oct-00 @
Time: 18:09:12", "Isotropic", @
1, "Directionality", @
1, "Linearity", 1, @
"Homogeneous", 0, @
"Linear Elastic", 1, @
"Model Options & IDs", @
["", "", "", "", ""], @
[0, 0, 0, 0, 0], @
"Active Flag", @
1, "Create", 10, @
"External Flag", FALSE, @
"Property IDs", ["", ""], [0], @
"Property Values", [""] )

# Creating the beam section

beam_section_create( "T_s", "T", @


["5","5","1","1"] )

# Creating the element proprties

elementprops_create( "T_sec", 11, 2, 42, @


1, 1, 20, [13, 39, @
6, 4042, 4043, 2047, @
2048, 4037, 4061], @
[5, 11, 2, 2, 2, 4, 4, 1, 6], @
["m:mat", "T_s", @
"<1 1 0>", "", "", "", @
"", "", ""], "Curve 1" )

# Using function we will get the beam section Id.

db_get_beam_section_id("T_s", bsid)

#--------------------------------------------------------------------

# Using the function blgetplotpointsbyid2() to get the coordinates


# of plot points on each loop for a given parametric loctions.

status = blgetplotpointsbyid2(bsid,bmtype, @
entype,entid, @
nparloc,parloc, @
Main Index
CHAPTER 10 1243
Element Properties

nrmflg,npoints, @
nloops,dspmode, @
points,nploop, @
vec1s,vec2s,xyz)

dump status
dump points
dump nploop
dump vec1s
dump vec2s
dump xyz

#---------------------------------------------------------------------

# End of File.

#---------------------------------------------------------------------

blgetprop ()

# Purpose : This function will get the all properties


# of beam section.
# This function requires beam type (1=basic,
# 2=advanced), beam shape, array of dimensions
# and and number of dimension as input arguments
# to this function and it will give properties
# and number of properties as output.
#
# This file can be run by starting a session of
# MSC.Patran, running corresponding session file
# through the "File","Session","Play" pulldown
# menus on the menu bar.
#
#
# The function blgetprop()
# has the following arguments:
#
# blgetprop
# (INPUT:
# INTEGER enttyp (1=basic,2=advanced),
# STRING shape[],
# REAL dim(),
# INTEGER ndim,
# OUTPUT:
# REAL prop(),
# INTEGER nprop
# )
#
# ---------------------------------------------------------------------

# Declaring and defining input arguments

INTEGER enttyp = 2

STRING shape[4]="T"

REAL dim(4)=[5.0,5.0,1.0,1.0]

INTEGER ndim = 4

# Declaring output arguments

REAL prop(30)

INTEGER nprop
Main Index
1244
Code Examples

INTEGER status = 1

# Using the function blgetprop() to get properties for the std "T"
# beam section and number of properties.

status = blgetprop(enttyp, @
shape, @
dim, @
ndim, @
prop, @
nprop)

dump status
dump prop
dump nprop

#---------------------------------------------------------------------

# End of File

#---------------------------------------------------------------------

blgetproplabels ()

# Purpose : This function will get the property labels


# for a given beam entity type.
# This function requires beam type (1=basic,
# 2=advanced) as input arguments and it will
# give property labels as a output.
#
# This file can be run by starting a session of
# MSC.Patran, running corresponding session file
# through the "File","Session","Play" pulldown
# menus on the menu bar.
#
#
# The function blgetproplabels()
# has the following arguments:
#
# blgetproplabels
# (INPUT:
# INTEGER enttyp (1=basic,2=advanced),
# OUTPUT:
# STRING cdo[]()
# )
#
# ---------------------------------------------------------------------

# Declaring and defining input arguments

INTEGER enttyp = 2

# Declaring output arguments

STRING cdo[8](30)

INTEGER status = 1

# Using the function blgetproplabels() we will


# get property labels for the beam section .

status = blgetproplabels(enttyp,cdo)
Main Index
CHAPTER 10 1245
Element Properties

dump status
dump cdo

#---------------------------------------------------------------------

# End of File

#---------------------------------------------------------------------

blgettypeinfo ()

# Purpose : This function gets the shape names, number of


# dimensions for each shape, and the number of
# dimensional constraints for each beam shape
# available in patran. This function require
# beam type as input argument.
#
# This file can be run by starting a session of
# MSC.Patran, running corresponding session file
# through the "File","Session","Play" pulldown
# menus on the menu bar.
#
#
# The function blgettypeinfo()
# has the following arguments:
#
# blgettypeinfo
# (INPUT:
# INTEGER entyp (1= basic, 2=advanced)
# OUTPUT:
# STRING shapes[](),
# INTEGER ndims(),
# INTEGER nconsts()
# )
#
#---------------------------------------------------------------------

# Declaring and defining input arguments

INTEGER entyp = 2

# Declaring output arguments

STRING shapes[8](20)
INTEGER ndims(20)
INTEGER nconsts(20)

INTEGER status = 1

#---------------------------------------------------------------------

# Using the function blgettypeinfo() to get shapes, ndims and nconsts

status=blgettypeinfo(entyp, @
shapes, @
ndims, @
nconsts)

dump shapes
dump ndims
dump nconsts
dump status

#---------------------------------------------------------------------
Main Index
1246
Code Examples

# End Of File

#---------------------------------------------------------------------

blmodifybeamdimension ()

# Purpose : This function will modify the beam section


# dimension. This function require beam section
# id, dmension location which is to be modified,
# value and field id.
#
# This file can be run by starting a session of
# MSC.Patran,running this session file through
# the "File","Session","Play" pulldown menus
# on the menu bar.
#
# The function blmodifybeamdimension()
# has the following arguments:
#
# blmodifybeamdimension
# ( INPUT:
# INTEGER bsid,
# INTEGER dimid,
# REAL value,
# INTEGER fid
# OUTPUT:
# )
#---------------------------------------------------------------------
#

# Opening new database

IF (!db_is_open())THEN
uil_file_new.go("", "new.db")
END IF
$? YES 36000002

# Creating field which is to be applied at last dimension


# of "T" section beam while modifying the dimension.

fields_create( "S", "Spatial", 1, @


"Scalar", "Real", @
"Coord 0", "", @
"Table", 1, "X", "", @
"", "", "", "", FALSE, @
[1., 2.], [0.], [0.], @
[[[5.]][[10.]]] )

# Declaring and defining input arguments

INTEGER bsid

INTEGER dimid = 3

REAL value = 6

INTEGER fid = 1

# Declaring output arguments

INTEGER status = 1

# Using the function bl_create_std_beam_section() to create


# the std "T" beam section and id of this beam will be used
Main Index
CHAPTER 10 1247
Element Properties

# as input argument to the function blmodifybeamdimension().

STRING name[16] = "New_Beam"


STRING shape[4] = "T"
INTEGER ndim = 4
INTEGER data_types(4) = [3,3,3,7]
REAL rvalues(4) = [5.,5.,1.,1.]
INTEGER field_ids(4) = [0,0,0,0]

bl_create_std_beam_section(shape, @
name, @
ndim, @
data_types, @
rvalues, @
field_ids, @
bsid)

# Using the function blmodifybeamdimension()


# to modify the beam sec.dimension

status = blmodifybeamdimension(bsid, @
dimid, @
value, @
fid)

dump status

#---------------------------------------------------------------------

# End of File.

#---------------------------------------------------------------------

db_associate_geo_to_region ()

# Purpose : This file provides an example of a call to the


# function db_associate_geo_to_region()
#
# This function associates a specified physical
# property region to a geometric entity in the
# database.This file opens a new database
# “new.db” and creates a physical property region
# with id = 9.It then creates a surface with
# label = 1. Later it gets a count of the
# geometric entities before and after the
# association of the region to surface entity.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_associate_geo_to_region()
# has the following arguments:
#
# db_associate_geo_to_region
# ( gid,
# gtype,
# gsid,
# rid )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_gid
INTEGER i_gtype
Main Index
1248
Code Examples

INTEGER i_gsid
INTEGER i_rid
INTEGER ia_rid(1)
INTEGER i_id = 9
STRING s_region_name[32] = [“REGION”]
INTEGER i_elem_type = 1
INTEGER i_geom_id = 1
INTEGER i_condense_id = 1
INTEGER i_form_id = 1
INTEGER i_lam_id = 1
INTEGER i_dof_set_id = 1
INTEGER i_count_region
INTEGER i_count
STRING sv_asm_create_patch_xy[VIRTUAL]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# Create a physical property region with id = 9


db_create_phys_prop_region @
( i_id, @
s_region_name, @
i_elem_type, @
i_geom_id, @
i_condense_id, @
i_form_id, @
i_lam_id, @
i_dof_set_id )

# Get the region ids


db_count_region_ids(i_count_region)
db_get_all_region_ids(i_count_region,ia_rid)
i_rid = ia_rid(1)

# Create a Surface with label = 1


asm_const_patch_xyz( “1”,”<1 1 0>”,”[0 0 0]”,”Coord 0”, @
sv_asm_create_patch_xy )

# Get surface id for surface label = 1.


db_get_surface_id( 1,i_gid)
# i_gtype = 3 (surface)
i_gtype = 3
i_gsid = 0

# Count the number of entities associated with the physical


# property region.
db_count_geo_in_region @
( i_rid, @
i_count)
dump i_count

i_return_value = @
db_associate_geo_to_region @
( i_gid, @
i_gtype, @
i_gsid, @
i_rid )
dump i_return_value

# Count the number of entities associated with the physical


# property region.
db_count_geo_in_region @
( i_rid, @
i_count)
dump i_count
Main Index
CHAPTER 10 1249
Element Properties

# Check the count of entities before and after the association


# of the geometric entity.

SYS_FREE_STRING( sv_asm_create_patch_xy )
#---------------------------------------------------------------------

db_bulk_get_possible_dof_sets1 ()

# Purpose : This file provides an example of a call to the


# function db_bulk_get_possible_dof_sets1()
#
# This function retrieves all possible values of
# the dof set option for specified input options.
# This file opens a new database “new.db” and
# gets the number of dof set ids and dof set ids
# for the analysis code MSC.Nastran , analysis
# type STRUCTURAL and element type Mass.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_bulk_get_possible_dof_sets1()
# has the following arguments:
#
# db_bulk_get_possible_dof_sets1
# ( etid,
# atid,
# acid,
# nbr,
# dsid )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_etid
INTEGER i_atid
INTEGER i_acid
INTEGER i_nbr
INTEGER ia_dsid(2)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# i_etid = 1 (MASS)
i_etid = 1
# i_atid = 1 (STRUCTURAL)
i_atid = 1
# i_acid = 1 (MSC.Nastran)
i_acid = 1

i_return_value = @
db_bulk_get_possible_dof_sets1 @
( i_etid, @
i_atid, @
i_acid, @
i_nbr, @
ia_dsid )
dump i_return_value

# The number of dof set ids that were found for the above
# specified set of parameters are
Main Index
1250
Code Examples

dump i_nbr
# The unique dof set ids that were found for the above
# specified set of parameters are
dump ia_dsid
#---------------------------------------------------------------------

db_bulk_get_possible_dof_sets2 ()

# Purpose : This file provides an example of a call to the


# function db_bulk_get_possible_dof_sets2()
#
# This function gets all possible values of
# degree of freedom sets for the specified input
# options.This file opens a new database
# “new.db” and gets the possible values of
# degree of freedom sets for the specified input
# options.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_bulk_get_possible_dof_sets2()
# has the following arguments:
#
# db_bulk_get_possible_dof_sets2
# ( etid,
# atid,
# acid,
# coc,
# goc,
# foc,
# loc,
# nbr,
# dsid )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_etid
INTEGER i_atid
INTEGER i_acid
INTEGER i_coc
INTEGER i_goc
INTEGER i_foc
INTEGER i_loc
INTEGER i_nbr
INTEGER ia_dsid(4)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# The names and the ids of the element types,analysis code


# analysis type,degree of freedom option,laminate option,
# geometric option,formulation option,condensation option
# are given in CHAPTER 7 of MSC.Patran USER MANUAL (Vol 4).
# i_etid = 51 (Element type shell)
i_etid = 51
# i_atid = 1 (Analysis type STRUCTURAL)
i_atid = 1
# i_acid = 1 (Analysis code MSC.Nastran)
i_acid = 1
# i_goc = 25 (Geometric option N/A)
Main Index
CHAPTER 10 1251
Element Properties

i_goc = 25
# i_foc = 1 (Formulation option STANDARD FORMULATION)
i_foc = 1
# i_loc = 1 (Laminate option HOMOGENEOUS)
i_loc = 1
# i_coc = 35 ( Condensation option THIN SHELL )
i_coc = 35
i_return_value = @
db_bulk_get_possible_dof_sets2 @
( i_etid, @
i_atid, @
i_acid, @
i_coc, @
i_goc, @
i_foc, @
i_loc, @
i_nbr, @
ia_dsid )
dump i_return_value

# The number of dof set Ids that were found for the above
# specified set of parameters are
dump i_nbr
# The unique dof set Ids that were found for the above
# specified set of parameters are
dump ia_dsid
#---------------------------------------------------------------------

db_bulk_get_possible_form_opts1 ()

# Purpose : This file provides an example of a call to the


# function db_bulk_get_possible_form_opts1()
#
# This function retrieves all possible values of
# the formulation option for specified input
# options.This file opens a new database “new.db”
# and gets the number of formulation options and
# its values for the analysis code MSC.Nastran ,
# analysis type STRUCTURAL and element type Mass.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_bulk_get_possible_form_opts1()
# has the following arguments:
#
# db_bulk_get_possible_form_opts1
# ( etid,
# atid,
# acid,
# nbr,
# foc )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_etid
INTEGER i_atid
INTEGER i_acid
INTEGER i_nbr
INTEGER ia_foc(4)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
Main Index
1252
Code Examples

uil_file_new.go(““,”new.db”)
$? YES 36000002

# i_etid = 1 (MASS)
i_etid = 1
# i_atid = 1 (STRUCTURAL)
i_atid = 1
# i_acid = 1 (MSC.Nastran)
i_acid = 1

i_return_value = @
db_bulk_get_possible_form_opts1 @
( i_etid, @
i_atid, @
i_acid, @
i_nbr, @
ia_foc )
dump i_return_value

# The number of formulation option codes that were found for


# the above specified set of parameters are
dump i_nbr
# The unique formulation option code values that were found for the
# above specified set of parameters are
dump ia_foc
#---------------------------------------------------------------------

db_bulk_get_possible_form_opts2 ()

# Purpose : This file provides an example of a call to the


# function db_bulk_get_possible_form_opts2()
#
# This function gets all possible values of
# formulation option for the specified input
# options.This file opens a new database
# “new.db” and gets the possible values of
# formulation option for the specified input
# options.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_bulk_get_possible_form_opts2()
# has the following arguments:
#
# db_bulk_get_possible_form_opts2
# ( etid,
# atid,
# acid,
# goc,
# coc,
# loc,
# nbr,
# foc )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_etid
INTEGER i_atid
INTEGER i_acid
INTEGER i_goc
INTEGER i_coc
INTEGER i_loc
Main Index
CHAPTER 10 1253
Element Properties

INTEGER i_nbr
INTEGER ia_foc(4)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# The names and the ids of the element types,analysis code


# analysis type,degree of freedom option,laminate option,
# geometric option,formulation option,condensation option
# are given in CHAPTER 7 of MSC.Patran USER MANUAL (Vol 4).
# i_etid = 51 (Element type shell)
i_etid = 51
# i_atid = 1 (Analysis type STRUCTURAL)
i_atid = 1
# i_acid = 1 (Analysis code MSC.Nastran)
i_acid = 1
# i_goc = 25 (Geometric option N/A)
i_goc = 25
# i_loc = 1 (Laminate option HOMOGENEOUS)
i_loc = 1
# i_coc = 35 ( Condensation option THIN SHELL )
i_coc = 35

i_return_value = @
db_bulk_get_possible_form_opts2 @
( i_etid, @
i_atid, @
i_acid, @
i_goc, @
i_coc, @
i_loc, @
i_nbr, @
ia_foc )
dump i_return_value
# The number of formulation option codes found for the above
# specified set of parameters.
dump i_nbr
# The unique formulation option codes values found for the above
# specified set of parameters.
dump ia_foc
#---------------------------------------------------------------------

db_bulk_get_possible_geo_opts1 ()

# Purpose : This file provides an example of a call to the


# function db_bulk_get_possible_geo_opts1()
#
# This function retrieves all possible values of
# the geometric option for specified input
# options.This file opens a new database “new.db”
# and gets the number of geometric options and
# its values for the analysis code MSC.Nastran ,
# analysis type STRUCTURAL and element type Mass.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_bulk_get_possible_geo_opts1()
# has the following arguments:
#
# db_bulk_get_possible_geo_opts1
Main Index
1254
Code Examples

# ( etid,
# atid,
# acid,
# nbr,
# goc )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_etid
INTEGER i_atid
INTEGER i_acid
INTEGER i_nbr
INTEGER ia_goc(2)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# i_etid = 1 (MASS)
i_etid = 1
# i_atid = 1 (STRUCTURAL)
i_atid = 1
# i_acid = 1 (MSC.Nastran)
i_acid = 1

i_return_value = @
db_bulk_get_possible_geo_opts1 @
( i_etid, @
i_atid, @
i_acid, @
i_nbr, @
ia_goc )
dump i_return_value

# The number of geometric option codes that were found for the above
# specified set of parameters are
dump i_nbr
# The unique geometric option code values that were found for the
# above specified set of parameters are
dump ia_goc
#---------------------------------------------------------------------

db_bulk_get_possible_lam_opts1 ()

# Purpose : This file provides an example of a call to the


# function db_bulk_get_possible_lam_opts1()
#
# This function retrieves all possible values of
# the laminate option for specified input
# options.This file opens a new database “new.db”
# and gets the number of laminate options and
# its values for the analysis code MSC.Nastran ,
# analysis type STRUCTURAL and element type Mass.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_bulk_get_possible_lam_opts1()
# has the following arguments:
#
# db_bulk_get_possible_lam_opts1
# ( etid,
Main Index
CHAPTER 10 1255
Element Properties

# atid,
# acid,
# nbr,
# loc )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_etid
INTEGER i_atid
INTEGER i_acid
INTEGER i_nbr
INTEGER ia_loc(2)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# i_etid = 1 (MASS)
i_etid = 1
# i_atid = 1 (STRUCTURAL)
i_atid = 1
# i_acid = 1 (MSC.Nastran)
i_acid = 1

i_return_value = @
db_bulk_get_possible_lam_opts1 @
( i_etid, @
i_atid, @
i_acid, @
i_nbr, @
ia_loc )
dump i_return_value

# The number of laminate option codes that were found for the above
# specified set of parameters are
dump i_nbr
# The unique laminate option code values that were found for the
# above specified set of parameters are
dump ia_loc
#---------------------------------------------------------------------

db_bulk_get_possible_lam_opts2 ()

# Purpose : This file provides an example of a call to the


# function db_bulk_get_possible_lam_opts2()
#
# This function gets all possible values of
# laminate options for the specified input
# options.This file opens a new database
# “new.db” and gets the possible values of
# laminate options for the specified input
# options.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_bulk_get_possible_lam_opts2()
# has the following arguments:
#
# db_bulk_get_possible_lam_opts2
# ( etid,
# atid,
Main Index
1256
Code Examples

# acid,
# goc,
# coc,
# nbr,
# loc )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_etid
INTEGER i_atid
INTEGER i_acid
INTEGER i_goc
INTEGER i_coc
INTEGER i_nbr
INTEGER ia_loc(4)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# The names and the ids of the element types,analysis code


# analysis type,degree of freedom option,laminate option,
# geometric option,formulation option,condensation option
# are given in CHAPTER 7 of MSC.Patran USER MANUAL (Vol 4).
# i_etid = 51 (Element type shell)
i_etid = 51
# i_atid = 1 (Analysis type STRUCTURAL)
i_atid = 1
# i_acid = 1 (Analysis code MSC.Nastran)
i_acid = 1
# i_goc = 25 (Geometric option N/A)
i_goc = 25
# i_coc = 35 ( Condensation option THIN SHELL )
i_coc = 35
i_return_value = @
db_bulk_get_possible_lam_opts2 @
( i_etid, @
i_atid, @
i_acid, @
i_goc, @
i_coc, @
i_nbr, @
ia_loc )
dump i_return_value
# The number of laminate option codes found for the above
# specified set of parameters.
dump i_nbr
# The unique laminate option codes values found for the above
# specified set of parameters.
dump ia_loc
#---------------------------------------------------------------------

db_bulk_get_possible_matl_dirs ()

# Purpose : This file provides an example of a call to the


# function db_bulk_get_possible_matl_dirs()
#
# This function gets the possible values of
# material directionality option for the
# specified input options.This file opens a
# new database “new.db” and gets the possible
# values of material directionality option for
# the specified input optons.
#
Main Index
CHAPTER 10 1257
Element Properties

# This file can be run by starting a session of


# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_bulk_get_possible_matl_dirs()
# has the following arguments:
#
# db_bulk_get_possible_matl_dirs
# ( etid,
# atid,
# acid,
# goc,
# foc,
# loc,
# dsid,
# coc,
# mlc,
# nbr,
# mdc )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_etid
INTEGER i_atid
INTEGER i_acid
INTEGER i_goc
INTEGER i_foc
INTEGER i_loc
INTEGER i_dsid
INTEGER i_coc
INTEGER i_mlc
INTEGER i_nbr
INTEGER ia_mdc(8)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# The names and the ids of the element types,analysis code


# analysis type,degree of freedom option,laminate option,
# geometric option,formulation option,condensation option
# are given in CHAPTER 7 of MSC.Patran USER MANUAL (Vol 4).
# i_etid = 51 (Element type SHELL)
i_etid = 51
# i_atid = 1 (Analysis type STRUCTURAL)
i_atid = 1
# i_acid = 1 (Analysis code MSC.Nastran)
i_acid = 1
# i_goc = 25 (Geometric option N/A)
i_goc = 25
# i_foc = 1 (Formulation option STANDARD FORMULATION)
i_foc = 1
# i_loc = 1 (Laminate option HOMOGENEOUS)
i_loc = 1
# i_dsid = 20 (Dof set name UX,UY,UZ,RX,RY,RZ)
i_dsid = 20
# i_coc = 35 ( Condensation option THIN SHELL )
i_coc = 35
# i_mlc = 1 ( Material linearity LINEARLY ELASTIC)
i_mlc = 1

i_return_value = @
db_bulk_get_possible_matl_dirs @
( i_etid, @
i_atid, @
Main Index
1258
Code Examples

i_acid, @
i_goc, @
i_foc, @
i_loc, @
i_dsid, @
i_coc, @
i_mlc, @
i_nbr, @
ia_mdc )
dump i_return_value

# The number of material directionality codes found for the above


# specified set of parameters.
dump i_nbr
# The unique material directionality code values found for the above
# specified set of parameters.
dump ia_mdc
#---------------------------------------------------------------------

db_bulk_get_possible_matl_lins ()

# Purpose : This file provides an example of a call to the


# function db_bulk_get_possible_matl_lins()
#
# This function gets all possible values of
# material linearity codes for the specified
# input options.This file opens a new database
# “new.db” and gets the possible values of
# material linearity codes for the specified
# input options.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
#
# The function db_bulk_get_possible_matl_lins()
# has the following arguments:
#
# db_bulk_get_possible_matl_lins
# ( etid,
# atid,
# acid,
# goc,
# foc,
# loc,
# dsid,
# coc,
# mdc,
# nbr,
# mlc )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_etid
INTEGER i_atid
INTEGER i_acid
INTEGER i_goc
INTEGER i_foc
INTEGER i_loc
INTEGER i_dsid
INTEGER i_coc
INTEGER i_mdc
INTEGER i_nbr
Main Index
CHAPTER 10 1259
Element Properties

INTEGER ia_mlc(4)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# The names and the ids of the element types,analysis code


# analysis type,degree of freedom option,laminate option,
# geometric option,formulation option,condensation option
# are given in CHAPTER 7 of MSC.Patran USER MANUAL (Vol 4).
# i_etid = 51 (Element type shell)
i_etid = 51
# i_atid = 1 (Analysis type STRUCTURAL)
i_atid = 1
# i_acid = 1 (Analysis code MSC.Nastran)
i_acid = 1
# i_goc = 25 (Geometric option N/A)
i_goc = 25
# i_foc = 1 (Formulation option STANDARD FORMULATION)
i_foc = 1
# i_loc = 1 (Laminate option HOMOGENEOUS)
i_loc = 1
# i_dsid = 20 (Dof set name UX,UY,UZ,RX,RY,RZ)
i_dsid = 20
# i_coc = 35 ( Condensation option THIN SHELL )
i_coc = 35
# i_mdc = 1 ( Material directionality code ISOTROPIC )
i_mdc = 1
i_return_value = @
db_bulk_get_possible_matl_lins @
( i_etid, @
i_atid, @
i_acid, @
i_goc, @
i_foc, @
i_loc, @
i_dsid, @
i_coc, @
i_mdc, @
i_nbr, @
ia_mlc )
dump i_return_value
# The number of material linearity codes found for
# the above specified set of parameters.
dump i_nbr
# The unique material linearity codes values found for
# the above specified set of parameters.
dump ia_mlc
#---------------------------------------------------------------------

db_bulk_get_selected_etops_mat ()

# Purpose : This file provides an example of a call to the


# function db_bulk_get_selected_etops_mat()
#
# This function gets all possible values of
# element topologies for the specified input
# options.This file opens a new database
# “new.db” and gets the possible values of
# element topologies for the specified input
# options.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
Main Index
1260
Code Examples

# through the “File”,”Session”,”Play” pulldown


# menus on the menu bar.
#
# The function db_bulk_get_selected_etops_mat()
# has the following arguments:
#
# db_bulk_get_selected_etops_mat
# ( etid,
# atid,
# acid,
# goc,
# foc,
# loc,
# dsid,
# coc,
# nbr,
# etop )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_etid
INTEGER i_atid
INTEGER i_acid
INTEGER i_goc
INTEGER i_foc
INTEGER i_loc
INTEGER i_dsid
INTEGER i_coc
INTEGER i_nbr
INTEGER ia_etop(8)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# The names and the ids of the element types,analysis code


# analysis type,degree of freedom option,laminate option,
# geometric option,formulation option,condensation option
# are given in CHAPTER 7 of MSC.Patran USER MANUAL (Vol 4).
# i_etid = 51 (Element type shell)
i_etid = 51
# i_atid = 1 (Analysis type STRUCTURAL)
i_atid = 1
# i_acid = 1 (Analysis code MSC.Nastran)
i_acid = 1
# i_goc = 25 (Geometric option N/A)
i_goc = 25
# i_foc = 1 (Formulation option STANDARD FORMULATION)
i_foc = 1
# i_loc = 1 (Laminate option HOMOGENEOUS)
i_loc = 1
# i_dsid = 20 (Dof set name UX,UY,UZ,RX,RY,RZ)
i_dsid = 20
# i_coc = 35 ( Condensation option THIN SHELL )
i_coc = 35
i_return_value = @
db_bulk_get_selected_etops_mat @
( i_etid, @
i_atid, @
i_acid, @
i_goc, @
i_foc, @
i_loc, @
i_dsid, @
i_coc, @
i_nbr, @
Main Index
CHAPTER 10 1261
Element Properties

ia_etop )
dump i_return_value

# The number of element topologies that were found for the


# above specified set of parameters are
dump i_nbr
# The unique element topologies values that were found for the
# above specified set of parameters are
dump ia_etop
#---------------------------------------------------------------------

db_count_elem_type ()

# Purpose : This file provides an example of a call to the


# function db_count_elem_type()
#
# This function gets the count of the number
# of distinct element types for each element
# dimensionality,given a specified analysis
# code and analysis type.This file opens a new
# database “new.db” and counts the distinct
# element types for each dimensionality for
# analysis code MSC.Nastran and analysis type
# STRUCTURAL.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_count_elem_type()
# has the following arguments:
#
# db_count_elem_type
# ( acid,
# atid,
# etcnt )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_acid
INTEGER i_atid
INTEGER ia_etcnt(4)
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# i_acid = 1 ( Analysis code is MSC.Nastran )


i_acid = 1
# i_atid = 1 ( Analysis type is STRUCTURAL )
i_atid = 1

db_count_elem_type @
( i_acid, @
i_atid, @
ia_etcnt )

# The count of element types (one for each dimensionality)


dump ia_etcnt
#---------------------------------------------------------------------

Main Index
1262
Code Examples

db_count_elements_in_region_exp ()

# Purpose : This file provides an example of a call to the


# function db_count_elements_in_region_exp()
#
# The function gets the number of elements in
# a specified region in the database.This
# file opens a new database “new.db” and
# creates a property region with id = 9
# Later it creates four elements with ids
# 1,2,3 and 4.Then it associates the elements
# with id = 2 and id = 3 to the property
# region.Later it counts and gets the elements
# in this region.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_count_elements_in_region_exp()
# has the following arguments:
#
# db_count_elements_in_region_exp
# ( rid,
# count )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_count
INTEGER i_rid
INTEGER iv_eid(VIRTUAL)
INTEGER ia_rid(1)
INTEGER i_count_region
STRING sv_fem_create_elems_created[VIRTUAL]
INTEGER i_id = 9
STRING s_region_name[32] = [“REGION”]
INTEGER i_elem_type = 1
INTEGER i_geom_id = 1
INTEGER i_condense_id = 1
INTEGER i_form_id = 1
INTEGER i_lam_id = 1
INTEGER i_dof_set_id = 1
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# Create a physical property region with id = 9


i_return_value = @
db_create_phys_prop_region @
( i_id, @
s_region_name, @
i_elem_type, @
i_geom_id, @
i_condense_id, @
i_form_id, @
i_lam_id, @
i_dof_set_id )
dump i_return_value

# Create four elements.


fem_create_elems(“Bar”,”Bar2”,”1”,”standard” @
,TRUE,”[0 0 0]”,”[1 0 0]”,””,””,””,””,””,””, @
sv_fem_create_elems_created)
Main Index
CHAPTER 10 1263
Element Properties

fem_create_elems(“Bar”,”Bar2”,”2”,”standard” @
,TRUE,”[1 0 0]”,”[1 1 0]”,””,””,””,””,””,””, @
sv_fem_create_elems_created)
fem_create_elems(“Bar”,”Bar2”,”3”,”standard” @
,TRUE,”[1 1 0]”,”[0 1 0]”,””,””,””,””,””,””, @
sv_fem_create_elems_created)
fem_create_elems(“Bar”,”Bar2”,”4”,”standard” @
,TRUE,”[0 1 0]”,”[0 0 0]”,””,””,””,””,””,””, @
sv_fem_create_elems_created)

# Get the region ids


i_return_value = db_count_region_ids(i_count_region)
dump i_return_value
i_return_value = db_get_all_region_ids(i_count_region,ia_rid)
dump i_return_value
i_rid = ia_rid(1)

# Associate the elements with id = 2 and 3 to the property region.


i_return_value = db_associate_element_to_region(2,i_rid)
dump i_return_value
i_return_value = db_associate_element_to_region(3,i_rid)
dump i_return_value

# Count the number of elements associated with the physical


# property region.
i_return_value = @
db_count_elements_in_region_exp @
( i_rid, @
i_count )
dump i_return_value

# The number of the elements associated with the region.


dump i_count

SYS_ALLOCATE_ARRAY(iv_eid,1,i_count)

# Get all elements for the physical property region


i_return_value = @
db_get_elements_in_region_exp @
( i_count, @
i_rid, @
iv_eid )
dump i_return_value

# The ids of the elements associated with the region.


dump iv_eid

SYS_FREE_ARRAY(iv_eid)
SYS_FREE_STRING(sv_fem_create_elems_created)
#---------------------------------------------------------------------

db_count_etop_for_a_code ()

# Purpose : This file provides an example of a call to the


# function db_count_etop_for_a_code()
#
# This function gives a count of element
# topologies based on the analysis code and type.
# This file opens a new database “new.db” and
# counts the element topologies for the analysis
# code MSC.Nastran and analysis type STRUCTURAL.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
Main Index
1264
Code Examples

#
# The function db_count_etop_for_a_code()
# has the following arguments:
#
# db_count_etop_for_a_code
# ( acid,
# atid,
# count )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_acid
INTEGER i_atid
INTEGER i_count
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# i_acid = 1 ( Analysis code is MSC.Nastran )


i_acid = 1
# i_atid = 1 ( Analysis type is STRUCTURAL )
i_atid = 1

i_return_value = @
db_count_etop_for_a_code @
( i_acid, @
i_atid, @
i_count )
dump i_return_value

# The count of element topologies for analysis code MSC.Nastran


# and analysis type STRUCTURAL is
dump i_count
#---------------------------------------------------------------------

db_count_geo_in_region ()

# Purpose : This file provides an example of a call to the


# function db_count_geo_in_region()
#
# This function gets the count of entities
# associated with a physical property region in
# the database.This file opens the database
# “spool.db” and gets the number of regions and
# the region ids.Later it gets the count of
# entities associated with this region id.The
# spool database has one region and has six
# surfaces associated with this region.
#
# Before running this session file run spool.ses
# to create spool.db.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_count_geo_in_region()
# has the following arguments:
#
# db_count_geo_in_region
# ( rid,
# count )
Main Index
CHAPTER 10 1265
Element Properties

#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_rid
INTEGER ia_rid(1)
INTEGER i_count
INTEGER i_count_region
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Get the region ids


db_count_region_ids(i_count_region)
db_get_all_region_ids(i_count_region,ia_rid)
i_rid = ia_rid(1)

# Count the number of entities associated with the physical


# property region.
i_return_value = @
db_count_geo_in_region @
( i_rid, @
i_count )
dump i_return_value

# The count of geometric entities in the region are.


dump i_count
#---------------------------------------------------------------------

db_create_analysis_elements ()

# Purpose : This file provides an example of a call to the


# function db_create_analysis_elements()
#
# This function stores a set of analysis element
# relationship.This file opens a new database
# “new.db” and gets the set of analysis elements
# relationship for analysis code MSC.Nastran and
# analysis code STRUCTURAL.It then deletes the
# analysis elements relationship and further
# creates a new element analysis relationship.
# Finally it gets the newly created element
# analysis relationship.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_create_analysis_elements()
# has the following arguments:
#
# db_create_analysis_elements
# ( acid,
# atid,
# etcnt,
# etids,
# etnames )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_acid
INTEGER i_atid
INTEGER i_etcnt
INTEGER ia_etids(2)
Main Index
1266
Code Examples

STRING sa_etnames[32](2)
INTEGER ia_etids_c(4)
INTEGER iv_etids_c(VIRTUAL)
STRING sv_etnames_c[32](VIRTUAL)
INTEGER iv_etids_c1(VIRTUAL)
STRING sv_etnames_c1[32](VIRTUAL)
INTEGER i_etcntmax
INTEGER i_etcntfound
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# i_acid = 1 (Analysis code MSC.Nastran )


i_acid = 1
# i_atid = 1 (Analysis type STRUCTURAL )
i_atid = 1

db_count_elem_type @
( i_acid, @
i_atid, @
ia_etids_c )
# Adding the element type of each dimensionality to get
# the maximum number of element types.
i_etcntmax = ia_etids_c(1) + ia_etids_c(2) + @
ia_etids_c(3) + ia_etids_c(4)

SYS_ALLOCATE_ARRAY(iv_etids_c,1,i_etcntmax )
SYS_ALLOCATE_ARRAY(sv_etnames_c,1,i_etcntmax )

# Get the set of analysis element relation


i_return_value = @
db_get_analysis_elements @
( i_acid, @
i_atid, @
i_etcntmax, @
i_etcntfound, @
iv_etids_c, @
sv_etnames_c )
dump i_return_value

# The element type ids retrived


dump iv_etids_c
# The element type names related to corresponding ids
dump sv_etnames_c

# Delete the set of analysis elements relation


i_return_value = @
db_delete_analysis_elements @
( i_acid, @
i_atid, @
i_etcntmax, @
iv_etids_c )
dump i_return_value

# Create the set of analysis element relation


i_etcnt = 2
ia_etids = [ 1,2 ]
sa_etnames(1) = “GSSL”
sa_etnames(2) = “MSC”
i_return_value = @
db_create_analysis_elements @
( i_acid, @
i_atid, @
i_etcnt, @
ia_etids, @
sa_etnames )
Main Index
CHAPTER 10 1267
Element Properties

dump i_return_value

# Get the set of analysis element relation


i_etcntmax = 2
SYS_ALLOCATE_ARRAY(iv_etids_c1,1,i_etcntmax )
SYS_ALLOCATE_ARRAY(sv_etnames_c1,1,i_etcntmax )
i_return_value = @
db_get_analysis_elements @
( i_acid, @
i_atid, @
i_etcntmax, @
i_etcntfound, @
iv_etids_c1, @
sv_etnames_c1 )
dump i_return_value

# The number of elements found


dump i_etcntfound
# The element type ids retrived
dump iv_etids_c1
# The element type names related to corresponding ids
dump sv_etnames_c1
SYS_FREE_ARRAY(iv_etids_c)
SYS_FREE_ARRAY(sv_etnames_c)
SYS_FREE_ARRAY(iv_etids_c1)
SYS_FREE_ARRAY(sv_etnames_c1)
#---------------------------------------------------------------------

db_create_anl_elm_summary ()

# Purpose : This file provides an example of a call to the


# function db_create_anl_elm_summary()
#
# This function stores an analysis element
# summary relationship.This file opens a new
# database “new.db” and gets the present summary
# for analysis code MSC.Nastran and analysis
# type STRUCTURAL.Later it deletes this summary
# and creates a new summary.Finally it gets this
# new summary.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_create_anl_elm_summary()
# has the following arguments:
#
# db_create_anl_elm_summary
# ( acid,
# atid,
# etcnt )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_acid
INTEGER i_atid
INTEGER ia_etcnt(4)
INTEGER ia_etcnt_c(4)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
Main Index
1268
Code Examples

# i_acid = 1 (MSC.Nastran)
i_acid = 1
# i_atid = 1 (STRUCTURAL)
i_atid = 1

i_return_value = @
db_get_anl_elm_summary @
( i_acid, @
i_atid, @
ia_etcnt_c )
dump i_return_value

# The count of element types one for each element dimensionality.


dump ia_etcnt_c

# Delete the analysis summary


i_return_value = @
db_delete_anl_elm_summary @
( i_acid, @
i_atid )
dump i_return_value

# Create a new elm summary


# ia_etcnt = [ 5,5,5,5 ]
ia_etcnt = [ 5,5,5,5 ]

i_return_value = @
db_create_anl_elm_summary @
( i_acid, @
i_atid, @
ia_etcnt )
dump i_return_value

i_return_value = @
db_get_anl_elm_summary @
( i_acid, @
i_atid, @
ia_etcnt_c )
dump i_return_value

# The count of element types one for each element dimensionality.


dump ia_etcnt_c
# Note the difference in summary before and after creation.
#---------------------------------------------------------------------

db_create_phys_prop_set_defn ()

# Purpose : This file provides an example of a call to the


# function db_create_phys_prop_set_defn()
#
# This function creates a physical property set
# entry into the database.This file opens a new
# database “new.db” and creates a physical
# property set with id= 8 and set name “GSSL”.
# It includes the three physical properties with
# property ids 1,6,7.Later it gets this physical
# property definition using the function
# db_get_phys_prop_set_defn().
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
Main Index
CHAPTER 10 1269
Element Properties

# The function db_create_phys_prop_set_defn()


# has the following arguments:
#
# db_create_phys_prop_set_defn
# ( id,
# name,
# num,
# ppids )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_id
STRING s_name[32],s_name_c[32]
INTEGER i_num,i_num_c
INTEGER ia_ppids(3),ia_ppids_c(3)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

i_id = 8
s_name = “GSSL”
i_num = 3
ia_ppids = [1,6,7]

i_return_value = @
db_create_phys_prop_set_defn @
( i_id, @
s_name, @
i_num, @
ia_ppids )
dump i_return_value

# Get the physical property set definition


db_get_phys_prop_set_defn @
( i_id, @
s_name_c, @
i_num_c, @
ia_ppids_c )

# The name of the physical property set


dump s_name_c
# The number of physical property values associated with this set
dump i_num_c
# The Ids of physical property values associated with this set
dump ia_ppids_c
#---------------------------------------------------------------------

db_create_selected_etype ()

# Purpose : This file provides an example of a call to the


# function db_create_selected_etype()
#
# This function creates a selected element type
# entry in the database.This file opens a new
# database “new.db” and gets the summary of
# analysis elements for analysis type STRUCTURAL
# and analysis code MSC.Nastran.It then creates
# an entry for element type rotary inertia in the
# database using the above function.Finally it
# re-creates the summary table and checks the
# analysis elements summary to show the entry
# of the element type rotary inertia.
#
Main Index
1270
Code Examples

# This file can be run by starting a session of


# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_create_selected_etype()
# has the following arguments:
#
# db_create_selected_etype
# ( atid,
# acid,
# geopcd,
# copcd,
# fopcd,
# lopcd,
# etopid,
# dofsetid,
# mlcd,
# mdcd,
# etypid )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_atid
INTEGER i_acid
INTEGER i_geopcd
INTEGER i_copcd
INTEGER i_fopcd
INTEGER i_lopcd
INTEGER i_etopid
INTEGER i_dofsetid
INTEGER i_mlcd
INTEGER i_mdcd
INTEGER i_etypid
INTEGER ia_etcnt(4)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# i_acid = 1 ( Analysis code is MSC.Nastran )


i_acid = 1
# i_atid = 1 ( Analysis type is Structural )
i_atid = 1

# Get the analysis element summary.


db_get_anl_elm_summary @
( i_acid, @
i_atid, @
ia_etcnt )
# The element summary is
dump ia_etcnt

i_geopcd = 1
i_copcd = 1
i_fopcd = 1
i_lopcd = 1
i_etopid = 1
i_dofsetid = 1
i_mlcd = 1
i_mdcd = 1

# Add the element type rotary inertia which is Zero dimensional.


# i_etypid = 2
i_etypid = 2
i_return_value = @
Main Index
CHAPTER 10 1271
Element Properties

db_create_selected_etype @
( i_atid, @
i_acid, @
i_geopcd, @
i_copcd, @
i_fopcd, @
i_lopcd, @
i_etopid, @
i_dofsetid, @
i_mlcd, @
i_mdcd, @
i_etypid )

dump i_return_value

# Recreate the summary table.


elementprops_def_create.make_elem_summary()

# Get the analysis element summary.


db_get_anl_elm_summary @
( i_acid, @
i_atid, @
ia_etcnt )
# The element summary is
dump ia_etcnt
# Note the first dimensional value of the element summary
# before and after creation.
#---------------------------------------------------------------------

db_delete_analysis_elements ()

# Purpose : This file provides an example of a call to the


# function db_delete_analysis_elements()
#
# This function removes a set of analysis element
# relationship.This file opens a new database
# “new.db” and gets the set of analysis elements
# relationship for analysis code MSC.Nastran and
# analysis code STRUCTURAL.It then deletes the
# analysis elements relationship and further
# it tries to get the element analysis
# relationship and the error message generated is
# shown.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_delete_analysis_elements()
# has the following arguments:
#
# db_delete_analysis_elements
# ( acid,
# atid,
# etcnt,
# etids )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_acid
INTEGER i_atid
INTEGER i_etcnt
INTEGER ia_etids_c(4)
INTEGER iv_etids(VIRTUAL)
Main Index
1272
Code Examples

STRING sv_etnames[32](VIRTUAL)
STRING s_err_msg[32]
INTEGER i_etcntmax
INTEGER i_etcntfound
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# i_acid = 1 (Analysis code MSC.Nastran )


i_acid = 1
# i_atid = 1 (Analysis type STRUCTURAL )
i_atid = 1

db_count_elem_type @
( i_acid, @
i_atid, @
ia_etids_c )

# Adding the element type of each dimensionality to get


# the maximum number of element types.
i_etcntmax = ia_etids_c(1) + ia_etids_c(2) + @
ia_etids_c(3) + ia_etids_c(4)

SYS_ALLOCATE_ARRAY(iv_etids,1,i_etcntmax )
SYS_ALLOCATE_ARRAY(sv_etnames,1,i_etcntmax )

# Get the set of analysis element relation


i_return_value = @
db_get_analysis_elements @
( i_acid, @
i_atid, @
i_etcntmax, @
i_etcntfound, @
iv_etids, @
sv_etnames )
dump i_return_value

# The element type ids retrived


dump iv_etids
# The element type names related to corresponding ids
dump sv_etnames

# Delete the set of analysis elements relation


i_etcnt = i_etcntmax
i_return_value = @
db_delete_analysis_elements @
( i_acid, @
i_atid, @
i_etcnt, @
iv_etids )
dump i_return_value

# Get the set of analysis element relation


i_return_value = @
db_get_analysis_elements @
( i_acid, @
i_atid, @
i_etcntmax, @
i_etcntfound, @
iv_etids, @
sv_etnames )
dump i_return_value

# The Error message generated due to retrieving the set of


# analysis element relationship which was deleted.
Main Index
CHAPTER 10 1273
Element Properties

msg_get_string(i_return_value,s_err_msg)
dump s_err_msg

SYS_FREE_ARRAY(iv_etids)
SYS_FREE_ARRAY(sv_etnames)
#---------------------------------------------------------------------

db_delete_anl_elm_summary ()

# Purpose : This file provides an example of a call to the


# function db_delete_anl_elm_summary()
#
# This function removes an analysis element
# summary relationship.This file opens a new
# database “new.db” and gets the present summary
# for analysis code MSC.Nastran and analysis
# type STRUCTURAl.Later it deletes this summary
# and tries to gets the summary.The error code
# generated due to missing summary is shown.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_delete_anl_elm_summary()
# has the following arguments:
#
# db_delete_anl_elm_summary
# ( acid,
# atid )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_acid
INTEGER i_atid
INTEGER ia_etcnt(4)
STRING s_msg[64]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# i_acid = 1 (MSC.Nastran)
i_acid = 1
# i_atid = 1 (STRUCTURAL)
i_atid = 1

i_return_value = @
db_get_anl_elm_summary @
( i_acid, @
i_atid, @
ia_etcnt )
dump i_return_value

# The count of element types one for each element dimensionality.


dump ia_etcnt

# Delete the analysis summary


i_return_value = @
db_delete_anl_elm_summary @
( i_acid, @
i_atid )
dump i_return_value
Main Index
1274
Code Examples

i_return_value = @
db_get_anl_elm_summary @
( i_acid, @
i_atid, @
ia_etcnt )
dump i_return_value

# Since the summary is deleted the error code is generated


# when trying to get the summary.The message is
msg_get_string(i_return_value,s_msg)
dump s_msg
#---------------------------------------------------------------------

db_delete_phys_prop_region ()

# Purpose : This file provides an example of a call to the


# function db_delete_phys_prop_region()
#
# This function deletes the specified physical
# property region from the database.This file
# opens a new database “new.db” and creates
# a physical property region with id = 9.It then
# associates the element property word with id =1
# to the created property region.Finally it
# deletes the physical property region.The count
# of no of regions and properties are made at
# appropriate places.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
#
# The function db_delete_phys_prop_region()
# has the following arguments:
#
# db_delete_phys_prop_region
# ( id )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_id = 9
STRING s_region_name[32] = [“REGION”]
INTEGER i_elem_type = 1
INTEGER i_geom_id = 1
INTEGER i_condense_id = 1
INTEGER i_form_id = 1
INTEGER i_lam_id = 1
INTEGER i_dof_set_id = 1
INTEGER i_count_region
INTEGER i_count_props
INTEGER i_word_id = 1
INTEGER i_material_id
INTEGER i_data_type
INTEGER i_integer_val
REAL ra_real_val(3) = [1,0,0]
STRING s_character_val[32] =[“ “]
INTEGER i_node_id
INTEGER i_coord_id
INTEGER i_field_id = 0
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
Main Index
CHAPTER 10 1275
Element Properties

uil_file_new.go(““,”new.db”)
$? YES 36000002

# Create a physical property region with id = 9


db_create_phys_prop_region @
( i_id, @
s_region_name, @
i_elem_type, @
i_geom_id, @
i_condense_id, @
i_form_id, @
i_lam_id, @
i_dof_set_id )

# No of regions are
db_count_region_ids(i_count_region)
dump i_count_region

# Associate a element property word with id = 1 to the property


# region created.
db_create_phys_prop_value @
( i_id, @
i_word_id, @
i_material_id, @
i_data_type, @
i_integer_val, @
ra_real_val, @
s_character_val, @
i_node_id, @
i_coord_id, @
i_field_id )

# No of physical props in the property region are


db_count_props(i_id,i_count_props)
dump i_count_props

i_return_value = @
db_delete_phys_prop_region @
( i_id )
dump i_return_value

# No of regions after deletion are


db_count_region_ids(i_count_region)
dump i_count_region
# No of physical props in the property region after deletion are
db_count_props(i_id,i_count_props)
dump i_count_props
#---------------------------------------------------------------------

db_get_a_phys_prop_w_nord ()

# Purpose : This file provides an example of a call to the


# function db_get_a_phys_prop_w_nord()
#
# This function creates an allowable physical
# property entry in the database.This file opens
# a new database “new.db” and creates a allowable
# entry for physical property “DOF at node 1”
# using analysis code MSC.Nastran and set id = 1.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
Main Index
1276
Code Examples

# The function db_get_a_phys_prop_w_nord()


# has the following arguments:
#
# db_get_a_phys_prop_w_nord
# ( acid,
# ppid,
# defid,
# alias,
# rflag,
# atypes,
# dtype,
# nord,
# aival,
# arval,
# acval )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_acid
INTEGER i_ppid
INTEGER i_defid
STRING s_alias[64]
INTEGER i_rflag
INTEGER ia_atypes(10)
INTEGER i_dtype
INTEGER i_nord
STRING s_aival[32]
STRING s_arval[32]
STRING s_acval[32]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# i_acid = 1 ( Analysis code is MSC.Nastran )


i_acid = 1
# i_ppid = 7 (Id for property “Dof at Node 1”)
i_ppid = 7
# i_defid = 1
i_defid = 1

i_return_value = @
db_get_a_phys_prop_w_nord @
( i_acid, @
i_ppid, @
i_defid, @
s_alias, @
i_rflag, @
ia_atypes, @
i_dtype, @
i_nord, @
s_aival, @
s_arval, @
s_acval )
dump i_return_value

# The alias to be used is


dump s_alias
# Flag indicating the requirement of the property is
dump i_rflag
# Allowable types for this physical property is
dump ia_atypes
# Default type for this property is
dump i_dtype
# PCL function used for validating integer values
dump s_aival
# PCL function used for validating real values
Main Index
dump s_arval
CHAPTER 10 1277
Element Properties

# PCL function used for validating character values


dump s_acval
#---------------------------------------------------------------------

db_get_all_dof_set_names ()

# Purpose : This file provides an example of a call to the


# function db_get_all_dof_set_names()
#
# This function sets the next db_get_next_dof set
# code names and ids to start at the beginning of
# the list of dof code names.This file opens a
# new database “new.db” and sets the db_get_next
# _dof set names to start at the beginning of the
# list of dof set code names and ids from the
# database. Later it gets these names and ids.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
#
# The function db_get_all_dof_set_names() has no arguments
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
STRING s_msg[64]
INTEGER i_id
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

i_return_value = db_get_all_dof_set_names()
dump i_return_value

WHILE( i_return_value == 0 )
i_return_value = @
db_get_next_dof_set_names @
( s_name, @
i_id )
IF( i_return_value == 0 ) THEN
dump s_name
dump i_id
ELSE
dump i_return_value
msg_get_string(i_return_value,s_msg)
dump s_msg
END IF
END WHILE
#---------------------------------------------------------------------

db_get_all_elem_defn ()

# Purpose : This file provides an example of a call to the


# function db_get_all_elem_defn()
#
# This function sets the db_get_next_elem_defn
# to the start of the element type and element
# id table.This file opens a new database
Main Index
1278
Code Examples

# “new.db” and sets the db_get_next_elem_defn


# to the start of the element type and element
# id table.Later it gets these element types
# and ids.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_all_elem_defn()
# has the following arguments:
#
# db_get_all_elem_defn
# ( acid,
# atid,
# eldim )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_acid
INTEGER i_atid
INTEGER i_eldim
INTEGER i_etype_id
STRING s_msg[64]
STRING s_ename[32]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# i_acid = 1 (Analysis code MSC.Nastran)


i_acid = 1
# i_atid = 1 (Analysis type STRUCTURAL)
i_atid = 1
# i_eldim = 0 (Dimensionality is ZERO dimension)
i_eldim = 0

i_return_value = @
db_get_all_elem_defn @
( i_acid, @
i_atid, @
i_eldim )
dump i_return_value

WHILE( i_return_value == 0 )
i_return_value = @
db_get_next_elem_defn @
( i_etype_id, @
s_ename )
IF( i_return_value == 0 ) THEN
dump s_ename
dump i_etype_id
ELSE
dump i_return_value
msg_get_string(i_return_value,s_msg)
dump s_msg
END IF
END WHILE
#---------------------------------------------------------------------

Main Index
CHAPTER 10 1279
Element Properties

db_get_all_form_opt_code_names ()

# Purpose : This file provides an example of a call to the


# function db_get_all_form_opt_code_names()
#
# This function sets the db_get_next_form_opt_
# code names to start at the beginning of the
# list of formulation option code names and id
# from the database.This file opens a new
# database “new.db” and sets the db_get_ next
# _form_opt_code names to start at the beginning
# of the list of formulation option code names
# and ids from the database. Later it gets these
# names and ids.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_all_next_form_opt_code_names() has no arguments
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
STRING s_msg[64]
INTEGER i_id
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

i_return_value = db_get_all_form_opt_code_names()
dump i_return_value

WHILE( i_return_value == 0 )
i_return_value = @
db_get_next_form_opt_code_names @
( s_name, @
i_id )
IF( i_return_value == 0 ) THEN
dump s_name
dump i_id
ELSE
dump i_return_value
msg_get_string(i_return_value,s_msg)
dump s_msg
END IF
END WHILE
#---------------------------------------------------------------------

db_get_all_geo_opt_code_names ()

# Purpose : This file provides an example of a call to the


# function db_all_next_geo_opt_code_names()
#
# This function sets the db_get_next_geo_opt_code
# names to start at the beginning of the list
# of geometric option code names and id from
# the database.This file opens a new database
# “new.db” and sets the db_get_next_geo_opt_
# code names to start at the beginning of the
Main Index
1280
Code Examples

# list of geometric option code names and ids


# from the database. Later it gets these names
# and ids.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_all_geo_opt_code_names()has no arguments
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
STRING s_msg[64]
INTEGER i_id
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

i_return_value = db_get_all_geo_opt_code_names()
dump i_return_value

WHILE( i_return_value == 0 )
i_return_value = @
db_get_next_geo_opt_code_names @
( s_name, @
i_id )
IF( i_return_value == 0 ) THEN
dump s_name
dump i_id
ELSE
dump i_return_value
msg_get_string(i_return_value,s_msg)
dump s_msg
END IF
END WHILE
#---------------------------------------------------------------------

db_get_all_lam_opt_code_names ()

# Purpose : This file provides an example of a call to the


# function db_all_next_lam_opt_code_names()
#
# This function sets the db_get_next_lam_opt_code
# names to start at the beginning of the list
# of lamination option code names and id from
# the database.This file opens a new database
# “new.db” and sets the db_get_next_lam_opt_
# code names to start at the beginning of the
# list of lamination option code names and ids
# from the database. Later it gets these names
# and ids.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_all_lam_opt_code_names() has no arguments
#
#---------------------------------------------------------------------
# Variable Declarations
Main Index
CHAPTER 10 1281
Element Properties

STRING s_name[32]
STRING s_msg[64]
INTEGER i_id
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

i_return_value = db_get_all_lam_opt_code_names()
dump i_return_value

WHILE( i_return_value == 0 )
i_return_value = @
db_get_next_lam_opt_code_names @
( s_name, @
i_id )
IF( i_return_value == 0 ) THEN
dump s_name
dump i_id
ELSE
dump i_return_value
msg_get_string(i_return_value,s_msg)
dump s_msg
END IF
END WHILE
#---------------------------------------------------------------------

db_get_all_pp_ids_and_names ()

# Purpose : This file provides an example of a call to the


# function db_get_all_pp_ids_and_names()
#
# This function sets the db_get_next_pp_ids_and
# _names to the start of the list of the physical
# property.This file opens the database
# “spool.db” and sets the db_get_next_pp_ids_and
# _names to the start of the list of the physical
# property words.Later it gets the ids,names and
# datatypes of the physical property words in the
# database.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
#
# The function db_get_all_pp_ids_and_names() has no arguments
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_pp_id
STRING s_pp_name[32]
STRING s_msg[64]
INTEGER i_datatype
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

i_return_value = db_get_all_pp_ids_and_names()
Main Index
1282
Code Examples

dump i_return_value

WHILE( i_return_value == 0 )
i_return_value = @
db_get_next_pp_ids_and_names @
( i_pp_id, @
s_pp_name, @
i_datatype )
IF( i_return_value == 0 ) THEN
dump i_pp_id
dump s_pp_name
dump i_datatype
ELSE
msg_get_string(i_return_value,s_msg)
dump s_msg
END IF
END WHILE
#---------------------------------------------------------------------

db_get_allowable_phys_prop ()

# Purpose : This file provides an example of a call to the


# function db_get_allowable_phys_prop()
#
# This function creates an allowable physical
# property entry in the database.This file opens
# a new database “new.db” and creates a allowable
# entry for physical property “DOF at node 1”
# using analysis code MSC.Nastran.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_allowable_phys_prop()
# has the following arguments:
#
# db_get_allowable_phys_prop
# ( acid,
# ppid,
# alias,
# rflag,
# atypes,
# dtype,
# nord,
# aival,
# arval,
# acval )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_acid
INTEGER i_ppid
STRING s_alias[64]
INTEGER i_rflag
INTEGER ia_atypes(10)
INTEGER i_dtype
INTEGER i_nord
STRING s_aival[32]
STRING s_arval[32]
STRING s_acval[32]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
Main Index
CHAPTER 10 1283
Element Properties

uil_file_new.go(““,”new.db”)
$? YES 36000002

# i_acid = 1 ( Analysis code is MSC.Nastran )


i_acid = 1
# i_ppid = 7 (Id for property “Dof at Node 1”)
i_ppid = 7

i_return_value = @
db_get_allowable_phys_prop @
( i_acid, @
i_ppid, @
s_alias, @
i_rflag, @
ia_atypes, @
i_dtype, @
i_nord, @
s_aival, @
s_arval, @
s_acval )
dump i_return_value

# The alias to be used is


dump s_alias
# Flag indicating the requirement of the property is
dump i_rflag
# Allowable types for this physical property is
dump ia_atypes
# Default type for this property is
dump i_dtype
# pcl function used for validating integer values
dump s_aival
# pcl function used for validating real values
dump s_arval
# pcl function used for validating character values
dump s_acval
#---------------------------------------------------------------------

db_get_analysis_elements ()

# Purpose : This file provides an example of a call to the


# function db_get_analysis_elements()
#
# This function retrieves a set of analysis
# element relationship.This file opens a new
# database “new.db” and gets the set of analysis
# elements relationship for analysis code
# MSC.Nastran and analysis code STRUCTURAL.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_analysis_elements()
# has the following arguments:
#
# db_get_analysis_elements
# ( acid,
# atid,
# etcntmax,
# etcntfound,
# etids,
# etnames )
#
Main Index
1284
Code Examples

#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_acid
INTEGER i_atid
INTEGER i_etcnt
INTEGER ia_etids_c(4)
INTEGER iv_etids(VIRTUAL)
STRING sv_etnames[32](VIRTUAL)
INTEGER i_etcntmax
INTEGER i_etcntfound
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# i_acid = 1 (Analysis code MSC.Nastran )


i_acid = 1
# i_atid = 1 (Analysis type STRUCTURAL )
i_atid = 1

db_count_elem_type @
( i_acid, @
i_atid, @
ia_etids_c )

# Adding the element type of each dimensionality to get


# the maximum number of element types.
i_etcntmax = ia_etids_c(1) + ia_etids_c(2) + @
ia_etids_c(3) + ia_etids_c(4)

SYS_ALLOCATE_ARRAY(iv_etids,1,i_etcntmax )
SYS_ALLOCATE_ARRAY(sv_etnames,1,i_etcntmax )

# Get the set of analysis element relationship


i_return_value = @
db_get_analysis_elements @
( i_acid, @
i_atid, @
i_etcntmax, @
i_etcntfound, @
iv_etids, @
sv_etnames )
dump i_return_value

# The number of elements found


dump i_etcntfound
# The element type ids retrived
dump iv_etids
# The element type names related to corresponding ids
dump sv_etnames

SYS_FREE_ARRAY(iv_etids)
SYS_FREE_ARRAY(sv_etnames)
#---------------------------------------------------------------------

db_get_anl_elm_summary ()

# Purpose : This file provides an example of two calls to


# the function db_get_anl_elem_summary()
#
# This function retrieves an analysis element
# summary relationship.This file opens a new
# database “new.db” and gets the present summary
# for analysis code MSC.Nastran and analysis
Main Index
CHAPTER 10 1285
Element Properties

# type STRUCTURAl.Later it deletes this summary


# and creates a new summary.Finally it gets this
# new summary.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_anl_elem_summary()
# has the following arguments:
#
# db_get_anl_elem_summary
# ( acid,
# atid,
# etcnt )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_acid
INTEGER i_atid
INTEGER ia_etcnt(4)
INTEGER ia_etcnt_c(4)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# i_acid = 1 (MSC.Nastran)
i_acid = 1
# i_atid = 1 (STRUCTURAL)
i_atid = 1

i_return_value = @
db_get_anl_elm_summary @
( i_acid, @
i_atid, @
ia_etcnt )
dump i_return_value

# The count of element types one for each element dimensionality.


dump ia_etcnt

# Delete the analysis summary


i_return_value = @
db_delete_anl_elm_summary @
( i_acid, @
i_atid )
dump i_return_value

# Create a new elm summary


# ia_etcnt_c = [ 5,5,5,5 ]
ia_etcnt_c = [ 5,5,5,5 ]

i_return_value = @
db_create_anl_elm_summary @
( i_acid, @
i_atid, @
ia_etcnt_c )
dump i_return_value

i_return_value = @
db_get_anl_elm_summary @
( i_acid, @
i_atid, @
ia_etcnt )
Main Index
1286
Code Examples

dump i_return_value

# The count of element types one for each element dimensionality.


dump ia_etcnt
# Note the difference in summary before and after creation.
#---------------------------------------------------------------------

db_get_elements_in_region_exp ()

# Purpose : This file provides an example of a call to the


# function db_get_elements_in_region_exp()
#
# The function gets the element ids for a
# specified region from the database.This
# file opens a new database “new.db” and
# creates a property region with id = 9
# Later it creates four elements with ids
# 1,2,3 and 4.Then it associates the elements
# with id = 2 and id = 3 to the property
# region.Later it gets the elements in
# this region.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_elements_in_region_exp()
# has the following arguments:
#
# db_get_elements_in_region_exp
# ( count,
# rid,
# eid )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_count
INTEGER i_rid
INTEGER iv_eid(VIRTUAL)
INTEGER ia_rid(1)
INTEGER i_count_region
STRING sv_fem_create_elems_created[VIRTUAL]
INTEGER i_id = 9
STRING s_region_name[32] = [“REGION”]
INTEGER i_elem_type = 1
INTEGER i_geom_id = 1
INTEGER i_condense_id = 1
INTEGER i_form_id = 1
INTEGER i_lam_id = 1
INTEGER i_dof_set_id = 1
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# Create a physical property region with id = 9


i_return_value = @
db_create_phys_prop_region @
( i_id, @
s_region_name, @
i_elem_type, @
i_geom_id, @
i_condense_id, @
Main Index
CHAPTER 10 1287
Element Properties

i_form_id, @
i_lam_id, @
i_dof_set_id )
dump i_return_value

# Create four elements.


fem_create_elems(“Bar”,”Bar2”,”1”,”standard” @
,TRUE,”[0 0 0]”,”[1 0 0]”,””,””,””,””,””,””, @
sv_fem_create_elems_created)
fem_create_elems(“Bar”,”Bar2”,”2”,”standard” @
,TRUE,”[1 0 0]”,”[1 1 0]”,””,””,””,””,””,””, @
sv_fem_create_elems_created)
fem_create_elems(“Bar”,”Bar2”,”3”,”standard” @
,TRUE,”[1 1 0]”,”[0 1 0]”,””,””,””,””,””,””, @
sv_fem_create_elems_created)
fem_create_elems(“Bar”,”Bar2”,”4”,”standard” @
,TRUE,”[0 1 0]”,”[0 0 0]”,””,””,””,””,””,””, @
sv_fem_create_elems_created)

# Get the region ids


i_return_value = db_count_region_ids(i_count_region)
dump i_return_value
i_return_value = db_get_all_region_ids(i_count_region,ia_rid)
dump i_return_value
i_rid = ia_rid(1)

# Associate the elements with id = 2 and 3 to the property region.


i_return_value = db_associate_element_to_region(2,i_rid)
dump i_return_value
i_return_value = db_associate_element_to_region(3,i_rid)
dump i_return_value

# Count the number of elements associated with the physical


# property region.
i_return_value = @
db_count_elements_in_region_exp @
( i_rid, @
i_count )
dump i_return_value

SYS_ALLOCATE_ARRAY(iv_eid,1,i_count)

# Get all elements for the physical property region


i_return_value = @
db_get_elements_in_region_exp @
( i_count, @
i_rid, @
iv_eid )
dump i_return_value

# The ids of the elements associated with the region.


dump iv_eid

SYS_FREE_ARRAY(iv_eid)
SYS_FREE_STRING(sv_fem_create_elems_created)
#---------------------------------------------------------------------

db_get_etop_for_a_code ()

# Purpose : This file provides an example of a call to the


# function db_get_etop_for_a_code()
#
# This function retrieves a set of element
# topology ids based on the analysis code and
# type.This file opens a new database “new.db”
Main Index
1288
Code Examples

# and gets the element topology ids for the


# analysis code MSC.Nastran and analysis type
# STRUCTURAL.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_etop_for_a_code()
# has the following arguments:
#
# db_get_etop_for_a_code
# ( acid,
# atid,
# count,
# etids )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_acid
INTEGER i_atid
INTEGER i_count
INTEGER iv_etids(VIRTUAL)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# i_acid = 1 ( Analysis code is MSC.Nastran )


i_acid = 1
# i_atid = 1 ( Analysis type is STRUCTURAL )
i_atid = 1

db_count_etop_for_a_code @
( i_acid, @
i_atid, @
i_count )

SYS_ALLOCATE_ARRAY(iv_etids,1,i_count)

i_return_value = @
db_get_etop_for_a_code @
( i_acid, @
i_atid, @
i_count, @
iv_etids )
dump i_return_value

# The element topology ids for analysis code MSC.Nastran


# and analysis type STRUCTURAL are
dump iv_etids
SYS_FREE_ARRAY(iv_etids)
#---------------------------------------------------------------------

db_get_geo_in_region ()

# Purpose : This file provides an example of a call to the


# function db_get_geo_in_region()
#
# This function gets all the geometric entities
# associated with a physical property region in
# the database.This file opens the database
# “spool.db” and gets the number of regions and
Main Index
CHAPTER 10 1289
Element Properties

# the region ids.Later it gets the count of


# entities associated with this region id and
# gets these geometric entities.The spool
# database has one region and has six surfaces
# associated with this region.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_geo_in_region() has the following arguments:
#
# db_get_geo_in_region
# ( count,
# rid,
# gid,
# gtype,
# gsid )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_count
INTEGER i_rid
INTEGER iv_gid(VIRTUAL)
INTEGER iv_gtype(VIRTUAL)
INTEGER iv_gsid(VIRTUAL)
INTEGER ia_rid(1)
INTEGER i_count_region
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Get the region ids


i_return_value = db_count_region_ids(i_count_region)
dump i_return_value
i_return_value = db_get_all_region_ids(i_count_region,ia_rid)
dump i_return_value
i_rid = ia_rid(1)

# Count the number of entities associated with the physical


# property region.
i_return_value = @
db_count_geo_in_region @
( i_rid, @
i_count )
dump i_return_value

SYS_ALLOCATE_ARRAY(iv_gid,1,i_count)
SYS_ALLOCATE_ARRAY(iv_gtype,1,i_count)
SYS_ALLOCATE_ARRAY(iv_gsid,1,i_count)

# Get all geometric entities for the physical property region


i_return_value = @
db_get_geo_in_region @
( i_count, @
i_rid, @
iv_gid, @
iv_gtype, @
iv_gsid )
dump i_return_value

# The ids of the geometric entities associated with the region.


Main Index
1290
Code Examples

dump iv_gid
# The type of the geometric entities associated with the region.
dump iv_gtype
# The sub-ids of the geometric entities associated with the region.
dump iv_gsid

SYS_FREE_ARRAY(iv_gid)
SYS_FREE_ARRAY(iv_gtype)
SYS_FREE_ARRAY(iv_gsid)
#---------------------------------------------------------------------

db_get_next_dof_set_names ()

# Purpose : This file provides an example of a call to the


# function db_get_next_dof_set_names()
#
# This function gets the next dof set code names
# and id from the database.This file opens a new
# database “new.db” and sets the db_get_next_dof
# set names to start at the beginning of the list
# of dof set code names and ids from the
# database. Later it gets these names and ids.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_next_dof_set_names()
# has the following arguments:
#
# db_get_next_dof_set_names
# ( name,
# id )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
STRING s_msg[64]
INTEGER i_id
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

i_return_value = db_get_all_dof_set_names()
dump i_return_value

WHILE( i_return_value == 0 )
i_return_value = @
db_get_next_dof_set_names @
( s_name, @
i_id )
IF( i_return_value == 0 ) THEN
dump s_name
dump i_id
ELSE
dump i_return_value
msg_get_string(i_return_value,s_msg)
dump s_msg
END IF
END WHILE
#---------------------------------------------------------------------
Main Index
CHAPTER 10 1291
Element Properties

db_get_next_elem_defn ()

# Purpose : This file provides an example of a call to the


# function db_get_next_elem_defn()
#
# This function gets all the definitions for all
# requested elements.This file opens a new
# database “new.db” and sets the db_get_next_
# elem_defn to the start of the element type
# and element id table.Later it gets these
# element types and ids.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_next_elem_defn() has the following arguments:
#
# db_get_next_elem_defn
# ( i_etype_id,
# s_ename )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_acid
INTEGER i_atid
INTEGER i_eldim
INTEGER i_etype_id
STRING s_ename[32]
STRING s_msg[64]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# i_acid = 1 (Analysis code MSC.Nastran)


i_acid = 1
# i_atid = 1 (Analysis type STRUCTURAL)
i_atid = 1
# i_eldim = 0 (Dimensionality is ZERO dimension)
i_eldim = 0

i_return_value = @
db_get_all_elem_defn @
( i_acid, @
i_atid, @
i_eldim )
dump i_return_value

WHILE( i_return_value == 0 )
i_return_value = @
db_get_next_elem_defn @
( i_etype_id, @
s_ename )
IF( i_return_value == 0 ) THEN
dump s_ename
dump i_etype_id
ELSE
dump i_return_value
msg_get_string(i_return_value,s_msg)
dump s_msg
END IF
END WHILE
#---------------------------------------------------------------------
Main Index
1292
Code Examples

db_get_next_form_opt_code_names ()

# Purpose : This file provides an example of a call to the


# function db_get_next_form_opt_code_names()
#
# This function gets the next formulation option
# code names and id from the database.This file
# opens a new database “new.db” and sets the db_
# get_next_form_opt_code names to start at the
# beginning of the list of formulation option
# code names and ids from the database. Later it
# gets these names and ids.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_next_form_opt_code_names()
# has the following arguments:
#
# db_get_next_form_opt_code_names
# ( name,
# id )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
STRING s_msg[64]
INTEGER i_id
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

i_return_value = db_get_all_form_opt_code_names()
dump i_return_value

WHILE( i_return_value == 0 )
i_return_value = @
db_get_next_form_opt_code_names @
( s_name, @
i_id )
IF( i_return_value == 0 ) THEN
dump s_name
dump i_id
ELSE
dump i_return_value
msg_get_string(i_return_value,s_msg)
dump s_msg
END IF
END WHILE
#---------------------------------------------------------------------

db_get_next_geo_opt_code_names ()

# Purpose : This file provides an example of a call to the


# function db_get_next_geo_opt_code_names()
#
# This function gets the next geometric option
# code names and id from the database.This file
# opens a new database “new.db” and sets the db_
Main Index
CHAPTER 10 1293
Element Properties

# get_next_geo_opt_code names to start at the


# beginning of the list of geometric option code
# names and ids from the database. Later it gets
# these names and ids.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_next_geo_opt_code_names()
# has the following arguments:
#
# db_get_next_geo_opt_code_names
# ( name,
# id )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
STRING s_msg[64]
INTEGER i_id
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

i_return_value = db_get_all_geo_opt_code_names()
dump i_return_value

WHILE( i_return_value == 0 )
i_return_value = @
db_get_next_geo_opt_code_names @
( s_name, @
i_id )
IF( i_return_value == 0 ) THEN
dump s_name
dump i_id
ELSE
dump i_return_value
msg_get_string(i_return_value,s_msg)
dump s_msg
END IF
END WHILE
#---------------------------------------------------------------------

db_get_next_lam_opt_code_names ()

# Purpose : This file provides an example of a call to the


# function db_get_next_lam_opt_code_names()
#
# This function gets the next lamination option
# code names and id from the database.This file
# opens a new database “new.db” and sets the db_
# get_next_lam_opt_code names to start at the
# beginning of the list of lamination option
# code names and ids from the database. Later it
# gets these names and ids.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
Main Index
1294
Code Examples

# The function db_get_next_lam_opt_code_names()


# has the following arguments:
#
# db_get_next_lam_opt_code_names
# ( name,
# id )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
STRING s_msg[64]
INTEGER i_id
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

i_return_value = db_get_all_lam_opt_code_names()
dump i_return_value

WHILE( i_return_value == 0 )
i_return_value = @
db_get_next_lam_opt_code_names @
( s_name, @
i_id )
IF( i_return_value == 0 ) THEN
dump s_name
dump i_id
ELSE
dump i_return_value
msg_get_string(i_return_value,s_msg)
dump s_msg
END IF
END WHILE
#---------------------------------------------------------------------

db_get_next_pp_ids_and_names ()

# Purpose : This file provides an example of a call to the


# function db_get_next_pp_ids_and_names()
#
# This function gets the id,name and the datatype
# of the physical property used in the database.
# This file opens the database “spool.db” and
# sets the db_get_next_pp_ids_and_names to the
# start of the list of the physical property
# words.Later it gets the ids,names and datatypes
# of the physical property words in the database.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
#
# The function db_get_next_pp_ids_and_names()
# has the following arguments:
#
# db_get_next_pp_ids_and_names
# ( pp_id,
# pp_name,
Main Index
CHAPTER 10 1295
Element Properties

# datatype )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_pp_id
STRING s_pp_name[32]
STRING s_msg[64]
INTEGER i_datatype
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

i_return_value = db_get_all_pp_ids_and_names()
dump i_return_value

WHILE( i_return_value == 0 )
i_return_value = @
db_get_next_pp_ids_and_names @
( i_pp_id, @
s_pp_name, @
i_datatype )
IF( i_return_value == 0 ) THEN
dump i_pp_id
dump s_pp_name
dump i_datatype
ELSE
dump i_return_value
msg_get_string(i_return_value,s_msg)
dump s_msg
END IF
END WHILE
#---------------------------------------------------------------------

db_get_phys_prop_set_defn ()

# Purpose : This file provides an example of a call to the


# function db_get_phys_prop_set_defn()
#
# This function gets the physical property
# definition from the database.This file opens
# a new database “new.db” and creates a physical
# property set with id= 8 and set name “GSSL”.
# It includes the three physical properties with
# property ids 1,6,7.Later it gets this physical
# property definition using the above function.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_phys_prop_set_defn()
# has the following arguments:
#
# db_get_phys_prop_set_defn
# ( id,
# name,
# num,
# ppids )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_id
STRING s_name[32],s_name_c[32]
Main Index
1296
Code Examples

INTEGER i_num,i_num_c
INTEGER ia_ppids(3),ia_ppids_c(3)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

i_id = 8
s_name_c = “GSSL”
i_num_c = 3
ia_ppids_c = [1,6,7]

db_create_phys_prop_set_defn @
( i_id, @
s_name_c, @
i_num_c, @
ia_ppids_c )

# Get the physical property set definition


i_return_value = @
db_get_phys_prop_set_defn @
( i_id, @
s_name, @
i_num, @
ia_ppids )

dump i_return_value

# The name of the physical property set


dump s_name
# The number of physical property values associated with this set
dump i_num
# The Ids of physical property values associated with this set
dump ia_ppids
#---------------------------------------------------------------------

db_get_region_for_geometry ()

# Purpose : This file provides an example of a call to the


# function db_get_region_for_geometry()
#
# This function gets the region id given the
# entity type and entity id.This file opens the
# database “spool.db” and gets the region id for
# surface entity with label = 1.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_region_for_geometry()
# has the following arguments:
#
# db_get_region_for_geometry
# ( entity_type,
# entity_id,
# rid )
#
#---------------------------------------------------------------------
# Variable Declarations
Main Index
CHAPTER 10 1297
Element Properties

INTEGER i_entity_type
INTEGER i_entity_id
INTEGER i_label
INTEGER i_rid
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# i_entity_type = 3 (surface)
i_entity_type = 3

# Get the id of surface with label = 1


# i_label = 1
i_label = 1
db_get_surface_id @
( i_label, @
i_entity_id )

i_return_value = @
db_get_region_for_geometry @
( i_entity_type, @
i_entity_id, @
i_rid )
dump i_return_value

# The Region id for the entity type surface with label = 1 is


dump i_rid
#---------------------------------------------------------------------

db_get_region_ids_and_names ()

# Purpose : This file provides an example of a call to the


# function db_get_region_ids_and_names()
#
# This function gets all region ids and names
# from the database.This file opens the database
# “spool.db” and counts the number of regions.
# Later it gets the region ids and region names.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_region_ids_and_names()
# has the following arguments:
#
# db_get_region_ids_and_names
# ( count,
# rid,
# name )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_count
INTEGER iv_rid(VIRTUAL)
STRING sv_name[64](VIRTUAL)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)
Main Index
1298
Code Examples

# Get the number of region ids in the database.


db_count_region_ids(i_count)

SYS_ALLOCATE_ARRAY(iv_rid,1,i_count)
SYS_ALLOCATE_ARRAY(sv_name,1,i_count)

i_return_value = @
db_get_region_ids_and_names @
( i_count, @
iv_rid, @
sv_name )
dump i_return_value

# The region ids are


dump iv_rid
# The region names are
dump sv_name

SYS_FREE_ARRAY(iv_rid)
SYS_FREE_ARRAY(sv_name)
#---------------------------------------------------------------------

db_get_selected_prop_set ()

# Purpose : This file provides an example of a call to the


# function db_get_selected_prop_set()
#
# This function gets a field in the database.This
# file opens a new database “new.db” and
# associates property set id =4023 to the element
# with all it attributes = 1.Later it gets the
# property set id using the above function.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_selected_prop_set()
# has the following arguments:
#
# db_get_selected_prop_set
# ( atid,
# acid,
# geopcd,
# copcd,
# fopcd,
# lopcd,
# etopid,
# dofsetid,
# physprop )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_atid
INTEGER i_acid
INTEGER i_geopcd
INTEGER i_copcd
INTEGER i_fopcd
INTEGER i_lopcd
INTEGER i_etopid
INTEGER i_dofsetid
INTEGER i_physprop,i_physprop_c
INTEGER i_return_value
Main Index
CHAPTER 10 1299
Element Properties

#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# Define the element attributes.


i_atid = 1
i_acid = 1
i_geopcd = 1
i_copcd = 1
i_fopcd = 1
i_lopcd = 1
i_etopid = 1
i_dofsetid = 1

# Define the set id.


# i_physprop_c = 4023 (stan. Equi. Sec. [CQUAD4/PCOMP])
i_physprop_c = 4023

# Associate property set to an element set defined by above


# element attributes.
db_create_selected_prop_set @
( i_atid, @
i_acid, @
i_geopcd, @
i_copcd, @
i_fopcd, @
i_lopcd, @
i_etopid, @
i_dofsetid, @
i_physprop_c )

# Get the id of the property set.


i_return_value = @
db_get_selected_prop_set @
( i_atid, @
i_acid, @
i_geopcd, @
i_copcd, @
i_fopcd, @
i_lopcd, @
i_etopid, @
i_dofsetid, @
i_physprop )
dump i_return_value

# The Id of the associated physical property set is


dump i_physprop
#---------------------------------------------------------------------

db_set_comp_lam ()

# Purpose : This file provides an example of a call to the


# function db_set_comp_lam()
#
# This session file will open a new database
# by name ‘new.db’ with default options and will
# add two definitions of 2d orthotropic material
# and one definition of composite laminate.
# For material property ids refer User’s Manual
# Part 9, Section 7.5 to 7.7
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
Main Index
1300
Code Examples

# menus on the menu bar.


#
# The function db_set_comp_lam() has the following arguments:
#
# db_set_comp_lam
# ( mat_name,
# num_plies,
# ply_names,
# thicknesses,
# orientations,
# iconven,
# offset,
# offset_def )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_mat_name[32]
INTEGER i_num_plies
STRING sv_ply_names[VIRTUAL]
REAL ra_thicknesses(5)
REAL ra_orientations(5)
INTEGER i_iconven
REAL r_offset
LOGICAL l_offset_def
INTEGER i_return_value
INTEGER iv_ply_names(VIRTUAL)
REAL rv_thicks(VIRTUAL)
REAL rv_orients(VIRTUAL)
INTEGER i_num_def
INTEGER i_iconv
STRING s_offset_string[32]
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
# Creating 2d orthotropic materials for laminate plies. The material
# names are “2dort1” and “2dort2”.

i_return_value = @
material.create( “Analysis code ID”, 1, “Analysis type ID”, 1, @
“2dort1”, 0, “Date: 08-Aug-97 Time: 12:11:28”, @
“2d Orthotropic”, 5, “Directionality”, 4, “Linearity”, 1, @
“Homogeneous”, 0, “Linear Elastic”, 1, “Model Options & IDs”, @
[““, ““, ““, ““, ““], [0, 0, 0, 0, 0], “Active Flag”, 1, “Create”,@
10, “External Flag”, FALSE, “Property IDs”, [“Elastic Modulus”, @
“Elastic Modulus 22”, “Poisson Ratio”, “Shear Modulus”, @
“Shear Modulus 23”, “Shear Modulus 31”], [2, 3, 5, 8, 9, 10, 0], @
“Property Values”, [“2e6”, “2e6”, “.33”, “2e7”, “3e7”, “4e6”, ““])
dump i_return_value

i_return_value = @
material.create( “Analysis code ID”, 1, “Analysis type ID”, 1, @
“2dort2”, 0, “Date: 08-Aug-97 Time: 12:11:28”, @
“2d Orthotropic”, 5, “Directionality”, 4, “Linearity”, 1, @
“Homogeneous”, 0, “Linear Elastic”, 1, “Model Options & IDs”, @
[““, ““, ““, ““, ““], [0, 0, 0, 0, 0], “Active Flag”, 1, “Create”,@
10, “External Flag”, FALSE, “Property IDs”, [“Elastic Modulus”, @
“Elastic Modulus 22”, “Poisson Ratio”, “Shear Modulus”, @
“Shear Modulus 23”, “Shear Modulus 31”], [2, 3, 5, 8, 9, 10, 0], @
“Property Values”,[“2e6”,”2e5”,”.4”,”2e8”,”2.7e7”,”3.7e6”,””] )
dump i_return_value

# Creating laminate composite lam1, with ‘Total’ as stacking sequence.


i_return_value = @
mat_create_lam( “lam1”, ““, 1, [“2dort1”, “2dort2”, “2dort1”, @
“2dort2”, “2dort1”], [0.1, 0.12, 0.1, 0.12, 0.1], @
Main Index
CHAPTER 10 1301
Element Properties

[0., 30., 60., 90., 120.], 5, “10”, “Create” )


dump i_return_value

#---------------------------------------------------------------------
# Loading the laminate definition data for ‘lam1’
s_mat_name = “lam1”
# Number of plies are 5
i_num_plies = 5
#
i_return_value = @
mat_lam_load_defn_show @
( s_mat_name, @
i_num_plies, @
iv_ply_names, @
rv_thicks, @
rv_orients, @
i_num_def, @
i_iconv, @
s_offset_string )
dump i_return_value
# The laminate definition data is
dump iv_ply_names,rv_thicks,rv_orients,i_num_def,i_iconv
dump s_offset_string
#---------------------------------------------------------------------
# Resetting the laminate properties of the laminate material.
s_mat_name = “lam1”
i_num_plies = 5
sys_allocate_string(sv_ply_names,32*i_num_plies)
#
# Each ply name must be in a field of 32 characters, with
# spaces being used to pad the empty space in the field
# 0 1 2 3 3
# 12345678901234567890123456789012345
sv_ply_names = “2dort1 “ // @
“2dort2 “ // @
“2dort1 “ // @
“2dort2 “ // @
“2dort1 “

ra_thicknesses = [0.2, 0.22, 0.2, 0.22, 0.2]


ra_orientations = [0., 30., 60., 90., 120.]
i_iconven = 1
r_offset = 20.0
l_offset_def = true
#
i_return_value = @
db_set_comp_lam @
( s_mat_name, @
i_num_plies, @
sv_ply_names, @
ra_thicknesses, @
ra_orientations, @
i_iconven, @
r_offset, @
l_offset_def )
dump i_return_value
#---------------------------------------------------------------------
# Loading the laminate definition data for ‘lam1’
s_mat_name = “lam1”
# Number of plies are 5
i_num_plies = 5
#
i_return_value = @
mat_lam_load_defn_show @
( s_mat_name, @
i_num_plies, @
iv_ply_names, @
Main Index
1302
Code Examples

rv_thicks, @
rv_orients, @
i_num_def, @
i_iconv, @
s_offset_string )
dump i_return_value
# The laminate definition data is
dump iv_ply_names,rv_thicks,rv_orients,i_num_def,i_iconv
dump s_offset_string
#---------------------------------------------------------------------

Main Index
MSC.Acumen, Volume 2: Code Examples

CHAPTER
Loads and Boundary Conditions
11
■ Introduction

Main Index
1304
Code Examples

11.1 Introduction
This chapter provides code examples for the PCL function described in Volume 1. These
examples are designed so that they can be cut and pasted into a file and, by following the
instructions listed with each example, executed in MSC.Patran.

db_bulk_get_lbc_ds ()

# Purpose : This file provides an example of a call to the


# function db_bulk_get_lbc_ds()
#
# This function fetches unevaluated dynamic
# scalar lbc data attached to specified lbc
#
# In this example the spool database is opened.
# A transient load case(“trans_lc”) is then
# created and made as current load case. Then a
# non-spatial field(“trans_field”) is created.
# LBC(“trans_pressure”) of type pressure is
# created using “trans_field”. Then this
# function is called to evaluate dynamic scalar
# data of “trans_pressure”.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_bulk_get_lbc_ds()
# has the following arguments:
#
# db_bulk_get_lbc_ds
# ( lbc_id,
# max,
# num_dyn_scalar,
# data_id,
# scalar_data_values,
# sc_position,
# sc_dyn,
# scale_factor )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_lbc_id
INTEGER i_max
INTEGER i_num_dyn_scalar
INTEGER ia_data_id(10)
REAL ra_scalar_data_values(10)
INTEGER ia_sc_position(10)
INTEGER ia_sc_dyn(10)
REAL ra_scale_factor(10)
INTEGER i_return_value
INTEGER ia_prior(4)
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Maximum number of dynamic scalar records


i_max = 10
Main Index
CHAPTER 11 1305
Loads and Boundary Conditions

# Create load case “trans_lc”


i_return_value = @
loadcase_create @
( “trans_lc”, @
“Time Dependent”, @
““, @
[““], @
ia_prior, @
““, @
0., @
TRUE )
dump i_return_value

# Create field “trans_field”


i_return_value = @
fields_create( “trans_field”, “Non-Spatial”, 1, “Scalar”, @
“Real”, ““, ““, “Table”, 1, “t”, ““, ““, ““, @
““, ““, FALSE, [0., 1., 2., 3., 4., 5., 6., @
7., 8., 9., 10., 11., 12., 13., 14., 15., 16., @
17., 18., 19., 20.], [0.], [0.], [[[0.]] @
[[10.]][[20.]][[30.]][[40.]][[50.]][[60.]] @
[[70.]][[80.]][[90.]][[100.]][[110.]][[120.]] @
[[130.]][[140.]][[150.]][[160.]][[170.]] @
[[180.]][[190.]][[200.]] ] )
dump i_return_value

# Created Load/BC set “trans_pressure”


i_return_value = @
loadsbcs_create @
( “trans_pressure”, @
“Pressure”, @
“Element Uniform”, @
“2D”, @
“Time Dependent”, @
[“Surface 4”], @
“Geometry”, @
““, @
1., @
[“ 10”, “ 0”, “ 0”], @
[“f:trans_field”, ““, ““] )
dump i_return_value

# Get the lbc id associated with “trans_pressure”


i_return_value = @
db_get_lbc_id @
( “trans_pressure”, @
i_lbc_id )
dump i_return_value

# Fetch unevaluated dynamic scalar lbc data attached to


# “trans_pressure”
i_return_value = @
db_bulk_get_lbc_ds @
( i_lbc_id, @
i_max, @
i_num_dyn_scalar, @
ia_data_id, @
ra_scalar_data_values, @
ia_sc_position, @
ia_sc_dyn, @
ra_scale_factor )
dump i_return_value
dump i_lbc_id
dump i_max
dump i_num_dyn_scalar
dump ia_data_id
dump ra_scalar_data_values
Main Index
1306
Code Examples

dump ia_sc_position
dump ia_sc_dyn
dump ra_scale_factor
#---------------------------------------------------------------------
# Note the following regarding the output values.
#
# 1. LBC 5(“trans_pressure”) having a field id = 2 in ia_sc_dyn
# as it is composed of time dependent field “trans_field”
# (field_id = 2)
#
# 2. ia_data_id consisting of values 1 and 2 indicating top and
# bottom pressure variable-id respectively.
#
# Refer chapter 9.0 in MSC.Patran User Manual - Part 9 (Vol. 4)
# for more details
#---------------------------------------------------------------------

db_bulk_get_lbc_dv ()

# Purpose : This file provides an example of a call to the


# function db_bulk_get_lbc_dv()
#
# This function fetches unevaluated dynamic
# vector lbc data attached to specified lbc
#
# In this example the spool database is opened.
# A transient load case(“trans_lc”) is created
# and made as current load case. Then a
# non-spatial field(“trans_field”) is created.
# LBC(“trans_force”) of type force is created
# using “trans_field”. Then this function is
# called to evaluate dynamic vector data of
# “trans_force”.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_bulk_get_lbc_dv()
# has the following arguments:
#
# db_bulk_get_lbc_dv
# ( lbc_id,
# max,
# num_dyn_vec,
# data_id,
# vec_data_values,
# vec_position,
# vec_dyn,
# null_flag,
# scale_factor )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_lbc_id
INTEGER i_max
INTEGER i_num_dyn_vec
INTEGER ia_data_id(10)
REAL raa_vec_data_values(10,3)
INTEGER iaa_vec_position(10,3)
INTEGER iaa_vec_dyn(10,3)
Main Index
CHAPTER 11 1307
Loads and Boundary Conditions

INTEGER iaa_null_flag(10,3)
REAL ra_scale_factor(10)
INTEGER i_return_value
INTEGER ia_prior(4)
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Maximum number of dynamic scalar records


i_max = 10

# Create load case “trans_lc”


i_return_value = @
loadcase_create @
( “trans_lc”, @
“Time Dependent”, @
““, @
[““], @
ia_prior, @
““, @
0., @
TRUE )
dump i_return_value

# Create field “trans_field”


i_return_value = @
fields_create( “trans_field”, “Non-Spatial”, 1, “Scalar”, @
“Real”, ““, ““, “Table”, 1, “t”, ““, ““, ““, @
““, ““, FALSE, [0., 1., 2., 3., 4., 5., 6., @
7., 8., 9., 10., 11., 12., 13., 14., 15., 16., @
17., 18., 19., 20.], [0.], [0.], [[[0.]] @
[[10.]][[20.]][[30.]][[40.]][[50.]][[60.]] @
[[70.]][[80.]][[90.]][[100.]][[110.]][[120.]] @
[[130.]][[140.]][[150.]][[160.]][[170.]] @
[[180.]][[190.]][[200.]] ] )
dump i_return_value

# Create Load/BC set “trans_force”


i_return_value = @
loadsbcs_create @
( “trans_force”, @
“Force”, @
“Nodal”, @
““, @
“Time Dependent”, @
[ “Point 8”], @
“Geometry”, @
“Coord 0”, @
1., @
[“<0 -1 0 >”, “< 0 0 0 >”], @
[ “f:trans_field”, ““] )
dump i_return_value

# Get the lbc id associated with “trans_force”


i_return_value = @
db_get_lbc_id @
( “trans_force”, @
i_lbc_id )
dump i_return_value

# Fetch unevaluated dynamic vector lbc data attached to


# “trans_force”
i_return_value = @
db_bulk_get_lbc_dv @
( i_lbc_id, @
i_max, @
i_num_dyn_vec, @
Main Index
1308
Code Examples

ia_data_id, @
raa_vec_data_values, @
iaa_vec_position, @
iaa_vec_dyn, @
iaa_null_flag, @
ra_scale_factor )
dump i_return_value
dump i_lbc_id
dump i_max
dump i_num_dyn_vec
dump ia_data_id
dump raa_vec_data_values
dump iaa_vec_position
dump iaa_vec_dyn
dump ra_scale_factor
#---------------------------------------------------------------------
# Note the following regarding the output values.
#
# 1. LBC 5(“trans_force”) having a field id = 2 in iaa_vec_dyn
# as it is composed of time dependent field “trans_field”
# (field_id = 2)
#
# 2. ia_data_id consisting of values 1 and 2 indicating linear force
# and moment variable-id respectively.
#
# Refer chapter 9.0 in MSC.Patran User Manual - Part 9 (Vol. 4)
# for more details
#---------------------------------------------------------------------

db_bulk_get_lbc_ss ()

# Purpose : This file provides an example of multiple calls


# to the function db_bulk_get_lbc_ss()
#
# This function fetches unevaluated static scalar
# lbc data attached to specified lbc
#
# In this example the spool database is opened
# and this function is called to get unevaluated
# static scalar lbc data for all the lbcs.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_bulk_get_lbc_ss()
# has the following arguments:
#
# db_bulk_get_lbc_ss
# ( lbc_id,
# max,
# num_stat_scalar,
# data_id,
# scalar_data_values,
# sc_position,
# scale_factor )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_lbc_id
INTEGER i_max
Main Index
CHAPTER 11 1309
Loads and Boundary Conditions

INTEGER i_num_stat_scalar
INTEGER ia_data_id(10)
REAL ra_scalar_data_values(10)
INTEGER ia_sc_position(10)
REAL ra_scale_factor(10)
INTEGER i_return_value
INTEGER i_count
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Maximum number of static records passed


i_max = 10

# Fetch unevaluated static scalar lbc data


FOR ( i_lbc_id = 1 TO 4 )
i_return_value = @
db_bulk_get_lbc_ss @
( i_lbc_id, @
i_max, @
i_num_stat_scalar, @
ia_data_id, @
ra_scalar_data_values, @
ia_sc_position, @
ra_scale_factor )
dump i_return_value
dump i_lbc_id
dump i_num_stat_scalar
dump ia_data_id
dump ra_scalar_data_values
dump ia_sc_position
dump ra_scale_factor
FOR ( i_count = 1 TO 10 )
ia_data_id ( i_count ) = 0
ra_scalar_data_values ( i_count ) = 0
ia_sc_position ( i_count ) = 0
ra_scale_factor ( i_count ) = 0
END FOR
END FOR
#---------------------------------------------------------------------
# Note the following regarding the output values.
#
# 1. LBC 1(“fillet_pressure”) having a field id in variable
# ia_sc_position, as it is composed of field
# “400_20_psi_transition” and ia_data_id = 2 representing
# bottom pressure.
#
# 2. LBCs 2(“400_psi”) and 3(“20_psi”) containing values in
# ra_scalar_data_values
#
# 3. LBC 4(“TZ_fixed”) having all entries zero as it is a vector
# quantity
#
# Refer chapter 9.0 in MSC.Patran User Manual - Part 9 (Vol. 4)
# for more details
#---------------------------------------------------------------------

db_bulk_get_lbc_sv ()

# Purpose : This file provides an example of two calls


# to the function db_bulk_get_lbc_sv()
#
# This function fetches unevaluated static vector
# lbc data attached to specified lbc
#
Main Index
1310
Code Examples

# In this example the spool database is opened


# and this function is called to get unevaluated
# static vector lbc data for all the lbcs.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_bulk_get_lbc_sv()
# has the following arguments:
#
# db_bulk_get_lbc_sv
# ( lbc_id,
# max,
# num_stat_vec,
# data_id,
# vec_data_values,
# vec_position,
# vec_dyn,
# scale_factor )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_lbc_id
INTEGER i_max
INTEGER i_num_stat_vec
INTEGER ia_data_id(10)
REAL raa_vec_data_values(10,3)
INTEGER iaa_vec_position(10,3)
INTEGER ia_vec_dyn(10,3)
REAL ra_scale_factor(10)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Maximum number of static records passed


i_max = 10

# Fetch unevaluated static vector lbc data


FOR ( i_lbc_id = 3 TO 4 )
i_return_value = @
db_bulk_get_lbc_sv @
( i_lbc_id, @
i_max, @
i_num_stat_vec, @
ia_data_id, @
raa_vec_data_values, @
iaa_vec_position, @
ia_vec_dyn, @
ra_scale_factor )
dump i_return_value
dump i_lbc_id
dump i_num_stat_vec
dump ia_data_id
dump raa_vec_data_values
dump iaa_vec_position
dump ia_vec_dyn
dump ra_scale_factor
END FOR
#---------------------------------------------------------------------
# Note the following regarding the output values.
#
Main Index
CHAPTER 11 1311
Loads and Boundary Conditions

# 1. LBCs 3(“20_psi”) have all entries zero as they are scalars.


#
# 2. LBC 4(“TZ_fixed”) have ia_data_id = 1,2 representing
# translation vector and rotation vector respectively.
# “raa_vec_data_values” consist of zeroes as spool is
# constrained in all degrees of freedom at Point 7.
#
# Refer chapter 9.0 in MSC.Patran User Manual - Part 9 (Vol. 4)
# for more details
#---------------------------------------------------------------------

db_count_appl_geo_region ()

# Purpose : This file provides an example of a call to the


# function db_count_appl_geo_region()
#
# This function gets the number of application
# region stored in the database by lbc_type_id
#
# In this example a new database is opened and
# number of application region for Pressure is
# obtained.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_count_appl_geo_region()
# has the following arguments:
#
# db_count_appl_geo_region
# ( lbc_type_id,
# count )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_lbc_type_id
INTEGER i_count
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# Pressure lbc_type_id
i_lbc_type_id = 8

# Get the number of application geometric region for Pressure


i_return_value = @
db_count_appl_geo_region @
( i_lbc_type_id, @
i_count )
dump i_return_value
dump i_count
#---------------------------------------------------------------------

Main Index
1312
Code Examples

db_count_lbc ()

# Purpose : This file provides an example of 2 calls to the


# function db_count_lbc()
#
# This function gets the number of lbcs stored
# in the database.
#
# In this example the spool database is opened
# and the number of lbcs are verified before and
# after deleting the lbc,”400_psi” using this
# function.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_count_lbc() has the following arguments:
#
# db_count_lbc
# ( count ),
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_count
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Get number of lbcs


i_return_value = @
db_count_lbc @
( i_count )
dump i_return_value
dump i_count

#---------------------------------------------------------------------
# Follow the instructions below to display Loads/BCs in the graphic
# Window.
# Pick “Display”,”Load/BC/Elem Props..” from pull-down menus
# Select “Show All” below Loads/BCs and “Apply”
#---------------------------------------------------------------------
# Session file paused. Press “Resume” to continue..
sf_pause()
#---------------------------------------------------------------------
# Delete lbc
i_return_value = @
loadsbcs_delete @
( [“400_psi”] )

# Get number of lbcs


i_return_value = @
db_count_lbc @
( i_count )
dump i_return_value
dump i_count

# It can be observed that number of lbcs decreased by one due to


# deletion
#---------------------------------------------------------------------
Main Index
CHAPTER 11 1313
Loads and Boundary Conditions

db_count_lbc_appl_region_entity ()

# Purpose : This file provides an example of a call to the


# function db_count_lbc_appl_region_entity()
#
# This function gets the count of entity in each
# application region and their ids for a
# specified lbc.
#
# In this example, the spool database is first
# opened. Then the ids and number of entities in
# each application region associated with lbc,
# “400_psi” are obtained.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_count_lbc_appl_region_entity()
# has the following arguments:
#
# db_count_lbc_appl_region_entity
# ( lbc_id,
# app_reg_id,
# count )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_lbc_id
INTEGER ia_app_reg_id(2)
INTEGER ia_count(2)
INTEGER i_return_value

STRING s_geo_str[16]
STRING sv_app_list[VIRTUAL]
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# i_lbc_id = 2 for Pressure “400_psi”


i_lbc_id = 2

# Get the number of entities in each application regions


i_return_value = @
db_count_lbc_appl_region_entity @
( i_lbc_id, @
ia_app_reg_id, @
ia_count )
dump i_return_value
dump ia_app_reg_id
dump ia_count

# Get the application region entities details


i_return_value = @
loadsbcs_get_appl_region_list @
( i_lbc_id, @
ia_app_reg_id(1), @
ia_count(1), @
s_geo_str, @
sv_app_list )
dump i_return_value
Main Index
1314
Code Examples

dump s_geo_str
dump sv_app_list

# Free memory
sys_free_string ( sv_app_list )
#---------------------------------------------------------------------

db_count_lbc_types ()

# Purpose : This file provides an example of a call to the


# function db_count_lbc_types()
#
# This function gets the total number of distinct
# lbc types in the database.
#
# In this example a new database is opened and
# total number of distinct lbc types in the
# database is obtained.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_count_lbc_types()
# has the following arguments:
#
# db_count_lbc_types
# ( num_of_lbc_type_ids ),
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_num_of_lbc_type_ids
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# Get the total number of distinct lbc types in the database


i_return_value = @
db_count_lbc_types @
( i_num_of_lbc_type_ids )
dump i_return_value
dump i_num_of_lbc_type_ids
#---------------------------------------------------------------------

db_count_load_cases_with_lbc ()

# Purpose : This file provides an example of multiple calls


# to the function db_count_load_cases_with_lbc()
#
# This function gets the number of load cases
# associated with lbc.
#
# In this example the spool database is opened
# and a new load case,”new_lc” is created with
# lbcs “fillet_pressure” and “400_psi”. Then the
# number of load cases associated with each lbc
# is verified.
#
# The given are the details of Load/BCs
#
Main Index
CHAPTER 11 1315
Loads and Boundary Conditions

# Load/BC name ids Associated load


# cases
#
# fillet_pressure 1 default,
# spool_loads,
#
# 400_psi 2 default,
# spool_loads,
#
# 20_psi 3 default,
# spool_loads
# new_lc
#
# TZ_fixed 4 default,
# spool_loads
# new_lc
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_count_load_cases_with_lbc()
# has the following arguments:
#
# db_count_load_cases_with_lbc
# ( lbc_id,
# num_load_cases )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_lbc_id
INTEGER i_num_load_cases
INTEGER i_return_value

INTEGER i_prior(4)
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Create load case “new_lc”


i_return_value = @
loadcase_create @
( “new_lc”, @
“Static”, @
““, @
[“TZ_fixed”, “20_psi”], @
i_prior, @
““, @
0., @
FALSE )
dump i_return_value

# Get the number of load case associated with lbcs


FOR ( i_lbc_id = 1 TO 4 )
i_return_value = @
db_count_load_cases_with_lbc @
( i_lbc_id, @
i_num_load_cases )
dump i_return_value
dump i_lbc_id
dump i_num_load_cases
END FOR
#---------------------------------------------------------------------
Main Index
1316
Code Examples

db_count_loads_for_element ()

# Purpose : This file provides an example of multiple calls


# to the function db_count_loads_for_element()
#
# This function gets the number of loads and
# boundary conditions for an element.
#
# In this example the spool database is opened
# and a new lbc, “new_press” is created on
# elements from 56 to 60. Then the number of lbcs
# for elements from 51 to 60 is obtained.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_count_loads_for_element()
# has the following arguments:
#
# db_count_loads_for_element
# ( elem_id,
# num_lbc_associated )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_elem_id
INTEGER i_num_lbc_associated
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Post group “fem_model”


uil_viewport_post_groups.posted_groups @
( “default_viewport”, @
1, @
[“fem_model”] )

#---------------------------------------------------------------------
# Follow the instructions below to display Loads/BCs in the graphic
# Window.
# Pick “Display”,”Load/BC/Elem Props..” from pull-down menus
# Select “Show All” below Loads/BCs and “Apply”
# Ignore warnings if any.
#---------------------------------------------------------------------
# Session file paused. Press “Resume” to continue..
sf_pause()
#---------------------------------------------------------------------

# Display shaded model


uil_toolbar.shaded_smooth()

# Create new lbc “new_press”


i_return_value = @
loadsbcs_create @
( “new_press”, @
“Pressure”, @
“Element Uniform”, @
“2D”, @
“Static”, @
Main Index
CHAPTER 11 1317
Loads and Boundary Conditions

[“Element 56:60”], @
“FEM”, @
““, @
1., @
[“ 0”, “ 200”,” 0”], @
[““, ““, ““] )
dump i_return_value

# Get the number of loads and boundary conditions for elements


# with ids 51 to 55
FOR ( i_elem_id = 51 to 55 )
i_return_value = @
db_count_loads_for_element @
( i_elem_id, @
i_num_lbc_associated )
dump i_return_value
dump i_num_lbc_associated
END FOR

# Get the number of loads and boundary conditions for elements


# with ids 56 to 60
FOR ( i_elem_id = 56 to 60 )
i_return_value = @
db_count_loads_for_element @
( i_elem_id, @
i_num_lbc_associated )
dump i_return_value
dump i_num_lbc_associated
END FOR

# It can be observed that elements from 56 to 60 having an lbc


# associated with them.
#---------------------------------------------------------------------

db_delete_lbc ()

# Purpose : This file provides an example of a call to the


# function db_delete_lbc()
#
# In this example the number of lbcs are
# verified before and after deleting the lbc
# “400_psi”(lbc_id = 2) from database.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_delete_lbc()
# has the following arguments:
#
# db_delete_lbc
# ( lbc_id ),
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_lbc_id
INTEGER i_return_value
INTEGER i_count
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)
Main Index
1318
Code Examples

# Get number of lbcs


i_return_value = db_count_lbc ( i_count )
dump i_return_value
dump i_count

# Delete lbc from database


# Load “400_psi”
i_lbc_id = 2
i_return_value = @
db_delete_lbc @
( i_lbc_id )
dump i_return_value

# Get number of lbcs


i_return_value = db_count_lbc ( i_count )
dump i_return_value
dump i_count

# It can be observed that number of lbcs decreased by one due to


# deletion
#---------------------------------------------------------------------

db_delete_lbc_defn ()

# Purpose : This function will delete the lbc type


# definition from the database.
# This function requires lbc type id as
# input argument.
#
# This file can be run by starting a session of
# MSC/PATRAN,running this session file through
# the "File","Session","Play" pulldown menus
# on the menu bar.
#
#
# The function db_delete_lbc_defn()
# has the following arguments:
#
# db_delete_lbc_defn
# ( INPUT:
# INTEGER lbc_type_id
# OUTPUT:
# INTEGER status
# )
#---------------------------------------------------------------------
#
# Opening a new database

uil_file_new.go("","new.db")

#---------------------------------------------------------------------

# Declaring and defining input arguents

INTEGER lbc_type_id = 100

# Declaring output argument

INTEGER status

#----------------------------------------------------------------------

# Using the function db_create_lbc_defn() to create the new


# lbc definition.
Main Index
CHAPTER 11 1319
Loads and Boundary Conditions

db_create_lbc_defn("New_lbc_defn", @
"Displacement", @
1,2,1, @
1,1,1, @
2,2,1, @
1,"","", @
1,1,1,1, @
lbc_type_id)

#-----------------------------------------------------------------------

# Using the Function db_delete_lbc_defn() to delete the


# lbc definition created in previous step.

status = db_delete_lbc_defn(lbc_type_id)

dump status

#---------------------------------------------------------------------

# End of File.

#---------------------------------------------------------------------

db_get_all_appl_geo_regions ()

# Purpose : This file provides an example of multiple calls


# to the function db_get_all_appl_geo_regions()
#
# This function gets all the records in the
# LbcAppRegion table, for the specified lbc_id
# from the database.
#
# In this example the spool database is opened
# and list of application region and number of
# entities in them are obtained using function,
# db_count_lbc_appl_region_entity() for lbc,
# “fillet_pressure”. All the records are loaded
# in LbcAppRegion table by call to this function.
# The records are then read one by one using
# function db_get_next_appl_geo_region().
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_all_appl_geo_regions()
# has the following arguments:
#
# db_get_all_appl_geo_regions
# ( lbc_id ),
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_lbc_id
INTEGER i_return_value

INTEGER ia_app_reg_id(2)
Main Index
1320
Code Examples

INTEGER ia_count(2)
INTEGER i_index
INTEGER i_app_reg_id
INTEGER i_ent_type
INTEGER i_ent_id
INTEGER i_ent_sub_id
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# lbc_id for “fillet_pressure”


i_lbc_id = 1

# Gets the number of entities in each application regions


i_return_value = @
db_count_lbc_appl_region_entity @
( i_lbc_id, @
ia_app_reg_id, @
ia_count )
dump i_return_value

# Get all the application geometric region for the specified id


i_return_value = @
db_get_all_appl_geo_regions @
( i_lbc_id )
dump i_return_value

# Get next record in lbc application region one by one


FOR (i_index = 1 TO ia_count(1))
i_return_value = @
db_get_next_appl_geo_region @
( i_app_reg_id, @
i_ent_type, @
i_ent_id, @
i_ent_sub_id )
dump i_return_value

# Application region id
dump i_app_reg_id

# Entity type id
dump i_ent_type

# Entity id
dump i_ent_id

# Entity sub id ( if appropriate )


dump i_ent_sub_id

END FOR
#---------------------------------------------------------------------

db_get_all_appl_reg_defns ()

# Purpose : This file provides an example of a call to the


# function db_get_all_appl_reg_defns()
#
# This function gets all application geometry
# region definitions for an lbc type definition
# from the database in get all, get next method.
#
# In this example the spool database is opened
# and this function is called to load records
# into application geometry definition table.
# The records are then read one by one using
Main Index
CHAPTER 11 1321
Loads and Boundary Conditions

# function db_get_next_appl_reg_defn().
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_all_appl_reg_defns()
# has the following arguments:
#
# db_get_all_appl_reg_defns
# ( lbc_type_id ),
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_lbc_type_id
INTEGER i_seq_app_reg_id
INTEGER i_all_status
INTEGER i_next_status = 0
STRING s_label[32]
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Load type id = 8 (for pressure in CHAPTER 9 in MSC.Patran


# USER MANUAL (vol 4))
i_lbc_type_id = 8

# Get all application geometry region definition for an lbc_type


i_all_status = @
db_get_all_appl_reg_defns @
( i_lbc_type_id )
dump i_all_status

# Get next application geometry region definition for an lbc_type


WHILE ( i_next_status == 0 )
i_next_status = @
db_get_next_appl_reg_defn @
( i_seq_app_reg_id, @
s_label )
dump i_next_status
IF ( i_next_status == 0 ) THEN
dump i_seq_app_reg_id
dump s_label
END IF
END WHILE
#---------------------------------------------------------------------

db_get_all_lbc_names ()

# Purpose : This file provides an example of a call to the


# function db_get_all_lbc_names()
#
# This function gets all LBC names and types from
# the database in get all, get next method.
#
# In this example the spool database is opened
# and this function is called to get all LBC
# names from database. Then the information about
# all the LBCs is retrieved using the function,
# db_get_next_lbc_name()
#
Main Index
1322
Code Examples

# Before running this session file run spool.ses


# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_all_lbc_names() has no arguments.
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_lbc_id
STRING s_lbc_name[32]
INTEGER i_lbc_type_id
INTEGER i_all_status
INTEGER i_next_status
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Get all LBC names and types


i_all_status = db_get_all_lbc_names()
dump i_all_status

# Get next lbc name and type from the database


WHILE ( i_next_status == 0 )
i_next_status = @
db_get_next_lbc_name @
( i_lbc_id, @
s_lbc_name, @
i_lbc_type_id )
dump i_next_status
IF ( i_next_status == 0) THEN
dump i_lbc_id
dump s_lbc_name
dump i_lbc_type_id
END IF
END WHILE
#---------------------------------------------------------------------

db_get_all_lbc_names_by_type ()

# Purpose : This file provides an example of a call to the


# function db_get_all_lbc_names_by_type()
#
# This function gets all LBCs of specified type
# from database in get all, get next method.
#
# In this example the spool database is opened
# and this function is called to get all LBC
# names of type “Pressure” from database. Then
# the information about each LBC is retrieved
# using the function,
# db_get_next_lbc_name_by_type()
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_all_lbc_names_by_type()
Main Index
CHAPTER 11 1323
Loads and Boundary Conditions

# has the following arguments:


#
# db_get_all_lbc_names_by_type
# ( lbc_type_id ),
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_lbc_type_id
INTEGER i_lbc_id
STRING s_lbc_name[32]
INTEGER i_all_status
INTEGER i_next_status
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Get all lbcs of type “Pressure”


i_lbc_type_id = 8
i_all_status = @
db_get_all_lbc_names_by_type @
( i_lbc_type_id )
dump i_all_status

# Get next lbc of type pressure from database


WHILE ( i_next_status == 0 )
i_next_status = @
db_get_next_lbc_name_by_type @
( i_lbc_id, @
s_lbc_name )
dump i_next_status
IF ( i_next_status == 0 ) THEN
dump i_lbc_id
dump s_lbc_name
END IF
END WHILE
#---------------------------------------------------------------------

db_get_all_lbc_type_defns ()

# Purpose : This file provides an example of a call to the


# function db_get_all_lbc_type_defns()
#
# This function gets all lbc type definitions
# from the database in get all, get next method.
#
# In this example the spool database is opened
# and this function is called to load records
# into lbc type table. The records are then read
# one by one using the function,
# db_get_next_lbc_type_defn()
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_all_lbc_type_defns() has no arguments.
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_internal_lbc_id
STRING s_lbc_name[32]
Main Index
1324
Code Examples

INTEGER i_class_lbc
INTEGER i_form
INTEGER i_global_bc
INTEGER i_flag_alt_cid
INTEGER i_graphic_symbol
INTEGER i_sv
INTEGER i_null_vector
INTEGER i_num_anal_code
INTEGER ia_anal_code_ids(15)
INTEGER i_default_color
INTEGER i_color_box_id
INTEGER i_anchor_style
INTEGER i_all_status
INTEGER i_next_status = 0
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Get all lbc type definitions from the database


i_all_status = db_get_all_lbc_type_defns()
dump i_all_status

# Get next lbc type definition from the database.


WHILE ( i_next_status == 0 )
i_next_status = @
db_get_next_lbc_type_defn @
( i_internal_lbc_id, @
s_lbc_name, @
i_class_lbc, @
i_form, @
i_global_bc, @
i_flag_alt_cid, @
i_graphic_symbol, @
i_sv, @
i_null_vector, @
i_num_anal_code, @
ia_anal_code_ids, @
i_default_color, @
i_color_box_id, @
i_anchor_style )
dump i_next_status
IF ( i_next_status == 0 ) THEN
dump i_internal_lbc_id
dump s_lbc_name
dump i_class_lbc
dump i_form
dump i_global_bc
dump i_flag_alt_cid
dump i_graphic_symbol
dump i_sv
dump i_null_vector
dump i_num_anal_code
dump ia_anal_code_ids
dump i_default_color
dump i_color_box_id
dump i_anchor_style
END IF
END WHILE
#---------------------------------------------------------------------

Main Index
CHAPTER 11 1325
Loads and Boundary Conditions

db_get_all_lbc_type_names

# Purpose : This file provides an example of a call to the


# function db_get_all_lbc_type_names()
#
# This function gets all the lbc type names from
# database in get all, get next method.
#
# In this example the spool database is opened
# and this function is called to load all names
# of lbc types in lbc type table from database.
# Then all the names of lbc types are obtained
# using the function,db_get_next_lbc_type_name().
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_all_lbc_type_names() has no arguments.
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_return_value
INTEGER i_lbc_type_id
STRING s_lbc_name[32]
INTEGER i_return_value
INTEGER i_all_status
INTEGER i_next_status = 0
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Get all the names of lbc types


i_all_status = db_get_all_lbc_type_names()
dump i_all_status

# Get next lbc type name


WHILE ( i_next_status == 0 )
i_next_status = @
db_get_next_lbc_type_name @
( i_lbc_type_id, @
s_lbc_name )
dump i_next_status
IF ( i_next_status == 0 ) THEN
dump i_lbc_type_id
dump s_lbc_name
END IF
END WHILE
#---------------------------------------------------------------------

db_get_all_lbc_var_defns ()

# Purpose : This file provides an example of a call to the


# function db_get_all_lbc_var_defns()
#
# This function gets all lbc variables for an
# lbc type definition from database in get all,
# get next method.
#
Main Index
1326
Code Examples

# In this example the spool database is opened


# and this function is called to get all lbc
# variables of type “Pressure” from database.
# Then variable ids are obtained one by one
# using the function, db_get_next_lbc_var_defn().
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_all_lbc_var_defns()
# has the following arguments:
#
# db_get_all_lbc_var_defns
# ( lbc_type_id ),
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_lbc_type_id
INTEGER i_category_id
INTEGER i_elem_dim
INTEGER i_all_status
INTEGER i_next_status = 0
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Lbc type id for “Pressure”


i_lbc_type_id = 8

# Get all the lbc variable for lbc type “Pressure”


i_all_status = @
db_get_all_lbc_var_defns @
( i_lbc_type_id )
dump i_all_status

# Get the next lbc variable


WHILE ( i_next_status == 0 )
i_next_status = @
db_get_next_lbc_var_defn @
( i_category_id, @
i_elem_dim )
dump i_next_status
IF ( i_next_status == 0 ) THEN
dump i_category_id
dump i_elem_dim
END IF
END WHILE
#---------------------------------------------------------------------

db_get_all_lbcs_new ()

# Purpose : This file provides an example of a call to the


# function db_get_all_lbcs_new()
#
# This function sets up the data required to
# retrieve all the information about all the
# LBCs in the database.
#
# In this example the spool database is opened
# and this function is called to retrieve
Main Index
CHAPTER 11 1327
Loads and Boundary Conditions

# information about the LBCs in the database.


# Then the information about all of the LBCs are
# retrieved using the function
# db_get_next_lbcs_new()
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_all_lbcs_new() has no arguments.
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_all_status
INTEGER i_next_status = 0
INTEGER i_lbc_struct_id
STRING s_name[16]
INTEGER i_lbc_type
INTEGER i_category
INTEGER ia_geo_fem(3)
INTEGER i_alt_coord_frame
INTEGER i_dyn_stat_flag
REAL r_scale_factor
INTEGER ia_targ_elem(3)
INTEGER i_app_reg_couple
INTEGER i_app_reg_order
INTEGER i_equiv_flag
INTEGER i_ac_mod_flag
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Set up the data required to retrieve all information about LBCs


i_all_status = @
db_get_all_lbcs_new()
dump i_all_status

# Get the information about LBCs.


WHILE ( i_next_status == 0 )
i_next_status = @
db_get_next_lbcs_new @
( i_lbc_struct_id, @
s_name, @
i_lbc_type, @
i_category, @
ia_targ_elem, @
i_alt_coord_frame, @
i_dyn_stat_flag, @
r_scale_factor, @
ia_geo_fem, @
i_app_reg_couple, @
i_app_reg_order, @
i_equiv_flag, @
i_ac_mod_flag )
dump i_next_status
IF ( i_next_status == 0 ) THEN
dump i_lbc_struct_id
dump s_name
dump i_lbc_type
dump i_category
dump ia_targ_elem
dump i_alt_coord_frame
dump i_dyn_stat_flag
Main Index
1328
Code Examples

dump r_scale_factor
dump ia_geo_fem
dump i_app_reg_couple
dump i_app_reg_order
dump i_equiv_flag
dump i_ac_mod_flag
END IF
END WHILE
#---------------------------------------------------------------------

db_get_lbc_id ()

# Purpose : This file provides an example of 2 calls to the


# function db_get_lbc_id()
#
# This function gets the lbc_id associated with
# the specified lbc name
#
# In this example the spool database is opened
# and lbc id of Load/BC set “fillet_pressure” and
# “TZ_fixed” are obtained.
#
# The given are the details of lbcs present in
# spool.db
#
# Lbc name id
#
# fillet_pressure 1
# 400_psi 2
# 20_psi 3
# TZ_fixed 4
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_lbc_id() has the following arguments:
#
# db_get_lbc_id
# ( lbc_name,
# lbc_id )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_lbc_name[32]
INTEGER i_lbc_id
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Get the lbc id of Load/BC set “fillet_pressure”


s_lbc_name = “fillet_pressure”
i_return_value = @
db_get_lbc_id @
( s_lbc_name, @
i_lbc_id )
dump i_return_value
dump i_lbc_id

# Get the lbc id of Load/BC set “TZ_fixed”


Main Index
CHAPTER 11 1329
Loads and Boundary Conditions

s_lbc_name = “TZ_fixed”
i_return_value = @
db_get_lbc_id @
( s_lbc_name, @
i_lbc_id )
dump i_return_value
dump i_lbc_id
#---------------------------------------------------------------------

db_get_lbc_name ()

# Purpose : This file provides an example of 4 calls to the


# function db_get_lbc_name()
#
# This function gets the lbc name associated with
# the specified lbc name
#
# In this example the spool database is opened
# and lbc name for all the four Load/BC set
# present are obtained.
#
# The given are the details of lbcs present in
# spool.db
#
# Lbc name Id
#
# fillet_pressure 1
# 400_psi 2
# 20_psi 3
# TZ_fixed 4
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_lbc_name() has the following arguments:
#
# db_get_lbc_name
# ( lbc_id,
# lbc_name )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_lbc_id
STRING s_lbc_name[32]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Get the lbc name of Load/BC sets


FOR ( i_lbc_id = 1 TO 4 )
i_return_value = @
db_get_lbc_name @
( i_lbc_id, @
s_lbc_name )
dump i_return_value
dump i_lbc_id
dump s_lbc_name
END FOR
#---------------------------------------------------------------------

Main Index
1330
Code Examples

db_get_lbc_type_defn ()

# Purpose : This file provides an example of 2 calls to the


# function db_get_lbc_type_defn()
#
# This function gets the lbc type definitions
# from the database given the lbc_type name.
#
# In this example a new database is opened and
# lbc_type definitions for “Pressure” and
# “Displacement” are obtained.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_lbc_type_defn()
# has the following arguments:
#
# db_get_lbc_type_defn
# ( name,
# id,
# class,
# form,
# gbc,
# cid,
# g_sym,
# sv,
# nv,
# nbr_ac,
# an_code,
# defcol,
# cbid,
# anstyl )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
INTEGER i_id
INTEGER i_class
INTEGER i_form
INTEGER i_gbc
INTEGER i_cid
INTEGER i_g_sym
INTEGER i_sv
INTEGER i_nv
INTEGER i_nbr_ac
INTEGER ia_an_code(15)
INTEGER i_defcol
INTEGER i_cbid
INTEGER i_anstyl
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# Lbc type name


s_name = “Pressure”

# Get the lbc type definition for “Pressure”


i_return_value = @
db_get_lbc_type_defn @
( s_name, @
Main Index
CHAPTER 11 1331
Loads and Boundary Conditions

i_id, @
i_class, @
i_form, @
i_gbc, @
i_cid, @
i_g_sym, @
i_sv, @
i_nv, @
i_nbr_ac, @
ia_an_code, @
i_defcol, @
i_cbid, @
i_anstyl )
dump i_return_value
dump i_id
dump i_class
dump i_form
dump i_gbc
dump i_cid
dump i_g_sym
dump i_sv
dump i_nv
dump i_nbr_ac
dump ia_an_code
dump i_defcol
dump i_cbid
dump i_anstyl

#---------------------------------------------------------------------
# Lbc type name
s_name = “Displacement”

# Get the lbc type definition for “Displacement”


i_return_value = @
db_get_lbc_type_defn @
( s_name, @
i_id, @
i_class, @
i_form, @
i_gbc, @
i_cid, @
i_g_sym, @
i_sv, @
i_nv, @
i_nbr_ac, @
ia_an_code, @
i_defcol, @
i_cbid, @
i_anstyl )
dump i_return_value
dump i_id
dump i_class
dump i_form
dump i_gbc
dump i_cid
dump i_g_sym
dump i_sv
dump i_nv
dump i_nbr_ac
dump ia_an_code
dump i_defcol
dump i_cbid
dump i_anstyl
#---------------------------------------------------------------------
# Note the following regarding the output values.
#
# i_class = 1 indicates structural analysis_type(class)
Main Index
1332
Code Examples

#
# ia_an_code = 5 indicates MSC.Patran FEA
# = 1 indicates MSC.Nastran
#
# Refer chapter 7 & 9 in MSC.Patran User Manual - Part 9 (Vol. 4)
# for more details
#---------------------------------------------------------------------

db_get_lbc_var_defn ()

# Purpose : This file provides an example of a call to the


# function db_get_lbc_var_defn()
#
# This function gets the lbc_type variable id
# from the database for specified detail of lbc
# type id along with label of variable.
#
# In this example a new database is opened and
# lbc_type variable id of label ‘Bot Surface
# Pressure’ is obtained after assigning
# suitable values for category type id and
# element dimension id.
#
# This file can be run by starting a session of
# MSC.Patran, opening a new or existing database,
# and running this session file through the
# “File”,”Session”,”Play” pulldown menus
# on the menu bar.
#
# The function db_get_lbc_var_defn()
# has the following arguments:
#
# db_get_lbc_var_defn
# ( lbc_type_id,
# lbc_category,
# eldim,
# label,
# id )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_lbc_type_id
INTEGER i_lbc_category
INTEGER i_eldim
STRING s_label[64]
INTEGER ia_id(10)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# Lbc type = 8 for pressure


i_lbc_type_id = 8

# Category of lbc = 2 for element uniform application


i_lbc_category = 2

# Dimensionality of the loaded elements = 2 for surface element


i_eldim = 2

# Data label for lbc


s_label = “Bot Surf Pressure”

i_return_value = @
Main Index
CHAPTER 11 1333
Loads and Boundary Conditions

db_get_lbc_var_defn @
( i_lbc_type_id, @
i_lbc_category, @
i_eldim, @
s_label, @
ia_id )
dump i_return_value
dump ia_id
#---------------------------------------------------------------------
# Following are valid load type variable id for Pressure
# ia_id = 1 for Top surface pressure
# = 2 for Bottom surface pressure
# = 3 for Edge pressure
#---------------------------------------------------------------------

db_get_load_cases_with_lbc ()

# Purpose : This file provides an example of multiple calls


# to the function db_get_load_cases_with_lbc()
#
# This function gets the ids of load cases
# associated with lbc.
#
# In this example the spool database is opened
# and a new load case,”new_lc” is created with
# lbcs “fillet_pressure” and “400_psi”. Then the
# ids of load cases associated with each lbc is
# obtained.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_load_cases_with_lbc()
# has the following arguments:
#
# db_get_load_cases_with_lbc
# ( lbc_id,
# num_loadcases,
# loadcase_ids,
# priority )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_lbc_id
INTEGER i_num_loadcases
INTEGER iv_loadcase_ids(VIRTUAL)
INTEGER iv_priority(VIRTUAL)
INTEGER i_return_value
INTEGER ia_prior(4)
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Maximum number of load cases in database


i_num_loadcases = 3

# Create load case “new_lc”


i_return_value = @
loadcase_create @
( “new_lc”, @
Main Index
1334
Code Examples

“Static”, @
““, @
[“TZ_fixed”, “20_psi”], @
ia_prior, @
““, @
0., @
FALSE )
dump i_return_value

# Allocate memory
i_return_value = sys_allocate_array(iv_loadcase_ids,1,i_num_loadcases)
dump i_return_value

i_return_value = sys_allocate_array(iv_priority,1,i_num_loadcases)
dump i_return_value

# Get the load cases associated with lbc


FOR ( i_lbc_id = 1 TO 4)
i_return_value = @
db_count_load_cases_with_lbc @
( i_lbc_id, @
i_num_loadcases )
dump i_return_value
dump i_lbc_id

i_return_value = sys_reallocate_array @
( iv_loadcase_ids,1, @
i_num_loadcases)
dump i_return_value

i_return_value = sys_reallocate_array @
( iv_priority,1, @
i_num_loadcases)
dump i_return_value

i_return_value = @
db_get_load_cases_with_lbc @
( i_lbc_id, @
i_num_loadcases, @
iv_loadcase_ids, @
iv_priority )
dump i_return_value
dump i_num_loadcases
dump iv_loadcase_ids
dump iv_priority
END FOR

#---------------------------------------------------------------------
# Refer the following table regarding output values for each lbc.
#
# Load/BC name ids Associated load cases(ids)
#
# fillet_pressure 1 default(1),spool_loads(2)
# 400_psi 2 default(1),spool_loads(2)
# 20_psi 3 default(1),spool_loads(2),new_lc(3)
# TZ_fixed 4 default(1),spool_loads(2),new_lc(3)
#---------------------------------------------------------------------
# Free memory
sys_free_array(iv_loadcase_ids)
sys_free_array(iv_priority)
#---------------------------------------------------------------------

Main Index
CHAPTER 11 1335
Loads and Boundary Conditions

db_get_loads_for_element ()

# Purpose : This file provides an example of multiple calls


# to the function db_get_loads_for_element()
#
# This function gets the loads and boundary
# conditions for an element.
#
# In this example the spool database is opened
# and a new lbc, “new_press” is created on
# elements from 56 to 60. Then the lbcs
# associated with elements from 51 to 60 are
# obtained.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_loads_for_element()
# has the following arguments:
#
# db_get_loads_for_element
# ( nbr_of_lbcs,
# elem_id,
# lbc )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_nbr_of_lbcs = 1
INTEGER i_elem_id
INTEGER iv_lbc(VIRTUAL)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Create new lbc “new_press” on elements 56 to 60


i_return_value = @
loadsbcs_create @
( “new_press”, @
“Pressure”, @
“Element Uniform”, @
“2D”, @
“Static”, @
[“Element 56:60”], @
“FEM”, @
““, @
1., @
[“ 0”, “ 200”,” 0”], @
[““, ““, ““] )
dump i_return_value

# Allocate memory
i_return_value = sys_allocate_array(iv_lbc,0,i_nbr_of_lbcs)
dump i_return_value

# Get the lbcs for an element


FOR ( i_elem_id = 51 to 60 )
i_return_value = @
db_count_loads_for_element @
( i_elem_id, @
Main Index
1336
Code Examples

i_nbr_of_lbcs )
dump i_return_value

i_return_value = sys_reallocate_array(iv_lbc,0, @
i_nbr_of_lbcs)
dump i_return_value

i_return_value = @
db_get_loads_for_element @
( i_nbr_of_lbcs, @
i_elem_id, @
iv_lbc )
dump i_return_value
dump i_elem_id
dump iv_lbc
END FOR

# Free memory
sys_free_array(iv_lbc)
#---------------------------------------------------------------------

db_get_next_appl_geo_region ()

# Purpose : This file provides an example of 2 calls to the


# function db_get_next_appl_geo_region()
#
# This function gets the next record in the
# LbcAppRegion table, for specified lbc_id from
# the database.
#
# In this example the spool database is opened
# and list of application region and number of
# entities in them are obtained using function,
# db_count_lbc_appl_region_entity() for lbc,
# “fillet_pressure”. The records in LbcAppRegion
# table are then read one by one after a
# call to function db_get_all_appl_geo_regions()
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_next_appl_geo_region()
# has the following arguments:
#
# db_get_next_appl_geo_region
# ( app_reg_id,
# ent_type,
# ent_id,
# ent_sub_id )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_app_reg_id
INTEGER i_ent_type
INTEGER i_ent_id
INTEGER i_ent_sub_id
INTEGER i_return_value

INTEGER i_lbc_id
INTEGER ia_app_reg_id(2)
Main Index
CHAPTER 11 1337
Loads and Boundary Conditions

INTEGER ia_count(2)
INTEGER i_index
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# lbc_id for “fillet_pressure”


i_lbc_id = 1

# Gets the number of entities in each application regions


i_return_value = @
db_count_lbc_appl_region_entity @
( i_lbc_id, @
ia_app_reg_id, @
ia_count )
dump i_return_value

# Get all the application geometric region for the specified id


i_return_value = @
db_get_all_appl_geo_regions @
( i_lbc_id )
dump i_return_value

# Get next record in lbc application region one by one


FOR (i_index = 1 TO ia_count(1))
i_return_value = @
db_get_next_appl_geo_region @
( i_app_reg_id, @
i_ent_type, @
i_ent_id, @
i_ent_sub_id )
dump i_return_value

# Application region id
dump i_app_reg_id

# Entity type id
dump i_ent_type

# Entity id
dump i_ent_id

# Entity sub id ( if appropriate )


dump i_ent_sub_id

END FOR
#---------------------------------------------------------------------

db_get_next_appl_reg_defn ()

# Purpose : This file provides an example of multiple calls


# to the function db_get_next_appl_reg_defn()
#
# This function gets next application geometry
# region definition for an lbc type definition
# from the database in get all, get next method.
#
# In this example the spool database is opened
# and the function,db_get_all_appl_reg_defns()
# is called to load records into application
# geometry definition table. The records are then
# read one by one using this function.
#
# Before running this session file run spool.ses
# to create spool.db
Main Index
1338
Code Examples

#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_next_appl_reg_defn()
# has the following arguments:
#
# db_get_next_appl_reg_defn
# ( seq_app_reg_id,
# label )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_seq_app_reg_id
STRING s_label[32]
INTEGER i_all_status
INTEGER i_next_status = 0
INTEGER i_lbc_type_id
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Load type id = 8 (for pressure in CHAPTER 9 of MSC.Patran


# USER MANUAL (vol 4))
i_lbc_type_id = 8

# Get all application geometry region definition for an lbc_type


i_all_status = @
db_get_all_appl_reg_defns @
( i_lbc_type_id )
dump i_all_status

# Get next application geometry region definition for an lbc_type


WHILE ( i_next_status == 0 )
i_next_status = @
db_get_next_appl_reg_defn @
( i_seq_app_reg_id, @
s_label )
dump i_next_status
IF ( i_next_status == 0 ) THEN
dump i_seq_app_reg_id
dump s_label
END IF
END WHILE
#---------------------------------------------------------------------

db_get_next_lbc_name ()

# Purpose : This file provides an example of multiple calls


# to the function db_get_next_lbc_name()
#
# This function gets next LBC name and type from
# the database in get all, get next method.
#
# In this example the spool database is opened
# and the function db_get_all_lbc_names() is
# called to get all LBC names from database. Then
# the information about all the LBCs is retrieved
# using this function
#
# Before running this session file run spool.ses
# to create spool.db
Main Index
CHAPTER 11 1339
Loads and Boundary Conditions

#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_next_lbc_name()
# has the following arguments:
#
# db_get_next_lbc_name
# ( lbc_id,
# lbc_name,
# lbc_type_id )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_lbc_id
STRING s_lbc_name[32]
INTEGER i_lbc_type_id
INTEGER i_all_status
INTEGER i_next_status
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Get all LBC names and types


i_all_status = db_get_all_lbc_names()
dump i_all_status

# Get next lbc name and type from the database


WHILE ( i_next_status == 0 )
i_next_status = @
db_get_next_lbc_name @
( i_lbc_id, @
s_lbc_name, @
i_lbc_type_id )
dump i_next_status
IF ( i_next_status == 0) THEN
dump i_lbc_id
dump s_lbc_name
dump i_lbc_type_id
END IF
END WHILE
#---------------------------------------------------------------------

db_get_next_lbc_name_by_type ()

# Purpose : This file provides an example of multiple calls


# to the function db_get_next_lbc_name_by_type()
#
# This function gets the next LBC of specified
# type from database in get all, get next method.
#
# In this example the spool database is opened
# and the function,
# db_get_all_lbc_names_by_type() is called to get
# all LBC names of type “Pressure” from database.
# Then the information about each LBC is
# retrieved using this function.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
Main Index
1340
Code Examples

# through the “File”,”Session”,”Play” pulldown


# menus on the menu bar.
#
# The function db_get_next_lbc_name_by_type()
# has the following arguments:
#
# db_get_next_lbc_name_by_type
# ( lbc_id,
# lbc_name )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_lbc_type_id
INTEGER i_lbc_id
STRING s_lbc_name[32]
INTEGER i_all_status
INTEGER i_next_status
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Get all lbcs of type “Pressure”


i_lbc_type_id = 8
i_all_status = @
db_get_all_lbc_names_by_type @
( i_lbc_type_id )
dump i_all_status

# Get next lbc of type pressure from database


WHILE ( i_next_status == 0 )
i_next_status = @
db_get_next_lbc_name_by_type @
( i_lbc_id, @
s_lbc_name )
dump i_next_status
IF ( i_next_status == 0 ) THEN
dump i_lbc_id
dump s_lbc_name
END IF
END WHILE
#---------------------------------------------------------------------

db_get_next_lbc_type_defn ()

# Purpose : This file provides an example of multiple calls


# to the function db_get_next_lbc_type_defn()
#
# This function gets next lbc type definitions
# from the lbc type table in database by get all,
# get next method.
#
# In this example the spool database is opened
# and the function, db_get_all_lbc_type_defns()
# is called to load records into lbc type table.
# The records are then read one by one using
# this function.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
Main Index
CHAPTER 11 1341
Loads and Boundary Conditions

# The function db_get_next_lbc_type_defn()


# has the following arguments:
#
# db_get_next_lbc_type_defn
# ( internal_lbc_id,
# lbc_name,
# class_lbc,
# form,
# global_bc,
# flag_alt_cid,
# graphic_symbol,
# sv,
# null_vector,
# num_anal_code,
# anal_code_ids,
# default_color,
# color_box_id,
# anchor_style )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_internal_lbc_id
STRING s_lbc_name[32]
INTEGER i_class_lbc
INTEGER i_form
INTEGER i_global_bc
INTEGER i_flag_alt_cid
INTEGER i_graphic_symbol
INTEGER i_sv
INTEGER i_null_vector
INTEGER i_num_anal_code
INTEGER ia_anal_code_ids(15)
INTEGER i_default_color
INTEGER i_color_box_id
INTEGER i_anchor_style
INTEGER i_all_status
INTEGER i_next_status = 0
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Get all lbc type definitions from the database


i_all_status = db_get_all_lbc_type_defns()
dump i_all_status

# Get next lbc type definition from the database.


WHILE ( i_next_status == 0 )
i_next_status = @
db_get_next_lbc_type_defn @
( i_internal_lbc_id, @
s_lbc_name, @
i_class_lbc, @
i_form, @
i_global_bc, @
i_flag_alt_cid, @
i_graphic_symbol, @
i_sv, @
i_null_vector, @
i_num_anal_code, @
ia_anal_code_ids, @
i_default_color, @
i_color_box_id, @
i_anchor_style )
dump i_next_status
IF ( i_next_status == 0 ) THEN
dump i_internal_lbc_id
dump s_lbc_name
Main Index
1342
Code Examples

dump i_class_lbc
dump i_form
dump i_global_bc
dump i_flag_alt_cid
dump i_graphic_symbol
dump i_sv
dump i_null_vector
dump i_num_anal_code
dump ia_anal_code_ids
dump i_default_color
dump i_color_box_id
dump i_anchor_style
END IF
END WHILE
#---------------------------------------------------------------------

db_get_next_lbc_type_name ()

# Purpose : This file provides an example of multiple calls


# to the function db_get_next_lbc_type_name()
#
# This function gets the next lbc type name from
# database in get all, get next method.
#
# In this example the spool database is opened
# and the function,db_get_all_lbc_type_names()
# is called to load all names of lbc types in
# lbc type table from database. Then all the
# names of lbc types are obtained using this
# function
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_next_lbc_type_name()
# has the following arguments:
#
# db_get_next_lbc_type_name
# ( internal_lbc_id,
# lbc_name )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_return_value
INTEGER i_lbc_type_id
STRING s_lbc_name[32]
INTEGER i_return_value
INTEGER i_all_status
INTEGER i_next_status = 0
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Get all the names of lbc types


i_all_status = db_get_all_lbc_type_names()
dump i_all_status

# Get next lbc type name


WHILE ( i_next_status == 0 )
i_next_status = @
Main Index
CHAPTER 11 1343
Loads and Boundary Conditions

db_get_next_lbc_type_name @
( i_lbc_type_id, @
s_lbc_name )
dump i_next_status
IF ( i_next_status == 0 ) THEN
dump i_lbc_type_id
dump s_lbc_name
END IF
END WHILE
#---------------------------------------------------------------------

db_get_next_lbc_var_defn ()

# Purpose : This file provides an example of multiple calls


# to the function db_get_next_lbc_var_defn()
#
# This function gets the next lbc variable for
# an lbc type definition from database in get
# all, get next method.
#
# In this example the spool database is opened
# and the function, db_get_all_lbc_var_defns()
# is called to get all lbc variables of type
# “Pressure” from database. Then variable ids
# are obtained one by one using this function.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_next_lbc_var_defn()
# has the following arguments:
#
# db_get_next_lbc_var_defn
# ( category_id,
# elem_dim )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_lbc_type_id
INTEGER i_category_id
INTEGER i_elem_dim
INTEGER i_all_status
INTEGER i_next_status = 0
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Lbc type id for “Pressure”


i_lbc_type_id = 8

# Get all the lbc variable for lbc type “Pressure”


i_all_status = @
db_get_all_lbc_var_defns @
( i_lbc_type_id )
dump i_all_status

# Get the next lbc variable


WHILE ( i_next_status == 0 )
i_next_status = @
db_get_next_lbc_var_defn @
Main Index
1344
Code Examples

( i_category_id, @
i_elem_dim )
dump i_next_status
IF ( i_next_status == 0 ) THEN
dump i_category_id
dump i_elem_dim
END IF
END WHILE
#---------------------------------------------------------------------

db_get_next_lbcs_new ()

# Purpose : This file provides an example of a call to the


# function db_get_next_lbcs_new()
#
# This function gets the information about LBCs
# in the database one structure at a time
#
# In this example the spool database is opened
# and the function, db_get_all_lbcs_new() is
# called to retrieve information about the LBCs
# in the database. Then the information about
# all of the LBCs are retrieved using this
# function.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_next_lbcs_new()
# has the following arguments:
#
# db_get_next_lbcs_new
# ( lbc_struct_id,
# name,
# lbc_type,
# category,
# targ_elem,
# coord_frame,
# dyn_stat_flag,
# scale_factor,
# geo_fem,
# app_reg_couple,
# app_reg_order,
# equiv_flag,
# ac_mod_flag )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_all_status
INTEGER i_next_status = 0
INTEGER i_lbc_struct_id
STRING s_name[16]
INTEGER i_lbc_type
INTEGER i_category
INTEGER ia_geo_fem(3)
INTEGER i_alt_coord_frame
INTEGER i_dyn_stat_flag
REAL r_scale_factor
INTEGER ia_targ_elem(3)
INTEGER i_app_reg_couple
Main Index
CHAPTER 11 1345
Loads and Boundary Conditions

INTEGER i_app_reg_order
INTEGER i_equiv_flag
INTEGER i_ac_mod_flag
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Set up the data required to retrieve all information about LBCs


i_all_status = @
db_get_all_lbcs_new()
dump i_all_status

# Get the information about LBCs.


WHILE ( i_next_status == 0 )
i_next_status = @
db_get_next_lbcs_new @
( i_lbc_struct_id, @
s_name, @
i_lbc_type, @
i_category, @
ia_targ_elem, @
i_alt_coord_frame, @
i_dyn_stat_flag, @
r_scale_factor, @
ia_geo_fem, @
i_app_reg_couple, @
i_app_reg_order, @
i_equiv_flag, @
i_ac_mod_flag )
dump i_next_status
IF ( i_next_status == 0 ) THEN
dump i_lbc_struct_id
dump s_name
dump i_lbc_type
dump i_category
dump ia_targ_elem
dump i_alt_coord_frame
dump i_dyn_stat_flag
dump r_scale_factor
dump ia_geo_fem
dump i_app_reg_couple
dump i_app_reg_order
dump i_equiv_flag
dump i_ac_mod_flag
END IF
END WHILE
#---------------------------------------------------------------------

db_get_valid_cat_by_type ()

# Purpose : This file provides an example of 2 calls to the


# function db_get_valid_cat_by_type()
#
# This function gets the valid category type for
# a specified lbc type. The maximum number of
# categories for a type is three.
#
# In this example a new database is created and
# valid category type ids of lbc type “Pressure”
# and “Force” are obtained.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
Main Index
1346
Code Examples

#
# The function db_get_valid_cat_by_type()
# has the following arguments:
#
# db_get_valid_cat_by_type
# ( typid,
# cat )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_typid
INTEGER ia_cat(3)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# Lbc type = 8 for Pressure


i_typid = 8

# Get all valid categories for Pressure


i_return_value = @
db_get_valid_cat_by_type @
( i_typid, @
ia_cat )
dump i_return_value
dump ia_cat

# Lbc type = 7 for Force


i_typid = 7

# Get all valid categories for Pressure


i_return_value = @
db_get_valid_cat_by_type @
( i_typid, @
ia_cat )
dump i_return_value
dump ia_cat
#---------------------------------------------------------------------
# Following are valid category ids for application of lbcs
# ia_cat = 1 indicates nodal application
# = 2 indicates element uniform application
# = 3 indicates element variable application
#---------------------------------------------------------------------

db_get_valid_eldim_by_type_cat ()

# Purpose : This file provides an example of multiple calls


# to the function db_get_valid_eldim_by_
# type_cat()
#
# This function gets the valid element dimension
# ids for specified lbc type and category type.
#
# In this example a new database is created and
# valid element dimension ids for lbc type
# “Pressure”, “Force” and “Displacement” are
# obtained.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
Main Index
CHAPTER 11 1347
Loads and Boundary Conditions

# The function db_get_valid_eldim_by_type_cat()


# has the following arguments:
#
# db_get_valid_eldim_by_type_cat
# ( typid,
# cat,
# eldim )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_typid
INTEGER i_cat
INTEGER ia_eldim(5)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# Lbc type = 8 for Pressure


i_typid = 8

# Get the valid element dimension ids


FOR ( i_cat = 2 TO 3 )
i_return_value = @
db_get_valid_eldim_by_type_cat @
( i_typid, @
i_cat, @
ia_eldim )
dump i_return_value
dump i_cat
dump ia_eldim
END FOR
#---------------------------------------------------------------------
# Lbc type = 7 for Force
i_typid = 7

# Get the valid element dimension ids


FOR ( i_cat = 1 TO 3 )
i_return_value = @
db_get_valid_eldim_by_type_cat @
( i_typid, @
i_cat, @
ia_eldim )
dump i_return_value
dump i_cat
dump ia_eldim
END FOR
#---------------------------------------------------------------------
# Lbc type = 6 for Displacement
i_typid = 6

# Get the valid element dimension ids


FOR ( i_cat = 1 TO 3 )
i_return_value = @
db_get_valid_eldim_by_type_cat @
( i_typid, @
i_cat, @
ia_eldim )
dump i_return_value
dump i_cat
dump ia_eldim
END FOR
#---------------------------------------------------------------------
# Following are valid element dimension ids for application of lbcs
# ia_eldim = 1 indicates line elements
# = 2 indicates surface elements
Main Index
1348
Code Examples

# = 3 indicates solid elements


#---------------------------------------------------------------------

db_get_valid_lbc_var_ids ()

# Purpose : This file provides an example of a call to the


# function db_get_valid_lbc_var_ids()
#
# This function gets all the lbc type variable
# id from the database for specified detail of
# lbc type id.
#
# In this example a new database is opened and
# variable ids of lbc_type “Pressure” is obtained
# after assigning suitable values for category
# type id and element dimension id.
#
# This file can be run by starting a session of
# MSC.Patran, opening a new or existing database,
# and running this session file through the
# “File”,”Session”,”Play” pulldown menus
# on the menu bar.
#
# The function db_get_valid_lbc_var_ids()
# has the following arguments:
#
# db_get_valid_lbc_var_ids
# ( typid,
# cat,
# eldim,
# count,
# vid )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_typid
INTEGER i_cat
INTEGER i_eldim
INTEGER i_count
INTEGER ia_vid(10)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# Lbc type id = 8 for Pressure


i_typid = 8

# Category type id = 2 for element uniform


i_cat = 2

# Element dimensionality id = 2 for surface elements


i_eldim = 2

# Maximum storage for variable IDs


i_count = 10

# Get all the valid element variable ids


i_return_value = @
db_get_valid_lbc_var_ids @
( i_typid, @
i_cat, @
i_eldim, @
i_count, @
Main Index
CHAPTER 11 1349
Loads and Boundary Conditions

ia_vid )
dump i_return_value
dump i_count
dump ia_vid
#---------------------------------------------------------------------
# Following are valid load type variable id for Pressure
# ia_vid = 1 for Top surface pressure
# = 2 for Bottom surface pressure
# = 3 for Edge pressure
#---------------------------------------------------------------------

db_modify_load_case ()

# Purpose : This file provides an example of a call to the


# function db_modify_load_case()
#
# This function modifies the load case in the
# database
#
# In the following example the spool database is
# opened and the load case “spool_loads”,
# originally consisting of 4 lbcs is modified
# using this function into load case with same
# name consisting of only 2 lbcs. Number of lbcs
# in load case is verified before and after
# modification.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_modify_load_case()
# has the following arguments:
#
# db_modify_load_case
# ( id
# name,
# type,
# desc,
# nbrlc,
# lbc,
# dlcname,
# mv,
# priority )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_id
STRING s_name[32]
INTEGER i_type
STRING s_desc[64]
INTEGER i_nbrlc
INTEGER iv_lbc(VIRTUAL)
STRING s_dlcname[32]
REAL r_mv
INTEGER ia_priority(4)
INTEGER i_num_loads
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)
Main Index
1350
Code Examples

# Id of the load case = 2 for “spool_loads”


i_id = 2

# Name for modified lbc (retaining same name)


s_name = “spool_loads”

# Load case type = 1 for static load case


i_type = 1

# Description of load case


s_desc = “Modified load case”

# Number of lbc attached to this new load case


i_nbrlc = 2

# Load ids associated with load case


i_return_value = sys_allocate_array(iv_lbc,1,i_nbrlc)
dump i_return_value
iv_lbc = [3,4]

# Name of dynamic load case from which this static load case is
# derived. A blank string if not applicable.
s_dlcname = ““

# Map variable
r_mv = 1.0

# Number of lbcs in load case “spool_loads” before modification


i_return_value = @
db_count_lbc_by_load_case @
( s_name, @
i_num_loads )
dump i_return_value
dump i_num_loads

# Modify load case


i_return_value = @
db_modify_load_case @
( i_id, @
s_name, @
i_type, @
s_desc, @
i_nbrlc, @
iv_lbc, @
s_dlcname, @
r_mv, @
ia_priority)
dump i_return_value

# Number of lbcs in load case “spool_loads” after modification


i_return_value = @
db_count_lbc_by_load_case @
( s_name, @
i_num_loads )
dump i_return_value
dump i_num_loads

# Free memory
sys_free_array(iv_lbc)
#---------------------------------------------------------------------

Main Index
CHAPTER 11 1351
Loads and Boundary Conditions

lbc_create ()

# Purpose : This file provides an example of a call to the


# function lbc_create()
#
# This function creates a load/boundary condition
# set.
#
# In the following example the spool database is
# opened and a load(force) named “new_force” is
# added. No. of lbcs in the database is verified
# before and after addition.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function lbc_create()
# has the following arguments:
#
# lbc_create
# ( name,
# type_id,
# cat_id,
# dyn_flag,
# num_ar,
# ar_id,
# aplist1,
# aplist2,
# fem_flag,
# targ_elem,
# lbc_sf,
# cid_id,
# no_data_flag,
# num_dat,
# var_id,
# sv,
# null_flag,
# null_var,
# datatype,
# ivalue,
# rvalue,
# fldid,
# dyn_fldid,
# node_id )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[64]
INTEGER i_type_id
INTEGER i_cat_id
INTEGER i_dyn_flag
INTEGER i_num_ar
INTEGER ia_ar_id(2)
STRING s_aplist1[32]
STRING s_aplist2[32]
INTEGER ia_fem_flag(5)
INTEGER ia_targ_elem(3)
REAL r_lbc_sf
INTEGER i_cid_id
INTEGER i_no_data_flag
Main Index
1352
Code Examples

INTEGER i_num_dat
INTEGER ia_var_id(20)
INTEGER ia_sv(20)
INTEGER ia_null_flag(20)
INTEGER iaa_null_var(20,3)
INTEGER ia_datatype(20)
INTEGER ia_ivalue(20)
REAL raa_rvalue(20,3)
INTEGER iaa_fldid(20,3)
INTEGER iaa_dyn_fldid(20,3)
INTEGER ia_node_id(20)
INTEGER i_return_value

INTEGER i_count1
INTEGER i_count2
INTEGER i_load_count
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Post the “default_group”


uil_viewport_post_groups.posted_groups @
( “default_viewport”, 1, [“default_group”] )

# Count number of Loads/BCs


i_return_value = @
db_count_lbc(i_load_count)
dump i_return_value

# The number of LBCs in the database is


dump i_load_count

# Follow the instructions below to display Loads/BCs in the graphic


# Window.
# Pick “Display”, “Load/BC/Elem Props..” from pull-down menus.
# Select “Show All” below Loads/BCs and “Apply”

# Session file paused. Press “Resume” to continue..


sf_pause()
#---------------------------------------------------------------------
# Initializing the input variables

# Load id = 7 for force 8 for pressure


i_type_id = 7

# Category id = 1 for nodal, 2 for Element Uniform,3 for Element var


i_cat_id = 1

# Dynamic flag = FA_FALSE = 0 for static mode


i_dyn_flag = 0

# Number of application region


i_num_ar = 1

# Application region db ID
ia_ar_id(1) = 1
ia_ar_id(2) = 0
s_aplist1 = “Point 8”

# FEM Flag = FA_TRUE if FEM entities


# if applied to geometry flag = 0
# if applied to fem flag = 1
# flag(4)=app_reg_couple=0 for Mult., appl., region coupling action
# flag(5)=app_reg_order=0 for Mult., appl., region order action

ia_fem_flag=[0,0,0,0,0]
Main Index
CHAPTER 11 1353
Loads and Boundary Conditions

# Target Element dimension = 0 for point, 1 for one-dimensional etc.


ia_targ_elem = [0,0,0]

# Lbc Set Scale factor


r_lbc_sf = 1.0

# Coordinate System ID
i_cid_id = 0

# No_Data_Flag = FA_TRUE if no case is invalid


# i_no_data_flag = FA_TRUE
i_no_data_flag = 1

# Number of Input data variables : Forces in three direction


i_num_dat = 6

# Input Variable data ID : Load variable id =1 of F1 F2 F3


# 2 for M1 M2 M3
# Pressure : 1 for top, 2 for bottom, 3 for edge

FOR (i_count1 = 1 TO 3)
ia_var_id(i_count1) = 1
END FOR

FOR (i_count1 = 4 TO 6)
ia_var_id(i_count1) = 2
END FOR

# Data is scalar or vector ( 2 if vector )


FOR (i_count1 = 1 TO 20 )
ia_sv(i_count1) = 2
END FOR

# Null vector flag = 1 if null allowed


FOR (i_count1 = 1 TO 20 )
ia_null_flag(i_count1) = 0
END FOR

# Flag indicating whether the vector component is null


# flag = 0 interprets blank components as zeroes
# flag = -1 interprets blank components as nulls
FOR (i_count1 = 1 TO 20 )
FOR (i_count2 = 1 TO 3 )
iaa_null_var(i_count1,i_count2) = 0
END FOR
END FOR

# Datatypes = 1 for integer, 2 for logical, 3 for real


FOR (i_count1 = 1 TO 20 )
ia_datatype(i_count1) = 3
END FOR

# Integer values
FOR (i_count1 = 1 TO 20 )
ia_ivalue(i_count1) = 0
END FOR

# Real values
FOR (i_count1 = 1 TO 20 )
FOR (i_count2 = 1 TO 3 )
raa_rvalue(i_count1,i_count2) = 0.0
END FOR
END FOR
raa_rvalue(1,2) = -200.0

# Field ID
FOR (i_count1 = 1 TO 20 )
Main Index
1354
Code Examples

FOR (i_count2 = 1 TO 3 )
iaa_fldid(i_count1,i_count2) = 0
END FOR
END FOR

# Dynamic field ID
FOR (i_count1 = 1 TO 20 )
FOR (i_count2 = 1 TO 3 )
iaa_dyn_fldid(i_count1,i_count2) = 0
END FOR
END FOR

# Node ID
FOR (i_count1 = 1 TO 20 )
ia_node_id(i_count1) = 6
END FOR

# Create LBC.
i_return_value = @
lbc_create @
( s_name, @
i_type_id, @
i_cat_id, @
i_dyn_flag, @
i_num_ar, @
ia_ar_id, @
s_aplist1, @
s_aplist2, @
ia_fem_flag, @
ia_targ_elem, @
r_lbc_sf, @
i_cid_id, @
i_no_data_flag, @
i_num_dat, @
ia_var_id, @
ia_sv, @
ia_null_flag, @
iaa_null_var, @
ia_datatype, @
ia_ivalue, @
raa_rvalue, @
iaa_fldid, @
iaa_dyn_fldid, @
ia_node_id )

dump i_return_value

# Count number of Loads/BCs


i_return_value = @
db_count_lbc(i_load_count)
dump i_return_value

# The number of LBCs in the database is


dump i_load_count
#---------------------------------------------------------------------

lbc_delete ()

# Purpose : This file provides an example of a call to the


# function lbc_delete()
#
# This functions deletes the loads and boundary
# condition sets ( and their related association
# with application region, data, load case
# association )
Main Index
CHAPTER 11 1355
Loads and Boundary Conditions

#
# In this example the spool database is
# opened and loads named “fillet_transition” and
# “400_psi” are deleted after a pause.
# Observation on list of Loads/BCs is made
# before and after deletion of loads.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function lbc_delete()
# has the following arguments:
#
# lbc_delete
# ( count,
# del_id,
# update_graph )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_count
INTEGER ia_del_id(2)
LOGICAL l_update_graph
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Number of Loads and BC Sets to delete = 2


i_count = 2

# Load/BC Set
ia_del_id = [1,2]

# If TRUE, then update graphics


l_update_graph = TRUE

# Follow the instructions below to display Loads/BCs in the graphic


# Window.
# Pick “Display”,”Load/BC/Elem Props..” from pull-down menus
# Select “Show All” below Loads/BCs and “Apply”

# It can be observed that the symbols representing


# “fillet_transition” and “400_psi” getting removed
# on execution lbc_delete()

# Session file paused. Press “Resume” to continue..


sf_pause()
#---------------------------------------------------------------------
# Delete the LBCs
i_return_value = @
lbc_delete @
( i_count, @
ia_del_id, @
l_update_graph )
dump i_return_value
#---------------------------------------------------------------------

Main Index
1356
Code Examples

lbc_eval_fem_by_lc ()

# Purpose : This file provides an example of a call to the


# function lbc_eval_fem_by_lc()
#
# Given a load case name it gets all the lbcs
# associated with it and checks to see if each
# lbc has any unevaluated fem_xx_lbcs. It also
# creates the appropriate fem_xx_table in the
# database.
#
# In this example the spool database is
# opened and fem_xx_table of load case “Default”
# is evaluated using this function.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function lbc_eval_fem_by_lc() has the following arguments:
#
# lbc_eval_fem_by_lc
# ( lc_name )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_lc_name[32]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Load case name


s_lc_name = “Default”

# Evaluate Load/BC of load-case set at associated FEM entities.


i_return_value = @
lbc_eval_fem_by_lc @
( s_lc_name )
dump i_return_value

# Comments generated on evaluation of load-case set at associated


# FEM entities can be observed.
#---------------------------------------------------------------------

lbc_eval_fem_lbc ()

# Purpose : This file provides an example of a call to the


# function lbc_eval_fem_lbc()
#
# Given a lbc id , this function checks to see if
# each lbc has any unevaluated fem_xx_lbcs. If it
# does then create the appropriate fem_xx_table
# in the database.
#
# In this example the spool database is opened
# and fem_xx_table of load “fillet_pressure”
# is evaluated.
#
Main Index
CHAPTER 11 1357
Loads and Boundary Conditions

# Before running this session file run spool.ses


# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function lbc_eval_fem_lbc()
# has the following arguments:
#
# lbc_eval_fem_lbc
# ( lbc_id )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_lbc_id
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# i_lbc_id = 1 for LBC “fillet_pressure” in spool.db


i_lbc_id = 1

# Evaluate Load/BC set at associated FEM entities


i_return_value = @
lbc_eval_fem_lbc @
( i_lbc_id )
dump i_return_value

# Comments generated on evaluation of Load/BC at associated


# FEM entities can be observed.
#---------------------------------------------------------------------

lbc_get_sdbx_datatype ()

# Purpose : This file provides an example of a call to the


# function lbc_get_sdbx_datatype()
#
# This function on input of lbc id, object,
# method target element type, geometry group;
# returns the select databox datatype and label
#
# In this example the spool database is opened
# and the select databox datatype and label for
# lbc “TZ_fixed” is obtained.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function lbc_get_sdbx_datatype()
# has the following arguments:
#
# lbc_get_sdbx_datatype
# ( lbc_id,
# obj_str,
# meth_str,
# targ_str,
# geo_group,
Main Index
1358
Code Examples

# sdbx_type,
# sdbx_label )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_lbc_id
STRING s_obj_str[32]
STRING s_meth_str[32]
STRING s_targ_str[32]
STRING s_geo_group[32]
STRING s_sdbx_type[32]
STRING s_sdbx_label[32]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Load/BCs details
# i_lbc_id = 4 for displacement
i_lbc_id = 4
s_obj_str = “Displacement”
s_meth_str = “Nodal”
s_geo_group = “Geometry”

# Return databox datatype and label


i_return_value = @
lbc_get_sdbx_datatype @
( i_lbc_id, @
s_obj_str, @
s_meth_str, @
s_targ_str, @
s_geo_group, @
s_sdbx_type, @
s_sdbx_label )
dump i_return_value
dump s_sdbx_type
dump s_sdbx_label
#---------------------------------------------------------------------

lbc_gm ()

# Purpose : This file provides an example of a call to the


# function lbc_gm()
#
# This function calls Loads/BCs Graphics Manager
#
# This illustration opens spool.db and fetches
# group vector table id associated with
# “default_group”. Then it calls lbc_gm() to
# create a new group vector table. The id of
# group vector table is verified again for
# “default_group”.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function lbc_gm() has no arguments.
#
#---------------------------------------------------------------------
# Variable Declarations
Main Index
CHAPTER 11 1359
Loads and Boundary Conditions

INTEGER i_return_value
STRING s_load_case_name[32]
STRING s_group_name[32]
INTEGER i_vector_id
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# s_group_name = “default_group”
s_group_name = “default_group”

# Get the load vector table associated with the group


i_return_value = @
ga_group_load_vector_get @
( s_group_name, @
i_vector_id )
dump i_return_value
dump i_vector_id

# Activate Loads/BC’s Graphics Manager


i_return_value = lbc_gm()
dump i_return_value

# Get the load vector table associated with the group


i_return_value = @
ga_group_load_vector_get @
( s_group_name, @
i_vector_id )
dump i_return_value
dump i_vector_id

# It can be observed that the load vector table id increased by 1


# which infers that a new Group Vector table is created and
# assigned to valid groups
#---------------------------------------------------------------------

lbc_graphics_defn ()

# Purpose : This file provides an example of a call to the


# function lbc_graphics_defn()
#
# Given LBC type id, category id and target elem
# id it gets data in ss_lbc, sv_lbc, ds_lbc and
# /or dv_lbc table.
#
# In this example the spool database is
# opened and lbc,”TZ_fixed” is used for
# getting data into its ss_lbc, sv_lbc, ds_lbc
# and/or dv_lbc table.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function lbc_graphics_defn()
# has the following arguments:
#
# lbc_graphics_defn
# ( type_id,
# cat_id,
# targ_elem_id,
Main Index
1360
Code Examples

# nvar,
# varid,
# vector_flag,
# marker,
# color,
# anchor )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_type_id
INTEGER i_cat_id
INTEGER i_targ_elem_id
INTEGER i_nvar
INTEGER ia_varid(16)
INTEGER ia_vector_flag(16)
INTEGER ia_marker(16)
INTEGER ia_color(16)
INTEGER ia_anchor(16)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# LBC Type Id - disp, Force ( 6 for displacement )


i_type_id = 6

# Category = 1 for Nodal, 2 for Elem Uniform, 3 for Element Var


i_cat_id = 1

# Target Element Dimension = 0 for point, 1 for one dimensional,..


i_targ_elem_id = 0

# Get data in ss_lbc, sv_lbc, ds_lbc and/or dv_lbc table


i_return_value = @
lbc_graphics_defn @
( i_type_id, @
i_cat_id, @
i_targ_elem_id, @
i_nvar, @
ia_varid, @
ia_vector_flag, @
ia_marker, @
ia_color, @
ia_anchor )

dump i_return_value
dump ia_varid
dump ia_vector_flag
dump ia_marker
dump ia_color
dump ia_anchor
#---------------------------------------------------------------------

lbc_lp_parse_sca ()

# Purpose : This file provides an example of a call to the


# function lbc_lp_parse_sca()
#
# This function parses the data contained in the
# string s_dval and verifies the validity of data
# (real scalar or a scalar field)
#
# In this example a string containing real
# scalar values is given for parsing.
#
Main Index
CHAPTER 11 1361
Loads and Boundary Conditions

# This file can be run by starting a session of


# MSC.Patran and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function lbc_lp_parse_sca() has the following arguments:
#
# lbc_lp_parse_sca
# ( dval,
# datatype,
# field_id,
# null_flag,
# rval )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_dval[64]
INTEGER i_datatype
INTEGER i_field_id
INTEGER i_null_flag
REAL r_rval
INTEGER i_return_value
#---------------------------------------------------------------------
# String containing the property
s_dval = “100.0”

# Datatype = 3 to parse real values


i_datatype = 3

# Parse the data contained in the string


i_return_value = @
lbc_lp_parse_sca @
( s_dval, @
i_datatype, @
i_field_id, @
i_null_flag, @
r_rval )
dump i_return_value

# Field ID
dump i_field_id

# Flag indicating if data is NULL


dump i_null_flag

# Real value of RVAL


dump r_rval
#---------------------------------------------------------------------

lbc_lp_parse_vec ()

# Purpose : This file provides an example of a call to the


# function lbc_lp_parse_vec()
#
# This function parses the data contained in the
# string s_dval and verifies the validity of
# data (real vector or a vector field)
#
# In this example a string containing real
# vector values is given for parsing
#
# This file can be run by starting a session of
# MSC.Patran and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
Main Index
1362
Code Examples

#
# The function lbc_lp_parse_vec() has the following arguments:
#
# lbc_lp_parse_vec
# ( dval,
# field_id,
# null_flag,
# rval )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_dval[32]
INTEGER ia_field_id(8)
INTEGER ia_null_flag(8)
REAL ra_rval(8)
INTEGER i_return_value
#---------------------------------------------------------------------
# String containing the property
s_dval = “< 123.1, -45.6, 7.89>”

# Parse the data contained in the string


i_return_value = @
lbc_lp_parse_vec @
( s_dval, @
ia_field_id, @
ia_null_flag, @
ra_rval )
dump i_return_value

# Field IDs
dump ia_field_id

# Flag to indicate NULL


dump ia_null_flag

# Real value of DVAL


dump ra_rval
#---------------------------------------------------------------------

lbc_plot_markers ()

# Purpose : This file provides an example of a call to the


# function lbc_plot_markers()
#
# This function creates the graphics marker table
# for display on groups
#
# In this example the spool database is opened
# and group vector table id associated with
# “default_group” is obtained. Then this function
# is called to create graphic marker tables for
# “default_group”.The id of group vector table is
# verified again for “default_group”.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function lbc_plot_markers() has the following arguments:
#
# lbc_plot_markers
Main Index
CHAPTER 11 1363
Loads and Boundary Conditions

# ( num_lbcs,
# lbc_ids,
# num_grps,
# grp_ids )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_num_lbcs
INTEGER ia_lbc_ids(4)
INTEGER i_num_grps
INTEGER ia_grp_ids(2)
INTEGER i_return_value
STRING s_group_name[16]
INTEGER i_vector_id
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Get the load vector table associated with the group


i_return_value = @
ga_group_load_vector_get @
( “default_group”, @
i_vector_id )
dump i_return_value
dump i_vector_id

# Number of lbc Ids


# num_lbcs = 4 (fillet_transition, 400_psi, 200_psi and TZ_fixed)
i_num_lbcs = 4

# Lbc Ids to process


ia_lbc_ids = [1,2,3,4]

# Number of groups
i_num_grps= 1

# Group ID = 1 for “default_group”


ia_grp_ids = [1,0]

# Create graphics marker tables for display on groups


i_return_value = @
lbc_plot_markers @
( i_num_lbcs, @
ia_lbc_ids, @
i_num_grps, @
ia_grp_ids )
dump i_return_value

# Get the load vector table associated with the “default_group”


i_return_value = @
ga_group_load_vector_get @
( “default_group”, @
i_vector_id )
dump i_return_value
dump i_vector_id

# It can be observed that the load vector table id increased by 1


# which infers that a new Group Vector table is created for
# “default_group”
#---------------------------------------------------------------------

Main Index
1364
Code Examples

lbc_show_plot_scalar ()

# Purpose : This file provides an example of a call to the


# function lbc_show_plot_scalar()
#
# This function loads scalar graphics table for
# specified loads and boundary condition and
# assigns them to the specified groups . It is
# also the main application routine for Loads/BCs
# show plot scalar option.
#
# In this example the spool database is opened
# and scalar plot for lbcs “fillet_transition”,
# “400_psi” and “200_psi” are displayed.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
#
# The function lbc_show_plot_scalar()
# has the following arguments:
#
# lbc_show_plot_scalar
# ( type_name,
# type_id,
# dynamic_val,
# var_name,
# component,
# num_lbcs,
# lbc_ids,
# num_grps,
# group_ids )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_type_name[32]
INTEGER i_type_id
REAL r_dynamic_val
STRING s_var_name[64]
STRING s_component[64]
INTEGER i_num_lbcs
INTEGER ia_lbc_ids(3)
INTEGER i_num_grps
INTEGER ia_group_ids(1)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Details of loads for which scalar graphics table is loaded


s_type_name = “Pressure”
i_type_id = 8
r_dynamic_val = 0.0
s_var_name = “Bot Surf Pressure”
s_component = “Resultant”
i_num_lbcs = 3
ia_lbc_ids = [1,2,3]
i_num_grps = 1
ia_group_ids = [1]

Main Index
CHAPTER 11 1365
Loads and Boundary Conditions

# Call the function to plot scalars on graphics window


i_return_value = @
lbc_show_plot_scalar @
( s_type_name, @
i_type_id, @
r_dynamic_val, @
s_var_name, @
s_component, @
i_num_lbcs, @
ia_lbc_ids, @
i_num_grps, @
ia_group_ids )
dump i_return_value
#---------------------------------------------------------------------

loadcase_create2 ()

# Purpose : This file provides an example of a call to the


# function loadcase_create2()
#
# This function creates a new loadcase in the
# database.
#
# This file can be run by starting a session of
# MSC/PATRAN, running this session file through the
# "File","Session","Play" pulldown menus
# on the menu bar.
#
#
# The function loadcase_create2()
# has the following arguments:
#
# loadcase_create2 ( loadcase_name, @
# loadcase_type, @
# loadcase_desp, @
# scale_factor, @
# lbcs_name, @
# priorities, @
# lbc_scales, @
# dynamic_lc, @
# mv, @
# make_current )
#
#---------------------------------------------------------------------
# Variable Declarations

STRING loadcase_name[32]
STRING loadcase_type[32]
STRING loadcase_desp[32]
REAL scale_factor
STRING lbcs_name[32](2)
INTEGER priorities(2)
REAL lbc_scales(2)
STRING dynamic_lc[32]
REAL mv
LOGICAL make_current
INTEGER i_return_value
INTEGER fem_create_mesh_solid_num_nodes
INTEGER fem_create_mesh_solid_num_elems
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]
STRING asm_create_hpat_xyz_created_ids[VIRTUAL]

#---------------------------------------------------------------------
# Open a new database
Main Index
1366
Code Examples

IF( !db_is_open()) THEN


uil_file_new.go( "", "new.db" )
ENDIF

$? YES 36000002

#---------------------------------------------------------------------
# Create Geometric entities

asm_const_hpat_xyz( "1", "<10 10 10>", "[0 0 0]", "Coord 0", @


asm_create_hpat_xyz_created_ids )

#---------------------------------------------------------------------
# Create Finite Element entities

fem_create_mesh_sol_3( "IsoMesh", 0, "Solid 1 ", 1, [2.], "Hex8", @


"1", "1", "Coord 0", "Coord 0", @
fem_create_mesh_solid_num_nodes, @
fem_create_mesh_solid_num_elems, @
fem_create_mesh_s_nodes_created, @
fem_create_mesh_s_elems_created )

#---------------------------------------------------------------------
# Create Displacement Boundary condition "New_disp"

loadsbcs_create2( "New_disp", "Displacement", "Nodal", "", "Static", @


[ "Node 6:216:6"], "FEM", "Coord 0", "1.", @
["<0 0 0 >", "<0 0 0 >"], [ "", ""] )

#---------------------------------------------------------------------
# Create Force Boundary condition "New_load"

loadsbcs_create2( "New_load", "Force", "Nodal", "", "Static", @


["Node 1:211:6"], "FEM", "Coord 0", "1.", @
["<0 0 -100 >", "<0 0 0 >"], ["", ""] )

#---------------------------------------------------------------------
# Argument Initialization.

loadcase_name = "NEW LOAD CASE"


loadcase_type = "Static"
loadcase_desp = "Example Load Case"
scale_factor = 1.0
lbcs_name(1) = "New_disp"
lbcs_name(2) = "New_load"
priorities(1) = 0
priorities(2) = 0
lbc_scales(1) = 1.
lbc_scales(2) = 1.
dynamic_lc = ""
mv = 0.
make_current = TRUE

#---------------------------------------------------------------------
# New Load Case Created as a "NEW LOAD CASE"

i_return_value = loadcase_create2 ( loadcase_name, @


loadcase_type, @
loadcase_desp, @
scale_factor, @
lbcs_name, @
priorities, @
lbc_scales, @
dynamic_lc, @
mv, @
make_current )
Main Index
CHAPTER 11 1367
Loads and Boundary Conditions

#---------------------------------------------------------------------
# Dump the return value of the function and its status

dump i_return_value

#---------------------------------------------------------------------
# closing the patran environment.

# uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

loadsbcs_get_appl_region_list ()

# Purpose : This file provides an example of a call to the


# function loadsbcs_get_appl_region_list()
#
# This function gets the application region
# entities - types, ids, and sub-ids from
# the database.
#
# In this example the spool database is
# opened and details of application region for
# lbc “400_psi” is obtained
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function loadsbcs_get_appl_region_list()
# has the following arguments:
#
# loadsbcs_get_appl_region_list
# ( id,
# region_id,
# ent_count,
# geo_str,
# app_list )
#
#--------------------------------------------------------------------
# Variable Declarations
INTEGER i_lbc_id
INTEGER i_region_id
INTEGER i_ent_count
STRING s_geo_str[16]
STRING sv_app_list[VIRTUAL]
INTEGER i_return_value

INTEGER ia_count(2)
INTEGER ia_region_ids(2)
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# i_lbc_id = 2 for Pressure “400_psi”


i_lbc_id = 2

# Gets the ids of the application regions


i_return_value = @
db_count_lbc_appl_region_entity @
Main Index
1368
Code Examples

( i_lbc_id, @
ia_region_ids, @
ia_count )
i_region_id = ia_region_ids(1)
i_ent_count = ia_count(1)

# Get the application region entities details


i_return_value = @
loadsbcs_get_appl_region_list @
( i_lbc_id, @
i_region_id, @
i_ent_count, @
s_geo_str, @
sv_app_list )
dump i_return_value
dump s_geo_str
dump sv_app_list

# Free memory
sys_free_string(sv_app_list)
#---------------------------------------------------------------------

loadsbcs_lp_coord ()

# Purpose : This file provides an example of a call to the


# function loadsbcs_lp_coord()
#
# This function returns the coordinate system id
# on input of the coordinate system list
#
# In this example a new database is opened and
# id of the default coordinate system “COORD 0”
# is obtained.
#
# This file can be run by starting a session of
# MSC.Patran and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function loadsbcs_lp_coord() has the following arguments:
#
# loadsbcs_lp_coord
# ( cid_list,
# cid_id )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_cid_list[32]
INTEGER i_cid_id
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “spool.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# Coordinate system list


s_cid_list = “COORD 0”

# Get the Coordinate system id


i_return_value = @
loadsbcs_lp_coord @
( s_cid_list, @
i_cid_id )
dump i_return_value
dump i_cid_id
#---------------------------------------------------------------------
Main Index
MSC.Acumen, Volume 2: Code Examples

CHAPTER
Materials
12
■ Introduction

Main Index
1370
Code Examples

12.1 Introduction
This chapter provides code examples for the PCL function described in Volume 1. These
examples are designed so that they can be cut and pasted into a file and, by following the
instructions listed with each example, executed in MSC.Patran.

db_bulk_get_possible_cond_opts1 ()

# Purpose : This file provides an example of a call to the


# function db_bulk_get_possible_cond_opts1()
#
# This file opens a new database “new.db” and
# gets the number of condense options and it’s
# code values for “Shell” element type with
# “Nastran” as analysis code and “Structural” as
# the analysis type.
#
# For element type ID,and condense option codes,
# refer MSC.Patran User Manual, Part 9,
# Section 7.6.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_bulk_get_possible_cond_opts1()
# has the following arguments:
#
# db_bulk_get_possible_cond_opts1
# ( etid,
# atid,
# acid,
# nbr,
# coc )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_etid
INTEGER i_atid
INTEGER i_acid
INTEGER i_nbr
INTEGER ia_coc(4)
INTEGER i_return_value
STRING s_atname[16]
#---------------------------------------------------------------------
# Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# The Element type ID for “Shell” is 51
i_etid = 51
# Get the analysis code id for “MSC.Nastran”
i_return_value = @
db_get_anal_code_id @
( “MSC.Nastran”,i_acid )
dump i_return_value
#
# Get the analysis type id for “Structural”
s_atname = “Structural”
i_return_value = @
db_get_anal_type_id @
Main Index ( s_atname, @
CHAPTER 12 1371
Materials

i_atid )
dump i_return_value
#
# Get the number and ID’s of the condense options
i_return_value = @
db_bulk_get_possible_cond_opts1 @
( i_etid, @
i_atid, @
i_acid, @
i_nbr, @
ia_coc )
dump i_return_value
dump i_nbr
dump ia_coc
#---------------------------------------------------------------------

db_bulk_get_possible_cond_opts2 ()

# Purpose : This file provides an example of a call to the


# function db_bulk_get_possible_cond_opts2()
#
# This file opens a new database “new.db” and
# gets the number of condense options and it’s
# code values for “Shell” element type with
# “Nastran” as analysis code and “Structural” as
# the analysis type.
#
# For element type ID,and condense option codes,
# and geometric option codes refer MSC.Patran
# User Manual, Part 9, Section 7.6.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_bulk_get_possible_cond_opts2()
# has the following arguments:
#
# db_bulk_get_possible_cond_opts2
# ( etid,
# atid,
# acid,
# goc,
# nbr,
# coc )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_etid
INTEGER i_atid
INTEGER i_acid
INTEGER i_goc
INTEGER i_nbr
INTEGER ia_coc(4)
INTEGER i_return_value
STRING s_atname[32]
#---------------------------------------------------------------------
# Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Get the code id for “MSC.Nastran”
i_return_value = @
db_get_anal_code_id(“MSC.Nastran”,i_acid)
Main Index
1372
Code Examples

dump i_return_value
#
# Get the analysis type id for “Structural”
s_atname = “Structural”
i_return_value = @
db_get_anal_type_id @
( s_atname, @
i_atid )
dump i_return_value
#
# The Element type id for ‘Shell’ is 51
i_etid = 51
#
# The geometric option code is N/A .
i_goc = 25
#
# Get the number and the ID’s of the condense options
i_return_value = @
db_bulk_get_possible_cond_opts2 @
( i_etid, @
i_atid, @
i_acid, @
i_goc, @
i_nbr, @
ia_coc )
dump i_return_value
dump i_nbr
dump ia_coc
#---------------------------------------------------------------------

db_bulk_get_possible_dof_sets ()

# Purpose : This file provides an example of a call to the


# function db_bulk_get_possible_dof_sets()
#
# This file opens a new database “new,db” and
# gets the number of unique DOF set ID values
# for the given set of input values.
#
# For element type ID,and condense option codes,
# geometric, formulation, laminate, linearity,
# and directionality codes refer MSC.Patran
# User Manual, Part 9, Section 7.6, 7.7.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_bulk_get_possible_dof_sets()
# has the following arguments:
#
# db_bulk_get_possible_dof_sets
# ( etid,
# atid,
# acid,
# coc,
# goc,
# foc,
# loc,
# mlc,
# mdc,
# nbr,
# dsid )
#
Main Index
CHAPTER 12 1373
Materials

#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_etid
INTEGER i_atid
INTEGER i_acid
INTEGER i_coc
INTEGER i_goc
INTEGER i_foc
INTEGER i_loc
INTEGER i_mlc
INTEGER i_mdc
INTEGER i_nbr
INTEGER ia_dsid(4)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# The element type ID for “Shell” is 51.
i_etid = 51
# The analysis type ID for “Structural” is 1.
i_atid = 1
# The analysis code ID for “MSC.Nastran” is 1.
i_acid = 1
# The ID of the condense option is 0.
i_coc = 0
# The geometric option code is 0.
i_goc = 0
# The formulation option code is 0.
i_foc = 0
# The laminate option code is 0.
i_loc = 0
# The material linearity code is 0.
i_mlc = 0
# The material directionality code is 0.
i_mdc = 0
i_return_value = @
db_bulk_get_possible_dof_sets @
( i_etid, @
i_atid, @
i_acid, @
i_coc, @
i_goc, @
i_foc, @
i_loc, @
i_mlc, @
i_mdc, @
i_nbr, @
ia_dsid )
dump i_return_value
dump i_nbr
dump ia_dsid

#---------------------------------------------------------------------

db_count_materials ()

# Purpose : This file provides an example of a call to the


# function db_count_materials()
#
# This file opens a new database “new.db” and
# and creates a new material “New_Material”.
# And gets the count of materials before and
# after the creation of the new material.
Main Index
1374
Code Examples

#
# For material category,linearity,directionality,
# and material type IDs refer MSC.Patran User
# Manual, Part 9, Section 7.6, 7.7, 9.14.
#
# 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_materials()
# has the following arguments:
#
# db_count_materials
# ( count )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_count
INTEGER i_return_value
STRING s_mat_name[32]
INTEGER i_id
STRING s_description[216]
INTEGER i_cat
INTEGER i_lin
INTEGER i_dir
INTEGER i_type
#---------------------------------------------------------------------
# Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Get the count of the material in the new database
# which is 0.
i_return_value = @
db_count_materials @
( i_count )
dump i_return_value
dump i_count
#
# Create a new material
# Assign the name of the material.
s_mat_name = “New_Material”
# Assign the description.
s_description = “This material is created for an illustration”
# Assign the the category as “Isotropic”
i_cat = 1
# Linearity code is “Linear Elastic”.
i_lin = 1
# The directionality code is “Isotropic”
i_dir = 1
# The material type is “Homogeneous material”
i_type = 1
i_return_value = @
db_create_material @
( s_mat_name, @
s_description, @
i_cat, @
i_lin, @
i_dir, @
i_type, @
i_id )
dump i_return_value
#
# Get the latest count of the materials.
i_return_value = @
Main Index
CHAPTER 12 1375
Materials

db_count_materials @
( i_count )
dump i_return_value
dump i_count
#------------------------------------------------------------

db_count_options ()

# Purpose : This file provides an example of a call to the


# function db_count_options()
#
# This file opens a new database “new.db” and
# gets the count of geometric, condense,
# formulation, laminate options and
# the count of degree of freedom sets and
# element topologies.
#
# All these codes, IDs and counts are available
# in MSC.Patran User Manual, Part 9,
# Section 7.6 and 7.7.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_count_options()
# has the following arguments:
#
# db_count_options
# ( goc,
# coc,
# loc,
# foc,
# dsid,
# etop )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_goc
INTEGER i_coc
INTEGER i_loc
INTEGER i_foc
INTEGER i_dsid
INTEGER i_etop
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Get the count of the options.
i_return_value = @
db_count_options @
( i_goc, @
i_coc, @
i_loc, @
i_foc, @
i_dsid, @
i_etop )
dump i_return_value
dump i_goc
dump i_coc
dump i_loc
dump i_foc
Main Index
1376
Code Examples

dump i_dsid
dump i_etop
#---------------------------------------------------------------------

db_create_mtl_allowable_magics ()

# Purpose : This file provides an example of a call to the


# function db_create_mtl_allowable_magics()
#
# This file opens a new database “new.db”,and
# 1. Gets the count of magics for the magic
# category “Hardening Rule”.
# 2. Creates new allowable magics for
# the magic category “Hardening Rule”. and
# 3. Gets the latest count of the magics for
# the magic category “Hardening Rule”
#
# For material category IDs, magic category IDs,
# magic option IDs refer MSC.Patran User Manual,
# Part 9, Section 7.6 and 7.7 .
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
#
# The function db_create_mtl_allowable_magics()
# has the following arguments:
#
# db_create_mtl_allowable_magics
# ( cid,
# mc_id,
# magic_category_id,
# magic_alias_id,
# nbr )
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_code_id
INTEGER i_matl_cat_id
INTEGER i_magic_category_id
INTEGER i_nbr
INTEGER i_return_value
INTEGER ia_magic_alias_id(3)
#---------------------------------------------------------------------
# Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Get the code id for “MSC.Nastran”
i_return_value = @
db_get_anal_code_id(“MSC.Nastran”,i_code_id)
dump i_return_value
#
# The material category ID for “Isotropic” is 1.
i_matl_cat_id = 1
# The magic category id for “Hardening Rule” is 5.
i_magic_category_id = 5
#
# Get the count of the material allowable magics.
i_return_value = @
db_get_mtl_allowable_magic_cnt @
( i_code_id, @
i_matl_cat_id, @
i_magic_category_id, @
Main Index
CHAPTER 12 1377
Materials

i_nbr )
dump i_return_value
dump i_nbr
# Create three new valid magic options for the
# “Hardening Rule”
# The magics option ids for VonMises, Tresca and Mohr_coulomb
# yield functions are 10,11 and 12 respectively.
ia_magic_alias_id = [10,11,12]
i_nbr = 3
i_return_value = @
db_create_mtl_allowable_magics @
( i_code_id, @
i_matl_cat_id, @
i_magic_category_id, @
ia_magic_alias_id, @
i_nbr )
dump i_return_value
#
# Get the new count of the material allowable magics.
i_return_value = @
db_get_mtl_allowable_magic_cnt @
( i_code_id, @
i_matl_cat_id, @
i_magic_category_id, @
i_nbr )
dump i_return_value
dump i_nbr
#---------------------------------------------------------------------

db_delete_material ()

# Purpose : This file provides an example of a call to the


# function db_delete_material()
#
# This file opens a new database “new.db”,
# creates a new material “New_Material” and
# gets the count before and after the deletion
# of the newly created material.
#
# For material category,linearity,directionality,
# and material type IDs refer MSC.Patran User
# Manual, Part 9, Section 7.6, 7.7, 9.14.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_delete_material()
# has the following arguments:
#
# db_delete_material
# ( name )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
INTEGER i_return_value
INTEGER i_count
INTEGER i_id
STRING s_description[216]
INTEGER i_cat
INTEGER i_lin
INTEGER i_dir
INTEGER i_type
Main Index
1378
Code Examples

#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Create a new material
# Assign the name of the material.
s_name = “New_Material”
# Assign the description.
s_description = “This material is created for an illustration”
# Assign the the category as “Isotropic”
i_cat = 1
# Linearity code is “Linear Elastic”.
i_lin = 1
# The directionality code is “Isotropic”
i_dir = 1
# The material type is “Homogeneous material”
i_type = 1
i_return_value = @
db_create_material @
( s_name, @
s_description, @
i_cat, @
i_lin, @
i_dir, @
i_type, @
i_id )
dump i_return_value
#
# Get the count of the materials.
i_return_value = @
db_count_materials @
( i_count )
dump i_return_value
dump i_count
#
# Delete the material “New_Material”
s_name = “New_Material”
i_return_value = @
db_delete_material @
( s_name )
dump i_return_value
# Get the latest count of the materials which is 0.
i_return_value = @
db_count_materials @
( i_count )
dump i_return_value
dump i_count
#---------------------------------------------------------------------

db_delete_material_property ()

# Purpose : This file provides an example of a call to the


# function db_delete_material_property()
#
# This session file will open a new database
# by name ‘new.db’ with default options and will
# add one defination of isotropic material.Then
# Reference Temperature property is deleted for
# the material. Before deletion session file is
# paused for user to see the created material.
# Similarly after deletion user will have to see
# the change in MATERIAL SHOW form.
#
# For material property ids refer User’s Manual
Main Index
CHAPTER 12 1379
Materials

# Part 9, Section 7.6 and 7.7


#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_delete_material_property()
# has the following arguments:
#
# db_delete_material_property
# ( mid,
# mpid )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_mid
INTEGER i_mpid
INTEGER i_return_value
STRING s_name[64]
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
# Creating material for Structural analysis on MSC.Nastran based on
# linear elastic theory. Material name is “Session_example_material”
s_name = “Session_example_material”
i_return_value = @
material.create( “Analysis code ID”, 1, “Analysis type ID”, 1, @
s_name, 0, “New Material”,”Isotropic”, 1,”Directionality”,1, @
“Linearity”,1,”Homogeneous”,0,”Linear Elastic”,1, @
“Model Options & IDs”,[““, ““, ““, ““, ““],[0, 0, 0, 0, 0], @
“Active Flag”,1,”Create”,10,”External Flag”,FALSE,”Property IDs”, @
[ “Elastic Modulus”, “Poisson Ratio”, “Reference Temperature”], @
[2, 5, 1, 0], “Property Values”,[“2e12”, “.35”, “40.5”, ““] )
dump i_return_value

# Getting the id for the created material.


i_return_value = db_get_material_id_from_name(s_name,i_mid)
dump i_return_value
#---------------------------------------------------------------------
# Session file paused. Press “Resume” to continue..
# Session file execution is paused to see the material created.
# Open MATERIAL SHOW form, select the only material and press
# ‘Show Properties’ button.
sf_pause()
#---------------------------------------------------------------------
# Deleting the Reference Temperature property (property no.1)
i_mpid = 1
#
i_return_value = @
db_delete_material_property @
( i_mid, @
i_mpid )
dump i_return_value

#---------------------------------------------------------------------
# To see the updated material, open MATERIAL SHOW form, select the
# only material and press ‘Show Properties’ button.
#---------------------------------------------------------------------

Main Index
1380
Code Examples

db_delete_matl_const_model ()

# Purpose : This file provides an example of a call to the


# function db_delete_matl_const_model()
#
# This file 1. Opens a new data base “new.db”
# 2. Creates a new material “New_Material”
# 3. Gets the ID of the new material
# 4. Gets the count and IDs of the constitutive
# models.
# 5. Deletes one constitutive model and gets
# the latest count of constitutive models
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_delete_matl_const_model()
# has the following arguments:
#
# db_delete_matl_const_model
# ( mid,
# cmid )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_mid
INTEGER i_cmid
INTEGER i_return_value
INTEGER i_cmid
INTEGER i_num_models
INTEGER i_count
INTEGER iv_cm_id(VIRTUAL)
STRING s_mat_name[32]
#---------------------------------------------------------------------
# Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Create a new material “New_Material”
i_return_value = @
material.create @
( “Analysis code ID”, 1, “Analysis type ID”, 1, @
“New_Material”, 0, “Date: 20-Aug-97 @
Time: 17:47:10”, “Isotropic”, 1, @
“Directionality”, 1, “Linearity”, 1, @
“Homogeneous”, 0, “Linear Elastic”, 1, @
“Model Options & IDs”, [““, ““, ““, ““, ““], @
[0, 0, 0, 0, 0], “Active Flag”, 1, “Create”, @
10, “External Flag”, FALSE, “Property IDs”, @
[“Elastic Modulus”,”Poisson Ratio”], [2, 5, 0], @
“Property Values”, [“3.6e6”, “.33”, ““] )
dump i_return_value
#
# Get the material ID of the newly created material.
s_mat_name = “New_Material”
i_return_value = @
db_get_material_id_from_name @
( s_mat_name, @
i_mid )
dump i_return_value
dump i_mid
#---------------------------------------------------------------------
# Get the count material constitutive models
Main Index
CHAPTER 12 1381
Materials

i_return_value = @
db_get_matl_const_model_count @
( i_mid, @
i_count )
dump i_return_value
dump i_count
#
# Get the IDs of all the constitutive models of the material.
SYS_ALLOCATE_ARRAY (iv_cm_id, 1, i_count)
i_return_value = @
db_get_matl_const_model @
( i_mid, @
iv_cm_id )
dump i_return_value
dump iv_cm_id
#
# Delete the first constitutive model
i_cmid = iv_cm_id(1)
i_return_value = @
db_delete_matl_const_model @
( i_mid, @
i_cmid )
dump i_return_value
#
# Get the latest count of constitutive models of the material
i_return_value = @
db_get_matl_const_model_count @
( i_mid, @
i_count )
dump i_return_value
dump i_count
sys_free_array (iv_cm_id)
#---------------------------------------------------------------------

db_get_all_allow_matl_prop_cnt ()

# Purpose : This file provides an example of a call to the


# function db_get_all_allow_matl_prop_cnt()
#
# This session file will open a new database
# by name ‘new.db’ with default options and will
# display the ids for allowable material
# properties.
#
# For material property ids refer User’s Manual
# Part 9, Section 7.5 to 7.7
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_all_allow_matl_prop_cnt()
# has the following arguments:
#
# db_get_all_allow_matl_prop_cnt
# ( cid,
# atid,
# mc_id,
# cm_id,
# nbr )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_cid
Main Index
1382
Code Examples

INTEGER i_atid
INTEGER i_mc_id
INTEGER i_cm_id
INTEGER i_nbr
INTEGER iv_mp_id(VIRTUAL)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
# Analysis code id for MSC.Nastran is 1.
i_cid=1
# Analysis type id for Structural analysis is 1.
i_atid=1
# Using Material Category for Isotropic Material, which is 1.
i_mc_id=1
# For Linear Elastic Constitutive Model, id is 1.
i_cm_id=1
# Finding out number of allowable properties in the database. And
# allocating the space for the output array.
#
i_return_value = @
db_get_all_allow_matl_prop_cnt @
( i_cid, @
i_atid, @
i_mc_id, @
i_cm_id, @
i_nbr )
dump i_return_value
# The number of allowable material properties are
dump i_nbr
sys_allocate_array(iv_mp_id,1,i_nbr)
#---------------------------------------------------------------------
# Calling function to read the property ids.
#
i_return_value = @
db_get_all_allowable_matl_prop @
( i_cid, @
i_atid, @
i_mc_id, @
i_cm_id, @
iv_mp_id )
dump i_return_value
dump iv_mp_id
#---------------------------------------------------------------------
sys_free_array(iv_mp_id)
#---------------------------------------------------------------------

db_get_all_allowable_matl_prop ()

# Purpose : This file provides an example of a call to the


# function db_get_all_allowable_matl_prop()
#
# This session file will open a new database
# by name ‘new.db’ with default options and will
# display the ids for allowable material
# properties.
#
# For material property ids refer User’s Manual
# Part 9, Section 7.5 to 7.7
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
Main Index
CHAPTER 12 1383
Materials

# menus on the menu bar.


#
# The function db_get_all_allowable_matl_prop()
# has the following arguments:
#
# db_get_all_allowable_matl_prop
# ( cid,
# atid,
# mc_id,
# cm_id,
# mp_id )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_cid
INTEGER i_atid
INTEGER i_mc_id
INTEGER i_cm_id
INTEGER i_nbr
INTEGER iv_mp_id(VIRTUAL)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
# Analysis code id for MSC.Nastran is 1.
i_cid=1
# Analysis type id for Structural analysis is 1.
i_atid=1
# Using Material Category for Isotropic Material, which is 1.
i_mc_id=1
# For Linear Elastic Constitutive Model, id is 1.
i_cm_id=1
# Finding out number of allowable properties in the database. And
# allocating the space for the output array.
#
i_return_value = @
db_get_all_allow_matl_prop_cnt @
( i_cid, @
i_atid, @
i_mc_id, @
i_cm_id, @
i_nbr )
dump i_return_value
sys_allocate_array(iv_mp_id,1,i_nbr)
#---------------------------------------------------------------------
# Calling function to read the property ids.
#
i_return_value = @
db_get_all_allowable_matl_prop @
( i_cid, @
i_atid, @
i_mc_id, @
i_cm_id, @
iv_mp_id )
dump i_return_value
dump iv_mp_id
#---------------------------------------------------------------------
sys_free_array(iv_mp_id)
#---------------------------------------------------------------------

Main Index
1384
Code Examples

db_get_all_cond_opt_code_names ()

# Purpose : This file provides an example of a call to the


# function db_get_all_cond_opt_code_names()
#
# This session file will open a new database
# by name ‘new.db’ with default options and will
# display the available condense_options.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_all_cond_opt_code_names() has no arguments.
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
INTEGER i_id
INTEGER all_status
INTEGER next_status = 0
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
# Calling the ‘get_all’ function to read all the relation_names in
# the relation ‘condense_option’.
#
all_status = @
db_get_all_cond_opt_code_names()
dump all_status
#---------------------------------------------------------------------
# Calling ‘get_next’ function to read the relation_names one by one.
#
WHILE ( next_status == 0 )
next_status = @
db_get_next_cond_opt_code_names @
( s_name, @
i_id )
dump next_status
IF( next_status == 0 ) THEN
# The relation name and id are.
dump s_name,i_id
ENDIF
END WHILE
#---------------------------------------------------------------------

db_get_all_lam_opt_code_names ()

# Purpose : This file provides an example of a call to the


# function db_get_all_lam_opt_code_names()
#
# This session file will open a new database
# by name ‘new.db’ with default options and will
# display the available laminate_options.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
Main Index
CHAPTER 12 1385
Materials

# The function db_get_all_lam_opt_code_names() has no arguments.


#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
INTEGER i_id
INTEGER all_status
INTEGER next_status = 0
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
# Calling the ‘get_all’ function to read all the relation_names in
# the relation ‘laminate_option’.
#
all_status = @
db_get_all_lam_opt_code_names()
dump all_status
#---------------------------------------------------------------------
# Calling ‘get_next’ function to read the relation_names one by one.
#
WHILE ( next_status == 0 )
next_status = @
db_get_next_lam_opt_code_names @
( s_name, @
i_id )
dump next_status
IF (next_status == 0 )THEN
# The relation name and id are.
dump s_name,i_id
ENDIF
END WHILE
#---------------------------------------------------------------------

db_get_all_material_names ()

# Purpose : This file provides an example of a call to the


# function db_get_all_material_names()
#
# This file opens a new database “new.db” and
# creates two materials. Then gets all the
# material information in get all, get next
# method.
#
# 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_material_names() has no arguments.
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[64]
INTEGER i_id
INTEGER i_cat
INTEGER i_lin
INTEGER i_dir
INTEGER i_type
INTEGER i_return_value
INTEGER all_status
INTEGER next_status = 0
#---------------------------------------------------------------------
# Open a new data base “new.db”
Main Index
1386
Code Examples

uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Create a new material “Material_1”.
i_return_value = @
material.create @
( “Analysis code ID”, 1, “Analysis type ID”, 1, @
“Material_1”, 0, “Date: @
Time: “, “Isotropic”, 1, @
“Directionality”, 1, “Linearity”, 1, @
“Homogeneous”, 0, “Linear Elastic”, 1, @
“Model Options & IDs”, [““, ““, ““, ““, ““], @
[0, 0, 0, 0, 0], “Active Flag”, 1, “Create”, @
10, “External Flag”, FALSE, “Property IDs”, @
[“Elastic Modulus”,”Poisson Ratio”], [2, 5, 0], @
“Property Values”, [“3.6e6”, “.33”, ““] )
dump i_return_value
#
# Create one more material “Material_2”.
i_return_value = @
material.create @
( “Analysis code ID”, 1, “Analysis type ID”, 1, @
“Material_2”, 0, “Date: @
Time: “, “Isotropic”, 1, @
“Directionality”, 1, “Linearity”, 1, @
“Homogeneous”, 0, “Linear Elastic”, 1, @
“Model Options & IDs”, [““, ““, ““, ““, ““], @
[0, 0, 0, 0, 0], “Active Flag”, 1, “Create”, @
10, “External Flag”, FALSE, “Property IDs”, @
[“Elastic Modulus”,”Poisson Ratio”], [2, 5, 0], @
“Property Values”, [“3.6e6”, “.33”, ““] )
dump i_return_value
#
# Get all the all the material names from the database
all_status = db_get_all_material_names ( )
dump all_status
#
# Get all material information from the database
WHILE ( next_status == 0 )
next_status = @
db_get_next_material_name @
( s_name, @
i_id, @
i_cat, @
i_lin, @
i_dir, @
i_type )
dump next_status
IF ( next_status == 0 ) THEN
dump s_name
dump i_id
dump i_cat
dump i_lin
dump i_dir
dump i_type
END IF
END WHILE
#
#---------------------------------------------------------------------

Main Index
CHAPTER 12 1387
Materials

db_get_allowable_matl_prop ()

# Purpose : This file provides an example of a call to the


# function db_get_allowable_matl_prop()
#
# This session file will open a new database
# by name ‘new.db’ with default options and will
# display the ids for allowable material
# properties.
#
# For material property ids refer User’s Manual
# Part 9, Section 7.5 to 7.7
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_allowable_matl_prop()
# has the following arguments:
#
# db_get_allowable_matl_prop
# ( cid,
# atid,
# mc_id,
# cm_id,
# magics,
# mp_id )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_cid
INTEGER i_atid
INTEGER i_mc_id
INTEGER i_cm_id
INTEGER ia_magics(5)
INTEGER iv_mp_id(VIRTUAL)
INTEGER i_return_value
INTEGER i_nbr
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
# Analysis code id for MSC.Nastran is 1.
i_cid = 1
# Analysis type id for Structural analysis is 1.
i_atid = 1
# Using Material Category for Isotropic Material, which is 1.
i_mc_id = 1
# For Linear Elastic Constitutive Model, id is 1.
i_cm_id = 1
# Getting the associated entry from the ‘matl_magic’ table.
i_return_value = @
db_get_mtl_magics @
( i_cid, @
i_atid, @
i_mc_id, @
i_cm_id, @
ia_magics )
dump i_return_value

# Finding out number of allowable properties in the database. And


# allocating the space for the output array.
i_return_value = @
Main Index
1388
Code Examples

db_get_allowable_matl_prop_cnt @
( i_cid, @
i_atid, @
i_mc_id, @
i_cm_id, @
ia_magics, @
i_nbr )
dump i_return_value
sys_allocate_array(iv_mp_id,1,i_nbr)
#---------------------------------------------------------------------
# Calling function to read the property ids.
i_return_value = @
db_get_allowable_matl_prop @
( i_cid, @
i_atid, @
i_mc_id, @
i_cm_id, @
ia_magics, @
iv_mp_id )
dump i_return_value
# The ids are
dump iv_mp_id
#---------------------------------------------------------------------
sys_free_array(iv_mp_id)
#---------------------------------------------------------------------

db_get_allowable_matl_prop_cnt ()

# Purpose : This file provides an example of a call to the


# function db_get_allowable_matl_prop_cnt()
#
# This session file will open a new database
# by name ‘new.db’ with default options and will
# display the ids for allowable material
# properties.
#
# For material property ids refer User’s Manual
# Part 9, Section 7.5 to 7.7
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_allowable_matl_prop_cnt()
# has the following arguments:
#
# db_get_allowable_matl_prop_cnt
# ( cid,
# atid,
# mc_id,
# cm_id,
# magics,
# nbr )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_cid
INTEGER i_atid
INTEGER i_mc_id
INTEGER i_cm_id
INTEGER ia_magics(5)
INTEGER iv_mp_id(VIRTUAL)
INTEGER i_return_value
INTEGER i_nbr
Main Index
CHAPTER 12 1389
Materials

#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
# Analysis code id for MSC.Nastran is 1.
i_cid = 1
# Analysis type id for Structural analysis is 1.
i_atid = 1
# Using Material Category for Isotropic Material, which is 1.
i_mc_id = 1
# For Linear Elastic Constitutive Model, id is 1.
i_cm_id = 1
# Getting the associated entry from the ‘matl_magic’ table.
i_return_value = @
db_get_mtl_magics @
( i_cid, @
i_atid, @
i_mc_id, @
i_cm_id, @
ia_magics )
dump i_return_value

# Finding out number of allowable properties in the database. And


# allocating the space for the output array.
i_return_value = @
db_get_allowable_matl_prop_cnt @
( i_cid, @
i_atid, @
i_mc_id, @
i_cm_id, @
ia_magics, @
i_nbr )
dump i_return_value
# The number of allowable material property ids are
dump i_nbr
sys_allocate_array(iv_mp_id,1,i_nbr)
#---------------------------------------------------------------------
# Calling function to read the property ids.
i_return_value = @
db_get_allowable_matl_prop @
( i_cid, @
i_atid, @
i_mc_id, @
i_cm_id, @
ia_magics, @
iv_mp_id )
dump i_return_value
# The ids are
dump iv_mp_id
#---------------------------------------------------------------------
sys_free_array(iv_mp_id)
#---------------------------------------------------------------------

db_get_comp_hal ()

# Purpose : This file provides an example of two calls to


# the function db_get_comp_hal()
#
# This session file will open a new database
# by name ‘new.db’ with default options and will
# create four materials of type isotropic,
# 3d orthotropic, cont. fiber and disc. ribbon
# composite. The construction data for the two
# composite materials will be listed
Main Index
1390
Code Examples

#
# For material property ids refer User’s Manual
# Part 9, Section 7.5 to 7.7
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_comp_hal()
# has the following arguments:
#
# db_get_comp_hal
# ( mat_name,
# iopt,
# fiber_name,
# matrix_name,
# fiber_vol_frac,
# matrix_vol_frac,
# theory,
# override,
# aspect_ratios,
# emperical_factors )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_mat_name[32]
INTEGER i_iopt
STRING s_fiber_name[32]
STRING s_matrix_name[32]
REAL r_fiber_vol_frac
REAL r_matrix_vol_frac
INTEGER i_theory
LOGICAL l_override
REAL ra_aspect_ratios(2)
REAL ra_emperical_factors(9)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
# Creating isotropic material by name ‘matrix’.
i_return_value = @
material.create(“Analysis code ID”,1,”Analysis type ID”,1,”matrix”@
,0, “New Material” , “Isotropic”, 1, @
“Directionality”, 1, “Linearity”, 1, “Homogeneous”, 0, @
“Linear Elastic”, 1,”Model Options & IDs”,[““,””,””,””,””], @
[0,0,0,0,0],”Active Flag”,1,”Create”,10,”External Flag”,FALSE, @
“Property IDs”,[“Elastic Modulus”,”Poisson Ratio”], [2, 5, 0], @
“Property Values”, [“2e5”, “.3”, ““] )
dump i_return_value

# Creating 3d orthotropic material by name ‘fiber’.


i_return_value = @
material.create(“Analysis code ID”,1,”Analysis type ID”,1,”fiber”,@
0,”New Material”, “3d Orthotropic”, @
2, “Directionality”,2,”Linearity”,1,”Homogeneous”,0, @
“Linear Elastic”, 1,”Model Options & IDs”,[““,””,””,””,””], @
[0,0,0,0,0],”Active Flag” ,1,”Create”,10,”External Flag”,FALSE,@
“Property IDs”,[“Elastic Modulus”,”Elastic Modulus 22”, @
“Elastic Modulus 33”,”Poisson Ratio”,”Poisson Ratio 23”, @
“Poisson Ratio 31”,”Shear Modulus”,”Shear Modulus 23”, @
“Shear Modulus 31”],[2, 3, 4, 5, 6, 7, 8, 9, 10, 0], @
“Property Values”,[“2e5”,”2e5”,”2e5”, “.33”, “.3”, “.37”, “2e6”@
, “2e7”, “4e6”, ““] )
dump i_return_value
Main Index
CHAPTER 12 1391
Materials

# Creating continuous fiber composite material by name ‘cfc’.


i_return_value = @
mat_hal_create( “cfc”, ““, 1, 0.2, 0.80000001, 1, [““, ““], TRUE, @
[“1”, “2”, “3”, “4”, “5”, ““, ““], “fiber”, “matrix”, “Create” )
dump i_return_value

# Creating discontinuous ribbon composite material by name ‘drc’.


i_return_value = @
mat_hal_create(“drc”,””,4, 0.59899998, 0.40099999, 0,[“100”,”10”],@
FALSE,[““,””,””,””,””,””,””], “fiber”, “matrix”, “Create” )
dump i_return_value
#---------------------------------------------------------------------
# Retrieving data for continuous fiber composite named ‘cfc’.
s_mat_name=”cfc”
#
i_return_value = @
db_get_comp_hal @
( s_mat_name, @
i_iopt, @
s_fiber_name, @
s_matrix_name, @
r_fiber_vol_frac, @
r_matrix_vol_frac, @
i_theory, @
l_override, @
ra_aspect_ratios, @
ra_emperical_factors )
dump i_return_value

# The construction data for continuous fiber composite ‘cfc’ is


dump i_iopt,s_fiber_name,s_matrix_name,i_theory,r_matrix_vol_frac
dump r_fiber_vol_frac,l_override,ra_aspect_ratios,ra_emperical_factors
#---------------------------------------------------------------------
# Retrieving data for discontinuous ribbon composite named ‘drc’.
s_mat_name=”drc”
#
i_return_value = @
db_get_comp_hal @
( s_mat_name, @
i_iopt, @
s_fiber_name, @
s_matrix_name, @
r_fiber_vol_frac, @
r_matrix_vol_frac, @
i_theory, @
l_override, @
ra_aspect_ratios, @
ra_emperical_factors )
dump i_return_value

# The construction data for discontinuous ribbon composite ‘drc’ is


dump i_iopt,s_fiber_name,s_matrix_name,i_theory,r_matrix_vol_frac
dump r_fiber_vol_frac,l_override,ra_aspect_ratios,ra_emperical_factors
#---------------------------------------------------------------------

db_get_comp_sfc ()

# Purpose : This file provides an example of a call to the


# function db_get_comp_sfc()
#
# This session file will open a new database
# by name ‘new.db’ with default options and will
# create five materials of type isotropic,
# 3d orthotropic, disc. ribbon composite and
Main Index
1392
Code Examples

# short fiber composites of both types. The


# construction data for the two short fiber
# composite materials will be listed
#
# For material property ids refer User’s Manual
# Part 9, Section 7.5 to 7.7
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_comp_sfc()
# has the following arguments:
#
# db_get_comp_sfc
# ( mat_name,
# uni_mat_name,
# ndim,
# niter,
# theta_av,
# sig_theta,
# phi_av,
# sig_phi,
# rho )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_mat_name[32]
STRING s_uni_mat_name[32]
INTEGER i_ndim
INTEGER i_niter
REAL r_theta_av
REAL r_sig_theta
REAL r_phi_av
REAL r_sig_phi
REAL r_rho
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
# Creating isotropic material by name ‘matrix’.
i_return_value = @
material.create(“Analysis code ID”,1,”Analysis type ID”,1, @
“matrix”,0, “New Material “, “Isotropic”, 1, @
“Directionality”, 1, “Linearity”, 1, “Homogeneous”, 0, @
“Linear Elastic”, 1,”Model Options & IDs”,[““,””,””,””,””], @
[0,0,0,0,0],”Active Flag”,1,”Create”,10,”External Flag”,FALSE, @
“Property IDs”,[“Elastic Modulus”,”Poisson Ratio”], [2, 5, 0], @
“Property Values”, [“2e5”, “.3”, ““] )
dump i_return_value

# Creating 3d orthotropic material by name ‘fiber’.


i_return_value = @
material.create(“Analysis code ID”,1,”Analysis type ID”,1,”fiber”,@
0,”New Material”, “3d Orthotropic”, 2,”Directionality”,2, @
“Linearity”,1,”Homogeneous”,0,”Linear Elastic”, 1, @
“Model Options & IDs”,[““,””,””,””,””],[0,0,0,0,0], @
“Active Flag” ,1,”Create”,10,”External Flag”,FALSE, @
“Property IDs”, [“Elastic Modulus”,”Elastic Modulus 22”, @
“Elastic Modulus 33”, “Poisson Ratio”,”Poisson Ratio 23”, @
“Poisson Ratio 31”, “Shear Modulus”,”Shear Modulus 23”, @
“Shear Modulus 31”], [2, 3, 4, 5, 6, 7, 8, 9, 10, 0], @
“Property Values”, [“2e5”,”2e5”,”2e5”, “.33”, “.3”, “.37”, @
“2e6”, “2e7”, “4e6”, ““] )
Main Index
CHAPTER 12 1393
Materials

dump i_return_value

# Creating discontinuous ribbon composite material by name ‘drc’.


i_return_value = @
mat_hal_create(“drc”,””,4, 0.59899998, 0.40099999, 0,[“100”,”10”],@
FALSE,[““,””,””,””,””,””,””], “fiber”, “matrix”, “Create” )
dump i_return_value

# Creating one dimensional short fiber composite material.


i_return_value = @
mat_sfc_create( “sfc1d”, ““, 1, 0., 0., 10., 0., 0., 1000, “drc”, @
“Create” )
dump i_return_value

# Creating two dimensional short fiber composite material.


i_return_value = @
mat_sfc_create( “sfc2d”, ““, 2, 0., 45., 7., 16., 0.2, 1000, “drc”@
, “Create” )
dump i_return_value
#---------------------------------------------------------------------
# Retrieving data for one dimensional short fiber composite.
s_mat_name = “sfc1d”
#
i_return_value = @
db_get_comp_sfc @
( s_mat_name, @
s_uni_mat_name, @
i_ndim, @
i_niter, @
r_theta_av, @
r_sig_theta, @
r_phi_av, @
r_sig_phi, @
r_rho )
dump i_return_value
# The construction data for one dimensional short fiber composite is
dump s_uni_mat_name,i_ndim,i_niter,r_theta_av,r_sig_theta,r_phi_av
dump r_sig_phi,r_rho
#---------------------------------------------------------------------
# Retrieving data for two dimensional short fiber composite.
s_mat_name = “sfc2d”
#
i_return_value = @
db_get_comp_sfc @
( s_mat_name, @
s_uni_mat_name, @
i_ndim, @
i_niter, @
r_theta_av, @
r_sig_theta, @
r_phi_av, @
r_sig_phi, @
r_rho )
dump i_return_value
# The construction data for two dimensional short fiber composite is
dump s_uni_mat_name,i_ndim,i_niter,r_theta_av,r_sig_theta,r_phi_av
dump r_sig_phi,r_rho
#---------------------------------------------------------------------

Main Index
1394
Code Examples

db_get_constitutive_model ()

# Purpose : This file provides an example of a call to the


# function db_get_constitutive_model()
#
# This file opens a new database “new.db”, gets
# the constitutive model names and linearity
# codes for the given analysis code.
#
# For the material category IDs refer MSC.Patran
# User Manual, Part 9, Section 7.7 .
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_constitutive_model()
# has the following arguments:
#
# db_get_constitutive_model
# ( cid,
# cm_id,
# cm_name,
# linearity_code )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_cid
INTEGER i_cm_id
STRING s_cm_name[32]
INTEGER i_linearity_code
INTEGER i_return_value
INTEGER i_atid
INTEGER i_mc_id
INTEGER iv_cm_id(VIRTUAL)
INTEGER i_nbr
INTEGER i_count
STRING s_atname[16]
#---------------------------------------------------------------------
# Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Get the code id for “MSC.Nastran”
i_return_value = @
db_get_anal_code_id(“MSC.Nastran”,i_cid)
dump i_return_value
#
# Get the analysis type id for “Structural”
s_atname = “Structural”
i_return_value = @
db_get_anal_type_id @
( s_atname, @
i_atid )
dump i_return_value
#
# The material category ID for Isotropic is 1.
i_mc_id = 1
#
# Get the count of valid constitutive models.
i_return_value = @
db_get_valid_const_models_count @
( i_cid, @
i_atid, @
Main Index
CHAPTER 12 1395
Materials

i_mc_id, @
i_nbr )
dump i_return_value
dump i_nbr
#
SYS_ALLOCATE_ARRAY(iv_cm_id, 1, i_nbr)
#
# Get the IDs of the constitutive models.
i_return_value = @
db_get_valid_const_models @
( i_cid, @
i_atid, @
i_mc_id, @
iv_cm_id )
dump i_return_value
dump iv_cm_id
#
# Get the names and the linearity code for all the
# constitutive models
FOR (i_count = 1 to i_nbr )
i_cm_id = iv_cm_id (i_count)
i_return_value = @
db_get_constitutive_model @
( i_cid, @
i_cm_id, @
s_cm_name, @
i_linearity_code )
dump i_return_value
dump s_cm_name
dump i_linearity_code
END FOR
sys_free_array(iv_cm_id)
#---------------------------------------------------------------------

db_get_material_id_from_name ()

# Purpose : This file provides an example of a call to the


# function db_get_material_id_from_name()
#
# This file opens a new database “new.db” and
# and creates a new material “New_Material”
# and gets the ID from its name.
#
# For material category,linearity,directionality,
# and material type IDs refer MSC.Patran User
# Manual, Part 9, Section 7.6, 7.7, 9.14.
#
# 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_material_id_from_name()
# has the following arguments:
#
# db_get_material_id_from_name
# ( mat_name,
# id )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_mat_name[32]
INTEGER i_id
INTEGER i_id_c
INTEGER i_return_value
Main Index
1396
Code Examples

STRING s_description[216]
INTEGER i_cat
INTEGER i_lin
INTEGER i_dir
INTEGER i_type
#---------------------------------------------------------------------
# Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Create a new material
# Assign the name of the material.
s_mat_name = “New_Material”
# Assign the description.
s_description = “This material is created for an illustration”
# Assign the the category as “Isotropic”
i_cat = 1
# Linearity code is “Linear Elastic”.
i_lin = 1
# The directionality code is “Isotropic”
i_dir = 1
# The material type is “Homogeneous material”
i_type = 1
i_return_value = @
db_create_material @
( s_mat_name, @
s_description, @
i_cat, @
i_lin, @
i_dir, @
i_type, @
i_id_c )
dump i_return_value
dump i_id_c
#
# Get the ID of the newly created material.
i_return_value = @
db_get_material_id_from_name @
( s_mat_name, @
i_id )
dump i_return_value
dump i_id
#---------------------------------------------------------------------

db_get_material_name_from_id ()

# Purpose : This file provides an example of a call to the


# function db_get_material_name_from_id()
#
# This file opens a new database “new.db” and
# and creates a new material “New_Material”
# and gets the name from its ID.
#
# For material category,linearity,directionality,
# and material type IDs refer MSC.Patran User
# Manual, Part 9, Section 7.6, 7.7, 9.14.
#
# 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_material_name_from_id()
# has the following arguments:
#
Main Index
CHAPTER 12 1397
Materials

# db_get_material_name_from_id
# ( id,
# mat_name )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_id
STRING s_mat_name[32]
STRING s_mat_name_c[32]
INTEGER i_return_value
STRING s_description[216]
INTEGER i_cat
INTEGER i_lin
INTEGER i_dir
INTEGER i_type
#---------------------------------------------------------------------
# Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Create a new material
# Assign the name of the material.
s_mat_name_c = “New_Material”
# Assign the description.
s_description = “This material is created for an illustration”
# Assign the the category as “Isotropic”
i_cat = 1
# Linearity code is “Linear Elastic”.
i_lin = 1
# The directionality code is “Isotropic”
i_dir = 1
# The material type is “Homogeneous material”
i_type = 1
i_return_value = @
db_create_material @
( s_mat_name_c, @
s_description, @
i_cat, @
i_lin, @
i_dir, @
i_type, @
i_id )
dump i_return_value
dump i_id
# Get the name of the material from its ID.
i_return_value = @
db_get_material_name_from_id @
( i_id, @
s_mat_name )
dump i_return_value
dump s_mat_name

#---------------------------------------------------------------------

db_get_matl_category ()

# Purpose : This file provides an example of a call to the


# function db_get_matl_category()
#
# This file opens a new database “new.db” and
# gets the count, IDs and the names of the
# material category definition and the
# directionality code in the database.
#
# This file can be run by starting a session of
Main Index
1398
Code Examples

# MSC.Patran, and running this session file


# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_matl_category()
# has the following arguments:
#
# db_get_matl_category
# ( cid,
# mc_id,
# mc_name,
# directionality )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_cid
INTEGER i_mc_id
STRING s_mc_name[32]
INTEGER i_directionality
INTEGER i_return_value
INTEGER i_atid
INTEGER iv_mc_id(VIRTUAL)
INTEGER i_count
INTEGER i_nbr
STRING s_atname[32]
#---------------------------------------------------------------------
# Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Get the code id for “MSC.Nastran”
i_return_value = @
db_get_anal_code_id @
( “MSC.Nastran”, @
i_cid )
dump i_return_value
#
# Get the analysis type id for “Structural”
s_atname = “Structural”
i_return_value = @
db_get_anal_type_id @
( s_atname, @
i_atid )
dump i_return_value
#
# Get the count of material category.
i_return_value = @
db_get_valid_mtl_category_cnt @
( i_cid, @
i_atid, @
i_nbr )
dump i_return_value
dump i_nbr
#
SYS_ALLOCATE_ARRAY(iv_mc_id, 1, i_nbr)
#
# Get the valid material categories ID.
i_return_value = @
db_get_valid_mtl_categories @
( i_cid, @
i_atid, @
iv_mc_id )
dump i_return_value
dump iv_mc_id
#
# Get the category definition and the directionality code.
FOR (i_count = 1 to i_nbr)
Main Index
CHAPTER 12 1399
Materials

i_mc_id = iv_mc_id(i_count)
i_return_value = @
db_get_matl_category @
( i_cid, @
i_mc_id, @
s_mc_name, @
i_directionality )
dump i_return_value
dump s_mc_name
dump i_directionality
END FOR
sys_free_array(iv_mc_id)
#---------------------------------------------------------------------

db_get_matl_prop_alias ()

# Purpose : This file provides an example of a call to the


# function db_get_matl_prop_alias()
#
# This session file will open a new database
# by name ‘new.db’ with default options and will
# display the names of the allowable material
# properties.
#
# For material property ids refer User’s Manual
# Part 9, Section 7.5 to 7.7
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_matl_prop_alias()
# has the following arguments:
#
# db_get_matl_prop_alias
# ( cid,
# atid,
# mc_id,
# cm_id,
# mp_id,
# mp_alias,
# field_ok )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_cid
INTEGER i_atid
INTEGER i_mc_id
INTEGER i_cm_id
INTEGER i_mp_id
STRING s_mp_alias[32]
INTEGER i_field_ok
INTEGER i_return_value
INTEGER i_nbr
INTEGER iv_mp_id(VIRTUAL)
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
# Analysis code id for MSC.Nastran is 1.
i_cid=1
# Analysis type id for Structural analysis is 1.
i_atid=1
Main Index
1400
Code Examples

# Using Material Category for Isotropic Material, which is 1.


i_mc_id=1
# For Linear Elastic Constitutive Model, id is 1.
i_cm_id=1
# Finding out number of allowable properties in the database. And
# allocating the space for the output array.
#
i_return_value = @
db_get_all_allow_matl_prop_cnt @
( i_cid, @
i_atid, @
i_mc_id, @
i_cm_id, @
i_nbr )
dump i_return_value
sys_allocate_array(iv_mp_id,1,i_nbr)
#---------------------------------------------------------------------
# Calling function to read the property ids.
#
i_return_value = @
db_get_all_allowable_matl_prop @
( i_cid, @
i_atid, @
i_mc_id, @
i_cm_id, @
iv_mp_id )
dump i_return_value
dump iv_mp_id
#---------------------------------------------------------------------
# Finding out material property names for the first material property
# name id.
i_mp_id = iv_mp_id(1)
#
i_return_value = @
db_get_matl_prop_alias @
( i_cid, @
i_atid, @
i_mc_id, @
i_cm_id, @
i_mp_id, @
s_mp_alias, @
i_field_ok )
dump i_return_value
dump s_mp_alias,i_field_ok
#---------------------------------------------------------------------
sys_free_array(iv_mp_id)
#---------------------------------------------------------------------

db_get_matl_prop_defn ()

# Purpose : This file provides an example of a call to the


# function db_get_matl_prop_defn()
#
# This session file will open a new database
# by name ‘new.db’ with default options and will
# get all the material property ids for Linear
# Elastic Structural analysis on MSC.Nastran.
#
# For material property ids refer User’s Manual
# Part 9, Section 7.5 to 7.7
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
Main Index
CHAPTER 12 1401
Materials

#
# The function db_get_matl_prop_defn()
# has the following arguments:
#
# db_get_matl_prop_defn
# ( mp_id,
# mp_name )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_mp_id
STRING s_mp_name[32]
INTEGER i_return_value
INTEGER i_cid
INTEGER i_atid
INTEGER i_mc_id
INTEGER i_cm_id
INTEGER i_nbr
INTEGER iv_mp_id(VIRTUAL)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
# Analysis code id for MSC.Nastran is 1.
i_cid=1
# Analysis type id for Structural analysis is 1.
i_atid=1
# Using Material Category for Isotropic Material, which is 1.
i_mc_id=1
# For Linear Elastic Constitutive Model, id is 1.
i_cm_id=1
# Finding out number of allowable properties in the database. And
# allocating the space for the output array.
#
i_return_value = @
db_get_all_allow_matl_prop_cnt @
( i_cid, @
i_atid, @
i_mc_id, @
i_cm_id, @
i_nbr )
dump i_return_value
sys_allocate_array(iv_mp_id,1,i_nbr)
#---------------------------------------------------------------------
# Calling function to read the property ids.
#
i_return_value = @
db_get_all_allowable_matl_prop @
( i_cid, @
i_atid, @
i_mc_id, @
i_cm_id, @
iv_mp_id )
dump i_return_value
dump iv_mp_id
#---------------------------------------------------------------------
# Getting material property defination name for first property id.
i_mp_id = iv_mp_id(1)
#
i_return_value = @
db_get_matl_prop_defn @
( i_mp_id, @
s_mp_name )
dump i_return_value
dump s_mp_name
Main Index
1402
Code Examples

#---------------------------------------------------------------------
sys_free_array(iv_mp_id)
#---------------------------------------------------------------------

db_get_mtl_allowable_magic_cnt ()

# Purpose : This file provides an example of a call to the


# function db_get_mtl_allowable_magic_cnt()
#
# This file opens a new database “new.db”,and
# 1. Gets the count of magics for the magic
# category “Hardening Rule”.
# 2. Creates new allowable magics for
# the magic category “Hardening Rule”. and
# 3. Gets the latest count of the magics for
# the magic category “Hardening Rule”
#
# For material category IDs, magic category IDs,
# magic option IDs refer MSC.Patran User Manual,
# Part 9, Section 7.6 and 7.7 .
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_mtl_allowable_magic_cnt()
# has the following arguments:
#
# db_get_mtl_allowable_magic_cnt
# ( code_id,
# matl_cat_id,
# magic_category_id,
# nbr )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_code_id
INTEGER i_matl_cat_id
INTEGER i_magic_category_id
INTEGER i_nbr
INTEGER i_return_value
INTEGER ia_magic_alias_id(3)
#---------------------------------------------------------------------
# Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Get the code id for “MSC.Nastran”
i_return_value = @
db_get_anal_code_id(“MSC.Nastran”,i_code_id)
dump i_return_value
#
# The material category ID for “Isotropic” is 1.
i_matl_cat_id = 1
# The magic category id for “Hardening Rule” is 5.
i_magic_category_id = 5
#
# Get the count of the material allowable magics.
i_return_value = @
db_get_mtl_allowable_magic_cnt @
( i_code_id, @
i_matl_cat_id, @
i_magic_category_id, @
i_nbr )
Main Index
CHAPTER 12 1403
Materials

dump i_return_value
dump i_nbr
# Create three new valid magic options for the
# “Hardening Rule”
# The magics option ids for VonMises, Tresca and Mohr_coulomb
# yield functions are 10,11 and 12 respectively.
# hardening are 10,11 and 12 respectively.
ia_magic_alias_id = [10,11,12]
i_nbr = 3
i_return_value = @
db_create_mtl_allowable_magics @
( i_code_id, @
i_matl_cat_id, @
i_magic_category_id, @
ia_magic_alias_id, @
i_nbr )
dump i_return_value
#
# Get the new count of the material allowable magics.
i_return_value = @
db_get_mtl_allowable_magic_cnt @
( i_code_id, @
i_matl_cat_id, @
i_magic_category_id, @
i_nbr )
dump i_return_value
dump i_nbr
#---------------------------------------------------------------------

db_get_mtl_allowable_magics ()

# Purpose : This file provides an example of a call to the


# function db_get_mtl_allowable_magics()
#
# This file opens a new database “new.db” and
# gets the count and IDs of the magics options
# for the magics category “Hardening Rule”.
#
# For material category IDs, magic category IDs,
# magic option IDs refer MSC.Patran User Manual,
# Part 9, Section 7.6 and 7.7 .
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_mtl_allowable_magics()
# has the following arguments:
#
# db_get_mtl_allowable_magics
# ( code_id,
# matl_cat_id,
# magic_category_id,
# magic_alias_id )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_code_id
INTEGER i_matl_cat_id
INTEGER i_magic_category_id
INTEGER iv_magic_alias_id(VIRTUAL)
INTEGER i_return_value
INTEGER i_nbr
#---------------------------------------------------------------------
Main Index
1404
Code Examples

# Open a new data base “new.db”


uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Get the code id for “MSC.Nastran”
i_return_value = @
db_get_anal_code_id(“MSC.Nastran”,i_code_id)
dump i_return_value
#
# Get the count of the allowable magics options.
# The material category ID for “Isotropic” is 1.
i_matl_cat_id = 1
# The magic category id for “Hardening Rule” is 5.
i_magic_category_id = 5
i_return_value = @
db_get_mtl_allowable_magic_cnt @
( i_code_id, @
i_matl_cat_id, @
i_magic_category_id, @
i_nbr )
dump i_return_value
dump i_nbr
#
SYS_ALLOCATE_ARRAY (iv_magic_alias_id, 1, i_nbr )
#
# Get the IDs of the allowable magics options.
i_return_value = @
db_get_mtl_allowable_magics @
( i_code_id, @
i_matl_cat_id, @
i_magic_category_id, @
iv_magic_alias_id )
dump i_return_value
dump iv_magic_alias_id
#
sys_free_array(iv_magic_alias_id)
#---------------------------------------------------------------------

db_get_mtl_magics ()

# Purpose : This file provides an example of a call to the


# function db_get_mtl_magics()
#
# This file opens a new database “new.db”, and
# gets the count and the IDs of the magic
# categories for the given set of input values.
#
# For material category IDs, constitutive model
# IDs refer MSC.Patran User Manual, Part 9,
# Section 7.6 and 7.7 .
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_mtl_magics()
# has the following arguments:
#
# db_get_mtl_magics
# ( analysis_code_id,
# analysis_type_id,
# matl_category_id,
# constit_model_id,
# magic_category_id )
Main Index
CHAPTER 12 1405
Materials

#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_analysis_code_id
INTEGER i_analysis_type_id
INTEGER i_matl_category_id
INTEGER i_constit_model_id
INTEGER iv_magic_category_id(VIRTUAL)
INTEGER i_return_value
STRING s_atname[32]
INTEGER i_nbr
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Get the code id for “MSC.Nastran”
i_return_value = @
db_get_anal_code_id(“MSC.Nastran”,i_analysis_code_id)
dump i_return_value
#
# Get the analysis type id for “Structural”
s_atname = “Structural”
i_return_value = @
db_get_anal_type_id @
( s_atname, @
i_analysis_type_id )
dump i_return_value
#
# Get the count of the magic categories
# The material category ID for ‘Isotropic’ is 1.
i_matl_category_id = 1
# The constitutive model ID for ‘Elastoplastic’ is 3.
i_constit_model_id = 3
i_return_value = @
db_get_mtl_magics_count @
( i_analysis_code_id, @
i_analysis_type_id, @
i_matl_category_id, @
i_constit_model_id, @
i_nbr )
dump i_return_value
dump i_nbr
#---------------------------------------------------------------------
SYS_ALLOCATE_ARRAY(iv_magic_category_id, 1, i_nbr)
#
# Get the magic category IDs.
i_return_value = @
db_get_mtl_magics @
( i_analysis_code_id, @
i_analysis_type_id, @
i_matl_category_id, @
i_constit_model_id, @
iv_magic_category_id )
dump i_return_value
dump iv_magic_category_id
sys_free_array(iv_magic_category_id)
#---------------------------------------------------------------------

Main Index
1406
Code Examples

db_get_mtl_magics_count ()

# Purpose : This file provides an example of a call to the


# function db_get_mtl_magics_count()
#
# This file opens a new database “new.db” and
# gets the count of magic categories for the
# given set of input values.
#
# For material category IDs, constitutive model
# IDs,refer MSC.Patran User Manual, Part 9,
# Section 7.6 and 7.7 .
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_mtl_magics_count()
# has the following arguments:
#
# db_get_mtl_magics_count
# ( analysis_code_id,
# analysis_type_id,
# matl_category_id,
# constit_model_id,
# nbr )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_analysis_code_id
INTEGER i_analysis_type_id
INTEGER i_matl_category_id
INTEGER i_constit_model_id
INTEGER i_nbr
INTEGER i_return_value
STRING s_atname[32]
#---------------------------------------------------------------------
# Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Get the code id for “MSC.Nastran”
i_return_value = @
db_get_anal_code_id(“MSC.Nastran”,i_analysis_code_id)
dump i_return_value
#
# Get the analysis type id for “Structural”
s_atname = “Structural”
i_return_value = @
db_get_anal_type_id @
( s_atname, @
i_analysis_type_id )
dump i_return_value
# Get the count of the magic categories.
# The material category ID for ‘Isotropic’ is 1.
i_matl_category_id = 1
# The constitutive model ID for ‘Elastoplastic’ is 3.
i_constit_model_id = 3
i_return_value = @
db_get_mtl_magics_count @
( i_analysis_code_id, @
i_analysis_type_id, @
i_matl_category_id, @
i_constit_model_id, @
Main Index
CHAPTER 12 1407
Materials

i_nbr )
dump i_return_value
dump i_nbr
#---------------------------------------------------------------------

db_get_mtl_magics_defn ()

# Purpose : This file provides an example of a call to the


# function db_get_mtl_magics_defn()
#
# This file opens a new database “new.db” and
# gets the count, IDs and the labels of the
# magic categories.
#
# For material category IDs, magic category IDs,
# magic option IDs and the constitutive model
# IDs refer MSC.Patran User Manual, Part 9,
# Section 7.6 and 7.7 .
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_mtl_magics_defn()
# has the following arguments:
#
# db_get_mtl_magics_defn
# ( analysis_code_id,
# analysis_type_id,
# magic_category_id,
# magic_label )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_analysis_code_id
INTEGER i_analysis_type_id
INTEGER i_magic_category_id
INTEGER i_matl_category_id
STRING s_magic_label[64]
INTEGER i_return_value
INTEGER i_constit_model_id
INTEGER iv_magic_category_id(VIRTUAL)
INTEGER i_count
STRING s_atname[32]
INTEGER i_nbr
#---------------------------------------------------------------------
# Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Get the code id for “MSC.Nastran”
i_return_value = @
db_get_anal_code_id(“MSC.Nastran”,i_analysis_code_id)
dump i_return_value
#
# Get the analysis type id for “Structural”
s_atname = “Structural”
i_return_value = @
db_get_anal_type_id @
( s_atname, @
i_analysis_type_id )
dump i_return_value
#
# The material category ID for ‘Isotropic’ is 1.
Main Index
1408
Code Examples

i_matl_category_id = 1
# The constitutive model ID for ‘Elastoplastic’ is 3.
i_constit_model_id = 3
# Get the count of the magic categories.
i_return_value = @
db_get_mtl_magics_count @
( i_analysis_code_id, @
i_analysis_type_id, @
i_matl_category_id, @
i_constit_model_id, @
i_nbr )
dump i_return_value
dump i_nbr
#
SYS_ALLOCATE_ARRAY(iv_magic_category_id, 1, i_nbr)
#
# Get the IDs of the magic categories.
i_return_value = @
db_get_mtl_magics @
( i_analysis_code_id, @
i_analysis_type_id, @
i_matl_category_id, @
i_constit_model_id, @
iv_magic_category_id )
dump i_return_value
dump iv_magic_category_id
#
# Get the magic label for all the magic categories.
FOR (i_count = 1 to i_nbr)
i_magic_category_id = iv_magic_category_id(i_count)
i_return_value = @
db_get_mtl_magics_defn @
( i_analysis_code_id, @
i_analysis_type_id, @
i_magic_category_id, @
s_magic_label )
dump i_return_value
dump s_magic_label
END FOR
sys_free_array(iv_magic_category_id)
#---------------------------------------------------------------------

db_get_mtl_magics_options ()

# Purpose : This file provides an example of a call to the


# function db_get_mtl_magics_options()
#
# This file opens a new database “new.db” and
# Gets the count, IDs and the names of magic
# options for the magic category
# “Hardening Rule”.
#
# For material category IDs, magic category IDs,
# magic option IDs and the constitutive model
# IDs refer MSC.Patran User Manual, Part 9,
# Section 7.6 and 7.7 .
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_mtl_magics_options()
# has the following arguments:
#
Main Index
CHAPTER 12 1409
Materials

# db_get_mtl_magics_options
# ( analysis_code_id,
# magic_alias_id,
# magic_name )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_analysis_code_id
INTEGER i_magic_alias_id
STRING s_magic_name[64]
INTEGER i_return_value
INTEGER i_matl_cat_id
INTEGER i_magic_category_id
INTEGER iv_magic_alias_id(VIRTUAL)
INTEGER i_nbr
INTEGER i_count
#---------------------------------------------------------------------
# Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Get the code id for “MSC.Nastran”
i_return_value = @
db_get_anal_code_id(“MSC.Nastran”,i_analysis_code_id)
dump i_return_value
#
# The material category ID for “Isotropic” is 1.
i_matl_cat_id = 1
# The magic category id for “Hardening Rule” is 5.
i_magic_category_id = 5
#
# Get the count of the magic options.
i_return_value = @
db_get_mtl_allowable_magic_cnt @
( i_analysis_code_id, @
i_matl_cat_id, @
i_magic_category_id, @
i_nbr )
dump i_return_value
dump i_nbr
#
SYS_ALLOCATE_ARRAY (iv_magic_alias_id, 1, i_nbr )
#
# Get the IDs of the magic options.
i_return_value = @
db_get_mtl_allowable_magics @
( i_analysis_code_id, @
i_matl_cat_id, @
i_magic_category_id, @
iv_magic_alias_id )
dump i_return_value
dump iv_magic_alias_id
#
# Get the names of all the magic options.
FOR ( i_count = 1 to i_nbr )
i_magic_alias_id = iv_magic_alias_id(i_count)
i_return_value = @
db_get_mtl_magics_options @
( i_analysis_code_id, @
i_magic_alias_id, @
s_magic_name )
dump i_return_value
dump s_magic_name
END FOR
sys_free_array(iv_magic_alias_id)
#---------------------------------------------------------------------
Main Index
1410
Code Examples

db_get_next_cond_opt_code_names ()

# Purpose : This file provides an example of a call to the


# function db_get_next_cond_opt_code_names()
#
# This session file will open a new database
# by name ‘new.db’ with default options and will
# display the available condense_options.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_next_cond_opt_code_names()
# has following arguments
# db_get_next_cond_opt_code_names
# ( name,
# id )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
INTEGER i_id
INTEGER all_status
INTEGER next_status = 0
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
# Calling the ‘get_all’ function to read all the relation_names in
# the relation ‘condense_option’.
#
all_status = @
db_get_all_cond_opt_code_names()
dump all_status
#---------------------------------------------------------------------
# Calling ‘get_next’ function to read the relation_names one by one.
#
WHILE ( next_status == 0 )
next_status = @
db_get_next_cond_opt_code_names @
( s_name, @
i_id )
dump next_status
IF( next_status == 0 ) THEN
# The relation name and id are.
dump s_name,i_id
ENDIF
END WHILE
#---------------------------------------------------------------------

db_get_next_lam_opt_code_names ()

# Purpose : This file provides an example of a call to the


# function db_get_next_lam_opt_code_names()
#
# This session file will open a new database
# by name ‘new.db’ with default options and will
# display the available laminate_options.
#
# This file can be run by starting a session of
Main Index
CHAPTER 12 1411
Materials

# MSC.Patran, and running this session file


# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_next_lam_opt_code_names()
# has the following arguments:
#
# db_get_next_lam_opt_code_names
# ( name,
# id )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
INTEGER i_id
INTEGER all_status
INTEGER next_status = 0
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
# Calling the ‘get_all’ function to read all the relation_names in
# the relation ‘laminate_option’.
#
all_status = @
db_get_all_lam_opt_code_names()
dump all_status
#---------------------------------------------------------------------
# Calling ‘get_next’ function to read the relation_names one by one.
#
WHILE ( next_status == 0 )
next_status = @
db_get_next_lam_opt_code_names @
( s_name, @
i_id )
dump next_status
IF (next_status == 0 )THEN
# The relation name and id are.
dump s_name,i_id
ENDIF
END WHILE
#---------------------------------------------------------------------

db_get_next_material_name ()

# Purpose : This file provides an example of a call to the


# function db_get_next_material_name()
#
# This file opens a new database “new.db” and
# creates two materials. Then gets all the
# material information in get all, get next
# method.
#
# 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_material_name() has the following
# arguments.
# db_get_next_material_name
# ( name,
# id,
Main Index
1412
Code Examples

# cat,
# lin,
# dir,
# type )
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[64]
INTEGER i_id
INTEGER i_cat
INTEGER i_lin
INTEGER i_dir
INTEGER i_type
INTEGER i_return_value
INTEGER all_status
INTEGER next_status = 0
#---------------------------------------------------------------------
# Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Create a new material “Material_1”.
i_return_value = @
material.create @
( “Analysis code ID”, 1, “Analysis type ID”, 1, @
“Material_1”, 0, “Date: @
Time: “, “Isotropic”, 1, @
“Directionality”, 1, “Linearity”, 1, @
“Homogeneous”, 0, “Linear Elastic”, 1, @
“Model Options & IDs”, [““, ““, ““, ““, ““], @
[0, 0, 0, 0, 0], “Active Flag”, 1, “Create”, @
10, “External Flag”, FALSE, “Property IDs”, @
[“Elastic Modulus”,”Poisson Ratio”], [2, 5, 0], @
“Property Values”, [“3.6e6”, “.33”, ““] )
dump i_return_value
#
# Create one more material “Material_2”.
i_return_value = @
material.create @
( “Analysis code ID”, 1, “Analysis type ID”, 1, @
“Material_2”, 0, “Date: @
Time: “, “Isotropic”, 1, @
“Directionality”, 1, “Linearity”, 1, @
“Homogeneous”, 0, “Linear Elastic”, 1, @
“Model Options & IDs”, [““, ““, ““, ““, ““], @
[0, 0, 0, 0, 0], “Active Flag”, 1, “Create”, @
10, “External Flag”, FALSE, “Property IDs”, @
[“Elastic Modulus”,”Poisson Ratio”], [2, 5, 0], @
“Property Values”, [“3.6e6”, “.33”, ““] )
dump i_return_value
#
# Get all the all the material names from the database
all_status = db_get_all_material_names ( )
dump all_status
#
# Get all material information from the database
WHILE ( next_status == 0 )
next_status = @
db_get_next_material_name @
( s_name, @
i_id, @
i_cat, @
i_lin, @
i_dir, @
i_type )
dump next_status
IF ( next_status == 0 ) THEN
dump s_name
Main Index
CHAPTER 12 1413
Materials

dump i_id
dump i_cat
dump i_lin
dump i_dir
dump i_type
END IF
END WHILE
#
#---------------------------------------------------------------------

db_get_valid_const_models ()

# Purpose : This file provides an example of a call to the


# function db_get_valid_const_models()
#
# This file opens a new database “new.db” and
# gets the number of valid constitutive models
# and their IDs.
#
# For material category IDs refer MSC.Patran User
# Manual, Part 7, Section 7.7 .
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_valid_const_models()
# has the following arguments:
#
# db_get_valid_const_models
# ( cid,
# atid,
# mc_id,
# cm_id )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_cid
INTEGER i_atid
INTEGER i_mc_id
INTEGER iv_cm_id(VIRTUAL)
INTEGER i_return_value
INTEGER i_nbr
STRING s_atname[16]
#---------------------------------------------------------------------
# Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Get the code id for “MSC.Nastran”
i_return_value = @
db_get_anal_code_id(“MSC.Nastran”,i_cid)
dump i_return_value
#
# Get the analysis type id for “Structural”
s_atname = “Structural”
i_return_value = @
db_get_anal_type_id @
( s_atname, @
i_atid )
dump i_return_value
#
# The material category ID for Isotropic is 1.
i_mc_id = 1
Main Index
1414
Code Examples

# Get the count of valid constitutive models.


i_return_value = @
db_get_valid_const_models_count @
( i_cid, @
i_atid, @
i_mc_id, @
i_nbr )
dump i_return_value
dump i_nbr
#
SYS_ALLOCATE_ARRAY(iv_cm_id, 1, i_nbr)
#
# Get the IDs of the constitutive models.
i_return_value = @
db_get_valid_const_models @
( i_cid, @
i_atid, @
i_mc_id, @
iv_cm_id )
dump i_return_value
dump iv_cm_id
sys_free_array(iv_cm_id)
#---------------------------------------------------------------------

db_get_valid_const_models_count ()

# Purpose : This file provides an example of a call to the


# function db_get_valid_const_models_count()
#
# This file opens a new database “new.db” and
# gets the number of constitutive models.
#
# For material category IDs refer MSC.Patran User
# Manual, Part 9, Section 7.6 .
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_valid_const_models_count()
# has the following arguments:
#
# db_get_valid_const_models_count
# ( cid,
# atid,
# mc_id,
# nbr )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_cid
INTEGER i_atid
INTEGER i_mc_id
INTEGER i_nbr
INTEGER i_return_value
STRING s_atname[16]
#---------------------------------------------------------------------
# Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Get the code id for “MSC.Nastran”
i_return_value = @
db_get_anal_code_id(“MSC.Nastran”,i_cid)
Main Index
CHAPTER 12 1415
Materials

dump i_return_value
#
# Get the analysis type id for “Structural”
s_atname = “Structural”
i_return_value = @
db_get_anal_type_id @
( s_atname, @
i_atid )
dump i_return_value
#
# The material category ID for Isotropic is 1.
i_mc_id = 1
#
# Get the number of valid constitutive models.
i_return_value = @
db_get_valid_const_models_count @
( i_cid, @
i_atid, @
i_mc_id, @
i_nbr )
dump i_return_value
dump i_nbr

#---------------------------------------------------------------------

db_get_valid_mtl_categories ()

# Purpose : This file provides an example of a call to the


# function db_get_valid_mtl_categories()
#
# This file opens a new database “new.db”, gets
# the count and the ID of the valid material
# categories for the given analysis code
# and type.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_valid_mtl_categories()
# has the following arguments:
#
# db_get_valid_mtl_categories
# ( cid,
# atid,
# mc_id )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_cid
INTEGER i_atid
INTEGER iv_mc_id(VIRTUAL)
INTEGER i_return_value
INTEGER i_nbr
STRING s_atname[32]
#---------------------------------------------------------------------
# Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Get the code id for “MSC.Nastran”
i_return_value = @
db_get_anal_code_id @
( “MSC.Nastran”, @
Main Index
1416
Code Examples

i_cid )
dump i_return_value
#
# Get the analysis type id for “Structural”
s_atname = “Structural”
i_return_value = @
db_get_anal_type_id @
( s_atname, @
i_atid )
dump i_return_value
#
# Get the count of the material category.
i_return_value = @
db_get_valid_mtl_category_cnt @
( i_cid, @
i_atid, @
i_nbr )
dump i_return_value
#
SYS_ALLOCATE_ARRAY(iv_mc_id, 1, i_nbr)
#
# Get the ID of the material categories.
i_return_value = @
db_get_valid_mtl_categories @
( i_cid, @
i_atid, @
iv_mc_id )
dump i_return_value
dump iv_mc_id
#
sys_free_array(iv_mc_id)
#---------------------------------------------------------------------

db_get_valid_mtl_category_cnt ()

# Purpose : This file provides an example of a call to the


# function db_get_valid_mtl_category_cnt()
#
# This file opens a new database “new.db” and
# gets the number of valid material categories
# for the analysis code “MSC.Nastran” having
# “Structural” as the analysis type.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_valid_mtl_category_cnt()
# has the following arguments:
#
# db_get_valid_mtl_category_cnt
# ( cid,
# atid,
# nbr )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_cid
INTEGER i_atid
INTEGER i_nbr
INTEGER i_return_value
STRING s_atname[32]
#---------------------------------------------------------------------
# Open a new data base “new.db”
Main Index
CHAPTER 12 1417
Materials

uil_file_new.go(““,”new.db”)
$? YES 36000002

# Get the code id for “MSC.Nastran”


i_return_value = @
db_get_anal_code_id @
( “MSC.Nastran”, @
i_cid )
dump i_return_value
#
# Get the analysis type id for “Structural”
s_atname = “Structural”
i_return_value = @
db_get_anal_type_id @
( s_atname, @
i_atid )
dump i_return_value
#
# Get the material category count.
i_return_value = @
db_get_valid_mtl_category_cnt @
( i_cid, @
i_atid, @
i_nbr )
dump i_return_value
dump i_nbr
#---------------------------------------------------------------------

db_mo_const_models_specified ()

# Purpose : This file provides an example of a call to the


# function db_mo_const_models_specified()
#
# 1. This file opens a new database “new.db”
# 2. Creates a new material
# 3. Gets the ID of the newly created material
# 4. Gets the magic numbers ID and active flag
# 5. Changes the magic numbers ID and flag
# and
# 6. Gets the new magic numbers ID and flag
#
# The constitutive model IDs, magic number IDs
# and active flag values are available in
# MSC.Patran User Manual, Part 9, Section 7.7
# & 9.14
#
# 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_mo_const_models_specified()
# has the following arguments:
#
# db_mo_const_models_specified
# ( mid,
# cm_id,
# magics,
# active )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_mid
INTEGER i_cm_id
INTEGER ia_magics(5)
Main Index
1418
Code Examples

INTEGER i_active
INTEGER i_return_value
STRING s_mat_name[32]
#---------------------------------------------------------------------
# Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Create a new material “New_Material” with “Linear Elastic”
# constitutive model.
i_return_value = @
material.create @
( “Analysis code ID”, 1, “Analysis type ID”, 1, @
“New_Material”, 0, “Date: 20-Aug-97 @
Time: 17:47:10”, “Isotropic”, 1, @
“Directionality”, 1, “Linearity”, 1, @
“Homogeneous”, 0, “Linear Elastic”, 1, @
“Model Options & IDs”, [““, ““, ““, ““, ““], @
[0, 0, 0, 0, 0], “Active Flag”, 1, “Create”, @
10, “External Flag”, FALSE, “Property IDs”, @
[“Elastic Modulus”,”Poisson Ratio”], [2, 5, 0], @
“Property Values”, [“3.6e6”, “.33”, ““] )
dump i_return_value
#
# Get the ID of the newly created material.
s_mat_name = “New_Material”
i_return_value = @
db_get_material_id_from_name @
( s_mat_name, @
i_mid )
dump i_return_value
dump i_mid
#
# Get the magics IDs and the active flag of the newly
# created material.
# The constitutive model code ID for “Linear Elastic” is 1.
i_cm_id = 1
i_return_value = @
db_get_active_flag @
( i_mid, @
i_cm_id, @
ia_magics, @
i_active )
dump i_return_value
dump ia_magics
dump i_active
#
# Modify the constitutive model magic numbers ID and
# the active flag.
ia_magics = [11,12,13,0,0]
IF (i_active == 1) THEN
i_active = 0
ELSE
i_active = 1
END IF
i_return_value = @
db_mo_const_models_specified @
( i_mid, @
i_cm_id, @
ia_magics, @
i_active )
dump i_return_value

# Get the magics IDs and the active flag of the modified
# constitutive model.
i_return_value = @
db_get_active_flag @
Main Index
CHAPTER 12 1419
Materials

( i_mid, @
i_cm_id, @
ia_magics, @
i_active )
dump i_return_value
dump ia_magics
dump i_active
#---------------------------------------------------------------------

db_modify_material ()

# Purpose : This file provides an example of a call to the


# function db_modify_material()
#
# This file opens a new database “new.db” and
# creates a new material “New_Material” with
# specific set of input values. It then
# modifies the input values and shows the
# modified values of the material.
#
# For material category,linearity,directionality,
# and material type IDs refer MSC.Patran User
# Manual, Part 9, Section 7.6, 7.7, 9.14.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_modify_material()
# has the following arguments:
#
# db_modify_material
# ( mid,
# desc,
# mc_id,
# lin,
# dir,
# mat_type )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_mid
STRING s_desc[128]
INTEGER i_mc_id
INTEGER i_lin
INTEGER i_dir
INTEGER i_mat_type
STRING s_desc_c[128]
INTEGER i_mc_id_c
INTEGER i_lin_c
INTEGER i_dir_c
INTEGER i_mat_type_c
INTEGER i_return_value
STRING s_mat_name[32]
INTEGER i_data_exists
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Create a new material
# The name of the material is “New_Material”
s_mat_name = “New_Material”
# Give the description to the material
Main Index
1420
Code Examples

s_desc = “This material is created for an illustration”


# The material category ID for “Isotropic” is 1.
i_mc_id = 1
# The linearity code ID for “Linear Elastic” is 1.
i_lin = 1
# The directionality code for “Isotropic” is 1.
i_dir = 1
# The material type ID for homogeneous material is 0
i_mat_type = 0
#
i_return_value = @
db_create_material @
( s_mat_name, @
s_desc, @
i_mc_id, @
i_lin, @
i_dir, @
i_mat_type, @
i_mid )
dump i_return_value
#
# Modify the description, category ID, linearity code ID
# directionality code ID and the material type.
#
# Give the new description
s_desc = “This is the modified Material”
# The modified category is “3D Orthotropic”
i_mc_id = 2
# The modified linearity code is “Nonlinear Elastic”
i_lin = 2
# The modified material directionality code is “Orthotropic”
i_dir = 2
# The new material type is “Standard laminate lay-up”.
i_mat_type =1
i_return_value = @
db_modify_material @
( i_mid, @
s_desc, @
i_mc_id, @
i_lin, @
i_dir, @
i_mat_type )
dump i_return_value
#
# Get the modified values of the material
i_return_value = @
db_get_material @
( i_mid, @
s_mat_name, @
i_mc_id_c, @
i_lin_c, @
i_dir_c, @
s_desc_c, @
i_mat_type_c, @
i_data_exists )
dump i_return_value
dump s_desc_c
dump i_mc_id_c
dump i_lin_c
dump i_dir_c
dump i_mat_type_c

#---------------------------------------------------------------------

Main Index
CHAPTER 12 1421
Materials

db_modify_matl_prop_value ()

# Purpose : This file provides an example of a call to the


# function db_modify_matl_prop_value()
#
# This session file will open a new database
# by name ‘new.db’ with default options and will
# add one defination of isotropic material and
# field. The values for Elastic Modulus and
# Poisson Ratio will be modified and Reference
# Temperature added.
# Before modification session file is paused for
# user to see the created material. Similarly
# after modification user will have to see the
# change in MATERIAL SHOW form.
#
# For material property ids refer User’s Manual
# Part 9, Section 7.6 and 7.7
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_modify_matl_prop_value()
# has the following arguments:
#
# db_modify_matl_prop_value
# ( mid,
# mp_id,
# fid,
# real,
# nbr )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_mid
INTEGER ia_mp_id(4)
INTEGER ia_fid(4)
REAL ra_real(4)
INTEGER i_nbr
INTEGER i_return_value
INTEGER i_id_field
STRING s_name[64]
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
# Creating field for material with Temperature as single independent
# variable. Name of the field is “Session_example_field”.
s_name = “Session_example_field”
i_return_value = @
fields_create( s_name, “Material”, 1, “Scalar”, @
“Real”, ““,””, “Table”, 1, “T”, ““, ““, ““, ““, ““, FALSE, @
[10., 20., 30., 40., 50.], [0.], [0.], @
[[[2E+11]][[1.7499999E+11]] [[1.4999999E+11]][[1.25E+11]] @
[[9.9999998E+10]]] )
dump i_return_value

# Getting the id for the created field.


i_return_value = db_get_field_id(s_name,i_id_field)
dump i_return_value

# Creating material for Structural analysis on MSC.Nastran based on


Main Index
1422
Code Examples

# linear elastic theory. Material name is “Session_example_material”


s_name = “Session_example_material”
i_return_value = @
material.create( “Analysis code ID”, 1, “Analysis type ID”, 1, @
s_name, 0, “New material”, “Isotropic”, 1, “Directionality”, 1,@
“Linearity”,1,”Homogeneous”, 0,”Linear Elastic”, 1, @
“Model Options & IDs”,[““, ““, ““, ““, ““], [0, 0, 0, 0, 0], @
“Active Flag”, 1, “Create”, 10, “External Flag”, FALSE, @
“Property IDs”, [ “Elastic Modulus”, “Poisson Ratio”], @
[2, 5, 0], “Property Values”,[“2e12”, “.35”, ““] )
dump i_return_value

# Getting the id for the created material.


i_return_value = db_get_material_id_from_name(s_name,i_mid)
dump i_return_value
#---------------------------------------------------------------------
# Session file paused. Press “Resume” to continue..
# Session file execution is paused to see the material created.
# Open MATERIAL SHOW form, select the only material and press
# ‘Show Properties’ button.
sf_pause()
#---------------------------------------------------------------------
# Number of properties which need to be supplied are
i_nbr = 4
# The property id array is
ia_mp_id(1) = 1
ia_mp_id(2) = 2
ia_mp_id(3) = 5
ia_mp_id(4) = 8

# The created field will be used for modifing the Elastic Modulus.
# Which has property id as 2.
ia_fid(2) = i_id_field

# Reference Temperature (property id 1) and Poisson Ratio(property


# id 5) will be modified.
ra_real(1) = 40
ra_real(3) = .4
#---------------------------------------------------------------------
# Modifying the property values.
#
i_return_value = @
db_modify_matl_prop_value @
( i_mid, @
ia_mp_id, @
ia_fid, @
ra_real, @
i_nbr )
dump i_return_value

#---------------------------------------------------------------------
# The result of modification can be seen through MATERIAL SHOW option
# on the main menu.
#---------------------------------------------------------------------

engin_cons_to_elastic_matrix ()

# Purpose : This file provides an example of a call to the


# function engin_cons_to_elastic_matrix()
#
# 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.
#
Main Index
CHAPTER 12 1423
Materials

# The function engin_cons_to_elastic_matrix()


# has the following arguments:
#
# engin_cons_to_elastic_matrix
# ( e,
# c,
# status )
#
#---------------------------------------------------------------------
# Variable Declarations
REAL ra_e(9)
REAL ra_c(21)
INTEGER i_status
#---------------------------------------------------------------------
# Assigning material properties for a 3d orthotropic material.
ra_e(1)=2e5
ra_e(2)=4e5
ra_e(3)=3e4
ra_e(4)=.3
ra_e(5)=.33
ra_e(6)=.36
ra_e(7)=2e11
ra_e(8)=3e12
ra_e(9)=4e9
#
# Converting the engineering constants into 21 stress-strain
# coefficients.
engin_cons_to_elastic_matrix @
( ra_e, @
ra_c, @
i_status )
dump i_status
dump ra_c
#---------------------------------------------------------------------

get_qab_from_engin_cons ()

# Purpose : This file provides an example of a call to the


# function get_qab_from_engin_cons()
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function get_qab_from_engin_cons()
# has the following arguments:
#
# get_qab_from_engin_cons
# ( e,
# qab,
# ier )
#
#---------------------------------------------------------------------
# Variable Declarations
REAL ra_e(8)
REAL ra_qab(3,3)
INTEGER i_ier
#---------------------------------------------------------------------
# Assigning values to the engineering constants.
ra_e(1)=2e6
ra_e(2)=3e4
ra_e(4)=.35
ra_e(7)=2e9
#
Main Index
1424
Code Examples

# Converting engineering constants into an array of 9 elements.


get_qab_from_engin_cons @
( ra_e, @
ra_qab, @
i_ier )
dump i_ier
dump ra_qab
#---------------------------------------------------------------------

mat_2d_ani_to_2d_ort ()

# Purpose : This file provides an example of a call to the


# function mat_2d_ani_to_2d_ort()
#
# 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 mat_2d_ani_to_2d_ort()
# has the following arguments:
#
# mat_2d_ani_to_2d_ort
# ( s11,
# s12,
# s22,
# div_tol,
# e11,
# e22,
# v12 )
#
#---------------------------------------------------------------------
# Variable Declarations
REAL r_s11
REAL r_s12
REAL r_s22
REAL r_div_tol
REAL r_e11
REAL r_e22
REAL r_v12
#---------------------------------------------------------------------
# Assigning values for stiffness matrix elements.
r_s11 =2.00437e11
r_s12 =1.32288e9
r_s22 =4.00873e9
r_div_tol =1e-14
#
# Calculating the corresponding engineering constants.
mat_2d_ani_to_2d_ort @
( r_s11, @
r_s12, @
r_s22, @
r_div_tol, @
r_e11, @
r_e22, @
r_v12 )
dump r_e11,r_e22,r_v12
#---------------------------------------------------------------------

Main Index
CHAPTER 12 1425
Materials

mat_3d_ani_to_3d_ort ()

# Purpose : This file provides an example of a call to the


# function mat_3d_ani_to_3d_ort()
#
# 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 mat_3d_ani_to_3d_ort()
# has the following arguments:
#
# mat_3d_ani_to_3d_ort
# ( s11,
# s12,
# s13,
# s22,
# s23,
# s33,
# div_tol,
# e11,
# e22,
# e33,
# v12,
# v23,
# v31 )
#
#---------------------------------------------------------------------
# Variable Declarations
REAL r_s11
REAL r_s12
REAL r_s13
REAL r_s22
REAL r_s23
REAL r_s33
REAL r_div_tol
REAL r_e11
REAL r_e22
REAL r_e33
REAL r_v12
REAL r_v23
REAL r_v31
#---------------------------------------------------------------------
# Assigning the values to the elements of stiffness matrix.
r_s11 = 1.99e11
r_s12 = -2.34e8
r_s13 = -3.43e9
r_s22 = -2.75e7
r_s23 = -9.17e9
r_s33 = -2.77e10
r_div_tol = 1e-14
#
# Converting stiffness matrix values into engineering constants.
mat_3d_ani_to_3d_ort @
( r_s11, @
r_s12, @
r_s13, @
r_s22, @
r_s23, @
r_s33, @
r_div_tol, @
r_e11, @
r_e22, @
r_e33, @
Main Index
1426
Code Examples

r_v12, @
r_v23, @
r_v31 )

dump r_e11,r_e22,r_e33,r_v12,r_v23,r_v31
#---------------------------------------------------------------------

mat_hal_load_defn_show ()

# Purpose : This file provides an example of a call to the


# function mat_hal_load_defn_show()
#
# This session file will open a new database
# by name ‘new.db’ with default options and will
# create four materials of type isotropic,
# 3d orthotropic, cont. fiber and disc. ribbon
# composite. The construction data for the two
# composite materials will be listed
#
# For material property ids refer User’s Manual
# Part 9, Section 7.5 to 7.7
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function mat_hal_load_defn_show()
# has the following arguments:
#
# mat_hal_load_defn_show
# ( mat_name,
# iopt,
# fiber_name,
# matrix_name,
# fvf,
# mvf,
# aratio1,
# aratio2,
# theory,
# override,
# fudge_factor1,
# fudge_factor2,
# fudge_factor3,
# fudge_factor4,
# fudge_factor5,
# fudge_factor6 )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_mat_name[32]
INTEGER i_iopt
STRING s_fiber_name[32]
STRING s_matrix_name[32]
REAL r_fvf
REAL r_mvf
STRING s_aratio1[32]
STRING s_aratio2[32]
INTEGER i_theory
LOGICAL l_override
STRING s_fudge_factor1[32]
STRING s_fudge_factor2[32]
STRING s_fudge_factor3[32]
STRING s_fudge_factor4[32]
STRING s_fudge_factor5[32]
Main Index
CHAPTER 12 1427
Materials

STRING s_fudge_factor6[32]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
# Creating isotropic material by name ‘matrix’.
i_return_value = @
material.create(“Analysis code ID”,1,”Analysis type ID”,1, @
“matrix”,0, “New Material “, “Isotropic”, 1, @
“Directionality”, 1, “Linearity”, 1, “Homogeneous”, 0, @
“Linear Elastic”, 1,”Model Options & IDs”,[““,””,””,””,””], @
[0,0,0,0,0],”Active Flag”,1,”Create”,10,”External Flag”,FALSE, @
“Property IDs”,[“Elastic Modulus”,”Poisson Ratio”], [2, 5, 0], @
“Property Values”, [“2e5”, “.3”, ““] )
dump i_return_value

# Creating 3d orthotropic material by name ‘fiber’.


i_return_value = @
material.create(“Analysis code ID”,1,”Analysis type ID”,1,”fiber”,@
0,”New Material”, “3d Orthotropic”, 2, “Directionality”,2, @
“Linearity”,1,”Homogeneous”,0,”Linear Elastic”, 1, @
“Model Options & IDs”,[““,””,””,””,””],[0,0,0,0,0], @
“Active Flag” ,1,”Create”,10,”External Flag”,FALSE, @
“Property IDs”, [“Elastic Modulus”,”Elastic Modulus 22”, @
“Elastic Modulus 33”,”Poisson Ratio”,”Poisson Ratio 23”, @
“Poisson Ratio 31”, “Shear Modulus”,”Shear Modulus 23”, @
“Shear Modulus 31”], [2, 3, 4, 5, 6, 7, 8, 9, 10, 0], @
“Property Values”, [“2e5”,”2e5”,”2e5”, “.33”, “.3”, “.37”, @
“2e6”, “2e7”, “4e6”, ““] )
dump i_return_value

# Creating continuous fiber composite material by name ‘cfc’.


i_return_value = @
mat_hal_create( “cfc”, ““, 1, 0.2, 0.80000001, 1, [““, ““], TRUE, @
[“1”, “2”, “3”, “4”, “5”, ““, ““], “fiber”, “matrix”, “Create” )
dump i_return_value

# Creating discontinuous ribbon composite material by name ‘drc’.


i_return_value = @
mat_hal_create(“drc”,””,4, 0.59899998, 0.40099999, 0,[“100”,”10”],@
FALSE,[““,””,””,””,””,””,””], “fiber”, “matrix”, “Create” )
dump i_return_value
#---------------------------------------------------------------------
# Retrieving data for continuous fiber composite named ‘cfc’.
s_mat_name = “cfc”
# The option flag for the continuous fiber composite is 1
i_iopt = 1
#
i_return_value = @
mat_hal_load_defn_show @
( s_mat_name, @
i_iopt, @
s_fiber_name, @
s_matrix_name, @
r_fvf, @
r_mvf, @
s_aratio1, @
s_aratio2, @
i_theory, @
l_override, @
s_fudge_factor1, @
s_fudge_factor2, @
s_fudge_factor3, @
s_fudge_factor4, @
s_fudge_factor5, @
Main Index
1428
Code Examples

s_fudge_factor6 )
dump i_return_value
# The material defination data into the string format is
dump i_iopt,s_fiber_name,s_matrix_name,r_fvf,r_mvf
dump s_aratio1,s_aratio2,i_theory,l_override
dump s_fudge_factor1,s_fudge_factor2,s_fudge_factor3
dump s_fudge_factor4,s_fudge_factor5,s_fudge_factor6
#---------------------------------------------------------------------
# Retrieving data for discontinuous ribbon composite named ‘drc’.
s_mat_name=”drc”
# The option flag for the discontinuous ribbon composite is 4
i_iopt = 4
#
i_return_value = @
mat_hal_load_defn_show @
( s_mat_name, @
i_iopt, @
s_fiber_name, @
s_matrix_name, @
r_fvf, @
r_mvf, @
s_aratio1, @
s_aratio2, @
i_theory, @
l_override, @
s_fudge_factor1, @
s_fudge_factor2, @
s_fudge_factor3, @
s_fudge_factor4, @
s_fudge_factor5, @
s_fudge_factor6 )
dump i_return_value
# The material defination data into the string format is
dump i_iopt,s_fiber_name,s_matrix_name,r_fvf,r_mvf
dump s_aratio1,s_aratio2,i_theory,l_override
dump s_fudge_factor1,s_fudge_factor2,s_fudge_factor3
dump s_fudge_factor4,s_fudge_factor5,s_fudge_factor6
#---------------------------------------------------------------------

mat_lam_load_defn_show ()

# Purpose : This file provides an example of two calls to


# the function mat_lam_load_defn_show()
#
# This session file will open a new database
# by name ‘new.db’ with default options and will
# add two definations of 2d orthotropic material
# and two definations of composite laminate.
#
# For material property ids refer User’s Manual
# Part 9, Section 7.5 to 7.7
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function mat_lam_load_defn_show()
# has the following arguments:
#
# mat_lam_load_defn_show
# ( mat_name,
# num_plies,
# ply_names,
# thicks,
Main Index
CHAPTER 12 1429
Materials

# orients,
# num_def,
# iconv,
# offset_string )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_mat_name[32]
INTEGER i_num_plies
INTEGER iv_ply_names(VIRTUAL)
REAL rv_thicks(VIRTUAL)
REAL rv_orients(VIRTUAL)
INTEGER i_num_def
INTEGER i_iconv
STRING s_offset_string[32]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
# Creating 2d orthotropic materials for laminate plies. The material
# names are “2dort1” and “2dort2”.

i_return_value = @
material.create( “Analysis code ID”, 1, “Analysis type ID”, 1, @
“2dort1”, 0, “New Material”, @
“2d Orthotropic”, 5, “Directionality”, 4, “Linearity”, 1, @
“Homogeneous”, 0, “Linear Elastic”, 1, “Model Options & IDs”, @
[““,””,””,””,””], [0, 0, 0, 0, 0], “Active Flag”, 1, “Create”, @
10, “External Flag”, FALSE, “Property IDs”, [“Elastic Modulus”,@
“Elastic Modulus 22”, “Poisson Ratio”, “Shear Modulus”, @
“Shear Modulus 23”, “Shear Modulus 31”], [2, 3, 5, 8, 9, 10,0],@
“Property Values”, [“2e6”, “2e6”, “.33”, “2e7”, “3e7”,”4e6”,””])
dump i_return_value

i_return_value = @
material.create( “Analysis code ID”, 1, “Analysis type ID”, 1, @
“2dort2”, 0, “New Material”, @
“2d Orthotropic”, 5, “Directionality”, 4, “Linearity”, 1, @
“Homogeneous”, 0, “Linear Elastic”, 1, “Model Options & IDs”, @
[““, ““, ““, ““, ““], [0, 0, 0, 0, 0],”Active Flag”,1,”Create”,@
10, “External Flag”, FALSE, “Property IDs”, [“Elastic Modulus”,@
“Elastic Modulus 22”, “Poisson Ratio”, “Shear Modulus”, @
“Shear Modulus 23”, “Shear Modulus 31”], [2, 3, 5, 8, 9, 10,0],@
“Property Values”,[“2e6”,”2e5”,”.4”,”2e8”,”2.7e7”,”3.7e6”,””] )
dump i_return_value

# Creating laminate composite lam1, with ‘Total’ as


# stacking sequence.
i_return_value = @
mat_create_lam( “lam1”, ““, 1, [“2dort1”, “2dort2”, “2dort1”, @
“2dort2”, “2dort1”], [0.1, 0.12, 0.1, 0.12, 0.1], @
[0., 30., 60., 90., 120.], 5, “10”, “Create” )
dump i_return_value

# Creating laminate composite lam2, with ‘Symmetry/Mid ply’ as


# stacking sequence.
i_return_value = @
mat_create_lam( “lam2”, ““, 3, [“2dort2”, “2dort1”, “2dort2”], @
[0.079999998, 0.15000001, 0.079999998], [30., 60., 90.], 3,”25”,@
“Create” )
dump i_return_value
#---------------------------------------------------------------------
# Loading the laminate defination data for ‘lam1’
s_mat_name = “lam1”
# Number of plies are 5
Main Index
1430
Code Examples

i_num_plies = 5
#
i_return_value = @
mat_lam_load_defn_show @
( s_mat_name, @
i_num_plies, @
iv_ply_names, @
rv_thicks, @
rv_orients, @
i_num_def, @
i_iconv, @
s_offset_string )
dump i_return_value
# The laminate defination data is
dump iv_ply_names,rv_thicks,rv_orients,i_num_def,i_iconv
dump s_offset_string
#---------------------------------------------------------------------
# Loading the laminate defination data for ‘lam2’
s_mat_name = “lam2”
# Number of plies are 5
i_num_plies = 5
#
i_return_value = @
mat_lam_load_defn_show @
( s_mat_name, @
i_num_plies, @
iv_ply_names, @
rv_thicks, @
rv_orients, @
i_num_def, @
i_iconv, @
s_offset_string )
dump i_return_value
# The laminate defination data is
dump iv_ply_names,rv_thicks,rv_orients,i_num_def,i_iconv
dump s_offset_string
#---------------------------------------------------------------------
sys_free_array(iv_ply_names)
sys_free_array(rv_thicks)
sys_free_array(rv_orients)
#---------------------------------------------------------------------

mat_load_show ()

# Purpose : This file provides an example of two calls to


# the function mat_load_show()
#
# This session file will open a new database
# by name ‘new.db’ with default options and will
# create four materials of type isotropic,
# 3d orthotropic, disc. ribbon composite and
# short fiber composite. The construction data
# for the short fiber and disc. ribbon composite
# materials will be listed
#
# For material property ids refer User’s Manual
# Part 9, Section 7.5 to 7.7
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function mat_load_show()
# has the following arguments:
Main Index
CHAPTER 12 1431
Materials

#
# mat_load_show
# ( mat_name,
# itype,
# iopt,
# desc,
# rvals,
# num_phases )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_mat_name[32]
INTEGER i_itype
INTEGER i_iopt
STRING s_desc[32]
REAL ra_rvals(32)
INTEGER i_num_phases
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
# Creating isotropic material by name ‘matrix’.
i_return_value = @
material.create(“Analysis code ID”,1,”Analysis type ID”,1, @
“matrix”,0, “New Material” , “Isotropic”, 1, @
“Directionality”, 1, “Linearity”, 1, “Homogeneous”, 0, @
“Linear Elastic”, 1,”Model Options & IDs”,[““,””,””,””,””], @
[0,0,0,0,0],”Active Flag”,1,”Create”,10,”External Flag”,FALSE, @
“Property IDs”,[“Elastic Modulus”,”Poisson Ratio”], [2, 5, 0], @
“Property Values”, [“2e5”, “.3”, ““] )
dump i_return_value

# Creating 3d orthotropic material by name ‘fiber’.


i_return_value = @
material.create(“Analysis code ID”,1,”Analysis type ID”,1,”fiber”,@
0,”New Material”, “3d Orthotropic”, 2, @
“Directionality”,2,”Linearity”,1,”Homogeneous”,0, @
“Linear Elastic”, 1,”Model Options & IDs”,[““,””,””,””,””],[0,0@
,0,0,0],”Active Flag” ,1,”Create”,10,”External Flag”,FALSE, @
“Property IDs”, [“Elastic Modulus”,”Elastic Modulus 22”, @
“Elastic Modulus 33”, “Poisson Ratio”,”Poisson Ratio 23”, @
“Poisson Ratio 31”, “Shear Modulus”,”Shear Modulus 23”, @
“Shear Modulus 31”], [2, 3, 4, 5, 6, 7, 8, 9, 10, 0], @
“Property Values”, [“2e5”,”2e5”,”2e5”, “.33”, “.3”, “.37”, @
“2e6”, “2e7”, “4e6”, ““] )
dump i_return_value

# Creating discontinuous ribbon composite material by name ‘drc’.


i_return_value = @
mat_hal_create(“drc”,””,4, 0.59899998, 0.40099999, 0,[“100”,”10”],@
FALSE,[““,””,””,””,””,””,””], “fiber”, “matrix”, “Create” )
dump i_return_value

# Creating one dimensional short fiber composite material.


i_return_value = @
mat_sfc_create( “sfc1d”, ““, 1, 0., 0., 10., 0., 0., 1000, “drc”, @
“Create” )
dump i_return_value
#---------------------------------------------------------------------
# Retrieving data for discontinuous ribbon composite material is
s_mat_name = “drc”
# The composite material type for Halpine-Tsai material is 3
i_itype = 3
# The composite option number for the material is 4
i_iopt = 4
Main Index
1432
Code Examples

#
i_return_value = @
mat_load_show @
( s_mat_name, @
i_itype, @
i_iopt, @
s_desc, @
ra_rvals, @
i_num_phases )
dump i_return_value
# The construction data for one dimensional short fiber composite is
dump i_iopt,s_desc,ra_rvals,i_num_phases
#---------------------------------------------------------------------
# Retrieving data for one dimensional short fiber composite.
s_mat_name = “sfc1d”
# The material type for short fiber composite of one dimension is 1
i_itype = 4
# The composite option number for the material is 1.
i_iopt = 1
#
i_return_value = @
mat_load_show @
( s_mat_name, @
i_itype, @
i_iopt, @
s_desc, @
ra_rvals, @
i_num_phases )
dump i_return_value
# The construction data for two dimensional short fiber composite is
dump i_iopt,s_desc,ra_rvals,i_num_phases
#---------------------------------------------------------------------

mat_mix_load_defn_show ()

# Purpose : This file provides an example of a call to the


# function mat_mix_load_defn_show()
#
# This session file will open a new database
# by name ‘new.db’ with default options and will
# add one defination of 3d anisotropic material
# and two definations of isotropic material.
# Using the three materials one Rule Of Mixture
# material will be defined.
#
# For material property ids refer User’s Manual
# Part 9, Section 7.5 to 7.7
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function mat_mix_load_defn_show()
# has the following arguments:
#
# mat_mix_load_defn_show
# ( mat_name,
# num_phases,
# name_string2,
# name_string3,
# name_string4,
# phase_string,
# v_f_string,
# orient_string,
Main Index
CHAPTER 12 1433
Materials

# ncn,
# ncv,
# nco )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_mat_name[32]
INTEGER i_num_phases
STRING s_name_string2[32]
STRING s_name_string3[32]
STRING s_name_string4[32]
STRING s_phase_string[32]
STRING s_v_f_string[32]
STRING s_orient_string[32]
INTEGER i_ncn
INTEGER i_ncv
INTEGER i_nco
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
# Creating two isotropic materials as ‘iso1’ and ‘iso2’.

i_return_value = @
material.create( “Analysis code ID”, 1, “Analysis type ID”, 1, @
“iso1”, 0, “New Material”, “Isotropic”, @
1, “Directionality”, 1, “Linearity”, 1, “Homogeneous”, 0, @
“Linear Elastic”, 1, “Model Options & IDs”, [““,””,””,””,””], @
[0, 0, 0, 0, 0], “Active Flag”, 1, “Create”,10,”External Flag”,@
FALSE, “Property IDs”, [“Elastic Modulus”, “Poisson Ratio”], @
[2, 5, 0], “Property Values”, [“2e11”, “.35”, ““] )
dump i_return_value

i_return_value = @
material.create( “Analysis code ID”, 1, “Analysis type ID”, 1, @
“iso2”, 0, “New Material”, “Isotropic”, @
1, “Directionality”, 1, “Linearity”, 1, “Homogeneous”, 0, @
“Linear Elastic”, 1, “Model Options & IDs”, [““,””,””,””,””], @
[0, 0, 0, 0, 0], “Active Flag”, 1, “Create”,10,”External Flag”,@
FALSE, “Property IDs”, [“Elastic Modulus”, “Poisson Ratio”], @
[2, 5, 0], “Property Values”, [“2E+11”, “0.34999999”, ““] )
dump i_return_value

# Defining 3d anisotropic material as ‘3dani’


i_return_value = @
material.create( “Analysis code ID”, 1, “Analysis type ID”, 1, @
“3dani”, 0, “New Material”, @
“3d Anisotropic”, 3, “Directionality”, 3, “Linearity”, 1, @
“Homogeneous”, 0, “Linear Elastic”,1,”Model Options & IDs”,[““,@
““, ““, ““, ““], [0, 0, 0, 0, 0],”Active Flag”,1, “Create”, 10,@
“External Flag”, FALSE, “Property IDs”, [“Stiffness 11”, @
“Stiffness 12”, “Stiffness 13”, “Stiffness 14”, “Stiffness 15”,@
“Stiffness 16”, “Stiffness 22”, “Stiffness 23”, “Stiffness 24”,@
“Stiffness 25”, “Stiffness 26”, “Stiffness 33”, “Stiffness 34”,@
“Stiffness 35”, “Stiffness 36”, “Stiffness 44”, “Stiffness 45”,@
“Stiffness 46”, “Stiffness 55”,”Stiffness 56”, “Stiffness 66”],@
[54, 55, 56, 66, 67, 68, 57, 58, 69, 70, 71, 59, 72, 73, 74,60,@
61, 62, 63, 64, 65, 0], “Property Values”,[“2e9”, “2e7”, “3e6”,@
“4e5”, “5e5”, “4e3”, “5e8”, “4e5”, “3e6”, “2e5”, “3e3”, “4e6”, @
“3e3”, “5e4”, “4e4”, “6e7”, “4e5”, “5e4”,”5e5”,”5e3”,”6e6”,””])
dump i_return_value

# Creating rule of mixture material by using ‘iso1’, ‘iso2’ and


# ‘3dani’ as constituent phases.
i_return_value = @
mat_create_mix( “rom”, ““, “iso1 iso2 3dani”, “.5 .25 .25”, “0 0 @
Main Index
1434
Code Examples

0 45 45 45 30 45 30”, “Create” )
dump i_return_value
#---------------------------------------------------------------------
# Calling function to load the material defination data for Rule of
# Mixture material ‘rom’.
s_mat_name= “rom”
i_num_phases=3
#
i_return_value = @
mat_mix_load_defn_show @
( s_mat_name, @
i_num_phases, @
s_name_string2, @
s_name_string3, @
s_name_string4, @
s_phase_string, @
s_v_f_string, @
s_orient_string, @
i_ncn, @
i_ncv, @
i_nco )
dump i_return_value
# Material defination data for the material is
dump s_name_string2,s_name_string3,s_name_string4,s_phase_string
dump s_v_f_string,s_orient_string,i_ncn,i_ncv,i_nco
#---------------------------------------------------------------------

mat_sfc_load_defn_show ()

# Purpose : This file provides an example of a call to the


# function mat_sfc_load_defn_show()
#
# This session file will open a new database
# by name ‘new.db’ with default options and will
# create five materials of type isotropic,
# 3d orthotropic, disc. ribbon composite and
# short fiber composites of both types. The
# construction data for the two short fiber
# composite materials will be listed
#
# For material property ids refer User’s Manual
# Part 9, Section 7.5 to 7.7
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function mat_sfc_load_defn_show()
# has the following arguments:
#
# mat_sfc_load_defn_show
# ( mat_name,
# iopt,
# uni_mat_name,
# fmo,
# smo,
# fsd,
# ssd,
# cor,
# niter )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_mat_name[32]
Main Index
CHAPTER 12 1435
Materials

INTEGER i_iopt
STRING s_uni_mat_name[32]
REAL r_fmo
REAL r_smo
REAL r_fsd
REAL r_ssd
REAL r_cor
INTEGER i_niter
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
# Creating isotropic material by name ‘matrix’.
i_return_value = @
material.create(“Analysis code ID”,1,”Analysis type ID”,1, @
“matrix”,0, “New Material”, “Isotropic”, 1, @
“Directionality”, 1, “Linearity”, 1, “Homogeneous”, 0, @
“Linear Elastic”, 1,”Model Options & IDs”,[““,””,””,””,””], @
[0,0,0,0,0],”Active Flag”,1,”Create”,10,”External Flag”,FALSE, @
“Property IDs”,[“Elastic Modulus”,”Poisson Ratio”], [2, 5, 0], @
“Property Values”, [“2e5”, “.3”, ““] )
dump i_return_value

# Creating 3d orthotropic material by name ‘fiber’.


i_return_value = @
material.create(“Analysis code ID”,1,”Analysis type ID”,1,”fiber”,@
0,”New Material”, “3d Orthotropic”, 2, @
“Directionality”,2,”Linearity”,1,”Homogeneous”,0, @
“Linear Elastic”, 1,”Model Options & IDs”,[““,””,””,””,””],[0,0@
,0,0,0],”Active Flag”,1,”Create”,10,”External Flag”,FALSE, @
“Property IDs”, [“Elastic Modulus”,”Elastic Modulus 22”, @
“Elastic Modulus 33”, “Poisson Ratio”,”Poisson Ratio 23”, @
“Poisson Ratio 31”, “Shear Modulus”,”Shear Modulus 23”, @
“Shear Modulus 31”], [2, 3, 4, 5, 6, 7, 8, 9, 10, 0], @
“Property Values”, [“2e5”,”2e5”,”2e5”, “.33”, “.3”, “.37”, @
“2e6”, “2e7”, “4e6”, ““] )
dump i_return_value

# Creating discontinuous ribbon composite material by name ‘drc’.


i_return_value = @
mat_hal_create(“drc”,””,4, 0.59899998, 0.40099999, 0,[“100”,”10”],@
FALSE, [““,””,””,””,””,””,””], “fiber”, “matrix”, “Create” )
dump i_return_value

# Creating one dimensional short fiber composite material.


i_return_value = @
mat_sfc_create( “sfc1d”, ““, 1, 0., 0., 10., 0., 0., 1000, “drc”, @
“Create” )
dump i_return_value

# Creating two dimensional short fiber composite material.


i_return_value = @
mat_sfc_create( “sfc2d”, ““, 2, 0., 45., 7., 16., 0.2, 1000, “drc”@
, “Create” )
dump i_return_value
#---------------------------------------------------------------------
# Retrieving data for one dimensional short fiber composite.
s_mat_name = “sfc1d”
# Material option is 1 for one dimensional short fiber composite.
i_iopt = 1
#
i_return_value = @
mat_sfc_load_defn_show @
( s_mat_name, @
i_iopt, @
Main Index
1436
Code Examples

s_uni_mat_name, @
r_fmo, @
r_smo, @
r_fsd, @
r_ssd, @
r_cor, @
i_niter )
dump i_return_value
# The construction data for one dimensional short fiber composite is
dump s_uni_mat_name,r_fmo,r_smo,r_fsd,r_ssd,r_cor,i_niter
#---------------------------------------------------------------------
# Retrieving data for two dimensional short fiber composite.
s_mat_name = “sfc2d”
# Material option is 2 for two dimensional short fiber composite.
i_iopt = 2
#
i_return_value = @
mat_sfc_load_defn_show @
( s_mat_name, @
i_iopt, @
s_uni_mat_name, @
r_fmo, @
r_smo, @
r_fsd, @
r_ssd, @
r_cor, @
i_niter )
dump i_return_value
# The construction data for two dimensional short fiber composite is
dump s_uni_mat_name,r_fmo,r_smo,r_fsd,r_ssd,r_cor,i_niter
#---------------------------------------------------------------------

material.namedelete ()

# Purpose : This file provides an example of a call to the


# function material.namedelete()
#
# This function deletes the material from
# a database. It requires the number of materials
# and the names of the material entered by the
# material.create() function. The function returns a
# status 0 after successful completion
# and the error code in case of failure.
#
# 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 material.namedelete()
# has the following arguments:
#
# material.namedelete
# ( material_name,
# descrip,
# num_materials )
#
#---------------------------------------------------------------------
# Variable Declarations

INTEGER num_materials = 2
STRING descrip[32] = ""
STRING material_name[32](VIRTUAL)
INTEGER status
STRING message[32]
Main Index
CHAPTER 12 1437
Materials

#----------------------------------------------------------------------
# Open a new database
if(!db_is_open())THEN
uil_file_new.go("","new.db")
$? YES 36000002
endif
#----------------------------------------------------------------------
# Setting the preference to MSC.Nastran.

uil_pref_analysis.set_analysis_pref( "MSC.Nastran", @
"Structural", @
"", @
".op2" )
#---------------------------------------------------------------------
# Creating 1st material database for the material "Steel_1"

status = material.create( @
"Analysis code ID", @
1, @
"Analysis type ID", @
1, @
"Steel_1", @
0, @
"", @
"Isotropic", @
1, @
"Directionality", @
1, @
"Linearity", @
1, @
"Homogeneous", @
0, @
"Linear Elastic", @
1, @
"Model Options & IDs", @
["", "", "", "", ""], @
[0, 0, 0, 0, 0], @
"Active Flag", @
1, @
"Create", @
10, @
"External Flag", @
FALSE, @
"Property IDs", @
["Elastic Modulus", @
"Poisson Ratio"], @
[2, 5, 0], @
"Property Values", @
["29E6", "0.3", ""])

dump status

#---------------------------------------------------------------------
# Creating a 2nd material database for the material "Steel_2"

status = material.create( @
"Analysis code ID", @
1, @
"Analysis type ID", @
1, @
"Steel_2", @
0, @
"", @
"Isotropic", @
1, @
"Directionality", @
1, @
Main Index
1438
Code Examples

"Linearity", @
1, @
"Homogeneous", @
0, @
"Linear Elastic", @
1, @
"Model Options & IDs", @
["", "", "", "", ""], @
[0, 0, 0, 0, 0], @
"Active Flag", @
1, @
"Create", @
10, @
"External Flag", @
FALSE, @
"Property IDs", @
["Elastic Modulus", @
"Poisson Ratio"], @
[2, 5, 0], @
"Property Values", @
["29E6", "0.3", ""])

dump status
#---------------------------------------------------------------------
# Assigning the array size to material_name

sys_allocate_array(material_name,1,num_materials)

#---------------------------------------------------------------------
# Defining the names for the materials

material_name(1) = "Steel_1"
material_name(2) = "Steel_2"

status = material.namedelete( @
material_name, @
descrip, @
num_materials )

dump status
#---------------------------------------------------------------------
# Getting the status output for the function execution

msg_get_string(status,message)

dump message
#---------------------------------------------------------------------
# Closing the file

# uil_file_close.goquit()

#---------------------------------------------------------------------
# End of file

n21_cons_to_sym_6x6_matrix ()

# Purpose : This file provides an example of a call to the


# function n21_cons_to_sym_6x6_matrix()
#
# 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.
#
Main Index
CHAPTER 12 1439
Materials

# The function n21_cons_to_sym_6x6_matrix()


# has the following arguments:
#
# n21_cons_to_sym_6x6_matrix
# ( cm,
# cb,
# status )
#
#---------------------------------------------------------------------
# Variable Declarations
REAL ra_cb(21)
REAL ra_cm(6,6)
REAL ra_e(9)
INTEGER i_status
#---------------------------------------------------------------------
# Assigning material properties for a 3d orthotropic material.
ra_e(1)=2e5
ra_e(2)=4e5
ra_e(3)=3e4
ra_e(4)=.3
ra_e(5)=.33
ra_e(6)=.36
ra_e(7)=2e11
ra_e(8)=3e12
ra_e(9)=4e9
#
# Converting the engineering constants into 21 stress-strain
# coefficients.
engin_cons_to_elastic_matrix @
( ra_e, @
ra_cb, @
i_status )
dump i_status
dump ra_cb
#---------------------------------------------------------------------
# Calling function to convert 21 engineering constants to 6x6 matrix.
#
n21_cons_to_sym_6x6_matrix @
( ra_cm, @
ra_cb )
dump ra_cm

#---------------------------------------------------------------------

p3cm.close_2 ()

# Purpose : This file provides an example of a call to the


# function p3cm.close_2()
#
# This session file closes the Layup file.
#
# Before running this session file run spool.ses and
# 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 p3cm.close_2()
# has the following arguments:
#
# p3cm.close_2 (detail)
#
#---------------------------------------------------------------------
Main Index
1440
Code Examples

# Variable Decleration

INTEGER detail
INTEGER i_return_value

#---------------------------------------------------------------------
# Opening the file spool.db

uil_file_open.go( "./spool.db")

#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.

sys_library( "add", "laminate_modeler.plb" )

#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.

P3CM.new ( "./spool.Layup" )

#---------------------------------------------------------------------
# Add the new material in the database.

p3cm.create_material_add( "Paint", "Mat_1", "aluminum", 0.1, 0., 0. )

#---------------------------------------------------------------------
# Argument Initialization.

detail = 0

#---------------------------------------------------------------------
# Close the Layup file.

i_return_value = p3cm.close_2( detail )

#---------------------------------------------------------------------
# Dump the status of the function.

dump i_return_value

#---------------------------------------------------------------------
# Closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

p3cm.create_book_layup2 ()

# Purpose : This file provides an example of a call to the


# function p3cm.create_book_layup2()
#
# This session file creates a book report for
# layups in the database.
#
# Before running this session file run spool.ses and
# 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.
#
#
Main Index
CHAPTER 12 1441
Materials

# The function p3cm.create_book_layup2()


# has the following arguments:
#
# P3CM.create_book_layup2( num_plies_in, @
# index_in, @
# report_it, @
# state, @
# rep_togs, @
# display_it, @
# material, @
# view_arrow, @
# init_vector, @
# disp_area, @
# max_strn, @
# angles, @
# pattern, @
# cutout, @
# offval, @
# pat_igs, @
# pat_dxf, @
# cut_igs, @
# cut_dxf, @
# curve_str, @
# layer_str, @
# hardcopy_it, @
# options)
#
#---------------------------------------------------------------------
# Variable Decleration

INTEGER num_plies_in
INTEGER index_in(1)
LOGICAL report_it
STRING state[80]
LOGICAL rep_togs(6)
LOGICAL display_it
LOGICAL material
LOGICAL view_arrow
LOGICAL init_vector
LOGICAL max_strn
LOGICAL disp_area
LOGICAL cutout
LOGICAL pattern
LOGICAL surface
LOGICAL angles
REAL offval
LOGICAL pat_igs,pat_dxf,cut_igs,cut_dxf
STRING curve_str[80],layer_str[80]
LOGICAL hardcopy_it
STRING options[1024]

#---------------------------------------------------------------------
# Opening the file spool.db

uil_file_open.go( "./spool.db")

#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.

sys_library( "add", "laminate_modeler.plb" )

#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.

P3CM.new ( "./spool.Layup" )

#---------------------------------------------------------------------
Main Index
1442
Code Examples

# Add the new material in the database.

p3cm.create_material_add( "Paint", "Mat_1", "aluminum", 0.1, 0., 0. )

#---------------------------------------------------------------------
# Add the created ply in the database.

p3cm.create_ply_add_2( "Paint", "Mat_1", "Ply_1", @


[-0.58138198, 7.9241023, -1.5620499], @
[0.75, -0.5, -0.433], [0., 0., 0.], @
0., -1., -1., -1., 0, "", "", 1, 0, @
[0., 0., 0., 0.], 1, @
["Surface 5"], "" )

$? YES 59200001

#---------------------------------------------------------------------
# Add the created layup in the database.

p3cm.create_layup_add_2( "spool", @
"LM_Layup created from : ./spool by LAMINATE MODELER", @
1, ["Ply_1", ""], ["Paint", ""], [1, 0], @
["Top", ""], [0., 0.], 0, [0.], [""], [0.], [0.], @
[""], 1, [5., 0.], [5., 0.] , ["", ""], FALSE, @
"Stan. Lam. Plate (CQUAD4/PCOMP)", @
FALSE, FALSE )

#---------------------------------------------------------------------
# Argument Initialization.

num_plies_in = 1
index_in(1) = 1
report_it = TRUE
state = "Expand"
rep_togs = [TRUE, TRUE, TRUE, TRUE, TRUE, TRUE]
display_it = TRUE
material = FALSE
view_arrow = TRUE
init_vector = TRUE
disp_area = TRUE
max_strn = TRUE
angles = FALSE
pattern = TRUE
cutout = TRUE
offval = 0.
pat_igs = FALSE
pat_dxf = FALSE
cut_igs = TRUE
cut_dxf = TRUE
curve_str = "SPLINE"
layer_str = "POLYLINE"
hardcopy_it = TRUE

options = "printer=Postscript Default," // @


"driver=Postscript, destination=Unknown," // @
"window=Current Viewport, save=YES," // @
"output_file=, paper=Letter, left_margin=0.5"// @
" in, right_margin=0.5 in, top_margin=0.5 in,"//@
"bottom_margin=0.5 in, default_units=Inches,"// @
"orientation=Landscape, copies=1," // @
"format=Black to White, background=White, " // @
"lines_&_text=Black, line_weight=0.5 pts,"// @
"text_scale=100%, image_size=Fit on Page,"// @
"scale_factor=1.0, center=Yes," // @
"draw_borders=Yes, quality=Normal, "// @
"color_model=RGB, gcr=75 %"
Main Index
CHAPTER 12 1443
Materials

#---------------------------------------------------------------------
# Create a book report for layups in the database.

P3CM.create_book_layup2( num_plies_in, @
index_in, @
report_it, @
state, @
rep_togs, @
display_it, @
material, @
view_arrow, @
init_vector, @
disp_area, @
max_strn, @
angles, @
pattern, @
cutout, @
offval, @
pat_igs, @
pat_dxf, @
cut_igs, @
cut_dxf, @
curve_str, @
layer_str, @
hardcopy_it, @
options)

#---------------------------------------------------------------------
# Closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

P3cm.create_laminates_layup_2 ()

# Purpose : This file provides an example of a call to the


# function P3CM.create_laminates_layup_2()
#
# This session file creates a laminate in the database.
#
# Before running this session file run spool.ses and
# 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 P3CM.create_laminates_layup_2()
# has the following arguments:
#
# P3CM.create_laminates_layup_2( areaspec, @
# an_code_name, @
# an_type_name, @
# orientation, @
# prim_entity, @
# switch_angle_in, @
# sec_entity, @
# num_tols, @
# ang_tols, @
# thick_tols, @
# tol_areas, @
# element_type, @
Main Index
1444
Code Examples

# prefix, @
# first_laminate_id, @
# first_property_id, @
# preview )
#
#---------------------------------------------------------------------
# Variable Decleration

STRING areaspec[80]
STRING an_code_name[80]
STRING an_type_name[80]
STRING orientation[80]
STRING prim_entity[80]
REAL switch_angle_in
STRING sec_entity[80]
INTEGER num_tols
REAL ang_tols(2)
REAL thick_tols(2)
STRING tol_areas[80](2)
STRING element_type[512]
STRING prefix[80]
INTEGER first_laminate_id
INTEGER first_property_id
LOGICAL preview

INTEGER i_return_value

#---------------------------------------------------------------------
# Opening the file spool.db

uil_file_open.go( "./spool.db")

#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.

sys_library( "add", "laminate_modeler.plb" )

#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.

P3CM.new ( "./spool.Layup" )

#---------------------------------------------------------------------
# Add the new material in the database.

p3cm.create_material_add( "Paint", "Mat_1", "aluminum", 0.1, 0., 0. )

#---------------------------------------------------------------------
# Add the created ply in the database.

p3cm.create_ply_add_2( "Paint", "Mat_1", "Ply_1", @


[-0.99995601, 8., 4.], [0.75, -0.5, -0.433], @
[0., 0., 0.], 0., -1., -1., -1., 0, "", "", @
1, 0, [0., 0., 0., 0.], 1, @
["Surface 4"], "" )

$? YES 59200001

#---------------------------------------------------------------------
# Add the created layup in the database.

p3cm.create_layup_add_2( "spool", @
"LM_Layup created from : /user2/manishj/" // @
"laminate/temp/spool by LAMINATE MODELER", 1, @
["Ply_1", ""], ["Paint", ""], [1, 0], ["Top", ""],@
[0., 0.], 0, [0.], [""], [0.], [0.], @
[""], 1, [5., 0.], [5., 0.], ["", ""], @
Main Index
CHAPTER 12 1445
Materials

TRUE, "Stan. Lam. Plate (CQUAD4/PCOMP)", @


FALSE, FALSE )

$? YESFORALL 29002020

#---------------------------------------------------------------------
# Argument Initialization.

AREASPEC = "ALL"
AN_CODE_NAME = "MSC/NASTRAN"
an_type_name = "Structural"
orientation = "angle"
prim_entity = ""
switch_angle_in = 0.
sec_entity = ""
num_tols = 1
ang_tols = [5., 0.]
thick_tols = [5., 0.]
tol_areas(1) = ""
tol_areas(2) = ""
element_type = "Rev. Lam. Plate (CQUADR/PCOMP)"
prefix = "LM_Layup."
first_laminate_id = 1
first_property_id = 1
preview = FALSE

#--------------------------------------------------------------------
# Create the laminate in the database.

i_return_value = P3CM.create_laminates_layup_2( areaspec, @


an_code_name, @
an_type_name, @
orientation, @
prim_entity, @
switch_angle_in, @
sec_entity, @
num_tols, @
ang_tols, @
thick_tols, @
tol_areas, @
element_type, @
prefix, @
first_laminate_id, @
first_property_id, @
preview )

$? YESFORALL 29002020

#---------------------------------------------------------------------
# Dump the status of the function.

dump i_return_value

#---------------------------------------------------------------------
# Closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

Main Index
1446
Code Examples

p3cm.create_layup_add_2 ()

# Purpose : This file provides an example of a call to the


# function P3CM.create_layup_add_2()
#
# This session file adds the new layup in the database.
#
# Before running this session file run spool.ses and
# 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 P3CM.create_layup_add_2()
# has the following arguments:
#
# P3CM.create_layup_add_2( layup_name, @
# layup_description, @
# num_plies, @
# ply_names, @
# type_names, @
# instances, @
# sides, @
# offsets, @
# num_offs, @
# off_values, @
# off_flags, @
# off_starts, @
# off_views, @
# off_areas, @
# num_tols, @
# ang_tols, @
# thick_tols, @
# tol_areas, @
# model_flag, @
# element_type, @
# solid_flag, @
# bacon_flag )
#
#---------------------------------------------------------------------
# Variable Decleration

STRING LAYUP_NAME[212]
STRING LAYUP_DESCRIPTION[212]
INTEGER num_plies
STRING ply_names[80](2)
STRING type_names[80](2)
INTEGER instances(2)
STRING sides[80](2)
REAL offsets(2)
INTEGER num_offs
REAL off_values(1)
STRING off_flags[80](1)
REAL off_starts(1)
REAL off_views(1)
STRING off_areas[80](1)
INTEGER num_tols
REAL ang_tols(2)
REAL thick_tols(2)
STRING tol_areas[80](2)
LOGICAL model_flag
STRING element_type[212]
Main Index
CHAPTER 12 1447
Materials

LOGICAL solid_flag
LOGICAL bacon_flag

INTEGER i_return_value

#---------------------------------------------------------------------
# Opening the file spool.db

uil_file_open.go( "./spool.db")

#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.

sys_library( "add", "laminate_modeler.plb" )

#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.

P3CM.new ( "./spool.Layup" )

#---------------------------------------------------------------------
# Add the new material in the database.

p3cm.create_material_add( "Paint", "Mat_1", "aluminum", 0.1, 0., 0. )

#---------------------------------------------------------------------
# Add the created ply in the database.

p3cm.create_ply_add_2( "Paint", "Mat_1", "Ply_1", @


[-2.0353413, 8., 3.8636858], @
[0.75, -0.5, -0.433], [0., 0., 0.], @
0., -1., -1., -1., 0, "", "", 1, 0, @
[0., 0., 0., 0.], 1, @
["Surface 4"], "" )

$? YES 59200001

#---------------------------------------------------------------------
# Argument Initialization.

LAYUP_NAME = "spool"
LAYUP_DESCRIPTION = "LM_Layup created from : ./spool by LAMINATE MODELER"
num_plies = 1

ply_names(1) = "Ply_1"
ply_names(2) = ""
type_names(1) = "Paint"
type_names(2) = ""

instances = [1, 0]

sides(1) = "Top"
sides(2) = ""

offsets = [0., 0.]


num_offs = 0
off_values = 0.
off_flags(1) = ""
off_starts(1) = 0.
off_views(1) = 0.
off_areas(1) = ""
num_tols = 1
ang_tols = [5., 0.]
thick_tols = [5., 0.]

tol_areas(1) = ""
tol_areas(2) = ""
Main Index
1448
Code Examples

model_flag = FALSE
element_type = "Stan. Lam. Plate (CQUAD4/PCOMP)"
solid_flag = FALSE
bacon_flag = FALSE

#---------------------------------------------------------------------
# Add the created layup in the database.

i_return_value = P3CM.create_layup_add_2( layup_name, @


layup_description, @
num_plies, @
ply_names, @
type_names, @
instances, @
sides, @
offsets, @
num_offs, @
off_values, @
off_flags, @
off_starts, @
off_views, @
off_areas, @
num_tols, @
ang_tols, @
thick_tols, @
tol_areas, @
model_flag, @
element_type, @
solid_flag, @
bacon_flag)

#---------------------------------------------------------------------
# Dump the status of the function.

dump i_return_value

#---------------------------------------------------------------------
# Closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

p3cm.create_material_add ()

# Purpose : This file provides an example of a call to the


# function P3CM.create_material_add()
#
# This session file adds the new material in the database.
#
# Before running this session file run spool.ses and
# 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 P3CM.create_material_add()
# has the following arguments:
#
# P3CM.create_material_add (type_name, @
Main Index
CHAPTER 12 1449
Materials

# material_name, @
# analysis_material_name, @
# thichness, @
# max_strain, @
# warp_weft_angle)
#
#
#---------------------------------------------------------------------
# Variable Decleration

STRING type_name[80]
STRING material_name[80]
STRING analysis_material_name[80]
REAL thichness
REAL max_strain
REAL warp_weft_angle
INTEGER i_return_value

#---------------------------------------------------------------------
# Opening the file spool.db

uil_file_open.go( "./spool.db")

#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.

sys_library( "add", "laminate_modeler.plb" )

#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.

P3CM.new ( "./spool.Layup" )

#---------------------------------------------------------------------
# Argument Initialization.

type_name = "Paint"
material_name = "Add_Material"
analysis_material_name = "aluminum"
thichness = 0.1
max_strain = 0.
warp_weft_angle = 0.

#---------------------------------------------------------------------
# Add the new material in the database.

i_return_value = P3CM.create_material_add (type_name, @


material_name, @
analysis_material_name, @
thichness, @
max_strain, @
warp_weft_angle)

#---------------------------------------------------------------------
# Dump the status of the function.

dump i_return_value

#---------------------------------------------------------------------
# Closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

Main Index
1450
Code Examples

p3cm.create_ply_add_2 ()

# Purpose : This file provides an example of a call to the


# function P3CM.create_ply_add_2()
#
# This session file adds the new ply in the database.
#
# Before running this session file run spool.ses and
# 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 P3CM.create_ply_add_2()
# has the following arguments:
#
# p3cm.create_ply_add_2(type_name, @
# material_name, @
# ply_name, @
# start_pt, @
# view_dirn, @
# ref_dirn, @
# ref_ang, @
# warp_weft_angle, @
# max_strain, @
# step_length, @
# axis_type, @
# warpaxis_str, @
# weftaxis_str, @
# extn_type, @
# max_sweeps, @
# bounds, @
# num_areas, @
# area_strs, @
# split_str)
#
#
#---------------------------------------------------------------------
# Variable Decleration

STRING type_name[80]
STRING material_name[80]
STRING ply_name[80]
REAL start_pt(3)
REAL view_dirn(3)
REAL ref_dirn(3)
REAL ref_ang
REAL warp_weft_angle
REAL max_strain
REAL step_length
INTEGER axis_type
STRING warpaxis_str[80]
STRING weftaxis_str[80]
INTEGER extn_type
INTEGER max_sweeps
REAL bounds(4)
INTEGER num_areas
STRING area_strs[80](1)
STRING split_str[80]

INTEGER i_return_value

Main Index
CHAPTER 12 1451
Materials

#---------------------------------------------------------------------
# Opening the file spool.db

uil_file_open.go( "./spool.db")

#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.

sys_library( "add", "laminate_modeler.plb" )

#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.

P3CM.new ( "./spool.Layup" )

#---------------------------------------------------------------------
# Add the new material in the database.

p3cm.create_material_add( "Paint", "Mat_1", "aluminum", 0.1, 0., 0. )

#---------------------------------------------------------------------
# Argument Initialization.

type_name = "Paint"
material_name = "Mat_1"
ply_name = "Ply_1"
start_pt = [-2.99985, 8., -3.4641883]
view_dirn = [0.75, -0.5, -0.433]
ref_dirn = [0., 0., 0.]
ref_ang = 0.
warp_weft_angle = -1.0
max_strain = -1.0
step_length = -1.0
axis_type = 0
warpaxis_str = ""
weftaxis_str = ""
extn_type = 1
max_sweeps = 0
bounds = [0., 0., 0., 0.]
num_areas = 1
area_strs(1) = "Surface 4"
split_str = ""

#---------------------------------------------------------------------
# Add the created ply in the database.

i_return_value = p3cm.create_ply_add_2 ( type_name, @


material_name, @
ply_name, @
start_pt, @
view_dirn, @
ref_dirn, @
ref_ang, @
warp_weft_angle, @
max_strain, @
step_length, @
axis_type, @
warpaxis_str, @
weftaxis_str, @
extn_type, @
max_sweeps, @
bounds, @
num_areas, @
area_strs, @
split_str)

#---------------------------------------------------------------------
Main Index
1452
Code Examples

# Dump the status of the function.

dump i_return_value

#---------------------------------------------------------------------
# Closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

p3cm.create_results_failure ()

# Purpose : This file provides an example of a call to the


# function P3CM.create_results_failure()
#
# This session file creates the Laminate Modeler
# results by using the Failure Calculation method.
#
# Before running this session file, run the session
# file plate_matid.ses and create result file
# plate_matid_res.op2 as per the instructions given in it.
# Import this result file plate_matid_res.op2 into
# plate_matid.db and open the plate_matib.Layup file.
#
# 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 P3CM.create_results_failure()
# has the following arguments:
#
# P3CM.create_results_failure ( res_name, @
# area, @
# criterion, @
# basis, @
# num_mats, @
# mat_names, @
# mat_allows, @
# name, @
# ply_sort, @
# ply_results, @
# failure_index, @
# reserve_factor, @
# margin_safety, @
# critical_component, @
# critical_ply)
#
#---------------------------------------------------------------------
# Variable Decleration

STRING res_name[80](5)
STRING area[80]
STRING criterion[80]
STRING basis[80]
INTEGER num_mats
STRING mat_names[80](virtual)
REAL mat_allows(virtual)
STRING name[80]
LOGICAL ply_sort
LOGICAL ply_results
LOGICAL failure_index
Main Index
CHAPTER 12 1453
Materials

LOGICAL reserve_factor
LOGICAL margin_safety
LOGICAL critical_component
LOGICAL critical_ply

INTEGER i_return_value

#---------------------------------------------------------------------
# Opening the file plate_matid.db

uil_file_open.go( "./plate_matid.db")

#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.

sys_library( "add", "laminate_modeler.plb" )

#---------------------------------------------------------------------
# Opening a Layup file.

P3CM.open( "./plate_matid.Layup" )

#---------------------------------------------------------------------
# Argument Initialization.

res_name(1) = "Default"
res_name(2) = "Static Subcase"
res_name(3) = "Stress Tensor"
res_name(4) = ""
res_name(5) = "none"
area = "Elm 7"
criterion = "Maximum"
basis = "STRESS"
num_mats = 8

sys_allocate_array(mat_names, 1, num_mats)

mat_names(1) = "mat.03"
mat_names(2) = "mat.04"
mat_names(3) = "mat.08"
mat_names(4) = "mat.09"
mat_names(5) = "mat.13"
mat_names(6) = "mat.14"
mat_names(7) = "mat.18"
mat_names(8) = "mat.19"

sys_allocate_array(mat_allows, 1, num_mats, 1, num_mats )

mat_allows = [[200.,200.,200.,200.,50.,50.,50.,0.] @
[200.,200.,200.,200.,50.,50.,50.,0.] @
[200.,200.,200.,200.,50.,50.,50.,0.] @
[200.,200.,200.,200.,50.,50.,50.,0.] @
[200.,200.,200.,200.,50.,50.,50.,0.] @
[200.,200.,200.,200.,50.,50.,50.,0.] @
[200.,200.,200.,200.,50.,50.,50.,0.] @
[200.,200.,200.,200.,50.,50.,50.,0.]]

name = ""
ply_sort = FALSE
ply_results = TRUE
failure_index = TRUE
reserve_factor = FALSE
margin_safety = TRUE
critical_component = TRUE
critical_ply = TRUE

#---------------------------------------------------------------------
Main Index
1454
Code Examples

# Create the LM results by using the Failure Calc method.

i_return_value = P3CM.create_results_failure ( res_name, @


area, @
criterion, @
basis, @
num_mats, @
mat_names, @
mat_allows, @
name, @
ply_sort, @
ply_results, @
failure_index, @
reserve_factor, @
margin_safety, @
critical_component, @
critical_ply)

#---------------------------------------------------------------------
# Dump the status of the function.

dump i_return_value

#---------------------------------------------------------------------
# Closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

p3cm.create_results_mid_sort ()

# Purpose : This file provides an example of a call to the


# function P3CM.create_results_mid_sort()
#
# This session file creates the LM results by
# using the material ids calculation method.
#
#
# Before running this session file, run the session
# file plate_matid.ses and create result file
# plate_matid_res.op2 as per the instructions given in it.
# Import this result file plate_matid_res.op2 into
# plate_matid.db and open the plate_matib.Layup file.
#
#
# 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 P3CM.create_results_mid_sort()
# has the following arguments:
#
# P3CM.create_results_mid_sort (res_name, @
# area, @
# num_mats, @
# mat_names)
#
#---------------------------------------------------------------------
# Variable Decleration

STRING res_name[80](5)
Main Index
CHAPTER 12 1455
Materials

STRING area[80]
INTEGER num_mats
STRING mat_names[80](virtual)

INTEGER i_return_value

#---------------------------------------------------------------------
# Opening the file plate_matid.db

uil_file_open.go( "./plate_matid.db")

#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.

sys_library( "add", "laminate_modeler.plb" )

#---------------------------------------------------------------------
# Opening a Layup file.

P3CM.open( "./plate_matid.Layup" )

#---------------------------------------------------------------------
# Argument Initialization.

res_name(1) = "Default"
res_name(2) = "Static Subcase"
res_name(3) = "Stress Tensor"
res_name(4) = ""
res_name(5) = "none"
area = "Elm 6"
num_mats = 1

sys_allocate_array(mat_names, 1, num_mats)

mat_names(1) = "mat.07"

#---------------------------------------------------------------------
# Create the LM results by using the mid_sort Calc method.

i_return_value = P3CM.create_results_mid_sort ( res_name, @


area, @
num_mats, @
mat_names)

#---------------------------------------------------------------------
# Dump the status of the function.

dump i_return_value

#---------------------------------------------------------------------
# Closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

p3cm.create_results_sort ()

# Purpose : This file provides an example of a call to the


# function P3CM.create_results_sort()
#
# This session file creates the Laminate Modeler
# results by using the LM_Ply Sorting method.
#
Main Index
1456
Code Examples

#
# Before running this session file, run the session
# file plate_matid.ses and create result file
# plate_matid_res.op2 as per the instructions given in it.
# Import this result file plate_matid_res.op2 into
# plate_matid.db and open the plate_matib.Layup file.
#
# 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 P3CM.create_results_sort()
# has the following arguments:
#
# P3CM.create_results_sort ( res_name )
#
#---------------------------------------------------------------------
# Variable Decleration

string res_name[256](5)
integer i_return_value

#---------------------------------------------------------------------
# Opening the file plate_matid.db

uil_file_open.go( "./plate_matid.db" )

#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.

sys_library( "add", "laminate_modeler.plb" )

#---------------------------------------------------------------------
# Opening a Layup file.

p3cm.open( "./plate_matid.Layup" )

#---------------------------------------------------------------------
# Argumant Initialization

res_name(1) = "Default"
res_name(2) = "Static Subcase"
res_name(3) = "Stress Tensor"
res_name(4) = ""
res_name(5) = "none"

#---------------------------------------------------------------------
# Create the LM results by using the LM_Ply Sort method.

i_return_value = p3cm.create_results_sort ( res_name)

#---------------------------------------------------------------------
# Dump the status of the function.

dump i_return_value

#---------------------------------------------------------------------
# Closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

Main Index
CHAPTER 12 1457
Materials

p3cm.delete_laminates ()

#
# Purpose : This file provides an example of a call to the
# function P3CM.delete_laminates ()
#
# This session file deletes a laminate from the database.
#
# Before running this session file run spool.ses and
# 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 P3CM.delete_laminates ()
# has the following arguments:
#
# P3CM.delete_laminates (num_laminates, laminates)
#
#---------------------------------------------------------------------
# Variable Decleration

INTEGER num_laminates
STRING laminates[80](virtual)
INTEGER i_return_value

#---------------------------------------------------------------------
# Opening the file spool.db

uil_file_open.go( "./spool.db")

#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.

sys_library( "add", "laminate_modeler.plb" )

#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.

P3CM.new ( "./spool.Layup" )

#---------------------------------------------------------------------
# Add the new material in the database.

p3cm.create_material_add( "Paint", "Mat_1", "aluminum", 0.1, 0., 0. )

#---------------------------------------------------------------------
# Add the created ply in the database.

p3cm.create_ply_add_2( "Paint", "Mat_1", "Ply_1", @


[-0.99995601, 8., 4.], @
[ 0.75, -0.5, -0.433], [0., 0., 0.], @
0., -1., -1., -1., 0, "", "", @
1, 0, [0., 0., 0., 0.], 1, @
["Surface 4"], "" )

$? YES 59200001

#---------------------------------------------------------------------
# Add the created layup in the database.

p3cm.create_layup_add_2( "spool", @
Main Index
1458
Code Examples

"LM_Layup created from : /user2/manishj/"// @


"laminate/temp/spool by LAMINATE MODELER", @
1, ["Ply_1", ""], ["Paint", ""], @
[1, 0], ["Top", ""], [0., 0.], 0, [0.], @
[""], [0.], [0.], [""], 1, [5., 0.], @
[ 5., 0.], ["", ""], TRUE, @
"Stan. Lam. Plate (CQUAD4/PCOMP)", @
FALSE, FALSE )

$? YES 59000040
$? YESFORALL 29002020

#---------------------------------------------------------------------
# Create the laminate in the database.

p3cm.create_laminates_layup( "ALL", "MSC/NASTRAN", @


"Structural", "angle", "", @
0., "", 1, [5., 0.], [5., 0.], @
["", ""], @
"Rev. Lam. Plate (CQUADR/PCOMP)", @
"LM_Layup.", 1, 1, FALSE )

$? YES 59000040
$? YESFORALL 29002020

#---------------------------------------------------------------------
# Argument Initialization.

num_laminates = 1
sys_allocate_array(laminates, 1, num_laminates)
laminates(1) = "spool_1"

#--------------------------------------------------
# Delete the laminate from the database.

i_return_value = P3CM.delete_laminates (num_laminates, laminates)

$? YES 59000001

#---------------------------------------------------------------------
# Dump the status of the function.

dump i_return_value

#---------------------------------------------------------------------
# Closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

p3cm.delete_material_name ()

# Purpose : This file provides an example of a call to the


# function P3CM.delete_material_name()
#
# This session file deletes the existing material.
#
# Before running this session file run spool.ses and
# 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
Main Index
CHAPTER 12 1459
Materials

# on the menu bar.


#
#
# The function P3CM.delete_material_name()
# has the following arguments:
#
# P3CM.delete_material_name (type_name, @
# material_name)
#
#
#---------------------------------------------------------------------
# Variable Decleration

STRING type_name[80]
STRING material_name[80]
INTEGER i_return_value

#---------------------------------------------------------------------
# Opening the file spool.db

uil_file_open.go( "./spool.db")

#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.

sys_library( "add", "laminate_modeler.plb" )

#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.

P3CM.new ( "./spool.Layup" )

#---------------------------------------------------------------------
# Add the new material in the database.

p3cm.create_material_add( "Paint", "Add_Material", @


"aluminum", 0.1, 0., 0. )

#---------------------------------------------------------------------
# Argument Initialization.

type_name = "Paint"
material_name = "Add_Material"

#---------------------------------------------------------------------
# Delete the existing material.

i_return_value = P3CM.delete_material_name ( type_name, @


material_name)

#---------------------------------------------------------------------
# Dump the status of the function.

dump i_return_value

#---------------------------------------------------------------------
# Closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

Main Index
1460
Code Examples

p3cm.delete_ply_name ()

# Purpose : This file provides an example of a call to the


# function P3CM.delete_ply_name()
#
# This session file deletes the ply name from the database.
#
# Before running this session file run spool.ses and
# 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 P3CM.delete_ply_name()
# has the following arguments:
#
# P3CM.delete_ply_name (type_name, ply_name)
#
#
#---------------------------------------------------------------------
# Variable Decleration

STRING type_name[80]
STRING ply_name[80]
INTEGER i_return_value

#---------------------------------------------------------------------
# Opening the file spool.db

uil_file_open.go( "./spool.db")

#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.

sys_library( "add", "laminate_modeler.plb" )

#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.

P3CM.new ( "./spool.Layup" )

#---------------------------------------------------------------------
# Add the new material in the database.

p3cm.create_material_add( "Paint", "Mat_1", "aluminum", 0.1, 0., 0. )

#---------------------------------------------------------------------
# Add the created ply in the database.

P3CM.create_ply_add_2 ( "Paint", "Mat_1", "Ply_1", @


[-2.99985, 8., -3.4641883], @
[0.75, -0.5, -0.433], @
[0., 0., 0.],0., -1., -1., @
-1., 0, "", "", 1, 0, @
[0., 0., 0., 0.], 1, @
["Surface 4"], "" )
$? YES 59200001

#---------------------------------------------------------------------
# Argument Initialization.

type_name = "Paint"
Main Index
CHAPTER 12 1461
Materials

ply_name = "Ply_1"

#---------------------------------------------------------------------
# Delete the created ply.

i_return_value = P3CM.delete_ply_name (type_name, ply_name)

#---------------------------------------------------------------------
# Dump the status of the function.

dump i_return_value

#---------------------------------------------------------------------
# Closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

p3cm.delete_propsets ()

# Purpose : This file provides an example of a call to the


# function P3CM.delete_propsets ()
#
# This session file deletes the properties sets
# from the database.
#
# Before running this session file run spool.ses and
# 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 P3CM.delete_propsets ()
# has the following arguments:
#
# P3CM.delete_propsets (num_propsets, propsets)
#
#---------------------------------------------------------------------
# Variable Decleration

INTEGER num_propsets
STRING propsets[80](virtual)
INTEGER i_return_value

#---------------------------------------------------------------------
# Opening the file spool.db

uil_file_open.go( "./spool.db")

#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.

sys_library( "add", "laminate_modeler.plb" )

#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.

P3CM.new ( "./spool.Layup" )

#---------------------------------------------------------------------
# Add the new material in the database.
Main Index
1462
Code Examples

p3cm.create_material_add( "Paint", "Mat_1", "aluminum", 0.1, 0., 0. )

#---------------------------------------------------------------------
# Add the created ply in the database.

p3cm.create_ply_add_2( "Paint", "Mat_1", "Ply_1", @


[-0.99995601, 8., 4.], @
[0.75, -0.5, -0.433], @
[0., 0., 0.], 0., -1., @
-1., -1., 0, "", "", 1, 0, @
[0., 0., 0., 0.], 1, @
["Surface 4"], "" )

$? YES 59200001

#---------------------------------------------------------------------
# Add the created layup in the database.

p3cm.create_layup_add_2( "spool", @
"LM_Layup created from : /user2/manishj/"// @
"laminate/temp/spool by LAMINATE MODELER", @
1, ["Ply_1", ""], ["Paint", ""], @
[1, 0], ["Top", ""], [0., 0.], 0, @
[0.], [""], [0.], [0.], [""], @
1, [5., 0.], [ 5., 0.], ["", ""], TRUE, @
"Stan. Lam. Plate (CQUAD4/PCOMP)", @
FALSE, FALSE )

$? YES 59000040
$? YESFORALL 29002020

#---------------------------------------------------------------------
# Create the laminate in the database.

p3cm.create_laminates_layup( "ALL", "MSC/NASTRAN", @


"Structural", "angle", @
"", 0., "", 1, [5., 0.], @
[5., 0.], ["", ""], @
"Rev. Lam. Plate (CQUADR/PCOMP)", @
"LM_Layup.", 1, 1, FALSE )

$? YES 59000040
$? YESFORALL 29002020

#---------------------------------------------------------------------
# Argument Initialization.

num_propsets = 1
sys_allocate_array(propsets, 1, num_propsets)
propsets(1) = "LM_Layup.1"

#---------------------------------------------------------------------
# Delete the properties sets from the database.

i_return_value = P3CM.delete_propsets (num_propsets, propsets)

$? YES 59000001

#---------------------------------------------------------------------
# Dump the status of the function.

dump i_return_value

#---------------------------------------------------------------------
# Closing the patran environment.
Main Index
CHAPTER 12 1463
Materials

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

p3cm.import_model_file_2 ()

# Purpose : This file provides an example of a call to the


# function P3CM.import_model_file_2()
#
# This session file imports the model file which
# includes mesh & material status.
#
# Before running this session file run spool.ses and
# 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 P3CM.import_model_file_2()
# has the following arguments:
#
# P3CM.import_model_file_2 (mesh, @
# materials, @
# node_id_offsets, @
# elem_id_offset, @
# create_group, @
# group_name)
#
#---------------------------------------------------------------------
# Variable Decleration

LOGICAL mesh
LOGICAL materials
INTEGER node_id_offsets
INTEGER elem_id_offset
LOGICAL create_group
STRING group_name[80]
INTEGER i_return_value

#---------------------------------------------------------------------
# Opening the file spool.db

uil_file_open.go( "./spool.db")

#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.

sys_library( "add", "laminate_modeler.plb" )

#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.

P3CM.new ( "./spool.Layup" )

#---------------------------------------------------------------------
# Argument Initialization.

mesh = TRUE
materials = TRUE
node_id_offsets = 1200
elem_id_offset = 1152
Main Index
1464
Code Examples

create_group = TRUE
group_name = "spool"

#---------------------------------------------------------------------
# Set all export options.

i_return_value = P3CM.import_model_file_2 ( mesh, @


materials, @
node_id_offsets, @
elem_id_offset, @
create_group, @
group_name)

#---------------------------------------------------------------------
# Dump the status of the function.

dump i_return_value

#---------------------------------------------------------------------
# Closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

p3cm.import_plies_file_2 ()

# Purpose : This file provides an example of a call to the


# function p3cm.import_plies_file_2 ()
#
# This session file imports the plies file from the
database.
#
# Before running this session file run spool.ses and
# 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 p3cm.import_plies_file_2 ()
# has the following arguments:
#
# p3cm.import_plies_file_2 ( num_files, @
# files, @
# angle_tolerance, @
# distance_tolerance, @
# create_layup, @
# preview, @
# merge_nodes)
#
#---------------------------------------------------------------------
# Variable Decleration

INTEGER num_files
STRING files[80](virtual)
REAL angle_tolerance, distance_tolerance
LOGICAL create_layup,preview,merge_nodes

INTEGER i_return_value

#---------------------------------------------------------------------
Main Index
CHAPTER 12 1465
Materials

# Opening the file spool.db

uil_file_open.go( "./spool.db")

#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.

sys_library( "add", "laminate_modeler.plb" )

#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.

P3CM.new ( "./spool.Layup" )

#---------------------------------------------------------------------
# Add the new material in the database.

p3cm.create_material_add( "Paint", "Mat_1", "aluminum", 0.5, 0., 0. )

#---------------------------------------------------------------------
# Add the created ply in the database.

p3cm.create_ply_add_2( "Paint", "Mat_1", "Ply_1", @


[-0.99995601, 8., 4.], @
[0.75, -0.5, -0.433], @
[0., 0., 0.], 0., -1., @
-1., -1., 0, "", "", 1, @
0, [0., 0., 0., 0.], 1, @
["Surface 4"], "" )

$? YES 59200001

p3cm.create_ply_add_2( "Paint", "Mat_1", "Ply_2", @


[-0.99995601, 8., 4.], @
[0.75, -0.5, -0.433], @
[1., 0., 0.], 0., -1., @
-1., -1., 0, "", "", 1, @
0, [0., 0., 0., 0.], 1, @
["Surface 4"], "" )

$? YES 59200001

#---------------------------------------------------------------------
# Save the database.

p3cm.save_as_2("./spool.Layup", 0)

#---------------------------------------------------------------------
# Argument Initialization.

num_files = 1

sys_allocate_array(files, 1, num_files)

files(1) = "./spool.Layup"
angle_tolerance = 25.
distance_tolerance = 5.
create_layup = TRUE
preview = TRUE
merge_nodes = TRUE

#---------------------------------------------------------------------
# Import the plies file from the database.

i_return_value = p3cm.import_plies_file_2 ( num_files, @


files, @
angle_tolerance, @
Main Index
1466
Code Examples

distance_tolerance, @
create_layup, @
preview, @
merge_nodes)
$? YESFORALL 59200001

#---------------------------------------------------------------------
# Dump the status of the function.

dump i_return_value

#---------------------------------------------------------------------
# Closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

p3cm.modify_material ()

# Purpose : This file provides an example of a call to the


# function P3CM.modify_material()
#
# This session file modifies the existing material.
#
# Before running this session file run spool.ses and
# 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 P3CM.modify_material()
# has the following arguments:
#
# P3CM.modify_material (type_name, @
# Add_material_name, @
# Modified_material_name, @
# analysis_material_name, @
# thickness, @
# max_strain, @
# warp_weft_angle)
#
#
#---------------------------------------------------------------------
# Variable Decleration

STRING type_name[80]
STRING Add_material_name[80]
STRING Modified_material_name[80]
STRING analysis_material_name[80]
REAL thickness
REAL max_strain
REAL warp_weft_angle
INTEGER i_return_value

#---------------------------------------------------------------------
# Opening the file spool.db

uil_file_open.go( "./spool.db")

#---------------------------------------------------------------------
Main Index
CHAPTER 12 1467
Materials

# Add the system library for Laminate Modeler.

sys_library( "add", "laminate_modeler.plb" )

#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.

P3CM.new ( "./spool.Layup" )

#---------------------------------------------------------------------
# Add the new material in the database.

p3cm.create_material_add( "Paint", "Add_Material", @


"aluminum", 0.1, 0., 0. )

#---------------------------------------------------------------------
# Argument Initialization.

type_name = "Paint"
Add_material_name = "Add_Material"
Modified_material_name = "Modified_Material"
analysis_material_name = "aluminum"
thichness = 0.1
max_strain = 0.
warp_weft_angle = 0.

#---------------------------------------------------------------------
# Modified the existing material.

i_return_value = P3CM.modify_material ( type_name, @


Add_material_name, @
Modified_material_name, @
analysis_material_name, @
thickness, @
max_strain, @
warp_weft_angle)

#---------------------------------------------------------------------
# Dump the status of the function.

dump i_return_value

#---------------------------------------------------------------------
# Closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

p3cm.modify_ply ()

# Purpose : This file provides an example of a call to the


# function P3CM.modify_ply()
#
# This session file modifies the old ply in the database.
#
# Before running this session file run spool.ses and
# 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.
#
Main Index
1468
Code Examples

#
# The function P3CM.modify_ply()
# has the following arguments:
#
# P3CM.modify_ply ( type_name, @
# material_name, @
# old_ply_name, @
# modified_ply_name, @
# start_pt, @
# view_dirn, @
# ref_dirn, @
# ref_ang, @
# warp_weft_angle, @
# max_strain, @
# step_length, @
# axis_type, @
# warpaxis_str, @
# weftaxis_str, @
# extn_type, @
# max_sweeps, @
# bounds, @
# num_areas, @
# area_strs, @
# split_str)
#
#
#---------------------------------------------------------------------
# Variable Decleration

STRING type_name[80]
STRING material_name[80]
STRING old_ply_name[80]
STRING modified_ply_name[80]
REAL start_pt(3)
REAL view_dirn(3)
REAL ref_dirn(3)
REAL ref_ang
REAL warp_weft_angle
REAL max_strain
REAL step_length
INTEGER axis_type
STRING warpaxis_str[80]
STRING weftaxis_str[80]
INTEGER extn_type
INTEGER max_sweeps
REAL bounds(4)
INTEGER num_areas
STRING area_strs[80](1)
STRING split_str[80]

INTEGER i_return_value

#---------------------------------------------------------------------
# Opening the file spool.db

uil_file_open.go( "./spool.db")

#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.

sys_library( "add", "laminate_modeler.plb" )

#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.

P3CM.new ( "./spool.Layup" )
Main Index
CHAPTER 12 1469
Materials

#---------------------------------------------------------------------
# Add the new material in the database.

p3cm.create_material_add( "Paint", "Mat_1", "aluminum", 0.1, 0., 0. )

#---------------------------------------------------------------------
# Add the created ply in the database.

P3CM.create_ply_add_2 ( "Paint", "Mat_1", "Ply_1", @


[-2.99985, 8., -3.4641883], @
[0.75, -0.5, -0.433], @
[0., 0., 0.],0., -1., -1., -1., 0, @
"", "", 1, 0, [0., 0., 0., 0.], 1, @
["Surface 4"], "" )

$? YES 59200001

#---------------------------------------------------------------------
# Argument Initialization.

type_name = "Paint"
material_name = "Mat_1"
old_ply_name = "Ply_1"
modified_ply_name = "Ply_1"
start_pt = [-2.4004319, 7.9241023, -0.8087222]
view_dirn = [0., 1., 0.]
ref_dirn = [0., 0., 0.]
ref_ang = 0.
warp_weft_angle = -1.0
max_strain = -1.0
step_length = -1.0
axis_type = 0
warpaxis_str = ""
weftaxis_str = ""
extn_type = 1
max_sweeps = 0
bounds = [0., 0., 0., 0.]
num_areas = 1
area_strs(1) = "Surface 5"
split_str = ""

#---------------------------------------------------------------------
# Modify the ply in the database.

i_return_value = P3CM.modify_ply ( type_name, @


material_name, @
old_ply_name, @
modified_ply_name, @
start_pt, @
view_dirn, @
ref_dirn, @
ref_ang, @
warp_weft_angle, @
max_strain, @
step_length, @
axis_type, @
warpaxis_str, @
weftaxis_str, @
extn_type, @
max_sweeps, @
bounds, @
num_areas, @
area_strs, @
split_str)

$? YES 59200001
Main Index
1470
Code Examples

#---------------------------------------------------------------------
# Dump the status of the function.

dump i_return_value

#---------------------------------------------------------------------
# Closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

p3cm.new ()

# Purpose : This file provides an example of a call to the


# function P3CM.new()
#
# This session file opens a new Layup file for
# begining the LAMINATE MODELER session.
#
# Before running this session file run spool.ses and
# 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 P3CM.new()
# has the following arguments:
#
# P3CM.new ( value )
#
#---------------------------------------------------------------------
# Variable Decleration

String value[256]
integer i_return_value

#---------------------------------------------------------------------
# Opening the file spool.db

uil_file_open.go( "./spool.db")

#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.

sys_library( "add", "laminate_modeler.plb" )

#--------------------------------------------------------------
# Argument Initialization

value = "./spool.Layup"

#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.

i_return_value = P3CM.new ( value )

#---------------------------------------------------------------------
# Dump the status of the function.
Main Index
CHAPTER 12 1471
Materials

dump i_return_value

#---------------------------------------------------------------------
# Closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

p3cm.set_offsets ()

# Purpose : This file provides an example of a call to the


# function P3CM.set_offsets()
#
# This session file sets the offsets data for layup.
#
# Before running this session file run spool.ses and
# 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 P3CM.set_offsets()
# has the following arguments:
#
# P3CM.set_offsets( num_offs, @
# off_values, @
# off_flags, @
# off_starts, @
# off_views, @
# off_areas )
#
#---------------------------------------------------------------------
# Variable Decleration

INTEGER num_offs
REAL off_values(2)
STRING off_flags[80](2)
REAL off_starts(4)
REAL off_views(4)
STRING off_areas[80](2)
INTEGER i_return_value

#---------------------------------------------------------------------
# Opening the file spool.db

uil_file_open.go( "./spool.db")

#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.

sys_library( "add", "laminate_modeler.plb" )

#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.

P3CM.new ( "./spool.Layup" )

#---------------------------------------------------------------------
# Add the new material in the database.
Main Index
1472
Code Examples

p3cm.create_material_add( "Paint", "Mat_1", "aluminum", 0.1, 0., 0. )

#---------------------------------------------------------------------
# Add the created ply in the database.

p3cm.create_ply_add_2( "Paint", "Mat_1", "Ply_1", @


[-2.0353413, 8., 3.8636858], @
[0.75, -0.5, -0.433], [0., 0., 0.], @
0., -1., -1., -1., 0, "", "", 1, 0, @
[0., 0., 0., 0.], 1, @
["Surface 4"], "" )

$? YES 59200001
#---------------------------------------------------------------------
# Argument Initialization.

num_offs = 1
off_values = [10., 0.]
off_starts = [0.76763952, 8., 1.7678945, 0.]
off_views = [0.75, -0.5, -0.433, 0.]
off_flags(1) = "1"
off_flags(2) = ""
off_areas(1) = "Surface 4"
off_areas(2) = ""

#---------------------------------------------------------------------
# Set the offsets data for layup.

i_return_value = P3CM.set_offsets( num_offs, @


off_values, @
off_flags, @
off_starts, @
off_views, @
off_areas)

#---------------------------------------------------------------------
# Dump the status of the function.

dump i_return_value

#---------------------------------------------------------------------
# Closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

p3cm.open ()

# Purpose : This file provides an example of a call to the


# function P3CM.open()
#
# This session file opens a existing Layup file.
#
# Before running this session file run spool.ses and
# 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 P3CM.open()
Main Index
CHAPTER 12 1473
Materials

# has the following arguments:


#
# P3CM.open ( value )
#
#---------------------------------------------------------------------
# Variable Decleration

string value[256]
integer i_return_value

#---------------------------------------------------------------------
# Opening the file spool.db

uil_file_open.go( "./spool.db")

#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.

sys_library( "add", "laminate_modeler.plb" )

#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.

P3CM.new ( "./spool.Layup" )

#---------------------------------------------------------------------
# Add the new material in the database.

p3cm.create_material_add( "Paint", "Mat_1", "aluminum", 0.1, 0., 0. )

#---------------------------------------------------------------------
# Close the Layup file.

p3cm.close_2( 0 )

#---------------------------------------------------------------------
# Argument Initialization.

value = "./spool.Layup"

#---------------------------------------------------------------------
# Open the existing Layup file spool.Layup.

i_return_value = p3cm.open( value )

#---------------------------------------------------------------------
# Dump the status of the function.

dump i_return_value

#---------------------------------------------------------------------
# Closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

p3cm.save_as_2 ()

# Purpose : This file provides an example of a call to the


# function P3CM.save_as_2()
#
# This session file saves the existing Layup file
# into the given file.
Main Index
1474
Code Examples

#
# Before running this session file run spool.ses and
# 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 P3CM.save_as_2()
# has the following arguments:
#
# P3CM.save_as_2 ( value , detail )
#
#---------------------------------------------------------------------
# Variable Decleration

STRING value[256]
INTEGER detail
INTEGER i_return_value

#---------------------------------------------------------------------
# Opening the file spool.db

uil_file_open.go( "./spool.db")

#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.

sys_library( "add", "laminate_modeler.plb" )

#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.

P3CM.new ( "./spool.Layup" )

#---------------------------------------------------------------------
# Add the new material in the database.

p3cm.create_material_add( "Paint", "Mat_1", "aluminum", 0.1, 0., 0. )

#---------------------------------------------------------------------
# Argument Initialization.

value = "./spool_bak.Layup"
detail = 0

#---------------------------------------------------------------------
# Save as the Spool_bak.Layup file.

i_return_value = p3cm.save_as_2(value , detail)

#---------------------------------------------------------------------
# Dump the status of the function.

dump i_return_value

#---------------------------------------------------------------------
# Closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

Main Index
CHAPTER 12 1475
Materials

p3cm.set_export_options_2 ()

# Purpose : This file provides an example of a call to the


# function P3CM.set_export_options_2()
#
# This session file sets all export options.
#
# Before running this session file run spool.ses and
# 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 P3CM.set_export_options_2()
# has the following arguments:
#
# P3CM.set_export_options_2 (draped_pattern_iges, @
# draped_pattern_dxf, @
# flat_pattern_iges, @
# flat_pattern_dxf, @
# mold_surface_iges, @
# curve, @
# layer)
#
#
#---------------------------------------------------------------------
# Variable Decleration

LOGICAL draped_pattern_iges
LOGICAL draped_pattern_dxf
LOGICAL flat_pattern_iges
LOGICAL flat_pattern_dxf
LOGICAL mold_surface_iges
STRING curve[80]
STRING layer[80]
INTEGER i_return_value

#---------------------------------------------------------------------
# Opening the file spool.db

uil_file_open.go( "./spool.db")

#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.

sys_library( "add", "laminate_modeler.plb" )

#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.

P3CM.new ( "./spool.Layup" )

#---------------------------------------------------------------------
# Argument Initialization.

draped_pattern_iges = TRUE
draped_pattern_dxf = TRUE
flat_pattern_iges = TRUE
flat_pattern_dxf = TRUE
mold_surface_iges = TRUE
curve = "SPLINE"
layer = "POLYLINE"
Main Index
1476
Code Examples

#---------------------------------------------------------------------
# Set all export options.

i_return_value = P3CM.set_export_options_2 ( draped_pattern_iges, @


draped_pattern_dxf, @
flat_pattern_iges, @
flat_pattern_dxf, @
mold_surface_iges, @
curve, @
layer)

#---------------------------------------------------------------------
# Dump the status of the function.

dump i_return_value

#---------------------------------------------------------------------
# Closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

p3cm.set_graphics_options_2 ()

# Purpose : This file provides an example of a call to the


# function P3CM.set_graphics_options_2()
#
# This session file sets all display options using
# laminate modeler ply graphics options also.
#
# Before running this session file run spool.ses and
# 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 P3CM.set_graphics_options_2()
# has the following arguments:
#
# P3CM.set_graphics_options_2 (message, @
# ply_graphics, @
# layup_graphics, @
# material, @
# app_direction, @
# ref_direction, @
# max_strain, @
# selected_area, @
# flat_pattern, @
# draped_pattern, @
# surface_offset, @
# angles, @
# offset_val, @
# scale)
#
#
#---------------------------------------------------------------------
# Variable Decleration

LOGICAL message
Main Index
CHAPTER 12 1477
Materials

LOGICAL ply_graphics
LOGICAL layup_graphics
LOGICAL material
LOGICAL app_direction
LOGICAL ref_direction
LOGICAL max_strain
LOGICAL selected_area
LOGICAL flat_pattern
LOGICAL draped_pattern
LOGICAL surface_offset
LOGICAL angles
REAL offset_val
REAL scale
INTEGER i_return_value

#---------------------------------------------------------------------
# Opening the file spool.db

uil_file_open.go( "./spool.db")

#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.

sys_library( "add", "laminate_modeler.plb" )

#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.

P3CM.new ( "./spool.Layup" )

#---------------------------------------------------------------------
# Argument Initialization.

message = FALSE
ply_graphics = TRUE
layup_graphics = TRUE
material = FALSE
app_direction = TRUE
ref_direction = TRUE
max_strain = TRUE
selected_area = TRUE
flat_pattern = TRUE
draped_pattern = TRUE
surface_offset = TRUE
angles = FALSE
offset_val = 2.0
scale = 1.8

#---------------------------------------------------------------------
# Set all display options using LM ply graphics options also.

i_return_value = P3CM.set_graphics_options_2 ( message, @


ply_graphics, @
layup_graphics, @
material, @
app_direction, @
ref_direction, @
max_strain, @
selected_area, @
flat_pattern, @
draped_pattern, @
surface_offset, @
angles, @
offset_val, @
scale)

#---------------------------------------------------------------------
Main Index
1478
Code Examples

# Dump the status of the function.

dump i_return_value

#---------------------------------------------------------------------
# Closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

p3cm.set_tolerance ()

# Purpose : This file provides an example of a call to the


# function P3CM.set_tolerance()
#
# This session file sets the tolerance data for Laminate
# modeler layup.
#
# Before running this session file run spool.ses and
# 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 P3CM.set_tolerance()
# has the following arguments:
#
# P3CM.set_tolerance ( num_tols, @
# ang_tols, @
# thick_tols, @
# tol_areas)
#
#---------------------------------------------------------------------
# Variable Decleration

INTEGER num_tols
REAL ang_tols(virtual)
REAL thick_tols(virtual)
STRING tol_areas[80](virtual)

INTEGER row
INTEGER i_return_value

#---------------------------------------------------------------------
# Opening the file spool.db

uil_file_open.go( "./spool.db")

#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.

sys_library( "add", "laminate_modeler.plb" )

#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.

P3CM.new ( "./spool.Layup" )

#---------------------------------------------------------------------
# Add the new material in the database.
Main Index
CHAPTER 12 1479
Materials

p3cm.create_material_add( "Paint", "Mat_1", "aluminum", 0.1, 0., 0. )

#---------------------------------------------------------------------
# Add the created ply in the database.

p3cm.create_ply_add_2( "Paint", "Mat_1", "Ply_1", @


[-0.99995601, 8., 4.], @
[0.75, -0.5, -0.433], @
[0., 0., 0.], 0., -1., @
-1., -1., 0, "", "", @
1, 0, [0., 0., 0., 0.], @
1, ["Surface 4"], "" )

$? YES 59200001

#---------------------------------------------------------------------
# Argument Initialization.

num_tols = 1
row = num_tols +1

sys_allocate_array(ang_tols, 1, row)
sys_allocate_array(thick_tols, 1, row)
sys_allocate_array(tol_areas, 1, row)

ang_tols = [5., 0.]


thick_tols = [5., 0.]
tol_areas(1) = ""
tol_areas(2) = ""

#--------------------------------------------------------------------
# Set the tolerance data for the layup.

i_return_value = P3CM.set_tolerance ( num_tols, @


ang_tols, @
thick_tols, @
tol_areas)

$? YESFORALL 29002020

#---------------------------------------------------------------------
# Dump the status of the function.

dump i_return_value

#---------------------------------------------------------------------
# Closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

p3cm.show_laminate ()

# Purpose : This file provides an example of a call to the


# function P3CM.show_laminate ()
#
# This session file shows the laminate.
#
# Before running this session file run spool.ses and
# create spool.db.
#
Main Index
1480
Code Examples

# 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 P3CM.show_laminate ()
# has the following arguments:
#
# P3CM.show_laminate ( elem_vstr, @
# nprop, @
# prop, @
# nlam, @
# lam, @
# property, @
# display_method, @
# scale, @
# nlay, @
# lay)
#
#---------------------------------------------------------------------
# Variable Decleration

STRING elem_vstr[512]
INTEGER nprop
STRING prop[80](1)
INTEGER nlam
INTEGER lam(1)
STRING property[80]
STRING display_method[80]
REAL scale
INTEGER nlay
INTEGER lay(1)

INTEGER i_return_value

#---------------------------------------------------------------------
# Opening the file spool.db

uil_file_open.go( "./spool.db")

#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.

sys_library( "add", "laminate_modeler.plb" )

#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.

P3CM.new ( "./spool.Layup" )

#---------------------------------------------------------------------
# Add the new material in the database.

p3cm.create_material_add( "Paint", "Mat_1", "aluminum", 0.1, 0., 0. )

#---------------------------------------------------------------------
# Add the created ply in the database.

p3cm.create_ply_add_2( "Paint", "Mat_1", "Ply_1", @


[1.0000571, 8., 3.4640687], @
[0.75, -0.5, -0.433], [0., 0., 0.], @
0., -1., -1., -1., 0, "", "", 1, 0, @
[0., 0., 0., 0.], 1, ["Surface 4"], "" )

$? YES 59200001
Main Index
CHAPTER 12 1481
Materials

#---------------------------------------------------------------------
# Add the created layup in the database.

p3cm.create_layup_add_2( "spool", @
"LM_Layup created from : ./spool by LAMINATE MODELER", @
1, ["Ply_1", ""], ["Paint", ""], [1, 0], ["Top", ""], @
[0., 0.], 0, [0.], [""], [ 0.], [0.], [""], 1, [5., 0.], @
[5., 0.], ["", ""], FALSE, @
"Stan. Lam. Plate (CQUAD4/PCOMP)", FALSE, FALSE )

$? YES 59000040
$? YESFORALL 29002020

#---------------------------------------------------------------------
# Create the laminate in the database.

p3cm.create_laminates_layup( "ALL", "MSC/NASTRAN", "Structural", @


"laminate_only", "", 0., "", 1, @
[5., 0.], [5., 0.], ["", ""], @
"Stan. Lam. Plate (CQUAD4/PCOMP)", @
"LM_Layup.", 1, 1, FALSE )

$? YES 59000040
$? YESFORALL 29002020

#---------------------------------------------------------------------
# Argument Initialization.

elem_vstr = "Elm 332"


nprop = 1
prop(1) = "LM_Layup.20"
nlam = 1
lam(1) = 21
property = "Orientation"
display_method = "Vector"
scale = 1.
nlay = 1
lay(1) = 1

#---------------------------------------------------------------------
# Show the laminate.

i_return_value = P3CM.show_laminate ( elem_vstr, @


nprop, @
prop, @
nlam, @
lam, @
property, @
display_method, @
scale, @
nlay, @
lay)

#---------------------------------------------------------------------
# Dump the status of the function.

dump i_return_value

#---------------------------------------------------------------------
# Closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.
Main Index
1482
Code Examples

p3cm.show_layup_exploded ()

# Purpose : This file provides an example of a call to the


# function p3cm.show_layup_exploded()
#
# This session file shows the exploded layup.
#
# Before running this session file run spool.ses and
# 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 p3cm.show_layup_exploded()
# has the following arguments:
#
# p3cm.show_layup_exploded ( num_selected, @
# index, @
# offset_mult)
#
#---------------------------------------------------------------------
# Variable Decleration

INTEGER num_selected
INTEGER index(1)
REAL offset_mult
INTEGER i_return_value

#---------------------------------------------------------------------
# Opening the file spool.db

uil_file_open.go( "./spool.db")

#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.

sys_library( "add", "laminate_modeler.plb" )

#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.

P3CM.new ( "./spool.Layup" )

#---------------------------------------------------------------------
# Add the new material in the database.

p3cm.create_material_add( "Paint", "Mat_1", "aluminum", 0.1, 0., 0. )

#---------------------------------------------------------------------
# Add the created ply in the database.

p3cm.create_ply_add_2( "Paint", "Mat_1", "Ply_1", @


[0.035210636, 8., 3.8637209] , @
[0.75, -0.5, -0.433], [0., 0., 0.], @
0., -1., -1., -1., 0, "", "", 1, 0, @
[0., 0., 0., 0.], 1, ["Surface 4"], "" )

$? YES 59200001

#---------------------------------------------------------------------
# Add the created layup in the database.

Main Index
CHAPTER 12 1483
Materials

p3cm.create_layup_add_2( "spool", @
"LM_Layup created from : /user2/manishj/"// @
"laminate/spool by LAMINATE MODELER", 1, @
["Ply_1", ""], ["Paint", ""], [1, 0], @
["Top", ""], [0., 0.], 0, [0.], [""], @
[0.], [0.], [""], 1, [5., 0.], [5., 0.], @
["", ""], FALSE, @
"Stan. Lam. Plate (CQUAD4/PCOMP)", @
TRUE, TRUE )

#---------------------------------------------------------------------
# Argument Initialization.

num_selected = 1
index(1) = 1
offset_mult = 1.

#---------------------------------------------------------------------
# Shows the exploded layup.

i_return_value = p3cm.show_layup_exploded( num_selected, @


index, @
offset_mult)

#---------------------------------------------------------------------
# Dump the status of the function.

dump i_return_value

#---------------------------------------------------------------------
# Closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

p3cm.show_ply ()

# Purpose : This file provides an example of a call to the


# function P3CM.show_ply()
#
# This session file shows the new ply in the database.
#
# Before running this session file run spool.ses and
# 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 P3CM.show_ply()
# has the following arguments:
#
# P3CM.show_ply ( type_id_name, @
# ply_name, @
# plot_flag)
#
#
#---------------------------------------------------------------------
# Variable Decleration
Main Index
1484
Code Examples

STRING type_id_name[80]
STRING ply_name[80]
LOGICAL plot_flag

INTEGER i_return_value

#---------------------------------------------------------------------
# Opening the file spool.db

uil_file_open.go( "./spool.db")

#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.

sys_library( "add", "laminate_modeler.plb" )

#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.

P3CM.new ( "./spool.Layup" )

#---------------------------------------------------------------------
# Add the new material in the database.

p3cm.create_material_add( "Paint", "Mat_1", "aluminum", 0.1, 0., 0. )

#---------------------------------------------------------------------
# Add the created ply in the database.

P3CM.create_ply_add_2 ( "Paint", "Mat_1", "Ply_1", @


[-2.99985, 8., -3.4641883], @
[0.75, -0.5, -0.433], @
[0., 0., 0.],0., -1., -1., -1., 0, @
"", "", 1, 0, [0., 0., 0., 0.], 1, @
["Surface 4"], "" )

$? YES 59200001

#---------------------------------------------------------------------
# Argument Initialization.

type_id_name = "1"
ply_name = "Ply_1"
plot_flag = TRUE

#---------------------------------------------------------------------
# Show the created ply.

i_return_value = P3CM.show_ply (type_id_name, ply_name, plot_flag)

#---------------------------------------------------------------------
# Dump the status of the function.

dump i_return_value

#---------------------------------------------------------------------
# Closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

Main Index
MSC.Acumen, Volume 2: Code Examples

CHAPTER
Analysis
13
■ Introduction

Main Index
1486
Code Examples

13.1 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.

analysis_get.pset_for_job ()

# Purpose : This file provides an example of a call to the


# function analysis_get.pset_for_job()
#
# This session file creates an analysis step for
# MSC.Nastran code and displays the same.
#
# Before running this session file run plate.ses
# to create plate.db. This database contains a
# model of a plate with two jobs 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 analysis_get.pset_for_job()
# has the following arguments:
#
# analysis_get.pset_for_job
# ( analysis_code,
# anal_job_name,
# anal_job_id )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_analysis_code [128]
STRING s_anal_job_names [80] (VIRTUAL)
STRING s_anal_job_descr [256] (VIRTUAL)
INTEGER i_anal_code_id
INTEGER i_anal_job_id
INTEGER i_return_value
INTEGER i_job_count
INTEGER i_job_id_list (VIRTUAL)
INTEGER i_job_sets (VIRTUAL)
INTEGER i_job_stats (VIRTUAL)

#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)

#---------------------------------------------------------------------

i_return_value = db_get_default_anal_code ( s_analysis_code)

dump i_return_value
dump s_analysis_code

# To get the analysis code id for “MSC.Nastran” code.


i_return_value = db_get_anal_code_id(s_analysis_code,i_anal_code_id)
dump i_return_value

#---------------------------------------------------------------------
# Get the number of jobs associated with the analysis code.
i_return_value = db_count_job_names_for_a_code( i_anal_code_id, i_job_count )
Main Index
CHAPTER 13 1487
Analysis

dump i_return_value
dump i_anal_code_id
dump i_job_count

#---------------------------------------------------------------------

i_job_count = i_job_count * 2

SYS_ALLOCATE_ARRAY( s_anal_job_names, 1, i_job_count )


SYS_ALLOCATE_ARRAY( i_job_id_list, 1, i_job_count )
SYS_ALLOCATE_ARRAY( s_anal_job_descr, 1, i_job_count )
SYS_ALLOCATE_ARRAY( i_job_sets, 1, i_job_count )
SYS_ALLOCATE_ARRAY( i_job_stats, 1, i_job_count )

i_return_value = db_get_jobnames_for_a_code @
( i_anal_code_id, @
i_job_count, @
s_anal_job_names, @
i_job_id_list, @
s_anal_job_descr, @
i_job_sets, @
i_job_stats )

dump i_return_value
dump i_anal_code_id
dump i_job_count
dump s_anal_job_names
dump i_job_id_list
dump s_anal_job_descr
dump i_job_sets
dump i_job_stats

#---------------------------------------------------------------------
# Call the function to get the analysis job id

s_anal_job_name = “plate1”

i_return_value = @
analysis_get.pset_for_job @
( s_analysis_code, @
s_anal_job_names(1), @
i_anal_job_id )

dump i_return_value

# The analysis step id is.


dump i_anal_job_id
#---------------------------------------------------------------------

analysis_import ()

# Purpose : This function controls the submittal of either


# a "Result File" importation or an "Input File "
# importation. It generates the geometry and FEM
# data from a input file like ".bdf" or from a
# result file like ".op2" file.
#
# 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.
#
#
Main Index
1488
Code Examples

# The function analysis_import()


# has the following arguments:
#
# analysis_import
# ( analysis_code,
# jobname_text,
# object,
# filename,
# wait)
#
#
#
#---------------------------------------------------------------------
# Variable Declarations

STRING asm_create_patch_xy_created_ids[VIRTUAL]
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]
INTEGER fem_create_mesh_surfa_num_nodes
INTEGER fem_create_mesh_surfa_num_elems
INTEGER i_return_value
#----------------------------------------------------------------------
# Open a new database
# uil_file_new.go("","new.db")

#----------------------------------------------------------------------
i_return_value = asm_const_patch_xyz @
( "1", @
"<1 1 0>", @
"[0 0 0]", @
"Coord 0", @
asm_create_patch_xy_created_ids )

dump i_return_value
#----------------------------------------------------------------------
# Create finite element entities

ui_exec_function( "mesh_seed_display_mgr", "init" )


mesh_seed_create( "Surface 1.4 1.3 1.2 1.1 ", @
1, 5, 0., 0., 0. )

i_return_value = fem_create_mesh_surf_3( "IsoMesh", @


0, @
"Surface 1 ", @
1, @
["0.2"], @
"Quad4", @
"1", @
"1", @
"Coord 0", @
"Coord 0", @
fem_create_mesh_surfa_num_nodes, @
fem_create_mesh_surfa_num_elems, @
fem_create_mesh_s_nodes_created, @
fem_create_mesh_s_elems_created )

dump i_return_value

mesh_seed_display_mgr.erase( )

#----------------------------------------------------------------------
# Create loads/boundary conditions
# Creating set 'fixed_nodes' on L.H.S. of the model
# Creating set of forces 'Loads_at_ends', Force of 50 units downwards.

Main Index
CHAPTER 13 1489
Analysis

i_return_value = loadsbcs_create2( "fixed_nodes", @


"Displacement", @
"Nodal", @
"", @
"Static", @
[" Node 1 31"], @
"FEM", @
"Coord 0", @
"1.", @
["<0,0,0>", @
"<0,0,0>"], @
["", ""] )

dump i_return_value

i_return_value = loadsbcs_create2( "Loads_at_ends", @


"Force", @
"Nodal", @
"", @
"Static", @
[" Node 36 6"], @
"FEM", @
"Coord 0", @
"1.", @
["<0,-50,0>", @
"<0,0,0>"], @
["", ""] )

dump i_return_value

#----------------------------------------------------------------------
# Create Material - Steel
# Modulus of elasticity - 29 E6 units
# Piosson ratio - 0.3

i_return_value = material.create( "Analysis code ID", @


1, @
"Analysis type ID", @
1, @
"Steel", @
0, @
"", @
"Isotropic", @
1, @
"Directionality", @
1, @
"Linearity", @
1, @
"Homogeneous", @
0, @
"Linear Elastic", @
1, @
"Model Options & IDs", @
["", "", "", "", ""], @
[0, 0, 0, 0, 0], @
"Active Flag", @
1, @
"Create", @
10, @
"External Flag", @
FALSE, @
"Property IDs", @
["Elastic Modulus", @
"Poisson Ratio"], @
[2, 5, 0], @
"Property Values", @
["29E6", "0.3", ""] )
Main Index
1490
Code Examples

dump i_return_value

#----------------------------------------------------------------------
# Create Element Properties 'Prop_1'
# thickness - 0.05 units

i_return_value = elementprops_create( "Prop_1", @


51,25,35,1,1,20, @
[13, 20, 36, 4037, 4111,4118, 4119], @
[5, 9, 1, 1, 1, 1, 1], @
["m:Steel","","0.05","","","",""], @
" Element 1:25" )

dump i_return_value

#----------------------------------------------------------------------
# Preparing the job for submission
jobfile.open( "new", "ANALYZE NO JOBFILE" )
msc_delete_old_files( "new", ".bdf", ".op2" )
jobfile.writec( "", "TRANSLATOR = pat3nas" )
jobfile.writec( "DATABASE", "new.db" )
jobfile.writec( "JOBNAME", "new" )
jobfile.writec( "ANALYSIS TITLE", "")
jobfile.writec( "", "" )
jobfile.writec( "OBJECT", "Entire Model" )
jobfile.writec( "METHOD", "Full Run" )
jobfile.writec( "", "" )
jobfile.writec( "MODEL SUFFIX", ".bdf" )
jobfile.writec( "RESULTS SUFFIX", ".op2" )
jobfile.writec( "", "" )
jobfile.writec( "", "/*" )
jobfile.writec( "", " * Translation Parameters" )
jobfile.writec( "", " */" )
jobfile.writec( "", "" )
jobfile.writec( "DATA OUTPUT", "OP2 Only" )
jobfile.writec( "OUTPUT2 REQUESTS", "P3 Built In" )
jobfile.writec( "OUTPUT2 FORMAT", "Binary" )
jobfile.writec( "DIVISION TOLERANCE", "1.0e-08" )
jobfile.writec( "NUMERICAL TOLERANCE", "1.0e-04" )
jobfile.writec( "MODEL TOLERANCE", "0.0049999999" )
jobfile.writec( "WRITING TOLERANCE", "1.0e-21" )
jobfile.writec( "CARD FORMAT", "either" )
jobfile.writec( "MINIMUM SIGNIF. DIGITS", "4" )
jobfile.writec( "NODE COORDINATES", "reference frame" )
jobfile.writec( "MSC.Nastran VERSION", "70.5" )
jobfile.writec( "PROPS ON ELEM ENTRY", "FALSE" )
jobfile.writec( "NO CONTINUATION ENTRY", "FALSE" )
jobfile.writec( "ITERATIVE SOLVER", "FALSE" )
jobfile.writec( "ELEMENT PROPERTY OFFSET", "0" )
jobfile.writec( "MATERIAL PROPERTY OFFSET", "0" )
jobfile.writec( "TABLE OFFSET", "0" )
jobfile.writec( "LOAD SET OFFSET", "0" )
jobfile.writec( "LOAD CASE OFFSET", "0" )
jobfile.writec( "CONTROL SET OFFSET", "0" )
jobfile.writec( "RIGID ELEMENT OFFSET", "0" )
jobfile.writec( "SCALAR POINT OFFSET", "0" )
jobfile.writec( "BEGINNING CONTINUATION MARKER", "+ A" )
jobfile.writec( "NUMBER ONLY", "ON" )
jobfile.writec( "BEGINNING NUMBER", "OFF" )
jobfile.writec( "TRAILING NUMBER", "OFF" )
jobfile.writec( "SYNTAX NUMBER", "ON" )
jobfile.writec( "SYNTAX MARKER", "." )
jobfile.writec( "", "" )
jobfile.writec( "", "/*" )
jobfile.writec( "", " * Solution Parameters" )
jobfile.writec( "", " */" )
jobfile.writec( "", "" )
Main Index
CHAPTER 13 1491
Analysis

jobfile.writec( "SOLUTION TYPE", "LINEAR STATIC" )


jobfile.writei( "SOLUTION SEQUENCE", 101 )
jobfile.writec( "DATABASE RUN", "ON" )
jobfile.writec( "CYCLIC SYMMETRY", "OFF" )
jobfile.writec( "AUTOMATIC CONSTRAINTS", "ON" )
jobfile.writec( "INERTIA RELIEF", "OFF" )
jobfile.writec( "ALTERNATE REDUCTION", "OFF" )
jobfile.writec( "MASS CALCULATION", "Lumped" )
jobfile.writec( "DATA DECK ECHO", "None" )
jobfile.writec( "PLATE RZ STIFFNESS FACTOR", "0.0" )
jobfile.writec( "MAXIMUM PRINTED LINES", "999999999" )
jobfile.writec( "MAXIMUM RUN TIME", "600" )
jobfile.writec( "WT-MASS CONVERSION", "1.0" )
jobfile.writec( "NODE ID FOR WT-GENER", "" )
jobfile.writec( "FMS WRITE", "ON" )
jobfile.writei( "FMS INPUT 0", 0 )
jobfile.writec( "EXEC WRITE", "ON" )
jobfile.writei( "EXEC INPUT 0", 0 )
jobfile.writec( "CASE WRITE", "ON" )
jobfile.writei( "CASE INPUT 0", 0 )
jobfile.writec( "BULK WRITE", "ON" )
jobfile.writei( "BULK INPUT 0", 0 )
jobfile.writec( "", "END" )
jobfile.close( )
mscnastran_job.associate_subcases( "101", "new", 1, ["Default"] )

#-----------------------------------------------------------------------
# Submitting the job for analysis

analysis_submit( "MSC.Nastran", "new",TRUE )


#-----------------------------------------------------------------------

# Closing the file new.db

uil_file_close.go( )
#-----------------------------------------------------------------------
# Opening the file with the name new.db again.
uil_file_new.go( "","new.db" )
$? YES 36000002

#-----------------------------------------------------------------------
# Importing data from the closed new.bdf file

analysis_import("MSC.Nastran","new","Input File","new.bdf",TRUE)
#-----------------------------------------------------------------------
# Closing the file new.db
#
uil_file_close.goquit( )
-----------------------------------------------------------------------

analysis_main.job_name_lbox ()

# Purpose : The function analysis_main.job_name_lbox()


# is a callback to "Available Jobs" listbox in
# "Analysis" form. Execution of this function
# will load the corresponding jobname in to
# "Job Name" data box in "Analysis" form.
#
# 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 analysis_main.job_name_lbox()
# has the following arguments:
Main Index
1492
Code Examples

#
# analysis_main.job_name_lbox
# ( INPUT:
# INTEGER num_items,
# STRING job_name[]()
# OUTPUT:
# )
#---------------------------------------------------------------------
#
# Opening a new database

uil_file_new.go("","new.db")

#---------------------------------------------------------------------

# Displaying Analyis Application form

ui_exec_function( "uil_app_analysis", "display" )

#--------------------------------------------------------------------

# Declaring and defining input arguents

INTEGER num_items = 1

STRING job_name[64](1) = ["new_job"]

#---------------------------------------------------------------------

# Using the function analysis_main.job_name_lbox() to load the


# jobname into "Job Name" data box in "Analysis" form.

analysis_main.job_name_lbox(num_items, @
job_name)

#---------------------------------------------------------------------

# Using the function analysis_main.get_job_name_and_desc()


# to check the job name in "Job Name" data box in "Analysis" form.

STRING check_job_name[64]

STRING job_desc[256]

analysis_main.get_job_name_and_desc(check_job_name,job_desc)

dump check_job_name

#----------------------------------------------------------------------

# End of File.

#---------------------------------------------------------------------

analysis_main.user_function ()

# Purpose : This file provides an example of a call to the


# function analysis_main.user_function()
#
# This function executes a given function under a
# classname. It first checks the status of the
# function and checks whether it exists and
# whether it is currently loaded in memory.
# If the function does not exists then the
Main Index
CHAPTER 13 1493
Analysis

# value of the output return is 0. If the function


# gets executed then the value returned is 1.
# It invokes a class' function. Problems could
# occur if the function has input arguements. this
# can best be utilised to "init" or "display"
# functions.
#
#
# 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 analysis_main.user_function()
# has the following arguments:
#
# analysis_main.user_function
# ( class_name,
# function_name,
# exist_flag )
#
#---------------------------------------------------------------------
# Variable Declarations

STRING classname[128]
STRING function_name[128]
INTEGER exist_flag
INTEGER status

#----------------------------------------------------------------------
# Open a new database
if(!db_is_open())THEN
uil_file_new.go("","new.db")
$? YES 36000002
endif
#----------------------------------------------------------------------
# Setting the preference to MSC.Nastran.

uil_pref_analysis.set_analysis_pref( "MSC.Nastran", @
"Structural", @
"", @
".op2" )

#---------------------------------------------------------------------
# Playing the event file to open the analysis open form

em_event_play("analysis_form_open.evt.01")

#---------------------------------------------------------------------
# Initialising the class of functions : analysis_main

analysis_main.init()

#---------------------------------------------------------------------
# Use the function to execute the function - jobfile.close
# Assigning values to the variables

classname = "jobfile"
function_name = "close"

status = analysis_main.user_function( @
classname, @
function_name, @
exist_flag)

dump status
Main Index
1494
Code Examples

dump exist_flag

#---------------------------------------------------------------------
# Closing the file

uil_file_close.goquit()

#---------------------------------------------------------------------
# End of file

analysis_submit ()

# Purpose : This function submits a job for analysis with a


# wait flag option. If running in a batch mode the
# wait flag can be set to TRUE to assure that the
# process will wait for completion of the analysis
# prior to continuing. analysis_submit() call must
# follow a job preparation sequence that is
# dependent upon the analysis solver preference
# selected. For example, the MSC.Patran ADVANCED
# FEA preference which invokes a direct translator
# without writing out a saved input file, requires
# a prerequisite sequence of "analysis_create"
# class calls.
# For the MSC.Nastran preference, a typical job
# submission involves the following sequence. A
# job file is created by a series of calls:
# jobfile.open, msc_delete_old_files,
# jobfile.write_spl, jobfile.writec,jobfile.writei,
# jobfile.close. Next, mscnastran_job.associate_
# subcases, and then finally analysis_submit is
# called. An exact sequence is best found from
# MSC.Patran session files.
#
#
# 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 analysis_submit()
# has the following arguments:
#
# analysis_submit
# ( analysis_code,
# jobname,
# wait_for_analysis)
#
#---------------------------------------------------------------------
# Variable Declarations

STRING asm_create_patch_xy_created_ids[VIRTUAL]
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]
INTEGER fem_create_mesh_surfa_num_nodes
INTEGER fem_create_mesh_surfa_num_elems
INTEGER i_return_value
#----------------------------------------------------------------------
# Open a new database
# uil_file_new.go("","new.db")
#$? YES 36000002

#----------------------------------------------------------------------
Main Index
CHAPTER 13 1495
Analysis

i_return_value = asm_const_patch_xyz @
( "1", @
"<1 1 0>", @
"[0 0 0]", @
"Coord 0", @
asm_create_patch_xy_created_ids )

dump i_return_value
#----------------------------------------------------------------------
# Create finite element entities

ui_exec_function( "mesh_seed_display_mgr", "init" )


mesh_seed_create( "Surface 1.4 1.3 1.2 1.1 ", @
1, 5, 0., 0., 0. )

i_return_value = fem_create_mesh_surf_3( "IsoMesh", @


0, @
"Surface 1 ", @
1, @
["0.2"], @
"Quad4", @
"1", @
"1", @
"Coord 0", @
"Coord 0", @
fem_create_mesh_surfa_num_nodes, @
fem_create_mesh_surfa_num_elems, @
fem_create_mesh_s_nodes_created, @
fem_create_mesh_s_elems_created )

dump i_return_value

mesh_seed_display_mgr.erase( )

#----------------------------------------------------------------------
# Create loads/boundary conditions
# Creating set 'fixed_nodes' on L.H.S. of the model
# Creating set of forces 'Loads_at_ends', Force of 50 units downwards.

i_return_value = loadsbcs_create2( "fixed_nodes", @


"Displacement", @
"Nodal", @
"", @
"Static", @
[" Node 1 31"], @
"FEM", @
"Coord 0", @
"1.", @
["<0,0,0>", @
"<0,0,0>"], @
["", ""] )

dump i_return_value

i_return_value = loadsbcs_create2( "Loads_at_ends", @


"Force", @
"Nodal", @
"", @
"Static", @
[" Node 36 6"], @
"FEM", @
"Coord 0", @
"1.", @
["<0,-50,0>", @
"<0,0,0>"], @
Main Index
1496
Code Examples

["", ""] )

dump i_return_value

#----------------------------------------------------------------------
# Create Material - Steel
# Modulus of elasticity - 29 E6 units
# Piosson ratio - 0.3

i_return_value = material.create( "Analysis code ID", @


1, @
"Analysis type ID", @
1, @
"Steel", @
0, @
"", @
"Isotropic", @
1, @
"Directionality", @
1, @
"Linearity", @
1, @
"Homogeneous", @
0, @
"Linear Elastic", @
1, @
"Model Options & IDs", @
["", "", "", "", ""], @
[0, 0, 0, 0, 0], @
"Active Flag", @
1, @
"Create", @
10, @
"External Flag", @
FALSE, @
"Property IDs", @
["Elastic Modulus", @
"Poisson Ratio"], @
[2, 5, 0], @
"Property Values", @
["29E6", "0.3", ""] )

dump i_return_value

#----------------------------------------------------------------------
# Create Element Properties 'Prop_1'
# thickness - 0.05 units

i_return_value = elementprops_create( "Prop_1", @


51,25,35,1,1,20, @
[13, 20, 36, 4037, 4111,4118, 4119], @
[5, 9, 1, 1, 1, 1, 1], @
["m:Steel","","0.05","","","",""], @
" Element 1:25" )

dump i_return_value

#----------------------------------------------------------------------
# Preaparing the file new.bdf required for submission

jobfile.open( "new", "ANALYZE NO JOBFILE" )


msc_delete_old_files( "new", ".bdf", ".op2" )
jobfile.writec( "", "TRANSLATOR = pat3nas" )
jobfile.writec( "DATABASE", "new.db" )
jobfile.writec( "JOBNAME", "new" )
jobfile.writec( "ANALYSIS TITLE", "" )
Main Index
CHAPTER 13 1497
Analysis

jobfile.writec( "", "" )


jobfile.writec( "OBJECT", "Entire Model" )
jobfile.writec( "METHOD", "Full Run" )
jobfile.writec( "", "" )
jobfile.writec( "MODEL SUFFIX", ".bdf" )
jobfile.writec( "RESULTS SUFFIX", ".op2" )
jobfile.writec( "", "" )
jobfile.writec( "", "/*" )
jobfile.writec( "", " * Translation Parameters" )
jobfile.writec( "", " */" )
jobfile.writec( "", "" )
jobfile.writec( "DATA OUTPUT", "OP2 Only" )
jobfile.writec( "OUTPUT2 REQUESTS", "P3 Built In" )
jobfile.writec( "OUTPUT2 FORMAT", "Binary" )
jobfile.writec( "DIVISION TOLERANCE", "1.0e-08" )
jobfile.writec( "NUMERICAL TOLERANCE", "1.0e-04" )
jobfile.writec( "MODEL TOLERANCE", "0.0049999999" )
jobfile.writec( "WRITING TOLERANCE", "1.0e-21" )
jobfile.writec( "CARD FORMAT", "either" )
jobfile.writec( "MINIMUM SIGNIF. DIGITS", "4" )
jobfile.writec( "NODE COORDINATES", "reference frame" )
jobfile.writec( "MSC.Nastran VERSION", "70.7" )
jobfile.writec( "PROPS ON ELEM ENTRY", "FALSE" )
jobfile.writec( "NO CONTINUATION ENTRY", "TRUE" )
jobfile.writec( "ITERATIVE SOLVER", "FALSE" )
jobfile.writec( "ELEMENT PROPERTY OFFSET", "0" )
jobfile.writec( "MATERIAL PROPERTY OFFSET", "0" )
jobfile.writec( "TABLE OFFSET", "0" )
jobfile.writec( "LOAD SET OFFSET", "0" )
jobfile.writec( "LOAD CASE OFFSET", "0" )
jobfile.writec( "CONTROL SET OFFSET", "0" )
jobfile.writec( "RIGID ELEMENT OFFSET", "0" )
jobfile.writec( "SCALAR POINT OFFSET", "0" )
jobfile.writec( "BEGINNING CONTINUATION MARKER", "+ A" )
jobfile.writec( "NUMBER ONLY", "ON" )
jobfile.writec( "BEGINNING NUMBER", "OFF" )
jobfile.writec( "TRAILING NUMBER", "OFF" )
jobfile.writec( "SYNTAX NUMBER", "ON" )
jobfile.writec( "SYNTAX MARKER", "." )
jobfile.writec( "", "" )
jobfile.writec( "", "/*" )
jobfile.writec( "", " * Solution Parameters" )
jobfile.writec( "", " */" )
jobfile.writec( "", "" )
jobfile.writec( "SOLUTION TYPE", "LINEAR STATIC" )
jobfile.writei( "SOLUTION SEQUENCE", 101 )
jobfile.writec( "DATABASE RUN", "ON" )
jobfile.writec( "CYCLIC SYMMETRY", "OFF" )
jobfile.writec( "AUTOMATIC CONSTRAINTS", "ON" )
jobfile.writec( "INERTIA RELIEF", "OFF" )
jobfile.writec( "ALTERNATE REDUCTION", "OFF" )
jobfile.writec( "MASS CALCULATION", "Lumped" )
jobfile.writec( "DATA DECK ECHO", "None" )
jobfile.writec( "PLATE RZ STIFFNESS FACTOR", "0.0" )
jobfile.writec( "MAXIMUM PRINTED LINES", "999999999" )
jobfile.writec( "MAXIMUM RUN TIME", "600" )
jobfile.writec( "WT-MASS CONVERSION", "1.0" )
jobfile.writec( "NODE ID FOR WT-GENER", "" )
jobfile.writec( "FMS WRITE", "ON" )
jobfile.writei( "FMS INPUT 0", 0 )
jobfile.writec( "EXEC WRITE", "ON" )
jobfile.writei( "EXEC INPUT 0", 0 )
jobfile.writec( "CASE WRITE", "ON" )
jobfile.writei( "CASE INPUT 0", 0 )
jobfile.writec( "BULK WRITE", "ON" )
jobfile.writei( "BULK INPUT 0", 0 )
jobfile.writec( "", "END" )
Main Index
1498
Code Examples

jobfile.close( )
mscnastran_job.associate_subcases( "101", "new", 1, ["Default"] )
#----------------------------------------------------------------------
# Submitting the job for analysis

analysis_submit( "MSC.Nastran", "new" ,TRUE)

#----------------------------------------------------------------------
# Closing the file new.db

uil_file_close.goquit( )

#----------------------------------------------------------------------

analysis_submit_2 ()

# Purpose : This is a new function designed to replace the


# call to analysis_submit in the session files.
# This function will determine what to do with the
# wait flag and then call the analysis_submit
# function with the appropriate wait flag instead
# of always having the wait flag set to FALSE as
# was done previously.
#
# 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 analysis_submit_2()
# has the following arguments:
#
# analysis_submit_2
# ( analysis_code,
# jobname )
#
#---------------------------------------------------------------------
# Variable Declarations

STRING asm_create_patch_xy_created_ids[VIRTUAL]
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]
INTEGER fem_create_mesh_surfa_num_nodes
INTEGER fem_create_mesh_surfa_num_elems
INTEGER i_return_value
#----------------------------------------------------------------------
# Open a new database
# uil_file_new.go("","new.db")
#$? YES 36000002

#----------------------------------------------------------------------
i_return_value = asm_const_patch_xyz @
( "1", @
"<1 1 0>", @
"[0 0 0]", @
"Coord 0", @
asm_create_patch_xy_created_ids )

dump i_return_value
#----------------------------------------------------------------------
# Create finite element entities

ui_exec_function( "mesh_seed_display_mgr", "init" )


Main Index
CHAPTER 13 1499
Analysis

mesh_seed_create( "Surface 1.4 1.3 1.2 1.1 ", @


1, 5, 0., 0., 0. )

i_return_value = fem_create_mesh_surf_3( "IsoMesh", @


0, @
"Surface 1 ", @
1, @
["0.2"], @
"Quad4", @
"1", @
"1", @
"Coord 0", @
"Coord 0", @
fem_create_mesh_surfa_num_nodes, @
fem_create_mesh_surfa_num_elems, @
fem_create_mesh_s_nodes_created, @
fem_create_mesh_s_elems_created )

dump i_return_value

mesh_seed_display_mgr.erase( )

#----------------------------------------------------------------------
# Create loads/boundary conditions
# Creating set 'fixed_nodes' on L.H.S. of the model
# Creating set of forces 'Loads_at_ends', Force of 50 units downwards.

i_return_value = loadsbcs_create2( "fixed_nodes", @


"Displacement", @
"Nodal", @
"", @
"Static", @
[" Node 1 31"], @
"FEM", @
"Coord 0", @
"1.", @
["<0,0,0>", @
"<0,0,0>"], @
["", ""] )

dump i_return_value

i_return_value = loadsbcs_create2( "Loads_at_ends", @


"Force", @
"Nodal", @
"", @
"Static", @
[" Node 36 6"], @
"FEM", @
"Coord 0", @
"1.", @
["<0,-50,0>", @
"<0,0,0>"], @
["", ""] )

dump i_return_value

#----------------------------------------------------------------------
# Create Material - Steel
# Modulus of elasticity - 29 E6 units
# Piosson ratio - 0.3

i_return_value = material.create( "Analysis code ID", @


1, @
"Analysis type ID", @
1, @
Main Index
1500
Code Examples

"Steel", @
0, @
"", @
"Isotropic", @
1, @
"Directionality", @
1, @
"Linearity", @
1, @
"Homogeneous", @
0, @
"Linear Elastic", @
1, @
"Model Options & IDs", @
["", "", "", "", ""], @
[0, 0, 0, 0, 0], @
"Active Flag", @
1, @
"Create", @
10, @
"External Flag", @
FALSE, @
"Property IDs", @
["Elastic Modulus", @
"Poisson Ratio"], @
[2, 5, 0], @
"Property Values", @
["29E6", "0.3", ""] )

dump i_return_value

#----------------------------------------------------------------------
# Create Element Properties 'Prop_1'
# thickness - 0.05 units

i_return_value = elementprops_create( "Prop_1", @


51,25,35,1,1,20, @
[13, 20, 36, 4037, 4111,4118, 4119], @
[5, 9, 1, 1, 1, 1, 1], @
["m:Steel","","0.05","","","",""], @
" Element 1:25" )

dump i_return_value

#----------------------------------------------------------------------
# Preaparing the file new.bdf required for submission

jobfile.open( "new", "ANALYZE NO JOBFILE" )


msc_delete_old_files( "new", ".bdf", ".op2" )
jobfile.writec( "", "TRANSLATOR = pat3nas" )
jobfile.writec( "DATABASE", "new.db" )
jobfile.writec( "JOBNAME", "new" )
jobfile.writec( "ANALYSIS TITLE", "" )
jobfile.writec( "", "" )
jobfile.writec( "OBJECT", "Entire Model" )
jobfile.writec( "METHOD", "Full Run" )
jobfile.writec( "", "" )
jobfile.writec( "MODEL SUFFIX", ".bdf" )
jobfile.writec( "RESULTS SUFFIX", ".op2" )
jobfile.writec( "", "" )
jobfile.writec( "", "/*" )
jobfile.writec( "", " * Translation Parameters" )
jobfile.writec( "", " */" )
jobfile.writec( "", "" )
jobfile.writec( "DATA OUTPUT", "OP2 Only" )
jobfile.writec( "OUTPUT2 REQUESTS", "P3 Built In" )
Main Index
CHAPTER 13 1501
Analysis

jobfile.writec( "OUTPUT2 FORMAT", "Binary" )


jobfile.writec( "DIVISION TOLERANCE", "1.0e-08" )
jobfile.writec( "NUMERICAL TOLERANCE", "1.0e-04" )
jobfile.writec( "MODEL TOLERANCE", "0.0049999999" )
jobfile.writec( "WRITING TOLERANCE", "1.0e-21" )
jobfile.writec( "CARD FORMAT", "either" )
jobfile.writec( "MINIMUM SIGNIF. DIGITS", "4" )
jobfile.writec( "NODE COORDINATES", "reference frame" )
jobfile.writec( "MSC.Nastran VERSION", "70.7" )
jobfile.writec( "PROPS ON ELEM ENTRY", "FALSE" )
jobfile.writec( "NO CONTINUATION ENTRY", "TRUE" )
jobfile.writec( "ITERATIVE SOLVER", "FALSE" )
jobfile.writec( "ELEMENT PROPERTY OFFSET", "0" )
jobfile.writec( "MATERIAL PROPERTY OFFSET", "0" )
jobfile.writec( "TABLE OFFSET", "0" )
jobfile.writec( "LOAD SET OFFSET", "0" )
jobfile.writec( "LOAD CASE OFFSET", "0" )
jobfile.writec( "CONTROL SET OFFSET", "0" )
jobfile.writec( "RIGID ELEMENT OFFSET", "0" )
jobfile.writec( "SCALAR POINT OFFSET", "0" )
jobfile.writec( "BEGINNING CONTINUATION MARKER", "+ A" )
jobfile.writec( "NUMBER ONLY", "ON" )
jobfile.writec( "BEGINNING NUMBER", "OFF" )
jobfile.writec( "TRAILING NUMBER", "OFF" )
jobfile.writec( "SYNTAX NUMBER", "ON" )
jobfile.writec( "SYNTAX MARKER", "." )
jobfile.writec( "", "" )
jobfile.writec( "", "/*" )
jobfile.writec( "", " * Solution Parameters" )
jobfile.writec( "", " */" )
jobfile.writec( "", "" )
jobfile.writec( "SOLUTION TYPE", "LINEAR STATIC" )
jobfile.writei( "SOLUTION SEQUENCE", 101 )
jobfile.writec( "DATABASE RUN", "ON" )
jobfile.writec( "CYCLIC SYMMETRY", "OFF" )
jobfile.writec( "AUTOMATIC CONSTRAINTS", "ON" )
jobfile.writec( "INERTIA RELIEF", "OFF" )
jobfile.writec( "ALTERNATE REDUCTION", "OFF" )
jobfile.writec( "MASS CALCULATION", "Lumped" )
jobfile.writec( "DATA DECK ECHO", "None" )
jobfile.writec( "PLATE RZ STIFFNESS FACTOR", "0.0" )
jobfile.writec( "MAXIMUM PRINTED LINES", "999999999" )
jobfile.writec( "MAXIMUM RUN TIME", "600" )
jobfile.writec( "WT-MASS CONVERSION", "1.0" )
jobfile.writec( "NODE ID FOR WT-GENER", "" )
jobfile.writec( "FMS WRITE", "ON" )
jobfile.writei( "FMS INPUT 0", 0 )
jobfile.writec( "EXEC WRITE", "ON" )
jobfile.writei( "EXEC INPUT 0", 0 )
jobfile.writec( "CASE WRITE", "ON" )
jobfile.writei( "CASE INPUT 0", 0 )
jobfile.writec( "BULK WRITE", "ON" )
jobfile.writei( "BULK INPUT 0", 0 )
jobfile.writec( "", "END" )
jobfile.close( )
mscnastran_job.associate_subcases( "101", "new", 1, ["Default"] )
#-----------------------------------------------------------------------------
# Submitting the job for analysis

analysis_submit_2( "MSC.Nastran", "new")


$? YES 6016072
#
#-----------------------------------------------------------------------------
# Closing the file new.db
uil_file_close.goquit( )
#-----------------------------------------------------------------------------
Main Index
1502
Code Examples

db_assign_last_jobname ()

# Purpose : This file provides an example of two calls to


# the function db_assign_last_jobname()
#
# Before running this session file run plate.ses
# to create plate.db. This database contains a
# model of a plate with two jobs created.
#
# This illustration opens the database
# “plate.db” and gets the array of job names
# for “MSC.Nastran”. Assigns first two job names
# as last job names. Each time gets the last
# job name for verification.
#
# 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_assign_last_jobname() has the following arguments:
#
# db_assign_last_jobname
# ( jobname )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_jobname[32]
INTEGER i_return_value
INTEGER i_analysis_code_id, i_max
INTEGER ia_job_name_ids(2)
STRING sa_jobnames[128](2)
STRING sa_description[512](2)
INTEGER ia_param_set_ids(2)
INTEGER ia_status_array(2)
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)
#
# Get the code id for “MSC.Nastran”
i_return_value = @
db_get_anal_code_id( “MSC.Nastran”, i_analysis_code_id )
dump i_return_value
dump i_analysis_code_id
#
# Get the two Job names for this analysis code
i_max = 2
i_return_value = @
db_get_jobnames_for_a_code @
( i_analysis_code_id, @
i_max, @
sa_jobnames, @
ia_job_name_ids, @
sa_description, @
ia_param_set_ids, @
ia_status_array )
dump i_return_value
#
# The Job names array is
dump sa_jobnames
#---------------------------------------------------------------------
# Set the sa_jobnames(1) as the last job name
s_jobname = sa_jobnames(1)
i_return_value = @
db_assign_last_jobname @
Main Index
CHAPTER 13 1503
Analysis

( s_jobname )
dump i_return_value
#
# Get the last job name
i_return_value = @
db_get_last_jobname(s_jobname)
dump i_return_value
dump s_jobname
#
# Now set the sa_jobnames(2) as the last job name
dump sa_jobnames(2)
s_jobname = sa_jobnames(2)
i_return_value = @
db_assign_last_jobname @
( s_jobname )
dump i_return_value
#
# Now get the newly set last job name
i_return_value = @
db_get_last_jobname ( s_jobname )
dump i_return_value
dump s_jobname
#---------------------------------------------------------------------

db_count_all_job_name_ids ()

# Purpose : This file provides an example of a call to the


# function db_count_all_job_name_ids()
#
# Before running this session file run plate.ses
# to create plate.db. This database contains a
# model of a plate with two jobs created.
#
# This illustration opens the data base
# “plate.db” and gets the count of job name 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_count_all_job_name_ids()
# has the following arguments:
#
# db_count_all_job_name_ids
# ( nbr_of_jobnames )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_nbr_of_jobnames
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)

# Get the count of all the job name ids


i_return_value = @
db_count_all_job_name_ids @
( i_nbr_of_jobnames )
dump i_return_value
dump i_nbr_of_jobnames
#---------------------------------------------------------------------

Main Index
1504
Code Examples

db_count_anal_codes ()

# Purpose : This file provides an example of a call to the


# function db_count_anal_codes()
#
# This file opens a new data base “new.db”
# and gets the count of analysis codes stored
# in the data base.
#
# 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_anal_codes() has the following arguments:
#
# db_count_anal_codes
# ( count )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_count
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Get the number of analysis codes stored in the database.
i_return_value = @
db_count_anal_codes @
( i_count )
dump i_return_value
dump i_count
#---------------------------------------------------------------------

db_count_anal_types ()

# Purpose : This file provides an example of a call to the


# function db_count_anal_types()
#
# This file opens a new data base “new.db” and
# gets the count of analysis types for the
# analysis code “MSC.Nastran”.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_count_anal_types() has the following arguments:
#
# db_count_anal_types
# ( name,
# count )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
INTEGER i_count
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
Main Index
CHAPTER 13 1505
Analysis

$? YES 36000002

# Count the analysis types for the analysis code “MSC.Nastran”


s_name = “MSC.Nastran”
i_return_value = @
db_count_anal_types @
( s_name, @
i_count )
dump i_return_value

# The number of analysis types


dump i_count

#---------------------------------------------------------------------

db_count_analysis_steps ()

# Purpose : This file provides an example of a call to the


# function db_count_analysis_steps()
#
# This session file gives the analysis steps used
# so far in the current database.
#
# Before running this session file run plate.ses
# to create plate.db. This database contains a
# model of a plate with two jobs 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 db_count_analysis_steps()
# has the following arguments:
#
# db_count_analysis_steps
# ( acode_id,
# num_steps )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_acode_id
INTEGER i_num_steps
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)

# To get the analysis code id for “MSC.Nastran” code.


i_return_value = db_get_anal_code_id(“MSC.Nastran”, i_acode_id)
dump i_return_value
#---------------------------------------------------------------------
i_return_value = @
db_count_analysis_steps @
( i_acode_id, @
i_num_steps )
dump i_return_value
# The number of analysis steps for “MSC.Nastran” code are
dump i_num_steps
#---------------------------------------------------------------------

Main Index
1506
Code Examples

db_count_job_name_list_entry ()

# Purpose : This file provides an example of a call to the


# function db_count_job_name_list_entry()
#
# This illustration opens the database plate.db
# and calls the functions to get all the job name
# IDs in the database. Then it calls the function
# to count the number of load cases associated
# with the last job. Finally it displays the load
# cases counted already.
#
# Before running this session file run plate.ses
# to create plate.db. This database contains a
# model of a plate with two jobs 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 db_count_job_name_list_entry()
# has the following arguments:
#
# db_count_job_name_list_entry
# ( jobname_id,
# num_lists )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_jobname_id
INTEGER i_num_lists
INTEGER i_return_value

INTEGER i_analysis_code_id
STRING sv_jobname[80](VIRTUAL)
STRING sv_description[256](VIRTUAL)
INTEGER iv_jobname_id(VIRTUAL)
INTEGER iv_param_set_id(VIRTUAL)
INTEGER iv_status(VIRTUAL)
INTEGER i_count
INTEGER iv_step_id(VIRTUAL)
INTEGER iv_load_case_id(VIRTUAL)
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)

# To get the analysis code id for “MSC.Nastran” code.


i_return_value = db_get_anal_code_id(“MSC.Nastran”,i_analysis_code_id)
dump i_return_value

# Find out number of jobs in the model for memory allocation.


#
i_return_value = @
db_count_job_names_for_a_code(i_analysis_code_id,i_count)
dump i_return_value

sys_allocate_array(sv_jobname,1,i_count)
sys_allocate_array(sv_description,1,i_count)
sys_allocate_array(iv_jobname_id,1,i_count)
sys_allocate_array(iv_param_set_id,1,i_count)
sys_allocate_array(iv_status,1,i_count)

# Get all the job names for analysis code “MSC.Nastran”


#
Main Index
CHAPTER 13 1507
Analysis

i_return_value = @
db_get_jobnames_for_a_code @
( i_analysis_code_id,i_count,sv_jobname, @
iv_jobname_id ,sv_description, @
iv_param_set_id,iv_status )
dump i_return_value
#---------------------------------------------------------------------
# Call the function to count the load cases associated with the
# last job name.
i_jobname_id = iv_jobname_id(i_count)
#
i_return_value = @
db_count_job_name_list_entry @
( i_jobname_id, @
i_num_lists )
dump i_return_value

# The number of load cases associated with the job are.


dump i_num_lists
#---------------------------------------------------------------------
# Get the list of loadcase IDs and Step IDs related to a individual
# job for all the jobs.
i_count = i_num_lists

sys_allocate_array(iv_load_case_id,1,i_num_lists)
sys_allocate_array(iv_step_id,1,i_num_lists)

i_return_value = @
db_get_jobname_list_entries @
(i_jobname_id, @
i_count, @
iv_load_case_id, @
iv_step_id)
dump i_return_value

# The load case id and analysis step id associated with the job are.
dump iv_load_case_id,iv_step_id

# Free the allocated memory


sys_free_array(iv_load_case_id)
sys_free_array(iv_step_id)
sys_free_array(sv_jobname)
sys_free_array(sv_description)
sys_free_array(iv_jobname_id)
sys_free_array(iv_param_set_id)
sys_free_array(iv_status)
#---------------------------------------------------------------------

db_count_job_names_for_a_code ()

# Purpose : This file provides an example of a call to the


# function db_count_job_names_for_a_code()
#
# Before running this session file run plate.ses
# to create plate.db. This database contains a
# model of a plate with two jobs created.
#
# This file opens the data base “plate.db” and
# gets the count of job names for the analysis
# code “MSC.Nastran”.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
Main Index
1508
Code Examples

#
# The function db_count_job_names_for_a_code()
# has the following arguments:
#
# db_count_job_names_for_a_code
# ( acode_id,
# num_acodes )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_acode_id
INTEGER i_num_acodes
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)
#
# Get the analysis code id(i_acode_id) of “MSC.Nastran”
i_return_value = @
db_get_anal_code_id( “MSC.Nastran”, i_acode_id )
dump i_return_value
dump i_acode_id
#
# Get the count of job names for the “MSC.Nastran” code id
i_return_value = @
db_count_job_names_for_a_code @
( i_acode_id, @
i_num_acodes )
dump i_return_value
dump i_num_acodes
#
# The number of available job names can also be seen on “Analysis”
# window form
#---------------------------------------------------------------------

db_count_param_set_entries ()

# Purpose : This file provides an example of a call to the


# function db_count_param_set_entries()
#
# Session file prints the number of entries in
# the first parameter set listed in the
# analysis_step relation.
#
# Before running this session file run plate.ses
# to create plate.db. This database contains a
# model of a plate with two jobs 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 db_count_param_set_entries()
# has the following arguments:
#
# db_count_param_set_entries
# ( param_id,
# num_params )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_param_id
INTEGER i_num_params
INTEGER i_return_value
Main Index
CHAPTER 13 1509
Analysis

INTEGER i_analysis_code_id
INTEGER i_count
STRING sa_stepname[80](16)
INTEGER ia_step_id(16)
STRING sa_description[256](16)
INTEGER ia_param_id(16)
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)

# To get the analysis code id for “MSC.Nastran” code.


i_return_value =db_get_anal_code_id(“MSC.Nastran”, i_analysis_code_id)
dump i_return_value
#---------------------------------------------------------------------
# Initialized to get maximum number of steps used in the database.
i_count= 16
#
i_return_value = @
db_get_analysis_steps @
( i_analysis_code_id, @
i_count, @
sa_stepname, @
ia_step_id, @
sa_description, @
ia_param_id )
dump i_return_value

# Available parameter set ids are.


dump ia_param_id

#---------------------------------------------------------------------
# Using first parameter set.
i_param_id = ia_param_id(1)
dump i_param_id

i_return_value = @
db_count_param_set_entries @
( i_param_id, @
i_num_params )
dump i_return_value

# The number of parameter entries for the parameter set are.


dump i_num_params
#---------------------------------------------------------------------

db_count_steps_for_a_job ()

# Purpose : This file provides an example of a call to the


# function db_count_steps_for_a_job()
#
# For a given job name used with a analysis code
# this function gives the steps used for the
# analysis.
#
# Before running this session file run plate.ses
# to create plate.db. This database contains a
# model of a plate with two jobs 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 db_count_steps_for_a_job()
Main Index
1510
Code Examples

# has the following arguments:


#
# db_count_steps_for_a_job
# ( ac_id,
# job_id,
# num_steps )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_ac_id
INTEGER i_job_id
INTEGER i_num_steps
INTEGER i_return_value
STRING s_jobname[80]
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)

# To get the analysis code id for “MSC.Nastran” code.


i_return_value = db_get_anal_code_id(“MSC.Nastran”, i_ac_id)
dump i_return_value

# To get the job name of the last job created.


i_return_value = db_get_last_jobname(s_jobname)
dump i_return_value

# To get the job id of the last job created.


i_return_value = @
db_get_id_given_job_name_code(i_ac_id,s_jobname,i_job_id)
dump i_return_value
#---------------------------------------------------------------------
#
i_return_value = @
db_count_steps_for_a_job @
( i_ac_id, @
i_job_id, @
i_num_steps )
dump i_return_value

# The number of analysis steps for the last job and “MSC.Nastran” as
# analysis code are
dump i_num_steps
#---------------------------------------------------------------------

db_create_analysis_step ()

# Purpose : This file provides an example of a call to the


# function db_create_analysis_step()
#
# This session file shows how to add a analysis_
# step and also shows the available analysis_
# steps in the data base.
#
# Before running this session file run plate.ses
# to create plate.db. This database contains a
# model of a plate with two jobs 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 db_create_analysis_step()
# has the following arguments:
#
Main Index
CHAPTER 13 1511
Analysis

# db_create_analysis_step
# ( stepname,
# stepdesc,
# ac_id,
# step_id,
# param_set_id )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_stepname[80]
STRING s_stepdesc[256]
INTEGER i_ac_id
INTEGER i_step_id=0
INTEGER i_param_set_id
INTEGER i_return_value

INTEGER i_count,i_temp
STRING sa_stepname[80](16)
INTEGER ia_step_id(16)
STRING sa_description[256](16)
INTEGER ia_param_set_id(16)
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)

# To get the analysis code id for “MSC.Nastran” code.


i_return_value = db_get_anal_code_id(“MSC.Nastran”, i_ac_id)
dump i_return_value
#---------------------------------------------------------------------
# Calling the function to add an analysis step “pcl_example”

s_stepname= “pcl_example”
s_stepdesc= “Written as example for function db_create_analysis_step”

i_return_value = @
db_create_analysis_step @
( s_stepname, @
s_stepdesc, @
i_ac_id, @
i_step_id, @
i_param_set_id )
dump i_return_value

# The step id of the step created is


dump i_step_id
# The parameter set id of the step created is
dump i_param_set_id

#---------------------------------------------------------------------
# Initialized to get maximum number of steps used in the database.
i_count= 16
#
i_return_value = @
db_get_analysis_steps @
( i_ac_id, @
i_count, @
sa_stepname, @
ia_step_id, @
sa_description, @
ia_param_set_id )
dump i_return_value

# The actual number of steps in the current data base are


dump i_count
# The steps are
FOR (i_temp=1 TO i_count)
dump sa_stepname(i_temp)
Main Index
1512
Code Examples

dump ia_step_id(i_temp)
dump sa_description(i_temp)
dump ia_param_set_id(i_temp)
END FOR

#---------------------------------------------------------------------

db_create_job_name ()

# Purpose : This file provides an example of a call to the


# function db_create_job_name()
#
# Before running this session file run plate.ses
# to create plate.db. This database contains a
# model of a plate with two jobs created.
#
# This illustration opens the database
# “plate.db” and creates a new job name for
# “MSC.Nastran”. Before and after the creation
# of the new job name, the count of job names ids
# in the database is shown.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_create_job_name() has the following arguments:
#
# db_create_job_name
# ( jobname,
# id )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_jobname[32]
INTEGER i_id, i_count
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)
#
# Get the count of the existing job name ids
i_return_value = @
db_count_all_job_name_ids ( i_count )
dump i_return_value
dump i_count
#
# Create the new job name “new” for “MSC.Nastran”
s_jobname = “new”
i_return_value = @
db_create_job_name @
( s_jobname, @
i_id )
dump i_return_value
dump i_id
#
# Get the latest count of the job name ids
i_return_value = @
db_count_all_job_name_ids ( i_count )
dump i_return_value
dump i_count
#---------------------------------------------------------------------

Main Index
CHAPTER 13 1513
Analysis

db_create_job_name_for_a_code ()

# Purpose : This file provides an example of a call to the


# function db_create_job_name_for_a_code()
#
# Before running this session file run plate.ses
# to create plate.db. This database contains a
# model of a plate with two jobs created.
#
# This file opens a data base “plate.db” and
# creates a new job name. It also checks for its
# existence.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_create_job_name_for_a_code()
# has the following arguments:
#
# db_create_job_name_for_a_code
# ( ac_id,
# jobname,
# jobdesc,
# status,
# jobname_id,
# param_set_id )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_ac_id
STRING s_jobname[32]
STRING s_jobdesc[128]
INTEGER i_status
INTEGER i_jobname_id
INTEGER i_param_set_id
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)
#
# Get the Code id for “MSC.Nastran”
i_return_value = @
db_get_anal_code_id( “MSC.Nastran”,i_ac_id )
dump i_return_value
dump i_ac_id
#
# Set the job name and the description
s_jobname = “new_job”
s_jobdesc = “The new job is created for the illustration”
i_status = 0
i_return_value = @
db_create_job_name_for_a_code @
( i_ac_id, @
s_jobname, @
s_jobdesc, @
i_status, @
i_jobname_id, @
i_param_set_id )
dump i_return_value
dump i_jobname_id
dump i_param_set_id
#
# Check the existence of the newly created jobname
Main Index
1514
Code Examples

i_return_value = @
db_get_job_name_given_id( i_jobname_id, s_jobname )
dump i_return_value
dump s_jobname
#---------------------------------------------------------------------

db_create_job_name_list ()

# Purpose : This file provides an example of a call to the


# function db_create_job_name_list()
#
# This session file shows how to associate
# load cases with an existing job.
#
# Before running this session file run plate.ses
# to create plate.db. This database contains a
# model of a plate with two jobs 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 db_create_job_name_list()
# has the following arguments:
#
# db_create_job_name_list
# ( jobname_id,
# nbr_of_loadcases,
# loadcase_ids )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_jobname_id
INTEGER i_nbr_of_loadcases
INTEGER iv_loadcase_ids(VIRTUAL)
INTEGER i_return_value

STRING s_jobname[32]
INTEGER i_count
INTEGER iv_step_id(VIRTUAL)
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)

# Create a new job with “Session_Example” as name and get the job id.
s_jobname = “Session_Example”

i_return_value = db_create_job_name(s_jobname,i_jobname_id)
dump i_return_value

# Associating the three available load cases with the new job.
# The IDs of the three load cases are 1,2 and 3.

i_nbr_of_loadcases = 3
sys_allocate_array(iv_loadcase_ids,1,i_nbr_of_loadcases)
iv_loadcase_ids(1)=1
iv_loadcase_ids(2)=2
iv_loadcase_ids(3)=3
#
i_return_value = @
db_create_job_name_list @
( i_jobname_id, @
i_nbr_of_loadcases, @
iv_loadcase_ids )
Main Index
CHAPTER 13 1515
Analysis

dump i_return_value

#---------------------------------------------------------------------
# Get the entries in the jobname list created.
i_return_value = db_count_job_name_list_entry(i_jobname_id, i_count)
dump i_return_value,i_count

sys_allocate_array(iv_loadcase_ids,1,i_count)
sys_allocate_array(iv_step_id,1,i_count)

i_return_value = @
db_get_jobname_list_entries @
( i_jobname_id,i_count, @
iv_loadcase_ids ,iv_step_id )
dump i_return_value

# Displaying the entries in the jobname list created.


dump iv_loadcase_ids,iv_step_id

# Deleting the job name


i_return_value = db_delete_job_name(i_jobname_id)
dump i_return_value

sys_free_array(iv_loadcase_ids)
sys_free_array(iv_step_id)
#---------------------------------------------------------------------

db_create_job_name_list_entry ()

# Purpose : This file provides an example of a call to the


# function db_create_job_name_list_entry()
#
# This file shows how to add a load case into
# a job.
#
# Before running this session file run plate.ses
# to create plate.db. This database contains a
# model of a plate with two jobs 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 db_create_job_name_list_entry()
# has the following arguments:
#
# db_create_job_name_list_entry
# ( jobname_id,
# load_case_id,
# analysis_step_id )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_jobname_id
INTEGER i_load_case_id
INTEGER i_analysis_step_id
INTEGER i_return_value

INTEGER i_analysis_code_id
INTEGER i_count,i_temp
STRING sa_stepname[80](8)
STRING s_jobname[80]
INTEGER ia_step_id(8)
INTEGER iv_step_id(VIRTUAL)
Main Index
1516
Code Examples

INTEGER iv_loadcase_ids(VIRTUAL)
STRING sa_description[256](8)
INTEGER ia_param_set_id(8)
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)

# To get the analysis code id for “MSC.Nastran” code.


i_return_value=db_get_anal_code_id(“MSC.Nastran”, i_analysis_code_id)
dump i_return_value

# Create a new job with “Session_Example” as name and get the job id.
s_jobname = “Session_Example”

i_return_value = db_create_job_name(s_jobname,i_jobname_id)
dump i_return_value

#---------------------------------------------------------------------
# Create 3 job name list entries with analysis step id as 2 and
# using load case id as 1,2 and 3

i_analysis_step_id = 2
#
FOR(i_count=1 TO 3)
i_load_case_id = i_count
i_return_value = @
db_create_job_name_list_entry @
( i_jobname_id, @
i_load_case_id, @
i_analysis_step_id )
dump i_return_value
END FOR
#---------------------------------------------------------------------
# Get the entries in the jobname list created.
i_return_value = @
db_count_job_name_list_entry @
( i_jobname_id, i_count )
dump i_return_value
# Number of loadcases associated with the job
dump i_count

sys_allocate_array(iv_loadcase_ids,1,i_count)
sys_allocate_array(iv_step_id,1,i_count)

i_return_value = @
db_get_jobname_list_entries @
( i_jobname_id,i_count, @
iv_loadcase_ids , @
iv_step_id )
dump i_return_value

# Displaying the entries in the jobname list created.


dump iv_loadcase_ids,iv_step_id

# Delete the newly created job


i_return_value = db_delete_job_name(i_jobname_id)
dump i_return_value

sys_free_array(iv_loadcase_ids)
sys_free_array(iv_step_id)
#---------------------------------------------------------------------

Main Index
CHAPTER 13 1517
Analysis

db_create_param_set_entry ()

# Purpose : This file provides an example of a call to the


# function db_create_param_set_entry()
#
# This session file demonstrates how to access
# data required to add a entry into a parameter_
# set relation.
#
# Before running this session file run plate.ses
# to create plate.db. This database contains a
# model of a plate with two jobs 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 db_create_param_set_entry()
# has the following arguments:
#
# db_create_param_set_entry
# ( param_set_id,
# param_name,
# param_type,
# param_real,
# param_char,
# param_int )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_param_set_id
STRING s_param_name[128]
INTEGER i_param_type
REAL r_param_real
STRING s_param_char[128]
INTEGER i_param_int
INTEGER i_return_value

INTEGER i_count
STRING sv_param_name[80](VIRTUAL)
INTEGER iv_param_type(VIRTUAL)
REAL rv_param_real(VIRTUAL)
STRING sv_param_char[256](VIRTUAL)
INTEGER iv_param_int(VIRTUAL)

INTEGER i_analysis_code_id
INTEGER i_temp
STRING sa_stepname[80](16)
INTEGER ia_step_id(16)
STRING sa_description[256](16)
INTEGER ia_param_set_id(16)
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)

# To get the analysis code id for “MSC.Nastran” code.


i_return_value =db_get_anal_code_id(“MSC.Nastran”, i_analysis_code_id)
dump i_return_value
#---------------------------------------------------------------------
# Initialized to get maximum number of steps used in the database.
i_count= 16
#
i_return_value = @
db_get_analysis_steps @
Main Index
1518
Code Examples

( i_analysis_code_id, @
i_count, @
sa_stepname, @
ia_step_id, @
sa_description, @
ia_param_set_id )
dump i_return_value
#---------------------------------------------------------------------
# Using the parameter set id for the first step.
i_param_set_id=ia_param_set_id(1)
# Initialized to get all parameters entries from the database.
i_return_value = db_count_param_set_entries(i_param_set_id,i_count)
dump i_return_value,i_count

sys_allocate_array(sv_param_name,1,i_count+1)
sys_allocate_array(iv_param_type,1,i_count+1)
sys_allocate_array(rv_param_real,1,i_count+1)
sys_allocate_array(sv_param_char,1,i_count+1)
sys_allocate_array(iv_param_int,1,i_count+1)
#
i_return_value = @
db_get_param_set_ent_pcl @
( i_param_set_id, @
i_count, @
sv_param_name, @
iv_param_type, @
rv_param_real, @
sv_param_char, @
iv_param_int )
dump i_return_value

# Displaying all the parameter entries in the set.


FOR (i_temp=1 TO i_count)
dump sv_param_name(i_temp)
dump iv_param_type(i_temp)
dump rv_param_real(i_temp)
dump sv_param_char(i_temp)
dump iv_param_int(i_temp)
END FOR
#---------------------------------------------------------------------
# Adding a parameter to the set.
s_param_name=”Session_Example”
i_param_type=3
r_param_real=1.33465e-5
s_param_char=””
i_param_int=0
#
i_return_value = @
db_create_param_set_entry @
( i_param_set_id, @
s_param_name, @
i_param_type, @
r_param_real, @
s_param_char, @
i_param_int )
dump i_return_value

#---------------------------------------------------------------------
# Initialized to get all parameter entries from the database.
i_return_value = db_count_param_set_entries(i_param_set_id,i_count)
dump i_return_value,i_count
#
i_return_value = @
db_get_param_set_ent_pcl @
( i_param_set_id, @
i_count, @
sv_param_name, @
Main Index
CHAPTER 13 1519
Analysis

iv_param_type, @
rv_param_real, @
sv_param_char, @
iv_param_int )
dump i_return_value

# Displaying all the parameter entries in the set.


FOR (i_temp=1 TO i_count)
dump sv_param_name(i_temp)
dump iv_param_type(i_temp)
dump rv_param_real(i_temp)
dump sv_param_char(i_temp)
dump iv_param_int(i_temp)
END FOR

sys_free_array(sv_param_name)
sys_free_array(iv_param_type)
sys_free_array(rv_param_real)
sys_free_array(sv_param_char)
sys_free_array(iv_param_int)
#---------------------------------------------------------------------
# End of File

db_create_pset_matrix_entry ()

# Purpose : This file provides an example of a call to the


# function db_create_pset_matrix_entry()
#
# This session file demonstrates how to add a
# real matrix in a parameter set.
#
# Before running this session file run plate.ses
# to create plate.db. This database contains a
# model of a plate with two jobs 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 db_create_pset_matrix_entry()
# has the following arguments:
#
# db_create_pset_matrix_entry
# ( param_set_id,
# param_name,
# nrows,
# ncols,
# matrix )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_param_set_id
STRING s_param_name[128]
INTEGER i_nrows
INTEGER i_ncols
REAL rv_matrix(VIRTUAL)
INTEGER i_return_value

INTEGER i_count,i_temp
INTEGER i_analysis_code_id
STRING sa_stepname[80](16)
INTEGER ia_step_id(16)
STRING sa_description[256](16)
INTEGER ia_param_set_id(16)
Main Index
1520
Code Examples

#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)

# To get the analysis code id for “MSC.Nastran” code.


i_return_value =db_get_anal_code_id(“MSC.Nastran”, i_analysis_code_id)
dump i_return_value
#---------------------------------------------------------------------
# Initialized to get maximum number of steps used in the database.
i_count = 16
#
i_return_value = @
db_get_analysis_steps @
( i_analysis_code_id, @
i_count, @
sa_stepname, @
ia_step_id, @
sa_description, @
ia_param_set_id )
dump i_return_value
#---------------------------------------------------------------------
# Using the parameter set id for the first step.
i_param_set_id=ia_param_set_id(1)
s_param_name=”pset_Session_example”
i_nrows=4
i_ncols=3

sys_allocate_array(rv_matrix,1,i_nrows*i_ncols)
FOR(i_temp=1 TO i_nrows*i_ncols)
rv_matrix(i_temp)=i_temp/3.0
END FOR
#---------------------------------------------------------------------
# Call the function to add a “parameter pset_Session_example”
i_return_value = @
db_create_pset_matrix_entry @
( i_param_set_id, @
s_param_name, @
i_nrows, @
i_ncols, @
rv_matrix )
dump i_return_value

sys_free_array(rv_matrix)
#---------------------------------------------------------------------
# Call the function to get the size of the matrix.

i_return_value = @
db_get_pset_matrix_size @
( i_param_set_id, @
s_param_name, @
i_nrows, @
i_ncols )
dump i_return_value

# The size of the matrix is


dump i_nrows,i_ncols
# Allocating memory to the array.
sys_allocate_array(rv_matrix,1,i_nrows*i_ncols)
#---------------------------------------------------------------------
# Get the matrix.

i_return_value = @
db_get_pset_matrix_entry @
( i_param_set_id, @
s_param_name, @
rv_matrix )
dump i_return_value
Main Index
CHAPTER 13 1521
Analysis

# The array is.


dump rv_matrix

sys_free_array(rv_matrix)
#---------------------------------------------------------------------

db_delete_analysis_step_id ()

# Purpose : This file provides an example of a call to the


# function db_delete_analysis_step_id()
#
# This session file creates an analysis_step and
# deletes the same analysis_step.
#
# Before running this session file run plate.ses
# to create plate.db. This database contains a
# model of a plate with two jobs 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 db_delete_analysis_step_id()
# has the following arguments:
#
# db_delete_analysis_step_id
# ( ac_id,
# step_id )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_ac_id
INTEGER i_step_id
INTEGER i_return_value

STRING s_stepname[80]
STRING s_stepdesc[256]
INTEGER i_param_set_id

INTEGER i_count,i_temp
STRING sa_stepname[80](16)
INTEGER ia_step_id(16)
STRING sa_description[256](16)
INTEGER ia_param_set_id(16)
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)

# To get the analysis code id for “MSC.Nastran” code.


i_return_value = db_get_anal_code_id(“MSC.Nastran”, i_ac_id)
dump i_return_value
#---------------------------------------------------------------------
# Creating a analysis_step for “MSC.Nastran” analysis code.
s_stepname= “ pcl_example”
s_stepdesc= “Written as example for function db_delete_analysis_step”

i_return_value = @
db_create_analysis_step @
( s_stepname, @
s_stepdesc, @
i_ac_id, @
i_step_id, @
i_param_set_id )
Main Index
1522
Code Examples

dump i_return_value
# The step id of the step created is
dump i_step_id
# The parameter set id of the step created is
dump i_param_set_id
#---------------------------------------------------------------------
# Initialized to get maximum number of steps used in the database.
i_count= 16
#
i_return_value = @
db_get_analysis_steps @
( i_ac_id, @
i_count, @
sa_stepname, @
ia_step_id, @
sa_description, @
ia_param_set_id )
dump i_return_value

# The actual number of steps in the current data base are


dump i_count
# The steps are
FOR (i_temp=1 TO i_count)
dump sa_stepname(i_temp)
dump ia_step_id(i_temp)
dump sa_description(i_temp)
dump ia_param_set_id(i_temp)
END FOR
#---------------------------------------------------------------------
# Deleting the last step.
i_step_id=ia_step_id(i_count)
i_return_value = @
db_delete_analysis_step_id @
( i_ac_id, @
i_step_id )
dump i_return_value

#---------------------------------------------------------------------
# Initialized to get maximum number of steps used in the database.
i_count= 16
#
i_return_value = @
db_get_analysis_steps @
( i_ac_id, @
i_count, @
sa_stepname, @
ia_step_id, @
sa_description, @
ia_param_set_id )
dump i_return_value

# The actual number of steps in the current data base are


dump i_count
# The steps are
FOR (i_temp=1 TO i_count)
dump sa_stepname(i_temp)
dump ia_step_id(i_temp)
dump sa_description(i_temp)
dump ia_param_set_id(i_temp)
END FOR
#---------------------------------------------------------------------

Main Index
CHAPTER 13 1523
Analysis

db_delete_job_name ()

# Purpose : This file provides an example of a call to the


# function db_delete_job_name()
#
# Before running this session file run plate.ses
# to create plate.db. This database contains a
# model of a plate with two jobs created.
#
# This file opens the data base “plate.db”, gets
# the array of job name ids and count of job name
# ids.Then deletes one job name and again gets
# the count of job name 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_delete_job_name() has the following arguments:
#
# db_delete_job_name
# ( id )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_id
INTEGER i_return_value
INTEGER i_analysis_code_id, i_max
INTEGER ia_job_name_ids(2)
STRING sa_jobnames[128](2)
STRING sa_description[512](2)
INTEGER ia_param_set_ids(2)
INTEGER ia_status_array(2)
INTEGER i_nbr_of_jobnames
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)
#
# Get the code id for “MSC.Nastran”
i_return_value = @
db_get_anal_code_id(“MSC.Nastran”,i_analysis_code_id)
dump i_return_value
dump i_analysis_code_id
#
# Get the two Job names and then ids for this analysis code
i_max = 2
i_return_value = @
db_get_jobnames_for_a_code @
( i_analysis_code_id, @
i_max, @
sa_jobnames, @
ia_job_name_ids, @
sa_description, @
ia_param_set_ids, @
ia_status_array )
dump i_return_value
dump ia_job_name_ids
#
# Get the count of all the job name ids
i_return_value = @
db_count_all_job_name_ids @
( i_nbr_of_jobnames )
dump i_return_value
dump i_nbr_of_jobnames
Main Index
1524
Code Examples

#---------------------------------------------------------------------
# Delete the first job name using it’s id
i_id = ia_job_name_ids(1)
i_return_value = @
db_delete_job_name @
( i_id )
dump i_return_value
#
# Get the count of all the job name ids
i_return_value = @
db_count_all_job_name_ids @
( i_nbr_of_jobnames )
dump i_return_value
dump i_nbr_of_jobnames
#---------------------------------------------------------------------

db_delete_job_name_list ()

# Purpose : This file provides an example of a call to the


# function db_delete_job_name_list()
#
# To delete the association between the load
# cases and the job.
#
# Before running this session file run plate.ses
# to create plate.db. This database contains a
# model of a plate with two jobs 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 db_delete_job_name_list() has the following arguments:
# db_delete_job_name_list
# ( jobname_id )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_jobname_id
INTEGER i_return_value

INTEGER i_load_case_id
INTEGER i_analysis_step_id
INTEGER i_analysis_code_id
INTEGER i_count,i_temp
STRING sa_stepname[80](8)
STRING s_jobname[80]
INTEGER ia_step_id(8)
INTEGER iv_step_id(VIRTUAL)
INTEGER iv_loadcase_ids(VIRTUAL)
STRING sa_description[256](8)
INTEGER ia_param_set_id(8)
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)

# To get the analysis code id for “MSC.Nastran” code.


i_return_value=db_get_anal_code_id(“MSC.Nastran”, i_analysis_code_id)
dump i_return_value

# Create a new job with “Session_Example” as name and get the job id.
s_jobname = “Session_Example”

i_return_value = db_create_job_name(s_jobname,i_jobname_id)
Main Index
CHAPTER 13 1525
Analysis

dump i_return_value

#---------------------------------------------------------------------
# Create 3 job name list entries with analysis step id as 2 and
# using load case id as 1,2 and 3

i_analysis_step_id = 2
#
FOR(i_count=1 TO 3)
i_load_case_id = i_count
i_return_value = @
db_create_job_name_list_entry @
( i_jobname_id, @
i_load_case_id, @
i_analysis_step_id )
dump i_return_value
END FOR
#---------------------------------------------------------------------
# Get the entries in the jobname list created.
i_return_value = @
db_count_job_name_list_entry @
( i_jobname_id, i_count )
dump i_return_value
# Number of loadcases associated with the job
dump i_count
sys_allocate_array(iv_loadcase_ids,1,i_count)
sys_allocate_array(iv_step_id,1,i_count)

i_return_value = @
db_get_jobname_list_entries @
( i_jobname_id,i_count, @
iv_loadcase_ids , @
iv_step_id )
dump i_return_value

# Displaying the entries in the jobname list created.


dump iv_loadcase_ids,iv_step_id
#---------------------------------------------------------------------
# Deleting the list.
i_return_value = @
db_delete_job_name_list @
( i_jobname_id )
dump i_return_value
#---------------------------------------------------------------------
# Get the entries in the jobname list created.
i_return_value = @
db_count_job_name_list_entry @
( i_jobname_id, i_count )
dump i_return_value
# Number of loadcases associated with the job
dump i_count
#---------------------------------------------------------------------
# Delete the newly created job
i_return_value = db_delete_job_name(i_jobname_id)
dump i_return_value

sys_free_array(iv_loadcase_ids)
sys_free_array(iv_step_id)
#---------------------------------------------------------------------

Main Index
1526
Code Examples

db_delete_param_set_entries ()

# Purpose : This file provides an example of a call to the


# function db_delete_param_set_entries()
#
# This function shows how to delete all entries
# in the parameter set.
#
# Before running this session file run plate.ses
# to create plate.db. This database contains a
# model of a plate with two jobs 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 db_delete_param_set_entries()
# has the following arguments:
#
# db_delete_param_set_entries
# ( param_set_id )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_param_set_id
INTEGER i_return_value

INTEGER i_count
STRING sv_param_name[80](VIRTUAL)
INTEGER iv_param_type(VIRTUAL)
REAL rv_param_real(VIRTUAL)
STRING sv_param_char[256](VIRTUAL)
INTEGER iv_param_int(VIRTUAL)

INTEGER i_analysis_code_id
INTEGER i_temp
STRING sa_stepname[80](16)
INTEGER ia_step_id(16)
STRING sa_description[256](16)
INTEGER ia_param_set_id(16)

#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)

# To get the analysis code id for “MSC.Nastran” code.


i_return_value =db_get_anal_code_id(“MSC.Nastran”, i_analysis_code_id)
dump i_return_value
#---------------------------------------------------------------------
# Initialized to get maximum number of steps used in the database.
i_count= 16
#
i_return_value = @
db_get_analysis_steps @
( i_analysis_code_id, @
i_count, @
sa_stepname, @
ia_step_id, @
sa_description, @
ia_param_set_id )
dump i_return_value

#---------------------------------------------------------------------
# Using the parameter set id for the first step.
Main Index
CHAPTER 13 1527
Analysis

i_param_set_id=ia_param_set_id(1)
# Initialized to get all parameter entries from the database.
i_return_value = db_count_param_set_entries(i_param_set_id,i_count)
dump i_return_value,i_count

sys_allocate_array(sv_param_name,1,i_count)
sys_allocate_array(iv_param_type,1,i_count)
sys_allocate_array(rv_param_real,1,i_count)
sys_allocate_array(sv_param_char,1,i_count)
sys_allocate_array(iv_param_int,1,i_count)
#
i_return_value = @
db_get_param_set_ent_pcl @
( i_param_set_id, @
i_count, @
sv_param_name, @
iv_param_type, @
rv_param_real, @
sv_param_char, @
iv_param_int )
dump i_return_value,i_count

# Displaying all the parameter entries in the set.


FOR (i_temp=1 TO i_count)
dump sv_param_name(i_temp)
dump iv_param_type(i_temp)
dump rv_param_real(i_temp)
dump sv_param_char(i_temp)
dump iv_param_int(i_temp)
END FOR
#---------------------------------------------------------------------
# Call the function to delete the parameter set.
i_return_value = @
db_delete_param_set_entries @
( i_param_set_id )
dump i_return_value
#---------------------------------------------------------------------
# Get all the parameters associated with the parameter set id.
#
dump i_count

i_return_value = @
db_get_param_set_ent_pcl @
( i_param_set_id, @
i_count, @
sv_param_name, @
iv_param_type, @
rv_param_real, @
sv_param_char, @
iv_param_int )
# The zero value for i_count indicates that all entries are deleted.
# This function will return an error code of 13000072
# (“Unmatched count”) which in this case indicates that the
# parameter set is undefined.
dump i_return_value,i_count

sys_free_array(sv_param_name)
sys_free_array(iv_param_type)
sys_free_array(rv_param_real)
sys_free_array(sv_param_char)
sys_free_array(iv_param_int)
#---------------------------------------------------------------------

Main Index
1528
Code Examples

db_delete_param_set_entry ()

# Purpose : This file provides an example of a call to the


# function db_delete_param_set_entry()
#
# To delete a specific parameter set entry, when
# parameter name is known, this function can
# be used.
#
# Before running this session file run plate.ses
# to create plate.db. This database contains a
# model of a plate with two jobs 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 db_delete_param_set_entry()
# has the following arguments:
#
# db_delete_param_set_entry
# ( param_set_id,
# name )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_param_set_id
STRING s_name[80]
INTEGER i_return_value

INTEGER i_count
STRING sv_param_name[80](VIRTUAL)
INTEGER iv_param_type(VIRTUAL)
REAL rv_param_real(VIRTUAL)
STRING sv_param_char[256](VIRTUAL)
INTEGER iv_param_int(VIRTUAL)

INTEGER i_analysis_code_id
INTEGER i_temp
STRING sa_stepname[80](16)
INTEGER ia_step_id(16)
STRING sa_description[256](16)
INTEGER ia_param_set_id(16)

STRING s_param_name[80]
INTEGER i_param_type
REAL r_param_real
STRING s_param_char[256]
INTEGER i_param_int
INTEGER i_return_value
#---------------------------------------------------------------------
#Open the database “plate.db”
uil_file_open.go(“plate.db”)

# To get the analysis code id for “MSC.Nastran” code.


i_return_value =db_get_anal_code_id(“MSC.Nastran”, i_analysis_code_id)
dump i_return_value
#---------------------------------------------------------------------
# Initialized to get maximum number of steps used in the database.
i_count= 16
#
i_return_value = @
db_get_analysis_steps @
( i_analysis_code_id, @
i_count, @
sa_stepname, @
Main Index
CHAPTER 13 1529
Analysis

ia_step_id, @
sa_description, @
ia_param_set_id )
dump i_return_value

#---------------------------------------------------------------------
# Using the parameter set id for the first step.
i_param_set_id=ia_param_set_id(1)
#---------------------------------------------------------------------
s_param_name=”Session_Example”
i_param_type=3
r_param_real=1.33465e-5
s_param_char=””
i_param_int=0
#
i_return_value = @
db_create_param_set_entry @
( i_param_set_id, @
s_param_name, @
i_param_type, @
r_param_real, @
s_param_char, @
i_param_int )
dump i_return_value

#---------------------------------------------------------------------
# Initialized to get all parameter entries from the database.
i_return_value = db_count_param_set_entries(i_param_set_id,i_count)
dump i_return_value,i_count

sys_allocate_array(sv_param_name,1,i_count)
sys_allocate_array(iv_param_type,1,i_count)
sys_allocate_array(rv_param_real,1,i_count)
sys_allocate_array(sv_param_char,1,i_count)
sys_allocate_array(iv_param_int,1,i_count)
#
i_return_value = @
db_get_param_set_ent_pcl @
( i_param_set_id, @
i_count, @
sv_param_name, @
iv_param_type, @
rv_param_real, @
sv_param_char, @
iv_param_int )
dump i_return_value,i_count

# Displaying all the parameter entries in the set.


FOR (i_temp=1 TO i_count)
WRITE(“ “)
dump sv_param_name(i_temp)
dump iv_param_type(i_temp)
dump rv_param_real(i_temp)
dump sv_param_char(i_temp)
dump iv_param_int(i_temp)
END FOR
#---------------------------------------------------------------------
# Call the function to delete the parameter “Session_Example”
s_name = s_param_name

dump s_name

#
i_return_value = @
db_delete_param_set_entry @
( i_param_set_id, @
s_name )
dump i_return_value
Main Index
1530
Code Examples

#---------------------------------------------------------------------
i_return_value = @
db_get_param_set_ent_pcl @
( i_param_set_id, @
i_count, @
sv_param_name, @
iv_param_type, @
rv_param_real, @
sv_param_char, @
iv_param_int )
dump i_return_value,i_count

# Displaying all the parameter entries in the set.


FOR (i_temp=1 TO i_count)
WRITE(“ “)
dump sv_param_name(i_temp)
dump iv_param_type(i_temp)
dump rv_param_real(i_temp)
dump sv_param_char(i_temp)
dump iv_param_int(i_temp)
END FOR

sys_free_array(sv_param_name)
sys_free_array(iv_param_type)
sys_free_array(rv_param_real)
sys_free_array(sv_param_char)
sys_free_array(iv_param_int)
#---------------------------------------------------------------------

db_get_all_anal_codes ()

# Purpose : This file provides an example of a call to the


# function db_get_all_anal_codes()
#
# This file opens a new database “new.db”
# and gets all the analysis code names from the
# database, in get all, get next method.
#
# 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_anal_codes() has NO arguments.
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
INTEGER i_return_value
INTEGER all_status
INTEGER next_status = 0
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Get all the analysis codes from the database
all_status = @
db_get_all_anal_codes()
dump all_status
#
# Get the analysis code from the database
WHILE ( next_status == 0 )
next_status = @
db_get_next_anal_code @
( s_name )
Main Index
CHAPTER 13 1531
Analysis

dump next_status
dump s_name
END WHILE
#---------------------------------------------------------------------

db_get_all_anal_types ()

# Purpose : This file provides an example of a call to the


# function db_get_all_anal_types()
#
# Demonstrate the use of ‘get_all’ and ‘get_next’
# method of retrieving data for analysis types.
#
# Before running this session file run plate.ses
# to create plate.db. This database contains a
# model of a plate with two jobs 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 db_get_all_anal_types()
# has the following arguments:
#
# db_get_all_anal_types
# ( name )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[128]
INTEGER i_count,i_temp
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)

s_name=”MSC.Nastran”
#
i_return_value = @
db_get_all_anal_types @
( s_name )
dump i_return_value
#---------------------------------------------------------------------
# Count the number of analysis types.
i_return_value = db_count_anal_types(s_name,i_count)
dump i_return_value
#---------------------------------------------------------------------
# Sequentially accessing the analysis types

FOR(i_temp=1 TO i_count)
s_name=”MSC.Nastran”
i_return_value = @
db_get_next_anal_type @
( s_name )
dump i_return_value
dump s_name
END FOR
#---------------------------------------------------------------------

Main Index
1532
Code Examples

db_get_all_job_name_ids ()

# Purpose : This file provides an example of a call to the


# function db_get_all_job_name_ids()
#
# Before running this session file run plate.ses
# to create plate.db. This database contains a
# model of a plate with two jobs created.
#
# This illustration opens the data base
# “plate.db”, gets the count of job name ids
# and the array of job name 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_job_name_ids() has the following arguments:
# db_get_all_job_name_ids
# ( max_count,
# nbr_of_jobnames,
# id )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_max_count, i_count
INTEGER i_nbr_of_jobnames
INTEGER iv_id(VIRTUAL)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)
#
# Count all job name ids
i_return_value = @
db_count_all_job_name_ids ( i_count )
dump i_return_value
dump i_count
#
# Set the maximum count as i_count
i_max_count = i_count
SYS_ALLOCATE_ARRAY( iv_id, 1, i_count )

# Call the function to get the array of IDs

i_return_value = @
db_get_all_job_name_ids @
( i_max_count, @
i_nbr_of_jobnames, @
iv_id )
dump i_return_value
dump iv_id

sys_free_array ( iv_id )
#---------------------------------------------------------------------

Main Index
CHAPTER 13 1533
Analysis

db_get_all_job_names ()

# Purpose : This file provides an example of a call to the


# function db_get_all_job_names()
#
# Before running this session file run plate.ses
# to create plate.db. This database contains a
# model of a plate with two jobs created.
#
# This file opens a database “plate.db”
# and gets all the job names from the
# database, in get all, get next method.
#
# 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_job_names() has NO arguments.
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_jobname[32]
INTEGER all_status
INTEGER next_status = 0
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)
#
# Get all the job names from the database
all_status = db_get_all_job_names ( )
dump all_status
#
# Get the job names from the database
WHILE ( next_status == 0 )
next_status = @
db_get_next_job_name @
( s_jobname )
dump next_status
dump s_jobname
END WHILE
#
#---------------------------------------------------------------------

db_get_anal_code_id ()

# Purpose : This file provides an example of a call to the


# function db_get_anal_code_id()
#
# The template database should support all the
# analysis preferences for running this file.
#
# This illustration opens a new database
# “new.db” and gets the analysis code ids
# for “MSC.Nastran” and “ABAQUS” codes.
#
# 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_anal_code_id() has the following arguments:
# db_get_anal_code_id
Main Index
1534
Code Examples

# ( name,
# id )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
INTEGER i_id
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Get the analysis code id for “MSC.Nastran”
s_name = “MSC.Nastran”
i_return_value = @
db_get_anal_code_id @
( s_name, @
i_id )
dump i_return_value
dump i_id
#
# Get the analysis code id for “ABAQUS”
s_name = “ABAQUS”
i_return_value = @
db_get_anal_code_id @
( s_name, @
i_id )
dump i_return_value
dump i_id
#---------------------------------------------------------------------

db_get_anal_code_name ()

# Purpose : This file provides an example of two calls to


# the function db_get_anal_code_name()
#
# The template database should support all the
# analysis preferences for running this file.
# The reserved analysis code ids are available in
# MSC.Patran User Manual, Volume 4, Chapter 7.
#
# This file opens a new database “new.db” and
# gets the analysis code names for two reserved
# analysis code 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_anal_code_name() has the following arguments:
# db_get_anal_code_name
# ( id,
# name )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_id
STRING s_name[32]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
Main Index
CHAPTER 13 1535
Analysis

#
# Get the analysis code name for id = 1
i_id = 1
i_return_value = @
db_get_anal_code_name @
( i_id, @
s_name )
dump i_return_value
dump s_name

# Get the analysis code name for id = 2


i_id = 2
i_return_value = @
db_get_anal_code_name @
( i_id, @
s_name )
dump i_return_value
dump s_name
#---------------------------------------------------------------------

db_get_anal_type_id ()

# Purpose : This file provides an example of a call to the


# function db_get_anal_type_id()
#
# This file opens a new data base “new.db” and
# creates a new analysis type “New_Type” with a
# id number as “4” and gets the id of newly
# created analysis type. The reserved analysis
# type ids are given in the MSC.Patran User
# Manual, Volume 4, Chapter 7.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_anal_type_id() has the following arguments:
# db_get_anal_type_id
# ( name,
# id )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
INTEGER i_id
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Create a new analysis type. The ids 1, 2 and 3
# are reserved for the analysis types “Structural”,
# “Thermal” and “Fluid Dynamics”
#
i_id = 4
s_name = “New_Type”
i_return_value = @
db_create_analysis_type ( i_id, s_name )
dump i_return_value
#
# Get the analysis type id for “New_Type”
s_name = “New_Type”
i_return_value = @
Main Index
1536
Code Examples

db_get_anal_type_id @
( s_name, @
i_id )
dump i_return_value
dump i_id
#---------------------------------------------------------------------

db_get_anal_type_name ()

# Purpose : This file provides an example of a call to the


# function db_get_anal_type_name()
#
# This file opens a new data base “new.db” and
# creates a new analysis type “New_Type” with a
# id number as “4” and gets the name of newly
# created analysis type. The reserved analysis
# type ids are given in the MSC.Patran User
# Manual, Volume 4, Chapter 7.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_anal_type_name() has the following arguments:
# db_get_anal_type_name
# ( id,
# name )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_id
STRING s_name[32]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Create a new analysis type “New_type” with id 4. The ids 1, 2 and 3
# are reserved for the analysis types “Structural”,
# “Thermal” and “Fluid Dynamics”
#
i_id = 4
s_name = “New_type”
i_return_value = @
db_create_analysis_type ( i_id, s_name )
dump i_return_value
#
# Get the analysis type name for id = 4
i_id = 4
i_return_value = @
db_get_anal_type_name @
( i_id, @
s_name )
dump i_return_value
dump s_name
#---------------------------------------------------------------------

Main Index
CHAPTER 13 1537
Analysis

db_get_analysis_steps ()

# Purpose : This file provides an example of a call to the


# function db_get_analysis_steps()
#
# This function gets the information about all
# currently active analysis steps in the database
#
# Before running this session file run plate.ses
# to create plate.db. This database contains a
# model of a plate with two jobs 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 db_get_analysis_steps()
# has the following arguments:
#
# db_get_analysis_steps
# ( analysis_code_id,
# count,
# stepname,
# step_id,
# description,
# param-set_id )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_analysis_code_id
INTEGER i_count,i_temp
STRING sa_stepname[80](16)
INTEGER ia_step_id(16)
STRING sa_description[256](16)
INTEGER ia_param_set_id(16)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)

# To get the analysis code id for “MSC.Nastran” code.


i_return_value= db_get_anal_code_id(“MSC.Nastran”, i_analysis_code_id)
dump i_return_value
#---------------------------------------------------------------------
# Initialized to get maximum number of steps used in the database.
i_count = 16
#
i_return_value = @
db_get_analysis_steps @
( i_analysis_code_id, @
i_count, @
sa_stepname, @
ia_step_id, @
sa_description, @
ia_param_set_id )
dump i_return_value

# The actual number of steps in the current data base are


dump i_count
# The steps are
FOR (i_temp=1 TO i_count)
dump sa_stepname(i_temp)
dump ia_step_id(i_temp)
dump sa_description(i_temp)
Main Index
1538
Code Examples

dump ia_param_set_id(i_temp)
END FOR

#---------------------------------------------------------------------

db_get_at_for_ac ()

# Purpose : This file provides an example of a call to the


# function db_get_at_for_ac()
#
# This file opens a new data base “new.db” and
# gets the default analysis type for the
# analysis code “MSC.Nastran”
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_at_for_ac() has the following arguments:
# db_get_at_for_ac
# ( acname,
# atname )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_acname[32]
STRING s_atname[32]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Get the default analysis type for “MSC.Nastran”
s_acname = “MSC.Nastran”
i_return_value = @
db_get_at_for_ac @
( s_acname, @
s_atname )
dump i_return_value
dump s_atname
#---------------------------------------------------------------------

db_get_default_anal_code ()

# Purpose : This file provides an example of a call to the


# function db_get_default_anal_code()
#
# This function is used to get the default
# analysis code name. This illustration opens a
# new database “new.db”, and gets the default
# analysis code name.
#
# 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_default_anal_code()
# has the following arguments:
#
# db_get_default_anal_code
Main Index
CHAPTER 13 1539
Analysis

# ( name )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Get the default analysis code name
i_return_value = @
db_get_default_anal_code @
( s_name )
dump i_return_value
dump s_name
#---------------------------------------------------------------------

db_get_default_anal_type ()

# Purpose : This file provides an example of a call to the


# function db_get_default_anal_type()
#
# This file opens a new data base “new.db” and
# gets the default analysis type name.
#
# 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_default_anal_type()
# has the following arguments:
#
# db_get_default_anal_type
# ( name )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Get the default analysis type (s_name)
i_return_value = @
db_get_default_anal_type @
( s_name )
dump i_return_value
dump s_name
#---------------------------------------------------------------------

db_get_id_given_job_name ()

# Purpose : This file provides an example of two calls to


# the function db_get_id_given_job_name()
#
# Before running this session file run plate.ses
# to create plate.db. This database contains a
# model of a plate with two jobs created.
Main Index
1540
Code Examples

#
# This illustration opens the data base
# “plate.db”, gets the array of jobnames, and
# the ids for two job names.
#
# 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_id_given_job_name ( )
# has the following arguments:
#
# db_get_id_given_job_name
# ( jobname,
# id )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_jobname[128]
INTEGER i_id
INTEGER i_return_value
INTEGER i_analysis_code_id, i_max
INTEGER ia_job_name_ids(2)
STRING sa_jobnames[128](2)
STRING sa_description[512](2)
INTEGER ia_param_set_ids(2)
INTEGER ia_status_array(2)
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)
#
# Get the code id for “MSC.Nastran”
i_return_value = @
db_get_anal_code_id ( “MSC.Nastran”, i_analysis_code_id )
dump i_return_value
dump i_analysis_code_id
#
# Get the two Job names and ids for this analysis code
i_max = 2
i_return_value = @
db_get_jobnames_for_a_code @
( i_analysis_code_id, @
i_max, @
sa_jobnames, @
ia_job_name_ids, @
sa_description, @
ia_param_set_ids, @
ia_status_array )
dump i_return_value
dump ia_job_name_ids
dump sa_jobnames
#
# Get the id of the first job name
s_jobname = sa_jobnames(1)
i_return_value = @
db_get_id_given_job_name @
( s_jobname, @
i_id )
dump i_return_value
dump i_id

# Get the id of the second job name


s_jobname = sa_jobnames(2)
i_return_value = @
db_get_id_given_job_name @
( s_jobname, @
Main Index
CHAPTER 13 1541
Analysis

i_id )
dump i_return_value
dump i_id
#---------------------------------------------------------------------

db_get_id_given_job_name_code ()

# Purpose : This file provides an example of two calls to


# the function db_get_id_given_job_name_code()
#
# This file opens the data base “plate.db”,
# gets the array of job names for the code
# “MSC.Nastran”. For the two job names it
# gets the id.
#
# This file can be run by starting a session of
# MSC.Patran, opening a new or existing database,
# and running this session file through the
# “File”,”Session”,”Play” pulldown menus
# on the menu bar.
#
# The function db_get_id_given_job_name_code()
# has the following arguments:
#
# db_get_id_given_job_name_code
# ( acode,
# jobname,
# id )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_jobname[128]
INTEGER i_id
INTEGER i_return_value
INTEGER i_acode, i_max
INTEGER ia_job_name_ids(2)
STRING sa_jobnames[128](2)
STRING sa_description[512](2)
INTEGER ia_param_set_ids(2)
INTEGER ia_status_array(2)
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)
#
# Get the code id for “MSC.Nastran”
i_return_value = @
db_get_anal_code_id( “MSC.Nastran”, i_acode )
dump i_return_value
dump i_acode
#
# Get the two Job names and ids for this analysis code
i_max = 2
i_return_value = @
db_get_jobnames_for_a_code @
( i_acode, @
i_max, @
sa_jobnames, @
ia_job_name_ids, @
sa_description, @
ia_param_set_ids, @
ia_status_array )
dump i_return_value
dump ia_job_name_ids
dump sa_jobnames
#
# Get the id of the first job name
Main Index
1542
Code Examples

s_jobname = sa_jobnames(1)
i_return_value = @
db_get_id_given_job_name_code @
( i_acode, @
s_jobname, @
i_id )
dump i_return_value
dump i_id
#
# Get the id of the second job name
s_jobname = sa_jobnames(2)
i_return_value = @
db_get_id_given_job_name_code @
( i_acode, @
s_jobname, @
i_id )
dump i_return_value
dump i_id
#---------------------------------------------------------------------

db_get_id_given_load_case_name ()

# Purpose : This file provides an example of a call to the


# function db_get_id_given_load_case_name()
#
# This file opens a new data base “new.db”,
# creates a bar element, load/boundary condition
# set and a new load case by name
# “New_Load_Case”. Then gets the load case id
# for the newly created load case name.
#
# 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_id_given_load_case_name()
# has the following arguments:
#
# db_get_id_given_load_case_name
# ( load_case_name,
# load_case_id )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_load_case_name[32]
INTEGER i_load_case_id
INTEGER i_return_value
STRING asm_create_grid_xyz_created_ids[VIRTUAL]
STRING sgm_transform_point_created_ids[VIRTUAL]
STRING fem_create_elemen_elems_created[VIRTUAL]
#---------------------------------------------------------------------
# Open a new data base
uil_file_new.go( ““, “new.db” )
$? YES 36000002
#
# Create a point at location [0 0 0]
i_return_value = @
asm_const_grid_xyz( “1”, @
“[0 0 0]”, @
“Coord 0”, @
asm_create_grid_xyz_created_ids )
dump i_return_value
#
# Create the second point by transforming
# the first point through one unit along X direction.
Main Index
CHAPTER 13 1543
Analysis

i_return_value = @
asm_transform_grid_translate( “2”, @
“<1 0 0>”, @
“Coord 0”, @
1, @
FALSE, @
FALSE, @
“[0 0 0]”, @
sgm_transform_point_created_ids )
dump i_return_value
#
# Create Bar element connecting two points
#
i_return_value = @
fem_create_elems( “Bar “, “Bar2”, “1”, “Standard”, @
TRUE, “Point 1 “, “Point 2 “, ““, @
““, ““, ““, ““, ““, @
fem_create_elemen_elems_created )
dump i_return_value
#
# Create the load/boundary condition set “Fix” for fixing one
# end of the bar.
#
i_return_value = @
loadsbcs_create( “Fix”, “Displacement”, “Nodal”, @
““, “Static”, [“Node 1”], @
“FEM”, “Coord 0”, 1., [“<0 0 0>”, @
“<0 0 0>”], [““, ““] )
dump i_return_value
#
# Create the load case “New_Load_Case” consisting of
# the load/boundary condition set “Fix”
#
i_return_value = @
loadcase_create2( “New_Load_Case”, “Static”, ““, @
1., [“Fix”], [0], [1.], ““, @
0., TRUE )
dump i_return_value
#
# Get the id of the load case “New_Load_Case”
s_load_case_name = “New_Load_Case”
i_return_value = @
db_get_id_given_load_case_name @
( s_load_case_name, @
i_load_case_id )
dump i_return_value
dump i_load_case_id
#
sys_free_string ( asm_create_grid_xyz_created_ids )
sys_free_string ( sgm_transform_point_created_ids )
sys_free_string ( fem_create_elemen_elems_created )
#---------------------------------------------------------------------

db_get_id_given_step_name ()

# Purpose : This file provides an example of a call to the


# function db_get_id_given_step_name()
#
# This function returns analysis step id after
# accepting the analysis step name.
#
# Before running this session file run plate.ses
# to create plate.db. This database contains a
# model of a plate with two jobs created.
#
# This file can be run by starting a session of
Main Index
1544
Code Examples

# MSC.Patran, and running this session file


# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_id_given_step_name()
# has the following arguments:
#
# db_get_id_given_step_name
# ( acode,
# stepname,
# id )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_acode
STRING s_stepname[80]
INTEGER i_id
INTEGER i_return_value
INTEGER i_count
STRING sa_stepname[80](16)
INTEGER ia_step_id(16)
STRING sa_description[256](16)
INTEGER ia_param_set_id(16)
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)

# To get the analysis code id for “MSC.Nastran” code.


i_return_value = db_get_anal_code_id(“MSC.Nastran”, i_acode)
dump i_return_value

# Initialized to get maximum number of steps used in the database.


i_count = 16

i_return_value = @
db_get_analysis_steps @
( i_acode, @
i_count, @
sa_stepname, @
ia_step_id, @
sa_description, @
ia_param_set_id )
dump i_return_value
#---------------------------------------------------------------------
# Selecting the last step name
s_stepname = sa_stepname(i_count)

i_return_value = @
db_get_id_given_step_name @
( i_acode, @
s_stepname, @
i_id )
dump i_return_value
# The step name is
dump s_stepname
# The corresponding step id is
dump i_id
#---------------------------------------------------------------------

Main Index
CHAPTER 13 1545
Analysis

db_get_job_info ()

# Purpose : This file provides an example of a call to the


# function db_get_job_info()
#
# Before running this session file run plate.ses
# to create plate.db. This database contains a
# model of a plate with two jobs created.
#
# This illustration opens the data base
# “plate.db”,gets the two jobname IDs and
# gets the information of these job names.
#
# 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_job_info() has the following arguments:
# db_get_job_info
# ( analysis_code_id,
# jobname_id,
# jobname,
# description,
# param_set_id,
# status )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_analysis_code_id, i_count, i_max
INTEGER i_jobname_id
INTEGER ia_job_name_ids(2)
STRING s_jobname[128], sa_jobnames[128](2)
STRING s_description[512], sa_description[512](2)
INTEGER i_param_set_id, ia_param_set_ids(2)
INTEGER i_status, ia_status_array(2)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)
#
# Get the values of input parameters
# Get the code id for “MSC.Nastran”
i_return_value = @
db_get_anal_code_id @
( “MSC.Nastran”, i_analysis_code_id )
dump i_return_value
dump i_analysis_code_id
#
# Get the two Job names and then ids for this analysis code
i_max = 2

i_return_value = @
db_get_jobnames_for_a_code @
( i_analysis_code_id, @
i_max, @
sa_jobnames, @
ia_job_name_ids, @
sa_description, @
ia_param_set_ids, @
ia_status_array )
dump i_return_value
dump ia_job_name_ids
dump ia_param_set_ids
dump ia_status_array
Main Index
1546
Code Examples

dump sa_description
#---------------------------------------------------------------------
# Get the information of the jobs.
FOR ( i_count = 1 to 2 )
i_jobname_id = ia_job_name_ids ( i_count )
i_return_value = @
db_get_job_info @
( i_analysis_code_id, @
i_jobname_id, @
s_jobname, @
s_description, @
i_param_set_id, @
i_status )
dump i_return_value
dump s_jobname
dump s_description
dump i_param_set_id
dump i_status
END FOR
#---------------------------------------------------------------------

db_get_job_name_given_id ()

# Purpose : This file provides an example of two calls to


# the function db_get_job_name_given_id()
#
# Before running this session file run plate.ses
# to create plate.db. This database contains a
# model of a plate with two jobs created.
#
# This illustration opens the database
# “plate.db”, gets the array of job name ids.
# For the first two ids gets the job names.
#
# 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_job_name_given_id()
# has the following arguments:
#
# db_get_job_name_given_id
# ( jobname,
# id )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
INTEGER i_id
INTEGER i_return_value
INTEGER i_analysis_code_id, i_max
INTEGER ia_job_name_ids(2)
STRING sa_jobnames[128](2)
STRING sa_description[512](2)
INTEGER ia_param_set_ids(2)
INTEGER ia_status_array(2)
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)
#
# Get the code id for “MSC.Nastran”
i_return_value = @
db_get_anal_code_id ( “MSC.Nastran”, i_analysis_code_id )
dump i_return_value
Main Index
CHAPTER 13 1547
Analysis

dump i_analysis_code_id
#
# Get the two Job names and ids for this analysis code
i_max = 2
i_return_value = @
db_get_jobnames_for_a_code @
( i_analysis_code_id, @
i_max, @
sa_jobnames, @
ia_job_name_ids, @
sa_description, @
ia_param_set_ids, @
ia_status_array )
dump i_return_value
dump ia_job_name_ids
dump sa_jobnames
#
# Get the name of the first job id
i_id = ia_job_name_ids(1)
i_return_value = @
db_get_job_name_given_id @
( i_id, @
s_name )
dump i_return_value
dump s_name
#
# Get the name of the second job id
i_id = ia_job_name_ids(2)
i_return_value = @
db_get_job_name_given_id @
( i_id, @
s_name )
dump i_return_value
dump s_name
#---------------------------------------------------------------------

db_get_jobname_list_entries ()

# Purpose : This file provides an example of a call to the


# function db_get_jobname_list_entries()
#
# This illustration opens the database plate.db
# and calls the functions to get all the job name
# IDs in the database. Then it calls the function
# to count the number of load cases associated
# with the last job. Finally it displays the load
# cases counted already.
#
# Before running this session file run plate.ses
# to create plate.db. This database contains a
# model of a plate with two jobs 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 db_get_jobname_list_entries()
# has the following arguments:
#
# db_get_jobname_list_entries
# ( jobname_id,
# count,
# load_case_id,
# step_id )
Main Index
1548
Code Examples

#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_jobname_id
INTEGER i_count
INTEGER iv_step_id(VIRTUAL)
INTEGER iv_load_case_id(VIRTUAL)
INTEGER i_return_value

INTEGER i_num_lists

INTEGER i_analysis_code_id
STRING sv_jobname[80](VIRTUAL)
STRING sv_description[256](VIRTUAL)
INTEGER iv_jobname_id(VIRTUAL)
INTEGER iv_param_set_id(VIRTUAL)
INTEGER iv_status(VIRTUAL)
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)

# To get the analysis code id for “MSC.Nastran” code.


i_return_value = db_get_anal_code_id(“MSC.Nastran”,i_analysis_code_id)
dump i_return_value

# Find out number of jobs in the model for memory allocation.


i_return_value = @
db_count_job_names_for_a_code(i_analysis_code_id,i_count)
dump i_return_value

sys_allocate_array(sv_jobname,1,i_count)
sys_allocate_array(sv_description,1,i_count)
sys_allocate_array(iv_jobname_id,1,i_count)
sys_allocate_array(iv_param_set_id,1,i_count)
sys_allocate_array(iv_status,1,i_count)

i_return_value= @
db_get_jobnames_for_a_code(i_analysis_code_id,i_count,sv_jobname, @
iv_jobname_id ,sv_description,iv_param_set_id,iv_status)
dump i_return_value
#---------------------------------------------------------------------
# Call the function to count the number of load cases associated with
# the last job.
i_jobname_id = iv_jobname_id(i_count)
#
i_return_value = @
db_count_job_name_list_entry @
( i_jobname_id, @
i_num_lists )
dump i_return_value
# The number of load cases associated with the job are.
dump i_num_lists
#---------------------------------------------------------------------
# Call the function to get the load case IDs of the last job.
i_count = i_num_lists
sys_allocate_array(iv_load_case_id,1,i_num_lists)
sys_allocate_array(iv_step_id,1,i_num_lists)

i_return_value = @
db_get_jobname_list_entries @
(i_jobname_id, @
i_count, @
iv_load_case_id, @
iv_step_id)
dump i_return_value
# The load case id and analysis step id associated with the job are.
dump iv_load_case_id,iv_step_id
Main Index
CHAPTER 13 1549
Analysis

# Free the memory


sys_free_array(iv_load_case_id)
sys_free_array(iv_step_id)
sys_free_array(sv_jobname)
sys_free_array(sv_description)
sys_free_array(iv_jobname_id)
sys_free_array(iv_param_set_id)
sys_free_array(iv_status)
#---------------------------------------------------------------------

db_get_jobnames_for_a_code ()

# Purpose : This file provides an example of two calls to


# the function db_get_jobnames_for_a_code()
#
# Before running this session file run plate.ses
# to create plate.db. This database contains a
# model of a plate with two jobs created.
#
# This file opens a database “plate.db” and gets
# the count of job names for “MSC.Nastran” code.
# Then gets the details of all the job names.
#
# 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_jobnames_for_a_code()
# has the following arguments:
#
# db_get_jobnames_for_a_code
# ( analysis_code_id,
# count,
# jobname,
# jobname_id,
# description,
# param_set_id,
# status )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_analysis_code_id
INTEGER i_count
STRING sav_jobname[80](VIRTUAL)
INTEGER iv_jobname_id(VIRTUAL)
STRING sav_description[256](VIRTUAL)
INTEGER iv_param_set_id(VIRTUAL)
INTEGER iv_status(VIRTUAL)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)
#
# Input parameters
# Get the code id for “MSC.Nastran”
i_return_value = @
db_get_anal_code_id( “MSC.Nastran”, i_analysis_code_id )
dump i_return_value
dump i_analysis_code_id
#
# Get the count of job names(i_count) for this analysis code
i_return_value = @
db_count_job_names_for_a_code ( i_analysis_code_id, i_count )
Main Index
1550
Code Examples

dump i_return_value
dump i_count
#
SYS_ALLOCATE_ARRAY( iv_status, 1, i_count )
SYS_ALLOCATE_ARRAY( iv_param_set_id, 1, i_count )
SYS_ALLOCATE_ARRAY( iv_jobname_id, 1, i_count )
SYS_ALLOCATE_ARRAY( sav_description, 1, i_count )
SYS_ALLOCATE_ARRAY( sav_jobname, 1, i_count )
#
# Get the array of job names
i_return_value = @
db_get_jobnames_for_a_code @
( i_analysis_code_id, @
i_count, @
sav_jobname, @
iv_jobname_id, @
sav_description, @
iv_param_set_id, @
iv_status )
dump i_return_value

# The output values


dump sav_jobname
dump iv_jobname_id
dump sav_description
dump iv_param_set_id
dump iv_status
#
# Free the memory
sys_free_array ( sav_jobname )
sys_free_array ( iv_jobname_id )
sys_free_array ( sav_description )
sys_free_array ( iv_param_set_id )
sys_free_array ( iv_status )
#---------------------------------------------------------------------

db_get_last_jobname ()

# Purpose : This file provides an example of two calls to


# the function db_get_last_jobname()
#
# Before running this session file run plate.ses
# to create plate.db. This database contains a
# model of a plate with two jobs created.
#
# This illustration opens the database
# “plate.db” and gets the array of job names
# for “MSC.Nastran”. Assigns first two job names
# as last job names in sequence. Each time gets
# the last job name for verification.
#
# 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_last_jobname() has the following arguments:
# db_get_last_jobname
# ( jobname )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_jobname[32]
INTEGER i_return_value
INTEGER i_analysis_code_id, i_max
Main Index
CHAPTER 13 1551
Analysis

INTEGER ia_job_name_ids(2)
STRING sa_jobnames[128](2)
STRING sa_description[512](2)
INTEGER ia_param_set_ids(2)
INTEGER ia_status_array(2)
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)
#
# Get the code id for “MSC.Nastran”
i_return_value = @
db_get_anal_code_id( “MSC.Nastran”, i_analysis_code_id )
dump i_return_value
dump i_analysis_code_id
#
# Get the two Job names for this analysis code
i_max = 2
i_return_value = @
db_get_jobnames_for_a_code @
( i_analysis_code_id, @
i_max, @
sa_jobnames, @
ia_job_name_ids, @
sa_description, @
ia_param_set_ids, @
ia_status_array )
dump i_return_value
# The Job names array
dump sa_jobnames
#
# Set the sa_jobnames(1) as the last job name
s_jobname = sa_jobnames(1)
i_return_value = @
db_assign_last_jobname @
( s_jobname )
dump i_return_value
#
# Get the last job name
i_return_value = @
db_get_last_jobname(s_jobname)
dump i_return_value
dump s_jobname
#
# Now set the sa_jobnames(2) as the last job name
s_jobname = sa_jobnames(2)
i_return_value = @
db_assign_last_jobname @
( s_jobname )
dump i_return_value
#
# Now get the newly set last job name
i_return_value = @
db_get_last_jobname ( s_jobname )
dump i_return_value
dump s_jobname
#---------------------------------------------------------------------

db_get_next_anal_code ()

# Purpose : This file provides an example of a call to the


# function db_get_next_anal_code()
#
# This file opens a new database “new.db”
# and gets all the analysis code names from the
# database, in get all, get next method.
Main Index
1552
Code Examples

#
# 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_anal_code() has the following arguments:
# db_get_next_anal_code
# ( name )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
INTEGER i_return_value
INTEGER all_status
INTEGER next_status = 0
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Get all the analysis codes from the database
all_status = db_get_all_anal_codes()
dump all_status
#
# Get the analysis code from the database
WHILE ( next_status == 0 )
next_status = @
db_get_next_anal_code @
( s_name )
dump next_status
dump s_name
END WHILE
#---------------------------------------------------------------------

db_get_next_anal_type ()

# Purpose : This file provides an example of a call to the


# function db_get_next_anal_type()
#
# Demonstrate the use of ‘get_all’ and ‘get_next’
# method of retrieving data for analysis types.
#
# Before running this session file run plate.ses
# to create plate.db. This database contains a
# model of a plate with two jobs 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 db_get_next_anal_type()
# has the following arguments:
#
# db_get_next_anal_type
# ( name )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[128]
INTEGER i_count,i_temp
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “plate.db”
Main Index
CHAPTER 13 1553
Analysis

uil_file_open.go(“plate.db”)

s_name=”MSC.Nastran”
#
i_return_value = @
db_get_all_anal_types @
( s_name )
dump i_return_value
#---------------------------------------------------------------------
# Count the number of analysis types.
i_return_value = db_count_anal_types(s_name,i_count)
dump i_return_value
#---------------------------------------------------------------------
# Sequentially accessing the analysis types

FOR(i_temp=1 TO i_count)
s_name=”MSC.Nastran”
i_return_value = @
db_get_next_anal_type @
( s_name )
dump i_return_value
dump s_name
END FOR
#---------------------------------------------------------------------

db_get_next_job_name ()

# Purpose : This file provides an example of a call to the


# function db_get_next_job_name()
#
# Before running this session file run plate.ses
# to create plate.db. This database contains a
# model of a plate with two jobs created.
#
# This file opens a database “plate.db”
# and gets all the job names from the
# database, in get all, get next method.
#
# 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_job_name() has the following arguments:
# db_get_next_job_name
# ( jobname )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_jobname[32]
INTEGER all_status
INTEGER next_status = 0
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)
#
# Get all the all the job names from the database
all_status = db_get_all_job_names ( )
dump all_status
#
# Get the job names from the database
WHILE ( next_status == 0 )
next_status = @
db_get_next_job_name @
( s_jobname )
Main Index
1554
Code Examples

dump next_status
dump s_jobname
END WHILE
#
#---------------------------------------------------------------------

db_get_param_set_ent_pcl ()

# Purpose : This file provides an example of a call to the


# function db_get_param_set_ent_pcl()
#
# Before running this session file run plate.ses
# to create plate.db. This database contains a
# model of a plate with two jobs 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 db_get_param_set_ent_pcl()
# has the following arguments:
#
# db_get_param_set_ent_pcl
# ( param_set_id,
# count,
# param_name,
# param_type,
# param_real,
# param_char,
# param_int )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_param_set_id
INTEGER i_count
STRING sv_param_name[80](VIRTUAL)
INTEGER iv_param_type(VIRTUAL)
REAL rv_param_real(VIRTUAL)
STRING sv_param_char[256](VIRTUAL)
INTEGER iv__param_int(VIRTUAL)
INTEGER i_return_value

INTEGER i_analysis_code_id
INTEGER i_temp
STRING sa_stepname[80](16)
INTEGER ia_step_id(16)
STRING sa_description[256](16)
INTEGER ia_param_set_id(16)
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)

# To get the analysis code id for “MSC.Nastran” code.


i_return_value =db_get_anal_code_id(“MSC.Nastran”, i_analysis_code_id)
dump i_return_value
#---------------------------------------------------------------------
# Initialized to get maximum number of steps used in the database.
i_count= 16
#
i_return_value = @
db_get_analysis_steps @
( i_analysis_code_id, @
i_count, @
sa_stepname, @
Main Index
CHAPTER 13 1555
Analysis

ia_step_id, @
sa_description, @
ia_param_set_id )
dump i_return_value

#---------------------------------------------------------------------
# Using the parameter set id for the first step.
i_param_set_id = ia_param_set_id(1)
# Initialized to get all parameter entries from the database.
i_return_value = db_count_param_set_entries(i_param_set_id,i_count)
dump i_return_value,i_count

sys_allocate_array(sv_param_name,1,i_count)
sys_allocate_array(iv_param_type,1,i_count)
sys_allocate_array(rv_param_real,1,i_count)
sys_allocate_array(sv_param_char,1,i_count)
sys_allocate_array(iv__param_int,1,i_count)
#
i_return_value = @
db_get_param_set_ent_pcl @
( i_param_set_id, @
i_count, @
sv_param_name, @
iv_param_type, @
rv_param_real, @
sv_param_char, @
iv__param_int )
dump i_return_value,i_count

# Displaying all the parameter entries in the set.


FOR (i_temp=1 TO i_count)
dump sv_param_name(i_temp)
dump iv_param_type(i_temp)
dump rv_param_real(i_temp)
dump sv_param_char(i_temp)
dump iv__param_int(i_temp)
END FOR

sys_free_array(sv_param_name)
sys_free_array(iv_param_type)
sys_free_array(rv_param_real)
sys_free_array(sv_param_char)
sys_free_array(iv__param_int)
#---------------------------------------------------------------------

db_get_param_set_entries ()

# Purpose : This file provides an example of a call to the


# function db_get_param_set_entries()
#
# This session file explains how to get the
# entries listed in a parameter set and shows
# how to get the related parameter set ID.
#
# Before running this session file run plate.ses
# to create plate.db. This database contains a
# model of a plate with two jobs 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 db_get_param_set_entries()
# has the following arguments:
Main Index
1556
Code Examples

#
# db_get_param_set_entries
# ( param_set_id,
# count,
# param_name,
# param_type,
# param_real,
# param_char,
# param_int )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_param_set_id
INTEGER i_count
STRING sv_param_name[80](VIRTUAL)
INTEGER iv_param_type(VIRTUAL)
REAL rv_param_real(VIRTUAL)
STRING sv_param_char[256](VIRTUAL)
INTEGER iv_param_int(VIRTUAL)
INTEGER i_return_value

INTEGER i_analysis_code_id
INTEGER i_temp
STRING sa_stepname[80](16)
INTEGER ia_step_id(16)
STRING sa_description[256](16)
INTEGER ia_param_set_id(16)
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)

# To get the analysis code id for “MSC.Nastran” code.


i_return_value=db_get_anal_code_id(“MSC.Nastran”, i_analysis_code_id)
dump i_return_value
#---------------------------------------------------------------------
# Initialized to get maximum number of steps used in the database.
i_count = 16
#
i_return_value = @
db_get_analysis_steps @
( i_analysis_code_id, @
i_count, @
sa_stepname, @
ia_step_id, @
sa_description, @
ia_param_set_id )
dump i_return_value
dump ia_param_set_id
#---------------------------------------------------------------------
# Using the parameter set id for the first step.
i_param_set_id = ia_param_set_id(1)
# Initialized to get all parameter entries from the database.
i_return_value = db_count_param_set_entries(i_param_set_id,i_count)
dump i_return_value,i_count

sys_allocate_array(sv_param_name,1,i_count)
sys_allocate_array(iv_param_type,1,i_count)
sys_allocate_array(rv_param_real,1,i_count)
sys_allocate_array(sv_param_char,1,i_count)
sys_allocate_array(iv_param_int,1,i_count)

i_return_value = @
db_get_param_set_entries @
( i_param_set_id, @
i_count, @
sv_param_name, @
iv_param_type, @
Main Index
CHAPTER 13 1557
Analysis

rv_param_real, @
sv_param_char, @
iv_param_int )
dump i_return_value,i_count

# Display all the parameter entries in the set.


FOR (i_temp=1 TO i_count)
dump sv_param_name(i_temp)
dump iv_param_type(i_temp)
dump rv_param_real(i_temp)
dump sv_param_char(i_temp)
dump iv_param_int(i_temp)
END FOR

sys_free_array(sv_param_name)
sys_free_array(iv_param_type)
sys_free_array(rv_param_real)
sys_free_array(sv_param_char)
sys_free_array(iv_param_int)
#---------------------------------------------------------------------

db_get_param_set_entry ()

# Purpose : This file provides an example of a call to the


# function db_get_param_set_entry()
#
# This session file displays the first parameter
# of the first parameter set id listed in the
# analysis_step relation.
#
# Before running this session file run plate.ses
# to create plate.db. This database contains a
# model of a plate with two jobs 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 db_get_param_set_entry()
# has the following arguments:
#
# db_get_param_set_entry
# ( param_set_id,
# param_name,
# param_type,
# param_real,
# param_char,
# param_int )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_param_set_id
STRING s_param_name[80]
INTEGER i_param_type
REAL r_param_real
STRING s_param_char[256]
INTEGER i_param_int
INTEGER i_return_value

INTEGER i_count
STRING sv_param_name[80](VIRTUAL)
INTEGER iv_param_type(VIRTUAL)
REAL rv_param_real(VIRTUAL)
STRING sv_param_char[256](VIRTUAL)
Main Index
1558
Code Examples

INTEGER iv_param_int(VIRTUAL)

INTEGER i_analysis_code_id
INTEGER i_temp
STRING sa_stepname[80](16)
INTEGER ia_step_id(16)
STRING sa_description[256](16)
INTEGER ia_param_set_id(16)
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)

# To get the analysis code id for “MSC.Nastran” code.


i_return_value =db_get_anal_code_id(“MSC.Nastran”, i_analysis_code_id)
dump i_return_value
#---------------------------------------------------------------------
# Initialized to get maximum number of steps used in the database.
i_count= 16
#
i_return_value = @
db_get_analysis_steps @
( i_analysis_code_id, @
i_count, @
sa_stepname, @
ia_step_id, @
sa_description, @
ia_param_set_id )
dump i_return_value

#---------------------------------------------------------------------
# Using the parameter set id for the first step.
i_param_set_id=ia_param_set_id(1)
# Initialized to get all parameter entries from the database.
i_return_value = db_count_param_set_entries(i_param_set_id,i_count)
dump i_return_value,i_count

sys_allocate_array(sv_param_name,1,i_count)
sys_allocate_array(iv_param_type,1,i_count)
sys_allocate_array(rv_param_real,1,i_count)
sys_allocate_array(sv_param_char,1,i_count)
sys_allocate_array(iv_param_int,1,i_count)
#
i_return_value = @
db_get_param_set_ent_pcl @
( i_param_set_id, @
i_count, @
sv_param_name, @
iv_param_type, @
rv_param_real, @
sv_param_char, @
iv_param_int )
dump i_return_value

# Available parameter entries are.


dump sv_param_name

#---------------------------------------------------------------------
# Displaying details for the first parameter name.
s_param_name=sv_param_name(1)
#
i_return_value = @
db_get_param_set_entry @
( i_param_set_id, @
s_param_name, @
i_param_type, @
r_param_real, @
s_param_char, @
Main Index
CHAPTER 13 1559
Analysis

i_param_int )
dump i_return_value

# Details for the first parameter name are.


dump i_param_set_id
dump s_param_name
dump i_param_type
dump r_param_real
dump s_param_char
dump i_param_int

sys_free_array(sv_param_name)
sys_free_array(iv_param_type)
sys_free_array(rv_param_real)
sys_free_array(sv_param_char)
sys_free_array(iv_param_int)
#---------------------------------------------------------------------

db_get_pset_matrix_entry ()

# Purpose : This file provides an example of a call to the


# function db_get_pset_matrix_entry()
#
# This session file shows how to add and retrieve
# the matrix listed in a parameter set as a entry
#
# Before running this session file run plate.ses
# to create plate.db. This database contains a
# model of a plate with two jobs 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 db_get_pset_matrix_entry()
# has the following arguments:
#
# db_get_pset_matrix_entry
# ( param_set_id,
# param_name,
# matrix )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_param_set_id
STRING s_param_name[128]
INTEGER i_nrows
INTEGER i_ncols
REAL rv_matrix(VIRTUAL)
INTEGER i_return_value

INTEGER i_count,i_temp
INTEGER i_analysis_code_id
STRING sa_stepname[80](16)
INTEGER ia_step_id(16)
STRING sa_description[256](16)
INTEGER ia_param_set_id(16)
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)

# To get the analysis code id for “MSC.Nastran” code.


i_return_value =db_get_anal_code_id(“MSC.Nastran”, i_analysis_code_id)
dump i_return_value
Main Index
1560
Code Examples

#---------------------------------------------------------------------
# Initialized to get maximum number of steps used in the database.
i_count = 16
#
i_return_value = @
db_get_analysis_steps @
( i_analysis_code_id, @
i_count, @
sa_stepname, @
ia_step_id, @
sa_description, @
ia_param_set_id )
dump i_return_value
#---------------------------------------------------------------------
# Using the parameter set id for the first step.
i_param_set_id=ia_param_set_id(1)
s_param_name=”pset_Session_example”
i_nrows=4
i_ncols=3

sys_allocate_array(rv_matrix,1,i_nrows*i_ncols)
FOR(i_temp=1 TO i_nrows*i_ncols)
rv_matrix(i_temp)=i_temp/3.0
END FOR
#---------------------------------------------------------------------
# Call the function to add a “parameter pset_Session_example”
i_return_value = @
db_create_pset_matrix_entry @
( i_param_set_id, @
s_param_name, @
i_nrows, @
i_ncols, @
rv_matrix )
dump i_return_value

sys_free_array(rv_matrix)
#---------------------------------------------------------------------
# Call the function to get the size of the matrix.

i_return_value = @
db_get_pset_matrix_size @
( i_param_set_id, @
s_param_name, @
i_nrows, @
i_ncols )
dump i_return_value

# The size of the matrix is


dump i_nrows,i_ncols
# Allocating memory to the array.
sys_allocate_array(rv_matrix,1,i_nrows*i_ncols)
#---------------------------------------------------------------------
# Get the matrix.

i_return_value = @
db_get_pset_matrix_entry @
( i_param_set_id, @
s_param_name, @
rv_matrix )
dump i_return_value

# The array is.


dump rv_matrix

sys_free_array(rv_matrix)
#---------------------------------------------------------------------
Main Index
CHAPTER 13 1561
Analysis

db_get_pset_matrix_size ()

# Purpose : This file provides an example of a call to the


# function db_get_pset_matrix_size()
#
# This session file shows how to add a matrix as
# a parameter set entry and to find the size of
# the real array listed in a parameter set.
#
# Before running this session file run plate.ses
# to create plate.db. This database contains a
# model of a plate with two jobs 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 db_get_pset_matrix_size() has the following arguments:
#
# db_get_pset_matrix_size
# ( param_set_id,
# param_name,
# nrows,
# ncols )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_param_set_id
STRING s_param_name[128]
INTEGER i_nrows
INTEGER i_ncols
REAL rv_matrix(VIRTUAL)
INTEGER i_return_value

INTEGER i_count,i_temp
INTEGER i_analysis_code_id
STRING sa_stepname[80](16)
INTEGER ia_step_id(16)
STRING sa_description[256](16)
INTEGER ia_param_set_id(16)
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)

# To get the analysis code id for “MSC.Nastran” code.


i_return_value =db_get_anal_code_id(“MSC.Nastran”, i_analysis_code_id)
dump i_return_value
#---------------------------------------------------------------------
# Initialized to get maximum number of steps used in the database.
i_count = 16
#
i_return_value = @
db_get_analysis_steps @
( i_analysis_code_id, @
i_count, @
sa_stepname, @
ia_step_id, @
sa_description, @
ia_param_set_id )
dump i_return_value
#---------------------------------------------------------------------
# Using the parameter set id for the first step.
i_param_set_id=ia_param_set_id(1)
s_param_name=”pset_Session_example”
Main Index
1562
Code Examples

i_nrows=4
i_ncols=3

sys_allocate_array(rv_matrix,1,i_nrows*i_ncols)
FOR(i_temp=1 TO i_nrows*i_ncols)
rv_matrix(i_temp)=i_temp/3.0
END FOR
#---------------------------------------------------------------------
# Call the function to add a “parameter pset_Session_example”
i_return_value = @
db_create_pset_matrix_entry @
( i_param_set_id, @
s_param_name, @
i_nrows, @
i_ncols, @
rv_matrix )
dump i_return_value

sys_free_array(rv_matrix)
#---------------------------------------------------------------------
# Call the function to get the size of the matrix.

i_return_value = @
db_get_pset_matrix_size @
( i_param_set_id, @
s_param_name, @
i_nrows, @
i_ncols )
dump i_return_value

# The size of the matrix is


dump i_nrows,i_ncols
# Allocating memory to the array.
sys_allocate_array(rv_matrix,1,i_nrows*i_ncols)
#---------------------------------------------------------------------
# Get the matrix.

i_return_value = @
db_get_pset_matrix_entry @
( i_param_set_id, @
s_param_name, @
rv_matrix )
dump i_return_value

# The array is.


dump rv_matrix

sys_free_array(rv_matrix)
#---------------------------------------------------------------------

db_get_step_info ()

# Purpose : This file provides an example of a call to the


# function db_get_step_info()
#
# This function gives information of a particular
# analysis_step.
#
# Before running this session file run plate.ses
# to create plate.db. This database contains a
# model of a plate with two jobs created.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
Main Index
CHAPTER 13 1563
Analysis

# menus on the menu bar.


#
# The function db_get_step_info() has the following arguments:
#
# db_get_step_info
# ( analysis_code_id,
# step_id,
# stepname,
# description,
# param_set_id )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_analysis_code_id
INTEGER i_step_id
STRING s_stepname[80]
STRING s_description[256]
INTEGER i_param_set_id
INTEGER i_return_value

INTEGER i_count
STRING sa_stepname[80](16)
INTEGER ia_step_id(16)
STRING sa_description[256](16)
INTEGER ia_param_set_id(16)
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)

# To get the analysis code id for “MSC.Nastran” code.


i_return_value= db_get_anal_code_id(“MSC.Nastran”, i_analysis_code_id)
dump i_return_value
#---------------------------------------------------------------------
# Initialized to get maximum number of steps used in the database.
i_count= 16
#
i_return_value = @
db_get_analysis_steps @
( i_analysis_code_id, @
i_count, @
sa_stepname, @
ia_step_id, @
sa_description, @
ia_param_set_id )
dump i_return_value
#---------------------------------------------------------------------
# Call the function to get the information of last step.
i_step_id = ia_step_id(i_count)
#
i_return_value = @
db_get_step_info @
( i_analysis_code_id, @
i_step_id, @
s_stepname, @
s_description, @
i_param_set_id )
dump i_return_value

# The step id, name, description and parameter set id in sequence are
dump i_step_id
dump s_stepname
dump s_description
dump i_param_set_id
#---------------------------------------------------------------------

Main Index
1564
Code Examples

db_get_steps_for_a_job ()

# Purpose : This file provides an example of a call to the


# function db_get_steps_for_a_job()
#
# This function returns the step information for
# the given analysis code id and jobname.
#
# Before running this session file run plate.ses
# to create plate.db. This database contains a
# model of a plate with two jobs 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 db_get_steps_for_a_job()
# has the following arguments:
#
# db_get_steps_for_a_job
# ( analysis_code_id,
# jobname_id,
# count,
# stepname,
# step_id,
# description,
# param_set_id )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_analysis_code_id
INTEGER i_jobname_id
INTEGER i_count,i_temp
STRING sa_stepname[80](8)
STRING s_jobname[80]
INTEGER ia_step_id(8)
STRING sa_description[256](8)
INTEGER ia_param_set_id(8)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)

# To get the analysis code id for “MSC.Nastran” code.


i_return_value=db_get_anal_code_id(“MSC.Nastran”, i_analysis_code_id)
dump i_return_value

# To get the job name of the last job created.


i_return_value = db_get_last_jobname(s_jobname)
dump i_return_value

# To get the job id of the last job created.


i_return_value = db_get_id_given_job_name_code @
(i_analysis_code_id,s_jobname,i_jobname_id)
dump i_return_value

# To get number of steps associated with this job.


i_return_value = db_count_steps_for_a_job(i_analysis_code_id, @
i_jobname_id,i_count)
dump i_return_value
#---------------------------------------------------------------------
#
i_return_value = @
db_get_steps_for_a_job @
Main Index
CHAPTER 13 1565
Analysis

( i_analysis_code_id, @
i_jobname_id, @
i_count, @
sa_stepname, @
ia_step_id, @
sa_description, @
ia_param_set_id )

dump i_return_value

# The analysis steps are listed in sequence as- name, id, description
# and parameter set id.
FOR (i_temp=1 TO i_count)
dump sa_stepname(i_temp)
dump ia_step_id(i_temp)
dump sa_description(i_temp)
dump ia_param_set_id(i_temp)
END FOR
#---------------------------------------------------------------------

db_set_at_for_ac ()

# Purpose : This file provides an example of a call to the


# function db_set_at_for_ac()
#
# This file opens a new data base “new.db” and
# and changes the default analysis type for
# the analysis code “MSC.Nastran”.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_set_at_ac() has the following arguments:
# db_set_at_for_ac
# ( anal_code,
# anal_type )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_anal_code[32]
STRING s_anal_type[32]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Get the default analysis type for “MSC.Nastran”
s_anal_code = “MSC.Nastran”
i_return_value = @
db_get_at_for_ac(s_anal_code,s_anal_type)
dump i_return_value
dump s_anal_type
#
# Change the default analysis type.
IF ( s_anal_type == “Structural” ) THEN
s_anal_type = “Thermal”
ELSE
s_anal_type = “Structural”
END IF
#
i_return_value = @
db_set_at_for_ac @
Main Index
1566
Code Examples

( s_anal_code, @
s_anal_type )
dump i_return_value

# Check the new default analysis type


i_return_value = @
db_get_at_for_ac(s_anal_code,s_anal_type)
dump i_return_value
dump s_anal_type
#---------------------------------------------------------------------

db_set_default_anal_code ()

# Purpose : This file provides an example of two calls to


# the function db_set_default_anal_code()
#
# The template database should support all
# analysis preferences for running this file.
#
# This file opens the new database “new.db” and
# sets the default analysis code as MSC.Nastran
# Using a function gets the default analysis
# code. Again it changes the default analysis
# code to “ABAQUS”.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_set_default_anal_code() has the following
# arguments:
# db_set_default_anal_code
# ( name )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Set the default analysis code name as “MSC.Nastran”
i_return_value = @
db_set_default_anal_code @
( “MSC.Nastran” )
dump i_return_value
#
# Get the default analysis code name
i_return_value = @
db_get_default_anal_code ( s_name )
dump i_return_value
dump s_name
#
# Set the new default analysis code name as “ABAQUS”
i_return_value = @
db_set_default_anal_code @
( “ABAQUS” )
dump i_return_value
#
# Get the new default analysis code name
i_return_value = @
db_get_default_anal_code ( s_name )
Main Index
CHAPTER 13 1567
Analysis

dump i_return_value
dump s_name
#
# The user can also verify the analysis preferences
# for the name of the default analysis code
#---------------------------------------------------------------------

db_set_default_anal_type ()

# Purpose : This file provides an example of a call to the


# function db_set_default_anal_type()
#
# This file opens a new data base “new.db” and
# changes the default analysis type.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_set_default_anal_type() has the following
# arguments:
# db_set_default_anal_type
# ( name )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Get the default analysis type
i_return_value = @
db_get_default_anal_type(s_name)
dump i_return_value
dump s_name

# Change the default analysis type


IF ( s_name == “Structural” ) THEN
s_name = “Thermal”
ELSE
s_name = “Structural”
END IF
#
i_return_value = @
db_set_default_anal_type @
( s_name )
dump i_return_value
#
# Get the default analysis type
i_return_value = @
db_get_default_anal_type ( s_name )
dump i_return_value
dump s_name
#---------------------------------------------------------------------

Main Index
1568
Code Examples

db_set_model_file_suffix ()

# Purpose : This file provides an example of two calls to


# the function db_set_model_file_suffix()
#
# This function sets the input file suffix for
# the given analysis code. This illustration
# opens the new database “new.db” and sets the
# suffix of the input file as “.in” for the
# “MSC.Nastran” analysis code.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_set_model_file_suffix() has the following
# arguments:
# db_set_model_file_suffix
# ( name,
# suffix )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
STRING s_suffix[6]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# The analysis code is “MSC.Nastran”


s_name = “MSC.Nastran”
#
# Get the existing suffix of the model(input) file
i_return_value = @
db_get_model_file_suffix ( s_name, s_suffix )
dump i_return_value
dump s_suffix

# Set the new suffix for the input file as “.in”


s_suffix = “.in”
#
i_return_value = @
db_set_model_file_suffix @
( s_name, @
s_suffix )
dump i_return_value

# Get the new suffix of the model(input) file


i_return_value = @
db_get_model_file_suffix ( s_name, s_suffix )
dump i_return_value
dump s_suffix

# The user can verify the suffix of the input file in


# the preferences window also.
#---------------------------------------------------------------------

Main Index
CHAPTER 13 1569
Analysis

db_set_pref ()

# Purpose : This file provides an example of a call to the


# function db_set_pref()
#
# This session file shows how to add a preference
# and reset the same.
#
# Before running this session file run plate.ses
# to create plate.db. This database contains a
# model of a plate with two jobs 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 db_set_pref() has the following arguments:
# db_set_pref
# ( pref_id,
# data_type,
# int_pref,
# log_pref,
# real_pref,
# char_pref )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_pref_id
INTEGER i_data_type
INTEGER i_int_pref
LOGICAL l_log_pref
REAL r_real_pref
STRING s_char_pref[16]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)

# Adding a preference_id which is not listed in ‘pref_names.i’ file


# in P3_HOME/Customization directory.
i_pref_id = 105

# Add the value of the Integer preference to 1234


# i_data_type = 1 (Integer preference)
i_data_type = 1
i_int_pref = 1234
i_return_value = @
db_add_pref @
( i_pref_id, @
i_data_type, @
i_int_pref, @
l_log_pref, @
r_real_pref, @
s_char_pref )
dump i_return_value

# Get the value/data type of the added preference( ID is 105).

i_return_value = @
db_get_pref @
( i_pref_id, @
i_data_type, @
i_int_pref, @
l_log_pref, @
r_real_pref, @
s_char_pref )
Main Index
1570
Code Examples

dump i_return_value

# The value of preferences for pref_id of 105.


dump s_char_pref
dump i_int_pref
dump l_log_pref
dump r_real_pref

#---------------------------------------------------------------------
# Set the value and data type of the preference ID 105 to a
# real value.
# i_data_type = 3 (Real preference)

i_data_type = 3
r_real_pref=1.9845e2
#
i_return_value = @
db_set_pref @
( i_pref_id, @
i_data_type, @
i_int_pref, @
l_log_pref, @
r_real_pref, @
s_char_pref )
dump i_return_value

#---------------------------------------------------------------------
# Get the value/data type of the preference ID 105.

i_return_value = @
db_get_pref @
( i_pref_id, @
i_data_type, @
i_int_pref, @
l_log_pref, @
r_real_pref, @
s_char_pref )
dump i_return_value

# The value of preferences for pref_id of 105.


dump s_char_pref
dump i_int_pref
dump l_log_pref
dump r_real_pref

#---------------------------------------------------------------------

db_set_results_file_suffix ()

# Purpose : This file provides an example of a call to


# the function db_set_results_file_suffix()
#
# This function is used to set the results file
# suffix for a particular analysis type. This
# session file opens the new data base “new.db”
# and sets the suffix of the results file for
# “MSC.Nastran” analysis code as “.res”. The
# results file extension is dependent on the
# particular analysis code.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_set_results_file_suffix()
Main Index
CHAPTER 13 1571
Analysis

# has the following arguments:


# db_set_results_file_suffix
# ( name,
# suffix )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
STRING s_suffix[6]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# The analysis code is “MSC.Nastran”


s_name = “MSC.Nastran”

# Get the existing suffix for the results file


i_return_value = @
db_get_results_file_suffix( s_name, s_suffix )
dump i_return_value
dump s_suffix

# Set the new suffix for the results file as “.res”


s_suffix = “.res”
#
i_return_value = @
db_set_results_file_suffix @
( s_name, @
s_suffix )
dump i_return_value

# Get the new suffix for the results file


i_return_value = @
db_get_results_file_suffix( s_name, s_suffix )
dump i_return_value
dump s_suffix

# Check for the suffix “.res” in analysis preferences


#---------------------------------------------------------------------

db_update_analysis_step ()

# Purpose : This file provides an example of a call to the


# function db_update_analysis_step()
#
# This session file creates a analysis_step and
# shows how to update the same.
#
# Before running this session file run plate.ses
# to create plate.db. This database contains a
# model of a plate with two jobs 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 db_update_analysis_step() has the following arguments:
#
# db_update_analysis_step
# ( analysis_code_id,
# analysis_step_id,
# stepname,
Main Index
1572
Code Examples

# stepdesc,
# param_set_id )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_analysis_code_id
INTEGER i_analysis_step_id
INTEGER i_param_set_id
INTEGER i_return_value

STRING s_stepname[80]
STRING s_stepdesc[256]

INTEGER i_count,i_temp
STRING sa_stepname[80](16)
INTEGER ia_analysis_step_id(16)
STRING sa_stepdesc[256](16)
INTEGER ia_param_set_id(16)
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)

# To get the analysis code id for “MSC.Nastran” code.


i_return_value =db_get_anal_code_id(“MSC.Nastran”, i_analysis_code_id)
dump i_return_value
#---------------------------------------------------------------------
# Creating analysis_step for “MSC.Nastran” analysis code.
s_stepname= “ pcl_example”
s_stepdesc= “Written as example for function db_create_analysis_step”
i_return_value = @
db_create_analysis_step @
( s_stepname, @
s_stepdesc, @
i_analysis_code_id, @
i_analysis_step_id, @
i_param_set_id )
dump i_return_value
# The step id of the step created is
dump i_analysis_step_id
# The parameter set id of the step created is
dump i_param_set_id
#---------------------------------------------------------------------
# Initialized to get maximum number of steps used in the database.
i_count= 16
#
i_return_value = @
db_get_analysis_steps @
( i_analysis_code_id, @
i_count, @
sa_stepname, @
ia_analysis_step_id, @
sa_stepdesc, @
ia_param_set_id )
dump i_return_value

# The actual number of steps in the current data base are


dump i_count
# The steps are
FOR (i_temp=1 TO i_count)
dump sa_stepname(i_temp)
dump ia_analysis_step_id(i_temp)
dump sa_stepdesc(i_temp)
dump ia_param_set_id(i_temp)
END FOR
#---------------------------------------------------------------------
# Updating the previously created analysis_step.
s_stepname=”rev_pcl_example”
Main Index
CHAPTER 13 1573
Analysis

s_stepdesc=”Updated as example for function db_update_analysis_step”


i_return_value = @
db_update_analysis_step @
( i_analysis_code_id, @
i_analysis_step_id, @
s_stepname, @
s_stepdesc, @
i_param_set_id )
dump i_return_value
dump i_param_set_id
#---------------------------------------------------------------------
# Initialized to get maximum number of steps used in the database.
i_count= 16

i_return_value = @
db_get_analysis_steps @
( i_analysis_code_id, @
i_count, @
sa_stepname, @
ia_analysis_step_id, @
sa_stepdesc, @
ia_param_set_id )
dump i_return_value

# The actual number of steps in the current data base are


dump i_count
# The steps are
FOR (i_temp=1 TO i_count)
dump sa_stepname(i_temp)
dump ia_analysis_step_id(i_temp)
dump sa_stepdesc(i_temp)
dump ia_param_set_id(i_temp)
END FOR
#---------------------------------------------------------------------

db_update_jobname_for_a_code ()

# Purpose : This file provides an example of a call to the


# function db_update_jobname_for_a_code()
#
# Before running this session file run plate.ses
# to create plate.db. This database contains a
# model of a plate with two jobs created.
#
# This illustration opens the database “plate.db”
# and creates the new job for “MSC.Nastran”, and
# gets it’s details. Again it changes the
# job name, description and status and gets the
# updated details.
#
# 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_update_jobname_for_a_code()
# has the following arguments:
#
# db_update_jobname_for_a_code
# ( analysis_code_id,
# jobname,
# description,
# status,
# jobname_id,
# param_set_id )
Main Index
1574
Code Examples

#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_analysis_code_id
STRING s_jobname[32]
STRING s_description[128]
INTEGER i_status
INTEGER i_jobname_id
INTEGER i_param_set_id
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)
#
# Get the analysis code id for “MSC.Nastran”
i_return_value = @
db_get_anal_code_id( “MSC.Nastran”, i_analysis_code_id )
dump i_return_value
dump i_analysis_code_id
#
# Create the new job name for “MSC.Nastran”
# The job name is “new_job”
s_jobname = “new_job”
# The description for the the new job
s_description = “The new job for NASTRAN analysis code”
# The status of the new job
i_status = 0
i_return_value = @
db_create_job_name_for_a_code @
( i_analysis_code_id, @
s_jobname, @
s_description, @
i_status, @
i_jobname_id, @
i_param_set_id )
dump i_return_value
dump i_jobname_id
#
# Get the job info of the newly created job name
i_return_value = @
db_get_job_info @
( i_analysis_code_id, @
i_jobname_id, @
s_jobname, @
s_description, @
i_param_set_id, @
i_status )
dump i_return_value
dump s_jobname
dump s_description
dump i_status
dump i_param_set_id
#
# Change the name, description and the status of the job “new_job”
s_jobname = “changed_name”
s_description = “This is the updated job name for the NASTRAN code”
i_status = 1
i_return_value = @
db_update_jobname_for_a_code @
( i_analysis_code_id, @
s_jobname, @
s_description, @
i_status, @
i_jobname_id, @
i_param_set_id )
dump i_return_value
# The param set id which was updated
Main Index
CHAPTER 13 1575
Analysis

dump i_param_set_id
#
# Get the job info of the updated job name
i_return_value = @
db_get_job_info @
( i_analysis_code_id, @
i_jobname_id, @
s_jobname, @
s_description, @
i_param_set_id, @
i_status )
dump i_return_value
dump s_jobname
dump s_description
dump i_param_set_id
dump i_status
#---------------------------------------------------------------------

jobfile.close ()

# Purpose : This function closes the jobfile opened by the


# jobfile.open function.
#
# This function can be run in batchmode by running
# this session file from "File","Session","Play"
# pulldown menus on the menu bar.
#
#
# The function jobfile.close() has no arguments:
#
#---------------------------------------------------------------------
# Variable Declarations

INTEGER i_return_status = 1
STRING filespec[128]

#---------------------------------------------------------------------
# Open a new database "new.db"

uil_file_new.go( "","new.db" )

#---------------------------------------------------------------------
# Opens the jobfile

i_return_status = jobfile.open( "new", "RESULTS" )


dump i_return_status
#---------------------------------------------------------------------
# Delete the old files - .bdf and .op2 files.

msc_delete_old_files( "new", ".bdf", ".op2" )

#---------------------------------------------------------------------
# Write the various parameter in the file

jobfile.writec( "", "TRANSLATOR = pat3nas" )


jobfile.writec( "JOBNAME", "new" )
jobfile.writec( "", "" )
jobfile.writec( "WT-MASS CONVERSION", "1.0" )
jobfile.writei( "EXEC INPUT 0", 0 )
jobfile.writec( "CASE WRITE", "ON" )
jobfile.writei( "CASE INPUT 0", 0 )
jobfile.writec( "", "END" )

#---------------------------------------------------------------------
# Close the file new.jbr
Main Index
1576
Code Examples

jobfile.close( )

#---------------------------------------------------------------------
# Checks the existence of the file new.jbr.
# This file name is obtained after the file is opened.

file_build_fname("","new","jbr","O",filespec)
dump filespec

#--------------------------------------------------------------------
# Close the file new.db

uil_file_close.goquit()

#--------------------------------------------------------------------

jobfile.create_matrix ()

# Purpose : This function writes an real matrix of any


# size into the database. The size of the
# matrix is defined by the jobfile.writess()
# 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 jobfile.create_matrix()
# has the following arguments:
#
# jobfile.create_matrix
# ( matrix_values,
# num_values )
#
#---------------------------------------------------------------------
# Variable Decelerations
STRING s_label[32]
INTEGER i_matrix_dim(2)
REAL ra_values(2)
INTEGER i_num_vals
INTEGER i_param_set_id
STRING s_param_name[128]
INTEGER i_nrows
INTEGER i_ncols
INTEGER i_size
REAL rv_matrix_out(VIRTUAL)
INTEGER i_analysis_code_id
INTEGER i_count
INTEGER ia_jobname_id(1)
STRING sa_jobname[80](1)
STRING sa_description[512](1)
INTEGER ia_param_set_id(1)
INTEGER i_param_set_id
INTEGER ia_status(1)
INTEGER i_return_value
#---------------------------------------------------------------------
# Opening a new database

IF(!db_is_open()) THEN
uil_file_new.go("","new.db")
ENDIF
$? YES 36000002
Main Index
CHAPTER 13 1577
Analysis

#---------------------------------------------------------------------
# Opening the jobfile with the name 'new.jba'.

jobfile.open( "new", "ANALYZE" )

#---------------------------------------------------------------------
# Deleting Old result and jobfiles.

msc_delete_old_files( "new", ".bda", ".op2" )

#---------------------------------------------------------------------
# Using the function jobfile.writeSS() to create the matrix
# label and the size of the matrix.

s_label = "matrix_label"
i_matrix_dim(1) = 1
i_matrix_dim(2) = 2

jobfile.writeSS @
( s_label, @
i_matrix_dim )

#---------------------------------------------------------------------
# Using the function jobfile.create_matrix() to writeSS() to
# create the matrix label and the matrix array.

i_num_vals = 2
ra_values = [ 12.5 , -12.3 ]

i_return_value = jobfile.create_matrix @
( ra_values, @
i_num_vals )

dump i_return_value
#---------------------------------------------------------------------
# Closing the jobfile.

jobfile.close( )

#---------------------------------------------------------------------
# Getting the parameter set id corresponding to this matrix dump.

i_analysis_code_id = 1
i_count = 1

i_return_value = db_get_jobnames_for_a_code @
(
i_analysis_code_id, @
i_count, @
sa_jobname, @
ia_jobname_id, @
sa_description, @
ia_param_set_id, @
ia_status )
dump i_return_value
dump ia_param_set_id
#---------------------------------------------------------------------
# Getting the matrix size.

i_param_set_id = ia_param_set_id(1)
s_param_name = "matrix_label"

i_return_value = @
db_get_pset_matrix_size @
( i_param_set_id, @
s_param_name, @
i_nrows, @
i_ncols )
Main Index
1578
Code Examples

dump i_nrows, i_ncols


i_size = i_nrows * i_ncols
#---------------------------------------------------------------------
# Getting the matrix.

sys_allocate_array(rv_matrix_out,1,i_size)

i_return_value = @
db_get_pset_matrix_entry @
( i_param_set_id, @
s_param_name, @
rv_matrix_out )

dump rv_matrix_out
#---------------------------------------------------------------------
sys_free_array(rv_matrix_out)
# End of File.

jobfile.open ()

# Purpose : This function opens the output file for deck


# creation. It writes the parameters to be used
# in the Results/Model data files. This is used
# if the MSC.Nastran preference is selected.
# The function returns a integer value '0' if
# executed properly. the functions which are used
# subsequent to this function are the
# msc_delete_old_files(), jobfile.writec,
# jobfile.writef, jobfile.writei. The file must
# necessarily be close by the jobfile.close()
# function.
#
#
# This function can be run in batchmode by running
# this session file from "File","Session","Play"
# pulldown menus on the menu bar.
#
#
# The function jobfile.open()
# has the following arguments:
#
# jobfile.open(
# ( jobname,
# job_type )
#
#
#
#---------------------------------------------------------------------
# Variable Declarations

INTEGER i_return_status = 1
#---------------------------------------------------------------------
# Open a new database "new.db"

uil_file_new.go( "","new.db" )

#---------------------------------------------------------------------
# Opens the jobfile

i_return_status = jobfile.open( "new", "RESULTS" )


#
#
#---------------------------------------------------------------------
# Delete the old files - .bdf and .op2 files.
Main Index
CHAPTER 13 1579
Analysis

msc_delete_old_files( "new", ".bdf", ".op2" )

#---------------------------------------------------------------------
#Write the various parameter in the file

jobfile.writec( "", "TRANSLATOR = pat3nas" )


jobfile.writec( "DATABASE", "new.db" )
jobfile.writec( "JOBNAME", "new" )
jobfile.writec( "ANALYSIS TITLE", "")
jobfile.writec( "", "" )
jobfile.writec( "OBJECT", "Entire Model" )
jobfile.writec( "METHOD", "Full Run" )
jobfile.writec( "", "" )
jobfile.writec( "MODEL SUFFIX", ".bdf" )
jobfile.writec( "RESULTS SUFFIX", ".op2" )
jobfile.writec( "", "" )
jobfile.writec( "", "/*" )
jobfile.writec( "", " * Translation Parameters" )
jobfile.writec( "", " */" )
jobfile.writec( "", "" )
jobfile.writec( "DATA OUTPUT", "OP2 and Print" )
jobfile.writec( "OUTPUT2 REQUESTS", "P3 Built In" )
jobfile.writec( "OUTPUT2 FORMAT", "Binary" )
jobfile.writec( "", "" )
jobfile.writec( "", "/*" )
jobfile.writec( "", " * Solution Parameters" )
jobfile.writec( "", " */" )
jobfile.writec( "", "" )
jobfile.writec( "SOLUTION TYPE", "LINEAR STATIC" )
jobfile.writei( "SOLUTION SEQUENCE", 101 )
jobfile.writec( "DATABASE RUN", "ON" )
jobfile.writec( "CYCLIC SYMMETRY", "OFF" )
jobfile.writei( "BULK INPUT 0", 0 )
jobfile.writec( "", "END" )

#---------------------------------------------------------------------
# Close the file new.jbr

jobfile.close()

#--------------------------------------------------------------------
# Close the file new.db

uil_file_close.goquit()

#--------------------------------------------------------------------

jobfile.set_job_status ()

# Purpose : This function sets the job_status and the


# description for a jobfile.
#
# 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.
#
# This file will not close patran , hence user
# will have to close patran through the "File"
# "Quit" pulldow menus from the menu bar.
#
# The function jobfile.set_job_status()
# has the following arguments:
#
# jobfile.set_job_status
Main Index
1580
Code Examples

# ( i_job_status,
# s_msg_string )
#
#---------------------------------------------------------------------
# Opening a new database

IF(!db_is_open()) THEN
uil_file_new.go("","new.db")
ENDIF
$? YES 36000002

#---------------------------------------------------------------------
# Variable Decelerations

INTEGER i_status = 2
INTEGER i_job_status = 50
LOGICAL l_status = FALSE
STRING s_msg_string[32] = "TEST MESSAGE"

#---------------------------------------------------------------------
# Opening a jobfile.

jobfile.open("new","ANALYZE")

#---------------------------------------------------------------------
# Calling the function jobfile.set_job_status to set the job status
# value for the job.

l_status = jobfile.set_job_status(i_job_status,s_msg_string)

dump l_status
#---------------------------------------------------------------------
# Closing the jobfile.

i_status = jobfile.close()
$? NO 50

dump i_status
#---------------------------------------------------------------------
# End of File.

jobfile.writec

# Purpose : This function write character strings in the


# jobfile opened by the jobfile.open function.
# The other eqvuivalents to this function are
# jobfile.writei, jobfile.writef,
# jobfile.write.spl.
#
#
# This function can be run in batchmode by running
# this session file from "File","Session","Play"
# pulldown menus on the menu bar.
#
#
# The function jobfile.writec()
# has the following arguments:
#
# jobfile.writec(
# ( label_str,
# char_val )
#
#
#
#---------------------------------------------------------------------
Main Index
CHAPTER 13 1581
Analysis

# Variable Declarations

INTEGER i_return_status = 1
#---------------------------------------------------------------------
# Open a new database "new.db"

uil_file_new.go( "","new.db" )

#---------------------------------------------------------------------
# Opens the jobfile

i_return_status = jobfile.open( "new", "RESULTS" )


dump i_return_status

#
#---------------------------------------------------------------------
# Delete the old files - .bdf and .op2 files.

msc_delete_old_files( "new", ".bdf", ".op2" )

#---------------------------------------------------------------------
#Write the various parameter in the file

#---------------------------------------------------------------------
# Using the jobfile.writec function to write text in the output file
# The format is jobfile.writec("str_1","str_2 ") writes the following
# to the output file : str_1 = str 2.
# for jobfile.writec("",str_2), the output is str_2.

jobfile.writec( "DATABASE", "new.db" )


jobfile.writec( "JOBNAME", "new" )
jobfile.writec( "ANALYSIS TITLE", "analysis of the new job")
jobfile.writec( "", "" )
jobfile.writec( "", "END" )

#---------------------------------------------------------------------
# Close the file new.jbr

jobfile.close( )

#--------------------------------------------------------------------
# Close the file new.db

uil_file_close.goquit()

#--------------------------------------------------------------------

jobfile.writei

# Purpose : This function write integer values in the jobfile


# opened by the jobfile.open function. The other
# eqvuivalents to this function are jobfile.writec,
# jobfile.writer, jobfile.write_spl.
#
# This function can be run in batchmode by running
# this session file from "File","Session","Play"
# pulldown menus on the menu bar.
#
#
# The function jobfile.writei()
# has the following arguments:
#
# jobfile.writei(
# ( label_str,
# int_val )
Main Index
1582
Code Examples

#
#
#
#---------------------------------------------------------------------
# Variable Declarations

INTEGER i_return_status = 1
#---------------------------------------------------------------------
# Open a new database "new.db"

uil_file_new.go( "","new.db" )

#---------------------------------------------------------------------
# Opens the jobfile

i_return_status = jobfile.open( "new", "RESULTS" )


#---------------------------------------------------------------------
# Delete the old files - .bdf and .op2 files.

msc_delete_old_files( "new", ".bdf", ".op2" )

#---------------------------------------------------------------------
# Using the jobfile.writei function to write text in the output file
# The format is jobfile.writei("str_1","int") writes the following
# to the output file : str_1 = int.

jobfile.writei( "SOLUTION SEQUENCE", 101 )


jobfile.writei( "FMS INPUT 0", 0 )
jobfile.writei( "EXEC INPUT 0", 0 )
jobfile.writei( "CASE INPUT 0", 0 )
jobfile.writei( "BULK INPUT 0", 0 )
jobfile.writec( "", "END" )

#---------------------------------------------------------------------
# Close the file new.jbr

jobfile.close()

#--------------------------------------------------------------------
# Close the file new.db

uil_file_close.goquit()

#--------------------------------------------------------------------

jobfile.writer

# Purpose : This function writes real values in the jobfile


# opened by the jobfile.open function. The other
# eqvuivalents to this function are jobfile.writei,
# jobfile.writec, jobfile.write.spl.
#
# This function can be run in batchmode by running
# this session file from "File","Session","Play"
# pulldown menus on the menu bar.
#
#
# The function jobfile.writec()
# has the following arguments:
#
# jobfile.writec(
# ( label_str,
# rl_val )
#
Main Index
CHAPTER 13 1583
Analysis

#
#
#---------------------------------------------------------------------
# Variable Declarations

INTEGER i_return_status = 1
#---------------------------------------------------------------------
# Open a new database "new.db"

uil_file_new.go( "","new.db" )

#---------------------------------------------------------------------
# Opens the jobfile

i_return_status = jobfile.open( "new", "RESULTS" )


dump i_return_status
#---------------------------------------------------------------------
# Delete the old files - .bdf and .op2 files.

msc_delete_old_files( "new", ".bdf", ".op2" )


#---------------------------------------------------------------------
# Write the various real values in the file - new.jbr
# The format is jobfile.writer("str_1",r_val) writes the following
# to the output file : str_1 = r_val.

jobfile.writer("REAL_VALUE_1 = ",3.1)
jobfile.writer("REAL_VALUE_2 = ",-2.9673)
jobfile.writer("REAL_VALUE_3 = ",0.4999999999999999)

#---------------------------------------------------------------------
jobfile.writec( "", "END" )

#---------------------------------------------------------------------
# Close the file new.jbr

jobfile.close()

#--------------------------------------------------------------------
# Close the file new.db

uil_file_close.goquit()

#--------------------------------------------------------------------

jobfile.write_spl

# Purpose : This function write character strings in the jobfile


# opened by the jobfile.open function. The other eqvui-
# valents to this function are jobfile.writei,
# jobfile.writer and jobfile.write.c. This function
# writes pure string or string arrays as against the
# function jobfile.writec which inserts two strings with
# a "=" in between.
#
# This function can be run in batchmode by running
# this session file from "File","Session","Play"
# pulldown menus on the menu bar.
#
#
# The function jobfile.write_spl()
# has the following arguments:
#
# jobfile.write_spl(
# label_str,
# char_str )
Main Index
1584
Code Examples

#
#
#
#---------------------------------------------------------------------
# Variable Declarations

INTEGER i_return_status = 1
STRING str[128](2)
str(1) = "STRING_1"
str(2) = "STRING_2"

#---------------------------------------------------------------------
# Open a new database "new.db"

uil_file_new.go( "","new.db" )

#---------------------------------------------------------------------
# Opens the jobfile

i_return_status = jobfile.open( "new", "RESULTS" )


dump i_return_status

#---------------------------------------------------------------------
# Delete the old files - .bdf and .op2 files.

msc_delete_old_files( "new", ".bdf", ".op2" )

#---------------------------------------------------------------------
# calling the function jobfile.write_spl

jobfile.write_spl( "/* Writing character string arrays: %A% and %A% */ ",
str)

#---------------------------------------------------------------------
# Using the jobfile.writec function to write pure text in the output file

jobfile.writec( "DATABASE", "new.db" )


jobfile.writec( "JOBNAME", "new" )
jobfile.writec( "ANALYSIS TITLE", "analysis of the new job")
jobfile.writec( "", "" )
jobfile.writec( "", "END" )

#---------------------------------------------------------------------
# Close the file new.jbr

jobfile.close()

#--------------------------------------------------------------------
# Close the file new.db

uil_file_close.goquit()

#--------------------------------------------------------------------

msc_delete_old_files

# Purpose : This function follows the jobfile.open()


# function. It searches and deletes all previous
# versions of the model and results files to
# avoid interference with the new jobname.
#
#
# This function can be run in batchmode by running
# this session file from "File","Session","Play"
Main Index
CHAPTER 13 1585
Analysis

# pulldown menus on the menu bar.


#
#
# The function msc_delete_old_files()
# has the following arguments:
#
# msc_delete_old_files(
# ( job_name,
# model_suffix,
# results_suffix )
#
#
#---------------------------------------------------------------------
# Variable Declarations

INTEGER i_return_status = 1

#---------------------------------------------------------------------
# Open a new database "new.db"

uil_file_new.go( "","new.db" )
#---------------------------------------------------------------------
# Delete the old files - new.bdf and new.op2 files.

i_return_status = msc_delete_old_files( "new", ".bdf", ".op2" )


$? YES 6022037

dump i_return_status
#--------------------------------------------------------------------
# Close the file new.db

uil_file_close.goquit()

#--------------------------------------------------------------------

mscnastran_anlyze_sub_create.available_callback ()

# Purpose : The function mscnastran_analyze_sub_create.


# available_callback() is a callback to
# "Available Subcases" list box in "Subcase Create"
# form. Execution of this function will display
# the corresponding subcase name in "Subcase Name"
# data box in "Sub Case Create" form.
#
# 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 mscnastran_analyze_sub_create.available_callback()
# has the following arguments:
#
# mscnastran_analyze_sub_create.available_callback
# ( INPUT:
# INTEGER num_items,
# STRING subcase_name[]()
# OUTPUT:
# )
#---------------------------------------------------------------------
#
# Opening a new database

uil_file_new.go("","new.db")
Main Index
1586
Code Examples

#---------------------------------------------------------------------

# Displaying Analyis Application form

ui_exec_function( "uil_app_analysis", "display" )

#--------------------------------------------------------------------

# Displaying Subcase Create form

ui_exec_function( "mscnastran_analyze_sub_create", "display" )

#--------------------------------------------------------------------

# Declaring and defining input arguents

INTEGER num_items = 1

STRING subcase_name[64](1) = ["new_subcase"]

#---------------------------------------------------------------------

# Using the function mscnastran_analyze_sub_create.available_callback()


# to apply callback to the "Available Subcases" list box in
# "Subcase Create" form.

mscnastran_analyze_sub_create.available_callback(num_items, @
subcase_name)

#---------------------------------------------------------------------

# Using the function mscnastran_analyze_sub_create.get_subcase_name()


# to check the subcase name in "Subcase Name" data box in
# "Subcase Create" form.

STRING check_subcase_name[64]

mscnastran_analyze_sub_create.get_subcase_name(check_subcase_name)

dump check_subcase_name

#----------------------------------------------------------------------

# End of File.

#---------------------------------------------------------------------

mscnastran_analyze_tp.get_version_number ()

# Purpose : This function will get version number of msc nastran.


# It does not require input argument. It will give
# version number as output.
#
# This file can be run by starting a session of
# MSC.Patran,running this session file through
# the "File","Session","Play" pulldown menus
# on the menu bar.
#
#
# The function mscnastran_analyze_tp.get_version_number()
# has the following arguments:
#
# mscnastran_analyze_tp.get_version_number
Main Index
CHAPTER 13 1587
Analysis

# (
# REAL version_no
# )
#---------------------------------------------------------------------
#
# Opening a new database

uil_file_new.go("","new.db")

REAL version_no

#---------------------------------------------------------------------
# Using the function mscnastran_analyze_tp.get_version_number()
# to get the version number of msc nastran.

mscnastran_analyze_tp.get_version_number(version_no)

dump version_no

#---------------------------------------------------------------------
# End of File.

mscnastran_job.associate_subcases ()

# Purpose : This function will associate subcases to a job


# for MSC.Nastran preference. It requires solution
# sequence number, name of the job, number of
# subcases and the name of subcases as input
# arguments. It will return integer status
# which is zero on success.
#
# 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 mscnastran_job.associate_subcases()
# has the following arguments:
#
# mscnastran_job.associate_subcases
# ( INPUT:
# STRING sseq_str,
# STRING jobname,
# INTEGER num_subcases,
# STRING subcase_names,
# OUTPUT:
# INTEGER status
# )
#---------------------------------------------------------------------
#
# Opening a new database

uil_file_new.go("","new.db")

#---------------------------------------------------------------------

# Displaying Analyis Application form

ui_exec_function( "uil_app_analysis", "display" )

#--------------------------------------------------------------------

# Declaring and defining input arguments


Main Index
1588
Code Examples

STRING sseq_str[16] = "101" /* For linear static solution */


STRING jobname[64] = "new_job"
INTEGER num_subcases = 2
STRING subcase_names[64](2) = ["Subcase_1","Subcase_2"]

# Declaring output argument

INTEGER status

#----------------------------------------------------------------------

# Using the Function mscnastran_subcase.create() to create the


# subcases for MSC.Nastran preference.

mscnastran_subcase.create(sseq_str, @
subcase_names(1), @
"First subcase")

mscnastran_subcase.create_char_param("LOAD CASE", "Default")

mscnastran_subcase.create(sseq_str, @
subcase_names(2), @
"Second subcase")

mscnastran_subcase.create_char_param("LOAD CASE", "Default")

#---------------------------------------------------------------------

# Creating new job file.

jobfile.open(jobname,"ANALYZE NO JOBFILE")

# Deleting Old result and jobfiles.

msc_delete_old_files( jobname, ".bdf", ".op2" )

# Closing the jobfile.

jobfile.close()

#------------------------------------------------------------------------

# Using the Function mscnastran_job.associate_subcases() to associate


# subcases to a job for MSC.Nastran preferences.

status = mscnastran_job.associate_subcases(sseq_str, @
jobname, @
num_subcases, @
subcase_names)

dump status

#---------------------------------------------------------------------

# End of File.

#---------------------------------------------------------------------

Main Index
CHAPTER 13 1589
Analysis

mscnastran_subcase.create ()

# Purpose : This function will create subcase for


# MSC.Nastran preference. It requires solution
# sequence value, name of the subcase and the
# subcase description as input arguments. It
# will return integer status which is zero on
# success.
#
# 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 mscnastran_subcase.create()
# has the following arguments:
#
# mscnastran_subcase.create
# ( INPUT:
# STRING sseq_str,
# STRING subcase_name,
# STRING subcase_desc,
# OUTPUT:
# INTEGER status
# )
#---------------------------------------------------------------------
#
# Opening a new database

uil_file_new.go("","new.db")

#---------------------------------------------------------------------

# Displaying Analyis Application form

ui_exec_function( "uil_app_analysis", "display" )

#--------------------------------------------------------------------

# Declaring and defining input arguents

STRING sseq_str[16] = "101" /* For linear static solution */


STRING subcase_name[64] = "New_subcase"
STRING subcase_desc[64] = "This is test subcase"

# Declaring output argument

INTEGER status

#----------------------------------------------------------------------

# Using the Function mscnastran_subcase.create() to create the


# subcase for MSC.Nastran preference.

status = mscnastran_subcase.create(sseq_str, @
subcase_name, @
subcase_desc)

dump status

#---------------------------------------------------------------------

# End of File.
Main Index
1590
Code Examples

#---------------------------------------------------------------------

mscnastran_subcase.create_char_param ()

# Purpose : This function will load a character value for


# subcase parameter in to data base. It requires
# name of the subcase parameter and the value of
# the parameter.It will return integer status
# which is zero on success.
#
# 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 mscnastran_subcase.create_char_param()
# has the following arguments:
#
# mscnastran_subcase.create_char_param
# ( INPUT:
# STRING param_name,
# STRING char_value,
# OUTPUT:
# INTEGER status
# )
#---------------------------------------------------------------------
#
# Opening a new database

uil_file_new.go("","new.db")

#---------------------------------------------------------------------

# Displaying Analyis Application form

ui_exec_function( "uil_app_analysis", "display" )

#--------------------------------------------------------------------

# Declaring and defining input arguents

STRING param_name[32] = "LOAD CASE"


STRING char_value[64] = "Test_Load_Case"

# Declaring output argument

INTEGER status

#----------------------------------------------------------------------

# Using the function loadcase_create2() to create new load case.

loadcase_create2(char_value, @
"static", @
"new load case", @
1.,[""],[0], @
[0.],"",0.,TRUE)

# Using the Function mscnastran_subcase.create() to create the


# subcase for MSC.Nastran preference.

mscnastran_subcase.create("101", @
"Test", @
Main Index
CHAPTER 13 1591
Analysis

"Test subcase")

#---------------------------------------------------------------------

# Using the function mscnastran_subcase.create_char_param() to load


# the subcase parameter "LOAD CASE" in to data base for Test subcase

status = mscnastran_subcase.create_char_param(param_name, @
char_value)

dump status

#---------------------------------------------------------------------
# End of File.
#---------------------------------------------------------------------

mscnastran_update.job ()

# Purpose : This function will update old job to current


# format of MSC.Nastran preference. It requires
# name of the job as input argument. It will
# return integer status which is zero success.
#
# 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 mscnastran_update.job()
# has the following arguments:
#
# mscnastran_update.job
# ( INPUT:
# STRING jobname,
# OUTPUT:
# INTEGER status
# )
#---------------------------------------------------------------------
#
# Opening a new database

uil_file_new.go("","new.db")

#---------------------------------------------------------------------

# Displaying Analyis Application form

ui_exec_function( "uil_app_analysis", "display" )

#--------------------------------------------------------------------

# Declaring and defining input arguments

STRING jobname[64] = "new_job"

# Declaring output argument

INTEGER status

#----------------------------------------------------------------------

# Creating new job file.


Main Index
1592
Code Examples

jobfile.open(jobname,"ANALYZE NO JOBFILE")

# Deleting Old result and jobfiles.

msc_delete_old_files( jobname, ".bdf", ".op2" )

jobfile.writec( "JOBNAME", jobname )


jobfile.writec( "OUTPUT2 REQUESTS", "P3 Built In" )
jobfile.writei( "SOLUTION SEQUENCE", 106 )

# Closing the jobfile.

jobfile.close()

# Using the Function mscnastran_job.associate_subcases() to associate


# subcases to a job for MSC.Nastran preferences.

mscnastran_job.associate_subcases("101", @
jobname, @
1, @
["Default"])

analysis_submit_2( "MSC.Nastran", jobname )

#------------------------------------------------------------------------

status = mscnastran_update.job(jobname)

dump status

#---------------------------------------------------------------------

# End of File.

#---------------------------------------------------------------------

uil_app_analysis.change_current_branch ()

# Purpose : This function changes the current branch of


# the option menu tree to new branch for the
# analysis application. It requires number of
# menus in new branch(num_branches), label for
# each menu(labels) and flag(post_them) to
# indicate if the menus are to be posted after
# they are set. The labels array must contain
# existing item labels.
#
# This file can be run by starting a session of
# MSC.Patran,running this session file through
# the "File","Session","Play" pulldown menus
# on the menu bar.
#
#
# The function uil_app_analysis.change_current_branch()
# has the following arguments:
#
# uil_app_analysis.change_current_branch
# ( INPUT:
# INTEGER num_branches,
# STRING labels(),
# LOGICAL post_them
# OUTPUT:
# )
Main Index
CHAPTER 13 1593
Analysis

#---------------------------------------------------------------------
#
# Opening a new database

uil_file_new.go("","new.db")

#---------------------------------------------------------------------

# Displaying Analyis Application form

ui_exec_function( "uil_app_analysis", "display" )

#--------------------------------------------------------------------

# Declaring input arguents

INTEGER num_branches
STRING labels[32](4)
LOGICAL post_them = TRUE

#----------------------------------------------------------------------

# Get the details in current branch of analysis application.

INTEGER items(4)

uil_app_analysis.get_current_branch(num_branches, items, labels)

dump num_branches labels post_them

#----------------------------------------------------------------------

# Get the analysis code name.

STRING analysis_code_name[32]

db_get_default_anal_code ( analysis_code_name )

# Defining new branch in analysis application.

IF( analysis_code_name == "MSC.Nastran" )THEN


labels(2)="Read Output2"
labels(3)="Result Entities"
labels(4)="Translate"
END IF

# Using the Function uil_app_analysis.change_current_branch() to change


# the current branch of analysis application.

uil_app_analysis.change_current_branch(num_branches, labels, post_them)

dump labels

# Displaying the new branch of analysis application.

ui_form_display( "uil_app_analysis" )

#---------------------------------------------------------------------
# End of File.

Main Index
1594
Code Examples

Main Index
MSC.Acumen, Volume 2: Code Examples

CHAPTER
Fields
14
■ Introduction

Main Index
1596
Code Examples

14.1 Introduction
This chapter provides code examples for the PCL function described in Volume 1. These
examples are designed so that they can be cut and pasted into a file and, by following the
instructions listed with each example, executed in MSC.Patran.

db_delete_field ()

# Purpose : This file provides an example of a call to the


# function db_delete_field()
#
# This function deletes the specified field from
# the database.
#
# In this example new database will be opened by
# name new.db and 2 fields,”field_1” & “field_2”
# are created. Then “field_2” is deleted.
# Deletion can be confirmed from the maximum id
# obtained before and after deletion
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_delete_field()
# has the following arguments:
#
# db_delete_field
# ( id )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_id
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# Create field “field_1”


i_return_value = @
fields_create @
( “field_1”, “Spatial”, 1, “Scalar”, “Real”, @
“Coord 0”, ““, “Table”, 1, ““, “Y”, ““, ““, ““, ““, @
FALSE, [1., 2., 3., 4., 5., 6., 7., 8.], [0.], [0.], @
[[[10.]][[20.]][[30.]][[40.]][[50.]][[60.]][[70.]] @
[[80.]]] )
dump i_return_value

# Create field “field_2”


i_return_value = @
fields_create @
( “field_2”, “Spatial”, 1, “Scalar”, “Real”, @
“Coord 0”, ““, “Function”, 1, “X”, ““, ““, “10*’X”, @
““, ““, FALSE, [0.], [0.], [0.], [[[0.]]] )
dump i_return_value

# Get the largest field id


i_return_value = @
db_get_max_field @
( i_id )
Main Index dump i_return_value
CHAPTER 14 1597
Fields

dump i_id

# Delete the field with largest field id


i_return_value = @
db_delete_field @
( i_id )
dump i_return_value

# Get the largest field id again.


i_return_value = @
db_get_max_field @
( i_id )
dump i_return_value
dump i_id

# Note the change in maximum field ID.


#---------------------------------------------------------------------

db_delete_field_res ()

# Purpose : This file provides an example of a call to the


# function db_delete_field_res()
#
# This function deletes records in the field_res
# _elem table or field_res_node table in the
# database.
#
# In this example the spool.db database is opened
# and a new lbc field (“new_field_lbc”) is
# created. This function is called to delete the
# records in field_res_elem.
# As there is no function for reading field_res_
# elem or field_res_node, user can confirm the
# deletion by using QLI on spool.db before and
# after the calling of this function.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_delete_field_res()
# has the following arguments:
#
# db_delete_field_res
# ( id )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_id
INTEGER i_field_id
INTEGER i_return_value
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_id
INTEGER i_nvals = 4
INTEGER ia_method(4)
INTEGER ia_eid(4)
INTEGER ia_elem_face(4)
INTEGER ia_elem_edge(4)
INTEGER ia_node_pos(4)
INTEGER ia_nodeid(4)
Main Index
1598
Code Examples

REAL ra_vals(4)
INTEGER i_return_value
INTEGER i_field_id
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Create an lbc field


i_return_value = @
db_create_field_lbc @
( i_field_id,”new_field_lbc”,0,0,124,4,[306,307,308,309], @
[1,1,1,1], [1,2,3,4], [4,2,1,3], [1.,2.,3.,4.] )
dump i_return_value
dump i_field_id

# Delete records in “field_res_elem”


i_id = i_field_id
i_return_value = @
db_delete_field_res @
( i_id )
dump i_return_value
#---------------------------------------------------------------------

db_get_all_field_names ()

# Purpose : This file provides an example of a call to the


# function db_get_all_field_names()
#
# This function gets all lbc object names from
# field table of database by get all, get next
# method.
#
# In this example the spool database is opened
# and a new field (“new_field”) is created. Then
# this function is called to get records from
# field table. The records are then read one by
# one using function db_get_next_field_name().
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_all_field_names()
# has the following arguments:
#
# db_get_all_field_names
# ( object )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_object
INTEGER i_id
STRING s_name[32]
INTEGER i_all_status
INTEGER i_next_status
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Object Id of selected rows


Main Index
CHAPTER 14 1599
Fields

# i_object = 0(Spatial),1(Material),2(Non-spatial or time)


i_object = 0

# Create field “new_field”


i_return_value = @
fields_create @
( “new_field”, “Spatial”, 1, “Scalar”, “Real”, @
“Coord 0”, ““, “Function”, 1, “X”, ““, ““, @
“10*’X”, ““, ““, FALSE, [0.], [0.], [0.], @
[[[0.]]] )
dump i_return_value

# Get all the lbc object names


i_all_status = @
db_get_all_field_names @
( i_object )
dump i_all_status

# Get next lbc object names


WHILE ( i_next_status == 0 )
i_next_status = @
db_get_next_field_name @
( i_id, @
s_name )
dump i_next_status
IF ( i_next_status == 0 ) THEN
dump i_id
dump s_name
END IF
END WHILE
#---------------------------------------------------------------------

db_get_field_attrs ()

# Purpose : This file provides an example of a call to the


# function db_get_field_attrs()
#
# This function gets the attributes of specified
# field from database.
#
# In this example a new database is opened and
# a field of type “Spatial” is created. Then
# attributes of created field are obtained using
# this function.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_field_attrs()
# has the following arguments:
#
# db_get_field_attrs
# ( id,
# name,
# object,
# nvar,
# ivar1,
# ivar2,
# ivar3 )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_id
Main Index
1600
Code Examples

STRING s_name[32]
INTEGER i_object
INTEGER i_nvar
INTEGER i_ivar1
INTEGER i_ivar2
INTEGER i_ivar3
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# Create field “new_field”


i_return_value = @
fields_create @
( “new_field”, “Spatial”, 1, “Scalar”, “Real”, “Coord 0”, @
““, “Table”, 1, ““, “Y”, ““, ““, ““, ““, FALSE, [1., @
2., 3., 4., 5., 6., 7., 8.], [0.], [0.], [[[10.]][[20.]]@
[[30.]][[40.]][[50.]][[60.]][[70.]][[80.]]] )
dump i_return_value

# Get the id of the field


i_return_value = @
db_get_field_id @
( “new_field”, @
i_id )
dump i_return_value
dump i_id

# Get the field attributes


i_return_value = @
db_get_field_attrs @
( i_id, @
s_name, @
i_object, @
i_nvar, @
i_ivar1, @
i_ivar2, @
i_ivar3 )
dump i_return_value
dump s_name
dump i_object
dump i_nvar
dump i_ivar1
dump i_ivar2
dump i_ivar3

# For details of field attributes refer Chapter 9 of MSC.Patran


# Users manual ( Vol. 4 - Release 1.4 )
#---------------------------------------------------------------------

db_get_field_dfem ()

# Purpose : This file provides an example of a call to the


# function db_get_field_dfem()
#
# This function gets the details of specified lbc
# field from the database
#
# In this example the spool database is opened
# and a new lbc field (“new_field_lbc”) is
# created. Then this function is called to get
# lbc details of fields “400_20_psi_transition”
# and “new_field_lbc”.
#
Main Index
CHAPTER 14 1601
Fields

# Before running this session file run spool.ses


# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_field_dfem() has the following arguments:
#
# db_get_field_dfem
# ( id,
# nvals,
# method,
# eid,
# elem_face,
# elem_edge,
# node_pos,
# nodeid,
# vals )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_id
INTEGER i_nvals = 4
INTEGER ia_method(4)
INTEGER ia_eid(4)
INTEGER ia_elem_face(4)
INTEGER ia_elem_edge(4)
INTEGER ia_node_pos(4)
INTEGER ia_nodeid(4)
REAL ra_vals(4)
INTEGER i_return_value
INTEGER i_field_id
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Create an lbc field


i_return_value = @
db_create_field_lbc @
( i_field_id,”new_field_lbc_a”,0,0,124,4,[306,307,308,309], @
[1,1,1,1], [1,2,3,4], [4,2,1,3], [1.,2.,3.,4.] )
dump i_return_value
dump i_field_id

# Get the lbc field details for field “400_20_psi_transition” and


# “new_field_lbc_a”
FOR ( i_id = 1 TO 2 )
i_return_value = @
db_get_field_dfem @
( i_id, @
i_nvals, @
ia_method, @
ia_eid, @
ia_elem_face, @
ia_elem_edge, @
ia_node_pos, @
ia_nodeid, @
ra_vals )
dump i_return_value
dump i_id
dump i_nvals
dump ia_method
dump ia_eid
dump ia_elem_face
dump ia_elem_edge
Main Index
1602
Code Examples

dump ia_node_pos
dump ia_nodeid
dump ra_vals
END FOR
#---------------------------------------------------------------------

db_get_field_id ()

# Purpose : This file provides an example of 2 calls to the


# function db_get_field_id()
#
# This function gets the field id for a specified
# field name in the database.
#
# In this example the spool database is opened
# and this function is called to get the field id
# of “400_20_psi_transition”.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_field_id()
# has the following arguments:
#
# db_get_field_id
# ( name,
# id )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
INTEGER i_id
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Get the id of the field


s_name = “400_20_psi_transition”
i_return_value = @
db_get_field_id @
( s_name, @
i_id )
dump i_return_value
dump i_id
#---------------------------------------------------------------------

db_get_field_lbc ()

# Purpose : This file provides an example of a call to the


# function db_get_field_lbc()
#
# This session file will open a new database and
# will draw a surface meshed with QUAD4 elements.
# A spatial field will be created using FEM
# method associated with four nodes. The same
# field will be read back.
#
Main Index
CHAPTER 14 1603
Fields

# This file can be run by starting a session of


# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_field_lbc()
# has the following arguments:
#
# db_get_field_lbc
# ( id,
# nvals,
# eid,
# elem_face,
# elem_edge,
# node_pos,
# vals )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_id
STRING s_name[32]
INTEGER i_type
INTEGER i_ent_type
INTEGER i_nvals
INTEGER ia_eid(4)
INTEGER ia_elem_face(4)
INTEGER ia_elem_edge(4)
INTEGER ia_node_pos(4)
REAL ra_vals(4)
INTEGER i_return_value
STRING sv_asm_create_patch_xy_created[VIRTUAL]
INTEGER i_fem_create_mesh_surfa_num_nd
INTEGER i_fem_create_mesh_surfa_num_el
STRING sv_fem_create_mesh_s_nodes_crt[VIRTUAL]
STRING sv_fem_create_mesh_s_elems_crt[VIRTUAL]
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
# Creating a Hpat surface.
i_return_value = @
asm_const_patch_xyz( “1”, “<1 1 0>”, “[0 0 0]”, “Coord 0”, @
sv_asm_create_patch_xy_created )
dump i_return_value
#---------------------------------------------------------------------
# Meshing the plate with QUAD4 elements.
ui_exec_function( “mesh_seed_display_mgr”, “init” )
i_return_value = @
fem_create_mesh_surf_2( “IsoMesh”, 0, “Surface 1 “, 1, [0.1], @
“Quad4”, “1”, “1”, “Coord 0”, “Coord 0”, @
i_fem_create_mesh_surfa_num_nd, i_fem_create_mesh_surfa_num_el,@
sv_fem_create_mesh_s_nodes_crt, sv_fem_create_mesh_s_elems_crt)
dump i_return_value
mesh_seed_display_mgr.erase( )
#---------------------------------------------------------------------
# Calling function to create a field which has values associated with
# four nodes.
i_id=1
s_name=”lbc_field”
i_type=1
i_ent_type=123
i_nvals=4
ia_eid=[1,2,3,4]
ra_vals=[10.,20.,30.,40.]
#
i_return_value = @
Main Index
1604
Code Examples

field_create_field_lbc @
( i_id, @
s_name, @
i_type, @
i_ent_type, @
i_nvals, @
ia_eid, @
ia_elem_face, @
ia_elem_edge, @
ia_node_pos, @
ra_vals )
dump i_return_value

#---------------------------------------------------------------------
# Calling function to read the field data.
i_nvals=4
ia_eid=[0,0,0,0]
ra_vals=[0.,0.,0.,0.]
#
i_return_value = @
db_get_field_lbc @
( i_id, @
i_nvals, @
ia_eid, @
ia_elem_face, @
ia_elem_edge, @
ia_node_pos, @
ra_vals )
dump i_return_value
dump i_nvals,ia_eid,ra_vals
#---------------------------------------------------------------------

db_get_field_lbc_type ()

# Purpose : This file provides an example of multiple calls


# to the function db_get_field_lbc_type()
#
# This function gets the lbc type and object of
# an specified field from the database.
#
# In this example 3 fields of with different
# combination of lbc type and object are created.
# Then this function is called to get the object
# and type details of field.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_field_lbc_type()
# has the following arguments:
#
# db_get_field_lbc_type
# ( id,
# type,
# object )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_id
INTEGER i_type
INTEGER i_object
INTEGER i_return_value
#---------------------------------------------------------------------
Main Index
CHAPTER 14 1605
Fields

# Open a new database “new.db”


uil_file_new.go(““,”new.db”)
$? YES 36000002

# Create field “stat_field_1”


i_return_value = @
fields_create @
( “stat_field_1”, “Spatial”, 1, “Scalar”, “Real”, @
“Coord 0”, ““, “Table”, 1, ““, “Y”, ““, ““, ““, ““, @
FALSE, [1., 2., 3., 4., 5., 6., 7., 8.], [0.], [0.], @
[[[10.]][[20.]][[30.]][[40.]][[50.]][[60.]][[70.]] @
[[80.]]] )
dump i_return_value

# Create field “stat_field_2”


i_return_value = @
fields_create @
( “stat_field_2”, “Spatial”, 1, “Vector”, “Real”, @
“Coord 0”, ““, “Function”, 1, “X”, ““, ““, “10*’X”, @
“0”, “0”, FALSE, [0.], [0.], [0.], [[[0.]]] )
dump i_return_value

# Create field “trans_field”


i_return_value = @
fields_create @
( “trans_field”, “Non-Spatial”, 1, “Scalar”, “Real”, @
““, ““, “Table”, 1, “t”, ““, ““, ““, ““, ““, FALSE, @
[1., 2., 3., 4., 5.], [0.], [0.], [[[10.]][[20.]][[30.]]@
[[40.]][[50.]]] )
dump i_return_value

# Get the lbc type id for field


FOR ( i_id = 1 TO 3 )
i_return_value = @
db_get_field_lbc_type @
( i_id, @
i_type, @
i_object )
dump i_return_value
dump i_id
dump i_type
dump i_object
END FOR

# For object and type details of field attributes refer Part 9


# Section 9.13 of MSC.Patran Users manual ( Vol. 4 - Release 1.4 )
#---------------------------------------------------------------------

db_get_max_field_id ()

# Purpose : This file provides an example of two calls to


# the function db_get_max_field_id()
#
# This function gets the largest field id from
# the database.
#
# In this example the spool database is opened
# and a new field (“new_field”) is created. Then
# this function is called to get the largest
# field id.
# List of fields and their ids used in this
# example.
# 400_20_psi_transition (id = 1)
# new_field (id = 2)
#
Main Index
1606
Code Examples

# Before running this session file run spool.ses


# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_max_field_id()
# has the following arguments:
#
# db_get_max_field
# ( id )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_id
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Get the largest field id


i_return_value = @
db_get_max_field @
( i_id )
dump i_return_value
dump i_id

# Create field “new_field”


i_return_value = @
fields_create @
( “new_field”, “Spatial”, 1, “Scalar”, “Real”, @
“Coord 0”, ““, “Function”, 1, “X”, ““, ““, @
“10*’X”, ““, ““, FALSE, [0.], [0.], [0.], @
[[[0.]]] )
dump i_return_value

# Get the largest field id


i_return_value = @
db_get_max_field @
( i_id )
dump i_return_value
dump i_id

# It can be observed that i_id = 2 after “new_field” is created.


#---------------------------------------------------------------------

db_get_next_field_name ()

# Purpose : This file provides an example of multiple calls


# to the function db_get_next_field_name()
#
# This function gets the next lbc object name
# from field table of database, by get all, get
# next method.
#
# In this example the spool database is opened
# and a new field (“new_field”) is created. Then
# the function db_get_all_field_names() is
# called to get records from field table. The
# records are then read one by one using this
# function.
#
# Before running this session file run spool.ses
Main Index
CHAPTER 14 1607
Fields

# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_next_field_name()
# has the following arguments:
#
# db_get_next_field_name
# ( id,
# name )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_object
INTEGER i_id
STRING s_name[32]
INTEGER i_all_status
INTEGER i_next_status
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Object Id of selected rows


# i_object = 0(Spatial),1(Material),2(Non-spatial or time)
i_object = 0

# Create field “new_field”


i_return_value = @
fields_create @
( “new_field”, “Spatial”, 1, “Scalar”, “Real”, @
“Coord 0”, ““, “Function”, 1, “X”, ““, ““, @
“10*’X”, ““, ““, FALSE, [0.], [0.], [0.], @
[[[0.]]] )
dump i_return_value

# Get all the lbc object names


i_all_status = @
db_get_all_field_names @
( i_object )
dump i_all_status

# Get next lbc object names


WHILE ( i_next_status == 0 )
i_next_status = @
db_get_next_field_name @
( i_id, @
s_name )
dump i_next_status
IF ( i_next_status == 0 ) THEN
dump i_id
dump s_name
END IF
END WHILE
#---------------------------------------------------------------------

Main Index
1608
Code Examples

db_modify_field ()

# Purpose : This file provides an example of a call to the


# function db_modify_field()
#
# This session file will open a new database and
# will create a spatial field with PCL Function
# ‘x+(y*z)’. The same field will be modified by
# changing the function to ‘x-(y/2)+z’ and the
# modified field will be displayed. The
# extrapolation option will also be modified from
# 1 to 2.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_modify_field() has the following arguments:
#
# db_modify_field
# ( id,
# name,
# object,
# type,
# etype,
# eid,
# extra_opt,
# cid_type,
# cid,
# defn_type,
# nvar,
# ivar1,
# ivar2,
# ivar3,
# fn1_size,
# fn2_size,
# fn3_size,
# fn1,
# fn2,
# fn3,
# lin_def,
# nxvals,
# nyvals,
# nzvals,
# xvals,
# yvals,
# zvals,
# vals )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_id
STRING s_name[32]
INTEGER i_object
INTEGER i_type
INTEGER i_etype
INTEGER i_eid
INTEGER i_extra_opt
INTEGER i_cid_type
INTEGER i_cid
INTEGER i_defn_type
INTEGER i_nvar
INTEGER i_ivar1
INTEGER i_ivar2
Main Index
CHAPTER 14 1609
Fields

INTEGER i_ivar3
INTEGER i_fn1_size
INTEGER i_fn2_size
INTEGER i_fn3_size
STRING s_fn1[16]
STRING s_fn2[16]
STRING s_fn3[16]
LOGICAL l_lin_def
INTEGER i_nxvals
INTEGER i_nyvals
INTEGER i_nzvals
REAL ra_xvals(8)
REAL ra_yvals(8)
REAL ra_zvals(8)
REAL ra_vals(8)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
# Creating scalar field with X Y and Z as variables and a single
# formula - x+(y*z) and extrapolation option as 1.
i_return_value = @
fields_create( “sp_pcl_sca_r”, “Spatial”, 1, “Scalar”, “Real”, @
“Coord 0”, ““, “Function”, 3, “X”, “Y”, “Z”, “‘x+(‘y*’z)”, ““, @
““, FALSE, [0.], [0.], [0.], [ [[0.]]] )
dump i_return_value

i_return_value = db_get_field_id(“sp_pcl_sca_r”,i_id)
dump i_return_value,i_id
#---------------------------------------------------------------------
# Calling function to read the data of the modified function.
i_return_value = @
db_get_field @
( i_id, @
s_name, @
i_object, @
i_type, @
i_etype, @
i_eid, @
i_extra_opt, @
i_cid_type, @
i_cid, @
i_defn_type, @
i_nvar, @
i_ivar1, @
i_ivar2, @
i_ivar3, @
i_fn1_size, @
i_fn2_size, @
i_fn3_size, @
l_lin_def, @
i_nxvals, @
i_nyvals, @
i_nzvals )
dump i_return_value

dump i_id,s_name,i_object,i_type,i_extra_opt,i_cid_type,i_cid
dump i_defn_type,i_nvar,i_ivar1,i_ivar2,i_ivar3,i_fn1_size,l_lin_def
#---------------------------------------------------------------------
# Modifying the field “sp_pcl_sca_r” and changing the function
# to - x-(y/2)+z
s_name=”sp_pcl_sca_r”
i_object=0
i_type=0
i_extra_opt=2
Main Index
1610
Code Examples

i_cid_type=0
i_cid=0
i_defn_type=0
i_nvar=1
i_ivar1=1
i_ivar2=2
i_ivar3=3
i_fn1_size=13
s_fn1=”’x-(‘y/’2)+’z”
l_lin_def=FALSE
#
i_return_value = @
db_modify_field @
( i_id, @
s_name, @
i_object, @
i_type, @
i_etype, @
i_eid, @
i_extra_opt, @
i_cid_type, @
i_cid, @
i_defn_type, @
i_nvar, @
i_ivar1, @
i_ivar2, @
i_ivar3, @
i_fn1_size, @
i_fn2_size, @
i_fn3_size, @
s_fn1, @
s_fn2, @
s_fn3, @
l_lin_def, @
i_nxvals, @
i_nyvals, @
i_nzvals, @
ra_xvals, @
ra_yvals, @
ra_zvals, @
ra_vals )
dump i_return_value

#---------------------------------------------------------------------
# Calling function to read the data of the modified function.
s_name=””
i_nvar=0
i_fn1_size=0

i_return_value = @
db_get_field @
( i_id, @
s_name, @
i_object, @
i_type, @
i_etype, @
i_eid, @
i_extra_opt, @
i_cid_type, @
i_cid, @
i_defn_type, @
i_nvar, @
i_ivar1, @
i_ivar2, @
i_ivar3, @
i_fn1_size, @
i_fn2_size, @
Main Index
CHAPTER 14 1611
Fields

i_fn3_size, @
l_lin_def, @
i_nxvals, @
i_nyvals, @
i_nzvals )
dump i_return_value

dump i_id,s_name,i_object,i_type,i_extra_opt,i_cid_type,i_cid
dump i_defn_type,i_nvar,i_ivar1,i_ivar2,i_ivar3,i_fn1_size,l_lin_def
#---------------------------------------------------------------------

field_create_field_lbc ()

# Purpose : This file provides an example of a call to the


# function field_create_field_lbc()
#
# This session file will open a new database and
# will draw a surface meshed with QUAD4 elements.
# A spatial field will be created using FEM
# method associated with four nodes. The same
# field will be read back.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function field_create_field_lbc()
# has the following arguments:
#
# field_create_field_lbc
# ( id,
# name,
# type,
# ent_type,
# nvals,
# eid,
# elem_face,
# elem_edge,
# node_pos,
# vals )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_id
STRING s_name[32]
INTEGER i_type
INTEGER i_ent_type
INTEGER i_nvals
INTEGER ia_eid(4)
INTEGER ia_elem_face(4)
INTEGER ia_elem_edge(4)
INTEGER ia_node_pos(4)
REAL ra_vals(4)
INTEGER i_return_value
STRING sv_asm_create_patch_xy_created[VIRTUAL]
INTEGER i_fem_create_mesh_surfa_num_nd
INTEGER i_fem_create_mesh_surfa_num_el
STRING sv_fem_create_mesh_s_nodes_crt[VIRTUAL]
STRING sv_fem_create_mesh_s_elems_crt[VIRTUAL]
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
Main Index
1612
Code Examples

# Creating a Hpat surface.


i_return_value = @
asm_const_patch_xyz( “1”, “<1 1 0>”, “[0 0 0]”, “Coord 0”, @
sv_asm_create_patch_xy_created )
dump i_return_value
#---------------------------------------------------------------------
# Meshing the plate with QUAD4 elements.
ui_exec_function( “mesh_seed_display_mgr”, “init” )
i_return_value = @
fem_create_mesh_surf_2( “IsoMesh”, 0, “Surface 1 “, 1, [0.1], @
“Quad4”, “1”, “1”, “Coord 0”, “Coord 0”, @
i_fem_create_mesh_surfa_num_nd, i_fem_create_mesh_surfa_num_el,@
sv_fem_create_mesh_s_nodes_crt, sv_fem_create_mesh_s_elems_crt)
dump i_return_value
mesh_seed_display_mgr.erase( )
#---------------------------------------------------------------------
# Calling function to create a field which has values associated with
# four nodes.
i_id=1
s_name=”lbc_field”
i_type=1
i_ent_type=123
i_nvals=4
ia_eid=[1,2,3,4]
ra_vals=[10.,20.,30.,40.]
#
i_return_value = @
field_create_field_lbc @
( i_id, @
s_name, @
i_type, @
i_ent_type, @
i_nvals, @
ia_eid, @
ia_elem_face, @
ia_elem_edge, @
ia_node_pos, @
ra_vals )
dump i_return_value

#---------------------------------------------------------------------
# Calling function to read the field data.
i_nvals=4
ia_eid=[0,0,0,0]
ra_vals=[0.,0.,0.,0.]
#
i_return_value = @
db_get_field_lbc @
( i_id, @
i_nvals, @
ia_eid, @
ia_elem_face, @
ia_elem_edge, @
ia_node_pos, @
ra_vals )
dump i_return_value
dump i_nvals,ia_eid,ra_vals
#---------------------------------------------------------------------

Main Index
CHAPTER 14 1613
Fields

fields_create_general_term ()

# Purpose : This file provides an example of a call to the


# function fields_create_general_term()
#
# This function creates a term for a general field
# in the database.
#
# This file can be run by starting a session of
# MSC.Patran, opening a new or existing database,
# and running this session file through the
# "File","Session","Play" pulldown menus
# on the menu bar.
#
#
# The function fields_create_general_term()
# has the following arguments:
#
# fields_create_general_term( field_name, @
# term_field_id, @
# term_type, @
# term_id, @
# data_length, @
# data )
#
#---------------------------------------------------------------------
# Variable Declarations

STRING field_name[32]
INTEGER term_field_id
INTEGER term_type
INTEGER term_id
INTEGER data_length
STRING data[32]

STRING asm_create_hpat_xyz_created_ids[VIRTUAL]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database

IF( !db_is_open()) THEN


uil_file_new.go( "", "new.db" )
ENDIF

$? YES 36000002
#---------------------------------------------------------------------
# Set the "ABAQUS" prefrence for analysis.

uil_pref_analysis.set_analysis_pref( "ABAQUS", "Structural", @


".inp", ".fil" )
#---------------------------------------------------------------------
# Create the two 3D Solids.

asm_const_hpat_xyz( "1", "<1 1 1>", "[0 0 0][1 0 0]", "Coord 0", @


asm_create_hpat_xyz_created_ids )
#---------------------------------------------------------------------
# Create Field for contact LBCs in ABAQUS as "._Lbc_contact_lbc1"

fields_create_general( "._Lbc_contact_lbc1", 2, 5, 2, @
"Real", "Coord 0", "", @
0, 0, 0, 0 )
#---------------------------------------------------------------------
# Argument Initialization.

field_name = "._Lbc_contact_lbc1"
Main Index
1614
Code Examples

term_field_id = 0
term_type = 0
term_id = 0
data_length = 17
data = "[1_contact_lbc()]"

#---------------------------------------------------------------------
# Create Term for the Field name "._Lbc_contact_lbc1"

fields_create_general_term ( field_name, @
term_field_id, @
term_type, @
term_id, @
data_length, @
data)
#---------------------------------------------------------------------
# Argument Initialization.

field_name ="._Lbc_contact_lbc1"
term_field_id =0
term_type =1
term_id =1
data_length =152
data ="contact_lbc(22|12|13|14|15|16|" // @
"19|20|21|22|23|24|25|26|27|28|29|30|31|33|3" // @
"5|53|54|1|3|1|1|2|1|1|2|0.02|" // @
"450.|0.|0.|0.|0.|0.|0.|0.|0.0049999999|0.|0."// @
"|2|2)"
#---------------------------------------------------------------------
# Create Term for the Field name "._Lbc_contact_lbc1"

i_return_value = fields_create_general_term ( field_name, @


term_field_id, @
term_type, @
term_id, @
data_length, @
data)
#---------------------------------------------------------------------
# Create the contact deform-deform LBCs.

loadsbcs_create2( "contact_lbc", "Contact[Deform-Deform]", @


"Element Uniform", @
"3D,3D", "Static", ["Solid 1.2", "Solid 2.1"], @
"Geometry,1,1", "Coord 0", "1.", @
["1.", "1.", "", "", "", "", "", "", @
"", "f:._Lbc_contact_lbc1"], ["", "", @
"", "", "", "", "", "", "", ""] )
#---------------------------------------------------------------------
# Dump the return value of the function and its status

dump i_return_value
#---------------------------------------------------------------------
# closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.

field_fem_const_eval ()

# Purpose : This file provides an example of a call to the


# function field_fem_const_eval()
#
# This session file will open a new database and
# will draw a surface meshed with QUAD4 elements.
# The function will be called for five locations
Main Index
CHAPTER 14 1615
Fields

# which are intermediate to three elements and on


# the element boundary at two locations.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function field_fem_const_eval()
# has the following arguments:
#
# field_fem_const_eval
# ( gid,
# numint,
# nindep,
# intrpl,
# extrap,
# maxnod,
# cnst,
# eids,
# geoloc,
# offflg )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_gid
INTEGER i_numint
INTEGER i_nindep
REAL ra_intrpl(5,3)
INTEGER i_extrap
INTEGER i_maxnod
REAL ra_cnst(5,4)
INTEGER ia_eids(5)
REAL ra_geoloc(5,3)
INTEGER ia_offflg(5)
INTEGER i_return_value
STRING sv_asm_create_patch_xy_created[VIRTUAL]
INTEGER i_fem_create_mesh_surfa_num_nd
INTEGER i_fem_create_mesh_surfa_num_el
STRING sv_fem_create_mesh_s_nodes_crt[VIRTUAL]
STRING sv_fem_create_mesh_s_elems_crt[VIRTUAL]
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
# Creating a Hpat surface.
i_return_value = @
asm_const_patch_xyz( “1”, “<5 1 0>”, “[0 0 0]”, “Coord 0”, @
sv_asm_create_patch_xy_created )
dump i_return_value
#---------------------------------------------------------------------
# Meshing the plate with QUAD4 elements.
ui_exec_function( “mesh_seed_display_mgr”, “init” )
i_return_value = @
fem_create_mesh_surf_2( “IsoMesh”, 0, “Surface 1 “, 1, [0.2], @
“Quad4”, “1”, “1”, “Coord 0”, “Coord 0”, @
i_fem_create_mesh_surfa_num_nd, i_fem_create_mesh_surfa_num_el,@
sv_fem_create_mesh_s_nodes_crt, sv_fem_create_mesh_s_elems_crt)
dump i_return_value
mesh_seed_display_mgr.erase( )
#---------------------------------------------------------------------
i_gid=1
i_numint=5
i_nindep=3
ra_intrpl=[[0.,0.,0.][.25,.25,0.][.5,.5,0.][.75,.75,0.][1., 1.,0.]]
i_extrap=1
Main Index
1616
Code Examples

i_maxnod=4
#
i_return_value = @
field_fem_const_eval @
( i_gid, @
i_numint, @
i_nindep, @
ra_intrpl, @
i_extrap, @
i_maxnod, @
ra_cnst, @
ia_eids, @
ra_geoloc, @
ia_offflg )
dump i_return_value
dump ra_cnst,ia_eids,ra_geoloc,ia_offflg
#---------------------------------------------------------------------

fld_cre_fem_res_sca ()

# Purpose : This file provides an example of a call to the


# function fld_cre_fem_res_sca()
#
# This session file will open a database field.db
# which has analysis results imported.
# The results for constrained forces will be
# displayed as a scalar plot and a Tabular
# Spatial field will be created. The field will
# be used for creating a ‘field_res_elem’ table.
#
# Before running this session file run ‘field.ses’
# to create ‘field.db’.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function fld_cre_fem_res_sca()
# has the following arguments:
#
# fld_cre_fem_res_sca
# ( fid,
# grpid,
# scalid )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_fid
INTEGER i_grpid
INTEGER i_scalid
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the “field.db” database.
uil_file_open.go( “field.db”)
#---------------------------------------------------------------------
# Generating scalar results for Constraint Forces.
res_init_fringe_plot( )

res_create_fringe_plot_rec3( 1, 2, 1, 1, 1, 1, 0, 0, 1., ““, 1, 1,@


3, 23, 1, 1, 0., 30, 0, 1 )

res_make_fringe_plot( 1, [1], [1], [““], [0.], [ @


“Default, Static Subcase: Constraint Forces, “ // @
“Translational (VEC-MAG) -MSC.Nastran”] )
Main Index
CHAPTER 14 1617
Fields

#---------------------------------------------------------------------
# Creating Spatial field using Tabular method.
i_return_value = @
fields_create( “tab”, “Spatial”, 1, “Scalar”, “Real”, “Coord 0”, @
““, “Table”, 1, “X”, ““, ““, ““, ““, ““, FALSE, [0.1, @
0.40000001, 0.69999999], [0.], [0.], [[[1.]][[3.]][[5.]]] )
dump i_return_value

i_return_value = db_get_field_id(“tab”,i_fid)
dump i_return_value,i_fid
#---------------------------------------------------------------------
# Scalar element table is created and
# associated with the Default_group.

i_return_value = @
ga_elem_scalar_create(“sclr_elm_tabl”,4,[1,5,19,25],[1,1,1,1],1, @
[1.2,2.3,3.4,4.5],i_scalid)
dump i_return_value,i_scalid

i_return_value = ga_group_elem_scalar_set(“default_group”,i_scalid)
dump i_return_value
#---------------------------------------------------------------------
# For Default_group ID is 1.
i_grpid = 1
#
i_return_value = @
fld_cre_fem_res_sca @
( i_fid, @
i_grpid, @
i_scalid )
dump i_return_value

#---------------------------------------------------------------------
# To confirm the creation of the table user should refer to Query
# Language Interpreter(QLI).
#---------------------------------------------------------------------
# End Of File

fld_cre_fem_res_vec ()

# Purpose : This file provides an example of a call to the


# function fld_cre_fem_res_vec()
#
# This session file will open a database field.db
# which has analysis results imported for a plate
# The results for constrained forces will be
# displayed as a vector plot and a Tabular
# Spatial field will be created. The field will
# be used for creating a ‘field_res_node’ table.
#
# Before running this session file run ‘field.ses’
# to create ‘field.db’.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function fld_cre_fem_res_vec() has the following arguments:
#
# fld_cre_fem_res_vec
# ( fid,
# vecid,
# elmflg )
Main Index
1618
Code Examples

#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_fid
INTEGER i_vecid
INTEGER i_elmflg
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the “field.db” database.
uil_file_open.go( “field.db”)
#---------------------------------------------------------------------
# Generating vector results for Constraint Forces.
res_init_vector_plot( )

res_create_vector_plot_rec( 1, 1, 3, [27, 28, 29, 0, 0, 0], [1, 1,@


1], 1, 1, 0, 0, 1, 0., 2, 1, 1, 1 )

res_make_vector_plot( 1, [1], [2], [““], [0.], [ @


“Default, Static Subcase: Constraint Forces, “// @
“Translational -MSC.Nastran”] )
#---------------------------------------------------------------------
# Creating Spatial field using Tabular method.
i_return_value = @
fields_create( “tab”, “Spatial”, 1, “Scalar”, “Real”, “Coord 0”, @
““, “Table”, 1, “X”, ““, ““, ““, ““, ““, FALSE, [0.1, @
0.40000001, 0.69999999], [0.], [0.], [[[1.]][[3.]][[5.]]] )
dump i_return_value

i_return_value = db_get_field_id(“tab”,i_fid)
dump i_return_value,i_fid
#---------------------------------------------------------------------
# Vector table is created.

i_return_value = @
ga_vector_create(“vect_tbl”,1,1,4,[123,123,123,123],[1,5,15,19], @
[[0.] [0.] [0.] [0.]],[[.1,.1,.1] [.2,.2,.2] [.3,.3,.3] [.25, @
.25,.25]],[1,1,1,1],[1,1,1,1],[0,0,0,0],[0],i_vecid)
dump i_return_value,i_vecid
#---------------------------------------------------------------------
#
i_return_value = @
fld_cre_fem_res_vec @
( i_fid, @
i_vecid, @
i_elmflg )
dump i_return_value

#---------------------------------------------------------------------
# To confirm the creation of the table user should refer to Query
# Language Interpreter(QLI).
#---------------------------------------------------------------------
# End Of File

fld_evl_get_maxnod_for_group ()

# Purpose : This file provides an example of a call to the


# function fld_evl_get_maxnod_for_group()
#
# This function gets the maximum number of nodes
# for any element in a specified group.
#
# In this example the spool database is opened.
# Then the maximum number of nodes for any
# elements present in group “fem_model” is
# obtained using this function.
Main Index
CHAPTER 14 1619
Fields

#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function fld_evl_get_maxnod_for_group()
# has the following arguments:
#
# fld_evl_get_maxnod_for_group
# ( gid,
# maxnod )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_gid
INTEGER i_maxnod
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Get the group id


i_return_value = @
db_get_group_id @
( “fem_model”, @
i_gid )
dump i_return_value

# Get the maximum number of nodes for any element in group


i_return_value = @
fld_evl_get_maxnod_for_group @
( i_gid, @
i_maxnod )
dump i_return_value
dump i_gid
dump i_maxnod
#---------------------------------------------------------------------

get_field_values ()

# Purpose : This file provides an example of a call to the


# function get_field_values()
#
# This session file will open a new database and
# draw surface. A spatial field will be created
# with tabular input and parametric coordinate
# frame. Values for three locations will be
# calculated for the field.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function get_field_values()
# has the following arguments:
#
# get_field_values
# ( field_id,
# num_evals,
# eval_dim,
Main Index
1620
Code Examples

# field_dim,
# eval_points,
# field_values )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_field_id
INTEGER i_num_evals
INTEGER i_eval_dim
INTEGER i_field_dim
REAL ra_eval_points(3,1)
REAL ra_field_values(3,1)
INTEGER i_return_value
STRING sv_asm_create_patch_xy_crtd_ids[VIRTUAL]
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
# Creating a Hpat surface.
i_return_value = @
asm_const_patch_xyz( “1”, “<1 1 0>”, “[0 0 0]”, “Coord 0”, @
sv_asm_create_patch_xy_crtd_ids )
dump i_return_value
#---------------------------------------------------------------------
# Creating a spatial tabular field on parametric coordinate system.
i_return_value = @
fields_create( “sp_tb_para_c1”, “Spatial”, 1, “Scalar”, @
“Parametric”, ““, “Surface 1.1”, “Table”, 1, “C1”, ““, ““, ““, @
““, ““, FALSE, [0.1, 0.25, 0.45, 0.55, 0.8], [0.], [0.], @
[[[1.]][[3.]][[2.]][[-45.]][[6.]] ] )
dump i_return_value

i_return_value = @
db_get_field_id(“sp_tb_para_c1”,i_field_id)
dump i_field_id,i_return_value
#---------------------------------------------------------------------
# Evaluating the field value at three different locations.
i_num_evals=3
i_eval_dim=1
i_field_dim=1
ra_eval_points=[0.,0.5,1.0 ]
#
i_return_value = @
get_field_values @
( i_field_id, @
i_num_evals, @
i_eval_dim, @
i_field_dim, @
ra_eval_points, @
ra_field_values )
dump i_return_value
dump ra_field_values
#---------------------------------------------------------------------

get_field_values_no_trans ()

# Purpose : This file provides an example of a call to the


# function get_field_values_no_trans()
#
# This session file will open a new database and
# draw surface. A spatial field will be created
# with tabular input and parametric coordinate
# frame. Values for three locations will be
# calculated for the field.
Main Index
CHAPTER 14 1621
Fields

#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function get_field_values_no_trans()
# has the following arguments:
#
# get_field_values_no_trans
# ( field_id,
# num_evals,
# eval_dim,
# field_dim,
# eval_points,
# field_values )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_field_id
INTEGER i_num_evals
INTEGER i_eval_dim
INTEGER i_field_dim
REAL ra_eval_points(3,1)
REAL ra_field_values(3,1)
INTEGER i_return_value
STRING sv_asm_create_patch_xy_crtd_ids[VIRTUAL]
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
# Creating a Hpat surface.
i_return_value = @
asm_const_patch_xyz( “1”, “<1 1 0>”, “[0 0 0]”, “Coord 0”, @
sv_asm_create_patch_xy_crtd_ids )
dump i_return_value
#---------------------------------------------------------------------
# Creating a spatial tabular field on parametric coordinate system.
i_return_value = @
fields_create( “sp_tb_para_c1”, “Spatial”, 1, “Scalar”, @
“Parametric”, ““, “Surface 1.1”, “Table”, 1, “C1”, ““, ““, ““, @
““, ““, FALSE, [0.1, 0.25, 0.45, 0.55, 0.8], [0.], [0.], @
[[[1.]][[3.]][[2.]][[-45.]][[6.]] ] )
dump i_return_value

i_return_value = @
db_get_field_id(“sp_tb_para_c1”,i_field_id)
dump i_field_id,i_return_value
#---------------------------------------------------------------------
# Evaluating the field value at three different locations.
i_num_evals=3
i_eval_dim=1
i_field_dim=1
ra_eval_points=[0.,0.5,1.0 ]
#
i_return_value = @
get_field_values_no_trans @
( i_field_id, @
i_num_evals, @
i_eval_dim, @
i_field_dim, @
ra_eval_points, @
ra_field_values )
dump i_return_value
dump ra_field_values
#---------------------------------------------------------------------
Main Index
1622
Code Examples

Main Index
MSC.Acumen, Volume 2: Code Examples

CHAPTER
Results
15
■ Introduction

Main Index
1624
Code Examples

15.1 Introduction
This chapter provides code examples for the PCL function described in Volume 1. These
examples are designed so that they can be cut and pasted into a file and, by following the
instructions listed with each example, executed in MSC.Patran.

db_count_result_types_for_elem ()

# Purpose : This file provides an example of a call to the


# function db_count_result_types_for_elem()
#
# This function counts all the unique result
# types used by a particular element.This
# file opens the existing database “spool.db”
# and counts the unique result types for
# element with id = 6.
#
# Before running this session file run spool.ses
# to create spool.db. Follow the steps given in
# spool.ses to conduct the analysis.
#
# 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_result_types_for_elem()
# has the following arguments:
#
# db_count_result_types_for_elem
# ( elementId,
# resultTypeCount )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_elementId
INTEGER i_resultTypeCount
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)

# Follow the following steps to read the results file.


# 1. From the “Analysis” window, from “Action”
# Option Menu, select “Read Output2” option.
# 2. Click on the “Select Results File..” Button
# and select “spool.op2”. Press “Apply”.

# Session file paused.Press resume to continue.


sf_pause()

# i_elementId = 6
i_elementId = 6

i_return_value = @
db_count_result_types_for_elem @
( i_elementId, @
i_resultTypeCount )
dump i_return_value

# The count of unique result types used by the element with id = 6.


dump i_resultTypeCount
Main Index
CHAPTER 15 1625
Results

# The result types are scalar,vector and tensor.


# The Default value is given in the analysis/subcase create/output
# requests form.The default results contains Element stresses
# which has result type tensor.Hence the count is 1.
#---------------------------------------------------------------------

db_get_elem_scalar_name ()

# Purpose : This file provides an example of a call to the


# function db_get_elem_scalar_name()
#
# This function gets the name of the type results
# in the graphics element scalar blob.This file
# opens the database “spool.db” and gets the
# element results from the database.Later it
# creates a element scalar table with the name
# “RESULTS TABLE” and finally gets this name
# using the above function.
#
# Before running this session file run spool.ses
# to create spool.db. Follow the instructions in
# spool.ses and create spool.op2 and spool.jbr.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_elem_scalar_name()
# has the following arguments:
#
# db_get_elem_scalar_name
# ( scalar_id,
# name )
#---------------------------------------------------------------------
# Variable Declarations
STRING s_title[32],s_group_name[32]
INTEGER i_ncases, iv_lcids(VIRTUAL),iv_nsub(VIRTUAL),ia_resids(5)
INTEGER i_dtype,i_resloc,i_nbr_elems,iv_elem_ids(VIRTUAL)
INTEGER iv_nbr_values(VIRTUAL),ia_minloc(6),ia_maxloc(6)
INTEGER i_max_vals
INTEGER i_id
INTEGER i_index
REAL rv_scalars(VIRTUAL)
INTEGER i_scalar_id
STRING s_name[32]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db” and read the deformation results
sf_play(“spool_res.ses”)

# Get the number of Load cases and their IDs


i_return_value = @
res_utl_get_loadcases(i_ncases,iv_lcids,iv_nsub)
dump i_return_value
dump i_ncases,iv_lcids,iv_nsub

# Extract the deformation results from the database


# Load case ID = iv_lcids(1)
# Sub case ID = 1
# Primary Result ID = 2 (Corresponds to deformation )
# Secondary Result ID = 1
# Layer ID = 1
# elem_list = “Element 1:#” (All elements )
# location = “C” (Centroid )
Main Index
1626
Code Examples

# derivation = “MAG” (Magnitude: Vector to Scalar)


# c_id = ““
ia_resids(1) = iv_lcids(1)
ia_resids(2) = 1
ia_resids(3) = 2
ia_resids(4) = 1
ia_resids(5) = 1
i_return_value = @
res_utl_extract_elem_results(ia_resids, @
“Element 1:#”,”MAG”,”C”,””,i_dtype,i_resloc, @
i_nbr_elems,iv_elem_ids,iv_nbr_values, @
rv_scalars, ia_minloc,ia_maxloc)

dump i_return_value

# Create a scalar table


s_title = “RESULTS TABLE”
i_max_vals = 1 /* Only at the Centroid */

i_return_value = @
ga_elem_scalar_create @
( s_title, @
i_nbr_elems, @
iv_elem_ids, @
iv_nbr_values, @
i_max_vals, @
rv_scalars, @
i_id )
dump i_return_value, i_id

# Set the current scalar element table associated with the


# group “fem_model”
s_group_name = “fem_model”
i_return_value = @
ga_group_elem_scalar_set @
( s_group_name, @
i_id )
dump i_return_value

i_scalar_id = i_id
i_return_value = @
db_get_elem_scalar_name @
( i_scalar_id, @
s_name )
dump i_return_value

# The name of the result type being retrived from the database
dump s_name

# Delete the scalar table.


#i_return_value = ga_elem_scalar_delete(i_id)
dump i_return_value

sys_free_array(iv_lcids)
sys_free_array(iv_nsub)
sys_free_array(iv_elem_ids)
sys_free_array(iv_nbr_values)
sys_free_array(rv_scalars)
#---------------------------------------------------------------------

Main Index
CHAPTER 15 1627
Results

db_get_results_file_suffix ()

# Purpose : This file provides an example of a call to the


# function db_get_results_file_suffix()
#
# This function retrieves the result file suffix
# associated with the named analysis code.This
# file opens a new database “new.db” and gets
# the results file suffix associated with the
# analysis code MSC.Nastran.Later it sets
# the suffix to ‘.res’ and gets the result file
# suffix again.
#
# 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_results_file_suffix()
# has the following arguments:
#
# db_get_results_file_suffix
# ( name,
# suffix )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
STRING s_suffix[32]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# s_name = “MSC.Nastran”
s_name = “MSC.Nastran”

i_return_value = @
db_get_results_file_suffix @
( s_name, @
s_suffix )
dump i_return_value
# The result file suffix for analysis code MSC.Nastran is
dump s_suffix

# Set the result file suffix to ‘.res’


i_return_value = @
db_set_results_file_suffix @
( s_name, @
“.res”)
dump i_return_value

i_return_value = @
db_get_results_file_suffix @
( s_name, @
s_suffix )
dump i_return_value
# The result file suffix for analysis code MSC.Nastran is
dump s_suffix
#---------------------------------------------------------------------

Main Index
1628
Code Examples

jobfile.create_jobname ()

# Purpose : This function creates a jobname for current


# analysis code. It returns a status of 0 on
# successful completion.
#
# 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 jobfile.create_jobname()
# has no arguments:
#
#---------------------------------------------------------------------
# Opening a new database

IF (!db_is_open()) THEN
uil_file_new.go("","new.db")
ENDIF
$? YES 36000002

INTEGER status = 5

#---------------------------------------------------------------------
# Opening the jobfile with the name 'new.jbr'.

jobfile.open( "new", "RESULTS" )

#---------------------------------------------------------------------
# Deleting Old result and jobfiles.

msc_delete_old_files( "new", ".bdf", ".op2" )

#---------------------------------------------------------------------
# Using the function jobfile.create_jobname() to the verify the jobname.

status = jobfile.create_jobname()

dump status

#---------------------------------------------------------------------
# Closing the jobfile.

jobfile.close( )

#---------------------------------------------------------------------
# Closing Patran

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

jobfile.create_param ()

# Purpose : This function creates a parameter set for the


# current parameter set of the type indicated.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the "File","Session","Play" pulldown
Main Index
CHAPTER 15 1629
Results

# menus on the menu bar.


#
#
# The function jobfile.create_param()
# has the following arguments:
#
# jobfile.create_param(
# label_str,
# int_val,
# real_val,
# char_val,
# param_type )
#
#---------------------------------------------------------------------
# Variable Declerations.

INTEGER status = 5

#---------------------------------------------------------------------
# Opening a new database

IF (!db_is_open()) THEN
uil_file_new.go("","new.db")
ENDIF
$? YES 36000002

#---------------------------------------------------------------------
# Opening the jobfile with the name 'new.jbr'.

jobfile.open( "new", "RESULTS" )

#---------------------------------------------------------------------
# Deleting Old result and jobfiles.

msc_delete_old_files( "new", ".bdf", ".op2" )

#---------------------------------------------------------------------
# Writing statements to the jobfile.

status = jobfile.create_param( @
"", @
5, @
0.0, @
"", @
1 )
dump status

#---------------------------------------------------------------------
# Checking the number of entries written to the database.

status = 5
INTEGER num_param

status = db_count_param_set_entries( 1, @
num_param )
dump num_param, status
#---------------------------------------------------------------------
# Retriving the entries in the param set.

status = 5
INTEGER param_type(VIRTUAL), param_int(VIRTUAL), count = 1
REAL param_real(VIRTUAL)
STRING param_str[512](VIRTUAL), param_name[80](VIRTUAL)

status = db_get_param_set_entries( 1 , @
count, @
Main Index
1630
Code Examples

param_name, @
param_type, @
param_real, @
param_str, @
param_int )

dump status, param_int, count


#---------------------------------------------------------------------
# Closing jobfile

jobfile.close( )

#---------------------------------------------------------------------
# Closing Patran

uil_file_close.goquit( )

#---------------------------------------------------------------------

jobfile.eval_list

# Purpose : This function sorts the values in the string


# in the form of real or integer array. This
# function should be followed by
# function jobfile.write_array_as_list to
# write the array.
#
# 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 jobfile.eval_list()
# has the following arguments:
#
# jobfile.eval_list
# ( list_str,
# sublist_filter )
#
#---------------------------------------------------------------------
# Opening a new database

IF(!db_is_open()) THEN
uil_file_new.go("","new.db")
ENDIF
$? YES 36000002

#---------------------------------------------------------------------
# VAriable Decelerations

INTEGER i_status = 5
STRING s_value_format[32]
STRING s_label[32]
STRING s_integer_val[32]
INTEGER num_values_on_line = 10
STRING s_ilist[64] = " 1:100"

#---------------------------------------------------------------------
# refer lpenums.i for the next assignment of LP_SUBLIST_TOKEN_INT

INTEGER LP_SUBLIST_TOKEN_INT = 8192

s_label = "THE INTEGER ARRAY IS"


s_value_format = "%I2.2%"
Main Index
CHAPTER 15 1631
Results

#---------------------------------------------------------------------
# Opening the jobfile with the name 'new.jba'.

jobfile.open( "new", "ANALYZE" )

#---------------------------------------------------------------------
# Deleting Old result and jobfiles.

msc_delete_old_files( "new", ".bda", ".op2" )

i_status = jobfile.eval_list( @
s_ilist, @
LP_SUBLIST_TOKEN_INT )

dump i_status
#---------------------------------------------------------------------
jobfile.write_string( " ", " " )

i_status = jobfile.write_array_as_list( @
s_label, @
s_value_format, @
num_values_on_line )
#---------------------------------------------------------------------
# Closing the jobfile.

jobfile.close( )

#---------------------------------------------------------------------
# Closing Patran

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

jobfile.write_array_as_list

# Purpose : This function writes any array of list


# in the string format to the jobfile in the
# desired format.
#
# 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 jobfile.write_array_as_list()
# has the following arguments:
#
# jobfile.write_array_as_list
# ( label_str,
# value_format,
# num_values_on_line )
#
#---------------------------------------------------------------------
# Opening a new database

IF(!db_is_open()) THEN
uil_file_new.go("","new.db")
ENDIF
$? YES 36000002

#---------------------------------------------------------------------
Main Index
1632
Code Examples

# VAriable Decelerations

INTEGER i_status = 5
STRING s_value_format[32]
STRING s_label[32]
STRING s_integer_val[32]
INTEGER num_values_on_line = 10
STRING s_ilist[64] = " 1:100"

#---------------------------------------------------------------------
# refer lpenums.i for the next assignment of LP_SUBLIST_TOKEN_INT

INTEGER LP_SUBLIST_TOKEN_INT = 8192

s_label = "THE INTEGER ARRAY IS"


s_value_format = "%I2.2%"

#---------------------------------------------------------------------
# Opening the jobfile with the name 'new.jba'.

jobfile.open( "new", "ANALYZE" )

#---------------------------------------------------------------------
# Deleting Old result and jobfiles.

msc_delete_old_files( "new", ".bda", ".op2" )

jobfile.eval_list(s_ilist,LP_SUBLIST_TOKEN_INT)

jobfile.write_string( " ", " " )

#---------------------------------------------------------------------
# Using the function jobfile.write_array_as_list() to the
# jobfile 'new.jba'.

i_status = jobfile.write_array_as_list( @
s_label, @
s_value_format, @
num_values_on_line)
dump i_status
#---------------------------------------------------------------------
# Closing the jobfile.

jobfile.close( )

#---------------------------------------------------------------------
# Closing Patran

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

jobfile.write_element_list

# Purpose : This function writes an integer array of element


# list in the string format to the jobfile.
#
# 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 jobfile.write_element_list()
# has the following arguments:
Main Index
CHAPTER 15 1633
Results

#
# jobfile.write_element_list
# ( label_str,
# element_list_array )
#
#---------------------------------------------------------------------
# Opening a new database

IF(!db_is_open()) THEN
uil_file_new.go("","new.db")
ENDIF
$? YES 36000002

#---------------------------------------------------------------------
# VAriable Decelerations

INTEGER i_status
STRING s_element_list[32]
STRING s_label[32]

s_label = "ELEMENT LIST"


s_element_list = "Element 1:100"

#---------------------------------------------------------------------
# Opening the jobfile with the name 'new.jba'.

jobfile.open( "new", "ANALYZE" )

#---------------------------------------------------------------------
# Deleting Old result and jobfiles.

msc_delete_old_files( "new", ".bda", ".op2" )

#---------------------------------------------------------------------
# Using the function jobfile.write_element_list() to the jobfile 'new.jba'.

jobfile.write_string( " ", " " )

jobfile.write_element_list( @
s_label, @
s_element_list )

jobfile.write_string( " ", " " )

#---------------------------------------------------------------------
# Closing the jobfile.

jobfile.close( )

#---------------------------------------------------------------------
# Closing Patran

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

jobfile.write_integer_list

# Purpose : This function writes an integer array of list


# in the string format to the jobfile.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the "File","Session","Play" pulldown
Main Index
1634
Code Examples

# menus on the menu bar.


#
# The function jobfile.write_integer_list()
# has the following arguments:
#
# jobfile.write_integer_list
# ( label_str,
# integer_val_array )
#
#---------------------------------------------------------------------
# Opening a new database

IF(!db_is_open()) THEN
uil_file_new.go("","new.db")
ENDIF
$? YES 36000002

#---------------------------------------------------------------------
# VAriable Decelerations

INTEGER i_status
STRING s_integer_val[32]
STRING s_label[32]

s_label = "TEST STRING"


s_integer_val = "1 5"

#---------------------------------------------------------------------
# Opening the jobfile with the name 'new.jba'.

jobfile.open( "new", "ANALYZE" )

#---------------------------------------------------------------------
# Deleting Old result and jobfiles.

msc_delete_old_files( "new", ".bda", ".op2" )

#---------------------------------------------------------------------
# Using the function jobfile.write_integer_list() to the jobfile 'new.jba'.

jobfile.write_string( " ", " " )

jobfile.write_integer_list( @
s_label, @
s_integer_val )

jobfile.write_string( " ", " " )

#---------------------------------------------------------------------
# Closing the jobfile.

jobfile.close( )

#---------------------------------------------------------------------
# Closing Patran

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

Main Index
CHAPTER 15 1635
Results

jobfile.write_node_list

# Purpose : This function writes a node array of list


# in the string format to the jobfile.
#
# 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 jobfile.write_node_list()
# has the following arguments:
#
# jobfile.write_node_list
# ( label_str,
# node_list )
#
#---------------------------------------------------------------------
# Opening a new database

IF(!db_is_open()) THEN
uil_file_new.go("","new.db")
ENDIF
$? YES 36000002

#---------------------------------------------------------------------
# VAriable Decelerations

INTEGER i_status
STRING s_node_list[32]
STRING s_label[32]

s_label = "NODE LIST"


s_node_list = "Node 1:100"

#---------------------------------------------------------------------
# Opening the jobfile with the name 'new.jba'.

jobfile.open( "new", "ANALYZE" )

#---------------------------------------------------------------------
# Deleting Old result and jobfiles.

msc_delete_old_files( "new", ".bda", ".op2" )

#---------------------------------------------------------------------
# Using the function jobfile.write_node_list() to the jobfile 'new.jba'.

jobfile.write_string( " ", " " )

jobfile.write_node_list( @
s_label, @
s_node_list )

jobfile.write_string( " ", " " )

#---------------------------------------------------------------------
# Closing the jobfile.

jobfile.close( )

#---------------------------------------------------------------------
# Closing Patran

Main Index
1636
Code Examples

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

jobfile.write_real_list

# Purpose : This function writes a real array of list in the


# string format to the jobfile.
#
# 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 jobfile.write_real_list()
# has the following arguments:
#
# jobfile.write_real_list
# ( label_str,
# real_val_array )
#
#---------------------------------------------------------------------
# Opening a new database

IF(!db_is_open()) THEN
uil_file_new.go("","new.db")
ENDIF
$? YES 36000002

#---------------------------------------------------------------------
# VAriable Decelerations

INTEGER i_status
STRING s_real_val[32]
STRING s_label[32]

s_label = "TEST STRING"


s_real_val = "1.5 2.5"

#---------------------------------------------------------------------
# Opening the jobfile with the name 'new.jba'.

jobfile.open( "new", "ANALYZE" )

#---------------------------------------------------------------------
# Deleting Old result and jobfiles.

msc_delete_old_files( "new", ".bda", ".op2" )

#---------------------------------------------------------------------
# Using the function jobfile.write_real_list() to the jobfile 'new.jba'.

jobfile.write_string( " ", " " )

jobfile.write_real_list( @
s_label, @
s_real_val )

jobfile.write_string( " ", " " )

#---------------------------------------------------------------------
# Closing the jobfile.
Main Index
CHAPTER 15 1637
Results

jobfile.close( )

#---------------------------------------------------------------------
# Closing Patran

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

jobfile.write_stream

# Purpose : This function writes a data of any type


# to the jobfile.
#
#
# 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 jobfile.write_stream()
# has the following arguments:
#
# jobfile.write_stream
# ( label_str,
# int_val,
# real_val,
# string_val )
#
#---------------------------------------------------------------------
# Opening a new database

IF(!db_is_open()) THEN
uil_file_new.go("","new.db")
ENDIF
$? YES 36000002

#---------------------------------------------------------------------
# VAriable Decelerations

INTEGER i_int_val
REAL r_real_val
STRING s_string_val[32]

s_string_val = "TEST STRING"


i_int_val = 10
r_real_val = 1.5

#---------------------------------------------------------------------
# Opening the jobfile with the name 'new.jba'.

jobfile.open( "new", "ANALYZE" )

#---------------------------------------------------------------------
# Deleting Old result and jobfiles.

msc_delete_old_files( "new", ".bdf", ".op2" )

#---------------------------------------------------------------------
# Using the function jobfile.write_stream() to the jobfile 'new.jba'.

jobfile.write_string( " ", " " )


Main Index
1638
Code Examples

jobfile.write_stream( @
"The text is :int_va=%I%, real val=%G% and string value is %A%",@
i_int_val, @
r_real_val, @
s_string_val )

jobfile.write_string( " ", " " )

#---------------------------------------------------------------------
# Closing the jobfile.

jobfile.close( )

#---------------------------------------------------------------------
# Closing Patran

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

jobfile.write_string

# Purpose : This function will write a Label = String


# in to job file which is opened by function
# jobfile.open(). It requires two arguments
# one is Label(String) and String which is to
# be written in to jobfile. It returns integer
# status, on success it is 0 and on failure
# it is non zero.
#
# The function jobfile.write_string()
# has the following arguments:
#
# jobfile.write_string()
# ( STRING label_str,
# STRING char_val,)
#
#---------------------------------------------------------------------
#
# Opening a new database

uil_file_new.go("","new.db")

INTEGER status = 5
STRING label_str[32], char_val[256]

label_str = "LABEL(first Arguement)"


char_val = "TRIAL_TEXT,TRIAL_TEXT,TRIAL_TEXT,TRIAL_TEXT," // @
"TRIAL_TEXT,TRIAL_TEXT,TRIAL_TEXT,TRIAL_TEXT," // @
"TRIAL_TEXT,TRIAL_TEXT,TRIAL_TEXT,TRIAL_TEXT," // @
"TRIAL_TEXT,TRIAL_TEXT,TRIAL_TEXT,TRIAL_TEXT,"

#---------------------------------------------------------------------
# Opening the jobfile with the name 'new.jbr'.

jobfile.open( "new", "RESULTS" )

#---------------------------------------------------------------------
# Deleting Old result and jobfiles.

msc_delete_old_files( "new", ".bdf", ".op2" )


Main Index
CHAPTER 15 1639
Results

#---------------------------------------------------------------------
# Using the function jobfile.write_string() to the jobfile.

jobfile.write_string( " ", " " )


status = jobfile.write_string( label_str, char_val)
jobfile.write_string( " ", " " )

dump status

#---------------------------------------------------------------------
# Closing the jobfile.

jobfile.close( )

#---------------------------------------------------------------------
# Closing Patran

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

jobfile.writer

# Purpose : This function writes real values in the jobfile


# opened by the jobfile.open() function.
#
# This function can be run in batchmode by running
# this session file from "File","Session","Play"
# pulldown menus on the menu bar.
#
#
# The function jobfile.writec()
# has the following arguments:
#
# jobfile.writec(
# ( label_str,
# r_val )
#
#---------------------------------------------------------------------
# Variable Declarations

INTEGER i_return_status = 1
#---------------------------------------------------------------------
# Open a new database "new.db"
IF(!db_is_open())THEN
uil_file_new.go( "","new.db" )
ENDIF
$? YES 36000002
#---------------------------------------------------------------------
# Opens the jobfile

i_return_status = jobfile.open( "new", "RESULTS" )


#---------------------------------------------------------------------
# Delete the old files - .bdf and .op2 files.

msc_delete_old_files( "new", ".bdf", ".op2" )


#---------------------------------------------------------------------
# Write the various real values in the file - new.jbr
# The format is jobfile.writer("str_1",r_val) writes the following
# to the output file : str_1 = r_val.

jobfile.writer("REAL_VALUE_1 = ",3.1)
jobfile.writer("REAL_VALUE_2 = ",-2.9673)
jobfile.writer("REAL_VALUE_3 = ",0.4999999999999999)
Main Index
1640
Code Examples

#---------------------------------------------------------------------
# Close the file new.jbr

jobfile.close()

#--------------------------------------------------------------------
# Close the file new.db

uil_file_close.goquit()

#--------------------------------------------------------------------

jobfile.writeS1

# Purpose : This function will write the array of one


# real element in to file opened by the jobfile.open()
# function.It requires one string and array of one
# real element as input argument.
#
# 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 jobfile.writeS1()
# has the following arguments:
#
# jobfile.writeS1
# ( STRING label,
# REAL rl_val()
# )
#---------------------------------------------------------------------
#
# Opening a new database

uil_file_new.go("","new.db")

INTEGER jobstatus= 6013032


STRING msgstring[256]
#STRING msgstring[256]="TESTING_SET.JOB_STATUS FUNCTION"

#---------------------------------------------------------------------
# Opening the jobfile with the name 'new.jbr'.

jobfile.open( "new", "RESULTS" )

#---------------------------------------------------------------------
# Deleting Old result and jobfiles.

msc_delete_old_files( "new", ".bdf", ".op2" )

#---------------------------------------------------------------------
# Using the function jobfile.writeS1() to the jobfile.

jobfile.set_job_status(jobstatus,msgstring)

#---------------------------------------------------------------------
# Closing the jobfile.
Main Index
CHAPTER 15 1641
Results

dump jobfile.close( )

#---------------------------------------------------------------------
#Displaying message to form

msg_to_form(jobstatus,1,0,0,0,msgstring)
# Closing Patran

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

jobfile.writeS2

# Purpose : This function will write the array of two


# real elements in to file opened by the jobfile.open()
# function.It requires one string and array of two
# real elements as input arguments.
#
# 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 jobfile.writeS2()
# has the following arguments:
#
# jobfile.writeS2
# ( STRING label,
# REAL rl_val()
# )
#---------------------------------------------------------------------
# Opening a new database

IF (!db_is_open()) THEN
uil_file_new.go("","new.db")
ENDIF
$? YES 36000002

STRING label_str[32]
REAL rl_val(2)=[1.1,2.2]

label_str = "LABEL(first Arguement)"

#---------------------------------------------------------------------
# Opening the jobfile with the name 'new.jbr'.

jobfile.open( "new", "RESULTS" )

#---------------------------------------------------------------------
# Deleting Old result and jobfiles.

msc_delete_old_files( "new", ".bdf", ".op2" )

#---------------------------------------------------------------------
# Using the function jobfile.writeS2() to the jobfile.

jobfile.writeS2(label_str,rl_val)

#---------------------------------------------------------------------
# Closing the jobfile.
Main Index
1642
Code Examples

jobfile.close( )

#---------------------------------------------------------------------
# Closing Patran

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File. /*jobfile.writeS2.example.ses*/

jobfile.writeS3

# Purpose : This function will write the array of three


# real elements in to file opened by the jobfile.open()
# function.It requires one string and array of three
# real elements as input arguments.
#
# 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 jobfile.writeS3()
# has the following arguments:
#
# jobfile.writeS3
# ( STRING label,
# REAL rl_val()
# )
#---------------------------------------------------------------------
# Opening a new database

IF (!db_is_open()) THEN
uil_file_new.go("","new.db")
ENDIF
$? YES 36000002

STRING label_str[32]
REAL rl_val(3)=[1.1,2.2,3.3]

label_str = "LABEL(first Arguement)"

#---------------------------------------------------------------------
# Opening the jobfile with the name 'new.jbr'.

jobfile.open( "new", "RESULTS" )

#---------------------------------------------------------------------
# Deleting Old result and jobfiles.

msc_delete_old_files( "new", ".bdf", ".op2" )

#---------------------------------------------------------------------
# Using the function jobfile.write_string() to the jobfile.

jobfile.writeS3(label_str,rl_val)

#---------------------------------------------------------------------
# Closing the jobfile.

jobfile.close( )

#---------------------------------------------------------------------
Main Index
CHAPTER 15 1643
Results

# Closing Patran

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File. /* jobfile.writeS3.example.ses */

jobfile.writeS4

# Purpose : This function will write the array of four


# real elements in to file opened by the jobfile.open()
# function.It requires one string and array of four
# real elements as input arguments.
#
# 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 jobfile.writeS4()
# has the following arguments:
#
# jobfile.writeS4
# ( STRING label,
# REAL rl_val()
# )
#---------------------------------------------------------------------
# Opening a new database

IF (!db_is_open()) THEN
uil_file_new.go("","new.db")
ENDIF
$? YES 36000002

STRING label_str[32]
REAL rl_val(4)=[1.1,2.2,3.3,4.4]

label_str = "LABEL(first Arguement)"

#---------------------------------------------------------------------
# Opening the jobfile with the name 'new.jbr'.

jobfile.open( "new", "RESULTS" )

#---------------------------------------------------------------------
# Deleting Old result and jobfiles.

msc_delete_old_files( "new", ".bdf", ".op2" )

#---------------------------------------------------------------------
# Using the function jobfile.writeS4() to the jobfile.

jobfile.writeS4(label_str,rl_val)

#---------------------------------------------------------------------
# Closing the jobfile.

jobfile.close( )

#---------------------------------------------------------------------
# Closing Patran

uil_file_close.goquit( )
Main Index
1644
Code Examples

#---------------------------------------------------------------------
# End of File. /* jobfile.writeS4.example.ses */

jobfile.writeSS

# Purpose : This function will write the array of two


# integer elements in to file opened by the jobfile.open()
# function.It requires one string and array of two
# integer elements as input arguments.
#
# 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 jobfile.writeSS()
# has the following arguments:
#
# jobfile.writeSS
# ( STRING label,
# INTEGER int_val()
# )
#---------------------------------------------------------------------
# Opening a new database

IF (!db_is_open()) THEN
uil_file_new.go("","new.db")
ENDIF
$? YES 36000002

STRING label_str[32]
INTEGER int_val(2)=[1,2]

label_str = "LABEL(first Arguement)"

#---------------------------------------------------------------------
# Opening the jobfile with the name 'new.jbr'.

jobfile.open( "new", "RESULTS" )

#---------------------------------------------------------------------
# Deleting Old result and jobfiles.

msc_delete_old_files( "new", ".bdf", ".op2" )

#---------------------------------------------------------------------
# Using the function jobfile.writeSS() to the jobfile.

jobfile.writeSS(label_str,int_val)

#---------------------------------------------------------------------
# Closing the jobfile.

jobfile.close( )

#---------------------------------------------------------------------
# Closing Patran

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File. /*jobfile.writeSS.example.ses*/
Main Index
CHAPTER 15 1645
Results

rdm_result_minmax_get ()

# Purpose : This file provides an example of a call to the


# function rdm_result_minmax_get()
#
# This function optains the minmax from the current
# "active" result controlling the current viewport
# spectrum/range.
#
# 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 rdm_result_minmax_get()
# has the following arguments:
#
# rdm_result_minmax_get
# (Active viewport spectrum, @
# min, @
# max)
#
#---------------------------------------------------------------------
# Variable Decleration

STRING asm_create_patch_xy_created_ids[VIRTUAL]
INTEGER fem_create_mesh_surfa_num_nodes
INTEGER fem_create_mesh_surfa_num_elems
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]
INTEGER res_create_demo_mcid
INTEGER res_create_demo_scid
INTEGER res_create_demo_rcid
INTEGER res_create_demo_rtid
INTEGER res_create_demo_layerposid
REAL min, max
INTEGER i_return_status

#---------------------------------------------------------------------
# Opening a new database

if(!db_is_open())THEN
uil_file_new.go("","new.db")
$? YES 36000002
endif

#---------------------------------------------------------------------
# Creating a patch

asm_const_patch_xyz( "1", "<1 1 0>", @


"[0 0 0]", "Coord 0", @
asm_create_patch_xy_created_ids )
#---------------------------------------------------------------------
# Meshing the geometry with 121 nodes and 100 elements.

ui_exec_function( "mesh_seed_display_mgr", "init" )

fem_create_mesh_surf_3( "IsoMesh", @
16384, @
"Surface 1", @
1, @
["0.1"], @
"Quad4", @
"#", @
Main Index
1646
Code Examples

"#", @
"Coord 0", @
"Coord 0", @
fem_create_mesh_surfa_num_nodes, @
fem_create_mesh_surfa_num_elems, @
fem_create_mesh_s_nodes_created, @
fem_create_mesh_s_elems_created )

mesh_seed_display_mgr.erase( )
#---------------------------------------------------------------------
# Creating Demo results

db_drop_res_index( )

res_db_create_loadcase_c("Derived Results", 1, @
"Created by PATRAN for demo results", @
res_create_demo_mcid )
res_db_create_subcase_c( 2, "Demo", @
res_create_demo_scid, @
res_create_demo_rcid )

res_db_createlayerpos_c( 0, 0, @
res_create_demo_layerposid )

res_db_create_restype_c( "Nodal Scalar", "Demo Result1", @


1, 1, "By PATRAN For Demo Results", @
0, res_create_demo_rtid )

res_create_demoresult2( 1, 1, 1., 1, 1, 1, @
[0, 0, 0, 0], 1, 0, 0, 0 )

#---------------------------------------------------------------------
# Creating a patch
db_post_results_load( )

res_data_load_dbresult( 0, "Nodal", "Scalar", @


"Derived Results", "Demo", "Nodal Scalar", @
"Demo Result1", "(NON-LAYERED)", "", "Default", @
"DeriveAverage", "All", "ShapeFunc" )

res_display_fringe_create( "", "FreeFaces", 0, [""], 12, @


[ "Range:Fri_default_Fringe", "RangeOverwrite:ON", @
"FringeStyle:Discrete/Smooth", "Shade:None", @
"ElemEdge:FreeEdge,Blue,Solid,1", "Shrink:0", @
"TitleDisplay:ON", "MinMaxDisplay:ON", "ValueDisplay:OFF", @
"Filter:None", "ScaleFactor:1.", "LabelStyle:Exponential, @
12, White, 3"], TRUE )

res_display_fringe_post( "", 0, "Nodal", TRUE, TRUE )


#---------------------------------------------------------------------
# Using the function rdm_result_minmax_get to get the minimum and
# maximum values of the fringe.

i_return_status = rdm_result_minmax_get( @
"", @
min, @
max )

dump min , max , i_return_status

#---------------------------------------------------------------------
# Closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
Main Index
CHAPTER 15 1647
Results

res_db_cgetlayerposids ()

# Purpose : This function will retrive list of layers of


# a result type in a given result case.
# This function requires result case id,and
# result type id as input arguments.
#
# Before running this session file run spool.ses
# and import result file spool.op2 to create
# spool.db with results. For instruction see
# file spool.ses.
#
# 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 res_db_cgetlayerposids()
# has the following arguments:
#
# res_db_cgetlayerposids
# ( INPUT:
# INTEGER rescase_id
# INTEGER rt_id
# OUTPUT:
# INTEGER nlayers
# INTEGER layerposids()
# )
#---------------------------------------------------------------------
#
# Opening a spool.db database

uil_file_open.go("spool.db")

#---------------------------------------------------------------------

# Declaring input arguents

INTEGER rescase_id(1)
INTEGER rt_id

# Declaring output argument

INTEGER nlayers
INTEGER layerposids(1)
INTEGER status

#----------------------------------------------------------------------

# Using the function db_get_load_case_id() to get the load case id.

INTEGER loadcase_id(1)
db_get_load_case_id("spool_loads", @
loadcase_id(1))

# Using the function db_get_sub_case_id() to get the sub case id.

INTEGER subcase_id(1)
db_get_sub_case_id(loadcase_id(1), @
"Static Subcase", @
subcase_id(1))

Main Index
1648
Code Examples

# Using the function res_db_cgetrescases() to get the the result


# case ids.

INTEGER numload_cases = 1
res_db_cgetrescases(numload_cases, @
loadcase_id, @
subcase_id, @
rescase_id)

# Using the function db_get_primary_res_id to get the primary result id

STRING pri_res_label[32] = "Displacements"


INTEGER prires_id
db_get_primary_res_id(pri_res_label, @
prires_id)

# Using the function db_get_secondary_res_id to get the secondary result id

STRING sec_res_label[32] = "Translational"


INTEGER secres_id
db_get_secondary_res_id(prires_id, @
sec_res_label, @
secres_id)

# Using the function vki_db_getresid to retrive result type id


# from the data base.

rt_id = vki_db_getresid(rescase_id(1), @
prires_id, @
secres_id)

#---------------------------------------------------------------------

# Using the function res_db_cgetlayerposids to retrive number of


# layers and layerposids from the data base.

status = res_db_cgetlayerposids(rescase_id(1), @
rt_id, @
nlayers, @
layerposids )

dump status
dump nlayers
dump layerposids

#---------------------------------------------------------------------

# End of File.

#---------------------------------------------------------------------

res_db_cgetrescases ()

# Purpose : This function will get the resultcase ids.


# This function requires number of load cases
# primary load case ids, primary subcase ids
# as input argument.
#
# Before running this session file run spool.ses
# and import result file spool.op2 to create
# spool.db with results. For instruction see
# file spool.ses.
#
# This file can be run by starting a session of
# MSC.Patran,running this session file through
Main Index
CHAPTER 15 1649
Results

# the "File","Session","Play" pulldown menus


# on the menu bar.
#
#
# The function res_db_cgetrescases()
# has the following arguments:
#
# res_db_cgetrescases
# ( INPUT:
# INTEGER num_ldcase
# INTEGER loadcase_id()
# INTEGER subcase_id()
# OUTPUT:
# INTEGER rescase_id()
# INTEGER status
# )
#---------------------------------------------------------------------
#
# Opening a spool.db database

uil_file_open.go("spool.db")

#---------------------------------------------------------------------

# Declaring input arguents

INTEGER numload_cases = 1

INTEGER loadcase_id(1)

INTEGER subcase_id(1)

# Declaring output argument

INTEGER rescase_id(1)

INTEGER status

#----------------------------------------------------------------------

# Using the function db_get_load_case_id() to get the load case id.

db_get_load_case_id("spool_loads", loadcase_id(1))

# Using the function db_get_sub_case_id() to get the sub case id.

db_get_sub_case_id(loadcase_id(1), "Static Subcase", subcase_id(1))

#-----------------------------------------------------------------------

# Using the function res_db_cgetrescases() to get the the result


# case ids.

status = res_db_cgetrescases(numload_cases, @
loadcase_id, @
subcase_id, @
rescase_id)

dump status
dump rescase_id

#---------------------------------------------------------------------
# End of File.
#---------------------------------------------------------------------

Main Index
1650
Code Examples

res_utl_create_elem_result ()

# Purpose : This file provides an example of a call to the


# function res_utl_create_elem_result()
#
# This session file creates new result case and
# writes to the database. After that the new result
# case can be displayed in the viewport.
#
# Before running this session file run spool.ses and
# create result file spool.op2 as per the instructions
# given in it. Import this result file spool.op2 into
# 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 res_utl_create_elem_result()
# has the following arguments:
#
# res_utl_create_elem_result( resultids, @
# primary_title, @
# secondary_title, @
# nids, @
# ids, @
# cidlist, @
# datatype, @
# location, @
# nresults, @
# results)
#
#
#---------------------------------------------------------------------
# Variable Decleration

INTEGER resultids(5)
STRING primary_title[80]
STRING secondary_title[80]
INTEGER nids
INTEGER ids(virtual)
STRING cidlist[12]
INTEGER datatype
STRING location[12]
INTEGER nresults(VIRTUAL)
REAL results(VIRTUAL)

STRING elem_list[12]
STRING derivation[12]
INTEGER resloc, cnt
INTEGER min_loc(12), max_loc(12)
INTEGER nrc, lcids(virtual), subids(virtual)
INTEGER nres, primary_id(virtual), secondary_id(virtual)
INTEGER nsub(virtual), nsub1
INTEGER result_ids(4), nlayers, layerids(VIRTUAL)
STRING layerlabels[80](VIRTUAL)
INTEGER i_return_value

#---------------------------------------------------------------------
# Opening the file spool.db

uil_file_open.go( "./spool.db")

Main Index
CHAPTER 15 1651
Results

#---------------------------------------------------------------------
# Clear any previous results from the memory

res_utl_clear_result()

#---------------------------------------------------------------------
# Gets the loadcases associated with the results

res_utl_get_loadcases(nrc, lcids, nsub)


dump nrc, lcids, nsub

#---------------------------------------------------------------------
# Gets the subcases

res_utl_get_subcases(lcids(1), nsub1, subids)


dump lcids(1), nsub1, subids

#---------------------------------------------------------------------
# Gets the result ids

res_utl_get_result_ids ( nrc, lcids, @


subids, nres, @
primary_id, secondary_id)

dump nres, primary_id, secondary_id


dump nrc
dump lcids
dump subids

#---------------------------------------------------------------------
# Gets the layer positions associated with the results

result_ids(1) = lcids(1)
result_ids(2) = subids(1)
result_ids(3) = primary_id(2)
result_ids(4) = secondary_id(2)

res_utl_get_result_layers( result_ids, nlayers, @


layerids, layerlabels)

dump nlayers
dump layerids
dump layerlabels

#---------------------------------------------------------------------
# Extracts result data for 10 elements (Elm 1:10) from the database

resultids(1) = lcids(1)
resultids(2) = subids(1)
resultids(3) = primary_id(2)
resultids(4) = secondary_id(2)
resultids(5) = layerids(1)

elem_list = "Elm 1:10"


derivation = "MAG"
location = "N[odal"
cidlist = ""

res_utl_extract_elem_results ( resultids, @
elem_list, @
derivation, @
location, @
cidlist, @
datatype, @
resloc, @
cnt, @
ids, @
Main Index
1652
Code Examples

nresults, @
results, @
min_loc, @
max_loc )

#---------------------------------------------------------------------
# Dump all extracted results as a output

dump datatype
dump resloc
dump cnt
dump ids
dump nresults
dump results
dump min_loc
dump max_loc

#---------------------------------------------------------------------
# Argument Initialization

resultids(1) = lcids(1)
resultids(2) = subids(1)
resultids(3) = 0
resultids(4) = 0
resultids(5) = layerids(1)

primary_title = "NEW RESULT CASE"


secondary_title = "Displacement"

nids = nres
location = "N[odal"
cidlist = ""

#---------------------------------------------------------------------
# Created new result case in the database as a
# "NEW RESULT CASE" (Primary load case title) and
# "DISPLACEMENT" (Secondary load case title)

i_return_value = res_utl_create_elem_result( resultids, @


primary_title, @
secondary_title, @
nids, @
ids, @
cidlist, @
datatype, @
location, @
nresults, @
results )

#---------------------------------------------------------------------
# Dump the return value of the function and output of the used function.
# The resultids(3) and resultids(4) are created newly.

dump i_return_value
dump resultids

#---------------------------------------------------------------------
# Closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

Main Index
CHAPTER 15 1653
Results

res_utl_extract_elem_history2 ()

# Purpose : This file provides an example of a call to the


# function res_utl_extract_elem_history2()
#
# This session file extracts specified results from the
# database. It gives the result at each element along
# with the type of results, element ids after using the
# averaging method, averaging domain, extrapolation
# method and given complex form as a input. Apart from
# that it also gives an array index for each minimum
# and maximum element result component.
#
# Before running this session file run spool.ses and
# create result file spool.op2 as per the instructions
# given in it. Import this result file spool.op2 into
# 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 res_utl_extract_elem_history2()
# has the following arguments:
#
# res_utl_extract_elem_history2 ( nrc, @
# lcids, @
# subids, @
# resultids, @
# elem_list, @
# derivation, @
# location, @
# cidlist, @
# avg_method, @
# avg_domain, @
# extrap_method, @
# complex_form, @
# complex_angle, @
# datatype, @
# resloc, @
# cnt, @
# ids, @
# nresults, @
# results, @
# min_loc, @
# max_loc )
#
#
#---------------------------------------------------------------------
# Variable Decleration

INTEGER nrc
INTEGER lcids(virtual)
INTEGER subids(virtual)
INTEGER resultids(3)
STRING elem_list[12]
STRING derivation[12]
STRING location[12]
STRING cidlist[12]
STRING avg_method[24]
STRING avg_domain[24]
STRING extrap_method[24]
STRING complex_form[24]
Main Index
1654
Code Examples

REAL complex_angle
INTEGER datatype
INTEGER resloc
INTEGER cnt
INTEGER ids(VIRTUAL)
INTEGER nresults(VIRTUAL)
REAL results(VIRTUAL)
INTEGER min_loc(virtual)
INTEGER max_loc(virtual)

INTEGER nres, primary_id(virtual), secondary_id(virtual)


INTEGER nsub(virtual), nsub1
INTEGER result_ids(4), nlayers, layerids(VIRTUAL)
STRING layerlabels[80](VIRTUAL)
INTEGER i_return_value

#---------------------------------------------------------------------
# Opening the file spool.db

uil_file_open.go( "./spool.db")

#---------------------------------------------------------------------
# Clear any previous results from the memory

i_return_value = res_utl_clear_result()
dump i_return_value

#---------------------------------------------------------------------
# Gets the loadcases associated with the results

i_return_value = res_utl_get_loadcases(nrc, lcids, nsub)


dump i_return_value, nrc, lcids, nsub

#---------------------------------------------------------------------
# Gets the subcases

i_return_value = res_utl_get_subcases(lcids(1), nsub1, subids)


dump i_return_value, lcids(1), nsub1, subids

#---------------------------------------------------------------------
# Gets the result ids

i_return_value = res_utl_get_result_ids(nrc, lcids, @


subids, nres, primary_id, secondary_id)

dump i_return_value, nres, primary_id, secondary_id


dump nrc
dump lcids
dump subids

#---------------------------------------------------------------------
# Gets the layer positions associated with the results

result_ids(1) = lcids(1)
result_ids(2) = subids(1)
result_ids(3) = primary_id(2)
result_ids(4) = secondary_id(2)

dump result_ids

i_return_value = res_utl_get_result_layers(result_ids, nlayers, @


layerids, layerlabels)

dump i_return_value
dump nlayers
dump layerids
dump layerlabels
Main Index
CHAPTER 15 1655
Results

#---------------------------------------------------------------------
# Argument Initialization

resultids(1) = primary_id(2)
resultids(2) = secondary_id(2)
resultids(3) = layerids(1)
elem_list = "Elm 1:10"
derivation = "MAG"
location = "Nodal"
cidlist = ""
avg_method = "Sum"
avg_domain = "All"
extrap_method = "ShapeFunc"
complex_form = "Real"
complex_angle = 0.0

#---------------------------------------------------------------------
# Extracts result data for 10 elements (Elements 1:10) from the database

i_return_value = res_utl_extract_elem_history2 ( nrc, @


lcids, @
subids, @
resultids, @
elem_list, @
derivation, @
location, @
cidlist, @
avg_method, @
avg_domain, @
extrap_method, @
complex_form, @
complex_angle, @
datatype, @
resloc, @
cnt, @
ids, @
nresults, @
results, @
min_loc, @
max_loc )

#---------------------------------------------------------------------

dump i_return_value
dump datatype
dump resloc
dump cnt
dump ids
dump nresults
dump results
dump min_loc
dump max_loc

#---------------------------------------------------------------------
# Closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

Main Index
1656
Code Examples

res_utl_extract_elem_results2 ()

# Purpose : This file provides an example of a call to the


# function res_utl_extract_elem_results2()
#
# This session file extracts specified results from the
# database. It gives the result at each element along
# with the type of results, element ids after using the
# averaging method, averaging domain, extrapolation
# method and given complex form as a input.
#
# Before running this session file run spool.ses and
# create result file spool.op2 as per the instructions
# given in it. Import this result file spool.op2 into
# 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 res_utl_extract_elem_results2()
# has the following arguments:
#
# res_utl_extract_elem_results2 ( resultids, @
# elem_list, @
# derivation, @
# location, @
# cidlist, @
# avg_method, @
# avg_domain, @
# extrap_method, @
# complex_form, @
# complex_angle, @
# datatype, @
# resloc, @
# cnt, @
# ids, @
# nresults, @
# results, @
# min_loc, @
# max_loc)
#
#
#---------------------------------------------------------------------
# Variable Decleration

INTEGER resultids(5)
STRING elem_list[12]
STRING derivation[12]
STRING location[12]
STRING cidlist[12]
STRING avg_method[24]
STRING avg_domain[24]
STRING extrap_method[24]
STRING complex_form[24]
REAL complex_angle
INTEGER datatype
INTEGER resloc
INTEGER cnt
INTEGER ids(VIRTUAL)
INTEGER nresults(VIRTUAL)
REAL results(VIRTUAL)
INTEGER min_loc(12)
Main Index
CHAPTER 15 1657
Results

INTEGER max_loc(12)

INTEGER nrc, lcids(virtual), subids(virtual)


INTEGER nres, primary_id(virtual), secondary_id(virtual)
INTEGER nsub(virtual), nsub1
INTEGER result_ids(4), nlayers, layerids(VIRTUAL)
STRING layerlabels[80](VIRTUAL)
INTEGER i_return_value

#---------------------------------------------------------------------
# Opening the file spool.db

uil_file_open.go( "./spool.db")

#---------------------------------------------------------------------
# Clear any previous results from the memory

res_utl_clear_result()

#---------------------------------------------------------------------
# Gets the loadcases associated with the results

res_utl_get_loadcases(nrc, lcids, nsub)


dump nrc, lcids, nsub

#---------------------------------------------------------------------
# Gets the subcases

res_utl_get_subcases(lcids(1), nsub1, subids)


dump nsub1, subids

#---------------------------------------------------------------------
# Gets the result ids

res_utl_get_result_ids ( nrc, lcids, subids, nres, @


primary_id, secondary_id)

dump nres, primary_id, secondary_id


dump nrc
dump lcids
dump subids

#---------------------------------------------------------------------
# Gets the layer positions associated with the results

result_ids(1) = lcids(1)
result_ids(2) = subids(1)
result_ids(3) = primary_id(2)
result_ids(4) = secondary_id(2)

res_utl_get_result_layers(result_ids, nlayers, layerids, layerlabels)

dump nlayers
dump layerids
dump layerlabels

#---------------------------------------------------------------------
# Argument Initialization

resultids(1) = lcids(1)
resultids(2) = subids(1)
resultids(3) = primary_id(2)
resultids(4) = secondary_id(2)
resultids(5) = layerids(1)

elem_list = "Elm 1:10"


derivation = "MAG"
Main Index
1658
Code Examples

location = "N[odal"
cidlist = ""
avg_method = "Sum"
avg_domain = "All"
extrap_method = "ShapeFunc"
complex_form = "Real"
complex_angle = 0.0

#---------------------------------------------------------------------
# Extracts result data for 10 elements (Elm 1:10) from the database

i_return_value = res_utl_extract_elem_results2 ( resultids, @


elem_list, @
derivation, @
location, @
cidlist, @
avg_method, @
avg_domain, @
extrap_method, @
complex_form, @
complex_angle, @
datatype, @
resloc, @
cnt, @
ids, @
nresults, @
results, @
min_loc, @
max_loc )

#---------------------------------------------------------------------

dump i_return_value
dump datatype
dump resloc
dump cnt
dump ids
dump nresults
dump results
dump min_loc
dump max_loc

#---------------------------------------------------------------------
# Closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

res_utl_extract_nodal_history2 ()

# Purpose : This file provides an example of a call to the


# function res_utl_extract_nodal_history2()
#
# This session file extracts specified results from the
# database. It gives the result at each node along
# with the type of results, nodal ids after using the
# averaging method, averaging domain, extrapolation
# method and given complex form as a input. Apart from
# that it also gives an array index for each minimum
# and maximum nodal result component.
#
# Before running this session file run spool.ses and
# create result file spool.op2 as per the instructions
Main Index
CHAPTER 15 1659
Results

# given in it. Import this result file spool.op2 into


# 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 res_utl_extract_nodal_history2()
# has the following arguments:
#
# res_utl_extract_nodal_history2 ( nrc, @
# lcids, @
# subids, @
# resultids, @
# node_list, @
# derivation, @
# cidlist, @
# avg_method, @
# avg_domain, @
# extrap_method, @
# complex_form, @
# complex_angle, @
# datatype, @
# cnt, @
# ids, @
# results, @
# min_loc, @
# max_loc)
#
#---------------------------------------------------------------------
# Variable Decleration

INTEGER nrc
INTEGER lcids(virtual)
INTEGER subids(virtual)
INTEGER resultids(5)
STRING node_list[12]
STRING derivation[12]
STRING cidlist[12]
STRING avg_method[24]
STRING avg_domain[24]
STRING extrap_method[24]
STRING complex_form[24]
REAL complex_angle
INTEGER datatype
INTEGER cnt
INTEGER ids(VIRTUAL)
REAL results(VIRTUAL)
INTEGER max_loc(virtual)
INTEGER min_loc(virtual)

INTEGER nres, primary_id(virtual), secondary_id(virtual)


INTEGER nsub(virtual), nsub1
INTEGER result_ids(4), nlayers, layerids(VIRTUAL)
STRING layerlabels[80](VIRTUAL)
INTEGER i_return_value

#---------------------------------------------------------------------
# Opening the file spool.db

uil_file_open.go( "./spool.db")

#---------------------------------------------------------------------
# Clear any previous results from the memory
Main Index
1660
Code Examples

res_utl_clear_result()

#---------------------------------------------------------------------
# Gets the loadcases associated with the results

res_utl_get_loadcases(nrc, lcids, nsub)


dump nrc, lcids, nsub

#---------------------------------------------------------------------
# Gets the subcases

res_utl_get_subcases(lcids(1), nsub1, subids)


dump nsub1, subids

#---------------------------------------------------------------------
# Gets the result ids

res_utl_get_result_ids ( nrc, lcids, subids, nres, @


primary_id, secondary_id)

dump nres, primary_id, secondary_id


dump nrc
dump lcids
dump subids

#---------------------------------------------------------------------
# Gets the layer positions associated with the results

result_ids(1) = lcids(1)
result_ids(2) = subids(1)
result_ids(3) = primary_id(2)
result_ids(4) = secondary_id(2)

res_utl_get_result_layers(result_ids, nlayers, layerids, layerlabels)

dump nlayers
dump layerids
dump layerlabels

#---------------------------------------------------------------------
# Argument Initialization

resultids(1) = primary_id(2)
resultids(2) = secondary_id(2)
resultids(3) = layerids(1)
node_list = "NODE 1:20"
derivation = "MAG"
cidlist = ""
avg_method = "Sum"
avg_domain = "All"
extrap_method = "ShapeFunc"
complex_form = "Real"
complex_angle = 0.0

#---------------------------------------------------------------------
# Extracts result data for 20 nodes (Nodes 1:20) from the database

i_return_value = res_utl_extract_nodal_history2( nrc, @


lcids, @
subids, @
resultids, @
node_list, @
derivation, @
cidlist, @
avg_method, @
avg_domain, @
extrap_method, @
Main Index
CHAPTER 15 1661
Results

complex_form, @
complex_angle, @
datatype, @
cnt, @
ids, @
results, @
min_loc, @
max_loc )

#---------------------------------------------------------------------

dump i_return_value
dump datatype
dump cnt
dump ids
dump results
dump min_loc
dump max_loc

#---------------------------------------------------------------------
# Closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

res_utl_extract_nodal_results2 ()

# Purpose : This file provides an example of a call to the


# function res_utl_extract_nodal_results2()
#
# This session file extracts specified results from the
# database. It gives the result at each node along
# with the type of results, nodalent ids after using the
# averaging method, averaging domain, extrapolation
# method and given complex form as a input.
#
# Before running this session file run spool.ses and
# create result file spool.op2 as per the instructions
# given in it. Import this result file spool.op2 into
# 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 res_utl_extract_nodal_results2()
# has the following arguments:
#
# res_utl_extract_nodal_results2 ( resultids, @
# nodal_list, @
# derivation, @
# cidlist, @
# avg_method, @
# avg_domain, @
# extrap_method, @
# complex_form, @
# complex_angle, @
# datatype, @
# cnt, @
# ids, @
# nresults, @
Main Index
1662
Code Examples

# results, @
# min_loc, @
# max_loc)
#
#
#---------------------------------------------------------------------
# Variable Decleration

INTEGER resultids(5)
STRING node_list[12]
STRING derivation[12]
STRING cidlist[12]
STRING avg_method[24]
STRING avg_domain[24]
STRING extrap_method[24]
STRING complex_form[24]
REAL complex_angle
INTEGER datatype
INTEGER cnt
INTEGER ids(VIRTUAL)
REAL results(VIRTUAL)
INTEGER min_loc(6)
INTEGER max_loc(6)

INTEGER nrc, lcids(virtual), subids(virtual)


INTEGER nres, primary_id(virtual), secondary_id(virtual)
INTEGER nsub(virtual), nsub1
INTEGER result_ids(4), nlayers, layerids(VIRTUAL)
STRING layerlabels[80](VIRTUAL)
INTEGER i_return_value

#---------------------------------------------------------------------
# Opening the file spool.db

uil_file_open.go( "./spool.db")

#---------------------------------------------------------------------
# Clear any previous results from the memory

res_utl_clear_result()

#---------------------------------------------------------------------
# Gets the loadcases associated with the results

res_utl_get_loadcases(nrc, lcids, nsub)


dump nrc, lcids, nsub

#---------------------------------------------------------------------
# Gets the subcases

res_utl_get_subcases(lcids(1), nsub1, subids)


dump nsub1, subids

#---------------------------------------------------------------------
# Gets the result ids

res_utl_get_result_ids(nrc, lcids, @
subids, nres, primary_id, secondary_id)

dump nres, primary_id, secondary_id


dump nrc
dump lcids
dump subids

#---------------------------------------------------------------------
# Gets the layer positions associated with the results
Main Index
CHAPTER 15 1663
Results

result_ids(1) = lcids(1)
result_ids(2) = subids(1)
result_ids(3) = primary_id(2)
result_ids(4) = secondary_id(2)

res_utl_get_result_layers(result_ids, nlayers, layerids, layerlabels)

dump nlayers
dump layerids
dump layerlabels

#---------------------------------------------------------------------
# Argument Initialization

resultids(1) = lcids(1)
resultids(2) = subids(1)
resultids(3) = primary_id(2)
resultids(4) = secondary_id(2)
resultids(5) = layerids(1)
node_list = "Node 1:10"
derivation = "MAG"
cidlist = ""
avg_method = "Sum"
avg_domain = "All"
extrap_method = "ShapeFunc"
complex_form = "Real"
complex_angle = 0.0

#---------------------------------------------------------------------
# Extracts result data for 10 nodes (Node 1:10) from the database

i_return_value = res_utl_extract_nodal_results2 ( resultids, @


node_list, @
derivation, @
cidlist, @
avg_method, @
avg_domain, @
extrap_method, @
complex_form, @
complex_angle, @
datatype, @
cnt, @
ids, @
results, @
min_loc, @
max_loc )

#---------------------------------------------------------------------

dump i_return_value
dump datatype
dump cnt
dump ids
dump results
dump min_loc
dump max_loc

#---------------------------------------------------------------------
# Closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

Main Index
1664
Code Examples

res_utl_transform_nodal_results ()

# Purpose : This file provides an example of a call to the


# function res_utl_transform_nodal_results()
#
# This session file transforms the specified nodal
# results for specified coordinate system.
#
# Before running this session file run spool.ses and
# create result file spool.op2 as per the instructions
# given in it. Import this result file spool.op2 into
# 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 res_utl_transform_nodal_results()
# has the following arguments:
#
# res_utl_transform_nodal_results ( node_count, @
# ids, @
# cid, @
# ncomp, @
# results)
#
#---------------------------------------------------------------------
# Variable Decleration

INTEGER node_count
INTEGER ids(VIRTUAL)
INTEGER cid
INTEGER ncomp
REAL results(VIRTUAL)
INTEGER i_return_value

INTEGER asm_create_cord_axi_created_ids
INTEGER resultids(5)
INTEGER datatype
INTEGER min_loc(6)
INTEGER max_loc(6)
INTEGER nrc, lcids(virtual), subids(virtual)
INTEGER nres, primary_id(virtual), secondary_id(virtual)
INTEGER nsub(virtual), nsub1
INTEGER result_ids(4), nlayers, layerids(VIRTUAL)
STRING layerlabels[80](VIRTUAL)

#---------------------------------------------------------------------
# Opening the file spool.db

uil_file_open.go( "./spool.db")

#---------------------------------------------------------------------
# Clear any previous results from the memory

res_utl_clear_result()

#---------------------------------------------------------------------
# Gets the loadcases associated with the results

res_utl_get_loadcases(nrc, lcids, nsub)


dump nrc, lcids, nsub

Main Index
CHAPTER 15 1665
Results

#---------------------------------------------------------------------
# Gets the subcases

res_utl_get_subcases(lcids(1), nsub1, subids)


dump nsub1, subids

#---------------------------------------------------------------------
# Gets the result ids

res_utl_get_result_ids(nrc, lcids, @
subids, nres, primary_id, secondary_id)

dump nres, primary_id, secondary_id


dump nrc
dump lcids
dump subids

#---------------------------------------------------------------------
# Gets the layer positions associated with the results

result_ids(1) = lcids(1)
result_ids(2) = subids(1)
result_ids(3) = primary_id(2)
result_ids(4) = secondary_id(2)

res_utl_get_result_layers(result_ids, nlayers, layerids, layerlabels)

dump nlayers
dump layerids
dump layerlabels

#---------------------------------------------------------------------
# Extracts result data for the 50 nodes from the database.

resultids(1) = lcids(1)
resultids(2) = subids(1)
resultids(3) = primary_id(2)
resultids(4) = secondary_id(2)
resultids(5) = layerids(1)

res_utl_extract_nodal_results ( resultids, @
"Node 51:100", @
"MAG", @
"", @
datatype, @
node_count, @
ids, @
results, @
min_loc, @
max_loc )

dump datatype
dump node_count
dump ids
dump results
dump min_loc
dump max_loc

#---------------------------------------------------------------------
# Create a new cordinate system.

i_return_value = asm_const_coord_axis("2", "XY", "Coord 0",1, @


"[0 0 5]", "[1 0 0]", "[0 1 0]", @
asm_create_cord_axi_created_ids)
dump i_return_value

#---------------------------------------------------------------------
Main Index
1666
Code Examples

# Argument Initialization

cid = 2
ncomp = 1

#---------------------------------------------------------------------
# Transform the specified nodal results for specified cid.

i_return_value = res_utl_transform_nodal_results ( node_count, @


ids, @
cid, @
ncomp, @
results)
dump i_return_value
dump results

#---------------------------------------------------------------------
# Closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

vki_db_getresid ()

# Purpose : This function will retrive the result type


# id from the data base. This function requires
# result case id,primary result id and secondary
# result id as input arguments.
#
# Before running this session file run spool.ses
# and import result file spool.op2 to create
# spool.db with results. For instruction see
# file spool.ses.
#
# 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 vki_db_getresids()
# has the following arguments:
#
# vki_db_getresid
# ( INPUT:
# INTEGER rescase_id
# INTEGER prires_id
# INTEGER secres_id
# OUTPUT:
# INTEGER rt_id
# )
#---------------------------------------------------------------------
#
# Opening a spool.db database

uil_file_open.go("spool.db")

#---------------------------------------------------------------------

# Declaring input arguents

INTEGER rescase_id(1)
INTEGER prires_id
Main Index
CHAPTER 15 1667
Results

INTEGER secres_id

# Declaring output argument

INTEGER rt_id

#----------------------------------------------------------------------

# Using the function db_get_load_case_id() to get the load case id.

INTEGER loadcase_id(1)
db_get_load_case_id("spool_loads", @
loadcase_id(1))

# Using the function db_get_sub_case_id() to get the sub case id.

INTEGER subcase_id(1)
db_get_sub_case_id(loadcase_id(1), @
"Static Subcase", @
subcase_id(1))

# Using the function res_db_cgetrescases() to get the the result


# case ids.

INTEGER numload_cases = 1
res_db_cgetrescases(numload_cases, @
loadcase_id, @
subcase_id, @
rescase_id)

# Using the function db_get_primary_res_id to get the primary result id

STRING pri_res_label[32] = "Displacements"


db_get_primary_res_id(pri_res_label, @
prires_id)

# Using the function db_get_secondary_res_id to get the secondary result id

STRING sec_res_label[32] = "Translational"


db_get_secondary_res_id(prires_id, @
sec_res_label, @
secres_id)

#---------------------------------------------------------------------

# Using the function vki_db_getresid to retrive result type id


# from the data base.

rt_id = vki_db_getresid(rescase_id(1), @
prires_id, @
secres_id)

dump rt_id

#---------------------------------------------------------------------

# End of File.

#---------------------------------------------------------------------

Main Index
1668
Code Examples

xy_curve_results_set_wnd ()

# Purpose : This function opens a window and


# draws a graph with given no. of points
# and the array for coordinates of the points
# It returns an integer with 0 as success
# condition or the error code in case of
# failure.
#
#
# 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 xy_curve_result_set_wnd()
# has the following arguments:
#
# xy_curve_result_set_wnd
# ( windowname,
# num_points,
# curve_name,
# x,
# y)
#---------------------------------------------------------------------
# Variable Declarations

STRING windowname[64]
INTEGER num_points
INTEGER int_status
STRING curve_name[64]
REAL x(VIRTUAL), y(VIRTUAL)

#----------------------------------------------------------------------
# Open a new database
if(!db_is_open())THEN
uil_file_new.go("","new.db")
$? YES 36000002
endif
#----------------------------------------------------------------------
# Setting the preference to MSC.Nastran.

uil_pref_analysis.set_analysis_pref( "MSC.Nastran", @
"Structural", @
"", @
".op2" )
#----------------------------------------------------------------------
# Declare the windows and the variables.

windowname = "win1"
num_points = 5
curve_name = "CURVE 1"
#----------------------------------------------------------------------
# Define the size of the array for x and y values.

sys_allocate_array(x,1,num_points)
sys_allocate_array(y,1,num_points)

x = [5.0, 2.0, 1.0, 5.1, 2.1]


y = [5.0, -.01, 0.90, 7.3, 5]

#----------------------------------------------------------------------
# Open the window with the function.

Main Index
CHAPTER 15 1669
Results

int_status = xy_curve_results_set_wnd( @
windowname, @
num_points, @
curve_name, @
x, @
y )
dump int_status
#----------------------------------------------------------------------
# Closing the file new.db

# uil_file_close.goquit()

# End of file
#----------------------------------------------------------------------

Main Index
1670
Code Examples

Main Index
MSC.Acumen, Volume 2: Code Examples

CHAPTER
Preferences
16
■ Introduction

Main Index
1672
Code Examples

16.1 Introduction
This chapter provides code examples for the PCL function described in Volume 1. These
examples are designed so that they can be cut and pasted into a file and, by following the
instructions listed with each example, executed in MSC.Patran.

db_add_pref ()

# Purpose : This file provides an example of a call to the


# function db_add_pref()
#
# This function adds the preferences from the
# database.This file opens a new database
# "new.db" and gets the value preferences for
# the preference ANALYSISTYPE. Later it adds
# the ANALYSISTYPE preference to the database
# with the value of integer preference = 1234.
# Finally it gets the value of preferences.
#
# 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_add_pref() has the following arguments:
#
# db_add_pref
# ( id,
# data_type,
# int_pref,
# log_pref,
# real_pref,
# name )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_id
INTEGER i_data_type
INTEGER i_int_pref
LOGICAL l_log_pref
REAL r_real_pref
STRING s_name[32]
STRING s_error_msg[64]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002

# i_id = 102 (ANALYSISTYPE from pref_names.i)


i_id = 102
# i_data_type = 1 (Integer preference)
i_data_type = 1
#---------------------------------------------------------------------
# Get the value of preference ANALYSISTYPE
i_return_value = @
db_get_pref @
( i_id, @
i_data_type, @
i_int_pref, @
l_log_pref, @
r_real_pref, @
Main Index s_name )
CHAPTER 16 1673
Preferences

# The preference ANALYSISTYPE is not added in the database.


# Hence an error occurs stating that preference not found.
dump i_return_value
#---------------------------------------------------------------------
msg_get_string( i_return_value, s_error_msg )
dump s_error_msg
#---------------------------------------------------------------------
# The value of preference for ANALYSISTYPE
dump s_name
dump i_int_pref
dump l_log_pref
dump r_real_pref
#---------------------------------------------------------------------
# Add the value 1234 to the Integer preference of ANALYSISTYPE
# i_data_type = 1 (Integer preference)
i_data_type = 1
i_int_pref = 1234
i_return_value = @
db_add_pref @
( i_id, @
i_data_type, @
i_int_pref, @
l_log_pref, @
r_real_pref, @
s_name )
dump i_return_value
#---------------------------------------------------------------------
# Get the value of preference ANALYSISTYPE
i_return_value = @
db_get_pref @
( i_id, @
i_data_type, @
i_int_pref, @
l_log_pref, @
r_real_pref, @
s_name )

# Check for the return value(Should return zero as the


# Preference is added to the database )
dump i_return_value
#---------------------------------------------------------------------
# The value of preferences for ANALYSISTYPE
dump s_name
dump i_int_pref
dump l_log_pref
dump r_real_pref
#---------------------------------------------------------------------
# End of File.

db_get_pref

# Purpose : This file provides an example of a call to the


# function db_get_pref()
#
# This function gets the preferences from the
# database.This file opens a new database
# “new.db” and creates a solid and gets the value
# of values of preferences for the preference
# RENDERSTYLE. Later it sets the value of
# character preference to SHADED and gets their
# preference.The change of this setting can be
# viewed on viewport.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
Main Index
1674
Code Examples

# through the “File”,”Session”,”Play” pulldown


# menus on the menu bar.
#
# The function db_get_pref() has the following arguments:
#
# db_get_pref
# ( pref_id,
# data_type,
# int_pref,
# log_pref,
# real_pref,
# char_pref )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_pref_id
INTEGER i_data_type
INTEGER i_int_pref
LOGICAL l_log_pref
REAL r_real_pref
STRING s_char_pref[32]
STRING sv_asm_created_hpat_xyz[VIRTUAL]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# Create a solid
asm_const_hpat_xyz(“1”,”<1 1 1>”,”[0 0 0]”,”Coord 0”, @
sv_asm_created_hpat_xyz)
ga_view_aa_set(23.,56.,0.)

# i_pref_id = 402 (RENDERSTYLE from pref_names.i)


i_pref_id = 402
# i_data_type = 1 (Integer preference)
i_data_type = 1

i_return_value = @
db_get_pref @
( i_pref_id, @
i_data_type, @
i_int_pref, @
l_log_pref, @
r_real_pref, @
s_char_pref )
dump i_return_value

# The value of integer preference for RENDERSTYLE


dump i_int_pref
# The value of logical preference for RENDERSTYLE
dump l_log_pref
# The value of real preference for RENDERSTYLE
dump r_real_pref
# The value of character preference for RENDERSTYLE
dump s_char_pref

# Set the value of the character preference to SHADED


# Session file paused. Press “Resume” to continue..
sf_pause()
# i_data_type = 4 (Character preference)
i_data_type = 4
i_return_value = @
db_set_pref @
( i_pref_id, @
i_data_type, @
i_int_pref, @
Main Index
CHAPTER 16 1675
Preferences

l_log_pref, @
r_real_pref, @
“SHADED” )
dump i_return_value

i_return_value = @
db_get_pref @
( i_pref_id, @
i_data_type, @
i_int_pref, @
l_log_pref, @
r_real_pref, @
s_char_pref )
dump i_return_value

# The value of integer preference for RENDERSTYLE


dump i_int_pref
# The value of logical preference for RENDERSTYLE
dump l_log_pref
# The value of real preference for RENDERSTYLE
dump r_real_pref
# The value of character preference for RENDERSTYLE
dump s_char_pref

SYS_FREE_STRING(sv_asm_created_hpat_xyz)
#---------------------------------------------------------------------

pref_anal_get ()

# Purpose : This file provides an example of a call to the


# function pref_anal_get()
#
# This function gets the analysis preferences
# parameters. This file open a new database
# “new.db” and gets the analysis preference
# parameters.
#
# 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 pref_anal_get() has the following arguments:
#
# pref_anal_get
# ( anal_code,
# anal_type,
# mod_suf,
# res_suf )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_anal_code[32]
STRING s_anal_type[32]
STRING s_mod_suf[32]
STRING s_res_suf[32]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

i_return_value = @
pref_anal_get @
( s_anal_code, @
Main Index
1676
Code Examples

s_anal_type, @
s_mod_suf, @
s_res_suf )
dump i_return_value

# The analysis code name is


dump s_anal_code
# The analysis type name is
dump s_anal_type
# The model file suffix name is
dump s_mod_suf
# The results file suffix name is
dump s_res_suf
#---------------------------------------------------------------------

pref_anal_set ()

# Purpose : This file provides an example of a call to the


# function pref_anal_set()
#
# This function sets the analysis preferences
# parameters.This file open a new database
# “new.db” and gets the analysis preference
# parameters.Later it changes the preference
# parameters and gets the modified preference
# parameters.
#
# 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 pref_anal_set() has the following arguments:
#
# pref_anal_set
# ( anal_code,
# anal_type,
# mod_suf,
# res_suf )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_anal_code[32]
STRING s_anal_type[32]
STRING s_mod_suf[32]
STRING s_res_suf[32]
STRING s_anal_code_c[32]
STRING s_anal_type_c[32]
STRING s_mod_suf_c[32]
STRING s_res_suf_c[32]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# Get the Analysis preferences


i_return_value = @
pref_anal_get @
( s_anal_code_c, @
s_anal_type_c, @
s_mod_suf_c, @
s_res_suf_c )
dump i_return_value
Main Index
CHAPTER 16 1677
Preferences

# The analysis code name is


dump s_anal_code_c
# The analysis type name is
dump s_anal_type_c
# The model file suffix name is
dump s_mod_suf_c
# The results file suffix name is
dump s_res_suf_c

# Set the analysis preferences


s_anal_code = “MSC.Nastran”
s_anal_type = “Thermal”
s_mod_suf = “.in”
s_res_suf = “.out”
i_return_value = @
pref_anal_set @
( s_anal_code, @
s_anal_type, @
s_mod_suf, @
s_res_suf )
dump i_return_value

# Get the Analysis preferences


i_return_value = @
pref_anal_get @
( s_anal_code_c, @
s_anal_type_c, @
s_mod_suf_c, @
s_res_suf_c )
dump i_return_value

# The analysis code name is


dump s_anal_code_c
# The analysis type name is
dump s_anal_type_c
# The model file suffix name is
dump s_mod_suf_c
# The results file suffix name is
dump s_res_suf_c
#---------------------------------------------------------------------

pref_confirm_get ()

# Purpose : This file provides an example of a call to the


# function pref_confirm_get()
#
# This function gets the global preference
# confirm status.This file opens a new database
# “new.db” and gets the confirm flag for global
# preferences.
#
# 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 pref_confirm_get() has the following arguments:
#
# pref_confirm_get
# ( confirm )
#
#---------------------------------------------------------------------
# Variable Declarations
LOGICAL l_confirm
INTEGER i_return_value
Main Index
1678
Code Examples

#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

i_return_value = @
pref_confirm_get @
( l_confirm )
dump i_return_value

# The Global preference confirm flag status is


dump l_confirm
#---------------------------------------------------------------------

pref_display_method_get ()

# Purpose : This file provides an example of a call to the


# function pref_display_method_get()
#
# This function gets the graphic display method
# preference type.This file opens a new database
# “new.db” and gets the graphic display method
# preference type.Later it changes the display
# method and gets the preference type.
#
# 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 pref_display_method_get()
# has the following arguments:
#
# pref_display_method_get
# ( disp_meth )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_disp_meth
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

i_return_value = @
pref_display_method_get @
( i_disp_meth )
dump i_return_value

# The Graphical display method type is


# (1 for entity type and 2 for group type)
dump i_disp_meth

# Change the display method


# The preference id for display method is 501.
i_return_value = @
db_set_pref @
( 501, @
1, @
2, @
FALSE, @
0.0, @
“ “ )
dump i_return_value
Main Index
CHAPTER 16 1679
Preferences

i_return_value = @
pref_display_method_get @
( i_disp_meth )
dump i_return_value

# The Graphical display method type is


# (1 for entity type and 2 for group type)
dump i_disp_meth
#---------------------------------------------------------------------

pref_entity_dp_get ()

# Purpose : This file provides an example of a call to the


# function pref_entity_dp_get()
#
# This function gets the entity display property
# preference.This file opens a new database
# “new.db” and gets the display property
# preference.Later it changes the display
# property preference and gets the preference.
# There are two entity display property
# preferences namely “general” and “simple”.
#
# 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 pref_entity_dp_get()
# has the following arguments:
#
# pref_entity_dp_get
# ( ed_prop )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_ed_prop[32]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

i_return_value = @
pref_entity_dp_get @
( s_ed_prop )
dump i_return_value

# The entity display property preference is


dump s_ed_prop

# Session file paused. Press “Resume” to continue.


sf_pause()

# Change the entity display property preference


i_return_value = pref_entity_dp_set( “simple” )
dump i_return_value

i_return_value = @
pref_entity_dp_get @
( s_ed_prop )
dump i_return_value

# The entity display property preference is


Main Index
1680
Code Examples

dump s_ed_prop
#---------------------------------------------------------------------

pref_entity_dp_set ()

# Purpose : This file provides an example of a call to the


# function pref_entity_dp_set()
#
# This function sets the entity display property
# preference.This file opens a new database
# “new.db” and gets the display property
# preference.Later it sets the display property
# preference and gets the preference.There are
# two entity display property preferences
# namely “general” and “simple”.
#
# 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 pref_entity_dp_set()
# has the following arguments:
#
# pref_entity_dp_set
# ( ed_prop )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_ed_prop[32]
STRING s_ed_prop_c[32]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

i_return_value = @
pref_entity_dp_get @
( s_ed_prop_c )
dump i_return_value

# The entity display property preference is


dump s_ed_prop_c

# Session file paused. Press “Resume” to continue..


sf_pause()

# Change the entity display property preference


s_ed_prop = “simple”
i_return_value = @
pref_entity_dp_set @
( s_ed_prop )
dump i_return_value

i_return_value = @
pref_entity_dp_get @
( s_ed_prop_c )
dump i_return_value

# The entity display property preference is


dump s_ed_prop_c
#---------------------------------------------------------------------

Main Index
CHAPTER 16 1681
Preferences

pref_entity_set ()

# Purpose : This file provides an example of a call to the


# function pref_entity_set()
#
# This function sets the graphics entity type
# preference parameters.This file opens a new
# database “new.db” and creates a solid.It
# later sets the render style to shaded with
# shade color GREEN. All other colors are set to
# BLUE and flags are set to TRUE.The change of
# the colors and flag can be noticed in the
# Entity Color/Label/Render form.
#
# 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 pref_entity_set() has the following arguments:
#
# pref_entity_set
# ( set_flag,
# ed_prop,
# r_style,
# precision,
# fa_vectors,
# dv_results,
# d_defo,
# shcolor,
# gcolor,
# lcolor,
# hpcolor,
# tscolor,
# bdcolor,
# ncolor,
# pecolor,
# bcolor,
# trcolor,
# qcolor,
# tecolor,
# wcolor,
# hecolor,
# mcolor,
# l_label,
# p_label,
# hp_label,
# ts_label,
# bd_label,
# n_label,
# pe_label,
# b_label,
# tr_label,
# q_label,
# te_label,
# w_label,
# he_label,
# m_label )
#
#---------------------------------------------------------------------
# Variable Declarations
LOGICAL la_set_flag(37)
STRING s_ed_prop[32] = “general”
STRING s_r_style[32] = “SHADED”
INTEGER i_precision = 0
Main Index
1682
Code Examples

LOGICAL l_fa_vectors = TRUE


LOGICAL l_dv_results = TRUE
LOGICAL l_d_defo = TRUE
INTEGER i_shcolor = 2
INTEGER i_gcolor = 4
INTEGER i_lcolor = 4
INTEGER i_pcolor = 4
INTEGER i_hpcolor = 4
INTEGER i_tscolor = 4
INTEGER i_bdcolor = 4
INTEGER i_ncolor = 4
INTEGER i_pecolor = 4
INTEGER i_bcolor = 4
INTEGER i_trcolor = 4
INTEGER i_qcolor = 4
INTEGER i_tecolor = 4
INTEGER i_wcolor = 4
INTEGER i_hecolor = 4
INTEGER i_mcolor = 4
LOGICAL l_g_label = TRUE
LOGICAL l_l_label = TRUE
LOGICAL l_p_label = TRUE
LOGICAL l_hp_label = TRUE
LOGICAL l_ts_label = TRUE
LOGICAL l_bd_label = TRUE
LOGICAL l_n_label = TRUE
LOGICAL l_pe_label = TRUE
LOGICAL l_b_label = TRUE
LOGICAL l_tr_label = TRUE
LOGICAL l_q_label = TRUE
LOGICAL l_te_label = TRUE
LOGICAL l_w_label = TRUE
LOGICAL l_he_label = TRUE
LOGICAL l_m_label = TRUE
INTEGER i_return_value
STRING sv_asm_created_hpat_xyz[VIRTUAL]
INTEGER i_count
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# Create a solid
asm_const_hpat_xyz(“1”,”<1 1 1>”,”[0 0 0]”, @
“Coord 0”, sv_asm_created_hpat_xyz)
ga_view_aa_set(23.,56.,0.)
uil_toolbar.labels_on()

# Note the colors and the flags in the pulldown menu


# “DISPLAY” “/Entity/Color/Label/Render”

# Session file paused. Press “Resume” to continue..


sf_pause()

FOR( i_count = 1 TO 37 )
la_set_flag(i_count) = TRUE
END FOR

i_return_value = @
pref_entity_set @
( la_set_flag, @
s_ed_prop, @
s_r_style, @
i_precision, @
l_fa_vectors, @
l_dv_results, @
l_d_defo, @
Main Index
CHAPTER 16 1683
Preferences

i_shcolor, @
i_gcolor, @
i_lcolor, @
i_pcolor, @
i_hpcolor, @
i_tscolor, @
i_bdcolor, @
i_ncolor, @
i_pecolor, @
i_bcolor, @
i_trcolor, @
i_qcolor, @
i_tecolor, @
i_wcolor, @
i_hecolor, @
i_mcolor, @
l_g_label, @
l_l_label, @
l_p_label, @
l_hp_label, @
l_ts_label, @
l_bd_label, @
l_n_label, @
l_pe_label, @
l_b_label, @
l_tr_label, @
l_q_label, @
l_te_label, @
l_w_label, @
l_he_label, @
l_m_label )
dump i_return_value

# Note the colors and the flags in the pulldown menu


# “DISPLAY” “Entity/Color/Label/Render”
# The shade color is green and render style is shaded.
# All other colors are blue and label are True.

SYS_FREE_STRING(sv_asm_created_hpat_xyz)
#---------------------------------------------------------------------

pref_env_get_integer ()

# Purpose : This file provides an example of a call to the


# function pref_env_get_integer()
#
# This function retrieves the value of the
# integer preference.This file sets the value
# of the integer preference for the preference
# MESSAGE_WARNING and later gets it.
#
# 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 pref_env_get_integer()
# has the following arguments:
#
# pref_env_get_integer
# ( prefname,
# value )
#
#---------------------------------------------------------------------
# Variable Declarations
Main Index
1684
Code Examples

STRING s_prefname[32]
INTEGER i_value
INTEGER i_value_c
INTEGER i_return_value
#---------------------------------------------------------------------
# Set the integer preference for MESSAGE_WARNING to 3.
s_prefname = “message_warning”
i_value_c = 3
i_return_value = @
pref_env_set_integer @
( s_prefname, @
i_value_c )
dump i_return_value

# Get the integer preference.


i_return_value = @
pref_env_get_integer @
( s_prefname, @
i_value )
dump i_return_value

# The value of integer preference is


dump i_value
#---------------------------------------------------------------------

pref_env_get_logical ()

# Purpose : This file provides an example of a call to the


# function pref_env_get_logical()
#
# This function retrieves the value of the
# logical preference.This file sets the value
# of the logical preference for the preference
# DISPLAY_TEMPLATE_PREFERENCE and later gets it.
#
# 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 pref_env_get_logical()
# has the following arguments:
#
# pref_env_get_logical
# ( prefname,
# value )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_prefname[32]
LOGICAL l_value
LOGICAL l_value_c
INTEGER i_return_value
#---------------------------------------------------------------------
# Set the logical preference for DISPLAY_TEMPLATE_PREFERENCE to TRUE.
s_prefname = “display_template_preference”
l_value_c = TRUE
i_return_value = @
pref_env_set_logical @
( s_prefname, @
l_value_c )
dump i_return_value

# Get the logical preference.


i_return_value = @
Main Index
CHAPTER 16 1685
Preferences

pref_env_get_logical @
( s_prefname, @
l_value )
dump i_return_value

# The value of logical preference is


dump l_value
#---------------------------------------------------------------------

pref_env_get_real ()

# Purpose : This file provides an example of a call to the


# function pref_env_get_real()
#
# This function retrieves the value of the
# real preference.This file sets the value
# of the real preference for the preference
# TOOLBARHEIGHT and later gets it.
#
# 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 pref_env_get_real()
# has the following arguments:
#
# pref_env_get_real
# ( prefname,
# value )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_prefname[32]
REAL r_value
REAL r_value_c
INTEGER i_return_value
#---------------------------------------------------------------------
# Set the real preference for TOOLBARHEIGHT to 0.799705.
s_prefname = “ToolbarHeight”
r_value_c = 0.799705
i_return_value = @
pref_env_set_real @
( s_prefname, @
r_value_c )
dump i_return_value

# Get the real preference.


i_return_value = @
pref_env_get_real @
( s_prefname, @
r_value )
dump i_return_value

# The value of real preference is


dump r_value
#---------------------------------------------------------------------

Main Index
1686
Code Examples

pref_env_get_string ()

# Purpose : This file provides an example of a call to the


# function pref_env_get_string()
#
# This function retrieves the value of the
# string preference.This file sets the value
# of the string preference for the preference
# graphics_refresh and later gets it.
#
# 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 pref_env_get_string()
# has the following arguments:
#
# pref_env_get_string
# ( prefname,
# value )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_prefname[32]
STRING s_value[32]
STRING s_value_c[32]
INTEGER i_return_value
#---------------------------------------------------------------------
# Set the string preference for “graphics_refresh” to “NO”
s_prefname = “graphics_refresh”
s_value_c = “NO”
i_return_value = @
pref_env_set_string @
( s_prefname, @
s_value_c )
dump i_return_value

# Get the string preference.


i_return_value = @
pref_env_get_string @
( s_prefname, @
s_value )
dump i_return_value

# The value of string preference is


dump s_value
#---------------------------------------------------------------------

pref_fa_get ()

# Purpose : This file provides an example of a call to the


# function pref_fa_get()
#
# This function returns the load-boundary colors,
# load-boundary flags, element_property colors,
# element property flags and the display fem flag.
# The function returns 0 if executed with success,
# else returns 1.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the "File","Session","Play" pulldown
Main Index
CHAPTER 16 1687
Preferences

# menus on the menu bar.


#
# The function pref_fa_get()
# has the following arguments:
#
# pref_fa_get
# ( ia_lbc_colors,
# la_lbc_display,
# ia_ep_colors,
# la_ep_display
# l_display_fem )
#
#---------------------------------------------------------------------
# Variable Declarations

INTEGER ia_lbc_color(40)
LOGICAL la_lbc_display(40)
INTEGER ia_ep_color(10)
LOGICAL la_ep_display(10)
LOGICAL l_display_fem
INTEGER i_status
#----------------------------------------------------------------------
# Open a new database
if(!db_is_open())THEN
uil_file_new.go("","new.db")
$? YES 36000002
endif
#----------------------------------------------------------------------
# Setting the preference to MSC.Nastran.

uil_pref_analysis.set_analysis_pref( "MSC.Nastran", @
"Structural", @
"", @
".op2" )
#---------------------------------------------------------------------
# Using the function pref_fa_get to get lbc colors & flags,
# ep colors & flag and fem display flag

i_status = pref_fa_get( @
ia_lbc_color, @
la_lbc_display, @
ia_ep_color, @
la_ep_display, @
l_display_fem )

dump ia_lbc_color
dump la_lbc_display
dump ia_ep_color
dump la_ep_display
dump l_display_fem
dump i_status

#---------------------------------------------------------------------
# Closing the file - new.db

uil_file_close.goquit()

#---------------------------------------------------------------------

Main Index
1688
Code Examples

pref_fa_set ()

# Purpose : This file provides an example of a call to the


# function pref_fa_set()
#
# This function sets the load-boundary colors,
# load-boundary flags, element_property colors,
# element property flags and the display fem flag.
# The function returns 0 if executed with success,
# else returns 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 pref_fa_set()
# has the following arguments:
#
# pref_fa_set
# ( la_set_flag,
# ia_lbc_colors,
# la_lbc_display,
# ia_ep_colors,
# la_ep_display,
# l_display_fem )
#
#---------------------------------------------------------------------
# Variable Declarations

LOGICAL la_set_flag(101)
INTEGER ia_lbc_color(40)
LOGICAL la_lbc_display(40)
INTEGER ia_ep_color(10)
LOGICAL la_ep_display(10)
LOGICAL l_display_fem
INTEGER i_status
INTEGER i
#----------------------------------------------------------------------
# Open a new database
if(!db_is_open())THEN
uil_file_new.go("","new.db")
$? YES 36000002
endif
#----------------------------------------------------------------------
# Setting the preference to MSC.Nastran.

uil_pref_analysis.set_analysis_pref( "MSC.Nastran", @
"Structural", @
"", @
".op2" )
#---------------------------------------------------------------------
# Set the graphics entity type preferences
# Set all lbc color = 2 and flag = FALSE
# Set all entity property color = 5 and flag = FALSE

FOR ( i = 1 to 10)
ia_ep_color(i) = 5
la_ep_display(i) = FALSE
END FOR

FOR ( i = 1 to 40)
ia_lbc_color(i) = 2
la_lbc_display(i) = FALSE
Main Index
CHAPTER 16 1689
Preferences

END FOR

FOR ( i = 1 to 101)
la_set_flag(i) = FALSE
END FOR

#---------------------------------------------------------------------
# Using the function pref_fa_set to set lbc colors & flags,
# ep colors & flag and fem display flag

i_status = pref_fa_set( @
la_set_flag, @
ia_lbc_color, @
la_lbc_display, @
ia_ep_color, @
la_ep_display, @
l_display_fem )

dump la_set_flag
dump ia_lbc_color
dump la_lbc_display
dump ia_ep_color
dump la_ep_display
dump l_display_fem
dump i_status
#---------------------------------------------------------------------
# Closing the file - new.db

uil_file_close.goquit()

#---------------------------------------------------------------------

pref_geo_cid_int_string ()

# Purpose : This file provides an example of a call to the


# function pref_geo_cid_int_string()
#
# This function constructs the select databox
# string from the coordinate frame id. This
# function assumes that the coordinate id is a
# valid id of the coordinate frame. This file
# opens a new database “new.db” and gets the
# select databox string for default coordinate
# frame which has id = 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 pref_geo_cid_int_string()
# has the following arguments:
#
# pref_geo_cid_int_string
# ( cid,
# sdb_string )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_cid
STRING s_sdb_string[32]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
Main Index
1690
Code Examples

$? YES 36000002

# i_cid = 0 (Default coordinate frame)


i_cid = 0

i_return_value = @
pref_geo_cid_int_string @
( i_cid, @
s_sdb_string )
dump i_return_value

# The SelectdataBox string is


dump s_sdb_string
#---------------------------------------------------------------------

pref_geo_cid_string_int ()

# Purpose : This file provides an example of two calls to


# the function pref_geo_cid_string_int()
#
# This function gets default coordinate frame id
# from the select databox input string. This
# function verifies the existence of coordinate
# frame.This file opens a new database “new.db”
# and gets the select databox string for default
# coordinate frame which has id=0. Later it gets
# the id of the coordinate frame given the select
# databox string. It also shows an example of
# getting an id for a non existent 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 pref_geo_cid_string_int()
# has the following arguments:
#
# pref_geo_cid_string_int
# ( sdb_string,
# cid )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_cid
INTEGER i_cid_c
STRING s_sdb_string[32]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# Get the select databox string for the default coordinate frame.
# i_cid_c = 0 (Default coordinate frame)
i_cid_c = 0

i_return_value = @
pref_geo_cid_int_string @
( i_cid_c, @
s_sdb_string )
dump i_return_value

# Get the id for default coordinate frame


Main Index
CHAPTER 16 1691
Preferences

i_return_value = @
pref_geo_cid_string_int @
( s_sdb_string, @
i_cid )
dump i_return_value

# The default coordinate frame id


dump i_cid

# Session file paused. Press “Resume” to continue..


sf_pause()

# Get the id for select databox string “Coord 1” which is not


# existing.
s_sdb_string = “Coord 1”
i_return_value = @
pref_geo_cid_string_int @
( s_sdb_string, @
i_cid )
dump i_return_value
# Error message generated since “Coord 1” doesnot exist.
#---------------------------------------------------------------------

pref_geo_get ()

# Purpose : This file provides an example of a call to the


# function pref_geo_get()
#
# This function gets the geometric modeling
# parameters. This file opens a new database
# “new.db” and gets the geometric modeling
# parameters.
#
# 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 pref_geo_get() has the following arguments:
#
# pref_geo_get
# ( defcid,
# rgtol )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_defcid
REAL r_rgtol
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

i_return_value = @
pref_geo_get @
( i_defcid, @
r_rgtol )
dump i_return_value

# The default coordinate frame id is


dump i_defcid
# The relative geometric tolerance is
dump r_rgtol
#---------------------------------------------------------------------
Main Index
1692
Code Examples

pref_get_anal_attributes ()

# Purpose : This file provides an example of a call to the


# function pref_get_anal_attributes()
#
# This function gets the analysis preference
# suffixes.This file opens a new database
# “new.db” and gets the analysis preference
# suffixes for analysis code MSC.Nastran.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function pref_get_anal_attributes()
# has the following arguments:
#
# pref_get_anal_attributes
# ( anal_code,
# anal_type,
# mod_suf,
# res_suf )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_anal_code[32]
STRING s_anal_type[32]
STRING s_mod_suf[32]
STRING s_res_suf[32]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# s_anal_code = “MSC.Nastran”
s_anal_code = “MSC.Nastran”
i_return_value = @
pref_get_anal_attributes @
( s_anal_code, @
s_anal_type, @
s_mod_suf, @
s_res_suf )
dump i_return_value

# The analysis type name is


dump s_anal_type
# The model file suffix name is
dump s_mod_suf
# The results file suffix name is
dump s_res_suf
#---------------------------------------------------------------------

pref_get_anal_code_count ()

# Purpose : This file provides an example of a call to the


# function pref_get_anal_code_count()
#
# This function counts the number of analysis
# codes.This file open a new database “new.db”
# and gets the count of number of analysis codes.
#
Main Index
CHAPTER 16 1693
Preferences

# 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 pref_get_anal_code_count()
# has the following arguments:
#
# pref_get_anal_code_count
# ( num_codes )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_num_codes
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

i_return_value = @
pref_get_anal_code_count @
( i_num_codes )
dump i_return_value

# The number of analysis codes in the database are


dump i_num_codes
#---------------------------------------------------------------------

pref_get_anal_type_count ()

# Purpose : This file provides an example of a call to the


# function pref_get_anal_type_count()
#
# This function counts the number of analysis
# types.This file open a new database “new.db”
# and gets the count of number of analysis types
# for analysis code MSC.Nastran.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function pref_get_anal_type_count()
# has the following arguments:
#
# pref_get_anal_type_count
# ( anal_code,
# num_types )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_anal_code[32]
INTEGER i_num_types
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# s_anal_code = MSC.Nastran
s_anal_code = “MSC.Nastran”
i_return_value = @
pref_get_anal_type_count @
Main Index
1694
Code Examples

( s_anal_code, @
i_num_types )
dump i_return_value

# The number of analysis types in the database are


dump i_num_types
#---------------------------------------------------------------------

pref_get_next_anal_code ()

# Purpose : This file provides an example of a call to the


# function pref_get_next_anal_code()
#
# This function gets the next analysis code.
# This file open a new database “new.db” and
# gets the count of number of analysis codes
# and prepares for their fetch by calling
# db_get_all_anal_codes.Later it uses the
# above function to get the next analysis code.
#
# This file can be run by starting a session of
# SC/PATRAN, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function pref_get_next_anal_code()
# has the following arguments:
#
# pref_get_next_anal_code
# ( anal_code )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_anal_code[32]
STRING s_msg[64]
INTEGER i_num_codes
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

i_return_value = @
pref_get_anal_code_count @
( i_num_codes )
dump i_return_value

# The number of analysis codes in the database are


dump i_num_codes

WHILE( i_return_value == 0 )
i_return_value = @
pref_get_next_anal_code @
( s_anal_code )
IF( i_return_value == 0 ) THEN
dump s_anal_code
ELSE
dump i_return_value
msg_get_string(i_return_value,s_msg)
dump s_msg
END IF
END WHILE
#---------------------------------------------------------------------

Main Index
CHAPTER 16 1695
Preferences

pref_get_next_anal_type ()

# Purpose : This file provides an example of a call to the


# function pref_get_next_anal_type()
#
# This function gets the next analysis type.
# This file open a new database “new.db” and
# gets the count of number of analysis types
# for analysis code MSC.Nastran and prepares for
# their fetch by calling db_get_all_anal_types.
# Later it uses the above function to get the
# next analysis type.
#
# This file can be run by starting a session of
# SC/PATRAN, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function pref_get_next_anal_type()
# has the following arguments:
#
# pref_get_next_anal_type
# ( anal_type )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_anal_type[32]
STRING s_anal_code[32]
STRING s_msg[64]
INTEGER i_num_types
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# s_anal_code = MSC.Nastran
s_anal_code = “MSC.Nastran”
i_return_value = @
pref_get_anal_type_count @
( s_anal_code, @
i_num_types )
dump i_return_value

# The number of analysis types in the database are


dump i_num_types

WHILE( i_return_value == 0 )
i_return_value = @
pref_get_next_anal_type @
( s_anal_type )
IF( i_return_value == 0 ) THEN
dump s_anal_type
ELSE
dump i_return_value
msg_get_string(i_return_value,s_msg)
dump s_msg
END IF
END WHILE
#---------------------------------------------------------------------

Main Index
1696
Code Examples

pref_global_get ()

# Purpose : This file provides an example of a call to the


# function pref_global_get()
#
# This function gets the global preference
# parameters. This file opens a new database
# “new.db” and gets the global preference
# parameters.
#
# 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 pref_global_get() has the following arguments:
#
# pref_global_get
# ( confirm,
# wm_opt,
# glo_mod_tol )
#
#---------------------------------------------------------------------
# Variable Declarations
LOGICAL l_confirm
INTEGER i_wm_opt
REAL r_glo_mod_tol
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

i_return_value = @
pref_global_get @
( l_confirm, @
i_wm_opt, @
r_glo_mod_tol )
dump i_return_value

# The confirmation flag is


dump l_confirm
# The Warning message option is
dump i_wm_opt
# The global model tolerance is
dump r_glo_mod_tol
#---------------------------------------------------------------------

pref_graphics_get ()

# Purpose : This file provides an example of a call to the


# function pref_graphics_get()
#
# This function gets the graphic preference
# parameters. This file opens a new database
# “new.db” and gets the graphic preference
# parameters.
#
# 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.
#
Main Index
# The function pref_graphics_get() has the following arguments:
CHAPTER 16 1697
Preferences

#
# pref_graphics_get
# ( disp_meth,
# p_color,
# s_color,
# e_color,
# extend,
# fit_view,
# center,
# hard_rend,
# anti_alias,
# td_vector,
# rt_display,
# s_light,
# p_marker,
# s_marker,
# m_color,
# m_size,
# gm_size,
# nm_size,
# l_format,
# nsigd )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_disp_meth
INTEGER i_p_color
INTEGER i_s_color
INTEGER i_e_color
LOGICAL l_extend
LOGICAL l_fit_view
LOGICAL l_center
LOGICAL l_hard_rend
LOGICAL l_anti_alias
LOGICAL l_td_vector
LOGICAL l_rt_display
LOGICAL l_s_light
INTEGER i_p_marker
INTEGER i_s_marker
INTEGER i_m_color
INTEGER i_m_size
INTEGER i_gm_size
INTEGER i_nm_size
INTEGER i_l_format
INTEGER i_nsigd
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

i_return_value = @
pref_graphics_get @
( i_disp_meth, @
i_p_color, @
i_s_color, @
i_e_color, @
l_extend, @
l_fit_view, @
l_center, @
l_hard_rend, @
l_anti_alias, @
l_td_vector, @
l_rt_display, @
l_s_light, @
i_p_marker, @
i_s_marker, @
i_m_color, @
Main Index
1698
Code Examples

i_m_size, @
i_gm_size, @
i_nm_size, @
i_l_format, @
i_nsigd )
dump i_return_value

# Display method is
dump i_disp_meth
# Primary color is
dump i_p_color
# Secondary color is
dump i_s_color
# Error color is
dump i_e_color
# Autoextend Flag is
dump l_extend
# Autofitview Flag is
dump l_fit_view
# Autocenter Flag is
dump l_center
# Hardware rendering Flag is
dump l_hard_rend
# Anti-Alias flag is
dump l_anti_alias
# 3-D vector Display Flag is
dump l_td_vector
# Result Title Display Flag is
dump l_rt_display
# Symmetric Light Flag is
dump l_s_light
# Primary marker is
dump i_p_marker
# Secondary marker is
dump i_s_marker
# Marker color is
dump i_m_color
# Marker size is
dump i_m_size
# Grid marker size is
dump i_gm_size
# Node marker size is
dump i_nm_size
# Results label format is
dump i_l_format
# Number of significant results digits are
dump i_nsigd
#---------------------------------------------------------------------

pref_graphics_marker_data_get ()

# Purpose : This file provides an example of a call to the


# function pref_graphics_marker_data_get()
#
# This function gets the graphic preference
# parameters for markers. This file opens a
# new database “new.db” and gets the graphic
# preference parameters for the markers.
#
# 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 pref_graphics_marker_data_get()
# has the following arguments:
Main Index
CHAPTER 16 1699
Preferences

#
# pref_graphics_marker_data_get
# ( p_marker,
# s_marker,
# m_color,
# m_size )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_p_marker
INTEGER i_s_marker
INTEGER i_m_color
INTEGER i_m_size
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

i_return_value = @
pref_graphics_marker_data_get @
( i_p_marker, @
i_s_marker, @
i_m_color, @
i_m_size )
dump i_return_value

# The primary marker is


dump i_p_marker
# The secondary marker is
dump i_s_marker
# The marker color is
dump i_m_color
# The marker size is
dump i_m_size
#---------------------------------------------------------------------

Main Index
1700
Code Examples

Main Index
MSC.Acumen, Volume 2: Code Examples

CHAPTER
Utilities
17
■ Introduction

Main Index
1702
Code Examples

17.1 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.

array_copy_real ()

# Purpose : This file provides an example of a call to the


# function array_copy_real()
#
# This function copies one real array to second array.
#
# 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 array_copy_real()
# has the following arguments:
#
# array_copy_real (array1, array2, num )
#
#---------------------------------------------------------------------
# Variable Declarations

INTEGER num
REAL array1(virtual)
REAL array2(virtual)

#---------------------------------------------------------------------
# Argument Initialization.

num = 5

sys_allocate_array(array1, 1, num)
sys_allocate_array(array2, 1, num)

array1 = [10.0, 1.0, 2.0, 3.0, 7.0]

#---------------------------------------------------------------------
# Copy array1 into array2.

array_copy_real(array1, array2, num)

#---------------------------------------------------------------------
# Dump the output of the function

dump array2

#---------------------------------------------------------------------
# closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

Main Index
CHAPTER 17 1703
Utilities

array_del_zero_int ()

# Purpose : This file provides an example of a call to the


# function array_del_zero_int()
#
# This function deletes all zero value from an array.
#
# 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 array_del_zero_int()
# has the following arguments:
#
# array_del_zero_int (array, numval )
#
#---------------------------------------------------------------------
# Variable Declarations

INTEGER numval
INTEGER array(virtual)

#---------------------------------------------------------------------
# Argument Initialization.

numval = 10
sys_allocate_array(array,1,numval)
array = [10, 0, 0, 2, 3, 5, 0, 8, 2, 0]

#---------------------------------------------------------------------
# Set each of num elements of array into zero real values.

array_del_zero_int(array, numval)

#---------------------------------------------------------------------
# Dump the output of the function

sys_reallocate_array(array,1,numval)
dump numval
dump array

#---------------------------------------------------------------------
# closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

array_fill_int ()

# Purpose : This file provides an example of a call to the


# function array_fill_int()
#
# This function sets each of num elements of integer
# array into a given input value.
#
# 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
Main Index
1704
Code Examples

# on the menu bar.


#
# The function array_fill_int()
# has the following arguments:
#
# array_fill_int ( array, n, dim )
#
#---------------------------------------------------------------------
# Variable Declarations

INTEGER array(virtual)
INTEGER n
INTEGER dim

#---------------------------------------------------------------------
# Argument Initialization.

dim = 8
sys_allocate_array(array, 1, dim)
array = [10, 1, 1, 2, 4, 6, 7, 2]
n = 5

#---------------------------------------------------------------------
# Set each of num elements of integer array into a given input value.

array_fill_int (array, n, dim)

#---------------------------------------------------------------------
# Dump the output of the function

dump array
dump n

#---------------------------------------------------------------------
# closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

array_fill_zero_int ()

# Purpose : This file provides an example of a call to the


# function array_fill_zero_int()
#
# This function sets every component of the
# integer array to zero.This file sets an
# integer array to a constant value 101 and
# later it uses the above function to set
# the components of integer array to ZERO.
#
# 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 array_fill_zero_int() has the following arguments:
#
# array_fill_zero_int
# ( array,
# in )
#
#---------------------------------------------------------------------
# Variable Declarations
Main Index
CHAPTER 17 1705
Utilities

INTEGER ia_array(8)
INTEGER i_in
INTEGER i_r
#---------------------------------------------------------------------
# Set the integer array to some constant value(say 101)
FOR(i_r = 1 TO 8)
ia_array(i_r) = 101
END FOR

# The integer array is (Before setting)


dump ia_array

# i_in = 8
i_in = 8
array_fill_zero_int @
( ia_array, @
i_in )

# The integer array is (After setting)


dump ia_array
#---------------------------------------------------------------------

array_fill_zero_real ()

# Purpose : This file provides an example of a call to the


# function array_fill_zero_real()
#
# This function sets each of num elements of
# array into zero real values.
#
# 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 array_fill_zero_real()
# has the following arguments:
#
# array_fill_zero_real ( array, dim )
#
#---------------------------------------------------------------------
# Variable Declarations

REAL array(virtual)
INTEGER dim

#---------------------------------------------------------------------
# Argument Initialization.

dim = 4
sys_allocate_array(array, 1, dim)
array = [10.0, 1.0, 3.0, 2.0]

#---------------------------------------------------------------------
# Set each of num elements of array into zero real values.

array_fill_zero_real (array, dim)

#---------------------------------------------------------------------
# Dump the output of the function

dump array

#---------------------------------------------------------------------
Main Index
1706
Code Examples

# closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

array_real_fill_null ()

# Purpose : This file provides an example of a call to the


# function array_real_fill_null()
#
# This function sets every component of the
# real array to NULL value.This file sets a
# real array to a constant value 202.54 and
# later it uses the above function to set
# the components of integer array to NULL value.
#
# 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 array_real_fill_null() has the following arguments:
#
# array_real_fill_null
# ( array,
# in )
#
#---------------------------------------------------------------------
# Variable Declarations
REAL ra_array(8)
INTEGER i_in
INTEGER i_r
#---------------------------------------------------------------------
# Set the real array to some constant value(say 202.54)
FOR(i_r = 1 TO 8)
ra_array(i_r) = 202.54
END FOR

# The real array is (Before setting)


dump ra_array

# i_in = 8
i_in = 8
array_real_fill_null @
( ra_array, @
i_in )

# The real array is (After setting)


dump ra_array
#---------------------------------------------------------------------

array_sort_and_del_dupl_int ()

# Purpose : This file provides an example of a call to the


# function array_sort_and_del_dupl_int()
#
# This function sqeezes all duplicate values from
# the first N locations of unsorted integer array.
#
# This file can be run by starting a session of
# MSC.Patran, opening a new or existing database,
Main Index
CHAPTER 17 1707
Utilities

# and running this session file through the


# "File","Session","Play" pulldown menus
# on the menu bar.
#
# This function does not exist in MSC.Patran9.0.
# It works in MSC.Patran8.5 version.
#
# The function array_sort_and_del_dupl_int()
# has the following arguments:
#
# array_sort_and_del_dupl_int (array, n, ndim)
#
#---------------------------------------------------------------------
# Variable Declarations

INTEGER array(virtual)
INTEGER ndim
INTEGER n

#---------------------------------------------------------------------
# Argument Initialization.

ndim = 8
sys_allocate_array(array, 1, ndim)
array = [10, 1, 1, 2, 4, 6, 7, 2]
n = 6

#---------------------------------------------------------------------
# Sqeeze all duplicate values from the Ist n locs. of unsorted int array.

array_sort_and_del_dupl_int (array, n, ndim)

#---------------------------------------------------------------------
# Dump the output of the function

sys_reallocate_array(array, 1, n)

dump array
dump n

#---------------------------------------------------------------------
# closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

ga_entities_string_format ()

# Purpose : This file provides an example of a call to the


# function ga_entities_string_format()
#
# This function converts an integer list of a
# given entity type into character string.This
# file defines 8 labels from 110 to 180 with
# a difference of 10.Later it gets the character
# string for entity surface with label ranging
# from 115 to 155.
#
# 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.
Main Index
1708
Code Examples

#
# The function ga_entities_string_format()
# has the following arguments:
#
# ga_entities_string_format
# ( entitytype,
# dblist,
# range,
# number,
# entitylist )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_entitytype
INTEGER ia_dblist(8) = [ 110,120,130,140,150,160,170,180 ]
INTEGER ia_range(3)
INTEGER i_number
STRING s_entitylist[128]
INTEGER i_return_value
#---------------------------------------------------------------------
# i_entitytype = 3 (Surface)
i_entitytype = 3
i_number = 8
# Lowest range for label.
ia_range(1) = 115
# Highest range for label.
ia_range(2) = 155
# Maximum string length
ia_range(3) = 128

i_return_value = @
ga_entities_string_format @
( i_entitytype, @
ia_dblist, @
ia_range, @
i_number, @
s_entitylist )
dump i_return_value

# The Formatted integer to character converted label list is


dump s_entitylist
#---------------------------------------------------------------------

ga_entity_get_by_type ()

# Purpose : This file provides an example of two calls


# to the function ga_entity_get_by_type()
#
# This function returns the labels of all the
# existing entities of a given type.This file
# opens a new database “new.db” and creates
# a surface and two curves.It then gets the
# entity labels with the orphan entity flag
# equal to TRUE and FALSE, for the entity
# type 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 ga_entity_get_by_type() has the following arguments:
#
# ga_entity_get_by_type
# ( entity_type,
# orphan_flag,
Main Index
CHAPTER 17 1709
Utilities

# label_count,
# entity_labels )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_entity_type
LOGICAL l_orphan_flag
INTEGER i_label_count
INTEGER ia_entity_labels(8)
STRING sv_asm_create_patch_xy_created[VIRTUAL]
STRING sv_asm_create_line_xyz_created[VIRTUAL]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# Create a surface and two curves.


# The surface contains 4 curves which are orphans.The other two
# curves have labels 1 and 2.In all there are 6 curves.
asm_const_patch_xyz( “1”, “<1 1 0>”, “[0 0 0]”, @
“Coord 0”, sv_asm_create_patch_xy_created )

asm_const_line_xyz( “1”, “<1 1 0>”, “[0 0 0]”, @


“Coord 0”, sv_asm_create_line_xyz_created )

asm_const_line_xyz( “2”, “<1 -1 0>”, “[0 1 0]”, @


“Coord 0”, sv_asm_create_line_xyz_created )

# i_entity_type = 2 (Curve)
i_entity_type = 2
i_label_count = 6

l_orphan_flag = TRUE
i_return_value = @
ga_entity_get_by_type @
( i_entity_type, @
l_orphan_flag, @
i_label_count, @
ia_entity_labels )
dump i_return_value

# The actual number of labels returned are(orphan entity flag=TRUE)


dump i_label_count

# The entity labels are(orphan entity flag=TRUE)


dump ia_entity_labels

l_orphan_flag = FALSE
i_return_value = @
ga_entity_get_by_type @
( i_entity_type, @
l_orphan_flag, @
i_label_count, @
ia_entity_labels )
dump i_return_value

# The actual number of labels returned are(orphan entity flag=FALSE)


dump i_label_count

# The entity labels are(orphan entity flag=FALSE)


dump ia_entity_labels

SYS_FREE_STRING(sv_asm_create_patch_xy_created)
SYS_FREE_STRING(sv_asm_create_line_xyz_created)
#---------------------------------------------------------------------

Main Index
1710
Code Examples

math_get_no_data_null ()

# Purpose : This file provides an example of a call to the


# function math_get_no_data_null()
#
# This function returns a no valid value real
# number.
#
# 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 math_get_no_data_null() has the following arguments:
#
# math_get_no_data_null
# ( rval )
#
#---------------------------------------------------------------------
# Variable Declarations
REAL r_rval
#---------------------------------------------------------------------
math_get_no_data_null @
( r_rval )

# The no valid value real number is


dump r_rval
#---------------------------------------------------------------------

math_is_no_data_null ()

# Purpose : This file provides an example of a call to the


# function math_is_no_data_null()
#
# This function returns a logical value TRUE if
# the given real value has a NULL value else it
# returns a FALSE value for a real number.This
# file uses the function math_get_no_data_null()
# to get a no valid value real number.Later this
# value is supplied to the above function to get
# the logical return value.
#
# 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 math_is_no_data_null() has the following arguments:
#
# math_is_no_data_null
# ( rval )
#
#---------------------------------------------------------------------
# Variable Declarations
REAL r_rval
LOGICAL l_return_value
#---------------------------------------------------------------------
# Get a no valid value real number
math_get_no_data_null( r_rval )

# The no valid value real number is


dump r_rval

Main Index
CHAPTER 17 1711
Utilities

l_return_value = @
math_is_no_data_null @
( r_rval )

# The return value for checking for a real value is


# (The value is TRUE if the real value is NULL).
dump l_return_value

#---------------------------------------------------------------------

math_mat_add ()

# Purpose : This file provides an example of a call to the


# function math_mat_add()
#
# This function adds the two matrix into third matrix.
#
# 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 math_mat_add()
# has the following arguments:
#
# math_mat_add ( @
# matrix3, @
# matrix1, @
# matrix2, @
# dim1, @
# dim2)
#
#---------------------------------------------------------------------
# Variable Declarations

real matrix1(2, 2), matrix2(2, 2), matrix3(2, 2)


integer dim1, dim2

#---------------------------------------------------------------------
# Argument Initialization.

dim1 = 2
dim2 = 2

matrix1 = [[1.0, 2.0] [2.0, 3.0]]


matrix2 = [[2.0, 3.0] [3.0, 4.0]]

#---------------------------------------------------------------------
# Add two matrix a and b into third matrix named c

math_mat_add(matrix3, matrix1, matrix2, dim1, dim2)

#---------------------------------------------------------------------
# Dump the output of the function

dump matrix3

#---------------------------------------------------------------------
# closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.
Main Index
1712
Code Examples

math_mat_invert ()

# Purpose : This file provides an example of a call to the


# function math_mat_invert()
#
# This function invert the given matrix.
#
# 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 math_mat_invert()
# has the following arguments:
#
# math_mat_invert ( @
# matrix, @
# dim, @
# tolerance, @
# i_return_value )
#
#---------------------------------------------------------------------
# Variable Declarations

real matrix(3, 3)
integer dim
real tol
integer i_return_value

#---------------------------------------------------------------------
# Argument Initialization.

dim = 3
tol = 0.001

matrix = [[1.0, 5.0, 3.0] [2.0, 7.0, 4.0] [1.0, 5.0, 6.0]]

#---------------------------------------------------------------------
# Invert the given matrix.

math_mat_invert(matrix, dim, tol, i_return_value)

#---------------------------------------------------------------------
# Dump the output of the function

dump matrix
dump i_return_value

#---------------------------------------------------------------------
# closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

Main Index
CHAPTER 17 1713
Utilities

math_mat_mult ()

# Purpose : This file provides an example of a call to the


# function math_mat_mult()
#
# This function multiply the two matrix.
#
# 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 math_mat_mult()
# has the following arguments:
#
# math_mat_mult ( @
# matrix1, @
# matrix2, @
# matrix3, @
# dim1, @
# dim2, @
# dim3)
#
#---------------------------------------------------------------------
# Variable Declarations

real matrix1(2, 3), matrix2(3, 2), matrix3(2, 2)


integer dim1, dim2, dim3

#---------------------------------------------------------------------
# Argument Initialization.

dim1 = 2
dim2 = 3
dim3 = 2

matrix1 = [[1.0, 2.0, 3.0] [1.0, 2.0, 3.0]]


matrix2 = [[1.0, 2.0] [1.0, 2.0] [1.0, 3.0]]

#---------------------------------------------------------------------
# Multiply two matrix

math_mat_mult(matrix1, matrix2, matrix3, dim1, dim2, dim3)

#---------------------------------------------------------------------
# Dump the output of the function

dump matrix3

#---------------------------------------------------------------------
# closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

Main Index
1714
Code Examples

math_mat_transp_in_place ()

# Purpose : This file provides an example of a call to the


# function math_mat_transp_in_place()
#
# This function transposes the matrix in place.
#
# 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 math_mat_transp_in_place()
# has the following arguments:
#
# math_mat_transp_in_place ( matrix, dim)
#
#---------------------------------------------------------------------
# Variable Declarations

real matrix(3, 3)
integer dim

#---------------------------------------------------------------------
# Argument Initialization.

dim = 3

matrix = [[1.0, 2.0, 3.0] [2.0, 3.0, 5.0] [7.0, 8.0, 9.0]]

#---------------------------------------------------------------------
# Transpose the matrix in place.

math_mat_transp_in_place(matrix, dim)

#---------------------------------------------------------------------
# Dump the output of the function

dump matrix

#---------------------------------------------------------------------
# closing the patran environment.

uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

math_vec_len ()

# Purpose : This file provides an example of a call to the


# function math_vec_len()
#
# This function computes the length of the vector.
#
# 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 math_vec_len()
Main Index
CHAPTER 17 1715
Utilities

# has the following arguments:


#
# math_vec_len ( vector )
#
#---------------------------------------------------------------------
# Variable Declarations

real vector(3)
real length

#---------------------------------------------------------------------
# Argument Initialization.

vector = [2.0, 3.0, 4.0]

#---------------------------------------------------------------------
# Compute the length of the vector

length = math_vec_len ( vector )

#---------------------------------------------------------------------
# Dump the output of the function

dump length

#---------------------------------------------------------------------
# closing the patran environment.

# uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

math_vec_norm ()

# Purpose : This file provides an example of a call to the


# function math_vec_norm()
#
# This function normalizes a 3-D vector.
#
# 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 math_vec_norm()
# has the following arguments:
#
# math_vec_norm ( syseps, vector )
#
#---------------------------------------------------------------------
# Variable Declarations

REAL vector(3)
REAL syseps

#---------------------------------------------------------------------
# Argument Initialization.

vector = [2.0, 3.0, 4.0]


syseps = 0.01

#---------------------------------------------------------------------
# This function normalizes a 3-D vector
Main Index
1716
Code Examples

math_vec_norm ( syseps, vector)

#---------------------------------------------------------------------
# Dump the output of the function

dump vector

#---------------------------------------------------------------------
# closing the patran environment.

# uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

mth_vec_add ()

# Purpose : This file provides an example of a call to the


# function mth_vec_add()
#
# This function computes the sum of two
# n-dimensional vectors.
#
# 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 mth_vec_add()
# has the following arguments:
#
# mth_vec_add ( dim, @
# vec1, @
# vec2, @
# vec3 )
#
#---------------------------------------------------------------------
# Variable Declarations

REAL vec1(3)
REAL vec2(3)
REAL vec3(3)
INTEGER dim

#---------------------------------------------------------------------
# Argument Initialization.

dim = 3
vec1 = [2.0, 3.0, 4.0]
vec2 = [3.0, 4.0, 6.0]

#---------------------------------------------------------------------
# Computes the sum of two n-dimensional vectors.

mth_vec_add ( dim, vec1, vec2, vec3)

#---------------------------------------------------------------------
# Dump the output of the function

dump vec3

#---------------------------------------------------------------------
# closing the patran environment.

# uil_file_close.goquit( )
Main Index
CHAPTER 17 1717
Utilities

#---------------------------------------------------------------------
# End of File.

mth_vec_cross_prod ()

# Purpose : This file provides an example of a call to the


# function mth_vec_cross_prod()
#
# This function computes the cross product of two
# 3-dimensional vectors array.
#
# 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 mth_vec_cross_prod()
# has the following arguments:
#
# mth_vec_cross_prod (vec1, vec2, vec3, dim)
#
#---------------------------------------------------------------------
# Variable Declarations

REAL vec1(2, 3)
REAL vec2(2, 3)
REAL vec3(2, 3)
INTEGER dim

#---------------------------------------------------------------------
# Argument Initialization.

dim = 2
vec1 = [[1.0, 2.0, 1.0][2.0, 3.0, 4.0]]
vec2 = [[4.0, 2.0, 3.0][3.0, 1.0, 2.0]]

#---------------------------------------------------------------------
# Computes the cross product of two 3-dimensional vectors array.

mth_vec_cross_prod ( vec1, vec2, vec3, dim)

#---------------------------------------------------------------------
# Dump the output of the function

dump vec3

#---------------------------------------------------------------------
# closing the patran environment.

# uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

mth_vec_dot_prod ()

# Purpose : This file provides an example of a call to the


# function mth_vec_dot_prod()
#
# This function computes the dot product of two
# 3-dimensional vectors.
#
Main Index
1718
Code Examples

# 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 mth_vec_dot_prod()
# has the following arguments:
#
# mth_vec_dot_prod ( vec1, vec2)
#
#---------------------------------------------------------------------
# Variable Declarations

REAL vec1(3)
REAL vec2(3)
REAL product

#---------------------------------------------------------------------
# Argument Initialization.

vec1 = [2.0, 3.0, 4.0]


vec2 = [3.0, 4.0, 6.0]

#---------------------------------------------------------------------
# Computes the dot product of two 3-dimensional vectors.

product = mth_vec_dot_prod ( vec1, vec2)

#---------------------------------------------------------------------
# Dump the output of the function

dump product

#---------------------------------------------------------------------
# closing the patran environment.

# uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

mth_vec_length ()

# Purpose : This file provides an example of a call to the


# function mth_vec_length()
#
# This function computes the length of the vector.
#
# 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 mth_vec_length()
# has the following arguments:
#
# mth_vec_length ( vector )
#
#---------------------------------------------------------------------
# Variable Declarations

real vector(3)
real length

#---------------------------------------------------------------------
Main Index
CHAPTER 17 1719
Utilities

# Argument Initialization.

vector = [2.0, 3.0, 4.0]

#---------------------------------------------------------------------
# Compute the length of the vector

length = mth_vec_length(vector)

#---------------------------------------------------------------------
# Dump the output of the function

dump length

#---------------------------------------------------------------------
# closing the patran environment.

# uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

mth_vec_scale

# Purpose : This file provides an example of a call to the


# function mth_vec_scale()
#
# This function scales a vector by a scale factor.
#
# 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 mth_vec_scale()
# has the following arguments:
#
# mth_vec_scale ( scale_factor, dim, vector)
#
#---------------------------------------------------------------------
# Variable Declarations

REAL scale_factor
REAL vector(3)
REAL dim

#---------------------------------------------------------------------
# Argument Initialization.

scale_factor = 2.5
dim = 3
vector = [2.0, 3.0, 4.0]

#---------------------------------------------------------------------
# Scale a vector by a scale factor.

mth_vec_scale ( scale_factor, dim, vector )

#---------------------------------------------------------------------
# Dump the output of the function

dump vector

#---------------------------------------------------------------------
# closing the patran environment.
Main Index
1720
Code Examples

# uil_file_close.goquit( )

#---------------------------------------------------------------------
# End of File.

rpc_add_server ()

# Purpose : This file provides an example of a call to the


# function rpc_add_server()
#
# In this illustration, a server program
# “rpc_test” is started. The server is registered
# and initialised. Then an integer is sent to the
# server and same integer is got back from the
# server.
#
# Before running this file, run the script
# compile.rpc_test.script in the same platform
# where this file is supposed to run. The script
# will compile “rpc_test.c” and prepare an
# executable “rpc_test”. Copy the executable to
# the current working directory.
#
# 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 rpc_add_server() has the following arguments:
#
# rpc_add_server
# ( server,
# prog_num,
# prog_ver,
# host )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_server[128]
INTEGER i_prog_num
INTEGER i_prog_ver
STRING s_host[128]
INTEGER i_handle
INTEGER i_value
INTEGER i_get_value
INTEGER i_return_value
#---------------------------------------------------------------------
# Start a program “rpc_test” in the back ground using the function
# utl_process_spawn(). This will act as the server. Set the program
# number to be 12345 and the version 1.
#
s_server = “rpc_test”
i_prog_num = 12345
i_prog_ver = 1

i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)

# The process ID of the server is


dump i_return_value

# Get the host name


utl_get_host_name(s_host)
Main Index
CHAPTER 17 1721
Utilities

dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )

dump i_return_value
#---------------------------------------------------------------------
# Put an integer value of 100 to the output stream (i.e. to the
# server)
#
i_value = 100
i_return_value = @
rpc_put_integer @
( i_handle, @
i_value )

dump i_return_value
#---------------------------------------------------------------------
# Send the remote procedure call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
i_return_value = @
rpc_call @
( i_handle )

dump i_return_value

# Get the integer from the input stream (i.e. from the server)
#
i_return_value = @
rpc_get_integer @
( i_handle, @
i_get_value )

dump i_return_value
dump i_get_value
#---------------------------------------------------------------------

rpc_call ()

# Purpose : This file provides an example of a call to the


# function rpc_call()
#
# In this illustration, a server program
# “rpc_test” is started. The server is registered
# and initialised. Then an integer is sent to the
# server and same integer is got back from the
# server.
Main Index
1722
Code Examples

#
# Before running this file, run the script
# compile.rpc_test.script in the same platform
# where this file is supposed to run. The script
# will compile “rpc_test.c” and prepare an
# executable “rpc_test”. Copy the executable to
# the current working directory.
#
# 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 rpc_call() has the following arguments:
#
# rpc_call
# ( handle )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_server[128]
INTEGER i_prog_num
INTEGER i_prog_ver
STRING s_host[128]
INTEGER i_handle
INTEGER i_value
INTEGER i_get_value
INTEGER i_return_value
#---------------------------------------------------------------------
# Start a program “rpc_test” in the back ground using the function
# utl_process_spawn(). This will act as the server. Set the program
# number to be 12345 and the version 1.
#
s_server = “rpc_test”
i_prog_num = 12345
i_prog_ver = 1

i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)

# The process ID of the server is


dump i_return_value

# Get the host name


utl_get_host_name(s_host)

dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )
Main Index
CHAPTER 17 1723
Utilities

dump i_return_value
#---------------------------------------------------------------------
# Put an integer value of 100 to the output stream (i.e. to the
# server)
#
i_value = 100
i_return_value = @
rpc_put_integer @
( i_handle, @
i_value )

dump i_return_value
#---------------------------------------------------------------------
# Send the remote procedure call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
i_return_value = @
rpc_call @
( i_handle )

dump i_return_value
#---------------------------------------------------------------------
# Get the integer from the input stream (i.e. from the server)
#
i_return_value = @
rpc_get_integer @
( i_handle, @
i_get_value )

dump i_return_value
dump i_get_value
#---------------------------------------------------------------------

rpc_clear_output ()

# Purpose : This file provides an example of a call to the


# function rpc_clear_output()
#
# In this illustration, a server program
# “rpc_test” is started. The server is registered
# and initialised. Then a string is sent to the
# server. Same string is got back from the
# server. Again another string is sent followed
# by a rpc_clear_output() call. Function rpc_call
# is called to see that it doesnot function since
# the output stream is cleared.
#
# Before running this file, run the script
# compile.rpc_test.script in the same platform
# where this file is supposed to run. The script
# will compile “rpc_test.c” and prepare an
# executable “rpc_test”. Copy the executable to
# the current working directory.
#
# 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 rpc_clear_output() has the following arguments:
#
# rpc_clear_output
# ( handle )
#
Main Index
1724
Code Examples

#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_handle
INTEGER i_count
STRING s_server[128]
INTEGER i_prog_num
INTEGER i_prog_ver
STRING s_host[128]
INTEGER i_handle
STRING s_value[128]
STRING s_get_value[128]
INTEGER i_return_value
#---------------------------------------------------------------------
# Start a program “rpc_test” in the back ground using the function
# utl_process_spawn(). This will act as the server. Set the program
# number to be 12345 and the version 1.
#
s_server = “rpc_test”
i_prog_num = 12345
i_prog_ver = 1

i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)

# The process ID of the server is


dump i_return_value

# Get the host name


utl_get_host_name(s_host)

dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )

dump i_return_value
#---------------------------------------------------------------------
# Put a string “MSC.Patran Welcomes” to the output stream ( i.e. to
# the server)
#
s_value = “MSC.Patran Welcomes”
i_return_value = @
rpc_put_string @
( i_handle, @
s_value )

dump i_return_value
#---------------------------------------------------------------------
# Send the remote procedure call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
Main Index
CHAPTER 17 1725
Utilities

#
i_return_value = @
rpc_call @
( i_handle )

dump i_return_value
#---------------------------------------------------------------------
# Get the string from the input stream (i.e. from the server)
#
i_return_value = @
rpc_get_string @
( i_handle, @
s_get_value )
dump i_return_value
dump s_get_value
#---------------------------------------------------------------------
s_value = “MSC.Patran again welcomes you”
i_return_value = @
rpc_put_string @
( i_handle, @
s_value )

dump i_return_value

# Reset the output data stream.


#
rpc_clear_output @
( i_handle )

i_return_value = @
rpc_call @
( i_handle )

dump i_return_value

# Note that rpc_call() returns an error message “RPC call failure”


# (Error code 47000008). The function rpc_clear_output() clears
# the output stream. Since there is nothing in the output stream,
# rpc_call() fails to make an RPC. Hence the error code.
#---------------------------------------------------------------------

rpc_get_bool_array ()

# Purpose : This file provides an example of a call to the


# function rpc_get_bool_array()
#
# In this illustration, a server program
# “rpc_test” is started. The server is registered
# and initialised. Then a boolean array is sent
# to the server and same boolean array is got
# back from the server.
#
# Before running this file, run the script
# compile.rpc_test.script in the same platform
# where this file is supposed to run. The script
# will compile “rpc_test.c” and prepare an
# executable “rpc_test”. Copy the executable to
# the current working directory.
#
# 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 rpc_get_bool_array() has the following arguments:
Main Index
1726
Code Examples

#
# rpc_get_bool_array
# ( handle,
# value,
# count )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_handle
LOGICAL la_put_value(4)
INTEGER i_count
STRING s_server[128]
INTEGER i_prog_num
INTEGER i_prog_ver
STRING s_host[128]
LOGICAL la_value(4)
INTEGER i_return_value
#---------------------------------------------------------------------
# Start a program “rpc_test” in the back ground using the function
# utl_process_spawn(). This will act as the server. Set the program
# number to be 12345 and the version 1.
#
s_server = “rpc_test”
i_prog_num = 12345
i_prog_ver = 1

i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)

# The process ID of the server is


dump i_return_value

# Get the host name


utl_get_host_name(s_host)

dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )

dump i_return_value
#---------------------------------------------------------------------
# Put a boolean array to the output stream (i.e. to the server)
#
la_put_value = [TRUE, FALSE, TRUE, FALSE]
i_count = 4
i_return_value = @
rpc_put_bool_array @
( i_handle, @
la_put_value, @
Main Index
CHAPTER 17 1727
Utilities

i_count )
dump i_return_value
#---------------------------------------------------------------------
# Send the remote procedure call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
i_return_value = @
rpc_call @
( i_handle )

dump i_return_value

# Get the boolean array from the input stream (i.e. from the server)
#
i_return_value = @
rpc_get_bool_array @
( i_handle, @
la_value, @
i_count )

dump i_return_value
dump la_value
#---------------------------------------------------------------------

rpc_get_boolean ()

# Purpose : This file provides an example of a call to the


# function rpc_get_boolean()
#
# In this illustration, a server program
# “rpc_test” is started.The server is registered
# and initialised.Then a boolean value is sent
# to the server and same boolean value is got
# back from the server.
#
# Before running this file, run the script
# compile.rpc_test.script in the same platform
# where this file is supposed to run. The script
# will compile “rpc_test.c” and prepare an
# executable “rpc_test”. Copy the executable to
# the current working directory.
#
# 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 rpc_get_boolean() has the following arguments:
#
# rpc_get_boolean
# ( handle,
# value )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_server[128]
INTEGER i_prog_num
INTEGER i_prog_ver
STRING s_host[128]
INTEGER i_handle
LOGICAL l_put_value
LOGICAL l_value
INTEGER i_return_value
#---------------------------------------------------------------------
# Start a program “rpc_test” in the back ground using the function
Main Index
1728
Code Examples

# utl_process_spawn(). This will act as the server. Set the program


# number to be 12345 and the version 1.
#
s_server = “rpc_test”
i_prog_num = 12345
i_prog_ver = 1

i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)

# The process ID of the server is


dump i_return_value

# Get the host name


utl_get_host_name(s_host)

dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )

dump i_return_value
#---------------------------------------------------------------------
# Put an boolean value of TRUE to the output stream (i.e. to the
# server)
#
l_put_value = TRUE
i_return_value = @
rpc_put_boolean @
( i_handle, @
l_put_value )
dump i_return_value
#---------------------------------------------------------------------
# Send the remote procedure call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
i_return_value = @
rpc_call @
( i_handle )

dump i_return_value

# Get the Boolean from the input stream (i.e. from the server)
#
i_return_value = @
rpc_get_boolean @
( i_handle, @
l_value )

dump i_return_value
Main Index
CHAPTER 17 1729
Utilities

dump l_value
#---------------------------------------------------------------------

rpc_get_command ()

# Purpose : This file provides an example of a call to the


# function rpc_get_command()
#
# In this illustration, a server program
# “rpc_test” is started. The server is registered
# and initialised. Then a command value is sent
# to the server and same command value is got
# back from the server.
#
# Before running this file, run the script
# compile.rpc_test.script in the same platform
# where this file is supposed to run. The script
# will compile “rpc_test.c” and prepare an
# executable “rpc_test”. Copy the executable to
# the current working directory.
#
# 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 rpc_get_command() has the following arguments:
#
# rpc_get_command
# ( handle,
# value )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_server[128]
INTEGER i_prog_num
INTEGER i_prog_ver
STRING s_host[128]
INTEGER i_handle
INTEGER i_put_value
INTEGER i_value
INTEGER i_return_value
#---------------------------------------------------------------------
# Start a program “rpc_test” in the back ground using the function
# utl_process_spawn(). This will act as the server. Set the program
# number to be 12345 and the version 1.
#
s_server = “rpc_test”
i_prog_num = 12345
i_prog_ver = 1

i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)

# The process ID of the server is


dump i_return_value

# Get the host name


utl_get_host_name(s_host)

dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
Main Index
1730
Code Examples

#
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )

dump i_return_value
#---------------------------------------------------------------------
# Put a command value of 4 to the output stream (i.e. to the
# server)
#
i_put_value = 4
i_return_value = @
rpc_put_command @
( i_handle, @
i_put_value )
dump i_return_value
#---------------------------------------------------------------------
# Send the remote procedure call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
i_return_value = @
rpc_call @
( i_handle )

dump i_return_value

# Get the command value from the input stream (i.e. from the server)
#
i_return_value = @
rpc_get_command @
( i_handle, @
i_value )

dump i_return_value
dump i_value
#---------------------------------------------------------------------

rpc_get_int_array ()

# Purpose : This file provides an example of a call to the


# function rpc_get_int_array()
#
# In this illustration, a server program
# “rpc_test” is started. The server is registered
# and initialised. Then an integer array is sent
# to the server and same integer array is got
# back from the server.
#
# Before running this file, run the script
# compile.rpc_test.script in the same platform
# where this file is supposed to run. The script
# will compile “rpc_test.c” and prepare an
# executable “rpc_test”. Copy the executable to
Main Index
CHAPTER 17 1731
Utilities

# the current working directory.


#
# 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 rpc_get_int_array() has the following arguments:
#
# rpc_get_int_array
# ( handle,
# value,
# count )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_handle
INTEGER ia_put_value(4)
INTEGER i_count
STRING s_server[128]
INTEGER i_prog_num
INTEGER i_prog_ver
STRING s_host[128]
INTEGER ia_value(4)
INTEGER i_return_value
#---------------------------------------------------------------------
# Start a program “rpc_test” in the back ground using the function
# utl_process_spawn(). This will act as the server. Set the program
# number to be 12345 and the version 1.
#
s_server = “rpc_test”
i_prog_num = 12345
i_prog_ver = 1

i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)

# The process ID of the server is


dump i_return_value

# Get the host name


utl_get_host_name(s_host)

dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )

dump i_return_value
#---------------------------------------------------------------------
Main Index
1732
Code Examples

# Put an integer array to the output stream (i.e. to the server)


#
ia_put_value = [1,2,3,4]
i_count = 4
i_return_value = @
rpc_put_int_array @
( i_handle, @
ia_put_value, @
i_count )
dump i_return_value
#---------------------------------------------------------------------
# Send the remote procedure call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
i_return_value = @
rpc_call @
( i_handle )

dump i_return_value

# Get the integer array from the input stream (i.e. from the server)
#
i_return_value = @
rpc_get_int_array @
( i_handle, @
ia_value, @
i_count )

dump i_return_value
dump ia_value
#---------------------------------------------------------------------

rpc_get_integer ()

# Purpose : This file provides an example of a call to the


# function rpc_get_integer()
#
# In this illustration, a server program
# “rpc_test” is started. The server is registered
# and initialised. Then an integer is sent to the
# server and same integer is got back from the
# server.
#
# Before running this file, run the script
# compile.rpc_test.script in the same platform
# where this file is supposed to run. The script
# will compile “rpc_test.c” and prepare an
# executable “rpc_test”. Copy the executable to
# the current working directory.
#
# 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 rpc_get_integer() has the following arguments:
#
# rpc_get_integer
# ( handle,
# value )
#---------------------------------------------------------------------
# Variable Declarations
STRING s_server[128]
INTEGER i_prog_num
INTEGER i_prog_ver
Main Index
CHAPTER 17 1733
Utilities

STRING s_host[128]
INTEGER i_handle
INTEGER i_put_value
INTEGER i_value
INTEGER i_return_value
#---------------------------------------------------------------------
# Start a program “rpc_test” in the back ground using the function
# utl_process_spawn(). This will act as the server. Set the program
# number to be 12345 and the version 1.
#
s_server = “rpc_test”
i_prog_num = 12345
i_prog_ver = 1

i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)

# The process ID of the server is


dump i_return_value

# Get the host name


utl_get_host_name(s_host)

dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )

dump i_return_value
#---------------------------------------------------------------------
# Put an integer value of 100 to the output stream (i.e. to the
# server)
#
i_put_value = 100
i_return_value = @
rpc_put_integer @
( i_handle, @
i_put_value )

dump i_return_value
#---------------------------------------------------------------------
# Send the remote procedure call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
i_return_value = @
rpc_call @
( i_handle )

dump i_return_value
Main Index
1734
Code Examples

# Get the integer from the input stream (i.e. from the server)
#
i_return_value = @
rpc_get_integer @
( i_handle, @
i_value )

dump i_return_value

# The value received from the server is


dump i_value
#---------------------------------------------------------------------

rpc_get_real ()

# Purpose : This file provides an example of a call to the


# function rpc_get_real()
#
# In this illustration, a server program
# “rpc_test” is started. The server is registered
# and initialised. Then a real is sent to the
# server and same real is got back from the
# server.
#
# Before running this file, run the script
# compile.rpc_test.script in the same platform
# where this file is supposed to run. The script
# will compile “rpc_test.c” and prepare an
# executable “rpc_test”. Copy the executable to
# the current working directory.
#
# 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 rpc_get_real() has the following arguments:
#
# rpc_get_real
# ( handle,
# value )
#---------------------------------------------------------------------
# Variable Declarations
STRING s_server[128]
INTEGER i_prog_num
INTEGER i_prog_ver
STRING s_host[128]
INTEGER i_handle
REAL r_put_value
REAL r_value
INTEGER i_return_value
#---------------------------------------------------------------------
# Start a program “rpc_test” in the back ground using the function
# utl_process_spawn(). This will act as the server. Set the program
# number to be 12345 and the version 1.
#
s_server = “rpc_test”
i_prog_num = 12345
i_prog_ver = 1

i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)

# The process ID of the server is


Main Index
CHAPTER 17 1735
Utilities

dump i_return_value

# Get the host name


utl_get_host_name(s_host)

dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )

dump i_return_value
#---------------------------------------------------------------------
# Put an integer value of 100 to the output stream (i.e. to the
# server)
#
r_put_value = 10.0
i_return_value = @
rpc_put_real @
( i_handle, @
r_put_value )

dump i_return_value
#---------------------------------------------------------------------
# Send the Remote Procedure Call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
i_return_value = @
rpc_call @
( i_handle )

dump i_return_value

# Get the integer from the input stream (i.e. from the server)
#
i_return_value = @
rpc_get_real @
( i_handle, @
r_value )

dump i_return_value
dump r_value
#---------------------------------------------------------------------

Main Index
1736
Code Examples

rpc_get_real_array ()

# Purpose : This file provides an example of a call to the


# function rpc_get_real_array()
#
# In this illustration, a server program
# “rpc_test” is started. The server is registered
# and initialised. Then a real array is sent
# to the server and same real array is got back
# from the server.
#
# Before running this file, run the script
# compile.rpc_test.script in the same platform
# where this file is supposed to run. The script
# will compile “rpc_test.c” and prepare an
# executable “rpc_test”. Copy the executable to
# the current working directory.
#
# 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 rpc_get_real_array() has the following arguments:
#
# rpc_get_real_array
# ( handle,
# value,
# count )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_handle
REAL ra_put_value(4)
INTEGER i_count
STRING s_server[128]
INTEGER i_prog_num
INTEGER i_prog_ver
STRING s_host[128]
REAL ra_value(4)
INTEGER i_return_value
#---------------------------------------------------------------------
# Start a program “rpc_test” in the back ground using the function
# utl_process_spawn(). This will act as the server. Set the program
# number to be 12345 and the version 1.
#
s_server = “rpc_test”
i_prog_num = 12345
i_prog_ver = 1

i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)

# The process ID of the server is


dump i_return_value

# Get the host name


utl_get_host_name(s_host)

dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
Main Index
CHAPTER 17 1737
Utilities

i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )

dump i_return_value
#---------------------------------------------------------------------
# Put a real array to the output stream (i.e. to the server)
#
ra_put_value = [100.0, 200.0, 300.0, 400.0]
i_count = 4
i_return_value = @
rpc_put_real_array @
( i_handle, @
ra_put_value, @
i_count )
dump i_return_value
#---------------------------------------------------------------------
# Send the remote procedure call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
i_return_value = @
rpc_call @
( i_handle )

dump i_return_value

# Get the real array from the input stream (i.e. from the server)
#
i_return_value = @
rpc_get_real_array @
( i_handle, @
ra_value, @
i_count )

dump i_return_value
dump ra_value
#---------------------------------------------------------------------

rpc_get_status ()

# Purpose : This file provides an example of a call to the


# function rpc_get_status()
#
# In this illustration, a server program
# “rpc_test” is started. The server is registered
# and initialised. Then a status value is sent to
# the server and same status value is got back
# from the server.
#
# Before running this file, run the script
# compile.rpc_test.script in the same platform
# where this file is supposed to run. The script
# will compile “rpc_test.c” and prepare an
Main Index
1738
Code Examples

# executable “rpc_test”. Copy the executable to


# the current working directory.
#
# 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 rpc_put_status() has the following arguments:
#
# rpc_get_status
# ( handle,
# value )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_server[128]
INTEGER i_prog_num
INTEGER i_prog_ver
STRING s_host[128]
INTEGER i_handle
INTEGER i_value
INTEGER i_put_value
INTEGER i_return_value
#---------------------------------------------------------------------
# Start a program “rpc_test” in the back ground using the function
# utl_process_spawn(). This will act as the server. Set the program
# number to be 12345 and the version 1.
#
s_server = “rpc_test”
i_prog_num = 12345
i_prog_ver = 1

i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)

# The process ID of the server is


dump i_return_value

# Get the host name


utl_get_host_name(s_host)

dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )

dump i_return_value
#---------------------------------------------------------------------
# Put a status value of 1 to the output stream (i.e. to the server)
Main Index
CHAPTER 17 1739
Utilities

#
i_put_value = 1
i_return_value = @
rpc_put_status @
( i_handle, @
i_put_value )

dump i_return_value
#---------------------------------------------------------------------
# Send the remote procedure call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
i_return_value = @
rpc_call @
( i_handle )

dump i_return_value

# Get the status value from the input stream (i.e. from the server)
#
i_return_value = @
rpc_get_status @
( i_handle, @
i_value )

dump i_return_value
dump i_value
#---------------------------------------------------------------------

rpc_get_string ()

# Purpose : This file provides an example of a call to the


# function rpc_get_string()
#
# In this illustration, a server program
# “rpc_test” is started. The server is registered
# and initialised. Then a string is sent to the
# server and same string is got back from the
# server.
#
# Before running this file, run the script
# compile.rpc_test.script in the same platform
# where this file is supposed to run. The script
# will compile “rpc_test.c” and prepare an
# executable “rpc_test”. Copy the executable to
# the current working directory.
#
# 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 rpc_get_string() has the following arguments:
#
# rpc_get_string
# ( handle,
# value )
#---------------------------------------------------------------------
# Variable Declarations
STRING s_server[128]
INTEGER i_prog_num
INTEGER i_prog_ver
STRING s_host[128]
INTEGER i_handle
STRING s_put_value[128]
Main Index
1740
Code Examples

STRING s_value[128]
INTEGER i_return_value
#---------------------------------------------------------------------
# Start a program “rpc_test” in the back ground using the function
# utl_process_spawn(). This will act as the server. Set the program
# number to be 12345 and the version 1.
#
s_server = “rpc_test”
i_prog_num = 12345
i_prog_ver = 1

i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)

# The process ID of the server is


dump i_return_value

# Get the host name


utl_get_host_name(s_host)

dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )

dump i_return_value
#---------------------------------------------------------------------
# Put a string “MSC.Patran” to the output stream ( i.e. to the
# server)
#
s_put_value = “MSC.Patran”
i_return_value = @
rpc_put_string @
( i_handle, @
s_put_value )

dump i_return_value
#---------------------------------------------------------------------
# Send the remote procedure call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
i_return_value = @
rpc_call @
( i_handle )

dump i_return_value

# Get the string from the input stream (i.e. from the server)
#
i_return_value = @
Main Index
CHAPTER 17 1741
Utilities

rpc_get_string @
( i_handle, @
s_value )
dump i_return_value

dump s_value
#---------------------------------------------------------------------

rpc_init_client ()

# Purpose : This file provides an example of a call to the


# function rpc_init_client()
#
# In this illustration, a server program
# “rpc_test” is started. The server is registered
# and initialised. Then an integer is sent to the
# server and same integer is got back from the
# server.
#
# Before running this file, run the script file
# compile.rpc_test.script in the same platform
# where this file is supposed to run. The script
# will compile “rpc_test.c” and prepare an
# executable “rpc_test”. Copy the executable to
# the current working directory.
#
# 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 rpc_init_client() has the following arguments:
#
# rpc_init_client
# ( server,
# handle )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_server[128]
INTEGER i_prog_num
INTEGER i_prog_ver
STRING s_host[128]
INTEGER i_handle
INTEGER i_value
INTEGER i_get_value
INTEGER i_return_value
#---------------------------------------------------------------------
# Start a program “rpc_test” in the back ground using the function
# utl_process_spawn(). This will act as the server. Set the program
# number to be 12345 and the version 1.
#
s_server = “rpc_test”
i_prog_num = 12345
i_prog_ver = 1

i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)

# The process ID of the server is


dump i_return_value

# Get the host name


utl_get_host_name(s_host)
Main Index
1742
Code Examples

dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )

dump i_return_value
#---------------------------------------------------------------------
# Put an integer value of 100 to the output stream (i.e. to the
# server)
#
i_value = 100
i_return_value = @
rpc_put_integer @
( i_handle, @
i_value )

dump i_return_value
#---------------------------------------------------------------------
# Send the remote procedure call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
i_return_value = @
rpc_call @
( i_handle )

dump i_return_value

# Get the integer from the input stream (i.e. from the server)

i_return_value = @
rpc_get_integer @
( i_handle, @
i_get_value )

dump i_return_value
dump i_get_value
#---------------------------------------------------------------------

rpc_inquire_count ()

# Purpose : This file provides an example of a call to the


# function rpc_inquire_count()
#
# In this illustration, a server program
# “rpc_test” is started. The server is registered
# and initialised. Then a string is sent to the
# server. Number of items in the input stream is
# is counted. Same string is got back from the
Main Index
CHAPTER 17 1743
Utilities

# server. Again the number of items in the input


# stream is counted.
#
# Before running this file, run the script
# compile.rpc_test.script in the same platform
# where this file is supposed to run. The script
# will compile “rpc_test.c” and prepare an
# executable “rpc_test”. Copy the executable to
# the current working directory.
#
# 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 rpc_inquire_count() has the following arguments:
#
# rpc_inquire_count
# ( handle,
# count )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_handle
INTEGER i_count
STRING s_server[128]
INTEGER i_prog_num
INTEGER i_prog_ver
STRING s_host[128]
INTEGER i_handle
STRING s_value[128]
STRING s_get_value[128]
INTEGER i_return_value
#---------------------------------------------------------------------
# Start a program “rpc_test” in the back ground using the function
# utl_process_spawn(). This will act as the server. Set the program
# number to be 12345 and the version 1.
#
s_server = “rpc_test”
i_prog_num = 12345
i_prog_ver = 1

i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)

# The process ID of the server is


dump i_return_value

# Get the host name


utl_get_host_name(s_host)

dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
Main Index
1744
Code Examples

#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )

dump i_return_value
#---------------------------------------------------------------------
# Put a string “MSC.Patran Welcomes” to the output stream ( i.e. to
# the server)
#
s_value = “MSC.Patran Welcomes”
i_return_value = @
rpc_put_string @
( i_handle, @
s_value )

dump i_return_value
#---------------------------------------------------------------------
# Send the remote procedure call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
i_return_value = @
rpc_call @
( i_handle )

dump i_return_value
#---------------------------------------------------------------------
# Determine how many items remain in the input stream.
i_return_value = @
rpc_inquire_count @
( i_handle, @
i_count )
dump i_return_value

# Number of items in the input stream


dump i_count
#---------------------------------------------------------------------
# Get the string from the input stream (i.e. from the server)
#
i_return_value = @
rpc_get_string @
( i_handle, @
s_get_value )
dump i_return_value
dump s_get_value

# Determine how many items remain in the input stream.


i_return_value = @
rpc_inquire_count @
( i_handle, @
i_count )
dump i_return_value
# Number of items in the input stream
dump i_count
#---------------------------------------------------------------------

rpc_inquire_item ()

# Purpose : This file provides an example of a call to the


# function rpc_inquire_item()
#
# In this illustration, a server program
# “rpc_test” is started. The server is registered
# and initialised. Then a string is sent to the
Main Index
CHAPTER 17 1745
Utilities

# server. Number of items in the input stream


# is counted. Same string is got back from the
# server.
#
# Before running this file, run the script
# compile.rpc_test.script in the same platform
# where this file is supposed to run. The script
# will compile “rpc_test.c” and prepare an
# executable “rpc_test”. Copy the executable to
# the current working directory.
#
# 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 rpc_inquire_item() has the following arguments:
#
# rpc_inquire_item
# ( handle,
# type,
# count )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_handle
INTEGER i_type
INTEGER i_count
STRING s_server[128]
INTEGER i_prog_num
INTEGER i_prog_ver
STRING s_host[128]
INTEGER i_handle
STRING s_value[128]
STRING s_get_value[128]
INTEGER i_return_value
#---------------------------------------------------------------------
# Start a program “rpc_test” in the back ground using the function
# utl_process_spawn(). This will act as the server. Set the program
# number to be 12345 and the version 1.
#
s_server = “rpc_test”
i_prog_num = 12345
i_prog_ver = 1

i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)

# The process ID of the server is


dump i_return_value

# Get the host name


utl_get_host_name(s_host)

dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
Main Index
1746
Code Examples

#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )

dump i_return_value
#---------------------------------------------------------------------
# Put strings “MSC.Patran Welcomes you” to the output stream
# ( i.e. to the server)
#
s_value = “MSC.Patran Welcomes you”
i_return_value = @
rpc_put_string @
( i_handle, @
s_value )

dump i_return_value
#---------------------------------------------------------------------
# Send the remote procedure call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
i_return_value = @
rpc_call @
( i_handle )

dump i_return_value
#---------------------------------------------------------------------
# Determine the type of data and the number of items in that type
# in the current input stream.
i_return_value = @
rpc_inquire_item @
( i_handle, @
i_type, @
i_count )
dump i_return_value

# Number of items in the input stream


dump i_count
# Type of data in the current list item
dump i_type
#---------------------------------------------------------------------
# Get the string from the input stream (i.e. from the server)
#
i_return_value = @
rpc_get_string @
( i_handle, @
s_get_value )
dump i_return_value
dump s_get_value
#---------------------------------------------------------------------

rpc_put_bool_array ()

# Purpose : This file provides an example of a call to the


# function rpc_put_bool_array()
#
# In this illustration, a server program
# “rpc_test” is started. The server is registered
# and initialised. Then a boolean array is sent
# to the server and same boolean array is got
# back from the server.
Main Index
CHAPTER 17 1747
Utilities

#
# Before running this file, run the script
# compile.rpc_test.script in the same platform
# where this file is supposed to run. The script
# will compile “rpc_test.c” and prepare an
# executable “rpc_test”. Copy the executable to
# the current working directory.
#
# 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 rpc_put_bool_array() has the following arguments:
#
# rpc_put_bool_array
# ( handle,
# value,
# count )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_handle
LOGICAL la_value(4)
INTEGER i_count
STRING s_server[128]
INTEGER i_prog_num
INTEGER i_prog_ver
STRING s_host[128]
LOGICAL la_get_value(4)
INTEGER i_return_value
#---------------------------------------------------------------------
# Start a program “rpc_test” in the back ground using the function
# utl_process_spawn(). This will act as the server. Set the program
# number to be 12345 and the version 1.
#
s_server = “rpc_test”
i_prog_num = 12345
i_prog_ver = 1

i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)

# The process ID of the server is


dump i_return_value

# Get the host name


utl_get_host_name(s_host)

dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
Main Index
1748
Code Examples

rpc_init_client @
( s_server, @
i_handle )

dump i_return_value
#---------------------------------------------------------------------
# Put a boolean array to the output stream (i.e. to the server)
#
la_value = [TRUE, FALSE, TRUE, FALSE]
i_count = 4
i_return_value = @
rpc_put_bool_array @
( i_handle, @
la_value, @
i_count )
dump i_return_value
#---------------------------------------------------------------------
# Send the remote procedure call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
i_return_value = @
rpc_call @
( i_handle )

dump i_return_value

# Get the boolean array from the input stream (i.e. from the server)
#
i_return_value = @
rpc_get_bool_array @
( i_handle, @
la_get_value, @
i_count )

dump i_return_value
dump la_get_value
#---------------------------------------------------------------------

rpc_put_boolean ()

# Purpose : This file provides an example of a call to the


# function rpc_put_boolean()
#
# In this illustration, a server program
# “rpc_test” is started.The server is registered
# and initialised.Then a boolean value is sent
# to the server and same boolean value is got
# back from the server.
#
# Before running this file, run the script
# compile.rpc_test.script in the same platform
# where this file is supposed to run. The script
# will compile “rpc_test.c” and prepare an
# executable “rpc_test”. Copy the executable to
# the current working directory.
#
# 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 rpc_put_boolean() has the following arguments:
#
# rpc_put_boolean
# ( handle,
Main Index
CHAPTER 17 1749
Utilities

# value )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_server[128]
INTEGER i_prog_num
INTEGER i_prog_ver
STRING s_host[128]
INTEGER i_handle
LOGICAL l_value
LOGICAL l_get_value
INTEGER i_return_value
#---------------------------------------------------------------------
# Start a program “rpc_test” in the back ground using the function
# utl_process_spawn(). This will act as the server. Set the program
# number to be 12345 and the version 1.
#
s_server = “rpc_test”
i_prog_num = 12345
i_prog_ver = 1

i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)

# The process ID of the server is


dump i_return_value

# Get the host name


utl_get_host_name(s_host)

dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )

dump i_return_value
#---------------------------------------------------------------------
# Put an boolean value of TRUE to the output stream (i.e. to the
# server)
#
l_value = TRUE
i_return_value = @
rpc_put_boolean @
( i_handle, @
l_value )
dump i_return_value
#---------------------------------------------------------------------
# Send the remote procedure call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
Main Index
1750
Code Examples

i_return_value = @
rpc_call @
( i_handle )

dump i_return_value

# Get the Boolean from the input stream (i.e. from the server)
#
i_return_value = @
rpc_get_boolean @
( i_handle, @
l_get_value )

dump i_return_value
dump l_get_value
#---------------------------------------------------------------------

rpc_put_command ()

# Purpose : This file provides an example of a call to the


# function rpc_put_command()
#
# In this illustration, a server program
# “rpc_test” is started. The server is registered
# and initialised. Then a command value is sent
# to the server and same command value is got
# back from the server.
#
# Before running this file, run the script
# compile.rpc_test.script in the same platform
# where this file is supposed to run. The script
# will compile “rpc_test.c” and prepare an
# executable “rpc_test”. Copy the executable to
# the current working directory.
#
# 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 rpc_put_command() has the following arguments:
#
# rpc_put_command
# ( handle,
# value )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_server[128]
INTEGER i_prog_num
INTEGER i_prog_ver
STRING s_host[128]
INTEGER i_handle
INTEGER i_value
INTEGER i_get_value
INTEGER i_return_value
#---------------------------------------------------------------------
# Start a program “rpc_test” in the back ground using the function
# utl_process_spawn(). This will act as the server. Set the program
# number to be 12345 and the version 1.
#
s_server = “rpc_test”
i_prog_num = 12345
i_prog_ver = 1
Main Index
CHAPTER 17 1751
Utilities

i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)

# The process ID of the server is


dump i_return_value

# Get the host name


utl_get_host_name(s_host)

dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )

dump i_return_value
#---------------------------------------------------------------------
# Put a command value of 4 to the output stream (i.e. to the server)
#
i_value = 4
i_return_value = @
rpc_put_command @
( i_handle, @
i_value )
dump i_return_value
#---------------------------------------------------------------------
# Send the remote procedure call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
i_return_value = @
rpc_call @
( i_handle )

dump i_return_value

# Get the command value from the input stream (i.e. from the server)
#
i_return_value = @
rpc_get_command @
( i_handle, @
i_get_value )

dump i_return_value
dump i_get_value
#---------------------------------------------------------------------

Main Index
1752
Code Examples

rpc_put_int_array ()

# Purpose : This file provides an example of a call to the


# function rpc_put_int_array()
#
# In this illustration, a server program
# “rpc_test” is started. The server is registered
# and initialised. Then an integer array is sent
# to the server and same integer array is got
# back from the server.
#
# Before running this file, run the script
# compile.rpc_test.script in the same platform
# where this file is supposed to run. The script
# will compile “rpc_test.c” and prepare an
# executable “rpc_test”. Copy the executable to
# the current working directory.
#
# 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 rpc_put_int_array() has the following arguments:
#
# rpc_put_int_array
# ( handle,
# value,
# count )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_handle
INTEGER ia_value(4)
INTEGER i_count
STRING s_server[128]
INTEGER i_prog_num
INTEGER i_prog_ver
STRING s_host[128]
INTEGER ia_get_value(4)
INTEGER i_return_value
#---------------------------------------------------------------------
# Start a program “rpc_test” in the back ground using the function
# utl_process_spawn(). This will act as the server. Set the program
# number to be 12345 and the version 1.
#
s_server = “rpc_test”
i_prog_num = 12345
i_prog_ver = 1

i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)

# The process ID of the server is


dump i_return_value

# Get the host name


utl_get_host_name(s_host)

dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
Main Index
CHAPTER 17 1753
Utilities

i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )

dump i_return_value
#---------------------------------------------------------------------
# Put an integer array to the output stream (i.e. to the server)
#
ia_value = [1,2,3,4]
i_count = 4
i_return_value = @
rpc_put_int_array @
( i_handle, @
ia_value, @
i_count )
dump i_return_value
#---------------------------------------------------------------------
# Send the remote procedure call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
i_return_value = @
rpc_call @
( i_handle )

dump i_return_value

# Get the integer array from the input stream (i.e. from the server)
#
i_return_value = @
rpc_get_int_array @
( i_handle, @
ia_get_value, @
i_count )

dump i_return_value
dump ia_get_value
#---------------------------------------------------------------------

rpc_put_integer ()

# Purpose : This file provides an example of a call to the


# function rpc_put_integer()
#
# In this illustration, a server program
# “rpc_test” is started. The server is registered
# and initialised. Then an integer is sent to the
# server and same integer is got back from the
# server.
#
# Before running this file, run the script
# compile.rpc_test.script in the same platform
# where this file is supposed to run. The script
# will compile “rpc_test.c” and prepare an
Main Index
1754
Code Examples

# executable “rpc_test”. Copy the executable to


# the current working directory.
#
# 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 rpc_put_integer() has the following arguments:
#
# rpc_put_integer
# ( handle,
# value )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_server[128]
INTEGER i_prog_num
INTEGER i_prog_ver
STRING s_host[128]
INTEGER i_handle
INTEGER i_value
INTEGER i_get_value
INTEGER i_return_value
#---------------------------------------------------------------------
# Start a program “rpc_test” in the back ground using the function
# utl_process_spawn(). This will act as the server. Set the program
# number to be 12345 and the version 1.
#
s_server = “rpc_test”
i_prog_num = 12345
i_prog_ver = 1

i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)

# The process ID of the server is


dump i_return_value

# Get the host name


utl_get_host_name(s_host)

dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )

dump i_return_value
#---------------------------------------------------------------------
# Put an integer value of 100 to the output stream (i.e. to the
Main Index
CHAPTER 17 1755
Utilities

# server)
#
i_value = 100
i_return_value = @
rpc_put_integer @
( i_handle, @
i_value )

dump i_return_value
#---------------------------------------------------------------------
# Send the remote procedure call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
i_return_value = @
rpc_call @
( i_handle )

dump i_return_value

# Get the integer from the input stream (i.e. from the server)
#
i_return_value = @
rpc_get_integer @
( i_handle, @
i_get_value )

dump i_return_value
dump i_get_value
#---------------------------------------------------------------------

rpc_put_real ()

# Purpose : This file provides an example of a call to the


# function rpc_put_real()
#
# In this illustration, a server program
# “rpc_test” is started. The server is registered
# and initialised. Then a real is sent to the
# server and same real is got back from the
# server.
#
# Before running this file, run the script
# compile.rpc_test.script in the same platform
# where this file is supposed to run. The script
# will compile “rpc_test.c” and prepare an
# executable “rpc_test”. Copy the executable to
# the current working directory.
#
# 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 rpc_put_real() has the following arguments:
#
# rpc_put_real
# ( handle,
# value )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_server[128]
INTEGER i_prog_num
INTEGER i_prog_ver
STRING s_host[128]
Main Index
1756
Code Examples

INTEGER i_handle
REAL r_value
REAL r_get_value
INTEGER i_return_value
#---------------------------------------------------------------------
# Start a program “rpc_test” in the back ground using the function
# utl_process_spawn(). This will act as the server. Set the program
# number to be 12345 and the version 1.
#
s_server = “rpc_test”
i_prog_num = 12345
i_prog_ver = 1

i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)

# The process ID of the server is


dump i_return_value

# Get the host name


utl_get_host_name(s_host)

dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )

dump i_return_value
#---------------------------------------------------------------------
# Put an integer value of 100 to the output stream (i.e. to the
# server)
#
r_value = 11.1
i_return_value = @
rpc_put_real @
( i_handle, @
r_value )

dump i_return_value
#---------------------------------------------------------------------
# Send the Remote Procedure Call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
i_return_value = @
rpc_call @
( i_handle )

dump i_return_value

# Get the integer from the input stream (i.e. from the server)
Main Index
CHAPTER 17 1757
Utilities

#
i_return_value = @
rpc_get_real @
( i_handle, @
r_get_value )

dump i_return_value
dump r_get_value
#---------------------------------------------------------------------

rpc_put_real_array ()

# Purpose : This file provides an example of a call to the


# function rpc_put_real_array()
#
# In this illustration, a server program
# “rpc_test” is started. The server is registered
# and initialised. Then a real array is sent
# to the server and same real array is got back
# from the server.
#
# Before running this file, run the script
# compile.rpc_test.script in the same platform
# where this file is supposed to run. The script
# will compile “rpc_test.c” and prepare an
# executable “rpc_test”. Copy the executable to
# the current working directory.
#
# 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 rpc_put_real_array() has the following arguments:
#
# rpc_put_real_array
# ( handle,
# value,
# count )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_handle
REAL ra_value(4)
INTEGER i_count
STRING s_server[128]
INTEGER i_prog_num
INTEGER i_prog_ver
STRING s_host[128]
REAL ra_get_value(4)
INTEGER i_return_value
#---------------------------------------------------------------------
# Start a program “rpc_test” in the back ground using the function
# utl_process_spawn(). This will act as the server. Set the program
# number to be 12345 and the version 1.
#
s_server = “rpc_test”
i_prog_num = 12345
i_prog_ver = 1

i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)

# The process ID of the server is


Main Index
1758
Code Examples

dump i_return_value

# Get the host name


utl_get_host_name(s_host)

dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )

dump i_return_value
#---------------------------------------------------------------------
# Put a real array to the output stream (i.e. to the server)
#
ra_value = [100.0, 200.0, 300.0, 400.0]
i_count = 4
i_return_value = @
rpc_put_real_array @
( i_handle, @
ra_value, @
i_count )
dump i_return_value
#---------------------------------------------------------------------
# Send the remote procedure call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
i_return_value = @
rpc_call @
( i_handle )

dump i_return_value

# Get the real array from the input stream (i.e. from the server)
#
i_return_value = @
rpc_get_real_array @
( i_handle, @
ra_get_value, @
i_count )

dump i_return_value
dump ra_get_value
#---------------------------------------------------------------------

Main Index
CHAPTER 17 1759
Utilities

rpc_put_status ()

# Purpose : This file provides an example of a call to the


# function rpc_put_status()
#
# In this illustration, a server program
# “rpc_test” is started. The server is registered
# and initialised. Then a status value is sent to
# the server and same status value is got back
# from the server.
#
# Before running this file, run the script
# compile.rpc_test.script in the same platform
# where this file is supposed to run. The script
# will compile “rpc_test.c” and prepare an
# executable “rpc_test”. Copy the executable to
# the current working directory.
#
# 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 rpc_put_status() has the following arguments:
#
# rpc_put_status
# ( handle,
# value )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_server[128]
INTEGER i_prog_num
INTEGER i_prog_ver
STRING s_host[128]
INTEGER i_handle
INTEGER i_value
INTEGER i_get_value
INTEGER i_return_value
#---------------------------------------------------------------------
# Start a program “rpc_test” in the back ground using the function
# utl_process_spawn(). This will act as the server. Set the program
# number to be 12345 and the version 1.
#
s_server = “rpc_test”
i_prog_num = 12345
i_prog_ver = 1

i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)

# The process ID of the server is


dump i_return_value

# Get the host name


utl_get_host_name(s_host)

dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
i_return_value = @
rpc_add_server @
Main Index
1760
Code Examples

( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )

dump i_return_value
#---------------------------------------------------------------------
# Put a status value of 1 to the output stream (i.e. to the server)
#
i_value = 1
i_return_value = @
rpc_put_status @
( i_handle, @
i_value )

dump i_return_value
#---------------------------------------------------------------------
# Send the remote procedure call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
i_return_value = @
rpc_call @
( i_handle )

dump i_return_value

# Get the status value from the input stream (i.e. from the server)
#
i_return_value = @
rpc_get_status @
( i_handle, @
i_get_value )

dump i_return_value
dump i_get_value
#---------------------------------------------------------------------

rpc_put_string ()

# Purpose : This file provides an example of a call to the


# function rpc_put_string()
#
# In this illustration, a server program
# “rpc_test” is started. The server is registered
# and initialised. Then a string is sent to the
# server and same string is got back from the
# server.
#
# Before running this file, run the script
# compile.rpc_test.script in the same platform
# where this file is supposed to run. The script
# will compile “rpc_test.c” and prepare an
# executable “rpc_test”. Copy the executable to
# the current working directory.
#
# This file can be run by starting a session of
Main Index
CHAPTER 17 1761
Utilities

# MSC.Patran and running this session file


# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function rpc_put_string() has the following arguments:
#
# rpc_put_string
# ( handle,
# value )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_server[128]
INTEGER i_prog_num
INTEGER i_prog_ver
STRING s_host[128]
INTEGER i_handle
STRING s_value[128]
STRING s_get_value[128]
INTEGER i_return_value
#---------------------------------------------------------------------
# Start a program “rpc_test” in the back ground using the function
# utl_process_spawn(). This will act as the server. Set the program
# number to be 12345 and the version 1.
#
s_server = “rpc_test”
i_prog_num = 12345
i_prog_ver = 1

i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)

# The process ID of the server is


dump i_return_value

# Get the host name


utl_get_host_name(s_host)

dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )

dump i_return_value
#---------------------------------------------------------------------
# Put a string “MSC.Patran” to the output stream ( i.e. to the
# server)
#
s_value = “MSC.Patran”
i_return_value = @
Main Index
1762
Code Examples

rpc_put_string @
( i_handle, @
s_value )

dump i_return_value
#---------------------------------------------------------------------
# Send the remote procedure call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
i_return_value = @
rpc_call @
( i_handle )

dump i_return_value

# Get the string from the input stream (i.e. from the server)
#
i_return_value = @
rpc_get_string @
( i_handle, @
s_get_value )
dump i_return_value

dump s_get_value
#---------------------------------------------------------------------

rpc_timeout ()

# Purpose : This file provides an example of a call to the


# function rpc_timeout()
#
# In this illustration, a server program
# “rpc_test” is started. The server is registered
# and initialised. Then rpc_timeout() is called.
#
# Before running this file, run the script
# compile.rpc_test.script in the same platform
# where this file is supposed to run. The script
# will compile “rpc_test.c” and prepare an
# executable “rpc_test”. Copy the executable to
# the current working directory.
#
# 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 rpc_timeout() has the following arguments:
#
# rpc_timeout
# ( handle,
# seconds )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_handle
INTEGER i_seconds
STRING s_server[128]
INTEGER i_prog_num
INTEGER i_prog_ver
STRING s_host[128]
LOGICAL l_return_value
INTEGER i_return_value
#---------------------------------------------------------------------
# Start a program “rpc_test” in the back ground using the function
Main Index
CHAPTER 17 1763
Utilities

# utl_process_spawn(). This will act as the server. Set the program


# number to be 12345 and the version 1.
#
s_server = “rpc_test”
i_prog_num = 12345
i_prog_ver = 1

i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)

# The process ID of the server is


dump i_return_value

# Get the host name


utl_get_host_name(s_host)

dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )

dump i_return_value
#---------------------------------------------------------------------
# Call the function to change the amount of time before all
# subsequent rpc calls will timeout.
#
l_return_value = @
rpc_timeout @
( i_handle, @
i_seconds )
dump l_return_value
#---------------------------------------------------------------------

string_newline_count ()

# Purpose : This file provides an example of a call to the


# function string_newline_count()
#
# This function counts the lines in a string.
# This file defines a string and formats it
# to contain four new line characters.Later
# it counts the number of lines in the string.
#
# 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.
#
Main Index
1764
Code Examples

# The function string_newline_count() has the following arguments:


#
# string_newline_count
# ( chars,
# nl )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_chars[128]
INTEGER i_nl
STRING s_new[128]
INTEGER ia_i(1)
REAL ra_r(1)
STRING s_s[1]
#---------------------------------------------------------------------
# s_new = “Geometric %N% Software %N% Services %N% Limited %N%”
s_new = “Geometric %N% Software %N% Services %N% Limited %N%”

# Format the string s_new to contain four newline characters.


string_write(s_new,ia_i,ra_r,s_s,s_chars)

# Call xf_write_stdout() to dump the formatted string in standard


# output. Note that there are four lines.
xf_write_stdout( s_chars )

string_newline_count @
( s_chars, @
i_nl )

# The number of lines are


dump i_nl
#---------------------------------------------------------------------

string_newline_position ()

# Purpose : This file provides an example of a call to the


# function string_newline_position()
#
# This function stores the new line locations
# in a string. This file defines a string and
# formats it to contain four new line characters.
# Later it counts the number of lines in the
# string.Finally it gets the position of these
# newline characters.
#
# 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 string_newline_position()
# has the following arguments:
#
# string_newline_position
# ( chars,
# pos )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_chars[128]
INTEGER iv_pos(VIRTUAL)
INTEGER i_nl
STRING s_new[128]
INTEGER ia_i(1)
REAL ra_r(1)
Main Index
CHAPTER 17 1765
Utilities

STRING s_s[1]
#---------------------------------------------------------------------
# s_new = “Geometric %N% Software %N% Services %N% Limited %N%”
s_new = “Geometric %N% Software %N% Services %N% Limited %N%”

# Format the string s_new to contain four newline characters.


string_write(s_new,ia_i,ra_r,s_s,s_chars)

# Call xf_write_stdout() to dump the formatted string in standard


# output. Note that there are four lines.
xf_write_stdout( s_chars )

string_newline_count @
( s_chars, @
i_nl )

# The number of new lines are


dump i_nl

SYS_ALLOCATE_ARRAY(iv_pos,1,i_nl)

string_newline_position @
( s_chars, @
iv_pos )

# The position of the newline characters are


dump iv_pos

SYS_FREE_ARRAY(iv_pos)
#---------------------------------------------------------------------

timer_off ()

# Purpose : This file provides an example of a call to the


# function timer_off()
#
# This function stops timer and reports the
# time to the xterm since last call to the
# the function timer_on().This file starts the
# timer and pauses for the user interaction.
# Finally it stops the timer and reports time
# to the xterm.
#
# 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 timer_off() has no arguments.
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_return_value
#---------------------------------------------------------------------
# Start the timer.
timer_on()

# Elapse some time.


# Session file paused. Press “Resume” to continue..
sf_pause()

# Stop the timer and report time to xterm.


i_return_value = timer_off()

# Accumulated CPU time elapsed for all calls to


Main Index
1766
Code Examples

# timer_on() and timer_off() during the session.


dump i_return_value
#---------------------------------------------------------------------

timer_on ()

# Purpose : This file provides an example of a call to the


# function timer_on()
#
# This function starts the timer.This file
# starts the timer and pauses for the user
# interaction.Finally it stops the timer and
# reports time to the xterm using the function
# timer_off().
#
# 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 timer_on() has no arguments.
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_return_value
#---------------------------------------------------------------------
# Start the timer.
timer_on()

# Elapse some time.


# Session file paused. Press “Resume” to continue..
sf_pause()

# Stop the timer and report time to xterm.


i_return_value = timer_off()

# Accumulated CPU time elapsed for all calls to


# timer_on() and timer_off() during the session.
dump i_return_value
#---------------------------------------------------------------------

uil_list_union_expr ()

# Purpose : This file provides an example of a call to the


# function uil_list_union_expr()
#
# This function updates two input strings
# returning unique combined string.
#
# 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 uil_list_union_expr()
# has the following arguments:
#
# uil_list_union_expr
# ( operator,
# in_string_1,
# in_string_2,
# out_string )
#
Main Index
CHAPTER 17 1767
Utilities

#---------------------------------------------------------------------
# Variable Declarations
STRING s_operator[5]
STRING s_in_string_1[32]
STRING s_in_string_2[32]
STRING s_out_string[VIRTUAL]
INTEGER i_return_value
#---------------------------------------------------------------------
# Adding two lists of surfaces.

s_operator = "A"
s_in_string_1 = "Surface 1:4"
s_in_string_2 = "Surface 3:7"

i_return_value = uil_list_union_expr @
( s_operator, @
s_in_string_1, @
s_in_string_2, @
s_out_string )
dump s_out_string
dump i_return_value
#---------------------------------------------------------------------
# Subracting one surface list from the other.

s_operator = "R"
s_in_string_1 = "Surface 1:4"
s_in_string_2 = "Surface 3"

i_return_value = uil_list_union_expr @
( s_operator, @
s_in_string_1, @
s_in_string_2, @
s_out_string )
dump s_out_string
dump i_return_value
#---------------------------------------------------------------------
# Removes repeated numbers from a list.

s_operator = "C"
s_in_string_1 = "Surface 1:4 2"
s_in_string_2 = ""

i_return_value = uil_list_union_expr @
( s_operator, @
s_in_string_1, @
s_in_string_2, @
s_out_string )
dump s_out_string
dump i_return_value
#---------------------------------------------------------------------

util_equal_real ()

# Purpose : This file provides an example of two calls


# to the function util_equal_real()
#
# This function determines whether two real
# numbers are equal upto a specified significant
# number of digits.This file checks for a set
# of real values with different significant
# digits.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
Main Index
1768
Code Examples

# menus on the menu bar.


#
# The function util_equal_real() has the following arguments:
#
# util_equal_real
# ( a,
# b,
# nsig )
#
#---------------------------------------------------------------------
# Variable Declarations
REAL r_a
REAL r_b
INTEGER i_nsig
LOGICAL l_return_value
#---------------------------------------------------------------------
# r_a = 202.1234
r_a = 202.1234
# r_b = 202.1235
r_b = 202.1235

# Check with significant digits = 6


i_nsig = 6
l_return_value = @
util_equal_real @
( r_a, @
r_b, @
i_nsig )
dump l_return_value

# Check with significant digits = 7


i_nsig = 7
l_return_value = @
util_equal_real @
( r_a, @
r_b, @
i_nsig )
dump l_return_value

# r_a = 202.1236
r_a = 202.1236
# r_b = 202.123
r_b = 202.123

# Check with significant digits = 5


i_nsig = 5
l_return_value = @
util_equal_real @
( r_a, @
r_b, @
i_nsig )
dump l_return_value

# Check with significant digits = 6


i_nsig = 6
l_return_value = @
util_equal_real @
( r_a, @
r_b, @
i_nsig )
dump l_return_value

#---------------------------------------------------------------------

Main Index
CHAPTER 17 1769
Utilities

util_real_equal_null ()

# Purpose : This file provides an example of two calls


# to the function util_real_equal_null()
#
# This function tests if a real value is Null.
# It returns a TRUE value if the input value
# is Null.This file gets the Null value using
# the function array_real_fill_null() and tests
# this value using the above function.Later it
# tests the value 202.54 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 util_real_equal_null()
# has the following arguments:
#
# util_real_equal_null
# ( val )
#
#---------------------------------------------------------------------
# Variable Declarations
REAL r_val
REAL ra_val(1)
LOGICAL l_return_value
#---------------------------------------------------------------------
# Get the NULL value
array_real_fill_null(ra_val,1)
r_val = ra_val(1)
# The Null value is
dump r_val

# Check the return value for real value = Null


l_return_value = @
util_real_equal_null @
( r_val )
dump l_return_value

# Check the return value for real value = 202.54


r_val = 202.54
l_return_value = @
util_real_equal_null @
( r_val )
dump l_return_value
#---------------------------------------------------------------------

util_rounder ()

# Purpose : This file provides an example of two calls


# to the function util_rounder()
#
# This function rounds off a given real number
# to a specified number of significant digits.
# In this file, two real values are rounded off
# to five significant digits.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
Main Index
1770
Code Examples

# menus on the menu bar.


#
# The function util_rounder() has the following arguments:
#
# util_rounder
# ( rval,
# nsigd,
# rout )
#
#---------------------------------------------------------------------
# Variable Declarations
REAL r_rval
INTEGER i_nsigd
REAL r_rout
INTEGER i_return_value
#---------------------------------------------------------------------
# i_nsigd = 5
i_nsigd = 5
# r_rval = 202.123
r_rval = 202.123

i_return_value = @
util_rounder @
( r_rval, @
i_nsigd, @
r_rout )
dump i_return_value

# The rounded value of 202.123 upto 5 significant digits is


dump r_rout

# r_rval = 202.125
r_rval = 202.125

i_return_value = @
util_rounder @
( r_rval, @
i_nsigd, @
r_rout )
dump i_return_value

# The rounded value of 202.125 upto 5 significant digits is


dump r_rout
#---------------------------------------------------------------------

Main Index
MSC.Acumen, Volume 2: Code Examples

CHAPTER
Support Files
18
■ Introduction

Main Index
1772
Code Examples

18.1 Introduction
This chapter provides session, pcl, and other files used to support the example code listed in this
manual. Each of these files is designed so that the file listing can be placed in a text file using cut
and past operations. The support code session files list instructions in comments that can be
followed to create the database or other files needed by the examples.
Read the comments in the supporting files and the example file comments and code closely to
understand how these files work together.

#---------------------------------------------------------------------
# File : fem1.ses
#
# Purpose : This file will generate a PATRAN database
# “fem1.db” which consists of a solid of Al
# with 16 Hexa elements, 45 nodes, 2 LBC’s.
#
# 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.
#
#---------------------------------------------------------------------
# Create a new database.
uil_file_new.go( ““, “./fem1.db” )
$? YES 36000002
#---------------------------------------------------------------------
# Create a Hyper patch using XYZ method
STRING asm_create_hpat_xyz_created_ids[VIRTUAL]
asm_const_hpat_xyz( “1”, “<2 1 1>”, “[0 0 0]”, “Coord 0”, @
asm_create_hpat_xyz_created_ids )
#---------------------------------------------------------------------
# Create a material “Al”
material.create( “Analysis code ID”, 1, “Analysis type ID”, @
1, “Al”, 0, “Date: 26-Jun-97 Time: 12:02:50”, @
“Isotropic”, 1, “Directionality”, @
1, “Linearity”, 1, “Homogeneous”, 0, “Linear Elastic”, @
1, “Model Options & IDs”, [““, ““, ““, ““, ““], @
[0, 0, 0, 0, 0], “Active Flag”, @
1, “Create”, 10, “External Flag”, FALSE, “Property IDs”, @
[“Elastic Modulus”, “Poisson Ratio”], [2, 5, 0], @
“Property Values”, [“7.1E10”, “0.3”, ““] )
#---------------------------------------------------------------------
# Create a property set “new_prop”
elementprops_create( “new_prop”, 71, 25, 30, 1, 1, 20, @
[13, 21, 4124, 4126, 4125], [5, 4, 4, 4, 4], @
[“m:Al”, ““, ““, ““, ““], “Solid 1” )
#---------------------------------------------------------------------
# Create a mesh by creating a mesh seed and then meshing it.
mesh_seed_create( “Solid 1.2.1 1.2.2 1.2.3 1.2.4 1.3.2”// @
“ 1.4.2 1.5.3 1.6.3 1.1.1 1.1.2 1.1.3 1.1.4 1.3.4 1.4.4”// @
“ 1.5.1 1.6.1 “, 1, 2, 0., 0., 0. )
mesh_seed_create( “Solid 1.4.1 1.4.3 1.3.3 1.3.1 “, @
1, 4, 0., 0., 0. )
mesh_seed_display_mgr.erase( )
INTEGER fem_create_mesh_solid_num_nodes
INTEGER fem_create_mesh_solid_num_elems
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]
fem_create_mesh_sol_3( “IsoMesh”, 0, “Solid 1 “, 1, [0.1], @
“Hex8”, “1”, “1”,”Coord 0”, “Coord 0”, @
fem_create_mesh_solid_num_nodes, @
fem_create_mesh_solid_num_elems, @
fem_create_mesh_s_nodes_created, @
Main Index
CHAPTER 18 1773
Support Files

fem_create_mesh_s_elems_created )
mesh_seed_display_mgr.erase( )
#---------------------------------------------------------------------
# Create a Boundary Condition
loadsbcs_create( “new_lbc”, “Displacement”, “Nodal”, @
““, “Static”, [“Solid 1.1”], “Geometry”, “Coord 0”, 1., @
[“< 0 0 0 >”, “< 0 0 0 >”], [““, ““] )
#---------------------------------------------------------------------
# Create a Load
loadsbcs_create( “new_load”, “Displacement”, @
“Element Uniform”, “3D”, “Static”, @
[“Element 4:16:4.4”], “FEM”, “Coord 0”, 1., @
[“< 0.1 0 0 >”], [““] )
#---------------------------------------------------------------------
ga_view_aa_set(-67.,0.,-34.)
#---------------------------------------------------------------------
# End of File

#---------------------------------------------------------------------
# File : fem2.ses
#
# Purpose : This file will generate a PATRAN database
# “fem2.db” which consists of 32 Quad Elements,
# 1 MPC ( Which consists of 3 Sub-MPCs ), 2
# LBCs.
#
# 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.
#---------------------------------------------------------------------
# Create a New database.
uil_file_new.go( ““, “./fem2.db” )
$? YES 36000002
#---------------------------------------------------------------------
# Create 4 Points.
STRING asm_create_grid_xyz_created_ids[VIRTUAL]
asm_const_grid_xyz( ““, “[0 0 0] [10 0 0] [10 3 0] [0 3 0]”, @
“Coord 0”, asm_create_grid_xyz_created_ids )
#---------------------------------------------------------------------
# Transform Point 1:4 to create 4 more points.
STRING sgm_transform_point_created_ids[VIRTUAL]
asm_transform_grid_translate( “5”, “<10 0 -1>”, “Coord 0”, @
1, FALSE, FALSE,”Point 1:4 “, @
sgm_transform_point_created_ids )
#---------------------------------------------------------------------
# Create 4 Lines.
STRING asm_line_2point_created_ids[VIRTUAL]
asm_const_line_2point( “1”, “Point 1 “, “Point 4 “, 0, ““, @
50., 1, asm_line_2point_created_ids )
asm_const_line_2point( “2”, “Point 2 “, “Point 3 “, 0, ““, @
50., 1, asm_line_2point_created_ids )
asm_const_line_2point( “3”, “Point 5 “, “Point 8 “, 0, ““, @
50., 1, asm_line_2point_created_ids )
asm_const_line_2point( “4”, “Point 6 “, “Point 7 “, 0, ““, @
50., 1, asm_line_2point_created_ids )
#---------------------------------------------------------------------
# Create 2 Surfaces.
STRING sgm_surface_2curve_created_ids[VIRTUAL]
sgm_const_surface_2curve( “1”, “Curve 1 “, “Curve 2 “, @
sgm_surface_2curve_created_ids )
sgm_const_surface_2curve( “2”, “Curve 3 “, “Curve 4 “, @
sgm_surface_2curve_created_ids )
#---------------------------------------------------------------------
# Create Mesh Seeds.
mesh_seed_create( “Curve 1:4 “, 1, 2, 0., 0., 0. )
Main Index
1774
Code Examples

mesh_seed_create( “Surface 1.1 1.3 2.1 2.3 “, 1, 8, @


0., 0., 0. )
#---------------------------------------------------------------------
# Mesh the Surface 1:2 with Quad elements.
INTEGER fem_create_mesh_surfa_num_nodes
INTEGER fem_create_mesh_surfa_num_elems
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]
fem_create_mesh_surf_2( “IsoMesh”, 0, “Surface 1 2 “, @
1, [0.1], “Quad4”, “1”, “1”, “Coord 0”, “Coord 0”, @
fem_create_mesh_surfa_num_nodes, @
fem_create_mesh_surfa_num_elems, @
fem_create_mesh_s_nodes_created, @
fem_create_mesh_s_elems_created )
#---------------------------------------------------------------------
# Create an Explicit MPC with ID 1. Dependent Nodes are Node 25:27
# and Independent nodes are Node 28:30
fem_create_mpc_nodal( 1, “Explicit”, 2., 2, [TRUE, FALSE], @
[0., 1.], [“Node 25:27”, “Node 28:30”], [“UX”, “UX”] )
#---------------------------------------------------------------------
# Create 2 LBCs
loadsbcs_create( “new_bc”, “Displacement”, “Nodal”, ““, @
“Static”, [“Node 1:3”],”FEM”, “Coord 0”, 1., @
[“< 0 0 0 >”, “< 0 0 0 >”], [““, ““] )
loadsbcs_create( “load”, “Force”, “Nodal”, ““, “Static”, @
[“Node 52:54”], “FEM” , “Coord 0”, 1., [“< 10 0 0 >”, @
“< 0 0 0 >”], [““, ““] )
#---------------------------------------------------------------------
# Set the view.
ga_view_aa_set( -67., 0., -34. )
#---------------------------------------------------------------------

#---------------------------------------------------------------------
# File : fem3.ses
#
# Purpose : This file will generate a PATRAN database
# “fem3.db” which consists of 9 Quad elements,
# 2 LBCs, 1 MPC, 21 nodes , a surface and
# 2 lines on that surface. It also contains
# 2 groups. The group “new” contains 4 un-referenced
# nodes.
#
# 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.
#
#---------------------------------------------------------------------
# Create new database “fem3.db”
uil_file_new.go( ““, “./fem3.db” )
$? YES 36000002
#---------------------------------------------------------------------
# Create 4 points
STRING asm_create_grid_xyz_created_ids[VIRTUAL]
asm_const_grid_xyz( ““, “[0 0 0][10 0 0][10 10 0][0 10 0]”, @
“Coord 0”, asm_create_grid_xyz_created_ids )
uil_toolbar.labels_on( )
#---------------------------------------------------------------------
# Create 2 lines
STRING asm_line_2point_created_ids[VIRTUAL]
asm_const_line_2point( “1”, “Point 4 “, “Point 1 “, 0, ““, @
50., 1, asm_line_2point_created_ids )
asm_const_line_2point( “2”, “Point 3 “, “Point 2 “, 0, ““, @
50., 1, asm_line_2point_created_ids )
#---------------------------------------------------------------------
# Create 1 Surface
Main Index
CHAPTER 18 1775
Support Files

STRING sgm_surface_2curve_created_ids[VIRTUAL]
sgm_const_surface_2curve( “1”, “Curve 1 “, “Curve 2 “, @
sgm_surface_2curve_created_ids )
#---------------------------------------------------------------------
# Create mesh seed
ui_exec_function( “mesh_seed_display_mgr”, “init” )
mesh_seed_create( “Curve 1 Surface 1.1 Curve 2 Surface 1.3 “, @
1, 3, 0., 0., 0. )
#---------------------------------------------------------------------
# Mesh the surface with Quad elements
INTEGER fem_create_mesh_surfa_num_nodes
INTEGER fem_create_mesh_surfa_num_elems
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]
fem_create_mesh_surf_2( “IsoMesh”, 0, “Surface 1 “, 1, @
[0.1], “Quad4”, “1”, “1”, “Coord 0”, “Coord 0”, @
fem_create_mesh_surfa_num_nodes, @
fem_create_mesh_surfa_num_elems, @
fem_create_mesh_s_nodes_created, @
fem_create_mesh_s_elems_created )
#---------------------------------------------------------------------
# Create a node at the center
STRING fem_create_nodes__nodes_created[VIRTUAL]
fem_create_nodes( “Coord 0”, “Coord 0”, FALSE, “17”, @
“ [5 5 0]”, fem_create_nodes__nodes_created )
#---------------------------------------------------------------------
# Create 4 more nodes which are unreferenced.
fem_create_nodes( “Coord 0”, “Coord 0”, FALSE, “18 19 20 21”, @
“[5 0 0][10 5 0][0 5 0][5 10 0]”, @
fem_create_nodes__nodes_created )
#---------------------------------------------------------------------
# Create a new group “new” with 4 nodes in it.
ga_group_create( “new” )
ga_group_entity_add( “new”, “Node 18:21” )
ga_group_current_set( “new” )
#---------------------------------------------------------------------
# Create 2 Load/BCs
loadsbcs_create( “BC1”, “Displacement”, “Nodal”, ““, @
“Static”, [“Node 1 4 13 16”], “FEM”, “Coord 0”, 1., @
[“< 0 0 0 >”, “< 0 0 0 >”], [““, ““] )
loadsbcs_create( “Load1”, “Force”, “Nodal”, ““, “Static”, @
[“Node 17”], “FEM”, “Coord 0”, 1., [“< 0 0 -10 >”, @
“< 0 0 0 >”], [““, ““] )
#---------------------------------------------------------------------
# Create a MPC
fem_create_mpc_nodal( 1, “Rigid (Fixed)”, 0., 2, @
[TRUE, FALSE], [0., 0.], @
[“Node 6 7 11 10”, “Node 17”], [““, ““] )
#---------------------------------------------------------------------
# Set view
ga_view_aa_set( -67., 0., -34. )
#---------------------------------------------------------------------

#---------------------------------------------------------------------
# File : field.ses
#
# Purpose : This file will generate a PATRAN database
# “field.db” which consists of a surface meshed using
# QUAD4 elements. The plate held from four sides and
# is loaded at the center. The model has “MSC.Nastran”
# as analysis preference. Analysis results will be
# imported for the same. The session execution will be
# paused, user should get the analysis results using
# MSC.Nastran before pressing ‘RESUME’ button.
#
# This file can be run by starting a session of
Main Index
1776
Code Examples

# MSC.Patran, and running this session file


# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# Model : The plate is a square of unit 1.
#
# The model consists of
# * -100000 unit force at the four central nodes.
# * Job name ‘field1’- is generated using one load
# case ‘Default’
#
# Analysis & While running this session file, ‘field1.bdf’ file
# Results : is generated. User will have to use MSC.Nastran to
# analyse this file and get ‘field1.op2’ file. The
# session execution will be paused, user should get
# the analysis results before pressing ‘RESUME’ button
#---------------------------------------------------------------------
# Create a new database and set the preferences
uil_file_new.go(““, “./field.db”)
$? YES 36000002
#---------------------------------------------------------------------
# Creating a Hpat surface.
STRING asm_create_patch_xy_created_ids[VIRTUAL]
asm_const_patch_xyz( “1”, “<1 1 0>”, “[0 0 0]”, “Coord 0”, @
asm_create_patch_xy_created_ids )
#---------------------------------------------------------------------
# Meshing the field with QUAD4 elements.
ui_exec_function( “mesh_seed_display_mgr”, “init” )
INTEGER fem_create_mesh_surfa_num_nodes
INTEGER fem_create_mesh_surfa_num_elems
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]
fem_create_mesh_surf_2( “IsoMesh”, 0, “Surface 1 “, 1, [0.2],”Quad4”,@
“1”, “1”, “Coord 0”, “Coord 0”, fem_create_mesh_surfa_num_nodes, @
fem_create_mesh_surfa_num_elems, fem_create_mesh_s_nodes_created, @
fem_create_mesh_s_elems_created )
mesh_seed_display_mgr.erase( )
#---------------------------------------------------------------------
# Creating BC set “fix” to fix the field edges.
loadsbcs_create( “fix”, “Displacement”, “Nodal”, ““, “Static”, [ @
“Surface 1.1 1.2 1.3 1.4”], “Geometry”, “Coord 0”, 1.,[“<0 0 0 >”,@
“< 0 0 0 >”], [““, ““] )
# Creating Load set “point” to load the field at the four nodes.
loadsbcs_create( “point”, “Force”, “Nodal”, ““, “Static”, @
[“Node 15 16 21 22”] , “FEM”, “Coord 0”, 1., [“< 0 0 -100000 >”,@
“< >”], [““, ““] )
#---------------------------------------------------------------------
# Isotropic material “iso” created.
material.create( “Analysis code ID”, 1, “Analysis type ID”, 1, “iso”,@
0,”Date: 09-Jul-97 Time: 16:23:14”,”Isotropic”,1,”Directionality”,@
1, “Linearity”, 1, “Homogeneous”, 0, “Linear Elastic”, 1, @
“Model Options & IDs”, [““, ““, ““, ““, ““], [0, 0, 0, 0, 0], @
“Active Flag”, 1,”Create”,10,”External Flag”,FALSE,”Property IDs”,@
[“Elastic Modulus”, “Poisson Ratio”],[2, 5, 0],”Property Values”,@
[“2e11”, “.35”, ““] )
#---------------------------------------------------------------------
# Element properties “metal” created.
elementprops_create( “metal”, 51, 25, 35, 1, 1, 20,[13, 20, 36, 4037,@
4111, 4118, 4119],[5, 9, 1, 1, 1, 1, 1],[“m:iso”,””, “.1”, ““, ““,@
““, ““], “Surface 1” )
#---------------------------------------------------------------------
# Load cases “Default” is created.
loadcase_create( “Default”, “Static”, @
“This load case is the default load case that always appears”, @
[“fix”, “point”], [0, 0], ““, 0., TRUE )
$? YES 3001002
#---------------------------------------------------------------------
Main Index
CHAPTER 18 1777
Support Files

# Creating job “field1”.


jobfile.open( “field1”, “ANALYZE NO JOBFILE” )
msc_delete_old_files( “field1”, “.bdf”, “.op2” )
$? YES 6022037
jobfile.write_spl( “/* Jobfile for PATNAS created %A% at %A% */”, @
[“09-Jul-97” , “16:47:22”] )
jobfile.writec( ““, “TRANSLATOR = pat3nas” )
jobfile.writec( “DATABASE”, “./field.db” )
jobfile.writec( “JOBNAME”, “field1” )
jobfile.writec( “ANALYSIS TITLE”, @
“MSC.Nastran job created on 09-Jul-97 at 16:24:30” )
jobfile.writec( ““, ““ )
jobfile.writec( “OBJECT”, “Entire Model” )
jobfile.writec( “METHOD”, “Full Run” )
jobfile.writec( ““, ““ )
jobfile.writec( “MODEL SUFFIX”, “.bdf” )
jobfile.writec( “RESULTS SUFFIX”, “.op2” )
jobfile.writec( ““, ““ )
jobfile.writec( ““, “/*” )
jobfile.writec( ““, “ * Translation Parameters” )
jobfile.writec( ““, “ */” )
jobfile.writec( ““, ““ )
jobfile.writec( “DATA OUTPUT”, “OP2 and Print” )
jobfile.writec( “OUTPUT2 REQUESTS”, “MSC.Patran Built In” )
jobfile.writec( “OUTPUT2 FORMAT”, “Text” )
jobfile.writec( “DIVISION TOLERANCE”, “1.0e-08” )
jobfile.writec( “NUMERICAL TOLERANCE”, “1.0e-04” )
jobfile.writec( “MODEL TOLERANCE”, “0.0049999999” )
jobfile.writec( “WRITING TOLERANCE”, “1.0e-20” )
jobfile.writec( “CARD FORMAT”, “either” )
jobfile.writec( “MINIMUM SIGNIF. DIGITS”, “4” )
jobfile.writec( “NODE COORDINATES”, “reference frame” )
jobfile.writec( “MSC.Nastran VERSION”, “69” )
jobfile.writec( “PROPS ON ELEM ENTRY”, “FALSE” )
jobfile.writec( “ELEMENT PROPERTY OFFSET”, “0” )
jobfile.writec( “MATERIAL PROPERTY OFFSET”, “0” )
jobfile.writec( “TABLE OFFSET”, “0” )
jobfile.writec( “LOAD SET OFFSET”, “0” )
jobfile.writec( “LOAD CASE OFFSET”, “0” )
jobfile.writec( “CONTROL SET OFFSET”, “0” )
jobfile.writec( “RIGID ELEMENT OFFSET”, “0” )
jobfile.writec( “SCALAR POINT OFFSET”, “0” )
jobfile.writec( “BEGINNING CONTINUATION MARKER”, “+ A” )
jobfile.writec( “NUMBER ONLY”, “ON” )
jobfile.writec( “BEGINNING NUMBER”, “OFF” )
jobfile.writec( “TRAILING NUMBER”, “OFF” )
jobfile.writec( “SYNTAX NUMBER”, “ON” )
jobfile.writec( “SYNTAX MARKER”, “.” )
jobfile.writec( ““, ““ )
jobfile.writec( ““, “/*” )
jobfile.writec( ““, “ * Solution Parameters” )
jobfile.writec( ““, “ */” )
jobfile.writec( ““, ““ )
jobfile.writec( “SOLUTION TYPE”, “LINEAR STATIC” )
jobfile.writei( “SOLUTION SEQUENCE”, 101 )
jobfile.writec( “DATABASE RUN”, “ON” )
jobfile.writec( “CYCLIC SYMMETRY”, “OFF” )
jobfile.writec( “AUTOMATIC CONSTRAINTS”, “ON” )
jobfile.writec( “INERTIA RELIEF”, “OFF” )
jobfile.writec( “ALTERNATE REDUCTION”, “OFF” )
jobfile.writec( “MASS CALCULATION”, “Lumped” )
jobfile.writec( “DATA DECK ECHO”, “None” )
jobfile.writec( “PLATE RZ STIFFNESS FACTOR”, “0.0” )
jobfile.writec( “MAXIMUM PRINTED LINES”, “999999999” )
jobfile.writec( “MAXIMUM RUN TIME”, “600” )
jobfile.writec( “WT-MASS CONVERSION”, “1.0” )
jobfile.writec( “NODE ID FOR WT-GENER”, ““ )
Main Index
1778
Code Examples

jobfile.writec( “FMS WRITE”, “ON” )


jobfile.writei( “FMS INPUT 0”, 0 )
jobfile.writec( “EXEC WRITE”, “ON” )
jobfile.writei( “EXEC INPUT 0”, 0 )
jobfile.writec( “CASE WRITE”, “ON” )
jobfile.writei( “CASE INPUT 0”, 0 )
jobfile.writec( “BULK WRITE”, “ON” )
jobfile.writei( “BULK INPUT 0”, 0 )
jobfile.writec( ““, “END” )
jobfile.close( )
mscnastran_job.associate_subcases( “101”, “field1”, 1, [“Default”] )
analysis_submit_2( “MSC.Nastran”, “field1” )
$? YES 6016072
#---------------------------------------------------------------------
# The session execution will be paused, user should get the analysis
# results using MSC.Nastran before pressing ‘RESUME’ button.
sf_pause()
#---------------------------------------------------------------------
# Importing the results.
jobfile.open( “field1”, “RESULTS” )
jobfile.write_spl( “/* Jobfile for NASPAT created %A% at %A% */”, [“28-Aug-97”
@
, “14:11:30”] )
jobfile.writec( ““, “TRANSLATOR = naspat3” )
jobfile.writec( “DATABASE”, “field.db” )
jobfile.writec( “JOBNAME”, “field1” )
jobfile.writec( “RESULTS FILE”, “field1.op2” )
jobfile.writec( ““, ““ )
jobfile.writec( “OBJECT”, “Result Entities” )
jobfile.writec( “ANALYSIS TYPE”, “Structural” )
jobfile.writec( ““, ““ )
jobfile.writec( ““, “/*” )
jobfile.writec( ““, “ * Translation Parameters” )
jobfile.writec( ““, “ */” )
jobfile.writec( ““, ““ )
jobfile.writec( “DIVISION TOLERANCE”, “1.0E-8” )
jobfile.writec( “NUMERICAL TOLERANCE”, “1.0E-4” )
jobfile.writec( “MODEL TOLERANCE”, “0.0049999999” )
jobfile.writec( “ROTATIONAL NODAL RESULTS”, “OFF” )
jobfile.writec( “STRESS/STRAIN INVARIANTS”, “OFF” )
jobfile.writec( “PRINCIPAL DIRECTIONS”, “OFF” )
jobfile.writec( “ELEMENT RESULTS POSITIONS”, “Nodal “ )
jobfile.writec( “CREATE P-ORDER FIELD”, “OFF” )
jobfile.writec( “MSC.Nastran VERSION”, “69” )
jobfile.writec( ““, “END” )
jobfile.close( )
analysis_import( “MSC.Nastran”, “field1”, “Results File”, @
“field1.op2”, TRUE )
#---------------------------------------------------------------------
# End of File.

FUNCTION pick_add(i,s)
INTEGER i
STRING s[]()
ui_write(“Inside pick_add”)
dump i,s
/* dump s */

ui_write(“It can be observed that function, pick-add being called”)


ui_write(“after selection and returning string data returned from”)
ui_write(“select menus”)
END FUNCTION

/*****************************************************************
* Purpose : To Create a FORM to illustrate the function
Main Index
CHAPTER 18 1779
Support Files

* gm_highlight_widget() in MSC.Acumen Manual.


*
* A single width quarter height sized form is created
* containing a select frame, a selectdatabox and a
* button.
*
* Side Effects :
* <none>
*
******************************************************************/

#ifndef hilight
#define hilight

#include “appforms.p”

CLASS HILIGHT

CLASSWIDE widget form_id, button_id, frame_id, selectdatabox_id

/*****************************************************************
* FUNCTION init
*
* Purpose :
*
* Initialize the hilight Form.
*
* Input :
*
* <none>
*
* Output :
*
* <none>
*
******************************************************************/

FUNCTION init()

REAL y_loc, x_loc

y_loc = FORM_Y_LOC + (FORM_HGT_QTR/2)


x_loc = (SCREEN_WID - FORM_WID_SML)/2

form_id = UI_FORM_CREATE( @
/* Callback */ ““, @
/* x location */ x_loc, @
/* y location */ y_loc, @
/* position */ “UL”, @
/* width */ FORM_WID_SML, @
/* height */ FORM_HGT_QTR, @
/* label */ “HILIGHT”, @
/* unused */ ““)

y_loc = INTER_WIDGET_SPACE
x_loc = INTER_WIDGET_SPACE

frame_id = UI_SELECTFRAME_CREATE( @
/* parent */ form_id, @
/* call back */ ““, @
/* x location */ x_loc, @
/* y location */ y_loc, @
/* width */ SFRAME_WID_SINGLE, @
/* height */ SFRAME_1SDB_HGT_NO_LABOVE, @
Main Index
1780
Code Examples

/* label */ ““, @
/* recycle */ FALSE )

selectdatabox_id = UI_SELECTDATABOX_CREATE( @
/* parent */ frame_id, @
/* call back */ ““, @
/* x location */ SFRAME_L_MARGIN, @
/* y location */ SFRAME_T_MARGIN, @
/* label_length */ 0.0, @
/* Box length */ SDBOX_WID_SINGLE, @
/* label */ ““, @
/* Value */ ““, @
/* Label Above */ FALSE, @
/* Datatype */ “ANY”, @
/* Prompt */ “Select Any Entity”)

y_loc = FORM_HGT_QTR-2*INTER_WIDGET_SPACE-BUTTON_DEFAULT_HGT

button_id = UI_BUTTON_CREATE ( @
/* parent */ form_id, @
/* call back */ “button_cb”, @
/* x location */ BUTTON_THIRD_X_LOC2, @
/* y location */ y_loc, @
/* width */ BUTTON_WID_THIRD, @
/* height */ 0, @
/* label */ “OK”, @
/* unused */ TRUE, @
/* highlight */ FALSE)

END FUNCTION /* init() */

/*****************************************************************
* FUNCTION display
*
* Purpose :
*
* To display the hilight Form.
*
* Input :
*
* <none>
*
* Output :
*
* <none>
*
******************************************************************/

FUNCTION display()

select_focus.select_manager(selectdatabox_id,”ANY”, @
“Select Any Entity”)

ui_form_display(“HILIGHT”)
ui_set_focus(selectdatabox_id)

END FUNCTION /* display */

/*****************************************************************
* FUNCTION exit
*
* Purpose :
*
* To delete the form.
Main Index
CHAPTER 18 1781
Support Files

*
* Input :
*
* <none>
*
* Output :
*
* <none>
*
******************************************************************/
FUNCTION exit()

select_focus.exit()
ui_form_delete(“HILIGHT”)

END FUNCTION
/*****************************************************************
* FUNCTION get_select_id()
*
* Purpose :
*
* To get the selectdatabox id
*
* Input :
*
* <none>
*
* Output :
*
* select_wid - Widget id of the selectdatabox
*
******************************************************************/

FUNCTION get_select_id(select_wid)
WIDGET select_wid

select_wid = selectdatabox_id

END FUNCTION /* get_widget_ids */

/*****************************************************************
* FUNCTION button_cb
*
* Purpose :
*
* Hides the HILIGHT form.
*
* Input :
*
* <none>
*
* Output :
*
* <none>
*
******************************************************************/

FUNCTION button_cb()

ui_form_hide(“HILIGHT”)
select_focus.exit()

END FUNCTION

END CLASS /* HILIGHT */

#endif
Main Index
1782
Code Examples

CLASS HILIGHT

CLASSWIDE widget form_id, button_id, frame_id, selectdatabox_id

FUNCTION init()

REAL y_loc, x_loc

y_loc = uil_form_sizes.form_y_loc( 1 ) + @
(uil_form_sizes.form_hgt( 5 )/2)

x_loc = (uil_form_sizes.screen( 1 ) - @
uil_form_sizes.form_wid( 1 ))/2

form_id = UI_FORM_CREATE( @
““, @
x_loc, @
y_loc, @
“UL”, @
uil_form_sizes.form_wid( 1 ), @
uil_form_sizes.form_hgt( 5 ), @
“HILIGHT”, @
““)

y_loc = uil_form_sizes.spacing( 8 )
x_loc = uil_form_sizes.spacing( 8 )

frame_id = UI_SELECTFRAME_CREATE( @
form_id, @
““, @
x_loc, @
y_loc, @
uil_form_sizes.selframe_wid( 1 ), @
uil_form_sizes.selframe_hgt( 1, 2 ), @
““, @
FALSE )

selectdatabox_id = UI_SELECTDATABOX_CREATE( @
frame_id, @
““, @
uil_form_sizes.selframe_margin( 1 ), @
uil_form_sizes.selframe_margin( 3 ), @
0.0, @
uil_form_sizes.sdbox_wid( 1 ), @
““, @
““, @
FALSE, @
“ANY”, @
“Select Any Entity”)

y_loc = uil_form_sizes.form_hgt( 5 )- @
2*uil_form_sizes.spacing( 8 )- @
uil_form_sizes.button_hgt( 2 )

button_id = UI_BUTTON_CREATE ( @
form_id, @
“button_cb”, @
uil_form_sizes.button_x_loc1( 5 ), @
y_loc, @
uil_form_sizes.button_wid( 3 ), @
0, @
“OK”, @
TRUE, @
Main Index
CHAPTER 18 1783
Support Files

FALSE)

END FUNCTION

FUNCTION display()

select_focus.select_manager(selectdatabox_id,”ANY”, @
“Select Any Entity”)

ui_form_display(“HILIGHT”)
ui_set_focus(selectdatabox_id)

END FUNCTION

FUNCTION exit()

select_focus.exit()
ui_form_delete(“HILIGHT”)

END FUNCTION

FUNCTION get_select_id(select_wid)
WIDGET select_wid

select_wid = selectdatabox_id

END FUNCTION

FUNCTION button_cb()

ui_form_hide(“HILIGHT”)
select_focus.exit()

END FUNCTION

END CLASS

/*****************************************************************
* Purpose : To Create a Message form
*
* A medium width quarter height sized form is created
* containing a text widget for message and a
* push button to acknowledge and remove the form.
*
* Side Effects :
* <none>
*
******************************************************************/

#ifndef msg
#define msg

#include “appforms.p”
#include “lpenums.p”

CLASS MSG

CLASSWIDE widget msg_form_id, msg_text, ok_button

/*****************************************************************
* FUNCTION init
*
* Purpose :
Main Index
1784
Code Examples

*
* Initialize the Message Form.
*
* Input :
*
* <none>
*
* Output :
*
* <none>
*
******************************************************************/

FUNCTION init()

REAL y_loc, x_loc

y_loc = SCREEN_HGT - FORM_HGT_QTR - FORM_T_MARGIN - FORM_B_MARGIN


x_loc = ( SCREEN_WID - FORM_WID_MED - 2* FORM_L_MARGIN) / 2.0

msg_form_id = UI_FORM_CREATE( @
/* Callback */ ““, @
/* x location */ x_loc, @
/* y location */ y_loc, @
/* position */ “UL”, @
/* width */ FORM_WID_MED, @
/* height */ FORM_HGT_QTR, @
/* label */ “Message”, @
/* unused */ ““)

y_loc = INTER_WIDGET_SPACE
x_loc = INTER_WIDGET_SPACE

msg_text = UI_TEXT_CREATE( @
/* parent */ msg_form_id, @
/* call back */ ““, @
/* x location */ x_loc, @
/* y location */ y_loc, @
/* width */ TBOX_WID_DOUBLE, @
/* num rows */ 3, @
/* label */ ““, @
/* text */ ““, @
/* editable */ FALSE)

y_loc = FORM_HGT_QTR - 2* INTER_WIDGET_SPACE - BUTTON_DEFAULT_HGT

ok_button = UI_BUTTON_CREATE ( @
/* parent */ msg_form_id, @
/* call back */ “ok_button_cb”, @
/* x location */ BUTTON_THIRD_X_LOC_CEN_MED, @
/* y location */ y_loc, @
/* width */ BUTTON_WID_THIRD, @
/* height */ 0, @
/* label */ “OK”, @
/* unused */ TRUE, @
/* highlight */ TRUE)

END FUNCTION /* init() */

/*****************************************************************
* FUNCTION display
*
* Purpose :
*
* To display the Message Form.
Main Index
CHAPTER 18 1785
Support Files

*
* Input :
*
* <none>
*
* Output :
*
* <none>
*
******************************************************************/

FUNCTION display()

ui_form_display(“MSG”)

END FUNCTION /* display */

/*****************************************************************
* FUNCTION set_msg()
*
* Purpose :
*
* To Initialize the Message.
*
* Input :
*
* str - STRING[] : Containing message to be displayed.
*
* Output :
*
* <none>
*
******************************************************************/

FUNCTION set_msg(str)
STRING str[]

IF (msg_text != WIDGET_NULL) THEN

ui_wid_set(msg_text, “VALUE”, str)


ui_wid_set(msg_text, “VISIBLE”,TRUE)

ELSE

write(“The msg_text widget is NULL!”)

END IF

END FUNCTION /* set_msg */

/*****************************************************************
* FUNCTION ok_button_cb
*
* Purpose :
*
* Hides the ERRMSG form.
*
* Input :
*
* <none>
*
* Output :
*
* <none>
*
Main Index
1786
Code Examples

******************************************************************/

FUNCTION ok_button_cb()

ui_form_delete(“MSG”)

END FUNCTION

END CLASS /* MSG */

/*****************************************************************
* FUNCTION message
*
* Purpose :
*
* Initializes, populates and displays the MSG form.
*
* Input :
*
* str - STRING[] : Containing message to be displayed.
*
* Output :
*
* <none>
*
******************************************************************/

FUNCTION message(mesg)
STRING mesg[]

ui_exec_function(“MSG”,”display”)
MSG.set_msg(mesg)

END FUNCTION

#endif

# File : mpc.ses
#
# Purpose : This file will generate a PATRAN database
# “mpc.db” which consists two nodes and a single
# element.It also consits of five groups and
# eight MPCs (Multi Point Constraints).
#
# 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.
#
# Model : The database consists of two nodes at location
# [0,0,0] and [1,0,0] and an element connecting it.
# It has five groups i.e “default_group”,”mpc2”,
# “mpc3”,”mpc4” and “mpc5”.Eight Mpc entities
# are created and are placed in the five groups.
# The group names and the mpc numbers are listed
# below
# --------------------------------
# Group NAME | MPC NO
# ---------------|----------------
# default_group | 1,2
# mpc2 | 3
# mpc3 | 4,5
# mpc4 | 6,7,8
# mpc5 | 3,6,7,8
Main Index
CHAPTER 18 1787
Support Files

#
#---------------------------------------------------------------------
# Open a new database “mpc.db”
uil_file_new.go(““,”mpc.db”)
$? YES 36000002
#---------------------------------------------------------------------
# Create two nodes at the location [0,0,0] and [1,0,0].
#
STRING fem_create_nodes__nodes_created[VIRTUAL]
fem_create_nodes( “Coord 0”, “Coord 0”, TRUE, “1”, “ [0 0 0]”, @
fem_create_nodes__nodes_created )

fem_create_nodes( “Coord 0”, “Coord 0”, TRUE, “2”, “ [1 0 0]”, @


fem_create_nodes__nodes_created )

#---------------------------------------------------------------------
# Create an element connecting this two nodes.
#
STRING fem_create_elemen_elems_created[VIRTUAL]
fem_create_elems( “Bar “, “Bar2”, “1”, “Standard”, TRUE, “[0 0 0]”, @
“[1 0 0]”, ““, ““, ““, ““, ““, ““, fem_create_elemen_elems_created )

#---------------------------------------------------------------------
# Create two MPC entities mpc no 1 and mpc no 2 which belongs to the
# default group.The two MPC entities are displacements in x and y
# respectively.
#
fem_create_mpc_nodal( 1, “Explicit”, 0., 2, [TRUE, FALSE], [0., 1.], @
[“Node 2” , “Node 1”], [“UX”, “UX”] )
fem_create_mpc_nodal( 2, “Explicit”, 0., 2, [TRUE, FALSE], [0., 1.], @
[“Node 2” , “Node 1”], [“UY”, “UY”] )
sys_poll_option( 2 )

#---------------------------------------------------------------------
# Create second group with the name “mpc2” and set it to current
# group.
#
ga_group_create( “mpc2” )
ga_group_current_set( “mpc2” )

#---------------------------------------------------------------------
# Create a MPC entity mpc no 3 which is displacement in z direction.
# This entity belongs to group “mpc2”
#
sys_poll_option( 0 )
fem_create_mpc_nodal( 3, “Explicit”, 0., 2, [TRUE, FALSE], [0., 1.], @
[“Node 2” , “Node 1”], [“UZ”, “UZ”] )
sys_poll_option( 2 )

#---------------------------------------------------------------------
# Create third group with the name “mpc3” and set it to current
# group.
#
ga_group_create( “mpc3” )
ga_group_current_set( “mpc3” )

#---------------------------------------------------------------------
# Create two MPC entities mpc no 4 and mpc no 5 which belongs to the
# “mpc3” group.The two MPC entities are displacements in z and y
# respectively.
#
sys_poll_option( 0 )
fem_create_mpc_nodal( 4, “Explicit”, 0., 2, [TRUE, FALSE], [0., 1.], @
[“Node 2” , “Node 1”], [“UZ”, “UZ”] )
fem_create_mpc_nodal( 5, “Explicit”, 0., 2, [TRUE, FALSE], [0., 1.], @
[“Node 2” , “Node 1”], [“UY”, “UY”] )
sys_poll_option( 2 )
Main Index
1788
Code Examples

#---------------------------------------------------------------------
# Create fourth group with the name “mpc4” and set it to current
# group.
#
ga_group_create( “mpc4” )
ga_group_current_set( “mpc4” )

#---------------------------------------------------------------------
# Create three MPC entities mpc no 6,MPC no 7 and mpc no 8 which
# belongs to the “mpc4” group.The three MPC entities are rotations in
# x,y and z respectively.
#
sys_poll_option( 0 )
fem_create_mpc_nodal( 6, “Explicit”, 0., 2, [TRUE, FALSE], [0., 1.], @
[“Node 2” , “Node 1”], [“RX”, “RX”] )
fem_create_mpc_nodal( 7, “Explicit”, 0., 2, [TRUE, FALSE], [0., 1.], @
[“Node 2” , “Node 1”], [“RY”, “RY”] )
fem_create_mpc_nodal( 8, “Explicit”, 0., 2, [TRUE, FALSE], [0., 1.], @
[“Node 2” , “Node 1”], [“RZ”, “RZ”] )
sys_poll_option( 2 )

#---------------------------------------------------------------------
# Create fifth group with the name “mpc5” and set it to current
# group.
#
ga_group_create( “mpc5” )
ga_group_current_set( “mpc5” )

#---------------------------------------------------------------------
# Add the mpc nos 3,6,7,8 to the group “mpc5”.
#
sys_poll_option( 0 )
ga_group_entity_add( “mpc5”, “ Node 1:2 MPC 3” )
ga_group_entity_add( “mpc5”, “ Node 1:2 MPC 6:8” )

#---------------------------------------------------------------------

FUNCTION pcl_func1()
ui_write(“In pcl_func1()”)
ui_write(“Calling pcl_func2()..”)
pcl_func2()
ui_write(“Back in pcl_func1()”)
END FUNCTION

FUNCTION pcl_func2()
ui_write(“In pcl_func2()”)
END FUNCTION

#---------------------------------------------------------------------
# File : plate.ses
#
# Purpose : This file will generate a PATRAN database
# “plate.db” which consists of a surface meshed using
# QUAD4 elements. The plate held from four sides and
# is loaded at the center. The model has “MSC.Nastran”
# as analysis preference.
#
# 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.
#
# Model : The plate is a square of unit 1.
Main Index
CHAPTER 18 1789
Support Files

#
# The model consists of
# * -100000 unit force at the four central nodes.
# * Job name ‘plate1’- is generated using one load
# case ‘Default’
# * Job name ‘plate2’- is generated using three load
# cases ‘Default’,’Load Case2’ and ‘Load Case3’.
#
# Analysis & After running this session file, two ‘*.bdf’ files
# Results : are generated, user may delete these files.
#---------------------------------------------------------------------
# Create a new database and set the preferences
uil_file_new.go(““, “./plate.db”)
$? YES 36000002
#---------------------------------------------------------------------
# Creating a Hpat surface.
STRING asm_create_patch_xy_created_ids[VIRTUAL]
asm_const_patch_xyz( “1”, “<1 1 0>”, “[0 0 0]”, “Coord 0”, @
asm_create_patch_xy_created_ids )
#---------------------------------------------------------------------
# Meshing the plate with QUAD4 elements.
ui_exec_function( “mesh_seed_display_mgr”, “init” )
INTEGER fem_create_mesh_surfa_num_nodes
INTEGER fem_create_mesh_surfa_num_elems
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]
fem_create_mesh_surf_2( “IsoMesh”, 0, “Surface 1 “, 1, [0.2],”Quad4”,@
“1”, “1”, “Coord 0”, “Coord 0”, fem_create_mesh_surfa_num_nodes, @
fem_create_mesh_surfa_num_elems, fem_create_mesh_s_nodes_created, @
fem_create_mesh_s_elems_created )
mesh_seed_display_mgr.erase( )
#---------------------------------------------------------------------
# Creating BC set “fix” to fix the plate edges.
loadsbcs_create( “fix”, “Displacement”, “Nodal”, ““, “Static”, [ @
“Surface 1.1 1.2 1.3 1.4”], “Geometry”, “Coord 0”, 1.,[“<0 0 0 >”,@
“< 0 0 0 >”], [““, ““] )
# Creating Load set “point” to load the plate at the four nodes.
loadsbcs_create( “point”, “Force”, “Nodal”, ““, “Static”, @
[“Node 15 16 21 22”] , “FEM”, “Coord 0”, 1., [“< 0 0 -100000 >”,@
“< >”], [““, ““] )
#---------------------------------------------------------------------
# Isotropic material “iso” created.
material.create( “Analysis code ID”, 1, “Analysis type ID”, 1, “iso”,@
0,”Date: 09-Jul-97 Time: 16:23:14”,”Isotropic”,1,”Directionality”,@
1, “Linearity”, 1, “Homogeneous”, 0, “Linear Elastic”, 1, @
“Model Options & IDs”, [““, ““, ““, ““, ““], [0, 0, 0, 0, 0], @
“Active Flag”, 1,”Create”,10,”External Flag”,FALSE,”Property IDs”,@
[“Elastic Modulus”, “Poisson Ratio”],[2, 5, 0],”Property Values”,@
[“2e11”, “.35”, ““] )
#---------------------------------------------------------------------
# Element properties “metal” created.
elementprops_create( “metal”, 51, 25, 35, 1, 1, 20,[13, 20, 36, 4037,@
4111, 4118, 4119],[5, 9, 1, 1, 1, 1, 1],[“m:iso”,””, “.1”, ““, ““,@
““, ““], “Surface 1” )
#---------------------------------------------------------------------
# Load cases “Default”, “Load Case2” and “Load case3” are created.
loadcase_create( “Default”, “Static”, @
“This load case is the default load case that always appears”, @
[“fix”, “point”], [0, 0], ““, 0., TRUE )
$? YES 3001002
loadcase_create( “Load Case2”, “Static”, “Load case number 2”, @
[“fix”], [0, 0], ““, 0., TRUE )
loadcase_create( “Load Case3”, “Static”, “Load case number 3”, “ // @
“ [“point”], [0, 0], ““, 0., TRUE )
#---------------------------------------------------------------------
# Creating job “plate1”.
jobfile.open( “plate1”, “ANALYZE NO JOBFILE” )
Main Index
1790
Code Examples

msc_delete_old_files( “plate1”, “.bdf”, “.op2” )


jobfile.write_spl( “/* Jobfile for PATNAS created %A% at %A% */”, @
[“09-Jul-97” , “16:47:22”] )
jobfile.writec( ““, “TRANSLATOR = pat3nas” )
jobfile.writec( “DATABASE”, “./plate.db” )
jobfile.writec( “JOBNAME”, “plate1” )
jobfile.writec( “ANALYSIS TITLE”, @
“MSC.Nastran job created on 09-Jul-97 at 16:24:30” )
jobfile.writec( ““, ““ )
jobfile.writec( “OBJECT”, “Entire Model” )
jobfile.writec( “METHOD”, “Full Run” )
jobfile.writec( ““, ““ )
jobfile.writec( “MODEL SUFFIX”, “.bdf” )
jobfile.writec( “RESULTS SUFFIX”, “.op2” )
jobfile.writec( ““, ““ )
jobfile.writec( ““, “/*” )
jobfile.writec( ““, “ * Translation Parameters” )
jobfile.writec( ““, “ */” )
jobfile.writec( ““, ““ )
jobfile.writec( “DATA OUTPUT”, “OP2 and Print” )
jobfile.writec( “OUTPUT2 REQUESTS”, “MSC.Patran Built In” )
jobfile.writec( “OUTPUT2 FORMAT”, “Binary” )
jobfile.writec( “DIVISION TOLERANCE”, “1.0e-08” )
jobfile.writec( “NUMERICAL TOLERANCE”, “1.0e-04” )
jobfile.writec( “MODEL TOLERANCE”, “0.0049999999” )
jobfile.writec( “WRITING TOLERANCE”, “1.0e-20” )
jobfile.writec( “CARD FORMAT”, “either” )
jobfile.writec( “MINIMUM SIGNIF. DIGITS”, “4” )
jobfile.writec( “NODE COORDINATES”, “reference frame” )
jobfile.writec( “MSC.Nastran VERSION”, “69” )
jobfile.writec( “PROPS ON ELEM ENTRY”, “FALSE” )
jobfile.writec( “ELEMENT PROPERTY OFFSET”, “0” )
jobfile.writec( “MATERIAL PROPERTY OFFSET”, “0” )
jobfile.writec( “TABLE OFFSET”, “0” )
jobfile.writec( “LOAD SET OFFSET”, “0” )
jobfile.writec( “LOAD CASE OFFSET”, “0” )
jobfile.writec( “CONTROL SET OFFSET”, “0” )
jobfile.writec( “RIGID ELEMENT OFFSET”, “0” )
jobfile.writec( “SCALAR POINT OFFSET”, “0” )
jobfile.writec( “BEGINNING CONTINUATION MARKER”, “+ A” )
jobfile.writec( “NUMBER ONLY”, “ON” )
jobfile.writec( “BEGINNING NUMBER”, “OFF” )
jobfile.writec( “TRAILING NUMBER”, “OFF” )
jobfile.writec( “SYNTAX NUMBER”, “ON” )
jobfile.writec( “SYNTAX MARKER”, “.” )
jobfile.writec( ““, ““ )
jobfile.writec( ““, “/*” )
jobfile.writec( ““, “ * Solution Parameters” )
jobfile.writec( ““, “ */” )
jobfile.writec( ““, ““ )
jobfile.writec( “SOLUTION TYPE”, “NONLINEAR TRANSIENT” )
jobfile.writei( “SOLUTION SEQUENCE”, 129 )
jobfile.writec( “AUTOMATIC CONSTRAINTS”, “ON” )
jobfile.writec( “LARGE DISPLACEMENTS”, “ON” )
jobfile.writec( “FOLLOWER FORCES”, “ON” )
jobfile.writec( “MASS CALCULATION”, “Lumped” )
jobfile.writec( “DATA DECK ECHO”, “None” )
jobfile.writec( “PLATE RZ STIFFNESS FACTOR”, “100.0” )
jobfile.writec( “MAXIMUM PRINTED LINES”, “999999999” )
jobfile.writec( “MAXIMUM RUN TIME”, “600” )
jobfile.writec( “WT-MASS CONVERSION”, “1.0” )
jobfile.writec( “NODE ID FOR WT-GENER”, ““ )
jobfile.writec( “STRUCTURAL DAMPING COEFF.”, ““ )
jobfile.writec( “W3 DAMPING FACTOR”, ““ )
jobfile.writec( “W4 DAMPING FACTOR”, ““ )
jobfile.writec( “FMS WRITE”, “ON” )
jobfile.writei( “FMS INPUT 0”, 0 )
Main Index
CHAPTER 18 1791
Support Files

jobfile.writec( “EXEC WRITE”, “ON” )


jobfile.writei( “EXEC INPUT 0”, 0 )
jobfile.writec( “CASE WRITE”, “ON” )
jobfile.writei( “CASE INPUT 0”, 0 )
jobfile.writec( “BULK WRITE”, “ON” )
jobfile.writei( “BULK INPUT 0”, 0 )
jobfile.writec( ““, “END” )
jobfile.close( )
mscnastran_job.associate_subcases( “129”, “plate1”, 1, [“Default”] )
analysis_submit_2( “MSC.Nastran”, “plate1” )
$? YES 6016072
#---------------------------------------------------------------------
# Creating job “plate2”.
jobfile.open( “plate2”, “ANALYZE NO JOBFILE” )
msc_delete_old_files( “plate2”, “.bdf”, “.op2” )
jobfile.write_spl( “/* Jobfile for PATNAS created %A% at %A% */”, @
[“22-Jul-97” , “09:01:50”] )
jobfile.writec( ““, “TRANSLATOR = pat3nas” )
jobfile.writec( “DATABASE”, “./plate.db” )
jobfile.writec( “JOBNAME”, “plate2” )
jobfile.writec( “ANALYSIS TITLE”, @
“MSC.Nastran job created on 09-Jul-97 at 16:24:30” )
jobfile.writec( ““, ““ )
jobfile.writec( “OBJECT”, “Entire Model” )
jobfile.writec( “METHOD”, “Full Run” )
jobfile.writec( ““, ““ )
jobfile.writec( “MODEL SUFFIX”, “.bdf” )
jobfile.writec( “RESULTS SUFFIX”, “.op2” )
jobfile.writec( ““, ““ )
jobfile.writec( ““, “/*” )
jobfile.writec( ““, “ * Translation Parameters” )
jobfile.writec( ““, “ */” )
jobfile.writec( ““, ““ )
jobfile.writec( “DATA OUTPUT”, “OP2 and Print” )
jobfile.writec( “OUTPUT2 REQUESTS”, “MSC.Patran Built In” )
jobfile.writec( “OUTPUT2 FORMAT”, “Binary” )
jobfile.writec( “DIVISION TOLERANCE”, “1.0e-08” )
jobfile.writec( “NUMERICAL TOLERANCE”, “1.0e-04” )
jobfile.writec( “MODEL TOLERANCE”, “0.0049999999” )
jobfile.writec( “WRITING TOLERANCE”, “1.0e-20” )
jobfile.writec( “CARD FORMAT”, “either” )
jobfile.writec( “MINIMUM SIGNIF. DIGITS”, “4” )
jobfile.writec( “NODE COORDINATES”, “reference frame” )
jobfile.writec( “MSC.Nastran VERSION”, “69” )
jobfile.writec( “PROPS ON ELEM ENTRY”, “FALSE” )
jobfile.writec( “ELEMENT PROPERTY OFFSET”, “0” )
jobfile.writec( “MATERIAL PROPERTY OFFSET”, “0” )
jobfile.writec( “TABLE OFFSET”, “0” )
jobfile.writec( “LOAD SET OFFSET”, “0” )
jobfile.writec( “LOAD CASE OFFSET”, “0” )
jobfile.writec( “CONTROL SET OFFSET”, “0” )
jobfile.writec( “RIGID ELEMENT OFFSET”, “0” )
jobfile.writec( “SCALAR POINT OFFSET”, “0” )
jobfile.writec( “BEGINNING CONTINUATION MARKER”, “+ A” )
jobfile.writec( “NUMBER ONLY”, “ON” )
jobfile.writec( “BEGINNING NUMBER”, “OFF” )
jobfile.writec( “TRAILING NUMBER”, “OFF” )
jobfile.writec( “SYNTAX NUMBER”, “ON” )
jobfile.writec( “SYNTAX MARKER”, “.” )
jobfile.writec( ““, ““ )
jobfile.writec( ““, “/*” )
jobfile.writec( ““, “ * Solution Parameters” )
jobfile.writec( ““, “ */” )
jobfile.writec( ““, ““ )
jobfile.writec( “SOLUTION TYPE”, “LINEAR STATIC” )
jobfile.writei( “SOLUTION SEQUENCE”, 101 )
jobfile.writec( “DATABASE RUN”, “ON” )
Main Index
1792
Code Examples

jobfile.writec( “CYCLIC SYMMETRY”, “OFF” )


jobfile.writec( “AUTOMATIC CONSTRAINTS”, “ON” )
jobfile.writec( “INERTIA RELIEF”, “OFF” )
jobfile.writec( “ALTERNATE REDUCTION”, “OFF” )
jobfile.writec( “MASS CALCULATION”, “Lumped” )
jobfile.writec( “DATA DECK ECHO”, “None” )
jobfile.writec( “PLATE RZ STIFFNESS FACTOR”, “0.0” )
jobfile.writec( “MAXIMUM PRINTED LINES”, “999999999” )
jobfile.writec( “MAXIMUM RUN TIME”, “600” )
jobfile.writec( “WT-MASS CONVERSION”, “1.0” )
jobfile.writec( “NODE ID FOR WT-GENER”, ““ )
jobfile.writec( “FMS WRITE”, “ON” )
jobfile.writei( “FMS INPUT 0”, 0 )
jobfile.writec( “EXEC WRITE”, “ON” )
jobfile.writei( “EXEC INPUT 0”, 0 )
jobfile.writec( “CASE WRITE”, “ON” )
jobfile.writei( “CASE INPUT 0”, 0 )
jobfile.writec( “BULK WRITE”, “ON” )
jobfile.writei( “BULK INPUT 0”, 0 )
jobfile.writec( ““, “END” )
jobfile.close( )
mscnastran_job.associate_subcases( “101”, “plate2”, 3, [“Default”, @
“Load Case2”, “Load Case3”] )
analysis_submit_2( “MSC.Nastran”, “plate2” )
$? YES 6016072
#---------------------------------------------------------------------
# End of File.

#include <stdio.h>

#define INTR_ARRAY_SIZE 110


#define REAL_ARRAY_SIZE 110
#define CHAR_ARRAY_SIZE 110

#define RTRN_GET -1
#define RTRN_OK 0

#define RTRN_INIT 1
#define RTRN_WRNG_NUM_ARGS 2

extern “C” int RpcInitServer ( int prognum,


int progver,
void (*handler)(int handler),
int inetd,
int timeout,
int debug);
extern “C” int RpcInquireItem(int handle, int * type, int *count);
extern “C” int RpcGetBoolArray(int handle, int *buffer, int *count, int
bools);
extern “C” int RpcGetBoolean(int handle, int *value);
extern “C” int RpcGetCommand(int handle, int *value);
extern “C” int RpcGetIntArray(int handle, int *buffer, int *count, int
ints);
extern “C” int RpcGetInteger(int handle, int *value);
extern “C” int RpcGetReal(int handle, float *value);
extern “C” int RpcGetRealArray(int handle, float *buffer, int *count, int
floats);
extern “C” int RpcGetStatus(int handle, int *value);
extern “C” int RpcGetString(int handle, char *buffer, int len);
extern “C” int RpcPutBoolArray(int handle, int *value, int count);
extern “C” int RpcPutBoolean(int handle, int value);
extern “C” int RpcPutCommand(int handle, int value);
extern “C” int RpcPutIntArray(int handle, int *value, int count );
extern “C” int RpcPutInteger(int handle, int value);
extern “C” int RpcPutReal(int handle, float value);
extern “C” int RpcPutRealArray(int handle, float *value, int count );
Main Index
CHAPTER 18 1793
Support Files

extern “C” int RpcPutStatus(int handle, int value);


extern “C” int RpcPutString(int handle, char *value);
extern “C” void RpcServerEnd(void);

extern “C” void RpcHandler(int handle);

extern “C” int handler_error( int error_value);

int handler_error( int error_value)


{
static int return_value = RTRN_INIT;

if (error_value >= RTRN_OK)


{
return_value = error_value;
}
else
{
error_value = error_value;
}
return(return_value);
}

void RpcHandler(int handle)


{
int type = 0;
int count = 0;
int rand_int = 0;
int arr_int [INTR_ARRAY_SIZE] = {0};
int cnt = 0;
int bufsize = 0;
float rand_flt = 0.0;
float arr_flt [REAL_ARRAY_SIZE] = {0.0};
char string [CHAR_ARRAY_SIZE] = {‘\0’};
int return_value = RTRN_INIT;

return_value = RpcInquireItem(handle, & type, & count);


printf(“type = %d, count = %d\n”, type, count);

if (return_value == RTRN_OK)
{

switch ( type )
{
/* Datatype status */
case 1:
return_value = RpcGetStatus(handle, &rand_int);
if (return_value == RTRN_OK)
{
return_value = RpcPutStatus(handle, rand_int);
}
break;
/* Datatype command */
case 2:
return_value = RpcGetCommand(handle, &rand_int);
if (return_value == RTRN_OK)
{
return_value = RpcPutCommand(handle, rand_int);
}
break;
/* Datatype integer */
case 3:
return_value = RpcGetInteger(handle, &rand_int);
if (return_value == RTRN_OK)
Main Index
1794
Code Examples

{
return_value = RpcPutInteger(handle, rand_int);
}
break;
/* Datatype boolean */
case 4:
return_value = RpcGetBoolean(handle, &rand_int);
if (return_value == RTRN_OK)
{
return_value = RpcPutBoolean(handle, rand_int);
}
break;
/* Datatype real */
case 5:
return_value = RpcGetReal(handle, &rand_flt);
if (return_value == RTRN_OK)
{
return_value = RpcPutReal(handle, rand_flt);
}
break;
/* Datatype string */
case 6:
return_value = RpcGetString(handle, string, sizeof(string));
if (return_value == RTRN_OK)
{
return_value = RpcPutString(handle, string);
}
break;
/* Datatype integer array */
case 7:
bufsize = sizeof(arr_int)/sizeof(arr_int[0]);
return_value = RpcGetIntArray(handle, arr_int, &cnt, bufsize);
if (return_value == RTRN_OK)
{
return_value = RpcPutIntArray(handle, arr_int, cnt);
}
break;
/* Datatype boolean array */
case 8:
bufsize = sizeof(arr_int)/sizeof(arr_int[0]);
return_value = RpcGetBoolArray(handle, arr_int, &cnt,
bufsize);
if (return_value == RTRN_OK)
{
return_value = RpcPutBoolArray(handle, arr_int, cnt);
}
break;
/* Datatype real array */
case 9:
bufsize = sizeof(arr_flt)/sizeof(arr_flt[0]);
return_value = RpcGetRealArray(handle, arr_flt, &cnt,
bufsize);
if (return_value == RTRN_OK)
{
return_value = RpcPutRealArray(handle, arr_flt, cnt);
}
break;
default:
/* Server will die after current Rpc call completes */
RpcServerEnd();
}
}
handler_error(return_value);
}

/* End of RpcHandler() */

Main Index
CHAPTER 18 1795
Support Files

/***************************************************************
*
*
* The all PDA RPC servers must make a call to RpcInitServer.
* This establishes the server’s run-time environment as
* follows. All clients must make a call to RpcAddServer
* and RpcInitClient.
*
* RpcInitServer
* ( int prognum - program number for
* client/server same
* value as in RpcInitClient
* int progver - program version
* void (*handler)(int) - RPC service handler
* logical inetd - server startup via inetd.
* int server_timeout - # of seconds of inactivity
* before server dies
* logical rpc_debug - display rpc data on stdout
***************************************************************/

int main(int argc, char ** argv)


{
int prognum = 0;
int return_value = RTRN_INIT;

if ( (argc != 2)
||(sscanf(argv[1], “%d”, &prognum) != 1)
)
{
printf(“usage : %s <prognum>\n”, argv[0]);
return_value = RTRN_WRNG_NUM_ARGS;
}
else
{
return_value = RpcInitServer(prognum, 1, RpcHandler, 0, 300, 0);
if (return_value == RTRN_OK)
{
return_value = handler_error(RTRN_GET);
}
}

return (return_value);
}

/* End of main */

#---------------------------------------------------------------------
# File : sphere.ses
#
# Purpose : This file will generate a PATRAN database
# “sphere.db” which consists of a sphercal syrface.
#
# 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.
#
#---------------------------------------------------------------------
# Open a new database “sphere.db”
uil_file_new.go( ““,”./sphere.db”)
$? YES 36000002

# Create a 2D circle
STRING sgm_create_curve_2d_created_ids[VIRTUAL]
sgm_const_curve_2d_circle_v1( “1”, 1, 1., “Coord 0.3”, ““, “[0 0 0]”,@
Main Index
1796
Code Examples

TRUE, sgm_create_curve_2d_created_ids )

# Revolve the circle through 180 degrees to get a spherical surface


STRING sgm_sweep_surface_r_created_ids[VIRTUAL]
sgm_const_surface_revolve( “1”, “{[1 0 0] [-1 0 0]}”, 180., 0., @
“Coord 0”, “Curve 1 “, sgm_sweep_surface_r_created_ids )

# Shade the surface


uil_toolbar.shaded_smooth( )

/* Jobfile for NASPAT created 07-Jul-97 at 08:53:37 */


TRANSLATOR = naspat3
DATABASE = /home/isaak/temp/./spool.db
JOBNAME = spool
RESULTS FILE = /home/isaak/temp/spool.op2
OBJECT = Result Entities
ANALYSIS TYPE = Structural
/*
* File Search Path Declaration
*/
File Search Path = /rapid/users/isaak/mount_users2/isaak/patran/patran3/bin
File Search Path = /rapid/users/isaak/mount_users2/isaak/patran/patran3/icons
File Search Path = /rapid/users/isaak/mount_users2/isaak/patran/patran3/alters
File Search Path =
/rapid/users/isaak/mount_users2/isaak/patran/patran3/helpfil@
es
File Search Path = /rapid/users/isaak/mount_users2/isaak/patran/patran3
File Search Path = /home/isaak
/*
* Translation Parameters
*/
DIVISION TOLERANCE = 1.0E-8
NUMERICAL TOLERANCE = 1.0E-4
MODEL TOLERANCE = 0.0040000002
ROTATIONAL NODAL RESULTS = OFF
STRESS/STRAIN INVARIANTS = OFF
PRINCIPAL DIRECTIONS = OFF
ELEMENT RESULTS POSITIONS = Nodal
CREATE P-ORDER FIELD = OFF
MSC.Nastran VERSION = 69
END

X 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ$/+-()’=.*”#%&,;:<>?@![]^_\
020080
62^6666810W^66^GNASTGRAN GFORTG TAPGE IDG CODGE -
^61^GXXXXGXXXX^4^3^HHHHHHHHHH
X 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ$/+-()’=.*”#%&,;:<>?@![]^_\
020080
61^GGEOMG1S ^4^66^810$3820 67333^71^60^3^61^GGEOMG1
^72^60^3^6F^81UG6J68606
1613B7 4^T3 99B7 4^T3 B 4^T3 9999^73^60^3^81UF^8205K6.60603B G?PB
9933361
3B G3PY69B7 59[N_333623B G3Q1P9B 59@BL333633B D’_R&9B7 A!]7 333643B
D’\)(9B A!!A0333653B 9@T!)9B7 F<^S%333663B 9@V- 9B F<[#-333673B 4^S
=W9B7 J(R\.333683B 4^UW=9B J(Q%<333693B30 15UP_9B7 M0?+63336A3B30
15:?T9B
M0?6;3336B3B7 4^TYH9B7 M:?F 3336C3B7 4^RK49B M:?F 3336D3B7 B7O]G9B7
M
0?MS3336E3B7 B7M”S9B M0@5P3336F3B7 G?P’H9B7 J(RG83336G3B7 G?N*69B J(SU
3336H3B7 L;R039B7 F<]*:3336I3B7 L;PI!9B F<_RM3336J3B7 P/[IM9B7
A![8P3336
K3B7 P/!479B A!^LD3336L3B7 R\L!#9B7 59!9]3336M3B7 R\LA;9B
59]MZ3336N3B7
S,LJ 9B33 1^$&V3336O3B D@’9 993336P3B DBAHU9B7 4OZCS3336Q3B DBB0Q9B
4OW*63336R3B B5&!V9B7 9QZ<(3336S3B B5;7”9B 9QX)03336T3B 7&+4C9B7
D#4>
Main Index
CHAPTER 18 1797
Support Files

_3336U3B 7&(1B9B D#39R3336V3B 3T5 -9B7 H3GS,3336W3B 3T7IV9B


H3E\[333
6X3BB0 4+BW$9B7 J8(/73336Y3BB0 4/&(J9B J8(5<3336Z3B7 4^T&]9B7 J>8D
3336$3B
7 4^RCF9B J>8D 3336/3B7 AM1##9B7 J8(LU3336+3B7 AM 3:9B J8)4Q3336-3B7
F
O2O]9B7 H3FUD3336(3B7 FO ^T9B H3G^53336)3B7 J.ZQF9B7 D#3@N3336’3B7
J.XT4
9B D#5<Y3336=3B7 N0”%39B7 9QYN^3336.3B7 N0*I]9B 9Q$:13336*3B7 P66!89B7
4OX(W3336”3B7 P66AC9B 4O$KL3336#3B7 P;+H 9B33 2H]_S3336%3B A!]7
993336&3
B AI]G=9B7 3-B^G3336,3B AI^ R9B 3-9GR3336;3B 8W+7%9B7 7]C$H3336:3B
8W-/S9B 7]A803336<3B 5’”UD9B7 B(DW,3336>3B 5’%RC9B B(BJ\3336?3B
1_*M
,9B7 EU4[W3336@3B 1_#;49B EU3T03336!3B7 0KHOU9B7 GGP$93336[3B7 0KE-[9B
GGO<D3336]3B7 4^T&]9B7 G?PB 3336^3B7 4^R7/9B G?PB 3336_3B7 9$’K$9B7
GG
P4>3336\3B7 9$-()9B GGP;,333810 3B7 D@’?]9B7 EU3^I33381003B7 D@(RT9B
EU
5P;33381013B7 H/=:R9B7 B(C2[33381023B7 H/)?H9B B(EF”33381033B7 KRZE99B7
7]A>^33381043B7 KRX%)9B 7]DJ133381053B7 MD??,9B7 3-AAH33381063B7 MD?8>9B
3-C^L33381073B7 M:?F 9B33 2UX-]33381083B 7]C5 9933381093B 7Q.039B7
2<:-
R333810A3B 7Q.”;9B 2<&]W333810B3B 5]Q/)9B7 6R<3H333810C3B 5]R;.9B
6R
,-0333810D3B 3Z>%$9B7 9XL=9333810E3B 3Z@,D9B 9XJ”A333810F3B 0UL,=9B7
B@!O+333810G3B 0UOE!9B B@?[*333810H3B7 15(>#9B7 DOAZA333810I3B7 15+7#9B
DO9:E333810J3B7 4^T&]9B7 D@’9 333810K3B7 4^RCF9B D@’9 333810L3B7
8;I!P9
B7 DOA3?333810M3B7 8;GD’9B DOA,;333810N3B7 CPJ+$9B7 B@@Q0333810O3B7
CPG[
T9B B@!(F333810P3B7 FU:E(9B7 9XKT6333810Q3B7 FU,1:9B 9XMQ5333810R3B7
H>
NS+9B7 6R;L^333810S3B7 H>MEN9B 6R<,1333810T3B7 JL(-A9B7 2<,%=333810U3B7
JL-@E9B 2<<V=333810V3B7 J>8D 9B33 2T \0333810W3B 4^T3 99333810X3B
4YT6;9
B7 24TD<333810Y3B 4YT,/9B 24Q.[333810Z3B 3ME\;9B7 4^TYH333810$3B
3MGJ
B9B 4^RN8333810/3B 1T 5\9B7 7QU5L333810+3B 1T0^*9B 7QS8M333810-3BB3
0=
K/ 9B7 9J*+’333810(3B33 2>Z*T9B 9J.O-333810)3B7 1?0E#9B7 AV]YC333810’3B7
1>_.E9B AV[;R333810=3B7 4^T&]9B7 A!]7 333810.3B7 4^RN89B A!]7
333810*3B7
81]UQ9B7 AV]2!333810”3B7 81!289B AV]YC333810#3B7 A!]<]9B7
9J.(H333810%3
B7 A!!)I9B 9J”5_333810&3B7 DN^O;9B7 7QS?J333810,3B7 DN[=)9B
7QU$(333810
;3B7 FHB[J9B7 4^S1K333810:3B7 FHA.59B 4^UH1333810<3B7 GTP+C9B7
24RR%3338
10>3B7 GTO?F9B 24T\H333810?3B7 G?PB 9B33 2AJ=U333810@3B 2’RYVB30
3WS?K933
3810!3B 2LQ6(B30 3WS?KB7 1U’HM333810[3B 2LQ$MB30 3WS?KB 1U(W<333810]3B
1N&-,B30 3WS?KB7 3;S”?333810^3B 1N,Z9B30 3WS?KB 3;R9G333810_3B
<“_’B30
3WS?KB7 5;D=[333810\3B <%I2B30 3WS?KB 5;CT.333811 3B7 080EUB30 3WS?KB7
7LG6N33381103B7 07\([B30 3WS?KB 7LF7,33381113B7 2S,,EB30 3WS?KB7
8I@R&333
81123B7 2S&09B30 3WS?KB 8I?^’33381133B7 4^TYHB30 3WS?KB7 8-!Q033381143B7
4^R@0B30 3WS?KB 8-!Q033381153B7 7S8X&B30 3WS?KB7 8I?^’33381163B7 7S6:SB30
3WS?KB 8I@R&33381173B7 9%] LB30 3WS?KB7 7LFNR33381183B7 9%!I0B30 3WS?KB
7LGM133381193B7 B%. OB30 3WS?KB7 5;C*L333811A3B7 B%’X?B30 3WS?KB
5;D]$3338
11B3B7 DI”P<B30 3WS?KB7 3;R/O333811C3B7 DI*R-B30 3WS?KB 3;T9P333811D3B7
E
GMV&B30 3WS?KB7 1U)05333811E3B7 EGM0VB30 3WS?KB 1U’%/333811F3B7 E/NT:B30
3
WS?KB33 1C8C 333811G3B 0”” 3B 0”*R69333811H3B 0T[MQB 0”*R6B7
0\(]Z3338
11I3B 0T[‘#B 0”*R6B 0\-%Y333811J3B .(@ZB 0”*R6B7 2</:Z333811K3B
.)XBB 0”*R6B 2<$#:333811L3BB0 46F$7B 0”*R6B7 4R#85333811M3BB0 466&+B
0
Main Index
1798
Code Examples

“*R6B 4R”F<333811N3B7 15>?+B 0”*R6B7 5’7AX333811O3B7 15<,?B 0”*R6B


5
‘6=Q333811P3B7 2^;<JB 0”*R6B7 6ROV5333811Q3B7 2^,-AB 0”*R6B
6ROFS33381
1R3B7 4^TI(B 0”*R6B7 6.B]B333811S3B7 4^SG\B 0”*R6B 6.B]B333811T3B7
6^
6\1B 0”*R6B7 6ROFS333811U3B7 6^5#,B 0”*R6B 6ROV5333811V3B7 8;40IB
0”
*R6B7 5’6=Q333811W3B7 8;2,FB 0”*R6B 5’7QA333811X3B7 APD7LB 0”*R6B7
4R
“T!333811Y3B7 APCOPB 0”*R6B 4R#M9333811Z3B7 B-/UAB 0”*R6B7
2</2Y333811
$3B7 B-$#EB 0”*R6B 2<+5.333811/3B7 CO>ZHB 0”*R6B7 0\(3J333811+3B7
CO>
J(B 0”*R6B 0\)F?333811-3B7 C)’ NB 0”*R6B33 0V7L 333811(3B30 3WW2MB
2’Q
;)9333811)3B30 1K)7 B 2’Q;)B7 0)D-V333811’3B30 1K=J(B 2’Q;)B
0)C;!333811
=3BB0 33MKBB 2’Q;)B7 2CC=E333811.3BB0 33IAUB 2’Q;)B 2CB_@333811*3B7
0QF
=’B 2’Q;)B7 3XC*.333811”3B7 0QF7#B 2’Q;)B 3XC9<333811#3B7 1#F:SB
2’Q
;)B7 4YQ\<333811%3B7 1#F75B 2’Q;)B 4YQ$I333811&3B7 3IE^<B 2’Q;)B7
5BQ
;<333811,3B7 3IE9LB 2’Q;)B 5BQ$C333811;3B7 4^TI(B 2’Q;)B7
5PP<1333811:
3B7 4^SYCB 2’Q;)B 5PP<1333811<3B7 6+=(QB 2’Q;)B7 5BQ;<333811>3B7
6+’!
UB 2’Q;)B 5BR3V333811?3B7 89’<$B 2’Q;)B7 4YQ’Y333811@3B7 89’6(B
2’Q;
)B 4YR55333811!3B7 9U’&.B 2’Q;)B7 3XCH$333811[3B7 9U’2^B 2’Q;)B
3XC?
6333811]3B7 AV!5[B 2’Q;)B7 2CC8?333811^3B7 AV@+;B 2’Q;)B
2CC>8333811_3
B7 B8@@1B 2’Q;)B7 0)C\<333811\3B7 B8@@1B 2’Q;)B 0)D,R333812 3B7
BM?!D
B 2’Q;)B33 0 <O 333812039B 4^T3 933381213BB0 10\KXB 4^T3 B7
0X”0B3338122
3BB0 10^>#B 4^T3 B 0X*SE33381233B7 ,5_AB 4^T3 B7 1_”B@33381243B7 ,5’
QB 4^T3 B 1_*=633381253B7 0”*<.B 4^T3 B7 3C”V533381263B7 0”*S=B 4^T3
B 3C”4T33381273B7 1_”DTB 4^T3 B7 49MI:33381283B7 1_*.=B 4^T3 B 49M0
633381293B7 3P”SOB 4^T3 B7 4#TDW333812A3B7 3P*@RB 4^T3 B
4#T46333812B3
B7 4^TI(B 4^T3 B7 4^T3 333812C3B7 4^S*6B 4^T3 B 4^T3 333812D3B7 6VB!K
B 4^T3 B7 4#T5.333812E3B7 6VBQ1B 4^T3 B 4#TG/333812F3B7 7]C5 B 4^T3
B7 49M3H333812G3B7 7]B/.B 4^T3 B 49MM 333812H3B7 9ACURB 4^T3 B7 3C”9D
333812I3B7 9AC 9B 4^T3 B 3C”Z#333812J3B7 A6:M:B 4^T3 B7
1_*&L333812K3B
7 A6;?YB 4^T3 B 1_”ID333812L3B7 A.]4^B 4^T3 B7 0X*YT333812M3B7 A.]4^B
4^T3 B 0X”6Q333812N3B7 A!]7 B 4^T3 B33 .%= 333812O39B 9QZ+ 9333812P3
BB0 10\KXB 9QZ+ B7 0X”0B333812Q3BB0 10^>#B 9QZ+ B 0X*SE333812R3B7
,5_A
B 9QZ+ B7 1_”B@333812S3B7 ,5’QB 9QZ+ B 1_*=6333812T3B7 0”*<.B 9QZ+
B7 3C”V5333812U3B7 0”*S=B 9QZ+ B 3C”4T333812V3B7 1_”DTB 9QZ+ B7 49MI:
333812W3B7 1_*.=B 9QZ+ B 49M06333812X3B7 3P”SOB 9QZ+ B7
4#TDW333812Y3B
7 3P*@RB 9QZ+ B 4#T46333812Z3B7 4^TI(B 9QZ+ B7 4^T3 333812$3B7 4^S*6B
9QZ+ B 4^T3 333812/3B7 6VB!KB 9QZ+ B7 4#T5.333812+3B7 6VBQ1B 9QZ+ B
4#TG/333812-3B7 7]C5 B 9QZ+ B7 49M3H333812(3B7 7]B/.B 9QZ+ B 49MM 3
33812)3B7 9ACURB 9QZ+ B7 3C”9D333812’3B7 9AC 9B 9QZ+ B
3C”Z#333812=3B7
A6:M:B 9QZ+ B7 1_*&L333812.3B7 A6;?YB 9QZ+ B 1_”ID333812*3B7 A.]4^B
9QZ+ B7 0X*YT333812”3B7 A.]4^B 9QZ+ B 0X”6Q333812#3B7 A!]7 B 9QZ+ B3
3 .%= 333812%39B D@’9 9333812&3BB0 10\KXB D@’9 B7 0X”0B333812,3BB0
10^>#B
D@’9 B 0X*SE333812;3B7 ,5_AB D@’9 B7 1_”B@333812:3B7 ,5’QB D@’9 B
1_*=6333812<3B7 0”*<.B D@’9 B7 3C”V5333812>3B7 0”*S=B D@’9 B 3C”4T3
33812?3B7 1_”DTB D@’9 B7 49MI:333812@3B7 1_*.=B D@’9 B
49M06333812!3B7
3P”SOB D@’9 B7 4#TDW^81UF^333812[3B7 3P*@RB D@’9 B 4#T46333812]3B7 4
^TI(B D@’9 B7 4^T3 333812^3B7 4^S*6B D@’9 B 4^T3 333812_3B7 6VB!KB D
Main Index
CHAPTER 18 1799
Support Files

@’9 B7 4#T5.333812\3B7 6VBQ1B D@’9 B 4#TG/333813 3B7 7]C5 B D@’9 B7 4


9M3H33381303B7 7]B/.B D@’9 B 49MM 33381313B7 9ACURB D@’9 B7
3C”9D33381
323B7 9AC 9B D@’9 B 3C”Z#33381333B7 A6:M:B D@’9 B7 1_*&L33381343B7 A6
;?YB D@’9 B 1_”ID33381353B7 A.]4^B D@’9 B7 0X*YT33381363B7 A.]4^B D@
‘9 B 0X”6Q33381373B7 A!]7 B D@’9 B33 .%= 333813839B IM%. 933381393BB0 1
0\KXB IM%. B7 0X”0B333813A3BB0 10^>#B IM%. B 0X*SE333813B3B7 ,5_AB I
M%. B7 1_”B@333813C3B7 ,5’QB IM%. B 1_*=6333813D3B7 0”*<.B IM%. B7 3
C”V5333813E3B7 0”*S=B IM%. B 3C”4T333813F3B7 1_”DTB IM%. B7
49MI:33381
3G3B7 1_*.=B IM%. B 49M06333813H3B7 3P”SOB IM%. B7 4#TDW333813I3B7 3P
*@RB IM%. B 4#T46333813J3B7 4^TI(B IM%. B7 4^T3 333813K3B7 4^S*6B IM
%. B 4^T3 333813L3B7 6VB!KB IM%. B7 4#T5.333813M3B7 6VBQ1B IM%. B 4#
TG/333813N3B7 7]C5 B IM%. B7 49M3H333813O3B7 7]B/.B IM%. B 49MM 333813
P3B7 9ACURB IM%. B7 3C”9D333813Q3B7 9AC 9B IM%. B 3C”Z#333813R3B7 A6:
M:B IM%. B7 1_*&L333813S3B7 A6;?YB IM%. B 1_”ID333813T3B7 A.]4^B IM%
. B7 0X*YT333813U3B7 A.]4^B IM%. B 0X”6Q333813V3B7 A!]7 B IM%. B33 .%
= 333813W39B M:?F 96033813X3BB0 10\KXB M:?F B7 0X”0B333813Y3BB0 10^>#B
M
:?F B 0X*SE333813Z3B7 ,5_AB M:?F B7 1_”B@333813$3B7 ,5’QB M:?F B 1
_*=6333813/3B7 0”*<.B M:?F B7 3C”V5333813+3B7 0”*S=B M:?F B
3C”4T33381
3-3B7 1_”DTB M:?F B7 49MI:333813(3B7 1_*.=B M:?F B 49M06333813)3B7 3P
“SOB M:?F B7 4#TDW333813’3B7 3P*@RB M:?F B 4#T46333813=3B7 4^TI(B M:
?F B7 4^T3 333813.3B7 4^S*6B M:?F B 4^T3 333813*3B7 6VB!KB M:?F B7 4#
T5.333813”3B7 6VBQ1B M:?F B 4#TG/333813#3B7 7]C5 B M:?F B7
49M3H333813
%3B7 7]B/.B M:?F B 49MM 333813&3B7 9ACURB M:?F B7 3C”9D333813,3B7 9AC
9B M:?F B 3C”Z#333813;3B7 A6:M:B M:?F B7 1_*&L333813:3B7 A6;?YB M:?
F B 1_”ID333813<3B7 A.]4^B M:?F B7 0X*YT333813>3B7 A.]4^B M:?F B 0X”
6Q333813?3B7 A!]7 B M:?F B33 .%= 333813@39B RI_, 9333813!3BB0 10\KXB
RI
_, B7 0X”0B333813[3BB0 10^>#B RI_, B 0X*SE333813]3B7 ,5_AB RI_, B7 1_
“B@333813^3B7 ,5’QB RI_, B 1_*=6333813_3B7 0”*<.B RI_, B7
3C”V5333813
\3B7 0”*S=B RI_, B 3C”4T333814 3B7 1_”DTB RI_, B7 49MI:33381403B7 1_*
.=B RI_, B 49M0633381413B7 3P”SOB RI_, B7 4#TDW33381423B7 3P*@RB RI_
, B 4#T4633381433B7 4^TI(B RI_, B7 4^T3 33381443B7 4^S*6B RI_, B 4^T
3 33381453B7 6VB!KB RI_, B7 4#T5.33381463B7 6VBQ1B RI_, B
4#TG/3338147
3B7 7]C5 B RI_, B7 49M3H33381483B7 7]B/.B RI_, B 49MM 33381493B7 9ACU
RB RI_, B7 3C”9D333814A3B7 9AC 9B RI_, B 3C”Z#333814B3B7 A6:M:B RI_,
B7 1_*&L333814C3B7 A6;?YB RI_, B 1_”ID333814D3B7 A.]4^B RI_, B7 0X*Y
T333814E3B7 A.]4^B RI_, B 0X”6Q333814F3B7 A!]7 B RI_, B33 .%= 333814G3
9B V&4L 9333814H3BB0 10\KXB V&4L B7 0X”0B333814I3BB0 10^>#B V&4L B 0X*
SE333814J3B7 ,5_AB V&4L B7 1_”B@333814K3B7 ,5’QB V&4L B 1_*=6333814L
3B7 0”*<.B V&4L B7 3C”V5333814M3B7 0”*S=B V&4L B 3C”4T333814N3B7 1_”D
TB V&4L B7 49MI:333814O3B7 1_*.=B V&4L B 49M06333814P3B7 3P”SOB V&4L
B7 4#TDW333814Q3B7 3P*@RB V&4L B 4#T46333814R3B7 4^TI(B V&4L B7 4^T3
333814S3B7 4^S*6B V&4L B 4^T3 333814T3B7 6VB!KB V&4L B7 4#T5.333814U3
B7 6VBQ1B V&4L B 4#TG/333814V3B7 7]C5 B V&4L B7 49M3H333814W3B7 7]B/.
B V&4L B 49MM 333814X3B7 9ACURB V&4L B7 3C”9D333814Y3B7 9AC 9B V&4L
B 3C”Z#333814Z3B7 A6:M:B V&4L B7 1_*&L333814$3B7 A6;?YB V&4L B 1_”ID
333814/3B7 A.]4^B V&4L B7 0X*YT333814+3B7 A.]4^B V&4L B 0X”6Q333814-
3B
7 A!]7 B V&4L B33 .%= 333814(39B $FA@ 9333814)3BB0 10\KXB $FA@ B7 0X”0
B333814’3BB0 10^>#B $FA@ B 0X*SE333814=3B7 ,5_AB $FA@ B7
1_”B@333814.3
B7 ,5’QB $FA@ B 1_*=6333814*3B7 0”*<.B $FA@ B7 3C”V5333814”3B7 0”*S=
B $FA@ B 3C”4T333814#3B7 1_”DTB $FA@ B7 49MI:333814%3B7 1_*.=B $FA@
B 49M06333814&3B7 3P”SOB $FA@ B7 4#TDW333814,3B7 3P*@RB $FA@ B 4#T46
333814;3B7 4^TI(B $FA@ B7 4^T3 333814:3B7 4^S*6B $FA@ B 4^T3 333814<3B
7 6VB!KB $FA@ B7 4#T5.333814>3B7 6VBQ1B $FA@ B 4#TG/333814?3B7 7]C5 B
$FA@ B7 49M3H333814@3B7 7]B/.B $FA@ B 49MM 333814!3B7 9ACURB $FA@ B
7 3C”9D333814[3B7 9AC 9B $FA@ B 3C”Z#333814]3B7 A6:M:B $FA@ B7 1_*&L3
33814^3B7 A6;?YB $FA@ B 1_”ID333814_3B7 A.]4^B $FA@ B7
0X*YT333814\3B7
A.]4^B $FA@ B 0X”6Q333815 3B7 A!]7 B $FA@ B33 .%= 333815039B (*HR 9
Main Index
1800
Code Examples

33381513BB0 10\KXB (*HR B7 0X”0B33381523BB0 10^>#B (*HR B


0X*SE33381533B
7 ,5_AB (*HR B7 1_”B@33381543B7 ,5’QB (*HR B 1_*=633381553B7 0”*<.B
(*HR B7 3C”V533381563B7 0”*S=B (*HR B 3C”4T33381573B7 1_”DTB (*HR B
7 49MI:33381583B7 1_*.=B (*HR B 49M0633381593B7 3P”SOB (*HR B7 4#TDW3
33815A3B7 3P*@RB (*HR B 4#T46333815B3B7 4^TI(B (*HR B7 4^T3
333815C3B7
4^S*6B (*HR B 4^T3 333815D3B7 6VB!KB (*HR B7 4#T5.333815E3B7 6VBQ1B
(*HR B 4#TG/333815F3B7 7]C5 B (*HR B7 49M3H333815G3B7 7]B/.B (*HR B
49MM 333815H3B7 9ACURB (*HR B7 3C”9D333815I3B7 9AC 9B (*HR B 3C”Z#33
3815J3B7 A6:M:B (*HR B7 1_*&L333815K3B7 A6;?YB (*HR B 1_”ID333815L3B7
A.]4^B (*HR B7 0X*YT333815M3B7 A.]4^B (*HR B 0X”6Q333815N3B7 A!]7 B
(*HR B33 .%= 333815O3B30 3WW2MB = J-R9333815P3B30 1K)7 B = J-RB7 0)D-
V33
3815Q3B30 1K=J(B = J-RB 0)C;!333815R3BB0 33MKBB = J-RB7
2CC=E333815S3BB0
33IAUB = J-RB 2CB_@333815T3B7 0QF=’B = J-RB7 3XC*.333815U3B7 0QF7#B
= J-RB 3XC9<333815V3B7 1#F:SB = J-RB7 4YQ\<333815W3B7 1#F75B = J-RB
4YQ$I333815X3B7 3IE^<B = J-RB7 5BQ;<333815Y3B7 3IE9LB = J-RB
5BQ$C333
815Z3B7 4^TI(B = J-RB7 5PP<1333815$3B7 4^SYCB = J-RB 5PP<1333815/3B7
6+=(QB = J-RB7 5BQ;<333815+3B7 6+’!UB = J-RB 5BR3V333815-3B7 89’<$B
= J-RB7 4YQ’Y333815(3B7 89’6(B = J-RB 4YR55333815)3B7 9U’&.B = J-RB7
3XCH$333815’3B7 9U’2^B = J-RB 3XC?6333815=3B7 AV!5[B = J-RB7
2CC8?3338
15.3B7 AV@+;B = J-RB 2CC>8333815*3B7 B8@@1B = J-RB7 0)C\<333815”3B7 B
8@@1B = J-RB 0)D,R333815#3B7 BM?!DB = J-RB33 0 <O 333815%3B 0”” 3B .
]0>F9333815&3B 0T[MQB .]0>FB7 0\(]Z333815,3B 0T[‘#B .]0>FB 0\-
%Y3338
15;3B .(@ZB .]0>FB7 2</:Z333815:3B .)XBB .]0>FB 2<$#:333815<3BB0 4
6F$7B .]0>FB7 4R#85333815>3BB0 466&+B .]0>FB 4R”F<333815?3B7 15>?+B
.
]0>FB7 5’7AX333815@3B7 15<,?B .]0>FB 5’6=Q333815!3B7 2^;<JB .]0>FB7
6
ROV5333815[3B7 2^,-AB .]0>FB 6ROFS333815]3B7 4^TI(B .]0>FB7
6.B]B33381
5^3B7 4^SG\B .]0>FB 6.B]B333815_3B7 6^6\1B .]0>FB7 6ROFS333815\3B7
6^
5#,B .]0>FB 6ROV5333816 3B7 8;40IB .]0>FB7 5’6=Q33381603B7 8;2,FB .]
0>FB 5’7QA33381613B7 APD7LB .]0>FB7 4R”T!33381623B7 APCOPB .]0>FB
4R
#M933381633B7 B-/UAB .]0>FB7 2</2Y33381643B7 B-$#EB .]0>FB
2<+5.333816
53B7 CO>ZHB .]0>FB7 0\(3J33381663B7 CO>J(B .]0>FB 0\)F?33381673B7
C)’
NB .]0>FB33 0V7L 33381683B 2’RYVB “D,.%933381693B 2LQ6(B “D,.%B7 1U
‘HM333816A3B 2LQ$MB “D,.%B 1U(W<333816B3B 1N&-,B “D,.%B7
3;S”?333816
C3B 1N,Z9B “D,.%B 3;R9G333816D3B <“_’B “D,.%B7 5;D=[333816E3B <%
I2B “D,.%B 5;CT.333816F3B7 080EUB “D,.%B7 7LG6N333816G3B7 07\([B
“D,
.%B 7LF7,333816H3B7 2S,,EB “D,.%B7 8I@R&333816I3B7 2S&09B “D,.%B
8I?
^’333816J3B7 4^TYHB “D,.%B7 8-!Q0333816K3B7 4^R@0B “D,.%B 8-
!Q0333816L
3B7 7S8X&B “D,.%B7 8I?^’333816M3B7 7S6:SB “D,.%B 8I@R&333816N3B7 9%]
LB “D,.%B7 7LFNR333816O3B7 9%!I0B “D,.%B 7LGM1333816P3B7 B%. OB “D,.
%B7 5;C*L333816Q3B7 B%’X?B “D,.%B 5;D]$333816R3B7 DI”P<B “D,.%B7
3;R/
O333816S3B7 DI*R-B “D,.%B 3;T9P333816T3B7 EGMV&B “D,.%B7
1U)05333816U3
B7 EGM0VB “D,.%B 1U’%/333816V3B7 E/NT:B “D,.%B33 1C8C 333816W3B 4^T3
B “‘#V 9333816X3B 4YT6;B “‘#V B7 24TD<333816Y3B 4YT,/B “‘#V B 24Q.
[333816Z3B 3ME\;B “‘#V B7 4^TYH333816$3B 3MGJBB “‘#V B 4^RN8333816/3
B 1T 5\B “‘#V B7 7QU5L333816+3B 1T0^*B “‘#V B 7QS8M333816-3BB3 0=K/
B “‘#V B7 9J*+’333816(3B33 2>Z*TB “‘#V B 9J.O-333816)3B7 1?0E#B “‘#V
B7 AV]YC333816’3B7 1>_.EB “‘#V B AV[;R333816=3B7 4^T&]B “‘#V B7 A!]7
333816.3B7 4^RN8B “‘#V B A!]7 333816*3B7 81]UQB “‘#V B7
AV]2!333816”3B
7 81!28B “‘#V B AV]YC333816#3B7 A!]<]B “‘#V B7 9J.(H333816%3B7 A!!)IB
Main Index “‘#V B 9J”5_333816&3B7 DN^O;B “‘#V B7 7QS?J333816,3B7 DN[=)B “‘#V B
CHAPTER 18 1801
Support Files

7QU$(333816;3B7 FHB[JB “‘#V B7 4^S1K^81BY^333816:3B7 FHA.5B “‘#V B


4^UH1333816<3B7 GTP+CB “‘#V B7 24RR%333816>3B7 GTO?FB “‘#V B
24T\H3338
16?3B7 G?PB B “‘#V B33 2AJ=U333816@3B 7]C5 B “‘#V 9333816!3B 7Q.03B
“‘#V B7 2<:-R333816[3B 7Q.”;B “‘#V B 2<&]W333816]3B 5]Q/)B “‘#V B7
6R<3H333816^3B 5]R;.B “‘#V B 6R,-0333816_3B 3Z>%$B “‘#V B7 9XL=93338
16\3B 3Z@,DB “‘#V B 9XJ”A333817 3B 0UL,=B “‘#V B7 B@!O+33381703B 0
UOE!B “‘#V B B@?[*33381713B7 15(>#B “‘#V B7 DOAZA33381723B7 15+7#B “
‘#V B DO9:E33381733B7 4^T&]B “‘#V B7 D@’9 33381743B7 4^RCFB “‘#V B D
@’9 33381753B7 8;I!PB “‘#V B7 DOA3?33381763B7 8;GD’B “‘#V B
DOA,;33381
773B7 CPJ+$B “‘#V B7 B@@Q033381783B7 CPG[TB “‘#V B B@!(F33381793B7 FU
:E(B “‘#V B7 9XKT6333817A3B7 FU,1:B “‘#V B 9XMQ5333817B3B7 H>NS+B “‘
#V B7 6R;L^333817C3B7 H>MENB “‘#V B 6R<,1333817D3B7 JL(-AB “‘#V B7 2<
,%=333817E3B7 JL-@EB “‘#V B 2<<V=333817F3B7 J>8D B “‘#V B33 2T
\0333817
G3B A!]7 B “‘#V 9333817H3B AI]G=B “‘#V B7 3-B^G333817I3B AI^ RB “‘
#V B 3-9GR333817J3B 8W+7%B “‘#V B7 7]C$H333817K3B 8W-/SB “‘#V B 7]
A80333817L3B 5’”UDB “‘#V B7 B(DW,333817M3B 5’%RCB “‘#V B B(BJ\333817
N3B 1_*M,B “‘#V B7 EU4[W333817O3B 1_#;4B “‘#V B EU3T0333817P3B7 0KH
OUB “‘#V B7 GGP$9333817Q3B7 0KE-[B “‘#V B GGO<D333817R3B7 4^T&]B “‘#
V B7 G?PB 333817S3B7 4^R7/B “‘#V B G?PB 333817T3B7 9$’K$B “‘#V B7 GGP
4>333817U3B7 9$-()B “‘#V B GGP;,333817V3B7 D@’?]B “‘#V B7
EU3^I333817W
3B7 D@(RTB “‘#V B EU5P;333817X3B7 H/=:RB “‘#V B7 B(C2[333817Y3B7 H/)?
HB “‘#V B B(EF”333817Z3B7 KRZE9B “‘#V B7 7]A>^333817$3B7 KRX%)B “‘#V
B 7]DJ1333817/3B7 MD??,B “‘#V B7 3-AAH333817+3B7 MD?8>B “‘#V B 3-C^
L333817-3B7 M:?F B “‘#V B33 2UX-]333817(3B D@’9 B “‘#V 9333817)3B DBAH
UB “‘#V B7 4OZCS333817’3B DBB0QB “‘#V B 4OW*6333817=3B B5&!VB “‘#V
B7 9QZ<(333817.3B B5;7”B “‘#V B 9QX)0333817*3B 7&+4CB “‘#V B7 D#4>
_333817”3B 7&(1BB “‘#V B D#39R333817#3B 3T5 -B “‘#V B7 H3GS,333817%3
B 3T7IVB “‘#V B H3E\[333817&3BB0 4+BW$B “‘#V B7 J8(/7333817,3BB0
4/&(J
B “‘#V B J8(5<333817;3B7 4^T&]B “‘#V B7 J>8D 333817:3B7 4^RCFB “‘#V
B J>8D 333817<3B7 AM1##B “‘#V B7 J8(LU333817>3B7 AM 3:B “‘#V B J8)4Q
333817?3B7 FO2O]B “‘#V B7 H3FUD333817@3B7 FO ^TB “‘#V B
H3G^5333817!3B
7 J.ZQFB “‘#V B7 D#3@N333817[3B7 J.XT4B “‘#V B D#5<Y333817]3B7 N0”%3B
“‘#V B7 9QYN^333817^3B7 N0*I]B “‘#V B 9Q$:1333817_3B7 P66!8B “‘#V B
7 4OX(W333817\3B7 P66ACB “‘#V B 4O$KL333818 3B7 P;+H B “‘#V B33 2H]_S3
3381803B G?PB B “‘#V 933381813B G3PY6B “‘#V B7 59[N_33381823B G3Q1PB
“‘#V B 59@BL33381833B D’_R&B “‘#V B7 A!]7 33381843B D’\)(B “‘#V B
A!!A033381853B 9@T!)B “‘#V B7 F<^S%33381863B 9@V- B “‘#V B F<[#-3
3381873B 4^S=WB “‘#V B7 J(R\.33381883B 4^UW=B “‘#V B J(Q%<33381893B3
0 15UP_B “‘#V B7 M0?+6333818A3B30 15:?TB “‘#V B M0?6;333818B3B7 4^TYHB
“‘#V B7 M:?F 333818C3B7 4^RK4B “‘#V B M:?F 333818D3B7 B7O]GB “‘#V B7
M0?MS333818E3B7 B7M”SB “‘#V B M0@5P333818F3B7 G?P’HB “‘#V B7 J(RG833
3818G3B7 G?N*6B “‘#V B J(SU 333818H3B7 L;R03B “‘#V B7 F<]*:333818I3B7
L;PI!B “‘#V B F<_RM333818J3B7 P/[IMB “‘#V B7 A![8P333818K3B7 P/!47B
“‘#V B A!^LD333818L3B7 R\L!#B “‘#V B7 59!9]333818M3B7 R\LA;B “‘#V B
59]MZ333818N3B7 S,LJ B “‘#V B33
1^$&V333^74^60^3^62^82E\\82E\\82E\\^75^60^3

^3^HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
H
X 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ$/+-()’=.*”#%&,;:<>?@![]^_\
020080
61^GGEOMG2S ^4^66^810/333821 33^71^60^3^61^GIGEOGM2X
^72^60^3^81UF^81*D6,811%
6060606O6P619933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 61606O6%6&6P9933B7 4^T3
B7
4^T3 B7 4^T3 B7 4^T3 62606%810881096&9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T
3 63608108810W810X81099933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
6460616P6R639933B
7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 65606P6&6;6R9933B7 4^T3 B7 4^T3 B7 4^T3 B
7 4^T3 66606&8109810B6;9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
67608109810X810
Z810B9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 6860636R6T659933B7 4^T3 B7 4^T3

Main Index
1802
Code Examples

B7 4^T3 B7 4^T3 69606R6;6<6T9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3


6A606;810
B810D6<9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 6B60810B810Z810/810D9933B7
4^T3
B7 4^T3 B7 4^T3 B7 4^T3 6C60656T6V679933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
6D606T6<6?6V9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 6E606<810D810F6?9933B7
4^
T3 B7 4^T3 B7 4^T3 B7 4^T3 6F60810D810/810-810F9933B7 4^T3 B7 4^T3 B7
4^T
3 B7 4^T3 6G60676V6X699933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
6H606V6?6!6X9933
B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 6I606?810F810H6!9933B7 4^T3 B7 4^T3 B7 4
^T3 B7 4^T3 6J60810F810-810)810H9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
6K6069
6X6Z6B9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 6L606X6!6]6Z9933B7 4^T3 B7
4^T3
B7 4^T3 B7 4^T3 6M606!810H810J6]9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 6N60
810H810)810=810J9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 6O606B6Z6/6D9933B7
4^T
3 B7 4^T3 B7 4^T3 B7 4^T3 6P606Z6]6_6/9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T
3 6Q606]810J810L6_9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
6R60810J810=810*810L9
933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 6S606D6/6-6F9933B7 4^T3 B7 4^T3 B7 4^
T3 B7 4^T3 6T606/6_810 6-9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
6U606_810L810
N810 9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 6V60810L810*810#810N9933B7 4^T3
B
7 4^T3 B7 4^T3 B7 4^T3 6W606F6-6)6H9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 6
X606-810 81016)9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 6Y60810
810N810P81019933
B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 6Z60810N810#810&810P9933B7 4^T3 B7 4^T3
B
7 4^T3 B7 4^T3 6$606H6)6=6J9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
6/606)8101
81036=9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 6+608101810P810R81039933B7 4^T3
B7 4^T3 B7 4^T3 B7 4^T3 6-60810P810&810;810R9933B7 4^T3 B7 4^T3 B7 4^T3
B
7 4^T3 6(606J6=6*6L9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
6)606=810381056*993
3B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 6’608103810R810T81059933B7 4^T3 B7 4^T3
B7 4^T3 B7 4^T3 6=60810R810;810<810T9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
6
.606L6*6#6N9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 6*606*810581076#9933B7
4^T3
B7 4^T3 B7 4^T3 B7 4^T3 6”608105810T810V81079933B7 4^T3 B7 4^T3 B7 4^T3
B7 4^T3 6#60810T810<810?810V9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
6%606N6#6”
6M9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 6&606#810781066”9933B7 4^T3 B7
4^T3
B7 4^T3 B7 4^T3 6,608107810V810U81069933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
6;60810V810?810>810U9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 6:606M6”6.6K9933B7
4^T3 B7 4^T3 B7 4^T3 B7 4^T3 6<606”810681046.9933B7 4^T3 B7 4^T3 B7 4^T3
B7 4^T3 6>608106810U810S81049933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
6?60810U8
10>810:810S9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 6@606K6.6’6I9933B7 4^T3 B7
4^T3 B7 4^T3 B7 4^T3 6!606.810481026’9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
6[608104810S810Q81029933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
6]60810S810:810,81
0Q9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 6^606I6’6(6G9933B7 4^T3 B7 4^T3 B7
4^T3 B7 4^T3 6_606’810281006(9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
6\608102
810Q810O81009933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 810
60810Q810,810%810O9933B
7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 8100606G6(6+6E9933B7 4^T3 B7 4^T3 B7 4^T3
B7 4^T3 8101606(81006\6+9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
8102608100810
O810M6\9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 810360810O810%810”810M9933B7
4^
T3 B7 4^T3 B7 4^T3 B7 4^T3 8104606E6+6$6C9933B7 4^T3 B7 4^T3 B7 4^T3 B7
4^T3 8105606+6\6^6$9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
8106606\810M810K6^99
Main Index
CHAPTER 18 1803
Support Files

33B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 810760810M810”810.810K9933B7 4^T3 B7


4^
T3 B7 4^T3 B7 4^T3 8108606C6$6Y6A9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 8109
606$6^6[6Y9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 810A606^810K810I6[9933B7
4^T
3 B7 4^T3 B7 4^T3 B7 4^T3 810B60810K810.810’810I9933B7 4^T3 B7 4^T3 B7
4^
T3 B7 4^T3 810C606A6Y6W689933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
810D606Y6[6@6
W9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 810E606[810I810G6@9933B7 4^T3 B7
4^T
3 B7 4^T3 B7 4^T3 810F60810I810’810(810G9933B7 4^T3 B7 4^T3 B7 4^T3 B7
4^
T3 810G60686W6U669933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 810H606W6@6>6U9933B7
4^T3 B7 4^T3 B7 4^T3 B7 4^T3 810I606@810G810E6>9933B7 4^T3 B7 4^T3 B7
4^T
3 B7 4^T3 810J60810G810(810+810E9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
810K60
666U6S649933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 810L606U6>6:6S9933B7 4^T3 B7
4^T3 B7 4^T3 B7 4^T3 810M606>810E810C6:9933B7 4^T3 B7 4^T3 B7 4^T3 B7
4^T
3 810N60810E810+810$810C9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
810O60646S6Q629
933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 810P606S6:6,6Q9933B7 4^T3 B7 4^T3 B7
4^T3 B7 4^T3 810Q606:810C810A6,9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
810R608
10C810$810Y810A9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 810S60626Q6O609933B7
4^
T3 B7 4^T3 B7 4^T3 B7 4^T3 810T606Q6,6%6O9933B7 4^T3 B7 4^T3 B7 4^T3 B7
4^T3 810U606,810A81086%9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
810V60810A810Y81
0W81089933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 810W60810W810@810!810X9933B7
4^T
3 B7 4^T3 B7 4^T3 B7 4^T3 810X60810@811G811H810!9933B7 4^T3 B7 4^T3 B7
4^
T3 B7 4^T3 810Y60811G811(811)811H9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
810Z6
0811(81208121811)9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
810$60810X810!810]810Z
9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 810/60810!811H811J810]9933B7 4^T3 B7
4^T3 B7 4^T3 B7 4^T3 810+60811H811)811=811J9933B7 4^T3 B7 4^T3 B7 4^T3 B7
4^T3 810-60811)81218123811=9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
810(60810Z8
10]810_810/9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
810)60810]811J811L810_9933B7
4^T3 B7 4^T3 B7 4^T3 B7 4^T3 810’60811J811=811*811L9933B7 4^T3 B7 4^T3
B
7 4^T3 B7 4^T3 810=60811=81238125811*9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
810.60810/810_811 810-9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
810*60810_811L811
N811 9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 810”60811L811*811#811N9933B7
4^T3
B7 4^T3 B7 4^T3 B7 4^T3 810#60811*81258127811#9933B7 4^T3 B7 4^T3 B7
4^T
3 B7 4^T3 810%60810-811 8111810)9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
810&60
811 811N811P81119933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
810,60811N811#811&811P9
933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 810;60811#81278129811&9933B7 4^T3 B7
4
^T3 B7 4^T3 B7 4^T3 810:60810)81118113810=9933B7 4^T3 B7 4^T3 B7 4^T3 B7
4^T3 810<608111811P811R81139933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
810>60811P81
1&811;811R9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 810?60811&8129812B811;9933B7
4^T3 B7 4^T3 B7 4^T3 B7 4^T3 810@60810=81138115810*9933B7 4^T3 B7 4^T3
B7
4^T3 B7 4^T3 810!608113811R811T81159933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
8
10[60811R811;811<811T9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
810]60811;812B812D
811<9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 810^60810*81158117810#9933B7 4^T3

Main Index
1804
Code Examples

B7 4^T3 B7 4^T3 B7 4^T3 810_608115811T811V81179933B7 4^T3 B7 4^T3 B7


4^T3
B7 4^T3 810\60811T811<811?811V9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 811
608
11<812D812F811?9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
811060810#81178119810&99
33B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 8111608117811V811X81199933B7 4^T3 B7
4^
T3 B7 4^T3 B7 4^T3 811260811V811?811!811X9933B7 4^T3 B7 4^T3 B7 4^T3 B7
4
^T3 811360811?812F812H811!9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
811460810&811
9811B810;9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 8115608119811X811Z811B9933B7
4^T3 B7 4^T3 B7 4^T3 B7 4^T3 811660811X811!811]811Z9933B7 4^T3 B7 4^T3 B7
4^T3 B7 4^T3 811760811!812H812J811]9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
81
1860810;811B811D810<9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
811960811B811Z811/8
11D9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 811A60811Z811]811_811/9933B7 4^T3
B
7 4^T3 B7 4^T3 B7 4^T3 811B60811]812J812L811_9933B7 4^T3 B7 4^T3 B7 4^T3
B7 4^T3 811C60810<811D811F810?9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
811D6081
1D811/811-811F9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 811E60811/811_812 811-
993
^81UF^3B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 811F60811_812L812N812 9933B7 4^T3
B
7 4^T3 B7 4^T3 B7 4^T3 811G60810?811F811E810>9933B7 4^T3 B7 4^T3 B7 4^T3
B7 4^T3 811H60811F811-811+811E9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
811I6081
1-812 811\811+9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 811J60812
812N812M811\993
3B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 811K60810>811E811C810:9933B7 4^T3 B7
4^T
3 B7 4^T3 B7 4^T3 811L60811E811+811$811C9933B7 4^T3 B7 4^T3 B7 4^T3 B7
4^
T3 811M60811+811\811^811$9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
811N60811\812M
812K811^9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 811O60810:811C811A810,9933B7
4
^T3 B7 4^T3 B7 4^T3 B7 4^T3 811P60811C811$811Y811A9933B7 4^T3 B7 4^T3 B7
4^T3 B7 4^T3 811Q60811$811^811[811Y9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
811
R60811^812K812I811[9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
811S60810,811A811881
0%9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 811T60811A811Y811W81189933B7 4^T3
B7
4^T3 B7 4^T3 B7 4^T3 811U60811Y811[811@811W9933B7 4^T3 B7 4^T3 B7 4^T3
B
7 4^T3 811V60811[812I812G811@9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
811W60810
%81188116810”9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
811X608118811W811U81169933
B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 811Y60811W811@811>811U9933B7 4^T3 B7
4^T3
B7 4^T3 B7 4^T3 811Z60811@812G812E811>9933B7 4^T3 B7 4^T3 B7 4^T3 B7
4^T
3 811$60810”81168114810.9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
811/608116811U8
11S81149933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 811+60811U811>811:811S9933B7
4^
T3 B7 4^T3 B7 4^T3 B7 4^T3 811-60811>812E812C811:9933B7 4^T3 B7 4^T3 B7
4
^T3 B7 4^T3 811(60810.81148112810’9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
811)
608114811S811Q81129933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
811’60811S811:811,811
Q9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 811=60811:812C812A811,9933B7 4^T3 B7
4^T3 B7 4^T3 B7 4^T3 811.60810’81128110810(9933B7 4^T3 B7 4^T3 B7 4^T3
B7
4^T3 811*608112811Q811O81109933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
811”60811Q
Main Index
CHAPTER 18 1805
Support Files

811,811%811O9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3


811#60811,812A8128811%9933B
7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 811%60810(8110810\810+9933B7 4^T3 B7 4^T3
B7 4^T3 B7 4^T3 811&608110811O811M810\9933B7 4^T3 B7 4^T3 B7 4^T3 B7
4^T3
811,60811O811%811”811M9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
811;60811%812881
26811”9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 811:60810+810\810^810$9933B7
4^T
3 B7 4^T3 B7 4^T3 B7 4^T3 811<60810\811M811K810^9933B7 4^T3 B7 4^T3 B7
4^
T3 B7 4^T3 811>60811M811”811.811K9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
811?6
0811”81268124811.9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
811@60810$810^810[810Y
9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 811!60810^811K811I810[9933B7 4^T3 B7
4^T3 B7 4^T3 B7 4^T3 811[60811K811.811’811I9933B7 4^T3 B7 4^T3 B7 4^T3 B7
4^T3 811]60811.81248122811’9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
811^60810Y8
10[810@810W9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
811_60810[811I811G810@9933B7
4^T3 B7 4^T3 B7 4^T3 B7 4^T3 811\60811I811’811(811G9933B7 4^T3 B7 4^T3
B
7 4^T3 B7 4^T3 812 60811’81228120811(9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
8120608120812O812P81219933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
812160812O812%812
&812P9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 812260812%81388139812&9933B7
4^T3
B7 4^T3 B7 4^T3 B7 4^T3 8123608138813W813X81399933B7 4^T3 B7 4^T3 B7
4^T
3 B7 4^T3 8124608121812P812R81239933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
812560
812P812&812;812R9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
812660812&8139813B812;9
933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 8127608139813X813Z813B9933B7 4^T3 B7
4
^T3 B7 4^T3 B7 4^T3 8128608123812R812T81259933B7 4^T3 B7 4^T3 B7 4^T3 B7
4^T3 812960812R812;812<812T9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
812A60812;81
3B813D812<9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 812B60813B813Z813/813D9933B7
4^T3 B7 4^T3 B7 4^T3 B7 4^T3 812C608125812T812V81279933B7 4^T3 B7 4^T3
B7
4^T3 B7 4^T3 812D60812T812<812?812V9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
8
12E60812<813D813F812?9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
812F60813D813/813-
813F9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 812G608127812V812X81299933B7 4^T3
B7 4^T3 B7 4^T3 B7 4^T3 812H60812V812?812!812X9933B7 4^T3 B7 4^T3 B7
4^T3
B7 4^T3 812I60812?813F813H812!9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
812J608
13F813-813)813H9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
812K608129812X812Z812B99
33B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 812L60812X812!812]812Z9933B7 4^T3 B7
4^
T3 B7 4^T3 B7 4^T3 812M60812!813H813J812]9933B7 4^T3 B7 4^T3 B7 4^T3 B7
4
^T3 812N60813H813)813=813J9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
812O60812B812
Z812/812D9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 812P60812Z812]812_812/9933B7
4^T3 B7 4^T3 B7 4^T3 B7 4^T3 812Q60812]813J813L812_9933B7 4^T3 B7 4^T3 B7
4^T3 B7 4^T3 812R60813J813=813*813L9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
81
2S60812D812/812-812F9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 812T60812/812_813
8
12-9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 812U60812_813L813N813 9933B7 4^T3
B
7 4^T3 B7 4^T3 B7 4^T3 812V60813L813*813#813N9933B7 4^T3 B7 4^T3 B7 4^T3
B7 4^T3 812W60812F812-812)812H9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
812X6081
2-813 8131812)9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 812Y60813
813N813P8131993
Main Index
1806
Code Examples

3B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 812Z60813N813#813&813P9933B7 4^T3 B7


4^T
3 B7 4^T3 B7 4^T3 812$60812H812)812=812J9933B7 4^T3 B7 4^T3 B7 4^T3 B7
4^
T3 812/60812)81318133812=9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
812+608131813P
813R81339933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 812-60813P813&813;813R9933B7
4
^T3 B7 4^T3 B7 4^T3 B7 4^T3 812(60812J812=812*812L9933B7 4^T3 B7 4^T3 B7
4^T3 B7 4^T3 812)60812=81338135812*9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
812
‘608133813R813T81359933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
812=60813R813;813<81
3T9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 812.60812L812*812#812N9933B7 4^T3
B7
4^T3 B7 4^T3 B7 4^T3 812*60812*81358137812#9933B7 4^T3 B7 4^T3 B7 4^T3
B
7 4^T3 812”608135813T813V81379933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
812#60813
T813<813?813V9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
812%60812N812#812”812M9933
B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 812&60812#81378136812”9933B7 4^T3 B7
4^T3
B7 4^T3 B7 4^T3 812,608137813V813U81369933B7 4^T3 B7 4^T3 B7 4^T3 B7
4^T
3 812;60813V813?813>813U9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
812:60812M812”8
12.812K9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 812<60812”81368134812.9933B7
4^
T3 B7 4^T3 B7 4^T3 B7 4^T3 812>608136813U813S81349933B7 4^T3 B7 4^T3 B7
4
^T3 B7 4^T3 812?60813U813>813:813S9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
812@
60812K812.812’812I9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
812!60812.81348132812
‘9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 812[608134813S813Q81329933B7 4^T3 B7
4^T3 B7 4^T3 B7 4^T3 812]60813S813:813,813Q9933B7 4^T3 B7 4^T3 B7 4^T3
B7
4^T3 812^60812I812’812(812G9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
812_60812’
81328130812(9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
812\608132813Q813O81309933B
7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 813 60813Q813,813%813O9933B7 4^T3 B7 4^T3
B7 4^T3 B7 4^T3 813060812G812(812+812E9933B7 4^T3 B7 4^T3 B7 4^T3 B7
4^T3
813160812(8130812\812+9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
8132608130813O81
3M812\9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 813360813O813%813”813M9933B7
4^T
3 B7 4^T3 B7 4^T3 B7 4^T3 813460812E812+812$812C9933B7 4^T3 B7 4^T3 B7
4^
T3 B7 4^T3 813560812+812\812^812$9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
81366
0812\813M813K812^9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
813760813M813”813.813K
9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 813860812C812$812Y812A9933B7 4^T3 B7
4^T3 B7 4^T3 B7 4^T3 813960812$812^812[812Y9933B7 4^T3 B7 4^T3 B7 4^T3 B7
4^T3 813A60812^813K813I812[9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
813B60813K8
13.813’813I9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
813C60812A812Y812W81289933B7
4^T3 B7 4^T3 B7 4^T3 B7 4^T3 813D60812Y812[812@812W9933B7 4^T3 B7 4^T3
B
7 4^T3 B7 4^T3 813E60812[813I813G812@9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
813F60813I813’813(813G9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
813G608128812W812
U81269933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 813H60812W812@812>812U9933B7
4^T3
B7 4^T3 B7 4^T3 B7 4^T3 813I60812@813G813E812>9933B7 4^T3 B7 4^T3 B7
4^T
3 B7 4^T3 813J60813G813(813+813E9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
813K60
Main Index
CHAPTER 18 1807
Support Files

8126812U812S81249933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3


813L60812U812>812:812S9
933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 813M60812>813E813C812:9933B7 4^T3 B7
4
^T3 B7 4^T3 B7 4^T3 813N60813E813+813$813C9933B7 4^T3 B7 4^T3 B7 4^T3 B7
4^T3 813O608124812S812Q81229933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
813P60812S81
2:812,812Q9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 813Q60812:813C813A812,9933B7
4^T3 B7 4^T3 B7 4^T3 B7 4^T3 813R60813C813$813Y813A9933B7 4^T3 B7 4^T3
B7
4^T3 B7 4^T3 813S608122812Q812O81209933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
8
13T60812Q812,812%812O9^81UF^933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
813U60812,81
3A8138812%9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 813V60813A813Y813W81389933B7
4^T3 B7 4^T3 B7 4^T3 B7 4^T3 813W6081808181817)817(9933B7 4^T3 B7 4^T3
B7
4^T3 B7 4^T3 813X6081818183817=817)9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
8
13Y6081838185817*817=9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
813Z6081858187817#
817*9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 813$6081878189817&817#9933B7 4^T3
B7 4^T3 B7 4^T3 B7 4^T3 813/608189818B817;817&9933B7 4^T3 B7 4^T3 B7
4^T3
B7 4^T3 813+60818B818D817<817;9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 813-
608
18D818F817?817<9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
813(60818F818H817!817?99
33B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 813)60818H818J817]817!9933B7 4^T3 B7
4^
T3 B7 4^T3 B7 4^T3 813’60818J818L817_817]9933B7 4^T3 B7 4^T3 B7 4^T3 B7
4
^T3 813=60818L818N818 817_9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
813.60818N818
M817\818 9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 813*60818M818K817^817\9933B7
4^T3 B7 4^T3 B7 4^T3 B7 4^T3 813”60818K818I817[817^9933B7 4^T3 B7 4^T3 B7
4^T3 B7 4^T3 813#60818I818G817@817[9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
81
3%60818G818E817>817@9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
813&60818E818C817:8
17>9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 813,60818C818A817,817:9933B7 4^T3
B
7 4^T3 B7 4^T3 B7 4^T3 813;60818A8188817%817,9933B7 4^T3 B7 4^T3 B7 4^T3
B7 4^T3 813:6081888186817”817%9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
813<6081
868184817.817”9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
813>6081848182817’817.993
3B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 813?6081828180817(817’9933B7 4^T3 B7
4^T
3 B7 4^T3 B7 4^T3 813@60817(817)817H817G9933B7 4^T3 B7 4^T3 B7 4^T3 B7
4^
T3 813!60817)817=817J817H9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
813[60817=817*
817L817J9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 813]60817*817#817N817L9933B7
4
^T3 B7 4^T3 B7 4^T3 B7 4^T3 813^60817#817&817P817N9933B7 4^T3 B7 4^T3 B7
4^T3 B7 4^T3 813_60817&817;817R817P9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
813
\60817;817<817T817R9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 814
60817<817?817V81
7T9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 814060817?817!817X817V9933B7 4^T3
B7
4^T3 B7 4^T3 B7 4^T3 814160817!817]817Z817X9933B7 4^T3 B7 4^T3 B7 4^T3
B
7 4^T3 814260817]817_817/817Z9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
814360817
_818 817-817/9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 814460818 817\817+817-
9933
B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 814560817\817^817$817+9933B7 4^T3 B7
4^T3
B7 4^T3 B7 4^T3 814660817^817[817Y817$9933B7 4^T3 B7 4^T3 B7 4^T3 B7
4^T
Main Index
1808
Code Examples

3 814760817[817@817W817Y9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3


814860817@817>8
17U817W9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 814960817>817:817S817U9933B7
4^
T3 B7 4^T3 B7 4^T3 B7 4^T3 814A60817:817,817Q817S9933B7 4^T3 B7 4^T3 B7
4
^T3 B7 4^T3 814B60817,817%817O817Q9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
814C
60817%817”817M817O9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
814D60817”817.817K817
M9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 814E60817.817’817I817K9933B7 4^T3 B7
4^T3 B7 4^T3 B7 4^T3 814F60817’817(817G817I9933B7 4^T3 B7 4^T3 B7 4^T3
B7
4^T3 814G60817G817H816!816@9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
814H60817H
817J816]816!9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
814I60817J817L816_816]9933B
7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 814J60817L817N817 816_9933B7 4^T3 B7 4^T3
B7 4^T3 B7 4^T3 814K60817N817P8171817 9933B7 4^T3 B7 4^T3 B7 4^T3 B7
4^T3
814L60817P817R817381719933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
814M60817R817T81
7581739933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 814N60817T817V817781759933B7
4^T
3 B7 4^T3 B7 4^T3 B7 4^T3 814O60817V817X817981779933B7 4^T3 B7 4^T3 B7
4^
T3 B7 4^T3 814P60817X817Z817B81799933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
814Q6
0817Z817/817D817B9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 814R60817/817-
817F817D
9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 814S60817-817+817E817F9933B7 4^T3 B7
4^T3 B7 4^T3 B7 4^T3 814T60817+817$817C817E9933B7 4^T3 B7 4^T3 B7 4^T3 B7
4^T3 814U60817$817Y817A817C9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
814V60817Y8
17W8178817A9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
814W60817W817U817681789933B7
4^T3 B7 4^T3 B7 4^T3 B7 4^T3 814X60817U817S817481769933B7 4^T3 B7 4^T3
B
7 4^T3 B7 4^T3 814Y60817S817Q817281749933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
814Z60817Q817O817081729933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
814$60817O817M816
\81709933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 814/60817M817K816^816\9933B7
4^T3
B7 4^T3 B7 4^T3 B7 4^T3 814+60817K817I816[816^9933B7 4^T3 B7 4^T3 B7
4^T
3 B7 4^T3 814-60817I817G816@816[9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
814(60
816@816!816X816W9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
814)60816!816]816Z816X9
933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 814’60816]816_816/816Z9933B7 4^T3 B7
4
^T3 B7 4^T3 B7 4^T3 814=60816_817 816-816/9933B7 4^T3 B7 4^T3 B7 4^T3 B7
4^T3 814.60817 8171816)816-9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
814*60817181
73816=816)9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 814”6081738175816*816=9933B7
4^T3 B7 4^T3 B7 4^T3 B7 4^T3 814#6081758177816#816*9933B7 4^T3 B7 4^T3
B7
4^T3 B7 4^T3 814%6081778179816&816#9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
8
14&608179817B816;816&9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
814,60817B817D816<
816;9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 814;60817D817F816?816<9933B7 4^T3
B7 4^T3 B7 4^T3 B7 4^T3 814:60817F817E816>816?9933B7 4^T3 B7 4^T3 B7
4^T3
B7 4^T3 814<60817E817C816:816>9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
814>608
17C817A816,816:9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
814?60817A8178816%816,99
33B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 814@6081788176816”816%9933B7 4^T3 B7
4^
T3 B7 4^T3 B7 4^T3 814!6081768174816.816”9933B7 4^T3 B7 4^T3 B7 4^T3 B7
4
Main Index
CHAPTER 18 1809
Support Files

^T3 814[6081748172816’816.9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3


814]608172817
0816(816’9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 814^608170816\816+816(9933B7
4^T3 B7 4^T3 B7 4^T3 B7 4^T3 814_60816\816^816$816+9933B7 4^T3 B7 4^T3 B7
4^T3 B7 4^T3 814\60816^816[816Y816$9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
81
5 60816[816@816W816Y9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
815060816W816X81698
1689933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 815160816X816Z816B81699933B7 4^T3
B
7 4^T3 B7 4^T3 B7 4^T3 815260816Z816/816D816B9933B7 4^T3 B7 4^T3 B7 4^T3
B7 4^T3 815360816/816-816F816D9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
81546081
6-816)816H816F9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
815560816)816=816J816H993
3B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 815660816=816*816L816J9933B7 4^T3 B7
4^T
3 B7 4^T3 B7 4^T3 815760816*816#816N816L9933B7 4^T3 B7 4^T3 B7 4^T3 B7
4^
T3 815860816#816&816P816N9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
815960816&816;
816R816P9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 815A60816;816<816T816R9933B7
4
^T3 B7 4^T3 B7 4^T3 B7 4^T3 815B60816<816?816V816T9933B7 4^T3 B7 4^T3 B7
4^T3 B7 4^T3 815C60816?816>816U816V9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
815
D60816>816:816S816U9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
815E60816:816,816Q81
6S9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 815F60816,816%816O816Q9933B7 4^T3
B7
4^T3 B7 4^T3 B7 4^T3 815G60816%816”816M816O9933B7 4^T3 B7 4^T3 B7 4^T3
B
7 4^T3 815H60816”816.816K816M9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
815I60816
.816’816I816K9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
815J60816’816(816G816I9933
B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 815K60816(816+816E816G9933B7 4^T3 B7
4^T3
B7 4^T3 B7 4^T3 815L60816+816$816C816E9933B7 4^T3 B7 4^T3 B7 4^T3 B7
4^T
3 815M60816$816Y816A816C9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
815N60816Y816W8
168816A9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 815O6081688169815&815%9933B7
4^
T3 B7 4^T3 B7 4^T3 B7 4^T3 815P608169816B815;815&9933B7 4^T3 B7 4^T3 B7
4
^T3 B7 4^T3 815Q60816B816D815<815;9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
815R
60816D816F815?815<9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
815S60816F816H815!815
?9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 815T60816H816J815]815!9933B7 4^T3 B7
4^T3 B7 4^T3 B7 4^T3 815U60816J816L815_815]9933B7 4^T3 B7 4^T3 B7 4^T3
B7
4^T3 815V60816L816N816 815_9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
815W60816N
816P8161816 9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
815X60816P816R816381619933B
7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 815Y60816R816T816581639933B7 4^T3 B7 4^T3
B7 4^T3 B7 4^T3 815Z60816T816V816781659933B7 4^T3 B7 4^T3 B7 4^T3 B7
4^T3
815$60816V816U816681679933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
815/60816U816S81
6481669933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 815+60816S816Q816281649933B7
4^T
3 B7 4^T3 B7 4^T3 B7 4^T3 815-60816Q816O816081629933B7 4^T3 B7 4^T3 B7
4^
T3 B7 4^T3 815(60816O816M815\81609933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
815)6
0816M816K815^815\9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
815’60816K816I815[815^
9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 815=60816I816G815@815[9933B7 4^T3 B7
4^T3 B7 4^T3 B7 4^T3 815.60816G816E815>^81UF^815@9933B7 4^T3 B7 4^T3 B7
4^
Main Index
1810
Code Examples

T3 B7 4^T3 815*60816E816C815:815>9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3


815”6
0816C816A815,815:9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
815#60816A8168815%815,
9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 815%60815%815&815P815O9933B7 4^T3 B7
4^T3 B7 4^T3 B7 4^T3 815&60815&815;815R815P9933B7 4^T3 B7 4^T3 B7 4^T3 B7
4^T3 815,60815;815<815T815R9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
815;60815<8
15?815V815T9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
815:60815?815!815X815V9933B7
4^T3 B7 4^T3 B7 4^T3 B7 4^T3 815<60815!815]815Z815X9933B7 4^T3 B7 4^T3
B
7 4^T3 B7 4^T3 815>60815]815_815/815Z9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
815?60815_816 815-815/9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 815@60816
8161815
)815-9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 815!6081618163815=815)9933B7
4^T3
B7 4^T3 B7 4^T3 B7 4^T3 815[6081638165815*815=9933B7 4^T3 B7 4^T3 B7
4^T
3 B7 4^T3 815]6081658167815#815*9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
815^60
81678166815”815#9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
815_6081668164815.815”9
933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 815\6081648162815’815.9933B7 4^T3 B7
4
^T3 B7 4^T3 B7 4^T3 816 6081628160815(815’9933B7 4^T3 B7 4^T3 B7 4^T3 B7
4^T3 8160608160815\815+815(9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
816160815\81
5^815$815+9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 816260815^815[815Y815$9933B7
4^T3 B7 4^T3 B7 4^T3 B7 4^T3 816360815[815@815W815Y9933B7 4^T3 B7 4^T3
B7
4^T3 B7 4^T3 816460815@815>815U815W9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
8
16560815>815:815S815U9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
816660815:815,815Q
815S9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 816760815,815%815O815Q9933B7 4^T3
B7 4^T3 B7 4^T3 B7 4^T3 816860815O815P815181509933B7 4^T3 B7 4^T3 B7
4^T3
B7 4^T3 816960815P815R815381519933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
816A608
15R815T815581539933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
816B60815T815V8157815599
33B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 816C60815V815X815981579933B7 4^T3 B7
4^
T3 B7 4^T3 B7 4^T3 816D60815X815Z815B81599933B7 4^T3 B7 4^T3 B7 4^T3 B7
4
^T3 816E60815Z815/815D815B9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
816F60815/815
-815F815D9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 816G60815-815)815H815F9933B7
4^T3 B7 4^T3 B7 4^T3 B7 4^T3 816H60815)815=815J815H9933B7 4^T3 B7 4^T3 B7
4^T3 B7 4^T3 816I60815=815*815L815J9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
81
6J60815*815#815N815L9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
816K60815#815”815M8
15N9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 816L60815”815.815K815M9933B7 4^T3
B
7 4^T3 B7 4^T3 B7 4^T3 816M60815.815’815I815K9933B7 4^T3 B7 4^T3 B7 4^T3
B7 4^T3 816N60815’815(815G815I9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
816O6081
5(815+815E815G9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
816P60815+815$815C815E993
3B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 816Q60815$815Y815A815C9933B7 4^T3 B7
4^T
3 B7 4^T3 B7 4^T3 816R60815Y815W8158815A9933B7 4^T3 B7 4^T3 B7 4^T3 B7
4^
T3 816S60815W815U815681589933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
816T60815U815S
815481569933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 816U60815S815Q815281549933B7
4
^T3 B7 4^T3 B7 4^T3 B7 4^T3 816V60815Q815O815081529933B7 4^T3 B7 4^T3 B7
4^T3 B7 4^T3 816W6081508151814)814(9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
816
Main Index
CHAPTER 18 1811
Support Files

X6081518153814=814)9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3


816Y6081538155814*81
4=9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 816Z6081558157814#814*9933B7 4^T3
B7
4^T3 B7 4^T3 B7 4^T3 816$6081578159814&814#9933B7 4^T3 B7 4^T3 B7 4^T3
B
7 4^T3 816/608159815B814;814&9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
816+60815
B815D814<814;9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 816-
60815D815F814?814<9933
B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 816(60815F815H814!814?9933B7 4^T3 B7
4^T3
B7 4^T3 B7 4^T3 816)60815H815J814]814!9933B7 4^T3 B7 4^T3 B7 4^T3 B7
4^T
3 816’60815J815L814_814]9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
816=60815L815N8
15 814_9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 816.60815N815M814\815 9933B7
4^
T3 B7 4^T3 B7 4^T3 B7 4^T3 816*60815M815K814^814\9933B7 4^T3 B7 4^T3 B7
4
^T3 B7 4^T3 816”60815K815I814[814^9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
816#
60815I815G814@814[9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
816%60815G815E814>814
@9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 816&60815E815C814:814>9933B7 4^T3 B7
4^T3 B7 4^T3 B7 4^T3 816,60815C815A814,814:9933B7 4^T3 B7 4^T3 B7 4^T3
B7
4^T3 816;60815A8158814%814,9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
816:608158
8156814”814%9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
816<6081568154814.814”9933B
7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 816>6081548152814’814.9933B7 4^T3 B7 4^T3
B7 4^T3 B7 4^T3 816?6081528150814(814’9933B7 4^T3 B7 4^T3 B7 4^T3 B7
4^T3
816@60814(814)814H814G9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
816!60814)814=81
4J814H9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 816[60814=814*814L814J9933B7
4^T
3 B7 4^T3 B7 4^T3 B7 4^T3 816]60814*814#814N814L9933B7 4^T3 B7 4^T3 B7
4^
T3 B7 4^T3 816^60814#814&814P814N9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
816_6
0814&814;814R814P9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
816\60814;814<814T814R
9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 817 60814<814?814V814T9933B7 4^T3 B7
4^T3 B7 4^T3 B7 4^T3 817060814?814!814X814V9933B7 4^T3 B7 4^T3 B7 4^T3 B7
4^T3 817160814!814]814Z814X9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
817260814]8
14_814/814Z9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 817360814_815 814-
814/9933B7
4^T3 B7 4^T3 B7 4^T3 B7 4^T3 817460815 814\814+814-9933B7 4^T3 B7 4^T3 B
7 4^T3 B7 4^T3 817560814\814^814$814+9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
817660814^814[814Y814$9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
817760814[814@814
W814Y9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 817860814@814>814U814W9933B7
4^T3
B7 4^T3 B7 4^T3 B7 4^T3 817960814>814:814S814U9933B7 4^T3 B7 4^T3 B7
4^T
3 B7 4^T3 817A60814:814,814Q814S9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
817B60
814,814%814O814Q9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
817C60814%814”814M814O9
933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 817D60814”814.814K814M9933B7 4^T3 B7
4
^T3 B7 4^T3 B7 4^T3 817E60814.814’814I814K9933B7 4^T3 B7 4^T3 B7 4^T3 B7
4^T3 817F60814’814(814G814I9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
817G60814G81
4H813!813@9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 817H60814H814J813]813!9933B7
4^T3 B7 4^T3 B7 4^T3 B7 4^T3 817I60814J814L813_813]9933B7 4^T3 B7 4^T3
B7
4^T3 B7 4^T3 817J60814L814N814 813_9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 8
17K60814N814P8141814 9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
Main Index 817L60814P814R8143
1812
Code Examples

81419933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 817M60814R814T814581439933B7 4^T3


B7 4^T3 B7 4^T3 B7 4^T3 817N60814T814V814781459933B7 4^T3 B7 4^T3 B7
4^T3
B7 4^T3 817O60814V814X814981479933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
817P608
14X814Z814B81499933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
817Q60814Z814/814D814B99
33B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 817R60814/814-814F814D9933B7 4^T3 B7
4^
T3 B7 4^T3 B7 4^T3 817S60814-814+814E814F9933B7 4^T3 B7 4^T3 B7 4^T3 B7
4
^T3 817T60814+814$814C814E9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
817U60814$814
Y814A814C9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 817V60814Y814W8148814A9933B7
4^T3 B7 4^T3 B7 4^T3 B7 4^T3 817W60814W814U814681489933B7 4^T3 B7 4^T3 B7
4^T3 B7 4^T3 817X60814U814S814481469933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
81
7Y60814S814Q814281449933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
817Z60814Q814O81408
1429933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 817$60814O814M813\81409933B7 4^T3
B
7 4^T3 B7 4^T3 B7 4^T3 817/60814M814K813^813\9933B7 4^T3 B7 4^T3 B7 4^T3
B7 4^T3 817+60814K814I813[813^9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 817-
6081
4I814G813@813[9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
817(60813@813!813X813W993
3B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 817)60813!813]813Z813X9933B7 4^T3 B7
4^T
3 B7 4^T3 B7 4^T3 817’60813]813_813/813Z9933B7 4^T3 B7 4^T3 B7 4^T3 B7
4^
T3 817=60813_814 813-813/9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 817.60814
8141
813)813-9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 817*6081418143813=813)9933B7
4
^T3 B7 4^T3 B7 4^T3 B7 4^T3 817”6081438145813*813=9933B7 4^T3 B7 4^T3 B7
4^T3 B7 4^T3 817#6081458147813#813*9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
817
%6081478149813&813#9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
817&608149814B813;81
3&9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 817,60814B814D813<813;9933B7 4^T3
B7
4^T3 B7 4^T3 B7 4^T3 817;60814D814F813?813<9933B7 4^T3 B7 4^T3 B7 4^T3
B
7 4^T3 817:60814F814E813>813?9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
817<60814
E814C813:813>9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
817>60814C814A813,813:9933
B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 817?60814A8148813%813,9933B7 4^T3 B7
4^T3
B7 4^T3 B7 4^T3 817@6081488146813”813%9933B7 4^T3 B7 4^T3 B7 4^T3 B7
4^T
3 817!6081468144813.813”9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
817[60814481428
13’813.9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
817]608142^8102^8140813(813’9933
B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 817^608140813\813+813(9933B7 4^T3 B7
4^T3
B7 4^T3 B7 4^T3 817_60813\813^813$813+9933B7 4^T3 B7 4^T3 B7 4^T3 B7
4^T
3 817\60813^813[813Y813$9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 818
60813[813@8
13W813Y9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
^73^60^3^62^82E\\82E\\82E\\^74^6

0^3^3^HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
H
X 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ$/+-()’=.*”#%&,;:<>?@![]^_\
020080
61^GGEOMG3S ^4^66^810+33367813 3^71^60^3^61^GGEOMG3
^72^60^3^6C^820666^810J6
1B 4^T3 B 4^T3 60B 4^T3 62B 4^T3
6344^73^60^3^81UF^820#(8107813’60810WB
Main Index
CHAPTER 18 1813
Support Files

0 !%=XTB 0 !%=XTB 0 !%=XTB 0 !%=XT33399960810XB 1 C;G\ZB 1 C;G\ZB 1 C;G\ZB 1


C
;G\Z33399960810YB 1 I@F%EB 1 I@F%EB 1 I@F%EB 1 I@F%E33399960810ZB 1 MA”TAB 1
MA
“TAB 1 MA”TAB 1 MA”TA33399960810$B 0 !%’J\B 0 !%’J\B 0 !%’J\B 0
!%’J\3339996081
0/B 1 C;G”!B 1 C;G”!B 1 C;G”!B 1 C;G”!33399960810+B 1 I@F%EB 1 I@F%EB 1 I@F%EB
1 I@F%E33399960810-B 1 MA”TAB 1 MA”TAB 1 MA”TAB 1 MA”TA33399960810(B 0 !%’J\B
0
!%’J\B 0 !%’J\B 0 !%’J\33399960810)B 1 C;G”!B 1 C;G”!B 1 C;G”!B 1
C;G”!3339996
0810’B 1 I@F%EB 1 I@F%EB 1 I@F%EB 1 I@F%E33399960810=B 1 MA”TAB 1 MA”TAB 1
MA”T
AB 1 MA”TA33399960810.B 0 !%’J\B 0 !%’J\B 0 !%’J\B 0 !%’J\33399960810*B 1
C;G”!
B 1 C;G”!B 1 C;G”!B 1 C;G”!33399960810”B 1 I@F%EB 1 I@F%EB 1 I@F%EB 1
I@F%E3339
9960810#B 1 MA”TAB 1 MA”TAB 1 MA”TAB 1 MA”TA33399960810%B 0 !%’J\B 0 !%’J\B 0
!
%’J\B 0 !%’J\33399960810&B 1 C;G”!B 1 C;G”!B 1 C;G”!B 1 C;G”!33399960810,B 1
I@
F%EB 1 I@F%EB 1 I@F%EB 1 I@F%E33399960810;B 1 MA”TAB 1 MA”TAB 1 MA”TAB 1
MA”TA3
3399960810:B 0 !%’J\B 0 !%’J\B 0 !%’J\B 0 !%’J\33399960810<B 1 C;G”!B 1 C;G”!B
1 C;G”!B 1 C;G”!33399960810>B 1 I@F%EB 1 I@F%EB 1 I@F%EB 1 I@F%E33399960810?B
1
MA”TAB 1 MA”TAB 1 MA”TAB 1 MA”TA33399960810@B 0 !%’J\B 0 !%’J\B 0 !%’J\B 0
!%’
J\33399960810!B 1 C;G”!B 1 C;G”!B 1 C;G”!B 1 C;G”!33399960810[B 1 I@F%EB 1
I@F%
EB 1 I@F%EB 1 I@F%E33399960810]B 1 MA”TAB 1 MA”TAB 1 MA”TAB 1
MA”TA33399960810^
B 0 !%’J\B 0 !%’J\B 0 !%’J\B 0 !%’J\33399960810_B 1 C;G”!B 1 C;G”!B 1 C;G”!B 1
C;G”!33399960810\B 1 I@F%EB 1 I@F%EB 1 I@F%EB 1 I@F%E33399960811 B 1 MA”TAB 1
M
A”TAB 1 MA”TAB 1 MA”TA333999608110B 0 !%’J\B 0 !%’J\B 0 !%’J\B 0
!%’J\333999608
111B 1 C;G”!B 1 C;G”!B 1 C;G”!B 1 C;G”!333999608112B 1 I@F%EB 1 I@F%EB 1
I@F%EB
1 I@F%E333999608113B 1 MA”TAB 1 MA”TAB 1 MA”TAB 1 MA”TA333999608114B 0 !%’J\B
0 !%’J\B 0 !%’J\B 0 !%’J\333999608115B 1 C;G”!B 1 C;G”!B 1 C;G”!B 1
C;G”!333999
608116B 1 I@F%EB 1 I@F%EB 1 I@F%EB 1 I@F%E333999608117B 1 MA”TAB 1 MA”TAB 1
MA”
TAB 1 MA”TA333999608118B 0 !%’J\B 0 !%’J\B 0 !%’J\B 0 !%’J\333999608119B 1
C;G”
!B 1 C;G”!B 1 C;G”!B 1 C;G”!33399960811AB 1 I@F%EB 1 I@F%EB 1 I@F%EB 1
I@F%E333
99960811BB 1 MA”TAB 1 MA”TAB 1 MA”TAB 1 MA”TA33399960811CB 0 !%’J\B 0 !%’J\B 0
!%’J\B 0 !%’J\33399960811DB 1 C;G”!B 1 C;G”!B 1 C;G”!B 1 C;G”!33399960811EB 1
I
@F%EB 1 I@F%EB 1 I@F%EB 1 I@F%E33399960811FB 1 MA”TAB 1 MA”TAB 1 MA”TAB 1
MA”TA
33399960811GB 0 !%’J\B 0 !%’J\B 0 !%’J\B 0 !%’J\33399960811HB 1 C;G”!B 1
C;G”!B
1 C;G”!B 1 C;G”!33399960811IB 1 I@F%EB 1 I@F%EB 1 I@F%EB 1 I@F%E33399960811JB
1 MA”TAB 1 MA”TAB 1 MA”TAB 1 MA”TA33399960811KB 0 !%’J\B 0 !%’J\B 0 !%’J\B 0
!%
‘J\33399960811LB 1 C;G”!B 1 C;G”!B 1 C;G”!B 1 C;G”!33399960811MB 1 I@F%EB 1
I@F
%EB 1 I@F%EB 1 I@F%E33399960811NB 1 MA”TAB 1 MA”TAB 1 MA”TAB 1
MA”TA33399960811
OB 0 !%’J\B 0 !%’J\B 0 !%’J\B 0 !%’J\33399960811PB 1 C;G”!B 1 C;G”!B 1 C;G”!B
1
C;G”!33399960811QB 1 I@F%EB 1 I@F%EB 1 I@F%EB 1 I@F%E33399960811RB 1 MA”TAB 1
MA”TAB 1 MA”TAB 1 MA”TA33399960811SB 0 !%’J\B 0 !%’J\B 0 !%’J\B 0
!%’J\33399960
811TB 1 C;G”!B 1 C;G”!B 1 C;G”!B 1 C;G”!33399960811UB 1 I@F%EB 1 I@F%EB 1
I@F%E
B 1 I@F%E33399960811VB 1 MA”TAB 1 MA”TAB 1 MA”TAB 1 MA”TA33399960811WB 0
!%’J\B
0 !%’J\B 0 !%’J\B 0 !%’J\33399960811XB 1 C;G”!B 1 C;G”!B 1 C;G”!B 1
C;G”!33399
Main Index
1814
Code Examples

960811YB 1 I@F%EB 1 I@F%EB 1 I@F%EB 1 I@F%E33399960811ZB 1 MA”TAB 1 MA”TAB 1


MA
“TAB 1 MA”TA33399960811$B 0 !%’J\B 0 !%’J\B 0 !%’J\B 0 !%’J\33399960811/B 1
C;G
“!B 1 C;G”!B 1 C;G”!B 1 C;G”!33399960811+B 1 I@F%EB 1 I@F%EB 1 I@F%EB 1
I@F%E33
399960811-B 1 MA”TAB 1 MA”TAB 1 MA”TAB 1 MA”TA33399960811(B 0 !%’J\B 0 !%’J\B
0
!%’J\B 0 !%’J\33399960811)B 1 C;G”!B 1 C;G”!B 1 C;G”!B 1 C;G”!33399960811’B 1
I@F%EB 1 I@F%EB 1 I@F%EB 1 I@F%E33399960811=B 1 MA”TAB 1 MA”TAB 1 MA”TAB 1
MA”T
A33399960811.B 0 !%’J\B 0 !%’J\B 0 !%’J\B 0 !%’J\33399960811*B 1 C;G”!B 1
C;G”!
B 1 C;G”!B 1 C;G”!33399960811”B 1 I@F%EB 1 I@F%EB 1 I@F%EB 1
I@F%E33399960811#B
1 MA”TAB 1 MA”TAB 1 MA”TAB 1 MA”TA33399960811%B 0 !%’J\B 0 !%’J\B 0 !%’J\B 0
!
%’J\33399960811&B 1 C;G”!B 1 C;G”!B 1 C;G”!B 1 C;G”!33399960811,B 1 I@F%EB 1
I@
F%EB 1 I@F%EB 1 I@F%E33399960811;B 1 MA”TAB 1 MA”TAB 1 MA”TAB 1
MA”TA3339996081
1:B 0 !%’J\B 0 !%’J\B 0 !%’J\B 0 !%’J\33399960811<B 1 C;G”!B 1 C;G”!B 1 C;G”!B
1 C;G”!33399960811>B 1 I@F%EB 1 I@F%EB 1 I@F%EB 1 I@F%E33399960811?B 1 MA”TAB
1
MA”TAB 1 MA”TAB 1 MA”TA33399960811@B 0 !%’J\B 0 !%’J\B 0 !%’J\B 0
!%’J\3339996
0811!B 1 C;G”!B 1 C;G”!B 1 C;G”!B 1 C;G”!33399960811[B 1 I@F%EB 1 I@F%EB 1
I@F%
EB 1 I@F%E33399960811]B 1 MA”TAB 1 MA”TAB 1 MA”TAB 1 MA”TA33399960811^B 0
!%/[L
B 0 !%/[LB 0 !%/[LB 0 !%/[L33399960811_B 1 C;GVGB 1 C;GVGB 1 C;GVGB 1
C;GVG3339
9960811\B 1 I@FW/B 1 I@FW/B 1 I@FW/B 1 I@FW/33399960812 B 1 MA”DXB 1 MA”DXB 1
M
A”DXB 1 MA”DX333999608150B 0 !%=XTB 0 !%=XTB 0 !%=XTB 0 !%=XT333999608151B 0
!%
‘J\B 0 !%’J\B 0 !%’J\B 0 !%’J\333999608152B 0 !%’J\B 0 !%’J\B 0 !%’J\B 0
!%’J\3
33999608153B 0 !%’J\B 0 !%’J\B 0 !%’J\B 0 !%’J\333999608154B 0 !%’J\B 0 !%’J\B
0 !%’J\B 0 !%’J\333999608155B 0 !%’J\B 0 !%’J\B 0 !%’J\B 0 !%’J\333999608156B
0
!%’J\B 0 !%’J\B 0 !%’J\B 0 !%’J\333999608157B 0 !%’J\B 0 !%’J\B 0 !%’J\B 0
!%’
J\333999608158B 0 !%’J\B 0 !%’J\B 0 !%’J\B 0 !%’J\333999608159B 0 !%’J\B 0
!%’J
\B 0 !%’J\B 0 !%’J\33399960815AB 0 !%’J\B 0 !%’J\B 0 !%’J\B 0
!%’J\33399960815B
B 0 !%’J\B 0 !%’J\B 0 !%’J\B 0 !%’J\33399960815CB 0 !%’J\B 0 !%’J\B 0 !%’J\B 0
!%’J\33399960815DB 0 !%’J\B 0 !%’J\B 0 !%’J\B 0 !%’J\33399960815EB 0 !%’J\B 0
!
%’J\B 0 !%’J\B 0 !%’J\33399960815FB 0 !%’J\B 0 !%’J\B 0 !%’J\B 0
!%’J\333999608
15GB 0 !%’J\B 0 !%’J\B 0 !%’J\B 0 !%’J\33399960815HB 0 !%’J\B 0 !%’J\B 0
!%’J\B
0 !%’J\33399960815IB 0 !%’J\B 0 !%’J\B 0 !%’J\B 0 !%’J\33399960815JB 0 !%’J\B
0 !%’J\B 0 !%’J\B 0 !%’J\33399960815KB 0 !%’J\B 0 !%’J\B 0 !%’J\B 0
!%’J\333999
60815LB 0 !%’J\B 0 !%’J\B 0 !%’J\B 0 !%’J\33399960815MB 0 !%’J\B 0 !%’J\B 0
!%’
J\B 0 !%’J\33399960815NB 0 !%/[LB 0 !%/[LB 0 !%/[LB 0 !%/[L33399960815OB 1
C;G\
ZB 1 C;G\ZB 1 C;G\ZB 1 C;G\Z33399960815PB 1 C;G”!B 1 C;G”!B 1 C;G”!B 1
C;G”!333
99960815QB 1 C;G”!B 1 C;G”!B 1 C;G”!B 1 C;G”!33399960815RB 1 C;G”!B 1 C;G”!B 1
C;G”!B 1 C;G”!33399960815SB 1 C;G”!B 1 C;G”!B 1 C;G”!B 1 C;G”!33399960815TB 1
C
;G”!B 1 C;G”!B 1 C;G”!B 1 C;G”!33399960815UB 1 C;G”!B 1 C;G”!B 1 C;G”!B 1
C;G”!
33399960815VB 1 C;G”!B 1 C;G”!B 1 C;G”!B 1 C;G”!33399960815WB 1 C;G”!B 1
C;G”!B
1 C;G”!B 1 C;G”!33399960815XB 1 C;G”!B 1 C;G”!B 1 C;G”!B 1 C;G”!33399960815YB
1 C;G”!B 1 C;G”!B 1 C;G”!B 1 C;G”!33399960815ZB 1 C;G”!B 1 C;G”!B 1 C;G”!B 1
C;
Main Index
CHAPTER 18 1815
Support Files

G”!33399960815$B 1 C;G”!B 1 C;G”!B 1 C;G”!B 1 C;G”!33399960815/B 1 C;G”!B 1


C;G
“!B 1 C;G”!B 1 C;G”!33399960815+B 1 C;G”!B 1 C;G”!B 1 C;G”!B 1
C;G”!33399960815
-B 1 C;G”!B 1 C;G”!B 1 C;G”!B 1 C;G”!33399960815(B 1 C;G”!B 1 C;G”!B 1 C;G”!B
1
C;G”!33399960815)B 1 C;G”!B 1 C;G”!B 1 C;G”!B 1 C;G”!33399960815’B 1 C;G”!B 1
C;G”!B 1 C;G”!B 1 C;G”!33399960815=B 1 C;G”!B 1 C;G”!B 1 C;G”!B 1
C;G”!33399960
815.B 1 C;G”!B 1 C;G”!B 1 C;G”!B 1 C;G”!33399960815*B 1 C;G”!B 1 C;G”!B 1
C;G”!
B 1 C;G”!33399960815”B 1 C;G”!B 1 C;G”!B 1 C;G”!B 1 C;G”!33399960815#B 1
C;GVGB
1 C;GVGB 1 C;GVGB 1 C;GVG33399960815%B 1 I@F%EB 1 I@F%EB 1 I@F%EB 1
I@F%E33399
960815&B 1 I@F%EB 1 I@F%EB 1 I@F%EB 1 I@F%E33399960815,B 1 I@F%EB 1 I@F%EB 1
I@
F%EB 1 I@F%E33399960815;B 1 I@F%EB 1 I@F%EB 1 I@F%EB 1 I@F%E33399960815:B 1
I@F
%EB 1 I@F%EB 1 I@F%EB 1 I@F%E33399960815<B 1 I@F%EB 1 I@F%EB 1 I@F%EB 1
I@F%E33
399960815>B 1 I@F%EB 1 I@F%EB 1 I@F%EB 1 I@F%E33399960815?B 1 I@F%EB 1 I@F%EB
1
I@F%EB 1 I@F%E33399960815@B 1 I@F%EB 1 I@F%EB 1 I@F%EB 1 I@F%E33399960815!B 1
I@F%EB 1 I@F%EB 1 I@F%EB 1 I@F%E33399960815[B 1 I@F%EB 1 I@F%EB 1 I@F%EB 1
I@F%
E33399960815]B 1 I@F%EB 1 I@F%EB 1 I@F%EB 1 I@F%E33399960815^B 1 I@F%EB 1
I@F%E
B 1 I@F%EB 1 I@F%E33399960815_B 1 I@F%EB 1 I@F%EB 1 I@F%EB 1
I@F%E33399960815\B
1 I@F%EB 1 I@F%EB 1 I@F%EB 1 I@F%E33399960816 B 1 I@F%EB 1 I@F%EB 1 I@F%EB 1
I
@F%E333999608160B 1 I@F%EB 1 I@F%EB 1 I@F%EB 1 I@F%E333999608161B 1 I@F%EB 1
I@
F%EB 1 I@F%EB 1 I@F%E333999608162B 1 I@F%EB 1 I@F%EB 1 I@F%EB 1
I@F%E3339996081
63B 1 I@F%EB 1 I@F%EB 1 I@F%EB 1 I@F%E333999608164B 1 I@F%EB 1 I@F%EB 1 I@F%EB
1 I@F%E333999608165B 1 I@F%EB 1 I@F%EB 1 I@F%EB 1 I@F%E333999608166B 1 I@F%EB
1
I@F%EB 1 I@F%E^81UF^B 1 I@F%E333999608167B 1 I@FW/B 1 I@FW/B 1 I@FW/B 1
I@FW/3
33999608168B 1 MA”TAB 1 MA”TAB 1 MA”TAB 1 MA”TA333999608169B 1 MA”TAB 1 MA”TAB
1 MA”TAB 1 MA”TA33399960816AB 1 MA”TAB 1 MA”TAB 1 MA”TAB 1 MA”TA33399960816BB
1
MA”TAB 1 MA”TAB 1 MA”TAB 1 MA”TA33399960816CB 1 MA”TAB 1 MA”TAB 1 MA”TAB 1
MA”
TA33399960816DB 1 MA”TAB 1 MA”TAB 1 MA”TAB 1 MA”TA33399960816EB 1 MA”TAB 1
MA”T
AB 1 MA”TAB 1 MA”TA33399960816FB 1 MA”TAB 1 MA”TAB 1 MA”TAB 1
MA”TA33399960816G
B 1 MA”TAB 1 MA”TAB 1 MA”TAB 1 MA”TA33399960816HB 1 MA”TAB 1 MA”TAB 1 MA”TAB 1
MA”TA33399960816IB 1 MA”TAB 1 MA”TAB 1 MA”TAB 1 MA”TA33399960816JB 1 MA”TAB 1
M
A”TAB 1 MA”TAB 1 MA”TA33399960816KB 1 MA”TAB 1 MA”TAB 1 MA”TAB 1
MA”TA333999608
16LB 1 MA”TAB 1 MA”TAB 1 MA”TAB 1 MA”TA33399960816MB 1 MA”TAB 1 MA”TAB 1
MA”TAB
1 MA”TA33399960816NB 1 MA”TAB 1 MA”TAB 1 MA”TAB 1 MA”TA33399960816OB 1 MA”TAB
1 MA”TAB 1 MA”TAB 1 MA”TA33399960816PB 1 MA”TAB 1 MA”TAB 1 MA”TAB 1
MA”TA333999
60816QB 1 MA”TAB 1 MA”TAB 1 MA”TAB 1 MA”TA33399960816RB 1 MA”TAB 1 MA”TAB 1
MA”
TAB 1 MA”TA33399960816SB 1 MA”TAB 1 MA”TAB 1 MA”TAB 1 MA”TA33399960816TB 1
MA”T
AB 1 MA”TAB 1 MA”TAB 1 MA”TA33399960816UB 1 MA”TAB 1 MA”TAB 1 MA”TAB 1
MA”TA333
99960816VB 1 MA”DXB 1 MA”DXB 1 MA”DXB 1 MA”DX333999628120B 1 M:?F B 1 M:?F B 1
M:?F B 1 M:?F 333999628121B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 333999628122B 1
M
:?F B 1 M:?F B 1 M:?F B 1 M:?F 333999628123B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F
333999628124B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 333999628125B 1 M:?F B 1 M:?F
B
Main Index 1 M:?F B 1 M:?F 333999628126B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 333999628127B
1816
Code Examples

1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 333999628128B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:


?F 333999628129B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962812AB 1 M:?F B 1
M:?
F B 1 M:?F B 1 M:?F 33399962812BB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962812
CB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962812DB 1 M:?F B 1 M:?F B 1 M:?F B 1
M:?F 33399962812EB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962812FB 1 M:?F B 1
M:?F B 1 M:?F B 1 M:?F 33399962812GB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962
812HB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962812IB 1 M:?F B 1 M:?F B 1 M:?F
B 1 M:?F 33399962812JB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962812KB 1 M:?F
B
1 M:?F B 1 M:?F B 1 M:?F 33399962812LB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399
962812MB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962812NB 1 M:?F B 1 M:?F B 1 M:
?F B 1 M:?F 33399962812OB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962812PB 1
M:?
F B 1 M:?F B 1 M:?F B 1 M:?F 33399962812QB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33
399962812RB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962812SB 1 M:?F B 1 M:?F B 1
M:?F B 1 M:?F 33399962812TB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962812UB 1
M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962812VB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F
33399962812WB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962812XB 1 M:?F B 1 M:?F
B 1 M:?F B 1 M:?F 33399962812YB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F
33399962812ZB
1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962812$B 1 M:?F B 1 M:?F B 1 M:?F B 1 M
:?F 33399962812/B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962812+B 1 M:?F B 1
M:
?F B 1 M:?F B 1 M:?F 33399962812-B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 3339996281
2(B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962812)B 1 M:?F B 1 M:?F B 1 M:?F B
1 M:?F 33399962812’B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962812=B 1 M:?F B
1
M:?F B 1 M:?F B 1 M:?F 33399962812.B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 3339996
2812*B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962812”B 1 M:?F B 1 M:?F B 1 M:?F
B 1 M:?F 33399962812#B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962812%B 1 M:?F
B 1 M:?F B 1 M:?F B 1 M:?F 33399962812&B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 3339
9962812,B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962812;B 1 M:?F B 1 M:?F B 1 M
:?F B 1 M:?F 33399962812:B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962812<B 1
M:
?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962812>B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 3
3399962812?B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962812@B 1 M:?F B 1 M:?F B
1 M:?F B 1 M:?F 33399962812!B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962812[B
1
M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962812]B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?
F 33399962812^B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962812_B 1 M:?F B 1
M:?F
B 1 M:?F B 1 M:?F 33399962812\B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962813
B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 333999628130B 1 M:?F B 1 M:?F B 1 M:?F B 1
M:?F 333999628131B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 333999628132B 1 M:?F B 1
M
:?F B 1 M:?F B 1 M:?F 333999628133B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 333999628
134B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 333999628135B 1 M:?F B 1 M:?F B 1 M:?F B
1 M:?F 333999628136B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 333999628137B 1 M:?F B
1 M:?F B 1 M:?F B 1 M:?F 333999628138B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 333999
628139B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962813AB 1 M:?F B 1 M:?F B 1 M:?
F B 1 M:?F 33399962813BB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962813CB 1
M:?F
B 1 M:?F B 1 M:?F B 1 M:?F 33399962813DB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 333
99962813EB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962813FB 1 M:?F B 1 M:?F B 1
M:?F B 1 M:?F 33399962813GB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962813HB 1
M
:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962813IB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F
33399962813JB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962813KB 1 M:?F B 1 M:?F
B
1 M:?F B 1 M:?F 33399962813LB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962813MB
1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962813NB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:
?F 33399962813OB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962813PB 1 M:?F B 1
M:?
F B 1 M:?F B 1 M:?F 33399962813QB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962813
RB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962813SB 1 M:?F B 1 M:?F B 1 M:?F B 1
M:?F 33399962813TB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962813UB 1 M:?F B 1
M:?F B 1 M:?F B 1 M:?F 33399962813VB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962
816WB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962816XB 1 M:?F B 1 M:?F B 1 M:?F
Main Index
CHAPTER 18 1817
Support Files

B 1 M:?F 33399962816YB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962816ZB 1 M:?F


B
1 M:?F B 1 M:?F B 1 M:?F 33399962816$B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399
962816/B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962816+B 1 M:?F B 1 M:?F B 1 M:
?F B 1 M:?F 33399962816-B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962816(B 1
M:?
F B 1 M:?F B 1 M:?F B 1 M:?F 33399962816)B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33
399962816’B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962816=B 1 M:?F B 1 M:?F B 1
M:?F B 1 M:?F 33399962816.B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962816*B 1
M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962816”B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F
33399962816#B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962816%B 1 M:?F B 1 M:?F
B 1 M:?F B 1 M:?F 33399962816&B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F
33399962816,B
1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962816;B 1 M:?F B 1 M:?F B 1 M:?F B 1 M
:?F 33399962816:B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962816<B 1 M:?F B 1
M:
?F B 1 M:?F B 1 M:?F 33399962816>B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 3339996281
6?B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962816@B 1 M:?F B 1 M:?F B 1 M:?F B
1 M:?F 33399962816!B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962816[B 1 M:?F B
1
M:?F B 1 M:?F B 1 M:?F 33399962816]B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 3339996
2816^B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962816_B 1 M:?F B 1 M:?F B 1 M:?F
B 1 M:?F 33399962816\B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962817 B 1 M:?F
B 1 M:?F B 1 M:?F B 1 M:?F 333999628170B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 3339
99628171B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 333999628172B 1 M:?F B 1 M:?F B 1 M
:?F B 1 M:?F 333999628173B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 333999628174B 1
M:
?F B 1 M:?F B 1 M:?F B 1 M:?F 333999628175B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 3
33999628176B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 333999628177B 1 M:?F B 1 M:?F B
1 M:?F B 1 M:?F 333999628178B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 333999628179B
1
M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962817AB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?
F 33399962817BB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962817CB 1 M:?F B 1
M:?F
B 1 M:?F B 1 M:?F 33399962^81UF^817DB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 333999
62817EB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962817FB 1 M:?F B 1 M:?F B 1 M:?
F B 1 M:?F 33399962817GB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962817HB 1
M:?F
B 1 M:?F B 1 M:?F B 1 M:?F 33399962817IB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 333
99962817JB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962817KB 1 M:?F B 1 M:?F B 1
M:?F B 1 M:?F 33399962817LB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962817MB 1
M
:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962817NB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F
33399962817OB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962817PB 1 M:?F B 1 M:?F
B
1 M:?F B 1 M:?F 33399962817QB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962817RB
1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962817SB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:
?F 33399962817TB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962817UB 1 M:?F B 1
M:?
F B 1 M:?F B 1 M:?F 33399962817VB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962817
WB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962817XB 1 M:?F B 1 M:?F B 1 M:?F B 1
M:?F 33399962817YB 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962817ZB 1 M:?F B 1
M:?F B 1 M:?F B 1 M:?F 33399962817$B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962
817/B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962817+B 1 M:?F B 1 M:?F B 1 M:?F
B 1 M:?F 33399962817-B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962817(B 1 M:?F
B
1 M:?F B 1 M:?F B 1 M:?F 33399962817)B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399
962817’B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962817=B 1 M:?F B 1 M:?F B 1 M:
?F B 1 M:?F 33399962817.B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962817*B 1
M:?
F B 1 M:?F B 1 M:?F B 1 M:?F 33399962817”B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33
399962817#B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962817%B 1 M:?F B 1 M:?F B 1
M:?F B 1 M:?F 33399962817&B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962817,B 1
M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962817;B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F
33399962817:B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962817<B 1 M:?F B 1 M:?F
B 1 M:?F B 1 M:?F 33399962817>B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F
33399962817?B
1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962817@B 1 M:?F B 1 M:?F B 1 M:?F B 1 M
:?F 33399962817!B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962817[B 1 M:?F B 1
M:
Main Index
1818
Code Examples

?F B 1 M:?F B 1 M:?F 33399962817]B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 3339996281


7^B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962817_B 1 M:?F B 1 M:?F B 1 M:?F B
1 M:?F 33399962817\B 1 M:?F B 1 M:?F B 1 M:?F B 1 M:?F 33399962818 B 1 M:?F B 1
M:?F B 1 M:?F B 1 M:?F 3339996360B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999636
1B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 3339996362B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A
!]7 3339996363B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 3339996364B 0 A!]7 B 0 A!]7 B
0 A!]7 B 0 A!]7 3339996365B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 3339996366B 0 A!
]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 3339996367B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333
9996368B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 3339996369B 0 A!]7 B 0 A!]7 B 0 A!]7
B 0 A!]7 333999636AB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999636BB 0 A!]7 B 0
A!]7 B 0 A!]7 B 0 A!]7 333999636CB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999636D
B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999636EB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!
]7 333999636FB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999636GB 0 A!]7 B 0 A!]7 B
0 A!]7 B 0 A!]7 333999636HB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999636IB 0 A!]
7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999636JB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 3339
99636KB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999636LB 0 A!]7 B 0 A!]7 B 0 A!]7
B 0 A!]7 333999636MB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999636NB 0 A!]7 B 0 A
!]7 B 0 A!]7 B 0 A!]7 333999636OB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999636PB
0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999636QB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]
7 333999636RB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999636SB 0 A!]7 B 0 A!]7 B 0
A!]7 B 0 A!]7 333999636TB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999636UB 0 A!]7
B 0 A!]7 B 0 A!]7 B 0 A!]7 333999636VB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399
9636WB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999636XB 0 A!]7 B 0 A!]7 B 0 A!]7 B
0 A!]7 333999636YB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999636ZB 0 A!]7 B 0 A!
]7 B 0 A!]7 B 0 A!]7 333999636$B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999636/B
0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999636+B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7
333999636-B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999636(B 0 A!]7 B 0 A!]7 B 0
A!]7 B 0 A!]7 333999636)B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999636’B 0 A!]7
B 0 A!]7 B 0 A!]7 B 0 A!]7 333999636=B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999
636.B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999636*B 0 A!]7 B 0 A!]7 B 0 A!]7 B
0 A!]7 333999636”B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999636#B 0 A!]7 B 0 A!]
7 B 0 A!]7 B 0 A!]7 333999636%B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999636&B 0
A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999636,B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7
333999636;B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999636:B 0 A!]7 B 0 A!]7 B 0 A
!]7 B 0 A!]7 333999636<B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999636>B 0 A!]7 B
0 A!]7 B 0 A!]7 B 0 A!]7 333999636?B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 3339996
36@B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999636!B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0
A!]7 333999636[B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999636]B 0 A!]7 B 0 A!]7
B 0 A!]7 B 0 A!]7 333999636^B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999636_B 0
A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999636\B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 3
3399963810 B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999638100B 0 A!]7 B 0 A!]7 B
0 A!]7 B 0 A!]7 333999638101B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999638102B
0
A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999638103B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]
7 333999638104B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999638105B 0 A!]7 B 0
A!]7
B 0 A!]7 B 0 A!]7 333999638106B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999638107
B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999638108B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0
A!]7 333999638109B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963810AB 0 A!]7 B 0
A
!]7 B 0 A!]7 B 0 A!]7 33399963810BB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999638
10CB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963810DB 0 A!]7 B 0 A!]7 B 0 A!]7 B
0 A!]7 33399963810EB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963810FB 0 A!]7 B
0 A!]7 B 0 A!]7 B 0 A!]7 33399963810GB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999
63810HB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963810IB 0 A!]7 B 0 A!]7 B 0 A!]
7 B 0 A!]7 33399963810JB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963810KB 0
A!]7
B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963810LB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333
99963810MB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963810NB 0 A!]7 B 0 A!]7 B 0
A!]7 B 0 A!]7 33399963810OB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963810PB 0
A
!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963810QB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7
33399963810RB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963810SB 0 A!]7 B 0 A!]7
B
0 A!]7 B 0 A!]7 33399963810TB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963810UB
0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963810VB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!
]7 33399963813WB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963813XB 0 A!]7 B 0
A!]
Main Index
CHAPTER 18 1819
Support Files

7 B 0 A!]7 B 0 A!]7 33399963813YB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963813


ZB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963813$B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0
A!]7 33399963813/B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963813+B 0 A!]7 B 0
A!]7 B 0 A!]7 B 0 A!]7 33399963813-B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963
813(B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963813)B 0 A!]7 B 0 A!]7 B 0 A!]7
B 0 A!]7 33399963813’B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963813=B 0 A!]7
B
0 A!]7 B 0 A!]7 B 0 A!]7 33399963813.B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399
963813*B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963813”B 0 A!]7 B 0 A!]7 B 0 A!
]7 B 0 A!]7 33399963813#B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963813%B 0
A!]
7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963813&B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33
399963813,B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963813;B 0 A!]7 B 0 A!]7 B 0
A!]7 B 0 A!]7 333^81DI^99963813:B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7
3339996381
3<B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963813>B 0 A!]7 B 0 A!]7 B 0 A!]7 B
0 A!]7 33399963813?B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963813@B 0 A!]7 B
0
A!]7 B 0 A!]7 B 0 A!]7 33399963813!B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 3339996
3813[B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963813]B 0 A!]7 B 0 A!]7 B 0 A!]7
B 0 A!]7 33399963813^B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963813_B 0 A!]7
B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963813\B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 3339
9963814 B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999638140B 0 A!]7 B 0 A!]7 B 0 A
!]7 B 0 A!]7 333999638141B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999638142B 0
A!
]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999638143B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 3
33999638144B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999638145B 0 A!]7 B 0 A!]7 B
0 A!]7 B 0 A!]7 333999638146B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999638147B
0
A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999638148B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]
7 333999638149B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963814AB 0 A!]7 B 0
A!]7
B 0 A!]7 B 0 A!]7 33399963814BB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963814C
B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963814DB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0
A!]7 33399963814EB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963814FB 0 A!]7 B 0
A
!]7 B 0 A!]7 B 0 A!]7 33399963814GB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999638
14HB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963814IB 0 A!]7 B 0 A!]7 B 0 A!]7 B
0 A!]7 33399963814JB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963814KB 0 A!]7 B
0 A!]7 B 0 A!]7 B 0 A!]7 33399963814LB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333999
63814MB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963814NB 0 A!]7 B 0 A!]7 B 0 A!]
7 B 0 A!]7 33399963814OB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963814PB 0
A!]7
B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963814QB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 333
99963814RB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963814SB 0 A!]7 B 0 A!]7 B 0
A!]7 B 0 A!]7 33399963814TB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963814UB 0
A
!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963814VB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7
33399963814WB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963814XB 0 A!]7 B 0 A!]7
B
0 A!]7 B 0 A!]7 33399963814YB 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963814ZB
0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963814$B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!
]7 33399963814/B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963814+B 0 A!]7 B 0
A!]
7 B 0 A!]7 B 0 A!]7 33399963814-B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963814
(B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963814)B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0
A!]7 33399963814’B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963814=B 0 A!]7 B 0
A!]7 B 0 A!]7 B 0 A!]7 33399963814.B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963
814*B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963814”B 0 A!]7 B 0 A!]7 B 0 A!]7
B 0 A!]7 33399963814#B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963814%B 0 A!]7
B
0 A!]7 B 0 A!]7 B 0 A!]7 33399963814&B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399
963814,B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963814;B 0 A!]7 B 0 A!]7 B 0 A!
]7 B 0 A!]7 33399963814:B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963814<B 0
A!]
7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963814>B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33
399963814?B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963814@B 0 A!]7 B 0 A!]7 B 0
A!]7 B 0 A!]7 33399963814!B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963814[B 0
A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963814]B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7
Main Index
1820
Code Examples

33399963814^B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963814_B 0 A!]7 B 0 A!]7


B 0 A!]7 B 0 A!]7 33399963814\B 0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7 33399963815 B
0 A!]7 B 0 A!]7 B 0 A!]7 B 0 A!]7
333999^74^60^3^62^82E\\82E\\82E\\^75^60^3^3^

HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
H
X 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ$/+-()’=.*”#%&,;:<>?@![]^_\
020080
61^GGEOMG4S ^4^66^810-333810V33^71^60^3^61^GGEOMG4
^72^60^3^67^820K(6!6B6082
T8
3813W4^73^60^3^65^820K,6[6C61604^74^60^3^62^82E\\82E\\82E\\^75^60^3^3^HHHHHH
X 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ$/+-()’=.*”#%&,;:<>?@![]^_\
020080
61^GEPTSF^4^66^810(3817 3333^71^60^3^61^GIEPTF^72^60^3^6D^81Y_6M813Q6060B30
3T5
Y 60B 4^T3 60B
3^@2I9M0M03^73^60^3^62^82E\\82E\\82E\\^74^60^3^3^HHHHHHHHHHH
X 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ$/+-()’=.*”#%&,;:<>?@![]^_\
020080
61^GMPTSF^4^66^810$827 33333^71^60^3^61^GMPT F^72^60^3^6E^810+60810C60B 6
50HB
\B 5 L-R <B 0^?(0B30 4^T3
9999993^73^60^3^62^82E\\82E\\82E\\^74^60^3^3^HHHHHH
X 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ$/+-()’=.*”#%&,;:<>?@![]^_\
020080
61^GOQG1F^4^66^810$3820A
3333^71^60^3^66^GOQG1F6666810W360^72^60^3^811H^6A62360
60336160673333333333333333333333333333333333333333G MSCG/NASGTRANG JOBG
CREGATE
DG ON G07-JGUL-9G7 ATG 08:G51:0G7 FFFFFFFFFFFFFFFFFFFGDEFAGULT
FFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFGSUBCGASE G1
FFF^73^60^3^81UF^6A609

999996K609999996U609999996(609999996,609999996^60999999810660999999810G6099999
9

810Q60999999810$60999999810”60999999810@60999999811260999999811C60999999811M60
9

99999811W60999999811’60999999811:60999999811\60999999812860999999812I609999998
1

2S60999999812+60999999812%60999999812[60999999813460999999813E60999999813O6099
9

999813Y60999999813.60999999813>60999999814060999999814A60999999814K60999999814
U

60999999814(60999999814,60999999814^60999999815660999999815G60999999815Q609999
9

9815$60999999815”60999999815@60999999816260999999816C60999999816M60999999816W6
0

999999816’60999999816:60999999816\60999999817860999999817I60999999817S60999999
8

17+60999999817%60999999817[60999999818460999999818E60999999818O60999999818Y609
9

9999818.60999999818>60999999819060999999819A60999999819K60999999819U6099999981
9

(60999999819,60999999819^6099999981A66099999981AG6099999981AQ6099999981A$60999
9

9981A”6099999981A@6099999981B26099999981BC6099999981BM6099999981BW6099999981B’
6

099999981B:6099999981B\6099999981C86099999981CI6099999981CS6099999981C+6099999
9
Main Index
CHAPTER 18 1821
Support Files

81C%6099999981C[6099999981D46099999981DE6099999981DO6099999981DY6099999981D.60
9

9999981D>6099999981E06099999981EA6099999981EK6099999981EU6099999981E(609999998
1

E,6099999981E^6099999981F66099999981FG6099999981FQ6099999981F$6099999981F”6099
9

99981F@6099999981G26099999981GC6099999981GM6099999981GW6099999981G’6099999981G
:

6099999981G\6099999981H86099999981HI6099999981HS6099999981H+6099999981H%609999
9

981H[6099999981I46099999981IE6099999981IO6099999981IY6099999981I.6099999981I>6
0

99999981J06099999981JA6099999981JK6099999981JU6099999981J(6099999981J,60999999
8

1J^6099999981K66099999981KG6099999981KQ6099999981K$6099999981K”6099999981K@609
9

999981L26099999981LC6099999981LM6099999981LW6099999981L’6099999981L:6099999981
L

\6099999981M86099999981MI6099999981MS6099999981M+6099999981M%6099999981M[60999
9

9981N46099999981NE6099999981NO6099999981NY6099999981N.6099999981N>6099999981O0
6

099999981OA6099999981OK6099999981OU6099999981O(6099999981O,6099999981O^6099999
9

81P66099999981PG6099999981PQ6099999981P$6099999981P”6099999981P@6099999981Q260
9

9999981QC6099999981QM6099999981QW6099999981Q’6099999981Q:6099999981Q\609999998
1

R86099999981RI6099999981RS6099999981R+6099999981R%6099999981R[6099999981S46099
9

99981SE6099999981SO6099999981SY6099999981S.6099999981S>6099999981T06099999981T
A

6099999981TK6099999981TU6099999981T(6099999981T,6099999981T^6099999981U6609999
9

981UG6099999981UQ6099999981U$6099999981U”6099999981U@6099999981V26099999981VC6
0

99999981VM6099999981VW6099999981V’6099999981V:6099999981V\6099999981W860999999
8

1WI6099999981WS6099999981W+6099999981W%6099999981W[6099999981X46099999981XE609
9

999981XO6099999981XY6099999981X.6099999981X>6099999981Y06099999981YA6099999981
Y

K6099999981YU6099999981Y(6099999981Y,6099999981Y^6099999981Z66099999981ZG60999
9

9981ZQ6099999981Z$6099999981Z”6099999981Z@6099999981$26099999981$C6099999981$M
6

099999981$W6099999981$’6099999981$:6099999981$\6099999981/86099999981/I6099999
9

81/S6099999981/+6099999981/%6099999981/[6099999981+460999999^81UF^81+E60999999
8
Main Index
1822
Code Examples

1+O6099999981+Y6099999981+.6099999981+>6099999981-06099999981-A6099999981-
K6099
999981-U6099999981-(6099999981-,6099999981-
^6099999981(66099999981(G6099999981(

Q6099999981($6099999981(“6099999981(@6099999981)26099999981)C6099999981)M60999
9

9981)W6099999981)’6099999981):6099999981)\6099999981’86099999981’I6099999981’S
6

099999981’+6099999981’%6099999981’[6099999981=46099999981=E6099999981=O6099999
9
81=Y6099999981=.6099999981=>6099999981.06099999981.A60BB2 1^ZHXB32 .48QBB9
0=E
+ZBB7 0:KA4BB6 /]L BB2
.49.81.K6099999981.U6099999981.(6099999981.,6099999981

.^6099999981*66099999981*G6099999981*Q6099999981*$6099999981*”6099999981*@6099
9

99981”26099999981”C6099999981”M6099999981”W6099999981”’6099999981”:6099999981”
\

6099999981#86099999981#I6099999981#S6099999981#+6099999981#%6099999981#[609999
9

981%46099999981%E6099999981%O6099999981%Y6099999981%.6099999981%>6099999981&06
0

99999981&A6099999981&K6099999981&U6099999981&(6099999981&,6099999981&^60999999
8

1,66099999981,G6099999981,Q6099999981,$6099999981,”6099999981,@6099999981;2609
9

999981;C6099999981;M6099999981;W6099999981;’6099999981;:6099999981;\6099999981
:

86099999981:I6099999981:S6099999981:+6099999981:%6099999981:[6099999981<460999
9

9981<E6099999981<O6099999981<Y6099999981<.6099999981<>6099999981>06099999981>A
6

099999981>K6099999981>U6099999981>(6099999981>,6099999981>^6099999981?66099999
9

81?G6099999981?Q6099999981?$6099999981?”6099999981?@6099999981@26099999981@C60
9

9999981@M6099999981@W6099999981@’6099999981@:6099999981@\6099999981!8609999998
1

!I6099999981!S6099999981!+6099999981!%6099999981![6099999981[46099999981[E6099
9

99981[O6099999981[Y6099999981[.6099999981[>6099999981]06099999981]A6099999981]
K

6099999981]U6099999981](6099999981],6099999981]^6099999981^66099999981^G609999
9

981^Q6099999981^$6099999981^”6099999981^@6099999981_26099999981_C6099999981_M6
0

99999981_W6099999981_’6099999981_:6099999981_\6099999981\86099999981\I60999999
8
1\S6099999981\+6099999981\%6099999981\[60999999820 460999999820 E60999999820
O6
0999999820 Y60999999820 .60999999820
>6099999982000609999998200A609999998200K60

9999998200U609999998200(609999998200,609999998200^6099999982016609999998201G60
9
Main Index
CHAPTER 18 1823
Support Files

999998201Q609999998201$609999998201”609999998201@6099999982022609999998202C609
9

99998202M609999998202W609999998202’609999998202:609999998202\60999999820386099
9

9998203I609999998203S609999998203+609999998203%609999998203[609999998204460999
9

998204E609999998204O609999998204Y609999998204.609999998204>6099999982050609999
9

98205A609999998205K609999998205U609999998205(609999998205,609999998205^6099999
9

82066609999998206G609999998206Q609999998206$609999998206”609999998206@60999999
8

2072609999998207C609999998207M609999998207W609999998207’609999998207:609999998
2

07\6099999982088609999998208I609999998208S609999998208+609999998208%6099999982
0

8[6099999982094609999998209E609999998209O609999998209Y609999998209.60999999820
9

>60999999820A060999999820AA60999999820AK60999999820AU60999999820A(60999999820A
,

60999999820A^60999999820B660999999820BG60999999820BQ60999999820B$60999999820B”
6

0999999820B@60999999820C260999999820CC60999999820CM60999999820CW60999999820C’6
0

999999820C:60999999820C\60999999820D860999999^81BV^820DI60999999820DS609999998
2

0D+60999999820D%60999999820D[60999999820E460999999820EE60999999820EO6099999982
0

EY60999999820E.60999999820E>60999999820F060999999820FA60999999820FK60999999820
F

U60999999820F(60999999820F,60999999820F^60999999820G660999999820GG60999999820G
Q

60999999820G$60999999820G”60999999820G@60999999820H260999999820HC60999999820HM
6

0999999820HW60999999820H’60999999820H:60999999820H\60999999820I860999999820II6
0

999999820IS60999999820I+60999999820I%60999999820I[60999999820J460999999820JE60
9

99999820JO60999999820JY60999999820J.60999999820J>60999999820K060999999820KA609
9

9999820KK60999999820KU60999999820K(60999999820K,60999999820K^60999999820L66099
9

999820LG60999999820LQ60999999820L$60999999820L”60999999820L@60999999820M260999
9

99820MC60999999820MM60999999820MW60999999820M’60999999820M:60999999820M\609999
9

9820N860999999820NI60999999820NS60999999820N+60999999820N%60999999820N[6099999
9

820O460999999820OE60999999820OO60999999820OY60999999820O.60999999820O>60999999
8
Main Index
1824
Code Examples

20P060999999820PA60999999820PK60999999820PU60999999820P(60999999820P,609999998
2

0P^60999999820Q660999999820QG60999999820QQ60999999820Q$60999999820Q”6099999982
0

Q@60999999820R260999999820RC60999999820RM60999999820RW60999999820R’60999999820
R

:60999999820R\60999999820S860999999820SI60999999820SS60999999820S+60999999820S
%

60999999^74^60^3^3^HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
H
X 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ$/+-()’=.*”#%&,;:<>?@![]^_\
020080
61^GOUGVG1 ^4^66^810$3820A 3333^71^60^3^66^GOUGVG1
6666810W360^72^60^3^811H
^6A6036060336160673333333333333333333333333333333333333333G MSCG/NASGTRANG
JOBG
CREGATEDG ON G07-JGUL-9G7 ATG 08:G51:0G7 FFFFFFFFFFFFFFFFFFFGDEFAGULT
FFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFGSUBCGASE G1
FFF^73^60^3^81
UF^6A60BB2 3)S2EB7 0OE!EBB5 09H&/BB5 ^&SD9B7 )M?=6K60BB2 3MA3 B7 0OE@@B32
1HZ1EBB0 0.)?-9B7 -[T#6U60BB2 3M7K)B7 0OE?]BB2 1H=V7B30 0.)G+9B7 -
[U/6(60B
B2 2T/C!B7 0OE?)B32 3QC<SBB0 2I>U%9BB0 4*^Y 6,60BB2 2TV<3B7 0OE?!BB2
3QKC,B30
2I<[;9BB0 4*^<Z6^60BB2 13Z_>B7 0OE@ZB31 -2)SBB0 3’-A59BB0 3’+”K810660BB2
13S
V%B7 0OE@2BB1 -3D7B30 3’+-99BB0 3’-C&810G60BB3 1NX<$B7 0OE])B31 %30IBB0
4*^
>>9BB0 2I>D*810Q60BB3 1M4X]B7 0OE[GBB1 %3M&B30 4*^$@9BB0 2I>)B810$60B32
0@NI&
B7 0OE]KB31 <*P3B7 -[VT9BB0 0.)’1810”60B32 0@X.=B7 0OE^RBB1 <*UOB -
[U.
9BB0 0.’B 810@60B32 3B !,B7 0OE_$B31 ?)5<B7 )M!D9B35 4BA/=811260B32
3BA’&B7
0OE\$BB1 ?(!GB )M!#9BB4 #T2#811C60B31 (S&RB7 0OE^YB31 <*=YB7 -[V19B
30 0.’3?811M60B31 (T;.B7 0OF 3BB1 <*C!B -[W”9B30 0.)YR811W60B31 >7M)B7
0OE]:B31 %3$4BB0 4*^”U9B30 2I>-.811’60B31 >8HWB7 0OE\3BB1 %2:[B30
4*_A+9B30
2I>7U811:60B31 01>P”B7 0OE^JB31 -3R5BB0 3’+]T9B30 3’-AY811\60B31 01?9RB7
0O
E_”BB1 -2T]B30 3’-W*9B30 3’+”W812860B31 0A>#$B7 0OE]WB32 3QMZ1BB0 2I>KQ9B30
4
*^<)812I60B31 0A?G<B7 0OE^=BB2 3QBOEB30 2I?299B30 4*^U:812S60B31 0GX6[B7
0OE[
_B32 1H*<CBB0 0.)+79B -[V7812+60B31 0GXOOB7 0OE[GBB2 1HXY#B30 0.’I19B -
[
T_812%60B31 0IS,.B7 0OE]]B35 0Y4_LB34 :1<79B )M@V812[60BB2 47O%&B7
02/X8B
B5 \(N?BB6 3+-EM9B7 ‘\_(813460BB2 3;5F-B7 02/W1B32 1PK1-BB0 0%?PR9B7
)V0V
813E60BB2 3;2^<B7 02/WKBB2 1PQ%SB30 0%>ZZ9B7 )V1*813O60BB2 2?W’JB7
02/W]B32
3)B\WBB0 2R 1]9BB0 4^1\Y813Y60BB2 2?SB<B7 02/WNBB2 3)H>6B30 2Q\H\9BB0
4^2OF81
3.60BB2 1O”%HB7 02/V^B31 )AFKBB0 3>7E-9BB0 3>6#\813>60BB2 1O(P.B7 02/W<BB1
)A=UB30 3>6/:9BB0 3>7L8814060BB3 3*9>5B7 02/Y^B31 ,)2%BB0 4^2N=9BB0 2Q\-
$814A
60BB3 3=^^QB7 02/X;BB1 ,)JDB30 4^1]B9BB0 2R L7814K60B32 0%(32B7 02/Y#B31
@+
Z.B7 )V2X9BB0 0%?06814U60B32 0%%*(B7 02/$QBB1 @+/]B )V1P9BB0
0%?#)814(60
B32 3B0%MB7 02/$”B31 [(%_B7 = 99B34 %-VC814,60B32 3B9”-B7 02//SBB1
[($N
B = (9BB4 06.UQ814^60B31 )ET?B7 02/$(B31 @+;8B7 )V1”9B30
0%?//815660B3
1 )FK/B7 02//:BB1 @+N+B )V3^9B30 0%>&^815G60B31 ?-G,B7 02/Y<B31
,)X5BB
Main Index
CHAPTER 18 1825
Support Files

0 4^28W9B30 2R D7815Q60B31 ?(1XB7 02/$PBB1 ,(?>B30 4^2*$9B30 2Q\T;815$60B31


03\ RB7 02/ZBB31 )A!&BB0 3>6]F9B30 3>7H&815”60B31 03\-5B7 02/$HBB1 )A4=B30
3>7=19B30 3>6’>815@60B31 0DS,CB7 02/YSB32 3)K8WBB0 2Q\)M9B30 4^2QC816260B31
0D
TD!B7 02/Y,BB2 3)AU7B30 2R ZT9B30 4^1^=816C60B31 0JQHKB7 02/Y.B32 1PT95BB0
0%
>][9B )V2G816M60B31 0JQV*B7 02/Y!BB2 1PI$(B30 0%??X9B )V0=816W60B31
0LST
:B7 02/ZPB35 0K2W=B34 087.%9B ‘\\Y816’60BB2 4?B<4B7 .O8>BB5 ;M.#B36
1_D-
&9B7 =82)816:60BB2 4XF>3B7 .O8WB32 1/.-SBB0 0&F $9B7 )-&”816\60BB2
4XE1AB
7 .O8ZBB2 1/&$UB30 0&D[O9B7 )-;L817860BB2 3W!QPB7 .O8QB32 416M”BB0
2R.Z79
B7 /DYX817I60BB2 3W<@5B7 .O8$BB2 41AZWB30 2R=/59B7 /D+4817S60BB2 1[X8$B7
.O9’B31 .Y- BB0 3?7W49BB0 3?6[Y817+60BB2 1[SD.B7 .O88BB1 .Y[,B30
3?6’99BB
0 3?7’Q817%60BB2 <5(&B7 .OAFB31 >,0*B7 /D/)9BB0 2R=_^817[60BB2 < YUB7
.O9*BB1 >,BBB /DYA9BB0 2R.@G818460B32 0$HA(B7 .OA3B31 _E4CB7 )-;]9BB0
0&EQ@818E60B32 0$O NB7 .OADBB1 _E3ZB )-,N9BB0 0&FQV818O60B32 3B1/4B7
.O
B)B31 0 Q=5B7 =84H9B34 <7BM818Y60B32 3B8#IB7 .OC7BB1 0 QUXB =84;9BB4
0U
7RE818.60B31 ‘T”AB7 .OAIB31 _EH1B7 )-,@9B30 0&FA%818>60B31 ‘UP[B7
.OB8
BB1 _D@TB )-<B9B30 0&ECG819060B31 [0I5B7 .OAIB31 >,P’B7 /DZ”9B30
2R.(
@819A60B31 [0@^B7 .OBRBB1 >&>7B /D(49B30 2R=%Y819K60B31 07MNLB7
.O9>B3
1 .Z9”BB0 3?72<9B30 3?7Y_819U60B31 07M>RB7 .OB!BB1 .YS)B30 3?7])9B30
3?6:_8
19(60B31 0H/#[B7 .O9\B32 41C]JBB0 2R=\29B /D+9819,60B31 0H+62B7 .OACBB2
414,QB30 2R* R9B /DY/819^60B31 0O1&#B7 .OAIB32 1/:1&BB0 0&EL’9B )-
;<81A
660B31 0O1^_B7 .OA’BB2 1/=C<B30 0&FT$9B )-,181AG60B31 0QEN[B7 .OA(B35
05
,YLB34 0O@!F9B =83*81AQ60BB1 .F0YBB0 2%MQ=BB5 (8.ZB35 !_ T9B7
+/@*81A$6
0BB1 )&_0BB0 2%MDBB32 1!TTBBB0 0/W3]9B7 /FV@81A”60BB1 )&:WBB0 2%ME$BB2
1!WW
0B30 0/U!$9B7 /FX*81A@60BB2 4Y\5CBB0 2%MQEB32 4-G,2BB0 251;59BB0 4M
“X81B260B
B2 4Y]/]BB0 2%ME7BB2 4-JPVB30 250#$9BB0 4M0E081BC60BB2 2%T’>BB0 2%MNLB31
&]\%B
B0 3N3*)9BB0 3N3C/81BM60BB2 2%Q2JBB0 2%MPCBB1 &^9LB30 3N2@#9BB0
3N41C81BW60BB2
0REU)BB0 2%M+QB31 _O\CBB0 4M0FJ9BB0 251B+81B’60BB2 0RA7HBB0 2%MX>BB1
_P2NB30
4M (C9BB0 252AO81B:60B32 0GYBBBB0 2%M$HB31 04/,ZB7 /FY(9BB0 0/VP,81B\60B32
0
G-4*BB0 2%M$)BB1 04/”-B /FW!9BB0 0/WV:81C860B32 3B2SPBB0 2%M”LB31 0730!B7
+/[R9B34 @”K%81CI60B32 3B7=>BB0 2%M%’BB1 072:QB +/[>9BB4 0+7:481CS60B31
.S
C+BB0 2%M+,B31 04/^PB7 /FXM9B30 0/WDO81C+60B31 .S=\BB0 2%M=YBB1 04/+_B
/F
Z\9B30 0/V9S81C%60B31 _:Y BB0 2%M”*B31 _PGWBB0 4M [G9B30 251_981C[60B31
_:\1
BB0 2%MV!BB1 _O:XB30 4M0UV9B30 250]181D460B31 0C#”\BB0 2%M+.B31 &^PCBB0
3N3JU
9B30 3N3@[81DE60B31 0C%5YBB0 2%MWBBB1 &]<?B30 3N4C$9B30 3N30U81DO60B31
0OC*.BB
0 2%MM1B32 4-L!PBB0 2519H9B30 4M0C.81DY60B31 0OC_EBB0 2%M$<BB2 4-FL’B30
252DY9B
30 4M “-81D.60B31 0VPWYBB0 2%MO”B32 1!Z6*BB0 0/VJ\9B /FYF81D>60B31 0VP(HBB0
2%MQ=BB2 1!S94B30 0/WW09B /FWP81E060B31 0X>*^BB0 2%M-4B35 >O7DB34 0U8R+9B
+/!&81EA60BB1 @<+VBB0 08+B BB6 3”7-YB35 04SJCB35 2=/);BB0 2_.3T81EK60BB1
<_
2RBB0 08+ACB32 2Q5^SBB0 00[D,BB5 *&A_BB0 2<0VR81EU60BB1 <^^[BB0 08+BLBB2
2Q6;
/B30 00!L[BB5 0QLB(BB0 2<0%%81E(60BB1 *V&*BB0 08+A1B31 )K9’BB0 0\L#IB35
\_&>
BB0 2RZ\Z81E,60BB1 *V(]BB0 08+C5BB1 )KD#B30 0\L .BB5 !-A*BB0 2R$Q881E^60BB2
Main Index
1826
Code Examples

49$M7BB0 08+BTB31 [>P<BB0 1;5;FBB6 1%#OYBB0 1;5K@81F660BB2 49YJ”BB0 08+7>BB1


[>Q3B30 1;56:B35 0*9$TBB0 1;5!^81FG60BB2 1QE.FBB0 08+B#B31 08JZLBB0 2R$G(B36
43
\,PBB0 0\LG@81FQ60BB2 1QCC3BB0 08+E=BB1 08JW*B30 2RZ?$B35 0JQL=BB0
0\M1(81F$60B
32 #]/?BB0 08+I,B31 0G%^ BB0 2<0@7BB5 0YWFLBB0 00!#981F”60B32 #\LMBB0
08+GTBB
1 0G%;.B30 2<0(BB35 09?+GBB0 00[$181F@60B32 3B3V[BB0 08+M1B31 0J)+”BB0
2_.KEBB5
0CJ3XB34 #=4A81G260B32 3B6Y<BB0 08+M!BB1 0J)REB30 2_.L-B35 1#>;BBB4
04JW”81GC
60B31 #*30BB0 08+K4B31 0G&22BB0 2<0#GB35 3C23IB30 00[MC81GM60B31 #*L6BB0
08+E
YBB1 0G%% B30 2<0?ZBB5 1”RF$B30 00!W581GW60B31 047[IBB0 08+A,B31 08J#”BB0
2RZ\6
BB5 >)TZB30 0\L,281G’60B31 048A’BB0 08+I[BB1 08JQJB30 2R$-GB35 3<5BRB30
0\L9F8
1G:60B31 0L’9PBB0 08+E=B31 [>.NBB0 1;5VSB35 &;]%B30 1;5,?81G\60B31 0L’L<BB0
0
8+GWBB1 [>GQB30 1;67VBB5 0>36$B30 1;5KB81H860B31 0Z7I&BB0 08+CGB31 )KV’BB0
0\
LGNB35 03I.;B30 2R$MV81HI60B31 0Z7R-BB0 08+G?BB1 )K2/B30 0\M6$BB5 06ND@B30
2R$
3P81HS60B31 0=$)ZBB0 08+CHB32 2Q9YDBB0 00!/)BB5 1BJ0CB30 2<0#481H+60B31
0=$*QBB
0 08+A.BB2 2Q4.(B30 00[T#B35 0+PJ6B30 2<0WZ81H%60B31 0”TK+BB0 08+IGB35
/@(:B34
03)”/B35 080OAB30 2_.C_81H[60B31 ]R4SBB1 0UQ;#BB6 2Q&%OBB6 43=YAB35 0-DG4BB0
0I4!D81I460B31 [H’>BB1 0UQ>=BB2 0M2[NBB1 2M3GQB36 3O^_\BB0 0FF*S81IE60B31
[H;
(BB1 0UQ@HB32 0M OWB31 2M1P?BB5 #?QXBB0 0FF%T81IO60B31 >[/QBB1 0UQ@YBB2 1-
9+8
BB0 (Y40BB5 @!!=BB0 06^OH81IY60B31 >[?!BB1 0UQ\BB32 1-6UTB30 (X<BB35
0N.[2B
B0 06^YE81I.60B31 &$VMBB1 0UQ^HBB2 2.,W7BB0 !#P1B35 0=J8*BB0 !#GT81I>60B31
&$@0BB1 0UR6)B32 2.%N=B30 !#G”B36 1J34\BB0 !#RO81J060B31 ‘+*_BB1 0UR3YBB2
3Y
E/RBB0 06^Z9BB6 4&[‘@BB0 (X!881JA60B31 ‘-CGBB1 0UR ;B32 3YDYHB30 06^L+B36
3$;
6JBB0 (Y4)81JK60B32 4Y573BB1 0URMDBB2 43:XGBB0 0FF^1BB6 4GW?&BB1
2M2LI81JU60B3
2 4YAU(BB1 0URM=B32 43:#2B30 0FF;$B35 1K7Z2BB1 2M4N$81J(60B32 3B2-’BB1
0UR1”BB2
4FHPNBB0 0I4_SB35 1,%M-B35 0M@(P81J,60B32 3B87FBB1 0UR4\B32 4FJLKB30 0I5 ABB5
0VZ6WBB5 2^3:181J^60B32 1:0IQBB1 0URB8BB2 43;5!BB0 0FF:6BB5 0%TY;B31
2M4O.81K66
0B32 1:5N&BB1 0URECB32 43>=HB30 0FF_MB35 12Q ;B31 2M1]181KG60B32 0Y!#9BB1
0UR71
BB2 3YB!+BB0 06^ULB35 1!5(EB30 (Y3#81KQ60B32 0Y\36BB1 0UR GB32 3YH7IB30
06^(]B
B6 441WNB30 (X?581K$60B33 3*#FJBB1 0UR3PBB2 2.”[]BB0 !#JMBB5 1’FZ>B30
!#R[81
K”60B33 3”KYNBB1 0UQ)EB32 2.<G.B30 !#ORB36 2,M-GB30 !#8 81K@60BB3 2+$”9BB1
0U
RA0BB2 1-51-BB0 (X[NB35 0U_S%B30 06^$B81L260BB3 2+B=FBB1 0UQ]$B32 1-CLHB30
(Y
8-B35 [3;HB30 06^TC81LC60BB2 ?”Z-BB1 0UR7:BB2 0L_+.BB1 2M1[ B35 1B$;OB30
0FF;
I81LM60BB2 ?*NEBB1 0UQ_$B32 0M5P.B31 2M3_/B36 2OL8NB30 0FF%L81LW60BB2
03BL+BB1
0UQ>?B35 _LEKB35 1=,T4BB5 -YNVB30 0I4?Z81L’60B31 0NPV8BB1 *’S%BB6 11A6CBB5
0]0U0BB6 1VK]0B31 25SXH81L:60B31 0LJ5GBB1 *’T#BB2 1US%^B31 ,M.PB36 13>R’B31
1
\=;>81L\60B31 0LJF6BB1 *’TSB32 1UP;5BB1 ,LEWB35 0D?O.B31 1\.0881M860B31
0F98D
BB1 *’W(BB2 3;1.#B31 0YD(:B35 0 ‘)=B31 1’>[;81MI60B31 0F9Q<BB1 *’YQB32 3;
H=B
B1 0YDCQB36 2_;@WB31 1’?3Q81MS60B31 05MUXBB1 *’$PBB1 ‘Z (B31 1BKOXBB5
(EG:B3
1 1BK2281M+60B31 05M!GBB1 *’-BB31 ‘Y:%BB1 1BJ%UB36 4F=XBB31 1BKOJ81M%60B31
@
/_$BB1 *’VOBB1 :L= B31 1’>[%BB5 ^#6@B31 0YD6)81M[60B31 @+N]BB1 *’)$B31
:L
Main Index
CHAPTER 18 1827
Support Files

V@BB1 1’>56B35 0G@&<B31 0YD^681N460B31 )#3ZBB1 *’T_BB1 [V/3B31 1\=B!B35


=5E
3B31 ,MO.81NE60B31 )#W\BB1 *’-%B31 [VYFBB1 1\’!MB35 .1VFB31
,MHL81NO60B32
3B36?BB1 *’XOBB1 ^/,^B31 25R^JB36 3JCN7BB6 0Q2Z581NY60B32 3B7;VBB1 *’X_B31
^+1KBB1 25S 0B35 0OH3GBB5 *-I_81N.60B32 0=+JYBB1 *’WMBB1 [VO+B31 1\=ZNB36
4
VM3XBB1 ,M+R81N>60B32 0==2/BB1 *’OBB31 [V>PBB1 1\=?OB35 %45-BB1
,ML381O060
BB2 +^”%BB1 *’Y0BB1 :LOYB31 1’>(VB35 02Y%=BB1 0YD@#81OA60BB2 +?,MBB1
*’R#B
31 :L!2BB1 1’?/KBB5 1D^X[BB1 0YC]E81OK60BB2 1+X*XBB1 *’/IBB1 ‘Y*PB31 1BKX-
B3
5 ?B_ BB1 1BK8281OU60BB2 1+T6XBB1 *’ZHB31 ‘ZC8BB1 1BKG0B36 2-Z.ABB1
1BJ\H81O
(60BB2 38Q^_BB1 *’-GBB2 3,_) B31 0YDL:B36 %”%EBB1 1’>;G81O,60BB2 38O/XBB1
*’
T7B32 3;4J[BB1 0YEAAB35 0?1#GBB1 1’?3<81O^60BB2 45_’,BB1 *’ZEBB2 1UORBB31
,LO
5B35 02&DUBB1 1\=)E81P660BB2 45]:8BB1 *’WGB32 1UVIOBB1 ,M[-BB5 ^4 [BB1
1\=[Z
81PG60BB2 4Q]==BB1 *’Z!B35 <;?OB35 ;R(#B36 3&GC9BB1 25SLH81PQ60B32 2PGKRBB1
0L-#EBB6 !(Q2B36 3PLA1B35 /[LRB31 15B^>81P$60B32 2Q^Y/BB1 0L-#QB33 1 :.7B32
4
QJ,TB36 @MPHB31 10-A,81P”60B32 2Q_Z8BB1 0L-#.BB3 1 !ZWBB2 4QK _B36 3\]VIB31
10
-GN81P@60B32 2V[^^BB1 0L-#^B33 2?]E”B31 025Y>B37 1IW(1B31 0;C@”81Q260B32
2V^.!B
B1 0L-%>BB3 2?^\CBB1 0256LB35 ,Q *B31 0;D4+81QC60B32 2-<P_BB1 0L-%8B33
4V4:CB3
1 0T?^>B37 4Y#U.B31 0T?\=81QM60B32 2-?_JBB1 0L-,7BB3 4V *7BB1 0T?>XB35
&FJHB31
0T@0_81QW60B32 2,9&HBB1 0L-*?B32 ‘6W B31 0;DJ#BB5 0H’3:B31 025OO81Q’60B32
2,D
0PBB1 0L-%,BB2 ‘53RBB1 0;C%;B35 1 OG,B31 024^*81Q:60B32 2\A^’BB1 0L-.6B32
#3X
3B31 10-KFBB6 3M”B%B32 4QFKG81Q\60B32 2\EY2BB1 0L-”&BB2 #1KZBB1 10+/=B35
@1.:
B32 4QHU681R860B32 3B3”:BB1 0L-.YB32 %%[#B31 15B%@B35 0’,G^B35 -Q4>81RI60B32
3B7MXBB1 0L-*-BB2 %”%<BB1 15B”3BB5 0”ZZLB35 0H3[R81RS60B32 3N^_5BB1 0L-#,B32
#6VXB31 10-O!B35 0+1@KBB2 4QHL;81R+60B32 3O0X BB1 0L-”&BB2 #4I/BB1 10( &BB5
0F
_J:BB2 4QG;[81R%60B32 3Z\C6BB1 0L-&;B32 ‘9O%B31 0;DMOB36 1IPDFBB1
025S;81R[60B
32 3$1H#BB1 0L-#QBB2 ‘6EFBB1 0;D7DB36 3ZHW’BB1 0269>81S460B32 3”IE^BB1 0L-
;QB3
3 4VT7?B31 0T?”FB36 20$E:BB1 0T@KT81SE60B32 3”K-_BB1 0L-#@BB3 4U;C:BB1
0T@CCB35
+’U/BB1 0T?>!81SO60B32 3>C&:BB1 0L-&’B33 2@I^/B31 0259_BB6 4&7R.BB1
0;C;)81SY
60B32 3>FY_BB1 0L-%,BB3 2?.=JBB1 0264>BB5 /P&=BB1 0;C;)81S.60B32 3]A:;BB1 0L-
,
B33 10A28B32 4QKM&BB7 2_RMDBB1 10-2D81S>60B32 3]E0$BB1 0L-,DBB3 1 +IMBB2
4QG!2
B35 /=+DBB1 10-E.81T060B32 3^@# BB1 0L-&#B36 3]-$YBB5 !*R+B35 1F=.0BB1
15BZ>8
1TA60B32 ‘NO?BB1 0GR.:BB7 2Y4/PB37 3Y,+:B36 2IH&PB33 2@W#781TK60B32 ,1L/BB1
0
GR.ZB32 !8-$B33 0 T*IBB6 0XJF*B33 2%1##81TU60B32 ,22XBB1 0GR*4BB2 !8U1BB3 0
S%7B35 0 Y&OB33 2% JB81T(60B32 08UBABB1 0GR.JB32 0#KY[B33 0]YJ’BB6 3-(_@B33
2N9
3Q81T,60B32 08V.PBB1 0GR*LBB2 0#K1UBB3 0]SZ+B35 0R97 B33 2NAF881T^60B32
0.B,UBB
1 0GR=#B32 1T>L5B33 1#<[QBB6 1’^SZB33 1”@W#81U660B32 0.ECIBB1 0GR*DBB2
1T<7KBB3
1#R+4B35 0(@3.B33 1”\C;81UG60B32 1Q*^JBB1 0GR=HB32 21ZWDB33 2M%W#B36
0%N,5B33
0]#GS81UQ60B32 1Q&CBBB1 0GR./BB2 21XAYBB3 2M=7VB35 _Q0VB33 0^ADG81U$60B32
2G[0
2BB1 0GR’ZB32 2O0BNB33 2%O1+B36 0*2>+B33 006GT81U”60B32 2G_VNBB1 0GR=)BB2
2N_KM
BB3 2%/32BB7 2T=REB33 0 ?=M81U@60B32 3B3*+BB1 0GR’@B32 2V’TIB33 2@[BXB35
)]!]B
Main Index
1828
Code Examples

B5 =_I&81V260B32 3B7C6BB1 0GR==BB2 2V-%(BB3 2@(3UBB5 &(,&BB5 1LT<,81VC60B32


4
5DS$BB1 0GR.SB32 2O1X2B33 2#&S6B35 00E$?BB3 0 XGN81VM60B32 45G_7BB1 0GR.JBB2
2N
\,2BB3 2”\;0BB5 ]CT&BB3 0 ‘ T81VW60B32 4]P,2BB1 0GR*\B32 21/(<B33 2M,W!B37
46P
V>BB3 0[^T!81V’60B32 4]TL6BB1 0GR.)BB2 21Z4#BB3 2NW01BB6 262BGBB3
0[O0<81V:60B3
1 )=SMBB1 0GR*?B32 1T@08B33 1”,UCBB5 +1”PBB3 1#NK_81V\60B31 )=<TBB1
0GR.ZBB2
1T>28BB3 1%RR B37 3#:Z-BB3 1#W9X81W860B31 *F_TBB1 0GR*,B32 0#L@<B33 0^NLDB35
068?MBB3 2MJU081WI60B31 *GL8BB1 0GR*,BB2 0#J;BBB3 0[_(=B35 02@_JBB3 2N-
RN81WS6
0B31 #V&IBB1 0GR”<B32 !AYLB33 0 &USB35 ‘”[&BB3 2%CB?81W+60B31 #V;]BB1
0GR*:
BB2 !71LBB3 \”K-B35 0’1IXBB3 2#O\T81W%60B31 %G*XBB1 0GR*:B36 3I0]EBB5
1Y,F/B
B6 _*F,BB3 2@46[81W[60BB3 0M>Z0BB1 ^QB$BB7 00J)&B36 /<<-B36 2].K/B32 -
L:”81
X460B34 0 S8RBB1 ^QBJB32 06(]*B33 0-P.GB37 28]2WB32 /\1#81XE60B34 00+(&BB1
^
QB*BB2 06(WJBB3 0-O8]B35 ;H+9B32 /\7581XO60B33 3Q1)(BB1 ^QB0B32 19QBZB33
28”
4@BB6 2^.8AB33 4S/@O81XY60B33 3QG\.BB1 ^QB=BB2 19PRWBB3 28$J2B35 0IA7,B33
4S)K
M81X.60B32 07I&GBB1 ^QA!B32 22#KVB33 3S4<KBB5 /(5:B33 3S=@X81X>60B32 07L2-
BB1
^QB=BB2 22”2YBB3 3SJL$B35 0”99+B33 3S)YV81Y060B32 10(-EBB1 ^QA?B32 2””**B33
4S\4XBB6 0[‘$EB33 28FUV81YA60B32 10=)PBB1 ^QB:BB2 2”.S3BB3 4T7-NB35 0OWQBB33
2
7&:<81YK60B32 23P[CBB1 ^QB9B32 3AO.3B32 /_4QB36 00GO=B33 0+WR281YU60B32
23TLL
BB1 ^QCFBB2 3ALW0BB2 /]81B35 &%A$B33 0+%[H81Y(60B32 3B3)8BB1 ^QBMB32
3J::IB
32 -K4GB35 01DKTB35 0X=RI81Y,60B32 3B7AEBB1 ^QCKBB2 3J%<0BB2 -I!&BB6 0M-
V1B3
5 1?Q @81Y^60B32 4I*V*BB1 ^QBVB32 3AQ=#B32 +0*LB35 0+F!,BB3 0+G&J81Z660B32
4I
&0ABB1 ^QB[BB2 3AMJ2BB2 +10NBB5 15S8/BB3 0+-K’81ZG60B31 -(+;BB1 ^QB”B32
2”&
/NB33 4S&S_B38 1’2@XBB3 28]W&81ZQ60B31 -)1$BB1 ^QBFBB2 2””_SBB3 4S0JFBB5
1Y>D
.BB3 2AE!;81Z$60B31 *NW;BB1 ^QCVB32 22&1<B33 3S9)8BB5 07AMGBB3
3S#SR81Z”60B31
*O6RBB1 ^QB6BB2 22%.EBB3 3S6J^BB5 %N,\BB3 3S/:[81Z@60B31 &&4IBB1 ^QD6B32
19REXB33 2897,B35 0OI-QBB3 4S?P881$260B31 &&-PBB1 ^QBMBB2 19Q(*BB3 29\>OB35
1
^]7VBB3 4S7/ 81$C60B31 :YE&BB1 ^QDBB32 06’(-B33 0+]&_BB6 2JI?7BB2
/^3081$M60
B31 :YDIBB1 ^QC-BB2 06-Y)BB3 0-H3<B35 32DCUBB2 + @>81$W60B31 <UP1BB1
^QDTB
36 2”KGIB35 0Z[#QBB5 _139BB2 -KM781$’60B34 1JX]6BB1 -?U<B39 2H%XRBB6
0F<2RB3
6 2* 3>BB3 28W[+81$:60B33 0()CSBB1 -?U,B32 03\&VBB3 ;9KZB36 075D?BB3
21)(‘81$
\60B33 0(%LMBB1 -?U[BB2 03\H<B33 ;C_9B35 .4+NBB3 21(&:81/860B33 4,_.#BB1 -
?
U<B32 14HSRBB3 0Z”JHBB6 2#(S(BB3 1*$K%81/I60B33 4;C03BB1 -?V7BB2 14G)’B33
0Z’4
1B35 0AJQ-BB3 1*Z@K81/S60B32 0EZU/BB1 -?U^B32 1]UO)BB3 1DO/8BB5 (DFABB3
1D’/[
81/+60B32 0E/(GBB1 -?VTBB2 1]T3;B33 1D/S<B35 0!-5WBB3 1D/=W81/%60B32
15&E^BB1
-?V9B32 2/<A7BB3 1” K2BB6 3/78 BB3 0ZLFP81/[60B32 15:K;BB1 -?V[BB2 2/,/HB33
1
“D%$B35 11;’TBB3 0Z Q581+460B32 2645HBB1 -?VFB32 30TA=BB3 21%@NBB7 4A_T;BB3
,
U)C^81UF^81+E60B32 267..BB1 -?W9BB2 30PMDB33 21#=SB35 09!Q5BB3
,*BS81+O60B32
3B3)QBB1 -?VHB32 39Z19BB3 28T;0B35 0OSO[BB5 09ZGU81+Y60B32 3B7N<BB1 -?W1BB2
3
9UN_B33 28Y%8BB5 *JXIBB5 1E^*)81+.60B32 4G3POBB1 -?VJB32 30V&^BB3 22 QVB35 1
Main Index
CHAPTER 18 1829
Support Files

ZNUB33 ,DKO81+>60B32 4G7BLBB1 -?VYBB2 30R3<B33 2291!BB5 1<@?SB33 ,M8A81-


060B
31 -7#’BB1 -?VUB32 2/@+)BB3 1*’I@BB7 1LDZ_B33 0Z,HC81-A60B31 -8D9BB1 -
?V3BB
2 2/<^EB33 1*8O*BB5 1&YM7B33 0$$YA81-K60B31 .)0^BB1 -?V,B32 1]WMHBB3
1DF%6BB5
0VWAIB33 1D?9,81-U60B31 .)’$BB1 -?U;BB2 1]WG<B33 1DC_#BB5 “7#IB33 1DTQL81-
(
60B31 %@4ZBB1 -?WEB32 14INFBB3 0ZLUXB35 =MZ<B33 1*\V+81-,60B31 %@”7BB1 -
?V
7BB2 14IN^B33 0$S08B35 29VR)B33 1*93B81-^60B31 ;Y--BB1 -?WVB32 040A@BB3
,@YG
BB6 3-GS@B33 21& “81(660B31 ;Y.%BB1 -?V+BB2 03_”5B33 ,,(4B35 3$LLIB33
21]\@8
1(G60B31 :S$JBB1 -?W8B36 26$]GBB5 0E;(5BB6 1(H_TB33 28/]-81(Q60B35 07@=RBB2
2
BVI4B38 2M]1-B36 17+)WB36 2L8=$B33 \#I%81($60B33 0R12NBB2 2BVJ B32 04M3*B34
1Z
=6DBB7 4PRB-B33 ^X/-81(“60B33 0R6&<BB2 2BVI;BB2 04LZCBB4 1$Z$[B35 *I?XB33
^Z
A981(@60B33 4+&4EBB2 2BVK7B32 14\NWB34 3^.<YBB6 4H(45B33 >AFL81)260B33
4+_%XBB
2 2BVLKBB2 14_Z?BB4 3^ZX=B35 0RZQUB33 >B@681)C60B32 0DZ>+BB2 2BVLEB32
1^T>6B33
=!4;BB5 ,’*!B33 .5ER81)M60B32 0D/\^BB2 2BVOJBB2 1^SP9BB3 =_W#B35 1E<FBB33
.38%81)W60B32 154I#BB2 2BVL,B32 2-2?]B33 >I:ABB6 2/1/EB34 3]67-81)’60B32
157S
$BB2 2BVQSBB2 2-04OBB3 >LOLB35 11LOCB34 3!EB#81):60B32 25.&0BB2 2BVL@B32
31:5^
B33 ^V’AB36 0]”E B34 1WR))81)\60B32 25%V-BB2 2BVR0BB2 31#^WBB3 ^O;ZB35
00SJ@B
34 1XE]S81’860B32 3B3-BBB2 2BVL@B32 3A_9PB33 \+<:B35 0ONM7B35 /”C581’I60B32
3
B7T\BB2 2BVP.BB2 3A@5IBB3 \ZI”BB5 )=3JB35 048\T81’S60B32 4GQ)(BB2 2BVMSB32
31
>&=B33 ^)/MB35 0!^)7BB4 1U:@681’+60B32 4GU$ABB2 2BVNTBB2 31&”WBB3 ^’%WBB5
20\
4$BB4 1WB:O81’%60B31 -CFEBB2 2BVNTB32 2-6Y(B33 >CC$BB6 /*^TBB4
3_6CN81’[60B3
1 -C”)BB2 2BVL8BB2 2-3\!BB3 <]-[BB5 2G-)”BB4 424[681=460B31 .#NVBB2
2BVP3B32
1^V]WB33 =>&0BB5 0-I$+BB3 .8=D81=E60B31 .%4&BB2 2BVKDBB2 1^WINBB3 =[6’BB5
; ]9BB3 .3;&81=O60B31 & >0BB2 2BVQGB32 15 FYB34 3[“3>B35 )8#>BB3
>HY)81=Y6
0B31 &0Y;BB2 2BVK/BB2 15 (1BB4 41KL”B35 2XA#%BB3 <\E+81=.60B31 ;=I;BB2
2BVQA
B32 04NL[B34 1Y26DBB6 2^!6;BB3 ^S#H81=>60B31 ;=O^BB2 2BVM:BB2 04L8$BB4
1YWM;B
35 3,* IBB3 ^+>781.060B31 :/ZQBB2 2BVP3B36 1: U1B36 4(\MMBB6 1Y9Y_BB3 \-
,_81
.A6099999981.K60B33 0QMEMB39 1>UROB32 04N9UB38 0Q!4YBB6 0=KFVBB9
0X@<S81.U60B33
0QPU:BB9 0$,#CBB2 04M._B38 /MCTB35 [<X_BBA 2%””#81.(60B33 4+BL/B38 ‘+UHB32
150V1B38 0&(WEBB6 4$*7HBB9 24_-L81.,60B33 4+M”(BB9 0&^V1BB2 15 .”BBA 2T!2’B35
0
Z&G3BB9 1:%G\81.^60B32 0DW%WB38 094,$B32 1^W@#B38 190Y0BB5 *-9@BB8
/LW)81*660
B32 0DY>5BB9 /+X BB2 1^VPQBB9 3F\<?B35 1HC)HBB9 4@YD/81*G60B32 1525EB38
0’’]KB
32 2-6(_B38 1QUMGBB6 39TC;BB8 ^5’&81*Q60B32 155IYB39 0@]’>BB2 2-3=GBB8
=?**B3
5 1D.C#BB8 ]F#@81*$60B32 25=)%B38 1D652B32 31@BHB38 1+<^$B36 @ENDBB8
0O/T$81*
“60B32 25#TDB39 4Y;22BB2 31;;?BB8 @)13B35 05/Z9BB8 0OQZK81*@60B32 3B3-TB38 1”
‘JB32 3B1P!B38 1’+@UB35 0XQ)\BB8 0?&\S81”260B32 3B7X\B38 0 =!)BB2 3A^FZBB8
^LR
6BB5 \.Y+BB8 0@*0S81”C60B32 4GR;VB38 2B82)B32 31]3>B38 1+&1\B35 12”+@BB8
1KP=,
81”M60B32 4GV;WB38 0WZ#1BB2 31>4@BB8 @D5KBB5 2E3BNBB8 1KJ:081”W60B31 -CTXB38
2YV_/B32 2-AR’B38 1RSS/BB6 0A!_KBB8 1%’B”81”’60B31 -C_PB38 12^DXBB2 2-7@&BB8
*”MMBB5 24+22BB8 1#U4[81”:60B31 .#=FB38 2,X!\B32 1^Z2*B38 17>TPBB5 0.>4:BB8
29
Main Index
1830
Code Examples

@,O81”\60B31 .%O*B38 1$V^WBB2 1^ZN*BB9 3O[“#BB5 &TB>BB8 27?5@81#860B31


&0D&B
38 2[80-B32 151O%B38 0&Q/]B36 4$:[ BB8 2QV_I81#I60B31 &0]#B38 22^E’BB2
151?[BB
A 1=[‘^B35 2M[8*BB8 2S@O@81#S60B31 ;=.%B38 2@&4FB32 04OP!B38 0K14HBB6
3H/(4BB8
2-:Z681#+60B31 ;=:@B38 2SD9HBB2 04ML<B39 3JU(7B35 3!@!]BB8 2-IDB81#%60B31
:+
B38 2”$A/B36 1.<N;B38 ;2?ABB7 3WUWCBB8 2’%%:81#[60B35 080_(B32 2BVI4B38
3)+D
7BB6 161@;B36 2L903BB3 \#-]81%460B33 0R17#B32 2BVJBB32 04M46BB4 1Z’>OBB7
4PU\@
BB3 ^X[I81%E60B33 0R6?CB32 2BVI;BB2 04LY[B34 1$$%(B35 *I>YBB3 ^ZU’81%O60B33
4+&9:B32 2BVKVB32 14\N\BB4 3^*1TBB6 4H(BSBB3 >AY,81%Y60B33 4+_>7B32 2BVLEBB2
1
4_Z(B34 3^/5\B35 0RZP0BB3 >CB*81%.60B32 0DZ?BB32 2BVL@B32 1^T>)BB3 =!8GBB5
,
‘./BB3 .5W681%>60B32 0D+ ZB32 2BVOJBB2 1^SO_B33 =_*BB35 1E<E7BB3
.3QT81&060B
32 154JMB32 2BVM”B32 2-2@PBB3 >I!IBB6 2/1HDBB4 3]8YJ81&A60B32 157TAB32
2BVQYBB
2 2-04IB33 >L+TB35 11LN:BB4 3!G+!81&K60B32 25.&’B32 2BVN6B32 31:6VBB3
^V%UB36
0]”V+BB4 1WT([81&U60B32 25%WHB32 2BVRIBB2 31#^KB33 ^P2!B35 00SJ<BB4
1XG[*81&(
60B32 3B3-]B32 2BVNNB32 3A_9^BB3 \+^WB35 0ONN7BB5 /_P”81&,60B32 3B7U”B32
2BVQ
GBB2 3A@5CB33 \ZYSBB5 )=39BB5 04O2^81&^60B32 4GQ’UB32 2BVO1B32 31>,9BB3
^)=’
B35 0!^)1B34 1U;,U81,660B32 4GU$[B32 2BVOJBB2 31&”QB33 ^= :BB5 20\3:B34
1WA”;8
1,G60B31 -CFJB32 2BVPLB32 2-6ZCBB3 >CH,BB6 /”78B34 3_5Y581,Q60B31 -C”#B32
2
BVMGBB2 2-3\*B33 <]>DBB5 2G-(XB34 424E;81,$60B31 .#NZB32 2BVR6B32 1^V^4BB3
=
>:MBB5 0-I+EB33 .8)P81,”60B31 .%4?B32 2BVL+BB2 1^WI5B33 =[JBBB5 ; !:B33
.3
&;81,@60B31 & >6B32 2BVSJB32 15 G BB4 3[“FKB35 )8”9B33 >HYR81;260B31
&0Y!B3
2 2BVMGBB2 15 -,B34 41L!]B35 2XA%,B33 <\E-81;C60B31 ;=I!B32 2BVS7B32
04NMLBB4
1Y1<“BB6 2^!JIB33 ^S%N81;M60B31 ;=P2B32 2BVO/BB2 04L8GB34 1YXU#B35 3,* >B33
^+?C81;W60B31 :/ZWB32 2BVR6B36 1::S8BB6 4-;/7BB6 1Y9/#B33 \-:N81;’60B34
1J/;
“B31 -?U:B38 1!N#AB36 0G=.\B36 2.\L>B33 28W.481;:60B33 0()$]B31 -?U;B32
03\&[
B33 ;9N&B36 075NJB33 21)QQ81;\60B33 0(%*<B31 -?U[BB2 03\G!BB3 ;C?&B35
.4Y&B
33 21(ZI81:860B33 4,\4JB31 -?U@B32 14HS$B33 0Z”LZBB6 2#(2<B33 1*$6,81:I60B33
4
;CNRB31 -?V5BB2 14G(WBB3 0Z)_5B35 0AJO:B33 1*Z’U81:S60B32 0EZW#B31 -?V B32
1]
UO)B33 1DO+OBB5 (DCDB33 1D’O.81:+60B32 0E/’QB31 -?VTBB2 1]T2SBB3 1D/L0B35
0!-
4CB33 1D/UL81:%60B32 15&G[B31 -?VDB32 2/<9]B33 1” KQBB6 3/6-JB33
0ZL3F81:[60B3
2 15:M;B31 -?V[BB2 2/,Z=BB3 1”D->B35 11;)VB33 0Z E181<460B32 26472B31 -
?VMB32
30TAPB33 21%@IBB7 4A!5IB33 ,UUA81<E60B32 267”OB31 -?WABB2 30PKYBB3 21#YQB35
09!QKB33 ,*0R81<O60B32 3B3’;B31 -?VQB32 39Z0&B33 28T,<B35 0OSQBB35
09J&[81<Y6
0B32 3B7PKB31 -?W5BB2 39UMIBB3 28Y+[BB5 *JV:B35 1E*7+81<.60B32 4G3Q.B31 -
?VT
B32 30V&’B33 22 QPB35 1 ZM?BB3 ,DS]81<>60B32 4G7CZB31 -?V(BB2 30R2FBB3
228@&B
B5 1<@<=BB3 ,MG*81>060B31 -7#&B31 -?V’B32 2/@+NB33 1*’JMBB7 1LG=YBB3
0Z,O)81
>A60B31 -8DGB31 -?VBBB2 2/<[“BB3 1*8GCBB5 1&YKDBB3 0$$)U81>K60B31 .)12B31
-
?V_B32 1]WMHB33 1DF&DBB5 0VWD2BB3 1D?GM81>U60B31 .)’)B31 -?U]BB2 1]WFRBB3
1DC
<\BB5 “7*EBB3 1DTW’81>(60B31 %@4+B31 -?WPB32 14INRB33 0ZLW%B35 =MW’BB3
1*\/
Main Index
CHAPTER 18 1831
Support Files

C81>,60B31 %@”AB31 -?VHBB2 14IM&BB3 0$R!6B35 29VTQBB3 1*99081>^60B31 ;Y-


’B31
-?W=B32 040BJB33 ,@/WBB6 3-G%4BB3 21&5281?660B31 ;Y.;B31 -?V&BB2 03_*8BB3
,,Y5B35 3$LL#BB3 21^4C81?G60B31 :S$MB31 -?WLB36 28E?>B35 0E[F,BB6 1(I33BB3
2
8+0)81?Q60BB3 0M><>B31 ^QB/BB7 -W$”BB7 4?CXJB36 2].75BB2 -LY,81?$60B34 0 PQ
B31 ^QBMB32 06(_&BB3 0-O>#B37 28[12BB2 /_%T81?”60B34 00Z[DB31 ^QB”BB2
06(WMB
33 0-NS,B35 ;HX>BB2 /_<;81?@60B33 3Q1SQB31 ^QB5B32 19QE(BB3 28.X@BB6
2^=*!BB
3 4SZUR81@260B33 3QG&IB31 ^QB*BB2 19PS$B33 28Y!4B35 0IA0/BB3 4S+[W81@C60B32
07
I%ZB31 ^QB B32 22#OPBB3 3S2=DBB5 /(0EBB3 3S)^$81@M60B32 07L1^B31 ^QB*BB2
22”
4VB33 3SHKPB35 0”94-BB3 3S-+Y81@W60B32 10(-PB31 ^QB B32 2””,HBB3 4S]SKBB6
0[)*
,BB3 28E9<81@’60B32 10=)YB31 ^QB?BB2 2”.U)B33 4T587B35 0OWP-BB3
27%WH81@:60B32
23P]PB31 ^QBJB32 3AO&5BB2 /^&.B36 00G@:BB3 0+V;_81@\60B32 23TMYB31 ^QCIBB2
3ALY\B32 /[>EB35 &%C-BB3 0+%JC81!860B32 3B3=HB31 ^QBXB32 3J:!KBB2 -J%!B35
0
1DLQBB5 0X[+Q81!I60B32 3B7CUB31 ^QCQBB2 3J%@5B32 -I-JBB6 0M+^/BB5
1?)1X81!S60
B32 4I*Y_B31 ^QB’B32 3AQ%&BB2 +0Q-B35 0+F@=B33 0+F>Y81!+60B32 4I&3QB31
^QC2B
B2 3AML]B32 +0”YBB5 15S3]B33 0++P^81!%60B31 -(-EB31 ^QB_B32 2”&)]BB3
4S”:&B3
8 1)5&VB33 28!@N81![60B31 -)20B31 ^QBPBB2 2”# _B33 4R_:ABB5 1Y>9+B33
2ADHQ81[
460B31 *NXKB31 ^QC”B32 22&5#BB3 3S7U:BB5 07ARDB33 3S*D 81[E60B31 *O6]B31
^Q
BHBB2 22%”5B33 3S4I?BB5 %N&=B33 3SZ/P81[O60B31 &&4>B31 ^QDLB32 19RHZBB3
287$
,B35 0OI+=B33 4S:=Y81[Y60B31 &&( B31 ^QBYBB2 19Q),B33 29_SEB35 1^]6*B33
4S4?/
81[.60B31 :YFOB31 ^QDQB32 06’’”BB3 0+[^WBB6 2JJ1[B32 /]#%81[>60B31 :YD[B31
^QC:BB2 06-Y.B33 0-GNBB35 32DC’B32 + /-81]060B31 <UP)B31 ^QD=B36 2%;AQBB5
0
Z;E0BB5 _15AB32 -K2D81]A60B32 ‘N)”B31 0GR.#BB7 210S)BB7 3O9TUB36 2IH-!BB3
2@
<9>81]K60B32 ,1/\B31 0GR.VB32 !8/LBB3 0 Y@WBB6 0XJ7,BB3 2%LUL81]U60B32
,2I@B
31 0GR._BB2 !8P4B33 0 Y4DB35 0 Y.1BB3 2%J2381](60B32 08UQAB31 0GR.GB32
0#KTLBB
3 0].N-BB6 3-(/UBB3 2NQ%T81],60B32 08V]OB31 0GR*DBB2 0#J!9B33 0]+%)B35
0R90!BB3
2NR^581]^60B32 0.C FB31 0GR=”B32 1T>C-BB3 1%4B1BB6 1’]J:BB3 1#7 .81^660B32
0.E
P3B31 0GR*6BB2 1T:^6B33 1#’ ‘B35 0(?!/BB3 1#C=<81^G60B32 1Q”6EB31 0GR=HB32
21ZL
VBB3 2N2 YB36 0%P’HBB3 0]!Y*81^Q60B32 1Q&M3B31 0GR.VBB2 21W_8B33 2M^#FB35
_P>%
BB3 0^KVQ81^$60B32 2G[6ZB31 0GR’/B32 2O0 GBB3 2%=X^B36 0*4A!BB3
00B)<81^”60B32
2G_/,B31 0GR=+BB2 2N_5(B33 2%@.EBB7 2T-Y<BB3 0 _4&81^@60B32 3B3%VB31 0GR’[B32
2
V’G”BB3 2!EN]B35 )]>QB35 =*<G81_260B32 3B7FAB31 0GR=)BB2 2V-XMB33 2@^P BB5
&
($<B35 1LEI;81_C60B32 45DR[B31 0GR.WB32 2O1K]BB3 2%4^YB35 00EO:B33 0
+ME81_M60B
32 45G^ZB31 0GR.JBB2 2N\ZFB33 2#ISOBB5 ]CGFB33 0 #5J81_W60B32 4]P”2B31
0GR”3B3
2 21/UDBB3 2N4 +B37 46HA^B33 0]6S)81_’60B32 4]TH5B31 0GR..BB2 21Y?KB33 2N&-
%BB6
261L;B33 0[Y /81_:60B31 )=R’B31 0GR*\B32 1T??*BB3 1#0”;BB5 +1)AB33
1#/WD81_\
60B31 )=:;B31 0GR./BB2 1T<>_B33 1%):/B37 3#,!YB33 1#”K?81\860B31 *F^ZB31
0GR*
[B32 0#L;CBB3 0^XP8B35 068:/B33 2M$?V81\I60B31 *GKEB31 0GR*?BB2 0#J’!B33
0]7<“
B35 02@@GB33 2N@:$81\S60B31 #V%FB31 0GR”_B32 !AW5BB3 0 >)XB35 ‘”]%B33
2%V+:8
Main Index
1832
Code Examples

1\+60B31 #V,>B31 0GR*]BB2 !6^NB33 \;(^B35 0’18\B33 2#.PV81\%60B31 %G.RB31


0
GR*]B36 3LK@+B35 1Y!4RBB6 _.;;B33 2@OE681\[60B32 2PG/OB31 0L-”%BB6 <!#4BB6
3O
DPVB35 /[DABB1 15BPZ820 460B32 2Q^;AB31 0L-”^B33 1 :O9BB2 4QIMMB36 @MLRBB1
10
+(.820 E60B32 2Q_;-B31 0L-#EBB3 1 @%\B32 4QI$@B36 3\]]+BB1 10+”L820 O60B32
2V]C
2B31 0L-#XB33 2?[P:BB1 025H8B37 1I’W[BB1 0;CQB820 Y60B32 2V^]\B31 0L-%OBB3
2?]’
%B31 024:=B35 ,P\GBB1 0;C+3820 .60B32 2-<+!B31 0L-##B33 4V3Y\BB1 0T?Z,B37
4Y:\
NBB1 0T?/%820 >60B32 2-@AGB31 0L-&-BB3 4U__SB31 0T?T$B35 &F9:BB1
0T?(28200060B
32 2,9]LB31 0L-*XB32 ‘6L*BB1 0;C<3BB5 0H)[ABB1 0256;8200A60B32 2,DATB31 0L-
%KB
B2 ‘4>6B31 0;CIDB35 1 O2MBB1 024=88200K60B32 2\B3TB31 0L-=”B32 #3LQBB1
10+,0B
B6 3M=’GBB2 4QD!#8200U60B32 2\E(^B31 0L-”KBB2 #15>B31 10+3YB35 @1’=BB2
4QG3U8
200(60B32 3B3,AB31 0L-.CB32 %%”(BB1 15BDSB35 0’,94BB5 -)HH8200,60B32
3B7P@B31
0L-*EBB2 %”X=B31 15BA*BB5 0”Z7[BB5 0HI^/8200^60B32 3N^^[B31 0L-#UB32
#6J?BB1
10+>’B35 0+1)%B32 4QF!F8201660B32 3O0W!B31 0L-”RBB2 #43?B31 10-T)BB5
0F_0%B32
4QFNL8201G60B32 3Z\8’B31 0L-&ZB32 ‘9EUBB1 0;C?*B36 1IPEYB31 025B 8201Q60B32
3
$1ECB31 0L-#2BB2 ‘60[B31 0;C(-B36 3ZF-KB31 025@48201$60B32 3”I8XB31 0L-;AB33
4
VR>’BB1 0T?LAB36 20$XGB31 0T?]N8201”60B32 3”KX”B31 0L-#ZBB3 4U&TAB31 0T?;EB35
+’RMB31 0T?T&8201@60B32 3>C)LB31 0L-&QB33 2@I7.BB1 024@EBB6 4&5??B31
0;CK[82022
60B32 3>FQUB31 0L-%WBB3 2?=N>B31 025;CBB5 /PW8B31 0;CK?8202C60B32 3]A’<B31
0L-
&#B33 109”DBB2 4QI[&BB7 2_I#LB31 10+W 8202M60B32 3]D>;B31 0L-&]BB3 1 /V&B32
4QF
T^B35 /=V7B31 10+.R8202W60B32 3^@$#B31 0L-&RB36 4 M+[B35 !:/VB35 1F=Q:B31
15B
0Q8202’60B31 0NPFRB31 *’/CBB6 0_4T$B35 0]719BB6 1VJ2_BB1 25S*O8202:60B31
0LI>4
B31 *’+EBB2 1US5YBB1 ,M#VB36 13>”FBB1 1\. =8202\60B31 0LJ !B31 *’/@B32
1UPB5
B31 ,LH=B35 0D?99BB1 1\.B?8203860B31 0F8[(B31 *’)8BB2 3;0QWBB1 0YD”<B35 0
‘’A
BB1 1’?5N8203I60B31 0F9DGB31 *’’?B32 3,\2;B31 0YDI$B36 2_&M BB1
1’?D^8203S60B3
1 05MJXB31 *’.]BB1 ‘Y:4BB1 1BKX0BB5 (EJPBB1 1BKA#8203+60B31 05M”FB31 *’#-
B3
1 ‘Y)YB31 1BJ!6B36 4F=?*BB1 1BKW_8203%60B31 @/<!B31 *’-^BB1 :LS@BB1
1’?5EBB
5 ^”[1BB1 0YDC,8203[60B31 @+GEB31 *’,2B31 :LI6B31 1’>F=B35 0G@Q8BB1
0YE2I82
04460B31 )# #B31 *’+$BB1 [VLLBB1 1\=NYB35 =5F3BB1 ,MR]8204E60B31 )#TAB31
*’%GB31 [VI>B31 1\=55B35 .1O!BB1 ,MK$8204O60B32 3B3AVB31 *’’1BB1 ^/Y=BB1
25S8KB36 3J9T.B36 0N(N!8204Y60B32 3B7?7B31 *’’VB31 ^/&OB31 25SB7B35 0OHE(B35
*N?-8204.60B32 0=-0!B31 *’)1BB1 [V8@BB1 1\=#0B36 4VM5^B31 ,M)U8204>60B32
0=
=#^B31 *’W”B31 [V-0B31 1\.3DB35 %3^3B31 ,MO78205060BB2 +]Q+B31 *’’.BB1
:
LARBB1 1’>,\B35 02Y*DB31 0YD\*8205A60BB2 +>UCB31 *’$LB31 :L=HB31 1’?#,BB5
1D
^N7B31 0YD1C8205K60BB2 1+V@2B31 *’”0BB1 ‘YX<BB1 1BK’8B35 ?C6AB31
1BKGX8205U6
0BB2 1+RH2B31 *’=[B31 ‘Z0[B31 1BKO$B36 2-YU1B31 1BK6#8205(60BB2 38O*[B31
*’%
BB2 3,^M%BB1 0YDR<B36 %%K)B31 1’>_(8205,60BB2 38MMUB31 *’/&B32 3;352B31
0YEG
JB35 0?1VRB31 1’?ED8205^60BB2 45]B-B31 *’=]BB2 1UN#:BB1 ,LRAB35 02%:_B31
1\=:
?8206660BB2 45!K\B31 *’(]B32 1UU’OB31 ,M_;BB5 ^3[4B31 1\.6C8206G60BB2
4Q!71B
Main Index
CHAPTER 18 1833
Support Files

31 *’.+B35 >E0SBB5 ;KL/B36 3&FM8B31 25SXH8206Q60B31 ]RM[B31 0UQ8YBB6


2MS&VB
36 44^8’B35 0-B-’B30 0I4I_8206$60B31 [H^.B31 0UQBRBB2 0M3-PB31 2M1*QB36
3P49DB
30 0FF8X8206”60B31 [I5TB31 0UQD0B32 0M093BB1 2M >_BB5 #<@’B30
0FFBX8206@60B31
>[<TB31 0UQDLBB2 1-A\%B30 (X%?BB5 @[FDB30 06]?78207260B31 >]7^B31
0UQI?B32
1-7[-BB0 (XY3B35 0N.-$B30 06^178207C60B31 &$.XB31 0UQH9BB2 2.:UEB30
!”_\B35
0=JF2B30 !”<R8207M60B31 &/5AB31 0UQRPB32 2.,PEBB0 !”<‘B36 1J8U”B30
!#0M820
7W60B31 ‘+?OB31 0UQOQBB2 3YH0DB30 06^24BB6 4&[BKB30 (X+08207’60B31 ‘-L’B31
0
UQK+B32 3YG0+BB0 06]:UB36 3$;#<B30 (X&X8207:60B32 4Y5!(B31 0UQ=8BB2 43?E6B30
0
FFN6BB6 4GYQ?B31 2M0,C8207\60B32 4YBHIB31 0UQ=TB32 43?VRBB0 0FFE-B35 1K7]MB31
2
M2:U8208860B32 3B2=UB31 0UQM.BB2 4FKCNB30 0I4NDB35 1,%OUBB5 0N6TR8208I60B32
3B8
B3B31 0UQP;B32 4FMB>BB0 0I4O[BB5 0VZ1DB35 2];’48208S60B32 1: -RB31 0UQW9BB2
43<
,#B30 0FFFDBB5 0%TGZBB1 2M2<,8208+60B32 1:4.<B31 0UQZ5B32 43!R%BB0 0FFOPB35
12P
<<BB1 2M0OD8208%60B32 0Y@O/B31 0UQS2BB2 3YEKUB30 06]_EB35 1!5UVBB0
(X%)8208[60
B32 0Y^.YB31 0UQKBB32 3YJ/*BB0 06^7,BB6 43[XFBB0 (X$ 8209460B33 3*R?RB31
0UQOW
BB2 2.%@]B30 !”@KBB5 1’F==BB0 !#0@8209E60B33 3”1A.B31 0UP\CB32 2.?ILBB0
!”_N
B36 2,J#.BB0 !”._8209O60BB3 2+^/8B31 0UQV7BB2 1-6QEB30 (X-GB35 0U_%.BB0
06^32
8209Y60BB3 2+ZYLB31 0UQG/B32 1-D&RBB0 (X<VB35 [3Z7BB0 06]^68209.60BB2
?&ENB3
1 0UQS@BB2 0L\J”B31 2M0N5B35 1B$#0BB0 0FFEN8209>60BB2 ?%20B31 0UQI+B32
0M6AFBB
1 2M2Q/B36 2OPU5BB0 0FFBR820A060BB2 03E6WB31 0UQB@B35 _& KBB5 1=’6:BB5 -
YMJBB
0 0I4HJ820AA60BB1 @<$?B30 08/;2BB6 3)*L#BB5 04LA*B35 2=(‘?B30
2_=DS820AK60BB1
<_0<B30 08/,FB32 2Q5[_B30 00[ >BB5 *,[KB30 2< =H820AU60BB1 <^]JB30 08/;OBB2
2Q6”ZBB0 00!7\BB5 0QO\)B30 2< ^+820A(60BB1 *V%FB30 08/,5B31 )K9DB30 0\LKNB35
\\O4B30 2RZF!820A,60BB1 *V-UB30 08/:8BB1 )KC^BB0 0\K$#BB5 !$LNB30
2RZ=U820A
^60BB2 49$9MB30 08/;WB31 [>P7B30 1;5D9BB6 1%+>:B30 1;4”#820B660BB2 49Y73B30
08
/#!BB1 [>P0BB0 1;4W(B35 0*5N[B30 1;5J;820BG60BB2 1QEY6B30 08/;;B31 08JYRB30
2R
ZX\B36 43:H+B30 0\K<?820BQ60BB2 1QC1[B30 08/>#BB1 08JVTBB0 2RZ8[B35 0JR+-B30
0\
L+”820B$60B32 #]* B30 08/[>B31 0G%] B30 2<043BB5 0YVGWB30 00!XD820B”60B32
#\S
UB30 08/@WBB1 0G%,KBB0 2< :1B35 09>/)B30 00[M3820B@60B32 3B3Z[B30 08/\6B31
0J)/
=B30 2_=UJBB5 0CH&_BB4 #.SC820C260B32 3B6+>B30 08/\]BB1 0J)P<BB0 2_=V.B35
1#:B
_B34 04H#U820CC60B31 #*36B30 08/^8B31 0G&11B30 2< ]6B35 3C S7BB0
00[8H820CM60B
31 #*LAB30 08/>+BB1 0G%”+BB0 2<03VBB5 1”OE,BB0 00!IA820CW60B31 047[4B30
08/,?B
31 08J”:B30 2RZFRBB5 >-?]BB0 0\LN4820C’60B31 048ARB30 08/[^BB1 08JP3BB0
2RZ@WB
35 3<0S^BB0 0\K”H820C:60B31 0L’8^B30 08/>,B31 [>==B30 1;4!KB35 &;6JBB0
1;5C”8
20C\60B31 0L’LMB30 08/@+BB1 [>FNBB0 1;5XNBB5 0>0:DBB0 1;4”2820D860B31
0Z7I4B30
08/:LB31 )KVEB30 0\K<PB35 03H,RBB0 2RZ-#^81BV^820DI60B31 0Z7Q[B30 08/@^BB1
)
K1%BB0 0\L=)BB5 06L+)BB0 2RZK)820DS60B31 0=$(%B30 08/:LB32 2Q9W;B30 00!N=BB5
1B
H6]BB0 2< []820D+60B31 0=$./B30 08/,&BB2 2Q4-.BB0 00[F&B35 0+M-\BB0 2<
./820D%6

Main Index
1834
Code Examples

0B31 0”TJ*B30 08/[MB35 +K@FBB4 03(;TB35 0809MBB0 2_=N8820D[60BB1 .F 6B30


2%L)
,BB5 -.T]BB5 !<^29B +/:7820E460BB1 )&]/B30 2%LSIB32 1!TSIB30 0/V@39B
/
FRS820EE60BB1 )&;7B30 2%LT=BB2 1!WRSBB0 0/U*.9B /FTH820EO60BB2 4Y_@3B30
2%L
)KB32 4-G”+B30 251S59B30 4M 6’820EY60BB2 4Y]O;B30 2%LTDBB2 4-JIQBB0 250O$9B30
4
M +F820E.60BB2 2%TVVB30 2%L+RB31 &]\BB30 3N3D89B30 3N2.G820E>60BB2 2%P>^B30
2%
L(JBB1 &^8PBB0 3N2OL9B30 3N3W.820F060BB2 0RELTB30 2%L<XB31 _O_UB30 4M -Y9B30
250:.820FA60BB2 0R9\5B30 2%L&3BB1 _P1HBB0 4M 0X9B30 251;T820FK60B32 0GYH>B30
2
%L;IB31 04/&*B /FUD9B30 0/VD?820FU60B32 0G-BNB30 2%L;>BB1 04/*QB7
/FST9B30
0/WJ!820F(60B32 3B2WJB30 2%L_SB31 07300B +/<>9BB4 @#%>820F,60B32 3B7#?B30
2%M &BB1 072;BB7 +/>G9B34 0+64=820F^60B31 .SC.B30 2%L> B31 04/]$B
/FS[9BB
0 0/W1W820G660B31 .S.6B30 2%L[)BB1 04//%B7 /FVY9BB0 0/U_-820GG60B31
_:X>B30
2%L_:B31 _PF%B30 4M I/9BB0 251+F820GQ60B31 _:_!B30 2%L#0BB1 _O;RBB0 4M
>”9B
B0 250$7820G$60B31 0C#”+B30 2%L<;B31 &^O(B30 3N2,\9BB0 3N3OQ820G”60B31
0C%5AB3
0 2%L#IBB1 &]:_BB0 3N3.99BB0 3N2WA820G@60B31 0OC*BB30 2%L/8B32 4-L<_B30
250,N9
BB0 4M $<820H260B31 0OC^*B30 2%L;^BB2 4-FE/BB0 251>Y9BB0 4M 6>820HC60B31
0VPV]B
30 2%L-]B32 1!Z5.B30 0/V869B7 /FT;820HM60B31 0VP-’B30 2%L)@BB2 1!S4WBB0
0/WK8
9B7 /FR_820HW60B31 0X>*IB30 2%L>5B35 >:MJBB4 0U7$C9B7 +/<B820H’60BB2 4?B-
>
B .O1,BB5 ,[U6BB6 1^7.!9B =7\Y820H:60BB2 4XF([B .O1RB32 1/.+>B30
0&E:
_9B )-*%820H\60BB2 4XD:8B .O1UBB2 1/&WCBB0 0&D#%9B )-#N820I860BB2
3W!E
IB .O1MB32 416J<B30 2R.E-9B /DU\820II60BB2 3W<=\B .O1WBB2 41AS\BB0
2R=
G+9B /DYX820IS60BB2 1[W_!B .O2+B31 .Y+WB30 3?7319B30 3?6T/820I+60BB2
1[S
34B .O14BB1 .Y!^BB0 3?6D09B30 3?7DS820I%60BB2 <5W7B .O3BB31 >,03B /
DY69B30 2R=)N820I[60BB2 < P<B .O2)BB1 >,ABB7 /DU-9B30 2R.Z%820J460B32
0$
HH0B .O3 B31 _E3UB )-#_9B30 0&EGE820JE60B32 0$O5%B .O39BB1 _E2SB7
)-”P9B30 0&FF?820JO60B32 3B1(\B .O4/B31 0 Q’JB =80B9BB4 <8)8820JY60B32
3
B8;CB .O53BB1 0 QTQB7 =80.9B34 0U5%D820J.60B31 ‘T”JB .O3FB31 _EGJB
)-”!9BB0 0&F08820J>60B31 ‘UQ3B .O45BB1 _D?NB7 )-&E9BB0 0&E1)820K060B31
[0I1B .O3EB31 >,P2B /DWB9BB0 2R.KP820KA60B31 [0@@B .O4NBB1 >&<7B7
/D$W9BB0 2R=S3820KK60B31 07MN3B .O2,B31 .Z9EB30 3?6/&9BB0 3?76
820KU60B31
07M>AB .O4>BB1 .YR,BB0 3?7UV9BB0 3?6O 820K(60B31 0H/#XB .O2]B32
41C@QB3
0 2R=)Z9B7 /DY+820K,60B31 0H+5-B .O38BB2 414=!BB0 2R.’]9B7
/DV2820K^60B3
1 0O1&CB .O3FB32 1/:17B30 0&EB69B7 )-#?820L660B31 0O1^PB .O3+BB2
1/=8+B
B0 0&FI^9B7 )-”4820LG60B31 0QENOB .O3$B35 06E&KBB4 0O@3I9B7 =8
+820LQ60B
B2 47O$6B 02/O6BB5 \C99B36 3-*9M9B ‘\!<820L$60BB2 3;53EB 02/M_B32
1PK1C
B30 0%?F-9B )U^<820L”60BB2 3;2%SB 02/NGBB2 1PQ.MBB0 0%>P#9B
)U\2820L@60
BB2 2?WU%B 02/N!B32 3)B]!B30 2Q\”]9B30 4^1T$820M260BB2 2?S0OB 02/NJBB2
3)H#
?BB0 2Q\ 49B30 4^1?H820MC60BB2 1O”+7B 02/M[B31 )AE@B30 3>6;.9B30
3>6L3820MM6
0BB2 1O(F+B 02/N;BB1 )A’’BB0 3>6B 9B30 3>6[D820MW60BB3 3*8Z0B 02/P[B31
,)
2BB30 4^1>;9B30 2Q\K=820M’60BB3 3=])LB 02/O&BB1 ,)IFBB0 4^1QD9B30 2R
27820M:
60B32 0%(9HB 02/P*B31 @+Z1B )U\>9B30 0%>>H820M\60B32 0%%;&B 02/RNBB1
@
Main Index
CHAPTER 18 1835
Support Files

+$!B7 )U_”9B30 0%?/&820N860B32 3B0:HB 02/R=B31 [(%GB ‘\]M9BB4


%(_X820N
I60B32 3B9,XB 02/SQBB1 [(ZIB7 ‘\]>9B34 06’<:820NS60B31 )EU1B 02/R/B31
@+,TB )U\49BB0 0%?R%820N+60B31 )FK%B 02/S&BB1 @+M/B7 )V0G9BB0
0%>(4820
N%60B31 ?-G#B 02/P;B31 ,)WXB30 4^1-(9BB0 2Q\[D820N[60B31 ?(1UB 02/RNBB1
,(>[BB0 4^2C.9BB0 2Q\A;820O460B31 03\ EB 02/Q9B31 )A!LB30 3>6WW9BB0
3>6>_82
0OE60B31 03\+@B 02/RFBB1 )A3@BB0 3>7G69BB0 3>6G1820OO60B31 0DS&:B
02/PPB32
3)K6 B30 2Q\MM9BB0 4^1!Q820OY60B31 0DTDZB 02/P%BB2 3)AN_BB0 2R GT9BB0
4^1R;8
20O.60B31 0JQG@B 02/P’B32 1PT8(B30 0%>,59B7 )U\/820O>60B31 0JQVFB
02/P?BB
2 1PIW$BB0 0%?*.9B7 )U_0820P060B31 0LSTLB 02/QMB35 0KU#-BB4 086!M9B7
‘\[%
820PA60BB2 3)R>1B 0OE”LBB5 08<Y<B35 ^@PR9B )M:4820PK60BB2 3M9?4B 0OE”
B
32 1HZ0!B30 0.)”J9B -[QG820PU60BB2 3M78(B 0OE*2BB2 1H=RABB0 0.)7I9B -
[R
6820P(60BB2 2T/1;B 0OE.%B32 3QC;7B30 2I>C.9B30 4*^2,820P,60BB2 2TV)_B
0OE*0
BB2 3QK6<BB0 2I<(#9B30 4*^MG820P^60BB2 13Z:5B 0OE*=B31 -2)1B30 3’+%U9B30
3’+
K-820Q660BB2 13SL\B 0OE*9BB1 -3CNBB0 3’+D”9B30 3’+;A820QG60BB3 1NW$#B
0OE%
%B31 %3 “B30 4*^NT9B30 2I<])820QQ60BB3 1M3H6B 0OE#NBB1 %3L?BB0 4*^5/9B30
2I
>N1820Q$60B32 0@NO,B 0OE%TB31 <*ORB -[S 9B30 0.)W’820Q”60B32 0@X,&B
0OE
&XBB1 <*TOB7 -[RD9B30 0.’1=820Q@60B32 3B _.B 0OE,’B31 ?)5BB )M<+9BB5
4
BP/V820R260B32 3BA”=B 0OE;’BB1 ?(@GB7 )M>89B34 #RSI820RC60B31 (S&+B
0O
E&’B31 <*’]B -[RY9BB0 0.)[W820RM60B31 (T;?B 0OE:BBB1 <*B]B7 -[TE9BB0
0.)P4820RW60B31 >7M+B 0OE%^B31 %3ZWB30 4*^FH9BB0 2I>L”820R’60B31 >8HVB
0
OE;BBB1 %2:0BB0 4*^=P9BB0 2I<<V820R:60B31 01>PYB 0OE&QB31 -3Q’B30
3’+X^9BB0
3’+&7820R\60B31 01?9EB 0OE,<BB1 -2TABB0 3’-7C9BB0 3’+L 820S860B31 0A>#FB
0OE%)B32 3QMW.B30 2I>2M9BB0 4*^MS820SI60B31 0A?GVB 0OE&,BB2 3QBIMBB0
2I>%59BB
0 4*^ Y820SS60B31 0GX6XB 0OE%5B32 1H*:?B30 0.)S;9B7 -[R(820S+60B31 0GXN_B
0OE#NBB2 1HXU,BB0 0.’8’9B7 -[QV820S%60B31 0IS,GB 0OE&2B35 0YXC9BB4
:1359B
7
)M:@^74^60^3^3^HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
X 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ$/+-()’=.*”#%&,;:<>?@![]^_\
020080
61^GOES1GX
^4^66^810$6\6666810W360^71^60^3^66^GOES1F6666810W360^72^60^3^811H^
6A64811F6060336160810M603362333333333333333333333333333333333333G
MSCG/NASGTRAN
G JOBG CREGATEDG ON G07-JGUL-9G7 ATG 08:G51:0G7 FFFFFFFFFFFFFFFFFFFGDEFAGULT
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFGSUBCGASE G1
FFF^73^6
0^3^81UF^6AGCEN/63BB0 1E2GVB 1 ,,?5FB 2 .N\DXBB1 0_*S?B70 :(DUWB 2 .N\DXB 1
,,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
9F
.E#B30 0$3O$B33 4XA”?B71 ,$LZLB73 9F.E#B 3 9 :(-65BB0 1E2GVB 1 /?.*5B 2
(TKIDBB
0 0C9^ B70 :(D6=B 2 (TKIDB 1 /?.*5B 2 +’2!\B30 1E2GVB 1 7PL;HB73 7RL-5B30
0$3O$
B32 -TZ%B 1 7PL;HB73 7RL-5B 3 7U3A+810$GCEN/63BB0 1E2GVB 2 W/??LB 3 56%WIBB1
4
#PW&B70 :(DF-B 3 56%WIB 2 W/??LB 2 :5HYCB30 1E2GVB72 L2?5&B73 A#\(RBB0
13SYKBB2
“J$0B72 L2?5&B73 A#\(RB 3 9:GAI6RBB0 1E2GVB 2 V$YCFB 2 !6.:VBB1 4#PW&B70
:(DF
Main Index
1838
Code Examples

-B 2 !6.:VB 2 V$YCFB 2 &SF^NB30 1E2GVB72 HWZ/!B73 9=P]+BB0 13SYKBB2 ,9TAB72


HW
Z/!B73 9=P]+B 3 8@W8V6;BB0 1E2GVB 2 X’=4@B 3 5R+-^BB1 4#PW&B70 :(DH6B 3 5R+-^B
2 X’=4@B 2 >?;MKB30 1E2GVB72 O&3K^B73 B@AO3BB0 13SYKBB2 ‘<.1B72 O&3K^B73
B@AO3
B 3 A;I1#6<BB0 1E2GVB 2 X’)’ B 3 5R+$DBB1 4#PW&B70 :(DH6B 3 5R+$DB 2 X’)’ B 2
>
?,:3B30 1E2GVB72 O&5G-B73 B@APYBB0 13SYKBB2 ‘<.”B72 O&5G-B73 B@APYB 3 A;I
K6TB
B0 1E2GVB 2 V$W:LB 2 !6=?PBB1 4#PW&B70 :(DF-B 2 !6=?PB 2 V$W:LB 2 &SF3#B30
1E2G
VB72 HW$”[B73 9=P;1BB0 13SYKBB2 ,9U/B72 HW$”[B73 9=P;1B 3 8@V_8810”GCEN/63BB0
1E2GVB 3 9+6@9B 3 7/BUSBB0 064$3BB2 0?V=PB 3 9+6@9B 3 7/BUSB 3 8#.^:B30
1E2GVB7
3 75:EQB73 E//9(B30 /F;ZB33 1*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VB73 7S0;FB73 F(<NDB30 *SL-B33 20T%IB73 7S0;FB73 F(<NDB 3
DQ4)L810FBB0 1E2GVB 3 9W8%ZB 3 7J6U>BB0 4UC&CBB1 <QQ&B 3 9W8%ZB 3 7J6U>B 3
8/?
;<B30 1E2GVB73 7S0T)B73 F(<HGB30 *SL-B33 20T’QB73 7S0T)B73 F(<HGB 3
DQ4$76?BB0
1E2GVB 3 9=*;EB 3 7>B[&BB0 4UC&CBB1 00J7CB 3 9=*;EB 3 7>B[&B 3 8!B0ZB30
1E2GVB
73 6%]A(B73 D+H##B30 *SL-B33 2-AF<B73 6%]A(B73 D+H##B 3 B)YS 811WGCEN/63BB0
1E
2GVB 3 NN34”B 3 A5,L,B7 089<OBB2 1]I&YB 3 NN34”B 3 A5,L,B 3 K7;^ZB30 1E2GVB73
IWCVAB73 JU”L*B30 1<FY7B31 \.GDB73 IWCVAB73 JU”L*B 3 J0+’!810DBB0 1E2GVB 3 O4
=:B 3 CD\QIB7 089<OBB2 2H_REB 3 O4 =:B 3 CD\QIB 3 K*=H.B30 1E2GVB73 IS@[6B73
J
K._?B30 1<FY7B31 06M<WB73 IS@[6B73 JK._?B 3 I!*+X810/BB0 1E2GVB 3 M+)\EB 3
7;7\
WB7 089<OBB2 1-%?SB 3 M+)\EB 3 7;7\WB 3 J’5,!B30 1E2GVB73 IZ%YUB73 J)X7\B30
1<
FY7B31 @5’RB73 IZ%YUB73 J)X7\B 3 J83VN810-BB0 1E2GVB 3 M+)A:B 3 7;7^HB7
089<O
BB2 1-&0DB 3 M+)A:B 3 7;7^HB 3 J’53EB30 1E2GVB73 IZ%L4B73 J)X2OB30 1<FY7B31
@5
Z_B73 IZ%L4B73 J)X2OB 3 J83M3810FBB0 1E2GVB 3 O3\^@B 3 CD\4KB7 089<OBB2
2H_YJB
3 O3\^@B 3 CD\4KB 3 K*’(MB30 1E2GVB73 IS@#=B73 JK.[@B30 1<FY7B31 06M.9B73
IS@#
=B73 JK.[@B 3 I!*WZ811’G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 3 5R+O7BB0 1B$4:B70
:(CXQ
B 3 5R+O7B 2 X’=4@B 2 >?&GDB30 1E2GVB72 O&4NGB73 B@AB%B30 2V3K?B32 09A#ZB72
O&4
Main Index
1840
Code Examples

NGB73 B@AB%B 3 A;H;/6!BB0 1E2GVB 2 X’=]HB 3 5R+NZBB0 1B$4:B70 :(CXQB 3 5R+NZB


2
X’=]HB 2 >?&E”B30 1E2GVB72 O&5<8B73 B@A7IB30 2V3K?B32 09A&6B72 O&5<8B73
B@A7IB
3 A;H=_6XBB0 1E2GVB 2 V$YOAB 2 !6(E]BB0 1B$4:B70 :(CLVB 2 !6(E]B 2 V$YOAB 2
&S
C9UB30 1E2GVB72 HW$[5B73 9=PO%B30 2V3K?B32 0LY4=B72 HW$[5B73 9=PO%B 3
8@VY?811\
GCEN/63BB0 1E2GVB 3 9+6@!B 3 7/BNBBB0 30V!?BB1 ‘(@6B 3 9+6@!B 3 7/BNBB 3
8#.[_
B30 1E2GVB73 75:AWB73 E/$_MB30 2ST%IB32 0Z@+)B73 75:AWB73 E/$_MB 3 CW0%%6?BB0
1
E2GVB 3 9=*\&B 3 7>B]WBB0 30V!?BB1 “?:?B 3 9=*\&B 3 7>B]WB 3 8!B8BB30
1E2GVB73
6%]6YB73 D+H:_B30 2ST%IB32 0*’%IB73 6%]6YB73 D+H:_B 3 B)YW5810FBB0 1E2GVB 3
9W
9 :B 3 7J6-FBB0 30V!?BB1 +!2YB 3 9W9 :B 3 7J6-FB 3 8/@0.B30 1E2GVB73 7S0M0B73
F(<EHB30 2ST%IB32 0RE82B73 7S0M0B73 F(<EHB 3 DQ4XW810HBB0 1E2GVB 3 9W9OQB 3
7J6
&IBB0 30V!?BB1 +@\NB 3 9W9OQB 3 7J6&IB 3 8/@KFB30 1E2GVB73 7S0: B73 F(<G@B30
2
ST%IB32 0REC:B73 7S0: B73 F(<G@B 3 DQ4Z#6!BB0 1E2GVB 3 9=”JGB 3 7>C3LBB0
30V!?B
B1 “?#.B 3 9=”J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3 7/BM(B31 3IJ3^B32 *)^IB 3


9+70!B
3 7/BM(B 3 8#*0 B30 1E2GVB73 75:EQB73 E/$^\B30 :7’OB33 2&3YLB73 75:EQB73
E/$^
\B 3 CW0%%6]BB0 1E2GVB 3 9=*_6B 3 7>B@[B31 3IJ3^B32 ,B’AB 3 9=*_6B 3 7>B@[B 3
8!B6KB30 1E2GVB73 6%]0PB73 D+H#OB30 :7’OB33 38X.:B73 6%]0PB73 D+H#OB 3
B)YRF81
0JBB0 1E2GVB 3 9W8]YB 3 7J6YDB31 3IJ3^B32 ))$YB 3 9W8]YB 3 7J6YDB 3 8/?^EB30
1
E2GVB73 7S0F7B73 F(<BIB30 :7’OB33 2SHEKB73 7S0F7B73 F(<BIB 3 DQ4UX810LBB0
1E2G
VB 3 9W9=\B 3 7J6;LB31 3IJ3^B32 ))R9B 3 9W9=\B 3 7J6;LB 3 8/@X>B30 1E2GVB73
7S
14CB73 F(<N/B30 :7’OB33 2SHVTB73 7S14CB73 F(<N/B 3 DQ4’56_BB0 1E2GVB 3 9=”/KB
3 7>C7FB31 3IJ3^B32 ,BU]B 3 9=”/KB 3 7>C7FB 3 8!B$?B30 1E2GVB73 6%].”B73
D+H!;
B30 :7’OB33 38Y1PB73 6%].”B73 D+H!;B 3 B)Y/=813OGCEN/63BB0 1E2GVB 3 NN2<:B 3
A
5,X!BB0 2I.PSBB2 <U5,B 3 NN2<:B 3 A5,X!B 3 K7;”1B30 1E2GVB73 IWC4LB73
JU”L*BB1
1 8Z+BB2 =&VCB73 IWC4LB73 JU”L*B 3 J0+T?810JBB0 1E2GVB 3 O3\!AB 3 CD_\”BB0
2I
.PSBB2 ^1:?B 3 O3\!AB 3 CD_\”B 3 K*’/NB30 1E2GVB73 IS@J B73 JK.”/BB1 1 8Z+BB2
&APQB73 IS@J B73 JK.”/B 3 I!*CS810=BB0 1E2GVB 3 M+)NUB 3 7;8R%BB0 2I.PSBB2
#:
T_B 3 M+)NUB 3 7;8R%B 3 J’5A’B30 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7PL_LB73 7RL5 BB0 2[<3*BB2
0Z
>K$B 1 7PL_LB73 7RL5 B 3 7U2(W813.GCEN/63BB0 1E2GVB 2 W/@;.B 3 56%CAB30 03%Z’B
0 :(D0*B 3 56%CAB 2 W/@;.B 2 :5E^,B30 1E2GVB72 L2?ZCB73 A#\I(BB0 0;]K^BB2
(%&B
B72 L2?ZCB73 A#\I(B 3 9:F;]6/BB0 1E2GVB 2 V$XYXB 2 !6([9B30 03%Z’B 0 :(C_”B 2
!
6([9B 2 V$XYXB 2 &SC=#B30 1E2GVB72 HWZ0)B73 9=PV<BB0 0;]K^BB2 .9><B72
HWZ0)B73
9=PV<B 3 8@V”F6_BB0 1E2GVB 2 X’’KTB 3 5R+H2B30 03%Z’B 0 :(D3.B 3 5R+H2B 2
X’’K
TB 2 >?%J7B30 1E2GVB72 O&2@(B73 B@A1KBB0 0;]K^BB2 /.@JB72 O&2@(B73 B@A1KB 3
A;
H.K810 BB0 1E2GVB 2 X’.RJB 3 5R+LKB30 03%Z’B 0 :(D3.B 3 5R+LKB 2 X’.RJB 2
>?%\L
B30 1E2GVB72 O&6>.B73 B@A9XBB0 0;]K^BB2 /.!KB72 O&6>.B73 B@A9XB 3 A;H=_6-BB0
1
E2GVB 2 V$ZFJB 2 !6)AYB30 03%Z’B 0 :(C_”B 2 !6)AYB 2 V$ZFJB 2 &SD 7B30
1E2GVB72
HW+0?B73 9=PU[BB0 0;]K^BB2 .9@RB72 HW+0?B73 9=PU[B 3 8@V++813>GCEN/63BB0
1E2G
VB 3 9+6[CB 3 7/BBGBB0 1./RDBB2 3/HG$B 3 9+6[CB 3 7/BBGB 3 8#.?+B30 1E2GVB73
75
Main Index
CHAPTER 18 1843
Support Files

:G<B73 E/$&3B7 ;8’%BB2 2.$’XB73 75:G<B73 E/$&3B 3 CW0+L6_BB0 1E2GVB 3 9=”+GB


3 7>C4HBB0 1./RDBB2 41,\FB 3 9=”+GB 3 7>C4HB 3 8!B$JB30 1E2GVB73 6%]W;B73
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!6’PWB30 ^Q89B 0 :(D2CB 2 !6’PWB 2 V$Z9LB 2 &SE0=B30
1E2G
VB72 HW$(/B73 9=P(QB7 -A&5BB2 1QC’2B72 HW$(/B73 9=P(QB 3 8@V;4810 BB0 1E2GVB
2 X’=\GB 3 5R+P\B30 ^Q89B 0 :(D6=B 3 5R+P\B 2 X’=\GB 2 >?&Z/B30 1E2GVB72
O&4”M
B73 B@AD-B7 -A&5BB2 141$PB72 O&4”MB73 B@AD-B 3 A;H:X8101BB0 1E2GVB 2 X’.@NB
3
5R+P,B30 ^Q89B 0 :(D6=B 3 5R+P,B 2 X’.@NB 2 >?&Z/B30 1E2GVB72 O&84BB73
B@ADFB
7 -A&5BB2 141(:B72 O&84BB73 B@ADFB 3 A;H*G6)BB0 1E2GVB 2 V$$1_B 2 !6’.@B30
^
Q89B 0 :(D2CB 2 !6’.@B 2 V$$1_B 2 &SELYB30 1E2GVB72 HW-?*B73 9=P#JB7 -A&5BB2
1QC*:B72 HW-?*B73 9=P#JB 3 8@V,*814UGCEN/63BB0 1E2GVB 3 9+6<[B 3 7/BQ[BB0
08.L_
BB2 0]^5&B 3 9+6<[B 3 7/BQ[B 3 8#.[DB30 1E2GVB73 75:AWB73 E//2]BB0 3,IR4BB2
1A\
@TB73 75:AWB73 E//2]B 3 CW0<+810 BB0 1E2GVB 3 9=*\1B 3 7>B[_BB0 08.L_BB2
183X?B
Main Index
1844
Code Examples

3 9=*\1B 3 7>B[_B 3 8!B7(B30 1E2GVB73 6%]4VB73 D+H,”BB0 3,IR4BB2 1OZ.EB73


6%]4
VB73 D+H,”B 3 B)YUE810NBB0 1E2GVB 3 9W93#B 3 7J6,\BB0 08.L_BB2 0&D/]B 3 9W93#B
3 7J6,\B 3 8/@6<B30 1E2GVB73 7S0P[B73 F(<T[BB0 3,IR4BB2 0\_X’B73 7S0P[B73
F(<T[
B 3 DQ4”]810PBB0 1E2GVB 3 9W9I(B 3 7J6[FBB0 08.L_BB2 0&DV@B 3 9W9I(B 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72 O&53DB73 B@A’=B 3 A;IGH8103BB0 1E2GVB 2 X’=Y=B 3 5R+;7B30 0V>’MB 0 :(C>HB
3 5R+;7B 2 X’=Y=B 2 >?:<.B30 1E2GVB72 O&746B73 B@A)]BB0 4#XCKBB2 0! ;AB72
O&746
B73 B@A)]B 3 A;IB;6=BB0 1E2GVB 2 V$X?OB 2 !6=/WB30 0V>’MB 0 :(C*LB 2 !6=/WB 2
V
$X?OB 2 &SE!JB30 1E2GVB72 HW/V*B73 9=P#=BB0 4#XCKBB2 1DLJ7B72 HW/V*B73 9=P#=B
3
8@V@I8156GCEN/63BB0 1E2GVB 3 9+7FFB 3 7/B;7B30 #Q-TB32 0H5(4B 3 9+7FFB 3
7/B;
7B 3 8#*I;B30 1E2GVB73 75:X,B73 E//ZMBB0 2NFJKBB2 0XWCDB73 75:X,B73 E//ZMB 3
CW
1H[8101BB0 1E2GVB 3 9=”MRB 3 7>CX9B30 #Q-TB32 0P3KVB 3 9=”MRB 3 7>CX9B 3
8!B$J
B30 1E2GVB73 6%]NJB73 D+IMVBB0 2NFJKBB2 0=3ZAB73 6%]NJB73 D+IMVB 3
B)Y_X810PBB0
1E2GVB 3 9W9GDB 3 7J6@ B30 #Q-TB32 0A2W4B 3 9W9GDB 3 7J6@ B 3 8/@G*B30
1E2GVB
Main Index
CHAPTER 18 1845
Support Files

73 7S0+&B73 F(<;9BB0 2NFJKBB2 0P2,QB73 7S0+&B73 F(<;9B 3 DQ51Z810RBB0 1E2GVB 3


9W9”DB 3 7J74>B30 #Q-TB32 0A2M^B 3 9W9”DB 3 7J74>B 3 8/@(#B30 1E2GVB73
7S1H3B7
3 F(<>8BB0 2NFJKBB2 0P2!9B73 7S1H3B73 F(<>8B 3 DQ54A8103BB0 1E2GVB 3 9=””5B 3
7
>C(DB30 #Q-TB32 0P37.B 3 9=””5B 3 7>C(DB 3 8!B>0B30 1E2GVB73 6%]\,B73
D+I+WBB0
2NFJKBB2 0=3)2B73 6%]\,B73 D+I+WB 3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 &SFW3B30 1E2GVB72
HW/;5B73 9=P;1B7 :Z5JBB2 2D@D*B72 HW/;5B73 9=P;1B 3 8@V]5815”GCEN/63BB0
1E2GV
B 3 9+7N:B 3 7/B>’B31 4TF<0B32 [NA3B 3 9+7N:B 3 7/B>’B 3 8#*PKB30 1E2GVB73
75:
(JB73 E//Y+BB0 4%(H BB2 1-OXYB73 75:(JB73 E//Y+B 3 CW1HY8103BB0 1E2GVB 3
9=”*!B
3 7>CW/B31 4TF<0B32 007+MB 3 9=”*!B 3 7>CW/B 3 8!B;DB30 1E2GVB73 6%]”&B73
D+IK
(BB0 4%(H BB2 1?*)VB73 6%]”&B73 D+IK(B 3 B)Y^P810RBB0 1E2GVB 3 9W9,=B 3
7J7EAB3
1 4TF<0B32 <G?6B 3 9W9,=B 3 7J7EAB 3 8/@”WB30 1E2GVB73 7S16-B73 F(>0CBB0 4%(H
BB2 1O]9-B73 7S16-B73 F(>0CB 3 DQ5D6810TBB0 1E2GVB 3 9W9ZDB 3 7J79@B31
4TF<0B32
Main Index
1846
Code Examples

<G]OB 3 9W9ZDB 3 7J79@B 3 8/@Z9B30 1E2GVB73 7S15KB73 F(<^TBB0 4%(H BB2


1O]AKB
73 7S15KB73 F(<^TB 3 DQ59#8105BB0 1E2GVB 3 9=”X2B 3 7>CS’B31 4TF<0B32 007=MB 3
9=”X2B 3 7>CS’B 3 8!B)XB30 1E2GVB73 6%]”1B73 D+IJ8BB0 4%(H BB2 1?*)?B73
6%]”1B7
3 D+IJ8B 3 B)Y]I815@GCEN/63BB0 1E2GVB 3 NN45YB 3 A5;10BB0 45$=*BB2 0J2D%B 3
NN4
5YB 3 A5;10B 3 K7::3B30 1E2GVB73 IWDSGB73 JU#”OBB0 4?6D?BB1 12S1=B73 IWDSGB73
J
U#”OB 3 J0-<,810RBB0 1E2GVB 3 O40YDB 3 CE ZBB0 45$=*BB2 0T9*KB 3 O40YDB 3 CE
ZB 3 K*.0GB30 1E2GVB73 IS!NAB73 JK*-DBB0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73 F(<*CBB0 0:\( BB2 %7>@B73 7S0Q6B73 F(<*CB 3 DQ4]/810UBB0
1E
2GVB 3 9W9ASB 3 7J6@NBB0 2T9?_BB2 4NIJ_B 3 9W9ASB 3 7J6@NB 3 8/@DAB30 1E2GVB73
7S10’B73 F(<*CBB0 0:\( BB2 %7[SB73 7S10’B73 F(<*CB 3 DQ4^*8106BB0 1E2GVB 3
9=”
BRB 3 7>CM9BB0 2T9?_BB1 (JF<B 3 9=”BRB 3 7>CM9B 3 8!BP.B30 1E2GVB73 6%]=3B73
D
+IIPBB0 0:\( BB2 !^!EB73 6%]=3B73 D+IIPB 3 B)Y[Y8178GCEN/63BB0 1E2GVB 3
NN3KNB
3 A5,*GB7 *9MBBB2 0<,MXB 3 NN3KNB 3 A5,*GB 3 K7:9DB30 1E2GVB73 IWC+-B73
JU”<
Main Index
1848
Code Examples

OB30 3>6VJB31 0=”HIB73 IWC+-B73 JU”<OB 3 J0- 1810VBB0 1E2GVB 3 O4 PCB 3


CD\ORB7
*9MBBB2 145/GB 3 O4 PCB 3 CD\ORB 3 K*=1JB30 1E2GVB73 IS@NTB73 JK*AXB30
3>6VJ
B31 0@,”NB73 IS@NTB73 JK*AXB 3 I!*T$810?BB0 1E2GVB 3 M+)=EB 3 7;8GPB7
*9MBBB2
0)T>9B 3 M+)=EB 3 7;8GPB 3 J’5U,B30 1E2GVB73 IZ#!WB73 J)XTDB30 3>6VJB31
0WSC+B
73 IZ#!WB73 J)XTDB 3 J83NA810>BB0 1E2GVB 3 M+’34B 3 7;8’<B7 *9MBBB2 0)T>UB 3
M+’34B 3 7;8’<B 3 J’5&2B30 1E2GVB73 IZ&HQB73 J)X@&B30 3>6VJB31 0WTW<B73
IZ&HQB7
3 J)X@&B 3 J84E=810UBB0 1E2GVB 3 O4 =5B 3 CD\)CB7 *9MBBB2 145/4B 3 O4 =5B 3
C
D\)CB 3 K*=HKB30 1E2GVB73 IS!TVB73 JK*XGB30 3>6VJB31 0@:N9B73 IS!TVB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”EQB 3 7>CVHB 3 8!BU”B30 1E2GVB73 6%]/)B73 D+IL#BB0 0O14>BB2 =U$%B73
6%]/)B73 D+IL#B 3 B)Y_9817%GCEN/63BB0 1E2GVB 3 NN3X2B 3 A5,@FB7 1AHF2BB2
4/S%9
B 3 NN3X2B 3 A5,@FB 3 K7:J)B30 1E2GVB73 IWD0KB73 JU#=PB +;)1B31 1A9< B73
IWD
0KB73 JU#=PB 3 J0-(0810UBB0 1E2GVB 3 O40K;B 3 CD\!/B7 1AHF2BB1 -9I>B 3
O40K;B
Main Index
CHAPTER 18 1849
Support Files

3 CD\!/B 3 K*=:*B30 1E2GVB73 IS!#0B73 JK*(.B +;)1B31 1Q^ “B73 IS!#0B73


JK*(
.B 3 I!”MC810>BB0 1E2GVB 3 M+’#PB 3 7;8#VB7 1AHF2BB2 40HPHB 3 M+’#PB 3 7;8#VB
3 J’6PHB30 1E2GVB73 IZ,6KB73 J)Z)HB +;)1B31 0]”-HB73 IZ,6KB73 J)Z)HB 3
J85Z-
810:BB0 1E2GVB 3 M+)L-B 3 7;8Q5B7 1AHF2BB2 40H%TB 3 M+)L-B 3 7;8Q5B 3
J’59BB30
1E2GVB73 IZ%QIB73 J)Z4PB +;)1B31 0].- B73 IZ%QIB73 J)Z4PB 3 J84U.810SBB0
1E
2GVB 3 O4 B,B 3 CD\+DB7 1AHF2BB1 -9L.B 3 O4 B,B 3 CD\+DB 3 K*’>WB30 1E2GVB73
IS@O/B73 JK*C1B +;)1B31 1Q!V5B73 IS@O/B73 JK*C1B 3 I!*U.817[GCEN/63BB0
1E2GV
B 1 ,,>T0B 2 .O0TKB31 13O,8B 0 :(DUWB 2 .O0TKB 1 ,,>T0B 2 ‘1EO-B30 1E2GVB71
J!V
^&B73 8KD$$BB0 247N5BB2 08,1QB71 J!V^&B73 8KD$$B 3 8D(X=6KBB0 1E2GVB 1 /?B95B
2
(TF=BB31 13O,8B 0 :(DUWB 2 (TF=BB 1 /?B95B 2 +’ “/B30 1E2GVB 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 6%]%SB73 D+H^QB 3 B)Y(I810OBB0 1E2GVB 3 9W9[?B 3
7
J6,,BB0 2L^LJBB2 4C53AB 3 9W9[?B 3 7J6,,B 3 8/@=YB30 1E2GVB73 7S112B73
F(<G@BB0
4D]#8BB2 1AU$&B73 7S112B73 F(<G@B 3 DQ4$7810MBB0 1E2GVB 3 9W9F’B 3 7J6/BBB0
2L
^LJBB2 4C69’B 3 9W9F’B 3 7J6/BB 3 8/@AOB30 1E2GVB73 7S0^#B73 F(<D9BB0 4D]#8BB2
1AU$”B73 7S0^#B73 F(<D9B 3 DQ4WP6\BB0 1E2GVB 3 9=”G<B 3 7>B^(BB0 2L^LJBB1
+_G3
B 3 9=”G<B 3 7>B^(B 3 8!BK6B30 1E2GVB73 6%]’?B73 D+H;6BB0 4D]#8BB2 1+O7[B73
6%]
‘?B73 D+H;6B 3 B)YV*819(GCEN/63BB0 1E2GVB 3 NN3”SB 3 A5,’<B7 ([#,BB2 0’!@GB
3
NN3”SB 3 A5,’<B 3 K7:WJB30 1E2GVB73 IWD5AB73 JU”!>BB0 3J?$VBB1 0V&9OB73
IWD5AB
73 JU”!>B 3 J0-FQ810OBB0 1E2GVB 3 O40JKB 3 CD\Y7B7 ([#,BB2 0?!D@B 3 O40JKB 3
CD\Y7B 3 K*=,>B30 1E2GVB73 IS@[>B73 JK.”/BB0 3J?$VBB1 0=Q?#B73 IS@[>B73 JK.”/B
3 I!*VS810%BB0 1E2GVB 3 M+’”HB 3 7;8X!B7 ([#,BB2 0V*$ZB 3 M+’”HB 3 7;8X!B 3
J
‘6QPB30 1E2GVB73 IZ%]SB73 J)YH”BB0 3J?$VBB1 0L”AVB73 IZ%]SB73 J)YH”B 3
J84IP810
“BB0 1E2GVB 3 M+)?!B 3 7;8$.B7 ([#,BB2 0V*’NB 3 M+)?!B 3 7;8$.B 3 J’5-”B30
1E
2GVB73 IZ&+)B73 J)YU&BB0 3J?$VBB1 0L”%FB73 IZ&+)B73 J)YU&B 3 J84*E810MBB0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GVB 1 /?S!JB 2 (TI<5B30 4L2R@B 0 :(B$KB 2 (TI<5B 1 /?S!JB 2 +’284B30


1
E2GVB 1 7PT YB73 7RLMWB7 ]AENBB2 2% A;B 1 7PT YB73 7RLMWB 3
7U2^G81B:GCEN/63B
B0 1E2GVB 2 W/@’#B 3 56%R:B30 4:NTFB 0 :(A/#B 3 56%R:B 2 W/@’#B 2 :5H [B30
1E2G
VB72 L2@6_B73 A#\/(B7 0C423BB2 3IMDCB72 L2@6_B73 A#\/(B 3 9:G5(6WBB0 1E2GVB 2
V$WL,B 2 !6=A.B30 4:NTFB 0 :(AM<B 2 !6=A.B 2 V$WL,B 2 &SET B30 1E2GVB72
HWX4EB7
3 9=P%2B7 0C423BB2 3(.^NB72 HWX4EB73 9=P%2B 3 8@W2M6@BB0 1E2GVB 2 X’(@:B 3
5R+
T@B30 4:NTFB 0 :(A:)B 3 5R+T@B 2 X’(@:B 2 >?&]RB30 1E2GVB72 O&0RRB73 B@AF7B7
0
C423BB2 2\B0IB72 O&0RRB73 B@AF7B 3 A;H\_6>BB0 1E2GVB 2 X’*LRB 3 5R+ZIB30
4:NTFB
0 :(A:)B 3 5R+ZIB 2 X’*LRB 2 >?,<YB30 1E2GVB72 O&9%DB73 B@AL4B7 0C423BB2
2\BL
3B72 O&9%DB73 B@AL4B 3 A;H&A6UBB0 1E2GVB 2 V$$K+B 2 !6.OBB30 4:NTFB 0 :(AM<B 2
!6.OBB 2 V$$K+B 2 &SF”^B30 1E2GVB72 HW)/\B73 9=Q WB7 0C423BB2 3(*G^B72
HW)/\B7
3 9=Q WB 3 8@V\(81B\GCEN/63BB0 1E2GVB 3 9+6!HB 3 7/BTLB30 290-UB32 4LT[KB 3
9+6
!HB 3 7/BTLB 3 8#._CB30 1E2GVB73 75:HDB73 E//7&B7 02K15BB2 3&*’”B73 75:HDB73
E
//7&B 3 CW0[46@BB0 1E2GVB 3 9=”79B 3 7>C7FB30 290-UB32 4>=U]B 3 9=”79B 3
7>C7FB
3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 KZD_.B 3 B?#&EB 3 H&?8VB30
1E2GVB
73 EJ[><B72 .SGK)B &FP9B 0 :(CXQB72 .SGK)B73 EJ[><B 3 C--)K811JBB0 1E2GVB 3
K!@%KB 3 C^SMTB30 27!>]B32 0LB;<B 3 K!@%KB 3 C^SMTB 3 ID0&*B30 1E2GVB73 BZNO:B
2 /7>+\B &FP9B 0 :(C?&B 2 /7>+\B73 BZNO:B 3 D<E1;811LBB0 1E2GVB 3 K!!(DB 3
C
^S):B30 27!>]B32 0LB*=B 3 K!!(DB 3 C^S):B 3 ID1WIB30 1E2GVB73 BZN5:B 2 /7@)NB
Main Index
CHAPTER 18 1861
Support Files

&FP9B 0 :(C?&B 2 /7@)NB73 BZN5:B 3 D<D@7810_BB0 1E2GVB 3 KZE)’B 3 B?#\(B30


27
!>]B32 0E2+/B 3 KZE)’B 3 B?#\(B 3 H&?*NB30 1E2GVB73 EJ[*9B72 .SH84B &FP9B 0
:(CXQB72 .SH84B73 EJ[*9B 3 C--UX81F”GCEN/63BB0 1E2GVB 2 E^=*\B 2 /OS]%B7
#”G/
B70 :(8;0B 2 /OS]%B 2 E^=*\B 2 WPG’WB30 1E2GVB 2 (6CD&B 2 >?;#’BB0 03Y[>B70
:(C
Y[B 2 >?;#’B 2 (6CD&B 2 &9DX6811JBB0 1E2GVB 2 TWP’-B 3 7F4,-B7 #”G/B70
:(BV>B
3 7F4,-B 2 TWP’-B 3 6DTBDB30 1E2GVB 2 ? T$”B 3 95Y!SBB0 03Y[>B70 :(DE7B 3
95Y!
SB 2 ? T$”B 3 7%1).811=BB0 1E2GVB 0 #;))9B72 7U:*CB7 #”G/BB1 1@E2XB 0
#;)’)B7
2 7U:*CB 2 7#6TTB30 1E2GVB 2 OG;4 B 2 6!1*%BB0 03Y[>BB2 15&M1B 2 OG;4 B 2
6!1*%
B 2 LOQQU811*BB0 1E2GVB 0 #?$1?B72 7U<CUB7 #”G/BB1 1@D4&B 0 #?$3MB72 7U<CUB
2
7#8JNB30 1E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6 SSB 2
&8\%N811PBB0
1E2GVB 2 TW$\:B 3 7F5OFBB0 0JWN$B70 :(DC(B 3 7F5OFB 2 TW$\:B 3 6DTZ3B30
1E2GVB
2 ? K0IB 3 95XW2B30 11-’BB 0 :(C[%B 3 95XW2B 2 ? K0IB 3 7%0RI811&BB0 1E2GVB 0
%CU5MB72 7UY”SBB0 0JWN$BB2 40E_ B 0 %CU5MB72 7UY”SB 2 7”_6RB30 1E2GVB 2 OG)O>B
Main Index
1864
Code Examples

2 6@&@7B30 11-’BB32 3 ,2LB 2 OG)O>B 2 6@&@7B 2 LOKY\811;BB0 1E2GVB 0 %4V!]B72


7
U+17BB0 0JWN$BB2 40F_*B 0 %4V!]B72 7U+17B 2 7”_-_B30 1E2GVB 2 OG-93B 2
6@#V#B30
11-’BB32 3 ,0IB 2 OG-93B 2 6@#V#B 2 LOI[‘811RBB0 1E2GVB 2 TWXH!B 3 7F5G\BB0
0J
WN$B70 :(DC(B 3 7F5G\B 2 TWXH!B 3 6DTW4B30 1E2GVB 2 ? I.<B 3 95XUBB30 11-’BB 0
:(C[%B 3 95XUBB 2 ? I.<B 3 7%0P381H%GCEN/63BB0 1E2GVB 2 72XM(B72 H^J4$BB0
04SJ”
BB2 0M,@-B 2 72XM(B72 H^J4$B 2 N0K;KB30 1E2GVB 2 :36[2B71 P2+^TB30 1TCUZB32
0W2
VUB 2 :36[2B71 P2+^TB 2 <PV1;811&BB0 1E2GVB 2 B]W=:B71 (N$+JBB0 04SJ”BB2
19<7(B
2 B]W=:B71 (N$+JB 2 EQ][LB30 1E2GVB 2 !S’”AB 2 C#M/<B30 1TCUZB32 0?<WFB 2
!S’”
AB 2 C#M/<B 2 ;]N[B8129BB0 1E2GVB 1 TRE&5B72 X89.,BB0 04SJ”BB2 \&L(B 1
TRE&5B7
2 X89.,B 2 Y#,(,B30 1E2GVB 2 “X2R(B72 IM*97B30 1TCUZB32 0F#-1B 2 “X2R(B72
IM*97
B 3 4^/%I812BBB0 1E2GVB 1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BB0
2.M
:UBB1 *)!;B 2 OG=M%B 2 6!1W[B 2 LOJ7.811<BB0 1E2GVB 0 #<6P&B72 7U?9HB
0/F6;B
Main Index
CHAPTER 18 1865
Support Files

30 /<!&B 0 #<6XEB72 7U?9TB 2 7#9PPB30 1E2GVB 2 OG*4IB 2 6!0*?BB0 2.M:UBB1


*);
3B 2 OG*4IB 2 6!0*?B 2 LOK[:811TBB0 1E2GVB 2 TWV++B 3 7F66(B 0/F6;B 0 :(9FKB
3 7F66(B 2 TWV++B 3 6DUJ’B30 1E2GVB 2 ? K4%B 3 95X[JBB0 2.M:UB70 :(CP_B 3
95X[J
B 2 ? K4%B 3 7%0&581IOGCEN/63BB0 1E2GVB 2 72UX%B72 H^Q3EB30 0;NS:B32 1I7B<B 2
7
2UX%B72 H^Q3EB 2 N0PR7B30 1E2GVB 2 :3C>1B71 P1DQDB 0JVH:B31 ,:%ZB 2
:3C>1B71
P1DQDB 2 <PWA:811;BB0 1E2GVB 2 B]SJJB71 (Q9R/B30 0;NS:B32 2-/&!B 2 B]SJJB71
(Q
9R/B 2 ER2\/B30 1E2GVB 2 !S.:HB 2 C#$(OB 0JVH:B31 0 YT%B 2 !S.:HB 2 C#$(OB 2
;]L?2812BBB0 1E2GVB 1 TR+’.B72 X861MB30 0;NS:B32 0)?K;B 1 TR+’.B72 X861MB 2
Y#%
J2B30 1E2GVB 2 “X DFB72 IM”1NB 0JVH:B31 ‘7*IB 2 “X DFB72 IM”1NB 3
4^/WT812DB
B0 1E2GVB 1 TR0EXB72 X87(AB30 0;NS:B32 0)?REB 1 TR0EXB72 X87(AB 2 Y##%1B30
1E2G
VB 2 “XBPKB72 IM’N,B 0JVH:B31 ‘7-&B 2 “XBPKB72 IM’N,B 3 4^+QO811<BB0 1E2GVB
2 B]O)”B71 (QQ&*B30 0;NS:B32 2-+B\B 2 B]O)”B71 (QQ&*B 2 ER0-*B30 1E2GVB 2
!S@40
B 2 C#-%;B 0JVH:B31 0 YI2B 2 !S@40B 2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2 /7’_BB73 BZPGPB 3 D<F3#8119BB0 1E2GVB 3 KZE8WB 3 B?”_SB
0
*)1<B31 ‘XYQB 3 KZE8WB 3 B?”_SB 3 H&?BTB30 1E2GVB73 EJ]@PB72 .S3$4B7 1
8U4B70
:(A_/B72 .S3$4B73 EJ]@PB 3 C-([Y81JUGCEN/63BB0 1E2GVB 2 E^’9PB 2 /OW3RB7
&@8
7B70 :(8//B 2 /OW3RB 2 E^’9PB 2 WPJ)FB30 1E2GVB 2 (66^GB 2 >?# =B30 2 =_PB 0
:(
A*CB 2 >?# =B 2 (66^GB 2 &98&7811VBB0 1E2GVB 2 TWXH9B 3 7F6W@B7 &@87B70
:(BP!
B 3 7F6W@B 2 TWXH9B 3 6DU’$B30 1E2GVB 2 ? M0RB 3 95X?WB30 2 =_PB 0 :(C-OB 3
95X
?WB 2 ? M0RB 3 7%0#/811?BB0 1E2GVB 0 #:!3^B72 7U[>^B7 &@87BB1 20N=ZB 0
#:!6]B
72 7U[>^B 2 7#D2EB30 1E2GVB 2 OG#%PB 2 6!4WOB30 2 =_PB32 4!>,XB 2 OG#%PB 2
6!4W
OB 2 LOM=K811!BB0 1E2GVB 0 #/!$GB72 7V 75B7 &@87BB1 20PUUB 0 #/!-FB72 7V 75B
2 7#C5.B30 1E2GVB 2 OG<Y.B 2 6!5JRB30 2 =_PB32 4!<5%B 2 OG<Y.B 2 6!5JRB 2
LOS1J
811XBB0 1E2GVB 2 TWO;VB 3 7F612B7 &@87B70 :(BP!B 3 7F612B 2 TWO;VB 3
6DUK,B30
1E2GVB 2 ? QK6B 3 95X,IB30 2 =_PB 0 :(C-OB 3 95X,IB 2 ? QK6B 3
7%0.\81J(GCEN/6
Main Index
CHAPTER 18 1867
Support Files

3BB0 1E2GVB 2 72T,GB72 H^U[IBB0 2HQ BB2 39 42B 2 72T,GB72 H^U[IB 2 N0TXOB30
1E
2GVB 2 :3M;,B71 P02QZB <F4WB32 4B,(DB 2 :3M;,B71 P02QZB 2 <P+6;811?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^9B30
1
E2GVB 2 OG]#3B 2 6!1T#B 0JHC B31 1$’H B 2 OG]#3B 2 6!1T#B 2 LOY”5811_BB0
1E2G
VB 0 #<4S+B72 7U:(AB 0T]Z B31 4-:]GB 0 #<4Y$B72 7U:(AB 2 7#6?*B30 1E2GVB 2
OG
)VZB 2 6@^T#B 0JHC B31 1$.F9B 2 OG)VZB 2 6@^T#B 2 LOIQ(811/BB0 1E2GVB 2
TWSU]
B 3 7F5K*B 0T]Z B 0 :(9$BB 3 7F5K*B 2 TWSU]B 3 6DT(5B30 1E2GVB 2 ? G,)B 3 95X
69B 0JHC B 0 :(9S”B 3 95X69B 2 ? G,)B 3 7%04N81K@GCEN/63BB0 1E2GVB 2
72Y=OB72
H^QNMB 0H’7EB31 0-V):B 2 72Y=OB72 H^QNMB 2 N0S#TB30 1E2GVB 2 :3ED^B71
P0]$,B
B0 4*70=BB2 2V/(HB 2 :3ED^B71 P0]$,B 2 <PW-8811]BB0 1E2GVB 2 B]RF8B71 (P@^$B
0H’7EB31 1$ES?B 2 B]RF8B71 (P@^$B 2 ER0;GB30 1E2GVB 2 !S”A*B 2 C#WRQBB0
4*70=BB
2 3M’YNB 2 !S”A*B 2 C#WRQB 2 ;]ON\812JBB0 1E2GVB 1 TQ^4XB72 X8C.GB 0H’7EB31
0
A[2?B 1 TQ^4XB72 X8C.GB 2 Y#:$UB30 1E2GVB 2 “X5F]B72 IM$PCBB0 4*70=BB2 1!@H,B
2
Main Index
CHAPTER 18 1869
Support Files

“X5F]B72 IM$PCB 3 4^/P0812LBB0 1E2GVB 1 TSZX?B72 X89YMB 0H’7EB31 0A!:DB 1


TS
ZY+B72 X89YMB 2 Y#?F<B30 1E2GVB 2 “XC?CB72 IMYA!BB0 4*70=BB2 1!@2)B 2 “XC?CB72
IMYA!B 3 4^/_W811_BB0 1E2GVB 2 B]$@QB71 (PQ#9B 0H’7EB31 1$DS<B 2 B]$@QB71
(PQ
#!B 2 ER879B30 1E2GVB 2 !S<HCB 2 C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2
:3C_UB7
1 P1P5WB 2 <PW^ 812 BB0 1E2GVB 2 B]LVSB71 (RVQ/B31 >>53B33 0”(83B 2 B]LVSB71
(
RVQ/B 2 ER2G%B30 1E2GVB 2 !S,6YB 2 C#”DCB ]?(0B31 *V%+B 2 !S,6YB 2 C#”DCB
2
;]OC3812NBB0 1E2GVB 1 TR.’PB72 X7@8VB31 >>53B33 ,IU’B 1 TR.’PB72 X7@8VB 2
Y#
Y,&B30 1E2GVB 2 “W\6TB72 IM@84B ]?(0B32 3<&AYB 2 “W\6TB72 IM@84B 3
4^+8W812M
BB0 1E2GVB 1 TR97#B72 X7!”$B31 >>53B33 ,IXMB 1 TR97#B72 X7!”$B 2 Y#YO.B30
1E2
Main Index
CHAPTER 18 1871
Support Files

GVB 2 “X6QRB72 IM<>,B ]?(0B32 3<%”QB 2 “X6QRB72 IM<>,B 3 4^+&6811\BB0


1E2GVB
2 B]I4PB71 (R&]EB31 >>53B33 0”(IMB 2 B]I4PB71 (R&]EB 2 ER0DGB30 1E2GVB 2
!S!.
KB 2 C##[*B ]?(0B31 *V’UB 2 !S!.KB 2 C##[*B 2 ;]V5881MIGCEN/63BB0 1E2GVB 3
YD^*FB 3 D;T](B30 12511B33 2QI\”B 3 YD^*FB 3 D;T](B 3 T(1#BB30 1E2GVB73
Q9\”@B7
3 F+C.4BB2 3]$-%B70 :(DZ B73 F+C.4B73 Q9\”@B 3 M*Q0:810>BB0 1E2GVB 3 XE[9TB 3
A
:V*LB30 12511B33 26#93B 3 XE[9TB 3 A:V*LB 3 T7B’IB30 1E2GVB73 S*3:VB73
NKM/CBB2
3]$-%B70 :(DXVB73 NKM/CB73 S*3:VB 3 QQH&7811EBB0 1E2GVB 3 ZHZ0CB 3 H0OZUB30
12
511B33 2:3WAB 3 ZHZ0CB 3 H0OZUB 3 UQPT=B30 1E2GVB73 NR04KB73 7J]K=BB2 3]$-%B70
:(DZ B73 7J]K=B73 NR04KB 3 KWB 6811CBB0 1E2GVB 3 ZH+Y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SB 2 “XC=HB72 IMY4$B 3 4^/^1812KBB0 1E2GVB 1
T
SU:7B72 X884UB 04 *[B31 \M[MB 1 TSU:7B72 X884UB 2 Y#<X$B30 1E2GVB 2
“XDC;B72
IMY1DB7 _^J-BB2 40M_DB 2 “XDC;B72 IMY1DB 3 4^/\:811^BB0 1E2GVB 2 B]V!YB71
(R
GO*B 04 *[B31 18!5:B 2 B]V!YB71 (RGO*B 2 ERBM)B30 1E2GVB 2 !S]#SB 2 C#:)DB7
_^J-BB1 #54BB 2 !S]#SB 2 C#:)DB 2 ;]V*N81M[GCEN/63BB0 1E2GVB 3 YD^9VB 3
D;TU^

Main Index
1872
Code Examples

B “4GAB32 0D% \B 3 YD^9VB 3 D;TU^B 3 T(1G(B30 1E2GVB73 QA +&B73 F+C@MB7


13I
Z>B70 :(A:)B73 F+C@MB73 QA +&B 3 M*Q”(810:BB0 1E2GVB 3 XE^K2B 3 A:X25B
“4GAB
32 06”M’B 3 XE^K2B 3 A:X25B 3 T7DT&B30 1E2GVB73 S*2-0B73 NKL$OB7 13IZ>B70
:(8C
GB73 NKL$OB73 S*2-0B 3 QQG’L811CBB0 1E2GVB 3 ZH/CHB 3 H0OO=B “4GAB32 0N @IB
3 ZH/CHB 3 H0OO=B 3 UQRN8B30 1E2GVB73 NQ\XFB73 7J[WXB7 13IZ>B70 :(B%FB73
7J[WX
B73 NQ\XFB 3 KW9=H811ABB0 1E2GVB 3 ZHY+7B 3 H0NLFB “4GAB32 0N0 .B 3 ZHY+7B
3
H0NLFB 3 UQP7LB30 1E2GVB73 NR1!JB73 7J^8TB7 13IZ>B70 :(B%FB73 7J^8TB73
NR1!JB
3 KWCZ=810,BB0 1E2GVB 3 XE[LOB 3 A:WZ”B “4GAB32 06”RTB 3 XE[LOB 3 A:WZ”B 3
T7B*GB30 1E2GVB73 S*50VB73 NKL[“B7 13IZ>B70 :(8CGB73 NKL[“B73 S*50VB 3
QQIK881
N4GCEN/63BB0 1E2GVB 3 K”9I5B 3 CO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 3!3N/BB2
2”@\0
B 2 !S&0WB 2 C#S*NB 2 ;]SFL81NYGCEN/63BB0 1E2GVB 3 YD]&)B 3 D;T0&B30 0 E:_B33
0
‘T<,B 3 YD]&)B 3 D;T0&B 3 T(0_GB30 1E2GVB73 QA MOB73 F+CV&B ‘VOTB 0
:(C’NB73
F+CV&B73 QA MOB 3 M*QU-810,BB0 1E2GVB 3 XE[A^B 3 A:WU8B30 0 E:_B33 0W@OIB 3
XE
Main Index [A^B 3 A:WU8B 3 T7BZ/B30 1E2GVB73 S*4’@B73 NKLGGB ‘VOTB 0 :(B&#B73 NKLGGB73
CHAPTER 18 1873
Support Files

S*4’@B 3 QQH?4811ABB0 1E2GVB 3 ZHY9;B 3 H0MK;B30 0 E:_B33 0?5-PB 3 ZHY9;B 3


H0M
K;B 3 UQO”#B30 1E2GVB73 NR1!JB73 7J^YMB ‘VOTB 0 :(C_”B73 7J^YMB73 NR1!JB 3
K
WCVD8118BB0 1E2GVB 3 ZH$-0B 3 H0N/HB30 0 E:_B33 0?5VYB 3 ZH$-0B 3 H0N/HB 3
UQQ?
<B30 1E2GVB73 NQ\ILB73 7J[CDB ‘VOTB 0 :(C_”B73 7J[CDB73 NQ\ILB 3
KW9WU810%BB
0 1E2GVB 3 XE^2AB 3 A:X6#B30 0 E:_B33 0W@I^B 3 XE^2AB 3 A:X6#B 3 T7DC(B30
1E2GV
B73 S*24#B73 NKKM!B ‘VOTB 0 :(B&#B73 NKKM!B73 S*24#B 3 QQF@Q81N.GCEN/63BB0
1
E2GVB 3 K”96YB 3 CO:7]B7 1]FZ?BB1 0C8=RB 3 K”96YB 3 CO:7]B 3 H\(@MB30
1E2GVB73
C\];@B71 ;5@’?B7 0BX77B70 :(CK0B71 ;5@’?B73 C\];@B 3 C”# 9811ABB0 1E2GVB 3
KZ
D$ B 3 B?”,GB7 1]FZ?BB1 093%YB 3 KZD$ B 3 B?”,GB 3 H&>.[B30 1E2GVB73 EJ]-GB72
.SH)/B7 0BX77B70 :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3 A:VR(B
3 T7B=&B30 1E2GVB73 S*2TKB73 NKKT+B7 04*”:B70 :(A”=B73 NKKT+B73 S*2TKB 3
QQGB,
8118BB0 1E2GVB 3 ZHZ2RB 3 H0O5=B 1C]9OB32 38L0*B 3 ZHZ2RB 3 H0O5=B 3
UQPV[B30
1E2GVB73 NR J!B73 7J]R]B7 04*”:B70 :(C/@B73 7J]R]B73 NR J!B 3 KWAGX8116BB0
1E
Main Index 2GVB 3 ZH/BXB 3 H0PNGB 1C]9OB32 38K:8B 3 ZH/BXB 3 H0PNGB 3 UQRN8B30 1E2GVB73
1874
Code Examples

NQ\%8B73 7J!&DB7 04*”:B70 :(C/@B73 7J!&DB73 NQ\%8B 3 KWA1G810”BB0 1E2GVB 3


XE]
(:B 3 A:V@@B 1C]9OB32 2NG-3B 3 XE](:B 3 A:V@@B 3 T7D2^B30 1E2GV^81UF^B73
S*2V
ZB73 NKK-IB7 04*”:B70 :(A”=B73 NKK-IB73 S*2VZB 3 QQGFW81OKGCEN/63BB0 1E2GVB 3
K”A:RB 3 CO>#CB7 18 RNBB1 ?8XWB 3 K”A:RB 3 CO>#CB 3 H\’/VB30 1E2GVB73
C\_CZB7
1 ;9/C_BB0 2Y\’/B70 :(DB9B71 ;9/C_B73 C\_CZB 3 C”#G’8118BB0 1E2GVB 3 KZG#&B 3
B
?&_’B7 18 RNBB1 :!7ZB 3 KZG#&B 3 B?&_’B 3 H&!-ZB30 1E2GVB73 EJ^J_B72
.SI”8BB0
2Y\’/B70 :(D5BB72 .SI”8B73 EJ^J_B 3 C-) 0811WBB0 1E2GVB 3 K!]_/B 3 C^VE>B7
18
RNBB1 !%?4B 3 K!]_/B 3 C^VE>B 3 ID3”DB30 1E2GVB73 BZP<HB 2 /7J&1BB0 2Y\’/B70
:(DF-B 2 /7J&1B73 BZP<HB 3 D<E2A811UBB0 1E2GVB 3 K![)PB 3 C^U&RB7 18 RNBB1
!%
_SB 3 K![)PB 3 C^U&RB 3 ID2-RB30 1E2GVB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B 3 7%0#1811:BB0 1E2GVB 0 %5@XJB72
7UY
OIB7 03”BDBB1 34HV7B 0 %5@$IB72 7UYOIB 2 7”[U2B30 1E2GVB 2 OG/Q2B 2 6@”HLB
0
5S7ZB31 19U!4B 2 OG/Q2B 2 6@”HLB 2 LOHXG811,BB0 1E2GVB 0 %6BXFB72 7UZTCB7
03”B
DBB1 34G[FB 0 %6B/*B72 7UZTCB 2 7”])>B30 1E2GVB 2 OG*XMB 2 6@#,NB 05S7ZB31
19
U4NB 2 OG*XMB 2 6@#,NB 2 LOO]>811QBB0 1E2GVB 2 TWVV9B 3 7F4&KB7 03”BDB70
:(A’D
B 3 7F4&KB 2 TWVV9B 3 6DT48B30 1E2GVB 2 ? P0’B 3 95X*:B 05S7ZB 0 :(A7]B 3 95X
*:B 2 ? P0’B 3 7%0(.81P@GCEN/63BB0 1E2GVB 2 72/ 5B72 H^G:PBB0 /YY^BB2 #”WHB
2
72/ 5B72 H^G:PB 2 N0LJNB30 1E2GVB 2 :33$_B71 P35.9B30 0,:47B32 062Z>B 2
:33$_B
71 P35.9B 2 <PTMW811:BB0 1E2GVB 2 B]T%SB71 (NO6>BB0 /YY^BB2 0C3!PB 2 B]T%SB71
(NO6>B 2 EQ@D2B30 1E2GVB 2 !S(\QB 2 C#I/[B30 0,:47B32 0NTW@B 2 !S(\QB 2 C#I/[B
2 ;]NMQ812CBB0 1E2GVB 1 TQ/LRB72 X8A.7BB0 /YY^BB3 4X4GFB 1 TQ/LRB72 X8A.7B 2
Y
#&INB30 1E2GVB 2 “X29#B72 IM*97B30 0,:47B32 [72:B 2 “X29#B72 IM*97B 3
4^/”R812
ABB0 1E2GVB 1 TS!A]B72 X86&&BB0 /YY^BB3 4X2(=B 1 TS!A]B72 X86&&B 2 Y#<*VB30
1E
2GVB 2 “W^D&B72 IM%CKB30 0,:47B32 [75OB 2 “W^D&B72 IM%CKB 3 4^/O4811,BB0
1E2GV
B 2 B]=+KB71 (M%.5BB0 /YY^BB2 0C3C#B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2F8B7 01&81B70 :(CCZB72 .S2F8B73 EJ!1?B 3 C-
+D=
Main Index
CHAPTER 18 1877
Support Files

811QBB0 1E2GVB 3 K![=GB 3 C^TD/B 2Q6JYB31 0T C/B 3 K![=GB 3 C^TD/B 3


ID2P)B30
1E2GVB73 BZL^3B 2 /7”KVB7 01&81B70 :(C’NB 2 /7”KVB73 BZL^3B 3 D<C38811OBB0
1E
2GVB 3 K!?=QB 3 C^SI”B 2Q6JYB31 0T /6B 3 K!?=QB 3 C^SI”B 3 ID ]KB30 1E2GVB73
BZPQ<B 2 /7(B6B7 01&81B70 :(C’NB 2 /7(B6B73 BZPQ<B 3 D<F1?8110BB0 1E2GVB 3
KZC
\ B 3 B?#OGB 2Q6JYB31 0LC^%B 3 KZC\ B 3 B?#OGB 3 H&>IUB30 1E2GVB73 EJ^ 6B72
.
SCVXB7 01&81B70 :(CCZB72 .SCVXB73 EJ^ 6B 3 C-(;<81QMGCEN/63BB0 1E2GVB 2
E^”N>B
2 /O$F’B @),RB 0 :(7]?B 2 /O$F’B 2 E^”N>B 2 WPN3YB30 1E2GVB 2 (63^&B 2 >?’E
CBB0 - XTB70 :(C_”B 2 >?’ECB 2 (63^&B 2 &94)N811QBB0 1E2GVB 2 TWZC5B 3 7F5=FB
@),RB 0 :(B80B 3 7F5=FB 2 TWZC5B 3 6DT>-B30 1E2GVB 2 ? PV^B 3 95XW2BB0 - XT
B70 :(DN4B 3 95XW2B 2 ? PV^B 3 7%0TL811,BB0 1E2GVB 0 %6&1:B72 7U-W6B
@),RB31
2QAZDB 0 %6&3JB72 7U-W6B 2 7# !FB30 1E2GVB 2 OG<WTB 2 6!3^SBB0 - XTBB2
0D(;JB
2 OG<WTB 2 6!3^SB 2 LOSHK811%BB0 1E2GVB 0 #.?2)B72 7U;YVB @),RB31 2QCH^B 0
#.?5(B72 7U;YVB 2 7#2^4B30 1E2GVB 2 OG(#8B 2 6@!11BB0 - XTBB2 0D(]-B 2 OG(#8B
2 6@!11B 2 LOI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 :3C/(B71 P0&?QB 2 <PUR3811%BB0
1E2
GVB 2 B]V(&B71 (Q%GMB (;K=B31 0IZU B 2 B]V(&B71 (Q%GMB 2 ER8!4B30 1E2GVB 2
!
S&RKB 2 C##(<B _9_4B31 “U.2B 2 !S&RKB 2 C##(<B 2 ;]N7W8128BB0 1E2GVB 1
TSYC
]B72 X81’.B (;K=B31 /O,XB 1 TSYC]B72 X81’.B 2 Y##J*B30 1E2GVB 2 “X J^B72
IM
&7]B _9_4B32 3^L<=B 2 “X J^B72 IM&7]B 3 4^/#Y8126BB0 1E2GVB 1 TSPTOB72
X82”V
B (;K=B31 /O,JB 1 TSPTOB72 X82”VB 2 Y##@_B30 1E2GVB 2 “X6A,B72 IM#”9B _9
_4B32 3^LR,B 2 “X6A,B72 IM#”9B 3 4^+J7811”BB0 1E2GVB 2 B]U<“B71 (Q!;IB
(;K=B
31 0IZTDB 2 B]U<“B71 (Q!;IB 2 ER8&FB30 1E2GVB 2 !S?;-B 2 C#%\WB _9_4B31
“U+
*B 2 !S?;-B 2 C#%\WB 2 ;]S^281RIGCEN/63BB0 1E2GVB 3 YD]A9B 3 D;T2GB 0\72@B32
2J’DLB 3 YD]A9B 3 D;T2GB 3 T(0PWB30 1E2GVB73 Q9\LZB73 F+C4$B7 1A&A”B70
:(A’DB7
3 F+C4$B73 Q9\LZB 3 M*P-?810+BB0 1E2GVB 3 XE!7!B 3 A:VD>B 0\72@B32 20.E=B 3
X
E!7!B 3 A:VD>B 3 T7A;9B30 1E2GVB73 S*3D%B73 NKL(>B7 1A&A”B70 :(7?PB73
NKL(>B73
S*3D%B 3 QQH4Q810\BB0 1E2GVB 3 ZHX<.B 3 H0NMNB 0\72@B32 2.(*-B 3 ZHX<.B 3
H0
NMNB 3 UQOT+B30 1E2GVB73 NR :=B73 7J]$.B7 1A&A”B70 :(B’IB73 7J]$.B73 NR :=B 3
KWA*_810^BB0 1E2GVB 3 ZH$L@B 3 H0O(KB 0\72@B32 2.(T,B 3 ZH$L@B 3 H0O(KB 3
UQQ
(BB30 1E2GVB73 NQ\B(B73 7J!>+B7 1A&A”B70 :(B’IB73 7J!>+B73 NQ\B(B 3 KW9U-
810$B
B0 1E2GVB 3 XE]B1B 3 A:WMVB 0\72@B32 20.6’B 3 XE]B1B 3 A:WMVB 3 T7CXQB30
1E2G
VB73 S*1;+B73 NKK ;B7 1A&A”B70 :(7?PB73 NKK ;B73 S*1;+B 3 QQF/,81RSGCEN/63BB0
1E2GVB 3 K”8!7B 3 CO:!UB 01J),B32 3E,;KB 3 K”8!7B 3 CO:!UB 3 H\(:FB30
1E2GVB7
3 C\[>3B71 ;7MI(B7 0[T JB70 :(B$KB71 ;7MI(B73 C\[>3B 3 C”*/N810\BB0 1E2GVB 3
K
ZEM’B 3 B?%U’B 01J),B32 33^\\B 3 KZEM’B 3 B?%U’B 3 H&?XSB30 1E2GVB73
EJ[3RB72
.SDHSB7 0[T JB70 :(B3YB72 .SDHSB73 EJ[3RB 3 C-+]@811MBB0 1E2GVB 3 K!! EB 3
C^
STYB 01J),B32 3RX%<B 3 K!! EB 3 C^STYB 3 ID0\OB30 1E2GVB73 BZM_FB 2 /7’62B7
0[T JB70 :(B[=B 2 /7’62B73 BZM_FB 3 D<C%/811KBB0 1E2GVB 3 K!!N4B 3 C^S(*B
01J
),B32 3RX’2B 3 K!!N4B 3 C^S(*B 3 ID1IVB30 1E2GVB73 BZO13B 2 /7=1)B7 0[T JB70
:
(B[=B 2 /7=1)B73 BZO13B 3 D<D>G810^BB0 1E2GVB 3 KZE([B 3 B?%+?B 01J),B32
33^[
EB 3 KZE([B 3 B?%+?B 3 H&?&5B30 1E2GVB73 EJ[]JB72 .SDX6B7 0[T JB70 :(B3YB72
.S
DX6B73 EJ[]JB 3 C--&X81R+GCEN/63BB0 1E2GVB 2 E^.BPB 2 /OTL5B30 1^=FLB 0 :(B*GB
Main Index
CHAPTER 18 1879
Support Files

2 /OTL5B 2 E^.BPB 2 WPG_?B30 1E2GVB 2 (69I%B 2 >?*F[BB0 3Q?E/B70 :(9M%B 2


>?*F[
B 2 (69I%B 2 &98AN811MBB0 1E2GVB 2 TWT7!B 3 7F57’B30 1^=FLB 0 :(C%KB 3 7F57’B
2
TWT7!B 3 6DTREB30 1E2GVB 2 ? Q(_B 3 95XS=BB0 3Q?E/B70 :(CB4B 3 95XS=B 2 ?
Q(_B
3 7%0RI811”BB0 1E2GVB 0 #@!F.B72 7U;0+B30 1^=FLB31 074&#B 0 #@!F.B72 7U;0+B 2
7#6/HB30 1E2GVB 2 OG?&#B 2 6!8.3BB0 3Q?E/BB1 >,<@B 2 OG?&#B 2 6!8.3B 2
LOTR481
1.BB0 1E2GVB 0 #,/&TB72 7U@N.B30 1^=FLB31 074-6B 0 #,/&TB72 7U@N.B 2 7#9%7B30
1
E2GVB 2 OG:73B 2 6!3M:BB0 3Q?E/BB1 >,%WB 2 OG:73B 2 6!3M:B 2 LOR4D811KBB0
1E2G
VB 2 TWQ5SB 3 7F4&KB30 1^=FLB 0 :(C%KB 3 7F4&KB 2 TWQ5SB 3 6DT9YB30 1E2GVB 2 ?
N[-B 3 95X6*BB0 3Q?E/B70 :(CB4B 3 95X6*B 2 ? N[-B 3 7%07”81R%GCEN/63BB0 1E2GVB
2 72Z83B72 H^P/RB 07+KKB31 0Q&<7B 2 72Z83B72 H^P/RB 2 N0SLOB30 1E2GVB 2
:3G9-
B71 P0T7*B30 3WI]KB32 1%T>>B 2 :3G9-B71 P0T7*B 2 <PW!0811”BB0 1E2GVB 2
B]XANB71
(PX%RB 07+KKB31 1G7DKB 2 B]XANB71 (PX%RB 2 ER4\NB30 1E2GVB 2 !S<# B 2
C#);BB
30 3WI]KB32 2S K9B 2 !S<# B 2 C#);BB 2 ;]T0W8126BB0 1E2GVB 1 TS “4B72 X88\/B
07+KKB31 01’#6B 1 TS “4B72 X88\/B 2 Y#:’RB30 1E2GVB 2 “XA29B72 IM$K B30
3WI]KB3
2 1I’-FB 2 “XA29B72 IM$K B 3 4^/>38124BB0 1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(B
3 K!!4:B 3 C^T]2B 3 ID1H0B30 1E2GVB73 BZOO9B 2 /7U58B7 _BA6B70 :(C*LB 2
/7U5
8B73 BZOO9B 3 D<DK”811GBB0 1E2GVB 3 K!!15B 3 C^T^9B &B^SB32 2MO4JB 3 K!!15B
3 C^T^9B 3 ID1EPB30 1E2GVB73 BZOXTB 2 /7V\/B7 _BA6B70 :(C*LB 2 /7V\/B73
BZOXT
B 3 D<D/?810@BB0 1E2GVB 3 KZD?NB 3 B?%VQB &B^SB32 24X$&B 3 KZD?NB 3 B?%VQB
3
H&?8VB30 1E2GVB73 EJ]STB72 .SMHOB7 _BA6B70 :(CIXB72 .SMHOB73 EJ]STB 3 C-
(498
1S>GCEN/63BB0 1E2GVB 2 E^.@6B 2 /OV”$BB0 _U”1B70 :(C^FB 2 /OV”$B 2 E^.@6B 2
WP
J5UB30 1E2GVB 2 (67K6B 2 >?’-YBB0 0$1B6B70 :(C3-B 2 >?’-YB 2 (67K6B 2
&95;?811I
BB0 1E2GVB 2 TWULPB 3 7F5,KBB0 _U”1B70 :(DI/B 3 7F5,KB 2 TWULPB 3 6DU1,B30
1E2
GVB 2 ? N 1B 3 95W>?BB0 0$1B6B70 :(D3.B 3 95W>?B 2 ? N 1B 3 7% [8811’BB0
1E2GVB
0 #<D%)B72 7U>/9BB0 _U”1BB2 2.V6>B 0 #<D%)B72 7U>/9B 2 7#8??B30 1E2GVB 2
OG<>
Main Index
CHAPTER 18 1881
Support Files

4B 2 6!8M(BB0 0$1B6BB2 25-”&B 2 OG<>4B 2 6!8M(B 2 LOR)<811(BB0 1E2GVB 0


#;_)AB7
2 7U@.]BB0 _U”1BB2 2.U$1B 0 #;_)AB72 7U@.]B 2 7#AZ!B30 1E2GVB 2 OG:-5B 2
6!63I
BB0 0$1B6BB2 25-YUB 2 OG:-5B 2 6!63IB 2 LOQ\-811GBB0 1E2GVB 2 TWT<MB 3
7F5’8BB0
_U”1B70 :(DI/B 3 7F5’8B 2 TWT<MB 3 6DT[*B30 1E2GVB 2 ? M7@B 3 95W*]BB0
0$1B6B
70 :(D3.B 3 95W*]B 2 ? M7@B 3 7% ,J81T0GCEN/63BB0 1E2GVB 2 72U,XB72 H^ROAB30
14
-9SB32 1-[JNB 2 72U,XB72 H^ROAB 2 N0Q@FB30 1E2GVB 2 :3I0:B71 P09F9B30 174NBB32
0IT@MB 2 :3I0:B71 P09F9B 2 <PX*A811’BB0 1E2GVB 2 B]S/CB71 (P*+9B30 14-9SB32
3A4
IFB 2 B]S/CB71 (P*+9B 2 ER1LAB30 1E2GVB 2 !S>] B 2 C#=2YB30 174NBB32 0+^59B 2
!
S>] B 2 C#=2YB 2 ;]T:’8122BB0 1E2GVB 1 TRD 6B72 X8BYWB30 14-9SB32 0!.%$B 1 TRD
6B72 X8BYWB 2 Y#:N;B30 1E2GVB 2 “XB(_B72 IMX=\B30 174NBB32 04S&^B 2 “XB(_B72
IM
X=\B 3 4^/;(8120BB0 1E2GVB 1 TR6VMB72 X8CETB30 14-9SB32 0!.%RB 1 TR6VMB72
X8CET
B 2 Y#:.’B30 1E2GVB 2 “XB+ B72 IMYF B30 174NBB32 04S&SB 2 “XB+ B72 IMYF B 3
4^/
>3811(BB0 1E2GVB 2 B]S CB71 (P;(<B30 14-9SB32 3A4H_B 2 B]S CB71 (P;(<B 2
ER1B6B
30 1E2GVB 2 !S>!WB 2 C#’$”B30 174NBB32 0+^4BB 2 !S>!WB 2 C#’$”B 2 ;]T[-
81TAGCEN
/63BB0 1E2GVB 2 V#%.VB72 R#,:0B31 1YT2)B33 0P”EHB 2 V#%.VB72 R#,:0B 2 :JR:_B30
1E2GVB 2 VUU-1B72 R<Q&^BB1 3H*4SBB3 1N]NAB 2 VUU-1B72 R<Q&^B 2 :8],G8120BB0
1E2
GVB 2 XHK:JB72 N89C!B31 1YT2)B33 0UX<*B 2 XHK:JB72 N89C!B 2 &<*-ZB30 1E2GVB 2
X
035^B72 ND%LCBB1 3H*4SBB3 1W3WPB 2 X035^B72 ND%LCB 2 &’YI*812OBB0 1E2GVB 2
UECZ
BB72 WNSR6B31 1YT2)B33 0LO4:B 2 UECZBB72 WNSR6B 2 >_FF)B30 1E2GVB 2 T^[JJB72
WT
5A_BB1 3H*4SBB3 1G/B%B 2 T^[JJB72 WT5A_B 2 >;P1B812PBB0 1E2GVB 2 UECZ]B72
WNSQM
B31 1YT2)B33 0LO4&B 2 UECZ]B72 WNSQMB 2 >_FH8B30 1E2GVB 2 T^[9-B72 WT5E=BB1
3H*
4SBB3 1G/C B 2 T^[9-B72 WT5E=B 2 >;O]D8121BB0 1E2GVB 2 XHK<2B72 N89CAB31
1YT2)B
33 0UX<*B 2 XHK<2B72 N89CAB 2 &<*)2B30 1E2GVB 2 X02^GB72 ND%O]BB1 3H*4SBB3
1W3W
=B 2 X02^GB72 ND%O]B 2 &’YC%81TKGCEN/63BB0 1E2GVB 2 V56XUB72 VHRYXB30 %ATCB33
33>2<B 2 V56XUB72 VHRYXB 2 >#W9KB30 1E2GVB 2 W97?BB72 U[]FCB31 2_VJ*B33 14WNSB
2 W97?BB72 U[]FCB 2 ?N88&812OBB0 1E2GVB 2 U&@< B72 WB’->B30 %ATCB33 31PR6B 2
U
&@< B72 WB’->B 2 ?H$W#B30 1E2GVB 2 V<[M(B72 V<9(ZB31 2_VJ*B33 13H5QB 2
V<[M(B72
V<9(ZB 2 ?@.]/812%BB0 1E2GVB 2 VOK#UB72 UNCI&B30 %ATCB33 36L(TB 2 VOK#UB72
UN
CI&B 2 >D>^@B30 1E2GVB 2 WSL:3B72 U0..!B31 2_VJ*B33 15&8;B 2 WSL:3B72 U0..!B 2
><\.>812&BB0 1E2GVB 2 VOKDDB72 UNCU.B30 %ATCB33 36L’3B 2 VOKDDB72 UNCU.B 2
>D>
(1B30 1E2GVB 2 WSLOVB72 U0.<<B31 2_VJ*B33 15&9QB 2 WSLOVB72 U0.<<B 2
><\ST812PB
B0 1E2GVB 2 U&@H\B72 WB’;1B30 %ATCB33 31PS+B 2 U&@H\B72 WB’;1B 2 ?H$DNB30
1E2G
VB 2 V<!]3B72 V<9&VB31 2_VJ*B33 13H5\B 2 V<!]3B72 V<9&VB 2 ?@...81TUGCEN/63BB0
1E2GVB 2 V> W=B72 UKWT”BB2 1.6@BBB4 0R5H”B 2 V> W=B72 UKWT”B 2 >/QHWB30 1E2GVB
2 VOD5\B72 UUH”,B30 :;DHB33 3U=J#B 2 VOD5\B72 UUH”,B 2 >J>\>812%BB0 1E2GVB 2
V
@(DKB72 UCY2)BB2 1.6@BBB4 0RC^(B 2 V@(DKB72 UCY2)B 2 >W?GYB30 1E2GVB 2
VQ<E>B72
UMKG4B30 :;DHB33 3V3M^B 2 VQ<E>B72 UMKG4B 2 >FIQ38138BB0 1E2GVB 2 V;NOZB72
US
U.?BB2 1.6@BBB4 0Q_-ZB 2 V;NOZB72 USU.?B 2 >)\87B30 1E2GVB 2 VL/ LB72 U+FDWB30
:;DHB33 3UJKNB 2 VL/ LB72 U+FDWB 2 >OS5]8139BB0 1E2GVB 2 V;M:3B72 USU!YBB2
1.6
@BBB4 0Q_(5B 2 V;M:3B72 USU!YB 2 >)_:#B30 1E2GVB 2 VL$]-B72 U+FEGB30 :;DHB33
3
UJKTB 2 VL$]-B72 U+FEGB 2 >OS4R812&BB0 1E2GVB 2 V@-)ZB72 UCYD:BB2 1.6@BBB4
Main Index 0RC_
1882
Code Examples

AB 2 V@-)ZB72 UCYD:B 2 >W>]=B30 1E2GVB 2 VQ<B?B72 UMKG:B30 :;DHB33 3V3N2B 2


VQ
<B?B72 UMKG:B 2 >FIO$81T(GCEN/63BB0 1E2GVB 2 VZV?)B72 UY3KEBB1 1_J/)BB3 0$M)+B
2 VZV?)B72 UY3KEB 2 >W^CSB30 1E2GVB 2 V’=W&B72 UV(KXB30 059K B33 4:F&?B 2
V’=W&
B72 UV(KXB 2 >/74A8138BB0 1E2GVB 2 VZ--7B72 UX=H.BB1 1_J/)BB3 0$N3PB 2 VZ--
7B72
UX=H.B 2 >W”EOB30 1E2GVB 2 V’;\SB72 UVE#(B30 059K B33 4:HLXB 2 V’;\SB72
UVE#(B
2 >$@PO813WBB0 1E2GVB 2 VZN.-B72 UYRXDBB1 1_J/)BB3 0$MGGB 2 VZN.-B72 UYRXDB 2
>X9]-B30 1E2GVB 2 V’Z4-B72 UW1[AB30 059K B33 4:EE8B 2 V’Z4-B72 UW1[AB 2
>/L”]81
3XBB0 1E2GVB 2 VZO9=B72 UYRNXBB1 1_J/)BB3 0$MF>B 2 VZO9=B72 UYRNXB 2 >XAC0B30
1
E2GVB 2 V’Z4-B72 UW1[AB30 059K B33 4:EE8B 2 V’Z4-B72 UW1[AB 2 >/L”]8139BB0
1E2G
VB 2 VZ(4BB72 UX=8#BB1 1_J/)BB3 0$N2@B 2 VZ(4BB72 UX=8#B 2 >W”WGB30 1E2GVB 2
V’
;^^B72 UVE#(B30 059K B33 4:HLXB 2 V’;^^B72 UVE#(B 2 >$@PO81T,GCEN/63BB0 1E2GVB
2 V#%!!B72 R#,>FB30 >HWTB33 3&@T=B 2 V#%!!B72 R#,>FB 2 :JS3?B30 1E2GVB 2
VUU9E
B72 R<R.;BB1 0ONR[BB3 %#.SB 2 VUU9EB72 R<R.;B 2 :8^B/8121BB0 1E2GVB 2
XHK!WB72
N897.B30 >HWTB33 428[/B 2 XHK!WB72 N897.B 2 &<*)2B30 1E2GVB 2 X028>B72
ND,’_B
B1 0ONR[BB3 ;O[SB 2 X028>B72 ND,’_B 2 &’ZL&812PBB0 1E2GVB 2 UECX.B72 WNS.\B30
>HWTB33 3ZB.,B 2 UECX.B72 WNS.\B 2 >_FW2B30 1E2GVB 2 T^[H;B72 WT4=’BB1
0ONR[BB
3 “M””B 2 T^[H;B72 WT4=’B 2 >;O$?812RBB0 1E2GVB 2 UEC[IB72 WNS/XB30 >HWTB33
3
ZB==B 2 UEC[IB72 WNS/XB 2 >_F*SB30 1E2GVB 2 T^[B6B72 WT4*!BB1 0ONR[BB3 “M”,B
2
T^[B6B72 WT4*!B 2 >;OX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%B72 UCZ/ B 2 >W?.>B30 1E2GVB 2 VQ<&?B72 UMIZIB30
0Y5-
3B32 :26#B 2 VQ<&?B72 UMIZIB 2 >FHP\8139BB0 1E2GVB 2 V;M/!B72 USVZGB31
3G(0CB3
3 1GNU2B 2 V;M/!B72 USVZGB 2 >)\B5B30 1E2GVB 2 VL/7YB72 U+E”DB30 0Y5-3B32
;!F?
B 2 VL/7YB72 U+E”DB 2 >OR&4813BBB0 1E2GVB 2 V;MUSB72 USV/VB31 3G(0CB33 1GNUEB
2
V;MUSB72 USV/VB 2 >)\6-B30 1E2GVB 2 VL$[7B72 U+E&^B30 0Y5-3B32 ;!F\B 2
VL$[7B
72 U+E&^B 2 >OR)-812;BB0 1E2GVB 2 V@-3ZB72 UCZ-EB31 3G(0CB33 1G#=!B 2 V@-3ZB72
UCZ-EB 2 >W?(OB30 1E2GVB 2 VQ<$TB72 UMI-%B30 0Y5-3B32 :26<B 2 VQ<$TB72 UMI-%B
2 >FHIX81UGGCEN/63BB0 1E2GVB 2 VZV_-B72 UY4F5B31 0_PUDB33 02K9JB 2 VZV_-B72
UY4
Main Index
CHAPTER 18 1883
Support Files

F5B 2 >W_54B30 1E2GVB 2 V’=]+B72 UV-J*B30 ‘N2;B33 2/#;%B 2 V’=]+B72 UV-J*B 2


>
/6X@8139BB0 1E2GVB 2 VZ-?WB72 UX=&”B31 0_PUDB33 02KQ.B 2 VZ-?WB72 UX=&”B 2
>W”@
6B30 1E2GVB 2 V’:6(B72 UVEGMB30 ‘N2;B33 2/%%UB 2 V’:6(B72 UVEGMB 2
>$@61813XBB
0 1E2GVB 2 VZN=@B72 UYS<PB31 0_PUDB33 02J@AB 2 VZN=@B72 UYS<PB 2 >XB39B30
1E2GV
B 2 V’ZYQB72 UW0T2B30 ‘N2;B33 2/”?+B 2 V’ZYQB72 UW0T2B 2 >/K?;813ZBB0 1E2GVB
2
VZO3”B72 UYS*DB31 0_PUDB33 02J?!B 2 VZO3”B72 UYS*DB 2 >XBI2B30 1E2GVB 2
V’Z%$B
72 UW0O$B30 ‘N2;B33 2/”?8B 2 V’Z%$B72 UW0O$B 2 >/L0#813BBB0 1E2GVB 2 VZ(G<B72
UX=)XB31 0_PUDB33 02KQQB 2 VZ(G<B72 UX=)XB 2 >W#70B30 1E2GVB 2 V’:K2B72
UVEB@B3
0 ‘N2;B33 2/%%1B 2 V’:K2B72 UVEB@B 2 >$@E_81UQGCEN/63BB0 1E2GVB 2 V#&++B72
R#%
&-B30 0NE\+B32 #\4AB 2 V#&++B72 R#%&-B 2 :JQ[>B30 1E2GVB 2 VUSI%B72 R<U,FB30
1
KV!@B32 0IEC@B 2 VUSI%B72 R<U,FB 2 :8_8=8123BB0 1E2GVB 2 XHM8VB72 N86”^B30
0NE\
+B32 ,$8)B 2 XHM8VB72 N86”^B 2 &<.:@B30 1E2GVB 2 X00S4B72 ND?F%B30 1KV!@B32
0M
)E9B 2 X00S4B72 ND?F%B 2 &’/WM812RBB0 1E2GVB 2 UED)EB72 WNQ)6B30 0NE\+B32 *-
!Z
B 2 UED)EB72 WNQ)6B 2 >_E(!B30 1E2GVB 2 T^!”2B72 WT5,SB30 1KV!@B32 0EEM4B 2
T^!
“2B72 WT5,SB 2 >;P4A812TBB0 1E2GVB 2 UED5TB72 WNQ:HB30 0NE\+B32 *-!:B 2
UED5TB
72 WNQ:HB 2 >_EK2B30 1E2GVB 2 T^@8*B72 WT6J\B30 1KV!@B32 0EENMB 2 T^@8*B72
WT6J
\B 2 >;OBY8125BB0 1E2GVB 2 XHL$”B72 N86[?B30 0NE\+B32 ,$8\B 2 XHL$”B72 N86[?B
2 &<.UYB30 1E2GVB 2 X \?UB72 ND?&IB30 1KV!@B32 0M)F#B 2 X \?UB72 ND?&IB 2
&’$WH
81U$GCEN/63BB0 1E2GVB 2 V557KB72 VHRBRB30 0WJ=HB32 ,+@4B 2 V557KB72 VHRBRB 2
>
#U(UB30 1E2GVB 2 W96[5B72 U[]+IB30 0-5V*B32 <+N8B 2 W96[5B72 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31 4OHY0B33 1>R%RB 2 V;M_#B72
USUE
KB 2 >)_LSB30 1E2GVB 2 VL$O+B72 U+G68B30 0Z&R]B32 :,;)B 2 VL$O+B72 U+G68B 2
>O
SK:812<BB0 1E2GVB 2 V@-(:B72 UCY ‘B31 4OHY0B33 1>[KJB 2 V@-(:B72 UCY ‘B 2
>W>”H
B30 1E2GVB 2 VQ<0.B72 UMK =B30 0Z&R]B32 :]:3B 2 VQ<0.B72 UMK =B 2
>FI0”81U@GCE
N/63BB0 1E2GVB 2 VZW<VB72 UY2*VB31 2AKG:B33 0=I96B 2 VZW<VB72 UY2*VB 2
>W^Y;B30
Main Index
1884
Code Examples

1E2GVB 2 V’=’TB72 UV()PB31 18VZ:B33 088]$B 2 V’=’TB72 UV()PB 2 >/7TV813BBB0


1E
2GVB 2 VZ(&-B72 UX’G?B31 2AKG:B33 0=I/ B 2 VZ(&-B72 UX’G?B 2 >W”NKB30 1E2GVB 2
V’;<VB72 UVFT<B31 18VZ:B33 089E_B 2 V’;<VB72 UVFT<B 2 >$@[A813ZBB0 1E2GVB 2
VZO
+#B72 UYRG:B31 2AKG:B33 0=H*XB 2 VZO+#B72 UYRG:B 2 >XAW?B30 1E2GVB 2 V’ZC4B72
U
W1[[B31 18VZ:B33 088(TB 2 V’ZC4B72 UW1[[B 2 >/L:!813/BB0 1E2GVB 2 VZO[6B72
UYRA
7B31 2AKG:B33 0=H*CB 2 VZO[6B72 UYRA7B 2 >XA=JB30 1E2GVB 2 V’ZVRB72 UW1:DB31
18
VZ:B33 088(CB 2 V’ZVRB72 UW1:DB 2 >/M0:813DBB0 1E2GVB 2 VZ)5 B72 UX’A[B31
2AKG:
B33 0=I$’B 2 VZ)5 B72 UX’A[B 2 >W”ZFB30 1E2GVB 2 V’:8?B72 UVFN8B31 18VZ:B33
089
E”B 2 V’:8?B72 UVFN8B 2 >$!6581V2GCEN/63BB0 1E2GVB 2 V#&JEB72 R#”M)B30
0HPP1B32
.””WB 2 V#&JEB72 R#”M)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 U0#@JB 2 >> 3C812?BB0 1E2GVB 2 VOI@HB72 UN9]XB30
0L
H]%B32 *CZ>B 2 VOI@HB72 UN9]XB 2 >D;HSB30 1E2GVB 2 WSJE’B72 U0#>4B30 14GO!B32
05$4)B 2 WSJE’B72 U0#>4B 2 >> 7’812VBB0 1E2GVB 2 U&?^NB72 WB/E@B30 0LH]%B32
.L
63B 2 U&?^NB72 WB/E@B 2 ?HV43B30 1E2GVB 2 V<?KAB72 V<EAOB30 14GO!B32 04GF”B 2
V
<?KAB72 V<EAOB 2 ?@”GX81VMGCEN/63BB0 1E2GVB 2 V>0.=B72 UKSA3B31 1 E-8B33
03DL(B
2 V>0.=B72 UKSA3B 2 >/N-(B30 1E2GVB 2 VOB(>B72 UUL@&B30 &0--B33 3AQIWB 2
VOB(
>B72 UUL@&B 2 >J!J?812<BB0 1E2GVB 2 V@(LXB72 UCV0]B31 1 E-8B33 03J11B 2
V@(LXB7
2 UCV0]B 2 >W:,/B30 1E2GVB 2 VQ:M\B72 UMM>DB30 &0--B33 3A%*UB 2 VQ:M\B72
UMM>D
B 2 >FJ!R813DBB0 1E2GVB 2 V;ODTB72 USP$JB31 1 E-8B33 037=%B 2 V;ODTB72 USP$JB
2
>)[RBB30 1E2GVB 2 VLZ59B72 U+K!<B30 &0--B33 3A3[?B 2 VLZ59B72 U+K!<B 2
>OVMY8
13FBB0 1E2GVB 2 V;P4/B72 USPIQB31 1 E-8B33 037=8B 2 V;P4/B72 USPIQB 2 >)[]_B30
1E2GVB 2 VLY[“B72 U+K^:B30 &0--B33 3A3]9B 2 VLY[“B72 U+K^:B 2 >OVG/812?BB0
1E2
GVB 2 V@)C)B72 UCU#3B31 1 E-8B33 03J0PB 2 V@)C)B72 UCU#3^81UF^B 2 >W<H@B30
1E2G
VB 2 VQ:DIB72 UMM!CB30 &0--B33 3A%*%B 2 VQ:DIB72 UMM!CB 2 >FJ&\81VWGCEN/63BB0
1E2GVB 2 VZYR$B72 UX\(“B31 47+! B33 1”19FB 2 VZYR$B72 UX\(“B 2 >W[P*B30 1E2GVB
2 V’’VDB72 UV.’RB31 03M;[B34 4’”LLB 2 V’’VDB72 UV.’RB 2 >/9!_813DBB0 1E2GVB 2
V
Z’&&B72 UX/MTB31 47+! B33 1”1?VB 2 VZ’&&B72 UX/MTB 2 >W=!NB30 1E2GVB 2
V’,ONB72
Main Index
CHAPTER 18 1885
Support Files

UVKLHB31 03M;[B34 4’#,UB 2 V’,ONB72 UVKLHB 2 >$]<]813/BB0 1E2GVB 2 VZQ5MB72


UY
N] B31 47+! B33 1”0R0B 2 VZQ5MB72 UYN] B 2 >X8[3B30 1E2GVB 2 V’YJSB72 UW55$B31
03M;[B34 4’.!QB 2 V’YJSB72 UW55$B 2 >/N,4813-BB0 1E2GVB 2 VZQ4-B72 UYN]”B31
47+
! B33 1”0R0B 2 VZQ4-B72 UYN]”B 2 >X8[3B30 1E2GVB 2 V’Y+;B72 UW4\?B31 03M;[B34
4
‘.@JB 2 V’Y+;B72 UW4\?B 2 >/N\ 813FBB0 1E2GVB 2 VZ’&1B72 UX/NCB31 47+! B33
1”1?
VB 2 VZ’&1B72 UX/NCB 2 >W=!NB30 1E2GVB 2 V’,=#B72 UVKFJB31 03M;[B34 4’#&GB 2
V’
,=#B72 UVKFJB 2 >$^1>81V’GCEN/63BB0 1E2GVB 2 V#*-,B72 R#&9TB30 1^UU\B32 0(A;3B
2 V#*-,B72 R#&9TB 2 :JN*DB30 1E2GVB 2 VUQ,)B72 R<W7BB30 1-@[0B32 0T16AB 2
VUQ,)
B72 R<W7BB 2 :8^\F8127BB0 1E2GVB 2 XHK+@B72 N89*=B30 1^UU\B32 0*#F,B 2
XHK+@B72
N89*=B 2 &<*>SB30 1E2GVB 2 X ^,?B72 ND@ZDB30 1-@[0B32 0Y0@IB 2 X ^,?B72
ND@ZDB
2 &’ZHJ812VBB0 1E2GVB 2 UEE)IB72 WNL]MB30 1^UU\B32 0Z8MUB 2 UEE)IB72 WNL]MB 2
>_BOIB30 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 1E2GVB 2 VZQJWB72 UYMZ4BB1
4UI’UBB
3 1[5=YB 2 VZQJWB72 UYMZ4B 2 >X7!\B30 1E2GVB 2 V’YVNB72 UW60RB30 0N8\HB32
*@KL
Main Index
1886
Code Examples

B 2 V’YVNB72 UW60RB 2 >/O%)813)BB0 1E2GVB 2 VZR3CB72 UYMJRBB1 4UI’UBB3 1[5’2B


2
VZR3CB72 UYMJRB 2 >X8N&B30 1E2GVB 2 V’X??B72 UW6E/B30 0N8\HB32 *@K)B 2
V’X??B
72 UW6E/B 2 >/OO;813HBB0 1E2GVB 2 VZ=RVB72 UX$. BB1 4UI’UBB3 1[7B5B 2 VZ=RVB72
UX$. B 2 >W=?@B30 1E2GVB 2 V’,20B72 UVLG8B30 0N8\HB32 *@.-B 2 V’,20B72 UVLG8B
2 >$^J”81WIGCEN/63BB0 1E2GVB 2 V#.)DB72 R#*@<B31 *K<PB34 30EJFB 2 V#.)DB72
R#*
@<B 2 :JK4%B30 1E2GVB 2 VUP:4B72 R<Z’QBB1 3’6*,BB3 1/W+BB 2 VUP:4B72 R<Z’QB 2
:
9 5>8129BB0 1E2GVB 2 XHE_YB72 N88T_B31 *K<PB34 3D>FSB 2 XHE_YB72 N88T_B 2 &<-
*
3B30 1E2GVB 2 X _&SB72 ND]77BB1 3’6*,BB3 1”M>,B 2 X _&SB72 ND]77B 2
&’+EY812XBB
0 1E2GVB 2 UE9N,B72 WNJ-<B31 *K<PB34 2;![RB 2 UE9N,B72 WNJ-<B 2 >_4<ZB30
1E2GV
B 2 T^>HWB72 WTC2YBB1 3’6*,BB3 1TW”1B 2 T^>HWB72 WTC2YB 2 >;R(4812ZBB0 1E2GVB
2
UEAK@B72 WNJJ*B31 *K<PB34 2;!@0B 2 UEAK@B72 WNJJ*B 2 >_5MLB30 1E2GVB 2
T^<<^B
72 WTCCEBB1 3’6*,BB3 1TW”&B 2 T^<<^B72 WTCCEB 2 >;RN=812BBB0 1E2GVB 2 XHF[(B72
N889>B31 *K<PB34 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VB 2 VQ,1DB72 UMVM>BB1 0QNI0BB3 #!O[B 2 VQ,1DB72 UMVM>B 2 >FPB=813HBB0
1E2GV
B 2 V;QO,B72 USK’(B31 3(_8)B33 1TJ1]B 2 V;QO,B72 USK’(B 2 >)@7’B30 1E2GVB 2
VLX
<RB72 U+Q68BB1 0QNI0BB3 #&F B 2 VLX<RB72 U+Q68B 2 >OY”+813JBB0 1E2GVB 2
V;Q.9B
72 USK$’B31 3(_8)B33 1TJ1QB 2 V;Q.9B72 USK$’B 2 >)@J/B30 1E2GVB 2 VLX””B72
U+Q8
NBB1 0QNI0BB3 #&F4B 2 VLX””B72 U+Q8NB 2 >OY=(812]BB0 1E2GVB 2 V@=_\B72
UCMX2B3
1 3(_8)B33 1T*SQB 2 V@=_\B72 UCMX2B 2 >W%’<B30 1E2GVB 2 VQ&[WB72 UMVP5BB1
0QNI0
BB3 #!O_B 2 VQ&[WB72 UMVP5B 2 >FP7D81W%GCEN/63BB0 1E2GVB 2 VZ$-(B72 UX@L)B31
2
4SHJB33 0(A38B 2 VZ$-(B72 UX@L)B 2 >W>@.B30 1E2GVB 2 V’(/1B72 UV,^&BB1
&_+8BB4
3EB%DB 2 V’(/1B72 UV,^&B 2 >/D)?813HBB0 1E2GVB 2 VZ.W2B72 UXW-_B31 24SHJB33
0(
AT7B 2 VZ.W2B72 UXW-_B 2 >W)IUB30 1E2GVB 2 V’%>%B72 UVP-XBB1 &_+8BB4 3EC@JB 2
V’%>%B72 UVP-XB 2 >/ 3Z813)BB0 1E2GVB 2 VZS>=B72 UYG1<B31 24SHJB33 0(9)0B 2
VZS
>=B72 UYG1<B 2 >X4X[B30 1E2GVB 2 V’W87B72 UWCL BB1 &_+8BB4 3EA(,B 2 V’W87B72
U
WCL B 2 >/S7E813=BB0 1E2GVB 2 VZS#EB72 UYG44B31 24SHJB33 0(9)6B 2 VZS#EB72
UYG4
Main Index
CHAPTER 18 1887
Support Files

4B 2 >X4TSB30 1E2GVB 2 V’WIYB72 UWCI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6AB72 USO’]BB1
2R
BWABB3 0;\IXB 2 V;Q6AB72 USO’]B 2 >)]J;B30 1E2GVB 2 VLYB&B72 U+L>CB30 0FR&/B32
)]:^B 2 VLYB&B72 U+L>CB 2 >OVO2812_BB0 1E2GVB 2 V@’]’B72 UCR]VBB1 2RBWABB3
0:H
,VB 2 V@’]’B72 UCR]VB 2 >W:Q%B30 1E2GVB 2 VQ,)SB72 UMQF&B30 0FR&/B32 ‘30<B 2
V
Q,)SB72 UMQF&B 2 >FLKK81XOGCEN/63BB0 1E2GVB 2 VZY?@B72 UX_*7B30 %?/*B33
38=.MB
2 VZY?@B72 UX_*7B 2 >W!\@B30 1E2GVB 2 V’’UUB72 UV*$ZBB0 0QI40BB2 #ZV2B 2
V’’U
UB72 UV*$ZB 2 >/A=8813JBB0 1E2GVB 2 VZ=JJB72 UX$[9B30 %?/*B33 38.%4B 2
VZ=JJB7
2 UX$[9B 2 >W=_<B30 1E2GVB 2 V’,B.B72 UVL3TBB0 0QI40BB2 #Z=#B 2 V’,B.B72
UVL3T
B 2 >$^G#813=BB0 1E2GVB 2 VZR0EB72 UYMKAB30 %?/*B33 38’+\B 2 VZR0EB72 UYMKAB
2
>X8MIB30 1E2GVB 2 V’X!NB72 UW6P0BB0 0QI40BB2 #ZI#B 2 V’X!NB72 UW6P0B 2
>/O$”8
13*BB0 1E2GVB 2 VZQSTB72 UYMW5B30 %?/*B33 38’(TB 2 VZQSTB72 UYMW5B 2 >X8 ^B30
1E2GVB 2 V’Y&FB72 UW65)BB0 0QI40BB2 #ZIJB 2 V’Y&FB72 UW65)B 2 >/P41813LBB0
1E2
Main Index
1888
Code Examples

GVB 2 VZ’%IB72 UX/6;B30 %?/*B33 38.&#B 2 VZ’%IB72 UX/6;B 2 >W=(\B30 1E2GVB 2


V
‘;3$B72 UVK%5BB0 0QI40BB2 #Z=JB 2 V’;3$B72 UVK%5B 2 >$^;181XYGCEN/63BB0
1E2GVB
2 V#&K”B72 R#@L!BB0 13@HFBB2 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2 >FBPX81Y0GCEN/63BB0 1E2GVB 2 VZTP.B72 UYE,?B31 0_&^ZB33 02X36B 2 VZTP.B72
UY
E,?B 2 >X3]AB30 1E2GVB 2 V’%WQB72 UVR]2BB0 ..Y*BB3 2,BZTB 2 V’%WQB72 UVR]2B 2
>/0%L813LBB0 1E2GVB 2 VZ/?MB72 UX<D_B31 0_&^ZB33 02XL7B 2 VZ/?MB72 UX<D_B 2
>W<
H@B30 1E2GVB 2 V’@D(B72 UV3&3BB0 ..Y*BB3 2,CX>B 2 V’@D(B72 UV3&3B 2
>$,)L813*B
B0 1E2GVB 2 VZL &B72 UY(MGB31 0_&^ZB33 02W&3B 2 VZL &B72 UY(MGB 2 >XI([B30
1E2G
VB 2 V’(DBB72 UV:ISBB0 ..Y*BB3 2,A+)B 2 V’(DBB72 UV:ISB 2 >/EU1813#BB0 1E2GVB
2 VZK^2B72 UY(N0B31 0_&^ZB33 02W&5B 2 VZK^2B72 UY(N0B 2 >XI/^B30 1E2GVB 2
V’(,R
B72 UV:5,BB0 ..Y*BB3 2,A/9B 2 V’(,RB72 UV:5,B 2 >/E:N813NBB0 1E2GVB 2
VZ/;(B72
UX<FTB31 0_&^ZB33 02XLCB 2 VZ/;(B72 UX<FTB 2 >W<E!B30 1E2GVB 2 V’@;(B72
UV3$OB
B0 ..Y*BB3 2,CWNB 2 V’@;(B72 UV3$OB 2 >$;1A81YAGCEN/63BB0 1E2GVB 2 V#;”CB72
R#
Main Index
CHAPTER 18 1889
Support Files

<2JB31 2Z3K3B33 0_$@\B 2 V#;”CB72 R#<2JB 2 :JWQWB30 1E2GVB 2 VUT&OB72 R<O.$B30


114-TB32 07Q7<B 2 VUT&OB72 R<O.$B 2 :8!HK812FBB0 1E2GVB 2 XHQE0B72 N89A’B31
2Z3
K3B33 14I2<B 2 XHQE0B72 N89A’B 2 &<,WUB30 1E2GVB 2 X01=2B72 ND%R!B30 114-TB32
0
BGPVB 2 X01=2B72 ND%R!B 2 &’X5E812-BB0 1E2GVB 2 UEG>7B72 WNV#SB31 2Z3K3B33
0?W&
YB 2 UEG>7B72 WNV#SB 2 >_L<MB30 1E2GVB 2 T^[N&B72 WT0%/B30 114-TB32 03]V,B 2
T^
[N&B72 WT0%/B 2 >;LEI812)BB0 1E2GVB 2 UEDF9B72 WNW[.B31 2Z3K3B33 0?W>0B 2
UEDF9
B72 WNW[.B 2 >_J;*B30 1E2GVB 2 T^!>FB72 WT0]%B30 114-TB32 03]WBB 2 T^!>FB72
WT0
]%B 2 >;K[[812HBB0 1E2GVB 2 XHM-2B72 N8AM’B31 2Z3K3B33 14I8LB 2 XHM-2B72
N8AM’B
2 &<%BTB30 1E2GVB 2 X019WB72 ND%-5B30 114-TB32 0BGP]B 2 X019WB72 ND%-5B 2
&’W%
N81YKGCEN/63BB0 1E2GVB 2 V531_B72 VHY=FBB0 0?MNMBB2 \<0<B 2 V531_B72 VHY=FB 2
>#ZLUB30 1E2GVB 2 W9A.\B72 U[:S<B31 0GM37B33 )’:SB 2 W9A.\B72 U[:S<B 2
?N4,C81
2-BB0 1E2GVB 2 U&:M@B72 WB%:DBB0 0?MNMBB2 \E*XB 2 U&:M@B72 WB%:DB 2 ?H+4/B30
1
E2GVB 2 V<^WTB72 V<4XUB31 0GM37B33 )HT’B 2 V<^WTB72 V<4XUB 2 ?@’Q’813 BB0
1E2G
VB 2 VOFL&B72 UNLK^BB0 0?MNMBB2 0 S4/B 2 VOFL&B72 UNLK^B 2 >D[1$B30 1E2GVB 2
WS
P3]B72 U0$KTB31 0GM37B33 ‘4):B 2 WSP3]B72 U0$KTB 2 ><[N=8131BB0 1E2GVB 2
VOH*1
B72 UNKZ1BB0 0?MNMBB2 0 S3 B 2 VOH*1B72 UNKZ1B 2 >D]PVB30 1E2GVB 2 WSO@%B72
U0$
NRB31 0GM37B33 ‘4)[B 2 WSO@%B72 U0$NRB 2 ><[H”812)BB0 1E2GVB 2 U&>”8B72
WB%32B
B0 0?MNMBB2 \E. B 2 U&>”8B72 WB%32B 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72 UV6O=B31 1^UU,B33 0Z;QJB 2 V’?<3B72 UV6O=B 2 >$:/0813#BB0 1E2GVB 2
VZ
MB%B72 UY$#IBB0 (J(OBB3 2R3.@B 2 VZMB%B72 UY$#IB 2 >XG$JB30 1E2GVB 2 V’-OIB72
UV@EHB31 1^UU,B33 0Z,/:B 2 V’-OIB72 UV@EHB 2 >/H9O813&BB0 1E2GVB 2 VZM>\B72
UY$
WPBB0 (J(OBB3 2R3=JB 2 VZM>\B72 UY$WPB 2 >XG^9B30 1E2GVB 2 V’-V#B72 UV@C2B31
1
^UU,B33 0Z,/=B 2 V’-V#B72 UV@C2B 2 >/HD>813PBB0 1E2GVB 2 VZ-R^B72 UX,IDBB0
(J(
OBB3 2R5U,B 2 VZ-R^B72 UX,IDB 2 >W:7OB30 1E2GVB 2 V’?_FB72 UV6MSB31 1^UU,B33
0Z
;QAB 2 V’?_FB72 UV6MSB 2 >$:)U81Y,GCEN/63BB0 1E2GVB 2 V#?42B72 R#X&FB30
.;N;B3
3 2_K’NB 2 V#?42B72 R#X&FB 2 :JJ1.B30 1E2GVB 2 VUN0WB72 R<.-NB30 0#!!RB32
_>E5
Main Index
1890
Code Examples

B 2 VUN0WB72 R<.-NB 2 :94D=812HBB0 1E2GVB 2 XHR\WB72 N7[8;B30 .;N;B33 3A,#_B


2
XHR\WB72 N7[8;B 2 &<-[UB30 1E2GVB 2 X ^0CB72 NE0C*B30 0#!!RB32 01C1”B 2 X
^0CB
72 NE0C*B 2 &’(#U812)BB0 1E2GVB 2 UELN^B72 WN8L8B30 .;N;B33 2&915B 2 UELN^B72
WN8L8B 2 >_5DPB30 1E2GVB 2 T^&?@B72 WTP50B30 0#!!RB32 [:_BB 2 T^&?@B72 WTP50B
2 >;ZG<812=BB0 1E2GVB 2 UEI9ZB72 WN9O]B30 .;N;B33 2&99BB 2 UEI9ZB72 WN9O]B 2
>
_3PBB30 1E2GVB 2 T^,1ZB72 WTP1IB30 0#!!RB32 [:_5B 2 T^,1ZB72 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GB72 VHY”EB 2 >#$&?B30 1E2GVB 2
W9A-
&B72 U[;UFB30 1BPVUB32 08)=]B 2 W9A-&B72 U[;UFB 2 ?N3>/812=BB0 1E2GVB 2
U&<2>B7
2 WB;$3BB0 0[T “BB2 0 ?1;B 2 U&<2>B72 WB;$3B 2 ?H)4;B30 1E2GVB 2 V> B:B72 V<
X6
B30 1BPVUB32 07_^)B 2 V> B:B72 V< X6B 2 ?@(P18133BB0 1E2GVB 2 VOH;”B72
UNI.ZBB0
0[T “BB2 016S8B 2 VOH;”B72 UNI.ZB 2 >D![7B30 1E2GVB 2 WSPTGB72 U0+H(B30
1BPVUB
32 09MDUB 2 WSPTGB72 U0+H(B 2 ><^N<8135BB0 1E2GVB 2 VOKH=B72 UNH@PBB0 0[T “BB2
016QPB 2 VOKH=B72 UNH@PB 2 >D]L1B30 1E2GVB 2 WSM2DB72 U0-P!B30 1BPVUB32 09MG6B
2 WSM2DB72 U0-P!B 2 ><[MC812*BB0 1E2GVB 2 U&?W,B72 WB,#!BB0 0[T “BB2 0 ?08B 2
U
&?W,B72 WB,#!B 2 ?H’UDB30 1E2GVB 2 V<],HB72 V<0’7B30 1BPVUB32 07\ DB 2
V<],HB72
V<0’7B 2 ?@+QM81Z”GCEN/63BB0 1E2GVB 2 V> Z’B72 UK/X:BB1 4,=L\BB3 24*.OB 2 V>
Z
‘B72 UK/X:B 2 >/U=8B30 1E2GVB 2 VOGM+B72 UUCSYBB0 0)DP6BB2 ?&M0B 2 VOGM+B72
UU
CSYB 2 >J<G/8133BB0 1E2GVB 2 V@(E:B72 UC-T6BB1 4,=L\BB3 24\9LB 2 V@(E:B72 UC-
T6
B 2 >W]^3B30 1E2GVB 2 VQ?;WB72 UMEB9BB0 0)DP6BB2 ?>78B 2 VQ?;WB72 UMEB9B 2
>FF
P<813RBB0 1E2GVB 2 V;N’SB72 USZM!BB1 4,=L\BB3 24TG(B 2 V;N’SB72 USZM!B 2
>’2NKB
30 1E2GVB 2 VL+,:B72 U+B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’>Z<B72
UVA.MB
2 >$?B!81$2GCEN/63BB0 1E2GVB 2 V##NZB72 R#<EEBB0 21*7YBB2 0=4O>B 2 V##NZB72
R#
<EEB 2 :JS*/B30 1E2GVB 2 VUU+IB72 R<PN2B30 4>*5CB32 2GA79B 2 VUU+IB72 R<PN2B 2
:8[$%812LBB0 1E2GVB 2 XHI-UB72 N8D1IBB0 21*7YBB2 0%,,:B 2 XHI-UB72 N8D1IB 2
&<“
*/B30 1E2GVB 2 X069@B72 ND”@;B30 4>*5CB32 2RHK9B 2 X069@B72 ND”@;B 2
&’Z!X812*B
B0 1E2GVB 2 UEBBHB72 WNT”YBB0 21*7YBB2 0/!6EB 2 UEBBHB72 WNT”YB 2 >_FE9B30
1E2G
Main Index
1892
Code Examples

VB 2 T^\6CB72 WT1WGB30 4>*5CB32 267 MB 2 T^\6CB72 WT1WGB 2 >;P2’812#BB0 1E2GVB


2 UEC8NB72 WNTP=BB0 21*7YBB2 0/!5CB 2 UEC8NB72 WNTP=B 2 >_F&[B30 1E2GVB 2
T^?1]
B72 WT3<HB30 4>*5CB32 267D_B 2 T^?1]B72 WT3<HB 2 >;L3>812NBB0 1E2GVB 2
XHJ$$B72
N8C*ABB0 21*7YBB2 0%,&ZB 2 XHJ$$B72 N8C*AB 2 &<#KLB30 1E2GVB 2 X0 6OB72
ND&D:B
30 4>*5CB32 2RH/]B 2 X0 6OB72 ND&D:B 2 &’VOS81$CGCEN/63BB0 1E2GVB 2 V585JB72
VH
QJZBB1 360,YBB3 1AW5(B 2 V585JB72 VHQJZB 2 >#WS.B30 1E2GVB 2 W98F1B72 U[]U>BB0
1.+]+BB2 0Q4’7B 2 W98F1B72 U[]U>B 2 ?N8=3812*BB0 1E2GVB 2 U&!PVB72 WB=H$BB1
360
,YBB3 19CI*B 2 U&!PVB72 WB=H$B 2 ?H/Z,B30 1E2GVB 2 V<[A*B72 V<7I3BB0 1.+]+BB2
0
PE(^B 2 V<[A*B72 V<7I3B 2 ?@’#X8135BB0 1E2GVB 2 VOMVFB72 UN9Q#BB1 360,YBB3
1B<V
UB 2 VOMVFB72 UN9Q#B 2 >D<\IB30 1E2GVB 2 WSJ/0B72 U0%/#BB0 1.+]+BB2 0Q]#CB 2
WS
J/0B72 U0%/#B 2 >>03H8137BB0 1E2GVB 2 VOM%OB72 UN9LYBB1 360,YBB3 1B<V3B 2
VOM%O
B72 UN9LYB 2 >D>8”B30 1E2GVB 2 WSMI+B72 U0#.OBB0 1.+]+BB2 0Q].+B 2 WSMI+B72
U0#
.OB 2 >>1=/812#BB0 1E2GVB 2 U&!=OB72 WB=B+BB1 360,YBB3 19CILB 2 U&!=OB72
WB=B+B
2 ?H/#*B30 1E2GVB 2 V<^!3B72 V<6O=BB0 1.+]+BB2 0PE+SB 2 V<^!3B72 V<6O=B 2
?@.M
L81$MGCEN/63BB0 1E2GVB 2 V>2NEB72 UKTD>B36 32%FNB38 19BKMB 2 V>2NEB72 UKTD>B 2
>/P\8B30 1E2GVB 2 VODW;B72 UUL9<B31 )X!GB34 2YR3:B 2 VODW;B72 UUL9<B 2
>J[IS81
35BB0 1E2GVB 2 V@’##B72 UCU!UB36 32#?(B38 19M(,B 2 V@’##B72 UCU!UB 2 >W>,#B30
1
E2GVB 2 VQ>PMB72 UMN1PB31 )X!GB34 2Y”4QB 2 VQ>PMB72 UMN1PB 2 >FL,7813TBB0
1E2G
VB 2 V;P]”B72 USRY_B36 32%-1B38 1901@B 2 V;P]”B72 USRY_B 2 >)_’JB30 1E2GVB 2
VL
/:\B72 U+I!.B31 )X!GB34 2Y83-B 2 VL/:\B72 U+I!.B 2 >OW1%813VBB0 1E2GVB 2
V;P\*
B72 USRYDB36 32%FNB38 19 <GB 2 V;P\*B72 USRYDB 2 >)_=;B30 1E2GVB 2 VL$) B72
U+J
J1B31 )X!GB34 2Y86VB 2 VL$) B72 U+JJ1B 2 >OVJZ8137BB0 1E2GVB 2 V@’,”B72
UCU@#B
36 32%FIB38 19M<JB 2 V@’,”B72 UCU@#B 2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X ^VVB72 NE [5BB0 47/6SBB2 2 ();B 2 X ^VVB72 NE [5B 2 &’(^@812#BB0 1E2GVB 2
UE
L<#B72 WM!GHBB0 ;^)&BB3 3M[,)B 2 UEL<#B72 WM!GHB 2 >^@P<B30 1E2GVB 2 T^.>%B72
WT)U,BB0 47/6SBB2 1*7-MB 2 T^.>%B72 WT)U,B 2 >;*P1812”BB0 1E2GVB 2 UES55B72
WM?
Main Index
CHAPTER 18 1893
Support Files

B’BB0 ;^)&BB3 3M[WVB 2 UES55B72 WM?B’B 2 >^]_:B30 1E2GVB 2 T^’*’B72 WT’BVBB0


4
7/6SBB2 1*7=EB 2 T^’*’B72 WT’BVB 2 >;.A3812MBB0 1E2GVB 2 XHTQ!B72 N7@^;BB0
;^)
&BB3 3:ZX#B 2 XHTQ!B72 N7@^;B 2 &<(G:B30 1E2GVB 2 X [N9B72 NE0+,BB0 47/6SBB2 2
(“ZB 2 X [N9B72 NE0+,B 2 &’-$\81$:GCEN/63BB0 1E2GVB 2 V5I\=B72 VG@”3B30
1C#F%B3
2 0AB$UB 2 V5I\=B72 VG@”3B 2 >#C%3B30 1E2GVB 2 W8_-YB72 U]UF/BB0 2U5”/BB2
0:1OL
B 2 W8_-YB72 U]UF/B 2 ?NTN%812#BB0 1E2GVB 2 U,7/”B72 WB5(3B30 1C#F%B32 09UQ(B
2
U,7/”B72 WB5(3B 2 ?HG_2B30 1E2GVB 2 V<“U’B72 V<*Q?BB0 2U5”/BB2 0,][-B 2
V<“U’B
72 V<*Q?B 2 ?!1),8137BB0 1E2GVB 2 VOYU)B72 UM’S!B30 1C#F%B32 0A!YJB 2 VOYU)B72
UM’S!B 2 >D/#=B30 1E2GVB 2 WSA81B72 U1F^]BB0 2U5”/BB2 0<8DHB 2 WSA81B72 U1F^]B
2 >>I/P8136BB0 1E2GVB 2 VOUN)B72 UM=:4B30 1C#F%B32 0A!/+B 2 VOUN)B72 UM=:4B 2
>
DZK*B30 1E2GVB 2 WSC&9B72 U1F53BB0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B30
2=1MGB32
0]”O$B 2 UEDL6B72 WNW^BB 2 >_J@BB30 1E2GVB 2 T^\”QB72 WT ]=B7 0HB[?BB1
‘ZC+B
2 T^\”QB72 WT ]=B 2 >;OD1812KBB0 1E2GVB 2 XHN6LB72 N898RB30 2=1MGB32 18^GXB 2
Main Index
1894
Code Examples

XHN6LB72 N898RB 2 &<#)CB30 1E2GVB 2 X06R&B72 ND”PXB7 0HB[?BB1 #BV”B 2


X06R&B7
2 ND”PXB 2 &’Z%/81/SGCEN/63BB0 1E2GVB 2 V53*AB72 VHYI’B30 0_^K(B32 02K:.B 2
V53
*AB72 VHYI’B 2 >#Z$NB30 1E2GVB 2 W9AWKB72 U[<0/BB1 27;@XBB3 0(M7%B 2 W9AWKB72
U
[<0/B 2 ?N55$812”BB0 1E2GVB 2 U&>T#B72 WB%AVB30 0_^K(B32 01.P!B 2 U&>T#B72
WB%A
VB 2 ?H-L2B30 1E2GVB 2 V<_=*B72 V<4%OBB1 27;@XBB3 0-NWZB 2 V<_=*B72 V<4%OB 2
?@
=(98136BB0 1E2GVB 2 VOH-;B72 UNKB]B30 0_^K(B32 02\0TB 2 VOH-;B72 UNKB]B 2
>D]0A
B30 1E2GVB 2 WSQKPB72 U0$IEBB1 27;@XBB3 0)L?TB 2 WSQKPB72 U0$IEB 2
><]T*8134BB0
1E2GVB 2 VOG]>B72 UNKQ5B30 0_^K(B32 02\0]B 2 VOG]>B72 UNKQ5B 2 >D[+:B30
1E2GVB
2 WSNL’B72 U0/G;BB1 27;@XBB3 0)L[:B 2 WSNL’B72 U0/G;B 2 ><!’\812.BB0 1E2GVB 2
U&<,XB72 WB%O)B30 0_^K(B32 01.QNB 2 U&<,XB72 WB%O)B 2 ?H+]*B30 1E2GVB 2
V<[.EB7
2 V<5#*BB1 27;@XBB3 0-NZ”B 2 V<[.EB72 V<5#*B 2 ?@)@O81/+GCEN/63BB0 1E2GVB 2
V<_
*^B72 UK-CNB30 0.X+7B32 !GRIB 2 V<_*^B72 UK-CNB 2 >/UVDB30 1E2GVB 2 VOF!YB72
U
UA, BB0 &EHIBB3 3BZ*&B 2 VOF!YB72 UUA, B 2 >J;Q?8136BB0 1E2GVB 2 V@+’EB72
UC)P
XB30 0.X+7B32 !LH6B 2 V@+’EB72 UC)PXB 2 >W^D^B30 1E2GVB 2 VQ@C6B72 UMCMBBB0
&
EHIBB3 3B[E9B 2 VQ@C6B72 UMCMBB 2 >FEA>813UBB0 1E2GVB 2 V;MN#B72 US$S]B30
0.X+7
B32 !B/MB 2 V;MN#B72 US$S]B 2 >’2BPB30 1E2GVB 2 VL-G(B72 U+9LGBB0 &EHIBB3
3BD
IEB 2 VL-G(B72 U+9LGB 2 >OP1E813SBB0 1E2GVB 2 V;K,QB72 US$_*B30 0.X+7B32
!B+JB
2 V;K,QB72 US$_*B 2 >’1HHB30 1E2GVB 2 VL-+\B72 U+9EZBB0 &EHIBB3 3BDHDB 2 VL-
+
\B72 U+9EZB 2 >OPD98134BB0 1E2GVB 2 V@/4!B72 UC)[JB30 0.X+7B32 !LI3B 2
V@/4!B7
2 UC)[JB 2 >W]ILB30 1E2GVB 2 VQ@X*B72 UMCE”BB0 &EHIBB3 3B[D8B 2 VQ@X*B72
UMCE”
B 2 >FEOG81/%GCEN/63BB0 1E2GVB 2 VZURHB72 UYA+(B31 01P”5B34 4W”?DB 2 VZURHB72
U
YA+(B 2 >X1EKB30 1E2GVB 2 V’”;(B72 UVW+ZB30 -Z(^B33 2M<$OB 2 V’”;(B72 UVW+ZB
2
>/3HH813UBB0 1E2GVB 2 VZ-5/B72 UX%>$B31 01P”5B34 4W%LZB 2 VZ-5/B72 UX%>$B 2
>W
,/2B30 1E2GVB 2 V’?3@B72 UV8- B30 -Z(^B33 2M>PNB 2 V’?3@B72 UV8- B 2
>$<;\813>
BB0 1E2GVB 2 VZM82B72 UY$G0B31 01P”5B34 4W*NZB 2 VZM82B72 UY$G0B 2 >XG50B30
1E2
GVB 2 V’-IKB72 UV@NEB30 -Z(^B33 2M:**B 2 V’-IKB72 UV@NEB 2 >/HA?813:BB0
1E2GVB
2 VZL&.B72 UY$NTB31 01P”5B34 4W*P3B 2 VZL&.B72 UY$NTB 2 >XF?+B30 1E2GVB 2
V’+$
@B72 UV@+7B30 -Z(^B33 2M:#OB 2 V’+$@B72 UV@+7B 2 >/G&Y813SBB0 1E2GVB 2
VZ+#FB7
2 UX%\1B31 01P”5B34 4W%M>B 2 VZ+#FB72 UX%\1B 2 >W,N-B30 1E2GVB 2 V’>K^B72
UV8<!
B30 -Z(^B33 2M>Q^B 2 V’>K^B72 UV8<!B 2 >$<PA81/[GCEN/63BB0 1E2GVB 2 V#*X<B72
R
%038B30 1_ :[B32 0(S[AB 2 V#*X<B72 R%038B 2 :J$E!B30 1E2GVB 2 VU$+#B72
R<D,TBB0
0%’<;BB2 \H#’B 2 VU$+#B72 R<D,TB 2 :8>3=812KBB0 1E2GVB 2 XHO4AB72 N8B&ZB30
1_
:[B32 0”2$/B 2 XHO4AB72 N8B&ZB 2 &<,’!B30 1E2GVB 2 X052NB72 ND*3<BB0 0%’<;BB2
01(!%B 2 X052NB72 ND*3<B 2 &’XQ5812.BB0 1E2GVB 2 UE9UVB72 WN,A7B30 1_ :[B32
0ZP
QPB 2 UE9UVB72 WN,A7B 2 >_V’BB30 1E2GVB 2 T_2S<B72 WS#4<BB0 0%’<;BB2 ]FG_B 2
T
_2S<B72 WS#4<B 2 >;C+^812’BB0 1E2GVB 2 UE3 VB72 WN:JDB30 1_ :[B32 0ZPXDB 2 UE3
VB72 WN:JDB 2 >_R\#B30 1E2GVB 2 T_4B>B72 WS”WLBB0 0%’<;BB2 ]FF@B 2 T_4B>B72
WS
“WLB 2 >;D$2812IBB0 1E2GVB 2 XHH$RB72 N8D]PB30 1_ :[B32 0”2.<B 2 XHH$RB72
N8D]P
Main Index
CHAPTER 18 1895
Support Files

B 2 &<“WBB30 1E2GVB 2 X06&OB72 ND.U/BB0 0%’<;BB2 01(@TB 2 X06&OB72 ND.U/B 2


&’Y
W781+4GCEN/63BB0 1E2GVB 2 V4_H!B72 VH;S@B31 33O?MB33 196YEB 2 V4_H!B72 VH;S@B
2
>#.![B30 1E2GVB 2 W9FQ B72 U[Z[6B30 “ZN&B33 2@Z&OB 2 W9FQ B72 U[Z[6B 2 ?M[‘
8
12.BB0 1E2GVB 2 U&*\+B72 WC2[&B31 33O?MB33 17;)]B 2 U&*\+B72 WC2[&B 2 ?H%O.B30
1E2GVB 2 V>2O*B72 V:;$=B30 “ZN&B33 2>FU B 2 V>2O*B72 V:;$=B 2 ?@W;F8134BB0
1E2
GVB 2 VO9,OB72 UN$]KB31 33O?MB33 1AR40B 2 VO9,OB72 UN$]KB 2 >E2-RB30 1E2GVB 2
W
SU[.B72 U0JS7B30 “ZN&B33 2[[&!B 2 WSU[.B72 U0JS7B 2 ><&588132BB0 1E2GVB 2
VOC/
^B72 UN$0TB31 33O?MB33 1AR !B 2 VOC/^B72 UN$0TB 2 >E4F#B30 1E2GVB 2 WSSS B72
U0
KGHB30 “ZN&B33 2[[@RB 2 WSSS B72 U0KGHB 2 ><#-F812’BB0 1E2GVB 2 U&%&QB72 WC2
[
B31 33O?MB33 17;/]B 2 U&%&QB72 WC2 [B 2 ?H, XB30 1E2GVB 2 V> [1B72 V::P$B30
“Z
N&B33 2>F$FB 2 V> [1B72 V::P$B 2 ?@VOM81+EGCEN/63BB0 1E2GVB 2 V<>_:B72
UK!U>B30
0”I;’B32 [CV3B 2 V<>_:B72 UK!U>B 2 >/(IZB30 1E2GVB 2 VOL*KB72 UT?] BB1
2T&,7B
B3 0>62EB 2 VOL*KB72 UT?] B 2 >J(F-8134BB0 1E2GVB 2 V@W_!B72 UC!SDB30 0”I;’B32
[HQ!B 2 V@W_!B72 UC!SDB 2 >X51DB30 1E2GVB 2 VQ_4HB72 UL]PNBB1 2T&,7BB3 0>G 9B
2 VQ_4HB72 UL]PNB 2 >F3<F813SBB0 1E2GVB 2 V;FHGB72 US@&3B30 0”I;’B32 [7Y/B 2
V
;FHGB72 US@&3B 2 >’DU6B30 1E2GVB 2 VL*LYB72 U/:,EBB1 2T&,7BB3 0<^8BB 2
VL*LYB72
U/:,EB 2 >OCYX813QBB0 1E2GVB 2 V;C_”B72 US!XUB30 0”I;’B32 [7$0B 2 V;C_”B72
US
!XUB 2 >’C6BB30 1E2GVB 2 VL”L-B72 U/:S-BB1 2T&,7BB3 0<^6]B 2 VL”L-B72 U/:S-B 2
>OD9H8132BB0 1E2GVB 2 V@U)(B72 UC[C)B30 0”I;’B32 [HSMB 2 V@U)(B72 UC[C)B 2
>X3
‘&B30 1E2GVB 2 VQ\4MB72 UL]5GBB1 2T&,7BB3 0>F_!B 2 VQ\4MB72 UL]5GB 2
>F4QV81+OG
CEN/63BB0 1E2GVB 2 VZN[&B72 UYTJ^BB1 3J_P%BB3 1IV<2B 2 VZN[&B72 UYTJ^B 2
>XB=OB
30 1E2GVB 2 V’:[,B72 UVDLVB30 0 Z6)B33 4MVZ@B 2 V’:[,B72 UVDLVB 2 >$@1Y813SBB0
1E2GVB 2 VZV=”B72 UY5G’BB1 3J_P%BB3 1IWQRB 2 VZV=”B72 UY5G’B 2 >W_”;B30 1E2GVB
2 V’_++B72 UU;@,B30 0 Z6)B33 4MW_’B 2 V’_++B72 UU;@,B 2 >$)=(813:BB0 1E2GVB 2
V
ZF&\B72 UY<U.BB1 3J_P%BB3 1IVGAB 2 VZF&\B72 UY<U.B 2 >XPQYB30 1E2GVB 2
V’.?^B72
UV+$1B30 0 Z6)B33 4MU7?B 2 V’.?^B72 UV+$1B 2 >/6#J813,BB0 1E2GVB 2 VZG9:B72
UY
<MVBB1 3J_P%BB3 1IVF+B 2 VZG9:B72 UY<MVB 2 >XP-_B30 1E2GVB 2 V’.F”B72 UV+&SB30
0 Z6)B33 4MUA6B 2 V’.F”B72 UV+&SB 2 >/6NT813QBB0 1E2GVB 2 VZW3$B72 UY59DBB1
3J_
P%BB3 1IWP?B 2 VZW3$B72 UY59DB 2 >W_^DB30 1E2GVB 2 V’^\NB72 UU:6CB30 0 Z6)B33
4
MX ;B 2 V’^\NB72 UU:6CB 2 >$)J,81+YGCEN/63BB0 1E2GVB 2 V##&(B72 R#?9[BB0
1)3XHB
B2 0TO)ZB 2 V##&(B72 R#?9[B 2 :JU*#B30 1E2GVB 2 VUWE+B72 R<MZVB _.YNB32
4S7)
TB 2 VUWE+B72 R<MZVB 2 :8!)A812IBB0 1E2GVB 2 XHIGOB72 N89F@BB0 1)3XHBB2 0YO<XB
2 XHIGOB72 N89F@B 2 &<=K1B30 1E2GVB 2 X06U%B72 ND#[OB _.YNB32 4”’U]B 2
X06U%
B72 ND#[OB 2 &’/2Y812’BB0 1E2GVB 2 UE6RIB72 WN-J”BB0 1)3XHBB2 0O?F<B 2
UE6RIB72
WN-J”B 2 >_JZKB30 1E2GVB 2 T_0]FB72 WS[!:B _.YNB32 4BMQ6B 2 T_0]FB72
WS[!:B
2 >;L.5812(BB0 1E2GVB 2 UEDJ-B72 WN/3BBB0 1)3XHBB2 0O?9RB 2 UEDJ-B72 WN/3BB 2
>_NT)B30 1E2GVB 2 T^!\RB72 WS_DLB _.YNB32 4BM,7B 2 T^!\RB72 WS_DLB 2
>;H%G81
2GBB0 1E2GVB 2 XHP9TB72 N86\+BB0 1)3XHBB2 0YO*)^81UF^B 2 XHP9TB72 N86\+B 2
&<#%
(B30 1E2GVB 2 X0 XDB72 ND,D!B _.YNB32 4”’^MB 2 X0 XDB72 ND,D!B 2
&’W$S81+.GC
EN/63BB0 1E2GVB 2 V51R8B72 VH+,GB30 0J91MB32 =-:UB 2 V51R8B72 VH+,GB 2
>#/W3B3
0 1E2GVB 2 W9BCHB72 U[%$”B30 +PV=B33 2D&GSB 2 W9BCHB72 U[%$”B 2 ?N1>S812’BB0
Main Index 1
1896
Code Examples

E2GVB 2 U&<=4B72 WB:X@B30 0J91MB32 =D0@B 2 U&<=4B72 WB:X@B 2 ?H’REB30 1E2GVB


2
V<]CHB72 V<1H+B30 +PV=B33 2B>U+B 2 V<]CHB72 V<1H+B 2 ?@+TL8132BB0 1E2GVB 2
VO
H5YB72 UNN#[B30 0J91MB32 .372B 2 VOH5YB72 UNN#[B 2 >D_(YB30 1E2GVB 2 WSN&EB72
U0W\-B30 +PV=B33 2F”UIB 2 WSN&EB72 U0W\-B 2 ><>O?8130BB0 1E2GVB 2 VODB^B72
UNP
2-B30 0J91MB32 .38@B 2 VODB^B72 UNP2-B 2 >D]L1B30 1E2GVB 2 WSRA,B72 U0V?6B30
+PV=B33 2F”N1B 2 WSRA,B72 U0V?6B 2 ><@P1812(BB0 1E2GVB 2 U&&&UB72 WB<;6B30
0J91
MB32 =D2’B 2 U&&&UB72 WB<;6B 2 ?H(D’B30 1E2GVB 2 V<\/:B72 V<0A:B30 +PV=B33
2B
>NXB 2 V<\/:B72 V<0A:B 2 ?@(QW81+>GCEN/63BB0 1E2GVB 2 V<[]@B72 UK*BKBB0 0
4\RBB
3 4J^7<B 2 V<[]@B72 UK*BKB 2 >/XC4B30 1E2GVB 2 VOHQPB72 UU4WPB30 1GKPUB32
0C=Z$
B 2 VOHQPB72 UU4WPB 2 >J#M68132BB0 1E2GVB 2 V@YO3B72 UC”DFBB0 0 4\RBB3 4KO’*B
2
V@YO3B72 UC”DFB 2 >W^-HB30 1E2GVB 2 VQ[D B72 UM7YTB30 1GKPUB32 0C,1!B 2 VQ[D
B
72 UM7YTB 2 >FB&N813QBB0 1E2GVB 2 V;G<<B72 US*1IBB0 0 4\RBB3 4JV;6B 2 V;G<<B72
US*1IB 2 >’4#JB30 1E2GVB 2 VL’V0B72 U+0!5B30 1GKPUB32 0C/4<B 2 VL’V0B72 U+0!5B
2 >OKW9813OBB0 1E2GVB 2 V;JU_B72 US.9QBB0 0 4\RBB3 4JV).B 2 V;JU_B72 US.9QB 2
>
‘6H)B30 1E2GVB 2 VL(-;B72 U+1V<B30 1GKPUB32 0C/6NB 2 VL(-;B72 U+1V<B 2
>OJR+813
0BB0 1E2GVB 2 V@/0RB72 UC*LMBB0 0 4\RBB3 4KOXDB 2 V@/0RB72 UC*LMB 2 >W\9-B30
1E
2GVB 2 VQ@MXB72 UM89DB30 1GKPUB32 0C,3QB 2 VQ@MXB72 UM89DB 2 >FA.:81-
0GCEN/63BB
0 1E2GVB 2 VZS41B72 UYG@EB30 [V2!B33 3]@<5B 2 VZS41B72 UYG@EB 2 >X4$!B30
1E2GV
B 2 V’%&YB72 UVP[9BB0 00141BB3 4O\F/B 2 V’%&YB72 UVP[9B 2 >/ FU813QBB0 1E2GVB
2
VZ$L0B72 UX@W:B30 [V2!B33 3][4*B 2 VZ$L0B72 UX@W:B 2 >W>&GB30 1E2GVB 2
V’@#AB
72 UV0’?BB0 00141BB3 4P .;B 2 V’@#AB72 UV0’?B 2 >$%R&813,BB0 1E2GVB 2 VZKJ4B72
UY)5CB30 [V2!B33 3]?Z,B 2 VZKJ4B72 UY)5CB 2 >XI’QB30 1E2GVB 2 V’-\IB72
UV;RKBB
0 00141BB3 4O^<RB 2 V’-\IB72 UV;RKB 2 >/DZ!813%BB0 1E2GVB 2 VZJ;&B72 UY)GOB30
[V2!B33 3]?/NB 2 VZJ;&B72 UY)GOB 2 >XIOXB30 1E2GVB 2 V’(;]B72 UV;9RBB0
00141BB3
4O^,TB 2 V’(;]B72 UV;9RB 2 >/E1*813OBB0 1E2GVB 2 VZZ<*B72 UX@’WB30 [V2!B33
3]
[6JB 2 VZZ<*B72 UX@’WB 2 >W>VNB30 1E2GVB 2 V’!$;B72 UV0O\BB0 00141BB3 4P )#B 2
V’!$;B72 UV0O\B 2 >$%^Z81-AGCEN/63BB0 1E2GVB 2 V#,?:B72 R#%M,BB0 06RS)BB2
+)3O
B 2 V#,?:B72 R#%M,B 2 :JR.1B30 1E2GVB 2 VUQ-UB72 R<UO[B 09_\OB31 (“*2B 2
VUQ
-UB72 R<UO[B 2 :8]L^812GBB0 1E2GVB 2 XHLJ/B72 N8BA:BB0 06RS)BB2 (#T@B 2
XHLJ/B
72 N8BA:B 2 &<#’=B30 1E2GVB 2 X02OVB72 ND%\BB 09_\OB31 ‘^=3B 2 X02OVB72
ND%\
BB 2 &’YBG812(BB0 1E2GVB 2 UEF!%B72 WNL”.BB0 06RS)BB3 4@$I_B 2 UEF!%B72 WNL”.B
2 >_CG[B30 1E2GVB 2 T^@B.B72 WTA38B 09_\OB31 +”L.B 2 T^@B.B72 WTA38B 2
>;RW-
812+BB0 1E2GVB 2 UEGRIB72 WNL$GBB0 06RS)BB3 4@$G[B 2 UEGRIB72 WNL$GB 2
>_C$HB30
1E2GVB 2 T^,>TB72 WTB:OB 09_\OB31 +”N!B 2 T^,>TB72 WTB:OB 2 >;OU!812EBB0
1E
2GVB 2 XHL<7B72 N8B )BB0 06RS)BB2 (#T-B 2 XHL<7B72 N8B )B 2 &<% YB30 1E2GVB 2
X _3GB72 ND,”=B 09_\OB31 ‘^*&B 2 X _3GB72 ND,”=B 2 &’U””81-KGCEN/63BB0
1E2GV
B 2 V56LZB72 VHOI)BB1 1_RD;BB3 0$02.B 2 V56LZB72 VHOI)B 2 >#TA/B30 1E2GVB 2
W96
).B72 U[\M?B30 1]N7MB32 0X;\UB 2 W96).B72 U[\M?B 2 ?N9&5812(BB0 1E2GVB 2
U&!QFB
72 WB$<ZBB1 1_RD;BB3 0Z3R,B 2 U&!QFB72 WB$<ZB 2 ?HV\AB30 1E2GVB 2 V<?#”B72
V<E=
[B30 1]N7MB32 0W!I2B 2 V<?#”B72 V<E=[B 2 ?@#6B8130BB0 1E2GVB 2 VOJ’CB72 UNB-
$BB
1 1_RD;BB3 0$_;HB 2 VOJ’CB72 UNB-$B 2 >D<P2B30 1E2GVB 2 WSKJ^B72 U0”RAB30
Main Index 1]N7M
CHAPTER 18 1897
Support Files

B32 0Y#;CB 2 WSKJ^B72 U0”RAB 2 ><\?H812\BB0 1E2GVB 2 VOJG7B72 UNB#%BB1


1_RD;BB3
0$_;#B 2 VOJG7B72 UNB#%B 2 >D<A8B30 1E2GVB 2 WSLYBB72 U0”2/B30 1]N7MB32
0Y#&^B
2 WSLYBB72 U0”2/B 2 >> /U812+BB0 1E2GVB 2 U&!0[B72 WB$_0BB1 1_RD;BB3 0Z3SCB 2
U&!0[B72 WB$_0B 2 ?HV%%B30 1E2GVB 2 V<@__B72 V<EH<B30 1]N7MB32 0W!G:B 2
V<@__B7
2 V<EH<B 2 ?@#&O81-UGCEN/63BB0 1E2GVB 2 V>0(_B72 UKT.PBB0 012ISBB3 4UN/ B 2
V>0
(_B72 UKT.PB 2 >/O@6B30 1E2GVB 2 VOCSGB72 UUKT8B30 0/Y”<B32 <;<@B 2 VOCSGB72
U
UKT8B 2 >J@%68130BB0 1E2GVB 2 V@->\B72 UCX7,BB0 012ISBB3 4U:;]B 2 V@->\B72
UCX7
,B 2 >W>AWB30 1E2GVB 2 VQ<7PB72 UMLY1B30 0/Y”<B32 <@S B 2 VQ<7PB72 UMLY1B 2
>F
JQ8813OBB0 1E2GVB 2 V;O31B72 USQ”3BB0 012ISBB3 4T[V]B 2 V;O31B72 USQ”3B 2
>)]IK
B30 1E2GVB 2 VLZ]YB72 U+JJ&B30 0/Y”<B32 <#GUB 2 VLZ]YB72 U+JJ&B 2
>OU.:813MBB0
1E2GVB 2 V;PSRB72 USQH#BB0 012ISBB3 4T[Q;B 2 V;PSRB72 USQH#B 2 >)^7_B30
1E2GVB
2 VLZ#-B72 U+JNVB30 0/Y”<B32 <#G$B 2 VLZ#-B72 U+JNVB 2 >OU+>812\BB0 1E2GVB 2
V@)GOB72 UCW’ BB0 012ISBB3 4U:”;B 2 V@)GOB72 UCW’ B 2 >W>\’B30 1E2GVB 2
VQ:^EB7
2 UML/#B30 0/Y”<B32 <@S5B 2 VQ:^EB72 UML/#B 2 >FJI=81-(GCEN/63BB0 1E2GVB 2
VZX
%MB72 UY0<YB31 05Z99B34 4><81B 2 VZX%MB72 UY0<YB 2 >W]*AB30 1E2GVB 2 V’=/GB72
U
V’LRBB1 0 );:BB4 4N1/\B 2 V’=/GB72 UV’LRB 2 >/8>!813OBB0 1E2GVB 2 VZ’E0B72
UX+)
!B31 05Z99B34 4>>%3B 2 VZ’E0B72 UX+)!B 2 >W.X+B30 1E2GVB 2 V’;4KB72 UVI,[BB1 0
);:BB4 4N2]]B 2 V’;4KB72 UVI,[B 2 >$]7”813%BB0 1E2GVB 2 VZO@-B72 UYRA>B31
05Z99
B34 4>;X>B 2 VZO@-B72 UYRA>B 2 >XA=JB30 1E2GVB 2 V’ZTCB72 UW25MBB1 0 );:BB4
4N0
I9B 2 V’ZTCB72 UW25MB 2 >/MEE813”BB0 1E2GVB 2 VZPJSB72 UYR1[B31 05Z99B34
4>;W5B
2 VZPJSB72 UYR1[B 2 >XA[CB30 1E2GVB 2 V’$5RB72 UW1@=BB1 0 );:BB4 4N0F:B 2
V’$5
RB72 UW1@=B 2 >/M+4813MBB0 1E2GVB 2 VZ’(<B72 UX+W_B31 05Z99B34 4>>”UB 2
VZ’(<B7
2 UX+W_B 2 >W.%WB30 1E2GVB 2 V’;=;B72 UVI+GBB1 0 );:BB4 4N2!.B 2 V’;=;B72
UVI+G
B 2 >$]U581-,GCEN/63BB0 1E2GVB 2 V#&J\B72 R#’0 B30 2V-R7B32 0]=G@B 2 V#&J\B72
R
#’0 B 2 :JK]@B30 1E2GVB 2 VUNP<B72 R<+A+B30 1Q/TAB32 0L-17B 2 VUNP<B72 R<+A+B
2
:9 5>812EBB0 1E2GVB 2 XHORHB72 N86Q5B30 2V-R7B32 12H=\B 2 XHORHB72 N86Q5B 2
&<
“)7B30 1E2GVB 2 X !,(B72 ND!KOB30 1Q/TAB32 0QD”TB 2 X !,(B72 ND!KOB 2
&’XBB812+
BB0 1E2GVB 2 UELL*B72 WN9]^B30 2V-R7B32 0<*4DB 2 UELL*B72 WN9]^B 2 >_6+;B30
1E2
GVB 2 T^””*B72 WTL3_B30 1Q/TAB32 0HS**B 2 T^””*B72 WTL3_B 2 >;T4T812$BB0
1E2GVB
2 UEADRB72 WND+(B30 2V-R7B32 0<*H!B 2 UEADRB72 WND+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 2
V’V8,B72
UWH@OB 2 >/W33813.BB0 1E2GVB 2 VZV;BB72 UYA@XBB0 0Q=*TBB2 #:*ZB 2 VZV;BB72
UY
A@XB 2 >X2’.B30 1E2GVB 2 V’US:B72 UWI6YB30 1MK^\B32 0FVQGB 2 V’US:B72 UWI6YB 2
>/V)”813KBB0 1E2GVB 2 VZ%R8B72 UXOVABB0 0Q=*TBB2 #<7GB 2 VZ%R8B72 UXOVAB 2
>W/
“VB30 1E2GVB 2 V’”YVB72 UVXN”B30 1MK^\B32 0FW3DB 2 V’”YVB72 UVXN”B 2
>/3*/81(QG
CEN/63BB0 1E2GVB 2 V#./UB72 R#*HMB30 0*PYGB32 ^H- B 2 V#./UB72 R#*HMB 2 :JJX
B
30 1E2GVB 2 VUPW.B72 R<$(GBB0 3TW?IBB2 1UV^0B 2 VUPW.B72 R<$(GB 2 :9 )-812CBB0
1E2GVB 2 XHHE:B72 N86”DB30 0*PYGB32 0 XL>B 2 XHHE:B72 N86”DB 2 &<(LIB30 1E2GVB
2 X ] OB72 ND\6+BB0 3TW?IBB2 1+\OEB 2 X ] OB72 ND\6+B 2 &’+75812$BB0 1E2GVB 2
U
EBN]B72 WNI=VB30 0*PYGB32 !L#KB 2 UEBN]B72 WNI=VB 2 >_5”BB30 1E2GVB 2
T^:NKB72
WTCM’BB0 3TW?IBB2 1M<.TB 2 T^:NKB72 WTCM’B 2 >;QG9812YBB0 1E2GVB 2 UE7^@B72
WN
J;0B30 0*PYGB32 !L&NB 2 UE7^@B72 WNJ;0B 2 >_3&0B30 1E2GVB 2 T^@2%B72 WTB9BBB0
3TW?IBB2 1M<+(B 2 T^@2%B72 WTB9BB 2 >;SK&812ABB0 1E2GVB 2 XHD;&B72 N87>UB30
0*P
YGB32 0 XOPB 2 XHD;&B72 N87>UB 2 &<+9EB30 1E2GVB 2 X \’:B72 ND^!7BB0 3TW?IBB2
1
+\H6B 2 X \’:B72 ND^!7B 2 &’(V581($GCEN/63BB0 1E2GVB 2 V5A(UB72 VHE#*BB2
46$P8B
B4 1.#\%B 2 V5A(UB72 VHE#*B 2 >#O(1B30 1E2GVB 2 W92ZSB72 U]62-B30 0J]7-B32
=Y!
TB 2 W92ZSB72 U]62-B 2 ?NC:I812$BB0 1E2GVB 2 U&]+JB72 WBVZIBB2 46$P8BB4 1=7($B
2 U&]+JB72 WBVZIB 2 ?HTF:B30 1E2GVB 2 V<?MPB72 V<F>QB30 0J]7-B32 =8T-B 2
V<?MP
B72 V<F>QB 2 ?@#”P812^BB0 1E2GVB 2 VOOVOB72 UM\LSBB2 46$P8BB4 1”QM!B 2
VOOVOB72
UM\LSB 2 >D”B6B30 1E2GVB 2 WSG YB72 U0]V?B30 0J]7-B32 =_:DB 2 WSG YB72
U0]V?B
2 >>6E9812[BB0 1E2GVB 2 VOP)!B72 UM_^7BB2 46$P8BB4 1”QK’B 2 VOP)!B72 UM_^7B 2
>D”>KB30 1E2GVB 2 WSD&EB72 U0^E3B30 0J]7-B32 =_<FB 2 WSD&EB72 U0^E3B 2
>>4[*81
2YBB0 1E2GVB 2 U&^&$B72 WBVA*BB2 46$P8BB4 1=7+QB 2 U&^&$B72 WBVA*B 2 ?HT]2B30
1
E2GVB 2 V<<86B72 V<G+6B30 0J]7-B32 =8U-B 2 V<<86B72 V<G+6B 2
Main Index ?@”SS81(“GCEN/63B
CHAPTER 18 1899
Support Files

B0 1E2GVB 2 V>573B72 UKIS’B31 \T+-B34 4G.2$B 2 V>573B72 UKIS’B 2 >/J82B30


1E2G
VB 2 VO9XFB72 UUV!XBB1 1FUZ:BB3 0CEP^B 2 VO9XFB72 UUV!XB 2 >K05V812^BB0 1E2GVB
2 V@”G%B72 UCJJPB31 \T+-B34 4H8B]B 2 V@”G%B72 UCJJPB 2 >W#!’B30 1E2GVB 2
VQ&9L
B72 UMYT,BB1 1FUZ:BB3 0CK?”B 2 VQ&9LB72 UMYT,B 2 >FR5?813KBB0 1E2GVB 2
V;T1AB72
USHF/B31 \T+-B34 4GF[2B 2 V;T1AB72 USHF/B 2 >)?T^B30 1E2GVB 2 VLW;?B72 U+T=-
B
B1 1FUZ:BB3 0C7\7B 2 VLW;?B72 U+T=-B 2 >O$_’813IBB0 1E2GVB 2 V;R_NB72 USH/]B31
\T+-B34 4GF_&B 2 V;R_NB72 USH/]B 2 >)>?CB30 1E2GVB 2 VLX@QB72 U+TLGBB1
1FUZ:BB
3 0C7_EB 2 VLX@QB72 U+TLGB 2 >O/$P812[BB0 1E2GVB 2 V@*C^B72 UCJ’WB31 \T+-B34
4
H8F%B 2 V@*C^B72 UCJ’WB 2 >W#HRB30 1E2GVB 2 VQ,D@B72 UMY7RBB1 1FUZ:BB3 0CK>>B
2
VQ,D@B72 UMY7RB 2 >FR”681(@GCEN/63BB0 1E2GVB 2 VZ+@]B72 UX:ZVBB0 /??BBB3
2E7*
6B 2 VZ+@]B72 UX:ZVB 2 >W<+#B30 1E2GVB 2 V’-^,B72 UV>?>B30 >O)’B33 3/*L<B 2
V’
-^,B72 UV>?>B 2 >/GUA813KBB0 1E2GVB 2 VZ”C4B72 UXTWIBB0 /??BBB3 2E8W2B 2
VZ”C4
B72 UXTWIB 2 >W(6UB30 1E2GVB 2 V’%$@B72 UVS_MB30 >O)’B33 3/”/BB 2 V’%$@B72
UVS
_MB 2 >/1=^813.BB0 1E2GVB 2 VZU!:B72 UYB:?BB0 /??BBB3 2E6]#B 2 VZU!:B72
UYB:?B
2 >X2.CB30 1E2GVB 2 V’VV8B72 UWG”(B30 >O)’B33 3/.60B 2 V’VV8B72 UWG”(B 2
>/VM
M813’BB0 1E2GVB 2 VZV+XB72 UYB/\BB0 /??BBB3 2E6[AB 2 VZV+XB72 UYB/\B 2
>X35XB3
0 1E2GVB 2 V’VLSB72 UWG,MB30 >O)’B33 3/.6UB 2 V’VLSB72 UWG,MB 2 >/VGP813IBB0
1
E2GVB 2 VZ”@2B72 UXTHOBB0 /??BBB3 2E8UTB 2 VZ”@2B72 UXTHOB 2 >W(XJB30 1E2GVB
2
V’%QSB72 UVT15B30 >O)’B33 3/”/#B 2 V’%QSB72 UVT15B 2 >/1$V81)2GCEN/63BB0
1E2G
VB 2 V#”)MB72 R#*HMBB0 25]/OBB2 0*Q%=B 2 V#”)MB72 R#*HMB 2 :JLLEB30 1E2GVB 2
VU
QN<B72 R<$-WBB0 4QHJ$BB2 20K)TB 2 VUQN<B72 R<$-WB 2 :90PI812ABB0 1E2GVB 2
XHD(+
B72 N86’UBB0 25]/OBB2 0;HEYB 2 XHD(+B72 N86’UB 2 &</0DB30 1E2GVB 2 X \’:B72
ND\
(@BB0 4QHJ$BB2 2A/[@B 2 X \’:B72 ND\(@B 2 &’)!\812YBB0 1E2GVB 2 UE6K/B72
WNM\QB
B0 25]/OBB2 0(8L9B 2 UE6K/B72 WNM\QB 2 >_5AQB30 1E2GVB 2 T^!AIB72 WT9Z>BB0
4QHJ
$BB2 1?2P<B 2 T^!AIB72 WT9Z>B 2 >;R@T812WBB0 1E2GVB 2 UEF’7B72 WNJ@\BB0
25]/OBB
2 0(8A^B 2 UEF’7B72 WNJ@\B 2 >_AUAB30 1E2GVB 2 T^>3MB72 WTA$’BB0 4QHJ$BB2
1?2V%
B 2 T^>3MB72 WTA$’B 2 >;Q8*8128BB0 1E2GVB 2 XHM\8B72 N83$IBB0 25]/OBB2 0;H23B
2
XHM\8B72 N83$IB 2 &<=0’B30 1E2GVB 2 X ]/OB72 NE ‘SBB0 4QHJ$BB2 2A+29B 2 X
]/OB
72 NE ‘SB 2 &’-]K81)CGCEN/63BB0 1E2GVB 2 V585JB72 VHJ&$B30 0X%=”B32 ;OH3B 2
V5
85JB72 VHJ&$B 2 >#Q&7B30 1E2GVB 2 W943ZB72 U]1”^BB0 2^”#-BB2 146;MB 2 W943ZB72
U]1”^B 2 ?NAQ;812YBB0 1E2GVB 2 U&^%4B72 WBX:/B30 0X%=”B32 ,@,)B 2 U&^%4B72
WBX
:/B 2 ?HWD4B30 1E2GVB 2 V<:(;B72 V<FXZBB0 2^”#-BB2 12?<$B 2 V<:(;B72 V<FXZB 2
?
@*7W812[BB0 1E2GVB 2 VOOU)B72 UN44&B30 0X%=”B32 ;@J9B 2 VOOU)B72 UN44&B 2
>D;7
0B30 1E2GVB 2 WSFC7B72 U0<MUBB0 2^”#-BB2 15NMZB 2 WSFC7B72 U0<MUB 2
>>0IB812@BB
0 1E2GVB 2 VOJQYB72 UN5#JB30 0X%=”B32 ;@L_B 2 VOJQYB72 UN5#JB 2 >D%8HB30
1E2GV
B 2 WSJV3B72 U0;^KBB0 2^”#-BB2 15NGYB 2 WSJV3B72 U0;^KB 2 >>2>5812WBB0 1E2GVB
2
U&?=EB72 WBZV7B30 0X%=”B32 ,@<NB 2 U&?=EB72 WBZV7B 2 ?HTKIB30 1E2GVB 2
V<@[\B
72 V<E7PBB0 2^”#-BB2 12?#;B 2 V<@[\B72 V<E7PB 2 ?@#/T81)MGCEN/63BB0 1E2GVB 2
V>
Main Index
1900
Code Examples

38PB72 UKN]/BB0 @UAEBB3 3%;?RB 2 V>38PB72 UKN]/B 2 >/M6&B30 1E2GVB 2 VOBE1B72


UUQ5 B30 0B-7&B32 -^+SB 2 VOBE1B72 UUQ5 B 2 >J^Z 812[BB0 1E2GVB 2 V@’SNB72
UCQ
JBBB0 @UAEBB3 3&DOJB 2 V@’SNB72 UCQJBB 2 >W,/2B30 1E2GVB 2 VQ<E6B72 UMQ”KB30
0
B-7&B32 (01+B 2 VQ<E6B72 UMQ”KB 2 >FO =813IBB0 1E2GVB 2 V;P@0B72 USMC\BB0
@UA
EBB3 3%QW?B 2 V;P@0B72 USMC\B 2 >)!0IB30 1E2GVB 2 VL$3 B72 U+OW4B30 0B-7&B32
-
!A)B 2 VL$3 B72 U+OW4B 2 >OZIN813GBB0 1E2GVB 2 V;R<[B72 USL$ BB0 @UAEBB3
3%QQ(
B 2 V;R<[B72 USL$ B 2 >)[9JB30 1E2GVB 2 VLXD^B72 U+PR’B30 0B-7&B32 -!B?B 2
VLX
D^B72 U+PR’B 2 >OX($812@BB0 1E2GVB 2 V@.PYB72 UCP’DBB0 @UAEBB3 3&DI4B 2
V@.PYB
72 UCP’DB 2 >W;#YB30 1E2GVB 2 VQ,P;B72 UMR)]B30 0B-7&B32 (02:B 2 VQ,P;B72
UMR)
]B 2 >FMKP81)WGCEN/63BB0 1E2GVB 2 VZ/A)B72 UX[ SB30 %YX B33 36]YTB 2 VZ/A)B72
UX[ SB 2 >W@&PB30 1E2GVB 2 V’):0B72 UV&L^BB0 0(#’NBB2 ?F>^B 2 V’):0B72 UV&L^B
2 >/DL0813IBB0 1E2GVB 2 VZ*)3B72 UXX-IB30 %YX B33 36^$8B 2 VZ*)3B72 UXX-IB 2
>
W=9=B30 1E2GVB 2 V’&”)B72 UVOT%BB0 0(#’NBB2 ?G5,B 2 V’&”)B72 UVOT%B 2
>$\:’813
‘BB0 1E2GVB 2 VZT’5B72 UYI3UB30 %YX B33 36[UOB 2 VZT’5B72 UYI3UB 2 >X6^@B30
1E
2GVB 2 V’XF(B72 UWAQ;BB0 0(#’NBB2 ?F(TB 2 V’XF(B72 UWAQ;B 2 >/RTW813(BB0
1E2GV
B 2 VZS.GB72 UYIN/B30 %YX B33 36[X5B 2 VZS.GB72 UYIN/B 2 >X6Q-B30 1E2GVB 2
V’X
[6B72 UWAC)BB0 0(#’NBB2 ?F(4B 2 V’X[6B72 UWAC)B 2 >/R><813GBB0 1E2GVB 2
VZ.=DB
72 UXX[‘B30 %YX B33 36^+”B 2 VZ.=DB72 UXX[‘B 2 >W’/[B30 1E2GVB 2 V’,P7B72
UVOF
+BB0 0(#’NBB2 ?G5PB 2 V’,P7B72 UVOF+B 2 >/ E 81)’GCEN/63BB0 1E2GVB 2 V#,”8B72
R#*=RBB0 1/U(MBB2 0RP%CB 2 V#,”8B72 R#*=RB 2 :JPIYB30 1E2GVB 2 VURE_B72
R<YXPBB
0 2]%0&BB2 1B.\TB 2 VURE_B72 R<YXPB 2 :9 N”8128BB0 1E2GVB 2 XHL5RB72 N84? BB0
1
/U(MBB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B 2 WSLQ”B72
U
0*I!BB0 2\;9SBB2 16TY2B 2 WSLQ”B72 U0*I!B 2 ><\?H812UBB0 1E2GVB 2 U&@O=B72
WB+6
1BB0 “2*1BB3 2>GP@B 2 U&@O=B72 WB+61B 2 ?HWB/B30 1E2GVB 2 V<@&JB72 V<D:&BB0
2\
;9SBB2 13^/3B 2 V<@&JB72 V<D:&B 2 ?@#D-81)\GCEN/63BB0 1E2GVB 2 V>0%QB72
UKT?$BB
2 0NS7:BB4 “2-XB 2 V>0%QB72 UKT?$B 2 >/P70B30 1E2GVB 2 VOC%NB72 UUK04BB0
?9N2
BB3 3=D?7B 2 VOC%NB72 UUK04B 2 >J@()812@BB0 1E2GVB 2 V@(:;B72 UCW”TBB2
0NS7:BB4
Main Index
CHAPTER 18 1901
Support Files

“6X?B 2 V@(:;B72 UCW”TB 2 >W>=IB30 1E2GVB 2 VQ>1XB72 UMKTUBB0 ?9N2BB3 3=-


1<B
2 VQ>1XB72 UMKTUB 2 >FJHC813GBB0 1E2GVB 2 V;O;TB72 USQ_*BB2 0NS7:BB4 *\*,B 2
V;O;TB72 USQ_*B 2 >)^9SB30 1E2GVB 2 VL$XYB72 U+JD4BB0 ?9N2BB3 3’:*QB 2
VL$XYB7
2 U+JD4B 2 >OV98813EBB0 1E2GVB 2 V;O’WB72 USR ^BB2 0NS7:BB4 *\*<B 2 V;O’WB72
U
SR ^B 2 >)^4\B30 1E2GVB 2 VLZV\B72 U+JX]BB0 ?9N2BB3 3’:%/B 2 VLZV\B72 U+JX]B
2
>OUYO812>BB0 1E2GVB 2 V@(=?B72 UCW&SBB2 0NS7:BB4 “6X]B 2 V@(=?B72 UCW&SB 2
>W
>+:B30 1E2GVB 2 VQ<0.B72 UMK,LBB0 ?9N2BB3 3=-50B 2 VQ<0.B72 UMK,LB 2
>FI’S81’8
GCEN/63BB0 1E2GVB 2 VZY”CB72 UY0FYB32 0J7WUB34 =,[ B 2 VZY”CB72 UY0FYB 2
>W^21
B30 1E2GVB 2 V’=..B72 UV=1OBB0 032U(BB3 4)2D3B 2 V’=..B72 UV=1OB 2
>/9Y7813GBB0
1E2GVB 2 VZ=UUB72 UX+*(B32 0J7WUB34 =;5*B 2 VZ=UUB72 UX+*(B 2 >W*.6B30
1E2GVB
2 V’;? B72 UVI-#BB0 032U(BB3 4)3(.B 2 V’;? B72 UVI-#B 2 >$](W813(BB0 1E2GVB 2
VZQ”LB72 UYPX3B32 0J7WUB34 =,*[B 2 VZQ”LB72 UYPX3B 2 >XA<“B30 1E2GVB 2
V’Z,3B7
2 UW3MZBB0 032U(BB3 4)0%UB 2 V’Z,3B72 UW3MZB 2 >/N+9813+BB0 1E2GVB 2 VZP^QB72
U
YP,CB32 0J7WUB34 =,”HB 2 VZP^QB72 UYP,CB 2 >XAPQB30 1E2GVB 2 V’ZYQB72
UW3R1BB0
032U(BB3 4)0&QB 2 V’ZYQB72 UW3R1B 2 >/NR*813EBB0 1E2GVB 2 VZ’*JB72 UX+\1B32
0J
7WU^81UF^B34 =;64B 2 VZ’*JB72 UX+\1B 2 >W*EJB30 1E2GVB 2 V’;(5B72 UVI._BB0
032
U(BB3 4)3)(B 2 V’;(5B72 UVI._B 2 >$]V$81’IGCEN/63BB0 1E2GVB 2 V#,(AB72
R#,FVBB0
0B*9ZBB2 )$V2B 2 V#,(AB72 R#,FVB 2 :JT3^B30 1E2GVB 2 VUT.[B72 R<SKIBB0
0O*:[B
B2 %^A4B 2 VUT.[B72 R<SKIB 2 :8^J28126BB0 1E2GVB 2 XHN-7B72 N87:FBB0 0B*9ZBB2
=:>:B 2 XHN-7B72 N87:FB 2 &<#2SB30 1E2GVB 2 X00+VB72 ND;!]BB0 0O*:[BB2 ;+2!B
2 X00+VB72 ND;!]B 2 &’Y[^812UBB0 1E2GVB 2 UEE_QB72 WNSERBB0 0B*9ZBB2 -X]:B 2
U
EE_QB72 WNSERB 2 >_H9<B30 1E2GVB 2 T^@]OB72 WT5M8BB0 0O*:[BB2 “Y+.B 2
T^@]OB72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72 UKZL0B32
11%E:B
34 04ZE;B 2 V<\-KB72 UKZL0B 2 >/R^,B30 1E2GVB 2 VOEF#B72 UUE->BB0 1P\[NBB2
0H>4
,B 2 VOEF#B72 UUE->B 2 >J<J$812>BB0 1E2GVB 2 V@-LSB72 UC/28B32 11%E&B34 04)1SB
2 V@-LSB72 UC/28B 2 >W!3IB30 1E2GVB 2 VQ>EBB72 UMG]”BB0 1P\[NBB2 0H_0-B 2
VQ>EB
B72 UMG]”B 2 >FGP!813EBB0 1E2GVB 2 V;M+(B72 USXP”B32 11%E&B34 04TS+B 2
V;M+(B72
USXP”B 2 >’ &[B30 1E2GVB 2 VL/,0B72 U+CUQBB0 1P\[NBB2 0H#A/B 2 VL/,0B72
U+CUQB
Main Index
1902
Code Examples

2 >OQQ(813CBB0 1E2GVB 2 V;L!]B72 USX(-B32 11%E&B34 04TT7B 2 V;L!]B72 USX(-B 2


>’ N5B30 1E2GVB 2 VL+HIB72 U+CK BB0 1P\[NBB2 0H#AAB 2 VL+HIB72 U+CK B 2
>OQ.X81
2:BB0 1E2GVB 2 V@+(#B72 UC/GIB32 11%E:B34 04)1_B 2 V@+(#B72 UC/GIB 2 >W@)^B30
1
E2GVB 2 VQ>*UB72 UMG%ZBB0 1P\[NBB2 0H_0BB 2 VQ>*UB72 UMG%ZB 2
>FG=,81’%GCEN/63B
B0 1E2GVB 2 VZW1LB72 UY6FFBB1 24.:8BB3 0(I-:B 2 VZW1LB72 UY6FFB 2 >W\>KB30
1E2G
VB 2 V’*I&B72 UV/3ABB1 4”[:*BB3 22”(“B 2 V’*I&B72 UV/3AB 2 >/5,D813EBB0 1E2GVB
2 VZ(X\B72 UX*Q2BB1 24.:8BB3 0(J2)B 2 VZ(X\B72 UX*Q2B 2 >W%@GB30 1E2GVB 2
V’>1$
B72 UVB+UBB1 4”[:*BB3 22#R%B 2 V’>1$B72 UVB+UB 2 >$?VH813+BB0 1E2GVB 2
VZOE9B72
UYU<ZBB1 24.:8BB3 0(ICGB 2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9BB0 0Z@0@BB2 < L)B 2 VQ<?5B72 UMI@9B 2
>
FH%L813CBB0 1E2GVB 2 V;MH2B72 USX1@BB1 4S8ZPBB3 1@U!)B 2 V;MH2B72 USX1@B 2 >’
9
=B30 1E2GVB 2 VL/[CB72 U+C?%BB0 0Z@0@BB2 :>L,B 2 VL/[CB72 U+C?%B 2
>OQ@S813ABB
Main Index
CHAPTER 18 1903
Support Files

0 1E2GVB 2 V;M)-B72 USW!=BB1 4S8ZPBB3 1@U! B 2 V;M)-B72 USW!=B 2 >’ O$B30


1E2GV
B 2 VL/,#B72 U+C[“BB0 0Z@0@BB2 :>L?B 2 VL/,#B72 U+C[“B 2 >OQ;\812,BB0 1E2GVB
2
V@-.YB72 UCZ$GBB1 4S8ZPBB3 1@_:>B 2 V@-.YB72 UCZ$GB 2 >W@7=B30 1E2GVB 2
VQ<“9B
72 UMI]8BB0 0Z@0@BB2 < L”B 2 VQ<“9B72 UMI]8B 2 >FH=?81=OGCEN/63BB0 1E2GVB 2
VZ
VM?B72 UY5\6B31 0H^.%B33 =B2JB 2 VZVM?B72 UY5\6B 2 >W\2AB30 1E2GVB 2 V’..2B72
UV/(RBB0 02G-8BB3 4$!I+B 2 V’..2B72 UV/(RB 2 >/5%*813CBB0 1E2GVB 2 VZ-[VB72
UX*
89B31 0H^.%B33 =BDYB 2 VZ-[VB72 UX*89B 2 >W%5/B30 1E2GVB 2 V’<C’B72 UVCJ[BB0
0
2G-8BB3 4$[%OB 2 V’<C’B72 UVCJ[B 2 >$?PJ813$BB0 1E2GVB 2 VZN+’B72 UYUYBB31
0H^.
%B33 =A>*B 2 VZN+’B72 UYUYBB 2 >XCU2B30 1E2GVB 2 V’$X#B72 UV\<UBB0 02G-8BB3
4$
?;+B 2 V’$X#B72 UV\<UB 2 >/KLX813YBB0 1E2GVB 2 VZM;GB72 UYU;KB31 0H^.%B33
=A?6
B 2 VZM;GB72 UYU;KB 2 >XB\#B30 1E2GVB 2 V’$BPB72 UV\^]BB0 02G-8BB3 4$?:[B 2
V’$
BPB72 UV\^]B 2 >/K87813ABB0 1E2GVB 2 VZ-75B72 UX*PIB31 0H^.%B33 =BD!B 2 VZ-
75B
72 UX*PIB 2 >W#-,B30 1E2GVB 2 V’:<$B72 UVCRNBB0 02G-8BB3 4$[&+B 2 V’:<$B72
UVCR
NB 2 >$?B!81=YGCEN/63BB0 1E2GVB 2 V#%-HB72 R#;(!BB1 05$LABB3 +AS.B 2 V#%-HB72
R#;(!B 2 :JSU=B30 1E2GVB 2 VUU]9B72 R<P_,B31 1C 7/B33 0DU^?B 2 VUU]9B72 R<P_,B
2 :8]O[8122BB0 1E2GVB 2 XHK]0B72 N8A71BB1 05$LABB3 (FHAB 2 XHK]0B72 N8A71B 2
&
<“U=B30 1E2GVB 2 X03YGB72 ND”<5B31 1C 7/B33 0H)].B 2 X03YGB72 ND”<5B 2
&’XUZ812
QBB0 1E2GVB 2 UEC&LB72 WNT +BB1 05$LABB4 4:0(HB 2 UEC&LB72 WNT +B 2 >_F^MB30
1E
2GVB 2 T^[GKB72 WT58”B31 1C 7/B33 09*-’B 2 T^[GKB72 WT58”B 2 >;O^*812OBB0
1E2GV
B 2 UECJYB72 WNTA2BB1 05$LABB4 4:0’8B 2 UECJYB72 WNTA2B 2 >_F=_B30 1E2GVB 2
T^[
K,B72 WT56VB31 1C 7/B33 09*-+B 2 T^[K,B72 WT56VB 2 >;P .8120BB0 1E2GVB 2
XHKT^B
72 N8AG*BB1 05$LABB3 (FHOB 2 XHKT^B72 N8AG*B 2 &<“9:B30 1E2GVB 2 X03+”B72
ND”;
+B31 1C 7/B33 0H)]+B 2 X03+”B72 ND”;+B 2 &’XXY81=.GCEN/63BB0 1E2GVB 2 V56-RB72
VHSCFBB1 3?(X!BB3 1$:$HB 2 V56-RB72 VHSCFB 2 >#W:YB30 1E2GVB 2 W98AZB72
U[]3HB3
1 (ISCB34 2N=Q5B 2 W98AZB72 U[]3HB 2 ?N8E#812QBB0 1E2GVB 2 U&@(KB72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\6-B30 1E2GVB 2 VL/91B72
U
+FH\BB1 2^##QBB3 16T#PB 2 VL/91B72 U+FH\B 2 >OSH>812%BB0 1E2GVB 2 V@-”&B72
UCY[
Main Index
1904
Code Examples

XBB1 3KUETBB3 1I,<^B 2 V@-”&B72 UCY[XB 2 >W?+!B30 1E2GVB 2 VQ<W B72 UMK1[BB1
2^
##QBB3 16:PXB 2 VQ<W B72 UMK1[B 2 >FIRY81.0GCEN/63BB0 1E2GVB 2 VZU^3B72
UY64;BB
1 0^LGKBB3 01#;4B 2 VZU^3B72 UY64;B 2 >W_&&B30 1E2GVB 2 V’.H_B72 UV/\1B31
029[M
B34 4$L’AB 2 V’.H_B72 UV/\1B 2 >/5.F813ABB0 1E2GVB 2 VZ-<HB72 UX=LQBB1
0^LGKBB3
01%5)B 2 VZ-<HB72 UX=LQB 2 >W”U&B30 1E2GVB 2 V’: ]B72 UVE>LB31 029[MB34 4$N
>B
2 V’: ]B72 UVE>LB 2 >$@W<813YBB0 1E2GVB 2 VZMDGB72 UYW&EBB1 0^LGKBB3 01#WPB 2
VZMDGB72 UYW&EB 2 >XD9GB30 1E2GVB 2 V’$%)B72 UV_0VB31 029[MB34 4$KJZB 2
V’$%)B7
2 UV_0VB 2 >/J 6813WBB0 1E2GVB 2 VZM3$B72 UYW:DBB1 0^LGKBB3 01#WTB 2 VZM3$B72
U
YW:DB 2 >XD3IB30 1E2GVB 2 V’$Z\B72 UV_4EB31 029[MB34 4$KKVB 2 V’$Z\B72 UV_4EB
2
>/I?)8138BB0 1E2GVB 2 VZ-.LB72 UX=OPBB1 0^LGKBB3 01%5%B 2 VZ-.LB72 UX=OPB 2
>W
“O;B30 1E2GVB 2 V’;,XB72 UVE[:B31 029[MB34 4$N0WB 2 V’;,XB72 UVE[:B 2
>$@PO81.A
GCEN/63BB0 1E2GVB 2 .N@<JB 1 ,,[ZHBB1 0_.#XBB3 0’-4LB 2 .N@<JB 1 ,,[ZHB 2
‘16(P
B30 1E2GVB73 8KC’)B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?81#%GCEN/63BB0 1E2GVB 2 .N!CPB 1
,,”T!B
30 <&’DB32 *XO5B 2 .N!CPB 1 ,,”T!B 2 ‘17VYB30 1E2GVB73 8KC>^B71 J!J-OBB0
2.FW
IB70 :(C_”B71 J!J-OB73 8KC>^B 3 8D-@98182BB0 1E2GVB 2 (TAS)B 1 /?G@PB30
<&’DB3
2 %&ONB 2 (TAS)B 1 /?G@PB 2 +)[H!B30 1E2GVB73 7RK7LB 1 7Q55LBB0 2.FWIB70
:(C^F
B 1 7Q55LB73 7RK7LB 3 7U1[K8180BB0 1E2GVB 2 (TA=YB 1 /?OBZB30 <&’DB32 %&P0B
2
(TA=YB 1 /?OBZB 2 +)[DRB30 1E2GVB73 7RKCBB 1 7P”M,BB0 2.FWIB70 :(C^FB 1
7P”M,B
73 7RKCBB 3 7U1?*817(BB0 1E2GVB 2 %U1L1B 2 5X4E+B30 <&’DB32 ‘Z6LB 2 %U1L1B 2
5X4E+B 2 *Z3(:B30 1E2GVB73 9F=5YB71 ,$4#UBB0 2.FWIB70 :(D0*B71 ,$4#UB73 9F=5YB
3 9 ;$S817’BB0 1E2GVB 2 %U1JXB 2 5X3UMB30 <&’DB32 ‘Z5+B 2 %U1JXB 2 5X3UMB 2
*
Z3!_B30 1E2GVB73 9F=42B71 ,Z.+EBB0 2.FWIB70 :(D0*B71 ,Z.+EB73 9F=42B 3 9
;’181#
[GCEN/63BB0 1E2GVB 3 56#-UB 2 W/!^*BB0 0OW5LBB2 0*”,QB 3 56#-UB 2 W/!^*B 2
:5AE
Main Index
1910
Code Examples

IB30 1E2GVB73 A#_Z.B72 L2!H5B30 1C$[\B 0 :(DF-B72 L2!H5B73 A#_Z.B 3


9:F21817(BB
0 1E2GVB 2 !6ZB/B 2 V$$G7BB0 0OW5LBB2 0>”OWB 2 !6ZB/B 2 V$$G7B 2 &S86CB30
1E2GV
B73 9=O#\B72 HW-0$B30 1C$[\B 0 :(DC(B72 HW-0$B73 9=O#\B 3 8@U<\817)BB0 1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=O<]B72 HWYUNBB0 4!#+<B70 :(C-OB72 HWYUNB73
9
=O<]B 3 8@V6C817#BB0 1E2GVB 2 !6$E(B 2 V$Z*>B31 /P’UB33 ,N”<B 2 !6$E(B 2
V$Z*
>B 2 &S8[MB30 1E2GVB73 9=P5^B72 HW(9/BB0 4!#+<B70 :(C-OB72 HW(9/B73 9=P5^B 3
8@
V9M817NBB0 1E2GVB 3 5R/)”B 2 X’.M<B31 /P’UB33 =1]AB 3 5R/)”B 2 X’.M<B 2
>?=C,
B30 1E2GVB73 B@9G9B72 O&7TSBB0 4!#+<B70 :(C%KB72 O&7TSB73 B@9G9B 3
A;G,P817LBB0
1E2GVB 3 5R/+$B 2 X’)R5B31 /P’UB33 =1?XB 3 5R/+$B 2 X’)R5B 2 >?’’WB30
1E2GVB
73 B@9F2B72 O&1%NBB0 4!#+<B70 :(C%KB72 O&1%NB73 B@9F2B 3 A;G_181%YGCEN/63BB0
1E
2GVB 3 56#ZCB 2 W/!\CBB0 1B$5%BB2 1.!!SB 3 56#ZCB 2 W/!\CB 2 :59.1B30 1E2GVB73
Main Index
CHAPTER 18 1911
Support Files

A#_$4B72 L2! DB30 2V3O@B 0 :(D2CB72 L2! DB73 A#_$4B 3 9:F38817#BB0 1E2GVB 2
!6Y
.IB 2 V$ZCKBB0 1B$5%BB2 1]1.DB 2 !6Y.IB 2 V$ZCKB 2 &S7(PB30 1E2GVB73 9=O,^B72
H
W/KYB30 2V3O@B 0 :(D EB72 HW/KYB73 9=O,^B 3 8@U^.817&BB0 1E2GVB 2 !6Y#HB 2
V$Z^
%BB0 1B$5%BB2 1]1&UB 2 !6Y#HB 2 V$Z^%B 2 &S7”MB30 1E2GVB73 9=O&5B72 HW+.TB30
2V
3O@B 0 :(D EB72 HW+.TB73 9=O&5B 3 8@U?>817PBB0 1E2GVB 3 5R/)MB 2 X’.]MBB0
1B$5%
BB2 1WAS]B 3 5R/)MB 2 X’.]MB 2 >?=C,B30 1E2GVB73 B@9J8B72 O&6_P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R/-7B 2 X’*ROB30 03%Y^B32 0D<ZEB 3 5R/-7B 2 X’*ROB 2 >?’[!B30 1E2GVB73
B
@9L B72 O&7\_BB0 0;]NWB70 :(DK5B72 O&7\_B73 B@9L B 3 A;G>J817TBB0 1E2GVB 3
5R/Y
<B 2 X’=KXB30 03%Y^B32 0D<VTB 3 5R/Y<B 2 X’=KXB 2 >?’F.B30 1E2GVB73 B@9DAB72
O&
40!BB0 0;]NWB70 :(DK5B72 O&40!B73 B@9DAB 3 A;G>=81&AGCEN/63BB0 1E2GVB 3 56#.8B
2 W/]FPB30 ^PY6B32 0A_”8B 3 56#.8B 2 W/]FPB 2 :5A] B30 1E2GVB73 A#_#;B72
L2[=-
B7 -A*1B70 :(C(?B72 L2[=-B73 A#_#;B 3 9:FB9817?BB0 1E2GVB 2 !6$]LB 2
V$$*]B30
^PY6B32 0H8X?B 2 !6$]LB 2 V$$*]B 2 &S9/ZB30 1E2GVB73 9=P0[B72 HW+Q^B7 -
A*1B
Main Index
1912
Code Examples

70 :(C$PB72 HW+Q^B73 9=P0[B 3 8@V83817!BB0 1E2GVB 2 !6/E*B 2 V$/+ZB30 ^PY6B32


0H8Z,B 2 !6/E*B 2 V$/+ZB 2 &S9@]B30 1E2GVB73 9=P7(B72 HW)’4B7 -A*1B70
:(C$PB7
2 HW)’4B73 9=P7(B 3 8@V7V817XBB0 1E2GVB 3 5R/=/B 2 X’*@SB30 ^PY6B32 05PWQB 3
5
R/=/B 2 X’*@SB 2 >?=X)B30 1E2GVB73 B@9P5B72 O&9CSB7 -A*1B70 :(C=>B72
O&9CSB73
B@9P5B 3 A;G?-817VBB0 1E2GVB 3 5R/=&B 2 X’._/B30 ^PY6B32 05PUBB 3 5R/=&B 2
X’
._/B 2 >?=WAB30 1E2GVB73 B@9PTB72 O&5<@B7 -A*1B70 :(C=>B72 O&5<@B73 B@9PTB 3
A;G\@81&KGCEN/63BB0 1E2GVB 3 56#\CB 2 W/[>:B30 0V<<[B32 0>;&ZB 3 56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PBMB72 HW-/5B7 :Z0.B70
:(CE3B72
HW-/5B73 9=PBMB 3 8@VF.817/BB0 1E2GVB 3 5R/\2B 2 X’./#B30 2T>K&B32 2\V@NB 3
5R
/\2B 2 X’./#B 2 >?*]8B30 1E2GVB73 B@9’+B72 O&7!%B7 :Z0.B70 :(CP_B72 O&7!%B73
B@9’+B 3 A;HBM817ZBB0 1E2GVB 3 5R/];B 2 X’’*,B30 2T>K&B32 2\V=LB 3 5R/];B 2
X’’
*,B 2 >?*WJB30 1E2GVB73 B@9+WB72 O&3I*B7 :Z0.B70 :(CP_B72 O&3I*B73 B@9+WB 3
A
;HH881&(GCEN/63BB0 1E2GVB 3 56#@RB 2 W/!U!B30 1[7(>B32 2+V+2B 3 56#@RB 2
W/!U!B
2 :5CQNB30 1E2GVB73 A#_@BB72 L2@Y9B7 > F4B70 :(CIXB72 L2@Y9B73 A#_@BB 3
9:FO
817_BB0 1E2GVB 2 !6+5>B 2 V$YF\B30 1[7(>B32 2!IY6B 2 !6+5>B 2 V$YF\B 2
&SAOEB3
0 1E2GVB73 9=P3AB72 HWZ4#B7 > F4B70 :(CCZB72 HWZ4#B73 9=P3AB 3 8@VH#818 BB0
1
E2GVB 2 !6++(B 2 V$$6SB30 1[7(>B32 2!I#2B 2 !6++(B 2 V$$6SB 2 &SA^ B30
1E2GVB73
9=PCIB72 HW(C$B7 > F4B70 :(CCZB72 HW(C$B73 9=PCIB 3 8@VF8817-BB0 1E2GVB 3
5R
/_>B 2 X’.]MB30 1[7(>B32 2LYFRB 3 5R/_>B 2 X’.]MB 2 >?*!(B30 1E2GVB73 B@9)>B72
O&8WVB7 > F4B70 :(COUB72 O&8WVB73 B@9)>B 3 A;H9V817/BB0 1E2GVB 3 5R/]RB 2
X’’
>”B30 1[7(>B32 2LY2_B 3 5R/]RB 2 X’’>”B 2 >?*U:B30 1E2GVB73 B@9/OB72 O&2?9B7
> F4B70 :(COUB72 O&2?9B73 B@9/OB 3 A;HH881&,GCEN/63BB0 1E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B30 1E2GVB73 9=O.;B72 HWZJ)B7 *9*2B70 :(CP_B72 HWZJ)B73
9
=O.;B 3 8@U]C817>BB0 1E2GVB 2 !6$G7B 2 V$+OUB30 1.3$MB32 2+VUVB 2 !6$G7B 2
V$+O
UB 2 &S97%B30 1E2GVB73 9=O^(B72 HW’1YB7 *9*2B70 :(CP_B72 HW’1YB73 9=O^(B 3
8@
U]%817UBB0 1E2GVB 3 5R/+]B 2 X’”_ B30 1.3$MB32 25Q!GB 3 5R/+]B 2 X’”_ B 2
>?’^P
Main Index
1914
Code Examples

B30 1E2GVB73 B@9EIB72 O&9:=B7 *9*2B70 :(C$PB72 O&9:=B73 B@9EIB 3


A;G=@817WBB0
1E2GVB 3 5R/W\B 2 X’’+LB30 1.3$MB32 25QYLB 3 5R/W\B 2 X’’+LB 2 >?’ JB30
1E2GVB
73 B@9A]B72 O&2&BB7 *9*2B70 :(C$PB72 O&2&BB73 B@9A]B 3 A;G>?81,$GCEN/63BB0
1E
2GVB 3 56#TEB 2 W/[J3B30 2,*)NB32 3.XLNB 3 56#TEB 2 W/[J3B 2 :58[>B30 1E2GVB73
A#_RVB72 L2!BWB7 \7)8B70 :(C6+B72 L2!BWB73 A#_RVB 3 9:E[O817>BB0 1E2GVB 2
!6X
@8B 2 V$$Y0B30 2,*)NB32 450V+B 2 !6X@8B 2 V$$Y0B 2 &S738B30 1E2GVB73 9=O)SB72
H
W/U\B7 \7)8B70 :(C 9B72 HW/U\B73 9=O)SB 3 8@U;O817:BB0 1E2GVB 2 !6X8SB 2
V$Z3
OB30 2,*)NB32 450M#B 2 !6X8SB 2 V$Z3OB 2 &S6K^B30 1E2GVB73 9=O/[B72 HW+”.B7
\
7)8B70 :(C 9B72 HW+”.B73 9=O/[B 3 8@U.’817SBB0 1E2GVB 3 5R/ZPB 2 X’.6SB30
2,*)N
B32 3MRNHB 3 5R/ZPB 2 X’.6SB 2 >?’N9B30 1E2GVB73 B@9E’B72 O&7NUB7 \7)8B70
:(C
E3B72 O&7NUB73 B@9E’B 3 A;G&T817UBB0 1E2GVB 3 5R/-=B 2 X’*#WB30 2,*)NB32
3MRWJB
3 5R/-=B 2 X’*#WB 2 >?=0?B30 1E2GVB73 B@9D[B72 O&5)DB7 \7)8B70 :(CE3B72
O&5)
DB73 B@9D[B 3 A;G:G81,”GCEN/63BB0 1E2GVB 3 56#Z0B 2 W/!ZNB30 4E8]<B31 (S.CB 3
56#Z0B 2 W/!ZNB 2 :59-ZB30 1E2GVB73 A#_XHB72 L2@F9B7 ],M7B70 :(C9$B72
L2@F9B7
3 A#_XHB 3 9:F21817:BB0 1E2GVB 2 !6X\5B 2 V$XEQB30 4E8]<B31 =:8:B 2 !6X\5B 2
V
$XEQB 2 &S6[CB30 1E2GVB73 9=O+UB72 HWXJ7B7 ],M7B70 :(C28B72 HWXJ7B73 9=O+UB
3
8@U!*817,BB0 1E2GVB 2 !6ZB/B 2 V$/1JB30 4E8]<B31 =:DPB 2 !6ZB/B 2 V$/1JB 2
&S
89BB30 1E2GVB73 9=O<NB72 HW)5^B7 ],M7B70 :(C28B72 HW)5^B73 9=O<NB 3
8@U>”817Q
BB0 1E2GVB 3 5R/.LB 2 X’”FYB30 4E8]<B31 /QJ+B 3 5R/.LB 2 X’”FYB 2 >?=)6B30
1E2
GVB73 B@9L#B72 O&9””B7 ],M7B70 :(CH1B72 O&9””B73 B@9L#B 3 A;G,_817SBB0
1E2GVB
3 5R/-VB 2 X’’ +B30 4E8]<B31 /QF7B 3 5R/-VB 2 X’’ +B 2 >?’:^B30 1E2GVB73
B@9H
)B72 O&1MIB7 ],M7B70 :(CH1B72 O&1MIB73 B@9H)B 3 A;H0#81,@GCEN/63BB0 1E2GVB 3
56#”ZB 2 W/!]DB ):IRB31 ;\OBB 3 56#”ZB 2 W/!]DB 2 :5B9!B30 1E2GVB73
A#_#;B7
2 L2@&3B7 0B[“7B70 :(B;EB72 L2@&3B73 A#_#;B 3 9:FF3817,BB0 1E2GVB 2 !6$J6B 2
V
$Y:UB ):IRB31 @H#CB 2 !6$J6B 2 V$Y:UB 2 &S8[MB30 1E2GVB73 9=O]9B72 HWZ8<B7
0B[“7B70 :(B’IB72 HWZ8<B73 9=O]9B 3 8@V9[817%BB0 1E2GVB 2 !6$J6B 2 V$$6SB
)
:IRB31 @H,5B 2 !6$J6B 2 V$$6SB 2 &S90JB30 1E2GVB73 9=O^(B72 HW(G’B7 0B[“7B70
:(B’IB72 HW(G’B73 9=O^(B 3 8@V >817OBB0 1E2GVB 3 5R/?KB 2 X’*LRB ):IRB31
%5
]$B 3 5R/?KB 2 X’*LRB 2 >?*4 B30 1E2GVB73 B@9-FB72 O&9H’B7 0B[“7B70 :(B[=B72
O
&9H’B73 B@9-FB 3 A;H5/817QBB0 1E2GVB 3 5R/<TB 2 X’=#MB ):IRB31 %5!PB 3
5R/<
TB 2 X’=#MB 2 >?.#8B30 1E2GVB73 B@9V3B72 O&2_>B7 0B[“7B70 :(B[=B72 O&2_>B73
B@
9V3B 3 A;HA;81;2GCEN/63BB0 1E2GVB 3 56#;DB 2 W/!_SB30 4:M%:B31 *BEGB 3 56#;DB
2 W/!_SB 2 :5B,8B30 1E2GVB73 A#_?;B72 L2!$<B7 0C3\FB70 :(B&#B72 L2!$<B73
A#_?;
B 3 9:FL$817%BB0 1E2GVB 2 !6/.WB 2 V$X]7B30 4:M%:B31 %]C<B 2 !6/.WB 2 V$X]7B
2
&SA1?B30 1E2GVB73 9=P8NB72 HWY>DB7 0C3\FB70 :(B’IB72 HWY>DB73 9=P8NB 3
8@VNK8
17”BB0 1E2GVB 2 !6+@WB 2 V$/!BB30 4:M%:B31 %]IFB 2 !6+@WB 2 V$/!BB 2 &SBJ<B30
1E2GVB73 9=PN<B72 HW=OLB7 0C3\FB70 :(B’IB72 HW=OLB73 9=PN<B 3 8@VJ+817MBB0
1E2
GVB 3 5R/:!B 2 X’”LWB30 4:M%:B31 ),.]B 3 5R/:!B 2 X’”LWB 2 >?.;+B30 1E2GVB73
B
@9WYB72 O&A?#B7 0C3\FB70 :(B[=B72 O&A?#B73 B@9WYB 3 A;G]X817OBB0 1E2GVB 3
5R/#
WB 2 X’)@9B30 4:M%:B31 ),-%B 3 5R/#WB 2 X’)@9B 2 >?=@ B30 1E2GVB73 B@9Q/B72
O&
Main Index
CHAPTER 18 1915
Support Files

1Y^B7 0C3\FB70 :(B[=B72 O&1Y^B73 B@9Q/B 3 A;H9J81;CGCEN/63BB0 1E2GVB 3 56#]+B


2 W/!%2B30 26-?$B32 2<_ZGB 3 56#]+B 2 W/!%2B 2 :5C<CB30 1E2GVB73 A#\ :B72
L2!3=
B7 06UL<B70 :(B[=B72 L2!3=B73 A#\ :B 3 9:FUL817”BB0 1E2GVB 2 !6-GMB 2
V$Z*6B30
26-?$B32 3A0^2B 2 !6-GMB 2 V$Z*6B 2 &SBS&B30 1E2GVB73 9=PFGB72 HWZ\VB7
06UL<B
70 :(B&#B72 HWZ\VB73 9=PFGB 3 8@VR\817.BB0 1E2GVB 2 !6+:2B 2 V$ZM%B30 26-?$B32
3A0^\B 2 !6+:2B 2 V$ZM%B 2 &SB3SB30 1E2GVB73 9=PH=B72 HW(U4B7 06UL<B70
:(B&#B7
2 HW(U4B73 9=PH=B 3 8@VJ\817KBB0 1E2GVB 3 5R/_6B 2 X’=]HB30 26-?$B32 2Z?+IB 3
5
R/_6B 2 X’=]HB 2 >?*%.B30 1E2GVB73 B@9%ZB72 O&8:-B7 06UL<B70 :(C28B72 O&8:-
B73
B@9%ZB 3 A;HFH817MBB0 1E2GVB 3 5R+05B 2 X’.J?B30 26-?$B32 2Z?/(B 3 5R+05B 2
X’
.J?B 2 >?”A1B30 1E2GVB73 B@9*DB72 O&3Z>B7 06UL<B70 :(C28B72 O&3Z>B73 B@9*DB 3
A;HNH81;MGCEN/63BB0 1E2GVB 3 56#%\B 2 W/@:RB30 19I 8B32 1’4::B 3 56#%\B 2
W/@:R
B 2 :5BO;B30 1E2GVB73 A#_&UB72 L2@N”B7 %D=$B70 :(CRTB72 L2@N”B73 A#_&UB 3
9:F
HU817.BB0 1E2GVB 2 !6$TYB 2 V$XF!B30 19I 8B32 1?_<?B 2 !6$TYB 2 V$XF!B 2
&S8_KB
30 1E2GVB73 9=O]9B72 HWYL;B7 %D=$B70 :(CLVB72 HWYL;B73 9=O]9B 3 8@VBP817’BB0
1E2GVB 2 !6$\KB 2 V$ZV.B30 19I 8B32 1?\2GB 2 !6$\KB 2 V$ZV.B 2 &S9$4B30
1E2GVB7
3 9=P3LB72 HW(Q”B7 %D=$B70 :(CLVB72 HW(Q”B73 9=P3LB 3 8@V60817IBB0 1E2GVB 3
5
R/!ZB 2 X’.’_B30 19I 8B32 1TY*RB 3 5R/!ZB 2 X’.’_B 2 >?*I!B30 1E2GVB73
B@9/0B72
O&921B7 %D=$B70 :(CV]B72 O&921B73 B@9/0B 3 A;H3”817KBB0 1E2GVB 3 5R/>_B 2
X’
‘72B30 19I 8B32 1TYY1B 3 5R/>_B 2 X’’72B 2 >?.>/B30 1E2GVB73 B@9WAB72 O&2C=B7
%D=$B70 :(CV]B72 O&2C=B73 B@9WAB 3 A;HD+81;WGCEN/63BB0 1E2GVB 3 56#O^B 2
W/@9_
B31 (“39B33 ,-X@B 3 56#O^B 2 W/@9_B 2 :58E9B30 1E2GVB73 A#_O*B72 L2>]LBB0
3;C
?MB70 :(C>HB72 L2>]LB73 A#_O*B 3 9:E^R817’BB0 1E2GVB 2 !6Y+KB 2 V$XD’B31
(“39B
33 >;,YB 2 !6Y+KB 2 V$XD’B 2 &S7Q\B30 1E2GVB73 9=O=KB72 HWY7HBB0 3;C?MB70
:(C&
;B72 HWY7HB73 9=O=KB 3 8@U^W817(BB0 1E2GVB 2 !6ZM0B 2 V$ZXBB31 (“39B33 >;<_B
2 !6ZM0B 2 V$ZXBB 2 &S8C9B30 1E2GVB73 9=O:SB72 HW+#RBB0 3;C?MB70 :(C&;B72
HW+#R
B73 9=O:SB 3 8@U]C817GBB0 1E2GVB 3 5R/LFB 2 X’=NWB31 (“39B33 “<V5B 3 5R/LFB
2
X’=NWB 2 >?(S^B30 1E2GVB73 B@94+B72 O&6KRBB0 3;C?MB70 :(C!GB72 O&6KRB73
B@94+B
3 A;G)<817IBB0 1E2GVB 3 5R/H9B 2 X’(%-B31 (“39B33 “<R?B 3 5R/H9B 2 X’(%-B 2
>?-:”B30 1E2GVB73 B@9 OB72 O&1C+BB0 3;C?MB70 :(C!GB72 O&1C+B73 B@9 OB 3
A;G#281
;’GCEN/63BB0 1E2GVB 3 7/A#@B 3 9+7MKBB0 0K0H”B70 :(C-OB 3 9+7MKB 3 7/A#@B 3
8#*
0#B30 1E2GVB73 E/$LVB73 75:#1B30 1\!W&B 0 :(D EB73 75:#1B73 E/$LVB 3
CW0F+817GB
B0 1E2GVB 3 7>BT9B 3 9=”S%BB0 0K0H”B70 :(CY[B 3 9=”S%B 3 7>BT9B 3 8!BGOB30
1E2G
VB73 D+HC B73 6%]’?B30 1\!W&B 0 :(C^FB73 6%]’?B73 D+HC B 3 B)X\Z817HBB0 1E2GVB
3 7>B/YB 3 9=”<“BB0 0K0H”B70 :(CY[B 3 9=”<“B 3 7>B/YB 3 8!BZ0B30 1E2GVB73
D+HK]
B73 6%^5VB30 1\!W&B 0 :(C^FB73 6%^5VB73 D+HK]B 3 B)Y7W816!BB0 1E2GVB 3 7J61\B
3
9W9<<BB0 0K0H”B70 :(C*LB 3 9W9<<B 3 7J61\B 3 8/@O*B30 1E2GVB73 F(:+QB73
7S1NOB
30 1\!W&B 0 :(D3.B73 7S1NOB73 F(:+QB 3 DQ4 \816@BB0 1E2GVB 3 7J5<WB 3 9W9M]BB0
0K0H”B70 :(C*LB 3 9W9M]B 3 7J5<WB 3 8/@08B30 1E2GVB73 F(:$[B73 7S0[KB30 1\!W&B
0 :(D3.B73 7S0[KB73 F(:$[B 3 DQ3\781;:GCEN/63BB0 1E2GVB 3 7/A:AB 3 9+7L/BB1
2YO
^8B70 :(DK5B 3 9+7L/B 3 7/A:AB 3 8#*1’B30 1E2GVB73 E/$P_B73 75:’[BB0 4W[.<B70
:
(CXQB73 75:’[B73 E/$P_B 3 CW0J*817HBB0 1E2GVB 3 7>B*YB 3 9=”]?BB1 2YO^8B70
:(DH
Main Index
1916
Code Examples

6B 3 9=”]?B 3 7>B*YB 3 8!B’5B30 1E2GVB73 D+HS%B73 6%][WBB0 4W[.<B70 :(CP_B73


6%
][WB73 D+HS%B 3 B)YDT817JBB0 1E2GVB 3 7>BYZB 3 9=”MRBB1 2YO^8B70 :(DH6B 3
9=”MR
B 3 7>BYZB 3 8!BELB30 1E2GVB73 D+HJ;B73 6%]%5BB0 4W[.<B70 :(CP_B73 6%]%5B73
D+H
J;B 3 B)Y5(816]BB0 1E2GVB 3 7J5<8B 3 9W9D,BB1 2YO^8B70 :(DL$B 3 9W9D,B 3
7J5<8B
3 8/?[ B30 1E2GVB73 F(:-!B73 7S1 YBB0 4W[.<B70 :(C/@B73 7S1 YB73 F(:-!B 3
DQ40
M816!BB0 1E2GVB 3 7J64/B 3 9W9]-BB1 2YO^8B70 :(DL$B 3 9W9]-B 3 7J64/B 3
8/@T0B3
0 1E2GVB73 F(:’8B73 7S19EBB0 4W[.<B70 :(C/@B73 7S19EB73 F(:’8B 3
DQ42/81;\GCEN/
63BB0 1E2GVB 3 7/A.MB 3 9+7A2BB0 0649WB70 :(C&;B 3 9+7A2B 3 7/A.MB 3 8#.?+B30
1
E2GVB73 E/$G)B73 75:Y”B30 /F/:B 0 :(DRYB73 75:Y”B73 E/$G)B 3 CW0BW817JBB0
1E2G
VB 3 7>B/YB 3 9=”NABB0 0649WB70 :(C*LB 3 9=”NAB 3 7>B/YB 3 8!BF:B30 1E2GVB73
D+
HNYB73 6%])0B30 /F/:B 0 :(DRYB73 6%])0B73 D+HNYB 3 B)Y8-817LBB0 1E2GVB 3
7>B’^
B 3 9=”);BB0 0649WB70 :(C*LB 3 9=”);B 3 7>B’^B 3 8!BT+B30 1E2GVB73 D+HWUB73
6%]
!/B30 /F/:B 0 :(DRYB73 6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A$!B 3 9+7A_BB0 30WUTB70 :(A%AB 3 9+7A_B 3 7/A$!B 3 8#.<ZB30
1E2GVB73
E/$4MB73 75:U;B30 2SUT5B 0 :(C!GB73 75:U;B73 E/$4MB 3 CW00*817NBB0 1E2GVB 3
7>
BIMB 3 9=”J(BB0 30WUTB70 :(AUIB 3 9=”J(B 3 7>BIMB 3 8!B74B30 1E2GVB73 D+H6PB73
6%]UCB30 2SUT5B 0 :(C>HB73 6%]UCB73 D+H6PB 3 B)X!*817PBB0 1E2GVB 3 7>BQBB 3
9=”
(7BB0 30WUTB70 :(AUIB 3 9=”(7B 3 7>BQBB 3 8!BMXB30 1E2GVB73 D+HBFB73 6%]@5B30
2
SUT5B 0 :(C>HB73 6%]@5B73 D+HBFB 3 B)X\Z8171BB0 1E2GVB 3 7J5<WB 3 9W9-VBB0
30WU
TB70 :(B0ZB 3 9W9-VB 3 7J5<WB 3 8/@B7B30 1E2GVB73 F(:DSB73 7S14%B30 2SUT5B 0
:(
C_”B73 7S14%B73 F(:DSB 3 DQ3’0817 BB0 1E2GVB 3 7J5=SB 3 9W9E”BB0 30WUTB70
:(B0Z
B 3 9W9E”B 3 7J5=SB 3 8/??OB30 1E2GVB73 F(:AUB73 7S0+&B30 2SUT5B 0 :(C_”B73
7S0
+&B73 F(:AUB 3 DQ3-181:SGCEN/63BB0 1E2GVB 3 7/A$*B 3 9+7DCBB0 1R:X B70 :(B>DB
3
9+7DCB 3 7/A$*B 3 8#.>?B30 1E2GVB73 E/$56B73 75:SPBB0 4:=X!B70 :(CUSB73
75:SPB
73 E/$56B 3 CW01S817PBB0 1E2GVB 3 7>BP;B 3 9=”#^BB0 1R:X B70 :(B=&B 3 9=”#^B 3
Main Index
CHAPTER 18 1917
Support Files

7>BP;B 3 8!BRNB30 1E2GVB73 D+H8GB73 6%]*6BB0 4:=X!B70 :(CN B73 6%]*6B73 D+H8GB
3 B)X]/817RBB0 1E2GVB 3 7>BE;B 3 9=”E,BB0 1R:X B70 :(B=&B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73 6%]S9B73 D+H3,B 3 B)X?U817XBB0 1E2GVB 3 7>BMGB 3 9=”U-BB0 08*L-
B70
:(C=>B 3 9=”U-B 3 7>BMGB 3 8!BFGB30 1E2GVB73 D+H9%B73 6%]<6BB0 3,H8]B70
:(C$PB
73 6%]<6B73 D+H9%B 3 B)X_S8179BB0 1E2GVB 3 7J5\SB 3 9W9XMBB0 08*L-B70 :(C:,B 3
9W9XMB 3 7J5\SB 3 8/@A0B30 1E2GVB73 F(:Q7B73 7S16RBB0 3,H8]B70 :(C”<B73
7S16RB7
3 F(:Q7B 3 DQ3:;8177BB0 1E2GV^81UF^B 3 7J5?BB 3 9W9I(BB0 08*L-B70 :(C:,B 3
9W9I
(B 3 7J5?BB 3 8/?_*B30 1E2GVB73 F(:Q7B73 7S0’?BB0 3,H8]B70 :(C”<B73 7S0’?B73
F(
:Q7B 3 DQ3:R81<4GCEN/63BB0 1E2GVB 3 7/B0<B 3 9+7XKB30 #QCFB 0 :(D2CB 3 9+7XKB
3 7/B0<B 3 8#*DPB30 1E2GVB73 E/$’MB73 75:>6BB0 2NF6’B70 :(C[%B73 75:>6B73
E/$’M
B 3 CW0XV817XBB0 1E2GVB 3 7>B?,B 3 9=”=6B30 #QCFB 0 :(C_”B 3 9=”=6B 3 7>B?,B
3
8!BZ0B30 1E2GVB73 D+H-]B73 6%]”_BB0 2NF6’B70 :(C?&B73 6%]”_B73 D+H-]B 3
B)YM&8
17ZBB0 1E2GVB 3 7>B\?B 3 9=#2^B30 #QCFB 0 :(C_”B 3 9=#2^B 3 7>B\?B 3 8!B:.B30
Main Index
1918
Code Examples

1E2GVB73 D+H?^B73 6%^MSBB0 2NF6’B70 :(C?&B73 6%^MSB73 D+H?^B 3 B)Y/=817BBB0


1E2
GVB 3 7J68?B 3 9W9_6B30 #QCFB 0 :(D3.B 3 9W9_6B 3 7J68?B 3 8/@VRB30 1E2GVB73
F
(:,LB73 7S1X(BB0 2NF6’B70 :(C_”B73 7S1X(B73 F(:,LB 3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/@3>B30 1E2GVB73 F(:)%B73 7S1HRBB0 0:\;JB70 :(DF-B73 7S1HRB73
F(:)%B
3 DQ42D817FBB0 1E2GVB 3 7J5^&B 3 9W9Z&BB0 2TA04B70 :(BM[B 3 9W9Z&B 3 7J5^&B 3
8/@A]B30 1E2GVB73 F(:)PB73 7S0’?BB0 0:\;JB70 :(DF-B73 7S0’?B73 F(:)PB 3
DQ41>81
<.GCEN/63BB0 1E2GVB 3 7/B1^B 3 9+7LPBB0 4=P;UB70 :(9-9B 3 9+7LPB 3 7/B1^B 3
8#*
68B30 1E2GVB73 E/$+-B73 75:”5BB0 0O [@B70 :(DI/B73 75:”5B73 E/$+-B 3
CW0U8817+B
B0 1E2GVB 3 7>B?\B 3 9=”#OBB0 4=P;UB70 :(9D:B 3 9=”#OB 3 7>B?\B 3 8!B/RB30
1E2G
VB73 D+H.&B73 6%]>,BB0 0O [@B70 :(DH6B73 6%]>,B73 D+H.&B 3 B)YQ?817$BB0 1E2GVB
3 7>B>7B 3 9=”ZTBB0 4=P;UB70 :(9D:B 3 9=”ZTB 3 7>B>7B 3 8!BT+B30 1E2GVB73 D+H-
B
B73 6%]_JBB0 0O [@B70 :(DH6B73 6%]_JB73 D+H-BB 3 B)YM&817CBB0 1E2GVB 3 7J67CB
3
9W9SWBB0 4=P;UB70 :(9^1B 3 9W9SWB 3 7J67CB 3 8/@9SB30 1E2GVB73 F(:%6B73
7S1A!B
Main Index B0 0O [@B70 :(DK5B73 7S1A!B73 F(:%6B 3 DQ47;817EBB0 1E2GVB 3 7J6B’B 3 9W9=QBB0
CHAPTER 18 1919
Support Files

4=P;UB70 :(9^1B 3 9W9=QB 3 7J6B’B 3 8/@K-B30 1E2GVB73 F(:”\B73 7S10IBB0 0O


[@B7
0 :(DK5B73 7S10IB73 F(:”\B 3 DQ46.81<>GCEN/63BB0 1E2GVB 3 7/A^[B 3 9+7S6BB0
1TN
FEB70 :(B>DB 3 9+7S6B 3 7/A^[B 3 8#*8#B30 1E2GVB73 E/$/WB73 75:<[BB0 304O#B70
:
(C;JB73 75:<[B73 E/$/WB 3 CW0TO817$BB0 1E2GVB 3 7>B’^B 3 9=”’YBB0 1TNFEB70
:(B’
IB 3 9=”’YB 3 7>B’^B 3 8!BT,B30 1E2GVB73 D+HKZB73 6%]*>BB0 304O#B70 :(C”<B73
6%
]*>B73 D+HKZB 3 B)Y6O817YBB0 1E2GVB 3 7>B.;B 3 9=”&;BB0 1TNFEB70 :(B’IB 3
9=”&;
B 3 7>B.;B 3 8!BZOB30 1E2GVB73 D+HXEB73 6%^C%BB0 304O#B70 :(C”<B73 6%^C%B73
D+H
XEB 3 B)YIJ817ABB0 1E2GVB 3 7J6ETB 3 9W9,7BB0 1TNFEB70 :(C 9B 3 9W9,7B 3
7J6ETB
3 8/@QDB30 1E2GVB73 F(:]HB73 7S1X(BB0 304O#B70 :(C?&B73 7S1X(B73 F(:]HB 3
DQ4H
?817CBB0 1E2GVB 3 7J67$B 3 9W9-=BB0 1TNFEB70 :(C 9B 3 9W9-=B 3 7J67$B 3
8/@H5B3
0 1E2GVB73 F(:_WB73 7S12LBB0 304O#B70 :(C?&B73 7S12LB73 F(:_WB 3
DQ4JM81>0GCEN/
63BB0 1E2GVB 3 7/A.MB 3 9+7-HBB0 1K.<<B70 :(B^AB 3 9+7-HB 3 7/A.MB 3 8#*ARB30
1
E2GVB73 E/$FXB73 75:[0BB0 !D\FB70 :(DOZB73 75:[0B73 E/$FXB 3 CW0A%817YBB0
1E2G
VB 3 7>B-&B 3 9=”?1BB0 1K.<<B70 :(B%FB 3 9=”?1B 3 7>B-&B 3 8!B$?B30 1E2GVB73
D+
HKBB73 6%]>EBB0 !D\FB70 :(DN4B73 6%]>EB73 D+HKBB 3 B)Y6O817WBB0 1E2GVB 3
7>B”I
B 3 9=#6IBB0 1K.<<B70 :(B%FB 3 9=#6IB 3 7>B”IB 3 8!B%,B30 1E2GVB73 D+HP&B73
6%^
OKBB0 !D\FB70 :(DN4B73 6%^OKB73 D+H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ZDB 3 9+7GZBB1 1/6!NB70 :(DN4B 3 9+7GZB 3 7/AZDB 3 8#.@YB30
1E2GVB73
E/$0GB73 75:V#B7 08AMWB70 :(BP!B73 75:V#B73 E/$0GB 3 CW _M817UBB0 1E2GVB 3
7>
BL*B 3 9=”=UBB1 1/6!NB70 :(DL$B 3 9=”=UB 3 7>BL*B 3 8!BN5B30 1E2GVB73 D+H KB73
6%]+PB7 08AMWB70 :(BCUB73 6%]+PB73 D+H KB 3 B)X;%817SBB0 1E2GVB 3 7>BGJB 3
9=”
P_BB1 1/6!NB70 :(DL$B 3 9=”P_B 3 7>BGJB 3 8!BAQB30 1E2GVB73 D+H0;B73 6%]”&B7
0
8AMWB70 :(BCUB73 6%]”&B73 D+H0;B 3 B)X<-8174BB0 1E2GVB 3 7J5*?B 3 9W9M#BB1
1/6!
NB70 :(DOZB 3 9W9M#B 3 7J5*?B 3 8/?_*B30 1E2GVB73 F(:BDB73 7S0^ZB7 08AMWB70
:(

Main Index
1920
Code Examples

B/:B73 7S0^ZB73 F(:BDB 3 DQ3-&8176BB0 1E2GVB 3 7J5,*B 3 9W9’>BB1 1/6!NB70


:(DOZ
B 3 9W9’>B 3 7J5,*B 3 8/@CRB30 1E2GVB73 F(:E^B73 7S0:BB7 08AMWB70 :(B/:B73
7S0
:BB73 F(:E^B 3 DQ3=781>UGCEN/63BB0 1E2GVB 3 7/A=QB 3 9+7K<B30 2:#=>B 0 :(A!7B
3
9+7K<B 3 7/A=QB 3 8#._^B30 1E2GVB73 E/$9CB73 75:Z6B7 .@GWB70 :(CE3B73
75:Z6B
73 E/$9CB 3 CW04;817SBB0 1E2GVB 3 7>BL@B 3 9=”RTB30 2:#=>B 0 :(A(“B 3 9=”RTB 3
7>BL@B 3 8!BD1B30 1E2GVB73 D+H4YB73 6%]N?B7 .@GWB70 :(C56B73 6%]N?B73 D+H4YB
3 B)X?>817QBB0 1E2GVB 3 7>BU<B 3 9=”,BB30 2:#=>B 0 :(A(“B 3 9=”,BB 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YFB70 :(B52B73 7S0&CB73
F
(:L)B 3 DQ3%*81>,GCEN/63BB0 1E2GVB 3 7/A=EB 3 9+7BLB30 29 “/B 0 :(BM[B 3
9+7BLB
3 7/A=EB 3 8#.?\B30 1E2GVB73 E/$F9B73 75:/XB7 02J_GB70 :(B/:B73 75:/XB73
E/$F
9B 3 CW09)817OBB0 1E2GVB 3 7>BT!B 3 9=”R<B30 29 “/B 0 :(B9WB 3 9=”R<B 3 7>BT!B
3 8!BGCB30 1E2GVB73 D+HD>B73 6%]S!B7 02J_GB70 :(BOPB73 6%]S!B73 D+HD>B 3
B)Y03
817MBB0 1E2GVB 3 7>BX-B 3 9=”YYB30 29 “/B 0 :(B9WB 3 9=”YYB 3 7>BX-B 3
8!BL+B30
1E2GVB73 D+HMQB73 6%^5?B7 02J_GB70 :(BOPB73 6%^5?B73 D+HMQB 3 B)Y8F816\BB0
1E
2GVB 3 7J5>3B 3 9W9UBB30 29 “/B 0 :(BY<B 3 9W9UBB 3 7J5>3B 3 8/@5AB30 1E2GVB73
F(:Q?B73 7S1K_B7 02J_GB70 :(B%FB73 7S1K_B73 F(:Q?B 3 DQ3<]8170BB0 1E2GVB 3
7J5
%>B 3 9W9M B30 29 “/B 0 :(BY<B 3 9W9M B 3 7J5%>B 3 8/?\5B30 1E2GVB73 F(:J,B73
7
S0$YB7 02J_GB70 :(B%FB73 7S0$YB73 F(:J,B 3 DQ3#E81>^GCEN/63BB0 1E2GVB 3
7/A?LB
3 9+7N:B31 4B3.WB 0 :(DC(B 3 9+7N:B 3 7/A?LB 3 8#*45B30 1E2GVB73 E/$URB73
75:#
1B7 ^’8NB70 :(B%FB73 75:#1B73 E/$URB 3 CW0NR817MBB0 1E2GVB 3 7>B%9B 3 9=”-
#B3
1 4B3.WB 0 :(D9)B 3 9=”-#B 3 7>B%9B 3 8!BUAB30 1E2GVB73 D+HYLB73 6%])#B7
^’8N
B70 :(B$KB73 6%])#B73 D+HYLB 3 B)YHZ817KBB0 1E2GVB 3 7>B;@B 3 9=”;JB31 4B3.WB
0
:(D9)B 3 9=”;JB 3 7>B;@B 3 8!B+”B30 1E2GVB73 D+H##B73 6%^GVB7 ^’8NB70
:(B$KB
73 6%^GVB73 D+H##B 3 B)YUE816^BB0 1E2GVB 3 7J5_KB 3 9W9=\B31 4B3.WB 0 :(DE7B 3
9W9=\B 3 7J5_KB 3 8/@GXB30 1E2GVB73 F(:W4B73 7S1OKB7 ^’8NB70 :(B[=B73
7S1OKB7
3 F(:W4B 3 DQ3[1816\BB0 1E2GVB 3 7J5:%B 3 9W9S.B31 4B3.WB 0 :(DE7B 3 9W9S.B 3
7
J5:%B 3 8/@3’B30 1E2GVB73 F(:V*B73 7S0#9B7 ^’8NB70 :(B[=B73 7S0#9B73 F(:V*B
3
Main Index
CHAPTER 18 1921
Support Files

DQ3!H81?6GCEN/63BB0 1E2GVB 3 7/A@:B 3 9+7W0BB0 0=MA\B70 :(COUB 3 9+7W0B 3


7/A@
:B 3 8#*9?B30 1E2GVB73 E/$W’B73 75:<“B7 -W)%B70 :(COUB73 75:<“B73 E/$W’B 3
CW
0PI817KBB0 1E2GVB 3 7>B#+B 3 9=”?1BB0 0=MA\B70 :(CH1B 3 9=”?1B 3 7>B#+B 3 8!B-

B30 1E2GVB73 D+HR(B73 6%]:]B7 -W)%B70 :(CFYB73 6%]:]B73 D+HR(B 3
B)YC*817IBB0
1E2GVB 3 7>B”>B 3 9=”&;BB0 0=MA\B70 :(CH1B 3 9=”&;B 3 7>B”>B 3 8!BZ^B30
1E2GVB
73 D+HVMB73 6%^ALB7 -W)%B70 :(CFYB73 6%^ALB73 D+HVMB 3 B)YGS816[BB0 1E2GVB 3
7J5\:B 3 9W9=2BB0 0=MA\B70 :(CUSB 3 9W9=2B 3 7J5\:B 3 8/@GXB30 1E2GVB73
F(:%<B7
3 7S1R’B7 -W)%B70 :(CUSB73 7S1R’B73 F(:%<B 3 DQ48Z816^BB0 1E2GVB 3 7J6 0B 3
9
W9&BBB0 0=MA\B70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C(B73 IZ%@<B73 J)W/.B 3
J83
M;816XBB0 1E2GVB 3 7;793B 3 M+=B*B7 \> 4B70 :(C/@B 3 M+=B*B 3 7;793B 3
J’72(B
30 1E2GVB73 J)W!SB73 IZ&#_BB1 1#]]\B70 :(DC(B73 IZ&#_B73 J)W!SB 3
J83[Z81?”GCEN
/63BB0 1E2GVB 3 A5&V_B 3 NN3(VB7 =8EEB70 :(C:,B 3 NN3(VB 3 A5&V_B 3 K7:U:B30
Main Index
1922
Code Examples

1E2GVB73 JU*((B73 IWD9(B30 07<7EB 0 :(B[=B73 IWD9(B73 JU*((B 3 J0++3816]BB0


1E2
GVB 3 CD_J@B 3 O4 ?#B7 =8EEB70 :(C”<B 3 O4 ?#B 3 CD_J@B 3 K*=P9B30 1E2GVB73
J
K=]]B73 IS!C#B30 07<7EB 0 :(B”%B73 IS!C#B73 JK=]]B 3 I!*CS816_BB0 1E2GVB 3
CD_S
:B 3 O4 ?0B7 =8EEB70 :(C”<B 3 O4 ?0B 3 CD_S:B 3 K*=P9B30 1E2GVB73 JK.4VB73
IS
!(JB30 07<7EB 0 :(B”%B73 IS!(JB73 JK.4VB 3 I!*UK816/BB0 1E2GVB 3 7;7GWB 3
M+’8I
B7 =8EEB70 :(C!GB 3 M+’8IB 3 7;7GWB 3 J’63IB30 1E2GVB73 J)W*9B73 IZ&S_B30
07<
7EB 0 :(C6+B73 IZ&S_B73 J)W*9B 3 J83’[816ZBB0 1E2GVB 3 7;76(B 3 M+’9&B7
=8EEB
70 :(C!GB 3 M+’9&B 3 7;76(B 3 J’65!B30 1E2GVB73 J)WYMB73 IZ%[KB30 07<7EB 0
:(C6
+B73 IZ%[KB73 J)WYMB 3 J83LJ81?@GCEN/63BB0 1E2GVB 3 A5&IYB 3 NN3-#B7 089@<B70
:(CLVB 3 NN3-#B 3 A5&IYB 3 K7:VCB30 1E2GVB73 JU*9MB73 IWD6)B30 1<F]MB 0
:(9UDB7
3 IWD6)B73 JU*9MB 3 J0+KB816_BB0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 7;6?BB 3 J’6 $B30 1E2GVB73 J)WP2B73 IZ%=3B ^[1JB 0
:
(18%B73 IZ%=3B73 J)WP2B 3 J839O816-BB0 1E2GVB 3 7;6_WB 3 M+’9&B7 0H<EQB70
:(CK
0B 3 M+’9&B 3 7;6_WB 3 J’671B30 1E2GVB73 J)W’YB73 IZ&W.B ^[1JB 0 :(18%B73
IZ
&W.B73 J)W’YB 3 J83=I81@CGCEN/63BB0 1E2GVB 3 A5&=KB 3 NN3- B7 0UK’JB70 :(C 9B
3 NN3- B 3 A5&=KB 3 K7:TLB30 1E2GVB73 JU*+2B73 IWC?0BB1 0!QKPB70 :(DH6B73
IWC?0
B73 JU*+2B 3 J0+SO8171BB0 1E2GVB 3 CD_(#B 3 O40SGB7 0UK’JB70 :(B;EB 3 O40SGB
3
CD_(#B 3 K*=@:B30 1E2GVB73 JK=[;B73 IS!7XBB1 0!QKPB70 :(DF-B73 IS!7XB73
JK=[;B
3 I!*9T8173BB0 1E2GVB 3 CD_D]B 3 O4 AJB7 0UK’JB70 :(B;EB 3 O4 AJB 3 CD_D]B 3
K*’,&B30 1E2GVB73 JK=[3B73 IS!61BB1 0!QKPB70 :(DF-B73 IS!61B73 JK=[3B 3
I!*8L81
6=BB0 1E2GVB 3 7;7K2B 3 M+)PMB7 0UK’JB70 :(C85B 3 M+)PMB 3 7;7K2B 3 J’5M/B30
1
E2GVB73 J)W(JB73 IZ%@<BB1 0!QKPB70 :(DK5B73 IZ%@<B73 J)W(JB 3 J83N[816)BB0
1E2G
VB 3 7;7’DB 3 M+’].B7 0UK’JB70 :(C85B 3 M+’].B 3 7;7’DB 3 J’6#GB30 1E2GVB73
J)
W)RB73 IZ%]SBB1 0!QKPB70 :(DK5B73 IZ%]SB73 J)W)RB 3 J83P&81@MGCEN/63BB0
1E2GVB
3 A5&UTB 3 NN3O6BB0 2I*3MB70 :(DC(B 3 NN3O6B 3 A5&UTB 3 K7:G’B30 1E2GVB73
JU*9M
B73 IWC=TBB1 1 2?BB70 :(DH6B73 IWC=TB73 JU*9MB 3 J0+7W8173BB0 1E2GVB 3 CD_B.B
3
Main Index
CHAPTER 18 1923
Support Files

O4 XPBB0 2I*3MB70 :(D9)B 3 O4 XPB 3 CD_B.B 3 K*=5&B30 1E2GVB73 JK=:UB73


IS!0SB
B1 1 2?BB70 :(DF-B73 IS!0SB73 JK=:UB 3 I!*388175BB0 1E2GVB 3 CD_OMB 3 O4 =5BB0
2I*3MB70 :(D9)B 3 O4 =5B 3 CD_OMB 3 K*=EMB30 1E2GVB73 JK=<_B73 IS!4[BB1 1
2?BB7
0 :(DF-B73 IS!4[B73 JK=<_B 3 I!*5#816*BB0 1E2GVB 3 7;7MTB 3 M+’0TBB0 2I*3MB70
:
(DF-B 3 M+’0TB 3 7;7MTB 3 J’5[“B30 1E2GVB73 J)V:XB73 IZ%)BBB1 1 2?BB70
:(DI/B73
IZ%)BB73 J)V:XB 3 J82:X816=BB0 1E2GVB 3 7;76(B 3 M+):ABB0 2I*3MB70 :(DF-B 3
M+
):AB 3 7;76(B 3 J’5,AB30 1E2GVB73 J)V;2B73 IZ%Y>BB1 1 2?BB70 :(DI/B73 IZ%Y>B73
J)V;2B 3 J82&Y81@WGCEN/63BB0 1E2GVB 3 A5&BHB 3 NN3O6BB0 1EXXIB70 :(DK5B 3
NN3O6
B 3 A5&BHB 3 K7:HQB30 1E2GVB73 JU*3OB73 IWD0KB7 -”:!B70 :(4Q>B73 IWD0KB73
JU*
3OB 3 J0+DU8175BB0 1E2GVB 3 CD_D]B 3 O4 @VBB0 1EXXIB70 :(DI/B 3 O4 @VB 3
CD_D]B
3 K*=P9B30 1E2GVB73 JK=F_B73 IS@??B7 -”:!B70 :(3K:B73 IS@??B73 JK=F_B 3
I!.=
‘8177BB0 1E2GVB 3 CD^@.B 3 O4 MEBB0 1EXXIB70 :(DI/B 3 O4 MEB 3 CD^@.B 3
K*’]*B3
0 1E2GVB73 JK=WMB73 IS!(JB7 -”:!B70 :(3K:B73 IS!(JB73 JK=WMB 3 I!*A/816#BB0
1
E2GVB 3 7;6^^B 3 M+)’6BB0 1EXXIB70 :(DL$B 3 M+)’6B 3 7;6^^B 3 J’5)/B30
1E2GVB73
J)WD>B73 IZ&W.B7 -”:!B70 :(5N_B73 IZ&W.B73 J)WD>B 3 J83S0816*^81UF^BB0
1E2GV
B 3 7;6*>B 3 M+’6,BB0 1EXXIB70 :(DL$B 3 M+’6,B 3 7;6*>B 3 J’66HB30 1E2GVB73
J)V
^MB73 IZ%$*B7 -”:!B70 :(5N_B73 IZ%$*B73 J)V^MB 3 J82?W81@’GCEN/63BB0 1E2GVB
3
A5&KEB 3 NN3ZHBB0 3C4”$B70 :(D6=B 3 NN3ZHB 3 A5&KEB 3 K7:R6B30 1E2GVB73
JU*G3B
73 IWD7&B30 1RMU<B 0 :(A3TB73 IWD7&B73 JU*G3B 3 J0+N[8177BB0 1E2GVB 3 CD_WZB 3
O4 =:BB0 3C4”$B70 :(D3.B 3 O4 =:B 3 CD_WZB 3 K*=E*B30 1E2GVB73 JK.J%B73
IS!%VB3
0 1RMU<B 0 :(9()B73 IS!%VB73 JK.J%B 3 I!*)?8179BB0 1E2GVB 3 CD_>YB 3 O40E6BB0
3
C4”$B70 :(D3.B 3 O40E6B 3 CD_>YB 3 K*=*GB30 1E2GVB73 JK.B^B73 IS!RGB30 1RMU<B
0
:(9()B73 IS!RGB73 JK.B^B 3 I!*R*816&BB0 1E2GVB 3 7;6U_B 3 M+’A9BB0 3C4”$B70
:(
D9)B 3 M+’A9B 3 7;6U_B 3 J’6B?B30 1E2GVB73 J)VW&B73 IZ%”PB30 1RMU<B 0 :(ARJB73
IZ%”PB73 J)VW&B 3 J82..816#BB0 1E2GVB 3 7;6PZB 3 M+)+OBB0 3C4”$B70 :(D9)B 3
M+)
+OB 3 7;6PZB 3 J’5=TB30 1E2GVB73 J)V(\B73 IZ&86B30 1RMU<B 0 :(ARJB73 IZ&86B73
J
)V(\B 3 J82_581@:GCEN/63BB0 1E2GVB 3 A5,3”B 3 NN4U8BB1 3:S”GB70 :(DW0B 3
NN4U8B
3 A5,3”B 3 K7<CHB30 1E2GVB73 JU”N/B73 IWD=YB30 2/B2=B 0 :(8P’B73 IWD=YB73
JU”N
/B 3 J0-E’8179BB0 1E2GVB 3 CD_’\B 3 O40Q&BB1 3:S”GB70 :(DW0B 3 O40Q&B 3 CD_’\B
3 K*=>^B30 1E2GVB73 JK.VKB73 IS!*XB30 2/B2=B 0 :(7&RB73 IS!*XB73 JK.VKB 3
I!*”*
817BBB0 1E2GVB 3 CD\4KB 3 O40_2BB1 3:S”GB70 :(DW0B 3 O40_2B 3 CD\4KB 3
K*.L7B30
1E2GVB73 JK./HB73 IS[2%B30 2/B2=B 0 :(7&RB73 IS[2%B73 JK./HB 3 I!*]O816;BB0
1E
2GVB 3 7;7[,B 3 M+=I,BB1 3:S”GB70 :(DXVB 3 M+=I,B 3 7;7[,B 3 J’71WB30 1E2GVB73
J)X)8B73 IZ, FB30 2/B2=B 0 :(8]^B73 IZ, FB73 J)X)8B 3 J84R*816&BB0 1E2GVB 3
7;7
*CB 3 M+’*YBB1 3:S”GB70 :(DXVB 3 M+’*YB 3 7;7*CB 3 J’6X6B30 1E2GVB73 J)XWZB73
I
Z&$QB30 2/B2=B 0 :(8]^B73 IZ&$QB73 J)XWZB 3 J84A/81@\GCEN/63BB0 1E2GVB 3
A5&_$B
3 NN4($BB0 45+/LB70 :(D0*B 3 NN4($B 3 A5&_$B 3 K7<MLB30 1E2GVB73 JU”Y0B73
IWE3
OBB0 4?4>+B70 :(593B73 IWE3OB73 JU”Y0B 3 J0-VR817BBB0 1E2GVB 3 CD\CWB 3
O41ASBB
0 45+/LB70 :(C_”B 3 O41ASB 3 CD\CWB 3 K*.X2B30 1E2GVB73 JK.*UB73 IS[4-BB0
4?4>+
Main Index
1924
Code Examples

B70 :(47VB73 IS[4-B73 JK.*UB 3 I!”0_817DBB0 1E2GVB 3 CD\5;B 3 O40&?BB0


45+/LB70
:(C_”B 3 O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BB0
2#U,*B70 :(8”XB73 IZ&.FB73 J)WDVB 3 J83W>81!IGCEN/63BB0 1E2GVB 3 A5&)<B 3
NN3?
OB7 *9GCB70 :(C&;B 3 NN3?OB 3 A5&)<B 3 K7:.EB30 1E2GVB73 JU*)OB73 IWDE6B30
3>
4W:B 0 :(6/SB73 IWDE6B73 JU*)OB 3 J0+(J817FBB0 1E2GVB 3 CD_/PB 3 O401RB7
*9GC
B70 :(C=>B 3 O401RB 3 CD_/PB 3 K*=YTB30 1E2GVB73 JK.HAB73 IS!4[B30 3>4W:B 0
:(5
#,B73 IS!4[B73 JK.HAB 3 I!*KG817EBB0 1E2GVB 3 CD_>AB 3 O40JKB7 *9GCB70
:(C=>B
3 O40JKB 3 CD_>AB 3 K*=&#B30 1E2GVB73 JK.-@B73 IS[BKB30 3>4W:B 0 :(5#,B73
IS[B
KB73 JK.-@B 3 I!”0_816>BB0 1E2GVB 3 7;7L!B 3 M+’W7B7 *9GCB70 :(C?&B 3 M+’W7B
3 7;7L!B 3 J’6OAB30 1E2GVB73 J)WP2B73 IZ&&<B30 3>4W:B 0 :(7J(B73 IZ&&<B73
J)WP2
B 3 J83’A816?BB0 1E2GVB 3 7;6]TB 3 M+’8IB7 *9GCB70 :(C?&B 3 M+’8IB 3 7;6]TB
3
J’65!B30 1E2GVB73 J)V_5B73 IZ%P[B30 3>4W:B 0 :(7J(B73 IZ%P[B73 J)V_5B 3
J82,’8
1!SGCEN/63BB0 1E2GVB 3 A5&::B 3 NN43JB7 1AHM(B70 :(BG^B 3 NN43JB 3 A5&::B 3
K7
:>IB30 1E2GVB73 JU”VPB73 IWD-;B +;])B 0 :(4)%B73 IWD-;B73 JU”VPB 3 J0-
HH817E
BB0 1E2GVB 3 CD\6ZB 3 O40_2B7 1AHM(B70 :(B 4B 3 O40_2B 3 CD\6ZB 3 K*.LVB30
1E2
GVB73 JK.”/B73 IS[STB +;])B 0 :(3Z”B73 IS[STB73 JK.”/B 3 I!”CX817CBB0
1E2GVB
3 CD_;BB 3 O4 :1B7 1AHM(B70 :(B 4B 3 O4 :1B 3 CD_;BB 3 K*=NIB30 1E2GVB73
JK.H
!B73 IS!61B +;])B 0 :(3Z”B73 IS!61B73 JK.H!B 3 I!*L0816:BB0 1E2GVB 3 7;74_B
3 M+),JB7 1AHM(B70 :(BV>B 3 M+),JB 3 7;74_B 3 J’5%JB30 1E2GVB73 J)X$’B73
IZ%]S
B +;])B 0 :(5Z?B73 IZ%]SB73 J)X$’B 3 J83[C816>BB0 1E2GVB 3 7;7QOB 3 M+=C5B7
1AHM(B70 :(BV>B 3 M+=C5B 3 7;7QOB 3 J’70PB30 1E2GVB73 J)Y8,B73 IZ,-UB
+;])B
0 :(5Z?B73 IZ,-UB73 J)Y8,B 3 J85 681!+GCEN/63BB0 1E2GVB 3 A5,6WB 3 NN47&B7
?
“V4B70 :(C-OB 3 NN47&B 3 A5,6WB 3 K7:@!B30 1E2GVB73 JU”GWB73 IWDT%BB0 =”6\B70
:(CY[B73 IWDT%B73 JU”GWB 3 J0-4-817CBB0 1E2GVB 3 CD_\MB 3 O40/CB7 ?”V4B70
:(C
V]B 3 O40/CB 3 CD_\MB 3 K*.10B30 1E2GVB73 JK.UCB73 IS!9%BB0 =”6\B70 :(CRTB73
I
S!9%B73 JK.UCB 3 I!*S<817ABB0 1E2GVB 3 CD__\B 3 O408@B7 ?”V4B70 :(CV]B 3
O408
Main Index
CHAPTER 18 1925
Support Files

@B 3 CD__\B 3 K*=)AB30 1E2GVB73 JK.>2B73 IS[L0BB0 =”6\B70 :(CRTB73 IS[L0B73


JK
.>2B 3 I!”DG816,BB0 1E2GVB 3 7;7*]B 3 M+’M4B7 ?”V4B70 :(C*LB 3 M+’M4B 3
7;7*]
B 3 J’6B7B30 1E2GVB73 J)XS<B73 IZ,D&BB0 =”6\B70 :(C’NB73 IZ,D&B73 J)XS<B 3
J84
R*816:BB0 1E2GVB 3 7;7*]B 3 M+’@*B7 ?”V4B70 :(C*LB 3 M+’@*B 3 7;7*]B 3
J’6=XB
30 1E2GVB73 J)W\IB73 IZ%#!BB0 =”6\B70 :(C’NB73 IZ%#!B73 J)W\IB 3
J83V#81!%GCEN
/63BB0 1E2GVB 3 A5&S+B 3 NN42$BB0 3@\G2B70 :(D2CB 3 NN42$B 3 A5&S+B 3 K7:<[B30
1E2GVB73 JU*LHB73 IWDWMB30 2@*GFB 0 :(7_MB73 IWDWMB73 JU*LHB 3 J0++3817ABB0
1E2
GVB 3 CD_A^B 3 O403’BB0 3@\G2B70 :(C_”B 3 O403’B 3 CD_A^B 3 K*=Y<B30 1E2GVB73
J
K.D3B73 IS[ACB30 2@*GFB 0 :(7I9B73 IS[ACB73 JK.D3B 3 I!*,S8178BB0 1E2GVB 3
CD_P
6B 3 O40T0BB0 3@\G2B70 :(C_”B 3 O40T0B 3 CD_P6B 3 K*=@:B30 1E2GVB73 JK.1@B73
IS
!)2B30 2@*GFB 0 :(7I9B73 IS!)2B73 JK.1@B 3 I!*S<816%BB0 1E2GVB 3 7;7K\B 3
M+’:F
BB0 3@\G2B70 :(D5BB 3 M+’:FB 3 7;7K\B 3 J’6’,B30 1E2GVB73 J)V%;B73 IZ&40B30
2@*
GFB 0 :(8Y-B73 IZ&40B73 J)V%;B 3 J82\_816,BB0 1E2GVB 3 7;76SB 3 M+’LKBB0
3@\G2B
70 :(D5BB 3 M+’LKB 3 7;76SB 3 J’6G*B30 1E2GVB73 J)V\_B73 IZ&* B30 2@*GFB 0
:(8Y
-B73 IZ&* B73 J)V\_B 3 J83P&81![GCEN/63BB0 1E2GVB 3 A5&-QB 3 NN4G”B7 ([@&B70
:(C?&B 3 NN4G”B 3 A5&-QB 3 K7<2/B30 1E2GVB73 JU*”EB73 IWD.)BB0 3J?PWB70 :(7M-
B7
3 IWD.)B73 JU*”EB 3 J0+!38178BB0 1E2GVB 3 CD_#5B 3 O40]ZB7 ([@&B70 :(C&;B 3
O
40]ZB 3 CD_#5B 3 K*.JGB30 1E2GVB73 JK=<DB73 IS!(JBB0 3J?PWB70 :(6+]B73
IS!(JB73
JK=<DB 3 I!*M88176BB0 1E2GVB 3 CD_L#B 3 O407PB7 ([@&B70 :(C&;B 3 O407PB 3
CD
_L#B 3 K*=+BB30 1E2GVB73 JK.1WB73 IS[B.BB0 3J?PWB70 :(6+]B73 IS[B.B73 JK.1WB 3
I!*.>816”BB0 1E2GVB 3 7;7F%B 3 M+’LKB7 ([@&B70 :(C^FB 3 M+’LKB 3 7;7F%B 3
J’6
E>B30 1E2GVB73 J)X 1B73 IZ,7;BB0 3J?PWB70 :(80LB73 IZ,7;B73 J)X 1B 3
J847\816%B
B0 1E2GVB 3 7;7C_B 3 M+=B*B7 ([@&B70 :(C^FB 3 M+=B*B 3 7;7C_B 3 J’71WB30
1E2G
VB73 J)W, B73 IZ&SEBB0 3J?PWB70 :(80LB73 IZ&SEB73 J)W, B 3 J83*!81[4GCEN/63BB0
1E2GVB 3 A5&M<B 3 NN3,[B7 06&W?B70 :(COUB 3 NN3,[B 3 A5&M<B 3 K7:(WB30
1E2GVB7
3 JU*4WB73 IWD6HBB0 0)16WB70 :(BCUB73 IWD6HB73 JU*4WB 3 J0+HC8176BB0 1E2GVB 3
C
D_X’B 3 O40MIB7 06&W?B70 :(CE3B 3 O40MIB 3 CD_X’B 3 K*=;+B30 1E2GVB73
JK.B^B73
IS[1(BB0 0)16WB70 :(A!7B73 IS[1(B73 JK.B^B 3 I!**_8174BB0 1E2GVB 3 CD_TCB 3
O4
?#B7 06&W?B70 :(CE3B 3 O4 ?#B 3 CD_TCB 3 K*=P!B30 1E2GVB73 JK=?:B73 IS!4[BB0
0)16WB70 :(A!7B73 IS!4[B73 JK=?:B 3 I!*6U816.BB0 1E2GVB 3 7;6)1B 3 M+)!OB7
06&
W?B70 :(CV]B 3 M+)!OB 3 7;6)1B 3 J’5[“B30 1E2GVB73 J)VEXB73 IZ%KKBB0 0)16WB70
:
(BROB73 IZ%KKB73 J)VEXB 3 J82N6816”BB0 1E2GVB 3 7;6!&B 3 M+’Y B7 06&W?B70
:(CV
]B 3 M+’Y B 3 7;6!&B 3 J’6U7B30 1E2GVB73 J)V-VB73 IZ&V^BB0 0)16WB70 :(BROB73
IZ
&V^B73 J)V-VB 3 J836&81[EGCEN/63BB0 1E2GVB 3 A5&]9B 3 NN3]7BB0 1’<[?B70 :(DH6B
3 NN3]7B 3 A5&]9B 3 K7:”6B30 1E2GVB73 JU*;4B73 IWD7PBB0 49BB6B70 :(6A-B73
IWD7P
B73 JU*;4B 3 J0+’A8174BB0 1E2GVB 3 CD_/1B 3 O40JKBB0 1’<[?B70 :(DF-B 3 O40JKB
3
CD_/1B 3 K*=& B30 1E2GVB73 JK=[;B73 IS!3,BB0 49BB6B70 :(5I B73 IS!3,B73
JK=[;B
3 I!*7+8172BB0 1E2GVB 3 CD_/PB 3 O4 @VBB0 1’<[?B70 :(DF-B 3 O4 @VB 3 CD_/PB 3
K*=P!B30 1E2GVB73 JK.5FB73 IS!/KBB0 49BB6B70 :(5I B73 IS!/KB73 JK.5FB 3
I!*S<81
6’BB0 1E2GVB 3 7;7@#B 3 M+’G>BB0 1’<[?B70 :(DI/B 3 M+’G>B 3 7;7@#B 3 J’65AB30
1
Main Index
1926
Code Examples

E2GVB73 J)X3?B73 IZ&X;BB0 49BB6B70 :(6[JB73 IZ&X;B73 J)X3?B 3 J83!S816.BB0


1E2G
VB 3 7;7,/B 3 M+’%@BB0 1’<[?B70 :(DI/B 3 M+’%@B 3 7;7,/B 3 J’6Z*B30 1E2GVB73
J)
W><B73 IZ%?*BB0 49BB6B70 :(6[JB73 IZ%?*B73 J)W><B 3 J83V#81[OGCEN/63BB0
1E2GVB
3 A5&(XB 3 NN3,[BB0 1N?3VB70 :(DI/B 3 NN3,[B 3 A5&(XB 3 K7:-%B30 1E2GVB73
JU*)O
B73 IWDD B7 0C<V<B70 :-^8OB73 IWDD B73 JU*)OB 3 J0+-]8172BB0 1E2GVB 3 CD_+@B
3
O4088BB0 1N?3VB70 :(DH6B 3 O4088B 3 CD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[$B70 :(3=BB73 IZ&HQB73 J)V’6B 3 J831]816(BB0 1E2GVB 3
7;
6-LB 3 M+’P2BB0 4M@T>B70 :(D3.B 3 M+’P2B 3 7;6-LB 3 J’6OXB30 1E2GVB73 J)VT;B73
IZ%-.B7 %A[$B70 :(3=BB73 IZ%-.B73 J)VT;B 3 J82(E81[.GCEN/63BB0 1E2GVB 3
A5&+6
B 3 NN3@@B7 0B(<%B70 :(CIXB 3 NN3@@B 3 A5&+6B 3 K7:*MB30 1E2GVB73 JU*@’B73
IWD
O[B30 !RM]B 0 :(CFYB73 IWDO[B73 JU*@’B 3 J0+<L816\BB0 1E2GVB 3 CD_TCB 3
O405!B
7 0B(<%B70 :(C85B 3 O405!B 3 CD_TCB 3 K*=/SB30 1E2GVB73 JK.KWB73 IS!<LB30
!RM
]B 0 :(C56B73 IS!<LB73 JK.KWB 3 I!*.6816^BB0 1E2GVB 3 CD_;BB 3 O40H5B7
0B(<%B7
0 :(C85B 3 O40H5B 3 CD_;BB 3 K*=#8B30 1E2GVB73 JK.BCB73 IS!T?B30 !RM]B 0
:(C56
B73 IS!T?B73 JK.BCB 3 I!*ST816$BB0 1E2GVB 3 7;78=B 3 M+’P2B7 0B(<%B70 :(CP_B
3
M+’P2B 3 7;78=B 3 J’6JKB30 1E2GVB73 J)W;7B73 IZ&C$B30 !RM]B 0 :(COUB73
IZ&C$B
73 J)W;7B 3 J83-C816+BB0 1E2GVB 3 7;72[B 3 M+’ILB7 0B(<%B70 :(CP_B 3 M+’ILB 3
7;72[B 3 J’6E6B30 1E2GVB73 J)W_AB73 IZ&)GB30 !RM]B 0 :(COUB73 IZ&)GB73 J)W_AB
3 J83!S81[>GCEN/63BB0 1E2GVB 3 A5&%[B 3 NN414B7 0T4N!B70 :(C0(B 3 NN414B 3
A5&
%[B 3 K7::3B30 1E2GVB73 JU*_?B73 IWDMJBB0 2+BL:B70 :(8OBB73 IWDMJB73 JU*_?B 3
J
0+?C816^BB0 1E2GVB 3 CD_;ZB 3 O40:6B7 0T4N!B70 :(B:*B 3 O40:6B 3 CD_;ZB 3
K*.D
=B30 1E2GVB73 JK.P”B73 IS!T?BB0 2+BL:B70 :(7#^B73 IS!T?B73 JK.P”B 3
I!*$I816[BB
0 1E2GVB 3 CD_ZAB 3 O4 “;B7 0T4N!B70 :(B:*B 3 O4 “;B 3 CD_ZAB 3 K*=H.B30
1E2GV
B73 JK.XBB73 IS!<LBB0 2+BL:B70 :(7#^B73 IS!<LB73 JK.XBB 3 I!*;Z816YBB0 1E2GVB
3
7;7L”B 3 M+)?XB7 0T4N!B70 :(C9$B 3 M+)?XB 3 7;7L”B 3 J’5,!B30 1E2GVB73
J)W@KB
73 IZ&Y]BB0 2+BL:B70 :(8[SB73 IZ&Y]B73 J)W@KB 3 J83;>816$BB0 1E2GVB 3 7;7V/B 3
Main Index
CHAPTER 18 1927
Support Files

M+=A_B7 0T4N!B70 :(C9$B 3 M+=A_B 3 7;7V/B 3 J’7 HB30 1E2GVB73 J)W#%B73


IZ&6FBB
0 2+BL:B70 :(8[SB73 IZ&6FB73 J)W#%B 3 J83YM81]0GCEN/63BB0 1E2GVB 3 A5%:NB 3
NN3
L?B7 06LFGB70 :(COUB 3 NN3L?B 3 A5%:NB 3 K7:G’B30 1E2GVB73 JU.[4B73 IWC;IBB0
0
I)/6B70 :(B’IB73 IWC;IB73 JU.[4B 3 J0+2=816[BB0 1E2GVB 3 CD^\HB 3 O407PB7
06LF
GB70 :(CE3B 3 O407PB 3 CD^\HB 3 K*=/SB30 1E2GVB73 JK=(ZB73 IS!R(BB0 0I)/6B70
:(
BS?B73 IS!R(B73 JK=(ZB 3 I!*9T816@BB0 1E2GVB 3 CD^Y*B 3 O4 5<B7 06LFGB70
:(CE3
B 3 O4 5<B 3 CD^Y*B 3 K*’.:B30 1E2GVB73 JK=S(B73 IS@?8BB0 0I)/6B70 :(BS?B73
IS@
?8B73 JK=S(B 3 I!.,N816WBB0 1E2GVB 3 7;6HBB 3 M+)EYB7 06LFGB70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70 :-WJ.B 0 #=9A,B72 7U!_DB 2
7#
8%EB30 1E2GVB 2 6!7’>B 2 OG[R-B 0A\\>B 0 :(402B 2 OG[R-B 2 6!7’=B 2
LOWBI815+
BB0 1E2GVB72 7U@4.B 0 #’[B9B7 1@_T3B70 :-WJ.B 0 #’[$VB72 7U@4@B 2 7#6;FB30
1E2
GVB 2 6!6W[B 2 OG%_@B 0A\\>B 0 :(402B 2 OG%_@B 2 6!6W”B 2
LONPW8205UGCEN/63BB
0 1E2GVB 2 /OP?;B 2 E^’-^B7 03”9EBB1 0--]\B 2 /OP?;B 2 E^’-^B 2 WPE 8B30
1E2GV
B 2 >?T=1B 2 (69_\B 05SGSB31 1X@^2B 2 >?T=1B 2 (69_\B 2 &8_OS815^BB0 1E2GVB
3
Main Index
CHAPTER 18 1943
Support Files

7F2(EB 2 TWJLJB7 03”9EBB1 .8&&B 3 7F2(EB 2 TWJK$B 3 6DRGHB30 1E2GVB 3


95W4PB
2 ? N^7B 05SGSB31 :SC7B 3 95W4PB 2 ? N^7B 3 7% G/815[BB0 1E2GVB 3 7F2GCB 2
TWIY)B7 03”9EBB1 .8:LB 3 7F2GCB 2 TWIY)B 3 6DQ[>B30 1E2GVB 3 95V[9B 2 ? T#9B
05SGSB31 :SK]B 3 95V[9B 2 ? T#9B 3 7% AG815YBB0 1E2GVB72 7UY<LB 0 % FQ%B7 0
3”9EB70 :-^<5B 0 % FT#B72 7UY<LB 2 7”@-_B30 1E2GVB 2 6@:H2B 2 OG!.=B 05SGSB
0
:(4=GB 2 OG!.=B 2 6@:H2B 2 LOZ$<815$BB0 1E2GVB72 7UX%QB 0 #\^PLB7 03”9EB70
:-
^<5B 0 #\^T;B72 7UX%QB 2 7”?SXB30 1E2GVB 2 6@,%BB 2 OG&$(B 05SGSB 0 :(4=GB 2
OG&$(B 2 6@,%BB 2 LOSA-8205(GCEN/63BB0 1E2GVB 2 /ON/&B 2 E^/ZTB @):UB31
0M&T
<B 2 /ON/&B 2 E^/ZTB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TSK=[BB0 2TG+\B70 :(CFYB 1
TSK=[B72
X85””B 2 Y#,-JB30 1E2GVB72 IMY[DB 2 “X3,3B31 3”&)JB 0 :(DT1B 2 “X3,3B72
IMY[DB
3 4^/9B8206$GCEN/63BB0 1E2GVB72 H^L”SB 2 72)P5BB0 3>WR%B70 :(B23B 2 72)P5B72
H
^L”SB 2 N0TDGB30 1E2GVB71 P0X1JB 2 :38/LBB1 27!S6B70 :(DUWB 2 :38/LB71 P0X1JB
2
<PPY8815PBB0 1E2GVB71 (PG6[B 2 B]$=OBB0 3>WR%B70 :(9$BB 2 B]$=OB71 (PG6[B 2
ER
7BZB30 1E2GVB 2 C#)G[B 2 !S*SWBB1 27!S6B70 :(DT1B 2 !S*SWB 2 C#)G[B 2
;]L7M815R
BB0 1E2GVB71 (P7HQB 2 B]-;RBB0 3>WR%B70 :(9$BB 2 B]-;RB71 (P7HQB 2 ER9-HB30
1E2
GVB 2 C#)IPB 2 !S”1&BB1 27!S6B70 :(DT1B 2 !S”1&B 2 C#)IPB 2 ;]L)(8153BB0
1E2GVB
72 X84FMB 1 TT9Z_BB0 3>WR%B70 :(B”%B 1 TT9Z_B72 X84FMB 2 Y#:6’B30 1E2GVB72
IM/#
(B 2 “X21ZBB1 27!S6B70 :(DUWB 2 “X21ZB72 IM/#(B 3 4^/BQ8151BB0 1E2GVB72 X85CSB
1 TS-_”BB0 3>WR%B70 :(B”%B 1 TS-_”B72 X85CSB 2 Y#;AKB30 1E2GVB72 IM/&7B 2
“X1PK
BB1 27!S6B70 :(DUWB 2 “X1PKB72 IM/&7B 3 4^/7=8206”GCEN/63BB0 1E2GVB72 H^K>ZB 2
72=86BB0 4Y_>CB70 :(A’DB 2 72=86B72 H^K>ZB 2 N0T)$B30 1E2GVB71 P12-ZB 2
:37:9B3
0 0<!&4B 0 :(D5BB 2 :37:9B71 P12-ZB 2 <PQZ.815RBB0 1E2GVB71 (P3K6B 2 B]-V=BB0
4
Y_>CB70 :(90QB 2 B]-V=B71 (P3K6B 2 ER92%B30 1E2GVB 2 C#/FVB 2 !S*W\B30 0<!&4B
0
:(C_”B 2 !S*W\B 2 C#/FVB 2 ;]MML815TBB0 1E2GVB71 (P1Y6B 2 B](V%BB0 4Y_>CB70
:(
90QB 2 B](V%B71 (P1Y6B 2 ER9@&B30 1E2GVB 2 C#$UKB 2 !S=”FB30 0<!&4B 0 :(C_”B 2
!S=”FB 2 C#$UKB 2 ;]K: 8155BB0 1E2GVB72 X83!0B 1 TTF3(BB0 4Y_>CB70 :(BUNB 1
TTF
Main Index
CHAPTER 18 1945
Support Files

3(B72 X83!0B 2 Y#:2^B30 1E2GVB72 IM(W_B 2 “X0IYB30 0<!&4B 0 :(D9)B 2 “X0IYB72


I
M(W_B 3 4^/D)8153BB0 1E2GVB72 X841^B 1 TT4UOBB0 4Y_>CB70 :(BUNB 1 TT4UOB72
X841
^B 2 Y#;/@B30 1E2GVB72 IM-(.B 2 “X2GSB30 0<!&4B 0 :(D9)B 2 “X2GSB72 IM-(.B 3
4^
/L)8206@GCEN/63BB0 1E2GVB72 H^OGVB 2 72+$\B30 3+:SZB 0 :(BB B 2 72+$\B72
H^OGVB
2 N0T/6B30 1E2GVB71 P0’ABB 2 :37T;BB0 1H2.!B70 :(C_”B 2 :37T;B71 P0’ABB 2
<PO]
P815TBB0 1E2GVB71 (QEQTB 2 B]-D;B30 3+:SZB 0 :(9&/B 2 B]-D;B71 (QEQTB 2
ERD]=B3
0 1E2GVB 2 C##Q=B 2 !S”1&BB0 1H2.!B70 :(C>HB 2 !S”1&B 2 C##Q=B 2 ;]J>!815VBB0
1
E2GVB71 (Q>,KB 2 B]R$#B30 3+:SZB 0 :(9&/B 2 B]R$#B71 (Q>,KB 2 ER5OSB30 1E2GVB
2
C##?#B 2 !S%1[BB0 1H2.!B70 :(C>HB 2 !S%1[B 2 C##?#B 2 ;]L.-8157BB0 1E2GVB72
X8
3BZB 1 TR,$9B30 3+:SZB 0 :(B:*B 1 TR,$9B72 X83BZB 2 Y#”9^B30 1E2GVB72 IM*_HB 2
“X B%BB0 1H2.!B70 :(D3.^81UF^B 2 “X B%B72 IM*_HB 3 4^/W58155BB0 1E2GVB72
X7\:9B
1 TT#^RB30 3+:SZB 0 :(B:*B 1 TT#^RB72 X7\:9B 2 Y#%>;B30 1E2GVB72 IM”R4B 2
“W_1
[BB0 1H2.!B70 :(D3.B 2 “W_1[B72 IM”R4B 3 4^/L582072GCEN/63BB0 1E2GVB72 H^K RB
2
72/;FB30 4FR:NB 0 :(A:)B 2 72/;FB72 H^K RB 2 N0O]:B30 1E2GVB71 P1OPZB 2
:33]JB
7 >:[,B70 :(BM[B 2 :33]JB71 P1OPZB 2 <PN@L815VBB0 1E2GVB71 (OXJ2B 2 B]WQ.B30
4FR:NB 0 :(9FKB 2 B]WQ.B71 (OXJ2B 2 ER :=B30 1E2GVB 2 C#/QJB 2 !S.&JB7
>:[,B7
0 :(A:)B 2 !S.&JB 2 C#/QJB 2 ;]LZ’815XBB0 1E2GVB71 (O84VB 2 B]-N7B30 4FR:NB 0
:
(9FKB 2 B]-NVB71 (O84VB 2 ER4<,B30 1E2GVB 2 C#ZO’B 2 !S/>#B7 >:[,B70 :(A:)B
2
!S/>#B 2 C#ZO’B 2 ;]FQH8159BB0 1E2GVB72 X85ZYB 1 TS*G”B30 4FR:NB 0 :(B$KB 1
TS
*G”B72 X85ZYB 2 Y#;:,B30 1E2GVB72 IM*8NB 2 “W!65B7 >:[,B70 :(B”%B 2 “W!65B72
IM*8NB 3 4^$>”8157BB0 1E2GVB72 X87:5B 1 TR$05B30 4FR:NB 0 :(B$KB 1 TR$05B72
X87
:5B 2 Y#&_$B30 1E2GVB72 IM’TOB 2 “X0.-B7 >:[,B70 :(B”%B 2 “X0.-B72 IM’TOB 3
4
^/PC8207CGCEN/63BB0 1E2GVB72 H^EHEB 2 72)FPBB0 04S-5B70 :(D EB 2 72)FPB72
H^EHE
B 2 N0L_<B30 1E2GVB71 P2.AFB 2 :3 I&B30 1TC-JB 0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1E2GVB72 X83 (B 1 TSEX2B30 0;N,^B 0 :(C?&B 1
TSEX2B7
2 X83 (B 2 Y##X?B30 1E2GVB72 IM’WMB 2 “X3] B 0JV92B 0 :(A;9B 2 “X3] B72
IM’WM
Main Index
1946
Code Examples

B 3 4^/*J815BBB0 1E2GVB72 X81O4B 1 TS:__B30 0;N,^B 0 :(C?&B 1 TS:__B72 X81O4B


2
Y#%5-B30 1E2GVB72 IM”9ZB 2 “W?”[B 0JV92B 0 :(A;9B 2 “W?”[B72 IM”9ZB 3
4^$;C8
207WGCEN/63BB0 1E2GVB72 H^TMSB 2 72X]@B ‘+$TB 0 :(A1\B 2 72X]@B72 H^TMSB 2
N
0V3”B30 1E2GVB71 P MF;B 2 :3F$NB 0ZB?UB 0 :(9-9B 2 :3F$NB71 P MF;B 2
<PSW?815
/BB0 1E2GVB71 (Q’5TB 2 B]VJAB ‘+$TB 0 :(7_MB 2 B]VJAB71 (Q’5TB 2 ER88)B30
1E
2GVB 2 C#,=IB 2 !S;9/B 0ZB?UB 0 :(8’3B 2 !S;9/B 2 C#,=IB 2 ;]N[B815-BB0
1E2GV
B71 (R07?B 2 B]SMIB ‘+$TB 0 :(7_MB 2 B]SMIB71 (R07?B 2 ER6&>B30 1E2GVB 2
C#,
,NB 2 !S?-.B 0ZB?UB 0 :(8’3B 2 !S?-.B 2 C#,,NB 2 ;]SD>815FBB0 1E2GVB72
X8A@,B
1 TR-2YB ‘+$TB 0 :(B 4B 1 TR-2YB72 X8A@,B 2 Y#<B_B30 1E2GVB72 IMW-;B 2
“XAJ
IB 0ZB?UB 0 :(AG@B 2 “XAJIB72 IMW-;B 3 4^/++815DBB0 1E2GVB72 X88)”B 1 TS6M0B
‘+$TB 0 :(B 4B 1 TS6M0B72 X88)”B 2 Y#:”9B30 1E2GVB72 IMW!KB 2 “X5TLB
0ZB?U
B 0 :(AG@B 2 “X5TLB72 IMW!KB 3 4^/A68207’GCEN/63BB0 1E2GVB72 H^Q6^B 2 72/’>BB0
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X88H@B 2 Y#&.SB30 1E2GVB72 IMYC%B 2 “X5D.B7 _^6<B70 :(BV>B 2
“X
5D.B72 IMYC%B 3 4^/E$8208+GCEN/63BB0 1E2GVB72 H^I>2B 2 72%:;B31 1,RD:B 0
:(DQ2B
2 72%:;B72 H^I>2B 2 N0V@-B30 1E2GVB71 P0=”1B 2 :3B0JBB0 3!1:_B70 :(CK0B 2
:3B0
JB71 P0=”1B 2 <PSYM815.BB0 1E2GVB71 (N!$9B 2 B]’.^B31 1,RD:B 0 :(DL$B 2
B]’.^B7
1 (N!$9B 2 ER75_B30 1E2GVB 2 C#U5IB 2 !S#’4BB0 3!1:_B70 :(C28B 2 !S#’4B 2
C#U5I
B 2 ;]QV$815’BB0 1E2GVB71 (NOL%B 2 B]<GLB31 1,RD:B 0 :(DL$B 2 B]<GLB71 (NOL%B
2
ERF4.B30 1E2GVB 2 C#R;(B 2 !S)H,BB0 3!1:_B70 :(C28B 2 !S)H,B 2 C#R;(B 2
;]K\Q8
15IBB0 1E2GVB72 X87<$B 1 TUY8NB31 1,RD:B 0 :(DRYB 1 TUY8NB72 X87<$B 2 Y#^=1B30
1E2GVB72 IMTC%B 2 “X4I<BB0 3!1:_B70 :(CXQB 2 “X4I<B72 IMTC%B 3 4^$&@815KBB0
1E2
GVB72 X8B VB 1 TS,2DB31 1,RD:B 0 :(DRYB 1 TS,2DB72 X8B VB 2 Y#!WOB30 1E2GVB72
I
MQHOB 2 “XBJNBB0 3!1:_B70 :(CXQB 2 “XBJNB72 IMQHOB 3 4^/FK8208%GCEN/63BB0
1E2GV
B72 H^N*UB 2 72’\EBB0 07NKIB70 :(C_”B 2 72’\EB72 H^N*UB 2 N0WHDB30 1E2GVB71
P0<
Main Index
1948
Code Examples

>_B 2 :3B$4B 035[.B 0 :(A?-B 2 :3B$4B71 P0<>_B 2 <PT(P815’BB0 1E2GVB71 (O\


+B
2 B];A\BB0 07NKIB70 :(C-OB 2 B];A\B71 (O\ +B 2 ERK1”B30 1E2GVB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72 IM$(6B 3 4^/*=815GBB0
1E2GVB72
X84[$B 1 TSBSLBB0 1/-H;B70 :(C$PB 1 TSBSLB72 X84[$B 2 Y#&H-B30 1E2GVB72
IM/%#B
2 “X4.AB30 0Y<H2B 0 :(DE7B 2 “X4.AB72 IM/%#B 3 4^/S 82094GCEN/63BB0 1E2GVB72
H
^O\=B 2 72SG>BB0 =6>YB70 :(DC(B 2 72SG>B72 H^O\=B 2 N0M#%B30 1E2GVB71 P0?4SB
2
:37?8B7 (/V’B70 :(B[=B 2 :37?8B71 P0?4SB 2 <PQ1R815+BB0 1E2GVB71 (Q)8NB 2
B]
F LBB0 =6>YB70 :(D EB 2 B]F LB71 (Q)8NB 2 EQ@DPB30 1E2GVB 2 C#*+4B 2 !S>>XB7
(/V’B70 :(BXMB 2 !S>>XB 2 C#*+4B 2 ;]T0W815$BB0 1E2GVB71 (P#L!B 2 B]X7%BB0
=6
>YB70 :(D EB 2 B]X7%B71 (P#L!B 2 ER5?MB30 1E2GVB 2 C#-’UB 2 !S/ZNB7 (/V’B70
:
(BXMB 2 !S/ZNB 2 C#-’UB 2 ;]D?]815CBB0 1E2GVB72 X8241B 1 TSWF0BB0 =6>YB70
:(DI
/B 1 TSWF0B72 X8241B 2 Y##-4B30 1E2GVB72 IM#K:B 2 “W>K1B7 (/V’B70 :(CCZB 2
“W
>K1B72 IM#K:B 3 4^$%1815EBB0 1E2GVB72 X87[2B 1 TPUS1BB0 =6>YB70 :(DI/B 1
TPUS1
B72 X87[2B 2 Y#’YEB30 1E2GVB72 IM(X.B 2 “X94JB7 (/V’B70 :(CCZB 2 “X94JB72
IM(
X.B 3 4^+3’8209EGCEN/63BB0 1E2GVB72 H^C1RB 2 72.?=BB0 /W>’B70 :(DF-B 2
72.?=B7
2 H^C1RB 2 N0MT?B30 1E2GVB71 P3A!^B 2 :2]_=B30 0,<$]B 0 :(D6=B 2 :2]_=B71
P3A!^
B 2 <PM2-815$BB0 1E2GVB71 (M+Q^B 2 B]/.$BB0 /W>’B70 :(D3.B 2 B]/.$B71 (M+Q^B
2
EQ^WLB30 1E2GVB 2 C#H.AB 2 !SXF.B30 0,<$]B 0 :(D EB 2 !SXF.B 2 C#H.AB 2
;]G6\8
15YBB0 1E2GVB71 (M 0BB 2 B];YSBB0 /W>’B70 :(D3.B 2 B];YSB71 (M 0BB 2 ER7H8B30
1E2GVB 2 C#FDUB 2 !SR> B30 0,<$]B 0 :(D EB 2 !SR> B 2 C#FDUB 2 ;]BY[815ABB0
1E2
GVB72 X82A B 1 TU7TSBB0 /W>’B70 :(DL$B 1 TU7TSB72 X82A B 2 Y#<W4B30 1E2GVB72
I
M%KWB 2 “W:#SB30 0,<$]B 0 :(DB9B 2 “W:#SB72 IM%KWB 3 4^$= 815CBB0 1E2GVB72
X863
/B 1 TR;(.BB0 /W>’B70 :(DL$B 1 TR;(.B72 X863/B 2 Y#&4^B30 1E2GVB72 IM*H=B 2
“W
[.AB30 0,<$]B 0 :(DB9B 2 “W[.AB72 IM*H=B 3 4^/1M8209OGCEN/63BB0 1E2GVB72 H^D-
8B
2 72%].BB1 3O\NUB70 :(DL$B 2 72%].B72 H^D-8B 2 N0Q^*B30 1E2GVB71 P2XM5B 2
:2_F
Main Index
CHAPTER 18 1949
Support Files

)B 0&&3’B 0 :(93PB 2 :2_F)B71 P2XM<B 2 <PL5X815YBB0 1E2GVB71 (ND&FB 2


B],RIBB
1 3O\NUB70 :(DC(B 2 B],RIB71 (ND&FB 2 ERB/]B30 1E2GVB 2 C#TE9B 2 !SV/!B
0&&3’
B 0 :(7]?B 2 !SV/!B 2 C#TE9B 2 ;]B9/815WBB0 1E2GVB71 (N,]UB 2 B]’?0BB1
3O\NUB70
:(DC(B 2 B]’?0B71 (N,]UB 2 ER6,/B30 1E2GVB 2 C#T\/B 2 !S/\BB 0&&3’B 0
:(7]?B
2 !S/\BB 2 C#T_<B 2 ;]H738158BB0 1E2GVB72 X80<,B 1 TTK4%BB1 3O\NUB70 :(DOZB 1
TTK4%B72 X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RAB 0 :(A$FB 1 TSMGVB72 X85;]B 2 Y#,&”B30 1E2GVB72 IM$6^B 2
“X
3Q_B30 2]-%;B 0 :(C”<B 2 “X3Q_B72 IM$6^B 3 4^/CX8154BB0 1E2GVB72 X83FHB 1
TT7T>
B &$RAB 0 :(A$FB 1 TT7T>B72 X83FHB 2 Y#; 9B30 1E2GVB72 IMZ’(B 2 “X1$VB30
2]-
%;B 0 :(C”<B 2 “X1$VB72 IMZ’(B 3 4^/ 7820A0GCEN/63BB0 1E2GVB72 H^M$TB 2
72+=7B3
0 14+[QB 0 :(CUSB 2 72+=JB72 H^M$TB 2 N0S2%B30 1E2GVB71 P0ET=B 2 :3AR3B30
174X3
B 0 :(D0*B 2 :3AR3B71 P0ET=B 2 <PQPH815QBB0 1E2GVB71 (O][FB 2 B]$XKB30 14+[QB
0
Main Index
1950
Code Examples

:(B>DB 2 B]$XKB71 (O][FB 2 ER5(<B30 1E2GVB 2 C#’8QB 2 !S#CHB30 174X3B 0


:(C?&B
2 !S#CHB 2 C#’8QB 2 ;]MYG815OBB0 1E2GVB71 (P1^BB 2 B]Z]KB30 14+[QB 0 :(B>DB 2
B]Z]KB71 (P1^BB 2 ER5UPB30 1E2GVB 2 C#)=NB 2 !S#A,B30 174X3B 0 :(C?&B 2 !S#A,B
2 C#)=NB 2 ;]M=C8150BB0 1E2GVB72 X87+=B 1 TSK,-B30 14+[QB 0 :(C&;B 1 TSK,-B72
X
87+=B 2 Y#:VGB30 1E2GVB72 IMYN$B 2 “X47’B30 174X3B 0 :(D6=B 2 “X47’B72 IMYN$B
3
4^/8;8152BB0 1E2GVB72 X86!\B 1 TSRINB30 14+[QB 0 :(C&;B 1 TSRINB72 X86!\B 2
Y#
:9)B30 1E2GVB72 IMX:YB 2 “X4BOB30 174X3B 0 :(D6=B 2 “X4BOB72 IMX:YB 3
4^/6$820A
AGCEN/63BB0 1E2GVB72 R#,T)B 2 V##P2B31 1YU7-B 0 :(DW0B 2 V##P2B72 R#,T)B 2
:JQO
$B30 1E2GVB72 R<P$TB 2 VUV]EBB1 3H”QJB70 :(DT1B 2 VUV]EB72 R<P$TB 2
:8]^=8150BB
0 1E2GVB72 N87GUB 2 XHK37B31 1YU7-B 0 :(DW0B 2 XHK37B72 N87GUB 2 &<=LXB30
1E2GV
B72 ND*YOB 2 X04[[BB1 3H”QJB70 :(DRYB 2 X04[[B72 ND*YOB 2 &’X=\8151BB0
1E2GVB72
N87GUB 2 XHK3?B31 1YU7-B 0 :(DW0B 2 XHK3?B72 N87GUB 2 &<=LXB30 1E2GVB72
ND*/NB
2 X04&\BB1 3H”QJB70 :(DRYB 2 X04&\B72 ND*/NB 2 &’X+0814)BB0 1E2GVB72 WNT’:B 2
UEA”_B31 1YU7-B 0 :(DW0B 2 UEA”_B72 WNT’:B 2 >_E;LB30 1E2GVB72 WT5+XB 2
T^[[,BB
1 3H”QJB70 :(DT1B 2 T^[[,B72 WT5+XB 2 >;P^,814(BB0 1E2GVB72 WNT=$B 2 UEA”DB31
1
YU7-B 0 :(DW0B 2 UEA”DB72 WNT=$B 2 >_E;LB30 1E2GVB72 WT5ZYB 2 T^]4UBB1
3H”QJB70
:(DT1B 2 T^]4UB72 WT5ZYB 2 >;Q1G820AKGCEN/63BB0 1E2GVB72 R#,V@B 2 V##+SB30
>H
S?B 0 :(DL$B 2 V##+SB72 R#,V@B 2 :JQ-UB30 1E2GVB72 R<QVKB 2 VUVTQBB1 0ON’PB70
:
(DXVB 2 VUVTQB72 R<QVKB 2 :8^J28151BB0 1E2GVB72 N87C0B 2 XHK8LB30 >HS?B 0
:(DL
$B 2 XHK8LB72 N87C0B 2 &<=LXB30 1E2GVB72 ND#@9B 2 X03_:BB1 0ON’PB70 :(DXVB 2
X0
3_:B72 ND#@9B 2 &’Y*Y8153BB0 1E2GVB72 N873:B 2 XHKW]B30 >HS?B 0 :(DL$B 2
XHKW]
B72 N873:B 2 &<=-PB30 1E2GVB72 ND#!(B 2 X03?>BB1 0ON’PB70 :(DXVB 2 X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72 R#”0IB 2 V#%0XB30
0H
PT_B 0 :(DF-B 2 V#%0XB72 R#”0IB 2 :JN9SB30 1E2GVB72 R<W:(B 2 VUR##B30 3A1F@B 0
:(C/@B 2 VUR##B72 R<W:(B 2 :8\P98155BB0 1E2GVB72 N84RRB 2 XHK37B30 0HPT_B 0
:(D
F-B 2 XHK37B72 N84RRB 2 &<)2 B30 1E2GVB72 ND?4/B 2 X00^6B30 3A1F@B 0 :(CY[B 2
X
00^6B72 ND?4/B 2 &’/;”8157BB0 1E2GVB72 N84M_B 2 XHKF2B30 0HPT_B 0 :(DF-B 2
XHKF
Main Index
CHAPTER 18 1951
Support Files

2B72 N84M_B 2 &<)9SB30 1E2GVB72 ND?:HB 2 X \’4B30 3A1F@B 0 :(CY[B 2 X \’4B72


ND
?:HB 2 &’$NL814#BB0 1E2GVB72 WNN/!B 2 UEB_]B30 0HPT_B 0 :(DH6B 2 UEB_]B72
WNN/!
B 2 >_AY(B30 1E2GVB72 WTA$’B 2 T^>ZOB30 3A1F@B 0 :(C(?B 2 T^>ZOB72 WTA$’B 2
>;Q
/1814*BB0 1E2GVB72 WNN’NB 2 UEB&HB30 0HPT_B 0 :(DH6B 2 UEB&HB72 WNN’NB 2
>_ARCB
30 1E2GVB72 WT9:\B 2 T^@:=B30 3A1F@B 0 :(C(?B 2 T^@:=B72 WT9:\B 2
>;R>\820A,GCE
N/63BB0 1E2GVB72 R#%;6B 2 V#.KMB30 1^UE”B 0 :(C?&B 2 V#.KMB72 R#%;6B 2
:JMG:B30
1E2GVB72 R<U[RB 2 VUS66B30 1-!PDB 0 :(C_”B 2 VUS66B72 R<U[RB 2 :8_5.8157BB0
1E
2GVB72 N87,0B 2 XHJ:EB30 1^UE&B 0 :(C>HB 2 XHJ:EB72 N87,0B 2 &<=$QB30 1E2GVB72
ND<%PB 2 X \-<B30 1-!PDB 0 :(C[%B 2 X \-<B72 ND<%PB 2 &’Y)48159BB0 1E2GVB72
N8A
R8B 2 XHB:NB30 1^UE”B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 WTCR?B 2 T^?2=BB1 3’6.>B70 :(DT1B 2 T^?2=B72 WTCR?B 2
>;S(9820B6GCEN/63B
B0 1E2GVB72 R#”F^B 2 V#”5+BB0 1MH)^B70 :(D0*B 2 V#”5+B72 R#”F^B 2 :JL=$B30
1E2G
VB72 R<W,PB 2 VUR_ABB0 3DQ’&B70 :(C/@B 2 VUR_AB72 R<W,PB 2 :8\Y5815BBB0
1E2GVB7
2 N86^NB 2 XHD.KBB0 1MH)^B70 :(D EB 2 XHD.KB72 N86^NB 2 &</I5B30 1E2GVB72
ND>HB
B 2 X017HBB0 3DQ’&B70 :(CY[B 2 X017HB72 ND>HBB 2 &’/KR815DBB0 1E2GVB72 N849ZB
2
XHM9FBB0 1MH)^B70 :(D EB 2 XHM9FB72 N849ZB 2 &<‘”&B30 1E2GVB72 ND>;SB 2 X0
V*B
B0 3DQ’&B70 :(CY[B 2 X0 V*B72 ND>;SB 2 &’$I?814<BB0 1E2GVB72 WNL/0B 2 UEEU?BB0
1MH)^B70 :(D3.B 2 UEEU?B72 WNL/0B 2 >_A[UB30 1E2GVB72 WTBI>B 2 T^>;,BB0
3DQ’&B7
0 :(C(?B 2 T^>;,B72 WTBI>B 2 >;RPA814;BB0 1E2GVB72 WNON4B 2 UE61DBB0 1MH)^B70
:
(D3.B 2 UE61DB72 WNON4B 2 >_67XB30 1E2GVB72 WTA%/B 2 T^@RMBB0 3DQ’&B70 :(C(?B
2
T^@RMB72 WTA%/B 2 >;SK&820BGGCEN/63BB0 1E2GVB72 R#@0JB 2 V#%1HBB0 13?]/B70
:(D
5BB 2 V#%1HB72 R#@0JB 2 :JV)LB30 1E2GVB72 R<K?SB 2 VUWS0BB0 2HME9B70 :(C;JB 2
V
UWS0B72 R<K?SB 2 :8@O.815DBB0 1E2GVB72 N8C *B 2 XHIW2BB0 13?]/B70 :(D3.B 2
XHIW
2B72 N8C *B 2 &<*%VB30 1E2GVB72 ND.JQB 2 X041YBB0 2HME9B70 :(C&;B 2 X041YB72
ND
.JQB 2 &’V>G815FBB0 1E2GVB72 N8AA#B 2 XHO0SBB0 13?]/B70 :(D3.B 2 XHO0SB72
N8AA#
B 2 &<&J B30 1E2GVB72 ND.9”B 2 X04T>BB0 2HME9B70 :(C&;B 2 X04T>B72 ND.9”B 2
&’W
Main Index
1952
Code Examples

88814?BB0 1E2GVB72 WN$1-B 2 UEDZGBB0 13?]/B70 :(D6=B 2 UEDZGB72 WN$1-B 2


>_M%^B
30 1E2GVB72 WS_RVB 2 T^^<“BB0 2HME9B70 :(C>HB 2 T^^<“B72 WS_RVB 2 >;KO)814<BB0
1E2GVB72 WN/<6B 2 UE82>BB0 13?]/B70 :(D6=B 2 UE82>B72 WN/<6B 2 >_J)HB30
1E2GVB7
2 WS_$RB 2 T^^Q9BB0 2HME9B70 :(C>HB 2 T^^Q9B72 WS_$RB 2 >;K9#820BQGCEN/63BB0
1E
2GVB72 R#:..B 2 V#,RWB31 2Y_C!B 0 :(DUWB 2 V#,RWB72 R#:..B 2 :JU\8B30 1E2GVB72
R<NV5B 2 VUV45B30 114X7B 0 :(D5BB 2 VUV45B72 R<NV5B 2 :8!QG815FBB0 1E2GVB72
N87
EFB 2 XHPS5B31 2Y_C!B 0 :(DT1B 2 XHPS5B72 N87EFB 2 &<%ESB30 1E2GVB72 ND*)5B 2
X
03W%B30 114X7B 0 :(D3.B 2 X03W%B72 ND*)5B 2 &’WV\815HBB0 1E2GVB72 N88QFB 2
XHL<
7B31 2Y_C!B 0 :(DT1B 2 XHL<7B72 N88QFB 2 &<*!RB30 1E2GVB72 ND*:HB 2 X02\VB30
11
4X7B 0 :(D3.B 2 X02\VB72 ND*:HB 2 &’W88814!BB0 1E2GVB72 WNYBAB 2 UEBQ[B31
2Y_C!
B 0 :(DUWB 2 UEBQ[B72 WNYBAB 2 >_JL!B30 1E2GVB72 WT1KLB 2 T^[-QB30 114X7B 0
:(D
6=B 2 T^[-QB72 WT1KLB 2 >;L] 814?BB0 1E2GVB72 WNX [B 2 UEF18B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.8BB30 1E2GVB72 ND% /B 2 X01
<B
B1 0*#2XB70 :(DXVB 2 X01 <B72 ND% /B 2 &’W59815LBB0 1E2GVB72 N88L1B 2 XHIH8BB1
(#]^B70 :(DXVB 2 XHIH8B72 N88L1B 2 &<‘/<B30 1E2GVB72 ND*.4B 2 X07]@BB1
0*#2XB7
0 :(DXVB 2 X07]@B72 ND*.4B 2 &’$ZG814_BB0 1E2GVB72 WN+<]B 2 UE6H+BB1 (#]^B70
:
(DXVB 2 UE6H+B72 WN+<]B 2 >_J12B30 1E2GVB72 WS[@KB 2 T_1’[BB1 0*#2XB70 :(DXVB
2
T_1’[B72 WS[@KB 2 >;MI<814]BB0 1E2GVB72 WN+3GB 2 UE8’LBB1 (#]^B70 :(DXVB 2
UE
8’LB72 WN+3GB 2 >_KNTB30 1E2GVB72 WS_AMB 2 T^[“?BB1 0*#2XB70 :(DXVB 2 T^[“?B72
WS_AMB 2 >;IN0820B@GCEN/63BB0 1E2GVB72 R#:?@B 2 V#”4>BB0 21*KOB70 :(C?&B 2
V#”4
>B72 R#:?@B 2 :JRF*B30 1E2GVB72 R<O9ZB 2 VUV!”B30 4>*GBB 0 :(CE3B 2 VUV!”B72
R<
O9ZB 2 :8[**815LBB0 1E2GVB72 N8B5+B 2 XHH<$BB0 21*KOB70 :(C:,B 2 XHH<$B72
N8B5+
B 2 &<.T2B30 1E2GVB72 ND.5GB 2 X08 +B30 4>*GBB 0 :(C85B 2 X08 +B72 ND.5GB 2
&’Z
KH815NBB0 1E2GVB72 N8A&VB 2 XHI,’BB0 21*KOB70 :(C:,B 2 XHI,’B72 N8A&VB 2
&<*2JB
30 1E2GVB72 ND”R0B 2 X00]MB30 4>*GBB 0 :(C85B 2 X00]MB72 ND”R0B 2 &’U%D815 BB0
1E2GVB72 WNU’9B 2 UEAJOBB0 21*KOB70 :(C!GB 2 UEAJOB72 WNU’9B 2 >_FI-B30
1E2GVB7
2 WT4E+B 2 T^?;>B30 4>*GBB 0 :(CIXB 2 T^?;>B72 WT4E+B 2 >;M3]814_BB0 1E2GVB72
W
Main Index
CHAPTER 18 1953
Support Files

NU\HB 2 UE9N2BB0 21*KOB70 :(C!GB 2 UE9N2B72 WNU\HB 2 >_E%MB30 1E2GVB72 WT1@>B


2
T^\@6B30 4>*GBB 0 :(CIXB 2 T^\@6B72 WT1@>B 2 >;Q4E820C2GCEN/63BB0 1E2GVB72
R#O
%ZB 2 V#@LFBB0 ;^K4B70 :(DN4B 2 V#@LFB72 R#O%ZB 2 :JCWTB30 1E2GVB72 R<;<JB 2
V
UK[PBB0 47/9\B70 :(COUB 2 VUK[PB72 R<;<JB 2 :98UN815NBB0 1E2GVB72 N7!5 B 2
XHMO
@BB0 ;^K4B70 :(DL$B 2 XHMO@B72 N7!5 B 2 &<X\VB30 1E2GVB72 ND_6XB 2 X \KTBB0
47
/9\B70 :(CK0B 2 X \KTB72 ND_6XB 2 &’(M9815MBB0 1E2GVB72 N7?17B 2 XHS(\BB0
;^K4
B70 :(DL$B 2 XHS(\B72 N7?17B 2 &</\,B30 1E2GVB72 ND_;\B 2 X ^BNBB0 47/9\B70
:(C
K0B 2 X ^BNB72 ND_;\B 2 &’+\E814\BB0 1E2GVB72 WM@S7B 2 UEQG7BB0 ;^K4B70
:(DN4B
2 UEQG7B72 WM@S7B 2 >^]W1B30 1E2GVB72 WT’$5B 2 T^=V/BB0 47/9\B70 :(CRTB 2
T^=V
/B72 WT’$<B 2 >;*A8815 BB0 1E2GVB72 WM[W B 2 UEK01BB0 ;^K4B70 :(DN4B 2
UEK01B7
2 WM[W B 2 >^?^2B30 1E2GVB72 WT)>(B 2 T^*-]BB0 47/9\B70 :(CRTB 2 T^*-]B72
WT)>(
B 2 >;”P6820CCGCEN/63BB0 1E2GVB72 R#:SJB 2 V#&)/B30 2=1,^B 0 :(C*LB 2 V#&)/B72
R#:SJB 2 :JU40B30 1E2GVB72 R<N9UB 2 VUWIKB7 0HB];B70 :(A(“B 2 VUWIKB72 R<N9UB
2 :8[C]815MBB0 1E2GVB72 N86*TB 2 XHN;2B30 2=1,^B 0 :(C=>B 2 XHN;2B72 N86*TB 2
&
<“I%B30 1E2GVB72 ND*\.B 2 X014JB7 0HB];B70 :(AS;B 2 X014JB72 ND*\.B 2
&’UY;815
KBB0 1E2GVB72 N87C%B 2 XHMKQB30 2=1,^B 0 :(C=>B 2 XHMKQB72 N87C%B 2 &<*L’B30
1E
2GVB72 ND=+*B 2 X08G#B7 0HB];B70 :(AS;B 2 X08G#B72 ND=+*B 2 &’Z8M814^BB0
1E2GV
B72 WNYC)B 2 UEBVOB30 2=1,^B 0 :(C%KB 2 UEBVOB72 WNYC)B 2 >_JQNB30 1E2GVB72
WT0
L0B 2 T_ V+B7 0HB];B70 :(A%AB 2 T_ V+B72 WT0L0B 2 >;PD6814\BB0 1E2GVB72
WNX*MB
2 UEC\0B30 2=1,^B 0 :(C%KB 2 UEC\0B72 WNX*MB 2 >_KEXB30 1E2GVB72 WT2*0B 2
T^@J
!B7 0HB];B70 :(A%AB 2 T^@J!B72 WT2*0B 2 >;L9:820CMGCEN/63BB0 1E2GVB72 R% .&B
2
V#.D(B30 1_ <CB 0 :(C?&B 2 V#.D(B72 R% .&B 2 :JY,WB30 1E2GVB72 R<C$\B 2
VU/[BB
B0 0%=C’B70 :(D9)B 2 VU/[BB72 R<C$\B 2 :8>C-815KBB0 1E2GVB72 N89<@B 2 XHNIGB30
1_ <CB 0 :(C>HB 2 XHNIGB72 N89<@B 2 &<%QNB30 1E2GVB72 ND’GHB 2 X06@5BB0
0%=C’B7
0 :(D8AB 2 X06@5B72 ND’GHB 2 &’W&>815IBB0 1E2GVB72 N8B\\B 2 XHG,WB30 1_ <CB 0
:
(C>HB 2 XHG,WB72 N8B\\B 2 &<.C)B30 1E2GVB72 ND)=&B 2 X08/+BB0 0%=C’B70 :(D8AB
2
X08/+B72 ND)=&B 2 &’X!O814[BB0 1E2GVB72 WN<Z=B 2 UE19&B30 1_ <CB 0 :(C!GB 2
UE
19&B72 WN<Z=B 2 >_RW]B30 1E2GVB72 WS”@[B 2 T_4_1BB0 0%=C’B70 :(D9)B 2 T_4_1B72
WS”@[B 2 >;E-6814^BB0 1E2GVB72 WN;Q/B 2 UE7)XB30 1_ <CB 0 :(C!GB 2 UE7)XB72
WN;
Q/B 2 >_VA@B30 1E2GVB72 WS#TRB 2 T_3E%BB0 0%=C’B70 :(D9)B 2 T_3E%B72 WS#TRB 2
>
;D(W820CWGCEN/63BB0 1E2GVB72 R#>;ZB 2 V#”U]BB0 1)3OFB70 :(C_”B 2 V#”U]B72
R#>;Z
B 2 :JTF?B30 1E2GVB72 R<LM#B 2 VUXY2B _.YNB 0 :(BJ]B 2 VUXY2B72 R<LM#B 2
:8!
%-815IBB0 1E2GVB72 N87KDB 2 XHHVDBB0 1)3OFB70 :(C[%B 2 XHHVDB72 N87KDB 2
&<)3VB
30 1E2GVB72 ND*7$B 2 X08KUB _.YNB 0 :(BCUB 2 X08KUB72 ND*7$B 2 &’$R;815GBB0
1E2GVB72 N852[B 2 XHONYBB0 1)3OFB70 :(C[%B 2 XHONYB72 N852[B 2 &<*W6B30
1E2GVB7
2 ND#QLB 2 X01M]B _.YNB 0 :(BCUB 2 X01M]B72 ND#QLB 2 &’V_.814@BB0 1E2GVB72
W
N+IAB 2 UEBU(BB0 1)3OFB70 :(C_”B 2 UEBU(B72 WN+IAB 2 >_M\NB30 1E2GVB72 WS_/]B
2
T^[%MB _.YNB 0 :(BROB 2 T^[%MB72 WS_/]B 2 >;I&:814[BB0 1E2GVB72 WN($CB 2
UE
4/$BB0 1)3OFB70 :(C_”B 2 UE4/$B72 WN($CB 2 >_J41B30 1E2GVB72 WS]J9B 2 T_1*!B
Main Index
1954
Code Examples

_.YNB 0 :(BROB 2 T_1*!B72 WS]J9B 2 >;M*’820C’GCEN/63BB0 1E2GVB72 R#%1BB 2


V#&$
NBB0 06R)IB70 :(DI/B 2 V#&$NB72 R#%1BB 2 :JQF(B30 1E2GVB72 R<TCAB 2 VUR[]B
09
\05B 0 :(A!7B 2 VUR[]B72 R<TCAB 2 :8]TO815GBB0 1E2GVB72 N89EPB 2 XHKYQBB0
06R)I
B70 :(DI/B 2 XHKYQB72 N89EPB 2 &<*NAB30 1E2GVB72 ND”A-B 2 X04DTB 09\05B 0
:(A
“=B 2 X04DTB72 ND”A-B 2 &’XZ1815EBB0 1E2GVB72 N893DB 2 XHL3^BB0 06R)IB70
:(DI/B
2 XHL3^B72 N893DB 2 &<**WB30 1E2GVB72 ND#]7B 2 X \@\B 09\05B 0 :(A”=B 2 X
\@
\B72 ND#]7B 2 &’U7\814>BB0 1E2GVB72 WNM;\B 2 UEE+KBB0 06R)IB70 :(DK5B 2
UEE+KB7
2 WNM;\B 2 >_C6UB30 1E2GVB72 WTCD*B 2 T^;-(B 09\05B 0 :(B0ZB 2 T^;-(B72
WTCD*
B 2 >;PU\814@BB0 1E2GVB72 WNM\QB 2 UEE4,BB0 06R)IB70 :(DK5B 2 UEE4,B72 WNM\QB
2
>_B;6B30 1E2GVB72 WTASUB 2 T^@_-B 09\05B 0 :(B0ZB 2 T^@_-B72 WTASUB 2
>;SW.8
20C:GCEN/63BB0 1E2GVB72 R#)’OB 2 V#%1HB30 2V+<PB 0 :(C%KB 2 V#%1HB72 R#)’OB 2
:
JJU0B30 1E2GVB72 R<$_7B 2 VUO.YB30 1Q+0ZB 0 :(D EB 2 VUO.YB72 R<$_7B 2 :9
DJ815
EBB0 1E2GVB72 N84UQB 2 XHN)MB30 2V+<PB 0 :(C*LB 2 XHN)MB72 N84UQB 2 &<.L/B30
1E
2GVB72 ND>X$B 2 X ](MB30 1Q+0ZB 0 :(C_”B 2 X ](MB72 ND>X$B 2 &’WY_815CBB0
1E2GV
B72 N8896B 2 XHCX:B30 2V+<PB 0 :(C*LB 2 XHCX:B72 N8896B 2 &</C8B30 1E2GVB72
ND:
T.B 2 X01!^B30 1Q+0ZB 0 :(C_”B 2 X01!^B72 ND:T.B 2 &’$$#814:BB0 1E2GVB72
WNE>NB
2 U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 2 V#*L[B72 R#.]#B 2
:JJ@<B
30 1E2GVB72 R<ZQ1B 2 VUR’XBB0 4QHVJB70 :(CK0B 2 VUR’XB72 R<ZQ1B 2 :90W#815ABB0
1E2GVB72 N84”3B 2 XHC<]BB0 25]A5B70 :(C;JB 2 XHC<]B72 N84”3B 2 &<Y”BB30
1E2GVB7
2 ND]<KB 2 X00WYBB0 4QHVJB70 :(CFYB 2 X00WYB72 ND]<KB 2 &’)JF8158BB0 1E2GVB72
N
81(-B 2 XHMCDBB0 25]A5B70 :(C;JB 2 XHMCDB72 N81(-B 2 &<(“(B30 1E2GVB72 ND^>@B
2
X _R6BB0 4QHVJB70 :(CFYB 2 X _R6B72 ND^>@B 2 &’-K$814%BB0 1E2GVB72 WNL9RB 2
UE
D<@BB0 25]A5B70 :(C?&B 2 UED<@B72 WNL9RB 2 >_9\@B30 1E2GVB72 WTA\ B 2 T^>>1BB0
4QHVJB70 :(COUB 2 T^>>1B72 WTA\ B 2 >;R8&814,BB0 1E2GVB72 WNOE@B 2 UE4V+BB0
25]
A5B70 :(C?&B 2 UE4V+B72 WNOE@B 2 >_4.-B30 1E2GVB72 WT9^RB 2 T^!]TBB0 4QHVJB70
:
Main Index
CHAPTER 18 1955
Support Files

(COUB 2 T^!]TB72 WT9^RB 2 >;S[1820DIGCEN/63BB0 1E2GVB72 R#*L:B 2 V#&RRBB0


1/UF&
B70 :(C_”B 2 V#&RRB72 R#*L:B 2 :JN>9B30 1E2GVB72 R<XK’B 2 VUSX’BB0 2]%T<B70
:(C
‘NB 2 VUSX’B72 R<XK’B 2 :9 W’8158BB0 1E2GVB72 N82]KB 2 XHKJXBB0 1/UF&B70
:(C^FB
2 XHKJXB72 N82]KB 2 &<(3QB30 1E2GVB72 ND@)AB 2 X00G@BB0 2]%T<B70 :(C/@B 2
X00G
@B72 ND@)AB 2 &’+U]8156BB0 1E2GVB72 N81;2B 2 XHN*4BB0 1/UF&B70 :(C^FB 2
XHN*4B7
2 N81;2B 2 &<‘FUB30 1E2GVB72 ND@/SB 2 X00S;BB0 2]%T<B70 :(C/@B 2 X00S;B72
ND@/S
B 2 &’++O814”BB0 1E2GVB72 WNN#/B 2 UEEY/BB0 1/UF&B70 :(D EB 2 UEEY/B72 WNN#/B
2
>_C?)B30 1E2GVB72 WT9\’B 2 T^@,SBB0 2]%T<B70 :(C=>B 2 T^@,SB72 WT9\’B 2
>;R^]8
14%BB0 1E2GVB72 WNO?>B 2 UEB92BB0 1/UF&B70 :(D EB 2 UEB92B72 WNO?>B 2 >_A]\B30
1E2GVB72 WTA2PB 2 T^@+XBB0 2]%T<B70 :(C=>B 2 T^@+XB72 WTA2PB 2
>;R>\820DSGCEN/6
3BB0 1E2GVB72 R#&!9B 2 V#&K”BB0 0B*6QB70 :(DH6B 2 V#&K”B72 R#&!9B 2 :JR)2B30
1E
2GVB72 R<R6;B 2 VUV16BB0 0O*]GB70 :(DF-B 2 VUV16B72 R<R6;B 2 :8^R\8156BB0
1E2GV
B72 N85@ZB 2 XHM<CBB0 0B*6QB70 :(DH6B 2 XHM<CB72 N85@ZB 2 &<.&!B30 1E2GVB72
ND&
77B 2 X02SDBB0 0O*]GB70 :(DE7B 2 X02SDB72 ND&77B 2 &’YL.8154BB0 1E2GVB72
N86K8B
2 XHLX#BB0 0B*6QB70 :(DH6B 2 XHLX#B72 N86K8B 2 &<=[&B30 1E2GVB72 ND%V(B 2
X04K
ABB0 0O*]GB70 :(DE7B 2 X04KAB72 ND%V(B 2 &’ZX.814.BB0 1E2GVB72 WNT[TB 2 UEB<
BB
0 0B*6QB70 :(DI/B 2 UEB< B72 WNT[TB 2 >_F^MB30 1E2GVB72 WT56VB 2 T^]/GBB0
0O*]G
B70 :(DF-B 2 T^]/GB72 WT56VB 2 >;Q4E814”BB0 1E2GVB72 WNTU9B 2 UED8SBB0
0B*6QB70
:(DI/B 2 UED8SB72 WNTU9B 2 >_G.1B30 1E2GVB72 WT5””B 2 T^!”2BB0 0O*]GB70 :(DF-
B
2 T^!”2B72 WT5””B 2 >;P1B820D+GCEN/63BB0 1E2GVB72 R#,/6B 2 V#%8”BB1 4SU_4B70
:
(DRYB 2 V#%8”B72 R#,/6B 2 :JR8GB30 1E2GVB72 R<PSGB 2 VUWB-B30 ‘I7/B 0 :(DQ2B
2
VUWB-B72 R<PSGB 2 :8^488154BB0 1E2GVB72 N86UZB 2 XHLR2BB1 4SU_4B70 :(DRYB 2
XH
LR2B72 N86UZB 2 &<=_%B30 1E2GVB72 ND*”JB 2 X05HGB30 ‘I7/B 0 :(DOZB 2 X05HGB72
ND*”JB 2 &’YBG8152BB0 1E2GVB72 N86”^B 2 XHK)?BB1 4SU_4B70 :(DRYB 2 XHK)?B72
N86
“^B 2 &<=UTB30 1E2GVB72 ND*[EB 2 X04.%B30 ‘I7/B 0 :(DOZB 2 X04.%B72 ND*[EB 2
&
‘X&]814’BB0 1E2GVB72 WNU’!B 2 UEA>QBB1 4SU_4B70 :(DRYB 2 UEA>QB72 WNU’!B 2
>_F%
RB30 1E2GVB72 WT5ADB 2 T^]6*B30 ‘I7/B 0 :(DQ2B 2 T^]6*B72 WT5ADB 2
>;P*@814.BB
0 1E2GVB72 WNUP%B 2 UEB-/BB1 4SU_4B70 :(DRYB 2 UEB-/B72 WNUP%B 2 >_GC#B30
1E2GV
B72 WT4\IB 2 T^]=DB30 ‘I7/B 0 :(DQ2B 2 T^]=DB72 WT4\IB 2 >;Q1G820D%GCEN/63BB0
1E2GVB72 R#;IZB 2 V##J:BB1 05X+_B70 :(DXVB 2 V##J:B72 R#;IZB 2 :JR0;B30
1E2GVB7
2 R<O&2B 2 VUWFLB31 1B[R!B 0 :(DW0B 2 VUWFLB72 R<O&2B 2 :8]WN8152BB0 1E2GVB72
N
88BLB 2 XHK95BB1 05X+_B70 :(DXVB 2 XHK95B72 N88BLB 2 &<.BAB30 1E2GVB72 ND.2HB
2
X05NEB31 1B[R!B 0 :(DW0B 2 X05NEB72 ND.2HB 2 &’W>K8150BB0 1E2GVB72 N88L1B 2
XH
J=IBB1 05X+_B70 :(DXVB 2 XHJ=IB72 N88L1B 2 &<=?,B30 1E2GVB72 ND.0,B 2 X05R.B31
1B[R!B 0 :(DW0B 2 X05R.B72 ND.0,B 2 &’W!J814(BB0 1E2GVB72 WNUP%B 2 UEAU$BB1
05X
+_B70 :(DXVB 2 UEAU$B72 WNUP%B 2 >_FC’B30 1E2GVB72 WT5V:B 2 T^]5_B31 1B[R!B 0
:
(DW0B 2 T^]5_B72 WT5V:B 2 >;Q %814’BB0 1E2GVB72 WNUG4B 2 UEA^NBB1 05X+_B70
:(DX
VB 2 UEA^NB72 WNUG4B 2 >_FW2B30 1E2GVB72 WT5XJB 2 T^]1VB31 1B[R!B 0 :(DW0B 2
T^
Main Index
1956
Code Examples

]1VB72 WT5XJB 2 >;P^,820D[GCEN/63BB0 1E2GVB72 VHR”SB 2 V56=!B30 %AGQB 0


:(DOZB
2 V56=!B72 VHR”SB 2 >#WUCB30 1E2GVB72 U[]Y$B 2 W97.%B31 2_XUPB 0 :(DT1B 2
W97.
%B72 U[]Y$B 2 ?N8GE814(BB0 1E2GVB72 WB=G4B 2 U&@>UB30 %AGQB 0 :(DOZB 2
U&@>UB7
2 WB=G4B 2 ?H/6 B30 1E2GVB72 V<AP B 2 V<[1%B31 2_XUPB 0 :(DT1B 2 V<[1%B72 V<AP
B 2 ?@*K]814)BB0 1E2GVB72 WB=RGB 2 U&@JTB30 %AGQB 0 :(DOZB 2 U&@JTB72 WB=RGB
2
?H$,-B30 1E2GVB72 V<AXBB 2 V<!+CB31 2_XUPB 0 :(DT1B 2 V<!+CB72 V<AXBB 2
?@*618
14HBB0 1E2GVB72 UNCDZB 2 VOKY4B30 %AGQB 0 :(DOZB 2 VOKY4B72 UNCDZB 2 >D>= B30
1E2GVB72 U0..9B 2 WSLN0B31 2_XUPB 0 :(DT1B 2 WSLN0B72 U0..9B 2 ><\I1814GBB0
1E2
GVB72 UNC2OB 2 VOL4LB30 %AGQB 0 :(DOZB 2 VOL4LB72 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 WSJD[B72 U0#.OB 2 ><\\”814LBB0 1E2GVB72 UN9H;B 2 VOKN(B30 0LH,GB 0 :(DF-B
2
VOKN(B72 UN9H;B 2 >D:17B30 1E2GVB72 U0#”-B 2 WSJ7DB30 14GXFB 0 :(D6=B 2
WSJ7DB
72 U0#”-B 2 ><\[G820EYGCEN/63BB0 1E2GVB72 VHM(7B 2 V56@$BB0 ‘R@?B70 :(DQ2B 2
V
Main Index
CHAPTER 18 1957
Support Files

56@$B72 VHM(7B 2 >#SF B30 1E2GVB72 U] RQB 2 W94V?B30 1X5 MB 0 :(D0*B 2


W94V?B72
U] RQB 2 ?N8<U814#BB0 1E2GVB72 WB+8GB 2 U&>;MBB0 ‘R@?B70 :(DQ2B 2 U&>;MB72
WB
+8GB 2 ?HU>)B30 1E2GVB72 V<C:*B 2 V<@,2B30 1X5 MB 0 :(D0*B 2 V<@,2B72 V<C:*B 2
?@”MV814&BB0 1E2GVB72 WB$(@B 2 U&]LBBB0 ‘R@?B70 :(DQ2B 2 U&]LBB72 WB$(@B 2
?HX
S2B30 1E2GVB72 V<E2CB 2 V<<57B30 1X5 MB 0 :(D0*B 2 V<<57B72 V<E2CB 2
?@.DP814PB
B0 1E2GVB72 UN77\B 2 VON HBB0 ‘R@?B70 :(DQ2B 2 VON HB72 UN77\B 2 >D:QTB30
1E2G
VB72 U0,2@B 2 WSGFBB30 1X5 MB 0 :(D0*B 2 WSGFBB72 U0,2@B 2 ><\MV814NBB0
1E2GVB7
2 UN8(5B 2 VOITSBB0 ‘R@?B70 :(DQ2B 2 VOITSB72 UN8(5B 2 >D&,4B30 1E2GVB72
U0%;!
B 2 WSJ]NB30 1X5 MB 0 :(D0*B 2 WSJ]NB72 U0%;!B 2 >>0$3820E.GCEN/63BB0 1E2GVB72
VHG*-B 2 V59ZBB31 2MEC=B 0 :(DUWB 2 V59ZBB72 VHG*-B 2 >#PQ=B30 1E2GVB72 U]4\;B
2 W92=(BB0 =05:B70 :(DQ2B 2 W92=(B72 U]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WSPR&B72 U0+7^B 2 ><^E!820F(GCEN/63BB0 1E2GVB72 VHQVUB 2
V58F#B
B1 36 “ B70 :(DT1B 2 V58F#B72 VHQVUB 2 >#W%4B30 1E2GVB72 U[]&UB 2 W983>BB0
1.+#
8B70 :(C_”B 2 W983>B72 U[]&UB 2 ?N8,V814_BB0 1E2GVB72 WB=!;B 2 U&!R BB1 36 “
B7
0 :(DT1B 2 U&!R B72 WB=!;B 2 ?H+AYB30 1E2GVB72 V<81#B 2 V<!>/BB0 1.+#8B70
:(C_”
B 2 V<!>/B72 V<81#B 2 ?@=8>815 BB0 1E2GVB72 WB=:/B 2 U&!.?BB1 36 “ B70 :(DT1B
2
U&!.?B72 WB=:/B 2 ?H+JUB30 1E2GVB72 V<797B 2 V<^$BBB0 1.+#8B70 :(C_”B 2
V<^$BB
72 V<797B 2 ?@...814-BB0 1E2GVB72 UN959B 2 VON5FBB1 36 “ B70 :(DT1B 2 VON5FB72
UN959B 2 >D>B*B30 1E2GVB72 U0#Y.B 2 WSMH?BB0 1.+#8B70 :(C_”B 2 WSMH?B72 U0#Y.B
2 >>1Y(814/BB0 1E2GVB72 UN9AMB 2 VOM:6BB1 36 “ B70 :(DT1B 2 VOM:6B72 UN9AMB 2
>
D>2%B30 1E2GVB72 U0%RKB 2 WSJ$GBB0 1.+#8B70 :(C_”B 2 WSJ$GB72 U0%RKB 2 >>
[L820
F,GCEN/63BB0 1E2GVB72 VG@!\B 2 V5J9>B30 1C#L^B 0 :(D3.B 2 V5J9>B72 VG@!\B 2
>#D
3RB30 1E2GVB72 U]UYDB 2 W8_T6BB0 2U5.4B70 :(C;JB 2 W8_T6B72 U]UYDB 2 ?NTT”815
B
B0 1E2GVB72 WB6H&B 2 U,7-DB30 1C#L^B 0 :(D3.B 2 U,7-DB72 WB6H&B 2 ?HHW;B30
1E2G
VB72 V<“AZB 2 V<“AZBB0 2U5.4B70 :(C;JB 2 V<“AZB72 V<“AZB 2 ?!238814\BB0
1E2GVB7
2 WB7-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 1E2GVB72 UN5UBB 2 VOJ”’B30 0X%$TB 0 :(DE7B 2 VOJ”’B72 UN5UBB 2 >D%BGB30
1E
2GVB72 U0;,(B 2 WSJTZBB0 2^”=FB70 :(C=>B 2 WSJTZB72 U0;,(B 2 >>2=)814QBB0
1E2GV
B72 UN3;(B 2 VOO;WB30 0X%$TB 0 :(DE7B 2 VOO;WB72 UN3;(B 2 >D;A B30 1E2GVB72
U0<
C,B 2 WSFBOBB0 2^”=FB70 :(C=>B 2 WSFBOB72 U0<C,B 2 >>09E820H2GCEN/63BB0
1E2GVB7
2 VHP4$B 2 V561RBB0 “2/SB70 :(DOZB 2 V561RB72 VHP4$B 2 >#T/QB30 1E2GVB72
U[\9T
B 2 W961TBB0 2\;CKB70 :(C=>B 2 W961TB72 U[\9TB 2 ?N92@814%BB0 1E2GVB72 WB+(IB
2
U&@”IBB0 “2/SB70 :(DQ2B 2 U&@”IB72 WB+(IB 2 ?HW^%B30 1E2GVB72 V<FBDB 2
V<>).B
B0 2\;CKB70 :(C=>B 2 V<>).B72 V<FBDB 2 ?@”YQ814”BB0 1E2GVB72 WB+# B 2 U&@PQBB0
“2/SB70 :(DQ2B 2 U&@PQB72 WB+# B 2 ?HW%<B30 1E2GVB72 V<E/DB 2 V<@SRBB0
2\;CKB7
0 :(C=>B 2 V<@SRB72 V<E/DB 2 ?@#/T814MBB0 1E2GVB72 UNBW>B 2 VOJJ6BB0 “2/SB70
:
(DOZB 2 VOJJ6B72 UNBW>B 2 >D<1CB30 1E2GVB72 U0*9DB 2 WSLPFBB0 2\;CKB70 :(C=>B
2
WSLPFB72 U0*9DB 2 ><\.>814OBB0 1E2GVB72 UNBPQB 2 VOJ-_BB0 “2/SB70 :(DOZB 2
VO
Main Index
CHAPTER 18 1961
Support Files

J-_B72 UNBPQB 2 >D<B(B30 1E2GVB72 U0*”TB 2 WSJ-FBB0 2\;CKB70 :(C=>B 2 WSJ-FB72


U0*”TB 2 ><_),820HCGCEN/63BB0 1E2GVB72 V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VQ! WBB1 4-A=MB70 :(DRYB 2 VQ! WB72
UMBY
%B 2 >FECM8149BB0 1E2GVB72 US+VKB 2 V;K_/BB0 )NB)B70 :(DQ2B 2 V;K_/B72 US+VKB
2 >’2*’B30 1E2GVB72 U+6\0B 2 VL(/$BB1 4-A=MB70 :(DRYB 2 VL(/$B72 U+6\0B 2
>OO77
8147BB0 1E2GVB72 US+PMB 2 V;LGDBB0 )NB)B70 :(DQ2B 2 V;LGDB72 US+PMB 2
>’2!/B30
1E2GVB72 U+7I?B 2 VL-/VBB1 4-A=MB70 :(DRYB 2 VL-/VB72 U+7I?B 2
>ONX?820J4GCEN/
63BB0 1E2GVB72 UKFQDB 2 V>6G:BB0 0N7@VB70 :(DF-B 2 V>6G:B72 UKFQDB 2 >/HXEB30
1
E2GVB72 UUZ2.B 2 VO8D3BB0 ]1L4B70 :(DL$B 2 VO8D3B72 UUZ2.B 2 >K1)K814XBB0
1E2G
VB72 UCH%KB 2 V@”G0BB0 0N7@VB70 :(DF-B 2 V@”G0B72 UCH%KB 2 >W”$”B30 1E2GVB72
UM
$] B 2 VQ%5YBB0 ]1L4B70 :(DL$B 2 VQ%5YB72 UM$] B 2 >FSH?814ZBB0 1E2GVB72
UCH(7
B 2 V@”’<BB0 0N7@VB70 :(DF-B 2 V@”’<B72 UCH(7B 2 >W”<7B30 1E2GVB72 UM$$(B 2
VQ&
Main Index
1964
Code Examples

8/BB0 ]1L4B70 :(DL$B 2 VQ&8/B72 UM$$(B 2 >FS[6814BBB0 1E2GVB72 USD46B 2


V;UG9B
B0 0N7@VB70 :(DF-B 2 V;UG9B72 USD46B 2 >):_0B30 1E2GVB72 U+XB8B 2 VLWLKBB0
]1L
4B70 :(DL$B 2 VLWLKB72 U+XB8B 2 >O-Z48149BB0 1E2GVB72 USDCJB 2 V;T>4BB0
0N7@VB7
0 :(DF-B 2 V;T>4B72 USDCJB 2 >):”6B30 1E2GVB72 U+XXVB 2 VLVIGBB0 ]1L4B70
:(DL$
B 2 V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GVB72 UMG+7B 2 VQ>%TBB0 1P\?$B70 :(D0*B 2
VQ>%TB
72 UMG+7B 2 >FG$L813^BB0 1E2GVB72 USX’?B 2 V;L@SB32 11>0@B 0 :(DZ B 2 V;L@SB72
USX’?B 2 >’ N5B30 1E2GVB72 U+CM\B 2 VL+EKBB0 1P\?$B70 :(D2CB 2 VL+EKB72 U+CM\B
2 >OQ.X813\BB0 1E2GVB72 USXS*B 2 V;M/9B32 11>0@B 0 :(DZ B 2 V;M/9B72 USXS*B 2
>
‘ ;PB30 1E2GVB72 U+CXPB 2 VL/#1BB0 1P\?$B70 :(D2CB 2 VL/#1B72 U+CXPB 2
>OQQ(820
L6GCEN/63BB0 1E2GVB72 UKYE\B 2 V> ABB1 4S7&IB70 :(DRYB 2 V> AB72 UKYE\B 2
>/R
KZB30 1E2GVB72 UUF<MB 2 VOD:BBB0 0Z@8%B70 :(DC(B 2 VOD:BB72 UUF<MB 2
>J<\&814KB
B0 1E2GVB72 UCZXHB 2 V@-M]BB1 4S7&IB70 :(DRYB 2 V@-M]B72 UCZXHB 2 >W?,:B30
1E2G
Main Index
CHAPTER 18 1967
Support Files

VB72 UMI.\B 2 VQ<@$BB0 0Z@8%B70 :(DC(B 2 VQ<@$B72 UMI.\B 2 >FH(@814IBB0


1E2GVB7
2 UCZOLB 2 V@-”&BB1 4S7&IB70 :(DRYB 2 V@-”&B72 UCZOLB 2 >W@0EB30 1E2GVB72
UMI#D
B 2 VQ<&7BB0 0Z@8%B70 :(DC(B 2 VQ<&7B72 UMI#DB 2 >FH$Q813[BB0 1E2GVB72 USW^’B
2
V;M-OBB1 4S7&IB70 :(DRYB 2 V;M-OB72 USW^’B 2 >’ O$B30 1E2GVB72 U+C_*B 2
VL/#&B
B0 0Z@8%B70 :(DC(B 2 VL/#&B72 U+C_*B 2 >OQ;\813^BB0 1E2GVB72 USX47B 2 V;MFYBB1
4S7&IB70 :(DRYB 2 V;MFYB72 USX47B 2 >’ BAB30 1E2GVB72 U+C[“B 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XBB0 1E2GVB72 UYS>9B 2 VZN=8B31 0_P+TB 0 :(DXVB 2 VZN=8B72 UYS>9B 2
>XB1)
B30 1E2GVB72 UW0SIB 2 V’ZZ!B30 ‘M@*B 0 :(DQ2B 2 V’ZZ!B72 UW0SIB 2
>/K!I820L”GC
EN/63BB0 1E2GVB72 UY2”\B 2 VZW:#B31 2AJIEB 0 :(DUWB 2 VZW:#B72 UY2”\B 2
>W^Y;B3
0 1E2GVB72 UV()PB 2 V’==_B31 18V1 B 0 :(DW0B 2 V’==_B72 UV()PB 2 >/7U\813]BB0
1
E2GVB72 UX’J>B 2 VZ(%8B31 2AJIEB 0 :(DUWB 2 VZ(%8B72 UX’J>B 2 >W”O;B30
1E2GVB72
UVFVKB 2 V’;>FB31 18V1 B 0 :(DW0B 2 V’;>FB72 UVFVKB 2 >$@_9813_BB0 1E2GVB72
UX
Main Index
1968
Code Examples

‘D9B 2 VZ)3WB31 2AJIEB 0 :(DUWB 2 VZ)3WB72 UX’D9B 2 >W”$”B30 1E2GVB72 UVFPNB 2


V’:9-B31 18V1 B 0 :(DW0B 2 V’:9-B72 UVFPNB 2 >$!7/813/BB0 1E2GVB72 UYRA>B 2
VZO
!NB31 2AJIEB 0 :(DUWB 2 VZO!NB72 UYRA>B 2 >XA=JB30 1E2GVB72 UW1:DB 2 V’ZW]B31
1
8V1 B 0 :(DW0B 2 V’ZW]B72 UW1:DB 2 >/M0:813ZBB0 1E2GVB72 UYRH$B 2 VZO+ B31
2AJI
EB 0 :(DUWB 2 VZO+ B72 UYRH$B 2 >XAW?B30 1E2GVB72 UW1[AB 2 V’ZDZB31 18V1 B 0
:(
DW0B 2 V’ZDZB72 UW1[AB 2 >/L>O820L@GCEN/63BB0 1E2GVB72 UX\’DB 2 VZYQ4B31
47/UCB
0 :(DRYB 2 VZYQ4B72 UX\’DB 2 >W[RCB30 1E2GVB72 UV.’RB 2 V’’V_B31 03NFDB 0
:(DX
VB 2 V’’V_B72 UV.’RB 2 >/9]S813_BB0 1E2GVB72 UX/PRB 2 VZ’%IB31 47/UCB 0 :(DRYB
2 VZ’%IB72 UX/PRB 2 >W=!NB30 1E2GVB72 UVKM%B 2 V’,P7B31 03NFDB 0 :(DXVB 2
V’,P7
B72 UVKM%B 2 >$]@!814 BB0 1E2GVB72 UX/PRB 2 VZ’#YB31 47/UCB 0 :(DRYB 2
VZ’#YB72
UX/PRB 2 >W=!NB30 1E2GVB72 UVKG,B 2 V’,.UB31 03NFDB 0 :(DXVB 2 V’,.UB72
UVKG,B
2 >$^3L813-BB0 1E2GVB72 UYN]”B 2 VZQ3?B31 47/UCB 0 :(DRYB 2 VZQ3?B72 UYN]”B 2
>X8[3B30 1E2GVB72 UW4\?B 2 V’Y(JB31 03NFDB 0 :(DXVB 2 V’Y(JB72 UW4\?B 2 >/N\
81
3/BB0 1E2GVB72 UYN]”B 2 VZQ4-B31 47/UCB 0 :(DRYB 2 VZQ4-B72 UYN]”B 2 >X8[3B30
1
E2GVB72 UW54:B 2 V’YK]B31 03NFDB 0 :(DXVB 2 V’YK]B72 UW54:B 2
>/N;Z820M2GCEN/63
BB0 1E2GVB72 UX_()B 2 VZY>OBB1 4UJ,$B70 :(DRYB 2 VZY>OB72 UX_()B 2 >W!@]B30
1E2
GVB72 UV*)1B 2 V’’H;B30 0N93#B 0 :(DF-B 2 V’’H;B72 UV*)1B 2 >/A/A814 BB0
1E2GVB
72 UX$_?B 2 VZ’)$BB1 4UJ,$B70 :(DRYB 2 VZ’)$B72 UX$_?B 2 >W=R$B30 1E2GVB72
UVL4
^B 2 V’,’FB30 0N93#B 0 :(DF-B 2 V’,’FB72 UVL4^B 2 >$^”Z8141BB0 1E2GVB72 UX$”EB
2 VZ=PGBB1 4UJ,$B70 :(DRYB 2 VZ=PGB72 UX$”EB 2 >W=!NB30 1E2GVB72 UVLH-B 2
V’,2%
B30 0N93#B 0 :(DF-B 2 V’,2%B72 UVLH-B 2 >$^M*813)BB0 1E2GVB72 UYMJRB 2
VZR2TBB1
4UJ,$B70 :(DRYB 2 VZR2TB72 UYMJRB 2 >X8N&B30 1E2GVB72 UW6D<B 2 V’X!NB30
0N93#B
0 :(DF-B 2 V’X!NB72 UW6D<B 2 >/OO;813-BB0 1E2GVB72 UYMZ4B 2 VZQI&BB1 4UJ,$B70
:(DRYB 2 VZQI&B72 UYMZ4B 2 >X7!\B30 1E2GVB72 UW60RB 2 V’YW>B30 0N93#B 0 :(DF-B
2 V’YW>B72 UW60RB 2 >/O,8820MCGCEN/63BB0 1E2GVB72 UX@N8B 2 VZ$+!B31 24RX;B 0
:(
DUWB 2 VZ$+!B72 UX@N8B 2 >W>@.B30 1E2GVB72 UV,_WB 2 V’(/&BB1 &^%”B70 :(DXVB 2
V’(/&B72 UV,_WB 2 >/D=M8141BB0 1E2GVB72 UXW’CB 2 VZ.T;B31 24RX;B 0 :(DUWB 2
VZ.
T;B72 UXW’CB 2 >W)J_B30 1E2GVB72 UVP)%B 2 V’%?WBB1 &^%”B70 :(DXVB 2 V’%?WB72
U
VP)%B 2 >/ 6Y8143BB0 1E2GVB72 UXW.RB 2 VZ.N6B31 24RX;B 0 :(DUWB 2 VZ.N6B72
UXW.
RB 2 >W)FVB30 1E2GVB72 UVP+2B 2 V’&1^BB1 &^%”B70 :(DXVB 2 V’&1^B72 UVP+2B 2
>/
CW813=BB0 1E2GVB72 UYG4:B 2 VZS”VB31 24RX;B 0 :(DUWB 2 VZS”VB72 UYG4:B 2
>X4TS
B30 1E2GVB72 UWCHHB 2 V’WK2BB1 &^%”B70 :(DXVB 2 V’WK2B72 UWCHHB 2
>/SE=813)BB0
1E2GVB72 UYG2/B 2 VZS<^B31 24RX;B 0 :(DUWB 2 VZS<^B72 UYG2/B 2 >X4X[B30
1E2GVB
72 UWCKGB 2 V’W9+BB1 &^%”B70 :(DXVB 2 V’W9+B72 UWCKGB 2 >/S8*820MMGCEN/63BB0
1
E2GVB72 UX_”+B 2 VZY?8B30 %?$LB 0 :(DOZB 2 VZY?8B72 UX_”+B 2 >W!\@B30
1E2GVB72
UV*/IB 2 V’’VDBB0 0QI28B70 :(DF-B 2 V’’VDB72 UV*/IB 2 >/A.-8143BB0 1E2GVB72
UX
$_7B 2 VZ=H;B30 %?$LB 0 :(DOZB 2 VZ=H;B72 UX$_7B 2 >W. LB30 1E2GVB72 UVL4^B 2
V’,CSBB0 0QI28B70 :(DF-B 2 V’,CSB72 UVL4^B 2 >$^J”8145BB0 1E2GVB72 UX/92B 2
VZ’
“,B30 %?$LB 0 :(DOZB 2 VZ’”,B72 UX/92B 2 >W=’TB30 1E2GVB72 UVK,KB 2 V’;4KBB0
0
QI28B70 :(DF-B 2 V’;4KB72 UVK,KB 2 >$^:W813*BB0 1E2GVB72 UYMW5B 2 VZQR*B30
%?$
Main Index
CHAPTER 18 1969
Support Files

LB 0 :(DOZB 2 VZQR*B72 UYMW5B 2 >X8 ^B30 1E2GVB72 UW65)B 2 V’Y,”BB0 0QI28B70


:(
DF-B 2 V’Y,”B72 UW65)B 2 >/P5W813=BB0 1E2GVB72 UYMK[B 2 VZR UB30 %?$LB 0
:(DOZ
B 2 VZR UB72 UYMK[B 2 >X8K;B30 1E2GVB72 UW6OHB 2 V’X[>BB0 0QI28B70 :(DF-B 2
V’X
[>B72 UW6OHB 2 >/O$”820MWGCEN/63BB0 1E2GVB72 UYE:MB 2 VZTO_B31 0_,58B 0 :(DXVB
2 VZTO_B72 UYE:MB 2 >X3^’B30 1E2GVB72 UVR],B 2 V’%X!BB0 ..+GB70 :(DQ2B 2
V’%X!
B72 UVR],B 2 >/0&<8145BB0 1E2GVB72 UX<GDB 2 VZ/<?B31 0_,58B 0 :(DXVB 2
VZ/<?B72
UX<GDB 2 >W<H@B30 1E2GVB72 UV3;IB 2 V’@EOBB0 ..+GB70 :(DQ2B 2 V’@EOB72
UV3;IB
2 >$,.J8147BB0 1E2GVB72 UX<H.B 2 VZ/,9B31 0_,58B 0 :(DXVB 2 VZ/,9B72 UX<H.B 2
>W<GPB30 1E2GVB72 UV3+-B 2 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 2 >$?W%814DBB0 1E2GVB72 UX#=KB 2 VZ(*!BB0
“IM
&B70 :(DOZB 2 VZ(*!B72 UX#=KB 2 >W,\NB30 1E2GVB72 UVA”/B 2 V’>$/B30 ‘*2<B 0
:(
DQ2B 2 V’>$/B72 UVA”/B 2 >$?DP813<BB0 1E2GVB72 UYWKBB 2 VZO’TBB0 “IM&B70
:(DOZ
B 2 VZO’TB72 UYWKBB 2 >XE[WB30 1E2GVB72 UV^G4B 2 V’+EXB30 ‘*2<B 0 :(DQ2B 2
V’+
EXB72 UV^G4B 2 >/J-L813;BB0 1E2GVB72 UYWT>B 2 VZOC’BB0 “IM&B70 :(DOZB 2
VZOC’B
72 UYWT>B 2 >XE(-B30 1E2GVB72 UV^5(B 2 V’+%3B30 ‘*2<B 0 :(DQ2B 2 V’+%3B72
Main Index UV^5
1970
Code Examples

(B 2 >/J[*820N8GCEN/63BB0 1E2GVB72 UY (3B 2 VZZ62B31 1RNXIB 0 :(DW0B 2


VZZ62B72
UY (3B 2 >W]:+B30 1E2GVB72 UV.4SB 2 V’=..BB0 .)5LB70 :(DQ2B 2 V’=..B72
UV.4SB
2 >/ASE814DBB0 1E2GVB72 UX-;’B 2 VZ=B>B31 1RNXIB 0 :(DW0B 2 VZ=B>B72 UX-;’B 2
>W”L<B30 1E2GVB72 UVI”SB 2 V’:4PBB0 .)5LB70 :(DQ2B 2 V’:4PB72 UVI”SB 2
>$][P81
4FBB0 1E2GVB72 UX-\5B 2 VZ’)$B31 1RNXIB 0 :(DW0B 2 VZ’)$B72 UX-\5B 2 >W”2TB30
1
E2GVB72 UVI”SB 2 V’:4PBB0 .)5LB70 :(DQ2B 2 V’:4PB72 UVI”SB 2 >$][P813?BB0
1E2G
VB72 UYNSSB 2 VZR UB31 1RNXIB 0 :(DW0B 2 VZR UB72 UYNSSB 2 >X9JOB30 1E2GVB72
UW
5QRB 2 V’ZL#BB0 .)5LB70 :(DQ2B 2 V’ZL#B72 UW5QRB 2 >/O\3813<BB0 1E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 >XP-_B30 1E2GVB72 UV+%.B 2 V’.HDB30 0 ZE:B 0 :(DL$B 2 V’.HDB72
UV+%
.B 2 >/6NT813:BB0 1E2GVB72 UY<U.B 2 VZF&FBB1 3J_X7B70 :(DT1B 2 VZF&FB72 UY<U.B
2 >XPP3B30 1E2GVB72 UV+$1B 2 V’.!SB30 0 ZE:B 0 :(DL$B 2 V’.!SB72 UV+$1B 2
>/6%,
820N%GCEN/63BB0 1E2GVB72 UYG!*B 2 VZS2XB30 [V0 B 0 :(DL$B 2 VZS2XB72 UYG!*B 2
>X4$!B30 1E2GVB72 UVP[9B 2 V’%;2BB0 000\BB70 :(DL$B 2 V’%;2B72 UVP[9B 2 >/
G\81
4ABB0 1E2GVB72 UX@Z3B 2 VZ$JXB30 [V0 B 0 :(DL$B 2 VZ$JXB72 UX@Z3B 2 >W>,#B30
Main Index 1
CHAPTER 18 1971
Support Files

E2GVB72 UV0.MB 2 V’@#[BB0 000\BB70 :(DL$B 2 V’@#[B72 UV0.MB 2 >$%U#8148BB0


1E2G
VB72 UX@*VB 2 VZZ:EB30 [V0 B 0 :(DL$B 2 VZZ:EB72 UX@*VB 2 >W>W?B30 1E2GVB72
UV
0QUB 2 V’!/ZBB0 000\BB70 :(DL$B 2 V’!/ZB72 UV0QUB 2 >$%\2813%BB0 1E2GVB72
UY)GO
B 2 VZJ;1B30 [V0 B 0 :(DL$B 2 VZJ;1B72 UY)GOB 2 >XIOXB30 1E2GVB72 UV;9RB 2
V’(
<QBB0 000\BB70 :(DL$B 2 V’(<QB72 UV;9RB 2 >/E3C813,BB0 1E2GVB72 UY)5^B 2
VZKIKB
30 [V0 B 0 :(DL$B 2 VZKIKB72 UY)5^B 2 >XI’QB30 1E2GVB72 UV;RKB 2 V’( &BB0
000\
BB70 :(DL$B 2 V’( &B72 UV;RKB 2 >/DZ!820N[GCEN/63BB0 1E2GVB72 UY0?1B 2
VZX#+B31
05YV>B 0 :(DXVB 2 VZX#+B72 UY0?1B 2 >W]”)B30 1E2GVB72 UV’MAB 2 V’=+ BB1 0
)L2B
70 :(DXVB 2 V’=+ B72 UV’MAB 2 >/8@O8148BB0 1E2GVB72 UX+.8B 2 VZ’CXB31 05YV>B 0
:(DXVB 2 VZ’CXB72 UX+.8B 2 >W.Z5B30 1E2GVB72 UVI:QB 2 V’;54BB1 0 )L2B70 :(DXVB
2 V’;54B72 UVI:QB 2 >$]9E8146BB0 1E2GVB72 UX+Z^B 2 VZ’-LB31 05YV>B 0 :(DXVB 2
V
Z’-LB72 UX+Z^B 2 >W., B30 1E2GVB72 UVI-#B 2 V’;.ZBB1 0 )L2B70 :(DXVB 2
V’;.ZB72
UVI-#B 2 >$]V$813”BB0 1E2GVB72 UYR2’B 2 VZPI.B31 05YV>B 0 :(DXVB 2 VZPI.B72
UY
R2’B 2 >XA[CB30 1E2GVB72 UW1?]B 2 V’$6]BB1 0 )L2B70 :(DXVB 2 V’$6]B72 UW1?]B 2
>/M+4813%BB0 1E2GVB72 UYRA>B 2 VZO??B31 05YV>B 0 :(DXVB 2 VZO??B72 UYRA>B 2
>XA
);B30 1E2GVB72 UW24+B 2 V’ZU.BB1 0 )L2B70 :(DXVB 2 V’ZU.B72 UW24+B 2
>/MEE820O4
GCEN/63BB0 1E2GVB72 UX, /B 2 VZ-G1BB0 0Q=&:B70 :(DF-B 2 VZ-G1B72 UX, /B 2
>W;.Z
B30 1E2GVB72 UV!(RB 2 V’+>0B30 1MK[\B 0 :(D2CB 2 V’+>0B72 UV!(RB 2
>/H!48146BB0
1E2GVB72 UXP5AB 2 VZ”*+BB0 0Q=&:B70 :(DF-B 2 VZ”*+B72 UXP5AB 2 >W$#!B30
1E2GVB
72 UVXB4B 2 V’#ETB30 1MK[\B 0 :(D2CB 2 V’#ETB72 UVXB4B 2 >/48P8144BB0 1E2GVB72
UXOY9B 2 VZ%P(BB0 0Q=&:B70 :(DF-B 2 VZ%P(B72 UXOY9B 2 >W/#\B30 1E2GVB72 UVXPEB
2 V’”ZFB30 1MK[\B 0 :(D2CB 2 V’”ZFB72 UVXPEB 2 >/3%$813.BB0 1E2GVB72 UYA!HB 2
V
ZV,SBB0 0Q=&:B70 :(DF-B 2 VZV,SB72 UYA!HB 2 >X2)DB30 1E2GVB72 UWI6YB 2
V’UUKB30
1MK[\B 0 :(D2CB 2 V’UUKB72 UWI6YB 2 >/V)”813”BB0 1E2GVB72 UYBSIB 2 VZU6PBB0
0Q
=&:B70 :(DF-B 2 VZU6PB72 UYBSIB 2 >X1’(B30 1E2GVB72 UWH@OB 2 V’VAHB30 1MK[\B 0
:(D2CB 2 V’VAHB72 UWH@OB 2 >/W33820OEGCEN/63BB0 1E2GVB72 UX:$FB 2 VZ+@BBB0
/?[
TB70 :(DRYB 2 VZ+@BB72 UX:$FB 2 >W<+#B30 1E2GVB72 UV>@+B 2 V’-_YB30 >O+6B 0
:(
DN4B 2 V’-_YB72 UV>@+B 2 >/GV’8144BB0 1E2GVB72 UXTYXB 2 VZ”A/BB0 /?[TB70
:(DRY
B 2 VZ”A/B72 UXTYXB 2 >W(6UB30 1E2GVB72 UVT /B 2 V’%/(B30 >O+6B 0 :(DN4B 2
V’%
/(B72 UVT /B 2 >/1”]8142BB0 1E2GVB72 UXTKNB 2 VZ”>YBB0 /?[TB70 :(DRYB 2
VZ”>YB
72 UXTKNB 2 >W(XJB30 1E2GVB72 UVT2$B 2 V’%RCB30 >O+6B 0 :(DN4B 2 V’%RCB72
UVT2
$B 2 >/1(_813’BB0 1E2GVB72 UYB/\B 2 VZV/&BB0 /?[TB70 :(DRYB 2 VZV/&B72 UYB/\B
2 >X35XB30 1E2GVB72 UWG&+B 2 V’VM^B30 >O+6B 0 :(DN4B 2 V’VM^B72 UWG&+B 2
>/VH@
813.BB0 1E2GVB72 UYB:?B 2 VZU!4BB0 /?[TB70 :(DRYB 2 VZU!4B72 UYB:?B 2
>X2.CB30
1E2GVB72 UWG”(B 2 V’VW(B30 >O+6B 0 :(DN4B 2 V’VW(B72 UWG”(B 2
>/VN<820OOGCEN/
63BB0 1E2GVB72 UX[0]B 2 VZ/9[B30 %YVIB 0 :(DOZB 2 VZ/9[B72 UX[0]B 2 >W@&PB30
1
E2GVB72 UV&L^B 2 V’)<VBB0 0(#.<B70 :(DC(B 2 V’)<VB72 UV&L^B 2 >/DMV8142BB0
1E2G
VB72 UXX)XB 2 VZ*-$B30 %YVIB 0 :(DOZB 2 VZ*-$B72 UXX)XB 2 >W=9=B30 1E2GVB72
UV
OVGB 2 V’&#OBB0 0(#.<B70 :(DC(B 2 V’&#OB72 UVOVGB 2 >$\?(8140BB0 1E2GVB72
UXX_)
B 2 VZ.)”B30 %YVIB 0 :(DOZB 2 VZ.)”B72 UXX_)B 2 >W’-QB30 1E2GVB72 UVOH<B 2
V’,
Main Index
1972
Code Examples

P>BB0 0(#.<B70 :(DC(B 2 V’,P>B72 UVOH<B 2 >/ FU813(BB0 1E2GVB72 UYIN/B 2


VZS=WB
30 %YVIB 0 :(DOZB 2 VZS=WB72 UYIN/B 2 >X6P7B30 1E2GVB72 UWAC)B 2 V’X]+BB0
0(#.
<B70 :(DC(B 2 V’X]+B72 UWAC)B 2 >/R><813’BB0 1E2GVB72 UYI3UB 2 VZT)MB30 %YVIB
0 :(DOZB 2 VZT)MB72 UYI3UB 2 >X6^@B30 1E2GVB72 UWAQ3B 2 V’XH8BB0 0(#.<B70
:(DC(
B 2 V’XH8B72 UWAQ3B 2 >/RV 820OYGCEN/63BB0 1E2GVB72 UY0H1B 2 VZY..B32 0JBV?B 0
:(DZ B 2 VZY..B72 UY0H1B 2 >W^21B30 1E2GVB72 UV=28B 2 V’=”CBB0 032W,B70 :(DL$B
2 V’=”CB72 UV=28B 2 >/9/58140BB0 1E2GVB72 UX+%+B 2 VZ=T B32 0JBV?B 0 :(DZ B 2
V
Z=T B72 UX+%+B 2 >W*.6B30 1E2GVB72 UVI)EB 2 V’;?”BB0 032W,B70 :(DL$B 2
V’;?”B72
UVI)EB 2 >$].\813\BB0 1E2GVB72 UX-0GB 2 VZ’=;B32 0JBV?B 0 :(DZ B 2 VZ’=;B72
UX
-0GB 2 >W*EJB30 1E2GVB72 UVI”SB 2 V’;(<BB0 032W,B70 :(DL$B 2 V’;(<B72 UVI”SB 2
>$]YZ813+BB0 1E2GVB72 UYP,CB 2 VZP]=B32 0JBV?B 0 :(DZ B 2 VZP]=B72 UYP,CB 2
>XA
PQB30 1E2GVB72 UW3QHB 2 V’ZZ!BB0 032W,B70 :(DL$B 2 V’ZZ!B72 UW3QHB 2
>/NR*813(B
B0 1E2GVB72 UYPX;B 2 VZQ*/B32 0JBV?B 0 :(DZ B 2 VZQ*/B72 UYPX;B 2 >XA<“B30
1E2G
VB72 UW3L;B 2 V’Z;ZBB0 032W,B70 :(DL$B 2 V’Z;ZB72 UW3L;B 2
>/N+9820O.GCEN/63BB0
1E2GVB72 UY6G”B 2 VZW >BB1 24=,TB70 :(DUWB 2 VZW >B72 UY6G”B 2 >W\>KB30
1E2GVB
72 UV/3[B 2 V’*JXBB1 4”]D^B70 :(DRYB 2 V’*JXB72 UV/3[B 2 >/5;.813\BB0 1E2GVB72
UX*SHB 2 VZ(V#BB1 24=,TB70 :(DUWB 2 VZ(V#B72 UX*SHB 2 >W%@GB30 1E2GVB72 UVB-_B
2 V’>2KBB1 4”]D^B70 :(DRYB 2 V’>2KB72 UVB-_B 2 >$?W%813^BB0 1E2GVB72 UX*=[B 2
V
Z-;2BB1 24=,TB70 :(DUWB 2 VZ-;2B72 UX*=[B 2 >W%U[B30 1E2GVB72 UVB?+B 2
V’<H@BB1
4”]D^B70 :(DRYB 2 V’<H@B72 UVB?+B 2 >$?5^813$BB0 1E2GVB72 UYV4SB 2 VZNV_BB1
24
=,TB70 :(DUWB 2 VZNV_B72 UYV4SB 2 >XC:PB30 1E2GVB72 UV\V7B 2 V’$/UBB1 4”]D^B70
:(DRYB 2 V’$/UB72 UV\V7B 2 >/K6(813+BB0 1E2GVB72 UYU>IB 2 VZODPBB1 24=,TB70
:(D
UWB 2 VZODPB72 UYU>IB 2 >XDG*B30 1E2GVB72 UV\E”B 2 V’/L9BB1 4”]D^B70 :(DRYB 2
V
‘/L9B72 UV\E”B 2 >/KY^820O>GCEN/63BB0 1E2GVB72 UY6 +B 2 VZVLOB31 0H\1*B 0
:(DXV
B 2 VZVLOB72 UY6 +B 2 >W\2AB30 1E2GVB72 UV/)AB 2 V’.*XBB0 02G+6B70 :(DL$B 2
V’.
*XB72 UV/)AB 2 >/5,D813^BB0 1E2GVB72 UX*AOB 2 VZ-! B31 0H\1*B 0 :(DXVB 2 VZ-!
B
72 UX*AOB 2 >W%75B30 1E2GVB72 UVCLQB 2 V’<DQBB0 02G+6B70 :(DL$B 2 V’<DQB72
UVCL
QB 2 >$?Q;813[BB0 1E2GVB72 UX*RXB 2 VZ-5/B31 0H\1*B 0 :(DXVB 2 VZ-5/B72 UX*RXB
2 >W#)HB30 1E2GVB72 UVCS?B 2 V’:>KBB0 02G+6B70 :(DL$B 2 V’:>KB72 UVCS?B 2
>$?DP
813YBB0 1E2GVB72 UYU:3B 2 VZM,WB31 0H\1*B 0 :(DXVB 2 VZM,WB72 UYU:3B 2
>XB_G^81
0#^B30 1E2GVB72 UV\^BB 2 V’$C@BB0 02G+6B70 :(DL$B 2 V’$C@B72 UV\^BB 2
>/K9+813$
BB0 1E2GVB72 UYUYBB 2 VZN/[B31 0H\1*B 0 :(DXVB 2 VZN/[B72 UYUYBB 2 >XCSZB30
1E2
GVB72 UV\:”B 2 V’$ZFBB0 02G+6B70 :(DL$B 2 V’$ZFB72 UV\:”B 2
>/KN1820P0GCEN/63BB
0 1E2GVB72 UY66JB 2 VZU]JBB1 0^Q0GB70 :(DXVB 2 VZU]JB72 UY66JB 2 >W_&&B30
1E2GV
B72 UV/\&B 2 V’.I.B31 02GO B 0 :(DXVB 2 V’.I.B72 UV/\&B 2 >/5*”813[BB0
1E2GVB72
UX=N)B 2 VZ-;,BB1 0^Q0GB70 :(DXVB 2 VZ-;,B72 UX=N)B 2 >W”WGB30 1E2GVB72
UVE@/B
2 V’:0=B31 02GO B 0 :(DXVB 2 V’:0=B72 UVE@/B 2 >$@Z:813@BB0 1E2GVB72 UX=Q(B 2
VZ-’<BB1 0^Q0GB70 :(DXVB 2 VZ-’<B72 UX=Q(B 2 >W”O;B30 1E2GVB72 UVE^JB 2
V’;;GB3
1 02GO B 0 :(DXVB 2 V’;;GB72 UVE^JB 2 >$@SN813WBB0 1E2GVB72 UYW:DB 2 VZM2:BB1
0
^Q0GB70 :(DXVB 2 VZM2:B72 UYW:DB 2 >XD3IB30 1E2GVB72 UV_3UB 2 V’$+DB31 02GO B
0
:(DXVB 2 V’$+DB72 UV_3UB 2 >/I?)813YBB0 1E2GVB72 UYW&EB 2 VZMCWBB1 0^Q0GB70
Main Index :(
CHAPTER 18 1973
Support Files

DXVB 2 VZMCWB72 UYW&EB 2 >XD7%B30 1E2GVB72 UV_ %B 2 V’$,8B31 02GO B 0 :(DXVB 2


V’$,8B72 UV_ %B 2 >/J
6^74^60^3^3^HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
X 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ$/+-()’=.*”#%&,;:<>?@![]^_\
020080

3^HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
H

#---------------------------------------------------------------------
# File : spool.ses
#
# Purpose : This file will generate a PATRAN database
# “spool.db” which consists of a free standing
# aluminum spool, wound with a wire which results
# in a compressive pressure on the spool’s core
# and flanges.
#
# 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.
#
# Model : The spool is 8 units tall with a core diameter of
# 2 units, a flange diameter of 8 units. Fillet
# radius is 1 unit. The spool is made of aluminum,
# 0.075 units thick.
#
# The model consists of
# * +400 psi compressive pressure on spool core
# * +20 psi compressive pressure on the top and
# bottom flanges
# * +400 to +20 psi compressive pressure varying
# over the top and bottom flanges
#
# Analysis & After running this session file, analysis can be
# Results: done by following these steps.
# 1. Choose “MSC.Nastran” from “Preferences”,
# “Analysis...” puldown menus on the menu bar.
# 2. Select “Analysis” switch and from the form
# displayed select “Translation Parameters...”
# button. From the “OUTPUT2 Fomat” Option Menu
# select option “Text”. Press “OK”.
# 3. Press “Apply” on “Analysis” window.
# If MSC.Nastran is available this will create
# a file “spool.op2”
# 4. From the “Analysis” window, from “Action”
# Option Menu, select “Read Output2” option.
# 5. Click on the “Select Results File..” Button
# and select “spool.op2”. Press “Apply”.
# 6. The results will be read, and a file
# “spool.jbr” is created.
#---------------------------------------------------------------------
#
# Create a new database and set the preferences
uil_file_new.go(““, “./spool.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 )

db_set_pref( 303, 3, 0, FALSE, 0.0040000002, ““ )


#---------------------------------------------------------------------
# Construct two curves for the bottom flange and core
STRING asm_create_line_xyz_created_ids[VIRTUAL]
asm_const_line_xyz( “1”, “<3 0 0>”, “[0 0 0]”, “Coord 0”, @
Main Index
1974
Code Examples

asm_create_line_xyz_created_ids )
asm_const_line_xyz( “2”, “<0 4 0>”, “[0 0 0]”, “Coord 0”, @
asm_create_line_xyz_created_ids )
#---------------------------------------------------------------------
# Create a fillet between the flange and the core curves
STRING asm_create_line_fil_created_ids[VIRTUAL]
asm_const_line_fillet( “3”, 1, 1., 0.0040000002, TRUE, @
“Construct PointCurveUOnCurve (Evaluate Geometry”// @
“(Point 1 )) (Evaluate Geometry (Curve 1 ))”, @
“Construct PointCurveUOnCurve (Evaluate Geometry”// @
“(Point 1 )) (Evaluate Geometry (Curve 2 ))”, @
asm_create_line_fil_created_ids )
$# Do you wish to trim the original curves?
$? YESFORALL 1000047
#---------------------------------------------------------------------
# Create spool surface using Create’s Revolve method
STRING sgm_sweep_surface_r_created_ids[VIRTUAL]
sgm_const_surface_revolve( “1”, “{[-1 0 0][-1 1 0]}”, 360., @
0.,”Coord 0”,”Curve 1 3 2”, sgm_sweep_surface_r_created_ids )
ga_view_aa_set( 30., 60., 0. )
ga_display_lines_set( “general”, 2 )
#---------------------------------------------------------------------
# Create the surfaces for the top half of the spool using
# Mirror method
STRING sgm_transform_surf__created_ids[VIRTUAL]
sgm_transform_mirror( “4”, “surface”, “{[0 4 0][0 5 0]}”, @
0., TRUE, FALSE, “Surface 1:3 “, sgm_transform_surf__created_ids )
#---------------------------------------------------------------------
# Set the positive surface normal vectors
STRING sgm_edit_surface_r_reversed_ids[VIRTUAL]
sgm_edit_surface_reverse( TRUE, “Surface 1:6”, @
sgm_edit_surface_r_reversed_ids )
sgm_edit_surface_reverse( TRUE, “Surface 1:6”, @
sgm_edit_surface_r_reversed_ids )
#---------------------------------------------------------------------
# Create a local cylindrical coordinate frame
STRING asm_create_cord_3po_created_ids[VIRTUAL]
asm_const_coord_3point( “1”, “Coord 0”, 2, “[-1 0 0]”, “[-1 1 0]”, @
“[1 0 0]”, asm_create_cord_3po_created_ids )
#---------------------------------------------------------------------
# Create a pressure field 400_20_psi_transition
fields_create( “400_20_psi_transition”, “Spatial”, 1, “Scalar”, @
“Real”, “Coord 1”, ““, “Function”, 1, “R”, ““, ““, @
“780-380*’R”, ““, ““, FALSE, [0.], [0.], [0.], [[[0.]]] )
#---------------------------------------------------------------------
# Apply a pressure varying from 400 to 20 psi on the fillet
loadsbcs_create( “fillet_pressure”, “Pressure”, “Element Uniform”, @
“2D”, “Static”, [“Surface 2 5”], “Geometry”, ““, 1., [““, @
“f:400_20_psi_transition”, ““], [““, ““, ““] )
# Apply a pressure of 400 psi on the core
loadsbcs_create( “400_psi”, “Pressure”, “Element Uniform”, “2D”, @
“Static”, [“Surface 3 6”], “Geometry”, ““, 1., [““, “400”, @
““], [““, ““, ““] )
# Apply a pressure of 20 psi on the top and bottom flanges
loadsbcs_create( “20_psi”, “Pressure”, “Element Uniform”, “2D”, @
“Static”, [“Surface 1 4”], “Geometry”, ““, 1., [““, “20”, ““], @
[““, ““, ““] )
#---------------------------------------------------------------------
# Apply displacement constraint at the centre of the spool
loadsbcs_create( “TZ_fixed”, “Displacement”, “Nodal”, ““, “Static”, @
[“Point 7”], “Geometry”, “Coord 1”, 1., [“<0,0,0>”, “<0,0,0 >” @
], [““, ““] )
#---------------------------------------------------------------------
# Create a new group called “fem_model” and make it current
sys_poll_option( 2 )
ga_group_create( “fem_model” )
ga_group_current_set( “fem_model” )
Main Index
CHAPTER 18 1975
Support Files

$# Group “fem_model” created.


sys_poll_option( 0 )
#---------------------------------------------------------------------
# Define mesh seeds for the flanges, core and fillets
ui_exec_function( “mesh_seed_display_mgr”, “init” )
mesh_seed_create( “Curve 1 3 2 Surface 6.1 5.1 4.1 “, 1, 4, 0., @
0., 0.)
mesh_seed_create( “Surface 1.1 4.4 “, 1, 24, 0., 0., 0. )
mesh_seed_display_mgr.erase( )
#---------------------------------------------------------------------
# Create the finite element mesh
INTEGER fem_create_mesh_surfa_num_nodes
INTEGER fem_create_mesh_surfa_num_elems
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]
fem_create_mesh_surf_2( “IsoMesh”, 0, “Surface 1:6 “, 1, [0.1], @
“Quad4”, “1”, “1”, “Coord 0”, “Coord 0”, @
fem_create_mesh_surfa_num_nodes, @
fem_create_mesh_surfa_num_elems, @
fem_create_mesh_s_nodes_created, @
fem_create_mesh_s_elems_created )
#---------------------------------------------------------------------
# Equivalence the coincident nodes
REAL fem_equiv_all_x_equivtol
INTEGER fem_equiv_all_x_segment
fem_equiv_all_group3( [“ “], 0, ““, 1, 0.0040000002, FALSE, @
fem_equiv_all_x_equivtol, fem_equiv_all_x_segment )
#---------------------------------------------------------------------
# Optimise the model
INTEGER fem_optimize_iband(4)
INTEGER fem_optimize_iprof(4)
INTEGER fem_optimize_maxwf(4)
REAL fem_optimize_avgwf(4)
REAL fem_optimize_rmswf(4)
fem_optimize( “Nodes”, “Both”, “Profile”, 1, fem_optimize_iband, @
fem_optimize_iprof, fem_optimize_maxwf, fem_optimize_avgwf, @
fem_optimize_rmswf )
#---------------------------------------------------------------------
# Define material properties for Aluminum
material.create( “Analysis code ID”, 1, “Analysis type ID”, 1, @
“aluminum”, 0, “Date: 14-May-97 Time: 13:49:55”, @
“Isotropic”, 1, “Directionality”, 1, “Linearity”, 1, @
“Homogeneous”, 0, “Linear Elastic”, 1, “Model Options & IDs”, @
[““, ““, ““, ““, ““], [0, 0, 0, 0, 0], “Active Flag”, 1, @
“Create”, 10, “External Flag”, FALSE, “Property IDs”, @
[“Elastic Modulus”, “Poisson Ratio”, “Density”], [2, 5, 16, 0], @
“Property Values”, [“10.1e6”, “0.33”, “0.1”, ““] )
#---------------------------------------------------------------------
# Create and assign element properties
elementprops_create( “const_thick_spool”, 51, 25, 35, 1, 1, 20, @
[13, 20, 36, 4037, 4111, 4118, 4119], [5, 9, 1, 1, 1, 1, 1], @
[“m:aluminum”, ““, “0.075”, ““, ““, ““, ““], “Surface 1:6” )
#---------------------------------------------------------------------
# Create a load case consisting the pressures and displacement
# constraint
loadcase_create2( “spool_loads”, “Static”, ““, 1., [“TZ_fixed”, @
“20_psi”, “400_psi”, “fillet_pressure”], [0, 0, 0, 0], [1., 1., @
1., 1.], ““, 0., TRUE )
sys_poll_option( 2 )
#---------------------------------------------------------------------
pref_fa_set([FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,@
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, @
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, @
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, @
FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, @
TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,@
TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,@
Main Index
1976
Code Examples

TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, @
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, @
FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, @
FALSE, FALSE, FALSE, FALSE, FALSE], [6, 3, 1, 1, 5, 7, 2, 2, 8,1,@
2, 3, 3, 5, 2, 1, 3, 4, 5, 3, 3, 2, 2, 2, 2, 6, 6, 6, 3, 6, 15,5,@
5, 5, 5, 6, 7, 8, 9, 10], [FALSE, FALSE, FALSE, FALSE, FALSE, @
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, @
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, @
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, @
FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE], [3, 4, 5, 6, 1,@
1, 7, 8, 9, 10], [FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE,@
TRUE, TRUE, TRUE], FALSE )
display_fa_vectors( TRUE )
sys_poll_option( 0 )
#---------------------------------------------------------------------
# End of File.

#---------------------------------------------------------------------
# File : spool_res.ses
#
# Purpose : This file will open the “spool.db” database
# and reads the results from files “spool.op2”
# and “spool.jbr”.
#
# This session file assumes that the files spool.db,
# spool.op2 and spool.jbr already exist. For
# instructions regarding creating these files see
# file “spool.ses”.
#
# 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.
#
#---------------------------------------------------------------------
#
# Open the “spool.db” database.
uil_file_open.go( “spool.db”)

# Set “fem_model” as current group


ga_group_current_set( “fem_model” )

# Read in the .op2 (Binary/Text) results file.


analysis_import( “MSC.Nastran”, “spool”, “Results File”, @
“./spool.op2”, TRUE )

# Plot the results


# res_init_fringe_plot( )
# res_create_fringe_plot_rec3( 23, 2, 1, 1, 1, 1, 0, 0, 1., ““,@
# 1, 2, 3, 23, 1, 1, 0., 30, 0, 1 )
# res_make_fringe_plot( 1, [1], [1], [““], [0.], [“DEFAULT, Static “//@
# “Subcase: Displacements, Translational (VEC-MAG) -MSC.Nastran” ] )
# res_deinit_fringe_plot( )
# sf_pause()

res_init_fringe_plot( )
res_create_fringe_plot_rec3( 25, 2, 1, 1, 1, 1, 0, 0, 1., ““, @
2, 3, 6, 52, 2, 1, 0., 30, 0, 1 )
res_make_fringe_plot( 1, [1], [1], [““], [0.], [ “DEFAULT, Static “//@
“Subcase: Stress Tensor At Z1 (VON-MISES) -MSC.Nastran”] )
res_deinit_fringe_plot( )
# sf_pause()

# res_init_deform_plot( )
# res_create_deform_plot_rec2( 24, 2, 1, 3, [27, 28, 29, 0, 0, 0], @
# 1, 1, 0., 8, 0, 1, 0, [0., 0., 0.] )
Main Index
CHAPTER 18 1977
Support Files

# res_make_deform_plot( 1, [1], [1], [““], [0.], [“DEFAULT, Static “//@


# “Subcase: Displacements, Translational -MSC.Nastran”] )
# res_deinit_deform_plot( )
# sf_pause()

# res_init_deform_plot( )
# res_create_deform_plot_rec2( 26, 1, 1, 3, [27, 28, 29, 0, 0, 0], @
# 1, 1, 0., 8, 0, 1, 0, [0., 0., 0.] )
# res_make_deform_plot( 1, [1], [1], [““], [0.], [“DEFAULT, Static “//@
# “Subcase: Constraint Forces, Translational -MSC.Nastran”] )
# res_deinit_deform_plot( )
# sf_pause()

#---------------------------------------------------------------------

#---------------------------------------------------------------------
# File : spool_res_deform.ses
#
# Purpose : This file will open the “spool.db” database
# and reads the results from files “spool.op2”
# and “spool.jbr”.
#
# This session file assumes that the files spool.db,
# spool.op2 and spool.jbr already exist. For
# instructions regarding creating these files see
# file “spool.ses”.
#
# 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.
#
#---------------------------------------------------------------------
#
# Open the “spool.db” database.
uil_file_open.go( “spool.db”)

# Set “fem_model” as current group


ga_group_current_set( “fem_model” )

# Read in the .op2 (Binary/Text) results file.


analysis_import( “MSC.Nastran”, “spool”, “Results File”, @
“./spool.op2”, TRUE )

# Plot the results


# res_init_fringe_plot( )
# res_create_fringe_plot_rec3( 23, 2, 1, 1, 1, 1, 0, 0, 1., ““,@
# 1, 2, 3, 23, 1, 1, 0., 30, 0, 1 )
# res_make_fringe_plot( 1, [1], [1], [““], [0.], [“DEFAULT, Static “//@
# “Subcase: Displacements, Translational (VEC-MAG) -MSC.Nastran” ] )
# res_deinit_fringe_plot( )
# sf_pause()

#res_init_fringe_plot( )
#res_create_fringe_plot_rec3( 25, 2, 1, 1, 1, 1, 0, 0, 1., ““, @
# 2, 3, 6, 52, 2, 1, 0., 30, 0, 1 )
#res_make_fringe_plot( 1, [1], [1], [““], [0.], [ “DEFAULT, Static “//@
# “Subcase: Stress Tensor At Z1 (VON-MISES) -MSC.Nastran”] )
#res_deinit_fringe_plot( )
# sf_pause()

res_init_deform_plot( )
res_create_deform_plot_rec2( 24, 2, 1, 3, [27, 28, 29, 0, 0, 0], @
1, 1, 0., 8, 0, 1, 0, [0., 0., 0.] )
res_make_deform_plot( 1, [1], [1], [““], [0.], [“DEFAULT, Static “//@
“Subcase: Displacements, Translational -MSC.Nastran”] )
Main Index
1978
Code Examples

res_deinit_deform_plot( )
# sf_pause()

# res_init_deform_plot( )
# res_create_deform_plot_rec2( 26, 1, 1, 3, [27, 28, 29, 0, 0, 0], @
# 1, 1, 0., 8, 0, 1, 0, [0., 0., 0.] )
# res_make_deform_plot( 1, [1], [1], [““], [0.], [“DEFAULT, Static “//@
# “Subcase: Constraint Forces, Translational -MSC.Nastran”] )
# res_deinit_deform_plot( )
# sf_pause()

#---------------------------------------------------------------------

#---------------------------------------------------------------------
# File : spool_res_vector.ses
#
# Purpose : This file will open the “spool.db” database
# and reads the results from files “spool.op2”
# and “spool.jbr”.
#
# This session file assumes that the files spool.db,
# spool.op2 and spool.jbr already exist. For
# instructions regarding creating these files see
# file “spool.ses”.
#
# 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.
#
#---------------------------------------------------------------------
#
# Open the “spool.db” database.
uil_file_open.go( “spool.db”)

# Set “fem_model” as current group


ga_group_current_set( “fem_model” )

# Read in the .op2 (Binary/Text) results file.


analysis_import( “MSC.Nastran”, “spool”, “Results File”, @
“./spool.op2”, TRUE )

# Plot the results


res_create_vector_plot_rec( 4, 2, 3, [27, 28, 29, 0, 0, 0], @
[1, 1, 1], 1, 1, 0, 0, 1, 0., 2, 1, 1, 1 )

res_make_vector_plot( 1, [1], [2], [““], [0.], [ “DEFAULT,”// @


“ Static Subcase: Displacements, Translational -MSC.Nastran”] )
res_deinit_vector_plot( )

#---------------------------------------------------------------------

#---------------------------------------------------------------------
# File name : titles.ses
#
# Purpose : This file is used to create a new database
# “new.db” and create some titles in it.
#
# 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.
#
#---------------------------------------------------------------------
# Variable Declarations
Main Index
CHAPTER 18 1979
Support Files

STRING s_name[32]
REAL r_x,r_y
INTEGER i_index,i_color, i_size
#---------------------------------------------------------------------
# Create a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002

# Create some titles and post them to the default viewport


FOR(i_index= 1 TO 5)
# Create the Title
r_x = i_index * 15
r_y = i_index * 15
i_color = i_index * 3
i_size = i_index
s_name = “Title “//str_from_integer(i_index)
i_return_value = ga_title_create(s_name,r_x,r_y,i_color,i_size )
# Post the title
ga_viewport_title_post(““,s_name)
END FOR

#---------------------------------------------------------------------

/*****************************************************************
* Purpose : To Create a FORM to facilitate the examples
* for functions in MSC.Acumen Manual.
*
* A medium width half height sized form is created
* containing the text widget, a frame widget, a list
* box widget and a button widget.
*
* Side Effects :
* <none>
*
******************************************************************/

#ifndef user_form
#define user_form

#include “appforms.p”

CLASS USER_FORM

CLASSWIDE widget user_form_id, user_text_id, user_button_id


CLASSWIDE widget user_frame_id,user_databox_id,user_list_id

/*****************************************************************
* FUNCTION init
*
* Purpose :
*
* Initialize the User Form.
*
* Input :
*
* <none>
*
* Output :
*
* <none>
*
******************************************************************/
Main Index
1980
Code Examples

FUNCTION init()

REAL y_loc, x_loc, f_height


STRING s_initial[64]

y_loc = FORM_Y_LOC + (FORM_WID_MED/2)


x_loc = (SCREEN_WID - FORM_WID_MED)/2

user_form_id = UI_FORM_CREATE( @
/* Callback */ ““, @
/* x location */ x_loc, @
/* y location */ y_loc, @
/* position */ “UL”, @
/* width */ FORM_WID_MED, @
/* height */ FORM_HGT_HALF, @
/* label */ “USER FORM”, @
/* unused */ ““)

y_loc = INTER_WIDGET_SPACE
x_loc = INTER_WIDGET_SPACE
s_initial = “This is the first string displayed.\n”// @
“You can edit these strings”

user_text_id = UI_TEXT_CREATE( @
/* parent */ user_form_id, @
/* call back */ ““, @
/* x location */ x_loc, @
/* y location */ y_loc, @
/* width */ TBOX_WID_DOUBLE, @
/* num rows */ 3, @
/* label */ “Text Widget”, @
/* text */ s_initial, @
/* editable */ TRUE)

y_loc = y_loc + @
3*TEXT_FONT_HGT + @
3*INTER_WIDGET_SPACE + @
FRAME_LABEL_HGT

x_loc = (FORM_WID_MED - FRAME_WID_SINGLE )/2

f_height = FRAME_T_MARGIN + @
LBOX_3L_HGT_LABOVE + @
INTER_WIDGET_SPACE + @
FRAME_B_MARGIN

user_frame_id = UI_FRAME_CREATE( @
/* parent */ user_form_id, @
/* call back */ ““, @
/* x location */ x_loc, @
/* y location */ y_loc, @
/* width */ FRAME_WID_SINGLE, @
/* height */ f_height, @
/* label */ “Frame Widget”)

user_list_id = UI_LISTBOX_CREATE( @
/* parent */ user_frame_id, @
/* call back */ “user_list_cb”, @
/* x location */ FRAME_L_MARGIN, @
/* y location */ FRAME_T_MARGIN, @
/* width */ LBOX_WID_SINGLE, @
/* num rows */ 3, @
/* label */ “List Box Widget”, @
/* Selection type*/ “MULTIPLE”, @
/* Sort */ TRUE)
Main Index
CHAPTER 18 1981
Support Files

ui_item_create(user_list_id, “First__row_text”, “First__row_text”, FALSE)


ui_item_create(user_list_id, “Second_row_text”, “Second_row_text”, FALSE)
ui_item_create(user_list_id, “Third__row_text”, “Third__row_text”, FALSE)
ui_item_create(user_list_id, “Fourth_row_text”, “Fourth_row_text”, FALSE)

y_loc = y_loc + f_height + 3* INTER_WIDGET_SPACE


x_loc = (FORM_WID_MED - DBOX_WID_SINGLE )/2

user_databox_id = UI_DATABOX_CREATE( @
/* parent */ user_form_id, @
/* call back */ “user_databox_cb”, @
/* x location */ x_loc, @
/* y location */ y_loc, @
/* label_length */ 0.0, @
/* Box length */ DBOX_WID_SINGLE, @
/* label */ “Databox Widget”, @
/* Value */ ““, @
/* Label Above */ TRUE, @
/* Datatype */ “STRING”, @
/* Num Values */ 0)

y_loc = FORM_HGT_HALF - @
2* INTER_WIDGET_SPACE - @
BUTTON_DEFAULT_HGT

user_button_id = UI_BUTTON_CREATE ( @
/* parent */ user_form_id, @
/* call back */ “user_button_cb”, @
/* x location */ BUTTON_THIRD_X_LOC_CEN_MED, @
/* y location */ y_loc, @
/* width */ BUTTON_WID_THIRD, @
/* height */ 0, @
/* label */ “OK”, @
/* unused */ TRUE, @
/* highlight */ FALSE)

END FUNCTION /* init() */

/*****************************************************************
* FUNCTION display
*
* Purpose :
*
* To display the User Form.
*
* Input :
*
* <none>
*
* Output :
*
* <none>
*
******************************************************************/

FUNCTION display()

ui_form_display(“USER_FORM”)

END FUNCTION /* display */

/*****************************************************************
* FUNCTION exit
*
* Purpose :
Main Index
1982
Code Examples

*
* To delete the form.
*
* Input :
*
* <none>
*
* Output :
*
* <none>
*
******************************************************************/
FUNCTION exit()

ui_write(“In exit function of USER_FORM”)


ui_write(“When ui_wid_exit() is called it executed exit” // @
“ function”)
ui_write(“Deleting the form ......”)
ui_form_delete(“USER_FORM”)

END FUNCTION
/*****************************************************************
* FUNCTION get_widget_ids()
*
* Purpose :
*
* To output the widget ids
*
* Input :
*
* <none>
*
* Output :
*
* user_widgets() - Widget ids of the user_form widgets
*
******************************************************************/

FUNCTION get_widget_ids(u_widget)
WIDGET u_widget()

sys_allocate_array(u_widget,1,6)

u_widget(1)= user_form_id
u_widget(2)= user_text_id
u_widget(3)= user_frame_id
u_widget(4)= user_list_id
u_widget(5)= user_databox_id
u_widget(6)= user_button_id

ui_write(“Widget ids are stored in the following order”)


ui_write(“user_form_id is”)
dump u_widget(1)
ui_write(“user_text_id is”)
dump u_widget(2)
ui_write(“user_frame_id is”)
dump u_widget(3)
ui_write(“user_list_id is”)
dump u_widget(4)
ui_write(“user_databox_id is”)
dump u_widget(5)
ui_write(“user_button_id is”)
dump u_widget(6)

END FUNCTION /* get_widget_ids */


Main Index
CHAPTER 18 1983
Support Files

/*****************************************************************
* FUNCTION user_databox_cb
*
* Purpose :
*
* Displays the value entered in databox in history window
*
* Input :
*
* <none>
*
* Output :
*
* <none>
*
******************************************************************/

FUNCTION user_databox_cb(s_event)
STRING s_event[]

STRING s_value[128]

IF ( s_event == “CR” ) THEN


ui_wid_get( user_databox_id, “VALUE”, s_value )
ui_write(“You have entered “// s_value//” in the databox”)
END IF

END FUNCTION

/*****************************************************************
* FUNCTION user_button_cb
*
* Purpose :
*
* Hides the USER form.
*
* Input :
*
* <none>
*
* Output :
*
* <none>
*
******************************************************************/

FUNCTION user_button_cb()

/*
This class function can be set up to delete the form
with the following call:

ui_form_delete(“USER_FORM”)

but is currently set up to do nothing.


*/

END FUNCTION

/*****************************************************************
* FUNCTION user_list_cb
*
* Purpose :
*
* Writes the choice selected in the list box to the history
* window.
Main Index
1984
Code Examples

*
* Input :
*
* <none>
*
* Output :
*
* <none>
*
******************************************************************/

FUNCTION user_list_cb(i_num_val,s_vstr)
INTEGER i_num_val
STRING s_vstr[]()

IF ( i_num_val > 0 ) THEN


ui_write(“You have selected.. “)
ui_write(s_vstr)
ui_write(“ from the list box.”)
END IF

END FUNCTION
/*****************************************************************/

END CLASS /* USER_FORM */

#endif

/*****************************************************************
* Purpose : To Create a FORM to facilitate the examples
* for functions in MSC.Acumen Manual.
*
* A medium width half height sized form is created
* containing the text widget, a frame widget, a list
* box widget and a button widget.
*
* Side Effects :
* <none>
*
******************************************************************/

#ifndef user_form
#define user_form

#include “appforms.p”

CLASS USER_FORM

CLASSWIDE widget user_form_id, user_text_id, user_button_id


CLASSWIDE widget user_frame_id,user_databox_id,user_list_id

/*****************************************************************
* FUNCTION init
*
* Purpose :
*
* Initialize the User Form.
*
* Input :
*
* <none>
*
* Output :
Main Index
CHAPTER 18 1985
Support Files

*
* <none>
*
******************************************************************/

FUNCTION init()

REAL y_loc, x_loc, f_height


STRING s_initial[64]

y_loc = FORM_Y_LOC + (FORM_WID_MED/2)


x_loc = (SCREEN_WID - FORM_WID_MED)/2

user_form_id = UI_FORM_CREATE( @
/* Callback */ ““, @
/* x location */ x_loc, @
/* y location */ y_loc, @
/* position */ “UL”, @
/* width */ FORM_WID_MED, @
/* height */ FORM_HGT_HALF, @
/* label */ “USER FORM”, @
/* unused */ ““)

y_loc = INTER_WIDGET_SPACE
x_loc = INTER_WIDGET_SPACE
s_initial = “This is the first string displayed.\n”// @
“You can edit these strings”

user_text_id = UI_TEXT_CREATE( @
/* parent */ user_form_id, @
/* call back */ ““, @
/* x location */ x_loc, @
/* y location */ y_loc, @
/* width */ TBOX_WID_DOUBLE, @
/* num rows */ 3, @
/* label */ “Text Widget”, @
/* text */ s_initial, @
/* editable */ TRUE)

y_loc = y_loc + @
3*TEXT_FONT_HGT + @
3*INTER_WIDGET_SPACE + @
FRAME_LABEL_HGT

x_loc = (FORM_WID_MED - FRAME_WID_SINGLE )/2

f_height = FRAME_T_MARGIN + @
LBOX_3L_HGT_LABOVE + @
INTER_WIDGET_SPACE + @
FRAME_B_MARGIN

user_frame_id = UI_FRAME_CREATE( @
/* parent */ user_form_id, @
/* call back */ ““, @
/* x location */ x_loc, @
/* y location */ y_loc, @
/* width */ FRAME_WID_SINGLE, @
/* height */ f_height, @
/* label */ “Frame Widget”)

user_list_id = UI_LISTBOX_CREATE( @
/* parent */ user_frame_id, @
/* call back */ “user_list_cb”, @
/* x location */ FRAME_L_MARGIN, @
/* y location */ FRAME_T_MARGIN, @
/* width */ LBOX_WID_SINGLE, @
Main Index
1986
Code Examples

/* num rows */ 3, @
/* label */ “List Box Widget”, @
/* Selection type*/ “MULTIPLE”, @
/* Sort */ TRUE)

y_loc = y_loc + f_height + 3* INTER_WIDGET_SPACE


x_loc = (FORM_WID_MED - DBOX_WID_SINGLE )/2

user_databox_id = UI_DATABOX_CREATE( @
/* parent */ user_form_id, @
/* call back */ “user_databox_cb”, @
/* x location */ x_loc, @
/* y location */ y_loc, @
/* label_length */ 0.0, @
/* Box length */ DBOX_WID_SINGLE, @
/* label */ “Databox Widget”, @
/* Value */ ““, @
/* Label Above */ TRUE, @
/* Datatype */ “STRING”, @
/* Num Values */ 0)

y_loc = FORM_HGT_HALF - @
2* INTER_WIDGET_SPACE - @
BUTTON_DEFAULT_HGT

user_button_id = UI_BUTTON_CREATE ( @
/* parent */ user_form_id, @
/* call back */ “user_button_cb”, @
/* x location */ BUTTON_THIRD_X_LOC_CEN_MED, @
/* y location */ y_loc, @
/* width */ BUTTON_WID_THIRD, @
/* height */ 0, @
/* label */ “OK”, @
/* unused */ TRUE, @
/* highlight */ FALSE)

END FUNCTION /* init() */

/*****************************************************************
* FUNCTION display
*
* Purpose :
*
* To display the User Form.
*
* Input :
*
* <none>
*
* Output :
*
* <none>
*
******************************************************************/

FUNCTION display()

ui_form_display(“USER_FORM”)

END FUNCTION /* display */

/*****************************************************************
* FUNCTION exit
*
* Purpose :
Main Index
CHAPTER 18 1987
Support Files

*
* To delete the form.
*
* Input :
*
* <none>
*
* Output :
*
* <none>
*
******************************************************************/
FUNCTION exit()

ui_write(“In exit function of USER_FORM”)


ui_write(“When ui_wid_exit() is called it executed exit” // @
“ function”)
ui_write(“Deleting the form ......”)
ui_form_delete(“USER_FORM”)

END FUNCTION
/*****************************************************************
* FUNCTION get_widget_ids()
*
* Purpose :
*
* To output the widget ids
*
* Input :
*
* <none>
*
* Output :
*
* user_widgets() - Widget ids of the user_form widgets
*
******************************************************************/

FUNCTION get_widget_ids(u_widget)
WIDGET u_widget()

sys_allocate_array(u_widget,1,6)

u_widget(1)= user_form_id
u_widget(2)= user_text_id
u_widget(3)= user_frame_id
u_widget(4)= user_list_id
u_widget(5)= user_databox_id
u_widget(6)= user_button_id

ui_write(“Widget ids are stored in the following order”)


ui_write(“user_form_id is”)
dump u_widget(1)
ui_write(“user_text_id is”)
dump u_widget(2)
ui_write(“user_frame_id is”)
dump u_widget(3)
ui_write(“user_list_id is”)
dump u_widget(4)
ui_write(“user_databox_id is”)
dump u_widget(5)
ui_write(“user_button_id is”)
dump u_widget(6)

END FUNCTION /* get_widget_ids */


Main Index
1988
Code Examples

/*****************************************************************
* FUNCTION user_databox_cb
*
* Purpose :
*
* Displays the value entered in databox in history window
*
* Input :
*
* <none>
*
* Output :
*
* <none>
*
******************************************************************/

FUNCTION user_databox_cb(s_event)
STRING s_event[]

STRING s_value[128]

IF ( s_event == “CR” ) THEN


ui_wid_get( user_databox_id, “VALUE”, s_value )
ui_write(“You have entered “// s_value//” in the databox”)
END IF

END FUNCTION

/*****************************************************************
* FUNCTION user_button_cb
*
* Purpose :
*
* Hides the USER form.
*
* Input :
*
* <none>
*
* Output :
*
* <none>
*
******************************************************************/

FUNCTION user_button_cb()

ui_form_delete(“USER_FORM”)

END FUNCTION

/*****************************************************************
* FUNCTION user_list_cb
*
* Purpose :
*
* Writes the choice selected in the list box to the history
* window.
*
* Input :
*
* <none>
*
* Output :
*
Main Index
CHAPTER 18 1989
Support Files

* <none>
*
******************************************************************/

FUNCTION user_list_cb(i_num_val,s_vstr)
INTEGER i_num_val
STRING s_vstr[]()

IF ( i_num_val > 0 ) THEN


ui_write(“You have selected.. “)
ui_write(s_vstr)
ui_write(“ from the list box.”)
END IF

END FUNCTION
/*****************************************************************/

END CLASS /* USER_FORM */

#endif

/*****************************************************************
* Purpose : To Create a User Graph form.
*
* A medium width half height sized form is created
* containing a GRAPHICS widget and a push button to acknowledge
* and remove the form.
*
* Side Effects :
* <none>
*
******************************************************************/

#ifndef user_graph
#define user_graph

#include “appforms.p”

CLASS USER_GRAPH

CLASSWIDE widget user_form_id, ok_button


CLASSWIDE widget frame_id, user_graph_id

/*****************************************************************
* FUNCTION init
*
* Purpose :
*
* Initialize the User Graph.
*
* Input :
*
* <none>
*
* Output :
*
* <none>
*
******************************************************************/

FUNCTION init()

REAL y_loc, x_loc, g_width, g_height,f_width,f_height

y_loc = FORM_Y_LOC + (FORM_WID_SML/2)


Main Index
1990
Code Examples

x_loc = (SCREEN_WID - FORM_WID_SML)/2

user_form_id = UI_FORM_CREATE( @
/* Callback */ ““, @
/* x location */ x_loc, @
/* y location */ y_loc, @
/* position */ “UL”, @
/* width */ FORM_WID_SML, @
/* height */ FORM_HGT_HALF, @
/* label */ “FORM with GRAPH widget”, @
/* unused */ ““)

y_loc = FORM_HGT_QTR/3
x_loc = (FORM_WID_SML - FORM_HGT_QTR)/2
f_width = FORM_HGT_QTR + FRAME_L_MARGIN + FRAME_R_MARGIN
f_height = FORM_HGT_QTR + FRAME_T_MARGIN + FRAME_B_MARGIN

frame_id = UI_FRAME_CREATE( @
/* parent */ user_form_id, @
/* call back */ ““, @
/* x location */ x_loc, @
/* y location */ y_loc, @
/* width */ f_width, @
/* height */ f_height, @
/* label */ ““)

y_loc = INTER_WIDGET_SPACE + FRAME_T_MARGIN/2


x_loc = INTER_WIDGET_SPACE + FRAME_L_MARGIN/2
g_width = FORM_HGT_QTR - 2*INTER_WIDGET_SPACE
g_height = FORM_HGT_QTR - 2*INTER_WIDGET_SPACE

user_graph_id = UI_GRAPH_CREATE ( @
/* parent */ frame_id, @
/* name */ “Graph Widget”, @
/* x location */ x_loc, @
/* y location */ y_loc, @
/* width */ g_width, @
/* height */ g_height )

y_loc = FORM_HGT_HALF - @
2* INTER_WIDGET_SPACE @
- BUTTON_DEFAULT_HGT
x_loc = (FORM_WID_SML - BUTTON_WID_THIRD)/2

ok_button = UI_BUTTON_CREATE ( @
/* parent */ user_form_id, @
/* call back */ “ok_button_cb”, @
/* x location */ x_loc, @
/* y location */ y_loc, @
/* width */ BUTTON_WID_THIRD, @
/* height */ 0, @
/* label */ “OK”, @
/* unused */ TRUE, @
/* highlight */ TRUE)

END FUNCTION /* init() */

/*****************************************************************
* FUNCTION display
*
* Purpose :
*
* To display the User Graph form.
*
* Input :
Main Index
CHAPTER 18 1991
Support Files

*
* <none>
*
* Output :
*
* <none>
*
******************************************************************/

FUNCTION display()

ui_form_display(“USER_GRAPH”)

END FUNCTION /* display */

/*****************************************************************
* FUNCTION ok_button_cb
*
* Purpose :
*
* Deletes the User Graph form.
*
* Input :
*
* <none>
*
* Output :
*
* <none>
*
******************************************************************/

FUNCTION ok_button_cb()

ui_form_delete(“USER_GRAPH”)

END FUNCTION
/*****************************************************************/

END CLASS /* USER_GRAPH */

#endif

1000000000 Example Customization


1000000001 There are %I% elements with %F% average length in database %A%

Main Index
1992
Code Examples

Main Index

You might also like