1410
C O N T E N T S MSC.Acumen Toolkit 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 sf_write_disable, 39 MSC.Acumen, Volume 2: Code Examples MSC.Acumen Tool- kit, Code Examples

MSC.Acumen 2006 Code Examples

  • Upload
    kevin

  • View
    206

  • Download
    25

Embed Size (px)

DESCRIPTION

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

Citation preview

C O N T E N T SMSC.Acumen Toolkit Code ExamplesMSC.Acumen, 2: Volume Examples Code MSC.Acumen Toolkit, Code Examples

CHAPTER

1

Introduction

I

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

2ModelI

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

3FilesI

Main Index

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

4GraphicsI

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

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

verify_boundaries_display_mgr.plot, 230

5User InterfaceI

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

6GroupI

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

7GeometryI

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

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

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

8Finite Element ModelI

Introduction, 532 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

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

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

9Load CasesI

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

10Element PropertiesI

Introduction, 616 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

11Loads and Boundary ConditionsI

Introduction, 702 db_bulk_get_lbc_ds, 702 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

12MaterialsI

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

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

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

13AnalysisI

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

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

14FieldsI

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

15ResultsI

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

16PreferencesI

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

17UtilitiesI

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

18Support FilesI

Introduction, 1170

Main Index

Main Index

MSC.Acumen, Volume 2: Code Examples

CHAPTER

1

Introduction

I Introduction

Main Index

2Code Examples

1.1

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

db_get_p3_version

()

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

i_return_value= db_get_p3_version ( s_p3_ver) dump s_p3_ver dump i_return_value #

-------------------------------------------------------------------

is_batch

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

Main Index

CHAPTER 1Introduction

3

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

l_status=is_batch() dump l_status # -------------------------------------------------------------------

user_db_close# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

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

user_db_new# # # # # # #Main Index

()Purpose : This file gives an example of a call to the functions user_db_new() This function is called by MSC.Patran itself just after a new database is created. Hence explicit call to the function has not been made in this session file.

4Code Examples

# # # # # # # # # # # # # # # # # # # # # # #

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

user_db_open# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

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

Main Index

CHAPTER 1Introduction

5

user_quit

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

user_start

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

Now start a new session of MSC.Patran. The instructions written in user_start() in usr_fns.pcl will be written on standard output. -------------------------------------------------------------------

Main Index

6Code Examples

utl_get_terse_version

()

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

utl_query_version_level

()

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

i_return_value = utl_query_version_level() dump i_return_value #

-------------------------------------------------------------------

Main Index

MSC.Acumen, Volume 2: Code Exampleskl

CHAPTER

2

Model

I Introduction

Main Index

610Code Examples

2.1

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

db_count_client_labels_by_type

()

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

Main Index

CHAPTER 2Model

611

i_client_label, i_client_type, i_num_logicals, i_num_integers, i_num_reals, i_num_strings, i_max_string_length, l_logical_data, i_integer_data, r_real_data, s_string_data ) # check for creation of the client data dump i_return_value # # Data type of the client. i_client_type=1001

@ @ @ @ @ @ @ @ @ @

i_return_value = db_count_client_labels_by_type ( i_client_type, i_nbr_of_labels ) # dump i_nbr_of_labels dump i_return_value

@ @ @

# create another client data with same client_type but different # client label and check for the no of labels. # i_client_label = 102 i_client_label = 102 i_return_value = db_create_client_data ( i_id, i_client_label, i_client_type, i_num_logicals, i_num_integers, i_num_reals, i_num_strings, i_max_string_length, l_logical_data, i_integer_data, r_real_data, s_string_data ) # check for creation of the client data dump i_return_value # check for the no of created labels.In this example # two labels are created. i_return_value = db_count_client_labels_by_type ( i_client_type, i_nbr_of_labels ) @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @

# check for the no of labels created dump i_nbr_of_labels dump i_return_value # ------------------------------------------------------------------Main Index

612Code Examples

db_count_general_field

()

