0% found this document useful (0 votes)
1K views1,410 pages

MSC - Acumen 2006 Code Examples

This manual provides code examples for the PCL function. 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.

Uploaded by

Kevin
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views1,410 pages

MSC - Acumen 2006 Code Examples

This manual provides code examples for the PCL function. 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.

Uploaded by

Kevin
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

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,