MSC - Acumen 2006 Code Examples
MSC - Acumen 2006 Code Examples
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 ()
# -------------------------------------------------------------------
i_return_value= @
db_get_p3_version @
( s_p3_ver)
dump s_p3_ver
dump i_return_value
# -------------------------------------------------------------------
is_batch ()
# -------------------------------------------------------------------
# Variable Declaration
#
LOGICAL l_status
# -------------------------------------------------------------------
l_status=is_batch()
dump l_status
# -------------------------------------------------------------------
user_db_close ()
user_db_new ()
user_db_open ()
Main Index
CHAPTER 1 5
Introduction
user_quit ()
user_start ()
Main Index
6
Code Examples
utl_get_terse_version ()
# -------------------------------------------------------------------
utl_get_terse_version @
( s_terse_version)
dump s_terse_version
# -------------------------------------------------------------------
utl_query_version_level ()
# -------------------------------------------------------------------
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 ()
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 )
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
# 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 )
i_return_value = @
db_count_client_labels_by_type @
( i_client_type, @
i_nbr_of_labels )
Main Index
612
Code Examples
db_count_general_field ()
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]
#----------------------------------------------------------------------
# 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
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)
#---------------------------------------------------------------------
# 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)
#---------------------------------------------------------------------
# Closing the file - new.db
uil_file_close.goquit()
#---------------------------------------------------------------------
db_create_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_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 ()
# -------------------------------------------------------------------
# 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 )
db_get_all_client_data ()
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 )
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 ()
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 )
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 ()
# -------------------------------------------------------------------
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 )
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 ()
STRING s_string_data[25](1)=[“Geometric”]
# -------------------------------------------------------------------
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 )
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 ()
# -------------------------------------------------------------------
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 )
i_return_value = @
db_get_client_labels_by_type @
( i_client_type, @
i_labels )
dump i_labels
dump i_return_value
# 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 )
i_return_value = @
db_get_client_labels_by_type @
( i_client_type, @
i_labels )
Main Index
CHAPTER 2 625
Model
db_get_db_version ()
# -------------------------------------------------------------------
i_return_value = @
db_get_db_version @
( s_db_ver )
dump i_return_value
dump s_db_ver
# -------------------------------------------------------------------
db_get_general_field ()
#
#---------------------------------------------------------------------
# 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]
#----------------------------------------------------------------------
# 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
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)
uil_file_close.goquit()
#---------------------------------------------------------------------
# End of File.
db_get_general_field_length ()
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]
#----------------------------------------------------------------------
# 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
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 )
uil_file_close.goquit()
#---------------------------------------------------------------------
db_get_model_file_suffix ()
# ( 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 ()
# -------------------------------------------------------------------
# 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 )
i_return_value = @
db_get_next_client_entity_label @
( i_label )
dump i_label
dump i_return_value
# 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 )
# -------------------------------------------------------------------
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 ()
get_current_dir ()
# 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 ()
#---------------------------------------------------------------------
neutral_export2 ()
#
# 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”)
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
nf_write ()
# 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”)
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
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
Main Index
638
Code Examples
nf_write2 ()
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
p3_ps_get_xmt ()
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().
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 ()
s_dirname=””
i_return_value = @
get_current_dir @
(s_dirname )
dump s_dirname
s_dirname=””
i_return_value = @
get_current_dir @
(s_dirname )
dump s_dirname
i_return_value = @
set_current_dir @
(s_savedir )
dump i_return_value
dump s_savedir
#---------------------------------------------------------------------
sf_write_disable ()
# Call pcl_func1()
pcl_func1()
# Call pcl_func1()
pcl_func1()
Main Index
642
Code Examples
ugi_export_iges_v1 ()
# 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
ugi_import_iges_v3 ()
#
# 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
$? 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
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 ()
ui_framemaker ()
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 )
s_classname=”MSG”
ui_form_to_frame @
(s_classname, @
r_scale )
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 )
i_option = 0
# With i_option =0, ui_form_display() reverts back to normal
# operation.
ui_framemaker @
(i_option, @
r_scale )
Main Index
648
Code Examples
uil_file_open.open_db ()
sf_pause()
utl_is_locked_file ()
dump i_return_value
#---------------------------------------------------------------------
utl_lock_file ()
utl_unlock_file ()
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 ()
s_name = “Clipping_Plane_1”
# 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
clip_plane_zoom_calc ()
Main Index
CHAPTER 4 657
Graphics
db_get_current_viewport_id ()
#---------------------------------------------------------------------
end_vrml_animation ()
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
#----------------------------------------------------------------------
# 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.
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_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 )
#----------------------------------------------------------------------
# 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)"] )
#----------------------------------------------------------------------
# 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 ()
ga_clip_plane_create
ga_clip_plane_delete ()
ga_clip_plane_delete @
( s_name )
dump i_return_value
ga_clip_plane_direction_get ()
dump i_return_value
dump ra_value
ga_clip_plane_direction_set ()
ga_clip_plane_icon_get ()
ga_clip_plane_icon_set ()
uil_file_open.go(“spool.db”)
ga_clip_plane_location_get ()
# 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”)
ga_clip_plane_location_set ()
#
# 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”)
ga_clip_plane_movement_get ()
# 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
Main Index
CHAPTER 4 671
Graphics
ga_clip_plane_movement_set ()
# Flag value
dump i_value
# 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
ga_clip_plane_nclip_planes_get ()
“default_viewport”, 1, [“default_group”] )
# Initialize saa_clip_plane_list
saa_clip_plane_list = [“Clipping_Plane_1” , @
“Clipping_Plane_2” , @
“Clipping_Plane_3” ]
ga_clip_plane_nposted_get ()
#
#---------------------------------------------------------------------
# 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”)
# Initialize saa_clip_plane_list
saa_clip_plane_list = [“Clipping_Plane_1” , @
“Clipping_Plane_2” , @
“Clipping_Plane_3” ]
ga_clip_plane_post ()
ga_clip_plane_posted_get ()
# to create spool.db
#
# This file can be run by 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”)
# Initialize saa_clip_plane_list
saa_clip_plane_list = [“Clipping_Plane_1” , @
“Clipping_Plane_2” , @
“Clipping_Plane_3” ]
Main Index
CHAPTER 4 677
Graphics
ga_clip_plane_unpost ()
ga_clip_plane_up_set ()
ga_elem_scalar_create ()
dump i_ncases,iv_lcids,iv_nsub
dump i_return_value
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
sys_free_array(iv_lcids)
sys_free_array(iv_nsub)
sys_free_array(iv_elem_ids)
sys_free_array(iv_nbr_values)
sys_free_array(rv_scalars)
Main Index
CHAPTER 4 681
Graphics
ga_elem_scalar_single_create ()
““,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
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)
ga_error ()
# 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
l_return_value = ga_error()
dump l_return_value
#---------------------------------------------------------------------
ga_light_attenuation_get ()
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
sys_free_array(sav_light_list)
#---------------------------------------------------------------------
ga_light_attenuation_set ()
i_return_value = @
ga_light_attenuation_get @
( s_name, @
r_old_value )
dump i_return_value
dump r_old_value
sys_free_array(sav_light_list)
#---------------------------------------------------------------------
ga_light_color_get ()
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)
sys_free_array(sav_light_list)
#---------------------------------------------------------------------
ga_light_color_set ()
sys_allocate_array(sav_light_list,1,i_nlights)
sys_free_array(sav_light_list)
#---------------------------------------------------------------------
ga_light_create ()
#---------------------------------------------------------------------
# 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”)
sys_allocate_array(sav_light_list,1,i_nlights)
sys_free_array(sav_light_list)
#---------------------------------------------------------------------
ga_light_delete ()
#
#---------------------------------------------------------------------
# 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”)
sys_allocate_array(sav_light_list,1,i_nlights)
sys_free_array(sav_light_list)
#---------------------------------------------------------------------
ga_light_direction_get ()
sys_allocate_array(sav_light_list,1,i_nlights)
sys_free_array(sav_light_list)
#---------------------------------------------------------------------
Main Index
CHAPTER 4 691
Graphics
ga_light_direction_set ()
sys_allocate_array(sav_light_list,1,i_nlights)
ra_value )
dump i_return_value
sys_free_array(sav_light_list)
#---------------------------------------------------------------------
ga_light_icon_get ()
sys_allocate_array(sav_light_list,1,i_nlights)
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 ()
sys_free_array(sav_light_list)
#---------------------------------------------------------------------
ga_light_intensity_get ()
sys_allocate_array(sav_light_list,1,i_nlights)
sys_free_array(sav_light_list)
#---------------------------------------------------------------------
ga_light_intensity_set ()
sys_allocate_array(sav_light_list,1,i_nlights)
ga_light_posted_get @
( sav_light_list )
dump i_return_value
dump sav_light_list
sys_free_array(sav_light_list)
#---------------------------------------------------------------------
ga_light_lights_get ()
INTEGER i_return_value
#---------------------------------------------------------------------
# The file “sphere.ses” opens a new database and creates a spherical
# surface in it.
sf_play(“sphere.ses”)
sys_allocate_array(sav_light_list,1,i_nlights)
sys_free_array(sav_light_list)
#---------------------------------------------------------------------
ga_light_location_get ()
sys_allocate_array(sav_light_list,1,i_nlights)
sys_free_array(sav_light_list)
#---------------------------------------------------------------------
ga_light_location_set ()
sys_allocate_array(sav_light_list,1,i_nlights)
ga_light_posted_get @
( sav_light_list )
dump i_return_value
dump sav_light_list
sys_free_array(sav_light_list)
#---------------------------------------------------------------------
ga_light_movement_get ()
#---------------------------------------------------------------------
# The file “sphere.ses” opens a new database and creates a spherical
# surface in it.
sf_play(“sphere.ses”)
sys_allocate_array(sav_light_list,1,i_nlights)
sys_free_array(sav_light_list)
#---------------------------------------------------------------------
ga_light_movement_set ()
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)
ga_view_aa_set(-157.,34.,0.)
ga_view_aa_set(23.,-34.,0.)
ga_view_aa_set(-157.,34.,0.)
ga_view_aa_set(23.,-34.,0.)
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 ()
ga_light_nposted_get ()
#
# 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”)
ga_light_post ()
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
ga_light_posted_get ()
#
# 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”)
sys_free_array(sav_light_list)
#---------------------------------------------------------------------
ga_light_type_get ()
sys_allocate_array(sav_light_list,1,i_nlights)
sys_free_array(sav_light_list)
#---------------------------------------------------------------------
ga_light_type_set ()
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”)
sys_allocate_array(sav_light_list,1,i_nlights)
sys_free_array(sav_light_list)
#---------------------------------------------------------------------
ga_light_unpost ()
#
# 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”)
# 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
ga_lookup_colors_get ()
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)
ga_lookup_colors_set ()
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
# 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
# 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)
Main Index
712
Code Examples
ga_lookup_create ()
i_return_value = @
ga_lookup_create @
( s_name, @
i_number, @
ra_rgb )
dump i_return_value
( s_old_name )
dump i_return_value
ga_lookup_current_get ()
Main Index
714
Code Examples
ga_lookup_current_set ()
i_return_value = @
ga_lookup_create @
( s_name, @
i_number, @
ra_rgb )
dump i_return_value
ga_lookup_delete ()
i_return_value = @
ga_lookup_create @
( s_name, @
i_number, @
ra_rgb )
dump i_return_value
Main Index
716
Code Examples
ga_lookup_ncolors_get ()
dump s_name
ga_lookup_ntables_get ()
Main Index
718
Code Examples
ga_lookup_rename ()
s_old_name = s_name
s_new_name = “New_LUT”
i_return_value = @
ga_lookup_rename @
( s_old_name, @
s_new_name )
dump i_return_value
ga_lookup_current_get @
( s_name )
dump s_name
ga_lookup_tables_get ()
SYS_ALLOCATE_ARRAY(sa_tables,1,i_ntables)
SYS_FREE_ARRAY(sa_tables)
Main Index
720
Code Examples
ga_node_deform_create ()
Main Index
CHAPTER 4 721
Graphics
dump i_return_value
i_return_value = @
ga_group_node_deform_set @
( “fem_model”, @
i_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_range_contour_get ()
#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)
# Number of ranges
dump i_nranges
sys_allocate_array(sav_ranges,1,i_nranges)
# List of ranges
dump sav_ranges
ga_range_contour_set ()
# Number of ranges
dump i_nranges
sys_allocate_array(sav_ranges,1,i_nranges)
# List of ranges
dump sav_ranges
s_name = sav_ranges(1)
# 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
sys_free_array(sav_ranges)
#---------------------------------------------------------------------
ga_range_create
sys_allocate_array(sav_ranges,1,i_nranges)
s_old_name = sav_ranges(1)
sys_free_array(sav_ranges)
sys_allocate_array(sav_ranges,1,i_nranges)
sys_free_array(sav_ranges)
#---------------------------------------------------------------------
ga_range_delete ()
sys_allocate_array(sav_ranges,1,i_nranges)
s_old_name = sav_ranges(1)
( s_name, @
i_number )
dump i_return_value
sys_free_array(sav_ranges)
sys_allocate_array(sav_ranges,1,i_nranges)
sys_free_array(sav_ranges)
#---------------------------------------------------------------------
Main Index
728
Code Examples
ga_range_exist_get ()
sys_allocate_array(sav_ranges,1,i_nranges)
ga_range_exist_get @
( s_name, @
i_flag )
dump i_return_value, i_flag
#---------------------------------------------------------------------
ga_range_nranges_get ()
ga_range_nvalues_get ()
sys_allocate_array(sav_ranges,1,i_nranges)
sys_free_array(sav_ranges)
#---------------------------------------------------------------------
ga_range_ranges_get ()
sys_allocate_array(sav_ranges,1,i_nranges)
sys_free_array(sav_ranges)
#---------------------------------------------------------------------
ga_range_rename ()
#
# This file can be run by 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”)
sys_allocate_array(sav_ranges,1,i_nranges)
i_return_value = @
ga_range_rename @
( s_old_name, @
s_new_name )
dump i_return_value
i_return_value = @
ga_range_rename @
( s_old_name, @
Main Index
CHAPTER 4 733
Graphics
s_new_name )
dump i_return_value
sys_free_array(sav_ranges)
#---------------------------------------------------------------------
ga_range_startend_set ()
sys_allocate_array(sav_ranges,1,i_nranges)
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)
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 ()
sys_allocate_array(sav_ranges,1,i_nranges)
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)
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
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 ()
( i_nranges )
dump i_return_value, i_nranges
sys_allocate_array(sav_ranges,1,i_nranges)
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_free_array(ra_from)
sys_free_array(ra_to)
sys_free_array(ra_mid)
sys_free_array(sav_ranges)
#---------------------------------------------------------------------
ga_range_values_set ()
#
#
# 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”)
sys_allocate_array(sav_ranges,1,i_nranges)
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)
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
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 ()
sys_allocate_array(iv_colors,1,i_number)
sys_free_array(iv_colors)
ga_spectrum_colors_set ()
sys_allocate_array(iv_old_colors,1,i_old_number)
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
ga_spectrum_continuous_get ()
ga_spectrum_continuous_set ()
( s_name, @
i_value )
dump i_return_value
ga_spectrum_create ()
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
# 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
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
dump i_return_value
# Session file paused. Press “Resume” to continue..
sf_pause()
sys_free_array(sav_spectrums)
Main Index
CHAPTER 4 747
Graphics
#---------------------------------------------------------------------
ga_spectrum_current_get ()
i_return_value = @
ga_spectrum_current_get @
( s_name )
dump i_return_value
dump s_name
ga_spectrum_current_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_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”)
# 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
dump i_return_value
# Session file paused. Press “Resume” to continue..
sf_pause()
Main Index
CHAPTER 4 749
Graphics
ga_spectrum_delete ()
# 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
sys_allocate_array(sav_spectrums,1,i_nspectrums)
dump i_return_value
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
sys_free_array(sav_spectrums)
#---------------------------------------------------------------------
ga_spectrum_interpolation_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
# 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”)
ga_spectrum_interpolation_set ()
Main Index
CHAPTER 4 753
Graphics
ga_spectrum_ncolors_get ()
ga_spectrum_nspectrums_get ()
ga_spectrum_rename ()
# 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”)
ga_spectrum_spectrums_get ()
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)
ga_title_color_get ()
#---------------------------------------------------------------------
# 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”)
sys_allocate_array(sav_list,1,i_posted)
sys_free_array(sav_list)
ga_title_color_set ()
# 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”)
sys_allocate_array(sav_list,1,i_posted)
sys_free_array(sav_list)
Main Index
CHAPTER 4 759
Graphics
ga_title_create ()
( s_name )
ga_title_delete ()
ga_title_delete @
( s_name )
ga_title_font_size_get ()
sys_allocate_array(sav_list,1,i_posted)
dump i_size
sys_free_array(sav_list)
ga_title_font_size_set ()
sys_allocate_array(sav_list,1,i_posted)
sys_free_array(sav_list)
ga_title_list_get ()
ga_title_num_get @
( i_ntitles )
dump i_return_value
dump i_ntitles
sys_allocate_array(sav_list,1,i_ntitles)
sys_free_array(sav_list)
ga_title_loc_get ()
sys_allocate_array(sav_list,1,i_posted)
sys_free_array(sav_list)
ga_title_loc_set ()
sf_play(“titles.ses”)
sys_allocate_array(sav_list,1,i_posted)
sys_free_array(sav_list)
ga_title_nposted_get ()
i_return_value = @
ga_title_nposted_get @
( i_nposted )
dump i_return_value
dump i_nposted
ga_title_num_get ()
i_return_value = @
ga_title_num_get @
( i_ntitles )
dump i_return_value
dump i_ntitles
uil_file_close.go()
#---------------------------------------------------------------------
ga_title_posted_get ()
sys_allocate_array(sav_list,1,i_posted)
sys_free_array(sav_list)
Main Index
CHAPTER 4 769
Graphics
ga_title_rename ()
s_new_name )
dump i_return_value
ga_vector_create ()
#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)
dump i_return_value
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
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_vector_get ()
# 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”)
dump i_return_value
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
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)
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)
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
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_vector_number_get ()
dump i_return_value
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
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_view_normal_get ()
# 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.
#---------------------------------------------------------------------
# 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 ()
gm_convert_name ()
s_orig_name=”/one/two/three/four”
dump s_new_name
#---------------------------------------------------------------------
gm_database_current ()
i_return_value = @
gm_database_current @
( s_dbname )
dump i_return_value, s_dbname
#---------------------------------------------------------------------
gm_draw_entity ()
# 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.
#---------------------------------------------------------------------
# Create a 2-D patch.
#---------------------------------------------------------------------
# Argument Initialization.
color_id = 5
entity_type = 3
entity_id = 1
#---------------------------------------------------------------------
# Create the segment id.
gm_segment_create(segment_id)
#---------------------------------------------------------------------
# Draw the selected entity.
#---------------------------------------------------------------------
# Dump the output of the function
dump i_return_value
#---------------------------------------------------------------------
# closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
gm_fit_view ()
gm_fullcolor_mode ()
i_return_value = gm_fullcolor_mode()
dump i_return_value
#---------------------------------------------------------------------
Main Index
CHAPTER 4 783
Graphics
gm_graphics_off ()
#---------------------------------------------------------------------
gm_graphics_on ()
#---------------------------------------------------------------------
gm_hilight_clear ()
ui_exec_function(“hilight”, “display”)
Main Index
CHAPTER 4 785
Graphics
#---------------------------------------------------------------------
gm_hilight_entity ()
i_id = 2
gm_hilight_entity @
( i_type, @
i_id, @
i_color )
# Unhighlight surface 1
i_id = 1
i_color= 0
gm_hilight_entity @
( i_type, @
i_id, @
i_color )
#---------------------------------------------------------------------
gm_hilight_string ()
STRING asm_create_patch_xy_created_ids[VIRTUAL]
INTEGER color_id
STRING entities[80]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new data base.
#---------------------------------------------------------------------
# Create a 2-D patch.
#---------------------------------------------------------------------
# Argument Initialization.
#---------------------------------------------------------------------
# Hilight all the selected entities.
#---------------------------------------------------------------------
# closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
gm_hilight_widget ()
uil_file_open.go(“spool.db”)
ui_exec_function(“hilight”,”display”)
gm_lookup_write ()
INTEGER i_ncolors
REAL ra_colors(16,3)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)
i_return_value = @
gm_lookup_write @
( i_start, @
i_ncolors, @
ra_colors )
dump i_return_value
#---------------------------------------------------------------------
gm_mpeg_pause_recording ()
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.
#---------------------------------------------------------------------
# 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 )
#---------------------------------------------------------------------
# Pause the recording .mpeg images file named "./new.mpg".
gm_mpeg_pause_recording( )
#---------------------------------------------------------------------
# Create the second 2-D patch.
#---------------------------------------------------------------------
# Resume the recording .mpeg images file named "./new.mpg".
gm_mpeg_resume_recording( )
#---------------------------------------------------------------------
# Delete the second 2-D patch.
#---------------------------------------------------------------------
# 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 ()
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.
#---------------------------------------------------------------------
# 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 )
#---------------------------------------------------------------------
# Pause the recording .mpeg images file named "./new.mpg".
gm_mpeg_pause_recording( )
#---------------------------------------------------------------------
# Create the second 2-D patch.
#---------------------------------------------------------------------
Main Index
CHAPTER 4 793
Graphics
gm_mpeg_resume_recording( )
#---------------------------------------------------------------------
# Delete the second 2-D patch.
#---------------------------------------------------------------------
# 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 ()
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.
#---------------------------------------------------------------------
# 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 )
#---------------------------------------------------------------------
# Pause the recording .mpeg images file named "./new.mpg".
gm_mpeg_pause_recording( )
#---------------------------------------------------------------------
# Create the second 2-D patch.
#---------------------------------------------------------------------
# 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.
#---------------------------------------------------------------------
# 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 ()
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.
#---------------------------------------------------------------------
# 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 )
#---------------------------------------------------------------------
# Pause the recording .mpeg images file named "./new.mpg".
gm_mpeg_pause_recording( )
#---------------------------------------------------------------------
# Create the second 2-D patch.
#---------------------------------------------------------------------
# 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.
#---------------------------------------------------------------------
# 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 ()
gm_viewport_hardware_mode_get @
( i_hard_flag )
#---------------------------------------------------------------------
gm_viewport_hardware_mode_set ()
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by 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”)
#---------------------------------------------------------------------
gm_viewport_id_to_name ()
#---------------------------------------------------------------------
gm_viewport_limits_get ()
#---------------------------------------------------------------------
gm_viewport_ncolors_get ()
gm_viewport_ncolors_get @
( i_ncolors )
dump i_ncolors
#---------------------------------------------------------------------
gm_viewport_refresh_off ()
# Force repaint
repaint_graphics()
# Force repaint
repaint_graphics()
#---------------------------------------------------------------------
gm_viewport_refresh_on ()
Main Index
802
Code Examples
gm_viewport_refresh_status ()
gm_viewport_view_corners ()
# 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”)
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 ()
#---------------------------------------------------------------------
gm_visibility_widget ()
gm_visibility_all(TRUE)
#---------------------------------------------------------------------
gm_write_image ()
# 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.
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
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
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.
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 ()
i_return_value = @
Main Index
810
Code Examples
ga_lookup_create @
( s_name, @
i_number, @
ra_rgb )
dump i_return_value
SYS_ALLOCATE_ARRAY(sa_tables,1,i_ntables)
SYS_FREE_ARRAY(sa_tables)
ga_lookup_current_set ()
uil_file_open.go(“spool.db”)
i_return_value = @
ga_lookup_create @
( s_name, @
i_number, @
ra_rgb )
dump i_return_value
ga_lookup_delete ()
# to create spool.db
#
# This file can be run by 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”)
i_return_value = @
ga_lookup_create @
( s_name, @
i_number, @
ra_rgb )
dump i_return_value
SYS_ALLOCATE_ARRAY(sa_tables,1,i_ntables)
SYS_FREE_ARRAY(sa_tables)
SYS_ALLOCATE_ARRAY(sa_tables,1,i_ntables)
SYS_FREE_ARRAY(sa_tables)
ga_range_create ()
Main Index
814
Code Examples
sys_allocate_array(sav_ranges,1,i_nranges)
sys_free_array(sav_ranges)
sys_allocate_array(sav_ranges,1,i_nranges)
#---------------------------------------------------------------------
ga_range_delete ()
#
#---------------------------------------------------------------------
# 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”)
sys_allocate_array(sav_ranges,1,i_nranges)
sys_free_array(sav_ranges)
sys_allocate_array(sav_ranges,1,i_nranges)
#---------------------------------------------------------------------
Main Index
816
Code Examples
ga_spectrum_colors_set ()
sys_allocate_array(iv_old_colors,1,i_old_number)
sys_allocate_array(iv_colors,1,iv_number)
sys_free_array(iv_colors)
sys_allocate_array(iv_colors,1,iv_number)
dump iv_colors
#---------------------------------------------------------------------
ga_spectrum_continuous_set ()
#---------------------------------------------------------------------
ga_spectrum_create ()
# 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
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)
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)
#---------------------------------------------------------------------
ga_spectrum_current_set ()
# 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
( s_old_name )
dump i_return_value
ga_spectrum_delete ()
# 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
sys_allocate_array(sav_spectrums,1,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
sys_free_array(sav_spectrums)
#---------------------------------------------------------------------
ga_spectrum_interpolation_set ()
(s_name, @
r_factor )
dump i_return_value
ga_title_create ()
i_return_value = @
ga_title_num_get @
( i_ntitles )
dump i_return_value
dump i_ntitles
sys_allocate_array(sav_list,1,i_ntitles)
sys_free_array(sav_list)
#---------------------------------------------------------------------
ga_title_delete ()
sys_allocate_array(sav_list,1,i_ntitles)
sys_free_array(sav_list)
i_return_value = @
ga_title_delete @
( s_name )
dump i_return_value
#---------------------------------------------------------------------
start_vrml_animation ()
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.
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_subcase_c( 2, @
"demo", @
res_create_demo_scid, @
res_create_demo_rcid )
res_db_createlayerpos_c( 0, @
0, @
res_create_demo_layerposid )
#----------------------------------------------------------------------
# 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)"] )
#----------------------------------------------------------------------
# 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 ()
verify_boundaries_display_mgr.initialize ()
verify_boundaries_display_mgr.plot ()
# (displ_type)
#
#---------------------------------------------------------------------
# Variable declaration
STRING s_displ_type[32]
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)
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 ()
# -------------------------------------------------------------------
# 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 )
i_return_value = @
app_count_list @
( i_type, @
s_list, @
l_domesg, @
i_status )
# -------------------------------------------------------------------
# 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 )
app_count_list ()
# -------------------------------------------------------------------
# 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 )
i_return_value = @
app_count_list @
( i_type, @
s_list, @
l_domesg, @
i_status )
# -------------------------------------------------------------------
# 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 )
app_db_err_msg ()
# -------------------------------------------------------------------
# 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
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 ()
# -------------------------------------------------------------------
# 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 )
i_return_value = @
app_ids_to_vstring @
( i_idarray, @
i_numval, @
i_type, @
s_appstr )
# -------------------------------------------------------------------
# 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 )
sys_free_string(s_appstr)
# -------------------------------------------------------------------
Main Index
842
Code Examples
app_int_array_to_vstring ()
# -------------------------------------------------------------------
# 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 )
i_return_value = @
app_int_array_to_vstring @
( s_prefix, @
i_numval, @
i_inlist, @
Main Index
CHAPTER 5 843
User Interface
s_virtsym )
sys_free_string(s_virtsym)
# -------------------------------------------------------------------
appcode ()
# -------------------------------------------------------------------
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
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 )
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.
l_last_supplied_label = FALSE
l_domesg = TRUE
i_count = 0
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 ()
# 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 )
asm_u_lp_get_vector ()
# -------------------------------------------------------------------
# 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 )
Main Index
848
Code Examples
lp_eval_cleanup ()
# -------------------------------------------------------------------
# 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 )
i_return_value = @
lp_sublist_count @
( i_handle, @
i_filter, @
i_count )
Main Index
CHAPTER 5 849
User Interface
i_return_value = @
lp_sublist_count @
( i_handle, @
i_filter, @
i_count )
# -------------------------------------------------------------------
lp_geometry_text ()
# -------------------------------------------------------------------
# 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 )
i_return_value = @
lp_geometry_text @
( i_geo_keyword, @
i_geo_id_count, @
i_geo_id_list, @
i_text_len_max, @
s_text )
lp_keyword_text ()
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 )
i_return_value = @
lp_keyword_text @
( i_keyword, @
i_family, @
s_text )
msg_format_string ()
# 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()
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
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
msg_get_application ()
# -------------------------------------------------------------------
i_return_value = @
msg_get_application @
( i_msgcode )
dump i_return_value
# -------------------------------------------------------------------
Main Index
854
Code Examples
msg_string_more ()
# -------------------------------------------------------------------
# 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”
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
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 ()
# -------------------------------------------------------------------
# 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
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 ()
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”
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
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 ()
# -------------------------------------------------------------------
# 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 ()
ui_exec_function(“USER_FORM”,”display”)
#---------------------------------------------------------------------
# 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”)
s_keyword = “user_form_help”
ui_register_help( w_form_id,s_keyword )
s_path = “./USER_FORM.mif”
s_marker = “framemaker_hypertext_marker”
i_return_value = @
ui_add_help @
( s_keyword, @
s_path, @
s_marker )
# After seeing the help file, Press “OK” to delete the form.
sys_free_array(wa_wid_ids)
#---------------------------------------------------------------------
ui_clear_focus ()
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)
#---------------------------------------------------------------------
ui_exec_command ()
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
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
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
l_return_value = @
ui_form_exists @
( s_class )
dump l_return_value
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
ui_form_is_displayed ()
s_class = “USER_FORM”
dump l_return_value
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
dump l_return_value
dump l_return_value
#---------------------------------------------------------------------
ui_form_is_displayed ()
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 )
Main Index
CHAPTER 5 867
User Interface
ui_get_client ()
# The X Client is
dump s_client_info
#---------------------------------------------------------------------
ui_get_help ()
ui_exec_function(“USER_FORM”,”display”)
#---------------------------------------------------------------------
# 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”)
s_help = “user_form_help”
ui_register_help @
( w_wid, @
s_help )
s_help = ““
ui_get_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.
s_path = “./USER_FORM.mif”
s_marker = “hypertext_marker”
i_return_value = @
ui_add_help @
( s_help, @
s_path, @
s_marker )
dump i_return_value
#---------------------------------------------------------------------
ui_get_server ()
# X Server is:
dump s_server_info
#---------------------------------------------------------------------
ui_graph_create ()
ui_exec_function(“USER_GRAPH”, “display”)
ui_graph_create ()
# name,
# x,
# y,
# width,
# height )
#
#---------------------------------------------------------------------
# Compile and make the functions in user_graph.pob available to
# MSC.Patran
ui_exec_function(“USER_GRAPH”, “display”)
ui_is_initialized ()
dump l_is_initialised
#---------------------------------------------------------------------
ui_register_help ()
ui_exec_function(“USER_FORM”,”display”)
#---------------------------------------------------------------------
# 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”)
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 )
ui_write(s_info)
#---------------------------------------------------------------------
ui_sys_command ()
l_return_value = @
ui_sys_command @
( s_cmd )
xf_write_stdout(“-----------------------------------------------”)
Main Index
874
Code Examples
ui_sys_return ()
ui_text_select ()
Main Index
CHAPTER 5 875
User Interface
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()
# 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 )
sys_free_array(w_wid_ids)
# Press “OK” to delete the form “USER_FORM”.
#---------------------------------------------------------------------
ui_text_select ()
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()
# 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)
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 )
sys_free_array(w_wid_ids)
sys_free_string(s_vstr)
#
#---------------------------------------------------------------------
ui_wid_exit ()
ui_exec_function(“USER_FORM”, “display”)
#---------------------------------------------------------------------
# Session file paused. Observe the form and press “Resume” to
# continue.
sf_pause()
ui_wid_exit()
#---------------------------------------------------------------------
ui_wid_hide_forms ()
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 )
ui_form_display(“USER_FORM”)
#---------------------------------------------------------------------
ui_wid_restore_widget ()
#
# 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
ui_exec_function(“USER_FORM”, “display”)
# 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)
l_return_value = @
ui_wid_save_widget @
( w_wid )
dump l_return_value
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)
sf_pause()
#---------------------------------------------------------------------
# Restore the original values of USER_FORM
l_return_value = @
ui_wid_restore_widget @
( w_wid )
dump l_return_value
ui_wid_save_widget ()
#---------------------------------------------------------------------
# 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
ui_exec_function(“USER_FORM”, “display”)
# 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)
l_return_value = @
ui_wid_save_widget @
( w_wid )
dump l_return_value
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)
sf_pause()
#---------------------------------------------------------------------
# Restore the original values of USER_FORM
l_return_value = @
ui_wid_restore_widget @
( w_wid )
dump l_return_value
uid_get_border_sizes ()
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
# -------------------------------------------------------------------
uid_get_font_heights ()
uid_get_font_heights @
( i_font_h, @
i_textfont_h, @
i_spreadfont_h )
# -------------------------------------------------------------------
uid_get_screen_info ()
uid_get_screen_info @
( i_xpix, @
i_ypix, @
i_xpixperinch, @
i_ypixperinch, @
i_value )
uid_set_sys_pix ()
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 )
uil_app_analysis.get_real_name
uil_file_open.go(“spool.db”)
# db_get_default_anal_code().
#
db_get_default_anal_code( s_user_name )
# The current analysis code name is
dump s_user_name
i_return_value = @
uil_app_analysis.get_real_name @
( s_user_name, @
s_real_name )
uil_pcntcomplete.close
#---------------------------------------------------------------------
# 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
#
# The function uil_pcntcomplete.initlz()
# has the following arguments:
#
# uil_pcntcomplete.initlz
# (
# label )
#
#---------------------------------------------------------------------
# Variable Initialization
#---------------------------------------------------------------------
#---------------------------------------------------------------------
# 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 ()
dump w_return_value
#---------------------------------------------------------------------
Main Index
888
Code Examples
uil_utils_listbox.append_list ()
ui_exec_function(“USER_FORM”, “display”)
# 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 )
sys_free_array(wa_wid_ids)
# Press “OK” to delete the USER_FORM
#---------------------------------------------------------------------
uil_utils_listbox.create_list ()
ui_exec_function(“USER_FORM”, “display”)
# 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 ()
# ( 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
ui_exec_function(“USER_FORM”, “display”)
# 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 )
l_return_value = @
uil_utils_listbox.delete_item @
( w_lbox_id, @
s_name )
Main Index
892
Code Examples
uil_utils_listbox.delete_item_list ()
ui_exec_function(“USER_FORM”, “display”)
# 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 )
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 ()
ui_exec_function(“USER_FORM”, “display”)
# 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 )
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 )
Main Index
CHAPTER 5 895
User Interface
uil_utils_listbox.get_all ()
ui_exec_function(“USER_FORM”, “display”)
# 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 )
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 )
#---------------------------------------------------------------------
uil_utils_listbox.get_selected ()
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
ui_exec_function(“USER_FORM”, “display”)
# 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 )
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 )
dump sav_items
uil_utils_listbox.get_unselected ()
ui_exec_function(“USER_FORM”, “display”)
# 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 )
i_listcnt = 2
l_return_value = @
uil_utils_listbox.select_list @
( w_lbox_id, @
sa_labellist, @
i_listcnt )
dump l_return_value
uil_utils_listbox.get_unselected @
( w_lbox_id, @
sav_items, @
i_num )
uil_utils_listbox.select ()
ui_exec_function(“USER_FORM”, “display”)
# 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 )
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 ()
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
ui_exec_function(“USER_FORM”, “display”)
# 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 )
uil_utils_listbox.select_all @
( w_lbox_id )
uil_utils_listbox.select_list ()
ui_exec_function(“USER_FORM”, “display”)
# 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 )
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 ()
ui_exec_function(“USER_FORM”, “display”)
# 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 )
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 )
user_message ()
# -------------------------------------------------------------------
# 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 )
# -------------------------------------------------------------------
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 ()
asm_db_count_asm_in_group @
( i_groupId, @
i_count, @
i_status )
# Checking the success of the call
dump i_status
asm_db_count_asm_in_group @
( i_groupId, @
i_count, @
i_status )
# -------------------------------------------------------------------
asm_db_get_grids_in_group ()
asm_db_count_asm_in_group @
( i_groupId, @
i_count, @
i_status )
i_count_c = i_count(1)
#Allocate memory
SYS_ALLOCATE_ARRAY(i_gridLabels,1,i_count_c)
SYS_ALLOCATE_ARRAY(r_xyzCoordinates,1,3*i_count_c)
# Get the 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 ()
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
# 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 ()
#i_count_c = i_count(2)
i_count_c = i_count(2)
#Allocate memory
SYS_ALLOCATE_ARRAY(i_linelabels,1,i_count_c)
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 ()
# 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 ()
i_grp_id = 2
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
i_return_value = @
count_orphan_elements @
( i_count )
#
dump i_return_value
# The number of orphan elements are
dump i_count
count_orphan_nodes ()
STRING s_name[32]
INTEGER i_return_value
# -------------------------------------------------------------------
#
# opening a existing database spool.db
uil_file_open.go(“spool.db”)
i_grp_id = 2
i_return_value = @
count_orphan_nodes @
( i_count )
#
dump i_return_value
# The number of orphan nodes are
dump i_count
i_return_value = @
count_orphan_nodes @
( i_count )
#
dump i_return_value
# The number of orphan nodes are
dump i_count
# -------------------------------------------------------------------
Main Index
CHAPTER 6 917
Group
db_add_mpc_to_group ()
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 )
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
db_count_entities_in_group @
( s_name, @
i_type, @
i_count )
# Compare the two counts and see the effect of addition
dump i_count
# -------------------------------------------------------------------
db_count_entities_in_group ()
# -------------------------------------------------------------------
# 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 )
dump i_return_value
Main Index
CHAPTER 6 919
Group
# -------------------------------------------------------------------
db_count_groups_for_entity ()
# -------------------------------------------------------------------
# open the existing database spool.db
uil_file_open.go(“spool.db”)
#i_id = 1
i_id = 1
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 ()
# -------------------------------------------------------------------
#
# opening a existing database mpc.db
uil_file_open.go(“mpc.db”)
# 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 ()
uil_file_open.go(“spool.db”)
i_return_value = @
db_count_curve @
( i_count )
dump i_return_value
dump i_count
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 = @
db_count_curve @
( i_count )
dump i_return_value
dump i_count
i_return_value = @
db_count_orphan_curves @
( i_count )
#
dump i_return_value
# The number of orphan curves are
dump i_count
i_return_value = @
db_count_curve @
( i_count )
dump i_return_value
dump i_count
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 ()
uil_file_open.go(“spool.db”)
i_return_value = @
db_count_curve @
( i_count )
dump i_return_value
dump i_count
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 = @
db_count_curve @
( i_count )
dump i_return_value
dump i_count
i_return_value = @
db_count_orphan_curves @
( i_count )
#
dump i_return_value
# The number of orphan curves are
dump i_count
i_return_value = @
db_count_curve @
( i_count )
dump i_return_value
dump i_count
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 ()
i_return_value = @
db_count_orphan_mpcs @
( i_count )
#
dump i_return_value
dump i_count
i_return_value = @
db_count_orphan_mpcs @
( i_count )
#
dump i_return_value
dump i_count
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 ()
#
# 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”)
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 ()
#
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)
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 ()
uil_file_open.go(“spool.db”)
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 ()
# -------------------------------------------------------------------
# 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 ()
# -------------------------------------------------------------------
# open the existing database spool.db
uil_file_open.go(“spool.db”)
#i_id = 1
i_id = 1
# 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 ()
# -------------------------------------------------------------------
#
# opening a existing database mpc.db
uil_file_open.go(“mpc.db”)
# 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 ()
uil_file_open.go(“spool.db”)
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)
# -------------------------------------------------------------------
db_get_orphan_mpcs ()
uil_file_open.go(“mpc.db”)
db_count_orphan_mpcs @
( i_count )
#
dump i_count
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 ()
uil_file_open.go(“spool.db”)
Main Index
934
Code Examples
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 ()
SYS_ALLOCATE_STRING(s_created_ids,32)
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 ()
uil_file_open.go(“spool.db”)
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 ()
# s_name=fem_model
s_name = “fem_model”
dump i_return_value
dump i_color
coloring_method(2)
# -------------------------------------------------------------------
ga_group_color_set ()
[“fem_model”])
# s_name=fem_model
s_name = “fem_model”
# i_color = 4
i_color = 4
dump i_return_value
coloring_method(2)
# -------------------------------------------------------------------
ga_group_current_get ()
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”
dump i_return_value
# current group name is
dump s_name
ga_group_current_set @
( “default_group” )
# -------------------------------------------------------------------
ga_group_deform_get ()
sf_play(“spool_res_deform.ses”)
coloring_method(2)
# s_name=fem_model
s_name = “fem_model”
dump i_return_value
# Deform flag is
dump i_flag
dump i_return_value
# Deform flag is
dump i_flag
# -------------------------------------------------------------------
ga_group_deform_set ()
#
# -------------------------------------------------------------------
# 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”
dump i_return_value
ga_group_display_get ()
# s_name=fem_model
s_name = “fem_model”
dump i_return_value
dump s_dname_c
coloring_method(2)
ga_group_display_set @
( s_name, @
s_dname )
dump i_return_value
dump s_dname_c
ga_group_display_set @
( s_name, @
s_dname )
# -------------------------------------------------------------------
Main Index
CHAPTER 6 943
Group
ga_group_elem_scalar_get ()
# s_name = “fem_model”
s_name = “fem_model”
ga_group_current_set(“fem_model”)
db_get_current_group_id(i_cur_group_id)
ga_elem_scalar_create @
( s_title, @
i_nbr_elems, @
i_elem_ids, @
i_nbr_values, @
i_max_vals, @
r_scalars, @
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
ga_elem_scalar_delete( i_id )
#---------------------------------------------------------------------
ga_group_elem_scalar_set ()
# s_name = “fem_model”
s_name = “fem_model”
ga_group_current_set(“fem_model”)
db_get_current_group_id(i_cur_group_id)
ga_elem_scalar_create @
( s_title, @
i_nbr_elems, @
i_elem_ids, @
i_nbr_values, @
i_max_vals, @
r_scalars, @
i_id )
dump i_return_value
Main Index
946
Code Examples
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”
# 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
# 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
SYS_FREE_STRING( s_entities )
# -------------------------------------------------------------------
ga_group_exist_get ()
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”
dump i_return_value
dump i_flag
# s_name=non_existing_group
s_name = “non_existing_group”
dump i_return_value
dump i_flag
# -------------------------------------------------------------------
ga_group_groups_get ()
i_return_value = @
ga_group_groups_get @
Main Index
CHAPTER 6 949
Group
( s_group_list )
dump i_return_value
# -------------------------------------------------------------------
ga_group_label_get ()
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)
dump i_return_value
# Label flag is
dump i_flag
Main Index
950
Code Examples
dump i_return_value
# Label flag is
dump i_flag
# -------------------------------------------------------------------
ga_group_label_set ()
uil_viewport_post_groups.posted_groups(“default_viewport”,1, @
[“default_group”])
coloring_method(2)
# s_name = default_group
s_name = “default_group”
i_return_value = @
ga_group_label_set @
( s_name, @
i_flag )
dump i_return_value
# Label flag is
dump i_flag_c
i_return_value = @
ga_group_label_set @
( s_name, @
i_flag )
dump i_return_value
# Label flag is
dump i_flag_c
# -------------------------------------------------------------------
ga_group_load_vector_get ()
#
#---------------------------------------------------------------------
# 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”)
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
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 ()
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
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 ()
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)
# 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
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 ()
# 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
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
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_vector_delete @
( (i_vector_id - 1) )
dump i_return_value
END IF
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
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 ()
# s_name = “fem_model”
s_name = “fem_model”
Main Index
CHAPTER 6 959
Group
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 ()
# 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)
dump i_return_value
dump 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 ()
# 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”)
dump i_return_value
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
dump i_return_value
dump 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 ()
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”)
dump i_return_value
# Precision flag is
dump i_flag
dump i_return_value
# Precision flag is
dump i_flag
ga_group_style_set(s_name,”WIREFRAME”)
# -------------------------------------------------------------------
ga_group_result_vector_get ()
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
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 ()
#---------------------------------------------------------------------
# Open the database “spool.db” and read the results
sf_play(“spool_res.ses”)
dump i_return_value
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
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 ()
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”)
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
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 ()
#
# 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”)
dump i_return_value
dump i_return_value
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
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 ()
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)
dump i_return_value
# Selectable flag is
dump i_flag
dump i_return_value
# Selectable flag is
dump i_flag
ga_group_selectable_set(s_name,1)
# -------------------------------------------------------------------
ga_group_selectable_set ()
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
dump i_return_value
# Selectable flag is
dump i_flag_c
Main Index
974
Code Examples
i_return_value = @
ga_group_selectable_set @
( s_name, @
i_flag )
dump i_return_value
# Selectable flag is
dump i_flag_c
ga_group_selectable_set(s_name,1)
# -------------------------------------------------------------------
ga_group_style_get ()
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”
dump i_return_value
# Render style is
dump s_style
dump i_return_value
# Render style is
dump s_style
# -------------------------------------------------------------------
ga_group_style_set ()
# s_name = default_group
s_name = “default_group”
i_return_value = @
ga_group_style_set @
(s_name, @
s_style )
dump i_return_value
# Render style is
dump s_style_c
i_return_value = @
ga_group_style_set @
(s_name, @
s_style )
dump i_return_value
# Render style is
dump s_style_c
Main Index
CHAPTER 6 977
Group
# -------------------------------------------------------------------
ga_group_vector_load_get ()
uil_viewport_post_groups.posted_groups(“default_viewport”,1, @
[“default_group”])
coloring_method(2)
# s_name = default_group
s_name = “default_group”
dump i_return_value
# Load vector flag is
dump i_flag
Main Index
978
Code Examples
dump i_return_value
# Load vector flag is
dump i_flag
# -------------------------------------------------------------------
ga_group_vector_load_set ()
uil_viewport_post_groups.posted_groups(“default_viewport”,1, @
[“default_group”])
coloring_method(2)
# s_name=default_group
s_name = “default_group”
Main Index
CHAPTER 6 979
Group
dump i_return_value
# -------------------------------------------------------------------
ga_group_vector_result_get ()
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”
dump i_return_value
dump i_return_value
ga_group_vector_result_get ()
# 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
# s_name = fem_model
s_name = “fem_model”
dump i_return_value
dump i_return_value
dump i_return_value
# -------------------------------------------------------------------
Main Index
982
Code Examples
ga_group_vector_result_set ()
coloring_method(2)
# s_name=fem_model
s_name = “fem_model”
dump i_return_value
ga_group_vector_result_get @
( s_name, @
i_flag_c )
ga_group_vector_result_set ()
i_preference_id = 501
i_data_type = 1
# s_name = fem_model
s_name = “fem_model”
dump i_return_value
dump i_return_value
dump i_return_value
# -------------------------------------------------------------------
ga_groups_load_vector_set ()
# 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”)
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
dump i_return_value
dump i_vector_id_c
dump i_vector_id_c
ga_vector_delete @
( i_vector_id )
#---------------------------------------------------------------------
ga_groups_load_vector_set ()
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
dump i_return_value
dump i_return_value
dump i_vector_id_c
dump i_return_value
dump i_vector_id_c
#---------------------------------------------------------------------
Main Index
988
Code Examples
get_orphan_elements ()
# 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” )
count_orphan_elements @
( i_count )
#
# Allocate memory
SYS_ALLOCATE_ARRAY( i_idlist,1,i_count)
i_return_value = @
get_orphan_elements @
( i_count, @
i_idlist )
dump i_return_value
# The list of orphan elements
dump i_idlist
# -------------------------------------------------------------------
get_orphan_nodes ()
count_orphan_nodes @
( i_count )
#
# Allocate memory
SYS_ALLOCATE_ARRAY( i_idlist,1,i_count)
i_return_value = @
get_orphan_nodes @
( i_count, @
i_idlist )
dump i_return_value
Main Index
990
Code Examples
# -------------------------------------------------------------------
sgm_db_count_iges_in_group ()
# -------------------------------------------------------------------
Main Index
CHAPTER 6 991
Group
sgm_db_get_iges_in_group ()
# Allocate memory
# i_count(12) is the count of surface of revolution IGES entity.
SYS_ALLOCATE_ARRAY(i_entityids,1,i_count(12))
SYS_FREE_ARRAY(i_entityids)
# -------------------------------------------------------------------
sgm_db_get_iges_in_group ()
# Allocate memory
# i_count(12) is the count of surface of revolution IGES entity.
SYS_ALLOCATE_ARRAY(i_entityids,1,i_count(12))
i_item_count )
#
dump i_item_count
dump i_entityids
dump i_return_value
SYS_FREE_ARRAY(i_entityids)
# -------------------------------------------------------------------
uil_entity_group_members_get ()
# -------------------------------------------------------------------
# open the existing database spool.db
uil_file_open.go(“spool.db”)
# 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 ()
# l_domesg = TRUE
l_domesg = TRUE
i_return_value = @
app_db_get_ref_cid @
( l_domesg, @
s_cord_frame )
dump i_return_value
dump s_cord_frame
SYS_FREE_STRING(sv_asm_create_cord_created_ids)
#---------------------------------------------------------------------
asm_const_curve_2d_arc2point_v2 ()
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 ()
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 ()
# 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 ()
#---------------------------------------------------------------------
# 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 ()
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.
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 ()
#
# 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
dump i_curve_id
asm_db_get_curve_geo @
( i_curve_id, @
ra_geo_coefs, @
i_status )
dump i_status
#---------------------------------------------------------------------
asm_db_get_next_cord_label ()
#
#---------------------------------------------------------------------
# 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
i_return_value = @
asm_db_get_next_cord_label @
( l_domessage, @
i_integerlabel, @
s_stringlabel )
dump i_return_value
SYS_FREE_STRING(sv_asm_create_cord_created_ids)
#---------------------------------------------------------------------
asm_db_get_next_grid_label ()
# 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_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 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
SYS_FREE_ARRAY( i_gridLabels )
SYS_FREE_ARRAY( r_xyzCoordinates )
#---------------------------------------------------------------------
Main Index
CHAPTER 7 1007
Geometry
asm_db_get_next_hpat_label ()
# 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
SYS_FREE_STRING(sv_asm_create_hpat)
#---------------------------------------------------------------------
Main Index
1008
Code Examples
asm_db_get_next_line_label ()
# 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
#---------------------------------------------------------------------
asm_db_get_next_patch_label
# 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
asm_u_coord_global_to_local ()
# 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 )
asm_u_coord_local_to_global ()
asm_u_coord_local_to_global @
( ra_p, @
ra_t, @
ra_r, @
i_itype, @
i_npts )
curve_arc_to_parm ()
#---------------------------------------------------------------------
# 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)
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 ()
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)
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 ()
# 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 )
SYS_FREE_STRING(sv_asm_create_cord_created_ids)
#---------------------------------------------------------------------
Main Index
CHAPTER 7 1015
Geometry
db_count_coordinate_frame ()
i_return_value = @
db_count_coordinate_frame @
( i_count )
dump i_return_value
SYS_FREE_STRING(sv_asm_create_cord_created_ids)
#---------------------------------------------------------------------
db_count_curve ()
i_return_value = @
db_count_curve @
( i_count )
dump i_return_value
#---------------------------------------------------------------------
db_count_curves_for_point ()
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
# i_id = 1
i_id = 1
i_return_value = @
db_count_curves_for_point @
( i_id, @
i_count )
dump i_return_value
SYS_FREE_STRING(sv_asm_line_2point_created_ids)
#---------------------------------------------------------------------
db_count_point ()
uil_file_open.go(“spool.db”)
i_return_value = @
db_count_point @
( i_count )
dump i_return_value
#---------------------------------------------------------------------
db_count_solid ()
i_return_value = @
db_count_solid @
( i_count )
dump i_return_value
Main Index
CHAPTER 7 1019
Geometry
db_count_solids_for_surface ()
# i_id = 1
i_id = 1
i_return_value = @
db_count_solids_for_surface @
( i_id, @
i_count )
dump i_return_value
# 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
db_count_surface ()
i_return_value = @
db_count_surface @
( i_count )
dump i_return_value
db_count_surfaces_for_edge ()
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
SYS_FREE_STRING(sv_asm_create_patch_xy)
#---------------------------------------------------------------------
db_get_all_coord_frame_ids ()
# Create a surface.
asm_const_patch_xyz( “4”, “<1 1 0>”, “[0 0 0]”, “Coord 0”, @
sv_asm_create_patch_xy_created )
Main Index
CHAPTER 7 1023
Geometry
db_get_all_posted_coord ()
# Create a surface.
asm_const_patch_xyz( “4”, “<1 1 0>”, “[0 0 0]”, “Coord 0”, @
sv_asm_create_patch_xy_created )
Main Index
1024
Code Examples
db_get_coord_frame_label ()
# 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
SYS_FREE_STRING(sv_asm_create_cord_created_ids)
#---------------------------------------------------------------------
db_get_current_coord ()
i_return_value = @
db_get_current_coord @
( i_coord_label )
dump i_return_value
db_set_current_coord(200)
i_return_value = @
db_get_current_coord @
( i_coord_label )
dump i_return_value
SYS_FREE_STRING(sv_asm_create_cord_created_ids)
#---------------------------------------------------------------------
db_get_curve_coo_and_type ()
# i_label = 1
i_label = 1
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
db_get_curve_id ()
# i_label = 1
i_label = 1
i_return_value = @
db_get_curve_id @
( i_label, @
i_id )
dump i_return_value
db_get_curve_label ()
# i_id = 4
i_id = 4
i_return_value = @
db_get_curve_label @
( i_id, @
i_label )
dump i_return_value
#---------------------------------------------------------------------
db_get_curves_for_point ()
# 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 )
SYS_FREE_STRING(sv_asm_line_2point_created_ids)
SYS_FREE_ARRAY(iv_crvid)
#---------------------------------------------------------------------
Main Index
1030
Code Examples
db_get_geom_type ()
# 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
#---------------------------------------------------------------------
Main Index
CHAPTER 7 1031
Geometry
db_get_max_coord_label ()
i_return_value = @
db_get_max_coord_label @
( i_label )
dump i_return_value
SYS_FREE_STRING(sv_asm_create_cord_created_ids)
#---------------------------------------------------------------------
db_get_max_curve_label ()
i_return_value = @
db_get_max_curve_label @
( i_label )
dump i_return_value
#---------------------------------------------------------------------
db_get_max_point_label ()
i_return_value = @
db_get_max_point_label @
( i_label )
dump i_return_value
#---------------------------------------------------------------------
db_get_max_solid_label ()
i_return_value = @
db_get_max_solid_label @
( i_label )
dump i_return_value
SYS_FREE_STRING(sv_asm_create_hpat)
#---------------------------------------------------------------------
Main Index
1034
Code Examples
db_get_max_surface_label ()
i_return_value = @
db_get_max_surface_label @
( i_label )
dump i_return_value
db_get_min_coord_label ()
#
# 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
i_return_value = @
db_get_min_coord_label @
( i_label )
dump i_return_value
SYS_FREE_STRING(sv_asm_create_cord_created_ids)
#---------------------------------------------------------------------
db_get_min_curve_label ()
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)
i_return_value = @
db_get_min_curve_label @
( i_label )
dump i_return_value
#---------------------------------------------------------------------
db_get_min_point_label ()
i_return_value = @
db_get_min_point_label @
( i_label )
dump i_return_value
#---------------------------------------------------------------------
Main Index
CHAPTER 7 1037
Geometry
db_get_min_solid_label ()
i_return_value = @
db_get_min_solid_label @
( i_label )
dump i_return_value
SYS_FREE_STRING(sv_asm_create_hpat)
#---------------------------------------------------------------------
db_get_min_surface_label ()
# to create spool.db
#
# This file can be run by starting 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
db_get_next_coord_frame_ids ()
# Create a surface.
asm_const_patch_xyz( “4”, “<1 1 0>”, “[0 0 0]”, “Coord 0”, @
sv_asm_create_patch_xy_created )
db_get_next_posted_coord ()
# Create a surface.
asm_const_patch_xyz( “4”, “<1 1 0>”, “[0 0 0]”, “Coord 0”, @
sv_asm_create_patch_xy_created )
Main Index
CHAPTER 7 1041
Geometry
db_get_point_association_count ()
# 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
#---------------------------------------------------------------------
Main Index
1042
Code Examples
db_get_point_coo_and_type ()
# 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
#---------------------------------------------------------------------
Main Index
CHAPTER 7 1043
Geometry
db_get_point_id ()
# i_label = 9
i_label = 9
i_return_value = @
db_get_point_id @
( i_label, @
i_id )
dump i_return_value
#---------------------------------------------------------------------
db_get_point_label ()
# i_id = 7
i_id = 7
i_return_value = @
db_get_point_label @
( i_id, @
i_label )
dump i_return_value
#---------------------------------------------------------------------
db_get_solid_coo_and_type ()
# i_label = 4
i_label = 4
i_return_value = @
db_get_solid_coo_and_type @
( i_id, @
i_coo, @
i_type )
dump i_return_value
SYS_FREE_STRING(sv_asm_create_hpat)
#---------------------------------------------------------------------
db_get_solid_id ()
# i_label = 4
i_label = 4
i_return_value = @
db_get_solid_id @
( i_label, @
i_id )
dump i_return_value
SYS_FREE_STRING(sv_asm_create_hpat)
#---------------------------------------------------------------------
db_get_solid_label ()
#
# 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
# i_id = 1
i_id = 1
i_return_value = @
db_get_solid_label @
( i_id, @
i_label )
dump i_return_value
SYS_FREE_STRING(sv_asm_create_hpat)
#---------------------------------------------------------------------
db_get_solids_for_surface ()
#---------------------------------------------------------------------
# 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
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 ()
# ( 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
i_return_value = @
db_get_surface_coo_and_type @
( i_id, @
i_coo, @
i_type )
dump i_return_value
db_get_surface_id ()
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_label
INTEGER i_id
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)
# i_label = 1
i_label = 1
i_return_value = @
db_get_surface_id @
( i_label, @
i_id )
dump i_return_value
db_get_surface_label ()
# 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
db_get_surfaces_for_edge ()
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 )
SYS_FREE_STRING(sv_asm_create_patch_xy)
SYS_FREE_ARRAY(iv_srfid)
#---------------------------------------------------------------------
sgm_associate_nodes_curve ()
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
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.
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 ()
# 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.
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 ()
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 ()
#
# 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 ()
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 ()
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
sgm_create_surface_comptrim_v1 ()
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 ()
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 ()
#
#---------------------------------------------------------------------
# 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 ()
#---------------------------------------------------------------------
# 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 ()
# ( 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
dump i_curveid
# i_entitytype = 2 (curve)
i_entitytype = 2
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
#---------------------------------------------------------------------
sgm_db_get_blob_size ()
# i_entitytype = 2 (curve)
i_entitytype = 2
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 ()
# i_dbtype = 1
i_dbtype = 1
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
#---------------------------------------------------------------------
sgm_db_get_curve ()
# i_label = 1
i_label = 1
i_curveid )
dump i_curveid
# i_entitytype = 2 (curve)
i_entitytype = 2
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
SYS_FREE_ARRAY(ra_blob)
#---------------------------------------------------------------------
sgm_db_get_edge_vertex_ids ()
uil_file_new.go(““,”new.db”)
$? YES 36000002
i_return_value = @
sgm_db_get_edge_vertex_ids @
( i_edgeid, @
ia_vertexids )
dump i_return_value
SYS_FREE_STRING(sv_asm_line_2point_created_ids)
#---------------------------------------------------------------------
sgm_db_get_gen_body_face_ids ()
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
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
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 ()
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
SYS_FREE_ARRAY(iv_vertexids)
SYS_FREE_STRING(sv_asm_create_hpat_xyz)
#---------------------------------------------------------------------
sgm_db_get_gen_face_edge_ids ()
uil_toolbar.labels_on( )
ga_view_aa_set( 23., -34., 0. )
Main Index
1080
Code Examples
# 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
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 ()
# 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
# 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
SYS_FREE_ARRAY(iv_vertexids)
SYS_FREE_STRING(sv_asm_create_patch_xy)
#---------------------------------------------------------------------
sgm_db_get_num_edges_face ()
#
# 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
i_return_value = @
sgm_db_get_num_edges_face @
( i_surfaceid, @
i_numberfaces )
dump i_return_value
SYS_FREE_STRING(sv_asm_create_patch_xy)
#---------------------------------------------------------------------
sgm_db_get_num_faces_body ()
sgm_db_get_num_faces_body @
( i_bodyid, @
i_numberfaces, @
i_status )
dump i_status
SYS_FREE_STRING(sv_asm_create_hpat_xyz)
#---------------------------------------------------------------------
sgm_db_get_num_loops_face ()
# 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
SYS_ALLOCATE_ARRAY(iv_numegploop,1,i_numloops)
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
SYS_FREE_ARRAY(iv_numegploop)
#---------------------------------------------------------------------
sgm_db_get_num_vertices_body ()
# 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
SYS_FREE_STRING(sv_asm_create_hpat)
#---------------------------------------------------------------------
sgm_db_get_point ()
# 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
#---------------------------------------------------------------------
Main Index
CHAPTER 7 1087
Geometry
sgm_db_get_solid ()
# i_label = 1
i_label = 1
# i_entitytype = 4 (solid)
i_entitytype = 4
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
SYS_FREE_STRING(sv_asm_create_hpat)
SYS_FREE_ARRAY(rv_blob)
#---------------------------------------------------------------------
sgm_db_get_surface ()
# i_label = 1
i_label = 1
# i_entitytype = 3 (surface)
Main Index
CHAPTER 7 1089
Geometry
i_entitytype = 3
SYS_ALLOCATE_ARRAY(rv_blob,1,i_blobsize)
sgm_db_get_surface @
( i_surfaceid, @
i_blobsize, @
rv_blob, @
i_status )
dump i_status
SYS_FREE_ARRAY(rv_blob)
#---------------------------------------------------------------------
sgm_db_modify_entity_label ()
#
# 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
# i_entitytype = 1
i_entitytype = 1
# i_entityid = 1
i_entityid = 1
# i_groupid = 1
i_groupid = 1
# i_newlabel = 100
i_newlabel = 100
dump i_groupid
db_get_group_name @
( i_groupid, @
s_group )
dump s_group
SYS_ALLOCATE_STRING(s_members,32)
dump s_members
i_return_value = @
sgm_db_modify_entity_label @
( i_entitytype, @
i_entityid, @
i_newlabel )
dump i_return_value
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 ()
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 ()
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 ()
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.
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 ()
# 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 ()
#---------------------------------------------------------------------
# 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
#---------------------------------------------------------------------
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 ()
#---------------------------------------------------------------------
# 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
#---------------------------------------------------------------------
solid_label(TRUE)
#---------------------------------------------------------------------
# Reversing the solid with respect to it's parametric
# direction. Watch the direction of the parametric
# direction set display.
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 ()
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
#---------------------------------------------------------------------
# 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 ()
#---------------------------------------------------------------------
# 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.
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 ()
i_return_value = @
sgm_const_curve_2d_arc2point_v2 @
( "1", @
1, @
0, @
TRUE, @
Main Index
1106
Code Examples
FALSE, @
1, @
"Coord 0.3", @
"[0 0 0]", @
"[5 0 0]", @
"[0 -0.5 0]", @
FALSE, @
sgm_create_curve_2d_created_ids )
#---------------------------------------------------------------------
# Getting the start point, center and the radius for
# this arc.
i_arc_id = 1
i_return_value = sgm_get_arc_center_radius( @
i_arc_id, @
r_start_point, @
r_center_point, @
r_radius )
dump i_return_value
dump r_start_point
dump r_center_point
dump r_radius
#---------------------------------------------------------------------
sys_free_string(sgm_create_curve_2d_created_ids)
#---------------------------------------------------------------------
# End of File.
sgm_get_close_points ()
INTEGER iv_point_ids(VIRTUAL)
REAL rv_distances(VIRTUAL)
STRING asm_create_grid_xyz_created_ids[VIRTUAL]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
#---------------------------------------------------------------------
# Creating the points
i_return_value = @
asm_const_grid_xyz @
( "1", @
"[1 0 0]", @
"Coord 0", @
asm_create_grid_xyz_created_ids )
dump i_return_value
i_return_value = @
asm_const_grid_xyz @
( "2", @
"[1.05 0 0]", @
"Coord 0", @
asm_create_grid_xyz_created_ids )
dump i_return_value
i_return_value = @
asm_const_grid_xyz @
( "3", @
"[1.002 0 0]", @
"Coord 0", @
asm_create_grid_xyz_created_ids )
$? YESFORALL 1000034
dump i_return_value
i_return_value = @
asm_const_grid_xyz @
( "4", @
"[0.99 0 0]", @
"Coord 0", @
asm_create_grid_xyz_created_ids )
dump i_return_value
#---------------------------------------------------------------------
# Using the function to get the close points around this point.
i_return_value = sgm_get_close_points( @
r_point_location, @
r_tolerance, @
i_num_only, @
i_vertices_only, @
i_sort_option, @
i_num_points, @
iv_point_ids, @
rv_distances )
dump i_return_value
dump i_num_points
#---------------------------------------------------------------------
Main Index
1108
Code Examples
sys_allocate_array(iv_point_ids,1,i_num_points)
sys_allocate_array(rv_distances,1,i_num_points)
#---------------------------------------------------------------------
i_return_value = sgm_get_close_points( @
r_point_location, @
r_tolerance, @
i_num_only, @
i_vertices_only, @
i_sort_option, @
i_num_points, @
iv_point_ids, @
rv_distances )
dump i_return_value
dump i_num_points
dump iv_point_ids
dump rv_distances
#---------------------------------------------------------------------
sys_free_array(iv_point_ids)
sys_free_array(rv_distances)
sys_free_string(asm_create_grid_xyz_created_ids)
#---------------------------------------------------------------------
sgm_get_curve_length ()
# i_label = 1
i_label = 1
i_curveid )
dump i_curveid
i_return_value = @
sgm_get_curve_length @
( i_curveid, @
r_length )
dump i_return_value
#---------------------------------------------------------------------
sgm_get_solid_volume ()
# i_label = 1
i_label = 1
i_return_value = @
sgm_get_solid_volume @
( i_solid, @
r_volume )
dump i_return_value
SYS_FREE_STRING(sv_asm_create_hpat)
#---------------------------------------------------------------------
sgm_get_surface_area ()
# i_label = 1
i_label = 1
i_return_value = @
sgm_get_surface_area @
( i_surfid, @
r_area )
dump i_return_value
sgm_incongruent_geom_display ()
asm_const_patch_xyz @
( “2”, @
“<1 1 0>”, @
“[1 1 0]”, @
“Coord 0”, @
s_asm_create_patch )
asm_const_patch_xyz @
( “3”, @
“<1 -1 0>”, @
“[1 1 0]”, @
“Coord 0”, @
s_asm_create_patch )
i_return_value = sgm_incongruent_geom_display()
dump i_return_value
#---------------------------------------------------------------------
Main Index
1112
Code Examples
sgm_incongruent_geom_exist ()
asm_const_patch_xyz @
( “2”, @
“<1 1 0>”, @
“[1 1 0]”, @
“Coord 0”, @
sv_asm_create_patch )
asm_const_patch_xyz @
( “3”, @
“<1 -1 0>”, @
“[1 1 0]”, @
“Coord 0”, @
sv_asm_create_patch )
i_return_value = sgm_incongruent_geom_exist()
dump i_return_value
#---------------------------------------------------------------------
sgm_incongruent_geom_seg_exit ()
asm_const_patch_xyz @
( “2”, @
“<1 1 0>”, @
“[1 1 0]”, @
“Coord 0”, @
s_asm_create_patch )
asm_const_patch_xyz @
( “3”, @
“<1 -1 0>”, @
“[1 1 0]”, @
“Coord 0”, @
s_asm_create_patch )
i_return_value = sgm_incongruent_geom_seg_exit()
dump i_return_value
#---------------------------------------------------------------------
Main Index
1114
Code Examples
sgm_nearest_point_on_curve ()
INTEGER i_label = 1
INTEGER i_curve_id
INTEGER i_blob_size
REAL rv_blob(VIRTUAL)
REAL ra_point_location(3)
REAL r_parameter
REAL ra_curve_data_out(3)
STRING sgm_create_curve_2d_created_ids[VIRTUAL]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
#---------------------------------------------------------------------
# Creating the arc
i_return_value = @
sgm_const_curve_2d_arc2point_v2 @
( "1", @
1, @
0, @
TRUE, @
FALSE, @
1, @
"Coord 0.3", @
"[0 0 0]", @
"[-4 3.5 0]", @
"[4 -0.5 0]", @
FALSE, @
sgm_create_curve_2d_created_ids )
db_get_curve_id(i_label, i_curve_id)
#---------------------------------------------------------------------
# Getting the blob size.
sgm_db_get_blob_size( @
2, @
i_curve_id, @
i_blob_size, @
Main Index
CHAPTER 7 1115
Geometry
i_return_value )
dump i_return_value
sys_allocate_array(rv_blob,1,i_blob_size)
#---------------------------------------------------------------------
# Getting the curve blob.
sgm_db_get_curve( @
i_curve_id, @
i_blob_size, @
rv_blob, @
i_return_value)
dump i_return_value
#---------------------------------------------------------------------
# Using the function to get the point on the curve.
i_return_value = sgm_nearest_point_on_curve( @
ra_point_location, @
rv_blob, @
r_parameter, @
ra_curve_data_out )
dump i_return_value
dump r_parameter
dump ra_curve_data_out
#---------------------------------------------------------------------
sys_free_array(rv_blob)
sys_free_string(sgm_create_curve_2d_created_ids)
#---------------------------------------------------------------------
sgm_nearest_point_on_curve_aea ()
INTEGER i_label = 1
INTEGER i_curve_id
INTEGER i_blob_size
REAL rv_blob(VIRTUAL)
Main Index
1116
Code Examples
REAL ra_point_location(3)
REAL r_parameter
REAL ra_curve_data_out(3)
STRING sgm_create_curve_2d_created_ids[VIRTUAL]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
#---------------------------------------------------------------------
# Creating the arc
i_return_value = @
sgm_const_curve_2d_arc2point_v2 @
( "1", @
1, @
0, @
TRUE, @
FALSE, @
1, @
"Coord 0.3", @
"[0 0 0]", @
"[-4 3.5 0]", @
"[4 -0.5 0]", @
FALSE, @
sgm_create_curve_2d_created_ids )
db_get_curve_id(i_label, i_curve_id)
#---------------------------------------------------------------------
# Getting the blob size.
sgm_db_get_blob_size( @
2, @
i_curve_id, @
i_blob_size, @
i_return_value )
dump i_return_value
sys_allocate_array(rv_blob,1,i_blob_size)
#---------------------------------------------------------------------
# Getting the curve blob.
sgm_db_get_curve( @
i_curve_id, @
i_blob_size, @
rv_blob, @
i_return_value)
dump i_return_value
#---------------------------------------------------------------------
# Using the function to get the nearest point on the curve.
i_return_value = sgm_nearest_point_on_curve_aea( @
ra_point_location, @
rv_blob, @
r_parameter, @
ra_curve_data_out )
dump i_return_value
dump r_parameter
dump ra_curve_data_out
#---------------------------------------------------------------------
Main Index
CHAPTER 7 1117
Geometry
sys_free_array(rv_blob)
sys_free_string(sgm_create_curve_2d_created_ids)
#---------------------------------------------------------------------
sgm_node_on_curve ()
ia_crv_id_lis(1) = i_id
Main Index
1118
Code Examples
SYS_ALLOCATE_ARRAY(iv_num_nodes,1,32)
SYS_ALLOCATE_ARRAY(iv_node_id_list,1,32)
SYS_ALLOCATE_ARRAY(rv_node_u_list,1,32)
# r_geotol = 0.004
r_geotol = 0.004
# i_num_crvs = 1
i_num_crvs = 1
# i_list_size = 32
i_list_size = 32
# i_init_flag = 0
i_init_flag = 0
i_return_value = @
sgm_node_on_curve @
( r_geotol, @
i_num_crvs, @
ia_crv_id_lis, @
i_list_size, @
i_init_flag, @
iv_num_nodes, @
iv_node_id_list, @
rv_node_u_list )
dump i_return_value
SYS_FREE_ARRAY(iv_num_nodes)
SYS_FREE_ARRAY(iv_node_id_list)
SYS_FREE_ARRAY(rv_node_u_list)
#---------------------------------------------------------------------
sgm_node_on_point ()
ia_pt_id_list(1) = i_id
# r_geotol = 0.004
r_geotol = 0.004
# i_num_pts = 1
i_num_pts = 1
SYS_ALLOCATE_ARRAY(iv_num_nodes,1,32)
SYS_ALLOCATE_ARRAY(iv_node_id_list,1,32)
i_return_value = @
sgm_node_on_point @
( r_geotol, @
i_num_pts, @
ia_pt_id_list, @
iv_num_nodes, @
iv_node_id_list )
dump i_return_value
SYS_FREE_ARRAY(iv_num_nodes)
SYS_FREE_ARRAY(iv_node_id_list)
#---------------------------------------------------------------------
Main Index
1120
Code Examples
sgm_node_on_surface ()
# i_label = 1
i_label = 1
db_get_surface_id @
( i_label, @
i_id )
ia_sur_id_list(1) = i_id
# r_geotol = 0.004
r_geotol = 0.004
# i_num_surs = 1
i_num_surs = 1
Main Index
CHAPTER 7 1121
Geometry
# i_list_size = 128
i_list_size = 128
# i_init_flag = 0
i_init_flag = 0
SYS_ALLOCATE_ARRAY(iv_num_nodes,1,4)
SYS_ALLOCATE_ARRAY(iv_node_id_list,1,128)
SYS_ALLOCATE_ARRAY(rv_node_uv_list,1,256)
i_return_value = @
sgm_node_on_surface @
( r_geotol, @
i_num_surs, @
ia_sur_id_list, @
i_list_size, @
i_init_flag, @
iv_num_nodes, @
iv_node_id_list, @
rv_node_uv_list )
dump i_return_value
SYS_FREE_ARRAY(iv_num_nodes)
SYS_FREE_ARRAY(iv_node_id_list)
SYS_FREE_ARRAY(rv_node_uv_list)
#---------------------------------------------------------------------
sgm_show_angle_between_curves ()
# Variable Declarations
STRING asm_create_line_xyz_created_ids[VIRTUAL]
STRING s_curve_list_1[32]
STRING s_curve_list_2[32]
INTEGER i_segment_id
INTEGER i_marker_type
INTEGER i_marker_color
INTEGER i_marker_size
STRING s_angle_out[32]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
#---------------------------------------------------------------------
# Creating the curves.
i_return_value = @
asm_const_line_xyz @
( "1", @
"<1.0 0 0>", @
"[0 0 0]", @
"Coord 0", @
asm_create_line_xyz_created_ids )
dump i_return_value
i_return_value = @
asm_const_line_xyz @
( "2", @
"<1 1 0>", @
"[0 0 0]", @
"Coord 0", @
asm_create_line_xyz_created_ids )
dump i_return_value
#---------------------------------------------------------------------
# Creating the segment
i_segment_id = 1
i_return_value = @
gm_segment_create( @
i_segment_id )
dump i_return_value
#---------------------------------------------------------------------
# Getting the angle between the nodes.
i_return_value = @
sgm_show_angle_between_curves @
( s_curve_list_1, @
s_curve_list_2, @
i_segment_id, @
i_marker_type, @
i_marker_color, @
i_marker_size, @
s_angle_out )
Main Index
CHAPTER 7 1123
Geometry
dump i_return_value
dump s_angle_out
#---------------------------------------------------------------------
sys_free_string(asm_create_line_xyz_created_ids)
#---------------------------------------------------------------------
sgm_show_surface_normals ()
# Create a segment
gm_segment_create(i_segid)
# s_surflist = “surface 1 4”
s_surflist = “surface 1 4”
# l_scaled = FALSE
l_scaled = FALSE
# i_numsurf = 2
i_numsurf = 2
# i_redflag = 0
i_redflag = 0
Main Index
1124
Code Examples
# i_vecdens = 10
i_vecdens = 10
# r_veclen = 2.
r_veclen = 2.
i_return_value = @
sgm_show_surface_normals @
( s_surflist, @
l_scaled, @
i_numsurf, @
i_segid, @
i_redflag, @
i_vecdens, @
r_veclen )
dump i_return_value
sgm_solid_evaluate ()
INTEGER i_irc
STRING sv_asm_create_hpat[VIRTUAL]
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
# r_ui = 0.3
r_ui = 0.3
# r_vi = 0.3
r_vi = 0.3
# r_wi = 0.3
r_wi = 0.3
# i_in = 0
i_in = 0
# i_label = 1
i_label = 1
# i_entitytype = 4 (solid)
i_entitytype = 4
SYS_ALLOCATE_ARRAY(rv_s,1,i_blobsize)
sgm_db_get_solid @
( i_solidid, @
i_blobsize, @
rv_s, @
i_status )
sgm_solid_evaluate @
( rv_s, @
r_ui, @
r_vi, @
r_wi, @
i_in, @
ra_pd, @
i_irc )
dump i_irc
SYS_FREE_ARRAY(rv_s)
SYS_FREE_STRING(sv_asm_create_hpat)
#---------------------------------------------------------------------
Main Index
1126
Code Examples
sgm_surface_evaluate ()
# r_ui = 0.3
r_ui = 0.3
# r_vi = 0.3
r_vi = 0.3
# i_in = 0
i_in = 0
# i_label = 1
i_label = 1
Main Index
CHAPTER 7 1127
Geometry
# i_entitytype = 3 (surface)
i_entitytype = 3
SYS_ALLOCATE_ARRAY(rv_s,1,i_blobsize)
sgm_db_get_surface @
( i_surfaceid, @
i_blobsize, @
rv_s, @
i_status )
sgm_surface_evaluate @
( rv_s, @
r_ui, @
r_vi, @
i_in, @
ra_pd, @
i_irc )
dump i_irc
SYS_FREE_ARRAY(rv_s)
#---------------------------------------------------------------------
sgm_u_calc_mscale_mat ()
i_return_value = @
sgm_u_calc_mscale_mat @
( ra_coord_org, @
ra_coord_rmat, @
ra_translation, @
ra_scale, @
ra_axis_base, @
ra_axis_tip, @
r_rotation_angle, @
ra_tmat )
dump i_return_value
sgm_verify_solid_brep ()
uil_app_asm.get_form_id()
SYS_FREE_STRING(sv_asm_create_patch_xy_created )
SYS_FREE_STRING(sv_sgm_create_solid_br_created )
#---------------------------------------------------------------------
transform_pts ()
INTEGER i_cidtyp
INTEGER i_npts
REAL ra_points(3,1)
STRING sv_asm_create_cord_created_ids[VIRTUAL]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
# ra_points = [[3.0][4.0][2.0]]
ra_points = [[3.0][4.0][2.0]]
# i_npts = 1
i_npts = 1
# i_cid = 1
i_cid = 1
i_return_value = @
transform_pts @
( i_cid, @
i_cidtyp, @
i_npts, @
ra_points )
dump i_return_value
SYS_FREE_STRING(sv_asm_create_cord_created_ids)
#---------------------------------------------------------------------
xy_curve_num_points_get ()
# OUTPUT:
# LOGICAL yonly,
# INTEGER npoints
# INTEGER status
# )
#---------------------------------------------------------------------
#
# Opening a new database
uil_file_new.go("","new.db")
#---------------------------------------------------------------------
LOGICAL yonly
INTEGER npoints
INTEGER status
#----------------------------------------------------------------------
xy_window_create("XY_Window", @
2.5,3.5, @
5.0,5.0)
xy_curve_create(curve_name, @
text,colour)
xy_curve_data_set(curve_name, @
yonly_flag, @
points, @
x_array, @
y_array)
#-----------------------------------------------------------------------
status = xy_curve_num_points_get(curve_name, @
yonly, @
npoints)
dump status
dump yonly
dump npoints
Main Index
1132
Code Examples
#---------------------------------------------------------------------
# End of File.
#---------------------------------------------------------------------
Main Index
MSC.Acumen, Volume 2: Code Examples
CHAPTER
Finite Element Model
8
■ Introduction
Main Index
1134
Code Examples
8.1 Introduction
This chapter provides code examples for the PCL function described in Volume 1. These
examples are designed so that they can be cut and pasted into a file and, by following the
instructions listed with each example, executed in MSC.Patran.
db_count_elem_topology_codes ()
db_count_elem_w_topology ()
#
# This file can be run by starting a session of
# MSC.Patran and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_count_elem_w_topology()
# has the following arguments:
# db_count_elem_w_topology
# ( ntop,
# top,
# nelem )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_ntop
INTEGER ia_top(4)
INTEGER ia_nelem(4)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “fem1.db”
uil_file_open.go(“fem1.db”)
i_return_value = @
db_count_elem_w_topology @
( i_ntop, @
ia_top, @
ia_nelem )
dump i_return_value
# Number of elements in topologies 25,26,27,28 are
dump ia_nelem
#---------------------------------------------------------------------
db_count_elems_for_geo ()
INTEGER i_nbr_of_elements
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “fem1.db”
uil_file_open.go(“fem1.db”)
i_return_value = @
db_count_elems_for_geo @
( i_geo_type, @
i_geo_id, @
i_nbr_of_elements )
dump i_return_value
db_count_elems_using_node ()
#
i_nnode = 20
ia_nid = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]
i_return_value = @
db_count_elems_using_node @
( i_nnode, @
ia_nid, @
ia_nelem, @
i_fflag )
dump i_return_value
db_count_mpcs_using_node ()
i_return_value = @
Main Index
1138
Code Examples
db_count_mpcs_using_node @
( i_nnode, @
ia_nid, @
ia_nmpc, @
i_fflag )
dump i_return_value
db_count_nodes_for_geometry ()
db_count_orphan_surfaces(i_count)
db_get_orphan_surfaces(i_count,ia_orphan)
db_get_surface_id(ia_orphan(1), i_geoId)
dump i_geoId
i_return_value = @
db_count_nodes_for_geometry @
( i_geoType, @
i_geoId, @
i_parentType, @
i_parentId, @
i_nodeCount )
dump i_return_value
db_count_nodes_in_mpc ()
db_count_unref_nodes ()
Main Index
CHAPTER 8 1141
Finite Element Model
db_count_valid_dofs_f_mpc_type ()
# Get the number of Valid Degree Of Freedoms for MPC type “Explicit”
i_return_value = @
db_count_valid_dofs_f_mpc_type @
( i_mpc_type_id, @
i_num_dofs )
dump i_return_value
db_count_valid_mpc_types ()
# Call the function to get the number of Valid MPC type ids.
#
i_return_value = @
db_count_valid_mpc_types @
( i_numtypes )
dump i_return_value
# The number of valid MPC type ids for the current analysis code and
# type is
dump i_numtypes
#---------------------------------------------------------------------
db_get_all_valid_dof_f_mpc_type ()
INTEGER i_num_dofs,i_count
INTEGER i_mpc_type_id
INTEGER i_dof_id
STRING s_dof_name[16]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem2.db
uil_file_open.go(“fem2.db”)
# Get the number of Valid Degree Of Freedoms for MPC type “Explicit”
i_return_value = @
db_count_valid_dofs_f_mpc_type @
( i_mpc_type_id, @
i_num_dofs )
# Call the function to get all the valid DOF for the MPC type
# “Explicit”. This function should be called before the call
# to the function db_get_nxt_valid_dof_f_mpc_type().
#
i_return_value = @
db_get_all_valid_dof_f_mpc_type @
( i_mpc_type_id )
dump i_return_value
# Get the DOF ID and name for the MPC type “Explicit”
FOR ( i_count = 1 TO i_num_dofs )
i_return_value = @
db_get_nxt_valid_dof_f_mpc_type @
( i_mpc_type_id, @
i_dof_id, @
s_dof_name )
dump i_dof_id
dump s_dof_name
END FOR
#---------------------------------------------------------------------
db_get_all_valid_mpc_type ()
#
# The function db_get_all_valid_mpc_type() has no arguments.
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_numtypes, i_count
INTEGER i_mpc_type_id
STRING s_mpc_type_name[16]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem2.db
uil_file_open.go(“fem2.db”)
# Get the number of valid mpc types for the default analysis type
# and code.
i_return_value = @
db_count_valid_mpc_types @
( i_numtypes )
db_get_dep_nodes_in_sub_mpc ()
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_num_mpcs
INTEGER ia_mpc_ids(8)
INTEGER iv_id_symbol(VIRTUAL)
INTEGER i_mpc_id
INTEGER i_sub_mpc_id
INTEGER i_maxnode
INTEGER i_nnode
INTEGER ia_nid(8)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem2.db
uil_file_open.go(“fem2.db”)
i_mpc_id = ia_mpc_ids(1)
# Get the Maximum number of nodes which may be returned for the
# Sub-MPC
i_return_value = @
fem_get_mpc_assoc_nodes @
( i_num_mpcs, @
ia_mpc_ids, @
i_maxnode, @
iv_id_symbol )
# Call the function to get the dependent nodes in first Sub MPC.
i_return_value = @
db_get_dep_nodes_in_sub_mpc @
( i_mpc_id, @
i_sub_mpc_id, @
i_maxnode, @
i_nnode, @
ia_nid )
dump i_return_value
sys_free_array( iv_id_symbol )
#---------------------------------------------------------------------
Main Index
1146
Code Examples
db_get_dof_id ()
# Call the function to get the ID of DOF “UX”. List of the available
# DOF can be referred in Chapter 7 of MSC.Patran Users Manual Vol 4.
#
s_dof_name = “UX”
i_return_value = @
db_get_dof_id @
( s_dof_name, @
i_dof_id )
dump i_return_value
# Id of DOF “UX” is
dump i_dof_id
#---------------------------------------------------------------------
db_get_dof_name ()
i_return_value = @
db_get_dof_name @
( i_dof_id, @
s_dof_name )
dump i_return_value
db_get_elem_config_ntl ()
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_set_name[32]
INTEGER i_num_region
INTEGER ia_region_ids(1)
INTEGER i_gener_elem_type
INTEGER i_lay_id
INTEGER i_mat_dir
INTEGER i_atid
INTEGER i_acid
INTEGER i_geopcd
INTEGER i_copcd
INTEGER i_fopcd
INTEGER i_lopcd
INTEGER i_etopcd
INTEGER i_dofsetid
INTEGER i_matlcode
INTEGER i_matdcode
INTEGER i_config
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem1.db
uil_file_open.go(“fem1.db”)
i_return_value = @
db_get_region_definition @
( ia_region_ids(1), @
s_set_name, @
i_gener_elem_type, @
i_dofsetid, @
i_copcd, @
i_geopcd, @
i_fopcd, @
i_lopcd, @
i_lay_id, @
i_matlcode, @
i_matdcode, @
i_mat_dir )
#---------------------------------------------------------------------
# Call the function to get the ID of the associated configuration
# IDs of the Analysis Type and Code can be referred from Chapter 7
# of MSC.Patran User Manual, Volume 4. IDs of the Element topology
# can be referred from Chapter 9 of the same Manual.
#
i_atid = 1 /* for Analysis type “Structural Analysis” */
i_acid = 1 /* for Analysis Code “MSC.Nastran” */
i_etopcd = 28 /* for “Hex8” element */
i_return_value = @
db_get_elem_config_ntl @
( i_atid, @
i_acid, @
i_geopcd, @
i_copcd, @
i_fopcd, @
i_lopcd, @
i_etopcd, @
Main Index
CHAPTER 8 1149
Finite Element Model
i_dofsetid, @
i_matlcode, @
i_matdcode, @
i_config )
dump i_return_value
dump i_config
#---------------------------------------------------------------------
db_get_elem_dimens ()
i_return_value = @
db_get_elem_dimens @
( i_top_id, @
i_dimen )
dump i_return_value
db_get_elem_for_geo_type_and_id ()
# to create fem1.db
#
# This file can be run by starting a session of
# MSC.Patran and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_elem_for_geo_type_and_id()
# has the following arguments:
# db_get_elem_for_geo_type_and_id
# ( geo_type,
# geo_id,
# nbr_of_elements,
# element )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_geo_type
INTEGER i_geo_id
INTEGER i_nbr_of_elements
INTEGER ia_element(16)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem1.db
uil_file_open.go(“fem1.db”)
# Get the element IDs that have geometry type “SOLID” and geometry
# ID 1
#
i_geo_type = 4 /* for SOLID from dbtypes.h */
i_geo_id = 1
i_nbr_of_elements = 16
i_return_value = @
db_get_elem_for_geo_type_and_id @
( i_geo_type, @
i_geo_id, @
i_nbr_of_elements, @
ia_element )
dump i_return_value
db_get_elem_nodes ()
i_return_value = @
db_get_elem_nodes @
( i_eid, @
i_numnode, @
ia_nid )
dump i_return_value
db_get_elem_shape_for_id ()
uil_file_open.go(“fem1.db”)
i_return_value = @
db_get_elem_shape_for_id @
( i_nelem, @
ia_eid, @
ia_shape )
dump i_return_value
db_get_elem_top_name ()
i_return_value = @
db_get_elem_top_name @
( i_id, @
s_name )
dump i_return_value
Main Index
CHAPTER 8 1153
Finite Element Model
db_get_elem_topology_codes ()
db_get_elem_topos_for_geom ()
#
# The function db_get_elem_topos_for_geom()
# has the following arguments:
# db_get_elem_topos_for_geom
# ( geo_id,
# geo_type,
# n_tops,
# top_ids )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_geo_id
INTEGER i_geo_type
INTEGER i_n_tops
INTEGER ia_top_ids(8)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem1.db
uil_file_open.go(“fem1.db”)
# Get the Topology IDs currently in use that match geometry type
# SOLID and geometry ID 1
#
i_geo_type = 4 /* for SOLID from dbtypes.h */
i_geo_id = 1
i_return_value = @
db_get_elem_topos_for_geom @
( i_geo_id, @
i_geo_type, @
i_n_tops, @
ia_top_ids )
dump i_return_value
db_get_elem_verification_parms ()
# Variable Declarations
STRING s_analysis_code_name[128]
INTEGER i_test_id
REAL r_threshold
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem1.db
uil_file_open.go(“fem1.db”)
i_return_value = @
db_get_elem_verification_parms @
( s_analysis_code_name, @
i_test_id, @
r_threshold )
dump i_return_value
db_get_elems ()
#---------------------------------------------------------------------
# Open the database “fem1.db”
uil_file_open.go(“fem1.db”)
i_return_value = @
db_get_elems @
( i_nelem, @
i_maxnode, @
ia_eid, @
ia_etop, @
ia_gtype, @
ia_gid, @
ia_econ )
dump i_return_value
db_get_elems_by_lbc ()
# Call the function to get the number of elements and their ids
# associated with the lbc “new_load”
i_max_elem = 8
i_return_value = @
db_get_elems_by_lbc @
( i_lbc_id, @
i_max_elem, @
i_nelem, @
ia_eid )
dump i_return_value
db_get_elems_using_nodes ()
uil_file_open.go(“fem3.db”)
i_return_value = @
db_get_elems_using_nodes @
( i_nnode, @
ia_nid, @
i_mxelem, @
ia_nelem, @
ia_eid )
dump i_return_value
db_get_etop_for_a_code ()
i_atid = 1
db_count_etop_for_a_code @
( i_acid, @
i_atid, @
i_count )
SYS_ALLOCATE_ARRAY(iv_etids,1,i_count)
i_return_value = @
db_get_etop_for_a_code @
( i_acid, @
i_atid, @
i_count, @
iv_etids )
dump i_return_value
db_get_indep_nodes_in_sub_mpc ()
#---------------------------------------------------------------------
# Open the database fem2.db
uil_file_open.go(“fem2.db”)
i_mpc_id = ia_mpc_ids(1)
# Get the Maximum number of nodes which may be returned for the
# Sub-MPC
i_return_value = @
fem_get_mpc_assoc_nodes @
( i_num_mpcs, @
ia_mpc_ids, @
i_maxnode, @
iv_id_symbol )
# Call the function to get the independent nodes in first Sub MPC.
i_return_value = @
db_get_indep_nodes_in_sub_mpc @
( i_mpc_id, @
i_sub_mpc_id, @
i_maxnode, @
i_nnode, @
ia_nid )
dump i_return_value
sys_free_array( iv_id_symbol )
#---------------------------------------------------------------------
db_get_max_elem_id ()
# to create fem1.db
#
# This file can be run by starting a session of
# MSC.Patran and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_max_elem_id() has the following arguments:
# db_get_max_elem_id
# ( id )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_id
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem1.db
uil_file_open.go(“fem1.db”)
i_return_value = @
db_get_max_elem_id @
( i_id )
dump i_return_value
db_get_max_node_id ()
db_get_mesh_params
# Call the function to get the definition of an edge mesh from the
# database
#
i_return_value = @
db_get_mesh_params @
( r_wmesh, @
i_mshcyc, @
r_relaxm, @
r_tolmsh, @
i_dgmesh, @
i_itrngl )
dump i_return_value
db_get_min_elem_id ()
db_get_min_node_id ()
db_get_mpc_type_id ()
i_return_value = @
db_get_mpc_type_id @
( s_mpc_type_name, @
i_mpc_type_id )
dump i_return_value
db_get_mpc_type_name ()
i_return_value = @
db_get_mpc_type_name @
( i_mpc_type_id, @
s_mpc_type_name )
dump i_return_value
db_get_next_elem_id ()
i_return_value = @
db_get_next_elem_id @
( i_id )
dump i_return_value
#---------------------------------------------------------------------
db_get_next_mpc_id ()
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_next_id
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem2.db
uil_file_open.go(“fem2.db”)
db_get_next_node_id ()
# Largest Node ID is
dump i_id
dump i_id
#---------------------------------------------------------------------
db_get_next_valid_mpc_type ()
# Get the number of valid mpc types for the default analysis type
# and code.
i_return_value = @
db_count_valid_mpc_types @
( i_numtypes )
Main Index
CHAPTER 8 1169
Finite Element Model
db_get_nodal_association ()
# Call the function to get the array of Geometry IDs and Geometry
# Types of Node IDs 1:16
#
i_nnode = 16
ia_nid = [ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 ]
i_return_value = @
db_get_nodal_association @
( i_nnode, @
ia_nid, @
ia_gid, @
ia_gtype )
dump i_return_value
Main Index
1170
Code Examples
db_get_node ()
i_return_value = @
db_get_node @
( i_id, @
ra_xyz )
dump i_return_value
db_get_nodes_by_lbc ()
i_return_value = @
db_get_nodes_by_lbc @
( i_lbc_id, @
i_max_node, @
i_nnode, @
ia_nid )
dump i_return_value
db_get_nodes_for_geometry ()
# ( geo_type,
# geo_id,
# parent_type,
# parent_id,
# nnode,
# nids,
# ncoord )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_geo_type
INTEGER i_geo_id
INTEGER i_parent_type
INTEGER i_parent_id
INTEGER i_nnode
INTEGER ia_nids(8)
REAL ra_ncoord(16)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem3.db
uil_file_open.go(“fem3.db”)
# Call the function to get the nodes associated with the geotype
# Curve with ID 1 of parent type Surface with ID 1. There 2 Curves
# associated to the Parent Surface 1 in the database.
#
i_geo_id = 1
i_geo_type = 2 /* for CURVE from dbtypes.h */
i_parent_id = 1
i_parent_type = 3 /* for SURFACE from dbtypes.h */
i_return_value = @
db_get_nodes_for_geometry @
( i_geo_type, @
i_geo_id, @
i_parent_type, @
i_parent_id, @
i_nnode, @
ia_nids, @
ra_ncoord )
dump i_return_value
db_get_nodes_in_mpc ()
# Call the function to return the list of all the nodes associated
# with the MPCs.
#
i_mxnode = 5
i_return_value = @
db_get_nodes_in_mpc @
( i_nmpc, @
ia_mpcid, @
i_mxnode, @
ia_nnode, @
ia_nid )
dump i_return_value
db_get_nxt_valid_dof_f_mpc_type ()
# Get the number of Valid Degree Of Freedoms for MPC type “Explicit”
i_return_value = @
db_count_valid_dofs_f_mpc_type @
( i_mpc_type_id, @
i_num_dofs )
# Call the function to get all the valid DOF for the MPC type
# “Explicit”. This function should be called before the call
# to the function db_get_nxt_valid_dof_f_mpc_type().
#
i_return_value = @
db_get_all_valid_dof_f_mpc_type @
( i_mpc_type_id )
dump i_return_value
# Get the next DOF ID and name for the MPC type “Explicit”
FOR ( i_count = 1 TO i_num_dofs )
i_return_value = @
db_get_nxt_valid_dof_f_mpc_type @
( i_mpc_type_id, @
i_dof_id, @
s_dof_name )
dump i_return_value
dump i_dof_id
dump s_dof_name
END FOR
#---------------------------------------------------------------------
Main Index
CHAPTER 8 1175
Finite Element Model
db_get_unreferenced_node_ids ()
db_get_valid_mpc_ids_in_group ()
# Purpose : This file provides an example of a call to the
# function db_get_valid_mpc_ids_in_group()
#
# This file opens fem2.db and calls the function
# db_get_current_group_id() to get the current
# group id. Then it gets the number of valid
# MPCs in the group. Finally,it calls the
# function to get the IDs of those MPCs.
#
Main Index
1176
Code Examples
db_update_elem_ids ()
# to create fem1.db
#
# This file can be run by starting a session of
# MSC.Patran and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_update_elem_ids() has the following arguments:
# db_update_elem_ids
# ( numelem,
# old_id,
# new_id )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_numelem, i_id, ia_old_id(1)
INTEGER ia_new_id(1), i_return_value
#---------------------------------------------------------------------
# Open the database “fem1.db”
uil_file_open.go(“fem1.db”)
# Maximum element id is
dump i_id
ia_old_id = i_id
i_id = i_id + 10
ia_new_id = i_id
i_numelem = 1
i_return_value = @
db_update_elem_ids @
( i_numelem, @
ia_old_id, @
ia_new_id )
dump i_return_value
i_return_value = @
db_update_elem_ids @
( i_numelem, @
ia_old_id, @
ia_new_id )
dump i_return_value
#---------------------------------------------------------------------
Main Index
1178
Code Examples
db_update_elem_types ()
i_return_value = @
db_get_elems @
( i_nelem, @
i_maxnode, @
ia_eid, @
ia_etop, @
ia_gtype, @
ia_gid, @
ia_econ )
dump i_return_value
#
ia_etop(1) = 20
i_maxnode = 20
i_return_value = @
db_update_elem_types @
( i_nelem, @
i_maxnode, @
ia_eid, @
ia_etop, @
ia_econ )
dump i_return_value
#---------------------------------------------------------------------
# Get the information of the Element 1 again.
#
i_return_value = @
db_get_elems @
( i_nelem, @
i_maxnode, @
ia_eid, @
ia_etop, @
ia_gtype, @
ia_gid, @
ia_econ )
dump i_return_value
db_validate_mpc ()
i_return_value = @
db_validate_mpc @
( i_mpc_id, @
l_valid_flag )
dump i_return_value
# Dump to see whether MPC is VALID or not.
# The first MPC should be valid or TRUE
dump l_valid_flag
i_return_value = @
db_validate_mpc @
( i_mpc_id, @
l_valid_flag )
dump i_return_value
# Dump to see whether MPC is VALID or not.
# This MPC should be invalid or FALSE
dump l_valid_flag
#---------------------------------------------------------------------
db_verify_nodes_exist ()
INTEGER i_nnode
INTEGER ia_nid(4)
INTEGER ia_exist(4)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem3.db
uil_file_open.go(“fem3.db”)
i_return_value = @
db_verify_nodes_exist @
( i_nnode, @
ia_nid, @
ia_exist )
dump i_return_value
fem_create_mesh_sol_3 ()
STRING asm_create_hpat_xyz_created_ids[VIRTUAL]
INTEGER int_status
#----------------------------------------------------------------------
# Open a new database
if(!db_is_open())THEN
uil_file_new.go("","new.db")
$? YES 36000002
endif
#----------------------------------------------------------------------
# Setting the preference to MSC.Nastran.
uil_pref_analysis.set_analysis_pref( "MSC.Nastran", @
"Structural", @
"", @
".op2" )
#---------------------------------------------------------------------
# Create Geometric entities
asm_const_hpat_xyz( "1", @
"<10 10 10>", @
"[0 0 0]", @
"Coord 0", @
asm_create_hpat_xyz_created_ids )
#---------------------------------------------------------------------
# Create Finite Element entities using the function
# fem_create_mesh_sol_3 to create 216 nodes and 125 elements
# for the Solid 1
dump int_status
#---------------------------------------------------------------------
# Closing the file new.db
# uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of file.
fem_get_elem_assoc_groups ()
i_return_value = @
fem_get_elem_assoc_groups @
( i_nelem, @
ia_idelems, @
i_ngroups, @
iv_id_symbols )
dump i_return_value
sys_free_array( iv_id_symbols )
#---------------------------------------------------------------------
fem_get_elem_ids ()
# notfound,
# noexist_symbol )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_entity_list[128]
INTEGER i_nelem
INTEGER iav_idelem_symbol(VIRTUAL)
INTEGER i_notfound
INTEGER iav_noexist_symbol(VIRTUAL)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “fem1.db”
uil_file_open.go(“fem1.db”)
# Extract the array of existing element ids from the following entity
# list by calling the function fem_get_elem_ids()
#
s_entity_list=”Elm 1:18”
i_return_value = @
fem_get_elem_ids @
( s_entity_list, @
i_nelem, @
iav_idelem_symbol, @
i_notfound, @
iav_noexist_symbol )
dump i_return_value
sys_free_array( iav_idelem_symbol )
sys_free_array( iav_noexist_symbol )
#---------------------------------------------------------------------
fem_get_mpc_assoc_groups ()
# fem_get_mpc_assoc_groups
# ( nmpc,
# idmpcs,
# ngroups,
# assoc_group_ids )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_nmpc
INTEGER ia_idmpcs(8)
INTEGER i_ngroups
INTEGER iv_assoc_group_ids(VIRTUAL)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem2.db
uil_file_open.go(“fem2.db”)
# Get the list of all the groups associated with the MPCs.
i_return_value = @
fem_get_mpc_assoc_groups @
( i_nmpc, @
ia_idmpcs, @
i_ngroups, @
iv_assoc_group_ids )
dump i_return_value
sys_free_array( iv_assoc_group_ids )
#---------------------------------------------------------------------
fem_get_mpc_assoc_nodes ()
# nnodes,
# id_symbols )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_nmpc
INTEGER ia_idmpcs(8)
INTEGER i_nnodes
INTEGER iv_id_symbols(VIRTUAL)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem2.db
uil_file_open.go(“fem2.db”)
sys_free_array(iv_id_symbols)
#---------------------------------------------------------------------
fem_get_mpc_ids ()
# idmpc_symbol,
# notfound,
# idnoexist_symbol )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_entity_list[128]
INTEGER i_nempc
INTEGER iv_idmpc_symbol(VIRTUAL)
INTEGER i_notfound
INTEGER iv_idnoexist_symbol(VIRTUAL)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem2.db
uil_file_open.go(“fem2.db”)
# Call the function with a MPC list which contains few existing
# and few nonexisting MPCs.
#
s_entity_list = “Mpc 1 2 3”
i_return_value = @
fem_get_mpc_ids @
( s_entity_list, @
i_nempc, @
iv_idmpc_symbol, @
i_notfound, @
iv_idnoexist_symbol )
dump i_return_value
sys_free_array(iv_idmpc_symbol)
sys_free_array(iv_idnoexist_symbol)
#---------------------------------------------------------------------
fem_get_node_assoc_groups ()
# fem_get_node_assoc_groups
# ( nnode,
# idnodes,
# ngroups,
# id_symbol )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_nnode
INTEGER ia_idnodes(2)
INTEGER i_ngroups
INTEGER iv_id_symbol(VIRTUAL)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem3.db
uil_file_open.go(“fem3.db”)
# Call the function to get the groups associated to the Nodes 1,20.
#
i_nnode = 2
ia_idnodes = [ 1,20 ]
i_return_value = @
fem_get_node_assoc_groups @
( i_nnode, @
ia_idnodes, @
i_ngroups, @
iv_id_symbol )
dump i_return_value
sys_free_array(iv_id_symbol)
#---------------------------------------------------------------------
fem_get_node_ids ()
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_entity_list[32]
INTEGER i_nenode
INTEGER iv_id_node_symbol(VIRTUAL)
INTEGER i_notfound
INTEGER iv_id_noexist_symbol(VIRTUAL)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem3.db
uil_file_open.go(“fem3.db”)
i_return_value = @
fem_get_node_ids @
( s_entity_list, @
i_nenode, @
iv_id_node_symbol, @
i_notfound, @
iv_id_noexist_symbol )
dump i_return_value
sys_free_array(iv_id_node_symbol)
sys_free_array(iv_id_noexist_symbol)
#---------------------------------------------------------------------
fem_seed_display_dir_arrows ()
# Variable Declarations
INTEGER i_arrow_segment
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database fem3.db
uil_file_open.go(“fem3.db”)
# Create a segment.
i_return_value = @
gm_segment_create ( i_arrow_segment )
dump i_return_value
fem_u_get_free_edges ()
INTEGER i_nels
INTEGER ia_el_con(128)
INTEGER ia_el_shape(16)
INTEGER ia_el_nodes(16)
INTEGER ia_edge_el_ids(192)
INTEGER ia_edge_ids(192)
INTEGER i_free_edges
INTEGER i_return_value
INTEGER ia_etop(16)
INTEGER ia_gtype(16)
INTEGER ia_gid(16)
#---------------------------------------------------------------------
# Open the database “fem1.db”
uil_file_open.go(“fem1.db”)
i_return_value = @
db_get_elems @
( i_nels, @
i_max_nodes, @
ia_el_ids, @
ia_etop, @
ia_gtype, @
ia_gid, @
ia_el_con )
dump i_return_value
#---------------------------------------------------------------------
# Get the Element Shape Array
# Each Hex 8 Element has 2 nodes per edge, 12 edges and 8 nodes.
i_max_per_edge = 2
i_max_edges = 12
ia_el_nodes=[8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8]
i_return_value = @
db_get_elem_shape_for_id @
( i_nels, @
ia_el_ids, @
ia_el_shape )
#---------------------------------------------------------------------
# Get the free edges in the database.
#
i_return_value = @
fem_u_get_free_edges @
( ia_el_ids, @
i_max_nodes, @
i_max_per_edge, @
i_max_edges, @
i_nels, @
ia_el_con, @
ia_el_shape, @
ia_el_nodes, @
ia_edge_el_ids, @
ia_edge_ids, @
i_free_edges )
dump i_return_value
# Associated element id is
dump ia_edge_el_ids
# Free edge id is
dump ia_edge_ids
# Number of free edges
dump i_free_edges
#---------------------------------------------------------------------
Main Index
1192
Code Examples
fem_u_get_free_faces ()
ia_el_ids = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]
Main Index
CHAPTER 8 1193
Finite Element Model
i_return_value = @
db_get_elems @
( i_nels, @
i_max_nodes, @
ia_el_ids, @
ia_etop, @
ia_gtype, @
ia_gid, @
iaa_econ )
dump i_return_value
#---------------------------------------------------------------------
# Get the Element Shape Array
# Each Hex 8 Element has 4 nodes in each face, 12 faces and 8 nodes.
i_max_per_face = 4
i_max_faces = 12
ia_el_nodes = [8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8]
i_return_value = @
db_get_elem_shape_for_id @
( i_nels, @
ia_el_ids, @
ia_el_shape )
#---------------------------------------------------------------------
# Get the free faces in the database.
#
SYS_ALLOCATE_ARRAY( ia_el_con, 1, ( i_nels * i_max_nodes ) )
SYS_ALLOCATE_ARRAY( ia_el_nodes, 1, i_nels )
ia_el_nodes = [8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8]
ia_el_con = iaa_econ
dump i_array_size
i_return_value = @
fem_u_get_free_faces @
( ia_el_ids, @
i_max_nodes, @
i_max_per_face, @
i_max_faces, @
i_nels, @
ia_el_con, @
ia_el_shape, @
ia_el_nodes, @
ia_face_el_ids, @
ia_face_ids, @
i_free_faces )
dump i_return_value
# Associated element id is
dump ia_face_el_ids
# Free face id is
dump ia_face_ids
# Number of free faces
Main Index
1194
Code Examples
dump i_free_faces
#---------------------------------------------------------------------
list_get_node_ass_el_edge ()
STRING asm_create_patch_xy_created_ids[VIRTUAL]
INTEGER fem_create_mesh_surfa_num_nodes
INTEGER fem_create_mesh_surfa_num_elems
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]
STRING elem_edge_list[80]
STRING node_list[virtual]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new data base.
$? YES 36000002
#---------------------------------------------------------------------
# Create a 2-D patch.
#---------------------------------------------------------------------
# Create a Fem mesh for this patch.
#---------------------------------------------------------------------
# Argument Initialization.
#---------------------------------------------------------------------
# Get nodes associated to specified element edge.
i_return_value = list_get_node_ass_el_edge(elem_edge_list, @
node_list)
#---------------------------------------------------------------------
# Dump the output of the function
dump node_list
dump i_return_value
#---------------------------------------------------------------------
# closing the patran environment.
# uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
list_get_node_ass_el_face ()
STRING asm_create_hpat_xyz_created_ids[VIRTUAL]
INTEGER fem_create_mesh_solid_num_nodes
INTEGER fem_create_mesh_solid_num_elems
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]
STRING elem_face_list[80]
STRING node_list[virtual]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new data base.
$? YES 36000002
#---------------------------------------------------------------------
# Create a 3-D solid.
asm_create_hpat_xyz_created_ids )
#---------------------------------------------------------------------
# Create a Fem mesh for this solid.
#---------------------------------------------------------------------
# Argument Initialization.
#---------------------------------------------------------------------
# Get all nodes associated to specified element faces
i_return_value = list_get_node_ass_el_face(elem_face_list, @
node_list)
#---------------------------------------------------------------------
# Dump the output of the function
dump node_list
dump i_return_value
#---------------------------------------------------------------------
# closing the patran environment.
# uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
#---------------------------------------------------------------------
list_get_node_ass_elem ()
STRING asm_create_patch_xy_created_ids[VIRTUAL]
INTEGER fem_create_mesh_surfa_num_nodes
INTEGER fem_create_mesh_surfa_num_elems
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]
STRING elem_list[80]
Main Index
CHAPTER 8 1197
Finite Element Model
STRING node_list[virtual]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new data base.
$? YES 36000002
#---------------------------------------------------------------------
# Create a 2-D patch.
#---------------------------------------------------------------------
# Create a Fem mesh for this patch.
#---------------------------------------------------------------------
# Argument Initialization.
#---------------------------------------------------------------------
# Get all nodes associated to specified elements.
i_return_value = list_get_node_ass_elem(elem_list, @
node_list)
#---------------------------------------------------------------------
# Dump the output of the function
dump node_list
dump i_return_value
#---------------------------------------------------------------------
# closing the patran environment.
# uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
list_get_node_ass_geo ()
STRING asm_create_patch_xy_created_ids[VIRTUAL]
INTEGER fem_create_mesh_surfa_num_nodes
INTEGER fem_create_mesh_surfa_num_elems
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]
string ent_list[80]
string node_list[virtual]
integer i_return_value
#---------------------------------------------------------------------
# Open a new data base.
$? YES 36000002
#---------------------------------------------------------------------
# Create a 2-D patch.
#---------------------------------------------------------------------
# Create a Fem mesh for this patch.
#---------------------------------------------------------------------
# Argument Initialization.
#---------------------------------------------------------------------
# Get all nodes associated to specified geometry.
#---------------------------------------------------------------------
# Dump the output of the function
dump node_list
dump i_return_value
#---------------------------------------------------------------------
# closing the patran environment.
Main Index
CHAPTER 8 1199
Finite Element Model
# uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
list_get_node_ass_group ()
STRING asm_create_patch_xy_created_ids[VIRTUAL]
INTEGER fem_create_mesh_surfa_num_nodes
INTEGER fem_create_mesh_surfa_num_elems
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]
INTEGER num
STRING group_list[80](2)
STRING node_list[virtual]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new data base.
$? YES 36000002
#---------------------------------------------------------------------
# Create a 2-D patch.
#---------------------------------------------------------------------
# Create a Fem mesh for this patch.
#---------------------------------------------------------------------
# Create first group "group1".
Main Index
1200
Code Examples
ga_group_create( "group1" )
ga_group_entity_add( "group1", @
"Point 1 2 Surface 1 Node 1:4 12:15 23:26 3" // @
"4:37 45:48 56:59 67:70 78:81 89:92 100:103" // @
"111:114 Elm 1:4 11:14 21:24 31" // @
":34 41:44 51:54 61:64 71:74 81:84 91:94" )
ga_group_current_set( "group1" )
#---------------------------------------------------------------------
# Create second group "group2".
ga_group_create( "group2" )
ga_group_entity_add( "group2", @
"Point 3 4 Surface 1 Node 9:11 20:22 31:33 " // @
"42:44 53:55 64:66 75:77 86:88 97:99 108:110" // @
"119:121 Elm 8:10 18:20 28:30 " // @
"38:40 48:50 58:60 68:70 78:80 88:90 98:100" )
ga_group_current_set( "group2" )
#---------------------------------------------------------------------
# Argument Initialization.
num = 2
group_list(1) = "group1"
group_list(2) = "group2"
#---------------------------------------------------------------------
# Get all nodes associated to specified groups.
i_return_value = list_get_node_ass_group(num, @
group_list, @
node_list)
#---------------------------------------------------------------------
# Dump the output of the function
dump node_list
dump i_return_value
#---------------------------------------------------------------------
# closing the patran environment.
# uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
list_get_node_ass_mpc ()
#
# The function list_get_node_ass_mpc()
# has the following arguments:
#
# list_get_node_ass_mpc (mpc_list, node_list )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING asm_create_patch_xy_created_ids[VIRTUAL]
INTEGER fem_create_mesh_surfa_num_nodes
INTEGER fem_create_mesh_surfa_num_elems
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]
STRING mpc_list[80]
STRING node_list[virtual]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new data base.
$? YES 36000002
#---------------------------------------------------------------------
# Create a 2-D patch.
#---------------------------------------------------------------------
# Create a Fem mesh for this patch.
#---------------------------------------------------------------------
# Create one "Rigid (Fixed)" mpc.
#---------------------------------------------------------------------
# Create one "Explicit" mpc.
#---------------------------------------------------------------------
# Argument Initialization.
#---------------------------------------------------------------------
# Get Nodes associated to mpcs.
Main Index
1202
Code Examples
i_return_value = list_get_node_ass_mpc(mpc_list, @
node_list)
#---------------------------------------------------------------------
# Dump the output of the function
dump node_list
dump i_return_value
#---------------------------------------------------------------------
# closing the patran environment.
# uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
list_get_node_att_fringe ()
REAL val(2)
STRING act[80]
REAL tol
string group[32]
STRING node_list[virtual]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the file "spool.db"
uil_file_open.go( "./spool.db" )
#---------------------------------------------------------------------
# Create the fringe plot for NEW RESULT CASE, Displacement
"AsIs", @
"DeriveAverage", "All", @
"ShapeFunc", "", 0. )
#---------------------------------------------------------------------
# Argument Initialization.
val(1) = 0.0194
val(2) = 0.234
act = "range"
tol = 0.005
group = "fem_model"
#---------------------------------------------------------------------
# Get all nodes with a specified fringe range
i_return_value = list_get_node_att_fringe(val, @
act, @
tol, @
group, @
node_list)
#---------------------------------------------------------------------
# Dump the output of the function
dump node_list
dump i_return_value
#---------------------------------------------------------------------
# closing the patran environment.
# uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
Main Index
1204
Code Examples
list_get_node_att_value ()
STRING asm_create_patch_xy_created_ids[VIRTUAL]
INTEGER fem_create_mesh_surfa_num_nodes
INTEGER fem_create_mesh_surfa_num_elems
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]
REAL val_xyz(3)
LOGICAL val_log(3)
STRING act[80](3)
REAL tol(3)
STRING coord[32]
LOGICAL group
STRING node_list[virtual]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new data base.
$? YES 36000002
#---------------------------------------------------------------------
# Create a 2-D patch.
#---------------------------------------------------------------------
# Create a Fem mesh for this patch.
fem_create_mesh_s_nodes_created, @
fem_create_mesh_s_elems_created )
#---------------------------------------------------------------------
# Argument Initialization.
val_xyz(1) = 0.0
val_log(1) = TRUE
act(1) = "equal"
tol(1) = 0.005
coord = "coord 0"
group = TRUE
#---------------------------------------------------------------------
# Get all nodes with a specified coordinate value
i_return_value = list_get_node_att_value(val_xyz, @
val_log, @
act, @
tol, @
coord, @
group, @
node_list)
#---------------------------------------------------------------------
# Dump the output of the function
dump node_list
dump i_return_value
#---------------------------------------------------------------------
# closing the patran environment.
# uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
move_mesh ()
# Variable Declarations
INTEGER fem_create_mesh_surfa_num_nodes
INTEGER fem_create_mesh_surfa_num_elems
INTEGER int_status
STRING asm_create_patch_xy_created_ids[VIRTUAL]
STRING sgm_transform_surf__created_ids[VIRTUAL]
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]
#----------------------------------------------------------------------
# Open a new database
if(!db_is_open())THEN
uil_file_new.go("","new.db")
$? YES 36000002
endif
#----------------------------------------------------------------------
# Setting the preference to MSC.Nastran.
uil_pref_analysis.set_analysis_pref( "MSC.Nastran", @
"Structural", @
"", @
".op2" )
#---------------------------------------------------------------------
# Creating a Surface 1
#
int_status = asm_const_patch_xyz( @
"1", @
"<1 1 0>", @
"[0 0 0]", @
"Coord 0", @
asm_create_patch_xy_created_ids )
dump int_status
#---------------------------------------------------------------------
# Making a copy of the surface - Surface 2
int_status = sgm_transform_translate( @
"2", @
"surface", @
"<0 0 0.5>", @
"Coord 0", @
1, @
FALSE, @
"Surface 1", @
sgm_transform_surf__created_ids )
dump int_status
#---------------------------------------------------------------------
# Meshing the Surface 1 with quad4 elements
# creating 36 nodes and 25 elements for Surface 1.
int_status = fem_create_mesh_surf_3( @
"IsoMesh", @
16384, @
"Surface 1", @
1, @
["0.2"], @
"Quad4", @
"#", @
"#", @
"Coord 0", @
"Coord 0", @
fem_create_mesh_surfa_num_nodes, @
fem_create_mesh_surfa_num_elems, @
fem_create_mesh_s_nodes_created, @
fem_create_mesh_s_elems_created )
Main Index
CHAPTER 8 1207
Finite Element Model
dump int_status
#---------------------------------------------------------------------
# Using the function move mesh to move mesh from surface 1
# to Surface 2.
int_status = move_mesh(2,1,0.5)
dump int_status
#---------------------------------------------------------------------
# Closing the file new.db
uil_file_close.goquit( )
#---------------------------------------------------------------------
move_mesh_1 ()
INTEGER fem_create_mesh_surfa_num_nodes
INTEGER fem_create_mesh_surfa_num_elems
INTEGER int_status
STRING asm_create_patch_xy_created_ids[VIRTUAL]
STRING sgm_transform_surf__created_ids[VIRTUAL]
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]
#----------------------------------------------------------------------
# Open a new database
if(!db_is_open())THEN
uil_file_new.go("","new.db")
$? YES 36000002
endif
#----------------------------------------------------------------------
# Setting the preference to MSC.Nastran.
uil_pref_analysis.set_analysis_pref( "MSC.Nastran", @
"Structural", @
"", @
".op2" )
#---------------------------------------------------------------------
# Creating a Surface 1
Main Index
1208
Code Examples
#
int_status = asm_const_patch_xyz( @
"1", @
"<1 1 0>", @
"[0 0 0]", @
"Coord 0", @
asm_create_patch_xy_created_ids )
dump int_status
#---------------------------------------------------------------------
# Making a copy of the surface - Surface 2
int_status = sgm_transform_translate( @
"2", @
"surface", @
"<0 0 0.5>", @
"Coord 0", @
1, @
FALSE, @
"Surface 1", @
sgm_transform_surf__created_ids )
dump int_status
#---------------------------------------------------------------------
# Meshing the Surface 1 with quad4 elements
# creating 36 nodes and 25 elements for Surface 1.
int_status = fem_create_mesh_surf_3( @
"IsoMesh", @
16384, @
"Surface 1", @
1, @
["0.2"], @
"Quad4", @
"#", @
"#", @
"Coord 0", @
"Coord 0", @
fem_create_mesh_surfa_num_nodes, @
fem_create_mesh_surfa_num_elems, @
fem_create_mesh_s_nodes_created, @
fem_create_mesh_s_elems_created )
dump int_status
#---------------------------------------------------------------------
# Using the function move_mesh_1 to move mesh from surface 1
# to Surface 2.
dump int_status
#---------------------------------------------------------------------
# Closing the file new.db
uil_file_close.goquit( )
#---------------------------------------------------------------------
Main Index
MSC.Acumen, Volume 2: Code Examples
CHAPTER
Load Cases
9
■ Introduction
Main Index
1210
Code Examples
9.1 Introduction
This chapter provides code examples for the PCL function described in Volume 1. These
examples are designed so that they can be cut and pasted into a file and, by following the
instructions listed with each example, executed in MSC.Patran.
db_activate_load_case ()
db_delete_load_case ()
i_return_value = @
db_delete_load_case @
( s_lc_name )
dump i_return_value
db_find_load_case_id ()
[“TZ_fixed”, “400_psi”, @
“fillet_pressure”], [0, 0, 0], @
[1., 1., 1.], ““, 0., FALSE )
#---------------------------------------------------------------------
# Submit the model for analysis in MSC.Nastran by following the
# given steps
#
# 1. Pick “MSC.Nastran” from “Preferences”, “Analysis...”
# from Pulldown menus. Press “O.K” button.
#
# 2. Pick “Analysis” from Application radio buttons and
# perform the following operations in the form.
# (a)Give job-name as “spool”
# (b)Select “Subcase Select” for fixing solution sequence
# (c)Select the load cases(as sub-cases) in following order
# “default”,”new_lc1”, “new_lc2”,”spool_loads”
# (d)Press “Apply”
#
# Note : Permit deletion of earlier existing job files if any.
# Ignore the Warnings if any.
#
#---------------------------------------------------------------------
# Session file paused. Press “Resume” to continue..
sf_pause()
#---------------------------------------------------------------------
db_get_lc_id_given_job_seq ()
#---------------------------------------------------------------------
# Submit the model for analysis in MSC.Nastran by following the
# given steps
#
# 1. Pick “MSC.Nastran” from “Preferences”, “Analysis...”
# from Pulldown menus.
#
# 2. Pick “Analysis” from Application radio buttons and
# perform the following operations in the form.
# (a)Give job-name as “spool”
# (b)Select “Subcase Select” for fixing solution sequence
# (c)Select the load cases(as sub-cases) in following order
# “new_lc1”, “new_lc2”,”spool_loads”
# (d)Press “Apply”
#
# Note : Permit deletion of earlier existing job files if any.
# Ignore the warnings if any.
#---------------------------------------------------------------------
Main Index
CHAPTER 9 1215
Load Cases
#---------------------------------------------------------------------
Main Index
1216
Code Examples
Main Index
MSC.Acumen, Volume 2: Code Examples
CHAPTER
Element Properties
10
■ Introduction
Main Index
1218
Code Examples
10.1 Introduction
This chapter provides code examples for the PCL function described in Volume 1. These
examples are designed so that they can be cut and pasted into a file and, by following the
instructions listed with each example, executed in MSC.Patran.
bl_create_std_beam_section ()
IF(!db_is_open())THEN
uil_file_new.go("", "new.db")
END IF
$? YES 36000002
INTEGER ndim = 4
INTEGER id
INTEGER status = 1
status = bl_create_std_beam_section(shape, @
name, @
ndim, @
data_types, @
rvalues, @
field_ids, @
id)
dump status
dump id
#---------------------------------------------------------------------
# End of File.
#---------------------------------------------------------------------
bl_get_std_beam_section_data ()
#
#
# Opening new database
IF(!db_is_open())THEN
uil_file_new.go("", "new.db")
END IF
$? YES 36000002
INTEGER id
INTEGER ndim = 4
INTEGER data_types(4)
REAL rvalues(4)
INTEGER field_ids(4)
INTEGER status = 1
bl_create_std_beam_section(shape_1, @
name_1, @
ndim_1, @
data_types_1, @
rvalues_1, @
field_ids_1, @
id)
status = bl_get_std_beam_section_data(id,ndim, @
data_types, @
rvalues, @
field_ids)
Main Index
CHAPTER 10 1221
Element Properties
dump status
dump data_types
dump rvalues
dump field_ids
#---------------------------------------------------------------------
# End of File.
#---------------------------------------------------------------------
bl_modify_std_beam_section ()
IF(!db_is_open())THEN
uil_file_new.go("", "new.db")
END IF
$? YES 36000002
STRING new_shape[4]="H"
INTEGER ndim = 4
INTEGER id
INTEGER status = 1
bl_create_std_beam_section(shape_1, @
old_name, @
ndim_1, @
data_types_1, @
rvalues_1, @
field_ids_1, @
id_1)
status = bl_modify_std_beam_section(new_shape, @
old_name, @
new_name, @
ndim, @
data_types, @
rvalues, @
field_ids, @
id)
dump status
dump id
#---------------------------------------------------------------------
# End of File.
#---------------------------------------------------------------------
Main Index
CHAPTER 10 1223
Element Properties
blcomputeprincaxespoints ()
INTEGER npoints = 4
INTEGER status = 1
#---------------------------------------------------------------------
status=blcomputeprincaxespoints(alpha, @
npoints, @
points, @
centroid, @
princ_axis1, @
princ_axis2)
dump princ_axis1
dump princ_axis2
dump status
#****************************************************************
Main Index
1224
Code Examples
# End of File
#****************************************************************
blgetalpha ()
INTEGER enttyp = 2
REAL alpha
INTEGER status = 1
blgetprop(enttyp, @
shape, @
dim, @
ndim, @
prop, @
nprop)
#---------------------------------------------------------------------
status=blgetalpha(enttyp, @
Main Index
CHAPTER 10 1225
Element Properties
prop, @
alpha)
dump alpha
dump status
#--------------------------------------------------------------------
# End of File.
#---------------------------------------------------------------------
blgetbuttonicon ()
STRING cdo[64]
INTEGER status = 1
#---------------------------------------------------------------------
status=blgetbuttonicon(shape,cdo)
dump cdo
dump status
#---------------------------------------------------------------------
# End of File.
#---------------------------------------------------------------------
Main Index
1226
Code Examples
blgetcenters ()
INTEGER enttyp = 2
STRING shape[4]="T"
REAL dim(4)=[5,5,1,1]
REAL centroid(2)
REAL shear(2)
INTEGER status = 1
INTEGER ndim = 4
INTEGER nprop
blgetprop(enttyp, @
shape, @
dim, @
ndim, @
prop, @
nprop)
#---------------------------------------------------------------------
Main Index
CHAPTER 10 1227
Element Properties
status=blgetcenters(enttyp, @
shape, @
dim, @
prop, @
centroid, @
shear)
dump status
dump centroid
dump shear
#---------------------------------------------------------------------
# End of File
#---------------------------------------------------------------------
blgetdimfieldid ()
IF(!db_is_open())THEN
uil_file_new.go("", "new.db")
END IF
$? YES 36000002
INTEGER bsid
Main Index
1228
Code Examples
INTEGER dim_loc = 2
INTEGER field_id
INTEGER status = 1
string dstring[32](4)
dstring(1) = "5.0"
dstring(2) = "5.0"
dstring(3) = "f:S" /* Applying this dim. through field "S" */
dstring(4) = "1.0"
beam_section_create(section_name, @
shape, @
dstring)
db_get_beam_section_id(section_name,bsid)
#---------------------------------------------------------------------
status=blgetdimfieldid(bsid, @
dim_loc, @
field_id)
dump status
dump field_id
#---------------------------------------------------------------------
# End of File.
#---------------------------------------------------------------------
blgetdimvalue
IF(!db_is_open())THEN
uil_file_new.go("", "new.db")
END IF
$? YES 36000002
INTEGER bsid
INTEGER dim_loc = 1
REAL value
INTEGER status = 1
string dstring[32](4)
dstring(1) = "5.0"
dstring(2) = "5.0"
dstring(3) = "1.0"
dstring(4) = "1.0"
beam_section_create(section_name, @
shape, @
dstring)
db_get_beam_section_id(section_name, @
bsid)
#---------------------------------------------------------------------
Main Index
1230
Code Examples
status=blgetdimvalue(bsid, @
dim_loc, @
value)
dump status
dump value
#---------------------------------------------------------------------
# End of File.
#---------------------------------------------------------------------
blgetlabelicon ()
STRING cdo[64]
INTEGER status = 1
#---------------------------------------------------------------------
status=blgetlabelicon(shape,cdo)
dump cdo
dump status
#---------------------------------------------------------------------
# End of File.
#---------------------------------------------------------------------
Main Index
CHAPTER 10 1231
Element Properties
blgetlabels ()
STRING cdo[64](4)
INTEGER status = 1
#--------------------------------------------------------------------
status=blgetlabels(shape,cdo)
dump cdo
dump status
#---------------------------------------------------------------------
# End of File.
#---------------------------------------------------------------------
blgetnumdimension ()
INTEGER numdim
#---------------------------------------------------------------------
numdim = blgetnumdimension(shape)
dump numdim
#---------------------------------------------------------------------
# End of File.
#---------------------------------------------------------------------
blgetnumplotpoints ()
INTEGER npoints
INTEGER nloops
INTEGER status
#---------------------------------------------------------------------
status = blgetnumplotpoints(shape, @
chord_tol, @
npoints, @
nloops)
dump npoints
dump nloops
dump status
#---------------------------------------------------------------------
# End of File.
#---------------------------------------------------------------------
blgetnumplotpointsbyid ()
IF(!db_is_open())THEN
uil_file_new.go("", "new.db")
END IF
$? YES 36000002
# points and loops for std beam section "T" using function
# blgetnumplotpontsbyid().
# In this function we will create std "T" beam section using
# function beam_section_create() and we will get beam section id
# for this new beam section using function db_get_beam_section_id()
# which we will use in blgetnumplotpontsbyid() function */
INTEGER bsid
INTEGER npoints
INTEGER nloops
INTEGER status = 1
string dstring[32](4)
dstring(1) = "5.0"
dstring(2) = "5.0"
dstring(3) = "1.0"
dstring(4) = "1.0"
beam_section_create(section_name, @
shape, @
dstring)
db_get_beam_section_id(section_name,bsid)
#---------------------------------------------------------------------*/
status=blgetnumplotpointsbyid(bsid, @
chord_tol, @
npoints, @
nloops)
dump status
dump npoints
dump nloops
#---------------------------------------------------------------------
# End of File.
#---------------------------------------------------------------------
Main Index
CHAPTER 10 1235
Element Properties
blgetnumtypeinfo ()
INTEGER nsect
INTEGER ndimax
INTEGER status = 1
#---------------------------------------------------------------------
status=blgetnumtypeinfo(nsect,ndimax)
dump nsect
dump ndimax
dump status
#---------------------------------------------------------------------
# End of File
#---------------------------------------------------------------------
blgetperim ()
STRING shape[4]="T"
REAL dim(4)=[5,5,1,1]
REAL perim
INTEGER status = 1
status=blgetperim(shape, @
dim, @
perim)
dump status
dump perim
#---------------------------------------------------------------------
# End of File
#---------------------------------------------------------------------
blgetplotpoints ()
# Purpose : This function gets the coord. of plot points and the
# number of points on each loop for a given section.
# This function requires beam shape, dimensions for
# beam section, number of tota plot points and loops.
# It will give coordinates of plot points for the
# section and array of number of points on each loop
#
# This file can be run by starting a session of
# MSC.Patran,running this session file through
# the "File","Session","Play" pulldown menus
# on the menu bar.
#
#
# The function blgetplotpoints()
# has the following arguments:
#
Main Index
CHAPTER 10 1237
Element Properties
# blgetplotpoints
# ( INPUT:
# STRING shape,
# REAL dim()
# INTEGER npoints,
# INTEGER nloops,
# OUTPUT:
# REAL points(),
# INTEGER nploop()
# )
#---------------------------------------------------------------------
#
# Declaring and defining input arguments
INTEGER npoints
INTEGER nloops
REAL points(9,2)
INTEGER nploop(4)
INTEGER status
#---------------------------------------------------------------------
blgetnumplotpoints(shape, @
chord_tol, @
npoints, @
nloops)
#--------------------------------------------------------------------
status = blgetplotpoints(shape, @
dim, @
npoints, @
nloops, @
points, @
nploop)
dump status
dump points
dump nploop
#---------------------------------------------------------------------
# End of File.
#---------------------------------------------------------------------
Main Index
1238
Code Examples
blgetplotpointsbyid ()
INTEGER bsid
INTEGER bmtype = 2
INTEGER entype = 124
INTEGER entid = 1
INTEGER nparloc = 2
Main Index REAL parloc(2)=[0.5,0.75]
CHAPTER 10 1239
Element Properties
INTEGER nrmflg = 1
INTEGER npoints = 9
INTEGER nloops = 1
REAL points(18,2)
INTEGER nploop(1)
REAL vec1s(2,3)
REAL vec2s(2,3)
REAL xyz(6)
INTEGER status
#---------------------------------------------------------------------
STRING asm_create_line_xyz_created_ids[VIRTUAL]
asm_const_line_xyz( "1", "<1 0 0>", @
"[0 0 0]", "Coord 0", @
asm_create_line_xyz_created_ids )
INTEGER fem_create_mesh_curve_num_nodes
INTEGER fem_create_mesh_curve_num_elems
STRING fem_create_mesh_c_nodes_created[VIRTUAL]
STRING fem_create_mesh_c_elems_created[VIRTUAL]
["m:mat", "T_s", @
"<1 1 0>", "", "", "", @
"", "", ""], "Curve 1" )
db_get_beam_section_id("T_s", bsid)
#--------------------------------------------------------------------
status = blgetplotpointsbyid(bsid,bmtype, @
entype,entid, @
nparloc,parloc, @
nrmflg,npoints, @
nloops, points, @
nploop, vec1s, @
vec2s,xyz)
dump status
dump points
dump nploop
dump vec1s
dump vec2s
dump xyz
#---------------------------------------------------------------------
# End of File.
#---------------------------------------------------------------------
blgetplotpointsbyid2 ()
uil_file_new.go("","new.db")
INTEGER bsid
INTEGER bmtype = 2
INTEGER entype = 124
INTEGER entid = 1
INTEGER nparloc = 2
REAL parloc(2)=[0.5,0.75]
INTEGER nrmflg = 1
INTEGER npoints = 9
INTEGER nloops = 1
INTEGER dspmode = 0
REAL points(18,2)
INTEGER nploop(1)
REAL vec1s(2,3)
REAL vec2s(2,3)
REAL xyz(6)
INTEGER status
#---------------------------------------------------------------------
STRING asm_create_line_xyz_created_ids[VIRTUAL]
asm_const_line_xyz( "1", "<1 0 0>", @
"[0 0 0]", "Coord 0", @
asm_create_line_xyz_created_ids )
INTEGER fem_create_mesh_curve_num_nodes
INTEGER fem_create_mesh_curve_num_elems
STRING fem_create_mesh_c_nodes_created[VIRTUAL]
STRING fem_create_mesh_c_elems_created[VIRTUAL]
db_get_beam_section_id("T_s", bsid)
#--------------------------------------------------------------------
status = blgetplotpointsbyid2(bsid,bmtype, @
entype,entid, @
nparloc,parloc, @
Main Index
CHAPTER 10 1243
Element Properties
nrmflg,npoints, @
nloops,dspmode, @
points,nploop, @
vec1s,vec2s,xyz)
dump status
dump points
dump nploop
dump vec1s
dump vec2s
dump xyz
#---------------------------------------------------------------------
# End of File.
#---------------------------------------------------------------------
blgetprop ()
INTEGER enttyp = 2
STRING shape[4]="T"
REAL dim(4)=[5.0,5.0,1.0,1.0]
INTEGER ndim = 4
REAL prop(30)
INTEGER nprop
Main Index
1244
Code Examples
INTEGER status = 1
# Using the function blgetprop() to get properties for the std "T"
# beam section and number of properties.
status = blgetprop(enttyp, @
shape, @
dim, @
ndim, @
prop, @
nprop)
dump status
dump prop
dump nprop
#---------------------------------------------------------------------
# End of File
#---------------------------------------------------------------------
blgetproplabels ()
INTEGER enttyp = 2
STRING cdo[8](30)
INTEGER status = 1
status = blgetproplabels(enttyp,cdo)
Main Index
CHAPTER 10 1245
Element Properties
dump status
dump cdo
#---------------------------------------------------------------------
# End of File
#---------------------------------------------------------------------
blgettypeinfo ()
INTEGER entyp = 2
STRING shapes[8](20)
INTEGER ndims(20)
INTEGER nconsts(20)
INTEGER status = 1
#---------------------------------------------------------------------
status=blgettypeinfo(entyp, @
shapes, @
ndims, @
nconsts)
dump shapes
dump ndims
dump nconsts
dump status
#---------------------------------------------------------------------
Main Index
1246
Code Examples
# End Of File
#---------------------------------------------------------------------
blmodifybeamdimension ()
IF (!db_is_open())THEN
uil_file_new.go("", "new.db")
END IF
$? YES 36000002
INTEGER bsid
INTEGER dimid = 3
REAL value = 6
INTEGER fid = 1
INTEGER status = 1
bl_create_std_beam_section(shape, @
name, @
ndim, @
data_types, @
rvalues, @
field_ids, @
bsid)
status = blmodifybeamdimension(bsid, @
dimid, @
value, @
fid)
dump status
#---------------------------------------------------------------------
# End of File.
#---------------------------------------------------------------------
db_associate_geo_to_region ()
INTEGER i_gsid
INTEGER i_rid
INTEGER ia_rid(1)
INTEGER i_id = 9
STRING s_region_name[32] = [“REGION”]
INTEGER i_elem_type = 1
INTEGER i_geom_id = 1
INTEGER i_condense_id = 1
INTEGER i_form_id = 1
INTEGER i_lam_id = 1
INTEGER i_dof_set_id = 1
INTEGER i_count_region
INTEGER i_count
STRING sv_asm_create_patch_xy[VIRTUAL]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
i_return_value = @
db_associate_geo_to_region @
( i_gid, @
i_gtype, @
i_gsid, @
i_rid )
dump i_return_value
SYS_FREE_STRING( sv_asm_create_patch_xy )
#---------------------------------------------------------------------
db_bulk_get_possible_dof_sets1 ()
# i_etid = 1 (MASS)
i_etid = 1
# i_atid = 1 (STRUCTURAL)
i_atid = 1
# i_acid = 1 (MSC.Nastran)
i_acid = 1
i_return_value = @
db_bulk_get_possible_dof_sets1 @
( i_etid, @
i_atid, @
i_acid, @
i_nbr, @
ia_dsid )
dump i_return_value
# The number of dof set ids that were found for the above
# specified set of parameters are
Main Index
1250
Code Examples
dump i_nbr
# The unique dof set ids that were found for the above
# specified set of parameters are
dump ia_dsid
#---------------------------------------------------------------------
db_bulk_get_possible_dof_sets2 ()
i_goc = 25
# i_foc = 1 (Formulation option STANDARD FORMULATION)
i_foc = 1
# i_loc = 1 (Laminate option HOMOGENEOUS)
i_loc = 1
# i_coc = 35 ( Condensation option THIN SHELL )
i_coc = 35
i_return_value = @
db_bulk_get_possible_dof_sets2 @
( i_etid, @
i_atid, @
i_acid, @
i_coc, @
i_goc, @
i_foc, @
i_loc, @
i_nbr, @
ia_dsid )
dump i_return_value
# The number of dof set Ids that were found for the above
# specified set of parameters are
dump i_nbr
# The unique dof set Ids that were found for the above
# specified set of parameters are
dump ia_dsid
#---------------------------------------------------------------------
db_bulk_get_possible_form_opts1 ()
uil_file_new.go(““,”new.db”)
$? YES 36000002
# i_etid = 1 (MASS)
i_etid = 1
# i_atid = 1 (STRUCTURAL)
i_atid = 1
# i_acid = 1 (MSC.Nastran)
i_acid = 1
i_return_value = @
db_bulk_get_possible_form_opts1 @
( i_etid, @
i_atid, @
i_acid, @
i_nbr, @
ia_foc )
dump i_return_value
db_bulk_get_possible_form_opts2 ()
INTEGER i_nbr
INTEGER ia_foc(4)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
i_return_value = @
db_bulk_get_possible_form_opts2 @
( i_etid, @
i_atid, @
i_acid, @
i_goc, @
i_coc, @
i_loc, @
i_nbr, @
ia_foc )
dump i_return_value
# The number of formulation option codes found for the above
# specified set of parameters.
dump i_nbr
# The unique formulation option codes values found for the above
# specified set of parameters.
dump ia_foc
#---------------------------------------------------------------------
db_bulk_get_possible_geo_opts1 ()
# ( etid,
# atid,
# acid,
# nbr,
# goc )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_etid
INTEGER i_atid
INTEGER i_acid
INTEGER i_nbr
INTEGER ia_goc(2)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
# i_etid = 1 (MASS)
i_etid = 1
# i_atid = 1 (STRUCTURAL)
i_atid = 1
# i_acid = 1 (MSC.Nastran)
i_acid = 1
i_return_value = @
db_bulk_get_possible_geo_opts1 @
( i_etid, @
i_atid, @
i_acid, @
i_nbr, @
ia_goc )
dump i_return_value
# The number of geometric option codes that were found for the above
# specified set of parameters are
dump i_nbr
# The unique geometric option code values that were found for the
# above specified set of parameters are
dump ia_goc
#---------------------------------------------------------------------
db_bulk_get_possible_lam_opts1 ()
# atid,
# acid,
# nbr,
# loc )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_etid
INTEGER i_atid
INTEGER i_acid
INTEGER i_nbr
INTEGER ia_loc(2)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
# i_etid = 1 (MASS)
i_etid = 1
# i_atid = 1 (STRUCTURAL)
i_atid = 1
# i_acid = 1 (MSC.Nastran)
i_acid = 1
i_return_value = @
db_bulk_get_possible_lam_opts1 @
( i_etid, @
i_atid, @
i_acid, @
i_nbr, @
ia_loc )
dump i_return_value
# The number of laminate option codes that were found for the above
# specified set of parameters are
dump i_nbr
# The unique laminate option code values that were found for the
# above specified set of parameters are
dump ia_loc
#---------------------------------------------------------------------
db_bulk_get_possible_lam_opts2 ()
# acid,
# goc,
# coc,
# nbr,
# loc )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_etid
INTEGER i_atid
INTEGER i_acid
INTEGER i_goc
INTEGER i_coc
INTEGER i_nbr
INTEGER ia_loc(4)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
db_bulk_get_possible_matl_dirs ()
i_return_value = @
db_bulk_get_possible_matl_dirs @
( i_etid, @
i_atid, @
Main Index
1258
Code Examples
i_acid, @
i_goc, @
i_foc, @
i_loc, @
i_dsid, @
i_coc, @
i_mlc, @
i_nbr, @
ia_mdc )
dump i_return_value
db_bulk_get_possible_matl_lins ()
INTEGER ia_mlc(4)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
db_bulk_get_selected_etops_mat ()
ia_etop )
dump i_return_value
db_count_elem_type ()
db_count_elem_type @
( i_acid, @
i_atid, @
ia_etcnt )
Main Index
1262
Code Examples
db_count_elements_in_region_exp ()
fem_create_elems(“Bar”,”Bar2”,”2”,”standard” @
,TRUE,”[1 0 0]”,”[1 1 0]”,””,””,””,””,””,””, @
sv_fem_create_elems_created)
fem_create_elems(“Bar”,”Bar2”,”3”,”standard” @
,TRUE,”[1 1 0]”,”[0 1 0]”,””,””,””,””,””,””, @
sv_fem_create_elems_created)
fem_create_elems(“Bar”,”Bar2”,”4”,”standard” @
,TRUE,”[0 1 0]”,”[0 0 0]”,””,””,””,””,””,””, @
sv_fem_create_elems_created)
SYS_ALLOCATE_ARRAY(iv_eid,1,i_count)
SYS_FREE_ARRAY(iv_eid)
SYS_FREE_STRING(sv_fem_create_elems_created)
#---------------------------------------------------------------------
db_count_etop_for_a_code ()
#
# The function db_count_etop_for_a_code()
# has the following arguments:
#
# db_count_etop_for_a_code
# ( acid,
# atid,
# count )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_acid
INTEGER i_atid
INTEGER i_count
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
i_return_value = @
db_count_etop_for_a_code @
( i_acid, @
i_atid, @
i_count )
dump i_return_value
db_count_geo_in_region ()
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_rid
INTEGER ia_rid(1)
INTEGER i_count
INTEGER i_count_region
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)
db_create_analysis_elements ()
STRING sa_etnames[32](2)
INTEGER ia_etids_c(4)
INTEGER iv_etids_c(VIRTUAL)
STRING sv_etnames_c[32](VIRTUAL)
INTEGER iv_etids_c1(VIRTUAL)
STRING sv_etnames_c1[32](VIRTUAL)
INTEGER i_etcntmax
INTEGER i_etcntfound
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
db_count_elem_type @
( i_acid, @
i_atid, @
ia_etids_c )
# Adding the element type of each dimensionality to get
# the maximum number of element types.
i_etcntmax = ia_etids_c(1) + ia_etids_c(2) + @
ia_etids_c(3) + ia_etids_c(4)
SYS_ALLOCATE_ARRAY(iv_etids_c,1,i_etcntmax )
SYS_ALLOCATE_ARRAY(sv_etnames_c,1,i_etcntmax )
dump i_return_value
db_create_anl_elm_summary ()
# i_acid = 1 (MSC.Nastran)
i_acid = 1
# i_atid = 1 (STRUCTURAL)
i_atid = 1
i_return_value = @
db_get_anl_elm_summary @
( i_acid, @
i_atid, @
ia_etcnt_c )
dump i_return_value
i_return_value = @
db_create_anl_elm_summary @
( i_acid, @
i_atid, @
ia_etcnt )
dump i_return_value
i_return_value = @
db_get_anl_elm_summary @
( i_acid, @
i_atid, @
ia_etcnt_c )
dump i_return_value
db_create_phys_prop_set_defn ()
i_id = 8
s_name = “GSSL”
i_num = 3
ia_ppids = [1,6,7]
i_return_value = @
db_create_phys_prop_set_defn @
( i_id, @
s_name, @
i_num, @
ia_ppids )
dump i_return_value
db_create_selected_etype ()
i_geopcd = 1
i_copcd = 1
i_fopcd = 1
i_lopcd = 1
i_etopid = 1
i_dofsetid = 1
i_mlcd = 1
i_mdcd = 1
db_create_selected_etype @
( i_atid, @
i_acid, @
i_geopcd, @
i_copcd, @
i_fopcd, @
i_lopcd, @
i_etopid, @
i_dofsetid, @
i_mlcd, @
i_mdcd, @
i_etypid )
dump i_return_value
db_delete_analysis_elements ()
STRING sv_etnames[32](VIRTUAL)
STRING s_err_msg[32]
INTEGER i_etcntmax
INTEGER i_etcntfound
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
db_count_elem_type @
( i_acid, @
i_atid, @
ia_etids_c )
SYS_ALLOCATE_ARRAY(iv_etids,1,i_etcntmax )
SYS_ALLOCATE_ARRAY(sv_etnames,1,i_etcntmax )
msg_get_string(i_return_value,s_err_msg)
dump s_err_msg
SYS_FREE_ARRAY(iv_etids)
SYS_FREE_ARRAY(sv_etnames)
#---------------------------------------------------------------------
db_delete_anl_elm_summary ()
# i_acid = 1 (MSC.Nastran)
i_acid = 1
# i_atid = 1 (STRUCTURAL)
i_atid = 1
i_return_value = @
db_get_anl_elm_summary @
( i_acid, @
i_atid, @
ia_etcnt )
dump i_return_value
i_return_value = @
db_get_anl_elm_summary @
( i_acid, @
i_atid, @
ia_etcnt )
dump i_return_value
db_delete_phys_prop_region ()
uil_file_new.go(““,”new.db”)
$? YES 36000002
# No of regions are
db_count_region_ids(i_count_region)
dump i_count_region
i_return_value = @
db_delete_phys_prop_region @
( i_id )
dump i_return_value
db_get_a_phys_prop_w_nord ()
i_return_value = @
db_get_a_phys_prop_w_nord @
( i_acid, @
i_ppid, @
i_defid, @
s_alias, @
i_rflag, @
ia_atypes, @
i_dtype, @
i_nord, @
s_aival, @
s_arval, @
s_acval )
dump i_return_value
db_get_all_dof_set_names ()
i_return_value = db_get_all_dof_set_names()
dump i_return_value
WHILE( i_return_value == 0 )
i_return_value = @
db_get_next_dof_set_names @
( s_name, @
i_id )
IF( i_return_value == 0 ) THEN
dump s_name
dump i_id
ELSE
dump i_return_value
msg_get_string(i_return_value,s_msg)
dump s_msg
END IF
END WHILE
#---------------------------------------------------------------------
db_get_all_elem_defn ()
i_return_value = @
db_get_all_elem_defn @
( i_acid, @
i_atid, @
i_eldim )
dump i_return_value
WHILE( i_return_value == 0 )
i_return_value = @
db_get_next_elem_defn @
( i_etype_id, @
s_ename )
IF( i_return_value == 0 ) THEN
dump s_ename
dump i_etype_id
ELSE
dump i_return_value
msg_get_string(i_return_value,s_msg)
dump s_msg
END IF
END WHILE
#---------------------------------------------------------------------
Main Index
CHAPTER 10 1279
Element Properties
db_get_all_form_opt_code_names ()
i_return_value = db_get_all_form_opt_code_names()
dump i_return_value
WHILE( i_return_value == 0 )
i_return_value = @
db_get_next_form_opt_code_names @
( s_name, @
i_id )
IF( i_return_value == 0 ) THEN
dump s_name
dump i_id
ELSE
dump i_return_value
msg_get_string(i_return_value,s_msg)
dump s_msg
END IF
END WHILE
#---------------------------------------------------------------------
db_get_all_geo_opt_code_names ()
i_return_value = db_get_all_geo_opt_code_names()
dump i_return_value
WHILE( i_return_value == 0 )
i_return_value = @
db_get_next_geo_opt_code_names @
( s_name, @
i_id )
IF( i_return_value == 0 ) THEN
dump s_name
dump i_id
ELSE
dump i_return_value
msg_get_string(i_return_value,s_msg)
dump s_msg
END IF
END WHILE
#---------------------------------------------------------------------
db_get_all_lam_opt_code_names ()
STRING s_name[32]
STRING s_msg[64]
INTEGER i_id
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
i_return_value = db_get_all_lam_opt_code_names()
dump i_return_value
WHILE( i_return_value == 0 )
i_return_value = @
db_get_next_lam_opt_code_names @
( s_name, @
i_id )
IF( i_return_value == 0 ) THEN
dump s_name
dump i_id
ELSE
dump i_return_value
msg_get_string(i_return_value,s_msg)
dump s_msg
END IF
END WHILE
#---------------------------------------------------------------------
db_get_all_pp_ids_and_names ()
i_return_value = db_get_all_pp_ids_and_names()
Main Index
1282
Code Examples
dump i_return_value
WHILE( i_return_value == 0 )
i_return_value = @
db_get_next_pp_ids_and_names @
( i_pp_id, @
s_pp_name, @
i_datatype )
IF( i_return_value == 0 ) THEN
dump i_pp_id
dump s_pp_name
dump i_datatype
ELSE
msg_get_string(i_return_value,s_msg)
dump s_msg
END IF
END WHILE
#---------------------------------------------------------------------
db_get_allowable_phys_prop ()
uil_file_new.go(““,”new.db”)
$? YES 36000002
i_return_value = @
db_get_allowable_phys_prop @
( i_acid, @
i_ppid, @
s_alias, @
i_rflag, @
ia_atypes, @
i_dtype, @
i_nord, @
s_aival, @
s_arval, @
s_acval )
dump i_return_value
db_get_analysis_elements ()
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_acid
INTEGER i_atid
INTEGER i_etcnt
INTEGER ia_etids_c(4)
INTEGER iv_etids(VIRTUAL)
STRING sv_etnames[32](VIRTUAL)
INTEGER i_etcntmax
INTEGER i_etcntfound
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
db_count_elem_type @
( i_acid, @
i_atid, @
ia_etids_c )
SYS_ALLOCATE_ARRAY(iv_etids,1,i_etcntmax )
SYS_ALLOCATE_ARRAY(sv_etnames,1,i_etcntmax )
SYS_FREE_ARRAY(iv_etids)
SYS_FREE_ARRAY(sv_etnames)
#---------------------------------------------------------------------
db_get_anl_elm_summary ()
# i_acid = 1 (MSC.Nastran)
i_acid = 1
# i_atid = 1 (STRUCTURAL)
i_atid = 1
i_return_value = @
db_get_anl_elm_summary @
( i_acid, @
i_atid, @
ia_etcnt )
dump i_return_value
i_return_value = @
db_create_anl_elm_summary @
( i_acid, @
i_atid, @
ia_etcnt_c )
dump i_return_value
i_return_value = @
db_get_anl_elm_summary @
( i_acid, @
i_atid, @
ia_etcnt )
Main Index
1286
Code Examples
dump i_return_value
db_get_elements_in_region_exp ()
i_form_id, @
i_lam_id, @
i_dof_set_id )
dump i_return_value
SYS_ALLOCATE_ARRAY(iv_eid,1,i_count)
SYS_FREE_ARRAY(iv_eid)
SYS_FREE_STRING(sv_fem_create_elems_created)
#---------------------------------------------------------------------
db_get_etop_for_a_code ()
db_count_etop_for_a_code @
( i_acid, @
i_atid, @
i_count )
SYS_ALLOCATE_ARRAY(iv_etids,1,i_count)
i_return_value = @
db_get_etop_for_a_code @
( i_acid, @
i_atid, @
i_count, @
iv_etids )
dump i_return_value
db_get_geo_in_region ()
SYS_ALLOCATE_ARRAY(iv_gid,1,i_count)
SYS_ALLOCATE_ARRAY(iv_gtype,1,i_count)
SYS_ALLOCATE_ARRAY(iv_gsid,1,i_count)
dump iv_gid
# The type of the geometric entities associated with the region.
dump iv_gtype
# The sub-ids of the geometric entities associated with the region.
dump iv_gsid
SYS_FREE_ARRAY(iv_gid)
SYS_FREE_ARRAY(iv_gtype)
SYS_FREE_ARRAY(iv_gsid)
#---------------------------------------------------------------------
db_get_next_dof_set_names ()
i_return_value = db_get_all_dof_set_names()
dump i_return_value
WHILE( i_return_value == 0 )
i_return_value = @
db_get_next_dof_set_names @
( s_name, @
i_id )
IF( i_return_value == 0 ) THEN
dump s_name
dump i_id
ELSE
dump i_return_value
msg_get_string(i_return_value,s_msg)
dump s_msg
END IF
END WHILE
#---------------------------------------------------------------------
Main Index
CHAPTER 10 1291
Element Properties
db_get_next_elem_defn ()
i_return_value = @
db_get_all_elem_defn @
( i_acid, @
i_atid, @
i_eldim )
dump i_return_value
WHILE( i_return_value == 0 )
i_return_value = @
db_get_next_elem_defn @
( i_etype_id, @
s_ename )
IF( i_return_value == 0 ) THEN
dump s_ename
dump i_etype_id
ELSE
dump i_return_value
msg_get_string(i_return_value,s_msg)
dump s_msg
END IF
END WHILE
#---------------------------------------------------------------------
Main Index
1292
Code Examples
db_get_next_form_opt_code_names ()
i_return_value = db_get_all_form_opt_code_names()
dump i_return_value
WHILE( i_return_value == 0 )
i_return_value = @
db_get_next_form_opt_code_names @
( s_name, @
i_id )
IF( i_return_value == 0 ) THEN
dump s_name
dump i_id
ELSE
dump i_return_value
msg_get_string(i_return_value,s_msg)
dump s_msg
END IF
END WHILE
#---------------------------------------------------------------------
db_get_next_geo_opt_code_names ()
i_return_value = db_get_all_geo_opt_code_names()
dump i_return_value
WHILE( i_return_value == 0 )
i_return_value = @
db_get_next_geo_opt_code_names @
( s_name, @
i_id )
IF( i_return_value == 0 ) THEN
dump s_name
dump i_id
ELSE
dump i_return_value
msg_get_string(i_return_value,s_msg)
dump s_msg
END IF
END WHILE
#---------------------------------------------------------------------
db_get_next_lam_opt_code_names ()
i_return_value = db_get_all_lam_opt_code_names()
dump i_return_value
WHILE( i_return_value == 0 )
i_return_value = @
db_get_next_lam_opt_code_names @
( s_name, @
i_id )
IF( i_return_value == 0 ) THEN
dump s_name
dump i_id
ELSE
dump i_return_value
msg_get_string(i_return_value,s_msg)
dump s_msg
END IF
END WHILE
#---------------------------------------------------------------------
db_get_next_pp_ids_and_names ()
# datatype )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_pp_id
STRING s_pp_name[32]
STRING s_msg[64]
INTEGER i_datatype
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)
i_return_value = db_get_all_pp_ids_and_names()
dump i_return_value
WHILE( i_return_value == 0 )
i_return_value = @
db_get_next_pp_ids_and_names @
( i_pp_id, @
s_pp_name, @
i_datatype )
IF( i_return_value == 0 ) THEN
dump i_pp_id
dump s_pp_name
dump i_datatype
ELSE
dump i_return_value
msg_get_string(i_return_value,s_msg)
dump s_msg
END IF
END WHILE
#---------------------------------------------------------------------
db_get_phys_prop_set_defn ()
INTEGER i_num,i_num_c
INTEGER ia_ppids(3),ia_ppids_c(3)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
i_id = 8
s_name_c = “GSSL”
i_num_c = 3
ia_ppids_c = [1,6,7]
db_create_phys_prop_set_defn @
( i_id, @
s_name_c, @
i_num_c, @
ia_ppids_c )
dump i_return_value
db_get_region_for_geometry ()
INTEGER i_entity_type
INTEGER i_entity_id
INTEGER i_label
INTEGER i_rid
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)
# i_entity_type = 3 (surface)
i_entity_type = 3
i_return_value = @
db_get_region_for_geometry @
( i_entity_type, @
i_entity_id, @
i_rid )
dump i_return_value
db_get_region_ids_and_names ()
SYS_ALLOCATE_ARRAY(iv_rid,1,i_count)
SYS_ALLOCATE_ARRAY(sv_name,1,i_count)
i_return_value = @
db_get_region_ids_and_names @
( i_count, @
iv_rid, @
sv_name )
dump i_return_value
SYS_FREE_ARRAY(iv_rid)
SYS_FREE_ARRAY(sv_name)
#---------------------------------------------------------------------
db_get_selected_prop_set ()
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
db_set_comp_lam ()
i_return_value = @
material.create( “Analysis code ID”, 1, “Analysis type ID”, 1, @
“2dort1”, 0, “Date: 08-Aug-97 Time: 12:11:28”, @
“2d Orthotropic”, 5, “Directionality”, 4, “Linearity”, 1, @
“Homogeneous”, 0, “Linear Elastic”, 1, “Model Options & IDs”, @
[““, ““, ““, ““, ““], [0, 0, 0, 0, 0], “Active Flag”, 1, “Create”,@
10, “External Flag”, FALSE, “Property IDs”, [“Elastic Modulus”, @
“Elastic Modulus 22”, “Poisson Ratio”, “Shear Modulus”, @
“Shear Modulus 23”, “Shear Modulus 31”], [2, 3, 5, 8, 9, 10, 0], @
“Property Values”, [“2e6”, “2e6”, “.33”, “2e7”, “3e7”, “4e6”, ““])
dump i_return_value
i_return_value = @
material.create( “Analysis code ID”, 1, “Analysis type ID”, 1, @
“2dort2”, 0, “Date: 08-Aug-97 Time: 12:11:28”, @
“2d Orthotropic”, 5, “Directionality”, 4, “Linearity”, 1, @
“Homogeneous”, 0, “Linear Elastic”, 1, “Model Options & IDs”, @
[““, ““, ““, ““, ““], [0, 0, 0, 0, 0], “Active Flag”, 1, “Create”,@
10, “External Flag”, FALSE, “Property IDs”, [“Elastic Modulus”, @
“Elastic Modulus 22”, “Poisson Ratio”, “Shear Modulus”, @
“Shear Modulus 23”, “Shear Modulus 31”], [2, 3, 5, 8, 9, 10, 0], @
“Property Values”,[“2e6”,”2e5”,”.4”,”2e8”,”2.7e7”,”3.7e6”,””] )
dump i_return_value
#---------------------------------------------------------------------
# Loading the laminate definition data for ‘lam1’
s_mat_name = “lam1”
# Number of plies are 5
i_num_plies = 5
#
i_return_value = @
mat_lam_load_defn_show @
( s_mat_name, @
i_num_plies, @
iv_ply_names, @
rv_thicks, @
rv_orients, @
i_num_def, @
i_iconv, @
s_offset_string )
dump i_return_value
# The laminate definition data is
dump iv_ply_names,rv_thicks,rv_orients,i_num_def,i_iconv
dump s_offset_string
#---------------------------------------------------------------------
# Resetting the laminate properties of the laminate material.
s_mat_name = “lam1”
i_num_plies = 5
sys_allocate_string(sv_ply_names,32*i_num_plies)
#
# Each ply name must be in a field of 32 characters, with
# spaces being used to pad the empty space in the field
# 0 1 2 3 3
# 12345678901234567890123456789012345
sv_ply_names = “2dort1 “ // @
“2dort2 “ // @
“2dort1 “ // @
“2dort2 “ // @
“2dort1 “
rv_thicks, @
rv_orients, @
i_num_def, @
i_iconv, @
s_offset_string )
dump i_return_value
# The laminate definition data is
dump iv_ply_names,rv_thicks,rv_orients,i_num_def,i_iconv
dump s_offset_string
#---------------------------------------------------------------------
Main Index
MSC.Acumen, Volume 2: Code Examples
CHAPTER
Loads and Boundary Conditions
11
■ Introduction
Main Index
1304
Code Examples
11.1 Introduction
This chapter provides code examples for the PCL function described in Volume 1. These
examples are designed so that they can be cut and pasted into a file and, by following the
instructions listed with each example, executed in MSC.Patran.
db_bulk_get_lbc_ds ()
dump ia_sc_position
dump ia_sc_dyn
dump ra_scale_factor
#---------------------------------------------------------------------
# Note the following regarding the output values.
#
# 1. LBC 5(“trans_pressure”) having a field id = 2 in ia_sc_dyn
# as it is composed of time dependent field “trans_field”
# (field_id = 2)
#
# 2. ia_data_id consisting of values 1 and 2 indicating top and
# bottom pressure variable-id respectively.
#
# Refer chapter 9.0 in MSC.Patran User Manual - Part 9 (Vol. 4)
# for more details
#---------------------------------------------------------------------
db_bulk_get_lbc_dv ()
INTEGER iaa_null_flag(10,3)
REAL ra_scale_factor(10)
INTEGER i_return_value
INTEGER ia_prior(4)
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)
ia_data_id, @
raa_vec_data_values, @
iaa_vec_position, @
iaa_vec_dyn, @
iaa_null_flag, @
ra_scale_factor )
dump i_return_value
dump i_lbc_id
dump i_max
dump i_num_dyn_vec
dump ia_data_id
dump raa_vec_data_values
dump iaa_vec_position
dump iaa_vec_dyn
dump ra_scale_factor
#---------------------------------------------------------------------
# Note the following regarding the output values.
#
# 1. LBC 5(“trans_force”) having a field id = 2 in iaa_vec_dyn
# as it is composed of time dependent field “trans_field”
# (field_id = 2)
#
# 2. ia_data_id consisting of values 1 and 2 indicating linear force
# and moment variable-id respectively.
#
# Refer chapter 9.0 in MSC.Patran User Manual - Part 9 (Vol. 4)
# for more details
#---------------------------------------------------------------------
db_bulk_get_lbc_ss ()
INTEGER i_num_stat_scalar
INTEGER ia_data_id(10)
REAL ra_scalar_data_values(10)
INTEGER ia_sc_position(10)
REAL ra_scale_factor(10)
INTEGER i_return_value
INTEGER i_count
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)
db_bulk_get_lbc_sv ()
db_count_appl_geo_region ()
# Pressure lbc_type_id
i_lbc_type_id = 8
Main Index
1312
Code Examples
db_count_lbc ()
#---------------------------------------------------------------------
# Follow the instructions below to display Loads/BCs in the graphic
# Window.
# Pick “Display”,”Load/BC/Elem Props..” from pull-down menus
# Select “Show All” below Loads/BCs and “Apply”
#---------------------------------------------------------------------
# Session file paused. Press “Resume” to continue..
sf_pause()
#---------------------------------------------------------------------
# Delete lbc
i_return_value = @
loadsbcs_delete @
( [“400_psi”] )
db_count_lbc_appl_region_entity ()
STRING s_geo_str[16]
STRING sv_app_list[VIRTUAL]
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)
dump s_geo_str
dump sv_app_list
# Free memory
sys_free_string ( sv_app_list )
#---------------------------------------------------------------------
db_count_lbc_types ()
db_count_load_cases_with_lbc ()
INTEGER i_prior(4)
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)
db_count_loads_for_element ()
#---------------------------------------------------------------------
# Follow the instructions below to display Loads/BCs in the graphic
# Window.
# Pick “Display”,”Load/BC/Elem Props..” from pull-down menus
# Select “Show All” below Loads/BCs and “Apply”
# Ignore warnings if any.
#---------------------------------------------------------------------
# Session file paused. Press “Resume” to continue..
sf_pause()
#---------------------------------------------------------------------
[“Element 56:60”], @
“FEM”, @
““, @
1., @
[“ 0”, “ 200”,” 0”], @
[““, ““, ““] )
dump i_return_value
db_delete_lbc ()
db_delete_lbc_defn ()
uil_file_new.go("","new.db")
#---------------------------------------------------------------------
INTEGER status
#----------------------------------------------------------------------
db_create_lbc_defn("New_lbc_defn", @
"Displacement", @
1,2,1, @
1,1,1, @
2,2,1, @
1,"","", @
1,1,1,1, @
lbc_type_id)
#-----------------------------------------------------------------------
status = db_delete_lbc_defn(lbc_type_id)
dump status
#---------------------------------------------------------------------
# End of File.
#---------------------------------------------------------------------
db_get_all_appl_geo_regions ()
INTEGER ia_app_reg_id(2)
Main Index
1320
Code Examples
INTEGER ia_count(2)
INTEGER i_index
INTEGER i_app_reg_id
INTEGER i_ent_type
INTEGER i_ent_id
INTEGER i_ent_sub_id
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)
# Application region id
dump i_app_reg_id
# Entity type id
dump i_ent_type
# Entity id
dump i_ent_id
END FOR
#---------------------------------------------------------------------
db_get_all_appl_reg_defns ()
# function db_get_next_appl_reg_defn().
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_all_appl_reg_defns()
# has the following arguments:
#
# db_get_all_appl_reg_defns
# ( lbc_type_id ),
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_lbc_type_id
INTEGER i_seq_app_reg_id
INTEGER i_all_status
INTEGER i_next_status = 0
STRING s_label[32]
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)
db_get_all_lbc_names ()
db_get_all_lbc_names_by_type ()
db_get_all_lbc_type_defns ()
INTEGER i_class_lbc
INTEGER i_form
INTEGER i_global_bc
INTEGER i_flag_alt_cid
INTEGER i_graphic_symbol
INTEGER i_sv
INTEGER i_null_vector
INTEGER i_num_anal_code
INTEGER ia_anal_code_ids(15)
INTEGER i_default_color
INTEGER i_color_box_id
INTEGER i_anchor_style
INTEGER i_all_status
INTEGER i_next_status = 0
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)
Main Index
CHAPTER 11 1325
Loads and Boundary Conditions
db_get_all_lbc_type_names
db_get_all_lbc_var_defns ()
db_get_all_lbcs_new ()
dump r_scale_factor
dump ia_geo_fem
dump i_app_reg_couple
dump i_app_reg_order
dump i_equiv_flag
dump i_ac_mod_flag
END IF
END WHILE
#---------------------------------------------------------------------
db_get_lbc_id ()
s_lbc_name = “TZ_fixed”
i_return_value = @
db_get_lbc_id @
( s_lbc_name, @
i_lbc_id )
dump i_return_value
dump i_lbc_id
#---------------------------------------------------------------------
db_get_lbc_name ()
Main Index
1330
Code Examples
db_get_lbc_type_defn ()
i_id, @
i_class, @
i_form, @
i_gbc, @
i_cid, @
i_g_sym, @
i_sv, @
i_nv, @
i_nbr_ac, @
ia_an_code, @
i_defcol, @
i_cbid, @
i_anstyl )
dump i_return_value
dump i_id
dump i_class
dump i_form
dump i_gbc
dump i_cid
dump i_g_sym
dump i_sv
dump i_nv
dump i_nbr_ac
dump ia_an_code
dump i_defcol
dump i_cbid
dump i_anstyl
#---------------------------------------------------------------------
# Lbc type name
s_name = “Displacement”
#
# ia_an_code = 5 indicates MSC.Patran FEA
# = 1 indicates MSC.Nastran
#
# Refer chapter 7 & 9 in MSC.Patran User Manual - Part 9 (Vol. 4)
# for more details
#---------------------------------------------------------------------
db_get_lbc_var_defn ()
i_return_value = @
Main Index
CHAPTER 11 1333
Loads and Boundary Conditions
db_get_lbc_var_defn @
( i_lbc_type_id, @
i_lbc_category, @
i_eldim, @
s_label, @
ia_id )
dump i_return_value
dump ia_id
#---------------------------------------------------------------------
# Following are valid load type variable id for Pressure
# ia_id = 1 for Top surface pressure
# = 2 for Bottom surface pressure
# = 3 for Edge pressure
#---------------------------------------------------------------------
db_get_load_cases_with_lbc ()
“Static”, @
““, @
[“TZ_fixed”, “20_psi”], @
ia_prior, @
““, @
0., @
FALSE )
dump i_return_value
# Allocate memory
i_return_value = sys_allocate_array(iv_loadcase_ids,1,i_num_loadcases)
dump i_return_value
i_return_value = sys_allocate_array(iv_priority,1,i_num_loadcases)
dump i_return_value
i_return_value = sys_reallocate_array @
( iv_loadcase_ids,1, @
i_num_loadcases)
dump i_return_value
i_return_value = sys_reallocate_array @
( iv_priority,1, @
i_num_loadcases)
dump i_return_value
i_return_value = @
db_get_load_cases_with_lbc @
( i_lbc_id, @
i_num_loadcases, @
iv_loadcase_ids, @
iv_priority )
dump i_return_value
dump i_num_loadcases
dump iv_loadcase_ids
dump iv_priority
END FOR
#---------------------------------------------------------------------
# Refer the following table regarding output values for each lbc.
#
# Load/BC name ids Associated load cases(ids)
#
# fillet_pressure 1 default(1),spool_loads(2)
# 400_psi 2 default(1),spool_loads(2)
# 20_psi 3 default(1),spool_loads(2),new_lc(3)
# TZ_fixed 4 default(1),spool_loads(2),new_lc(3)
#---------------------------------------------------------------------
# Free memory
sys_free_array(iv_loadcase_ids)
sys_free_array(iv_priority)
#---------------------------------------------------------------------
Main Index
CHAPTER 11 1335
Loads and Boundary Conditions
db_get_loads_for_element ()
# Allocate memory
i_return_value = sys_allocate_array(iv_lbc,0,i_nbr_of_lbcs)
dump i_return_value
i_nbr_of_lbcs )
dump i_return_value
i_return_value = sys_reallocate_array(iv_lbc,0, @
i_nbr_of_lbcs)
dump i_return_value
i_return_value = @
db_get_loads_for_element @
( i_nbr_of_lbcs, @
i_elem_id, @
iv_lbc )
dump i_return_value
dump i_elem_id
dump iv_lbc
END FOR
# Free memory
sys_free_array(iv_lbc)
#---------------------------------------------------------------------
db_get_next_appl_geo_region ()
INTEGER i_lbc_id
INTEGER ia_app_reg_id(2)
Main Index
CHAPTER 11 1337
Loads and Boundary Conditions
INTEGER ia_count(2)
INTEGER i_index
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)
# Application region id
dump i_app_reg_id
# Entity type id
dump i_ent_type
# Entity id
dump i_ent_id
END FOR
#---------------------------------------------------------------------
db_get_next_appl_reg_defn ()
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_next_appl_reg_defn()
# has the following arguments:
#
# db_get_next_appl_reg_defn
# ( seq_app_reg_id,
# label )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_seq_app_reg_id
STRING s_label[32]
INTEGER i_all_status
INTEGER i_next_status = 0
INTEGER i_lbc_type_id
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)
db_get_next_lbc_name ()
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_next_lbc_name()
# has the following arguments:
#
# db_get_next_lbc_name
# ( lbc_id,
# lbc_name,
# lbc_type_id )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_lbc_id
STRING s_lbc_name[32]
INTEGER i_lbc_type_id
INTEGER i_all_status
INTEGER i_next_status
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)
db_get_next_lbc_name_by_type ()
db_get_next_lbc_type_defn ()
dump i_class_lbc
dump i_form
dump i_global_bc
dump i_flag_alt_cid
dump i_graphic_symbol
dump i_sv
dump i_null_vector
dump i_num_anal_code
dump ia_anal_code_ids
dump i_default_color
dump i_color_box_id
dump i_anchor_style
END IF
END WHILE
#---------------------------------------------------------------------
db_get_next_lbc_type_name ()
db_get_next_lbc_type_name @
( i_lbc_type_id, @
s_lbc_name )
dump i_next_status
IF ( i_next_status == 0 ) THEN
dump i_lbc_type_id
dump s_lbc_name
END IF
END WHILE
#---------------------------------------------------------------------
db_get_next_lbc_var_defn ()
( i_category_id, @
i_elem_dim )
dump i_next_status
IF ( i_next_status == 0 ) THEN
dump i_category_id
dump i_elem_dim
END IF
END WHILE
#---------------------------------------------------------------------
db_get_next_lbcs_new ()
INTEGER i_app_reg_order
INTEGER i_equiv_flag
INTEGER i_ac_mod_flag
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)
db_get_valid_cat_by_type ()
#
# The function db_get_valid_cat_by_type()
# has the following arguments:
#
# db_get_valid_cat_by_type
# ( typid,
# cat )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_typid
INTEGER ia_cat(3)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
db_get_valid_eldim_by_type_cat ()
db_get_valid_lbc_var_ids ()
ia_vid )
dump i_return_value
dump i_count
dump ia_vid
#---------------------------------------------------------------------
# Following are valid load type variable id for Pressure
# ia_vid = 1 for Top surface pressure
# = 2 for Bottom surface pressure
# = 3 for Edge pressure
#---------------------------------------------------------------------
db_modify_load_case ()
# Name of dynamic load case from which this static load case is
# derived. A blank string if not applicable.
s_dlcname = ““
# Map variable
r_mv = 1.0
# Free memory
sys_free_array(iv_lbc)
#---------------------------------------------------------------------
Main Index
CHAPTER 11 1351
Loads and Boundary Conditions
lbc_create ()
INTEGER i_num_dat
INTEGER ia_var_id(20)
INTEGER ia_sv(20)
INTEGER ia_null_flag(20)
INTEGER iaa_null_var(20,3)
INTEGER ia_datatype(20)
INTEGER ia_ivalue(20)
REAL raa_rvalue(20,3)
INTEGER iaa_fldid(20,3)
INTEGER iaa_dyn_fldid(20,3)
INTEGER ia_node_id(20)
INTEGER i_return_value
INTEGER i_count1
INTEGER i_count2
INTEGER i_load_count
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)
# Application region db ID
ia_ar_id(1) = 1
ia_ar_id(2) = 0
s_aplist1 = “Point 8”
ia_fem_flag=[0,0,0,0,0]
Main Index
CHAPTER 11 1353
Loads and Boundary Conditions
# Coordinate System ID
i_cid_id = 0
FOR (i_count1 = 1 TO 3)
ia_var_id(i_count1) = 1
END FOR
FOR (i_count1 = 4 TO 6)
ia_var_id(i_count1) = 2
END FOR
# Integer values
FOR (i_count1 = 1 TO 20 )
ia_ivalue(i_count1) = 0
END FOR
# Real values
FOR (i_count1 = 1 TO 20 )
FOR (i_count2 = 1 TO 3 )
raa_rvalue(i_count1,i_count2) = 0.0
END FOR
END FOR
raa_rvalue(1,2) = -200.0
# Field ID
FOR (i_count1 = 1 TO 20 )
Main Index
1354
Code Examples
FOR (i_count2 = 1 TO 3 )
iaa_fldid(i_count1,i_count2) = 0
END FOR
END FOR
# Dynamic field ID
FOR (i_count1 = 1 TO 20 )
FOR (i_count2 = 1 TO 3 )
iaa_dyn_fldid(i_count1,i_count2) = 0
END FOR
END FOR
# Node ID
FOR (i_count1 = 1 TO 20 )
ia_node_id(i_count1) = 6
END FOR
# Create LBC.
i_return_value = @
lbc_create @
( s_name, @
i_type_id, @
i_cat_id, @
i_dyn_flag, @
i_num_ar, @
ia_ar_id, @
s_aplist1, @
s_aplist2, @
ia_fem_flag, @
ia_targ_elem, @
r_lbc_sf, @
i_cid_id, @
i_no_data_flag, @
i_num_dat, @
ia_var_id, @
ia_sv, @
ia_null_flag, @
iaa_null_var, @
ia_datatype, @
ia_ivalue, @
raa_rvalue, @
iaa_fldid, @
iaa_dyn_fldid, @
ia_node_id )
dump i_return_value
lbc_delete ()
#
# In this example the spool database is
# opened and loads named “fillet_transition” and
# “400_psi” are deleted after a pause.
# Observation on list of Loads/BCs is made
# before and after deletion of loads.
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function lbc_delete()
# has the following arguments:
#
# lbc_delete
# ( count,
# del_id,
# update_graph )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_count
INTEGER ia_del_id(2)
LOGICAL l_update_graph
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)
# Load/BC Set
ia_del_id = [1,2]
Main Index
1356
Code Examples
lbc_eval_fem_by_lc ()
lbc_eval_fem_lbc ()
lbc_get_sdbx_datatype ()
# sdbx_type,
# sdbx_label )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_lbc_id
STRING s_obj_str[32]
STRING s_meth_str[32]
STRING s_targ_str[32]
STRING s_geo_group[32]
STRING s_sdbx_type[32]
STRING s_sdbx_label[32]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)
# Load/BCs details
# i_lbc_id = 4 for displacement
i_lbc_id = 4
s_obj_str = “Displacement”
s_meth_str = “Nodal”
s_geo_group = “Geometry”
lbc_gm ()
INTEGER i_return_value
STRING s_load_case_name[32]
STRING s_group_name[32]
INTEGER i_vector_id
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)
# s_group_name = “default_group”
s_group_name = “default_group”
lbc_graphics_defn ()
# nvar,
# varid,
# vector_flag,
# marker,
# color,
# anchor )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_type_id
INTEGER i_cat_id
INTEGER i_targ_elem_id
INTEGER i_nvar
INTEGER ia_varid(16)
INTEGER ia_vector_flag(16)
INTEGER ia_marker(16)
INTEGER ia_color(16)
INTEGER ia_anchor(16)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)
dump i_return_value
dump ia_varid
dump ia_vector_flag
dump ia_marker
dump ia_color
dump ia_anchor
#---------------------------------------------------------------------
lbc_lp_parse_sca ()
# Field ID
dump i_field_id
lbc_lp_parse_vec ()
#
# The function lbc_lp_parse_vec() has the following arguments:
#
# lbc_lp_parse_vec
# ( dval,
# field_id,
# null_flag,
# rval )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_dval[32]
INTEGER ia_field_id(8)
INTEGER ia_null_flag(8)
REAL ra_rval(8)
INTEGER i_return_value
#---------------------------------------------------------------------
# String containing the property
s_dval = “< 123.1, -45.6, 7.89>”
# Field IDs
dump ia_field_id
lbc_plot_markers ()
# ( num_lbcs,
# lbc_ids,
# num_grps,
# grp_ids )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_num_lbcs
INTEGER ia_lbc_ids(4)
INTEGER i_num_grps
INTEGER ia_grp_ids(2)
INTEGER i_return_value
STRING s_group_name[16]
INTEGER i_vector_id
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)
# Number of groups
i_num_grps= 1
Main Index
1364
Code Examples
lbc_show_plot_scalar ()
Main Index
CHAPTER 11 1365
Loads and Boundary Conditions
loadcase_create2 ()
STRING loadcase_name[32]
STRING loadcase_type[32]
STRING loadcase_desp[32]
REAL scale_factor
STRING lbcs_name[32](2)
INTEGER priorities(2)
REAL lbc_scales(2)
STRING dynamic_lc[32]
REAL mv
LOGICAL make_current
INTEGER i_return_value
INTEGER fem_create_mesh_solid_num_nodes
INTEGER fem_create_mesh_solid_num_elems
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]
STRING asm_create_hpat_xyz_created_ids[VIRTUAL]
#---------------------------------------------------------------------
# Open a new database
Main Index
1366
Code Examples
$? YES 36000002
#---------------------------------------------------------------------
# Create Geometric entities
#---------------------------------------------------------------------
# Create Finite Element entities
#---------------------------------------------------------------------
# Create Displacement Boundary condition "New_disp"
#---------------------------------------------------------------------
# Create Force Boundary condition "New_load"
#---------------------------------------------------------------------
# Argument Initialization.
#---------------------------------------------------------------------
# New Load Case Created as a "NEW LOAD CASE"
#---------------------------------------------------------------------
# Dump the return value of the function and its status
dump i_return_value
#---------------------------------------------------------------------
# closing the patran environment.
# uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
loadsbcs_get_appl_region_list ()
INTEGER ia_count(2)
INTEGER ia_region_ids(2)
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)
( i_lbc_id, @
ia_region_ids, @
ia_count )
i_region_id = ia_region_ids(1)
i_ent_count = ia_count(1)
# Free memory
sys_free_string(sv_app_list)
#---------------------------------------------------------------------
loadsbcs_lp_coord ()
CHAPTER
Materials
12
■ Introduction
Main Index
1370
Code Examples
12.1 Introduction
This chapter provides code examples for the PCL function described in Volume 1. These
examples are designed so that they can be cut and pasted into a file and, by following the
instructions listed with each example, executed in MSC.Patran.
db_bulk_get_possible_cond_opts1 ()
i_atid )
dump i_return_value
#
# Get the number and ID’s of the condense options
i_return_value = @
db_bulk_get_possible_cond_opts1 @
( i_etid, @
i_atid, @
i_acid, @
i_nbr, @
ia_coc )
dump i_return_value
dump i_nbr
dump ia_coc
#---------------------------------------------------------------------
db_bulk_get_possible_cond_opts2 ()
dump i_return_value
#
# Get the analysis type id for “Structural”
s_atname = “Structural”
i_return_value = @
db_get_anal_type_id @
( s_atname, @
i_atid )
dump i_return_value
#
# The Element type id for ‘Shell’ is 51
i_etid = 51
#
# The geometric option code is N/A .
i_goc = 25
#
# Get the number and the ID’s of the condense options
i_return_value = @
db_bulk_get_possible_cond_opts2 @
( i_etid, @
i_atid, @
i_acid, @
i_goc, @
i_nbr, @
ia_coc )
dump i_return_value
dump i_nbr
dump ia_coc
#---------------------------------------------------------------------
db_bulk_get_possible_dof_sets ()
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_etid
INTEGER i_atid
INTEGER i_acid
INTEGER i_coc
INTEGER i_goc
INTEGER i_foc
INTEGER i_loc
INTEGER i_mlc
INTEGER i_mdc
INTEGER i_nbr
INTEGER ia_dsid(4)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# The element type ID for “Shell” is 51.
i_etid = 51
# The analysis type ID for “Structural” is 1.
i_atid = 1
# The analysis code ID for “MSC.Nastran” is 1.
i_acid = 1
# The ID of the condense option is 0.
i_coc = 0
# The geometric option code is 0.
i_goc = 0
# The formulation option code is 0.
i_foc = 0
# The laminate option code is 0.
i_loc = 0
# The material linearity code is 0.
i_mlc = 0
# The material directionality code is 0.
i_mdc = 0
i_return_value = @
db_bulk_get_possible_dof_sets @
( i_etid, @
i_atid, @
i_acid, @
i_coc, @
i_goc, @
i_foc, @
i_loc, @
i_mlc, @
i_mdc, @
i_nbr, @
ia_dsid )
dump i_return_value
dump i_nbr
dump ia_dsid
#---------------------------------------------------------------------
db_count_materials ()
#
# For material category,linearity,directionality,
# and material type IDs refer MSC.Patran User
# Manual, Part 9, Section 7.6, 7.7, 9.14.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
#
# The function db_count_materials()
# has the following arguments:
#
# db_count_materials
# ( count )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_count
INTEGER i_return_value
STRING s_mat_name[32]
INTEGER i_id
STRING s_description[216]
INTEGER i_cat
INTEGER i_lin
INTEGER i_dir
INTEGER i_type
#---------------------------------------------------------------------
# Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Get the count of the material in the new database
# which is 0.
i_return_value = @
db_count_materials @
( i_count )
dump i_return_value
dump i_count
#
# Create a new material
# Assign the name of the material.
s_mat_name = “New_Material”
# Assign the description.
s_description = “This material is created for an illustration”
# Assign the the category as “Isotropic”
i_cat = 1
# Linearity code is “Linear Elastic”.
i_lin = 1
# The directionality code is “Isotropic”
i_dir = 1
# The material type is “Homogeneous material”
i_type = 1
i_return_value = @
db_create_material @
( s_mat_name, @
s_description, @
i_cat, @
i_lin, @
i_dir, @
i_type, @
i_id )
dump i_return_value
#
# Get the latest count of the materials.
i_return_value = @
Main Index
CHAPTER 12 1375
Materials
db_count_materials @
( i_count )
dump i_return_value
dump i_count
#------------------------------------------------------------
db_count_options ()
dump i_dsid
dump i_etop
#---------------------------------------------------------------------
db_create_mtl_allowable_magics ()
i_nbr )
dump i_return_value
dump i_nbr
# Create three new valid magic options for the
# “Hardening Rule”
# The magics option ids for VonMises, Tresca and Mohr_coulomb
# yield functions are 10,11 and 12 respectively.
ia_magic_alias_id = [10,11,12]
i_nbr = 3
i_return_value = @
db_create_mtl_allowable_magics @
( i_code_id, @
i_matl_cat_id, @
i_magic_category_id, @
ia_magic_alias_id, @
i_nbr )
dump i_return_value
#
# Get the new count of the material allowable magics.
i_return_value = @
db_get_mtl_allowable_magic_cnt @
( i_code_id, @
i_matl_cat_id, @
i_magic_category_id, @
i_nbr )
dump i_return_value
dump i_nbr
#---------------------------------------------------------------------
db_delete_material ()
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Create a new material
# Assign the name of the material.
s_name = “New_Material”
# Assign the description.
s_description = “This material is created for an illustration”
# Assign the the category as “Isotropic”
i_cat = 1
# Linearity code is “Linear Elastic”.
i_lin = 1
# The directionality code is “Isotropic”
i_dir = 1
# The material type is “Homogeneous material”
i_type = 1
i_return_value = @
db_create_material @
( s_name, @
s_description, @
i_cat, @
i_lin, @
i_dir, @
i_type, @
i_id )
dump i_return_value
#
# Get the count of the materials.
i_return_value = @
db_count_materials @
( i_count )
dump i_return_value
dump i_count
#
# Delete the material “New_Material”
s_name = “New_Material”
i_return_value = @
db_delete_material @
( s_name )
dump i_return_value
# Get the latest count of the materials which is 0.
i_return_value = @
db_count_materials @
( i_count )
dump i_return_value
dump i_count
#---------------------------------------------------------------------
db_delete_material_property ()
#---------------------------------------------------------------------
# To see the updated material, open MATERIAL SHOW form, select the
# only material and press ‘Show Properties’ button.
#---------------------------------------------------------------------
Main Index
1380
Code Examples
db_delete_matl_const_model ()
i_return_value = @
db_get_matl_const_model_count @
( i_mid, @
i_count )
dump i_return_value
dump i_count
#
# Get the IDs of all the constitutive models of the material.
SYS_ALLOCATE_ARRAY (iv_cm_id, 1, i_count)
i_return_value = @
db_get_matl_const_model @
( i_mid, @
iv_cm_id )
dump i_return_value
dump iv_cm_id
#
# Delete the first constitutive model
i_cmid = iv_cm_id(1)
i_return_value = @
db_delete_matl_const_model @
( i_mid, @
i_cmid )
dump i_return_value
#
# Get the latest count of constitutive models of the material
i_return_value = @
db_get_matl_const_model_count @
( i_mid, @
i_count )
dump i_return_value
dump i_count
sys_free_array (iv_cm_id)
#---------------------------------------------------------------------
db_get_all_allow_matl_prop_cnt ()
INTEGER i_atid
INTEGER i_mc_id
INTEGER i_cm_id
INTEGER i_nbr
INTEGER iv_mp_id(VIRTUAL)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
# Analysis code id for MSC.Nastran is 1.
i_cid=1
# Analysis type id for Structural analysis is 1.
i_atid=1
# Using Material Category for Isotropic Material, which is 1.
i_mc_id=1
# For Linear Elastic Constitutive Model, id is 1.
i_cm_id=1
# Finding out number of allowable properties in the database. And
# allocating the space for the output array.
#
i_return_value = @
db_get_all_allow_matl_prop_cnt @
( i_cid, @
i_atid, @
i_mc_id, @
i_cm_id, @
i_nbr )
dump i_return_value
# The number of allowable material properties are
dump i_nbr
sys_allocate_array(iv_mp_id,1,i_nbr)
#---------------------------------------------------------------------
# Calling function to read the property ids.
#
i_return_value = @
db_get_all_allowable_matl_prop @
( i_cid, @
i_atid, @
i_mc_id, @
i_cm_id, @
iv_mp_id )
dump i_return_value
dump iv_mp_id
#---------------------------------------------------------------------
sys_free_array(iv_mp_id)
#---------------------------------------------------------------------
db_get_all_allowable_matl_prop ()
Main Index
1384
Code Examples
db_get_all_cond_opt_code_names ()
db_get_all_lam_opt_code_names ()
db_get_all_material_names ()
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Create a new material “Material_1”.
i_return_value = @
material.create @
( “Analysis code ID”, 1, “Analysis type ID”, 1, @
“Material_1”, 0, “Date: @
Time: “, “Isotropic”, 1, @
“Directionality”, 1, “Linearity”, 1, @
“Homogeneous”, 0, “Linear Elastic”, 1, @
“Model Options & IDs”, [““, ““, ““, ““, ““], @
[0, 0, 0, 0, 0], “Active Flag”, 1, “Create”, @
10, “External Flag”, FALSE, “Property IDs”, @
[“Elastic Modulus”,”Poisson Ratio”], [2, 5, 0], @
“Property Values”, [“3.6e6”, “.33”, ““] )
dump i_return_value
#
# Create one more material “Material_2”.
i_return_value = @
material.create @
( “Analysis code ID”, 1, “Analysis type ID”, 1, @
“Material_2”, 0, “Date: @
Time: “, “Isotropic”, 1, @
“Directionality”, 1, “Linearity”, 1, @
“Homogeneous”, 0, “Linear Elastic”, 1, @
“Model Options & IDs”, [““, ““, ““, ““, ““], @
[0, 0, 0, 0, 0], “Active Flag”, 1, “Create”, @
10, “External Flag”, FALSE, “Property IDs”, @
[“Elastic Modulus”,”Poisson Ratio”], [2, 5, 0], @
“Property Values”, [“3.6e6”, “.33”, ““] )
dump i_return_value
#
# Get all the all the material names from the database
all_status = db_get_all_material_names ( )
dump all_status
#
# Get all material information from the database
WHILE ( next_status == 0 )
next_status = @
db_get_next_material_name @
( s_name, @
i_id, @
i_cat, @
i_lin, @
i_dir, @
i_type )
dump next_status
IF ( next_status == 0 ) THEN
dump s_name
dump i_id
dump i_cat
dump i_lin
dump i_dir
dump i_type
END IF
END WHILE
#
#---------------------------------------------------------------------
Main Index
CHAPTER 12 1387
Materials
db_get_allowable_matl_prop ()
db_get_allowable_matl_prop_cnt @
( i_cid, @
i_atid, @
i_mc_id, @
i_cm_id, @
ia_magics, @
i_nbr )
dump i_return_value
sys_allocate_array(iv_mp_id,1,i_nbr)
#---------------------------------------------------------------------
# Calling function to read the property ids.
i_return_value = @
db_get_allowable_matl_prop @
( i_cid, @
i_atid, @
i_mc_id, @
i_cm_id, @
ia_magics, @
iv_mp_id )
dump i_return_value
# The ids are
dump iv_mp_id
#---------------------------------------------------------------------
sys_free_array(iv_mp_id)
#---------------------------------------------------------------------
db_get_allowable_matl_prop_cnt ()
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
# Analysis code id for MSC.Nastran is 1.
i_cid = 1
# Analysis type id for Structural analysis is 1.
i_atid = 1
# Using Material Category for Isotropic Material, which is 1.
i_mc_id = 1
# For Linear Elastic Constitutive Model, id is 1.
i_cm_id = 1
# Getting the associated entry from the ‘matl_magic’ table.
i_return_value = @
db_get_mtl_magics @
( i_cid, @
i_atid, @
i_mc_id, @
i_cm_id, @
ia_magics )
dump i_return_value
db_get_comp_hal ()
#
# For material property ids refer User’s Manual
# Part 9, Section 7.5 to 7.7
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_comp_hal()
# has the following arguments:
#
# db_get_comp_hal
# ( mat_name,
# iopt,
# fiber_name,
# matrix_name,
# fiber_vol_frac,
# matrix_vol_frac,
# theory,
# override,
# aspect_ratios,
# emperical_factors )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_mat_name[32]
INTEGER i_iopt
STRING s_fiber_name[32]
STRING s_matrix_name[32]
REAL r_fiber_vol_frac
REAL r_matrix_vol_frac
INTEGER i_theory
LOGICAL l_override
REAL ra_aspect_ratios(2)
REAL ra_emperical_factors(9)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
# Creating isotropic material by name ‘matrix’.
i_return_value = @
material.create(“Analysis code ID”,1,”Analysis type ID”,1,”matrix”@
,0, “New Material” , “Isotropic”, 1, @
“Directionality”, 1, “Linearity”, 1, “Homogeneous”, 0, @
“Linear Elastic”, 1,”Model Options & IDs”,[““,””,””,””,””], @
[0,0,0,0,0],”Active Flag”,1,”Create”,10,”External Flag”,FALSE, @
“Property IDs”,[“Elastic Modulus”,”Poisson Ratio”], [2, 5, 0], @
“Property Values”, [“2e5”, “.3”, ““] )
dump i_return_value
db_get_comp_sfc ()
dump i_return_value
Main Index
1394
Code Examples
db_get_constitutive_model ()
i_mc_id, @
i_nbr )
dump i_return_value
dump i_nbr
#
SYS_ALLOCATE_ARRAY(iv_cm_id, 1, i_nbr)
#
# Get the IDs of the constitutive models.
i_return_value = @
db_get_valid_const_models @
( i_cid, @
i_atid, @
i_mc_id, @
iv_cm_id )
dump i_return_value
dump iv_cm_id
#
# Get the names and the linearity code for all the
# constitutive models
FOR (i_count = 1 to i_nbr )
i_cm_id = iv_cm_id (i_count)
i_return_value = @
db_get_constitutive_model @
( i_cid, @
i_cm_id, @
s_cm_name, @
i_linearity_code )
dump i_return_value
dump s_cm_name
dump i_linearity_code
END FOR
sys_free_array(iv_cm_id)
#---------------------------------------------------------------------
db_get_material_id_from_name ()
STRING s_description[216]
INTEGER i_cat
INTEGER i_lin
INTEGER i_dir
INTEGER i_type
#---------------------------------------------------------------------
# Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Create a new material
# Assign the name of the material.
s_mat_name = “New_Material”
# Assign the description.
s_description = “This material is created for an illustration”
# Assign the the category as “Isotropic”
i_cat = 1
# Linearity code is “Linear Elastic”.
i_lin = 1
# The directionality code is “Isotropic”
i_dir = 1
# The material type is “Homogeneous material”
i_type = 1
i_return_value = @
db_create_material @
( s_mat_name, @
s_description, @
i_cat, @
i_lin, @
i_dir, @
i_type, @
i_id_c )
dump i_return_value
dump i_id_c
#
# Get the ID of the newly created material.
i_return_value = @
db_get_material_id_from_name @
( s_mat_name, @
i_id )
dump i_return_value
dump i_id
#---------------------------------------------------------------------
db_get_material_name_from_id ()
# db_get_material_name_from_id
# ( id,
# mat_name )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_id
STRING s_mat_name[32]
STRING s_mat_name_c[32]
INTEGER i_return_value
STRING s_description[216]
INTEGER i_cat
INTEGER i_lin
INTEGER i_dir
INTEGER i_type
#---------------------------------------------------------------------
# Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Create a new material
# Assign the name of the material.
s_mat_name_c = “New_Material”
# Assign the description.
s_description = “This material is created for an illustration”
# Assign the the category as “Isotropic”
i_cat = 1
# Linearity code is “Linear Elastic”.
i_lin = 1
# The directionality code is “Isotropic”
i_dir = 1
# The material type is “Homogeneous material”
i_type = 1
i_return_value = @
db_create_material @
( s_mat_name_c, @
s_description, @
i_cat, @
i_lin, @
i_dir, @
i_type, @
i_id )
dump i_return_value
dump i_id
# Get the name of the material from its ID.
i_return_value = @
db_get_material_name_from_id @
( i_id, @
s_mat_name )
dump i_return_value
dump s_mat_name
#---------------------------------------------------------------------
db_get_matl_category ()
i_mc_id = iv_mc_id(i_count)
i_return_value = @
db_get_matl_category @
( i_cid, @
i_mc_id, @
s_mc_name, @
i_directionality )
dump i_return_value
dump s_mc_name
dump i_directionality
END FOR
sys_free_array(iv_mc_id)
#---------------------------------------------------------------------
db_get_matl_prop_alias ()
db_get_matl_prop_defn ()
#
# The function db_get_matl_prop_defn()
# has the following arguments:
#
# db_get_matl_prop_defn
# ( mp_id,
# mp_name )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_mp_id
STRING s_mp_name[32]
INTEGER i_return_value
INTEGER i_cid
INTEGER i_atid
INTEGER i_mc_id
INTEGER i_cm_id
INTEGER i_nbr
INTEGER iv_mp_id(VIRTUAL)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
# Analysis code id for MSC.Nastran is 1.
i_cid=1
# Analysis type id for Structural analysis is 1.
i_atid=1
# Using Material Category for Isotropic Material, which is 1.
i_mc_id=1
# For Linear Elastic Constitutive Model, id is 1.
i_cm_id=1
# Finding out number of allowable properties in the database. And
# allocating the space for the output array.
#
i_return_value = @
db_get_all_allow_matl_prop_cnt @
( i_cid, @
i_atid, @
i_mc_id, @
i_cm_id, @
i_nbr )
dump i_return_value
sys_allocate_array(iv_mp_id,1,i_nbr)
#---------------------------------------------------------------------
# Calling function to read the property ids.
#
i_return_value = @
db_get_all_allowable_matl_prop @
( i_cid, @
i_atid, @
i_mc_id, @
i_cm_id, @
iv_mp_id )
dump i_return_value
dump iv_mp_id
#---------------------------------------------------------------------
# Getting material property defination name for first property id.
i_mp_id = iv_mp_id(1)
#
i_return_value = @
db_get_matl_prop_defn @
( i_mp_id, @
s_mp_name )
dump i_return_value
dump s_mp_name
Main Index
1402
Code Examples
#---------------------------------------------------------------------
sys_free_array(iv_mp_id)
#---------------------------------------------------------------------
db_get_mtl_allowable_magic_cnt ()
dump i_return_value
dump i_nbr
# Create three new valid magic options for the
# “Hardening Rule”
# The magics option ids for VonMises, Tresca and Mohr_coulomb
# yield functions are 10,11 and 12 respectively.
# hardening are 10,11 and 12 respectively.
ia_magic_alias_id = [10,11,12]
i_nbr = 3
i_return_value = @
db_create_mtl_allowable_magics @
( i_code_id, @
i_matl_cat_id, @
i_magic_category_id, @
ia_magic_alias_id, @
i_nbr )
dump i_return_value
#
# Get the new count of the material allowable magics.
i_return_value = @
db_get_mtl_allowable_magic_cnt @
( i_code_id, @
i_matl_cat_id, @
i_magic_category_id, @
i_nbr )
dump i_return_value
dump i_nbr
#---------------------------------------------------------------------
db_get_mtl_allowable_magics ()
db_get_mtl_magics ()
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_analysis_code_id
INTEGER i_analysis_type_id
INTEGER i_matl_category_id
INTEGER i_constit_model_id
INTEGER iv_magic_category_id(VIRTUAL)
INTEGER i_return_value
STRING s_atname[32]
INTEGER i_nbr
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Get the code id for “MSC.Nastran”
i_return_value = @
db_get_anal_code_id(“MSC.Nastran”,i_analysis_code_id)
dump i_return_value
#
# Get the analysis type id for “Structural”
s_atname = “Structural”
i_return_value = @
db_get_anal_type_id @
( s_atname, @
i_analysis_type_id )
dump i_return_value
#
# Get the count of the magic categories
# The material category ID for ‘Isotropic’ is 1.
i_matl_category_id = 1
# The constitutive model ID for ‘Elastoplastic’ is 3.
i_constit_model_id = 3
i_return_value = @
db_get_mtl_magics_count @
( i_analysis_code_id, @
i_analysis_type_id, @
i_matl_category_id, @
i_constit_model_id, @
i_nbr )
dump i_return_value
dump i_nbr
#---------------------------------------------------------------------
SYS_ALLOCATE_ARRAY(iv_magic_category_id, 1, i_nbr)
#
# Get the magic category IDs.
i_return_value = @
db_get_mtl_magics @
( i_analysis_code_id, @
i_analysis_type_id, @
i_matl_category_id, @
i_constit_model_id, @
iv_magic_category_id )
dump i_return_value
dump iv_magic_category_id
sys_free_array(iv_magic_category_id)
#---------------------------------------------------------------------
Main Index
1406
Code Examples
db_get_mtl_magics_count ()
i_nbr )
dump i_return_value
dump i_nbr
#---------------------------------------------------------------------
db_get_mtl_magics_defn ()
i_matl_category_id = 1
# The constitutive model ID for ‘Elastoplastic’ is 3.
i_constit_model_id = 3
# Get the count of the magic categories.
i_return_value = @
db_get_mtl_magics_count @
( i_analysis_code_id, @
i_analysis_type_id, @
i_matl_category_id, @
i_constit_model_id, @
i_nbr )
dump i_return_value
dump i_nbr
#
SYS_ALLOCATE_ARRAY(iv_magic_category_id, 1, i_nbr)
#
# Get the IDs of the magic categories.
i_return_value = @
db_get_mtl_magics @
( i_analysis_code_id, @
i_analysis_type_id, @
i_matl_category_id, @
i_constit_model_id, @
iv_magic_category_id )
dump i_return_value
dump iv_magic_category_id
#
# Get the magic label for all the magic categories.
FOR (i_count = 1 to i_nbr)
i_magic_category_id = iv_magic_category_id(i_count)
i_return_value = @
db_get_mtl_magics_defn @
( i_analysis_code_id, @
i_analysis_type_id, @
i_magic_category_id, @
s_magic_label )
dump i_return_value
dump s_magic_label
END FOR
sys_free_array(iv_magic_category_id)
#---------------------------------------------------------------------
db_get_mtl_magics_options ()
# db_get_mtl_magics_options
# ( analysis_code_id,
# magic_alias_id,
# magic_name )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_analysis_code_id
INTEGER i_magic_alias_id
STRING s_magic_name[64]
INTEGER i_return_value
INTEGER i_matl_cat_id
INTEGER i_magic_category_id
INTEGER iv_magic_alias_id(VIRTUAL)
INTEGER i_nbr
INTEGER i_count
#---------------------------------------------------------------------
# Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Get the code id for “MSC.Nastran”
i_return_value = @
db_get_anal_code_id(“MSC.Nastran”,i_analysis_code_id)
dump i_return_value
#
# The material category ID for “Isotropic” is 1.
i_matl_cat_id = 1
# The magic category id for “Hardening Rule” is 5.
i_magic_category_id = 5
#
# Get the count of the magic options.
i_return_value = @
db_get_mtl_allowable_magic_cnt @
( i_analysis_code_id, @
i_matl_cat_id, @
i_magic_category_id, @
i_nbr )
dump i_return_value
dump i_nbr
#
SYS_ALLOCATE_ARRAY (iv_magic_alias_id, 1, i_nbr )
#
# Get the IDs of the magic options.
i_return_value = @
db_get_mtl_allowable_magics @
( i_analysis_code_id, @
i_matl_cat_id, @
i_magic_category_id, @
iv_magic_alias_id )
dump i_return_value
dump iv_magic_alias_id
#
# Get the names of all the magic options.
FOR ( i_count = 1 to i_nbr )
i_magic_alias_id = iv_magic_alias_id(i_count)
i_return_value = @
db_get_mtl_magics_options @
( i_analysis_code_id, @
i_magic_alias_id, @
s_magic_name )
dump i_return_value
dump s_magic_name
END FOR
sys_free_array(iv_magic_alias_id)
#---------------------------------------------------------------------
Main Index
1410
Code Examples
db_get_next_cond_opt_code_names ()
db_get_next_lam_opt_code_names ()
db_get_next_material_name ()
# cat,
# lin,
# dir,
# type )
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[64]
INTEGER i_id
INTEGER i_cat
INTEGER i_lin
INTEGER i_dir
INTEGER i_type
INTEGER i_return_value
INTEGER all_status
INTEGER next_status = 0
#---------------------------------------------------------------------
# Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Create a new material “Material_1”.
i_return_value = @
material.create @
( “Analysis code ID”, 1, “Analysis type ID”, 1, @
“Material_1”, 0, “Date: @
Time: “, “Isotropic”, 1, @
“Directionality”, 1, “Linearity”, 1, @
“Homogeneous”, 0, “Linear Elastic”, 1, @
“Model Options & IDs”, [““, ““, ““, ““, ““], @
[0, 0, 0, 0, 0], “Active Flag”, 1, “Create”, @
10, “External Flag”, FALSE, “Property IDs”, @
[“Elastic Modulus”,”Poisson Ratio”], [2, 5, 0], @
“Property Values”, [“3.6e6”, “.33”, ““] )
dump i_return_value
#
# Create one more material “Material_2”.
i_return_value = @
material.create @
( “Analysis code ID”, 1, “Analysis type ID”, 1, @
“Material_2”, 0, “Date: @
Time: “, “Isotropic”, 1, @
“Directionality”, 1, “Linearity”, 1, @
“Homogeneous”, 0, “Linear Elastic”, 1, @
“Model Options & IDs”, [““, ““, ““, ““, ““], @
[0, 0, 0, 0, 0], “Active Flag”, 1, “Create”, @
10, “External Flag”, FALSE, “Property IDs”, @
[“Elastic Modulus”,”Poisson Ratio”], [2, 5, 0], @
“Property Values”, [“3.6e6”, “.33”, ““] )
dump i_return_value
#
# Get all the all the material names from the database
all_status = db_get_all_material_names ( )
dump all_status
#
# Get all material information from the database
WHILE ( next_status == 0 )
next_status = @
db_get_next_material_name @
( s_name, @
i_id, @
i_cat, @
i_lin, @
i_dir, @
i_type )
dump next_status
IF ( next_status == 0 ) THEN
dump s_name
Main Index
CHAPTER 12 1413
Materials
dump i_id
dump i_cat
dump i_lin
dump i_dir
dump i_type
END IF
END WHILE
#
#---------------------------------------------------------------------
db_get_valid_const_models ()
db_get_valid_const_models_count ()
dump i_return_value
#
# Get the analysis type id for “Structural”
s_atname = “Structural”
i_return_value = @
db_get_anal_type_id @
( s_atname, @
i_atid )
dump i_return_value
#
# The material category ID for Isotropic is 1.
i_mc_id = 1
#
# Get the number of valid constitutive models.
i_return_value = @
db_get_valid_const_models_count @
( i_cid, @
i_atid, @
i_mc_id, @
i_nbr )
dump i_return_value
dump i_nbr
#---------------------------------------------------------------------
db_get_valid_mtl_categories ()
i_cid )
dump i_return_value
#
# Get the analysis type id for “Structural”
s_atname = “Structural”
i_return_value = @
db_get_anal_type_id @
( s_atname, @
i_atid )
dump i_return_value
#
# Get the count of the material category.
i_return_value = @
db_get_valid_mtl_category_cnt @
( i_cid, @
i_atid, @
i_nbr )
dump i_return_value
#
SYS_ALLOCATE_ARRAY(iv_mc_id, 1, i_nbr)
#
# Get the ID of the material categories.
i_return_value = @
db_get_valid_mtl_categories @
( i_cid, @
i_atid, @
iv_mc_id )
dump i_return_value
dump iv_mc_id
#
sys_free_array(iv_mc_id)
#---------------------------------------------------------------------
db_get_valid_mtl_category_cnt ()
uil_file_new.go(““,”new.db”)
$? YES 36000002
db_mo_const_models_specified ()
INTEGER i_active
INTEGER i_return_value
STRING s_mat_name[32]
#---------------------------------------------------------------------
# Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Create a new material “New_Material” with “Linear Elastic”
# constitutive model.
i_return_value = @
material.create @
( “Analysis code ID”, 1, “Analysis type ID”, 1, @
“New_Material”, 0, “Date: 20-Aug-97 @
Time: 17:47:10”, “Isotropic”, 1, @
“Directionality”, 1, “Linearity”, 1, @
“Homogeneous”, 0, “Linear Elastic”, 1, @
“Model Options & IDs”, [““, ““, ““, ““, ““], @
[0, 0, 0, 0, 0], “Active Flag”, 1, “Create”, @
10, “External Flag”, FALSE, “Property IDs”, @
[“Elastic Modulus”,”Poisson Ratio”], [2, 5, 0], @
“Property Values”, [“3.6e6”, “.33”, ““] )
dump i_return_value
#
# Get the ID of the newly created material.
s_mat_name = “New_Material”
i_return_value = @
db_get_material_id_from_name @
( s_mat_name, @
i_mid )
dump i_return_value
dump i_mid
#
# Get the magics IDs and the active flag of the newly
# created material.
# The constitutive model code ID for “Linear Elastic” is 1.
i_cm_id = 1
i_return_value = @
db_get_active_flag @
( i_mid, @
i_cm_id, @
ia_magics, @
i_active )
dump i_return_value
dump ia_magics
dump i_active
#
# Modify the constitutive model magic numbers ID and
# the active flag.
ia_magics = [11,12,13,0,0]
IF (i_active == 1) THEN
i_active = 0
ELSE
i_active = 1
END IF
i_return_value = @
db_mo_const_models_specified @
( i_mid, @
i_cm_id, @
ia_magics, @
i_active )
dump i_return_value
# Get the magics IDs and the active flag of the modified
# constitutive model.
i_return_value = @
db_get_active_flag @
Main Index
CHAPTER 12 1419
Materials
( i_mid, @
i_cm_id, @
ia_magics, @
i_active )
dump i_return_value
dump ia_magics
dump i_active
#---------------------------------------------------------------------
db_modify_material ()
#---------------------------------------------------------------------
Main Index
CHAPTER 12 1421
Materials
db_modify_matl_prop_value ()
# The created field will be used for modifing the Elastic Modulus.
# Which has property id as 2.
ia_fid(2) = i_id_field
#---------------------------------------------------------------------
# The result of modification can be seen through MATERIAL SHOW option
# on the main menu.
#---------------------------------------------------------------------
engin_cons_to_elastic_matrix ()
get_qab_from_engin_cons ()
mat_2d_ani_to_2d_ort ()
Main Index
CHAPTER 12 1425
Materials
mat_3d_ani_to_3d_ort ()
r_v12, @
r_v23, @
r_v31 )
dump r_e11,r_e22,r_e33,r_v12,r_v23,r_v31
#---------------------------------------------------------------------
mat_hal_load_defn_show ()
STRING s_fudge_factor6[32]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
# Creating isotropic material by name ‘matrix’.
i_return_value = @
material.create(“Analysis code ID”,1,”Analysis type ID”,1, @
“matrix”,0, “New Material “, “Isotropic”, 1, @
“Directionality”, 1, “Linearity”, 1, “Homogeneous”, 0, @
“Linear Elastic”, 1,”Model Options & IDs”,[““,””,””,””,””], @
[0,0,0,0,0],”Active Flag”,1,”Create”,10,”External Flag”,FALSE, @
“Property IDs”,[“Elastic Modulus”,”Poisson Ratio”], [2, 5, 0], @
“Property Values”, [“2e5”, “.3”, ““] )
dump i_return_value
s_fudge_factor6 )
dump i_return_value
# The material defination data into the string format is
dump i_iopt,s_fiber_name,s_matrix_name,r_fvf,r_mvf
dump s_aratio1,s_aratio2,i_theory,l_override
dump s_fudge_factor1,s_fudge_factor2,s_fudge_factor3
dump s_fudge_factor4,s_fudge_factor5,s_fudge_factor6
#---------------------------------------------------------------------
# Retrieving data for discontinuous ribbon composite named ‘drc’.
s_mat_name=”drc”
# The option flag for the discontinuous ribbon composite is 4
i_iopt = 4
#
i_return_value = @
mat_hal_load_defn_show @
( s_mat_name, @
i_iopt, @
s_fiber_name, @
s_matrix_name, @
r_fvf, @
r_mvf, @
s_aratio1, @
s_aratio2, @
i_theory, @
l_override, @
s_fudge_factor1, @
s_fudge_factor2, @
s_fudge_factor3, @
s_fudge_factor4, @
s_fudge_factor5, @
s_fudge_factor6 )
dump i_return_value
# The material defination data into the string format is
dump i_iopt,s_fiber_name,s_matrix_name,r_fvf,r_mvf
dump s_aratio1,s_aratio2,i_theory,l_override
dump s_fudge_factor1,s_fudge_factor2,s_fudge_factor3
dump s_fudge_factor4,s_fudge_factor5,s_fudge_factor6
#---------------------------------------------------------------------
mat_lam_load_defn_show ()
# orients,
# num_def,
# iconv,
# offset_string )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_mat_name[32]
INTEGER i_num_plies
INTEGER iv_ply_names(VIRTUAL)
REAL rv_thicks(VIRTUAL)
REAL rv_orients(VIRTUAL)
INTEGER i_num_def
INTEGER i_iconv
STRING s_offset_string[32]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
# Creating 2d orthotropic materials for laminate plies. The material
# names are “2dort1” and “2dort2”.
i_return_value = @
material.create( “Analysis code ID”, 1, “Analysis type ID”, 1, @
“2dort1”, 0, “New Material”, @
“2d Orthotropic”, 5, “Directionality”, 4, “Linearity”, 1, @
“Homogeneous”, 0, “Linear Elastic”, 1, “Model Options & IDs”, @
[““,””,””,””,””], [0, 0, 0, 0, 0], “Active Flag”, 1, “Create”, @
10, “External Flag”, FALSE, “Property IDs”, [“Elastic Modulus”,@
“Elastic Modulus 22”, “Poisson Ratio”, “Shear Modulus”, @
“Shear Modulus 23”, “Shear Modulus 31”], [2, 3, 5, 8, 9, 10,0],@
“Property Values”, [“2e6”, “2e6”, “.33”, “2e7”, “3e7”,”4e6”,””])
dump i_return_value
i_return_value = @
material.create( “Analysis code ID”, 1, “Analysis type ID”, 1, @
“2dort2”, 0, “New Material”, @
“2d Orthotropic”, 5, “Directionality”, 4, “Linearity”, 1, @
“Homogeneous”, 0, “Linear Elastic”, 1, “Model Options & IDs”, @
[““, ““, ““, ““, ““], [0, 0, 0, 0, 0],”Active Flag”,1,”Create”,@
10, “External Flag”, FALSE, “Property IDs”, [“Elastic Modulus”,@
“Elastic Modulus 22”, “Poisson Ratio”, “Shear Modulus”, @
“Shear Modulus 23”, “Shear Modulus 31”], [2, 3, 5, 8, 9, 10,0],@
“Property Values”,[“2e6”,”2e5”,”.4”,”2e8”,”2.7e7”,”3.7e6”,””] )
dump i_return_value
i_num_plies = 5
#
i_return_value = @
mat_lam_load_defn_show @
( s_mat_name, @
i_num_plies, @
iv_ply_names, @
rv_thicks, @
rv_orients, @
i_num_def, @
i_iconv, @
s_offset_string )
dump i_return_value
# The laminate defination data is
dump iv_ply_names,rv_thicks,rv_orients,i_num_def,i_iconv
dump s_offset_string
#---------------------------------------------------------------------
# Loading the laminate defination data for ‘lam2’
s_mat_name = “lam2”
# Number of plies are 5
i_num_plies = 5
#
i_return_value = @
mat_lam_load_defn_show @
( s_mat_name, @
i_num_plies, @
iv_ply_names, @
rv_thicks, @
rv_orients, @
i_num_def, @
i_iconv, @
s_offset_string )
dump i_return_value
# The laminate defination data is
dump iv_ply_names,rv_thicks,rv_orients,i_num_def,i_iconv
dump s_offset_string
#---------------------------------------------------------------------
sys_free_array(iv_ply_names)
sys_free_array(rv_thicks)
sys_free_array(rv_orients)
#---------------------------------------------------------------------
mat_load_show ()
#
# mat_load_show
# ( mat_name,
# itype,
# iopt,
# desc,
# rvals,
# num_phases )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_mat_name[32]
INTEGER i_itype
INTEGER i_iopt
STRING s_desc[32]
REAL ra_rvals(32)
INTEGER i_num_phases
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
# Creating isotropic material by name ‘matrix’.
i_return_value = @
material.create(“Analysis code ID”,1,”Analysis type ID”,1, @
“matrix”,0, “New Material” , “Isotropic”, 1, @
“Directionality”, 1, “Linearity”, 1, “Homogeneous”, 0, @
“Linear Elastic”, 1,”Model Options & IDs”,[““,””,””,””,””], @
[0,0,0,0,0],”Active Flag”,1,”Create”,10,”External Flag”,FALSE, @
“Property IDs”,[“Elastic Modulus”,”Poisson Ratio”], [2, 5, 0], @
“Property Values”, [“2e5”, “.3”, ““] )
dump i_return_value
#
i_return_value = @
mat_load_show @
( s_mat_name, @
i_itype, @
i_iopt, @
s_desc, @
ra_rvals, @
i_num_phases )
dump i_return_value
# The construction data for one dimensional short fiber composite is
dump i_iopt,s_desc,ra_rvals,i_num_phases
#---------------------------------------------------------------------
# Retrieving data for one dimensional short fiber composite.
s_mat_name = “sfc1d”
# The material type for short fiber composite of one dimension is 1
i_itype = 4
# The composite option number for the material is 1.
i_iopt = 1
#
i_return_value = @
mat_load_show @
( s_mat_name, @
i_itype, @
i_iopt, @
s_desc, @
ra_rvals, @
i_num_phases )
dump i_return_value
# The construction data for two dimensional short fiber composite is
dump i_iopt,s_desc,ra_rvals,i_num_phases
#---------------------------------------------------------------------
mat_mix_load_defn_show ()
# ncn,
# ncv,
# nco )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_mat_name[32]
INTEGER i_num_phases
STRING s_name_string2[32]
STRING s_name_string3[32]
STRING s_name_string4[32]
STRING s_phase_string[32]
STRING s_v_f_string[32]
STRING s_orient_string[32]
INTEGER i_ncn
INTEGER i_ncv
INTEGER i_nco
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
# Creating two isotropic materials as ‘iso1’ and ‘iso2’.
i_return_value = @
material.create( “Analysis code ID”, 1, “Analysis type ID”, 1, @
“iso1”, 0, “New Material”, “Isotropic”, @
1, “Directionality”, 1, “Linearity”, 1, “Homogeneous”, 0, @
“Linear Elastic”, 1, “Model Options & IDs”, [““,””,””,””,””], @
[0, 0, 0, 0, 0], “Active Flag”, 1, “Create”,10,”External Flag”,@
FALSE, “Property IDs”, [“Elastic Modulus”, “Poisson Ratio”], @
[2, 5, 0], “Property Values”, [“2e11”, “.35”, ““] )
dump i_return_value
i_return_value = @
material.create( “Analysis code ID”, 1, “Analysis type ID”, 1, @
“iso2”, 0, “New Material”, “Isotropic”, @
1, “Directionality”, 1, “Linearity”, 1, “Homogeneous”, 0, @
“Linear Elastic”, 1, “Model Options & IDs”, [““,””,””,””,””], @
[0, 0, 0, 0, 0], “Active Flag”, 1, “Create”,10,”External Flag”,@
FALSE, “Property IDs”, [“Elastic Modulus”, “Poisson Ratio”], @
[2, 5, 0], “Property Values”, [“2E+11”, “0.34999999”, ““] )
dump i_return_value
0 45 45 45 30 45 30”, “Create” )
dump i_return_value
#---------------------------------------------------------------------
# Calling function to load the material defination data for Rule of
# Mixture material ‘rom’.
s_mat_name= “rom”
i_num_phases=3
#
i_return_value = @
mat_mix_load_defn_show @
( s_mat_name, @
i_num_phases, @
s_name_string2, @
s_name_string3, @
s_name_string4, @
s_phase_string, @
s_v_f_string, @
s_orient_string, @
i_ncn, @
i_ncv, @
i_nco )
dump i_return_value
# Material defination data for the material is
dump s_name_string2,s_name_string3,s_name_string4,s_phase_string
dump s_v_f_string,s_orient_string,i_ncn,i_ncv,i_nco
#---------------------------------------------------------------------
mat_sfc_load_defn_show ()
INTEGER i_iopt
STRING s_uni_mat_name[32]
REAL r_fmo
REAL r_smo
REAL r_fsd
REAL r_ssd
REAL r_cor
INTEGER i_niter
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
# Creating isotropic material by name ‘matrix’.
i_return_value = @
material.create(“Analysis code ID”,1,”Analysis type ID”,1, @
“matrix”,0, “New Material”, “Isotropic”, 1, @
“Directionality”, 1, “Linearity”, 1, “Homogeneous”, 0, @
“Linear Elastic”, 1,”Model Options & IDs”,[““,””,””,””,””], @
[0,0,0,0,0],”Active Flag”,1,”Create”,10,”External Flag”,FALSE, @
“Property IDs”,[“Elastic Modulus”,”Poisson Ratio”], [2, 5, 0], @
“Property Values”, [“2e5”, “.3”, ““] )
dump i_return_value
s_uni_mat_name, @
r_fmo, @
r_smo, @
r_fsd, @
r_ssd, @
r_cor, @
i_niter )
dump i_return_value
# The construction data for one dimensional short fiber composite is
dump s_uni_mat_name,r_fmo,r_smo,r_fsd,r_ssd,r_cor,i_niter
#---------------------------------------------------------------------
# Retrieving data for two dimensional short fiber composite.
s_mat_name = “sfc2d”
# Material option is 2 for two dimensional short fiber composite.
i_iopt = 2
#
i_return_value = @
mat_sfc_load_defn_show @
( s_mat_name, @
i_iopt, @
s_uni_mat_name, @
r_fmo, @
r_smo, @
r_fsd, @
r_ssd, @
r_cor, @
i_niter )
dump i_return_value
# The construction data for two dimensional short fiber composite is
dump s_uni_mat_name,r_fmo,r_smo,r_fsd,r_ssd,r_cor,i_niter
#---------------------------------------------------------------------
material.namedelete ()
INTEGER num_materials = 2
STRING descrip[32] = ""
STRING material_name[32](VIRTUAL)
INTEGER status
STRING message[32]
Main Index
CHAPTER 12 1437
Materials
#----------------------------------------------------------------------
# Open a new database
if(!db_is_open())THEN
uil_file_new.go("","new.db")
$? YES 36000002
endif
#----------------------------------------------------------------------
# Setting the preference to MSC.Nastran.
uil_pref_analysis.set_analysis_pref( "MSC.Nastran", @
"Structural", @
"", @
".op2" )
#---------------------------------------------------------------------
# Creating 1st material database for the material "Steel_1"
status = material.create( @
"Analysis code ID", @
1, @
"Analysis type ID", @
1, @
"Steel_1", @
0, @
"", @
"Isotropic", @
1, @
"Directionality", @
1, @
"Linearity", @
1, @
"Homogeneous", @
0, @
"Linear Elastic", @
1, @
"Model Options & IDs", @
["", "", "", "", ""], @
[0, 0, 0, 0, 0], @
"Active Flag", @
1, @
"Create", @
10, @
"External Flag", @
FALSE, @
"Property IDs", @
["Elastic Modulus", @
"Poisson Ratio"], @
[2, 5, 0], @
"Property Values", @
["29E6", "0.3", ""])
dump status
#---------------------------------------------------------------------
# Creating a 2nd material database for the material "Steel_2"
status = material.create( @
"Analysis code ID", @
1, @
"Analysis type ID", @
1, @
"Steel_2", @
0, @
"", @
"Isotropic", @
1, @
"Directionality", @
1, @
Main Index
1438
Code Examples
"Linearity", @
1, @
"Homogeneous", @
0, @
"Linear Elastic", @
1, @
"Model Options & IDs", @
["", "", "", "", ""], @
[0, 0, 0, 0, 0], @
"Active Flag", @
1, @
"Create", @
10, @
"External Flag", @
FALSE, @
"Property IDs", @
["Elastic Modulus", @
"Poisson Ratio"], @
[2, 5, 0], @
"Property Values", @
["29E6", "0.3", ""])
dump status
#---------------------------------------------------------------------
# Assigning the array size to material_name
sys_allocate_array(material_name,1,num_materials)
#---------------------------------------------------------------------
# Defining the names for the materials
material_name(1) = "Steel_1"
material_name(2) = "Steel_2"
status = material.namedelete( @
material_name, @
descrip, @
num_materials )
dump status
#---------------------------------------------------------------------
# Getting the status output for the function execution
msg_get_string(status,message)
dump message
#---------------------------------------------------------------------
# Closing the file
# uil_file_close.goquit()
#---------------------------------------------------------------------
# End of file
n21_cons_to_sym_6x6_matrix ()
#---------------------------------------------------------------------
p3cm.close_2 ()
# Variable Decleration
INTEGER detail
INTEGER i_return_value
#---------------------------------------------------------------------
# Opening the file spool.db
uil_file_open.go( "./spool.db")
#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.
#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.
P3CM.new ( "./spool.Layup" )
#---------------------------------------------------------------------
# Add the new material in the database.
#---------------------------------------------------------------------
# Argument Initialization.
detail = 0
#---------------------------------------------------------------------
# Close the Layup file.
#---------------------------------------------------------------------
# Dump the status of the function.
dump i_return_value
#---------------------------------------------------------------------
# Closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
p3cm.create_book_layup2 ()
INTEGER num_plies_in
INTEGER index_in(1)
LOGICAL report_it
STRING state[80]
LOGICAL rep_togs(6)
LOGICAL display_it
LOGICAL material
LOGICAL view_arrow
LOGICAL init_vector
LOGICAL max_strn
LOGICAL disp_area
LOGICAL cutout
LOGICAL pattern
LOGICAL surface
LOGICAL angles
REAL offval
LOGICAL pat_igs,pat_dxf,cut_igs,cut_dxf
STRING curve_str[80],layer_str[80]
LOGICAL hardcopy_it
STRING options[1024]
#---------------------------------------------------------------------
# Opening the file spool.db
uil_file_open.go( "./spool.db")
#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.
#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.
P3CM.new ( "./spool.Layup" )
#---------------------------------------------------------------------
Main Index
1442
Code Examples
#---------------------------------------------------------------------
# Add the created ply in the database.
$? YES 59200001
#---------------------------------------------------------------------
# Add the created layup in the database.
p3cm.create_layup_add_2( "spool", @
"LM_Layup created from : ./spool by LAMINATE MODELER", @
1, ["Ply_1", ""], ["Paint", ""], [1, 0], @
["Top", ""], [0., 0.], 0, [0.], [""], [0.], [0.], @
[""], 1, [5., 0.], [5., 0.] , ["", ""], FALSE, @
"Stan. Lam. Plate (CQUAD4/PCOMP)", @
FALSE, FALSE )
#---------------------------------------------------------------------
# Argument Initialization.
num_plies_in = 1
index_in(1) = 1
report_it = TRUE
state = "Expand"
rep_togs = [TRUE, TRUE, TRUE, TRUE, TRUE, TRUE]
display_it = TRUE
material = FALSE
view_arrow = TRUE
init_vector = TRUE
disp_area = TRUE
max_strn = TRUE
angles = FALSE
pattern = TRUE
cutout = TRUE
offval = 0.
pat_igs = FALSE
pat_dxf = FALSE
cut_igs = TRUE
cut_dxf = TRUE
curve_str = "SPLINE"
layer_str = "POLYLINE"
hardcopy_it = TRUE
#---------------------------------------------------------------------
# Create a book report for layups in the database.
P3CM.create_book_layup2( num_plies_in, @
index_in, @
report_it, @
state, @
rep_togs, @
display_it, @
material, @
view_arrow, @
init_vector, @
disp_area, @
max_strn, @
angles, @
pattern, @
cutout, @
offval, @
pat_igs, @
pat_dxf, @
cut_igs, @
cut_dxf, @
curve_str, @
layer_str, @
hardcopy_it, @
options)
#---------------------------------------------------------------------
# Closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
P3cm.create_laminates_layup_2 ()
# prefix, @
# first_laminate_id, @
# first_property_id, @
# preview )
#
#---------------------------------------------------------------------
# Variable Decleration
STRING areaspec[80]
STRING an_code_name[80]
STRING an_type_name[80]
STRING orientation[80]
STRING prim_entity[80]
REAL switch_angle_in
STRING sec_entity[80]
INTEGER num_tols
REAL ang_tols(2)
REAL thick_tols(2)
STRING tol_areas[80](2)
STRING element_type[512]
STRING prefix[80]
INTEGER first_laminate_id
INTEGER first_property_id
LOGICAL preview
INTEGER i_return_value
#---------------------------------------------------------------------
# Opening the file spool.db
uil_file_open.go( "./spool.db")
#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.
#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.
P3CM.new ( "./spool.Layup" )
#---------------------------------------------------------------------
# Add the new material in the database.
#---------------------------------------------------------------------
# Add the created ply in the database.
$? YES 59200001
#---------------------------------------------------------------------
# Add the created layup in the database.
p3cm.create_layup_add_2( "spool", @
"LM_Layup created from : /user2/manishj/" // @
"laminate/temp/spool by LAMINATE MODELER", 1, @
["Ply_1", ""], ["Paint", ""], [1, 0], ["Top", ""],@
[0., 0.], 0, [0.], [""], [0.], [0.], @
[""], 1, [5., 0.], [5., 0.], ["", ""], @
Main Index
CHAPTER 12 1445
Materials
$? YESFORALL 29002020
#---------------------------------------------------------------------
# Argument Initialization.
AREASPEC = "ALL"
AN_CODE_NAME = "MSC/NASTRAN"
an_type_name = "Structural"
orientation = "angle"
prim_entity = ""
switch_angle_in = 0.
sec_entity = ""
num_tols = 1
ang_tols = [5., 0.]
thick_tols = [5., 0.]
tol_areas(1) = ""
tol_areas(2) = ""
element_type = "Rev. Lam. Plate (CQUADR/PCOMP)"
prefix = "LM_Layup."
first_laminate_id = 1
first_property_id = 1
preview = FALSE
#--------------------------------------------------------------------
# Create the laminate in the database.
$? YESFORALL 29002020
#---------------------------------------------------------------------
# Dump the status of the function.
dump i_return_value
#---------------------------------------------------------------------
# Closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
Main Index
1446
Code Examples
p3cm.create_layup_add_2 ()
STRING LAYUP_NAME[212]
STRING LAYUP_DESCRIPTION[212]
INTEGER num_plies
STRING ply_names[80](2)
STRING type_names[80](2)
INTEGER instances(2)
STRING sides[80](2)
REAL offsets(2)
INTEGER num_offs
REAL off_values(1)
STRING off_flags[80](1)
REAL off_starts(1)
REAL off_views(1)
STRING off_areas[80](1)
INTEGER num_tols
REAL ang_tols(2)
REAL thick_tols(2)
STRING tol_areas[80](2)
LOGICAL model_flag
STRING element_type[212]
Main Index
CHAPTER 12 1447
Materials
LOGICAL solid_flag
LOGICAL bacon_flag
INTEGER i_return_value
#---------------------------------------------------------------------
# Opening the file spool.db
uil_file_open.go( "./spool.db")
#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.
#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.
P3CM.new ( "./spool.Layup" )
#---------------------------------------------------------------------
# Add the new material in the database.
#---------------------------------------------------------------------
# Add the created ply in the database.
$? YES 59200001
#---------------------------------------------------------------------
# Argument Initialization.
LAYUP_NAME = "spool"
LAYUP_DESCRIPTION = "LM_Layup created from : ./spool by LAMINATE MODELER"
num_plies = 1
ply_names(1) = "Ply_1"
ply_names(2) = ""
type_names(1) = "Paint"
type_names(2) = ""
instances = [1, 0]
sides(1) = "Top"
sides(2) = ""
tol_areas(1) = ""
tol_areas(2) = ""
Main Index
1448
Code Examples
model_flag = FALSE
element_type = "Stan. Lam. Plate (CQUAD4/PCOMP)"
solid_flag = FALSE
bacon_flag = FALSE
#---------------------------------------------------------------------
# Add the created layup in the database.
#---------------------------------------------------------------------
# Dump the status of the function.
dump i_return_value
#---------------------------------------------------------------------
# Closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
p3cm.create_material_add ()
# material_name, @
# analysis_material_name, @
# thichness, @
# max_strain, @
# warp_weft_angle)
#
#
#---------------------------------------------------------------------
# Variable Decleration
STRING type_name[80]
STRING material_name[80]
STRING analysis_material_name[80]
REAL thichness
REAL max_strain
REAL warp_weft_angle
INTEGER i_return_value
#---------------------------------------------------------------------
# Opening the file spool.db
uil_file_open.go( "./spool.db")
#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.
#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.
P3CM.new ( "./spool.Layup" )
#---------------------------------------------------------------------
# Argument Initialization.
type_name = "Paint"
material_name = "Add_Material"
analysis_material_name = "aluminum"
thichness = 0.1
max_strain = 0.
warp_weft_angle = 0.
#---------------------------------------------------------------------
# Add the new material in the database.
#---------------------------------------------------------------------
# Dump the status of the function.
dump i_return_value
#---------------------------------------------------------------------
# Closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
Main Index
1450
Code Examples
p3cm.create_ply_add_2 ()
STRING type_name[80]
STRING material_name[80]
STRING ply_name[80]
REAL start_pt(3)
REAL view_dirn(3)
REAL ref_dirn(3)
REAL ref_ang
REAL warp_weft_angle
REAL max_strain
REAL step_length
INTEGER axis_type
STRING warpaxis_str[80]
STRING weftaxis_str[80]
INTEGER extn_type
INTEGER max_sweeps
REAL bounds(4)
INTEGER num_areas
STRING area_strs[80](1)
STRING split_str[80]
INTEGER i_return_value
Main Index
CHAPTER 12 1451
Materials
#---------------------------------------------------------------------
# Opening the file spool.db
uil_file_open.go( "./spool.db")
#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.
#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.
P3CM.new ( "./spool.Layup" )
#---------------------------------------------------------------------
# Add the new material in the database.
#---------------------------------------------------------------------
# Argument Initialization.
type_name = "Paint"
material_name = "Mat_1"
ply_name = "Ply_1"
start_pt = [-2.99985, 8., -3.4641883]
view_dirn = [0.75, -0.5, -0.433]
ref_dirn = [0., 0., 0.]
ref_ang = 0.
warp_weft_angle = -1.0
max_strain = -1.0
step_length = -1.0
axis_type = 0
warpaxis_str = ""
weftaxis_str = ""
extn_type = 1
max_sweeps = 0
bounds = [0., 0., 0., 0.]
num_areas = 1
area_strs(1) = "Surface 4"
split_str = ""
#---------------------------------------------------------------------
# Add the created ply in the database.
#---------------------------------------------------------------------
Main Index
1452
Code Examples
dump i_return_value
#---------------------------------------------------------------------
# Closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
p3cm.create_results_failure ()
STRING res_name[80](5)
STRING area[80]
STRING criterion[80]
STRING basis[80]
INTEGER num_mats
STRING mat_names[80](virtual)
REAL mat_allows(virtual)
STRING name[80]
LOGICAL ply_sort
LOGICAL ply_results
LOGICAL failure_index
Main Index
CHAPTER 12 1453
Materials
LOGICAL reserve_factor
LOGICAL margin_safety
LOGICAL critical_component
LOGICAL critical_ply
INTEGER i_return_value
#---------------------------------------------------------------------
# Opening the file plate_matid.db
uil_file_open.go( "./plate_matid.db")
#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.
#---------------------------------------------------------------------
# Opening a Layup file.
P3CM.open( "./plate_matid.Layup" )
#---------------------------------------------------------------------
# Argument Initialization.
res_name(1) = "Default"
res_name(2) = "Static Subcase"
res_name(3) = "Stress Tensor"
res_name(4) = ""
res_name(5) = "none"
area = "Elm 7"
criterion = "Maximum"
basis = "STRESS"
num_mats = 8
sys_allocate_array(mat_names, 1, num_mats)
mat_names(1) = "mat.03"
mat_names(2) = "mat.04"
mat_names(3) = "mat.08"
mat_names(4) = "mat.09"
mat_names(5) = "mat.13"
mat_names(6) = "mat.14"
mat_names(7) = "mat.18"
mat_names(8) = "mat.19"
mat_allows = [[200.,200.,200.,200.,50.,50.,50.,0.] @
[200.,200.,200.,200.,50.,50.,50.,0.] @
[200.,200.,200.,200.,50.,50.,50.,0.] @
[200.,200.,200.,200.,50.,50.,50.,0.] @
[200.,200.,200.,200.,50.,50.,50.,0.] @
[200.,200.,200.,200.,50.,50.,50.,0.] @
[200.,200.,200.,200.,50.,50.,50.,0.] @
[200.,200.,200.,200.,50.,50.,50.,0.]]
name = ""
ply_sort = FALSE
ply_results = TRUE
failure_index = TRUE
reserve_factor = FALSE
margin_safety = TRUE
critical_component = TRUE
critical_ply = TRUE
#---------------------------------------------------------------------
Main Index
1454
Code Examples
#---------------------------------------------------------------------
# Dump the status of the function.
dump i_return_value
#---------------------------------------------------------------------
# Closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
p3cm.create_results_mid_sort ()
STRING res_name[80](5)
Main Index
CHAPTER 12 1455
Materials
STRING area[80]
INTEGER num_mats
STRING mat_names[80](virtual)
INTEGER i_return_value
#---------------------------------------------------------------------
# Opening the file plate_matid.db
uil_file_open.go( "./plate_matid.db")
#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.
#---------------------------------------------------------------------
# Opening a Layup file.
P3CM.open( "./plate_matid.Layup" )
#---------------------------------------------------------------------
# Argument Initialization.
res_name(1) = "Default"
res_name(2) = "Static Subcase"
res_name(3) = "Stress Tensor"
res_name(4) = ""
res_name(5) = "none"
area = "Elm 6"
num_mats = 1
sys_allocate_array(mat_names, 1, num_mats)
mat_names(1) = "mat.07"
#---------------------------------------------------------------------
# Create the LM results by using the mid_sort Calc method.
#---------------------------------------------------------------------
# Dump the status of the function.
dump i_return_value
#---------------------------------------------------------------------
# Closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
p3cm.create_results_sort ()
#
# Before running this session file, run the session
# file plate_matid.ses and create result file
# plate_matid_res.op2 as per the instructions given in it.
# Import this result file plate_matid_res.op2 into
# plate_matid.db and open the plate_matib.Layup file.
#
# This file can be run by starting a session of
# MSC/PATRAN, and running this session file through
# the "File","Session","Play" pulldown menus
# on the menu bar.
#
# The function P3CM.create_results_sort()
# has the following arguments:
#
# P3CM.create_results_sort ( res_name )
#
#---------------------------------------------------------------------
# Variable Decleration
string res_name[256](5)
integer i_return_value
#---------------------------------------------------------------------
# Opening the file plate_matid.db
uil_file_open.go( "./plate_matid.db" )
#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.
#---------------------------------------------------------------------
# Opening a Layup file.
p3cm.open( "./plate_matid.Layup" )
#---------------------------------------------------------------------
# Argumant Initialization
res_name(1) = "Default"
res_name(2) = "Static Subcase"
res_name(3) = "Stress Tensor"
res_name(4) = ""
res_name(5) = "none"
#---------------------------------------------------------------------
# Create the LM results by using the LM_Ply Sort method.
#---------------------------------------------------------------------
# Dump the status of the function.
dump i_return_value
#---------------------------------------------------------------------
# Closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
Main Index
CHAPTER 12 1457
Materials
p3cm.delete_laminates ()
#
# Purpose : This file provides an example of a call to the
# function P3CM.delete_laminates ()
#
# This session file deletes a laminate from the database.
#
# Before running this session file run spool.ses and
# create spool.db.
#
# This file can be run by starting a session of
# MSC/PATRAN, and running this session file through
# the "File","Session","Play" pulldown menus
# on the menu bar.
#
#
# The function P3CM.delete_laminates ()
# has the following arguments:
#
# P3CM.delete_laminates (num_laminates, laminates)
#
#---------------------------------------------------------------------
# Variable Decleration
INTEGER num_laminates
STRING laminates[80](virtual)
INTEGER i_return_value
#---------------------------------------------------------------------
# Opening the file spool.db
uil_file_open.go( "./spool.db")
#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.
#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.
P3CM.new ( "./spool.Layup" )
#---------------------------------------------------------------------
# Add the new material in the database.
#---------------------------------------------------------------------
# Add the created ply in the database.
$? YES 59200001
#---------------------------------------------------------------------
# Add the created layup in the database.
p3cm.create_layup_add_2( "spool", @
Main Index
1458
Code Examples
$? YES 59000040
$? YESFORALL 29002020
#---------------------------------------------------------------------
# Create the laminate in the database.
$? YES 59000040
$? YESFORALL 29002020
#---------------------------------------------------------------------
# Argument Initialization.
num_laminates = 1
sys_allocate_array(laminates, 1, num_laminates)
laminates(1) = "spool_1"
#--------------------------------------------------
# Delete the laminate from the database.
$? YES 59000001
#---------------------------------------------------------------------
# Dump the status of the function.
dump i_return_value
#---------------------------------------------------------------------
# Closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
p3cm.delete_material_name ()
STRING type_name[80]
STRING material_name[80]
INTEGER i_return_value
#---------------------------------------------------------------------
# Opening the file spool.db
uil_file_open.go( "./spool.db")
#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.
#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.
P3CM.new ( "./spool.Layup" )
#---------------------------------------------------------------------
# Add the new material in the database.
#---------------------------------------------------------------------
# Argument Initialization.
type_name = "Paint"
material_name = "Add_Material"
#---------------------------------------------------------------------
# Delete the existing material.
#---------------------------------------------------------------------
# Dump the status of the function.
dump i_return_value
#---------------------------------------------------------------------
# Closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
Main Index
1460
Code Examples
p3cm.delete_ply_name ()
STRING type_name[80]
STRING ply_name[80]
INTEGER i_return_value
#---------------------------------------------------------------------
# Opening the file spool.db
uil_file_open.go( "./spool.db")
#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.
#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.
P3CM.new ( "./spool.Layup" )
#---------------------------------------------------------------------
# Add the new material in the database.
#---------------------------------------------------------------------
# Add the created ply in the database.
#---------------------------------------------------------------------
# Argument Initialization.
type_name = "Paint"
Main Index
CHAPTER 12 1461
Materials
ply_name = "Ply_1"
#---------------------------------------------------------------------
# Delete the created ply.
#---------------------------------------------------------------------
# Dump the status of the function.
dump i_return_value
#---------------------------------------------------------------------
# Closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
p3cm.delete_propsets ()
INTEGER num_propsets
STRING propsets[80](virtual)
INTEGER i_return_value
#---------------------------------------------------------------------
# Opening the file spool.db
uil_file_open.go( "./spool.db")
#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.
#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.
P3CM.new ( "./spool.Layup" )
#---------------------------------------------------------------------
# Add the new material in the database.
Main Index
1462
Code Examples
#---------------------------------------------------------------------
# Add the created ply in the database.
$? YES 59200001
#---------------------------------------------------------------------
# Add the created layup in the database.
p3cm.create_layup_add_2( "spool", @
"LM_Layup created from : /user2/manishj/"// @
"laminate/temp/spool by LAMINATE MODELER", @
1, ["Ply_1", ""], ["Paint", ""], @
[1, 0], ["Top", ""], [0., 0.], 0, @
[0.], [""], [0.], [0.], [""], @
1, [5., 0.], [ 5., 0.], ["", ""], TRUE, @
"Stan. Lam. Plate (CQUAD4/PCOMP)", @
FALSE, FALSE )
$? YES 59000040
$? YESFORALL 29002020
#---------------------------------------------------------------------
# Create the laminate in the database.
$? YES 59000040
$? YESFORALL 29002020
#---------------------------------------------------------------------
# Argument Initialization.
num_propsets = 1
sys_allocate_array(propsets, 1, num_propsets)
propsets(1) = "LM_Layup.1"
#---------------------------------------------------------------------
# Delete the properties sets from the database.
$? YES 59000001
#---------------------------------------------------------------------
# Dump the status of the function.
dump i_return_value
#---------------------------------------------------------------------
# Closing the patran environment.
Main Index
CHAPTER 12 1463
Materials
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
p3cm.import_model_file_2 ()
LOGICAL mesh
LOGICAL materials
INTEGER node_id_offsets
INTEGER elem_id_offset
LOGICAL create_group
STRING group_name[80]
INTEGER i_return_value
#---------------------------------------------------------------------
# Opening the file spool.db
uil_file_open.go( "./spool.db")
#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.
#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.
P3CM.new ( "./spool.Layup" )
#---------------------------------------------------------------------
# Argument Initialization.
mesh = TRUE
materials = TRUE
node_id_offsets = 1200
elem_id_offset = 1152
Main Index
1464
Code Examples
create_group = TRUE
group_name = "spool"
#---------------------------------------------------------------------
# Set all export options.
#---------------------------------------------------------------------
# Dump the status of the function.
dump i_return_value
#---------------------------------------------------------------------
# Closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
p3cm.import_plies_file_2 ()
INTEGER num_files
STRING files[80](virtual)
REAL angle_tolerance, distance_tolerance
LOGICAL create_layup,preview,merge_nodes
INTEGER i_return_value
#---------------------------------------------------------------------
Main Index
CHAPTER 12 1465
Materials
uil_file_open.go( "./spool.db")
#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.
#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.
P3CM.new ( "./spool.Layup" )
#---------------------------------------------------------------------
# Add the new material in the database.
#---------------------------------------------------------------------
# Add the created ply in the database.
$? YES 59200001
$? YES 59200001
#---------------------------------------------------------------------
# Save the database.
p3cm.save_as_2("./spool.Layup", 0)
#---------------------------------------------------------------------
# Argument Initialization.
num_files = 1
sys_allocate_array(files, 1, num_files)
files(1) = "./spool.Layup"
angle_tolerance = 25.
distance_tolerance = 5.
create_layup = TRUE
preview = TRUE
merge_nodes = TRUE
#---------------------------------------------------------------------
# Import the plies file from the database.
distance_tolerance, @
create_layup, @
preview, @
merge_nodes)
$? YESFORALL 59200001
#---------------------------------------------------------------------
# Dump the status of the function.
dump i_return_value
#---------------------------------------------------------------------
# Closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
p3cm.modify_material ()
STRING type_name[80]
STRING Add_material_name[80]
STRING Modified_material_name[80]
STRING analysis_material_name[80]
REAL thickness
REAL max_strain
REAL warp_weft_angle
INTEGER i_return_value
#---------------------------------------------------------------------
# Opening the file spool.db
uil_file_open.go( "./spool.db")
#---------------------------------------------------------------------
Main Index
CHAPTER 12 1467
Materials
#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.
P3CM.new ( "./spool.Layup" )
#---------------------------------------------------------------------
# Add the new material in the database.
#---------------------------------------------------------------------
# Argument Initialization.
type_name = "Paint"
Add_material_name = "Add_Material"
Modified_material_name = "Modified_Material"
analysis_material_name = "aluminum"
thichness = 0.1
max_strain = 0.
warp_weft_angle = 0.
#---------------------------------------------------------------------
# Modified the existing material.
#---------------------------------------------------------------------
# Dump the status of the function.
dump i_return_value
#---------------------------------------------------------------------
# Closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
p3cm.modify_ply ()
#
# The function P3CM.modify_ply()
# has the following arguments:
#
# P3CM.modify_ply ( type_name, @
# material_name, @
# old_ply_name, @
# modified_ply_name, @
# start_pt, @
# view_dirn, @
# ref_dirn, @
# ref_ang, @
# warp_weft_angle, @
# max_strain, @
# step_length, @
# axis_type, @
# warpaxis_str, @
# weftaxis_str, @
# extn_type, @
# max_sweeps, @
# bounds, @
# num_areas, @
# area_strs, @
# split_str)
#
#
#---------------------------------------------------------------------
# Variable Decleration
STRING type_name[80]
STRING material_name[80]
STRING old_ply_name[80]
STRING modified_ply_name[80]
REAL start_pt(3)
REAL view_dirn(3)
REAL ref_dirn(3)
REAL ref_ang
REAL warp_weft_angle
REAL max_strain
REAL step_length
INTEGER axis_type
STRING warpaxis_str[80]
STRING weftaxis_str[80]
INTEGER extn_type
INTEGER max_sweeps
REAL bounds(4)
INTEGER num_areas
STRING area_strs[80](1)
STRING split_str[80]
INTEGER i_return_value
#---------------------------------------------------------------------
# Opening the file spool.db
uil_file_open.go( "./spool.db")
#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.
#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.
P3CM.new ( "./spool.Layup" )
Main Index
CHAPTER 12 1469
Materials
#---------------------------------------------------------------------
# Add the new material in the database.
#---------------------------------------------------------------------
# Add the created ply in the database.
$? YES 59200001
#---------------------------------------------------------------------
# Argument Initialization.
type_name = "Paint"
material_name = "Mat_1"
old_ply_name = "Ply_1"
modified_ply_name = "Ply_1"
start_pt = [-2.4004319, 7.9241023, -0.8087222]
view_dirn = [0., 1., 0.]
ref_dirn = [0., 0., 0.]
ref_ang = 0.
warp_weft_angle = -1.0
max_strain = -1.0
step_length = -1.0
axis_type = 0
warpaxis_str = ""
weftaxis_str = ""
extn_type = 1
max_sweeps = 0
bounds = [0., 0., 0., 0.]
num_areas = 1
area_strs(1) = "Surface 5"
split_str = ""
#---------------------------------------------------------------------
# Modify the ply in the database.
$? YES 59200001
Main Index
1470
Code Examples
#---------------------------------------------------------------------
# Dump the status of the function.
dump i_return_value
#---------------------------------------------------------------------
# Closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
p3cm.new ()
String value[256]
integer i_return_value
#---------------------------------------------------------------------
# Opening the file spool.db
uil_file_open.go( "./spool.db")
#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.
#--------------------------------------------------------------
# Argument Initialization
value = "./spool.Layup"
#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.
#---------------------------------------------------------------------
# Dump the status of the function.
Main Index
CHAPTER 12 1471
Materials
dump i_return_value
#---------------------------------------------------------------------
# Closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
p3cm.set_offsets ()
INTEGER num_offs
REAL off_values(2)
STRING off_flags[80](2)
REAL off_starts(4)
REAL off_views(4)
STRING off_areas[80](2)
INTEGER i_return_value
#---------------------------------------------------------------------
# Opening the file spool.db
uil_file_open.go( "./spool.db")
#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.
#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.
P3CM.new ( "./spool.Layup" )
#---------------------------------------------------------------------
# Add the new material in the database.
Main Index
1472
Code Examples
#---------------------------------------------------------------------
# Add the created ply in the database.
$? YES 59200001
#---------------------------------------------------------------------
# Argument Initialization.
num_offs = 1
off_values = [10., 0.]
off_starts = [0.76763952, 8., 1.7678945, 0.]
off_views = [0.75, -0.5, -0.433, 0.]
off_flags(1) = "1"
off_flags(2) = ""
off_areas(1) = "Surface 4"
off_areas(2) = ""
#---------------------------------------------------------------------
# Set the offsets data for layup.
#---------------------------------------------------------------------
# Dump the status of the function.
dump i_return_value
#---------------------------------------------------------------------
# Closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
p3cm.open ()
string value[256]
integer i_return_value
#---------------------------------------------------------------------
# Opening the file spool.db
uil_file_open.go( "./spool.db")
#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.
#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.
P3CM.new ( "./spool.Layup" )
#---------------------------------------------------------------------
# Add the new material in the database.
#---------------------------------------------------------------------
# Close the Layup file.
p3cm.close_2( 0 )
#---------------------------------------------------------------------
# Argument Initialization.
value = "./spool.Layup"
#---------------------------------------------------------------------
# Open the existing Layup file spool.Layup.
#---------------------------------------------------------------------
# Dump the status of the function.
dump i_return_value
#---------------------------------------------------------------------
# Closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
p3cm.save_as_2 ()
#
# Before running this session file run spool.ses and
# create spool.db.
#
# This file can be run by starting a session of
# MSC/PATRAN, and running this session file through
# the "File","Session","Play" pulldown menus
# on the menu bar.
#
#
# The function P3CM.save_as_2()
# has the following arguments:
#
# P3CM.save_as_2 ( value , detail )
#
#---------------------------------------------------------------------
# Variable Decleration
STRING value[256]
INTEGER detail
INTEGER i_return_value
#---------------------------------------------------------------------
# Opening the file spool.db
uil_file_open.go( "./spool.db")
#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.
#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.
P3CM.new ( "./spool.Layup" )
#---------------------------------------------------------------------
# Add the new material in the database.
#---------------------------------------------------------------------
# Argument Initialization.
value = "./spool_bak.Layup"
detail = 0
#---------------------------------------------------------------------
# Save as the Spool_bak.Layup file.
#---------------------------------------------------------------------
# Dump the status of the function.
dump i_return_value
#---------------------------------------------------------------------
# Closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
Main Index
CHAPTER 12 1475
Materials
p3cm.set_export_options_2 ()
LOGICAL draped_pattern_iges
LOGICAL draped_pattern_dxf
LOGICAL flat_pattern_iges
LOGICAL flat_pattern_dxf
LOGICAL mold_surface_iges
STRING curve[80]
STRING layer[80]
INTEGER i_return_value
#---------------------------------------------------------------------
# Opening the file spool.db
uil_file_open.go( "./spool.db")
#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.
#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.
P3CM.new ( "./spool.Layup" )
#---------------------------------------------------------------------
# Argument Initialization.
draped_pattern_iges = TRUE
draped_pattern_dxf = TRUE
flat_pattern_iges = TRUE
flat_pattern_dxf = TRUE
mold_surface_iges = TRUE
curve = "SPLINE"
layer = "POLYLINE"
Main Index
1476
Code Examples
#---------------------------------------------------------------------
# Set all export options.
#---------------------------------------------------------------------
# Dump the status of the function.
dump i_return_value
#---------------------------------------------------------------------
# Closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
p3cm.set_graphics_options_2 ()
LOGICAL message
Main Index
CHAPTER 12 1477
Materials
LOGICAL ply_graphics
LOGICAL layup_graphics
LOGICAL material
LOGICAL app_direction
LOGICAL ref_direction
LOGICAL max_strain
LOGICAL selected_area
LOGICAL flat_pattern
LOGICAL draped_pattern
LOGICAL surface_offset
LOGICAL angles
REAL offset_val
REAL scale
INTEGER i_return_value
#---------------------------------------------------------------------
# Opening the file spool.db
uil_file_open.go( "./spool.db")
#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.
#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.
P3CM.new ( "./spool.Layup" )
#---------------------------------------------------------------------
# Argument Initialization.
message = FALSE
ply_graphics = TRUE
layup_graphics = TRUE
material = FALSE
app_direction = TRUE
ref_direction = TRUE
max_strain = TRUE
selected_area = TRUE
flat_pattern = TRUE
draped_pattern = TRUE
surface_offset = TRUE
angles = FALSE
offset_val = 2.0
scale = 1.8
#---------------------------------------------------------------------
# Set all display options using LM ply graphics options also.
#---------------------------------------------------------------------
Main Index
1478
Code Examples
dump i_return_value
#---------------------------------------------------------------------
# Closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
p3cm.set_tolerance ()
INTEGER num_tols
REAL ang_tols(virtual)
REAL thick_tols(virtual)
STRING tol_areas[80](virtual)
INTEGER row
INTEGER i_return_value
#---------------------------------------------------------------------
# Opening the file spool.db
uil_file_open.go( "./spool.db")
#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.
#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.
P3CM.new ( "./spool.Layup" )
#---------------------------------------------------------------------
# Add the new material in the database.
Main Index
CHAPTER 12 1479
Materials
#---------------------------------------------------------------------
# Add the created ply in the database.
$? YES 59200001
#---------------------------------------------------------------------
# Argument Initialization.
num_tols = 1
row = num_tols +1
sys_allocate_array(ang_tols, 1, row)
sys_allocate_array(thick_tols, 1, row)
sys_allocate_array(tol_areas, 1, row)
#--------------------------------------------------------------------
# Set the tolerance data for the layup.
$? YESFORALL 29002020
#---------------------------------------------------------------------
# Dump the status of the function.
dump i_return_value
#---------------------------------------------------------------------
# Closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
p3cm.show_laminate ()
STRING elem_vstr[512]
INTEGER nprop
STRING prop[80](1)
INTEGER nlam
INTEGER lam(1)
STRING property[80]
STRING display_method[80]
REAL scale
INTEGER nlay
INTEGER lay(1)
INTEGER i_return_value
#---------------------------------------------------------------------
# Opening the file spool.db
uil_file_open.go( "./spool.db")
#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.
#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.
P3CM.new ( "./spool.Layup" )
#---------------------------------------------------------------------
# Add the new material in the database.
#---------------------------------------------------------------------
# Add the created ply in the database.
$? YES 59200001
Main Index
CHAPTER 12 1481
Materials
#---------------------------------------------------------------------
# Add the created layup in the database.
p3cm.create_layup_add_2( "spool", @
"LM_Layup created from : ./spool by LAMINATE MODELER", @
1, ["Ply_1", ""], ["Paint", ""], [1, 0], ["Top", ""], @
[0., 0.], 0, [0.], [""], [ 0.], [0.], [""], 1, [5., 0.], @
[5., 0.], ["", ""], FALSE, @
"Stan. Lam. Plate (CQUAD4/PCOMP)", FALSE, FALSE )
$? YES 59000040
$? YESFORALL 29002020
#---------------------------------------------------------------------
# Create the laminate in the database.
$? YES 59000040
$? YESFORALL 29002020
#---------------------------------------------------------------------
# Argument Initialization.
#---------------------------------------------------------------------
# Show the laminate.
#---------------------------------------------------------------------
# Dump the status of the function.
dump i_return_value
#---------------------------------------------------------------------
# Closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
Main Index
1482
Code Examples
p3cm.show_layup_exploded ()
INTEGER num_selected
INTEGER index(1)
REAL offset_mult
INTEGER i_return_value
#---------------------------------------------------------------------
# Opening the file spool.db
uil_file_open.go( "./spool.db")
#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.
#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.
P3CM.new ( "./spool.Layup" )
#---------------------------------------------------------------------
# Add the new material in the database.
#---------------------------------------------------------------------
# Add the created ply in the database.
$? YES 59200001
#---------------------------------------------------------------------
# Add the created layup in the database.
Main Index
CHAPTER 12 1483
Materials
p3cm.create_layup_add_2( "spool", @
"LM_Layup created from : /user2/manishj/"// @
"laminate/spool by LAMINATE MODELER", 1, @
["Ply_1", ""], ["Paint", ""], [1, 0], @
["Top", ""], [0., 0.], 0, [0.], [""], @
[0.], [0.], [""], 1, [5., 0.], [5., 0.], @
["", ""], FALSE, @
"Stan. Lam. Plate (CQUAD4/PCOMP)", @
TRUE, TRUE )
#---------------------------------------------------------------------
# Argument Initialization.
num_selected = 1
index(1) = 1
offset_mult = 1.
#---------------------------------------------------------------------
# Shows the exploded layup.
#---------------------------------------------------------------------
# Dump the status of the function.
dump i_return_value
#---------------------------------------------------------------------
# Closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
p3cm.show_ply ()
STRING type_id_name[80]
STRING ply_name[80]
LOGICAL plot_flag
INTEGER i_return_value
#---------------------------------------------------------------------
# Opening the file spool.db
uil_file_open.go( "./spool.db")
#---------------------------------------------------------------------
# Add the system library for Laminate Modeler.
#---------------------------------------------------------------------
# Opening a new Layup file for begining the LAMINATE MODELER session.
P3CM.new ( "./spool.Layup" )
#---------------------------------------------------------------------
# Add the new material in the database.
#---------------------------------------------------------------------
# Add the created ply in the database.
$? YES 59200001
#---------------------------------------------------------------------
# Argument Initialization.
type_id_name = "1"
ply_name = "Ply_1"
plot_flag = TRUE
#---------------------------------------------------------------------
# Show the created ply.
#---------------------------------------------------------------------
# Dump the status of the function.
dump i_return_value
#---------------------------------------------------------------------
# Closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
Main Index
MSC.Acumen, Volume 2: Code Examples
CHAPTER
Analysis
13
■ Introduction
Main Index
1486
Code Examples
13.1 Introduction
This chapter provides code examples for the PCL function described in Volume 1. These
examples are designed so that they can be cut and pasted into a file and, by following the
instructions listed with each example, executed in MSC.Patran.
analysis_get.pset_for_job ()
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)
#---------------------------------------------------------------------
dump i_return_value
dump s_analysis_code
#---------------------------------------------------------------------
# Get the number of jobs associated with the analysis code.
i_return_value = db_count_job_names_for_a_code( i_anal_code_id, i_job_count )
Main Index
CHAPTER 13 1487
Analysis
dump i_return_value
dump i_anal_code_id
dump i_job_count
#---------------------------------------------------------------------
i_job_count = i_job_count * 2
i_return_value = db_get_jobnames_for_a_code @
( i_anal_code_id, @
i_job_count, @
s_anal_job_names, @
i_job_id_list, @
s_anal_job_descr, @
i_job_sets, @
i_job_stats )
dump i_return_value
dump i_anal_code_id
dump i_job_count
dump s_anal_job_names
dump i_job_id_list
dump s_anal_job_descr
dump i_job_sets
dump i_job_stats
#---------------------------------------------------------------------
# Call the function to get the analysis job id
s_anal_job_name = “plate1”
i_return_value = @
analysis_get.pset_for_job @
( s_analysis_code, @
s_anal_job_names(1), @
i_anal_job_id )
dump i_return_value
analysis_import ()
STRING asm_create_patch_xy_created_ids[VIRTUAL]
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]
INTEGER fem_create_mesh_surfa_num_nodes
INTEGER fem_create_mesh_surfa_num_elems
INTEGER i_return_value
#----------------------------------------------------------------------
# Open a new database
# uil_file_new.go("","new.db")
#----------------------------------------------------------------------
i_return_value = asm_const_patch_xyz @
( "1", @
"<1 1 0>", @
"[0 0 0]", @
"Coord 0", @
asm_create_patch_xy_created_ids )
dump i_return_value
#----------------------------------------------------------------------
# Create finite element entities
dump i_return_value
mesh_seed_display_mgr.erase( )
#----------------------------------------------------------------------
# Create loads/boundary conditions
# Creating set 'fixed_nodes' on L.H.S. of the model
# Creating set of forces 'Loads_at_ends', Force of 50 units downwards.
Main Index
CHAPTER 13 1489
Analysis
dump i_return_value
dump i_return_value
#----------------------------------------------------------------------
# Create Material - Steel
# Modulus of elasticity - 29 E6 units
# Piosson ratio - 0.3
dump i_return_value
#----------------------------------------------------------------------
# Create Element Properties 'Prop_1'
# thickness - 0.05 units
dump i_return_value
#----------------------------------------------------------------------
# Preparing the job for submission
jobfile.open( "new", "ANALYZE NO JOBFILE" )
msc_delete_old_files( "new", ".bdf", ".op2" )
jobfile.writec( "", "TRANSLATOR = pat3nas" )
jobfile.writec( "DATABASE", "new.db" )
jobfile.writec( "JOBNAME", "new" )
jobfile.writec( "ANALYSIS TITLE", "")
jobfile.writec( "", "" )
jobfile.writec( "OBJECT", "Entire Model" )
jobfile.writec( "METHOD", "Full Run" )
jobfile.writec( "", "" )
jobfile.writec( "MODEL SUFFIX", ".bdf" )
jobfile.writec( "RESULTS SUFFIX", ".op2" )
jobfile.writec( "", "" )
jobfile.writec( "", "/*" )
jobfile.writec( "", " * Translation Parameters" )
jobfile.writec( "", " */" )
jobfile.writec( "", "" )
jobfile.writec( "DATA OUTPUT", "OP2 Only" )
jobfile.writec( "OUTPUT2 REQUESTS", "P3 Built In" )
jobfile.writec( "OUTPUT2 FORMAT", "Binary" )
jobfile.writec( "DIVISION TOLERANCE", "1.0e-08" )
jobfile.writec( "NUMERICAL TOLERANCE", "1.0e-04" )
jobfile.writec( "MODEL TOLERANCE", "0.0049999999" )
jobfile.writec( "WRITING TOLERANCE", "1.0e-21" )
jobfile.writec( "CARD FORMAT", "either" )
jobfile.writec( "MINIMUM SIGNIF. DIGITS", "4" )
jobfile.writec( "NODE COORDINATES", "reference frame" )
jobfile.writec( "MSC.Nastran VERSION", "70.5" )
jobfile.writec( "PROPS ON ELEM ENTRY", "FALSE" )
jobfile.writec( "NO CONTINUATION ENTRY", "FALSE" )
jobfile.writec( "ITERATIVE SOLVER", "FALSE" )
jobfile.writec( "ELEMENT PROPERTY OFFSET", "0" )
jobfile.writec( "MATERIAL PROPERTY OFFSET", "0" )
jobfile.writec( "TABLE OFFSET", "0" )
jobfile.writec( "LOAD SET OFFSET", "0" )
jobfile.writec( "LOAD CASE OFFSET", "0" )
jobfile.writec( "CONTROL SET OFFSET", "0" )
jobfile.writec( "RIGID ELEMENT OFFSET", "0" )
jobfile.writec( "SCALAR POINT OFFSET", "0" )
jobfile.writec( "BEGINNING CONTINUATION MARKER", "+ A" )
jobfile.writec( "NUMBER ONLY", "ON" )
jobfile.writec( "BEGINNING NUMBER", "OFF" )
jobfile.writec( "TRAILING NUMBER", "OFF" )
jobfile.writec( "SYNTAX NUMBER", "ON" )
jobfile.writec( "SYNTAX MARKER", "." )
jobfile.writec( "", "" )
jobfile.writec( "", "/*" )
jobfile.writec( "", " * Solution Parameters" )
jobfile.writec( "", " */" )
jobfile.writec( "", "" )
Main Index
CHAPTER 13 1491
Analysis
#-----------------------------------------------------------------------
# Submitting the job for analysis
uil_file_close.go( )
#-----------------------------------------------------------------------
# Opening the file with the name new.db again.
uil_file_new.go( "","new.db" )
$? YES 36000002
#-----------------------------------------------------------------------
# Importing data from the closed new.bdf file
analysis_import("MSC.Nastran","new","Input File","new.bdf",TRUE)
#-----------------------------------------------------------------------
# Closing the file new.db
#
uil_file_close.goquit( )
-----------------------------------------------------------------------
analysis_main.job_name_lbox ()
#
# analysis_main.job_name_lbox
# ( INPUT:
# INTEGER num_items,
# STRING job_name[]()
# OUTPUT:
# )
#---------------------------------------------------------------------
#
# Opening a new database
uil_file_new.go("","new.db")
#---------------------------------------------------------------------
#--------------------------------------------------------------------
INTEGER num_items = 1
#---------------------------------------------------------------------
analysis_main.job_name_lbox(num_items, @
job_name)
#---------------------------------------------------------------------
STRING check_job_name[64]
STRING job_desc[256]
analysis_main.get_job_name_and_desc(check_job_name,job_desc)
dump check_job_name
#----------------------------------------------------------------------
# End of File.
#---------------------------------------------------------------------
analysis_main.user_function ()
STRING classname[128]
STRING function_name[128]
INTEGER exist_flag
INTEGER status
#----------------------------------------------------------------------
# Open a new database
if(!db_is_open())THEN
uil_file_new.go("","new.db")
$? YES 36000002
endif
#----------------------------------------------------------------------
# Setting the preference to MSC.Nastran.
uil_pref_analysis.set_analysis_pref( "MSC.Nastran", @
"Structural", @
"", @
".op2" )
#---------------------------------------------------------------------
# Playing the event file to open the analysis open form
em_event_play("analysis_form_open.evt.01")
#---------------------------------------------------------------------
# Initialising the class of functions : analysis_main
analysis_main.init()
#---------------------------------------------------------------------
# Use the function to execute the function - jobfile.close
# Assigning values to the variables
classname = "jobfile"
function_name = "close"
status = analysis_main.user_function( @
classname, @
function_name, @
exist_flag)
dump status
Main Index
1494
Code Examples
dump exist_flag
#---------------------------------------------------------------------
# Closing the file
uil_file_close.goquit()
#---------------------------------------------------------------------
# End of file
analysis_submit ()
STRING asm_create_patch_xy_created_ids[VIRTUAL]
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]
INTEGER fem_create_mesh_surfa_num_nodes
INTEGER fem_create_mesh_surfa_num_elems
INTEGER i_return_value
#----------------------------------------------------------------------
# Open a new database
# uil_file_new.go("","new.db")
#$? YES 36000002
#----------------------------------------------------------------------
Main Index
CHAPTER 13 1495
Analysis
i_return_value = asm_const_patch_xyz @
( "1", @
"<1 1 0>", @
"[0 0 0]", @
"Coord 0", @
asm_create_patch_xy_created_ids )
dump i_return_value
#----------------------------------------------------------------------
# Create finite element entities
dump i_return_value
mesh_seed_display_mgr.erase( )
#----------------------------------------------------------------------
# Create loads/boundary conditions
# Creating set 'fixed_nodes' on L.H.S. of the model
# Creating set of forces 'Loads_at_ends', Force of 50 units downwards.
dump i_return_value
["", ""] )
dump i_return_value
#----------------------------------------------------------------------
# Create Material - Steel
# Modulus of elasticity - 29 E6 units
# Piosson ratio - 0.3
dump i_return_value
#----------------------------------------------------------------------
# Create Element Properties 'Prop_1'
# thickness - 0.05 units
dump i_return_value
#----------------------------------------------------------------------
# Preaparing the file new.bdf required for submission
jobfile.close( )
mscnastran_job.associate_subcases( "101", "new", 1, ["Default"] )
#----------------------------------------------------------------------
# Submitting the job for analysis
#----------------------------------------------------------------------
# Closing the file new.db
uil_file_close.goquit( )
#----------------------------------------------------------------------
analysis_submit_2 ()
STRING asm_create_patch_xy_created_ids[VIRTUAL]
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]
INTEGER fem_create_mesh_surfa_num_nodes
INTEGER fem_create_mesh_surfa_num_elems
INTEGER i_return_value
#----------------------------------------------------------------------
# Open a new database
# uil_file_new.go("","new.db")
#$? YES 36000002
#----------------------------------------------------------------------
i_return_value = asm_const_patch_xyz @
( "1", @
"<1 1 0>", @
"[0 0 0]", @
"Coord 0", @
asm_create_patch_xy_created_ids )
dump i_return_value
#----------------------------------------------------------------------
# Create finite element entities
dump i_return_value
mesh_seed_display_mgr.erase( )
#----------------------------------------------------------------------
# Create loads/boundary conditions
# Creating set 'fixed_nodes' on L.H.S. of the model
# Creating set of forces 'Loads_at_ends', Force of 50 units downwards.
dump i_return_value
dump i_return_value
#----------------------------------------------------------------------
# Create Material - Steel
# Modulus of elasticity - 29 E6 units
# Piosson ratio - 0.3
"Steel", @
0, @
"", @
"Isotropic", @
1, @
"Directionality", @
1, @
"Linearity", @
1, @
"Homogeneous", @
0, @
"Linear Elastic", @
1, @
"Model Options & IDs", @
["", "", "", "", ""], @
[0, 0, 0, 0, 0], @
"Active Flag", @
1, @
"Create", @
10, @
"External Flag", @
FALSE, @
"Property IDs", @
["Elastic Modulus", @
"Poisson Ratio"], @
[2, 5, 0], @
"Property Values", @
["29E6", "0.3", ""] )
dump i_return_value
#----------------------------------------------------------------------
# Create Element Properties 'Prop_1'
# thickness - 0.05 units
dump i_return_value
#----------------------------------------------------------------------
# Preaparing the file new.bdf required for submission
db_assign_last_jobname ()
( s_jobname )
dump i_return_value
#
# Get the last job name
i_return_value = @
db_get_last_jobname(s_jobname)
dump i_return_value
dump s_jobname
#
# Now set the sa_jobnames(2) as the last job name
dump sa_jobnames(2)
s_jobname = sa_jobnames(2)
i_return_value = @
db_assign_last_jobname @
( s_jobname )
dump i_return_value
#
# Now get the newly set last job name
i_return_value = @
db_get_last_jobname ( s_jobname )
dump i_return_value
dump s_jobname
#---------------------------------------------------------------------
db_count_all_job_name_ids ()
Main Index
1504
Code Examples
db_count_anal_codes ()
db_count_anal_types ()
$? YES 36000002
#---------------------------------------------------------------------
db_count_analysis_steps ()
Main Index
1506
Code Examples
db_count_job_name_list_entry ()
INTEGER i_analysis_code_id
STRING sv_jobname[80](VIRTUAL)
STRING sv_description[256](VIRTUAL)
INTEGER iv_jobname_id(VIRTUAL)
INTEGER iv_param_set_id(VIRTUAL)
INTEGER iv_status(VIRTUAL)
INTEGER i_count
INTEGER iv_step_id(VIRTUAL)
INTEGER iv_load_case_id(VIRTUAL)
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)
sys_allocate_array(sv_jobname,1,i_count)
sys_allocate_array(sv_description,1,i_count)
sys_allocate_array(iv_jobname_id,1,i_count)
sys_allocate_array(iv_param_set_id,1,i_count)
sys_allocate_array(iv_status,1,i_count)
i_return_value = @
db_get_jobnames_for_a_code @
( i_analysis_code_id,i_count,sv_jobname, @
iv_jobname_id ,sv_description, @
iv_param_set_id,iv_status )
dump i_return_value
#---------------------------------------------------------------------
# Call the function to count the load cases associated with the
# last job name.
i_jobname_id = iv_jobname_id(i_count)
#
i_return_value = @
db_count_job_name_list_entry @
( i_jobname_id, @
i_num_lists )
dump i_return_value
sys_allocate_array(iv_load_case_id,1,i_num_lists)
sys_allocate_array(iv_step_id,1,i_num_lists)
i_return_value = @
db_get_jobname_list_entries @
(i_jobname_id, @
i_count, @
iv_load_case_id, @
iv_step_id)
dump i_return_value
# The load case id and analysis step id associated with the job are.
dump iv_load_case_id,iv_step_id
db_count_job_names_for_a_code ()
#
# The function db_count_job_names_for_a_code()
# has the following arguments:
#
# db_count_job_names_for_a_code
# ( acode_id,
# num_acodes )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_acode_id
INTEGER i_num_acodes
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)
#
# Get the analysis code id(i_acode_id) of “MSC.Nastran”
i_return_value = @
db_get_anal_code_id( “MSC.Nastran”, i_acode_id )
dump i_return_value
dump i_acode_id
#
# Get the count of job names for the “MSC.Nastran” code id
i_return_value = @
db_count_job_names_for_a_code @
( i_acode_id, @
i_num_acodes )
dump i_return_value
dump i_num_acodes
#
# The number of available job names can also be seen on “Analysis”
# window form
#---------------------------------------------------------------------
db_count_param_set_entries ()
INTEGER i_analysis_code_id
INTEGER i_count
STRING sa_stepname[80](16)
INTEGER ia_step_id(16)
STRING sa_description[256](16)
INTEGER ia_param_id(16)
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)
#---------------------------------------------------------------------
# Using first parameter set.
i_param_id = ia_param_id(1)
dump i_param_id
i_return_value = @
db_count_param_set_entries @
( i_param_id, @
i_num_params )
dump i_return_value
db_count_steps_for_a_job ()
# The number of analysis steps for the last job and “MSC.Nastran” as
# analysis code are
dump i_num_steps
#---------------------------------------------------------------------
db_create_analysis_step ()
# db_create_analysis_step
# ( stepname,
# stepdesc,
# ac_id,
# step_id,
# param_set_id )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_stepname[80]
STRING s_stepdesc[256]
INTEGER i_ac_id
INTEGER i_step_id=0
INTEGER i_param_set_id
INTEGER i_return_value
INTEGER i_count,i_temp
STRING sa_stepname[80](16)
INTEGER ia_step_id(16)
STRING sa_description[256](16)
INTEGER ia_param_set_id(16)
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)
s_stepname= “pcl_example”
s_stepdesc= “Written as example for function db_create_analysis_step”
i_return_value = @
db_create_analysis_step @
( s_stepname, @
s_stepdesc, @
i_ac_id, @
i_step_id, @
i_param_set_id )
dump i_return_value
#---------------------------------------------------------------------
# Initialized to get maximum number of steps used in the database.
i_count= 16
#
i_return_value = @
db_get_analysis_steps @
( i_ac_id, @
i_count, @
sa_stepname, @
ia_step_id, @
sa_description, @
ia_param_set_id )
dump i_return_value
dump ia_step_id(i_temp)
dump sa_description(i_temp)
dump ia_param_set_id(i_temp)
END FOR
#---------------------------------------------------------------------
db_create_job_name ()
Main Index
CHAPTER 13 1513
Analysis
db_create_job_name_for_a_code ()
i_return_value = @
db_get_job_name_given_id( i_jobname_id, s_jobname )
dump i_return_value
dump s_jobname
#---------------------------------------------------------------------
db_create_job_name_list ()
STRING s_jobname[32]
INTEGER i_count
INTEGER iv_step_id(VIRTUAL)
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)
# Create a new job with “Session_Example” as name and get the job id.
s_jobname = “Session_Example”
i_return_value = db_create_job_name(s_jobname,i_jobname_id)
dump i_return_value
# Associating the three available load cases with the new job.
# The IDs of the three load cases are 1,2 and 3.
i_nbr_of_loadcases = 3
sys_allocate_array(iv_loadcase_ids,1,i_nbr_of_loadcases)
iv_loadcase_ids(1)=1
iv_loadcase_ids(2)=2
iv_loadcase_ids(3)=3
#
i_return_value = @
db_create_job_name_list @
( i_jobname_id, @
i_nbr_of_loadcases, @
iv_loadcase_ids )
Main Index
CHAPTER 13 1515
Analysis
dump i_return_value
#---------------------------------------------------------------------
# Get the entries in the jobname list created.
i_return_value = db_count_job_name_list_entry(i_jobname_id, i_count)
dump i_return_value,i_count
sys_allocate_array(iv_loadcase_ids,1,i_count)
sys_allocate_array(iv_step_id,1,i_count)
i_return_value = @
db_get_jobname_list_entries @
( i_jobname_id,i_count, @
iv_loadcase_ids ,iv_step_id )
dump i_return_value
sys_free_array(iv_loadcase_ids)
sys_free_array(iv_step_id)
#---------------------------------------------------------------------
db_create_job_name_list_entry ()
INTEGER i_analysis_code_id
INTEGER i_count,i_temp
STRING sa_stepname[80](8)
STRING s_jobname[80]
INTEGER ia_step_id(8)
INTEGER iv_step_id(VIRTUAL)
Main Index
1516
Code Examples
INTEGER iv_loadcase_ids(VIRTUAL)
STRING sa_description[256](8)
INTEGER ia_param_set_id(8)
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)
# Create a new job with “Session_Example” as name and get the job id.
s_jobname = “Session_Example”
i_return_value = db_create_job_name(s_jobname,i_jobname_id)
dump i_return_value
#---------------------------------------------------------------------
# Create 3 job name list entries with analysis step id as 2 and
# using load case id as 1,2 and 3
i_analysis_step_id = 2
#
FOR(i_count=1 TO 3)
i_load_case_id = i_count
i_return_value = @
db_create_job_name_list_entry @
( i_jobname_id, @
i_load_case_id, @
i_analysis_step_id )
dump i_return_value
END FOR
#---------------------------------------------------------------------
# Get the entries in the jobname list created.
i_return_value = @
db_count_job_name_list_entry @
( i_jobname_id, i_count )
dump i_return_value
# Number of loadcases associated with the job
dump i_count
sys_allocate_array(iv_loadcase_ids,1,i_count)
sys_allocate_array(iv_step_id,1,i_count)
i_return_value = @
db_get_jobname_list_entries @
( i_jobname_id,i_count, @
iv_loadcase_ids , @
iv_step_id )
dump i_return_value
sys_free_array(iv_loadcase_ids)
sys_free_array(iv_step_id)
#---------------------------------------------------------------------
Main Index
CHAPTER 13 1517
Analysis
db_create_param_set_entry ()
INTEGER i_count
STRING sv_param_name[80](VIRTUAL)
INTEGER iv_param_type(VIRTUAL)
REAL rv_param_real(VIRTUAL)
STRING sv_param_char[256](VIRTUAL)
INTEGER iv_param_int(VIRTUAL)
INTEGER i_analysis_code_id
INTEGER i_temp
STRING sa_stepname[80](16)
INTEGER ia_step_id(16)
STRING sa_description[256](16)
INTEGER ia_param_set_id(16)
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)
( i_analysis_code_id, @
i_count, @
sa_stepname, @
ia_step_id, @
sa_description, @
ia_param_set_id )
dump i_return_value
#---------------------------------------------------------------------
# Using the parameter set id for the first step.
i_param_set_id=ia_param_set_id(1)
# Initialized to get all parameters entries from the database.
i_return_value = db_count_param_set_entries(i_param_set_id,i_count)
dump i_return_value,i_count
sys_allocate_array(sv_param_name,1,i_count+1)
sys_allocate_array(iv_param_type,1,i_count+1)
sys_allocate_array(rv_param_real,1,i_count+1)
sys_allocate_array(sv_param_char,1,i_count+1)
sys_allocate_array(iv_param_int,1,i_count+1)
#
i_return_value = @
db_get_param_set_ent_pcl @
( i_param_set_id, @
i_count, @
sv_param_name, @
iv_param_type, @
rv_param_real, @
sv_param_char, @
iv_param_int )
dump i_return_value
#---------------------------------------------------------------------
# Initialized to get all parameter entries from the database.
i_return_value = db_count_param_set_entries(i_param_set_id,i_count)
dump i_return_value,i_count
#
i_return_value = @
db_get_param_set_ent_pcl @
( i_param_set_id, @
i_count, @
sv_param_name, @
Main Index
CHAPTER 13 1519
Analysis
iv_param_type, @
rv_param_real, @
sv_param_char, @
iv_param_int )
dump i_return_value
sys_free_array(sv_param_name)
sys_free_array(iv_param_type)
sys_free_array(rv_param_real)
sys_free_array(sv_param_char)
sys_free_array(iv_param_int)
#---------------------------------------------------------------------
# End of File
db_create_pset_matrix_entry ()
INTEGER i_count,i_temp
INTEGER i_analysis_code_id
STRING sa_stepname[80](16)
INTEGER ia_step_id(16)
STRING sa_description[256](16)
INTEGER ia_param_set_id(16)
Main Index
1520
Code Examples
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)
sys_allocate_array(rv_matrix,1,i_nrows*i_ncols)
FOR(i_temp=1 TO i_nrows*i_ncols)
rv_matrix(i_temp)=i_temp/3.0
END FOR
#---------------------------------------------------------------------
# Call the function to add a “parameter pset_Session_example”
i_return_value = @
db_create_pset_matrix_entry @
( i_param_set_id, @
s_param_name, @
i_nrows, @
i_ncols, @
rv_matrix )
dump i_return_value
sys_free_array(rv_matrix)
#---------------------------------------------------------------------
# Call the function to get the size of the matrix.
i_return_value = @
db_get_pset_matrix_size @
( i_param_set_id, @
s_param_name, @
i_nrows, @
i_ncols )
dump i_return_value
i_return_value = @
db_get_pset_matrix_entry @
( i_param_set_id, @
s_param_name, @
rv_matrix )
dump i_return_value
Main Index
CHAPTER 13 1521
Analysis
sys_free_array(rv_matrix)
#---------------------------------------------------------------------
db_delete_analysis_step_id ()
STRING s_stepname[80]
STRING s_stepdesc[256]
INTEGER i_param_set_id
INTEGER i_count,i_temp
STRING sa_stepname[80](16)
INTEGER ia_step_id(16)
STRING sa_description[256](16)
INTEGER ia_param_set_id(16)
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)
i_return_value = @
db_create_analysis_step @
( s_stepname, @
s_stepdesc, @
i_ac_id, @
i_step_id, @
i_param_set_id )
Main Index
1522
Code Examples
dump i_return_value
# The step id of the step created is
dump i_step_id
# The parameter set id of the step created is
dump i_param_set_id
#---------------------------------------------------------------------
# Initialized to get maximum number of steps used in the database.
i_count= 16
#
i_return_value = @
db_get_analysis_steps @
( i_ac_id, @
i_count, @
sa_stepname, @
ia_step_id, @
sa_description, @
ia_param_set_id )
dump i_return_value
#---------------------------------------------------------------------
# Initialized to get maximum number of steps used in the database.
i_count= 16
#
i_return_value = @
db_get_analysis_steps @
( i_ac_id, @
i_count, @
sa_stepname, @
ia_step_id, @
sa_description, @
ia_param_set_id )
dump i_return_value
Main Index
CHAPTER 13 1523
Analysis
db_delete_job_name ()
#---------------------------------------------------------------------
# Delete the first job name using it’s id
i_id = ia_job_name_ids(1)
i_return_value = @
db_delete_job_name @
( i_id )
dump i_return_value
#
# Get the count of all the job name ids
i_return_value = @
db_count_all_job_name_ids @
( i_nbr_of_jobnames )
dump i_return_value
dump i_nbr_of_jobnames
#---------------------------------------------------------------------
db_delete_job_name_list ()
INTEGER i_load_case_id
INTEGER i_analysis_step_id
INTEGER i_analysis_code_id
INTEGER i_count,i_temp
STRING sa_stepname[80](8)
STRING s_jobname[80]
INTEGER ia_step_id(8)
INTEGER iv_step_id(VIRTUAL)
INTEGER iv_loadcase_ids(VIRTUAL)
STRING sa_description[256](8)
INTEGER ia_param_set_id(8)
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)
# Create a new job with “Session_Example” as name and get the job id.
s_jobname = “Session_Example”
i_return_value = db_create_job_name(s_jobname,i_jobname_id)
Main Index
CHAPTER 13 1525
Analysis
dump i_return_value
#---------------------------------------------------------------------
# Create 3 job name list entries with analysis step id as 2 and
# using load case id as 1,2 and 3
i_analysis_step_id = 2
#
FOR(i_count=1 TO 3)
i_load_case_id = i_count
i_return_value = @
db_create_job_name_list_entry @
( i_jobname_id, @
i_load_case_id, @
i_analysis_step_id )
dump i_return_value
END FOR
#---------------------------------------------------------------------
# Get the entries in the jobname list created.
i_return_value = @
db_count_job_name_list_entry @
( i_jobname_id, i_count )
dump i_return_value
# Number of loadcases associated with the job
dump i_count
sys_allocate_array(iv_loadcase_ids,1,i_count)
sys_allocate_array(iv_step_id,1,i_count)
i_return_value = @
db_get_jobname_list_entries @
( i_jobname_id,i_count, @
iv_loadcase_ids , @
iv_step_id )
dump i_return_value
sys_free_array(iv_loadcase_ids)
sys_free_array(iv_step_id)
#---------------------------------------------------------------------
Main Index
1526
Code Examples
db_delete_param_set_entries ()
INTEGER i_count
STRING sv_param_name[80](VIRTUAL)
INTEGER iv_param_type(VIRTUAL)
REAL rv_param_real(VIRTUAL)
STRING sv_param_char[256](VIRTUAL)
INTEGER iv_param_int(VIRTUAL)
INTEGER i_analysis_code_id
INTEGER i_temp
STRING sa_stepname[80](16)
INTEGER ia_step_id(16)
STRING sa_description[256](16)
INTEGER ia_param_set_id(16)
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)
#---------------------------------------------------------------------
# Using the parameter set id for the first step.
Main Index
CHAPTER 13 1527
Analysis
i_param_set_id=ia_param_set_id(1)
# Initialized to get all parameter entries from the database.
i_return_value = db_count_param_set_entries(i_param_set_id,i_count)
dump i_return_value,i_count
sys_allocate_array(sv_param_name,1,i_count)
sys_allocate_array(iv_param_type,1,i_count)
sys_allocate_array(rv_param_real,1,i_count)
sys_allocate_array(sv_param_char,1,i_count)
sys_allocate_array(iv_param_int,1,i_count)
#
i_return_value = @
db_get_param_set_ent_pcl @
( i_param_set_id, @
i_count, @
sv_param_name, @
iv_param_type, @
rv_param_real, @
sv_param_char, @
iv_param_int )
dump i_return_value,i_count
i_return_value = @
db_get_param_set_ent_pcl @
( i_param_set_id, @
i_count, @
sv_param_name, @
iv_param_type, @
rv_param_real, @
sv_param_char, @
iv_param_int )
# The zero value for i_count indicates that all entries are deleted.
# This function will return an error code of 13000072
# (“Unmatched count”) which in this case indicates that the
# parameter set is undefined.
dump i_return_value,i_count
sys_free_array(sv_param_name)
sys_free_array(iv_param_type)
sys_free_array(rv_param_real)
sys_free_array(sv_param_char)
sys_free_array(iv_param_int)
#---------------------------------------------------------------------
Main Index
1528
Code Examples
db_delete_param_set_entry ()
INTEGER i_count
STRING sv_param_name[80](VIRTUAL)
INTEGER iv_param_type(VIRTUAL)
REAL rv_param_real(VIRTUAL)
STRING sv_param_char[256](VIRTUAL)
INTEGER iv_param_int(VIRTUAL)
INTEGER i_analysis_code_id
INTEGER i_temp
STRING sa_stepname[80](16)
INTEGER ia_step_id(16)
STRING sa_description[256](16)
INTEGER ia_param_set_id(16)
STRING s_param_name[80]
INTEGER i_param_type
REAL r_param_real
STRING s_param_char[256]
INTEGER i_param_int
INTEGER i_return_value
#---------------------------------------------------------------------
#Open the database “plate.db”
uil_file_open.go(“plate.db”)
ia_step_id, @
sa_description, @
ia_param_set_id )
dump i_return_value
#---------------------------------------------------------------------
# Using the parameter set id for the first step.
i_param_set_id=ia_param_set_id(1)
#---------------------------------------------------------------------
s_param_name=”Session_Example”
i_param_type=3
r_param_real=1.33465e-5
s_param_char=””
i_param_int=0
#
i_return_value = @
db_create_param_set_entry @
( i_param_set_id, @
s_param_name, @
i_param_type, @
r_param_real, @
s_param_char, @
i_param_int )
dump i_return_value
#---------------------------------------------------------------------
# Initialized to get all parameter entries from the database.
i_return_value = db_count_param_set_entries(i_param_set_id,i_count)
dump i_return_value,i_count
sys_allocate_array(sv_param_name,1,i_count)
sys_allocate_array(iv_param_type,1,i_count)
sys_allocate_array(rv_param_real,1,i_count)
sys_allocate_array(sv_param_char,1,i_count)
sys_allocate_array(iv_param_int,1,i_count)
#
i_return_value = @
db_get_param_set_ent_pcl @
( i_param_set_id, @
i_count, @
sv_param_name, @
iv_param_type, @
rv_param_real, @
sv_param_char, @
iv_param_int )
dump i_return_value,i_count
dump s_name
#
i_return_value = @
db_delete_param_set_entry @
( i_param_set_id, @
s_name )
dump i_return_value
Main Index
1530
Code Examples
#---------------------------------------------------------------------
i_return_value = @
db_get_param_set_ent_pcl @
( i_param_set_id, @
i_count, @
sv_param_name, @
iv_param_type, @
rv_param_real, @
sv_param_char, @
iv_param_int )
dump i_return_value,i_count
sys_free_array(sv_param_name)
sys_free_array(iv_param_type)
sys_free_array(rv_param_real)
sys_free_array(sv_param_char)
sys_free_array(iv_param_int)
#---------------------------------------------------------------------
db_get_all_anal_codes ()
dump next_status
dump s_name
END WHILE
#---------------------------------------------------------------------
db_get_all_anal_types ()
s_name=”MSC.Nastran”
#
i_return_value = @
db_get_all_anal_types @
( s_name )
dump i_return_value
#---------------------------------------------------------------------
# Count the number of analysis types.
i_return_value = db_count_anal_types(s_name,i_count)
dump i_return_value
#---------------------------------------------------------------------
# Sequentially accessing the analysis types
FOR(i_temp=1 TO i_count)
s_name=”MSC.Nastran”
i_return_value = @
db_get_next_anal_type @
( s_name )
dump i_return_value
dump s_name
END FOR
#---------------------------------------------------------------------
Main Index
1532
Code Examples
db_get_all_job_name_ids ()
i_return_value = @
db_get_all_job_name_ids @
( i_max_count, @
i_nbr_of_jobnames, @
iv_id )
dump i_return_value
dump iv_id
sys_free_array ( iv_id )
#---------------------------------------------------------------------
Main Index
CHAPTER 13 1533
Analysis
db_get_all_job_names ()
db_get_anal_code_id ()
# ( name,
# id )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
INTEGER i_id
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Get the analysis code id for “MSC.Nastran”
s_name = “MSC.Nastran”
i_return_value = @
db_get_anal_code_id @
( s_name, @
i_id )
dump i_return_value
dump i_id
#
# Get the analysis code id for “ABAQUS”
s_name = “ABAQUS”
i_return_value = @
db_get_anal_code_id @
( s_name, @
i_id )
dump i_return_value
dump i_id
#---------------------------------------------------------------------
db_get_anal_code_name ()
#
# Get the analysis code name for id = 1
i_id = 1
i_return_value = @
db_get_anal_code_name @
( i_id, @
s_name )
dump i_return_value
dump s_name
db_get_anal_type_id ()
db_get_anal_type_id @
( s_name, @
i_id )
dump i_return_value
dump i_id
#---------------------------------------------------------------------
db_get_anal_type_name ()
Main Index
CHAPTER 13 1537
Analysis
db_get_analysis_steps ()
dump ia_param_set_id(i_temp)
END FOR
#---------------------------------------------------------------------
db_get_at_for_ac ()
db_get_default_anal_code ()
# ( name )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new data base “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Get the default analysis code name
i_return_value = @
db_get_default_anal_code @
( s_name )
dump i_return_value
dump s_name
#---------------------------------------------------------------------
db_get_default_anal_type ()
db_get_id_given_job_name ()
#
# This illustration opens the data base
# “plate.db”, gets the array of jobnames, and
# the ids for two job names.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_id_given_job_name ( )
# has the following arguments:
#
# db_get_id_given_job_name
# ( jobname,
# id )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_jobname[128]
INTEGER i_id
INTEGER i_return_value
INTEGER i_analysis_code_id, i_max
INTEGER ia_job_name_ids(2)
STRING sa_jobnames[128](2)
STRING sa_description[512](2)
INTEGER ia_param_set_ids(2)
INTEGER ia_status_array(2)
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)
#
# Get the code id for “MSC.Nastran”
i_return_value = @
db_get_anal_code_id ( “MSC.Nastran”, i_analysis_code_id )
dump i_return_value
dump i_analysis_code_id
#
# Get the two Job names and ids for this analysis code
i_max = 2
i_return_value = @
db_get_jobnames_for_a_code @
( i_analysis_code_id, @
i_max, @
sa_jobnames, @
ia_job_name_ids, @
sa_description, @
ia_param_set_ids, @
ia_status_array )
dump i_return_value
dump ia_job_name_ids
dump sa_jobnames
#
# Get the id of the first job name
s_jobname = sa_jobnames(1)
i_return_value = @
db_get_id_given_job_name @
( s_jobname, @
i_id )
dump i_return_value
dump i_id
i_id )
dump i_return_value
dump i_id
#---------------------------------------------------------------------
db_get_id_given_job_name_code ()
s_jobname = sa_jobnames(1)
i_return_value = @
db_get_id_given_job_name_code @
( i_acode, @
s_jobname, @
i_id )
dump i_return_value
dump i_id
#
# Get the id of the second job name
s_jobname = sa_jobnames(2)
i_return_value = @
db_get_id_given_job_name_code @
( i_acode, @
s_jobname, @
i_id )
dump i_return_value
dump i_id
#---------------------------------------------------------------------
db_get_id_given_load_case_name ()
i_return_value = @
asm_transform_grid_translate( “2”, @
“<1 0 0>”, @
“Coord 0”, @
1, @
FALSE, @
FALSE, @
“[0 0 0]”, @
sgm_transform_point_created_ids )
dump i_return_value
#
# Create Bar element connecting two points
#
i_return_value = @
fem_create_elems( “Bar “, “Bar2”, “1”, “Standard”, @
TRUE, “Point 1 “, “Point 2 “, ““, @
““, ““, ““, ““, ““, @
fem_create_elemen_elems_created )
dump i_return_value
#
# Create the load/boundary condition set “Fix” for fixing one
# end of the bar.
#
i_return_value = @
loadsbcs_create( “Fix”, “Displacement”, “Nodal”, @
““, “Static”, [“Node 1”], @
“FEM”, “Coord 0”, 1., [“<0 0 0>”, @
“<0 0 0>”], [““, ““] )
dump i_return_value
#
# Create the load case “New_Load_Case” consisting of
# the load/boundary condition set “Fix”
#
i_return_value = @
loadcase_create2( “New_Load_Case”, “Static”, ““, @
1., [“Fix”], [0], [1.], ““, @
0., TRUE )
dump i_return_value
#
# Get the id of the load case “New_Load_Case”
s_load_case_name = “New_Load_Case”
i_return_value = @
db_get_id_given_load_case_name @
( s_load_case_name, @
i_load_case_id )
dump i_return_value
dump i_load_case_id
#
sys_free_string ( asm_create_grid_xyz_created_ids )
sys_free_string ( sgm_transform_point_created_ids )
sys_free_string ( fem_create_elemen_elems_created )
#---------------------------------------------------------------------
db_get_id_given_step_name ()
i_return_value = @
db_get_analysis_steps @
( i_acode, @
i_count, @
sa_stepname, @
ia_step_id, @
sa_description, @
ia_param_set_id )
dump i_return_value
#---------------------------------------------------------------------
# Selecting the last step name
s_stepname = sa_stepname(i_count)
i_return_value = @
db_get_id_given_step_name @
( i_acode, @
s_stepname, @
i_id )
dump i_return_value
# The step name is
dump s_stepname
# The corresponding step id is
dump i_id
#---------------------------------------------------------------------
Main Index
CHAPTER 13 1545
Analysis
db_get_job_info ()
i_return_value = @
db_get_jobnames_for_a_code @
( i_analysis_code_id, @
i_max, @
sa_jobnames, @
ia_job_name_ids, @
sa_description, @
ia_param_set_ids, @
ia_status_array )
dump i_return_value
dump ia_job_name_ids
dump ia_param_set_ids
dump ia_status_array
Main Index
1546
Code Examples
dump sa_description
#---------------------------------------------------------------------
# Get the information of the jobs.
FOR ( i_count = 1 to 2 )
i_jobname_id = ia_job_name_ids ( i_count )
i_return_value = @
db_get_job_info @
( i_analysis_code_id, @
i_jobname_id, @
s_jobname, @
s_description, @
i_param_set_id, @
i_status )
dump i_return_value
dump s_jobname
dump s_description
dump i_param_set_id
dump i_status
END FOR
#---------------------------------------------------------------------
db_get_job_name_given_id ()
dump i_analysis_code_id
#
# Get the two Job names and ids for this analysis code
i_max = 2
i_return_value = @
db_get_jobnames_for_a_code @
( i_analysis_code_id, @
i_max, @
sa_jobnames, @
ia_job_name_ids, @
sa_description, @
ia_param_set_ids, @
ia_status_array )
dump i_return_value
dump ia_job_name_ids
dump sa_jobnames
#
# Get the name of the first job id
i_id = ia_job_name_ids(1)
i_return_value = @
db_get_job_name_given_id @
( i_id, @
s_name )
dump i_return_value
dump s_name
#
# Get the name of the second job id
i_id = ia_job_name_ids(2)
i_return_value = @
db_get_job_name_given_id @
( i_id, @
s_name )
dump i_return_value
dump s_name
#---------------------------------------------------------------------
db_get_jobname_list_entries ()
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_jobname_id
INTEGER i_count
INTEGER iv_step_id(VIRTUAL)
INTEGER iv_load_case_id(VIRTUAL)
INTEGER i_return_value
INTEGER i_num_lists
INTEGER i_analysis_code_id
STRING sv_jobname[80](VIRTUAL)
STRING sv_description[256](VIRTUAL)
INTEGER iv_jobname_id(VIRTUAL)
INTEGER iv_param_set_id(VIRTUAL)
INTEGER iv_status(VIRTUAL)
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)
sys_allocate_array(sv_jobname,1,i_count)
sys_allocate_array(sv_description,1,i_count)
sys_allocate_array(iv_jobname_id,1,i_count)
sys_allocate_array(iv_param_set_id,1,i_count)
sys_allocate_array(iv_status,1,i_count)
i_return_value= @
db_get_jobnames_for_a_code(i_analysis_code_id,i_count,sv_jobname, @
iv_jobname_id ,sv_description,iv_param_set_id,iv_status)
dump i_return_value
#---------------------------------------------------------------------
# Call the function to count the number of load cases associated with
# the last job.
i_jobname_id = iv_jobname_id(i_count)
#
i_return_value = @
db_count_job_name_list_entry @
( i_jobname_id, @
i_num_lists )
dump i_return_value
# The number of load cases associated with the job are.
dump i_num_lists
#---------------------------------------------------------------------
# Call the function to get the load case IDs of the last job.
i_count = i_num_lists
sys_allocate_array(iv_load_case_id,1,i_num_lists)
sys_allocate_array(iv_step_id,1,i_num_lists)
i_return_value = @
db_get_jobname_list_entries @
(i_jobname_id, @
i_count, @
iv_load_case_id, @
iv_step_id)
dump i_return_value
# The load case id and analysis step id associated with the job are.
dump iv_load_case_id,iv_step_id
Main Index
CHAPTER 13 1549
Analysis
db_get_jobnames_for_a_code ()
dump i_return_value
dump i_count
#
SYS_ALLOCATE_ARRAY( iv_status, 1, i_count )
SYS_ALLOCATE_ARRAY( iv_param_set_id, 1, i_count )
SYS_ALLOCATE_ARRAY( iv_jobname_id, 1, i_count )
SYS_ALLOCATE_ARRAY( sav_description, 1, i_count )
SYS_ALLOCATE_ARRAY( sav_jobname, 1, i_count )
#
# Get the array of job names
i_return_value = @
db_get_jobnames_for_a_code @
( i_analysis_code_id, @
i_count, @
sav_jobname, @
iv_jobname_id, @
sav_description, @
iv_param_set_id, @
iv_status )
dump i_return_value
db_get_last_jobname ()
INTEGER ia_job_name_ids(2)
STRING sa_jobnames[128](2)
STRING sa_description[512](2)
INTEGER ia_param_set_ids(2)
INTEGER ia_status_array(2)
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)
#
# Get the code id for “MSC.Nastran”
i_return_value = @
db_get_anal_code_id( “MSC.Nastran”, i_analysis_code_id )
dump i_return_value
dump i_analysis_code_id
#
# Get the two Job names for this analysis code
i_max = 2
i_return_value = @
db_get_jobnames_for_a_code @
( i_analysis_code_id, @
i_max, @
sa_jobnames, @
ia_job_name_ids, @
sa_description, @
ia_param_set_ids, @
ia_status_array )
dump i_return_value
# The Job names array
dump sa_jobnames
#
# Set the sa_jobnames(1) as the last job name
s_jobname = sa_jobnames(1)
i_return_value = @
db_assign_last_jobname @
( s_jobname )
dump i_return_value
#
# Get the last job name
i_return_value = @
db_get_last_jobname(s_jobname)
dump i_return_value
dump s_jobname
#
# Now set the sa_jobnames(2) as the last job name
s_jobname = sa_jobnames(2)
i_return_value = @
db_assign_last_jobname @
( s_jobname )
dump i_return_value
#
# Now get the newly set last job name
i_return_value = @
db_get_last_jobname ( s_jobname )
dump i_return_value
dump s_jobname
#---------------------------------------------------------------------
db_get_next_anal_code ()
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_next_anal_code() has the following arguments:
# db_get_next_anal_code
# ( name )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_name[32]
INTEGER i_return_value
INTEGER all_status
INTEGER next_status = 0
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#
# Get all the analysis codes from the database
all_status = db_get_all_anal_codes()
dump all_status
#
# Get the analysis code from the database
WHILE ( next_status == 0 )
next_status = @
db_get_next_anal_code @
( s_name )
dump next_status
dump s_name
END WHILE
#---------------------------------------------------------------------
db_get_next_anal_type ()
uil_file_open.go(“plate.db”)
s_name=”MSC.Nastran”
#
i_return_value = @
db_get_all_anal_types @
( s_name )
dump i_return_value
#---------------------------------------------------------------------
# Count the number of analysis types.
i_return_value = db_count_anal_types(s_name,i_count)
dump i_return_value
#---------------------------------------------------------------------
# Sequentially accessing the analysis types
FOR(i_temp=1 TO i_count)
s_name=”MSC.Nastran”
i_return_value = @
db_get_next_anal_type @
( s_name )
dump i_return_value
dump s_name
END FOR
#---------------------------------------------------------------------
db_get_next_job_name ()
dump next_status
dump s_jobname
END WHILE
#
#---------------------------------------------------------------------
db_get_param_set_ent_pcl ()
INTEGER i_analysis_code_id
INTEGER i_temp
STRING sa_stepname[80](16)
INTEGER ia_step_id(16)
STRING sa_description[256](16)
INTEGER ia_param_set_id(16)
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)
ia_step_id, @
sa_description, @
ia_param_set_id )
dump i_return_value
#---------------------------------------------------------------------
# Using the parameter set id for the first step.
i_param_set_id = ia_param_set_id(1)
# Initialized to get all parameter entries from the database.
i_return_value = db_count_param_set_entries(i_param_set_id,i_count)
dump i_return_value,i_count
sys_allocate_array(sv_param_name,1,i_count)
sys_allocate_array(iv_param_type,1,i_count)
sys_allocate_array(rv_param_real,1,i_count)
sys_allocate_array(sv_param_char,1,i_count)
sys_allocate_array(iv__param_int,1,i_count)
#
i_return_value = @
db_get_param_set_ent_pcl @
( i_param_set_id, @
i_count, @
sv_param_name, @
iv_param_type, @
rv_param_real, @
sv_param_char, @
iv__param_int )
dump i_return_value,i_count
sys_free_array(sv_param_name)
sys_free_array(iv_param_type)
sys_free_array(rv_param_real)
sys_free_array(sv_param_char)
sys_free_array(iv__param_int)
#---------------------------------------------------------------------
db_get_param_set_entries ()
#
# db_get_param_set_entries
# ( param_set_id,
# count,
# param_name,
# param_type,
# param_real,
# param_char,
# param_int )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_param_set_id
INTEGER i_count
STRING sv_param_name[80](VIRTUAL)
INTEGER iv_param_type(VIRTUAL)
REAL rv_param_real(VIRTUAL)
STRING sv_param_char[256](VIRTUAL)
INTEGER iv_param_int(VIRTUAL)
INTEGER i_return_value
INTEGER i_analysis_code_id
INTEGER i_temp
STRING sa_stepname[80](16)
INTEGER ia_step_id(16)
STRING sa_description[256](16)
INTEGER ia_param_set_id(16)
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)
sys_allocate_array(sv_param_name,1,i_count)
sys_allocate_array(iv_param_type,1,i_count)
sys_allocate_array(rv_param_real,1,i_count)
sys_allocate_array(sv_param_char,1,i_count)
sys_allocate_array(iv_param_int,1,i_count)
i_return_value = @
db_get_param_set_entries @
( i_param_set_id, @
i_count, @
sv_param_name, @
iv_param_type, @
Main Index
CHAPTER 13 1557
Analysis
rv_param_real, @
sv_param_char, @
iv_param_int )
dump i_return_value,i_count
sys_free_array(sv_param_name)
sys_free_array(iv_param_type)
sys_free_array(rv_param_real)
sys_free_array(sv_param_char)
sys_free_array(iv_param_int)
#---------------------------------------------------------------------
db_get_param_set_entry ()
INTEGER i_count
STRING sv_param_name[80](VIRTUAL)
INTEGER iv_param_type(VIRTUAL)
REAL rv_param_real(VIRTUAL)
STRING sv_param_char[256](VIRTUAL)
Main Index
1558
Code Examples
INTEGER iv_param_int(VIRTUAL)
INTEGER i_analysis_code_id
INTEGER i_temp
STRING sa_stepname[80](16)
INTEGER ia_step_id(16)
STRING sa_description[256](16)
INTEGER ia_param_set_id(16)
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)
#---------------------------------------------------------------------
# Using the parameter set id for the first step.
i_param_set_id=ia_param_set_id(1)
# Initialized to get all parameter entries from the database.
i_return_value = db_count_param_set_entries(i_param_set_id,i_count)
dump i_return_value,i_count
sys_allocate_array(sv_param_name,1,i_count)
sys_allocate_array(iv_param_type,1,i_count)
sys_allocate_array(rv_param_real,1,i_count)
sys_allocate_array(sv_param_char,1,i_count)
sys_allocate_array(iv_param_int,1,i_count)
#
i_return_value = @
db_get_param_set_ent_pcl @
( i_param_set_id, @
i_count, @
sv_param_name, @
iv_param_type, @
rv_param_real, @
sv_param_char, @
iv_param_int )
dump i_return_value
#---------------------------------------------------------------------
# Displaying details for the first parameter name.
s_param_name=sv_param_name(1)
#
i_return_value = @
db_get_param_set_entry @
( i_param_set_id, @
s_param_name, @
i_param_type, @
r_param_real, @
s_param_char, @
Main Index
CHAPTER 13 1559
Analysis
i_param_int )
dump i_return_value
sys_free_array(sv_param_name)
sys_free_array(iv_param_type)
sys_free_array(rv_param_real)
sys_free_array(sv_param_char)
sys_free_array(iv_param_int)
#---------------------------------------------------------------------
db_get_pset_matrix_entry ()
INTEGER i_count,i_temp
INTEGER i_analysis_code_id
STRING sa_stepname[80](16)
INTEGER ia_step_id(16)
STRING sa_description[256](16)
INTEGER ia_param_set_id(16)
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)
#---------------------------------------------------------------------
# Initialized to get maximum number of steps used in the database.
i_count = 16
#
i_return_value = @
db_get_analysis_steps @
( i_analysis_code_id, @
i_count, @
sa_stepname, @
ia_step_id, @
sa_description, @
ia_param_set_id )
dump i_return_value
#---------------------------------------------------------------------
# Using the parameter set id for the first step.
i_param_set_id=ia_param_set_id(1)
s_param_name=”pset_Session_example”
i_nrows=4
i_ncols=3
sys_allocate_array(rv_matrix,1,i_nrows*i_ncols)
FOR(i_temp=1 TO i_nrows*i_ncols)
rv_matrix(i_temp)=i_temp/3.0
END FOR
#---------------------------------------------------------------------
# Call the function to add a “parameter pset_Session_example”
i_return_value = @
db_create_pset_matrix_entry @
( i_param_set_id, @
s_param_name, @
i_nrows, @
i_ncols, @
rv_matrix )
dump i_return_value
sys_free_array(rv_matrix)
#---------------------------------------------------------------------
# Call the function to get the size of the matrix.
i_return_value = @
db_get_pset_matrix_size @
( i_param_set_id, @
s_param_name, @
i_nrows, @
i_ncols )
dump i_return_value
i_return_value = @
db_get_pset_matrix_entry @
( i_param_set_id, @
s_param_name, @
rv_matrix )
dump i_return_value
sys_free_array(rv_matrix)
#---------------------------------------------------------------------
Main Index
CHAPTER 13 1561
Analysis
db_get_pset_matrix_size ()
INTEGER i_count,i_temp
INTEGER i_analysis_code_id
STRING sa_stepname[80](16)
INTEGER ia_step_id(16)
STRING sa_description[256](16)
INTEGER ia_param_set_id(16)
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)
i_nrows=4
i_ncols=3
sys_allocate_array(rv_matrix,1,i_nrows*i_ncols)
FOR(i_temp=1 TO i_nrows*i_ncols)
rv_matrix(i_temp)=i_temp/3.0
END FOR
#---------------------------------------------------------------------
# Call the function to add a “parameter pset_Session_example”
i_return_value = @
db_create_pset_matrix_entry @
( i_param_set_id, @
s_param_name, @
i_nrows, @
i_ncols, @
rv_matrix )
dump i_return_value
sys_free_array(rv_matrix)
#---------------------------------------------------------------------
# Call the function to get the size of the matrix.
i_return_value = @
db_get_pset_matrix_size @
( i_param_set_id, @
s_param_name, @
i_nrows, @
i_ncols )
dump i_return_value
i_return_value = @
db_get_pset_matrix_entry @
( i_param_set_id, @
s_param_name, @
rv_matrix )
dump i_return_value
sys_free_array(rv_matrix)
#---------------------------------------------------------------------
db_get_step_info ()
INTEGER i_count
STRING sa_stepname[80](16)
INTEGER ia_step_id(16)
STRING sa_description[256](16)
INTEGER ia_param_set_id(16)
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)
# The step id, name, description and parameter set id in sequence are
dump i_step_id
dump s_stepname
dump s_description
dump i_param_set_id
#---------------------------------------------------------------------
Main Index
1564
Code Examples
db_get_steps_for_a_job ()
( i_analysis_code_id, @
i_jobname_id, @
i_count, @
sa_stepname, @
ia_step_id, @
sa_description, @
ia_param_set_id )
dump i_return_value
# The analysis steps are listed in sequence as- name, id, description
# and parameter set id.
FOR (i_temp=1 TO i_count)
dump sa_stepname(i_temp)
dump ia_step_id(i_temp)
dump sa_description(i_temp)
dump ia_param_set_id(i_temp)
END FOR
#---------------------------------------------------------------------
db_set_at_for_ac ()
( s_anal_code, @
s_anal_type )
dump i_return_value
db_set_default_anal_code ()
dump i_return_value
dump s_name
#
# The user can also verify the analysis preferences
# for the name of the default analysis code
#---------------------------------------------------------------------
db_set_default_anal_type ()
Main Index
1568
Code Examples
db_set_model_file_suffix ()
Main Index
CHAPTER 13 1569
Analysis
db_set_pref ()
i_return_value = @
db_get_pref @
( i_pref_id, @
i_data_type, @
i_int_pref, @
l_log_pref, @
r_real_pref, @
s_char_pref )
Main Index
1570
Code Examples
dump i_return_value
#---------------------------------------------------------------------
# Set the value and data type of the preference ID 105 to a
# real value.
# i_data_type = 3 (Real preference)
i_data_type = 3
r_real_pref=1.9845e2
#
i_return_value = @
db_set_pref @
( i_pref_id, @
i_data_type, @
i_int_pref, @
l_log_pref, @
r_real_pref, @
s_char_pref )
dump i_return_value
#---------------------------------------------------------------------
# Get the value/data type of the preference ID 105.
i_return_value = @
db_get_pref @
( i_pref_id, @
i_data_type, @
i_int_pref, @
l_log_pref, @
r_real_pref, @
s_char_pref )
dump i_return_value
#---------------------------------------------------------------------
db_set_results_file_suffix ()
db_update_analysis_step ()
# stepdesc,
# param_set_id )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_analysis_code_id
INTEGER i_analysis_step_id
INTEGER i_param_set_id
INTEGER i_return_value
STRING s_stepname[80]
STRING s_stepdesc[256]
INTEGER i_count,i_temp
STRING sa_stepname[80](16)
INTEGER ia_analysis_step_id(16)
STRING sa_stepdesc[256](16)
INTEGER ia_param_set_id(16)
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)
i_return_value = @
db_get_analysis_steps @
( i_analysis_code_id, @
i_count, @
sa_stepname, @
ia_analysis_step_id, @
sa_stepdesc, @
ia_param_set_id )
dump i_return_value
db_update_jobname_for_a_code ()
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_analysis_code_id
STRING s_jobname[32]
STRING s_description[128]
INTEGER i_status
INTEGER i_jobname_id
INTEGER i_param_set_id
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “plate.db”
uil_file_open.go(“plate.db”)
#
# Get the analysis code id for “MSC.Nastran”
i_return_value = @
db_get_anal_code_id( “MSC.Nastran”, i_analysis_code_id )
dump i_return_value
dump i_analysis_code_id
#
# Create the new job name for “MSC.Nastran”
# The job name is “new_job”
s_jobname = “new_job”
# The description for the the new job
s_description = “The new job for NASTRAN analysis code”
# The status of the new job
i_status = 0
i_return_value = @
db_create_job_name_for_a_code @
( i_analysis_code_id, @
s_jobname, @
s_description, @
i_status, @
i_jobname_id, @
i_param_set_id )
dump i_return_value
dump i_jobname_id
#
# Get the job info of the newly created job name
i_return_value = @
db_get_job_info @
( i_analysis_code_id, @
i_jobname_id, @
s_jobname, @
s_description, @
i_param_set_id, @
i_status )
dump i_return_value
dump s_jobname
dump s_description
dump i_status
dump i_param_set_id
#
# Change the name, description and the status of the job “new_job”
s_jobname = “changed_name”
s_description = “This is the updated job name for the NASTRAN code”
i_status = 1
i_return_value = @
db_update_jobname_for_a_code @
( i_analysis_code_id, @
s_jobname, @
s_description, @
i_status, @
i_jobname_id, @
i_param_set_id )
dump i_return_value
# The param set id which was updated
Main Index
CHAPTER 13 1575
Analysis
dump i_param_set_id
#
# Get the job info of the updated job name
i_return_value = @
db_get_job_info @
( i_analysis_code_id, @
i_jobname_id, @
s_jobname, @
s_description, @
i_param_set_id, @
i_status )
dump i_return_value
dump s_jobname
dump s_description
dump i_param_set_id
dump i_status
#---------------------------------------------------------------------
jobfile.close ()
INTEGER i_return_status = 1
STRING filespec[128]
#---------------------------------------------------------------------
# Open a new database "new.db"
uil_file_new.go( "","new.db" )
#---------------------------------------------------------------------
# Opens the jobfile
#---------------------------------------------------------------------
# Write the various parameter in the file
#---------------------------------------------------------------------
# Close the file new.jbr
Main Index
1576
Code Examples
jobfile.close( )
#---------------------------------------------------------------------
# Checks the existence of the file new.jbr.
# This file name is obtained after the file is opened.
file_build_fname("","new","jbr","O",filespec)
dump filespec
#--------------------------------------------------------------------
# Close the file new.db
uil_file_close.goquit()
#--------------------------------------------------------------------
jobfile.create_matrix ()
IF(!db_is_open()) THEN
uil_file_new.go("","new.db")
ENDIF
$? YES 36000002
Main Index
CHAPTER 13 1577
Analysis
#---------------------------------------------------------------------
# Opening the jobfile with the name 'new.jba'.
#---------------------------------------------------------------------
# Deleting Old result and jobfiles.
#---------------------------------------------------------------------
# Using the function jobfile.writeSS() to create the matrix
# label and the size of the matrix.
s_label = "matrix_label"
i_matrix_dim(1) = 1
i_matrix_dim(2) = 2
jobfile.writeSS @
( s_label, @
i_matrix_dim )
#---------------------------------------------------------------------
# Using the function jobfile.create_matrix() to writeSS() to
# create the matrix label and the matrix array.
i_num_vals = 2
ra_values = [ 12.5 , -12.3 ]
i_return_value = jobfile.create_matrix @
( ra_values, @
i_num_vals )
dump i_return_value
#---------------------------------------------------------------------
# Closing the jobfile.
jobfile.close( )
#---------------------------------------------------------------------
# Getting the parameter set id corresponding to this matrix dump.
i_analysis_code_id = 1
i_count = 1
i_return_value = db_get_jobnames_for_a_code @
(
i_analysis_code_id, @
i_count, @
sa_jobname, @
ia_jobname_id, @
sa_description, @
ia_param_set_id, @
ia_status )
dump i_return_value
dump ia_param_set_id
#---------------------------------------------------------------------
# Getting the matrix size.
i_param_set_id = ia_param_set_id(1)
s_param_name = "matrix_label"
i_return_value = @
db_get_pset_matrix_size @
( i_param_set_id, @
s_param_name, @
i_nrows, @
i_ncols )
Main Index
1578
Code Examples
sys_allocate_array(rv_matrix_out,1,i_size)
i_return_value = @
db_get_pset_matrix_entry @
( i_param_set_id, @
s_param_name, @
rv_matrix_out )
dump rv_matrix_out
#---------------------------------------------------------------------
sys_free_array(rv_matrix_out)
# End of File.
jobfile.open ()
INTEGER i_return_status = 1
#---------------------------------------------------------------------
# Open a new database "new.db"
uil_file_new.go( "","new.db" )
#---------------------------------------------------------------------
# Opens the jobfile
#---------------------------------------------------------------------
#Write the various parameter in the file
#---------------------------------------------------------------------
# Close the file new.jbr
jobfile.close()
#--------------------------------------------------------------------
# Close the file new.db
uil_file_close.goquit()
#--------------------------------------------------------------------
jobfile.set_job_status ()
# ( i_job_status,
# s_msg_string )
#
#---------------------------------------------------------------------
# Opening a new database
IF(!db_is_open()) THEN
uil_file_new.go("","new.db")
ENDIF
$? YES 36000002
#---------------------------------------------------------------------
# Variable Decelerations
INTEGER i_status = 2
INTEGER i_job_status = 50
LOGICAL l_status = FALSE
STRING s_msg_string[32] = "TEST MESSAGE"
#---------------------------------------------------------------------
# Opening a jobfile.
jobfile.open("new","ANALYZE")
#---------------------------------------------------------------------
# Calling the function jobfile.set_job_status to set the job status
# value for the job.
l_status = jobfile.set_job_status(i_job_status,s_msg_string)
dump l_status
#---------------------------------------------------------------------
# Closing the jobfile.
i_status = jobfile.close()
$? NO 50
dump i_status
#---------------------------------------------------------------------
# End of File.
jobfile.writec
# Variable Declarations
INTEGER i_return_status = 1
#---------------------------------------------------------------------
# Open a new database "new.db"
uil_file_new.go( "","new.db" )
#---------------------------------------------------------------------
# Opens the jobfile
#
#---------------------------------------------------------------------
# Delete the old files - .bdf and .op2 files.
#---------------------------------------------------------------------
#Write the various parameter in the file
#---------------------------------------------------------------------
# Using the jobfile.writec function to write text in the output file
# The format is jobfile.writec("str_1","str_2 ") writes the following
# to the output file : str_1 = str 2.
# for jobfile.writec("",str_2), the output is str_2.
#---------------------------------------------------------------------
# Close the file new.jbr
jobfile.close( )
#--------------------------------------------------------------------
# Close the file new.db
uil_file_close.goquit()
#--------------------------------------------------------------------
jobfile.writei
#
#
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_return_status = 1
#---------------------------------------------------------------------
# Open a new database "new.db"
uil_file_new.go( "","new.db" )
#---------------------------------------------------------------------
# Opens the jobfile
#---------------------------------------------------------------------
# Using the jobfile.writei function to write text in the output file
# The format is jobfile.writei("str_1","int") writes the following
# to the output file : str_1 = int.
#---------------------------------------------------------------------
# Close the file new.jbr
jobfile.close()
#--------------------------------------------------------------------
# Close the file new.db
uil_file_close.goquit()
#--------------------------------------------------------------------
jobfile.writer
#
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_return_status = 1
#---------------------------------------------------------------------
# Open a new database "new.db"
uil_file_new.go( "","new.db" )
#---------------------------------------------------------------------
# Opens the jobfile
jobfile.writer("REAL_VALUE_1 = ",3.1)
jobfile.writer("REAL_VALUE_2 = ",-2.9673)
jobfile.writer("REAL_VALUE_3 = ",0.4999999999999999)
#---------------------------------------------------------------------
jobfile.writec( "", "END" )
#---------------------------------------------------------------------
# Close the file new.jbr
jobfile.close()
#--------------------------------------------------------------------
# Close the file new.db
uil_file_close.goquit()
#--------------------------------------------------------------------
jobfile.write_spl
#
#
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_return_status = 1
STRING str[128](2)
str(1) = "STRING_1"
str(2) = "STRING_2"
#---------------------------------------------------------------------
# Open a new database "new.db"
uil_file_new.go( "","new.db" )
#---------------------------------------------------------------------
# Opens the jobfile
#---------------------------------------------------------------------
# Delete the old files - .bdf and .op2 files.
#---------------------------------------------------------------------
# calling the function jobfile.write_spl
jobfile.write_spl( "/* Writing character string arrays: %A% and %A% */ ",
str)
#---------------------------------------------------------------------
# Using the jobfile.writec function to write pure text in the output file
#---------------------------------------------------------------------
# Close the file new.jbr
jobfile.close()
#--------------------------------------------------------------------
# Close the file new.db
uil_file_close.goquit()
#--------------------------------------------------------------------
msc_delete_old_files
INTEGER i_return_status = 1
#---------------------------------------------------------------------
# Open a new database "new.db"
uil_file_new.go( "","new.db" )
#---------------------------------------------------------------------
# Delete the old files - new.bdf and new.op2 files.
dump i_return_status
#--------------------------------------------------------------------
# Close the file new.db
uil_file_close.goquit()
#--------------------------------------------------------------------
mscnastran_anlyze_sub_create.available_callback ()
uil_file_new.go("","new.db")
Main Index
1586
Code Examples
#---------------------------------------------------------------------
#--------------------------------------------------------------------
#--------------------------------------------------------------------
INTEGER num_items = 1
#---------------------------------------------------------------------
mscnastran_analyze_sub_create.available_callback(num_items, @
subcase_name)
#---------------------------------------------------------------------
STRING check_subcase_name[64]
mscnastran_analyze_sub_create.get_subcase_name(check_subcase_name)
dump check_subcase_name
#----------------------------------------------------------------------
# End of File.
#---------------------------------------------------------------------
mscnastran_analyze_tp.get_version_number ()
# (
# REAL version_no
# )
#---------------------------------------------------------------------
#
# Opening a new database
uil_file_new.go("","new.db")
REAL version_no
#---------------------------------------------------------------------
# Using the function mscnastran_analyze_tp.get_version_number()
# to get the version number of msc nastran.
mscnastran_analyze_tp.get_version_number(version_no)
dump version_no
#---------------------------------------------------------------------
# End of File.
mscnastran_job.associate_subcases ()
uil_file_new.go("","new.db")
#---------------------------------------------------------------------
#--------------------------------------------------------------------
INTEGER status
#----------------------------------------------------------------------
mscnastran_subcase.create(sseq_str, @
subcase_names(1), @
"First subcase")
mscnastran_subcase.create(sseq_str, @
subcase_names(2), @
"Second subcase")
#---------------------------------------------------------------------
jobfile.open(jobname,"ANALYZE NO JOBFILE")
jobfile.close()
#------------------------------------------------------------------------
status = mscnastran_job.associate_subcases(sseq_str, @
jobname, @
num_subcases, @
subcase_names)
dump status
#---------------------------------------------------------------------
# End of File.
#---------------------------------------------------------------------
Main Index
CHAPTER 13 1589
Analysis
mscnastran_subcase.create ()
uil_file_new.go("","new.db")
#---------------------------------------------------------------------
#--------------------------------------------------------------------
INTEGER status
#----------------------------------------------------------------------
status = mscnastran_subcase.create(sseq_str, @
subcase_name, @
subcase_desc)
dump status
#---------------------------------------------------------------------
# End of File.
Main Index
1590
Code Examples
#---------------------------------------------------------------------
mscnastran_subcase.create_char_param ()
uil_file_new.go("","new.db")
#---------------------------------------------------------------------
#--------------------------------------------------------------------
INTEGER status
#----------------------------------------------------------------------
loadcase_create2(char_value, @
"static", @
"new load case", @
1.,[""],[0], @
[0.],"",0.,TRUE)
mscnastran_subcase.create("101", @
"Test", @
Main Index
CHAPTER 13 1591
Analysis
"Test subcase")
#---------------------------------------------------------------------
status = mscnastran_subcase.create_char_param(param_name, @
char_value)
dump status
#---------------------------------------------------------------------
# End of File.
#---------------------------------------------------------------------
mscnastran_update.job ()
uil_file_new.go("","new.db")
#---------------------------------------------------------------------
#--------------------------------------------------------------------
INTEGER status
#----------------------------------------------------------------------
jobfile.open(jobname,"ANALYZE NO JOBFILE")
jobfile.close()
mscnastran_job.associate_subcases("101", @
jobname, @
1, @
["Default"])
#------------------------------------------------------------------------
status = mscnastran_update.job(jobname)
dump status
#---------------------------------------------------------------------
# End of File.
#---------------------------------------------------------------------
uil_app_analysis.change_current_branch ()
#---------------------------------------------------------------------
#
# Opening a new database
uil_file_new.go("","new.db")
#---------------------------------------------------------------------
#--------------------------------------------------------------------
INTEGER num_branches
STRING labels[32](4)
LOGICAL post_them = TRUE
#----------------------------------------------------------------------
INTEGER items(4)
#----------------------------------------------------------------------
STRING analysis_code_name[32]
db_get_default_anal_code ( analysis_code_name )
dump labels
ui_form_display( "uil_app_analysis" )
#---------------------------------------------------------------------
# End of File.
Main Index
1594
Code Examples
Main Index
MSC.Acumen, Volume 2: Code Examples
CHAPTER
Fields
14
■ Introduction
Main Index
1596
Code Examples
14.1 Introduction
This chapter provides code examples for the PCL function described in Volume 1. These
examples are designed so that they can be cut and pasted into a file and, by following the
instructions listed with each example, executed in MSC.Patran.
db_delete_field ()
dump i_id
db_delete_field_res ()
REAL ra_vals(4)
INTEGER i_return_value
INTEGER i_field_id
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)
db_get_all_field_names ()
db_get_field_attrs ()
STRING s_name[32]
INTEGER i_object
INTEGER i_nvar
INTEGER i_ivar1
INTEGER i_ivar2
INTEGER i_ivar3
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
db_get_field_dfem ()
dump ia_node_pos
dump ia_nodeid
dump ra_vals
END FOR
#---------------------------------------------------------------------
db_get_field_id ()
db_get_field_lbc ()
field_create_field_lbc @
( i_id, @
s_name, @
i_type, @
i_ent_type, @
i_nvals, @
ia_eid, @
ia_elem_face, @
ia_elem_edge, @
ia_node_pos, @
ra_vals )
dump i_return_value
#---------------------------------------------------------------------
# Calling function to read the field data.
i_nvals=4
ia_eid=[0,0,0,0]
ra_vals=[0.,0.,0.,0.]
#
i_return_value = @
db_get_field_lbc @
( i_id, @
i_nvals, @
ia_eid, @
ia_elem_face, @
ia_elem_edge, @
ia_node_pos, @
ra_vals )
dump i_return_value
dump i_nvals,ia_eid,ra_vals
#---------------------------------------------------------------------
db_get_field_lbc_type ()
db_get_max_field_id ()
db_get_next_field_name ()
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function db_get_next_field_name()
# has the following arguments:
#
# db_get_next_field_name
# ( id,
# name )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_object
INTEGER i_id
STRING s_name[32]
INTEGER i_all_status
INTEGER i_next_status
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)
Main Index
1608
Code Examples
db_modify_field ()
INTEGER i_ivar3
INTEGER i_fn1_size
INTEGER i_fn2_size
INTEGER i_fn3_size
STRING s_fn1[16]
STRING s_fn2[16]
STRING s_fn3[16]
LOGICAL l_lin_def
INTEGER i_nxvals
INTEGER i_nyvals
INTEGER i_nzvals
REAL ra_xvals(8)
REAL ra_yvals(8)
REAL ra_zvals(8)
REAL ra_vals(8)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
# Creating scalar field with X Y and Z as variables and a single
# formula - x+(y*z) and extrapolation option as 1.
i_return_value = @
fields_create( “sp_pcl_sca_r”, “Spatial”, 1, “Scalar”, “Real”, @
“Coord 0”, ““, “Function”, 3, “X”, “Y”, “Z”, “‘x+(‘y*’z)”, ““, @
““, FALSE, [0.], [0.], [0.], [ [[0.]]] )
dump i_return_value
i_return_value = db_get_field_id(“sp_pcl_sca_r”,i_id)
dump i_return_value,i_id
#---------------------------------------------------------------------
# Calling function to read the data of the modified function.
i_return_value = @
db_get_field @
( i_id, @
s_name, @
i_object, @
i_type, @
i_etype, @
i_eid, @
i_extra_opt, @
i_cid_type, @
i_cid, @
i_defn_type, @
i_nvar, @
i_ivar1, @
i_ivar2, @
i_ivar3, @
i_fn1_size, @
i_fn2_size, @
i_fn3_size, @
l_lin_def, @
i_nxvals, @
i_nyvals, @
i_nzvals )
dump i_return_value
dump i_id,s_name,i_object,i_type,i_extra_opt,i_cid_type,i_cid
dump i_defn_type,i_nvar,i_ivar1,i_ivar2,i_ivar3,i_fn1_size,l_lin_def
#---------------------------------------------------------------------
# Modifying the field “sp_pcl_sca_r” and changing the function
# to - x-(y/2)+z
s_name=”sp_pcl_sca_r”
i_object=0
i_type=0
i_extra_opt=2
Main Index
1610
Code Examples
i_cid_type=0
i_cid=0
i_defn_type=0
i_nvar=1
i_ivar1=1
i_ivar2=2
i_ivar3=3
i_fn1_size=13
s_fn1=”’x-(‘y/’2)+’z”
l_lin_def=FALSE
#
i_return_value = @
db_modify_field @
( i_id, @
s_name, @
i_object, @
i_type, @
i_etype, @
i_eid, @
i_extra_opt, @
i_cid_type, @
i_cid, @
i_defn_type, @
i_nvar, @
i_ivar1, @
i_ivar2, @
i_ivar3, @
i_fn1_size, @
i_fn2_size, @
i_fn3_size, @
s_fn1, @
s_fn2, @
s_fn3, @
l_lin_def, @
i_nxvals, @
i_nyvals, @
i_nzvals, @
ra_xvals, @
ra_yvals, @
ra_zvals, @
ra_vals )
dump i_return_value
#---------------------------------------------------------------------
# Calling function to read the data of the modified function.
s_name=””
i_nvar=0
i_fn1_size=0
i_return_value = @
db_get_field @
( i_id, @
s_name, @
i_object, @
i_type, @
i_etype, @
i_eid, @
i_extra_opt, @
i_cid_type, @
i_cid, @
i_defn_type, @
i_nvar, @
i_ivar1, @
i_ivar2, @
i_ivar3, @
i_fn1_size, @
i_fn2_size, @
Main Index
CHAPTER 14 1611
Fields
i_fn3_size, @
l_lin_def, @
i_nxvals, @
i_nyvals, @
i_nzvals )
dump i_return_value
dump i_id,s_name,i_object,i_type,i_extra_opt,i_cid_type,i_cid
dump i_defn_type,i_nvar,i_ivar1,i_ivar2,i_ivar3,i_fn1_size,l_lin_def
#---------------------------------------------------------------------
field_create_field_lbc ()
#---------------------------------------------------------------------
# Calling function to read the field data.
i_nvals=4
ia_eid=[0,0,0,0]
ra_vals=[0.,0.,0.,0.]
#
i_return_value = @
db_get_field_lbc @
( i_id, @
i_nvals, @
ia_eid, @
ia_elem_face, @
ia_elem_edge, @
ia_node_pos, @
ra_vals )
dump i_return_value
dump i_nvals,ia_eid,ra_vals
#---------------------------------------------------------------------
Main Index
CHAPTER 14 1613
Fields
fields_create_general_term ()
STRING field_name[32]
INTEGER term_field_id
INTEGER term_type
INTEGER term_id
INTEGER data_length
STRING data[32]
STRING asm_create_hpat_xyz_created_ids[VIRTUAL]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database
$? YES 36000002
#---------------------------------------------------------------------
# Set the "ABAQUS" prefrence for analysis.
fields_create_general( "._Lbc_contact_lbc1", 2, 5, 2, @
"Real", "Coord 0", "", @
0, 0, 0, 0 )
#---------------------------------------------------------------------
# Argument Initialization.
field_name = "._Lbc_contact_lbc1"
Main Index
1614
Code Examples
term_field_id = 0
term_type = 0
term_id = 0
data_length = 17
data = "[1_contact_lbc()]"
#---------------------------------------------------------------------
# Create Term for the Field name "._Lbc_contact_lbc1"
fields_create_general_term ( field_name, @
term_field_id, @
term_type, @
term_id, @
data_length, @
data)
#---------------------------------------------------------------------
# Argument Initialization.
field_name ="._Lbc_contact_lbc1"
term_field_id =0
term_type =1
term_id =1
data_length =152
data ="contact_lbc(22|12|13|14|15|16|" // @
"19|20|21|22|23|24|25|26|27|28|29|30|31|33|3" // @
"5|53|54|1|3|1|1|2|1|1|2|0.02|" // @
"450.|0.|0.|0.|0.|0.|0.|0.|0.0049999999|0.|0."// @
"|2|2)"
#---------------------------------------------------------------------
# Create Term for the Field name "._Lbc_contact_lbc1"
dump i_return_value
#---------------------------------------------------------------------
# closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
field_fem_const_eval ()
i_maxnod=4
#
i_return_value = @
field_fem_const_eval @
( i_gid, @
i_numint, @
i_nindep, @
ra_intrpl, @
i_extrap, @
i_maxnod, @
ra_cnst, @
ia_eids, @
ra_geoloc, @
ia_offflg )
dump i_return_value
dump ra_cnst,ia_eids,ra_geoloc,ia_offflg
#---------------------------------------------------------------------
fld_cre_fem_res_sca ()
#---------------------------------------------------------------------
# Creating Spatial field using Tabular method.
i_return_value = @
fields_create( “tab”, “Spatial”, 1, “Scalar”, “Real”, “Coord 0”, @
““, “Table”, 1, “X”, ““, ““, ““, ““, ““, FALSE, [0.1, @
0.40000001, 0.69999999], [0.], [0.], [[[1.]][[3.]][[5.]]] )
dump i_return_value
i_return_value = db_get_field_id(“tab”,i_fid)
dump i_return_value,i_fid
#---------------------------------------------------------------------
# Scalar element table is created and
# associated with the Default_group.
i_return_value = @
ga_elem_scalar_create(“sclr_elm_tabl”,4,[1,5,19,25],[1,1,1,1],1, @
[1.2,2.3,3.4,4.5],i_scalid)
dump i_return_value,i_scalid
i_return_value = ga_group_elem_scalar_set(“default_group”,i_scalid)
dump i_return_value
#---------------------------------------------------------------------
# For Default_group ID is 1.
i_grpid = 1
#
i_return_value = @
fld_cre_fem_res_sca @
( i_fid, @
i_grpid, @
i_scalid )
dump i_return_value
#---------------------------------------------------------------------
# To confirm the creation of the table user should refer to Query
# Language Interpreter(QLI).
#---------------------------------------------------------------------
# End Of File
fld_cre_fem_res_vec ()
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_fid
INTEGER i_vecid
INTEGER i_elmflg
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the “field.db” database.
uil_file_open.go( “field.db”)
#---------------------------------------------------------------------
# Generating vector results for Constraint Forces.
res_init_vector_plot( )
i_return_value = db_get_field_id(“tab”,i_fid)
dump i_return_value,i_fid
#---------------------------------------------------------------------
# Vector table is created.
i_return_value = @
ga_vector_create(“vect_tbl”,1,1,4,[123,123,123,123],[1,5,15,19], @
[[0.] [0.] [0.] [0.]],[[.1,.1,.1] [.2,.2,.2] [.3,.3,.3] [.25, @
.25,.25]],[1,1,1,1],[1,1,1,1],[0,0,0,0],[0],i_vecid)
dump i_return_value,i_vecid
#---------------------------------------------------------------------
#
i_return_value = @
fld_cre_fem_res_vec @
( i_fid, @
i_vecid, @
i_elmflg )
dump i_return_value
#---------------------------------------------------------------------
# To confirm the creation of the table user should refer to Query
# Language Interpreter(QLI).
#---------------------------------------------------------------------
# End Of File
fld_evl_get_maxnod_for_group ()
#
# Before running this session file run spool.ses
# to create spool.db
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function fld_evl_get_maxnod_for_group()
# has the following arguments:
#
# fld_evl_get_maxnod_for_group
# ( gid,
# maxnod )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_gid
INTEGER i_maxnod
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database “spool.db”
uil_file_open.go(“spool.db”)
get_field_values ()
# field_dim,
# eval_points,
# field_values )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_field_id
INTEGER i_num_evals
INTEGER i_eval_dim
INTEGER i_field_dim
REAL ra_eval_points(3,1)
REAL ra_field_values(3,1)
INTEGER i_return_value
STRING sv_asm_create_patch_xy_crtd_ids[VIRTUAL]
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
# Creating a Hpat surface.
i_return_value = @
asm_const_patch_xyz( “1”, “<1 1 0>”, “[0 0 0]”, “Coord 0”, @
sv_asm_create_patch_xy_crtd_ids )
dump i_return_value
#---------------------------------------------------------------------
# Creating a spatial tabular field on parametric coordinate system.
i_return_value = @
fields_create( “sp_tb_para_c1”, “Spatial”, 1, “Scalar”, @
“Parametric”, ““, “Surface 1.1”, “Table”, 1, “C1”, ““, ““, ““, @
““, ““, FALSE, [0.1, 0.25, 0.45, 0.55, 0.8], [0.], [0.], @
[[[1.]][[3.]][[2.]][[-45.]][[6.]] ] )
dump i_return_value
i_return_value = @
db_get_field_id(“sp_tb_para_c1”,i_field_id)
dump i_field_id,i_return_value
#---------------------------------------------------------------------
# Evaluating the field value at three different locations.
i_num_evals=3
i_eval_dim=1
i_field_dim=1
ra_eval_points=[0.,0.5,1.0 ]
#
i_return_value = @
get_field_values @
( i_field_id, @
i_num_evals, @
i_eval_dim, @
i_field_dim, @
ra_eval_points, @
ra_field_values )
dump i_return_value
dump ra_field_values
#---------------------------------------------------------------------
get_field_values_no_trans ()
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function get_field_values_no_trans()
# has the following arguments:
#
# get_field_values_no_trans
# ( field_id,
# num_evals,
# eval_dim,
# field_dim,
# eval_points,
# field_values )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_field_id
INTEGER i_num_evals
INTEGER i_eval_dim
INTEGER i_field_dim
REAL ra_eval_points(3,1)
REAL ra_field_values(3,1)
INTEGER i_return_value
STRING sv_asm_create_patch_xy_crtd_ids[VIRTUAL]
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
# Creating a Hpat surface.
i_return_value = @
asm_const_patch_xyz( “1”, “<1 1 0>”, “[0 0 0]”, “Coord 0”, @
sv_asm_create_patch_xy_crtd_ids )
dump i_return_value
#---------------------------------------------------------------------
# Creating a spatial tabular field on parametric coordinate system.
i_return_value = @
fields_create( “sp_tb_para_c1”, “Spatial”, 1, “Scalar”, @
“Parametric”, ““, “Surface 1.1”, “Table”, 1, “C1”, ““, ““, ““, @
““, ““, FALSE, [0.1, 0.25, 0.45, 0.55, 0.8], [0.], [0.], @
[[[1.]][[3.]][[2.]][[-45.]][[6.]] ] )
dump i_return_value
i_return_value = @
db_get_field_id(“sp_tb_para_c1”,i_field_id)
dump i_field_id,i_return_value
#---------------------------------------------------------------------
# Evaluating the field value at three different locations.
i_num_evals=3
i_eval_dim=1
i_field_dim=1
ra_eval_points=[0.,0.5,1.0 ]
#
i_return_value = @
get_field_values_no_trans @
( i_field_id, @
i_num_evals, @
i_eval_dim, @
i_field_dim, @
ra_eval_points, @
ra_field_values )
dump i_return_value
dump ra_field_values
#---------------------------------------------------------------------
Main Index
1622
Code Examples
Main Index
MSC.Acumen, Volume 2: Code Examples
CHAPTER
Results
15
■ Introduction
Main Index
1624
Code Examples
15.1 Introduction
This chapter provides code examples for the PCL function described in Volume 1. These
examples are designed so that they can be cut and pasted into a file and, by following the
instructions listed with each example, executed in MSC.Patran.
db_count_result_types_for_elem ()
# i_elementId = 6
i_elementId = 6
i_return_value = @
db_count_result_types_for_elem @
( i_elementId, @
i_resultTypeCount )
dump i_return_value
db_get_elem_scalar_name ()
dump i_return_value
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
i_scalar_id = i_id
i_return_value = @
db_get_elem_scalar_name @
( i_scalar_id, @
s_name )
dump i_return_value
# The name of the result type being retrived from the database
dump s_name
sys_free_array(iv_lcids)
sys_free_array(iv_nsub)
sys_free_array(iv_elem_ids)
sys_free_array(iv_nbr_values)
sys_free_array(rv_scalars)
#---------------------------------------------------------------------
Main Index
CHAPTER 15 1627
Results
db_get_results_file_suffix ()
# s_name = “MSC.Nastran”
s_name = “MSC.Nastran”
i_return_value = @
db_get_results_file_suffix @
( s_name, @
s_suffix )
dump i_return_value
# The result file suffix for analysis code MSC.Nastran is
dump s_suffix
i_return_value = @
db_get_results_file_suffix @
( s_name, @
s_suffix )
dump i_return_value
# The result file suffix for analysis code MSC.Nastran is
dump s_suffix
#---------------------------------------------------------------------
Main Index
1628
Code Examples
jobfile.create_jobname ()
IF (!db_is_open()) THEN
uil_file_new.go("","new.db")
ENDIF
$? YES 36000002
INTEGER status = 5
#---------------------------------------------------------------------
# Opening the jobfile with the name 'new.jbr'.
#---------------------------------------------------------------------
# Deleting Old result and jobfiles.
#---------------------------------------------------------------------
# Using the function jobfile.create_jobname() to the verify the jobname.
status = jobfile.create_jobname()
dump status
#---------------------------------------------------------------------
# Closing the jobfile.
jobfile.close( )
#---------------------------------------------------------------------
# Closing Patran
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
jobfile.create_param ()
INTEGER status = 5
#---------------------------------------------------------------------
# Opening a new database
IF (!db_is_open()) THEN
uil_file_new.go("","new.db")
ENDIF
$? YES 36000002
#---------------------------------------------------------------------
# Opening the jobfile with the name 'new.jbr'.
#---------------------------------------------------------------------
# Deleting Old result and jobfiles.
#---------------------------------------------------------------------
# Writing statements to the jobfile.
status = jobfile.create_param( @
"", @
5, @
0.0, @
"", @
1 )
dump status
#---------------------------------------------------------------------
# Checking the number of entries written to the database.
status = 5
INTEGER num_param
status = db_count_param_set_entries( 1, @
num_param )
dump num_param, status
#---------------------------------------------------------------------
# Retriving the entries in the param set.
status = 5
INTEGER param_type(VIRTUAL), param_int(VIRTUAL), count = 1
REAL param_real(VIRTUAL)
STRING param_str[512](VIRTUAL), param_name[80](VIRTUAL)
status = db_get_param_set_entries( 1 , @
count, @
Main Index
1630
Code Examples
param_name, @
param_type, @
param_real, @
param_str, @
param_int )
jobfile.close( )
#---------------------------------------------------------------------
# Closing Patran
uil_file_close.goquit( )
#---------------------------------------------------------------------
jobfile.eval_list
IF(!db_is_open()) THEN
uil_file_new.go("","new.db")
ENDIF
$? YES 36000002
#---------------------------------------------------------------------
# VAriable Decelerations
INTEGER i_status = 5
STRING s_value_format[32]
STRING s_label[32]
STRING s_integer_val[32]
INTEGER num_values_on_line = 10
STRING s_ilist[64] = " 1:100"
#---------------------------------------------------------------------
# refer lpenums.i for the next assignment of LP_SUBLIST_TOKEN_INT
#---------------------------------------------------------------------
# Opening the jobfile with the name 'new.jba'.
#---------------------------------------------------------------------
# Deleting Old result and jobfiles.
i_status = jobfile.eval_list( @
s_ilist, @
LP_SUBLIST_TOKEN_INT )
dump i_status
#---------------------------------------------------------------------
jobfile.write_string( " ", " " )
i_status = jobfile.write_array_as_list( @
s_label, @
s_value_format, @
num_values_on_line )
#---------------------------------------------------------------------
# Closing the jobfile.
jobfile.close( )
#---------------------------------------------------------------------
# Closing Patran
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
jobfile.write_array_as_list
IF(!db_is_open()) THEN
uil_file_new.go("","new.db")
ENDIF
$? YES 36000002
#---------------------------------------------------------------------
Main Index
1632
Code Examples
# VAriable Decelerations
INTEGER i_status = 5
STRING s_value_format[32]
STRING s_label[32]
STRING s_integer_val[32]
INTEGER num_values_on_line = 10
STRING s_ilist[64] = " 1:100"
#---------------------------------------------------------------------
# refer lpenums.i for the next assignment of LP_SUBLIST_TOKEN_INT
#---------------------------------------------------------------------
# Opening the jobfile with the name 'new.jba'.
#---------------------------------------------------------------------
# Deleting Old result and jobfiles.
jobfile.eval_list(s_ilist,LP_SUBLIST_TOKEN_INT)
#---------------------------------------------------------------------
# Using the function jobfile.write_array_as_list() to the
# jobfile 'new.jba'.
i_status = jobfile.write_array_as_list( @
s_label, @
s_value_format, @
num_values_on_line)
dump i_status
#---------------------------------------------------------------------
# Closing the jobfile.
jobfile.close( )
#---------------------------------------------------------------------
# Closing Patran
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
jobfile.write_element_list
#
# jobfile.write_element_list
# ( label_str,
# element_list_array )
#
#---------------------------------------------------------------------
# Opening a new database
IF(!db_is_open()) THEN
uil_file_new.go("","new.db")
ENDIF
$? YES 36000002
#---------------------------------------------------------------------
# VAriable Decelerations
INTEGER i_status
STRING s_element_list[32]
STRING s_label[32]
#---------------------------------------------------------------------
# Opening the jobfile with the name 'new.jba'.
#---------------------------------------------------------------------
# Deleting Old result and jobfiles.
#---------------------------------------------------------------------
# Using the function jobfile.write_element_list() to the jobfile 'new.jba'.
jobfile.write_element_list( @
s_label, @
s_element_list )
#---------------------------------------------------------------------
# Closing the jobfile.
jobfile.close( )
#---------------------------------------------------------------------
# Closing Patran
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
jobfile.write_integer_list
IF(!db_is_open()) THEN
uil_file_new.go("","new.db")
ENDIF
$? YES 36000002
#---------------------------------------------------------------------
# VAriable Decelerations
INTEGER i_status
STRING s_integer_val[32]
STRING s_label[32]
#---------------------------------------------------------------------
# Opening the jobfile with the name 'new.jba'.
#---------------------------------------------------------------------
# Deleting Old result and jobfiles.
#---------------------------------------------------------------------
# Using the function jobfile.write_integer_list() to the jobfile 'new.jba'.
jobfile.write_integer_list( @
s_label, @
s_integer_val )
#---------------------------------------------------------------------
# Closing the jobfile.
jobfile.close( )
#---------------------------------------------------------------------
# Closing Patran
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
Main Index
CHAPTER 15 1635
Results
jobfile.write_node_list
IF(!db_is_open()) THEN
uil_file_new.go("","new.db")
ENDIF
$? YES 36000002
#---------------------------------------------------------------------
# VAriable Decelerations
INTEGER i_status
STRING s_node_list[32]
STRING s_label[32]
#---------------------------------------------------------------------
# Opening the jobfile with the name 'new.jba'.
#---------------------------------------------------------------------
# Deleting Old result and jobfiles.
#---------------------------------------------------------------------
# Using the function jobfile.write_node_list() to the jobfile 'new.jba'.
jobfile.write_node_list( @
s_label, @
s_node_list )
#---------------------------------------------------------------------
# Closing the jobfile.
jobfile.close( )
#---------------------------------------------------------------------
# Closing Patran
Main Index
1636
Code Examples
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
jobfile.write_real_list
IF(!db_is_open()) THEN
uil_file_new.go("","new.db")
ENDIF
$? YES 36000002
#---------------------------------------------------------------------
# VAriable Decelerations
INTEGER i_status
STRING s_real_val[32]
STRING s_label[32]
#---------------------------------------------------------------------
# Opening the jobfile with the name 'new.jba'.
#---------------------------------------------------------------------
# Deleting Old result and jobfiles.
#---------------------------------------------------------------------
# Using the function jobfile.write_real_list() to the jobfile 'new.jba'.
jobfile.write_real_list( @
s_label, @
s_real_val )
#---------------------------------------------------------------------
# Closing the jobfile.
Main Index
CHAPTER 15 1637
Results
jobfile.close( )
#---------------------------------------------------------------------
# Closing Patran
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
jobfile.write_stream
IF(!db_is_open()) THEN
uil_file_new.go("","new.db")
ENDIF
$? YES 36000002
#---------------------------------------------------------------------
# VAriable Decelerations
INTEGER i_int_val
REAL r_real_val
STRING s_string_val[32]
#---------------------------------------------------------------------
# Opening the jobfile with the name 'new.jba'.
#---------------------------------------------------------------------
# Deleting Old result and jobfiles.
#---------------------------------------------------------------------
# Using the function jobfile.write_stream() to the jobfile 'new.jba'.
jobfile.write_stream( @
"The text is :int_va=%I%, real val=%G% and string value is %A%",@
i_int_val, @
r_real_val, @
s_string_val )
#---------------------------------------------------------------------
# Closing the jobfile.
jobfile.close( )
#---------------------------------------------------------------------
# Closing Patran
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
jobfile.write_string
uil_file_new.go("","new.db")
INTEGER status = 5
STRING label_str[32], char_val[256]
#---------------------------------------------------------------------
# Opening the jobfile with the name 'new.jbr'.
#---------------------------------------------------------------------
# Deleting Old result and jobfiles.
#---------------------------------------------------------------------
# Using the function jobfile.write_string() to the jobfile.
dump status
#---------------------------------------------------------------------
# Closing the jobfile.
jobfile.close( )
#---------------------------------------------------------------------
# Closing Patran
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
jobfile.writer
INTEGER i_return_status = 1
#---------------------------------------------------------------------
# Open a new database "new.db"
IF(!db_is_open())THEN
uil_file_new.go( "","new.db" )
ENDIF
$? YES 36000002
#---------------------------------------------------------------------
# Opens the jobfile
jobfile.writer("REAL_VALUE_1 = ",3.1)
jobfile.writer("REAL_VALUE_2 = ",-2.9673)
jobfile.writer("REAL_VALUE_3 = ",0.4999999999999999)
Main Index
1640
Code Examples
#---------------------------------------------------------------------
# Close the file new.jbr
jobfile.close()
#--------------------------------------------------------------------
# Close the file new.db
uil_file_close.goquit()
#--------------------------------------------------------------------
jobfile.writeS1
uil_file_new.go("","new.db")
#---------------------------------------------------------------------
# Opening the jobfile with the name 'new.jbr'.
#---------------------------------------------------------------------
# Deleting Old result and jobfiles.
#---------------------------------------------------------------------
# Using the function jobfile.writeS1() to the jobfile.
jobfile.set_job_status(jobstatus,msgstring)
#---------------------------------------------------------------------
# Closing the jobfile.
Main Index
CHAPTER 15 1641
Results
dump jobfile.close( )
#---------------------------------------------------------------------
#Displaying message to form
msg_to_form(jobstatus,1,0,0,0,msgstring)
# Closing Patran
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
jobfile.writeS2
IF (!db_is_open()) THEN
uil_file_new.go("","new.db")
ENDIF
$? YES 36000002
STRING label_str[32]
REAL rl_val(2)=[1.1,2.2]
#---------------------------------------------------------------------
# Opening the jobfile with the name 'new.jbr'.
#---------------------------------------------------------------------
# Deleting Old result and jobfiles.
#---------------------------------------------------------------------
# Using the function jobfile.writeS2() to the jobfile.
jobfile.writeS2(label_str,rl_val)
#---------------------------------------------------------------------
# Closing the jobfile.
Main Index
1642
Code Examples
jobfile.close( )
#---------------------------------------------------------------------
# Closing Patran
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File. /*jobfile.writeS2.example.ses*/
jobfile.writeS3
IF (!db_is_open()) THEN
uil_file_new.go("","new.db")
ENDIF
$? YES 36000002
STRING label_str[32]
REAL rl_val(3)=[1.1,2.2,3.3]
#---------------------------------------------------------------------
# Opening the jobfile with the name 'new.jbr'.
#---------------------------------------------------------------------
# Deleting Old result and jobfiles.
#---------------------------------------------------------------------
# Using the function jobfile.write_string() to the jobfile.
jobfile.writeS3(label_str,rl_val)
#---------------------------------------------------------------------
# Closing the jobfile.
jobfile.close( )
#---------------------------------------------------------------------
Main Index
CHAPTER 15 1643
Results
# Closing Patran
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File. /* jobfile.writeS3.example.ses */
jobfile.writeS4
IF (!db_is_open()) THEN
uil_file_new.go("","new.db")
ENDIF
$? YES 36000002
STRING label_str[32]
REAL rl_val(4)=[1.1,2.2,3.3,4.4]
#---------------------------------------------------------------------
# Opening the jobfile with the name 'new.jbr'.
#---------------------------------------------------------------------
# Deleting Old result and jobfiles.
#---------------------------------------------------------------------
# Using the function jobfile.writeS4() to the jobfile.
jobfile.writeS4(label_str,rl_val)
#---------------------------------------------------------------------
# Closing the jobfile.
jobfile.close( )
#---------------------------------------------------------------------
# Closing Patran
uil_file_close.goquit( )
Main Index
1644
Code Examples
#---------------------------------------------------------------------
# End of File. /* jobfile.writeS4.example.ses */
jobfile.writeSS
IF (!db_is_open()) THEN
uil_file_new.go("","new.db")
ENDIF
$? YES 36000002
STRING label_str[32]
INTEGER int_val(2)=[1,2]
#---------------------------------------------------------------------
# Opening the jobfile with the name 'new.jbr'.
#---------------------------------------------------------------------
# Deleting Old result and jobfiles.
#---------------------------------------------------------------------
# Using the function jobfile.writeSS() to the jobfile.
jobfile.writeSS(label_str,int_val)
#---------------------------------------------------------------------
# Closing the jobfile.
jobfile.close( )
#---------------------------------------------------------------------
# Closing Patran
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File. /*jobfile.writeSS.example.ses*/
Main Index
CHAPTER 15 1645
Results
rdm_result_minmax_get ()
STRING asm_create_patch_xy_created_ids[VIRTUAL]
INTEGER fem_create_mesh_surfa_num_nodes
INTEGER fem_create_mesh_surfa_num_elems
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]
INTEGER res_create_demo_mcid
INTEGER res_create_demo_scid
INTEGER res_create_demo_rcid
INTEGER res_create_demo_rtid
INTEGER res_create_demo_layerposid
REAL min, max
INTEGER i_return_status
#---------------------------------------------------------------------
# Opening a new database
if(!db_is_open())THEN
uil_file_new.go("","new.db")
$? YES 36000002
endif
#---------------------------------------------------------------------
# Creating a patch
fem_create_mesh_surf_3( "IsoMesh", @
16384, @
"Surface 1", @
1, @
["0.1"], @
"Quad4", @
"#", @
Main Index
1646
Code Examples
"#", @
"Coord 0", @
"Coord 0", @
fem_create_mesh_surfa_num_nodes, @
fem_create_mesh_surfa_num_elems, @
fem_create_mesh_s_nodes_created, @
fem_create_mesh_s_elems_created )
mesh_seed_display_mgr.erase( )
#---------------------------------------------------------------------
# Creating Demo results
db_drop_res_index( )
res_db_create_loadcase_c("Derived Results", 1, @
"Created by PATRAN for demo results", @
res_create_demo_mcid )
res_db_create_subcase_c( 2, "Demo", @
res_create_demo_scid, @
res_create_demo_rcid )
res_db_createlayerpos_c( 0, 0, @
res_create_demo_layerposid )
res_create_demoresult2( 1, 1, 1., 1, 1, 1, @
[0, 0, 0, 0], 1, 0, 0, 0 )
#---------------------------------------------------------------------
# Creating a patch
db_post_results_load( )
i_return_status = rdm_result_minmax_get( @
"", @
min, @
max )
#---------------------------------------------------------------------
# Closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
Main Index
CHAPTER 15 1647
Results
res_db_cgetlayerposids ()
uil_file_open.go("spool.db")
#---------------------------------------------------------------------
INTEGER rescase_id(1)
INTEGER rt_id
INTEGER nlayers
INTEGER layerposids(1)
INTEGER status
#----------------------------------------------------------------------
INTEGER loadcase_id(1)
db_get_load_case_id("spool_loads", @
loadcase_id(1))
INTEGER subcase_id(1)
db_get_sub_case_id(loadcase_id(1), @
"Static Subcase", @
subcase_id(1))
Main Index
1648
Code Examples
INTEGER numload_cases = 1
res_db_cgetrescases(numload_cases, @
loadcase_id, @
subcase_id, @
rescase_id)
rt_id = vki_db_getresid(rescase_id(1), @
prires_id, @
secres_id)
#---------------------------------------------------------------------
status = res_db_cgetlayerposids(rescase_id(1), @
rt_id, @
nlayers, @
layerposids )
dump status
dump nlayers
dump layerposids
#---------------------------------------------------------------------
# End of File.
#---------------------------------------------------------------------
res_db_cgetrescases ()
uil_file_open.go("spool.db")
#---------------------------------------------------------------------
INTEGER numload_cases = 1
INTEGER loadcase_id(1)
INTEGER subcase_id(1)
INTEGER rescase_id(1)
INTEGER status
#----------------------------------------------------------------------
db_get_load_case_id("spool_loads", loadcase_id(1))
#-----------------------------------------------------------------------
status = res_db_cgetrescases(numload_cases, @
loadcase_id, @
subcase_id, @
rescase_id)
dump status
dump rescase_id
#---------------------------------------------------------------------
# End of File.
#---------------------------------------------------------------------
Main Index
1650
Code Examples
res_utl_create_elem_result ()
INTEGER resultids(5)
STRING primary_title[80]
STRING secondary_title[80]
INTEGER nids
INTEGER ids(virtual)
STRING cidlist[12]
INTEGER datatype
STRING location[12]
INTEGER nresults(VIRTUAL)
REAL results(VIRTUAL)
STRING elem_list[12]
STRING derivation[12]
INTEGER resloc, cnt
INTEGER min_loc(12), max_loc(12)
INTEGER nrc, lcids(virtual), subids(virtual)
INTEGER nres, primary_id(virtual), secondary_id(virtual)
INTEGER nsub(virtual), nsub1
INTEGER result_ids(4), nlayers, layerids(VIRTUAL)
STRING layerlabels[80](VIRTUAL)
INTEGER i_return_value
#---------------------------------------------------------------------
# Opening the file spool.db
uil_file_open.go( "./spool.db")
Main Index
CHAPTER 15 1651
Results
#---------------------------------------------------------------------
# Clear any previous results from the memory
res_utl_clear_result()
#---------------------------------------------------------------------
# Gets the loadcases associated with the results
#---------------------------------------------------------------------
# Gets the subcases
#---------------------------------------------------------------------
# Gets the result ids
#---------------------------------------------------------------------
# Gets the layer positions associated with the results
result_ids(1) = lcids(1)
result_ids(2) = subids(1)
result_ids(3) = primary_id(2)
result_ids(4) = secondary_id(2)
dump nlayers
dump layerids
dump layerlabels
#---------------------------------------------------------------------
# Extracts result data for 10 elements (Elm 1:10) from the database
resultids(1) = lcids(1)
resultids(2) = subids(1)
resultids(3) = primary_id(2)
resultids(4) = secondary_id(2)
resultids(5) = layerids(1)
res_utl_extract_elem_results ( resultids, @
elem_list, @
derivation, @
location, @
cidlist, @
datatype, @
resloc, @
cnt, @
ids, @
Main Index
1652
Code Examples
nresults, @
results, @
min_loc, @
max_loc )
#---------------------------------------------------------------------
# Dump all extracted results as a output
dump datatype
dump resloc
dump cnt
dump ids
dump nresults
dump results
dump min_loc
dump max_loc
#---------------------------------------------------------------------
# Argument Initialization
resultids(1) = lcids(1)
resultids(2) = subids(1)
resultids(3) = 0
resultids(4) = 0
resultids(5) = layerids(1)
nids = nres
location = "N[odal"
cidlist = ""
#---------------------------------------------------------------------
# Created new result case in the database as a
# "NEW RESULT CASE" (Primary load case title) and
# "DISPLACEMENT" (Secondary load case title)
#---------------------------------------------------------------------
# Dump the return value of the function and output of the used function.
# The resultids(3) and resultids(4) are created newly.
dump i_return_value
dump resultids
#---------------------------------------------------------------------
# Closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
Main Index
CHAPTER 15 1653
Results
res_utl_extract_elem_history2 ()
INTEGER nrc
INTEGER lcids(virtual)
INTEGER subids(virtual)
INTEGER resultids(3)
STRING elem_list[12]
STRING derivation[12]
STRING location[12]
STRING cidlist[12]
STRING avg_method[24]
STRING avg_domain[24]
STRING extrap_method[24]
STRING complex_form[24]
Main Index
1654
Code Examples
REAL complex_angle
INTEGER datatype
INTEGER resloc
INTEGER cnt
INTEGER ids(VIRTUAL)
INTEGER nresults(VIRTUAL)
REAL results(VIRTUAL)
INTEGER min_loc(virtual)
INTEGER max_loc(virtual)
#---------------------------------------------------------------------
# Opening the file spool.db
uil_file_open.go( "./spool.db")
#---------------------------------------------------------------------
# Clear any previous results from the memory
i_return_value = res_utl_clear_result()
dump i_return_value
#---------------------------------------------------------------------
# Gets the loadcases associated with the results
#---------------------------------------------------------------------
# Gets the subcases
#---------------------------------------------------------------------
# Gets the result ids
#---------------------------------------------------------------------
# Gets the layer positions associated with the results
result_ids(1) = lcids(1)
result_ids(2) = subids(1)
result_ids(3) = primary_id(2)
result_ids(4) = secondary_id(2)
dump result_ids
dump i_return_value
dump nlayers
dump layerids
dump layerlabels
Main Index
CHAPTER 15 1655
Results
#---------------------------------------------------------------------
# Argument Initialization
resultids(1) = primary_id(2)
resultids(2) = secondary_id(2)
resultids(3) = layerids(1)
elem_list = "Elm 1:10"
derivation = "MAG"
location = "Nodal"
cidlist = ""
avg_method = "Sum"
avg_domain = "All"
extrap_method = "ShapeFunc"
complex_form = "Real"
complex_angle = 0.0
#---------------------------------------------------------------------
# Extracts result data for 10 elements (Elements 1:10) from the database
#---------------------------------------------------------------------
dump i_return_value
dump datatype
dump resloc
dump cnt
dump ids
dump nresults
dump results
dump min_loc
dump max_loc
#---------------------------------------------------------------------
# Closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
Main Index
1656
Code Examples
res_utl_extract_elem_results2 ()
INTEGER resultids(5)
STRING elem_list[12]
STRING derivation[12]
STRING location[12]
STRING cidlist[12]
STRING avg_method[24]
STRING avg_domain[24]
STRING extrap_method[24]
STRING complex_form[24]
REAL complex_angle
INTEGER datatype
INTEGER resloc
INTEGER cnt
INTEGER ids(VIRTUAL)
INTEGER nresults(VIRTUAL)
REAL results(VIRTUAL)
INTEGER min_loc(12)
Main Index
CHAPTER 15 1657
Results
INTEGER max_loc(12)
#---------------------------------------------------------------------
# Opening the file spool.db
uil_file_open.go( "./spool.db")
#---------------------------------------------------------------------
# Clear any previous results from the memory
res_utl_clear_result()
#---------------------------------------------------------------------
# Gets the loadcases associated with the results
#---------------------------------------------------------------------
# Gets the subcases
#---------------------------------------------------------------------
# Gets the result ids
#---------------------------------------------------------------------
# Gets the layer positions associated with the results
result_ids(1) = lcids(1)
result_ids(2) = subids(1)
result_ids(3) = primary_id(2)
result_ids(4) = secondary_id(2)
dump nlayers
dump layerids
dump layerlabels
#---------------------------------------------------------------------
# Argument Initialization
resultids(1) = lcids(1)
resultids(2) = subids(1)
resultids(3) = primary_id(2)
resultids(4) = secondary_id(2)
resultids(5) = layerids(1)
location = "N[odal"
cidlist = ""
avg_method = "Sum"
avg_domain = "All"
extrap_method = "ShapeFunc"
complex_form = "Real"
complex_angle = 0.0
#---------------------------------------------------------------------
# Extracts result data for 10 elements (Elm 1:10) from the database
#---------------------------------------------------------------------
dump i_return_value
dump datatype
dump resloc
dump cnt
dump ids
dump nresults
dump results
dump min_loc
dump max_loc
#---------------------------------------------------------------------
# Closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
res_utl_extract_nodal_history2 ()
INTEGER nrc
INTEGER lcids(virtual)
INTEGER subids(virtual)
INTEGER resultids(5)
STRING node_list[12]
STRING derivation[12]
STRING cidlist[12]
STRING avg_method[24]
STRING avg_domain[24]
STRING extrap_method[24]
STRING complex_form[24]
REAL complex_angle
INTEGER datatype
INTEGER cnt
INTEGER ids(VIRTUAL)
REAL results(VIRTUAL)
INTEGER max_loc(virtual)
INTEGER min_loc(virtual)
#---------------------------------------------------------------------
# Opening the file spool.db
uil_file_open.go( "./spool.db")
#---------------------------------------------------------------------
# Clear any previous results from the memory
Main Index
1660
Code Examples
res_utl_clear_result()
#---------------------------------------------------------------------
# Gets the loadcases associated with the results
#---------------------------------------------------------------------
# Gets the subcases
#---------------------------------------------------------------------
# Gets the result ids
#---------------------------------------------------------------------
# Gets the layer positions associated with the results
result_ids(1) = lcids(1)
result_ids(2) = subids(1)
result_ids(3) = primary_id(2)
result_ids(4) = secondary_id(2)
dump nlayers
dump layerids
dump layerlabels
#---------------------------------------------------------------------
# Argument Initialization
resultids(1) = primary_id(2)
resultids(2) = secondary_id(2)
resultids(3) = layerids(1)
node_list = "NODE 1:20"
derivation = "MAG"
cidlist = ""
avg_method = "Sum"
avg_domain = "All"
extrap_method = "ShapeFunc"
complex_form = "Real"
complex_angle = 0.0
#---------------------------------------------------------------------
# Extracts result data for 20 nodes (Nodes 1:20) from the database
complex_form, @
complex_angle, @
datatype, @
cnt, @
ids, @
results, @
min_loc, @
max_loc )
#---------------------------------------------------------------------
dump i_return_value
dump datatype
dump cnt
dump ids
dump results
dump min_loc
dump max_loc
#---------------------------------------------------------------------
# Closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
res_utl_extract_nodal_results2 ()
# results, @
# min_loc, @
# max_loc)
#
#
#---------------------------------------------------------------------
# Variable Decleration
INTEGER resultids(5)
STRING node_list[12]
STRING derivation[12]
STRING cidlist[12]
STRING avg_method[24]
STRING avg_domain[24]
STRING extrap_method[24]
STRING complex_form[24]
REAL complex_angle
INTEGER datatype
INTEGER cnt
INTEGER ids(VIRTUAL)
REAL results(VIRTUAL)
INTEGER min_loc(6)
INTEGER max_loc(6)
#---------------------------------------------------------------------
# Opening the file spool.db
uil_file_open.go( "./spool.db")
#---------------------------------------------------------------------
# Clear any previous results from the memory
res_utl_clear_result()
#---------------------------------------------------------------------
# Gets the loadcases associated with the results
#---------------------------------------------------------------------
# Gets the subcases
#---------------------------------------------------------------------
# Gets the result ids
res_utl_get_result_ids(nrc, lcids, @
subids, nres, primary_id, secondary_id)
#---------------------------------------------------------------------
# Gets the layer positions associated with the results
Main Index
CHAPTER 15 1663
Results
result_ids(1) = lcids(1)
result_ids(2) = subids(1)
result_ids(3) = primary_id(2)
result_ids(4) = secondary_id(2)
dump nlayers
dump layerids
dump layerlabels
#---------------------------------------------------------------------
# Argument Initialization
resultids(1) = lcids(1)
resultids(2) = subids(1)
resultids(3) = primary_id(2)
resultids(4) = secondary_id(2)
resultids(5) = layerids(1)
node_list = "Node 1:10"
derivation = "MAG"
cidlist = ""
avg_method = "Sum"
avg_domain = "All"
extrap_method = "ShapeFunc"
complex_form = "Real"
complex_angle = 0.0
#---------------------------------------------------------------------
# Extracts result data for 10 nodes (Node 1:10) from the database
#---------------------------------------------------------------------
dump i_return_value
dump datatype
dump cnt
dump ids
dump results
dump min_loc
dump max_loc
#---------------------------------------------------------------------
# Closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
Main Index
1664
Code Examples
res_utl_transform_nodal_results ()
INTEGER node_count
INTEGER ids(VIRTUAL)
INTEGER cid
INTEGER ncomp
REAL results(VIRTUAL)
INTEGER i_return_value
INTEGER asm_create_cord_axi_created_ids
INTEGER resultids(5)
INTEGER datatype
INTEGER min_loc(6)
INTEGER max_loc(6)
INTEGER nrc, lcids(virtual), subids(virtual)
INTEGER nres, primary_id(virtual), secondary_id(virtual)
INTEGER nsub(virtual), nsub1
INTEGER result_ids(4), nlayers, layerids(VIRTUAL)
STRING layerlabels[80](VIRTUAL)
#---------------------------------------------------------------------
# Opening the file spool.db
uil_file_open.go( "./spool.db")
#---------------------------------------------------------------------
# Clear any previous results from the memory
res_utl_clear_result()
#---------------------------------------------------------------------
# Gets the loadcases associated with the results
Main Index
CHAPTER 15 1665
Results
#---------------------------------------------------------------------
# Gets the subcases
#---------------------------------------------------------------------
# Gets the result ids
res_utl_get_result_ids(nrc, lcids, @
subids, nres, primary_id, secondary_id)
#---------------------------------------------------------------------
# Gets the layer positions associated with the results
result_ids(1) = lcids(1)
result_ids(2) = subids(1)
result_ids(3) = primary_id(2)
result_ids(4) = secondary_id(2)
dump nlayers
dump layerids
dump layerlabels
#---------------------------------------------------------------------
# Extracts result data for the 50 nodes from the database.
resultids(1) = lcids(1)
resultids(2) = subids(1)
resultids(3) = primary_id(2)
resultids(4) = secondary_id(2)
resultids(5) = layerids(1)
res_utl_extract_nodal_results ( resultids, @
"Node 51:100", @
"MAG", @
"", @
datatype, @
node_count, @
ids, @
results, @
min_loc, @
max_loc )
dump datatype
dump node_count
dump ids
dump results
dump min_loc
dump max_loc
#---------------------------------------------------------------------
# Create a new cordinate system.
#---------------------------------------------------------------------
Main Index
1666
Code Examples
# Argument Initialization
cid = 2
ncomp = 1
#---------------------------------------------------------------------
# Transform the specified nodal results for specified cid.
#---------------------------------------------------------------------
# Closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
vki_db_getresid ()
uil_file_open.go("spool.db")
#---------------------------------------------------------------------
INTEGER rescase_id(1)
INTEGER prires_id
Main Index
CHAPTER 15 1667
Results
INTEGER secres_id
INTEGER rt_id
#----------------------------------------------------------------------
INTEGER loadcase_id(1)
db_get_load_case_id("spool_loads", @
loadcase_id(1))
INTEGER subcase_id(1)
db_get_sub_case_id(loadcase_id(1), @
"Static Subcase", @
subcase_id(1))
INTEGER numload_cases = 1
res_db_cgetrescases(numload_cases, @
loadcase_id, @
subcase_id, @
rescase_id)
#---------------------------------------------------------------------
rt_id = vki_db_getresid(rescase_id(1), @
prires_id, @
secres_id)
dump rt_id
#---------------------------------------------------------------------
# End of File.
#---------------------------------------------------------------------
Main Index
1668
Code Examples
xy_curve_results_set_wnd ()
STRING windowname[64]
INTEGER num_points
INTEGER int_status
STRING curve_name[64]
REAL x(VIRTUAL), y(VIRTUAL)
#----------------------------------------------------------------------
# Open a new database
if(!db_is_open())THEN
uil_file_new.go("","new.db")
$? YES 36000002
endif
#----------------------------------------------------------------------
# Setting the preference to MSC.Nastran.
uil_pref_analysis.set_analysis_pref( "MSC.Nastran", @
"Structural", @
"", @
".op2" )
#----------------------------------------------------------------------
# Declare the windows and the variables.
windowname = "win1"
num_points = 5
curve_name = "CURVE 1"
#----------------------------------------------------------------------
# Define the size of the array for x and y values.
sys_allocate_array(x,1,num_points)
sys_allocate_array(y,1,num_points)
#----------------------------------------------------------------------
# Open the window with the function.
Main Index
CHAPTER 15 1669
Results
int_status = xy_curve_results_set_wnd( @
windowname, @
num_points, @
curve_name, @
x, @
y )
dump int_status
#----------------------------------------------------------------------
# Closing the file new.db
# uil_file_close.goquit()
# End of file
#----------------------------------------------------------------------
Main Index
1670
Code Examples
Main Index
MSC.Acumen, Volume 2: Code Examples
CHAPTER
Preferences
16
■ Introduction
Main Index
1672
Code Examples
16.1 Introduction
This chapter provides code examples for the PCL function described in Volume 1. These
examples are designed so that they can be cut and pasted into a file and, by following the
instructions listed with each example, executed in MSC.Patran.
db_add_pref ()
db_get_pref
# Create a solid
asm_const_hpat_xyz(“1”,”<1 1 1>”,”[0 0 0]”,”Coord 0”, @
sv_asm_created_hpat_xyz)
ga_view_aa_set(23.,56.,0.)
i_return_value = @
db_get_pref @
( i_pref_id, @
i_data_type, @
i_int_pref, @
l_log_pref, @
r_real_pref, @
s_char_pref )
dump i_return_value
l_log_pref, @
r_real_pref, @
“SHADED” )
dump i_return_value
i_return_value = @
db_get_pref @
( i_pref_id, @
i_data_type, @
i_int_pref, @
l_log_pref, @
r_real_pref, @
s_char_pref )
dump i_return_value
SYS_FREE_STRING(sv_asm_created_hpat_xyz)
#---------------------------------------------------------------------
pref_anal_get ()
i_return_value = @
pref_anal_get @
( s_anal_code, @
Main Index
1676
Code Examples
s_anal_type, @
s_mod_suf, @
s_res_suf )
dump i_return_value
pref_anal_set ()
pref_confirm_get ()
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
i_return_value = @
pref_confirm_get @
( l_confirm )
dump i_return_value
pref_display_method_get ()
i_return_value = @
pref_display_method_get @
( i_disp_meth )
dump i_return_value
i_return_value = @
pref_display_method_get @
( i_disp_meth )
dump i_return_value
pref_entity_dp_get ()
i_return_value = @
pref_entity_dp_get @
( s_ed_prop )
dump i_return_value
i_return_value = @
pref_entity_dp_get @
( s_ed_prop )
dump i_return_value
dump s_ed_prop
#---------------------------------------------------------------------
pref_entity_dp_set ()
i_return_value = @
pref_entity_dp_get @
( s_ed_prop_c )
dump i_return_value
i_return_value = @
pref_entity_dp_get @
( s_ed_prop_c )
dump i_return_value
Main Index
CHAPTER 16 1681
Preferences
pref_entity_set ()
# Create a solid
asm_const_hpat_xyz(“1”,”<1 1 1>”,”[0 0 0]”, @
“Coord 0”, sv_asm_created_hpat_xyz)
ga_view_aa_set(23.,56.,0.)
uil_toolbar.labels_on()
FOR( i_count = 1 TO 37 )
la_set_flag(i_count) = TRUE
END FOR
i_return_value = @
pref_entity_set @
( la_set_flag, @
s_ed_prop, @
s_r_style, @
i_precision, @
l_fa_vectors, @
l_dv_results, @
l_d_defo, @
Main Index
CHAPTER 16 1683
Preferences
i_shcolor, @
i_gcolor, @
i_lcolor, @
i_pcolor, @
i_hpcolor, @
i_tscolor, @
i_bdcolor, @
i_ncolor, @
i_pecolor, @
i_bcolor, @
i_trcolor, @
i_qcolor, @
i_tecolor, @
i_wcolor, @
i_hecolor, @
i_mcolor, @
l_g_label, @
l_l_label, @
l_p_label, @
l_hp_label, @
l_ts_label, @
l_bd_label, @
l_n_label, @
l_pe_label, @
l_b_label, @
l_tr_label, @
l_q_label, @
l_te_label, @
l_w_label, @
l_he_label, @
l_m_label )
dump i_return_value
SYS_FREE_STRING(sv_asm_created_hpat_xyz)
#---------------------------------------------------------------------
pref_env_get_integer ()
STRING s_prefname[32]
INTEGER i_value
INTEGER i_value_c
INTEGER i_return_value
#---------------------------------------------------------------------
# Set the integer preference for MESSAGE_WARNING to 3.
s_prefname = “message_warning”
i_value_c = 3
i_return_value = @
pref_env_set_integer @
( s_prefname, @
i_value_c )
dump i_return_value
pref_env_get_logical ()
pref_env_get_logical @
( s_prefname, @
l_value )
dump i_return_value
pref_env_get_real ()
Main Index
1686
Code Examples
pref_env_get_string ()
pref_fa_get ()
INTEGER ia_lbc_color(40)
LOGICAL la_lbc_display(40)
INTEGER ia_ep_color(10)
LOGICAL la_ep_display(10)
LOGICAL l_display_fem
INTEGER i_status
#----------------------------------------------------------------------
# Open a new database
if(!db_is_open())THEN
uil_file_new.go("","new.db")
$? YES 36000002
endif
#----------------------------------------------------------------------
# Setting the preference to MSC.Nastran.
uil_pref_analysis.set_analysis_pref( "MSC.Nastran", @
"Structural", @
"", @
".op2" )
#---------------------------------------------------------------------
# Using the function pref_fa_get to get lbc colors & flags,
# ep colors & flag and fem display flag
i_status = pref_fa_get( @
ia_lbc_color, @
la_lbc_display, @
ia_ep_color, @
la_ep_display, @
l_display_fem )
dump ia_lbc_color
dump la_lbc_display
dump ia_ep_color
dump la_ep_display
dump l_display_fem
dump i_status
#---------------------------------------------------------------------
# Closing the file - new.db
uil_file_close.goquit()
#---------------------------------------------------------------------
Main Index
1688
Code Examples
pref_fa_set ()
LOGICAL la_set_flag(101)
INTEGER ia_lbc_color(40)
LOGICAL la_lbc_display(40)
INTEGER ia_ep_color(10)
LOGICAL la_ep_display(10)
LOGICAL l_display_fem
INTEGER i_status
INTEGER i
#----------------------------------------------------------------------
# Open a new database
if(!db_is_open())THEN
uil_file_new.go("","new.db")
$? YES 36000002
endif
#----------------------------------------------------------------------
# Setting the preference to MSC.Nastran.
uil_pref_analysis.set_analysis_pref( "MSC.Nastran", @
"Structural", @
"", @
".op2" )
#---------------------------------------------------------------------
# Set the graphics entity type preferences
# Set all lbc color = 2 and flag = FALSE
# Set all entity property color = 5 and flag = FALSE
FOR ( i = 1 to 10)
ia_ep_color(i) = 5
la_ep_display(i) = FALSE
END FOR
FOR ( i = 1 to 40)
ia_lbc_color(i) = 2
la_lbc_display(i) = FALSE
Main Index
CHAPTER 16 1689
Preferences
END FOR
FOR ( i = 1 to 101)
la_set_flag(i) = FALSE
END FOR
#---------------------------------------------------------------------
# Using the function pref_fa_set to set lbc colors & flags,
# ep colors & flag and fem display flag
i_status = pref_fa_set( @
la_set_flag, @
ia_lbc_color, @
la_lbc_display, @
ia_ep_color, @
la_ep_display, @
l_display_fem )
dump la_set_flag
dump ia_lbc_color
dump la_lbc_display
dump ia_ep_color
dump la_ep_display
dump l_display_fem
dump i_status
#---------------------------------------------------------------------
# Closing the file - new.db
uil_file_close.goquit()
#---------------------------------------------------------------------
pref_geo_cid_int_string ()
$? YES 36000002
i_return_value = @
pref_geo_cid_int_string @
( i_cid, @
s_sdb_string )
dump i_return_value
pref_geo_cid_string_int ()
# Get the select databox string for the default coordinate frame.
# i_cid_c = 0 (Default coordinate frame)
i_cid_c = 0
i_return_value = @
pref_geo_cid_int_string @
( i_cid_c, @
s_sdb_string )
dump i_return_value
i_return_value = @
pref_geo_cid_string_int @
( s_sdb_string, @
i_cid )
dump i_return_value
pref_geo_get ()
i_return_value = @
pref_geo_get @
( i_defcid, @
r_rgtol )
dump i_return_value
pref_get_anal_attributes ()
# s_anal_code = “MSC.Nastran”
s_anal_code = “MSC.Nastran”
i_return_value = @
pref_get_anal_attributes @
( s_anal_code, @
s_anal_type, @
s_mod_suf, @
s_res_suf )
dump i_return_value
pref_get_anal_code_count ()
i_return_value = @
pref_get_anal_code_count @
( i_num_codes )
dump i_return_value
pref_get_anal_type_count ()
# s_anal_code = MSC.Nastran
s_anal_code = “MSC.Nastran”
i_return_value = @
pref_get_anal_type_count @
Main Index
1694
Code Examples
( s_anal_code, @
i_num_types )
dump i_return_value
pref_get_next_anal_code ()
i_return_value = @
pref_get_anal_code_count @
( i_num_codes )
dump i_return_value
WHILE( i_return_value == 0 )
i_return_value = @
pref_get_next_anal_code @
( s_anal_code )
IF( i_return_value == 0 ) THEN
dump s_anal_code
ELSE
dump i_return_value
msg_get_string(i_return_value,s_msg)
dump s_msg
END IF
END WHILE
#---------------------------------------------------------------------
Main Index
CHAPTER 16 1695
Preferences
pref_get_next_anal_type ()
# s_anal_code = MSC.Nastran
s_anal_code = “MSC.Nastran”
i_return_value = @
pref_get_anal_type_count @
( s_anal_code, @
i_num_types )
dump i_return_value
WHILE( i_return_value == 0 )
i_return_value = @
pref_get_next_anal_type @
( s_anal_type )
IF( i_return_value == 0 ) THEN
dump s_anal_type
ELSE
dump i_return_value
msg_get_string(i_return_value,s_msg)
dump s_msg
END IF
END WHILE
#---------------------------------------------------------------------
Main Index
1696
Code Examples
pref_global_get ()
i_return_value = @
pref_global_get @
( l_confirm, @
i_wm_opt, @
r_glo_mod_tol )
dump i_return_value
pref_graphics_get ()
#
# pref_graphics_get
# ( disp_meth,
# p_color,
# s_color,
# e_color,
# extend,
# fit_view,
# center,
# hard_rend,
# anti_alias,
# td_vector,
# rt_display,
# s_light,
# p_marker,
# s_marker,
# m_color,
# m_size,
# gm_size,
# nm_size,
# l_format,
# nsigd )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_disp_meth
INTEGER i_p_color
INTEGER i_s_color
INTEGER i_e_color
LOGICAL l_extend
LOGICAL l_fit_view
LOGICAL l_center
LOGICAL l_hard_rend
LOGICAL l_anti_alias
LOGICAL l_td_vector
LOGICAL l_rt_display
LOGICAL l_s_light
INTEGER i_p_marker
INTEGER i_s_marker
INTEGER i_m_color
INTEGER i_m_size
INTEGER i_gm_size
INTEGER i_nm_size
INTEGER i_l_format
INTEGER i_nsigd
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
i_return_value = @
pref_graphics_get @
( i_disp_meth, @
i_p_color, @
i_s_color, @
i_e_color, @
l_extend, @
l_fit_view, @
l_center, @
l_hard_rend, @
l_anti_alias, @
l_td_vector, @
l_rt_display, @
l_s_light, @
i_p_marker, @
i_s_marker, @
i_m_color, @
Main Index
1698
Code Examples
i_m_size, @
i_gm_size, @
i_nm_size, @
i_l_format, @
i_nsigd )
dump i_return_value
# Display method is
dump i_disp_meth
# Primary color is
dump i_p_color
# Secondary color is
dump i_s_color
# Error color is
dump i_e_color
# Autoextend Flag is
dump l_extend
# Autofitview Flag is
dump l_fit_view
# Autocenter Flag is
dump l_center
# Hardware rendering Flag is
dump l_hard_rend
# Anti-Alias flag is
dump l_anti_alias
# 3-D vector Display Flag is
dump l_td_vector
# Result Title Display Flag is
dump l_rt_display
# Symmetric Light Flag is
dump l_s_light
# Primary marker is
dump i_p_marker
# Secondary marker is
dump i_s_marker
# Marker color is
dump i_m_color
# Marker size is
dump i_m_size
# Grid marker size is
dump i_gm_size
# Node marker size is
dump i_nm_size
# Results label format is
dump i_l_format
# Number of significant results digits are
dump i_nsigd
#---------------------------------------------------------------------
pref_graphics_marker_data_get ()
#
# pref_graphics_marker_data_get
# ( p_marker,
# s_marker,
# m_color,
# m_size )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_p_marker
INTEGER i_s_marker
INTEGER i_m_color
INTEGER i_m_size
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
i_return_value = @
pref_graphics_marker_data_get @
( i_p_marker, @
i_s_marker, @
i_m_color, @
i_m_size )
dump i_return_value
Main Index
1700
Code Examples
Main Index
MSC.Acumen, Volume 2: Code Examples
CHAPTER
Utilities
17
■ Introduction
Main Index
1702
Code Examples
17.1 Introduction
This chapter provides code examples for the PCL function described in Volume 1. These
examples are designed so that they can be cut and pasted into a file and, by following the
instructions listed with each example, executed in MSC.Patran.
array_copy_real ()
INTEGER num
REAL array1(virtual)
REAL array2(virtual)
#---------------------------------------------------------------------
# Argument Initialization.
num = 5
sys_allocate_array(array1, 1, num)
sys_allocate_array(array2, 1, num)
#---------------------------------------------------------------------
# Copy array1 into array2.
#---------------------------------------------------------------------
# Dump the output of the function
dump array2
#---------------------------------------------------------------------
# closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
Main Index
CHAPTER 17 1703
Utilities
array_del_zero_int ()
INTEGER numval
INTEGER array(virtual)
#---------------------------------------------------------------------
# Argument Initialization.
numval = 10
sys_allocate_array(array,1,numval)
array = [10, 0, 0, 2, 3, 5, 0, 8, 2, 0]
#---------------------------------------------------------------------
# Set each of num elements of array into zero real values.
array_del_zero_int(array, numval)
#---------------------------------------------------------------------
# Dump the output of the function
sys_reallocate_array(array,1,numval)
dump numval
dump array
#---------------------------------------------------------------------
# closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
array_fill_int ()
INTEGER array(virtual)
INTEGER n
INTEGER dim
#---------------------------------------------------------------------
# Argument Initialization.
dim = 8
sys_allocate_array(array, 1, dim)
array = [10, 1, 1, 2, 4, 6, 7, 2]
n = 5
#---------------------------------------------------------------------
# Set each of num elements of integer array into a given input value.
#---------------------------------------------------------------------
# Dump the output of the function
dump array
dump n
#---------------------------------------------------------------------
# closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
array_fill_zero_int ()
INTEGER ia_array(8)
INTEGER i_in
INTEGER i_r
#---------------------------------------------------------------------
# Set the integer array to some constant value(say 101)
FOR(i_r = 1 TO 8)
ia_array(i_r) = 101
END FOR
# i_in = 8
i_in = 8
array_fill_zero_int @
( ia_array, @
i_in )
array_fill_zero_real ()
REAL array(virtual)
INTEGER dim
#---------------------------------------------------------------------
# Argument Initialization.
dim = 4
sys_allocate_array(array, 1, dim)
array = [10.0, 1.0, 3.0, 2.0]
#---------------------------------------------------------------------
# Set each of num elements of array into zero real values.
#---------------------------------------------------------------------
# Dump the output of the function
dump array
#---------------------------------------------------------------------
Main Index
1706
Code Examples
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
array_real_fill_null ()
# i_in = 8
i_in = 8
array_real_fill_null @
( ra_array, @
i_in )
array_sort_and_del_dupl_int ()
INTEGER array(virtual)
INTEGER ndim
INTEGER n
#---------------------------------------------------------------------
# Argument Initialization.
ndim = 8
sys_allocate_array(array, 1, ndim)
array = [10, 1, 1, 2, 4, 6, 7, 2]
n = 6
#---------------------------------------------------------------------
# Sqeeze all duplicate values from the Ist n locs. of unsorted int array.
#---------------------------------------------------------------------
# Dump the output of the function
sys_reallocate_array(array, 1, n)
dump array
dump n
#---------------------------------------------------------------------
# closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
ga_entities_string_format ()
#
# The function ga_entities_string_format()
# has the following arguments:
#
# ga_entities_string_format
# ( entitytype,
# dblist,
# range,
# number,
# entitylist )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_entitytype
INTEGER ia_dblist(8) = [ 110,120,130,140,150,160,170,180 ]
INTEGER ia_range(3)
INTEGER i_number
STRING s_entitylist[128]
INTEGER i_return_value
#---------------------------------------------------------------------
# i_entitytype = 3 (Surface)
i_entitytype = 3
i_number = 8
# Lowest range for label.
ia_range(1) = 115
# Highest range for label.
ia_range(2) = 155
# Maximum string length
ia_range(3) = 128
i_return_value = @
ga_entities_string_format @
( i_entitytype, @
ia_dblist, @
ia_range, @
i_number, @
s_entitylist )
dump i_return_value
ga_entity_get_by_type ()
# label_count,
# entity_labels )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_entity_type
LOGICAL l_orphan_flag
INTEGER i_label_count
INTEGER ia_entity_labels(8)
STRING sv_asm_create_patch_xy_created[VIRTUAL]
STRING sv_asm_create_line_xyz_created[VIRTUAL]
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
# i_entity_type = 2 (Curve)
i_entity_type = 2
i_label_count = 6
l_orphan_flag = TRUE
i_return_value = @
ga_entity_get_by_type @
( i_entity_type, @
l_orphan_flag, @
i_label_count, @
ia_entity_labels )
dump i_return_value
l_orphan_flag = FALSE
i_return_value = @
ga_entity_get_by_type @
( i_entity_type, @
l_orphan_flag, @
i_label_count, @
ia_entity_labels )
dump i_return_value
SYS_FREE_STRING(sv_asm_create_patch_xy_created)
SYS_FREE_STRING(sv_asm_create_line_xyz_created)
#---------------------------------------------------------------------
Main Index
1710
Code Examples
math_get_no_data_null ()
math_is_no_data_null ()
Main Index
CHAPTER 17 1711
Utilities
l_return_value = @
math_is_no_data_null @
( r_rval )
#---------------------------------------------------------------------
math_mat_add ()
#---------------------------------------------------------------------
# Argument Initialization.
dim1 = 2
dim2 = 2
#---------------------------------------------------------------------
# Add two matrix a and b into third matrix named c
#---------------------------------------------------------------------
# Dump the output of the function
dump matrix3
#---------------------------------------------------------------------
# closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
Main Index
1712
Code Examples
math_mat_invert ()
real matrix(3, 3)
integer dim
real tol
integer i_return_value
#---------------------------------------------------------------------
# Argument Initialization.
dim = 3
tol = 0.001
matrix = [[1.0, 5.0, 3.0] [2.0, 7.0, 4.0] [1.0, 5.0, 6.0]]
#---------------------------------------------------------------------
# Invert the given matrix.
#---------------------------------------------------------------------
# Dump the output of the function
dump matrix
dump i_return_value
#---------------------------------------------------------------------
# closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
Main Index
CHAPTER 17 1713
Utilities
math_mat_mult ()
#---------------------------------------------------------------------
# Argument Initialization.
dim1 = 2
dim2 = 3
dim3 = 2
#---------------------------------------------------------------------
# Multiply two matrix
#---------------------------------------------------------------------
# Dump the output of the function
dump matrix3
#---------------------------------------------------------------------
# closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
Main Index
1714
Code Examples
math_mat_transp_in_place ()
real matrix(3, 3)
integer dim
#---------------------------------------------------------------------
# Argument Initialization.
dim = 3
matrix = [[1.0, 2.0, 3.0] [2.0, 3.0, 5.0] [7.0, 8.0, 9.0]]
#---------------------------------------------------------------------
# Transpose the matrix in place.
math_mat_transp_in_place(matrix, dim)
#---------------------------------------------------------------------
# Dump the output of the function
dump matrix
#---------------------------------------------------------------------
# closing the patran environment.
uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
math_vec_len ()
real vector(3)
real length
#---------------------------------------------------------------------
# Argument Initialization.
#---------------------------------------------------------------------
# Compute the length of the vector
#---------------------------------------------------------------------
# Dump the output of the function
dump length
#---------------------------------------------------------------------
# closing the patran environment.
# uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
math_vec_norm ()
REAL vector(3)
REAL syseps
#---------------------------------------------------------------------
# Argument Initialization.
#---------------------------------------------------------------------
# This function normalizes a 3-D vector
Main Index
1716
Code Examples
#---------------------------------------------------------------------
# Dump the output of the function
dump vector
#---------------------------------------------------------------------
# closing the patran environment.
# uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
mth_vec_add ()
REAL vec1(3)
REAL vec2(3)
REAL vec3(3)
INTEGER dim
#---------------------------------------------------------------------
# Argument Initialization.
dim = 3
vec1 = [2.0, 3.0, 4.0]
vec2 = [3.0, 4.0, 6.0]
#---------------------------------------------------------------------
# Computes the sum of two n-dimensional vectors.
#---------------------------------------------------------------------
# Dump the output of the function
dump vec3
#---------------------------------------------------------------------
# closing the patran environment.
# uil_file_close.goquit( )
Main Index
CHAPTER 17 1717
Utilities
#---------------------------------------------------------------------
# End of File.
mth_vec_cross_prod ()
REAL vec1(2, 3)
REAL vec2(2, 3)
REAL vec3(2, 3)
INTEGER dim
#---------------------------------------------------------------------
# Argument Initialization.
dim = 2
vec1 = [[1.0, 2.0, 1.0][2.0, 3.0, 4.0]]
vec2 = [[4.0, 2.0, 3.0][3.0, 1.0, 2.0]]
#---------------------------------------------------------------------
# Computes the cross product of two 3-dimensional vectors array.
#---------------------------------------------------------------------
# Dump the output of the function
dump vec3
#---------------------------------------------------------------------
# closing the patran environment.
# uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
mth_vec_dot_prod ()
REAL vec1(3)
REAL vec2(3)
REAL product
#---------------------------------------------------------------------
# Argument Initialization.
#---------------------------------------------------------------------
# Computes the dot product of two 3-dimensional vectors.
#---------------------------------------------------------------------
# Dump the output of the function
dump product
#---------------------------------------------------------------------
# closing the patran environment.
# uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
mth_vec_length ()
real vector(3)
real length
#---------------------------------------------------------------------
Main Index
CHAPTER 17 1719
Utilities
# Argument Initialization.
#---------------------------------------------------------------------
# Compute the length of the vector
length = mth_vec_length(vector)
#---------------------------------------------------------------------
# Dump the output of the function
dump length
#---------------------------------------------------------------------
# closing the patran environment.
# uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
mth_vec_scale
REAL scale_factor
REAL vector(3)
REAL dim
#---------------------------------------------------------------------
# Argument Initialization.
scale_factor = 2.5
dim = 3
vector = [2.0, 3.0, 4.0]
#---------------------------------------------------------------------
# Scale a vector by a scale factor.
#---------------------------------------------------------------------
# Dump the output of the function
dump vector
#---------------------------------------------------------------------
# closing the patran environment.
Main Index
1720
Code Examples
# uil_file_close.goquit( )
#---------------------------------------------------------------------
# End of File.
rpc_add_server ()
i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)
dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )
dump i_return_value
#---------------------------------------------------------------------
# Put an integer value of 100 to the output stream (i.e. to the
# server)
#
i_value = 100
i_return_value = @
rpc_put_integer @
( i_handle, @
i_value )
dump i_return_value
#---------------------------------------------------------------------
# Send the remote procedure call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
i_return_value = @
rpc_call @
( i_handle )
dump i_return_value
# Get the integer from the input stream (i.e. from the server)
#
i_return_value = @
rpc_get_integer @
( i_handle, @
i_get_value )
dump i_return_value
dump i_get_value
#---------------------------------------------------------------------
rpc_call ()
#
# Before running this file, run the script
# compile.rpc_test.script in the same platform
# where this file is supposed to run. The script
# will compile “rpc_test.c” and prepare an
# executable “rpc_test”. Copy the executable to
# the current working directory.
#
# This file can be run by starting a session of
# MSC.Patran and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function rpc_call() has the following arguments:
#
# rpc_call
# ( handle )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_server[128]
INTEGER i_prog_num
INTEGER i_prog_ver
STRING s_host[128]
INTEGER i_handle
INTEGER i_value
INTEGER i_get_value
INTEGER i_return_value
#---------------------------------------------------------------------
# Start a program “rpc_test” in the back ground using the function
# utl_process_spawn(). This will act as the server. Set the program
# number to be 12345 and the version 1.
#
s_server = “rpc_test”
i_prog_num = 12345
i_prog_ver = 1
i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)
dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )
Main Index
CHAPTER 17 1723
Utilities
dump i_return_value
#---------------------------------------------------------------------
# Put an integer value of 100 to the output stream (i.e. to the
# server)
#
i_value = 100
i_return_value = @
rpc_put_integer @
( i_handle, @
i_value )
dump i_return_value
#---------------------------------------------------------------------
# Send the remote procedure call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
i_return_value = @
rpc_call @
( i_handle )
dump i_return_value
#---------------------------------------------------------------------
# Get the integer from the input stream (i.e. from the server)
#
i_return_value = @
rpc_get_integer @
( i_handle, @
i_get_value )
dump i_return_value
dump i_get_value
#---------------------------------------------------------------------
rpc_clear_output ()
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_handle
INTEGER i_count
STRING s_server[128]
INTEGER i_prog_num
INTEGER i_prog_ver
STRING s_host[128]
INTEGER i_handle
STRING s_value[128]
STRING s_get_value[128]
INTEGER i_return_value
#---------------------------------------------------------------------
# Start a program “rpc_test” in the back ground using the function
# utl_process_spawn(). This will act as the server. Set the program
# number to be 12345 and the version 1.
#
s_server = “rpc_test”
i_prog_num = 12345
i_prog_ver = 1
i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)
dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )
dump i_return_value
#---------------------------------------------------------------------
# Put a string “MSC.Patran Welcomes” to the output stream ( i.e. to
# the server)
#
s_value = “MSC.Patran Welcomes”
i_return_value = @
rpc_put_string @
( i_handle, @
s_value )
dump i_return_value
#---------------------------------------------------------------------
# Send the remote procedure call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
Main Index
CHAPTER 17 1725
Utilities
#
i_return_value = @
rpc_call @
( i_handle )
dump i_return_value
#---------------------------------------------------------------------
# Get the string from the input stream (i.e. from the server)
#
i_return_value = @
rpc_get_string @
( i_handle, @
s_get_value )
dump i_return_value
dump s_get_value
#---------------------------------------------------------------------
s_value = “MSC.Patran again welcomes you”
i_return_value = @
rpc_put_string @
( i_handle, @
s_value )
dump i_return_value
i_return_value = @
rpc_call @
( i_handle )
dump i_return_value
rpc_get_bool_array ()
#
# rpc_get_bool_array
# ( handle,
# value,
# count )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_handle
LOGICAL la_put_value(4)
INTEGER i_count
STRING s_server[128]
INTEGER i_prog_num
INTEGER i_prog_ver
STRING s_host[128]
LOGICAL la_value(4)
INTEGER i_return_value
#---------------------------------------------------------------------
# Start a program “rpc_test” in the back ground using the function
# utl_process_spawn(). This will act as the server. Set the program
# number to be 12345 and the version 1.
#
s_server = “rpc_test”
i_prog_num = 12345
i_prog_ver = 1
i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)
dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )
dump i_return_value
#---------------------------------------------------------------------
# Put a boolean array to the output stream (i.e. to the server)
#
la_put_value = [TRUE, FALSE, TRUE, FALSE]
i_count = 4
i_return_value = @
rpc_put_bool_array @
( i_handle, @
la_put_value, @
Main Index
CHAPTER 17 1727
Utilities
i_count )
dump i_return_value
#---------------------------------------------------------------------
# Send the remote procedure call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
i_return_value = @
rpc_call @
( i_handle )
dump i_return_value
# Get the boolean array from the input stream (i.e. from the server)
#
i_return_value = @
rpc_get_bool_array @
( i_handle, @
la_value, @
i_count )
dump i_return_value
dump la_value
#---------------------------------------------------------------------
rpc_get_boolean ()
i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)
dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )
dump i_return_value
#---------------------------------------------------------------------
# Put an boolean value of TRUE to the output stream (i.e. to the
# server)
#
l_put_value = TRUE
i_return_value = @
rpc_put_boolean @
( i_handle, @
l_put_value )
dump i_return_value
#---------------------------------------------------------------------
# Send the remote procedure call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
i_return_value = @
rpc_call @
( i_handle )
dump i_return_value
# Get the Boolean from the input stream (i.e. from the server)
#
i_return_value = @
rpc_get_boolean @
( i_handle, @
l_value )
dump i_return_value
Main Index
CHAPTER 17 1729
Utilities
dump l_value
#---------------------------------------------------------------------
rpc_get_command ()
i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)
dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
Main Index
1730
Code Examples
#
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )
dump i_return_value
#---------------------------------------------------------------------
# Put a command value of 4 to the output stream (i.e. to the
# server)
#
i_put_value = 4
i_return_value = @
rpc_put_command @
( i_handle, @
i_put_value )
dump i_return_value
#---------------------------------------------------------------------
# Send the remote procedure call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
i_return_value = @
rpc_call @
( i_handle )
dump i_return_value
# Get the command value from the input stream (i.e. from the server)
#
i_return_value = @
rpc_get_command @
( i_handle, @
i_value )
dump i_return_value
dump i_value
#---------------------------------------------------------------------
rpc_get_int_array ()
i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)
dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )
dump i_return_value
#---------------------------------------------------------------------
Main Index
1732
Code Examples
dump i_return_value
# Get the integer array from the input stream (i.e. from the server)
#
i_return_value = @
rpc_get_int_array @
( i_handle, @
ia_value, @
i_count )
dump i_return_value
dump ia_value
#---------------------------------------------------------------------
rpc_get_integer ()
STRING s_host[128]
INTEGER i_handle
INTEGER i_put_value
INTEGER i_value
INTEGER i_return_value
#---------------------------------------------------------------------
# Start a program “rpc_test” in the back ground using the function
# utl_process_spawn(). This will act as the server. Set the program
# number to be 12345 and the version 1.
#
s_server = “rpc_test”
i_prog_num = 12345
i_prog_ver = 1
i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)
dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )
dump i_return_value
#---------------------------------------------------------------------
# Put an integer value of 100 to the output stream (i.e. to the
# server)
#
i_put_value = 100
i_return_value = @
rpc_put_integer @
( i_handle, @
i_put_value )
dump i_return_value
#---------------------------------------------------------------------
# Send the remote procedure call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
i_return_value = @
rpc_call @
( i_handle )
dump i_return_value
Main Index
1734
Code Examples
# Get the integer from the input stream (i.e. from the server)
#
i_return_value = @
rpc_get_integer @
( i_handle, @
i_value )
dump i_return_value
rpc_get_real ()
i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)
dump i_return_value
dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )
dump i_return_value
#---------------------------------------------------------------------
# Put an integer value of 100 to the output stream (i.e. to the
# server)
#
r_put_value = 10.0
i_return_value = @
rpc_put_real @
( i_handle, @
r_put_value )
dump i_return_value
#---------------------------------------------------------------------
# Send the Remote Procedure Call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
i_return_value = @
rpc_call @
( i_handle )
dump i_return_value
# Get the integer from the input stream (i.e. from the server)
#
i_return_value = @
rpc_get_real @
( i_handle, @
r_value )
dump i_return_value
dump r_value
#---------------------------------------------------------------------
Main Index
1736
Code Examples
rpc_get_real_array ()
i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)
dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
Main Index
CHAPTER 17 1737
Utilities
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )
dump i_return_value
#---------------------------------------------------------------------
# Put a real array to the output stream (i.e. to the server)
#
ra_put_value = [100.0, 200.0, 300.0, 400.0]
i_count = 4
i_return_value = @
rpc_put_real_array @
( i_handle, @
ra_put_value, @
i_count )
dump i_return_value
#---------------------------------------------------------------------
# Send the remote procedure call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
i_return_value = @
rpc_call @
( i_handle )
dump i_return_value
# Get the real array from the input stream (i.e. from the server)
#
i_return_value = @
rpc_get_real_array @
( i_handle, @
ra_value, @
i_count )
dump i_return_value
dump ra_value
#---------------------------------------------------------------------
rpc_get_status ()
i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)
dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )
dump i_return_value
#---------------------------------------------------------------------
# Put a status value of 1 to the output stream (i.e. to the server)
Main Index
CHAPTER 17 1739
Utilities
#
i_put_value = 1
i_return_value = @
rpc_put_status @
( i_handle, @
i_put_value )
dump i_return_value
#---------------------------------------------------------------------
# Send the remote procedure call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
i_return_value = @
rpc_call @
( i_handle )
dump i_return_value
# Get the status value from the input stream (i.e. from the server)
#
i_return_value = @
rpc_get_status @
( i_handle, @
i_value )
dump i_return_value
dump i_value
#---------------------------------------------------------------------
rpc_get_string ()
STRING s_value[128]
INTEGER i_return_value
#---------------------------------------------------------------------
# Start a program “rpc_test” in the back ground using the function
# utl_process_spawn(). This will act as the server. Set the program
# number to be 12345 and the version 1.
#
s_server = “rpc_test”
i_prog_num = 12345
i_prog_ver = 1
i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)
dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )
dump i_return_value
#---------------------------------------------------------------------
# Put a string “MSC.Patran” to the output stream ( i.e. to the
# server)
#
s_put_value = “MSC.Patran”
i_return_value = @
rpc_put_string @
( i_handle, @
s_put_value )
dump i_return_value
#---------------------------------------------------------------------
# Send the remote procedure call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
i_return_value = @
rpc_call @
( i_handle )
dump i_return_value
# Get the string from the input stream (i.e. from the server)
#
i_return_value = @
Main Index
CHAPTER 17 1741
Utilities
rpc_get_string @
( i_handle, @
s_value )
dump i_return_value
dump s_value
#---------------------------------------------------------------------
rpc_init_client ()
i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)
dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )
dump i_return_value
#---------------------------------------------------------------------
# Put an integer value of 100 to the output stream (i.e. to the
# server)
#
i_value = 100
i_return_value = @
rpc_put_integer @
( i_handle, @
i_value )
dump i_return_value
#---------------------------------------------------------------------
# Send the remote procedure call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
i_return_value = @
rpc_call @
( i_handle )
dump i_return_value
# Get the integer from the input stream (i.e. from the server)
i_return_value = @
rpc_get_integer @
( i_handle, @
i_get_value )
dump i_return_value
dump i_get_value
#---------------------------------------------------------------------
rpc_inquire_count ()
i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)
dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
Main Index
1744
Code Examples
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )
dump i_return_value
#---------------------------------------------------------------------
# Put a string “MSC.Patran Welcomes” to the output stream ( i.e. to
# the server)
#
s_value = “MSC.Patran Welcomes”
i_return_value = @
rpc_put_string @
( i_handle, @
s_value )
dump i_return_value
#---------------------------------------------------------------------
# Send the remote procedure call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
i_return_value = @
rpc_call @
( i_handle )
dump i_return_value
#---------------------------------------------------------------------
# Determine how many items remain in the input stream.
i_return_value = @
rpc_inquire_count @
( i_handle, @
i_count )
dump i_return_value
rpc_inquire_item ()
i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)
dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
Main Index
1746
Code Examples
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )
dump i_return_value
#---------------------------------------------------------------------
# Put strings “MSC.Patran Welcomes you” to the output stream
# ( i.e. to the server)
#
s_value = “MSC.Patran Welcomes you”
i_return_value = @
rpc_put_string @
( i_handle, @
s_value )
dump i_return_value
#---------------------------------------------------------------------
# Send the remote procedure call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
i_return_value = @
rpc_call @
( i_handle )
dump i_return_value
#---------------------------------------------------------------------
# Determine the type of data and the number of items in that type
# in the current input stream.
i_return_value = @
rpc_inquire_item @
( i_handle, @
i_type, @
i_count )
dump i_return_value
rpc_put_bool_array ()
#
# Before running this file, run the script
# compile.rpc_test.script in the same platform
# where this file is supposed to run. The script
# will compile “rpc_test.c” and prepare an
# executable “rpc_test”. Copy the executable to
# the current working directory.
#
# This file can be run by starting a session of
# MSC.Patran and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# The function rpc_put_bool_array() has the following arguments:
#
# rpc_put_bool_array
# ( handle,
# value,
# count )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_handle
LOGICAL la_value(4)
INTEGER i_count
STRING s_server[128]
INTEGER i_prog_num
INTEGER i_prog_ver
STRING s_host[128]
LOGICAL la_get_value(4)
INTEGER i_return_value
#---------------------------------------------------------------------
# Start a program “rpc_test” in the back ground using the function
# utl_process_spawn(). This will act as the server. Set the program
# number to be 12345 and the version 1.
#
s_server = “rpc_test”
i_prog_num = 12345
i_prog_ver = 1
i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)
dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
Main Index
1748
Code Examples
rpc_init_client @
( s_server, @
i_handle )
dump i_return_value
#---------------------------------------------------------------------
# Put a boolean array to the output stream (i.e. to the server)
#
la_value = [TRUE, FALSE, TRUE, FALSE]
i_count = 4
i_return_value = @
rpc_put_bool_array @
( i_handle, @
la_value, @
i_count )
dump i_return_value
#---------------------------------------------------------------------
# Send the remote procedure call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
i_return_value = @
rpc_call @
( i_handle )
dump i_return_value
# Get the boolean array from the input stream (i.e. from the server)
#
i_return_value = @
rpc_get_bool_array @
( i_handle, @
la_get_value, @
i_count )
dump i_return_value
dump la_get_value
#---------------------------------------------------------------------
rpc_put_boolean ()
# value )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_server[128]
INTEGER i_prog_num
INTEGER i_prog_ver
STRING s_host[128]
INTEGER i_handle
LOGICAL l_value
LOGICAL l_get_value
INTEGER i_return_value
#---------------------------------------------------------------------
# Start a program “rpc_test” in the back ground using the function
# utl_process_spawn(). This will act as the server. Set the program
# number to be 12345 and the version 1.
#
s_server = “rpc_test”
i_prog_num = 12345
i_prog_ver = 1
i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)
dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )
dump i_return_value
#---------------------------------------------------------------------
# Put an boolean value of TRUE to the output stream (i.e. to the
# server)
#
l_value = TRUE
i_return_value = @
rpc_put_boolean @
( i_handle, @
l_value )
dump i_return_value
#---------------------------------------------------------------------
# Send the remote procedure call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
Main Index
1750
Code Examples
i_return_value = @
rpc_call @
( i_handle )
dump i_return_value
# Get the Boolean from the input stream (i.e. from the server)
#
i_return_value = @
rpc_get_boolean @
( i_handle, @
l_get_value )
dump i_return_value
dump l_get_value
#---------------------------------------------------------------------
rpc_put_command ()
i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)
dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )
dump i_return_value
#---------------------------------------------------------------------
# Put a command value of 4 to the output stream (i.e. to the server)
#
i_value = 4
i_return_value = @
rpc_put_command @
( i_handle, @
i_value )
dump i_return_value
#---------------------------------------------------------------------
# Send the remote procedure call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
i_return_value = @
rpc_call @
( i_handle )
dump i_return_value
# Get the command value from the input stream (i.e. from the server)
#
i_return_value = @
rpc_get_command @
( i_handle, @
i_get_value )
dump i_return_value
dump i_get_value
#---------------------------------------------------------------------
Main Index
1752
Code Examples
rpc_put_int_array ()
i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)
dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
Main Index
CHAPTER 17 1753
Utilities
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )
dump i_return_value
#---------------------------------------------------------------------
# Put an integer array to the output stream (i.e. to the server)
#
ia_value = [1,2,3,4]
i_count = 4
i_return_value = @
rpc_put_int_array @
( i_handle, @
ia_value, @
i_count )
dump i_return_value
#---------------------------------------------------------------------
# Send the remote procedure call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
i_return_value = @
rpc_call @
( i_handle )
dump i_return_value
# Get the integer array from the input stream (i.e. from the server)
#
i_return_value = @
rpc_get_int_array @
( i_handle, @
ia_get_value, @
i_count )
dump i_return_value
dump ia_get_value
#---------------------------------------------------------------------
rpc_put_integer ()
i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)
dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )
dump i_return_value
#---------------------------------------------------------------------
# Put an integer value of 100 to the output stream (i.e. to the
Main Index
CHAPTER 17 1755
Utilities
# server)
#
i_value = 100
i_return_value = @
rpc_put_integer @
( i_handle, @
i_value )
dump i_return_value
#---------------------------------------------------------------------
# Send the remote procedure call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
i_return_value = @
rpc_call @
( i_handle )
dump i_return_value
# Get the integer from the input stream (i.e. from the server)
#
i_return_value = @
rpc_get_integer @
( i_handle, @
i_get_value )
dump i_return_value
dump i_get_value
#---------------------------------------------------------------------
rpc_put_real ()
INTEGER i_handle
REAL r_value
REAL r_get_value
INTEGER i_return_value
#---------------------------------------------------------------------
# Start a program “rpc_test” in the back ground using the function
# utl_process_spawn(). This will act as the server. Set the program
# number to be 12345 and the version 1.
#
s_server = “rpc_test”
i_prog_num = 12345
i_prog_ver = 1
i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)
dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )
dump i_return_value
#---------------------------------------------------------------------
# Put an integer value of 100 to the output stream (i.e. to the
# server)
#
r_value = 11.1
i_return_value = @
rpc_put_real @
( i_handle, @
r_value )
dump i_return_value
#---------------------------------------------------------------------
# Send the Remote Procedure Call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
i_return_value = @
rpc_call @
( i_handle )
dump i_return_value
# Get the integer from the input stream (i.e. from the server)
Main Index
CHAPTER 17 1757
Utilities
#
i_return_value = @
rpc_get_real @
( i_handle, @
r_get_value )
dump i_return_value
dump r_get_value
#---------------------------------------------------------------------
rpc_put_real_array ()
i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)
dump i_return_value
dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )
dump i_return_value
#---------------------------------------------------------------------
# Put a real array to the output stream (i.e. to the server)
#
ra_value = [100.0, 200.0, 300.0, 400.0]
i_count = 4
i_return_value = @
rpc_put_real_array @
( i_handle, @
ra_value, @
i_count )
dump i_return_value
#---------------------------------------------------------------------
# Send the remote procedure call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
i_return_value = @
rpc_call @
( i_handle )
dump i_return_value
# Get the real array from the input stream (i.e. from the server)
#
i_return_value = @
rpc_get_real_array @
( i_handle, @
ra_get_value, @
i_count )
dump i_return_value
dump ra_get_value
#---------------------------------------------------------------------
Main Index
CHAPTER 17 1759
Utilities
rpc_put_status ()
i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)
dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
i_return_value = @
rpc_add_server @
Main Index
1760
Code Examples
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )
dump i_return_value
#---------------------------------------------------------------------
# Put a status value of 1 to the output stream (i.e. to the server)
#
i_value = 1
i_return_value = @
rpc_put_status @
( i_handle, @
i_value )
dump i_return_value
#---------------------------------------------------------------------
# Send the remote procedure call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
i_return_value = @
rpc_call @
( i_handle )
dump i_return_value
# Get the status value from the input stream (i.e. from the server)
#
i_return_value = @
rpc_get_status @
( i_handle, @
i_get_value )
dump i_return_value
dump i_get_value
#---------------------------------------------------------------------
rpc_put_string ()
i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)
dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )
dump i_return_value
#---------------------------------------------------------------------
# Put a string “MSC.Patran” to the output stream ( i.e. to the
# server)
#
s_value = “MSC.Patran”
i_return_value = @
Main Index
1762
Code Examples
rpc_put_string @
( i_handle, @
s_value )
dump i_return_value
#---------------------------------------------------------------------
# Send the remote procedure call(RPC) to the server and make client
# to wait for the response from the server by calling rpc_call().
#
i_return_value = @
rpc_call @
( i_handle )
dump i_return_value
# Get the string from the input stream (i.e. from the server)
#
i_return_value = @
rpc_get_string @
( i_handle, @
s_get_value )
dump i_return_value
dump s_get_value
#---------------------------------------------------------------------
rpc_timeout ()
i_return_value = @
utl_process_spawn @
(“rpc_test 12345”, FALSE)
dump s_host
#---------------------------------------------------------------------
# Register the server program and associate it with the program
# number, program version and the server host.
#
i_return_value = @
rpc_add_server @
( s_server, @
i_prog_num, @
i_prog_ver, @
s_host )
dump i_return_value
#---------------------------------------------------------------------
# Initialise client server communication and get the handle for
# further communication with the server.
#
i_return_value = @
rpc_init_client @
( s_server, @
i_handle )
dump i_return_value
#---------------------------------------------------------------------
# Call the function to change the amount of time before all
# subsequent rpc calls will timeout.
#
l_return_value = @
rpc_timeout @
( i_handle, @
i_seconds )
dump l_return_value
#---------------------------------------------------------------------
string_newline_count ()
string_newline_count @
( s_chars, @
i_nl )
string_newline_position ()
STRING s_s[1]
#---------------------------------------------------------------------
# s_new = “Geometric %N% Software %N% Services %N% Limited %N%”
s_new = “Geometric %N% Software %N% Services %N% Limited %N%”
string_newline_count @
( s_chars, @
i_nl )
SYS_ALLOCATE_ARRAY(iv_pos,1,i_nl)
string_newline_position @
( s_chars, @
iv_pos )
SYS_FREE_ARRAY(iv_pos)
#---------------------------------------------------------------------
timer_off ()
timer_on ()
uil_list_union_expr ()
#---------------------------------------------------------------------
# Variable Declarations
STRING s_operator[5]
STRING s_in_string_1[32]
STRING s_in_string_2[32]
STRING s_out_string[VIRTUAL]
INTEGER i_return_value
#---------------------------------------------------------------------
# Adding two lists of surfaces.
s_operator = "A"
s_in_string_1 = "Surface 1:4"
s_in_string_2 = "Surface 3:7"
i_return_value = uil_list_union_expr @
( s_operator, @
s_in_string_1, @
s_in_string_2, @
s_out_string )
dump s_out_string
dump i_return_value
#---------------------------------------------------------------------
# Subracting one surface list from the other.
s_operator = "R"
s_in_string_1 = "Surface 1:4"
s_in_string_2 = "Surface 3"
i_return_value = uil_list_union_expr @
( s_operator, @
s_in_string_1, @
s_in_string_2, @
s_out_string )
dump s_out_string
dump i_return_value
#---------------------------------------------------------------------
# Removes repeated numbers from a list.
s_operator = "C"
s_in_string_1 = "Surface 1:4 2"
s_in_string_2 = ""
i_return_value = uil_list_union_expr @
( s_operator, @
s_in_string_1, @
s_in_string_2, @
s_out_string )
dump s_out_string
dump i_return_value
#---------------------------------------------------------------------
util_equal_real ()
# r_a = 202.1236
r_a = 202.1236
# r_b = 202.123
r_b = 202.123
#---------------------------------------------------------------------
Main Index
CHAPTER 17 1769
Utilities
util_real_equal_null ()
util_rounder ()
i_return_value = @
util_rounder @
( r_rval, @
i_nsigd, @
r_rout )
dump i_return_value
# r_rval = 202.125
r_rval = 202.125
i_return_value = @
util_rounder @
( r_rval, @
i_nsigd, @
r_rout )
dump i_return_value
Main Index
MSC.Acumen, Volume 2: Code Examples
CHAPTER
Support Files
18
■ Introduction
Main Index
1772
Code Examples
18.1 Introduction
This chapter provides session, pcl, and other files used to support the example code listed in this
manual. Each of these files is designed so that the file listing can be placed in a text file using cut
and past operations. The support code session files list instructions in comments that can be
followed to create the database or other files needed by the examples.
Read the comments in the supporting files and the example file comments and code closely to
understand how these files work together.
#---------------------------------------------------------------------
# File : fem1.ses
#
# Purpose : This file will generate a PATRAN database
# “fem1.db” which consists of a solid of Al
# with 16 Hexa elements, 45 nodes, 2 LBC’s.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
#---------------------------------------------------------------------
# Create a new database.
uil_file_new.go( ““, “./fem1.db” )
$? YES 36000002
#---------------------------------------------------------------------
# Create a Hyper patch using XYZ method
STRING asm_create_hpat_xyz_created_ids[VIRTUAL]
asm_const_hpat_xyz( “1”, “<2 1 1>”, “[0 0 0]”, “Coord 0”, @
asm_create_hpat_xyz_created_ids )
#---------------------------------------------------------------------
# Create a material “Al”
material.create( “Analysis code ID”, 1, “Analysis type ID”, @
1, “Al”, 0, “Date: 26-Jun-97 Time: 12:02:50”, @
“Isotropic”, 1, “Directionality”, @
1, “Linearity”, 1, “Homogeneous”, 0, “Linear Elastic”, @
1, “Model Options & IDs”, [““, ““, ““, ““, ““], @
[0, 0, 0, 0, 0], “Active Flag”, @
1, “Create”, 10, “External Flag”, FALSE, “Property IDs”, @
[“Elastic Modulus”, “Poisson Ratio”], [2, 5, 0], @
“Property Values”, [“7.1E10”, “0.3”, ““] )
#---------------------------------------------------------------------
# Create a property set “new_prop”
elementprops_create( “new_prop”, 71, 25, 30, 1, 1, 20, @
[13, 21, 4124, 4126, 4125], [5, 4, 4, 4, 4], @
[“m:Al”, ““, ““, ““, ““], “Solid 1” )
#---------------------------------------------------------------------
# Create a mesh by creating a mesh seed and then meshing it.
mesh_seed_create( “Solid 1.2.1 1.2.2 1.2.3 1.2.4 1.3.2”// @
“ 1.4.2 1.5.3 1.6.3 1.1.1 1.1.2 1.1.3 1.1.4 1.3.4 1.4.4”// @
“ 1.5.1 1.6.1 “, 1, 2, 0., 0., 0. )
mesh_seed_create( “Solid 1.4.1 1.4.3 1.3.3 1.3.1 “, @
1, 4, 0., 0., 0. )
mesh_seed_display_mgr.erase( )
INTEGER fem_create_mesh_solid_num_nodes
INTEGER fem_create_mesh_solid_num_elems
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]
fem_create_mesh_sol_3( “IsoMesh”, 0, “Solid 1 “, 1, [0.1], @
“Hex8”, “1”, “1”,”Coord 0”, “Coord 0”, @
fem_create_mesh_solid_num_nodes, @
fem_create_mesh_solid_num_elems, @
fem_create_mesh_s_nodes_created, @
Main Index
CHAPTER 18 1773
Support Files
fem_create_mesh_s_elems_created )
mesh_seed_display_mgr.erase( )
#---------------------------------------------------------------------
# Create a Boundary Condition
loadsbcs_create( “new_lbc”, “Displacement”, “Nodal”, @
““, “Static”, [“Solid 1.1”], “Geometry”, “Coord 0”, 1., @
[“< 0 0 0 >”, “< 0 0 0 >”], [““, ““] )
#---------------------------------------------------------------------
# Create a Load
loadsbcs_create( “new_load”, “Displacement”, @
“Element Uniform”, “3D”, “Static”, @
[“Element 4:16:4.4”], “FEM”, “Coord 0”, 1., @
[“< 0.1 0 0 >”], [““] )
#---------------------------------------------------------------------
ga_view_aa_set(-67.,0.,-34.)
#---------------------------------------------------------------------
# End of File
#---------------------------------------------------------------------
# File : fem2.ses
#
# Purpose : This file will generate a PATRAN database
# “fem2.db” which consists of 32 Quad Elements,
# 1 MPC ( Which consists of 3 Sub-MPCs ), 2
# LBCs.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#---------------------------------------------------------------------
# Create a New database.
uil_file_new.go( ““, “./fem2.db” )
$? YES 36000002
#---------------------------------------------------------------------
# Create 4 Points.
STRING asm_create_grid_xyz_created_ids[VIRTUAL]
asm_const_grid_xyz( ““, “[0 0 0] [10 0 0] [10 3 0] [0 3 0]”, @
“Coord 0”, asm_create_grid_xyz_created_ids )
#---------------------------------------------------------------------
# Transform Point 1:4 to create 4 more points.
STRING sgm_transform_point_created_ids[VIRTUAL]
asm_transform_grid_translate( “5”, “<10 0 -1>”, “Coord 0”, @
1, FALSE, FALSE,”Point 1:4 “, @
sgm_transform_point_created_ids )
#---------------------------------------------------------------------
# Create 4 Lines.
STRING asm_line_2point_created_ids[VIRTUAL]
asm_const_line_2point( “1”, “Point 1 “, “Point 4 “, 0, ““, @
50., 1, asm_line_2point_created_ids )
asm_const_line_2point( “2”, “Point 2 “, “Point 3 “, 0, ““, @
50., 1, asm_line_2point_created_ids )
asm_const_line_2point( “3”, “Point 5 “, “Point 8 “, 0, ““, @
50., 1, asm_line_2point_created_ids )
asm_const_line_2point( “4”, “Point 6 “, “Point 7 “, 0, ““, @
50., 1, asm_line_2point_created_ids )
#---------------------------------------------------------------------
# Create 2 Surfaces.
STRING sgm_surface_2curve_created_ids[VIRTUAL]
sgm_const_surface_2curve( “1”, “Curve 1 “, “Curve 2 “, @
sgm_surface_2curve_created_ids )
sgm_const_surface_2curve( “2”, “Curve 3 “, “Curve 4 “, @
sgm_surface_2curve_created_ids )
#---------------------------------------------------------------------
# Create Mesh Seeds.
mesh_seed_create( “Curve 1:4 “, 1, 2, 0., 0., 0. )
Main Index
1774
Code Examples
#---------------------------------------------------------------------
# File : fem3.ses
#
# Purpose : This file will generate a PATRAN database
# “fem3.db” which consists of 9 Quad elements,
# 2 LBCs, 1 MPC, 21 nodes , a surface and
# 2 lines on that surface. It also contains
# 2 groups. The group “new” contains 4 un-referenced
# nodes.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
#---------------------------------------------------------------------
# Create new database “fem3.db”
uil_file_new.go( ““, “./fem3.db” )
$? YES 36000002
#---------------------------------------------------------------------
# Create 4 points
STRING asm_create_grid_xyz_created_ids[VIRTUAL]
asm_const_grid_xyz( ““, “[0 0 0][10 0 0][10 10 0][0 10 0]”, @
“Coord 0”, asm_create_grid_xyz_created_ids )
uil_toolbar.labels_on( )
#---------------------------------------------------------------------
# Create 2 lines
STRING asm_line_2point_created_ids[VIRTUAL]
asm_const_line_2point( “1”, “Point 4 “, “Point 1 “, 0, ““, @
50., 1, asm_line_2point_created_ids )
asm_const_line_2point( “2”, “Point 3 “, “Point 2 “, 0, ““, @
50., 1, asm_line_2point_created_ids )
#---------------------------------------------------------------------
# Create 1 Surface
Main Index
CHAPTER 18 1775
Support Files
STRING sgm_surface_2curve_created_ids[VIRTUAL]
sgm_const_surface_2curve( “1”, “Curve 1 “, “Curve 2 “, @
sgm_surface_2curve_created_ids )
#---------------------------------------------------------------------
# Create mesh seed
ui_exec_function( “mesh_seed_display_mgr”, “init” )
mesh_seed_create( “Curve 1 Surface 1.1 Curve 2 Surface 1.3 “, @
1, 3, 0., 0., 0. )
#---------------------------------------------------------------------
# Mesh the surface with Quad elements
INTEGER fem_create_mesh_surfa_num_nodes
INTEGER fem_create_mesh_surfa_num_elems
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]
fem_create_mesh_surf_2( “IsoMesh”, 0, “Surface 1 “, 1, @
[0.1], “Quad4”, “1”, “1”, “Coord 0”, “Coord 0”, @
fem_create_mesh_surfa_num_nodes, @
fem_create_mesh_surfa_num_elems, @
fem_create_mesh_s_nodes_created, @
fem_create_mesh_s_elems_created )
#---------------------------------------------------------------------
# Create a node at the center
STRING fem_create_nodes__nodes_created[VIRTUAL]
fem_create_nodes( “Coord 0”, “Coord 0”, FALSE, “17”, @
“ [5 5 0]”, fem_create_nodes__nodes_created )
#---------------------------------------------------------------------
# Create 4 more nodes which are unreferenced.
fem_create_nodes( “Coord 0”, “Coord 0”, FALSE, “18 19 20 21”, @
“[5 0 0][10 5 0][0 5 0][5 10 0]”, @
fem_create_nodes__nodes_created )
#---------------------------------------------------------------------
# Create a new group “new” with 4 nodes in it.
ga_group_create( “new” )
ga_group_entity_add( “new”, “Node 18:21” )
ga_group_current_set( “new” )
#---------------------------------------------------------------------
# Create 2 Load/BCs
loadsbcs_create( “BC1”, “Displacement”, “Nodal”, ““, @
“Static”, [“Node 1 4 13 16”], “FEM”, “Coord 0”, 1., @
[“< 0 0 0 >”, “< 0 0 0 >”], [““, ““] )
loadsbcs_create( “Load1”, “Force”, “Nodal”, ““, “Static”, @
[“Node 17”], “FEM”, “Coord 0”, 1., [“< 0 0 -10 >”, @
“< 0 0 0 >”], [““, ““] )
#---------------------------------------------------------------------
# Create a MPC
fem_create_mpc_nodal( 1, “Rigid (Fixed)”, 0., 2, @
[TRUE, FALSE], [0., 0.], @
[“Node 6 7 11 10”, “Node 17”], [““, ““] )
#---------------------------------------------------------------------
# Set view
ga_view_aa_set( -67., 0., -34. )
#---------------------------------------------------------------------
#---------------------------------------------------------------------
# File : field.ses
#
# Purpose : This file will generate a PATRAN database
# “field.db” which consists of a surface meshed using
# QUAD4 elements. The plate held from four sides and
# is loaded at the center. The model has “MSC.Nastran”
# as analysis preference. Analysis results will be
# imported for the same. The session execution will be
# paused, user should get the analysis results using
# MSC.Nastran before pressing ‘RESUME’ button.
#
# This file can be run by starting a session of
Main Index
1776
Code Examples
FUNCTION pick_add(i,s)
INTEGER i
STRING s[]()
ui_write(“Inside pick_add”)
dump i,s
/* dump s */
/*****************************************************************
* Purpose : To Create a FORM to illustrate the function
Main Index
CHAPTER 18 1779
Support Files
#ifndef hilight
#define hilight
#include “appforms.p”
CLASS HILIGHT
/*****************************************************************
* FUNCTION init
*
* Purpose :
*
* Initialize the hilight Form.
*
* Input :
*
* <none>
*
* Output :
*
* <none>
*
******************************************************************/
FUNCTION init()
form_id = UI_FORM_CREATE( @
/* Callback */ ““, @
/* x location */ x_loc, @
/* y location */ y_loc, @
/* position */ “UL”, @
/* width */ FORM_WID_SML, @
/* height */ FORM_HGT_QTR, @
/* label */ “HILIGHT”, @
/* unused */ ““)
y_loc = INTER_WIDGET_SPACE
x_loc = INTER_WIDGET_SPACE
frame_id = UI_SELECTFRAME_CREATE( @
/* parent */ form_id, @
/* call back */ ““, @
/* x location */ x_loc, @
/* y location */ y_loc, @
/* width */ SFRAME_WID_SINGLE, @
/* height */ SFRAME_1SDB_HGT_NO_LABOVE, @
Main Index
1780
Code Examples
/* label */ ““, @
/* recycle */ FALSE )
selectdatabox_id = UI_SELECTDATABOX_CREATE( @
/* parent */ frame_id, @
/* call back */ ““, @
/* x location */ SFRAME_L_MARGIN, @
/* y location */ SFRAME_T_MARGIN, @
/* label_length */ 0.0, @
/* Box length */ SDBOX_WID_SINGLE, @
/* label */ ““, @
/* Value */ ““, @
/* Label Above */ FALSE, @
/* Datatype */ “ANY”, @
/* Prompt */ “Select Any Entity”)
y_loc = FORM_HGT_QTR-2*INTER_WIDGET_SPACE-BUTTON_DEFAULT_HGT
button_id = UI_BUTTON_CREATE ( @
/* parent */ form_id, @
/* call back */ “button_cb”, @
/* x location */ BUTTON_THIRD_X_LOC2, @
/* y location */ y_loc, @
/* width */ BUTTON_WID_THIRD, @
/* height */ 0, @
/* label */ “OK”, @
/* unused */ TRUE, @
/* highlight */ FALSE)
/*****************************************************************
* FUNCTION display
*
* Purpose :
*
* To display the hilight Form.
*
* Input :
*
* <none>
*
* Output :
*
* <none>
*
******************************************************************/
FUNCTION display()
select_focus.select_manager(selectdatabox_id,”ANY”, @
“Select Any Entity”)
ui_form_display(“HILIGHT”)
ui_set_focus(selectdatabox_id)
/*****************************************************************
* FUNCTION exit
*
* Purpose :
*
* To delete the form.
Main Index
CHAPTER 18 1781
Support Files
*
* Input :
*
* <none>
*
* Output :
*
* <none>
*
******************************************************************/
FUNCTION exit()
select_focus.exit()
ui_form_delete(“HILIGHT”)
END FUNCTION
/*****************************************************************
* FUNCTION get_select_id()
*
* Purpose :
*
* To get the selectdatabox id
*
* Input :
*
* <none>
*
* Output :
*
* select_wid - Widget id of the selectdatabox
*
******************************************************************/
FUNCTION get_select_id(select_wid)
WIDGET select_wid
select_wid = selectdatabox_id
/*****************************************************************
* FUNCTION button_cb
*
* Purpose :
*
* Hides the HILIGHT form.
*
* Input :
*
* <none>
*
* Output :
*
* <none>
*
******************************************************************/
FUNCTION button_cb()
ui_form_hide(“HILIGHT”)
select_focus.exit()
END FUNCTION
#endif
Main Index
1782
Code Examples
CLASS HILIGHT
FUNCTION init()
y_loc = uil_form_sizes.form_y_loc( 1 ) + @
(uil_form_sizes.form_hgt( 5 )/2)
x_loc = (uil_form_sizes.screen( 1 ) - @
uil_form_sizes.form_wid( 1 ))/2
form_id = UI_FORM_CREATE( @
““, @
x_loc, @
y_loc, @
“UL”, @
uil_form_sizes.form_wid( 1 ), @
uil_form_sizes.form_hgt( 5 ), @
“HILIGHT”, @
““)
y_loc = uil_form_sizes.spacing( 8 )
x_loc = uil_form_sizes.spacing( 8 )
frame_id = UI_SELECTFRAME_CREATE( @
form_id, @
““, @
x_loc, @
y_loc, @
uil_form_sizes.selframe_wid( 1 ), @
uil_form_sizes.selframe_hgt( 1, 2 ), @
““, @
FALSE )
selectdatabox_id = UI_SELECTDATABOX_CREATE( @
frame_id, @
““, @
uil_form_sizes.selframe_margin( 1 ), @
uil_form_sizes.selframe_margin( 3 ), @
0.0, @
uil_form_sizes.sdbox_wid( 1 ), @
““, @
““, @
FALSE, @
“ANY”, @
“Select Any Entity”)
y_loc = uil_form_sizes.form_hgt( 5 )- @
2*uil_form_sizes.spacing( 8 )- @
uil_form_sizes.button_hgt( 2 )
button_id = UI_BUTTON_CREATE ( @
form_id, @
“button_cb”, @
uil_form_sizes.button_x_loc1( 5 ), @
y_loc, @
uil_form_sizes.button_wid( 3 ), @
0, @
“OK”, @
TRUE, @
Main Index
CHAPTER 18 1783
Support Files
FALSE)
END FUNCTION
FUNCTION display()
select_focus.select_manager(selectdatabox_id,”ANY”, @
“Select Any Entity”)
ui_form_display(“HILIGHT”)
ui_set_focus(selectdatabox_id)
END FUNCTION
FUNCTION exit()
select_focus.exit()
ui_form_delete(“HILIGHT”)
END FUNCTION
FUNCTION get_select_id(select_wid)
WIDGET select_wid
select_wid = selectdatabox_id
END FUNCTION
FUNCTION button_cb()
ui_form_hide(“HILIGHT”)
select_focus.exit()
END FUNCTION
END CLASS
/*****************************************************************
* Purpose : To Create a Message form
*
* A medium width quarter height sized form is created
* containing a text widget for message and a
* push button to acknowledge and remove the form.
*
* Side Effects :
* <none>
*
******************************************************************/
#ifndef msg
#define msg
#include “appforms.p”
#include “lpenums.p”
CLASS MSG
/*****************************************************************
* FUNCTION init
*
* Purpose :
Main Index
1784
Code Examples
*
* Initialize the Message Form.
*
* Input :
*
* <none>
*
* Output :
*
* <none>
*
******************************************************************/
FUNCTION init()
msg_form_id = UI_FORM_CREATE( @
/* Callback */ ““, @
/* x location */ x_loc, @
/* y location */ y_loc, @
/* position */ “UL”, @
/* width */ FORM_WID_MED, @
/* height */ FORM_HGT_QTR, @
/* label */ “Message”, @
/* unused */ ““)
y_loc = INTER_WIDGET_SPACE
x_loc = INTER_WIDGET_SPACE
msg_text = UI_TEXT_CREATE( @
/* parent */ msg_form_id, @
/* call back */ ““, @
/* x location */ x_loc, @
/* y location */ y_loc, @
/* width */ TBOX_WID_DOUBLE, @
/* num rows */ 3, @
/* label */ ““, @
/* text */ ““, @
/* editable */ FALSE)
ok_button = UI_BUTTON_CREATE ( @
/* parent */ msg_form_id, @
/* call back */ “ok_button_cb”, @
/* x location */ BUTTON_THIRD_X_LOC_CEN_MED, @
/* y location */ y_loc, @
/* width */ BUTTON_WID_THIRD, @
/* height */ 0, @
/* label */ “OK”, @
/* unused */ TRUE, @
/* highlight */ TRUE)
/*****************************************************************
* FUNCTION display
*
* Purpose :
*
* To display the Message Form.
Main Index
CHAPTER 18 1785
Support Files
*
* Input :
*
* <none>
*
* Output :
*
* <none>
*
******************************************************************/
FUNCTION display()
ui_form_display(“MSG”)
/*****************************************************************
* FUNCTION set_msg()
*
* Purpose :
*
* To Initialize the Message.
*
* Input :
*
* str - STRING[] : Containing message to be displayed.
*
* Output :
*
* <none>
*
******************************************************************/
FUNCTION set_msg(str)
STRING str[]
ELSE
END IF
/*****************************************************************
* FUNCTION ok_button_cb
*
* Purpose :
*
* Hides the ERRMSG form.
*
* Input :
*
* <none>
*
* Output :
*
* <none>
*
Main Index
1786
Code Examples
******************************************************************/
FUNCTION ok_button_cb()
ui_form_delete(“MSG”)
END FUNCTION
/*****************************************************************
* FUNCTION message
*
* Purpose :
*
* Initializes, populates and displays the MSG form.
*
* Input :
*
* str - STRING[] : Containing message to be displayed.
*
* Output :
*
* <none>
*
******************************************************************/
FUNCTION message(mesg)
STRING mesg[]
ui_exec_function(“MSG”,”display”)
MSG.set_msg(mesg)
END FUNCTION
#endif
# File : mpc.ses
#
# Purpose : This file will generate a PATRAN database
# “mpc.db” which consists two nodes and a single
# element.It also consits of five groups and
# eight MPCs (Multi Point Constraints).
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# Model : The database consists of two nodes at location
# [0,0,0] and [1,0,0] and an element connecting it.
# It has five groups i.e “default_group”,”mpc2”,
# “mpc3”,”mpc4” and “mpc5”.Eight Mpc entities
# are created and are placed in the five groups.
# The group names and the mpc numbers are listed
# below
# --------------------------------
# Group NAME | MPC NO
# ---------------|----------------
# default_group | 1,2
# mpc2 | 3
# mpc3 | 4,5
# mpc4 | 6,7,8
# mpc5 | 3,6,7,8
Main Index
CHAPTER 18 1787
Support Files
#
#---------------------------------------------------------------------
# Open a new database “mpc.db”
uil_file_new.go(““,”mpc.db”)
$? YES 36000002
#---------------------------------------------------------------------
# Create two nodes at the location [0,0,0] and [1,0,0].
#
STRING fem_create_nodes__nodes_created[VIRTUAL]
fem_create_nodes( “Coord 0”, “Coord 0”, TRUE, “1”, “ [0 0 0]”, @
fem_create_nodes__nodes_created )
#---------------------------------------------------------------------
# Create an element connecting this two nodes.
#
STRING fem_create_elemen_elems_created[VIRTUAL]
fem_create_elems( “Bar “, “Bar2”, “1”, “Standard”, TRUE, “[0 0 0]”, @
“[1 0 0]”, ““, ““, ““, ““, ““, ““, fem_create_elemen_elems_created )
#---------------------------------------------------------------------
# Create two MPC entities mpc no 1 and mpc no 2 which belongs to the
# default group.The two MPC entities are displacements in x and y
# respectively.
#
fem_create_mpc_nodal( 1, “Explicit”, 0., 2, [TRUE, FALSE], [0., 1.], @
[“Node 2” , “Node 1”], [“UX”, “UX”] )
fem_create_mpc_nodal( 2, “Explicit”, 0., 2, [TRUE, FALSE], [0., 1.], @
[“Node 2” , “Node 1”], [“UY”, “UY”] )
sys_poll_option( 2 )
#---------------------------------------------------------------------
# Create second group with the name “mpc2” and set it to current
# group.
#
ga_group_create( “mpc2” )
ga_group_current_set( “mpc2” )
#---------------------------------------------------------------------
# Create a MPC entity mpc no 3 which is displacement in z direction.
# This entity belongs to group “mpc2”
#
sys_poll_option( 0 )
fem_create_mpc_nodal( 3, “Explicit”, 0., 2, [TRUE, FALSE], [0., 1.], @
[“Node 2” , “Node 1”], [“UZ”, “UZ”] )
sys_poll_option( 2 )
#---------------------------------------------------------------------
# Create third group with the name “mpc3” and set it to current
# group.
#
ga_group_create( “mpc3” )
ga_group_current_set( “mpc3” )
#---------------------------------------------------------------------
# Create two MPC entities mpc no 4 and mpc no 5 which belongs to the
# “mpc3” group.The two MPC entities are displacements in z and y
# respectively.
#
sys_poll_option( 0 )
fem_create_mpc_nodal( 4, “Explicit”, 0., 2, [TRUE, FALSE], [0., 1.], @
[“Node 2” , “Node 1”], [“UZ”, “UZ”] )
fem_create_mpc_nodal( 5, “Explicit”, 0., 2, [TRUE, FALSE], [0., 1.], @
[“Node 2” , “Node 1”], [“UY”, “UY”] )
sys_poll_option( 2 )
Main Index
1788
Code Examples
#---------------------------------------------------------------------
# Create fourth group with the name “mpc4” and set it to current
# group.
#
ga_group_create( “mpc4” )
ga_group_current_set( “mpc4” )
#---------------------------------------------------------------------
# Create three MPC entities mpc no 6,MPC no 7 and mpc no 8 which
# belongs to the “mpc4” group.The three MPC entities are rotations in
# x,y and z respectively.
#
sys_poll_option( 0 )
fem_create_mpc_nodal( 6, “Explicit”, 0., 2, [TRUE, FALSE], [0., 1.], @
[“Node 2” , “Node 1”], [“RX”, “RX”] )
fem_create_mpc_nodal( 7, “Explicit”, 0., 2, [TRUE, FALSE], [0., 1.], @
[“Node 2” , “Node 1”], [“RY”, “RY”] )
fem_create_mpc_nodal( 8, “Explicit”, 0., 2, [TRUE, FALSE], [0., 1.], @
[“Node 2” , “Node 1”], [“RZ”, “RZ”] )
sys_poll_option( 2 )
#---------------------------------------------------------------------
# Create fifth group with the name “mpc5” and set it to current
# group.
#
ga_group_create( “mpc5” )
ga_group_current_set( “mpc5” )
#---------------------------------------------------------------------
# Add the mpc nos 3,6,7,8 to the group “mpc5”.
#
sys_poll_option( 0 )
ga_group_entity_add( “mpc5”, “ Node 1:2 MPC 3” )
ga_group_entity_add( “mpc5”, “ Node 1:2 MPC 6:8” )
#---------------------------------------------------------------------
FUNCTION pcl_func1()
ui_write(“In pcl_func1()”)
ui_write(“Calling pcl_func2()..”)
pcl_func2()
ui_write(“Back in pcl_func1()”)
END FUNCTION
FUNCTION pcl_func2()
ui_write(“In pcl_func2()”)
END FUNCTION
#---------------------------------------------------------------------
# File : plate.ses
#
# Purpose : This file will generate a PATRAN database
# “plate.db” which consists of a surface meshed using
# QUAD4 elements. The plate held from four sides and
# is loaded at the center. The model has “MSC.Nastran”
# as analysis preference.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# Model : The plate is a square of unit 1.
Main Index
CHAPTER 18 1789
Support Files
#
# The model consists of
# * -100000 unit force at the four central nodes.
# * Job name ‘plate1’- is generated using one load
# case ‘Default’
# * Job name ‘plate2’- is generated using three load
# cases ‘Default’,’Load Case2’ and ‘Load Case3’.
#
# Analysis & After running this session file, two ‘*.bdf’ files
# Results : are generated, user may delete these files.
#---------------------------------------------------------------------
# Create a new database and set the preferences
uil_file_new.go(““, “./plate.db”)
$? YES 36000002
#---------------------------------------------------------------------
# Creating a Hpat surface.
STRING asm_create_patch_xy_created_ids[VIRTUAL]
asm_const_patch_xyz( “1”, “<1 1 0>”, “[0 0 0]”, “Coord 0”, @
asm_create_patch_xy_created_ids )
#---------------------------------------------------------------------
# Meshing the plate with QUAD4 elements.
ui_exec_function( “mesh_seed_display_mgr”, “init” )
INTEGER fem_create_mesh_surfa_num_nodes
INTEGER fem_create_mesh_surfa_num_elems
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]
fem_create_mesh_surf_2( “IsoMesh”, 0, “Surface 1 “, 1, [0.2],”Quad4”,@
“1”, “1”, “Coord 0”, “Coord 0”, fem_create_mesh_surfa_num_nodes, @
fem_create_mesh_surfa_num_elems, fem_create_mesh_s_nodes_created, @
fem_create_mesh_s_elems_created )
mesh_seed_display_mgr.erase( )
#---------------------------------------------------------------------
# Creating BC set “fix” to fix the plate edges.
loadsbcs_create( “fix”, “Displacement”, “Nodal”, ““, “Static”, [ @
“Surface 1.1 1.2 1.3 1.4”], “Geometry”, “Coord 0”, 1.,[“<0 0 0 >”,@
“< 0 0 0 >”], [““, ““] )
# Creating Load set “point” to load the plate at the four nodes.
loadsbcs_create( “point”, “Force”, “Nodal”, ““, “Static”, @
[“Node 15 16 21 22”] , “FEM”, “Coord 0”, 1., [“< 0 0 -100000 >”,@
“< >”], [““, ““] )
#---------------------------------------------------------------------
# Isotropic material “iso” created.
material.create( “Analysis code ID”, 1, “Analysis type ID”, 1, “iso”,@
0,”Date: 09-Jul-97 Time: 16:23:14”,”Isotropic”,1,”Directionality”,@
1, “Linearity”, 1, “Homogeneous”, 0, “Linear Elastic”, 1, @
“Model Options & IDs”, [““, ““, ““, ““, ““], [0, 0, 0, 0, 0], @
“Active Flag”, 1,”Create”,10,”External Flag”,FALSE,”Property IDs”,@
[“Elastic Modulus”, “Poisson Ratio”],[2, 5, 0],”Property Values”,@
[“2e11”, “.35”, ““] )
#---------------------------------------------------------------------
# Element properties “metal” created.
elementprops_create( “metal”, 51, 25, 35, 1, 1, 20,[13, 20, 36, 4037,@
4111, 4118, 4119],[5, 9, 1, 1, 1, 1, 1],[“m:iso”,””, “.1”, ““, ““,@
““, ““], “Surface 1” )
#---------------------------------------------------------------------
# Load cases “Default”, “Load Case2” and “Load case3” are created.
loadcase_create( “Default”, “Static”, @
“This load case is the default load case that always appears”, @
[“fix”, “point”], [0, 0], ““, 0., TRUE )
$? YES 3001002
loadcase_create( “Load Case2”, “Static”, “Load case number 2”, @
[“fix”], [0, 0], ““, 0., TRUE )
loadcase_create( “Load Case3”, “Static”, “Load case number 3”, “ // @
“ [“point”], [0, 0], ““, 0., TRUE )
#---------------------------------------------------------------------
# Creating job “plate1”.
jobfile.open( “plate1”, “ANALYZE NO JOBFILE” )
Main Index
1790
Code Examples
#include <stdio.h>
#define RTRN_GET -1
#define RTRN_OK 0
#define RTRN_INIT 1
#define RTRN_WRNG_NUM_ARGS 2
if (return_value == RTRN_OK)
{
switch ( type )
{
/* Datatype status */
case 1:
return_value = RpcGetStatus(handle, &rand_int);
if (return_value == RTRN_OK)
{
return_value = RpcPutStatus(handle, rand_int);
}
break;
/* Datatype command */
case 2:
return_value = RpcGetCommand(handle, &rand_int);
if (return_value == RTRN_OK)
{
return_value = RpcPutCommand(handle, rand_int);
}
break;
/* Datatype integer */
case 3:
return_value = RpcGetInteger(handle, &rand_int);
if (return_value == RTRN_OK)
Main Index
1794
Code Examples
{
return_value = RpcPutInteger(handle, rand_int);
}
break;
/* Datatype boolean */
case 4:
return_value = RpcGetBoolean(handle, &rand_int);
if (return_value == RTRN_OK)
{
return_value = RpcPutBoolean(handle, rand_int);
}
break;
/* Datatype real */
case 5:
return_value = RpcGetReal(handle, &rand_flt);
if (return_value == RTRN_OK)
{
return_value = RpcPutReal(handle, rand_flt);
}
break;
/* Datatype string */
case 6:
return_value = RpcGetString(handle, string, sizeof(string));
if (return_value == RTRN_OK)
{
return_value = RpcPutString(handle, string);
}
break;
/* Datatype integer array */
case 7:
bufsize = sizeof(arr_int)/sizeof(arr_int[0]);
return_value = RpcGetIntArray(handle, arr_int, &cnt, bufsize);
if (return_value == RTRN_OK)
{
return_value = RpcPutIntArray(handle, arr_int, cnt);
}
break;
/* Datatype boolean array */
case 8:
bufsize = sizeof(arr_int)/sizeof(arr_int[0]);
return_value = RpcGetBoolArray(handle, arr_int, &cnt,
bufsize);
if (return_value == RTRN_OK)
{
return_value = RpcPutBoolArray(handle, arr_int, cnt);
}
break;
/* Datatype real array */
case 9:
bufsize = sizeof(arr_flt)/sizeof(arr_flt[0]);
return_value = RpcGetRealArray(handle, arr_flt, &cnt,
bufsize);
if (return_value == RTRN_OK)
{
return_value = RpcPutRealArray(handle, arr_flt, cnt);
}
break;
default:
/* Server will die after current Rpc call completes */
RpcServerEnd();
}
}
handler_error(return_value);
}
/* End of RpcHandler() */
Main Index
CHAPTER 18 1795
Support Files
/***************************************************************
*
*
* The all PDA RPC servers must make a call to RpcInitServer.
* This establishes the server’s run-time environment as
* follows. All clients must make a call to RpcAddServer
* and RpcInitClient.
*
* RpcInitServer
* ( int prognum - program number for
* client/server same
* value as in RpcInitClient
* int progver - program version
* void (*handler)(int) - RPC service handler
* logical inetd - server startup via inetd.
* int server_timeout - # of seconds of inactivity
* before server dies
* logical rpc_debug - display rpc data on stdout
***************************************************************/
if ( (argc != 2)
||(sscanf(argv[1], “%d”, &prognum) != 1)
)
{
printf(“usage : %s <prognum>\n”, argv[0]);
return_value = RTRN_WRNG_NUM_ARGS;
}
else
{
return_value = RpcInitServer(prognum, 1, RpcHandler, 0, 300, 0);
if (return_value == RTRN_OK)
{
return_value = handler_error(RTRN_GET);
}
}
return (return_value);
}
/* End of main */
#---------------------------------------------------------------------
# File : sphere.ses
#
# Purpose : This file will generate a PATRAN database
# “sphere.db” which consists of a sphercal syrface.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
#---------------------------------------------------------------------
# Open a new database “sphere.db”
uil_file_new.go( ““,”./sphere.db”)
$? YES 36000002
# Create a 2D circle
STRING sgm_create_curve_2d_created_ids[VIRTUAL]
sgm_const_curve_2d_circle_v1( “1”, 1, 1., “Coord 0.3”, ““, “[0 0 0]”,@
Main Index
1796
Code Examples
TRUE, sgm_create_curve_2d_created_ids )
X 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ$/+-()’=.*”#%&,;:<>?@![]^_\
020080
62^6666810W^66^GNASTGRAN GFORTG TAPGE IDG CODGE -
^61^GXXXXGXXXX^4^3^HHHHHHHHHH
X 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ$/+-()’=.*”#%&,;:<>?@![]^_\
020080
61^GGEOMG1S ^4^66^810$3820 67333^71^60^3^61^GGEOMG1
^72^60^3^6F^81UG6J68606
1613B7 4^T3 99B7 4^T3 B 4^T3 9999^73^60^3^81UF^8205K6.60603B G?PB
9933361
3B G3PY69B7 59[N_333623B G3Q1P9B 59@BL333633B D’_R&9B7 A!]7 333643B
D’\)(9B A!!A0333653B 9@T!)9B7 F<^S%333663B 9@V- 9B F<[#-333673B 4^S
=W9B7 J(R\.333683B 4^UW=9B J(Q%<333693B30 15UP_9B7 M0?+63336A3B30
15:?T9B
M0?6;3336B3B7 4^TYH9B7 M:?F 3336C3B7 4^RK49B M:?F 3336D3B7 B7O]G9B7
M
0?MS3336E3B7 B7M”S9B M0@5P3336F3B7 G?P’H9B7 J(RG83336G3B7 G?N*69B J(SU
3336H3B7 L;R039B7 F<]*:3336I3B7 L;PI!9B F<_RM3336J3B7 P/[IM9B7
A![8P3336
K3B7 P/!479B A!^LD3336L3B7 R\L!#9B7 59!9]3336M3B7 R\LA;9B
59]MZ3336N3B7
S,LJ 9B33 1^$&V3336O3B D@’9 993336P3B DBAHU9B7 4OZCS3336Q3B DBB0Q9B
4OW*63336R3B B5&!V9B7 9QZ<(3336S3B B5;7”9B 9QX)03336T3B 7&+4C9B7
D#4>
Main Index
CHAPTER 18 1797
Support Files
^3^HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
H
X 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ$/+-()’=.*”#%&,;:<>?@![]^_\
020080
61^GGEOMG2S ^4^66^810/333821 33^71^60^3^61^GIGEOGM2X
^72^60^3^81UF^81*D6,811%
6060606O6P619933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 61606O6%6&6P9933B7 4^T3
B7
4^T3 B7 4^T3 B7 4^T3 62606%810881096&9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T
3 63608108810W810X81099933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
6460616P6R639933B
7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 65606P6&6;6R9933B7 4^T3 B7 4^T3 B7 4^T3 B
7 4^T3 66606&8109810B6;9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3
67608109810X810
Z810B9933B7 4^T3 B7 4^T3 B7 4^T3 B7 4^T3 6860636R6T659933B7 4^T3 B7 4^T3
Main Index
1802
Code Examples
Main Index
1804
Code Examples
0^3^3^HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
H
X 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ$/+-()’=.*”#%&,;:<>?@![]^_\
020080
61^GGEOMG3S ^4^66^810+33367813 3^71^60^3^61^GGEOMG3
^72^60^3^6C^820666^810J6
1B 4^T3 B 4^T3 60B 4^T3 62B 4^T3
6344^73^60^3^81UF^820#(8107813’60810WB
Main Index
CHAPTER 18 1813
Support Files
HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
H
X 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ$/+-()’=.*”#%&,;:<>?@![]^_\
020080
61^GGEOMG4S ^4^66^810-333810V33^71^60^3^61^GGEOMG4
^72^60^3^67^820K(6!6B6082
T8
3813W4^73^60^3^65^820K,6[6C61604^74^60^3^62^82E\\82E\\82E\\^75^60^3^3^HHHHHH
X 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ$/+-()’=.*”#%&,;:<>?@![]^_\
020080
61^GEPTSF^4^66^810(3817 3333^71^60^3^61^GIEPTF^72^60^3^6D^81Y_6M813Q6060B30
3T5
Y 60B 4^T3 60B
3^@2I9M0M03^73^60^3^62^82E\\82E\\82E\\^74^60^3^3^HHHHHHHHHHH
X 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ$/+-()’=.*”#%&,;:<>?@![]^_\
020080
61^GMPTSF^4^66^810$827 33333^71^60^3^61^GMPT F^72^60^3^6E^810+60810C60B 6
50HB
\B 5 L-R <B 0^?(0B30 4^T3
9999993^73^60^3^62^82E\\82E\\82E\\^74^60^3^3^HHHHHH
X 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ$/+-()’=.*”#%&,;:<>?@![]^_\
020080
61^GOQG1F^4^66^810$3820A
3333^71^60^3^66^GOQG1F6666810W360^72^60^3^811H^6A62360
60336160673333333333333333333333333333333333333333G MSCG/NASGTRANG JOBG
CREGATE
DG ON G07-JGUL-9G7 ATG 08:G51:0G7 FFFFFFFFFFFFFFFFFFFGDEFAGULT
FFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFGSUBCGASE G1
FFF^73^60^3^81UF^6A609
999996K609999996U609999996(609999996,609999996^60999999810660999999810G6099999
9
810Q60999999810$60999999810”60999999810@60999999811260999999811C60999999811M60
9
99999811W60999999811’60999999811:60999999811\60999999812860999999812I609999998
1
2S60999999812+60999999812%60999999812[60999999813460999999813E60999999813O6099
9
999813Y60999999813.60999999813>60999999814060999999814A60999999814K60999999814
U
60999999814(60999999814,60999999814^60999999815660999999815G60999999815Q609999
9
9815$60999999815”60999999815@60999999816260999999816C60999999816M60999999816W6
0
999999816’60999999816:60999999816\60999999817860999999817I60999999817S60999999
8
17+60999999817%60999999817[60999999818460999999818E60999999818O60999999818Y609
9
9999818.60999999818>60999999819060999999819A60999999819K60999999819U6099999981
9
(60999999819,60999999819^6099999981A66099999981AG6099999981AQ6099999981A$60999
9
9981A”6099999981A@6099999981B26099999981BC6099999981BM6099999981BW6099999981B’
6
099999981B:6099999981B\6099999981C86099999981CI6099999981CS6099999981C+6099999
9
Main Index
CHAPTER 18 1821
Support Files
81C%6099999981C[6099999981D46099999981DE6099999981DO6099999981DY6099999981D.60
9
9999981D>6099999981E06099999981EA6099999981EK6099999981EU6099999981E(609999998
1
E,6099999981E^6099999981F66099999981FG6099999981FQ6099999981F$6099999981F”6099
9
99981F@6099999981G26099999981GC6099999981GM6099999981GW6099999981G’6099999981G
:
6099999981G\6099999981H86099999981HI6099999981HS6099999981H+6099999981H%609999
9
981H[6099999981I46099999981IE6099999981IO6099999981IY6099999981I.6099999981I>6
0
99999981J06099999981JA6099999981JK6099999981JU6099999981J(6099999981J,60999999
8
1J^6099999981K66099999981KG6099999981KQ6099999981K$6099999981K”6099999981K@609
9
999981L26099999981LC6099999981LM6099999981LW6099999981L’6099999981L:6099999981
L
\6099999981M86099999981MI6099999981MS6099999981M+6099999981M%6099999981M[60999
9
9981N46099999981NE6099999981NO6099999981NY6099999981N.6099999981N>6099999981O0
6
099999981OA6099999981OK6099999981OU6099999981O(6099999981O,6099999981O^6099999
9
81P66099999981PG6099999981PQ6099999981P$6099999981P”6099999981P@6099999981Q260
9
9999981QC6099999981QM6099999981QW6099999981Q’6099999981Q:6099999981Q\609999998
1
R86099999981RI6099999981RS6099999981R+6099999981R%6099999981R[6099999981S46099
9
99981SE6099999981SO6099999981SY6099999981S.6099999981S>6099999981T06099999981T
A
6099999981TK6099999981TU6099999981T(6099999981T,6099999981T^6099999981U6609999
9
981UG6099999981UQ6099999981U$6099999981U”6099999981U@6099999981V26099999981VC6
0
99999981VM6099999981VW6099999981V’6099999981V:6099999981V\6099999981W860999999
8
1WI6099999981WS6099999981W+6099999981W%6099999981W[6099999981X46099999981XE609
9
999981XO6099999981XY6099999981X.6099999981X>6099999981Y06099999981YA6099999981
Y
K6099999981YU6099999981Y(6099999981Y,6099999981Y^6099999981Z66099999981ZG60999
9
9981ZQ6099999981Z$6099999981Z”6099999981Z@6099999981$26099999981$C6099999981$M
6
099999981$W6099999981$’6099999981$:6099999981$\6099999981/86099999981/I6099999
9
81/S6099999981/+6099999981/%6099999981/[6099999981+460999999^81UF^81+E60999999
8
Main Index
1822
Code Examples
1+O6099999981+Y6099999981+.6099999981+>6099999981-06099999981-A6099999981-
K6099
999981-U6099999981-(6099999981-,6099999981-
^6099999981(66099999981(G6099999981(
Q6099999981($6099999981(“6099999981(@6099999981)26099999981)C6099999981)M60999
9
9981)W6099999981)’6099999981):6099999981)\6099999981’86099999981’I6099999981’S
6
099999981’+6099999981’%6099999981’[6099999981=46099999981=E6099999981=O6099999
9
81=Y6099999981=.6099999981=>6099999981.06099999981.A60BB2 1^ZHXB32 .48QBB9
0=E
+ZBB7 0:KA4BB6 /]L BB2
.49.81.K6099999981.U6099999981.(6099999981.,6099999981
.^6099999981*66099999981*G6099999981*Q6099999981*$6099999981*”6099999981*@6099
9
99981”26099999981”C6099999981”M6099999981”W6099999981”’6099999981”:6099999981”
\
6099999981#86099999981#I6099999981#S6099999981#+6099999981#%6099999981#[609999
9
981%46099999981%E6099999981%O6099999981%Y6099999981%.6099999981%>6099999981&06
0
99999981&A6099999981&K6099999981&U6099999981&(6099999981&,6099999981&^60999999
8
1,66099999981,G6099999981,Q6099999981,$6099999981,”6099999981,@6099999981;2609
9
999981;C6099999981;M6099999981;W6099999981;’6099999981;:6099999981;\6099999981
:
86099999981:I6099999981:S6099999981:+6099999981:%6099999981:[6099999981<460999
9
9981<E6099999981<O6099999981<Y6099999981<.6099999981<>6099999981>06099999981>A
6
099999981>K6099999981>U6099999981>(6099999981>,6099999981>^6099999981?66099999
9
81?G6099999981?Q6099999981?$6099999981?”6099999981?@6099999981@26099999981@C60
9
9999981@M6099999981@W6099999981@’6099999981@:6099999981@\6099999981!8609999998
1
!I6099999981!S6099999981!+6099999981!%6099999981![6099999981[46099999981[E6099
9
99981[O6099999981[Y6099999981[.6099999981[>6099999981]06099999981]A6099999981]
K
6099999981]U6099999981](6099999981],6099999981]^6099999981^66099999981^G609999
9
981^Q6099999981^$6099999981^”6099999981^@6099999981_26099999981_C6099999981_M6
0
99999981_W6099999981_’6099999981_:6099999981_\6099999981\86099999981\I60999999
8
1\S6099999981\+6099999981\%6099999981\[60999999820 460999999820 E60999999820
O6
0999999820 Y60999999820 .60999999820
>6099999982000609999998200A609999998200K60
9999998200U609999998200(609999998200,609999998200^6099999982016609999998201G60
9
Main Index
CHAPTER 18 1823
Support Files
999998201Q609999998201$609999998201”609999998201@6099999982022609999998202C609
9
99998202M609999998202W609999998202’609999998202:609999998202\60999999820386099
9
9998203I609999998203S609999998203+609999998203%609999998203[609999998204460999
9
998204E609999998204O609999998204Y609999998204.609999998204>6099999982050609999
9
98205A609999998205K609999998205U609999998205(609999998205,609999998205^6099999
9
82066609999998206G609999998206Q609999998206$609999998206”609999998206@60999999
8
2072609999998207C609999998207M609999998207W609999998207’609999998207:609999998
2
07\6099999982088609999998208I609999998208S609999998208+609999998208%6099999982
0
8[6099999982094609999998209E609999998209O609999998209Y609999998209.60999999820
9
>60999999820A060999999820AA60999999820AK60999999820AU60999999820A(60999999820A
,
60999999820A^60999999820B660999999820BG60999999820BQ60999999820B$60999999820B”
6
0999999820B@60999999820C260999999820CC60999999820CM60999999820CW60999999820C’6
0
999999820C:60999999820C\60999999820D860999999^81BV^820DI60999999820DS609999998
2
0D+60999999820D%60999999820D[60999999820E460999999820EE60999999820EO6099999982
0
EY60999999820E.60999999820E>60999999820F060999999820FA60999999820FK60999999820
F
U60999999820F(60999999820F,60999999820F^60999999820G660999999820GG60999999820G
Q
60999999820G$60999999820G”60999999820G@60999999820H260999999820HC60999999820HM
6
0999999820HW60999999820H’60999999820H:60999999820H\60999999820I860999999820II6
0
999999820IS60999999820I+60999999820I%60999999820I[60999999820J460999999820JE60
9
99999820JO60999999820JY60999999820J.60999999820J>60999999820K060999999820KA609
9
9999820KK60999999820KU60999999820K(60999999820K,60999999820K^60999999820L66099
9
999820LG60999999820LQ60999999820L$60999999820L”60999999820L@60999999820M260999
9
99820MC60999999820MM60999999820MW60999999820M’60999999820M:60999999820M\609999
9
9820N860999999820NI60999999820NS60999999820N+60999999820N%60999999820N[6099999
9
820O460999999820OE60999999820OO60999999820OY60999999820O.60999999820O>60999999
8
Main Index
1824
Code Examples
20P060999999820PA60999999820PK60999999820PU60999999820P(60999999820P,609999998
2
0P^60999999820Q660999999820QG60999999820QQ60999999820Q$60999999820Q”6099999982
0
Q@60999999820R260999999820RC60999999820RM60999999820RW60999999820R’60999999820
R
:60999999820R\60999999820S860999999820SI60999999820SS60999999820S+60999999820S
%
60999999^74^60^3^3^HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
H
X 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ$/+-()’=.*”#%&,;:<>?@![]^_\
020080
61^GOUGVG1 ^4^66^810$3820A 3333^71^60^3^66^GOUGVG1
6666810W360^72^60^3^811H
^6A6036060336160673333333333333333333333333333333333333333G MSCG/NASGTRANG
JOBG
CREGATEDG ON G07-JGUL-9G7 ATG 08:G51:0G7 FFFFFFFFFFFFFFFFFFFGDEFAGULT
FFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFGSUBCGASE G1
FFF^73^60^3^81
UF^6A60BB2 3)S2EB7 0OE!EBB5 09H&/BB5 ^&SD9B7 )M?=6K60BB2 3MA3 B7 0OE@@B32
1HZ1EBB0 0.)?-9B7 -[T#6U60BB2 3M7K)B7 0OE?]BB2 1H=V7B30 0.)G+9B7 -
[U/6(60B
B2 2T/C!B7 0OE?)B32 3QC<SBB0 2I>U%9BB0 4*^Y 6,60BB2 2TV<3B7 0OE?!BB2
3QKC,B30
2I<[;9BB0 4*^<Z6^60BB2 13Z_>B7 0OE@ZB31 -2)SBB0 3’-A59BB0 3’+”K810660BB2
13S
V%B7 0OE@2BB1 -3D7B30 3’+-99BB0 3’-C&810G60BB3 1NX<$B7 0OE])B31 %30IBB0
4*^
>>9BB0 2I>D*810Q60BB3 1M4X]B7 0OE[GBB1 %3M&B30 4*^$@9BB0 2I>)B810$60B32
0@NI&
B7 0OE]KB31 <*P3B7 -[VT9BB0 0.)’1810”60B32 0@X.=B7 0OE^RBB1 <*UOB -
[U.
9BB0 0.’B 810@60B32 3B !,B7 0OE_$B31 ?)5<B7 )M!D9B35 4BA/=811260B32
3BA’&B7
0OE\$BB1 ?(!GB )M!#9BB4 #T2#811C60B31 (S&RB7 0OE^YB31 <*=YB7 -[V19B
30 0.’3?811M60B31 (T;.B7 0OF 3BB1 <*C!B -[W”9B30 0.)YR811W60B31 >7M)B7
0OE]:B31 %3$4BB0 4*^”U9B30 2I>-.811’60B31 >8HWB7 0OE\3BB1 %2:[B30
4*_A+9B30
2I>7U811:60B31 01>P”B7 0OE^JB31 -3R5BB0 3’+]T9B30 3’-AY811\60B31 01?9RB7
0O
E_”BB1 -2T]B30 3’-W*9B30 3’+”W812860B31 0A>#$B7 0OE]WB32 3QMZ1BB0 2I>KQ9B30
4
*^<)812I60B31 0A?G<B7 0OE^=BB2 3QBOEB30 2I?299B30 4*^U:812S60B31 0GX6[B7
0OE[
_B32 1H*<CBB0 0.)+79B -[V7812+60B31 0GXOOB7 0OE[GBB2 1HXY#B30 0.’I19B -
[
T_812%60B31 0IS,.B7 0OE]]B35 0Y4_LB34 :1<79B )M@V812[60BB2 47O%&B7
02/X8B
B5 \(N?BB6 3+-EM9B7 ‘\_(813460BB2 3;5F-B7 02/W1B32 1PK1-BB0 0%?PR9B7
)V0V
813E60BB2 3;2^<B7 02/WKBB2 1PQ%SB30 0%>ZZ9B7 )V1*813O60BB2 2?W’JB7
02/W]B32
3)B\WBB0 2R 1]9BB0 4^1\Y813Y60BB2 2?SB<B7 02/WNBB2 3)H>6B30 2Q\H\9BB0
4^2OF81
3.60BB2 1O”%HB7 02/V^B31 )AFKBB0 3>7E-9BB0 3>6#\813>60BB2 1O(P.B7 02/W<BB1
)A=UB30 3>6/:9BB0 3>7L8814060BB3 3*9>5B7 02/Y^B31 ,)2%BB0 4^2N=9BB0 2Q\-
$814A
60BB3 3=^^QB7 02/X;BB1 ,)JDB30 4^1]B9BB0 2R L7814K60B32 0%(32B7 02/Y#B31
@+
Z.B7 )V2X9BB0 0%?06814U60B32 0%%*(B7 02/$QBB1 @+/]B )V1P9BB0
0%?#)814(60
B32 3B0%MB7 02/$”B31 [(%_B7 = 99B34 %-VC814,60B32 3B9”-B7 02//SBB1
[($N
B = (9BB4 06.UQ814^60B31 )ET?B7 02/$(B31 @+;8B7 )V1”9B30
0%?//815660B3
1 )FK/B7 02//:BB1 @+N+B )V3^9B30 0%>&^815G60B31 ?-G,B7 02/Y<B31
,)X5BB
Main Index
CHAPTER 18 1825
Support Files
Main Index
1834
Code Examples
3BB0 1E2GVB 2 72T,GB72 H^U[IBB0 2HQ BB2 39 42B 2 72T,GB72 H^U[IB 2 N0TXOB30
1E
2GVB 2 :3M;,B71 P02QZB <F4WB32 4B,(DB 2 :3M;,B71 P02QZB 2 <P+6;811?BB0
1E2GV
B 2 B]NCEB71 (Q+I/BB0 2HQ BB1 )2(&B 2 B]NCEB71 (Q+I/B 2 ER0 6B30 1E2GVB 2
!S_
8>B 2 C#’!+B <F4WB31 (RE4B 2 !S_8>B 2 C#’!+B 2 ;]Z]4812FBB0 1E2GVB 1
TQQ_/B
72 X8FCSBB0 2HQ BB2 20EMIB 1 TQQ_/B72 X8FCSB 2 Y#<DSB30 1E2GVB 2 “XJB1B72
IMUF
SB <F4WB32 3J[N7B 2 “XJB1B72 IMUFSB 3 4^+I0812HBB0 1E2GVB 1 TR’=#B72
X8D*<BB
0 2HQ BB2 20D:/B 1 TR’=#B72 X8D*<B 2 Y#@D=B30 1E2GVB 2 “XE”QB72 IMW\XB
<F4W
B32 3J[UCB 2 “XE”QB72 IMW\XB 3 4^+3U811!BB0 1E2GVB 2 B]U*YB71 (QLF4BB0 2HQ
BB1
)2QTB 2 B]U*YB71 (QLF4B 2 ER68VB30 1E2GVB 2 !S!73B 2 C#(*!B <F4WB31
(RF&B
2 !S!73B 2 C#(*!B 2 ;]W(_81J,GCEN/63BB0 1E2GVB 3 YD^RNB 3 D;T*>B 0QPN\B32
1N
[K^B 3 YD^RNB 3 D;T*>B 3 T(1U,B30 1E2GVB73 Q9\?5B73 F+D5PB30 27,HFB 0 :(D9)B73
F+D5PB73 Q9\?5B 3 M*QBG810&BB0 1E2GVB 3 XE[UKB 3 A:W/PB 0QPN\B32 1AHT$B 3
XE[
UKB 3 A:W/PB 3 T7B:*B30 1E2GVB73 S*31<B73 NKL:&B30 27,HFB 0 :(C”<B73 NKL:&B73
S
*31<B 3 QQH ]8119BB0 1E2GVB 3 ZHY;XB 3 H0N)#B 0QPN\B32 1)?”^B 3 ZHY;XB 3
H0N)
#B 3 UQPJFB30 1E2GVB73 NR ZYB73 7J]:!B30 27,HFB 0 :(DH6B73 7J]:!B73 NR ZYB 3
KW
AQD811BBB0 1E2GVB 3 ZH/)KB 3 H0O?_B 0QPN\B32 1)?V?B 3 ZH/)KB 3 H0O?_B 3
UQR&C
B30 1E2GVB73 NR J!B73 7J]0ZB30 27,HFB 0 :(DH6B73 7J]0ZB73 NR J!B 3
KWAK(810;BB0
1E2GVB 3 XE^))B 3 A:XF=B 0QPN\B32 1AHK7B 3 XE^))B 3 A:XF=B 3 T7D&8B30
1E2GVB
73 S*36JB73 NKM0.B30 27,HFB 0 :(C”<B73 NKM0.B73 S*36JB 3 QQH8881J^GCEN/63BB0
1E
2GVB 3 K”9’JB 3 CO<U B 04?T,B32 3TOLSB 3 K”9’JB 3 CO<U B 3 H\)V<B30 1E2GVB73
C\]D@B71 ;7082B7 15#)RB70 :(BOPB71 ;7082B73 C\]D@B 3 C””3[8119BB0 1E2GVB 3
KZD
\:B 3 B?%#;B 04?T,B32 3H_.>B 3 KZD\:B 3 B?%#;B 3 H&?GJB30 1E2GVB73 EJ^3^B72
.
SR”4B7 15#)RB70 :(A:)B72 .SR”4B73 EJ^3^B 3 C-(YK811XBB0 1E2GVB 3 K!@G’B 3
C^SR
JB 04?T,B32 3’;ZCB 3 K!@G’B 3 C^SRJB 3 ID0P?B30 1E2GVB73 BZOWLB 2 /7&[*B7
15
#)RB70 :(B%FB 2 /7&[*B73 BZOWLB 3 D<E,\811ZBB0 1E2GVB 3 K!]ZWB 3 C^T+ZB
04?T,
B32 3’,J’B 3 K!]ZWB 3 C^T+ZB 3 ID39LB30 1E2GVB73 BZMQ+B 2 /8 @,B7 15#)RB70
:(B
%FB 2 /8 @,B73 BZMQ+B 3 D<D*J811BBB0 1E2GVB 3 KZG+TB 3 B?&)[B 04?T,B32
3H^>ZB
3 KZG+TB 3 B?&)[B 3 H&!T?B30 1E2GVB73 EJ[UFB72 .SJ3 B7 15#)RB70 :(A:)B72
.SJ3
B73 EJ[UFB 3 C--DO81K6GCEN/63BB0 1E2GVB 2 E^=VSB 2 /OS$’B7 0(W@WB70 :(3H<B 2
/OS/QB 2 E^=VSB 2 WPGN8B30 1E2GVB 2 (6C]_B 2 >?;\ZBB0 3ZO&&B70 :(9FKB 2 >?;\ZB
2 (6C]_B 2 &9D?S811XBB0 1E2GVB 2 TWO^RB 3 7F5K*B7 0(W@WB70 :(97?B 3 7F5K*B 2
T
WO^RB 3 6DT=RB30 1E2GVB 2 ? S] B 3 95Y^;BB0 3ZO&&B70 :(C85B 3 95Y^;B 2 ? S] B
3
7%1.7811!BB0 1E2GVB 0 #=H2SB72 7U^21B7 0(W@WBB0 -5”6B 0 #=H9!B72 7U^2DB 2
7#
A@1B30 1E2GVB 2 OG&[EB 2 6!1WMBB0 3ZO&&BB1 @U1&B 2 OG&[EB 2 6!1WMB 2
LOPNR811]
BB0 1E2GVB 0 #@%]*B72 7U]9DB7 0(W@WBB0 -5BYB 0 #@&3AB72 7U]9DB 2 7#E’MB30
1E2
GVB 2 OG[3&B 2 6!2C7BB0 3ZO&&BB1 @T)4B 2 OG[3&B 2 6!2C7B 2 LOW\.811ZBB0
1E2GVB
2 TWV;HB 3 7F5J2B7 0(W@WB70 :(97?B 3 7F5J2B 2 TWV;HB 3 6DTZFB30 1E2GVB 2 ?
ZP
GB 3 95Y!:BB0 3ZO&&B70 :(C85B 3 95Y!:B 2 ? ZPGB 3 7%1.J81KGGCEN/63BB0 1E2GVB 2
72YAQB72 H^NHYB30 2NFK”B32 3GNX%B 2 72YAQB72 H^NHYB 2 N0PR7B30 1E2GVB 2
:3CUBB7
Main Index
1868
Code Examples
Main Index
1872
Code Examples
XBB1 3KUETBB3 1I,<^B 2 V@-”&B72 UCY[XB 2 >W?+!B30 1E2GVB 2 VQ<W B72 UMK1[BB1
2^
##QBB3 16:PXB 2 VQ<W B72 UMK1[B 2 >FIRY81.0GCEN/63BB0 1E2GVB 2 VZU^3B72
UY64;BB
1 0^LGKBB3 01#;4B 2 VZU^3B72 UY64;B 2 >W_&&B30 1E2GVB 2 V’.H_B72 UV/\1B31
029[M
B34 4$L’AB 2 V’.H_B72 UV/\1B 2 >/5.F813ABB0 1E2GVB 2 VZ-<HB72 UX=LQBB1
0^LGKBB3
01%5)B 2 VZ-<HB72 UX=LQB 2 >W”U&B30 1E2GVB 2 V’: ]B72 UVE>LB31 029[MB34 4$N
>B
2 V’: ]B72 UVE>LB 2 >$@W<813YBB0 1E2GVB 2 VZMDGB72 UYW&EBB1 0^LGKBB3 01#WPB 2
VZMDGB72 UYW&EB 2 >XD9GB30 1E2GVB 2 V’$%)B72 UV_0VB31 029[MB34 4$KJZB 2
V’$%)B7
2 UV_0VB 2 >/J 6813WBB0 1E2GVB 2 VZM3$B72 UYW:DBB1 0^LGKBB3 01#WTB 2 VZM3$B72
U
YW:DB 2 >XD3IB30 1E2GVB 2 V’$Z\B72 UV_4EB31 029[MB34 4$KKVB 2 V’$Z\B72 UV_4EB
2
>/I?)8138BB0 1E2GVB 2 VZ-.LB72 UX=OPBB1 0^LGKBB3 01%5%B 2 VZ-.LB72 UX=OPB 2
>W
“O;B30 1E2GVB 2 V’;,XB72 UVE[:B31 029[MB34 4$N0WB 2 V’;,XB72 UVE[:B 2
>[email protected]
GCEN/63BB0 1E2GVB 2 .N@<JB 1 ,,[ZHBB1 0_.#XBB3 0’-4LB 2 .N@<JB 1 ,,[ZHB 2
‘16(P
B30 1E2GVB73 8KC’)B71 J!/>@BB2 2>7+!B70 :(DZ B71 J!/>@B73 8KC’)B 3 8D-
/!8180BB0
1E2GVB 2 (T9L?B 1 /?M)DBB1 0_.#XBB3 0,882B 2 (T9L?B 1 /?M)DB 2 +)@^DB30
1E2GVB
73 7RJ#KB 1 7P@!4BB2 2>7+!B70 :(DZ B 1 7P@!4B73 7RJ#KB 3 7U1UC8181BB0 1E2GVB 2
(T9@@B 1 /?+</BB1 0_.#XBB3 0,8BMB 2 (T9@@B 1 /?+</B 2 +)@,XB30 1E2GVB73 7RJ:AB
1 7PY4CBB2 2>7+!B70 :(DZ B 1 7PY4CB73 7RJ:AB 3 7U1R/817)BB0 1E2GVB 2 %U1T_B 2
5
X63%BB1 0_.#XBB3 0Z#15B 2 %U1T_B 2 5X63%B 2 *Z33$B30 1E2GVB73 9F=1-B71
,$RMOBB2
2>7+!B70 :(DZ B71 ,$RMOB73 9F=1-B 3 9 ;P:817(BB0 1E2GVB 2 %U1L1B 2 5X4NABB1
0_
.#XBB3 0Z”_TB 2 %U1L1B 2 5X4NAB 2 *Z3$MB30 1E2GVB73 9F=2#B71 ,$4#UBB2 2>7+!B70
:(DZ B71 ,$4#UB73 9F=2#B 3 9 ;X<81.KGCEN/63BB0 1E2GVB 2 .N]&;B 1 ,,,$AB30
2BHHO
B32 1.VUPB 2 .N]&;B 1 ,,,$AB 2 ‘19!1B30 1E2GVB73 8KDBRB71 J!QU_BB0 4&\+(B70
:(C
‘NB71 J!QU_B73 8KDBRB 3 8D(AP8181BB0 1E2GVB 2 (TDE*B 1 /?V1)B30 2BHHOB32 1@-
2SB
2 (TDE*B 1 /?V1)B 2 +)^SUB30 1E2GVB73 7RKWJB 1 7P>/ BB0 4&\+(B70 :(C/@B 1
7P>/
B73 7RKWJB 3 7U2ER8183BB0 1E2GVB 2 (TCD9B 1 /?FV B30 2BHHOB32 1@- @B 2 (TCD9B
1 /?FV B 2 +)^5OB30 1E2GVB73 7RKQ9B 1 7P%B/BB0 4&\+(B70 :(C/@B 1 7P%B/B73
7RKQ9
B 3 7U26F817=BB0 1E2GVB 2 %U3\!B 2 5X3+NB30 2BHHOB32 1XQ >B 2 %U3\!B 2 5X3+NB
2
*Z6W>B30 1E2GVB73 9F=QDB71 ,$5Z(BB0 4&\+(B70 :(C*LB71 ,$5Z(B73 9F=QDB 3 9
;@]8
17)BB0 1E2GVB 2 %U4Y)B 2 5X5B8B30 2BHHOB32 1XQ3=B 2 %U4Y)B 2 5X5B8B 2 *Z6T7B30
1E2GVB73 9F=OMB71 ,Z!==BB0 4&\+(B70 :(C*LB71 ,Z!==B73 9F=OMB 3 9
;[Q81.UGCEN/63
BB0 1E2GVB 2 .N_MOB 1 ,,?I’BB0 0C9*LBB2 00X+/B 2 .N_MOB 1 ,,?I’B 2 ‘1BG]B30
1E2
GVB73 8KDX&B71 J!X5QB30 0$3BPB 0 :(DK5B71 J!X5QB73 8KDX&B 3 8D(UX8183BB0
1E2GVB
2 (TE @B 1 /?8!IBB0 0C9*LBB2 056WVB 2 (TE @B 1 /?8!IB 2 +)\A#B30 1E2GVB73
7RK@
.B 1 7P\KSB30 0$3BPB 0 :(DI/B 1 7P\KSB73 [email protected] 3 7U2)S8185BB0 1E2GVB 2 (TFUWB
1 /?,0<BB0 0C9*LBB2 056/RB 2 (TFUWB 1 /?,0<B 2 +)_@?B30 1E2GVB73 7RL4GB 1
7PF;%
B30 0$3BPB 0 :(DI/B 1 7PF;%B73 7RL4GB 3 7U2/*817*BB0 1E2GVB 2 %U5%9B 2
5X6!PBB0
0C9*LBB2 ^L’ZB 2 %U5%9B 2 5X6!PB 2 *Z6\)B30 1E2GVB73 9F=Z*B71 ,$NJ6B30
0$3BPB
0 :(DL$B71 ,$NJ6B73 9F=Z*B 3 9 ;_D817=BB0 1E2GVB 2 %U4_UB 2 5X2VPBB0 0C9*LBB2
^L/OB 2 %U4_UB 2 5X2VPB 2 *Z7[GB30 1E2GVB73 9F=ZLB71 ,Z(;LB30 0$3BPB 0
:(DL$B7
1 ,Z(;LB73 9F=ZLB 3 9 :A(81.(GCEN/63BB0 1E2GVB 2 .N!’CB 1 ,,@>VB30 0!;]!B32 0-
J
Main Index
CHAPTER 18 1905
Support Files
A#_$4B72 L2! DB30 2V3O@B 0 :(D2CB72 L2! DB73 A#_$4B 3 9:F38817#BB0 1E2GVB 2
!6Y
.IB 2 V$ZCKBB0 1B$5%BB2 1]1.DB 2 !6Y.IB 2 V$ZCKB 2 &S7(PB30 1E2GVB73 9=O,^B72
H
W/KYB30 2V3O@B 0 :(D EB72 HW/KYB73 9=O,^B 3 8@U^.817&BB0 1E2GVB 2 !6Y#HB 2
V$Z^
%BB0 1B$5%BB2 1]1&UB 2 !6Y#HB 2 V$Z^%B 2 &S7”MB30 1E2GVB73 9=O&5B72 HW+.TB30
2V
3O@B 0 :(D EB72 HW+.TB73 9=O&5B 3 8@U?>817PBB0 1E2GVB 3 5R/)MB 2 X’.]MBB0
1B$5%
BB2 1WAS]B 3 5R/)MB 2 X’.]MB 2 >?=C,B30 1E2GVB73 B@9J8B72 O&6_PB30 2V3O@B 0
:(D
5BB72 O&6_PB73 B@9J8B 3 A;G>J817NBB0 1E2GVB 3 5R/)”B 2 X’.4DBB0 1B$5%BB2 1WAO
B
3 5R/)”B 2 X’.4DB 2 >?=C,B30 1E2GVB73 B@9NEB72 O&5U&B30 2V3O@B 0 :(D5BB72
O&5U
&B73 B@9NEB 3 A;G_^81%.GCEN/63BB0 1E2GVB 3 56#Z0B 2 W/!WPB30 0)8KJB32 12JR”B 3
56#Z0B 2 W/!WPB 2 :59)2B30 1E2GVB73 A#_ZKB72 L2?\1B7 ,=I?B70 :(COUB72
L2?\1B7
3 A#_ZKB 3 9:F4-817&BB0 1E2GVB 2 !6ZKXB 2 V$ZU^B30 0)8KJB32 1C_>XB 2 !6ZKXB 2
V
$ZU^B 2 &S8A’B30 1E2GVB73 9=O,/B72 HWZ_NB7 ,=I?B70 :(CH1B72 HWZ_NB73 9=O,/B
3
8@V U817;BB0 1E2GVB 2 !6ZB/B 2 V$Z6NB30 0)8KJB32 1C_<EB 2 !6ZB/B 2 V$Z6NB 2
&S
81”B30 1E2GVB73 9=O?+B72 HW+Q^B7 ,=I?B70 :(CH1B72 HW+Q^B73 9=O?+B 3
8@U\]817R
BB0 1E2GVB 3 5R/$.B 2 X’=+QB30 0)8KJB32 0@=*\B 3 5R/$.B 2 X’=+QB 2 >?’X$B30
1E2
GVB73 B@9I%B72 O&6P(B7 ,=I?B70 :(CS^B72 O&6P(B73 B@9I%B 3 A;G?F817PBB0
1E2GVB
3 5R/+#B 2 X’.5*B30 0)8KJB32 0@=””B 3 5R/+#B 2 X’.5*B 2 >?’;TB30 1E2GVB73
B@9G
9B72 O&3.2B7 ,=I?B70 :(CS^B72 O&3.2B73 B@9G9B 3 A;G[E81%>GCEN/63BB0 1E2GVB 3
56#RZB 2 W/!J”B31 0VP!=B33 0>HU0B 3 56#RZB 2 W/!J”B 2 :58(_B30 1E2GVB73 A#_S-
B7
2 L2@K#BB1 0!,F&B70 :(DXVB72 L2@K#B73 A#_S-B 3 9:E_B817;BB0 1E2GVB 2 !6W’)B 2
V
$Y6IB31 0VP!=B33 1 _P-B 2 !6W’)B 2 V$Y6IB 2 &S5@(B30 1E2GVB73 9=O$\B72 HWZ_
BB1
0!,F&B70 :(DXVB72 HWZ_ B73 9=O$\B 3 8@U&.817<BB0 1E2GVB 2 !6X8SB 2 V$ZJ1B31
0V
P!=B33 1 _TLB 2 !6X8SB 2 V$ZJ1B 2 &S6MRB30 1E2GVB73 9=O=KB72 HW+UJBB1 0!,F&B70
:(DXVB72 HW+UJB73 9=O=KB 3 8@U,(817TBB0 1E2GVB 3 5R/+CB 2 X’.’_B31 0VP!=B33
0*Y
9.B 3 5R/+CB 2 X’.’_B 2 >?’&_B30 1E2GVB73 B@9EIB72 O&6?SBB1 0!,F&B70 :(DXVB72
O
&6?SB73 B@9EIB 3 A;G,1817RBB0 1E2GVB 3 5R/+CB 2 X’=S”B31 0VP!=B33 0*Y5BB 3
5R/+
CB 2 X’=S”B 2 >?’*VB30 1E2GVB73 B@9IOB72 O&4W^BB1 0!,F&B70 :(DXVB72 O&4W^B73
B@
9IOB 3 A;G[_81&0GCEN/63BB0 1E2GVB 3 56#Z%B 2 W/[78B30 03%Y^B32 0K4S<B 3 56#Z%B
2 W/[78B 2 :59%VB30 1E2GVB73 A#_/ B72 L2!0.BB0 0;]NWB70 :(DI/B72 L2!0.B73 A#_/
B 3 9:F3@817<BB0 1E2GVB 2 !6ZTTB 2 V$Z76B30 03%Y^B32 0Q\ZUB 2 !6ZTTB 2 V$Z76B
2
&S8F8B30 1E2GVB73 9=O@AB72 HW$,(BB0 0;]NWB70 :(DF-B72 HW$,(B73 9=O@AB 3
8@V3D8
17?BB0 1E2GVB 2 !6Z.NB 2 V$$;@B30 03%Y^B32 0Q\(“B 2 !6Z.NB 2 V$$;@B 2 &S8$ B30
1E2GVB73 9=O?+B72 HW-,?BB0 0;]NWB70 :(DF-B72 HW-,?B73 9=O?+B 3 8@U]$817VBB0
1E2
GVB 3 5R/-7B 2 X’*ROB30 03%Y^B32 0D<ZEB 3 5R/-7B 2 X’*ROB 2 >?’[!B30 1E2GVB73
B
@9L B72 O&7\_BB0 0;]NWB70 :(DK5B72 O&7\_B73 B@9L B 3 A;G>J817TBB0 1E2GVB 3
5R/Y
<B 2 X’=KXB30 03%Y^B32 0D<VTB 3 5R/Y<B 2 X’=KXB 2 >?’F.B30 1E2GVB73 B@9DAB72
O&
40!BB0 0;]NWB70 :(DK5B72 O&40!B73 B@9DAB 3 A;G>=81&AGCEN/63BB0 1E2GVB 3 56#.8B
2 W/]FPB30 ^PY6B32 0A_”8B 3 56#.8B 2 W/]FPB 2 :5A] B30 1E2GVB73 A#_#;B72
L2[=-
B7 -A*1B70 :(C(?B72 L2[=-B73 A#_#;B 3 9:FB9817?BB0 1E2GVB 2 !6$]LB 2
V$$*]B30
^PY6B32 0H8X?B 2 !6$]LB 2 V$$*]B 2 &S9/ZB30 1E2GVB73 9=P0[B72 HW+Q^B7 -
A*1B
Main Index
1912
Code Examples
7>BP;B 3 8!BRNB30 1E2GVB73 D+H8GB73 6%]*6BB0 4:=X!B70 :(CN B73 6%]*6B73 D+H8GB
3 B)X]/817RBB0 1E2GVB 3 7>BE;B 3 9=”E,BB0 1R:X B70 :(B=&B 3 9=”E,B 3 7>BE;B 3
8
!B2QB30 1E2GVB73 D+H4AB73 6%]X]BB0 4:=X!B70 :(CN B73 6%]X]B73 D+H4AB 3
B)X?>817
3BB0 1E2GVB 3 7J5.CB 3 9W99@BB0 1R:X B70 :(C 9B 3 9W99@B 3 7J5.CB 3 8/?:PB30
1E
2GVB73 F(:CLB73 7S0*IBB0 4:=X!B70 :(C$PB73 7S0*IB73 F(:CLB 3 DQ3(W8171BB0
1E2GV
B 3 7J5@JB 3 9W9&ZBB0 1R:X B70 :(C0(B 3 9W9&ZB 3 7J5@JB 3 8/@I%B30 1E2GVB73
F(:
KXB73 7S0](BB0 4:=X!B70 :(C$PB73 7S0](B73 F(:KXB 3 DQ3#_81:+GCEN/63BB0 1E2GVB
3
7/A$XB 3 9+7I\B31 3IMWCB 0 :(DF-B 3 9+7I\B 3 7/A$XB 3 8#.[/B30 1E2GVB73
E/$3\B
73 75:Y”B30 :7G:B 0 :(DQ2B73 75:Y”B73 E/$3\B 3 CW00L817RBB0 1E2GVB 3 7>BFZB 3
9=”I9B31 3IMWCB 0 :(DE7B 3 9=”I9B 3 7>BFZB 3 8!B4<B30 1E2GVB73 D+H0;B73
6%]O3B3
0 :7G:B 0 :(DOZB73 6%]O3B73 D+H0;B 3 B)X:W817TBB0 1E2GVB 3 7>BT!B 3 9=”[OB31
3
IMWCB 0 :(DE7B 3 9=”[OB 3 7>BT!B 3 8!BZOB30 1E2GVB73 D+HBFB73 6%^4OB30 :7G:B
0
:(DOZB73 6%^4OB73 D+HBFB 3 B)X\]8175BB0 1E2GVB 3 7J5?ZB 3 9W9[=B31 3IMWCB 0
:(
DH6B 3 9W9[=B 3 7J5?ZB 3 8/@OYB30 1E2GVB73 F(:J,B73 7S1K_B30 :7G:B 0 :(DQ2B73
7S1K_B73 F(:J,B 3 DQ3#/8173BB0 1E2GVB 3 7J5+EB 3 9W9ASB31 3IMWCB 0 :(DH6B 3
9W9
ASB 3 7J5+EB 3 8/?;5B30 1E2GVB73 F(:7?B73 7S0V@B30 :7G:B 0 :(DQ2B73 7S0V@B73
F
(:7?B 3 DQ3$,81:%GCEN/63BB0 1E2GVB 3 7/AO\B 3 9+7B!BB0 1.+7ZB70 :(B’IB 3
9+7B!B
3 7/AO\B 3 8#.,DB30 1E2GVB73 E/Z@3B73 75:/9B7 ;8+&B70 :(C28B73 75:/9B73
E/Z@
3B 3 CW >H817TBB0 1E2GVB 3 7>BQ[B 3 9=”[]BB0 1.+7ZB70 :(BUNB 3 9=”[]B 3 7>BQ[B
3 8!BY:B30 1E2GVB73 D+HD>B73 6%]@TB7 ;8+&B70 :(B?.B73 6%]@TB73 D+HD>B 3
B)Y0,
817VBB0 1E2GVB 3 7>BBTB 3 9=”8)BB0 1.+7ZB70 :(BUNB 3 9=”8)B 3 7>BBTB 3
8!A_$B30
1E2GVB73 D+H7XB73 6%];;B7 ;8+&B70 :(B?.B73 6%];;B73 D+H7XB 3 B)X]D8177BB0
1E
2GVB 3 7J5H]B 3 9W8[-BB0 1.+7ZB70 :(B>DB 3 9W8[-B 3 7J5H]B 3 8/?X_B30 1E2GVB73
F(;*2B73 7S0:BB7 ;8+&B70 :(C9$B73 7S0:BB73 F(;*2B 3 DQ3D.8175BB0 1E2GVB 3
7J5
/JB 3 9W9?LBB0 1.+7ZB70 :(B>DB 3 9W9?LB 3 7J5/JB 3 8/@GXB30 1E2GVB73 F(;&8B73
7
S0!1B7 ;8+&B70 :(C9$B73 7S0!1B73 F(;&8B 3 DQ3HQ81:[GCEN/63BB0 1E2GVB 3
7/A(;B
3 9+77\BB0 08*L-B70 :(C%KB 3 9+77\B 3 7/A(;B 3 8#.<0B30 1E2GVB73 E/$AJB73
75:U
;BB0 3,H8]B70 :(C’NB73 75:U;B73 E/$AJB 3 CW05Z817VBB0 1E2GVB 3 7>BH+B 3
9=”I.BB
0 08*L-B70 :(C=>B 3 9=”I.B 3 7>BH+B 3 8!B68B30 1E2GVB73 D+H3,B73 6%]S9BB0
3,H8]
B70 :(C$PB73 6%]S9B73 D+H3,B 3 B)X?U817XBB0 1E2GVB 3 7>BMGB 3 9=”U-BB0 08*L-
B70
:(C=>B 3 9=”U-B 3 7>BMGB 3 8!BFGB30 1E2GVB73 D+H9%B73 6%]<6BB0 3,H8]B70
:(C$PB
73 6%]<6B73 D+H9%B 3 B)X_S8179BB0 1E2GVB 3 7J5\SB 3 9W9XMBB0 08*L-B70 :(C:,B 3
9W9XMB 3 7J5\SB 3 8/@A0B30 1E2GVB73 F(:Q7B73 7S16RBB0 3,H8]B70 :(C”<B73
7S16RB7
3 F(:Q7B 3 DQ3:;8177BB0 1E2GV^81UF^B 3 7J5?BB 3 9W9I(BB0 08*L-B70 :(C:,B 3
9W9I
(B 3 7J5?BB 3 8/?_*B30 1E2GVB73 F(:Q7B73 7S0’?BB0 3,H8]B70 :(C”<B73 7S0’?B73
F(
:Q7B 3 DQ3:R81<4GCEN/63BB0 1E2GVB 3 7/B0<B 3 9+7XKB30 #QCFB 0 :(D2CB 3 9+7XKB
3 7/B0<B 3 8#*DPB30 1E2GVB73 E/$’MB73 75:>6BB0 2NF6’B70 :(C[%B73 75:>6B73
E/$’M
B 3 CW0XV817XBB0 1E2GVB 3 7>B?,B 3 9=”=6B30 #QCFB 0 :(C_”B 3 9=”=6B 3 7>B?,B
3
8!BZ0B30 1E2GVB73 D+H-]B73 6%]”_BB0 2NF6’B70 :(C?&B73 6%]”_B73 D+H-]B 3
B)YM&8
17ZBB0 1E2GVB 3 7>B\?B 3 9=#2^B30 #QCFB 0 :(C_”B 3 9=#2^B 3 7>B\?B 3 8!B:.B30
Main Index
1918
Code Examples
Main Index
1920
Code Examples
.B 3 IC_KRB30 1E2GVB 2 /7K BB73 BZKZPBB0 2Y]N:BB2 “WPUB 2 /7K BB73 BZKZPB 3
D<
8[M8201$GCEN/63BB0 1E2GVB 3 CO,I_B 3 K”2UEB 1F&[$B 0 :(9%6B 3 K”2UEB 3
CO,I_B
3 H\ZP3B30 1E2GVB71 ;3X,[B73 C\>#,BB0 2),Y/BB2 [U[SB71 ;3X,[B73 C\>#,B 3
C”’(
?816MBB0 1E2GVB 3 B?”XVB 3 KZ8#AB 1F&[$B 0 :(9!2B 3 KZ8#AB 3 B?”XVB 3
H&,,DB3
0 1E2GVB72 .RJA?B73 EJ<HDBB0 2),Y/BB2 09N27B72 .RJA?B73 EJ<HDB 3 C-Z.0816KBB0
1
E2GVB 3 B?”9’B 3 KZ7=NB 1F&[$B 0 :(9!2B 3 KZ7=NB 3 B?”9’B 3 H&&!DB30
1E2GVB72
.RLH”B73 EJ<M3BB0 2),Y/BB2 09N31B72 .RLH”B73 EJ<M3B 3 C-Z*?815^BB0 1E2GVB 3
C^
PNMB 3 K!&\*B 1F&[$B 0 :(9/’B 3 K!&\*B 3 C^PNMB 3 IC]2&B30 1E2GVB 2 /7Z\@B73
BZKQTBB0 2),Y/BB2 #]@:B 2 /7Z\@B73 BZKQTB 3 D<9?4815\BB0 1E2GVB 3 C^P”SB 3
K!;
H2B 1F&[$B 0 :(9/’B 3 K!;H2B 3 C^P”SB 3 IC^6CB30 1E2GVB 2 /7U;LB73 BZK$@BB0
2
),Y/BB2 #]!@B 2 /7U;LB73 BZK$@B 3 D<9’&8201”GCEN/63BB0 1E2GVB 3 CO,I_B 3
K”2()
BB0 0NRHFB70 :(DL$B 3 K”2()B 3 CO,I_B 3 H\ZXFB30 1E2GVB71 ;3B?EB73 C\<7UB7
1;1
^:BB1 .+]\B71 ;3B?EB73 C\<7UB 3 C”)7)816KBB0 1E2GVB 3 B?”^KB 3 KZ7S<BB0
0NRHFB
70 :(DL$B 3 KZ7S<B 3 B?”^KB 3 H&&,@B30 1E2GVB72 .RZ’-B73 EJ<J4B7 1;1^:BB1
@14
(B72 .RZ’-B73 EJ<J4B 3 C-ZL)816IBB0 1E2GVB 3 B?#>4B 3 KZA (BB0 0NRHFB70 :(DL$B
3 KZA (B 3 B?#>4B 3 H&;^*B30 1E2GVB72 .RM&<B73 EJ,:0B7 1;1^:BB1 @1A_B72
.RM&<
B73 EJ,:0B 3 C-XGI815[BB0 1E2GVB 3 C^O]&B 3 K!: \BB0 0NRHFB70 :(DK5B 3 K!: \B
3
C^O]&B 3 IC^YWB30 1E2GVB 2 /7</QB73 BZH QB7 1;1^:BB2 4>MMBB 2 /7</QB73 BZH
QB
3 D<7*\815^BB0 1E2GVB 3 C^N:GB 3 K!%:CBB0 0NRHFB70 :(DK5B 3 K!%:CB 3 C^N:GB 3
IC!!0B30 1E2GVB 2 /7+*\B73 BZK3”B7 1;1^:BB2 4>L&_B 2 /7+*\B73 BZK3”B 3
D<9.(82
01@GCEN/63BB0 1E2GVB 3 CO&&RB 3 K”1?7B 2Q5*ZB 0 :(7,]B 3 K”1?7B 3 CO&&RB 3
H\
Y<‘B30 1E2GVB71 ;2TR]B73 C\:%%B7 01%P<BB2 1(B]’B71 ;2TR]B73 C\:%%B 3
C”(\L816I
BB0 1E2GVB 3 B?”%&B 3 KZ8\:B 2Q5*ZB 0 :(81:B 3 KZ8\:B 3 B?”%&B 3 H&;16B30
1E2
GVB72 .RC7MB73 EJ&_\B7 01%P<BB2 2IW2OB72 .RC7MB73 EJ&_\B 3 C-W.X816GBB0
1E2GVB
3 B?*_NB 3 KZ6Z>B 2Q5*ZB 0 :(81:B 3 KZ6$/B 3 B?*_NB 3 H&%\”B30 1E2GVB72
.RMN
%B73 EJ:]\B7 01%P<BB2 2IVSOB72 .RMN%B73 EJ:]\B 3 C-ZI=815@BB0 1E2GVB 3 C^N_$B
3 K!%KYB 2Q5*ZB 0 :(7YYB 3 K!%KYB 3 C^N_$B 3 IC!X[B30 1E2GVB 2 /7(PGB73
BZK9K
B7 01%P<BB2 1AC4TB 2 /7(PGB73 BZK9KB 3 D<9!=815[BB0 1E2GVB 3 C^O@RB 3 K!;K0B
2Q5*ZB 0 :(7YYB 3 K!;K0B 3 C^O@RB 3 IC^0FB30 1E2GVB 2 /7”X[B73 BZG’YB7
01%P<B
B2 1ACS?B 2 /7”X[B73 BZG’YB 3 D<6[^82022GCEN/63BB0 1E2GVB 3 CO&X,B 3 K”144B30
4
.NFXB 0 :(C/@B 3 K”144B 3 CO&X,B 3 H\YASB30 1E2GVB71 ;2H?MB73 C\<B$B7
1+F76BB1
)NQDB71 ;2H?MB73 C\<B$B 3 C”)S@816GBB0 1E2GVB 3 B?*9DB 3 KZ5Y)B30 4.NFXB 0
:(
C(?B 3 KZ5Y)B 3 B?*9DB 3 H&%4FB30 1E2GVB72 .RNJNB73 EJ:(EB7 1+F76BB1 ;_)SB72
.RNJNB73 EJ:(EB 3 C-Y\]816EBB0 1E2GVB 3 B?”2DB 3 KZ83DB30 4.NFXB 0 :(C(?B 3
KZ8
3DB 3 B?”2DB 3 H&,BTB30 1E2GVB72 .RD]/B73 EJ;H;B7 1+F76BB1 ;_=WB72 .RD]/B73
E
J;H;B 3 C-X[0815>BB0 1E2GVB 3 C^PH%B 3 K!,%-B30 4.NFXB 0 :(CY[B 3 K!,%-B 3
C^PH
%B 3 IC](PB30 1E2GVB 2 /7;[?B73 BZH]OB7 1+F76BB2 4R’_ B 2 /7;[?B73 BZH]OB 3
D<
8XO815@BB0 1E2GVB 3 C^OA\B 3 K!#($B30 4.NFXB 0 :(CY[B 3 K!#($B 3 C^OA\B 3
IC!1@
B30 1E2GVB 2 /7)1VB73 BZJ/]B7 1+F76BB2 4R’%,B 2 /7)1VB73 BZJ/]B 3
D<9Q08202CGC
Main Index
1938
Code Examples
Main Index
CHAPTER 18 1939
Support Files
Main Index
CHAPTER 18 1941
Support Files
3BB0 1E2GVB72 H^HT#B 2 72’ TB7 +V^SB70 :(AM<B 2 72’ TB72 H^HT#B 2 N0P$;B30
1E
2GVB71 P19-KB 2 :36:5B 0D[ 3B 0 :(AS;B 2 :36:5B71 P19-KB 2 <PP^_815*BB0
1E2GV
B71 (MLD0B 2 B]&[8B7 +V^SB70 :(8V(B 2 B]&[8B71 (MLD0B 2 ER7D2B30 1E2GVB 2
C#S
.-B 2 !S=/JB 0D[ 3B 0 :(9*7B 2 !S=/JB 2 C#S.-B 2 ;]M\$815#BB0 1E2GVB71 (NB
[B
2 B]ZD?B7 +V^SB70 :(8V(B 2 B]ZD?B71 (NB [B 2 EQ^-QB30 1E2GVB 2 C#QF2B 2
!S/]
DB 0D[ 3B 0 :(9*7B 2 !S/]DB 2 C#QF2B 2 ;]IA7815NBB0 1E2GVB72 X8F50B 1
TR8\;B7
+V^SB70 :(BD\B 1 TR8\;B72 X8F50B 2 Y#?=PB30 1E2GVB72 IMXK8B 2 “X08>B 0D[
3
B 0 :(B 4B 2 “X08>B72 IMXK8B 3 4^$=N815LBB0 1E2GVB72 X88[7B 1 TT(M)B7
+V^SB70
:(BD\B 1 TT(M)B72 X88[7B 2 Y#[U_B30 1E2GVB72 IMUF4B 2 “X6OCB 0D[ 3B 0 :(B
4B
2 “X6OCB72 IMUF4B 3 4^/3P8208IGCEN/63BB0 1E2GVB72 H^J3:B 2 72ZI?B31 >^45B 0
:
(DXVB 2 72ZI?B72 H^J3:B 2 N0MDUB30 1E2GVB71 P1UK2B 2 :35MDB ]?Q0B 0 :(BB B
2
:35MDB71 P1UK2B 2 <PP++815#BB0 1E2GVB71 (Q**]B 2 B]TR^B31 >^45B 0 :(DUWB 2
B]
TR^B71 (Q**]B 2 ER6$;B30 1E2GVB 2 C#*JSB 2 !S’N:B ]?Q0B 0 :(A$FB 2 !S’N:B 2
C#*JSB 2 ;]G]8815”BB0 1E2GVB71 (R0E$B 2 B]Q0YB31 >^45B 0 :(DUWB 2 B]Q0YB71
(R0
E$B 2 ER4W]B30 1E2GVB 2 C##0+B 2 !S&_+B ]?Q0B 0 :(A$FB 2 !S&_+B 2 C##0+B 2 ;
]N:D815MBB0 1E2GVB72 X7<6&B 1 TSNQGB31 >^45B 0 :(DXVB 1 TSNQGB72 X7<6&B 2
Y#YB
HB30 1E2GVB72 IM> MB 2 “W\^7B ]?Q0B 0 :(B$KB 2 “W\^7B72 IM> MB 3
4^+3’815NBB
0 1E2GVB72 X7;V_B 1 TS[_’B31 >^45B 0 :(DXVB 1 TS[_’B72 X7;V_B 2 Y#Y/MB30
1E2GV
B72 IM@GHB 2 “W>(@B ]?Q0B 0 :(B$KB 2 “W>(@B72 IM@GHB 3 4^/RF8208SGCEN/63BB0
1E2GVB72 H^R(BB 2 72/ZPB 04 %>B 0 :(7_MB 2 72/ZPB72 H^R(BB 2 N0W3;B30
1E2GVB7
1 P QX\B 2 :3DV#B7 _^6<B70 :(B52B 2 :3DV#B71 P QX\B 2 <PQ=9815”BB0 1E2GVB71
(
RAP0B 2 B]P^4B 04 %>B 0 :(4”EB 2 B]P^4B71 (RAP0B 2 ER59AB30 1E2GVB 2 C#;<RB
2
!S;/!B7 _^6<B70 :(AUIB 2 !S;/!B 2 C#;<RB 2 ;]N\)815.BB0 1E2GVB71 (QU.3B 2
B]
-<‘B 04 %>B 0 :(4”EB 2 B]-<‘B71 (QU.3B 2 ERF)^B30 1E2GVB 2 C#;#6B 2 !S:0”B7
_^6<B70 :(AUIB 2 !S:0”B 2 C#;#6B 2 ;]OQ_815KBB0 1E2GVB72 X83S.B 1 TT*6(B 04
%>B 0 :(9V*B 1 TT*6(B72 X83S.B 2 Y#<I’B30 1E2GVB72 IMY9QB 2 “X5#EB7 _^6<B70
:
(BV>B 2 “X5#EB72 IMY9QB 3 4^/H#815MBB0 1E2GVB72 X88H@B 1 TRN5;B 04 %>B 0
:(9V
*B 1 TRN5;B72 X88H@B 2 Y#&.SB30 1E2GVB72 IMYC%B 2 “X5D.B7 _^6<B70 :(BV>B 2
“X
5D.B72 IMYC%B 3 4^/E$8208+GCEN/63BB0 1E2GVB72 H^I>2B 2 72%:;B31 1,RD:B 0
:(DQ2B
2 72%:;B72 H^I>2B 2 N0V@-B30 1E2GVB71 P0=”1B 2 :3B0JBB0 3!1:_B70 :(CK0B 2
:3B0
JB71 P0=”1B 2 <PSYM815.BB0 1E2GVB71 (N!$9B 2 B]’.^B31 1,RD:B 0 :(DL$B 2
B]’.^B7
1 (N!$9B 2 ER75_B30 1E2GVB 2 C#U5IB 2 !S#’4BB0 3!1:_B70 :(C28B 2 !S#’4B 2
C#U5I
B 2 ;]QV$815’BB0 1E2GVB71 (NOL%B 2 B]<GLB31 1,RD:B 0 :(DL$B 2 B]<GLB71 (NOL%B
2
ERF4.B30 1E2GVB 2 C#R;(B 2 !S)H,BB0 3!1:_B70 :(C28B 2 !S)H,B 2 C#R;(B 2
;]K\Q8
15IBB0 1E2GVB72 X87<$B 1 TUY8NB31 1,RD:B 0 :(DRYB 1 TUY8NB72 X87<$B 2 Y#^=1B30
1E2GVB72 IMTC%B 2 “X4I<BB0 3!1:_B70 :(CXQB 2 “X4I<B72 IMTC%B 3 4^$&@815KBB0
1E2
GVB72 X8B VB 1 TS,2DB31 1,RD:B 0 :(DRYB 1 TS,2DB72 X8B VB 2 Y#!WOB30 1E2GVB72
I
MQHOB 2 “XBJNBB0 3!1:_B70 :(CXQB 2 “XBJNB72 IMQHOB 3 4^/FK8208%GCEN/63BB0
1E2GV
B72 H^N*UB 2 72’\EBB0 07NKIB70 :(C_”B 2 72’\EB72 H^N*UB 2 N0WHDB30 1E2GVB71
P0<
Main Index
1948
Code Examples
Main Index
1966
Code Examples
3^HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
H
#---------------------------------------------------------------------
# File : spool.ses
#
# Purpose : This file will generate a PATRAN database
# “spool.db” which consists of a free standing
# aluminum spool, wound with a wire which results
# in a compressive pressure on the spool’s core
# and flanges.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
# Model : The spool is 8 units tall with a core diameter of
# 2 units, a flange diameter of 8 units. Fillet
# radius is 1 unit. The spool is made of aluminum,
# 0.075 units thick.
#
# The model consists of
# * +400 psi compressive pressure on spool core
# * +20 psi compressive pressure on the top and
# bottom flanges
# * +400 to +20 psi compressive pressure varying
# over the top and bottom flanges
#
# Analysis & After running this session file, analysis can be
# Results: done by following these steps.
# 1. Choose “MSC.Nastran” from “Preferences”,
# “Analysis...” puldown menus on the menu bar.
# 2. Select “Analysis” switch and from the form
# displayed select “Translation Parameters...”
# button. From the “OUTPUT2 Fomat” Option Menu
# select option “Text”. Press “OK”.
# 3. Press “Apply” on “Analysis” window.
# If MSC.Nastran is available this will create
# a file “spool.op2”
# 4. From the “Analysis” window, from “Action”
# Option Menu, select “Read Output2” option.
# 5. Click on the “Select Results File..” Button
# and select “spool.op2”. Press “Apply”.
# 6. The results will be read, and a file
# “spool.jbr” is created.
#---------------------------------------------------------------------
#
# Create a new database and set the preferences
uil_file_new.go(““, “./spool.db”)
$? YES 36000002
asm_create_line_xyz_created_ids )
asm_const_line_xyz( “2”, “<0 4 0>”, “[0 0 0]”, “Coord 0”, @
asm_create_line_xyz_created_ids )
#---------------------------------------------------------------------
# Create a fillet between the flange and the core curves
STRING asm_create_line_fil_created_ids[VIRTUAL]
asm_const_line_fillet( “3”, 1, 1., 0.0040000002, TRUE, @
“Construct PointCurveUOnCurve (Evaluate Geometry”// @
“(Point 1 )) (Evaluate Geometry (Curve 1 ))”, @
“Construct PointCurveUOnCurve (Evaluate Geometry”// @
“(Point 1 )) (Evaluate Geometry (Curve 2 ))”, @
asm_create_line_fil_created_ids )
$# Do you wish to trim the original curves?
$? YESFORALL 1000047
#---------------------------------------------------------------------
# Create spool surface using Create’s Revolve method
STRING sgm_sweep_surface_r_created_ids[VIRTUAL]
sgm_const_surface_revolve( “1”, “{[-1 0 0][-1 1 0]}”, 360., @
0.,”Coord 0”,”Curve 1 3 2”, sgm_sweep_surface_r_created_ids )
ga_view_aa_set( 30., 60., 0. )
ga_display_lines_set( “general”, 2 )
#---------------------------------------------------------------------
# Create the surfaces for the top half of the spool using
# Mirror method
STRING sgm_transform_surf__created_ids[VIRTUAL]
sgm_transform_mirror( “4”, “surface”, “{[0 4 0][0 5 0]}”, @
0., TRUE, FALSE, “Surface 1:3 “, sgm_transform_surf__created_ids )
#---------------------------------------------------------------------
# Set the positive surface normal vectors
STRING sgm_edit_surface_r_reversed_ids[VIRTUAL]
sgm_edit_surface_reverse( TRUE, “Surface 1:6”, @
sgm_edit_surface_r_reversed_ids )
sgm_edit_surface_reverse( TRUE, “Surface 1:6”, @
sgm_edit_surface_r_reversed_ids )
#---------------------------------------------------------------------
# Create a local cylindrical coordinate frame
STRING asm_create_cord_3po_created_ids[VIRTUAL]
asm_const_coord_3point( “1”, “Coord 0”, 2, “[-1 0 0]”, “[-1 1 0]”, @
“[1 0 0]”, asm_create_cord_3po_created_ids )
#---------------------------------------------------------------------
# Create a pressure field 400_20_psi_transition
fields_create( “400_20_psi_transition”, “Spatial”, 1, “Scalar”, @
“Real”, “Coord 1”, ““, “Function”, 1, “R”, ““, ““, @
“780-380*’R”, ““, ““, FALSE, [0.], [0.], [0.], [[[0.]]] )
#---------------------------------------------------------------------
# Apply a pressure varying from 400 to 20 psi on the fillet
loadsbcs_create( “fillet_pressure”, “Pressure”, “Element Uniform”, @
“2D”, “Static”, [“Surface 2 5”], “Geometry”, ““, 1., [““, @
“f:400_20_psi_transition”, ““], [““, ““, ““] )
# Apply a pressure of 400 psi on the core
loadsbcs_create( “400_psi”, “Pressure”, “Element Uniform”, “2D”, @
“Static”, [“Surface 3 6”], “Geometry”, ““, 1., [““, “400”, @
““], [““, ““, ““] )
# Apply a pressure of 20 psi on the top and bottom flanges
loadsbcs_create( “20_psi”, “Pressure”, “Element Uniform”, “2D”, @
“Static”, [“Surface 1 4”], “Geometry”, ““, 1., [““, “20”, ““], @
[““, ““, ““] )
#---------------------------------------------------------------------
# Apply displacement constraint at the centre of the spool
loadsbcs_create( “TZ_fixed”, “Displacement”, “Nodal”, ““, “Static”, @
[“Point 7”], “Geometry”, “Coord 1”, 1., [“<0,0,0>”, “<0,0,0 >” @
], [““, ““] )
#---------------------------------------------------------------------
# Create a new group called “fem_model” and make it current
sys_poll_option( 2 )
ga_group_create( “fem_model” )
ga_group_current_set( “fem_model” )
Main Index
CHAPTER 18 1975
Support Files
TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, @
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, @
FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, @
FALSE, FALSE, FALSE, FALSE, FALSE], [6, 3, 1, 1, 5, 7, 2, 2, 8,1,@
2, 3, 3, 5, 2, 1, 3, 4, 5, 3, 3, 2, 2, 2, 2, 6, 6, 6, 3, 6, 15,5,@
5, 5, 5, 6, 7, 8, 9, 10], [FALSE, FALSE, FALSE, FALSE, FALSE, @
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, @
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, @
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, @
FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE], [3, 4, 5, 6, 1,@
1, 7, 8, 9, 10], [FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE,@
TRUE, TRUE, TRUE], FALSE )
display_fa_vectors( TRUE )
sys_poll_option( 0 )
#---------------------------------------------------------------------
# End of File.
#---------------------------------------------------------------------
# File : spool_res.ses
#
# Purpose : This file will open the “spool.db” database
# and reads the results from files “spool.op2”
# and “spool.jbr”.
#
# This session file assumes that the files spool.db,
# spool.op2 and spool.jbr already exist. For
# instructions regarding creating these files see
# file “spool.ses”.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
#---------------------------------------------------------------------
#
# Open the “spool.db” database.
uil_file_open.go( “spool.db”)
res_init_fringe_plot( )
res_create_fringe_plot_rec3( 25, 2, 1, 1, 1, 1, 0, 0, 1., ““, @
2, 3, 6, 52, 2, 1, 0., 30, 0, 1 )
res_make_fringe_plot( 1, [1], [1], [““], [0.], [ “DEFAULT, Static “//@
“Subcase: Stress Tensor At Z1 (VON-MISES) -MSC.Nastran”] )
res_deinit_fringe_plot( )
# sf_pause()
# res_init_deform_plot( )
# res_create_deform_plot_rec2( 24, 2, 1, 3, [27, 28, 29, 0, 0, 0], @
# 1, 1, 0., 8, 0, 1, 0, [0., 0., 0.] )
Main Index
CHAPTER 18 1977
Support Files
# res_init_deform_plot( )
# res_create_deform_plot_rec2( 26, 1, 1, 3, [27, 28, 29, 0, 0, 0], @
# 1, 1, 0., 8, 0, 1, 0, [0., 0., 0.] )
# res_make_deform_plot( 1, [1], [1], [““], [0.], [“DEFAULT, Static “//@
# “Subcase: Constraint Forces, Translational -MSC.Nastran”] )
# res_deinit_deform_plot( )
# sf_pause()
#---------------------------------------------------------------------
#---------------------------------------------------------------------
# File : spool_res_deform.ses
#
# Purpose : This file will open the “spool.db” database
# and reads the results from files “spool.op2”
# and “spool.jbr”.
#
# This session file assumes that the files spool.db,
# spool.op2 and spool.jbr already exist. For
# instructions regarding creating these files see
# file “spool.ses”.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
#---------------------------------------------------------------------
#
# Open the “spool.db” database.
uil_file_open.go( “spool.db”)
#res_init_fringe_plot( )
#res_create_fringe_plot_rec3( 25, 2, 1, 1, 1, 1, 0, 0, 1., ““, @
# 2, 3, 6, 52, 2, 1, 0., 30, 0, 1 )
#res_make_fringe_plot( 1, [1], [1], [““], [0.], [ “DEFAULT, Static “//@
# “Subcase: Stress Tensor At Z1 (VON-MISES) -MSC.Nastran”] )
#res_deinit_fringe_plot( )
# sf_pause()
res_init_deform_plot( )
res_create_deform_plot_rec2( 24, 2, 1, 3, [27, 28, 29, 0, 0, 0], @
1, 1, 0., 8, 0, 1, 0, [0., 0., 0.] )
res_make_deform_plot( 1, [1], [1], [““], [0.], [“DEFAULT, Static “//@
“Subcase: Displacements, Translational -MSC.Nastran”] )
Main Index
1978
Code Examples
res_deinit_deform_plot( )
# sf_pause()
# res_init_deform_plot( )
# res_create_deform_plot_rec2( 26, 1, 1, 3, [27, 28, 29, 0, 0, 0], @
# 1, 1, 0., 8, 0, 1, 0, [0., 0., 0.] )
# res_make_deform_plot( 1, [1], [1], [““], [0.], [“DEFAULT, Static “//@
# “Subcase: Constraint Forces, Translational -MSC.Nastran”] )
# res_deinit_deform_plot( )
# sf_pause()
#---------------------------------------------------------------------
#---------------------------------------------------------------------
# File : spool_res_vector.ses
#
# Purpose : This file will open the “spool.db” database
# and reads the results from files “spool.op2”
# and “spool.jbr”.
#
# This session file assumes that the files spool.db,
# spool.op2 and spool.jbr already exist. For
# instructions regarding creating these files see
# file “spool.ses”.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
#---------------------------------------------------------------------
#
# Open the “spool.db” database.
uil_file_open.go( “spool.db”)
#---------------------------------------------------------------------
#---------------------------------------------------------------------
# File name : titles.ses
#
# Purpose : This file is used to create a new database
# “new.db” and create some titles in it.
#
# This file can be run by starting a session of
# MSC.Patran, and running this session file
# through the “File”,”Session”,”Play” pulldown
# menus on the menu bar.
#
#---------------------------------------------------------------------
# Variable Declarations
Main Index
CHAPTER 18 1979
Support Files
STRING s_name[32]
REAL r_x,r_y
INTEGER i_index,i_color, i_size
#---------------------------------------------------------------------
# Create a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
#---------------------------------------------------------------------
/*****************************************************************
* Purpose : To Create a FORM to facilitate the examples
* for functions in MSC.Acumen Manual.
*
* A medium width half height sized form is created
* containing the text widget, a frame widget, a list
* box widget and a button widget.
*
* Side Effects :
* <none>
*
******************************************************************/
#ifndef user_form
#define user_form
#include “appforms.p”
CLASS USER_FORM
/*****************************************************************
* FUNCTION init
*
* Purpose :
*
* Initialize the User Form.
*
* Input :
*
* <none>
*
* Output :
*
* <none>
*
******************************************************************/
Main Index
1980
Code Examples
FUNCTION init()
user_form_id = UI_FORM_CREATE( @
/* Callback */ ““, @
/* x location */ x_loc, @
/* y location */ y_loc, @
/* position */ “UL”, @
/* width */ FORM_WID_MED, @
/* height */ FORM_HGT_HALF, @
/* label */ “USER FORM”, @
/* unused */ ““)
y_loc = INTER_WIDGET_SPACE
x_loc = INTER_WIDGET_SPACE
s_initial = “This is the first string displayed.\n”// @
“You can edit these strings”
user_text_id = UI_TEXT_CREATE( @
/* parent */ user_form_id, @
/* call back */ ““, @
/* x location */ x_loc, @
/* y location */ y_loc, @
/* width */ TBOX_WID_DOUBLE, @
/* num rows */ 3, @
/* label */ “Text Widget”, @
/* text */ s_initial, @
/* editable */ TRUE)
y_loc = y_loc + @
3*TEXT_FONT_HGT + @
3*INTER_WIDGET_SPACE + @
FRAME_LABEL_HGT
f_height = FRAME_T_MARGIN + @
LBOX_3L_HGT_LABOVE + @
INTER_WIDGET_SPACE + @
FRAME_B_MARGIN
user_frame_id = UI_FRAME_CREATE( @
/* parent */ user_form_id, @
/* call back */ ““, @
/* x location */ x_loc, @
/* y location */ y_loc, @
/* width */ FRAME_WID_SINGLE, @
/* height */ f_height, @
/* label */ “Frame Widget”)
user_list_id = UI_LISTBOX_CREATE( @
/* parent */ user_frame_id, @
/* call back */ “user_list_cb”, @
/* x location */ FRAME_L_MARGIN, @
/* y location */ FRAME_T_MARGIN, @
/* width */ LBOX_WID_SINGLE, @
/* num rows */ 3, @
/* label */ “List Box Widget”, @
/* Selection type*/ “MULTIPLE”, @
/* Sort */ TRUE)
Main Index
CHAPTER 18 1981
Support Files
user_databox_id = UI_DATABOX_CREATE( @
/* parent */ user_form_id, @
/* call back */ “user_databox_cb”, @
/* x location */ x_loc, @
/* y location */ y_loc, @
/* label_length */ 0.0, @
/* Box length */ DBOX_WID_SINGLE, @
/* label */ “Databox Widget”, @
/* Value */ ““, @
/* Label Above */ TRUE, @
/* Datatype */ “STRING”, @
/* Num Values */ 0)
y_loc = FORM_HGT_HALF - @
2* INTER_WIDGET_SPACE - @
BUTTON_DEFAULT_HGT
user_button_id = UI_BUTTON_CREATE ( @
/* parent */ user_form_id, @
/* call back */ “user_button_cb”, @
/* x location */ BUTTON_THIRD_X_LOC_CEN_MED, @
/* y location */ y_loc, @
/* width */ BUTTON_WID_THIRD, @
/* height */ 0, @
/* label */ “OK”, @
/* unused */ TRUE, @
/* highlight */ FALSE)
/*****************************************************************
* FUNCTION display
*
* Purpose :
*
* To display the User Form.
*
* Input :
*
* <none>
*
* Output :
*
* <none>
*
******************************************************************/
FUNCTION display()
ui_form_display(“USER_FORM”)
/*****************************************************************
* FUNCTION exit
*
* Purpose :
Main Index
1982
Code Examples
*
* To delete the form.
*
* Input :
*
* <none>
*
* Output :
*
* <none>
*
******************************************************************/
FUNCTION exit()
END FUNCTION
/*****************************************************************
* FUNCTION get_widget_ids()
*
* Purpose :
*
* To output the widget ids
*
* Input :
*
* <none>
*
* Output :
*
* user_widgets() - Widget ids of the user_form widgets
*
******************************************************************/
FUNCTION get_widget_ids(u_widget)
WIDGET u_widget()
sys_allocate_array(u_widget,1,6)
u_widget(1)= user_form_id
u_widget(2)= user_text_id
u_widget(3)= user_frame_id
u_widget(4)= user_list_id
u_widget(5)= user_databox_id
u_widget(6)= user_button_id
/*****************************************************************
* FUNCTION user_databox_cb
*
* Purpose :
*
* Displays the value entered in databox in history window
*
* Input :
*
* <none>
*
* Output :
*
* <none>
*
******************************************************************/
FUNCTION user_databox_cb(s_event)
STRING s_event[]
STRING s_value[128]
END FUNCTION
/*****************************************************************
* FUNCTION user_button_cb
*
* Purpose :
*
* Hides the USER form.
*
* Input :
*
* <none>
*
* Output :
*
* <none>
*
******************************************************************/
FUNCTION user_button_cb()
/*
This class function can be set up to delete the form
with the following call:
ui_form_delete(“USER_FORM”)
END FUNCTION
/*****************************************************************
* FUNCTION user_list_cb
*
* Purpose :
*
* Writes the choice selected in the list box to the history
* window.
Main Index
1984
Code Examples
*
* Input :
*
* <none>
*
* Output :
*
* <none>
*
******************************************************************/
FUNCTION user_list_cb(i_num_val,s_vstr)
INTEGER i_num_val
STRING s_vstr[]()
END FUNCTION
/*****************************************************************/
#endif
/*****************************************************************
* Purpose : To Create a FORM to facilitate the examples
* for functions in MSC.Acumen Manual.
*
* A medium width half height sized form is created
* containing the text widget, a frame widget, a list
* box widget and a button widget.
*
* Side Effects :
* <none>
*
******************************************************************/
#ifndef user_form
#define user_form
#include “appforms.p”
CLASS USER_FORM
/*****************************************************************
* FUNCTION init
*
* Purpose :
*
* Initialize the User Form.
*
* Input :
*
* <none>
*
* Output :
Main Index
CHAPTER 18 1985
Support Files
*
* <none>
*
******************************************************************/
FUNCTION init()
user_form_id = UI_FORM_CREATE( @
/* Callback */ ““, @
/* x location */ x_loc, @
/* y location */ y_loc, @
/* position */ “UL”, @
/* width */ FORM_WID_MED, @
/* height */ FORM_HGT_HALF, @
/* label */ “USER FORM”, @
/* unused */ ““)
y_loc = INTER_WIDGET_SPACE
x_loc = INTER_WIDGET_SPACE
s_initial = “This is the first string displayed.\n”// @
“You can edit these strings”
user_text_id = UI_TEXT_CREATE( @
/* parent */ user_form_id, @
/* call back */ ““, @
/* x location */ x_loc, @
/* y location */ y_loc, @
/* width */ TBOX_WID_DOUBLE, @
/* num rows */ 3, @
/* label */ “Text Widget”, @
/* text */ s_initial, @
/* editable */ TRUE)
y_loc = y_loc + @
3*TEXT_FONT_HGT + @
3*INTER_WIDGET_SPACE + @
FRAME_LABEL_HGT
f_height = FRAME_T_MARGIN + @
LBOX_3L_HGT_LABOVE + @
INTER_WIDGET_SPACE + @
FRAME_B_MARGIN
user_frame_id = UI_FRAME_CREATE( @
/* parent */ user_form_id, @
/* call back */ ““, @
/* x location */ x_loc, @
/* y location */ y_loc, @
/* width */ FRAME_WID_SINGLE, @
/* height */ f_height, @
/* label */ “Frame Widget”)
user_list_id = UI_LISTBOX_CREATE( @
/* parent */ user_frame_id, @
/* call back */ “user_list_cb”, @
/* x location */ FRAME_L_MARGIN, @
/* y location */ FRAME_T_MARGIN, @
/* width */ LBOX_WID_SINGLE, @
Main Index
1986
Code Examples
/* num rows */ 3, @
/* label */ “List Box Widget”, @
/* Selection type*/ “MULTIPLE”, @
/* Sort */ TRUE)
user_databox_id = UI_DATABOX_CREATE( @
/* parent */ user_form_id, @
/* call back */ “user_databox_cb”, @
/* x location */ x_loc, @
/* y location */ y_loc, @
/* label_length */ 0.0, @
/* Box length */ DBOX_WID_SINGLE, @
/* label */ “Databox Widget”, @
/* Value */ ““, @
/* Label Above */ TRUE, @
/* Datatype */ “STRING”, @
/* Num Values */ 0)
y_loc = FORM_HGT_HALF - @
2* INTER_WIDGET_SPACE - @
BUTTON_DEFAULT_HGT
user_button_id = UI_BUTTON_CREATE ( @
/* parent */ user_form_id, @
/* call back */ “user_button_cb”, @
/* x location */ BUTTON_THIRD_X_LOC_CEN_MED, @
/* y location */ y_loc, @
/* width */ BUTTON_WID_THIRD, @
/* height */ 0, @
/* label */ “OK”, @
/* unused */ TRUE, @
/* highlight */ FALSE)
/*****************************************************************
* FUNCTION display
*
* Purpose :
*
* To display the User Form.
*
* Input :
*
* <none>
*
* Output :
*
* <none>
*
******************************************************************/
FUNCTION display()
ui_form_display(“USER_FORM”)
/*****************************************************************
* FUNCTION exit
*
* Purpose :
Main Index
CHAPTER 18 1987
Support Files
*
* To delete the form.
*
* Input :
*
* <none>
*
* Output :
*
* <none>
*
******************************************************************/
FUNCTION exit()
END FUNCTION
/*****************************************************************
* FUNCTION get_widget_ids()
*
* Purpose :
*
* To output the widget ids
*
* Input :
*
* <none>
*
* Output :
*
* user_widgets() - Widget ids of the user_form widgets
*
******************************************************************/
FUNCTION get_widget_ids(u_widget)
WIDGET u_widget()
sys_allocate_array(u_widget,1,6)
u_widget(1)= user_form_id
u_widget(2)= user_text_id
u_widget(3)= user_frame_id
u_widget(4)= user_list_id
u_widget(5)= user_databox_id
u_widget(6)= user_button_id
/*****************************************************************
* FUNCTION user_databox_cb
*
* Purpose :
*
* Displays the value entered in databox in history window
*
* Input :
*
* <none>
*
* Output :
*
* <none>
*
******************************************************************/
FUNCTION user_databox_cb(s_event)
STRING s_event[]
STRING s_value[128]
END FUNCTION
/*****************************************************************
* FUNCTION user_button_cb
*
* Purpose :
*
* Hides the USER form.
*
* Input :
*
* <none>
*
* Output :
*
* <none>
*
******************************************************************/
FUNCTION user_button_cb()
ui_form_delete(“USER_FORM”)
END FUNCTION
/*****************************************************************
* FUNCTION user_list_cb
*
* Purpose :
*
* Writes the choice selected in the list box to the history
* window.
*
* Input :
*
* <none>
*
* Output :
*
Main Index
CHAPTER 18 1989
Support Files
* <none>
*
******************************************************************/
FUNCTION user_list_cb(i_num_val,s_vstr)
INTEGER i_num_val
STRING s_vstr[]()
END FUNCTION
/*****************************************************************/
#endif
/*****************************************************************
* Purpose : To Create a User Graph form.
*
* A medium width half height sized form is created
* containing a GRAPHICS widget and a push button to acknowledge
* and remove the form.
*
* Side Effects :
* <none>
*
******************************************************************/
#ifndef user_graph
#define user_graph
#include “appforms.p”
CLASS USER_GRAPH
/*****************************************************************
* FUNCTION init
*
* Purpose :
*
* Initialize the User Graph.
*
* Input :
*
* <none>
*
* Output :
*
* <none>
*
******************************************************************/
FUNCTION init()
user_form_id = UI_FORM_CREATE( @
/* Callback */ ““, @
/* x location */ x_loc, @
/* y location */ y_loc, @
/* position */ “UL”, @
/* width */ FORM_WID_SML, @
/* height */ FORM_HGT_HALF, @
/* label */ “FORM with GRAPH widget”, @
/* unused */ ““)
y_loc = FORM_HGT_QTR/3
x_loc = (FORM_WID_SML - FORM_HGT_QTR)/2
f_width = FORM_HGT_QTR + FRAME_L_MARGIN + FRAME_R_MARGIN
f_height = FORM_HGT_QTR + FRAME_T_MARGIN + FRAME_B_MARGIN
frame_id = UI_FRAME_CREATE( @
/* parent */ user_form_id, @
/* call back */ ““, @
/* x location */ x_loc, @
/* y location */ y_loc, @
/* width */ f_width, @
/* height */ f_height, @
/* label */ ““)
user_graph_id = UI_GRAPH_CREATE ( @
/* parent */ frame_id, @
/* name */ “Graph Widget”, @
/* x location */ x_loc, @
/* y location */ y_loc, @
/* width */ g_width, @
/* height */ g_height )
y_loc = FORM_HGT_HALF - @
2* INTER_WIDGET_SPACE @
- BUTTON_DEFAULT_HGT
x_loc = (FORM_WID_SML - BUTTON_WID_THIRD)/2
ok_button = UI_BUTTON_CREATE ( @
/* parent */ user_form_id, @
/* call back */ “ok_button_cb”, @
/* x location */ x_loc, @
/* y location */ y_loc, @
/* width */ BUTTON_WID_THIRD, @
/* height */ 0, @
/* label */ “OK”, @
/* unused */ TRUE, @
/* highlight */ TRUE)
/*****************************************************************
* FUNCTION display
*
* Purpose :
*
* To display the User Graph form.
*
* Input :
Main Index
CHAPTER 18 1991
Support Files
*
* <none>
*
* Output :
*
* <none>
*
******************************************************************/
FUNCTION display()
ui_form_display(“USER_GRAPH”)
/*****************************************************************
* FUNCTION ok_button_cb
*
* Purpose :
*
* Deletes the User Graph form.
*
* Input :
*
* <none>
*
* Output :
*
* <none>
*
******************************************************************/
FUNCTION ok_button_cb()
ui_form_delete(“USER_GRAPH”)
END FUNCTION
/*****************************************************************/
#endif
Main Index
1992
Code Examples
Main Index