# Purpose : This file provides an example of a call to the # function db_count_general_field() # # This function returns the count of terms in a # field. It returns a positive integer # indicating the status of the execution of the # function. # # This file can be run by starting a session of # MSC.Patran, and running this session file # through the "File","Session","Play" pulldown # menus on the menu bar. # # # The function db_count_general_field() # has the following arguments: # # db_count_general_field # ( field_id, # count ) # #--------------------------------------------------------------------# Variable Declarations INTEGER fem_create_mesh_surfa_num_nodes INTEGER fem_create_mesh_surfa_num_elems STRING asm_create_patch_xy_created_ids[VIRTUAL] STRING fem_create_mesh_s_nodes_created[VIRTUAL] STRING fem_create_mesh_s_elems_created[VIRTUAL] integer int_status=5, int_field_id, int_count STRING str_field[10] = "field_1" #---------------------------------------------------------------------# Open a new database if(!db_is_open())THEN uil_file_new.go("","new.db") $? YES 36000002 endif #---------------------------------------------------------------------# Setting the preference to MSC.Nastran. uil_pref_analysis.set_analysis_pref( "MSC.Nastran", @ "Structural", @ "", @ ".op2" ) #--------------------------------------------------------------------# Create Geometric entities int_status = asm_const_patch_xyz ( "1", "", "[0 0 0]", "Coord 0", asm_create_patch_xy_created_ids ) @ @

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

ui_exec_function( "mesh_seed_display_mgr", "init" ) mesh_seed_create( "Surface 1.2 1.4 ", 1, 4, 0., 0., 0. )Main Index

CHAPTER 2Model

613

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

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

int_status = fields_create_general ( "field_1", 0, 5, 2, "Real", "Coord 0", "", 3, 1, 2, 15 ) dump int_status int_status = fields_create_general_term ( "field_1", 0, 0, 0, 30, " [ ( 'X + 'Y ) * 'RAD ]" )

@ @ @

@ @ @

dump int_status #--------------------------------------------------------------------# Getting the field_id for the field - 'field_1' int_status = db_get_field_id(str_field,int_field_id) dump int_status, str_field, int_field_id #--------------------------------------------------------------------# Using the function db_count_general_field() to get # the number of terms_ids or count in the field

int_status = db_count_general_field (int_field_id, int_count) dump int_status, int_field_id, int_count

@

#--------------------------------------------------------------------# Closing the file - new.db uil_file_close.goquit() #---------------------------------------------------------------------

db_create_client_data# # # # # # # # Purpose

(): This file gives an example of a call to the function db_create_client_data() This function creates a client defined entity in the database. A table is provided in the database which is reserved for the use by user. The db_create_client_data() function writes the information to this table.

Main Index

614Code Examples

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

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

Main Index

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,

@ @ @ @ @ @ @ @ @ @ @ @

CHAPTER 2Model

615

r_real_data, s_string_data )

@

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

db_delete_client_data

()

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

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

Main Index

i_return_value = db_create_client_data ( i_id,

@ @ @

616Code Examples

i_client_label, i_client_type, i_num_logicals, i_num_integers, i_num_reals, i_num_strings, i_max_string_length, l_logical_data, i_integer_data, r_real_data, s_string_data ) # dump i_return_value i_return_value = db_delete_client_data ( i_client_label )

@ @ @ @ @ @ @ @ @ @

@ @

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

db_get_all_client_data

()

Main Index

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

CHAPTER 2Model

617

INTEGER INTEGER LOGICAL INTEGER REAL STRING

i_id, i_num_logicals, i_num_integers, i_num_reals, i_num_strings, i_max_string_length i_client_label, i_client_type l_logical_data(1)= [TRUE] i_integer_data(1)=[1] r_real_data(1)=[202.54] s_string_data[25](1)=[Geometric]

@

# variables used for checking the function. LOGICAL INTEGER REAL STRING INTEGER # # # # # # # # # # # l_c_logical_data(1) i_c_integer_data(1) r_c_real_data(1) s_c_string_data[25](1) 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

@ @ @ @ @ @ @ @ @ @ @ @ @

Main Index

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,

@ @ @ @ @ @ @ @ @ @

618Code Examples

r_c_real_data, s_c_string_data ) # check for the data got from the function dump dump dump dump l_c_logical_data i_c_integer_data r_c_real_data s_c_string_data

@

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

db_get_client_data

()

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

@

Main Index

INTEGER i_return_value # ------------------------------------------------------------------# Create a client defined entity in the database.

CHAPTER 2Model

619

# # # # # # # # #

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

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

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

@ @ @ @ @ @ @ @ @ @ @ @ @

i_return_value = db_get_client_data ( i_client_label, i_id, i_c_client_type, i_c_num_logicals, i_c_num_integers, i_c_num_reals, i_c_num_strings, i_c_max_string_length ) # check for the data got from the function

@ @ @ @ @ @ @ @ @

dump dump dump dump dump dump

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_return_value # -------------------------------------------------------------------

Main Index

620Code Examples

db_get_client_id_by_label

()

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

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

i_return_value = db_create_client_dataMain Index

@ @

CHAPTER 2Model

621

( i_id, i_client_label, i_client_type, i_num_logicals, i_num_integers, i_num_reals, i_num_strings, i_max_string_length, l_logical_data, i_integer_data, r_real_data, s_string_data ) # check for creation of the client data dump i_return_value # Data type of the client.

@ @ @ @ @ @ @ @ @ @ @

i_return_value = db_get_client_id_by_label ( i_client_label, i_c_id ) #

@ @ @

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

db_get_client_label_by_id

()

Main Index

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

622Code Examples

STRING

s_string_data[25](1)=[Geometric]

# Variable Declaration for checking the output. INTEGER i_c_client_label,i_return_value # # # # # # # # # # # ------------------------------------------------------------------Create a client defined entity in the database. i_client_label=101 i_client_type=1001 i_num_logicals=1 i_num_integers=1 i_num_reals=1 i_num_strings=1 i_max_string_length=25

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

i_return_value = db_create_client_data ( i_id, i_client_label, i_client_type, i_num_logicals, i_num_integers, i_num_reals, i_num_strings, i_max_string_length, l_logical_data, i_integer_data, r_real_data, s_string_data ) # check for creation of the client data dump i_return_value # Data type of the client.

@ @ @ @ @ @ @ @ @ @ @ @ @

i_return_value = db_get_client_label_by_id ( i_id, i_c_client_label ) #

@ @ @

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

Main Index

CHAPTER 2Model

623

db_get_client_labels_by_type

()

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

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

i_return_value = db_create_client_data ( i_id, i_client_label, i_client_type, i_num_logicals, i_num_integers,Main Index

@ @ @ @ @ @ @

624Code Examples

i_num_reals, i_num_strings, i_max_string_length, l_logical_data, i_integer_data, r_real_data, s_string_data ) # check for creation of the client data dump i_return_value # # Data type of the client. i_client_type=1001

@ @ @ @ @ @

i_return_value = db_get_client_labels_by_type ( i_client_type, i_labels ) # dump i_labels dump i_return_value

@ @ @

# create another client data with same client_type but different # client label and check for the labels. # i_client_label = 102 i_client_label = 102

i_return_value = db_create_client_data ( i_id, i_client_label, i_client_type, i_num_logicals, i_num_integers, i_num_reals, i_num_strings, i_max_string_length, l_logical_data, i_integer_data, r_real_data, s_string_data ) # check for creation of the client data dump i_return_value # check for the no of created labels.In this example # two labels are created. i_return_value = db_get_client_labels_by_type ( i_client_type, i_labels )

@ @ @ @ @ @ @ @ @ @ @ @ @

@ @ @

# check for the no of labels created dump i_labels dump i_return_value # -------------------------------------------------------------------

Main Index

CHAPTER 2Model

625

db_get_db_version

()

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

i_return_value = db_get_db_version ( s_db_ver ) dump i_return_value dump s_db_ver #

-------------------------------------------------------------------

db_get_general_field# # # # # # # # # # # # # # # # # # # # # # # # # # #Main Index

(): This file provides an example of a call to the function db_get_general_field() This function returns the term_field_ids, term_function_types and field_datas from the field forms, after supplying the field_id, term_id and the length of the field data. It returns a positive integer indicating the status of the execution of the function. This file can be run by starting a session of MSC.Patran, and running this session file through the "File","Session","Play" pulldown menus on the menu bar.

Purpose

The function db_get_general_field() has the following arguments: db_get_general_field ( field_id, count, term_id, field_data_length, term_field_id, term_function_type, field_data )

626Code Examples

# #--------------------------------------------------------------------# Variable Declarations INTEGER fem_create_mesh_surfa_num_nodes INTEGER fem_create_mesh_surfa_num_elems STRING asm_create_patch_xy_created_ids[VIRTUAL] STRING fem_create_mesh_s_nodes_created[VIRTUAL] STRING fem_create_mesh_s_elems_created[VIRTUAL] INTEGER INTEGER INTEGER STRING STRING int_status=5, int_field_id, int_count int_term_id(virtual), int_field_data_length(virtual) int_term_field_id, int_term_function_type str_field_data[64] str_field[10] = "field_1"

#---------------------------------------------------------------------# Open a new database if(!db_is_open())THEN uil_file_new.go("","new.db") $? YES 36000002 endif #---------------------------------------------------------------------# Setting the preference to MSC.Nastran. uil_pref_analysis.set_analysis_pref( "MSC.Nastran", @ "Structural", @ "", @ ".op2" ) #--------------------------------------------------------------------# Create Geometric entities int_status = asm_const_patch_xyz ( "1", "", "[0 0 0]", "Coord 0", asm_create_patch_xy_created_ids ) @ @

dump int_status #--------------------------------------------------------------------# Create Finite Element entities # 219 Nodes IDS = 1:219 # 60 Elements IDS = 1:60 ui_exec_function( "mesh_seed_display_mgr", "init" ) mesh_seed_create( "Surface 1.2 1.4 ", 1, 4, 0., 0., 0. ) mesh_seed_create( "Surface 1.1 1.3 ", 1, 15, 0., 0., 0. ) int_status = fem_create_mesh_surf_3 @ ( "IsoMesh", 0, "Surface 1 ", 1, @ ["0.1"], "Quad8", "1", @ "1", "Coord 0", "Coord 0", @ fem_create_mesh_surfa_num_nodes, @ fem_create_mesh_surfa_num_elems, @ fem_create_mesh_s_nodes_created, @ fem_create_mesh_s_elems_created ) dump int_status mesh_seed_display_mgr.erase( ) #--------------------------------------------------------------------# Create a Field - 'field_1' int_status = fields_create_general ( "field_1", 0, 5, 2, "Real", "Coord 0", "", 3, 1, 2, 15 ) dump int_status int_status = fields_create_general_term ( "field_1", @ @ @

Main Index

@ @

CHAPTER 2Model

627

0, 0, 0, 30, @ " [ ( 'X + 'Y ) * 'RAD ]" ) dump int_status #--------------------------------------------------------------------# Getting the field_id for the field - 'field_1' int_status = db_get_field_id(str_field,int_field_id) dump int_status #--------------------------------------------------------------------# Getting the int_count for the filed_id = 1 int_status = db_count_general_field @ (int_field_id, int_count) dump int_status #--------------------------------------------------------------------# Getting term_ids and the field_data_lengths from the field_id # and the count sys_allocate_array(int_term_id , 1, int_count) sys_allocate_array(int_field_data_length , 1, int_count)

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

db_get_general_field_length# # # # # # # # # # # Purpose

(): This file provides an example of a call to the function db_get_general_field_length() This function returns the term_ids and field_data_lengths of the field_id from which the length of field is required. It returns a positive integer indicating the status of the execution of the function, 0 for success. This file can be run by starting a session of MSC.Patran, and running this session file

Main Index

628Code Examples

# through the "File","Session","Play" pulldown # menus on the menu bar. # # # The function db_get_general_field_length() # has the following arguments: # # db_get_general_field_length # ( field_id, # count, # term_id, # field_data_length ) # #--------------------------------------------------------------------# Variable Declarations INTEGER fem_create_mesh_surfa_num_nodes INTEGER fem_create_mesh_surfa_num_elems STRING asm_create_patch_xy_created_ids[VIRTUAL] STRING fem_create_mesh_s_nodes_created[VIRTUAL] STRING fem_create_mesh_s_elems_created[VIRTUAL] INTEGER int_status=5, int_field_id, int_count INTEGER int_term_id(virtual), int_field_data_length(virtual) STRING str_field[10] = "field_1"

#---------------------------------------------------------------------# Open a new database if(!db_is_open())THEN uil_file_new.go("","new.db") $? YES 36000002 endif #---------------------------------------------------------------------# Setting the preference to MSC.Nastran. uil_pref_analysis.set_analysis_pref( "MSC.Nastran", @ "Structural", @ "", @ ".op2" ) #--------------------------------------------------------------------# Create Geometric entities int_status = asm_const_patch_xyz ( "1", "", "[0 0 0]", "Coord 0", asm_create_patch_xy_created_ids ) @ @

dump int_status #--------------------------------------------------------------------# Create Finite Element entities # 219 Nodes IDS = 1:219 # 60 Elements IDS = 1:60 ui_exec_function( "mesh_seed_display_mgr", "init" ) mesh_seed_create( "Surface 1.2 1.4 ", 1, 4, 0., 0., 0. ) mesh_seed_create( "Surface 1.1 1.3 ", 1, 15, 0., 0., 0. ) int_status = fem_create_mesh_surf_3 ( "IsoMesh", 0, "Surface 1 ", 1, ["0.1"], "Quad8", "1", @ "1", "Coord 0", "Coord 0", fem_create_mesh_surfa_num_nodes, @ fem_create_mesh_surfa_num_elems, fem_create_mesh_s_nodes_created, @ fem_create_mesh_s_elems_created ) dump int_status mesh_seed_display_mgr.erase( ) @ @ @ @

Main Index

CHAPTER 2Model

629

#--------------------------------------------------------------------# Create a Field - 'field_1' int_status = fields_create_general ( "field_1", 0, 5, 2, "Real", "Coord 0", "", 3, 1, 2, 15 ) dump int_status int_status = fields_create_general_term ( "field_1", 0, 0, 0, 30, " [ ( 'X + 'Y ) * 'RAD ]" ) @ @ @ @ @ @

dump int_status #--------------------------------------------------------------------# Getting the field_id for the field - 'field_1' int_status = db_get_field_id(str_field,int_field_id) #--------------------------------------------------------------------# int_status = db_count_general_field @ (int_field_id, int_count) #--------------------------------------------------------------------# Using the function db_get_general_field_length() to get # term_ids and the field_data_lengths from the field_id # and the count sys_allocate_array(int_term_id , 1, int_count) sys_allocate_array(int_field_data_length , 1, int_count)

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

@ @ @ @

dump int_status, int_field_id, int_count dump int_term_id, int_field_data_length #--------------------------------------------------------------------# Closing the file - new.db uil_file_close.goquit() #---------------------------------------------------------------------

db_get_model_file_suffix# # # # # # # # # # # # # Purpose

(): This file gives an example of a call to the function db_get_model_file_suffix() This function gives the suffix associated with the named analysis code. To run this session file,first start a session of MSC.Patran,open a database or start a new database,then run this session file by File,Session,Play pulldown menus on the menu bar.

Main Index

The db_create_client_data has the following arguments: db_get_model_file_suffix

630Code Examples

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

i_return_value = db_get_model_file_suffix ( s_name, s_suffix )

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

db_get_next_client_entity_label

()

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

Main Index

# #

Create a client defined entity in the database.

CHAPTER 2Model

631

# # # # # # # #

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

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

i_return_value = db_create_client_data ( i_id, i_client_label, i_client_type, i_num_logicals, i_num_integers, i_num_reals, i_num_strings, i_max_string_length, l_logical_data, i_integer_data, r_real_data, s_string_data ) # check for creation of the client data dump i_return_value # # Data type of the client. i_client_type=1001

@ @ @ @ @ @ @ @ @ @ @ @ @

i_return_value = db_get_next_client_entity_label ( i_label ) # dump i_label dump i_return_value

@ @

# create another client data with same client_type but different # client label and check for the largest client entity label. # i_client_label = 102 i_client_label = 102

Main Index

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,

@ @ @ @ @ @ @ @ @ @

632Code Examples

l_logical_data, i_integer_data, r_real_data, s_string_data ) # check for creation of the client data dump i_return_value # check for the no of created labels.In this example i_return_value = db_get_next_client_entity_label ( i_label ) # check for the largest label created dump i_label dump i_return_value #

@ @ @

@ @

-------------------------------------------------------------------

Main Index

MSC.Acumen, Volume 2: Code Examples

CHAPTER

3

Files

I Introduction

Main Index

634Code Examples

3.1

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

file_is_directory

()

# Purpose : This file provides two example calls to the # function file_is_directory() # # This function is used to check whether a # given path is valid directory. # # The function file_is_directory() # has the following arguments: # # file_is_directory # (dirname ) # #--------------------------------------------------------------------# Variable Declarations STRING s_dirname[128] INTEGER i_return_value #--------------------------------------------------------------------# # Checks if /usr/bin is a valid directory name s_dirname = /usr/bin i_return_value = @ file_is_directory @ ( s_dirname ) dump i_return_value # Paused. Press resume to continue... sf_pause() # date is an executable commonly found in /usr/bin # Checks if /usr/bin/date is a valid directory name s_dirname = /usr/bin/date i_return_value = @ file_is_directory @ ( s_dirname ) dump i_return_value #---------------------------------------------------------------------

get_current_dir

()

Main Index

# Purpose : This file provides an example of a call to the # function get_current_dir() # # This function is used to get the current # directory. # # # The function get_current_dir() # has the following arguments: # # get_current_dir # (dirname ) # #---------------------------------------------------------------------

CHAPTER 3Files

635

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

jou_file_write

()# Purpose : This file provides an example of a call to the # function jou_file_write() # # To write a string to ONLY to the journal file # (not to the session file). # # This file can be run by starting a session of # MSC.Patran, opening a new or existing database, # and running this session file through the # File,Session,Play pulldown menus # on the menu bar. # # # The function jou_file_write() # has the following arguments: # # jou_file_write # ( astring ) # #--------------------------------------------------------------------# Variable Declarations STRING s_astring[128] #--------------------------------------------------------------------# Write a string to the journal file. s_astring = # This line WILL be written to the journal file. jou_file_write @ (s_astring ) #---------------------------------------------------------------------

neutral_export2# # # # # # # # # # # # # # # # #Main Index

()Purpose : This file provides an example of a call to the function neutral_export2() This function is used to export data to a MSC.Patran 2.5 neutral file, applying the specified entity and group filters first. Before running this session file run spool.ses to create spool.db This file can be run by starting a session of MSC.Patran, and running this session file through the File,Session,Play pulldown menus on the menu bar. The function neutral_export2() has the following arguments:

636Code Examples

# # neutral_export2 # ( fname, # title, # entflag, # grpall, # ngroups, # grids ) # #--------------------------------------------------------------------# Variable Declarations STRING s_fname[128] STRING s_title[128] LOGICAL la_entflag(35)=[TRUE , TRUE , TRUE , @ TRUE , TRUE , TRUE , TRUE , TRUE , FALSE, @ TRUE , TRUE , FALSE, FALSE, TRUE , TRUE , @ TRUE , TRUE , FALSE, TRUE , TRUE , TRUE , @ TRUE , TRUE , TRUE , FALSE, FALSE, FALSE, @ FALSE, FALSE, FALSE, FALSE, TRUE , TRUE , @ FALSE, FALSE ] LOGICAL l_grpall INTEGER i_ngroups INTEGER ia_grids(2)=[1,2] INTEGER i_return_value #--------------------------------------------------------------------# Open the database spool.db uil_file_open.go(spool.db) # # # # # Assign values to variables s_fname = spool.neutral : Neutral file to write s_title = MSC.Patran 2.5 Neutral File : Title l_grpall = TRUE : Export all groups i_ngroups = 2 : Number of groups

s_fname = spool.neutral s_title = MSC.Patran 2.5 Neutral File l_grpall = TRUE i_ngroups = 2 # ------------------------------------------------------------------# Now export MSC.Patran data to a MSC.Patran 2.5 neutral file. # i_return_value = @ neutral_export2 @ (s_fname, @ s_title, @ la_entflag, @ l_grpall, @ i_ngroups, @ ia_grids ) dump i_return_value # Close the database spool.db uil_file_close.go() #---------------------------------------------------------------------

nf_write

()# # # # # # # Purpose : This file provides two examples of calls to the function nf_write() This function writes a MSC.Patran 2.5 format neutral file from the open database. Uses PFEA translator as a base, adds new Phase I If PFEA is TRUE writes only a PFEA neutral

Main Index

CHAPTER 3Files

637

# file. # # Before running this session file run spool.ses # to create spool.db # # This file can be run by starting a session of # MSC.Patran, and running this session file # through the File,Session,Play pulldown # menus on the menu bar. # # The function nf_write() # has the following arguments: # # nf_write # ( fname, # title, # pfea ) # #--------------------------------------------------------------------# Variable Declarations STRING s_fname[128] STRING s_title[128] LOGICAL l_pfea INTEGER i_return_value #--------------------------------------------------------------------# Open the database spool.db uil_file_open.go(spool.db) # # # # Export to s_fname = s_title = l_pfea = a MSC.Patran 2.5 neutral file spool.nopfea.neutral : File name to export to MSC.Patran 2.5 Neutral file : Title FALSE : Export all

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

@ @ @ @

# Session file paused. Press Resume to continue.. sf_pause() # # # # Export to s_fname = s_title = l_pfea = a MSC.Patran 2.5 neutral file (only PFEA) spool.pfea.neutral : File name to export to MSC.Patran 2.5 (PFEA) Neutral file : Title FALSE : Export only PFEA

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

@ @ @ @

# Session file paused. Press Resume to continue.. sf_pause() # Close the database spool.db uil_file_close.go() #--------------------------------------------------------------------Main Index

638Code Examples

nf_write2

()# Purpose : This file provides an example of a call to the # function nf_write2() # # This function is used to write MSC.Patran 2.5 # format neutral file from the open MSC.Patran database. # Uses PFEA translator as a base, adds new # Phase I. If pfea is TRUE exports only a # PFEA neutral file. # # Before running this session file run spool.ses # to create spool.db # # This file can be run by starting a session of # MSC.Patran, and running this session file # through the File,Session,Play pulldown # menus on the menu bar. # # The function nf_write2() # has the following arguments: # # nf_write2 # (pname, # title, # pfea, # entflag, # grp_all, # ngroups, # grids ) # #--------------------------------------------------------------------# Variable Declarations STRING s_pname[128] STRING s_title[128] LOGICAL l_pfea LOGICAL la_entflag(35)=[TRUE , TRUE , TRUE , @ TRUE , TRUE , TRUE , TRUE , FALSE, FALSE, @ FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, @ FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, @ FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, @ FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, @ FALSE, FALSE ] LOGICAL l_grp_all INTEGER i_ngroups = 2 INTEGER ia_grids(2)=[1,2] INTEGER i_return_value #--------------------------------------------------------------------# Open the database spool.db uil_file_open.go(spool.db) # # # # s_pname = spool.pfea.neutral2 : File name to export to s_title = MSC.Patran 2.5 Neutral File : Title l_pfea = TRUE : only PFEA neutral file l_grp_all = TRUE : All groups

s_pname = spool.pfea.neutral2 s_title = PFEA Neutral File l_pfea = TRUE l_grp_all = TRUE i_return_value = nf_write2 (s_pname, s_title,Main Index

@ @ @ @

CHAPTER 3Files

639

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

@ @ @ @

# Session file paused. Press Resume to continue.. sf_pause() # Close the database spool.db uil_file_close.go() #---------------------------------------------------------------------

p3_ps_get_xmt

()

# Purpose : This function gets the filename for importing the # model from other applications. This functions # imports model from a UG file. # # A UG file "clip.prt" is used in this session file. # # This file can be run by starting a session of # MSC.Patran, and running this session file with # the "File","Session","Play" pulldown menus # on the menu bar. # # The function p3_ps_get_xmt() # has the following arguments: # # p3_ps_get_xmt # ( # filename ) # #--------------------------------------------------------------------# Variable Decleration INTEGER uil_file_import_paras_num_parts INTEGER i_status STRING filename[1024](1) #--------------------------------------------------------------------# Open a database IF(!db_is_open())THEN uil_file_new.go("","new.db") $? YES 36000002 ENDIF #--------------------------------------------------------------------# The following 2 functions are required to initialise the function # p3_ps_get_xmt(). uil_db_commit( "Unigraphics Model Access Command" ) p3_ps_open_ug_v2( "clip.prt", [1, 1], [0], ["Attributes", "2", "*", "*", "I", "0","Components", "0"], uil_file_import_paras_num_parts ) @ @ @ @

#--------------------------------------------------------------------# Using the function p3_ps_get_xmt() to get the filename from # the current directory. i_status = p3_ps_get_xmt(filename)Main Index

640Code Examples

dump filename #---------------------------------------------------------------------# End of file

set_current_dir

()

# Purpose : This file provides two example calls to the # function set_current_dir() # # This function is used to set the current # directory. # # The function set_current_dir() # has the following arguments: # # set_current_dir # ( dirname ) # #--------------------------------------------------------------------# Variable Declarations STRING s_dirname[128],s_savedir[128] INTEGER i_return_value #--------------------------------------------------------------------# Save the current working directory. i_return_value = @ get_current_dir @ (s_savedir ) # Set the current directory to /usr/bin s_dirname = /usr/bin i_return_value = set_current_dir (s_dirname ) dump i_return_value # Paused. Press resume to continue... sf_pause() s_dirname= i_return_value = get_current_dir (s_dirname ) dump s_dirname # Paused. Press resume to continue... sf_pause() # Set the current directory to /notadir s_dirname = /notadir i_return_value = set_current_dir (s_dirname ) dump i_return_value # Paused. Press resume to continue... sf_pause() s_dirname= i_return_value = get_current_dir (s_dirname ) dump s_dirnameMain Index

@ @

@ @

@ @

@ @

#

Set the current directory back to initial directory.

CHAPTER 3Files

641

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

sf_write_disable

()

# Purpose : This file provides an example of a call to the # function sf_write_disable() # # This function controls whether the next PCL # function gets written to the session file. # # This file can be run by starting a session of # MSC.Patran, opening a new or existing database, # and running this session file through the # File,Session,Play pulldown menus # on the menu bar. # # File pclfunc.pcl should be available. # # # The function sf_write_disable() # has the following arguments: # # sf_write_disable # (alogical) # #--------------------------------------------------------------------# Variable Declarations LOGICAL l_alogical #--------------------------------------------------------------------# Compile pclfunc.pcl to get pclfunc.plb # This file contains two functions pcl_func1() and pcl_func2() # pcl_func1() calls pcl_func2(). # These functions use ui_write() to write a message to session file. !!COMPILE pclfunc.pcl # Add pclfunc.plb to LIBRARY !!LIBRARY ADD pclfunc.plb # Enable recording PCL function calls. l_alogical = FALSE sf_write_disable(l_alogical ) # Call pcl_func1() pcl_func1() # Disable recording PCL function calls. l_alogical = TRUE sf_write_disable(l_alogical ) # Call pcl_func1() pcl_func1() !!LIBRARY REMOVE pclfunc.plb #---------------------------------------------------------------------

Main Index

642Code Examples

ugi_export_iges_v1

()

# Purpose : This file gives an example of a call to the # function ugi_export_iges_v1() # # This function exports MSC.Patran geometry to IGES # standard. # # Before running this session file run spool.ses # to create spool.db # # This file can be run by starting a session of # MSC.Patran, and running this session file # through the File,Session,Play pulldown # menus on the menu bar. # # The ugi_export_iges_v1 has the following arguments: # ugi_export_iges_v1 # ( filename, # start_section, # nlpos, # nlknt, # product_id, # author, # author_org, # model_units, # entity_toggle_values, # all_groups, # ngroups, # group_ids, # patran_summary, # iges_summary ) # #--------------------------------------------------------------------# Variable Declaration and initialisation. # STRING sv_created_ids[VIRTUAL] STRING s_filename[64],s_start_section[128] INTEGER ia_nlpos(2) = [45, 90] INTEGER i_nlknt STRING s_product_id[64] STRING s_author[32] STRING s_author_org[32] STRING s_model_units[16] LOGICAL la_entity_toggle_values(35) = [TRUE, TRUE, TRUE, @ TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, @ FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, @ FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, @ FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, @ FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, @ FALSE, FALSE ] LOGICAL l_all_groups INTEGER i_ngroups INTEGER ia_group_ids(2)=[1,2] INTEGER ia_patran_summary(7) INTEGER ia_iges_summary(20) INTEGER i_return_value #--------------------------------------------------------------------# Open the database spool.db uil_file_open.go(spool.db) # # # #Main Index

Now export MSC.Patran geometry to the IGES standard. s_filename[64] = spool_igs s_start_section[128] = MSC.Patran generated IGES file

CHAPTER 3Files

643

# # # # # # #

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 s_start_section i_nlknt s_product_id s_author s_author_org s_model_units l_all_groups i_ngroups

= = = = = = = = =

spool_igs MSC.Patran generated IGES file 2 MSC.Patran IGES Export Sudarshan N Mogasale GSSL,Pune,India cm TRUE 2 @ @ @ @ @ @ @ @ @ @ @ @ @ @ @

i_return_value = ugi_export_iges_v1 ( s_filename, s_start_section, ia_nlpos, i_nlknt, s_