Patran 2008 r1 PCL Reference Manual Volume 2: Code Examples

1434
Patran 2008 r1 PCL Reference Manual Volume 2: Code Examples

description

This manual provides examples of use of many of the PCL functions “built-in” to Patran that are available to the user.

Transcript of Patran 2008 r1 PCL Reference Manual Volume 2: Code Examples

Patran 2008 r1PCL Reference Manual Volume 2: Code Examples

Main Index

CorporateMSC.Software Corporation 2 MacArthur Place Santa Ana, CA 92707 USA Telephone: (800) 345-2078 Fax: (714) 784-4056

EuropeMSC.Software GmbH Am Moosfeld 13 81829 Munich, Germany Telephone: (49) (89) 43 19 87 0 Fax: (49) (89) 43 61 71 6

Asia PacificMSC.Software Japan Ltd. Shinjuku First West 8F 23-7 Nishi Shinjuku 1-Chome, Shinjuku-Ku Tokyo 160-0023, JAPAN Telephone: (81) (3)-6911-1200 Fax: (81) (3)-6911-1201

Worldwide Webwww.mscsoftware.com

DisclaimerThis documentation, as well as the software described in it, is furnished under license and may be used only in accordance with the terms of such license. MSC.Software Corporation reserves the right to make changes in specifications and other information contained in this document without prior notice. The concepts, methods, and examples presented in this text are for illustrative and educational purposes only, and are not intended to be exhaustive or to apply to any particular engineering problem or design. MSC.Software Corporation assumes no liability or responsibility to any person or company for direct or indirect damages resulting from the use of any information contained herein. User Documentation: Copyright 2008 MSC.Software Corporation. Printed in U.S.A. All Rights Reserved. This notice shall be marked on any reproduction of this documentation, in whole or in part. Any reproduction or distribution of this document, in whole or in part, without the prior written consent of MSC.Software Corporation is prohibited. The software described herein may contain certain third-party software that is protected by copyright and licensed from MSC.Software suppliers. Contains IBM XL Fortran for AIX V8.1, Runtime Modules, (c) Copyright IBM Corporation 1990-2002, All Rights Reserved. MSC, MSC/, MSC Nastran, MD Nastran, MSC Fatigue, Marc, Patran, Dytran, and Laminate Modeler are trademarks or registered trademarks of MSC.Software Corporation in the United States and/or other countries. NASTRAN is a registered trademark of NASA. PAM-CRASH is a trademark or registered trademark of ESI Group. SAMCEF is a trademark or registered trademark of Samtech SA. LS-DYNA is a trademark or registered trademark of Livermore Software Technology Corporation. ANSYS is a registered trademark of SAS IP, Inc., a wholly owned subsidiary of ANSYS Inc. ACIS is a registered trademark of Spatial Technology, Inc. ABAQUS, and CATIA are registered trademark of Dassault Systemes, SA. EUCLID is a registered trademark of Matra Datavision Corporation. FLEXlm is a registered trademark of Macrovision Corporation. HPGL is a trademark of Hewlett Packard. PostScript is a registered trademark of Adobe Systems, Inc. PTC, CADDS and Pro/ENGINEER are trademarks or registered trademarks of Parametric Technology Corporation or its subsidiaries in the United States and/or other countries. Unigraphics, Parasolid and I-DEAS are registered trademarks of UGS Corp. a Siemens Group Company. All other brand names, product names or trademarks belong to their respective owners.

P3:V2008R1:Z:PCL-XPL:Z:DC-REF-PDF

Main Index

ContentsPCL Reference Manual Examples1 IntroductionIntroduction 2 3

m`i=o b~

Supporting Files

2

Basic FunctionsIntroduction File Menu Group Menu Viewport Menu Viewing Menu Display Menu Tools Menu 9 47 81 127 175 293 8

3

Geometry FunctionsIntroduction 380 381 589

Construct Actions Disassemble Actions

4

Finite Element FunctionsIntroduction Create Action Transform Action Sweep Action 754 710 711 745

Main Index

iv PCL Reference Manual Examples==

Renumber Action Disassociate Action Equivalence Action Optimize Action Verify Action Show Action Modify Action Delete Action Utilities 914

779 782 785 800

802 882 885 905

5

Property Assignment FunctionsIntroduction 926 927

Loads and Boundary Conditions Element Properties Beam Library Materials Load Cases Fields 969 953 964 946 937

6

Results Postprocessing FunctionsIntroduction 988 989 1025 1047 1062 1066

Results Utility Functions

Data Register Definition Functions Data Register Query Functions Data Register Operator Functions

Plot Tool Creation and Modification Functions Plot Tool Manipulation Functions 1087

Main Index

CONTENTS v

Animation Functions

1099 1117

Plot Tool Query Functions

7

XY Plot FunctionsIntroduction Create Action Post Action Modify Action Rename Action Delete Action 1134 1135 1162 1172 1346 1347

8

Preference FunctionsIntroduction 1352 1353 1355 1373 1417 1421 1424

Analysis Preferences Global Preferences Graphics Preferences Report Preferences Geometry Preferences

Finite Element Preferences

Main Index

vi PCL Reference Manual Examples==

Main Index

Chapter 1: Introduction PCL Reference Manual Examples

1

IntroductionIntroduction 1 3

Supporting Files

Main Index

2 PCL Reference Manual ExamplesIntroduction

IntroductionThis manual provides examples of use of many of the PCL functions built-in to Patran that are available to the user. This manual is broken up into seven chapters that describe:Basic Functions

This chapter provides examples for the functions that are used in the implementation of the File, Group, Viewport, Viewing, Display and Tools items on the menu bar. This chapter provides examples for the functions that are used to implement the Geometry form accessed through the switch bar. The switch bar is located between the menu bar and the tool bar near the top of the user interface. This chapter provides examples for the functions that are used in the implementation of the Finite Elements switch bar form. This chapter provides examples for the functions that are used in the implementation of the Loads/BC, Material, Properties, Load Cases, and Fields switch bar forms. This chapter provides examples for the functions that are used by the Results switch bar form. This chapter provides examples for the functions that are used in the implementation of the XY Plot switch bar form. This chapter provides examples for the functions that are used to control some of the settings or preferences used by many of the other forms used in Patran. Many of these functions are used in the implementation of the Preferences menu bar item.

Geometry Functions

Finite Element Functions Property Assignment Functions

Results Postprocessing Functions XY Plot Functions Preference Functions

Main Index

Chapter 1: Introduction 3Supporting Files

Supporting FilesThe spool.ses file is a session file that is used by many of the examples in this book. To use this file, hold down the control key and the right mouse button, highlight the text and paste it into a text file named spool.ses. Start Patran and go to File/Session/Play to run the session 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 # 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..." pulldown menus on the menu bar. # 2. Select "Analysis" switch and from the form # displayed, select the "Subcase Select" menu # button from the "The Subcases For Solution Sequence: 101" # select both default and spool_loads from the List box # and it will be added the selected subcases list box. # Enter OK. This will generate Subcase 1 (Default subcase) # 3. Select the "Translation Parameters..." # button. From the "OUTPUT2 Fomat" Option Menu # select option "Text". Press "OK". # 4. Press "Apply" on "Analysis" window. # If MSC.Nastran is available this will create # a file "spool.op2" # 5. From the "Analysis" window, from "Action" # Option Menu, select "Read Output2" option. # 6. Click on the "Select Results File.." Button # and select "spool.op2". Press "Apply". # 7. The results will be read, and a file # "spool.jbr" is created. #--------------------------------------------------------------------# # Create a new database and set the preferences uil_file_new.go("", "./spool.db") $? YES 36000002 ga_viewport_size_set( "default_viewport", 3.5, 3.5, 1 )

Main Index

4 PCL Reference Manual ExamplesSupporting Files

ga_viewport_location_set( "default_viewport", 0.0, 5.0, 1 ) db_set_pref( 303, 3, 0, FALSE, 0.0040000002, "" ) #--------------------------------------------------------------------# Construct two curves for the bottom flange and core STRING asm_create_line_xyz_created_ids[VIRTUAL] asm_const_line_xyz( "1", "", "[0 0 0]", "Coord 0", @ asm_create_line_xyz_created_ids ) asm_const_line_xyz( "2", "", "[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., ["", "" @

Main Index

Chapter 1: Introduction 5Supporting Files

], ["", ""] ) #--------------------------------------------------------------------# 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" ) $# Group "fem_model" created. sys_poll_option( 0 ) #--------------------------------------------------------------------# Define mesh seeds for the flanges, core and fillets ui_exec_function( "mesh_seed_display_mgr", "init" ) mesh_seed_create( "Curve 1 3 2 Surface 6.1 5.1 4.1 ", 1, 4, 0., @ 0., 0.) mesh_seed_create( "Surface 1.1 4.4 ", 1, 24, 0., 0., 0. ) mesh_seed_display_mgr.erase( ) #--------------------------------------------------------------------# Create the finite element mesh INTEGER fem_create_mesh_surfa_num_nodes INTEGER fem_create_mesh_surfa_num_elems STRING fem_create_mesh_s_nodes_created[VIRTUAL] STRING fem_create_mesh_s_elems_created[VIRTUAL] fem_create_mesh_surf_2( "IsoMesh", 0, "Surface 1:6 ", 1, [0.1], @ "Quad4", "1", "1", "Coord 0", "Coord 0", @ fem_create_mesh_surfa_num_nodes, @ fem_create_mesh_surfa_num_elems, @ fem_create_mesh_s_nodes_created, @ fem_create_mesh_s_elems_created ) #--------------------------------------------------------------------# Equivalence the coincident nodes REAL fem_equiv_all_x_equivtol INTEGER fem_equiv_all_x_segment fem_equiv_all_group3( [" "], 0, "", 1, 0.0040000002, FALSE, @ fem_equiv_all_x_equivtol, fem_equiv_all_x_segment ) #--------------------------------------------------------------------# Optimise the model INTEGER fem_optimize_iband(4) INTEGER fem_optimize_iprof(4) INTEGER fem_optimize_maxwf(4) REAL fem_optimize_avgwf(4) REAL fem_optimize_rmswf(4) fem_optimize( "Nodes", "Both", "Profile", 1, fem_optimize_iband, @ fem_optimize_iprof, fem_optimize_maxwf, fem_optimize_avgwf, @ fem_optimize_rmswf ) #--------------------------------------------------------------------# Define material properties for Aluminum material.create( "Analysis code ID", 1, "Analysis type ID", 1, @ "aluminum", 0, "Date: 14-May-97 Time: 13:49:55", @ "Isotropic", 1, "Directionality", 1, "Linearity", 1, @ "Homogeneous", 0, "Linear Elastic", 1, "Model Options & IDs", @ ["", "", "", "", ""], [0, 0, 0, 0, 0], "Active Flag", 1, @ "Create", 10, "External Flag", FALSE, "Property IDs", @ ["Elastic Modulus", "Poisson Ratio", "Density"], [2, 5, 16, 0], @ "Property Values", ["10.1e6", "0.33", "0.1", ""] ) #--------------------------------------------------------------------# Create and assign element properties elementprops_create( "const_thick_spool", 51, 25, 35, 1, 1, 20, @ [13, 20, 36, 4037, 4111, 4118, 4119], [5, 9, 1, 1, 1, 1, 1], @ ["m:aluminum", "", "0.075", "", "", "", ""], "Surface 1:6" ) #--------------------------------------------------------------------# Create a load case consisting the pressures and displacement # constraint loadcase_create2( "spool_loads", "Static", "", 1., ["TZ_fixed", @ "20_psi", "400_psi", "fillet_pressure"], [0, 0, 0, 0], [1., 1., @ 1., 1.], "", 0., TRUE ) sys_poll_option( 2 ) #--------------------------------------------------------------------pref_fa_set([FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,@ FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, @

Main Index

6 PCL Reference Manual ExamplesSupporting Files

FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, @ FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, @ FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, @ TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,@ TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,@ 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.

Main Index

Chapter 2: Basic Functions PCL Reference Manual Examples

2

Basic FunctionsIntroduction File Menu Group Menu Viewport Menu Viewing Menu Display Menu Tools Menu 9 47 81 127 175 293 8

Main Index

8 PCL Reference Manual ExamplesIntroduction

IntroductionThis chapter provides examples for functions that are used in the implementation of the File, Group, Viewport, Viewing, Display and Tools items on the menu bar. See Basic Functions (Ch. 2) in the PCL Reference Manual for a description of these functions.

Main Index

Chapter 2: Basic Functions 9File Menu

File MenuThis section contains examples of some of the functions used to import and export model geometry files to and from files that can be used by various types of CAD systems.neutold_import_neutral

()

# Purpose : This file provides an example of a call to the # function neutold_import_neutral() # # This session file will open a existing database # plate.db and will export it to Neutral format # database by name plate_neutral.out.1. The same # file will be imported to demonstrate the effect # of the function. # # Before running this session file run plate.ses # to create plate.db # # This file can be run by starting a session of # Patran, and running this session file # through the "File","Session","Play" pulldown # menus on the menu bar. # # The function neutold_import_neutral() # has the following arguments: # # neutold_import_neutral # ( file_name, # group_name, # entity_toggle_flags, # minimum_id, # maximum_id, # offset ) # #--------------------------------------------------------------------# Variable Declarations STRING s_file_name[32] STRING s_group_name[32] LOGICAL la_entity_toggle_flags(35) INTEGER ia_minimum_id(35) INTEGER ia_maximum_id(35) INTEGER ia_offset(35) INTEGER i_return_value STRING s_title[64] LOGICAL l_all_groups INTEGER i_number_of_groups INTEGER ia_group_entity_ids(4) #--------------------------------------------------------------------# Open the database "plate.db" uil_file_open.go("plate.db") #--------------------------------------------------------------------# Exporting following entity types to the file plate_neutral.out.1 # Entity types - Nodes, Elements, Material, Element Properties la_entity_toggle_flags(1) = TRUE la_entity_toggle_flags(2) = TRUE la_entity_toggle_flags(3) = TRUE la_entity_toggle_flags(4) = TRUE s_file_name s_title l_all_groups i_number_of_groups = = = = "plate_neutral.out" "File created by exporting Patran database" FALSE 1

Main Index

10 PCL Reference Manual ExamplesFile Menu

ia_group_entity_ids = [1, 0, 0, 0] # i_return_value = neutral_export2 ( s_file_name, s_title, la_entity_toggle_flags, l_all_groups, i_number_of_groups, ia_group_entity_ids ) dump i_return_value

@ @ @ @ @ @ @

# Closing the current database plate.db. uil_file_close.go( ) #--------------------------------------------------------------------# Opening a new database by name new.db. uil_file_new.go( "", "new.db" ) $? YES 36000002 #--------------------------------------------------------------------# Importing the file with all entities in default_group. s_file_name = "plate_neutral.out.1" s_group_name = "default_group" ia_offset(1) = 3 ia_offset(2) = 7 # i_return_value = @ neutold_import_neutral @ ( s_file_name, @ s_group_name, @ la_entity_toggle_flags, @ ia_minimum_id, @ ia_maximum_id, @ ia_offset ) dump i_return_value #---------------------------------------------------------------------

neutral_export2# # # # # # # # # # # # # # # # # # # # # # # # # # #

()

Purpose

:

This file provides an example of a call to the function neutral_export2() This session file will open a existing database plate.db and will export it to Neutral format database by name plate_neutral.out.1. Before running this session file run plate.ses to create plate.db

Patran,

This file can be run by starting a session of and running this session file through the "File","Session","Play" pulldown menus on the menu bar.

The function neutral_export2() has the following arguments: neutral_export2 ( file_name, title, entity_toggle_flags, all_groups, number_of_groups, group_entity_ids )

Main Index

Chapter 2: Basic Functions 11File Menu

#--------------------------------------------------------------------# Variable Declarations STRING s_file_name[32] STRING s_title[64] LOGICAL la_entity_toggle_flags(35) LOGICAL l_all_groups INTEGER i_number_of_groups INTEGER ia_group_entity_ids(4) INTEGER i_return_value #--------------------------------------------------------------------# Open the database "plate.db" uil_file_open.go("plate.db") #--------------------------------------------------------------------# Exporting following entity types to the file plate_neutral.out.1 # Entity types - Nodes, Elements, Material, Element Properties la_entity_toggle_flags(1) = TRUE la_entity_toggle_flags(2) = TRUE la_entity_toggle_flags(3) = TRUE la_entity_toggle_flags(4) = TRUE s_file_name = "plate_neutral.out" s_title = "File created by exporting Patran database" l_all_groups = FALSE i_number_of_groups = 1 ia_group_entity_ids = [1, 0, 0, 0] # i_return_value = @ neutral_export2 @ ( s_file_name, @ s_title, @ la_entity_toggle_flags, @ l_all_groups, @ i_number_of_groups, @ ia_group_entity_ids ) dump i_return_value #---------------------------------------------------------------------

p3_express_import

()

# # Purpose : This file provides an example of a call to the # function p3_express_import() # # This session file will open a new database by # name new.db and import a Express Neutral # model named sgm_cv_block-hole.exp. # # This file can be run by starting a session of Patran, and running this session file # # through the "File","Session","Play" pulldown # menus on the menu bar. # # The function p3_express_import() # has the following arguments: # # p3_express_import # ( option_file, # file_name, # geometry_tracking, # reset_tolerance, # tolerance_prompt, # return_entity_count, # entities ) # #--------------------------------------------------------------------# Variable Declarations

Main Index

12 PCL Reference Manual ExamplesFile Menu

STRING s_option_file[32] STRING s_file_name[32] LOGICAL l_geometry_tracking LOGICAL l_reset_tolerance LOGICAL l_tolerance_prompt LOGICAL l_return_entity_count INTEGER iaa_entities(64,2) INTEGER i_return_value #--------------------------------------------------------------------# Open a new database "new.db" uil_file_new.go("","new.db") $? YES 36000002 #--------------------------------------------------------------------# Calling function to import model sgm_cv_block-hole.exp.A log file # by name ComputerVision_Geometry.log.01 will be written. Also form # will appear indicating the change in tolerance. s_file_name = "sgm_cv_block-hole.exp" l_geometry_tracking = TRUE l_reset_tolerance = TRUE l_tolerance_prompt = TRUE l_return_entity_count = TRUE # i_return_value = @ p3_express_import @ ( s_option_file, @ s_file_name, @ l_geometry_tracking, @ l_reset_tolerance, @ l_tolerance_prompt, @ l_return_entity_count, @ iaa_entities ) dump i_return_value dump iaa_entities #--------------------------------------------------------------------# Exiting the import operation without deleting the express file. i_return_value = @ p3_express_import_exit( TRUE, FALSE ) dump i_return_value #---------------------------------------------------------------------

p3_express_import_preview# # # # # # # # # # # # # # # # # # # # # # Purpose :

()This file provides an example of a call to the function p3_express_import_preview() This session file will open a new database by name new.db and find summary information of a Express Neutral model named sgm_cv_block-hole.exp.

Patran,

This file can be run by starting a session of and running this session file through the "File","Session","Play" pulldown menus on the menu bar.

The function p3_express_import_preview() has the following arguments: p3_express_import_preview ( option_file, file_name, tolerance_check, return_entity_count,

Main Index

Chapter 2: Basic Functions 13File Menu

# entities, # cad_attributes, # cad_tolerance, # shortest_curve_length ) # #--------------------------------------------------------------------# Variable Declarations STRING s_option_file[32] STRING s_file_name[32] LOGICAL l_tolerance_check LOGICAL l_return_entity_count INTEGER iaa_entities(64,2) STRING sa_cad_attributes[2](256) REAL r_cad_tolerance REAL r_shortest_curve_length INTEGER i_return_value #--------------------------------------------------------------------# Open a new database "new.db" uil_file_new.go("","new.db") $? YES 36000002 #--------------------------------------------------------------------# Calling function to get the geometry information of the model # sgm_cv_block-hole.exp and calculate the tolerance also. s_file_name = "sgm_cv_block-hole.exp" l_tolerance_check = TRUE l_return_entity_count = TRUE # i_return_value = @ p3_express_import_preview @ ( s_option_file, @ s_file_name, @ l_tolerance_check, @ l_return_entity_count, @ iaa_entities, @ sa_cad_attributes, @ r_cad_tolerance, @ r_shortest_curve_length ) dump i_return_value dump iaa_entities, sa_cad_attributes, r_cad_tolerance dump r_shortest_curve_length #--------------------------------------------------------------------# Exiting the import operation without deleting the express file. i_return_value = @ p3_express_import_exit( TRUE, FALSE ) dump i_return_value #---------------------------------------------------------------------

p3_express_import_exit# # # # # # # # # # # # # # # #

()

Purpose

:

This file provides an example of a call to the function p3_express_import_exit() This session file will open a new database by name new.db and import a Express Neutral model named sgm_cv_block-hole.exp. And exits the import operation without deleting the express file.

Patran,

This file can be run by starting a session of and running this session file through the "File","Session","Play" pulldown menus on the menu bar.

The function p3_express_import_exit()

Main Index

14 PCL Reference Manual ExamplesFile Menu

# has the following arguments: # # p3_express_import_exit # ( delete_option_file, # delete_express_file ) # #--------------------------------------------------------------------# Variable Declarations LOGICAL l_delete_option_file LOGICAL l_delete_express_file INTEGER i_return_value STRING s_option_file[32] STRING s_file_name[32] LOGICAL l_geometry_tracking LOGICAL l_reset_tolerance LOGICAL l_tolerance_prompt LOGICAL l_return_entity_count INTEGER iaa_entities(64,2) #--------------------------------------------------------------------# Open a new database "new.db" uil_file_new.go("","new.db") $? YES 36000002 #--------------------------------------------------------------------# Calling function to import model sgm_cv_block-hole.exp.A log file # by name ComputerVision_Geometry.log.01 will be written. Also form # will appear indicating the change in tolerance. s_file_name = "sgm_cv_block-hole.exp" l_geometry_tracking = TRUE l_reset_tolerance = TRUE l_tolerance_prompt = TRUE l_return_entity_count = TRUE # i_return_value = @ p3_express_import @ ( s_option_file, @ s_file_name, @ l_geometry_tracking, @ l_reset_tolerance, @ l_tolerance_prompt, @ l_return_entity_count, @ iaa_entities ) dump i_return_value dump iaa_entities #--------------------------------------------------------------------# Exiting the import operation without deleting the files. l_delete_option_file = FALSE l_delete_express_file = FALSE # i_return_value = @ p3_express_import_exit @ ( l_delete_option_file, @ l_delete_express_file ) dump i_return_value #---------------------------------------------------------------------

p3_express_options_file# # # # # # # # #

()

Purpose

:

This file provides an example of a call to the function p3_express_options_file() This session file will write an options file named exampla.exp for express model named sgm_cv_block-hole.exp. Then will open a new database by name new.db and import the same Express Neutral model.

Main Index

Chapter 2: Basic Functions 15File Menu

# # This file can be run by starting a session of Patran, and running this session file # # through the "File","Session","Play" pulldown # menus on the menu bar. # # The function p3_express_options_file() # has the following arguments: # # p3_express_options_file # ( option_file, # versioning, # file_format, # action, # source, # transform_exists, # transformation, # number_of_groups, # group_names, # group_entities, # group_layers, # group_colors, # all_entities, # entities, # all_layers, # layers, # all_colors, # colors, # trimmed_curve_type, # trimmed_surface_type, # solid_representation ) # #--------------------------------------------------------------------# Variable Declarations STRING s_option_file[16] LOGICAL l_versioning INTEGER i_file_format INTEGER i_action INTEGER i_source LOGICAL l_transform_exists REAL ra_transformation(12) INTEGER i_number_of_groups STRING sa_group_names[16](3) INTEGER iaa_group_entities(3,3) INTEGER iaa_group_layers(3,1) INTEGER iaa_group_colors(3,1) LOGICAL l_all_entities INTEGER ia_entities(64) LOGICAL l_all_layers INTEGER ia_layers(256) LOGICAL l_all_colors INTEGER ia_colors(10) INTEGER i_trimmed_curve_type INTEGER i_trimmed_surface_type INTEGER i_solid_representation INTEGER i_return_value STRING s_file_name[32] LOGICAL l_geometry_tracking LOGICAL l_reset_tolerance LOGICAL l_tolerance_prompt LOGICAL l_return_entity_count INTEGER iaa_entities(64,2) #--------------------------------------------------------------------# Calling function to write options file by name example.exp. The # file will be written in ascii without the transformation matrix. s_option_file = "example.exp" i_file_format = 1 i_action = 1

Main Index

16 PCL Reference Manual ExamplesFile Menu

# Making the source of the geometry entities as PDA ENGINEERING. i_source = 52054 # Three groups will be created while importing. And entities will be # separated in these groups. i_number_of_groups =3 sa_group_names(1) = "curve" sa_group_names(2) = "surface" sa_group_names(3) = "solid" iaa_group_entities = [[1 102 0][1 1002 0][1 2002 0]] # All layers and colors will be read in for each group. iaa_group_layers = [[-1][-1][-1]] iaa_group_colors = [[0][0][0]] l_all_entities = TRUE l_all_layers = TRUE l_all_colors = TRUE # Only preference for trimmed surface will be # set to only general trimmed surface i_trimmed_curve_type = 3 i_trimmed_surface_type = 2 i_solid_representation = 3 # i_return_value = p3_express_options_file ( s_option_file, l_versioning, i_file_format, i_action, i_source, l_transform_exists, ra_transformation, i_number_of_groups, sa_group_names, iaa_group_entities, iaa_group_layers, iaa_group_colors, l_all_entities, ia_entities, l_all_layers, ia_layers, l_all_colors, ia_colors, i_trimmed_curve_type, i_trimmed_surface_type, i_solid_representation ) dump i_return_value

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

#--------------------------------------------------------------------# Open a new database "new.db" uil_file_new.go("","new.db") $? YES 36000002 #--------------------------------------------------------------------# Calling function to import model sgm_cv_block-hole.exp. Using the # options file created. A log file by name # ComputerVision_Geometry.log.01 will be written. Also form will # appear indicating the change in tolerance. s_file_name = "sgm_cv_block-hole.exp" l_geometry_tracking = TRUE l_reset_tolerance = TRUE l_tolerance_prompt = TRUE l_return_entity_count = TRUE # i_return_value = @ p3_express_import @ ( s_option_file, @ s_file_name, @

Main Index

Chapter 2: Basic Functions 17File Menu

l_geometry_tracking, @ l_reset_tolerance, @ l_tolerance_prompt, @ l_return_entity_count, @ iaa_entities ) $? NOFORALL 1000034 dump i_return_value dump iaa_entities #--------------------------------------------------------------------# Exiting the import operation without deleting the files. i_return_value = @ p3_express_import_exit( FALSE, FALSE ) dump i_return_value #---------------------------------------------------------------------

ps_get_body_string_attribute

()

FUNCTION attribute_import_body( output_name ) STRING output_name[] INTEGER i, status, nc, nsrf, nsol, entity_id(1), min_label, label STRING attr_name[VIRTUAL], psidentifier[256] INTEGER endLabel, startLabel, fid psidentifier = "SDL/TYSA_NAME" utl_process_spawn( "rm -f " // output_name, TRUE ) status = fio_openw( output_name, fid ) status = db_count_solid( nsol ) status = db_get_min_solid_label( min_label ) status = db_get_max_solid_label( endLabel ) label = min_label startLabel = label fio_writec( fio_writec( fio_writec( fio_writec( fid, fid, fid, fid, "minimum solid label = %d \n", startLabel ) "maximum solid label = %d \n\n", endLabel ) "Identifier: %s\n",psidentifier ) "Function: ps_get_body_string_attribute\n\n" )

IF( label > 0 ) THEN fio_writec( fid, "Number of solids = %d\n",nsol) FOR (i = startLabel TO endLabel) status = db_get_solid_id( label, entity_id(1) ) status = ps_get_body_string_attribute( entity_id(1), 4,psidentifier, 0, attr_name ) fio_writec( fid, "status from ps_get_body_string_attribute = %d \n", status ) IF( status == 0 ) THEN fio_writec( fid, "solid %d : Body Attribute name = %s\n",entity_id(1), attr_name ) END IF fio_writec( fid, label += 1 END FOR END IF "\n" )

status = db_count_surface( nsrf ) status = db_get_min_surface_label( min_label ) status = db_get_max_surface_label( endLabel ) label = min_label startLabel = label

Main Index

18 PCL Reference Manual ExamplesFile Menu

fio_writec( fid, "minimum surface label = %d \n", startLabel ) fio_writec( fid, "maximum surface label = %d \n", endLabel ) IF( label > 0 ) THEN fio_writec( fid, "Number of surfaces = %d\n",nsrf) FOR (i = startLabel TO endLabel) status = db_get_surface_id( label, entity_id(1) ) status = ps_get_body_string_attribute( entity_id(1), 3, psidentifier, 0, attr_name ) fio_writec( fid, "status from ps_get_body_string_attribute = %d \n", status ) IF( status == 0 ) THEN fio_writec( fid, "surface %d : Body Attribute name = %s\n",entity_id(1), attr_name ) END IF fio_writec( fid, label += 1 END FOR END IF "\n" )

status = db_count_curve( nc ) status = db_get_min_curve_label( min_label ) status = db_get_max_curve_label( endLabel ) label = min_label startLabel = label fio_writec( fid, "minimum curve label = %d \n", startLabel ) fio_writec( fid, "maximum curve label = %d \n", endLabel ) IF( label > 0 ) THEN fio_writec( fid, "Number of curves = %d\n",nc) FOR (i = startLabel TO endLabel) status = db_get_curve_id( label, entity_id(1) ) status = ps_get_body_string_attribute( entity_id(1), 2, psidentifier, 0, attr_name ) fio_writec( fid, "status from ps_get_body_string_attribute = %d\n", status ) IF( status == 0 ) THEN fio_writec( fid, "curve %d : Body Attribute name = %s\n", entity_id(1), attr_name ) END IF fio_writec( fid, label += 1 END FOR END IF fio_close( fid ) END FUNCTION "\n" )

ps_get_string_attribute

()

FUNCTION attribute_import_topology( output_name ) STRING output_name[] INTEGER i, status, nc, nsrf, nsol, entity_id(1), min_label, label STRING attr_name[VIRTUAL], psidentifier[256] INTEGER endLabel, startLabel, fid psidentifier = "SDL/TYSA_NAME" utl_process_spawn( "rm -f " // output_name, TRUE )

Main Index

Chapter 2: Basic Functions 19File Menu

status = fio_openw( output_name, fid ) status = db_count_solid( nsol ) status = db_get_min_solid_label( min_label ) status = db_get_max_solid_label( endLabel ) label = min_label startLabel = label fio_writec( fio_writec( fio_writec( fio_writec( fid, fid, fid, fid, "minimum solid label = %d \n", startLabel ) "maximum solid label = %d \n\n", endLabel ) "Identifier: %s\n",psidentifier ) "Function: ps_get_string_attribute\n\n" )

IF( label > 0 ) THEN fio_writec( fid, "Number of solids = %d\n",nsol) FOR (i = startLabel TO endLabel) status = db_get_solid_id( label, entity_id(1) ) status = ps_get_string_attribute( entity_id(1), 4,psidentifier, 0, attr_name ) fio_writec( fid, "status from ps_get_string_attribute = %d \n", status ) IF( status == 0 ) THEN fio_writec( fid, "solid %d : Attribute name = %s\n",entity_id(1), attr_name ) END IF fio_writec( fid, label += 1 END FOR END IF "\n" )

status = db_count_surface( nsrf ) status = db_get_min_surface_label( min_label ) status = db_get_max_surface_label( endLabel ) label = min_label startLabel = label fio_writec( fid, "minimum surface label = %d \n", startLabel ) fio_writec( fid, "maximum surface label = %d \n", endLabel ) IF( label > 0 ) THEN fio_writec( fid, "Number of surfaces = %d\n",nsrf) FOR (i = startLabel TO endLabel) status = db_get_surface_id( label, entity_id(1) ) status = ps_get_string_attribute( entity_id(1), 3, psidentifier, 0, attr_name ) fio_writec( fid, "status from ps_get_string_attribute = %d \n", status ) IF( status == 0 ) THEN fio_writec( fid, "surface %d : Attribute name = %s\n",entity_id(1), attr_name ) END IF fio_writec( fid, label += 1 END FOR END IF "\n" )

status = db_count_curve( nc ) status = db_get_min_curve_label( min_label ) status = db_get_max_curve_label( endLabel ) label = min_label startLabel = label fio_writec( fid, "minimum curve label = %d \n", startLabel ) fio_writec( fid, "maximum curve label = %d \n", endLabel ) IF( label > 0 ) THEN

Main Index

20 PCL Reference Manual ExamplesFile Menu

fio_writec( fid, "Number of curves = %d\n",nc) FOR (i = startLabel TO endLabel) status = db_get_curve_id( label, entity_id(1) ) status = ps_get_string_attribute( entity_id(1), 2, psidentifier, 0, attr_name ) fio_writec( fid, "status from ps_get_string_attribute = %d\n", status ) IF( status == 0 ) THEN fio_writec( fid, "curve %d : Attribute name = %s\n", entity_id(1), attr_name ) END IF fio_writec( fid, label += 1 END FOR END IF fio_close( fid ) END FUNCTION "\n" )

Example 2:FUNCTION publication_import( output_name ) $ This function searches for CAD tags from CATIA and creates a matched array of labels: p3 CATIA STRINGoutput_name[] STRINGp3_labels[32](VIRTUAL), CATIA_labels[512](VIRTUAL) INTEGER num_publications = 0 INTEGER i, status, nc, nsrf, nsol, entity_id(1) INTEGER min_labelS, min_labelF, min_labelC, label INTEGER endLabelS, endLabelF, endLabelC STRING attr_name[VIRTUAL], battr_name[VIRTUAL], psidentifier[256] INTEGER fid STRING face_name_prefix[32], face_name[32], edge_name_prefix[32], edge_name[32] INTEGER dummy(VIRTUAL), j, k, m INTEGER faces(VIRTUAL),nfaces INTEGER num_edges, number_loops, loop_ids(VIRTUAL), edge_orients(VIRTUAL), edge_ids(VIRTUAL) REAL time(10) INTEGER method, handle, attribute, internal_curve_id(1) INTEGER num_faces_found = 0, num_edges_found = 0 INTEGER found_faces(VIRTUAL), found_edges(VIRTUAL) LOGICAL face_found, edge_found time(1) = sys_cputime() psidentifier = "SDL/TYSA_NAME" utl_process_spawn( "rm -f " // output_name, TRUE ) status = fio_openw( output_name, fid ) status status status status status status status status status = = = = = = = = = db_count_solid( nsol ) db_get_min_solid_label( min_labelS ) db_get_max_solid_label( endLabelS ) db_count_surface( nsrf ) db_get_min_surface_label( min_labelF ) db_get_max_surface_label( endLabelF ) db_count_curve( nc ) db_get_min_curve_label( min_labelC ) db_get_max_curve_label( endLabelC )

$ Allocate space for array of face and edge ids to prevent duplication sys_allocate_array( found_faces, 1, nsrf ) sys_allocate_array( found_edges, 1, nc ) $ Allocate space for array of labels to return

Main Index

Chapter 2: Basic Functions 21File Menu

sys_allocate_array( p3_labels, 1, nsol+nsrf+nc ) sys_allocate_array( CATIA_labels, 1, nsol+nsrf+nc ) fio_writec( fid, "Solids: Number=%d minimum=%d maximum=%d \n",nsol, min_labelS, endLabelS ) fio_writec( fid, "Surfaces: Number=%d minimum=%d maximum=%d \n",nsrf, min_labelF, endLabelF) fio_writec( fid, "Curves: Number=%d minimum=%d maximum=%d \n\n",nc, min_labelC, endLabelC ) fio_writec( fid, "Identifier: %s\n",psidentifier ) fio_writec( fid, "Function: ps_get_string_attribute\n\n" ) if(min_labelF==0) THEN min_labelF = 1 if(endLabelF==0) THEN endLabelF = nsrf if(min_labelC==0) THEN min_labelC = 1 if(endLabelC==0) THEN endLabelC = nc IF( nsol FOR (i = status = status = > 0 ) THEN min_labelS TO endLabelS) db_get_solid_id( i, entity_id(1) ) ps_get_string_attribute( entity_id(1), 4, psidentifier, 0, attr_name )

IF( status == 0 ) THEN status = db_get_solid_label( entity_id(1), label ) fio_writec( fid, "solid %d [Solid %d] : Attribute name = %s\n",label, entity_id(1), attr_name ) num_publications += 1 p3_labels(num_publications) = "Solid " // str_from_integer( label ) CATIA_labels(num_publications) = attr_name END IF $ do all faces on this solid: face_name_prefix = "Solid " // str_from_integer( i ) //"." sgm_db_get_num_faces_body( entity_id(1),nfaces,status) IF( status != 0) THEN msg_to_form( status, 4, appcode(status),1,1.,"") RETURN status END IF $ Allocate memory: status = sys_allocate_array( faces, 1, nfaces ) IF( status != 0) THEN msg_to_form( status, 4, appcode(status),1,1.,"") RETURN status END IF status = sys_allocate_array( dummy, 1, nfaces ) IF( status != 0) THEN msg_to_form( status, 4, appcode(status),1,1.,"") RETURN status END IF $ Get the list of faces referenced by the body sgm_db_get_gen_body_face_ids( entity_id(1), nfaces, faces, dummy, @ dummy, status ) IF( status != 0) THEN msg_to_form( status, 4, appcode(status),1,1.,"") RETURN status END IF FOR( j = 1 TO nfaces ) face_name = face_name_prefix // str_from_integer( j ) $fio_writec( fid, "Face name = %s Surface id = %d\n",face_name, faces(i) ) face_found = FALSE FOR( m = 1 TO num_faces_found ) IF(found_faces(m)==faces(j)) THEN face_found = TRUE END FOR IF(face_found!=TRUE) THEN status = ps_get_string_attribute( faces(j), 3, psidentifier, 0, attr_name ) IF( status == 0 ) THEN fio_writec( fid, "%s [Face %d] : Attribute name = %s\n", @

Main Index

22 PCL Reference Manual ExamplesFile Menu

face_name, faces(j), attr_name ) num_publications += 1 p3_labels(num_publications) = face_name CATIA_labels(num_publications) = attr_name num_faces_found += 1 found_faces(num_faces_found) = faces(j) END IF END IF status = sgm_db_get_num_edges_face( faces(j), num_edges ) IF( status != 0 ) THEN BREAK sgm_db_get_num_vertices_surface( faces(j), num_edges, status ) edge_name_prefix = face_name // "." $Allocate and initialize virtual strings sys_allocate_array( edge_ids, 1, num_edges ) sys_allocate_array( loop_ids, 1, num_edges ) sys_allocate_array( edge_orients, 1, num_edges ) status = sgm_db_get_gen_face_edge_ids ( faces(i), number_loops, num_edges, @ loop_ids, edge_ids, edge_orients ) FOR( k = 1 TO num_edges ) edge_name = edge_name_prefix // str_from_integer( k ) $method = LP_EVAL_FOR_ID = 4, LP_ATTRIBUTE_ID = 1 method = 4 ; attribute = 1 status = lp_eval( edge_name, method, handle ) IF(status==0) THEN status = lp_sublist_attribute_get_int( handle, attribute, internal_curve_id ) END IF lp_eval_cleanup(handle) edge_found = FALSE FOR( m = 1 TO num_edges_found ) IF(found_edges(m)==internal_curve_id(1)) THEN edge_found = TRUE END FOR IF(edge_found!=TRUE) THEN status = ps_get_string_attribute( internal_curve_id(1), 2, psidentifier, 0, attr_name ) IF( status == 0 ) THEN fio_writec( fid, "%s [Edge %d] : Attribute name = %s\n", @ edge_name, internal_curve_id(1), attr_name ) num_publications += 1 p3_labels(num_publications) = edge_name CATIA_labels(num_publications) = attr_name num_edges_found+= 1 found_edges(num_edges_found) = internal_curve_id(1) END IF END IF END FOR END FOR label += 1 END FOR END IF fio_writec( fid, "\n" ) battr_name = "" $ Get directly creates surfaces and curves IF( nsrf > 0 ) THEN FOR (i = min_labelF TO endLabelF) /*status = db_get_surface_id( label, entity_id(1) )*/ entity_id(1) = i face_found = FALSE FOR( m = 1 TO num_faces_found ) IF(found_faces(m)==entity_id(1)) THEN face_found = TRUE END FOR IF(face_found!=TRUE) THEN status = ps_get_string_attribute( entity_id(1), 3, psidentifier, 0, attr_name )

Main Index

Chapter 2: Basic Functions 23File Menu

IF( status == 0 ) THEN status = db_get_surface_label( entity_id(1), label ) $ a label of -1 means it is not an actual surface IF(label!=-1) THEN fio_writec( fid, "Surface %d [Face %d] : Attribute name = %s\n",@ label, entity_id(1), attr_name ) num_publications += 1 p3_labels(num_publications) = "Surface " // str_from_integer( label ) CATIA_labels(num_publications) = attr_name num_faces_found += 1 found_faces(num_faces_found) = entity_id(1) END IF END IF END IF label += 1 END FOR END IF fio_writec( fid, "\n" ) battr_name = "" IF( nc > 0 ) THEN FOR (i = 1 TO endLabelC) entity_id(1) = i edge_found = FALSE FOR( m = 1 TO num_edges_found ) IF(found_edges(m)==entity_id(1)) THEN edge_found = TRUE END FOR IF(edge_found!=TRUE) THEN status = ps_get_string_attribute( entity_id(1), 2, psidentifier, 0, attr_name ) IF( status == 0 ) THEN status = db_get_curve_label( entity_id(1), label ) $ a label of -1 means it is not an actual curve IF(label!=-1) THEN fio_writec( fid, "Curve %d [Edge %d] : Attribute name = %s\n", @ label, entity_id(1), attr_name ) num_publications += 1 p3_labels(num_publications) = "Curve " // str_from_integer( label ) CATIA_labels(num_publications) = attr_name num_edges_found += 1 found_edges(num_edges_found) = entity_id(1) END IF END IF END IF label += 1 END FOR END IF fio_writec( fid, "\n" ) time(2) = sys_cputime() fio_writec( fid, "Total computation time = %f seconds\n", time(2)-time(1) ) fio_close( fid ) IF( num_publications > 0 ) THEN sys_reallocate_array( p3_labels, 1, num_publications ) sys_reallocate_array( CATIA_labels, 1, num_publications ) END IF dump p3_labels, CATIA_labels RETURN num_publications END FUNCTION

select_focus.exit# #

()

Purpose

:

This file provides an example of a call to the

Main Index

24 PCL Reference Manual ExamplesFile Menu

# function select_focus.exit() # # This session file will open a new database by # name new.db. A curve and a surface will be # drawn so that the curve is overlapping with one # edge from the surface. # After this the session file will be paused and # the user will have to try to delete the curve # by screen picking. Which will make the # Selection window appear on the screen. The # session file will be resumed after that. In # effect this function will be executed and the # selection window will disappear. # # This file can be run by starting a session of # Patran, and running this session file # through the "File","Session","Play" pulldown # menus on the menu bar. # # The function select_focus.exit() has no arguments. # #--------------------------------------------------------------------# Variable Declarations INTEGER i_return_value STRING sv_asm_create_patch_xy_crtd_ids[VIRTUAL] STRING sv_asm_create_line_xyz_crtd_ids[VIRTUAL] #--------------------------------------------------------------------# Open a new database "new.db" uil_file_new.go("","new.db") $? YES 36000002 #--------------------------------------------------------------------# Creating a curve. i_return_value = @ asm_const_line_xyz( "1", "", "[0 0 0]", "Coord 0", @ sv_asm_create_line_xyz_crtd_ids ) dump i_return_value # Drawing a surface so that an edge of the surface will overlap with # the curve. i_return_value = @ asm_const_patch_xyz( "1", "", "[0 0 0]", "Coord 0", @ sv_asm_create_patch_xy_crtd_ids ) dump i_return_value #--------------------------------------------------------------------# Session file paused. Press "Resume" to continue.. # User should open the Geometry form and try to Delete the curve # by clicking on the screen. While trying this the Object should be # Any. After the selection window appears on the screen the # Resume button should be pressed. sf_pause() #--------------------------------------------------------------------# Calling function to remove the selection window. # select_focus.exit() sys_free_string(sv_asm_create_patch_xy_crtd_ids) sys_free_string(sv_asm_create_line_xyz_crtd_ids) #---------------------------------------------------------------------e

sgm_cad_access_v1# # # # #

()

Purpose

:

This file provides an example of a call to the function sgm_cad_access_v1() This session file will open a new database by

Main Index

Chapter 2: Basic Functions 25File Menu

# name new.db. UG file named asm002.prt is # imported with all its entities in default_group # # This file can be run by starting a session of # Patran, and running this session file # through the "File","Session","Play" pulldown # menus on the menu bar. # # The function sgm_cad_access_v1() # has the following arguments: # # sgm_cad_access_v1 # ( file_name, # file_name_length, # group_name, # group_name_length, # entity_toggle_values, # simply_trimmed, # access_as_solids, # enable_tol_prompt, # color_toggle_values, # all_layers, # active_layer, # layer_numbers, # mod_type, # number_of_groups, # group_entity_ids, # group_entity_values, # group_color_values, # active_layer_values, # layer_pointers, # group_layers, # I_N_UG_LAYERS, # ug_count, # patran_count ) # #--------------------------------------------------------------------# Variable Declarations STRING s_file_name[32] INTEGER i_file_name_length STRING s_group_name[80] INTEGER i_group_name_length LOGICAL la_entity_toggle_values(35) LOGICAL l_simply_trimmed LOGICAL l_access_as_solids LOGICAL l_enable_tol_prompt LOGICAL la_color_toggle_values(14) LOGICAL l_all_layers LOGICAL l_active_layer INTEGER ia_layer_numbers(256) STRING s_mod_type[6] INTEGER i_number_of_groups INTEGER ia_group_entity_ids(1) LOGICAL laa_group_entity_values(1,20) LOGICAL laa_group_color_values(1,14) LOGICAL la_active_layer_values(256) INTEGER ia_layer_pointers(1) INTEGER ia_group_layers(512) integer i_n_ug_layers INTEGER iaa_ug_count(256,37) INTEGER ia_patran_count(4) INTEGER i_return_value #--------------------------------------------------------------------# Open a new database "new.db" uil_file_new.go("","new.db") $? YES 36000002 #--------------------------------------------------------------------# Calling function to import all entities from UG model asm002.prt.

Main Index

26 PCL Reference Manual ExamplesFile Menu

# Tolerance prompt will be displayed on the screen. s_file_name = "asm002.prt" i_file_name_length =10 s_group_name = "default_group" i_group_name_length = 13 l_simply_trimmed = true l_enable_tol_prompt = true l_all_layers = true s_mod_type ="ug" i_number_of_groups =1 ia_group_entity_ids =[1] ia_layer_pointers = [1] ia_group_layers(1) = 1 la_entity_toggle_values=[true true true true true true true true true@ true true true true true true true true true true false false @ false false false false false false false false false false false @ false false false] laa_group_entity_values=[true true true true true true true true true@ true true true true true true true true true true false] # i_return_value = @ sgm_cad_access_v1 @ ( s_file_name, @ i_file_name_length, @ s_group_name, @ i_group_name_length, @ la_entity_toggle_values, @ l_simply_trimmed, @ l_access_as_solids, @ l_enable_tol_prompt, @ la_color_toggle_values, @ l_all_layers, @ l_active_layer, @ ia_layer_numbers, @ s_mod_type, @ i_number_of_groups, @ ia_group_entity_ids, @ laa_group_entity_values, @ laa_group_color_values, @ la_active_layer_values, @ ia_layer_pointers, @ ia_group_layers, @ i_n_ug_layers, @ iaa_ug_count, @ ia_patran_count ) dump i_return_value dump ia_patran_count,i_n_ug_layers #---------------------------------------------------------------------

sgm_catia_access# # # # # # # # # # # # # # #

()

Purpose

:

This file provides an example of a call to the function sgm_catia_access() This session file will open a new database by name new.db. A Catia model named catia_cam.cat will be imported in the default group with all entities. Model will be made visible on the screen. This file can be run by starting a session of Patran, and running this session file through the "File","Session","Play" pulldown menus on the menu bar.

Main Index

Chapter 2: Basic Functions 27File Menu

# The function sgm_catia_access() # has the following arguments: # # sgm_catia_access # ( file_name, # group_name, # group_name_length, # entity_toggle_values, # simply_trimmed, # color_toggle_values, # all_layers, # active_layer, # layer_numbers, # mod_type, # number_of_groups, # group_entity_ids, # group_entity_values, # group_color_values, # active_layer_values, # layer_pointers, # group_layers, # interactive_flag, # user_control_flag ) # #--------------------------------------------------------------------# Variable Declarations STRING s_file_name[32] STRING s_group_name[32] INTEGER i_group_name_length LOGICAL la_entity_toggle_values(35) LOGICAL l_simply_trimmed LOGICAL la_color_toggle_values(14) LOGICAL l_all_layers LOGICAL l_active_layer INTEGER ia_layer_numbers(256) STRING s_mod_type[6] INTEGER i_number_of_groups = 1 INTEGER ia_group_entity_ids(2) LOGICAL laa_group_entity_values(2,20) LOGICAL laa_group_color_values(2,14) LOGICAL la_active_layer_values(256) INTEGER ia_layer_pointers(2) INTEGER ia_group_layers(8) INTEGER i_interactive_flag INTEGER ia_user_control_flag(2) INTEGER i_return_value #--------------------------------------------------------------------# Open a new database "new.db" uil_file_new.go("","new.db") $? YES 36000002 #--------------------------------------------------------------------# Importing all entities of file named "catia_cam.cat". s_file_name = "catia_cam.cat" s_group_name = "default_group" i_group_name_length = 13 l_all_layers = TRUE s_mod_type = "catia" ia_group_entity_ids = [1,0] la_entity_toggle_values = [TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, @ TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, @ FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, @ FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE] # i_return_value = @ sgm_catia_access @ ( s_file_name, @ s_group_name, @ i_group_name_length, @

Main Index

28 PCL Reference Manual ExamplesFile Menu

la_entity_toggle_values, l_simply_trimmed, la_color_toggle_values, l_all_layers, l_active_layer, ia_layer_numbers, s_mod_type, i_number_of_groups, ia_group_entity_ids, laa_group_entity_values, laa_group_color_values, la_active_layer_values, ia_layer_pointers, ia_group_layers, i_interactive_flag, ia_user_control_flag ) dump i_return_value

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

#--------------------------------------------------------------------# Model is made visible in the viewport. i_return_value = ga_view_corners_set([125.,-60.,0],[150.,-20.,0],1) dump i_return_value #---------------------------------------------------------------------

sgm_catia_access_v1

()

# # Purpose : This file provides an example of a call to the # function sgm_catia_access_v1() # # This session file will open a new database by # name new.db. A Catia model named # catia_cam.cat will be imported in the default # group with all entities. Model will be made # visible on the screen. # # This file can be run by starting a session of # Patran, and running this session file # through the "File","Session","Play" pulldown # menus on the menu bar. # # The function sgm_catia_access_v1() # has the following arguments: # # sgm_catia_access_v1 # ( file_name, # group_name, # group_name_length, # entity_toggle_values, # simply_trimmed, # enable_tol_prompt, # color_toggle_values, # all_layers, # active_layer, # layer_numbers, # mod_type, # number_of_groups, # group_entity_ids, # group_entity_values, # group_color_values, # active_layer_values, # layer_pointers, # group_layers, # interactive_flag, # user_control_flag ) # #---------------------------------------------------------------------

Main Index

Chapter 2: Basic Functions 29File Menu

# Variable Declarations STRING s_file_name[32] STRING s_group_name[32] INTEGER i_group_name_length LOGICAL la_entity_toggle_values(35) LOGICAL l_simply_trimmed LOGICAL l_enable_tol_prompt LOGICAL la_color_toggle_values(14) LOGICAL l_all_layers LOGICAL l_active_layer INTEGER ia_layer_numbers(256) STRING s_mod_type[6] INTEGER i_number_of_groups = 1 INTEGER ia_group_entity_ids(2) LOGICAL laa_group_entity_values(2,20) LOGICAL laa_group_color_values(2,14) LOGICAL la_active_layer_values(256) INTEGER ia_layer_pointers(2) INTEGER ia_group_layers(8) INTEGER i_interactive_flag INTEGER ia_user_control_flag(2) INTEGER i_return_value #--------------------------------------------------------------------# Open a new database "new.db" uil_file_new.go("","new.db") $? YES 36000002 #--------------------------------------------------------------------# Importing all entities of file named "catia_cam.cat". Form # indicating proposed change in tolerance will appear on the screen. s_file_name = "catia_cam.cat" s_group_name = "default_group" i_group_name_length = 13 l_enable_tol_prompt = TRUE l_all_layers = TRUE s_mod_type = "catia" ia_group_entity_ids = [1,0] la_entity_toggle_values = [TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, @ TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, @ FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, @ FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE] # i_return_value = @ sgm_catia_access_v1 @ ( s_file_name, @ s_group_name, @ i_group_name_length, @ la_entity_toggle_values, @ l_simply_trimmed, @ l_enable_tol_prompt, @ la_color_toggle_values, @ l_all_layers, @ l_active_layer, @ ia_layer_numbers, @ s_mod_type, @ i_number_of_groups, @ ia_group_entity_ids, @ laa_group_entity_values, @ laa_group_color_values, @ la_active_layer_values, @ ia_layer_pointers, @ ia_group_layers, @ i_interactive_flag, @ ia_user_control_flag ) dump i_return_value #--------------------------------------------------------------------# Model is made visible in the viewport. i_return_value =ga_view_corners_set([125.,-60.,0],[150.,-20.,0],1)

Main Index

30 PCL Reference Manual ExamplesFile Menu

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

sgm_euclid_access

()

# # Purpose : This file provides an example of a call to the # function sgm_euclid_access() # # This session file will open a new database by # name new.db. A Euclid model named # euclid_exo_2.pat will be imported in the # default group with all entities. Model will be # made visible on the screen. # # This file can be run by starting a session of # Patran, and running this session file # through the "File","Session","Play" pulldown # menus on the menu bar. # # The function sgm_euclid_access() # has the following arguments: # # sgm_euclid_access # ( file_name, # group_name, # group_name_length, # entity_toggle_values, # simply_trimmed, # color_toggle_values, # all_layers, # active_layer, # layer_numbers, # mod_type, # number_of_groups, # group_entity_ids, # group_entity_values, # group_color_values, # active_layer_values, # layer_pointers, # group_layers, # interactive_flag, # user_control_flag ) # #--------------------------------------------------------------------# Variable Declarations STRING s_file_name[32] STRING s_group_name[32] INTEGER i_group_name_length LOGICAL la_entity_toggle_values(35) LOGICAL l_simply_trimmed LOGICAL la_color_toggle_values(14) LOGICAL l_all_layers LOGICAL l_active_layer INTEGER ia_layer_numbers(256) STRING s_mod_type[6] INTEGER i_number_of_groups = 1 INTEGER ia_group_entity_ids(2) LOGICAL laa_group_entity_values(2,20) LOGICAL laa_group_color_values(2,14) LOGICAL la_active_layer_values(256) INTEGER ia_layer_pointers(2) INTEGER ia_group_layers(8) INTEGER i_interactive_flag INTEGER ia_user_control_flag(2) INTEGER i_return_value

Main Index

Chapter 2: Basic Functions 31File Menu

#--------------------------------------------------------------------# Open a new database "new.db" uil_file_new.go("","new.db") $? YES 36000002 #--------------------------------------------------------------------# Importing all entities of file named "euclid_exo_2.pat". s_file_name = "euclid_exo_2.pat" s_group_name = "default_group" i_group_name_length = 13 l_all_layers = TRUE s_mod_type = "euclid" ia_group_entity_ids = [1,0] la_entity_toggle_values = [TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, @ TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, @ FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, @ FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE] # i_return_value = @ sgm_euclid_access @ ( s_file_name, @ s_group_name, @ i_group_name_length, @ la_entity_toggle_values, @ l_simply_trimmed, @ la_color_toggle_values, @ l_all_layers, @ l_active_layer, @ ia_layer_numbers, @ s_mod_type, @ i_number_of_groups, @ ia_group_entity_ids, @ laa_group_entity_values, @ laa_group_color_values, @ la_active_layer_values, @ ia_layer_pointers, @ ia_group_layers, @ i_interactive_flag, @ ia_user_control_flag ) dump i_return_value #--------------------------------------------------------------------# Model is made visible in the viewport. i_return_value =ga_view_corners_set([-70.,-70.,0],[70.,70.,0],1) dump i_return_value #---------------------------------------------------------------------

sgm_euclid_access_v1# # # # # # # # # # # # # # # # # # #

()

Purpose

:

This file provides an example of a call to the function sgm_euclid_access_v1() This session file will open a new database by name new.db. A Euclid model named euclid_exo_2.pat will be imported in the default group with all entities. Model will be made visible on the screen. This file can be run by starting a session of Patran, and running this session file through the "File","Session","Play" pulldown menus on the menu bar.

The function sgm_euclid_access_v1() has the following arguments: sgm_euclid_access_v1

Main Index

32 PCL Reference Manual ExamplesFile Menu

# ( file_name, # group_name, # group_name_length, # entity_toggle_values, # simply_trimmed, # enable_tol_prompt, # color_toggle_values, # all_layers, # active_layer, # layer_numbers, # mod_type, # number_of_groups, # group_entity_ids, # group_entity_values, # group_color_values, # active_layer_values, # layer_pointers, # group_layers, # interactive_flag, # user_control_flag ) # #--------------------------------------------------------------------# Variable Declarations STRING s_file_name[32] STRING s_group_name[32] INTEGER i_group_name_length LOGICAL la_entity_toggle_values(35) LOGICAL l_simply_trimmed LOGICAL l_enable_tol_prompt LOGICAL la_color_toggle_values(14) LOGICAL l_all_layers LOGICAL l_active_layer INTEGER ia_layer_numbers(256) STRING s_mod_type[6] INTEGER i_number_of_groups = 1 INTEGER ia_group_entity_ids(2) LOGICAL laa_group_entity_values(2,20) LOGICAL laa_group_color_values(2,14) LOGICAL la_active_layer_values(256) INTEGER ia_layer_pointers(2) INTEGER ia_group_layers(8) INTEGER i_interactive_flag INTEGER ia_user_control_flag(2) INTEGER i_return_value #--------------------------------------------------------------------# Open a new database "new.db" uil_file_new.go("","new.db") $? YES 36000002 #--------------------------------------------------------------------# Importing all entities of file named "euclid_exo_2.pat". Form # indicating proposed change in tolerance will appear on the screen. s_file_name = "euclid_exo_2.pat" s_group_name = "default_group" i_group_name_length = 13 l_enable_tol_prompt = TRUE l_all_layers = TRUE s_mod_type = "euclid" ia_group_entity_ids = [1,0] la_entity_toggle_values = [TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, @ TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, @ FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, @ FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE] # i_return_value = @ sgm_euclid_access_v1 @ ( s_file_name, @ s_group_name, @ i_group_name_length, @

Main Index

Chapter 2: Basic Functions 33File Menu

la_entity_toggle_values, l_simply_trimmed, l_enable_tol_prompt, la_color_toggle_values, l_all_layers, l_active_layer, ia_layer_numbers, s_mod_type, i_number_of_groups, ia_group_entity_ids, laa_group_entity_values, laa_group_color_values, la_active_layer_values, ia_layer_pointers, ia_group_layers, i_interactive_flag, ia_user_control_flag ) dump i_return_value

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

#--------------------------------------------------------------------# Model is made visible in the viewport. i_return_value =ga_view_corners_set([-70.,-70.,0],[70.,70.,0],1) dump i_return_value #---------------------------------------------------------------------

sgm_intersect_curves

()

# # Purpose : This file provides an example of a call to the # function sgm_intersect_curves() # # This session file will create a new database by # name new.db and will draw two curves. These # curves will be used for finding out minimum # distance between the two. # # This file can be run by starting a session of # Patran, and running this session file # through the "File","Session","Play" pulldown # menus on the menu bar. # # The function sgm_intersect_curves() # has the following arguments: # # sgm_intersect_curves # ( curve1, # curve2, # distance, # u1, # u2, # xyz1, # xyz2 ) # #--------------------------------------------------------------------# Variable Declarations REAL rv_curve1(VIRTUAL) REAL rv_curve2(VIRTUAL) REAL r_distance REAL r_u1 REAL r_u2 REAL ra_xyz1(3) REAL ra_xyz2(3) INTEGER i_return_value INTEGER i_blob_size STRING sv_asm_create_line_xyz_crtd_ids[VIRTUAL] #--------------------------------------------------------------------# Open a new database "new.db"

Main Index

34 PCL Reference Manual ExamplesFile Menu

uil_file_new.go("","new.db") $? YES 36000002 #--------------------------------------------------------------------# Creating two parallel lines. i_return_value = @ asm_const_line_xyz( "1", "", "[0 0 0]","Coord 0",@ sv_asm_create_line_xyz_crtd_ids ) dump i_return_value i_return_value = @ asm_const_line_xyz( "2", "", "[0 1 1]","Coord 0",@ sv_asm_create_line_xyz_crtd_ids ) dump i_return_value #--------------------------------------------------------------------# Getting the blob size for curves(entity type = 2) and allocating # the memory for getting the information for curves. # For curve ID. 1 sgm_db_get_blob_size(2,1,i_blob_size,i_return_value) dump i_return_value sys_allocate_array(rv_curve1,1,i_blob_size) sgm_db_get_curve(1,i_blob_size,rv_curve1,i_return_value) dump i_return_value # For curve ID. 2 sgm_db_get_blob_size(2,2,i_blob_size,i_return_value) dump i_return_value sys_allocate_array(rv_curve2,1,i_blob_size) sgm_db_get_curve(2,i_blob_size,rv_curve2,i_return_value) dump i_return_value #--------------------------------------------------------------------# Calling the function two get the minimum distance. # i_return_value = @ sgm_intersect_curves @ ( rv_curve1, @ rv_curve2, @ r_distance, @ r_u1, @ r_u2, @ ra_xyz1, @ ra_xyz2 ) dump i_return_value dump r_distance,r_u1,r_u2,ra_xyz1,ra_xyz2 sys_free_array(rv_curve1) sys_free_array(rv_curve2) sys_free_string(sv_asm_create_line_xyz_crtd_ids) #---------------------------------------------------------------------

sgm_nearest_point_on_surface# # # # # # # # # # # # # # #

()

Purpose

:

This file provides an example of a call to the function sgm_nearest_point_on_surface() This session file will create a new database by name new.db and will draw a X-Y surface. This surface will be used for finding out minimum distance of a point(1,1,1) from the surface. This file can be run by starting a session of Patran, and running this session file through the "File","Session","Play" pulldown menus on the menu bar.

The function sgm_nearest_point_on_surface()

Main Index

Chapter 2: Basic Functions 35File Menu

# has the following arguments: # # sgm_nearest_point_on_surface # ( point, # surface, # u, # v, # xyz ) # #--------------------------------------------------------------------# Variable Declarations REAL ra_point(3) REAL rv_surface(VIRTUAL) REAL r_u REAL r_v REAL raa_xyz(3,4) INTEGER i_return_value INTEGER i_blob_size 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 patch. i_return_value = @ asm_const_patch_xyz( "1","","[0 0 0]","Coord 0", @ sv_asm_create_patch_xy_crtd_ids ) dump i_return_value # Getting the blob size for surface(entity type = 3) and allocating # the memory for getting the information for surface(Surface ID = 1). sgm_db_get_blob_size(3,1,i_blob_size,i_return_value) dump i_return_value sys_allocate_array(rv_surface,1,i_blob_size) sgm_db_get_surface(1,i_blob_size,rv_surface,i_return_value) dump i_return_value #--------------------------------------------------------------------# Calling the function to find out shortest distance between the # Surface and point at (1,1,1). ra_point = [1.,1.,1.] # i_return_value = @ sgm_nearest_point_on_surface @ ( ra_point, @ rv_surface, @ r_u, @ r_v, @ raa_xyz ) dump i_return_value dump r_u,r_v,raa_xyz sys_free_array(rv_surface) sys_free_string(sv_asm_create_patch_xy_crtd_ids) #---------------------------------------------------------------------

sgm_ptc_access_v2# # # # # # # # #

()

Purpose

:

This file provides an example of a call to the function sgm_ptc_access_v2() This session file will open a new database by name new.db. A Pro/ENGINEER geometry file named gn-0348.geo will be imported with all entities. Model will be made visible on the screen.

Main Index

36 PCL Reference Manual ExamplesFile Menu

# # This file can be run by starting a session of # Patran, and running this session file # through the "File","Session","Play" pulldown # menus on the menu bar. # # The function sgm_ptc_access_v2() # has the following arguments: # # sgm_ptc_access_v2 # ( file_name, # file_type, # simply_trimmed, # create_groups, # save_geo_file, # enable_tol_prompt, # pro_entities, # pro_count, # patran_count ) # #--------------------------------------------------------------------# Variable Declarations STRING s_file_name[32] STRING s_file_type[3] LOGICAL l_simply_trimmed LOGICAL l_create_groups LOGICAL l_save_geo_file LOGICAL l_enable_tol_prompt INTEGER ia_pro_entities(17) INTEGER ia_pro_count(9) INTEGER ia_patran_count(7) INTEGER i_return_value #--------------------------------------------------------------------# Open a new database "new.db" uil_file_new.go("","new.db") $? YES 36000002 #--------------------------------------------------------------------# Importing all entities of file named "euclid_exo_2.pat". Form # indicating proposed change in tolerance will appear on the screen. s_file_name = "gn-0348.geo" s_file_type = "GEO" l_simply_trimmed = TRUE l_create_groups = TRUE l_enable_tol_prompt = TRUE ia_pro_entities = [16, 1, 2, 3, 4, 108, 114, @ 118, 120, 122, 128, 154, 156, 160, 170, 172, 174] # i_return_value = @ sgm_ptc_access_v2 @ ( s_file_name, @ s_file_type, @ l_simply_trimmed, @ l_create_groups, @ l_save_geo_file, @ l_enable_tol_prompt, @ ia_pro_entities, @ ia_pro_count, @ ia_patran_count ) dump i_return_value, ia_pro_count, ia_patran_count #---------------------------------------------------------------------

uil_db_commit# # #

()

Purpose

:

This file provides an example of a call to the function uil_db_commit()

Main Index

Chapter 2: Basic Functions 37File Menu

# # This session file will open a new database by # name new.db. Initially a line will be drawn # and uil_db_commit function will be called. # After this one more line will be created and # uil_db_undo function will be called twice to # undo both the lines. # # This file can be run by starting a session of # Patran, and running this session file # through the "File","Session","Play" pulldown # menus on the menu bar. # # The function uil_db_commit() # has the following arguments: # # uil_db_commit # ( command ) # #--------------------------------------------------------------------# Variable Declarations STRING sa_command[32] INTEGER i_return_value STRING sv_asm_create_line_xyz_crtd_ids[VIRTUAL] #--------------------------------------------------------------------# Open a new database "new.db" uil_file_new.go("","new.db") $? YES 36000002 #--------------------------------------------------------------------# Creating line with id Line 1 i_return_value = @ asm_const_line_xyz( "1", "", "[0 0 0]", @ "Coord 0", sv_asm_create_line_xyz_crtd_ids ) dump i_return_value #--------------------------------------------------------------------# The line creation will be committed. sa_command = "committed" # uil_db_commit @ ( sa_command ) #--------------------------------------------------------------------# Creating line with id Line 2 i_return_value = @ asm_const_line_xyz( "2", "", "[0 0 0]", @ "Coord 0", sv_asm_create_line_xyz_crtd_ids ) dump i_return_value #--------------------------------------------------------------------# Attempt will be made to undo the line Line 2. uil_db_undo() # Attempt will be made to undo the line Line 1. uil_db_undo() #--------------------------------------------------------------------sys_free_string(sv_asm_create_line_xyz_crtd_ids) #---------------------------------------------------------------------

uil_db_undo# # # # # # # # #

()

Purpose

:

This file provides an example of two calls to the function uil_db_undo() This session file will open a new database by name new.db. Initially a line will be drawn and uil_db_commit function will be called. After this one more line will be created and uil_db_undo function will be called twice to

Main Index

38 PCL Reference Manual ExamplesFile Menu

# undo both the lines. # # This file can be run by starting a session of # Patran, and running this session file # through the "File","Session","Play" pulldown # menus on the menu bar. # # The function uil_db_undo() has no arguments. # #--------------------------------------------------------------------# Variable Declarations STRING sa_command[32] INTEGER i_return_value STRING sv_asm_create_line_xyz_crtd_ids[VIRTUAL] #--------------------------------------------------------------------# Open a new database "new.db" uil_file_new.go("","new.db") $? YES 36000002 #--------------------------------------------------------------------# Creating line with id Line 1 i_return_value = @ asm_const_line_xyz( "1", "", "[0 0 0]", @ "Coord 0", sv_asm_create_line_xyz_crtd_ids ) dump i_return_value #--------------------------------------------------------------------# The line creation will be committed. sa_command = "committed" # uil_db_commit @ ( sa_command ) #--------------------------------------------------------------------# Creating line with id Line 2 i_return_value = @ asm_const_line_xyz( "2", "", "[0 0 0]", @ "Coord 0", sv_asm_create_line_xyz_crtd_ids ) dump i_return_value #--------------------------------------------------------------------# Attempt will be made to undo the line Line 2. uil_db_undo() # Attempt will be made to undo the line Line 1. uil_db_undo() #--------------------------------------------------------------------sys_free_string(sv_asm_create_line_xyz_crtd_ids) #---------------------------------------------------------------------

uil_file_close.go

()

# # Purpose : This file provides an example of a call to the # function uil_file_close.go() # # This session file will create a new database by # using template.db in P3_HOME directory by # the name new.db. Session file execution will be # paused. After pressing Resume button the # database will be closed and the same will be # reopened. # # This file can be run by starting a session of # Patran, and running this session file # through the "File","Session","Play" pulldown # menus on the menu bar. # # The function uil_file_close.go() has no arguments. # #---------------------------------------------------------------------

Main Index

Chapter 2: Basic Functions 39File Menu

# Variable Declarations STRING s_template_name[32] STRING s_file_name[32] INTEGER i_return_value #--------------------------------------------------------------------# Create a database using template.db in P3_HOME directory. s_template_name = "" s_file_name = "new.db" # i_return_value = @ uil_file_new.go @ ( s_template_name, @ s_file_name ) $? YES 36000002 dump i_return_value #--------------------------------------------------------------------# Session file paused. Press "Resume" to continue.. sf_pause() #--------------------------------------------------------------------# Database will be closed. # uil_file_close.go() #--------------------------------------------------------------------# The same database will be reopened. # i_return_value = @ uil_file_open.go @ ( s_file_name ) dump i_return_value #---------------------------------------------------------------------

uil_file_new.go

()

# # Purpose : This file provides an example of a call to the # function uil_file_new.go() # # This session file will create a new database by # using template.db in P3_HOME directory by # the name new.db. # # This file can be run by starting a session of # Patran, and running this session file # through the "File","Session","Play" pulldown # menus on the menu bar. # # The function uil_file_new.go() # has the following arguments: # # uil_file_new.go # ( template_name, # file_name ) # #--------------------------------------------------------------------# Variable Declarations STRING s_template_name[32] STRING s_file_name[32] INTEGER i_return_value #--------------------------------------------------------------------# Create a database using template.db in P3_HOME directory. s_template_name = "" s_file_name = "new.db" # i_return_value = @ uil_file_new.go @ ( s_template_name, @ s_file_name )

Main Index

40 PCL Reference Manual ExamplesFile Menu

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

uil_file_open.go

()

# # Purpose : This file provides an example of a call to the # function uil_file_open.go() # # This session file will create a new database by # using template.db in P3_HOME directory by # the name new.db, closes the same and reopens. # # This file can be run by starting a session of # Patran, and running this session file # through the "File","Session","Play" pulldown # menus on the menu bar. # # The function uil_file_open.go() # has the following arguments: # # uil_file_open.go # ( file_name ) # #--------------------------------------------------------------------# Variable Declarations STRING s_template_name[32] STRING s_file_name[32] INTEGER i_return_value #--------------------------------------------------------------------# Create a database using template.db in P3_HOME directory. s_template_name = "" s_file_name = "new.db" # i_return_value = @ uil_file_new.go @ ( s_template_name, @ s_file_name ) $? YES 36000002 dump i_return_value #--------------------------------------------------------------------# Database will be closed. # uil_file_close.go() #--------------------------------------------------------------------# Session file paused. Press "Resume" to continue.. sf_pause() #--------------------------------------------------------------------# The same database will be reopened. # i_return_value = @ uil_file_open.go @ ( s_file_name ) dump i_return_value #---------------------------------------------------------------------

uil_imaging_coordframes.post_cf# # # # # # # Purpose :

()This file provides an example of a call to the function uil_imaging_coordframes.post_cf() This session file will open a existing database of name view.db tile the three viewports. A cylindrical coordinate frame will be created.

Main Index

Chapter 2: Basic Functions 41File Menu

# The unpost function will demonstrate the # unposting of the created coordinate frame and # the post function will post the coordinate # frame after a pause. # # Before running this session file run view.ses # to create view.db # # This file can be run by starting a session of # Patran, and running this session file # through the "File","Session","Play" pulldown # menus on the menu bar. # # The function uil_imaging_coordframes.post_cf() # has the following arguments: # # uil_imaging_coordframes.post_cf # ( contents ) # #--------------------------------------------------------------------# Variable Declarations STRING s_contents[16] INTEGER i_return_value STRING sv_asm_create_cord_3po_crtd_ids[VIRTUAL] #--------------------------------------------------------------------# Open the database "view.db" uil_file_open.go("view.db") #--------------------------------------------------------------------# Tiling all the viewports. i_return_value = ga_viewport_post("default_viewport") dump i_return_value i_return_value = ga_viewport_post("view1") dump i_return_value i_return_value = ga_viewport_post("view2") dump i_return_value uil_viewport_tiling.tile( ) #--------------------------------------------------------------------# Creating a coordinate frame. The frame will be posted by the create # function. i_return_value = @ asm_const_coord_3point( "1", "Coord 0", 2, "[0 0 0]", "[0 0 1]", @ "[1 0 0]", sv_asm_create_cord_3po_crtd_ids ) dump i_return_value #--------------------------------------------------------------------# Unposting the coordinate frame "Coord 1". s_contents = "Coord 1" # i_return_value = @ uil_imaging_coordframes.unpost_cf @ ( s_contents ) dump i_return_value #--------------------------------------------------------------------# Session file paused. Press "Resume" to continue.. sf_pause() #--------------------------------------------------------------------# The coordinate frame "Coord 1" will be posted. # i_return_value = @ uil_imaging_coordframes.post_cf @ ( s_contents ) dump i_return_value sys_free_string(sv_asm_create_cord_3po_crtd_ids) #---------------------------------------------------------------------

Main Index

42 PCL Reference Manual ExamplesFile Menu

uil_imaging_coordframes.unpost_cf

()

# # Purpose : This file provides an example of a call to the # function uil_imaging_coordframes.unpost_cf() # # This session file will open a existing database # of name view.db tile the three viewports. A # cylindrical coordinate frame will be created. # The function will demonstrate the unposting of # the created coordinate frame. # # Before running this session file run view.ses # to create view.db # # This file can be run by starting a session of # Patran, and running this session file # through the "File","Session","Play" pulldown # menus on the menu bar. # # The function uil_imaging_coordframes.unpost_cf() # has the following arguments: # # uil_imaging_coordframes.unpost_cf # ( contents ) # #--------------------------------------------------------------------# Variable Declarations STRING s_contents[16] INTEGER i_return_value STRING sv_asm_create_cord_3po_crtd_ids[VIRTUAL] #--------------------------------------------------------------------# Open the database "view.db" uil_file_open.go("view.db") #--------------------------------------------------------------------# Tiling all the viewports. i_return_value = ga_viewport_post("default_viewport") dump i_return_value i_return_value = ga_viewport_post("view1") dump i_return_value i_return_value = ga_viewport_post("view2") dump i_return_value uil_viewport_tiling.tile( ) #--------------------------------------------------------------------# Creating a coordinate frame. The frame will be posted by the create # function. i_return_value = @ asm_const_coord_3point( "1", "Coord 0", 2, "[0 0 0]", "[0 0 1]", @ "[1 0 0]", sv_asm_create_cord_3po_crtd_ids ) dump i_return_value #--------------------------------------------------------------------# Session file paused. Press "Resume" to continue.. sf_pause() #--------------------------------------------------------------------# Unposting the coordinate frame "Coord 1". s_contents = "Coord 1" # i_return_value = @ uil_imaging_coordframes.unpost_cf @ ( s_contents ) dump i_return_value sys_free_string(sv_asm_create_cord_3po_crtd_ids) #---------------------------------------------------------------------

Main Index

Chapter 2: Basic Functions 43File Menu

uil_primary.get_menubar_id

()

# # Purpose : This file provides an example of a call to the # function uil_primary.get_menubar_id() # # This function gets the widget id of the # primary menubar # # This file can be run by starting a session of # Patran, and running this session file # through the "File","Session","Play" pulldown # menus on the menu bar. # # The function uil_primary.get_menubar_id() has no arguments. # #--------------------------------------------------------------------# Variable Declarations WIDGET w_return_value #--------------------------------------------------------------------# Calling function to get the primary menubar ID. # w_return_value = uil_primary.get_menubar_id() dump w_return_value #---------------------------------------------------------------------

uil_viewport_tiling.tile

()

# # Purpose : This file provides an example of a call to the # function uil_viewport_tiling.tile() # # This session file will create a new database by # name new.db and three viewports at different # locations and of different size will be created # and tiled after a pause. # # This file can be run by starting a session of # Patran, and running this session file # through the "File","Session","Play" pulldown # menus on the menu bar. # # The function uil_viewport_tiling.tile() has no arguments. # #--------------------------------------------------------------------# Variable Declarations INTEGER i_return_value #--------------------------------------------------------------------# Open a new database "new.db" uil_file_new.go("","new.db") $? YES 36000002 #--------------------------------------------------------------------# Creating three viewports at different locations on the screen. i_return_value = ga_viewport_create("view1",0,0,4,4) dump i_return_value i_return_value = ga_viewport_create("view2",0,10,8,4) dump i_return_value i_return_value = ga_viewport_create("view3",10,0,4,7) dump i_return_value #--------------------------------------------------------------------# Session file paused. Press "Resume" to continue.. sf_pause() #--------------------------------------------------------------------# Tiling the three views including the "default_viewport".

Main Index

44 PCL Reference Manual ExamplesFile Menu

# uil_viewport_tiling.tile() #---------------------------------------------------------------------

ugi_import_iges

()

# # Purpose : This file provides an example of a call to the # function ugi_import_iges() # # This session file will open a existing database # of name plate.db. The model will be exported # to IGES format file plate_IGES.igs.01. The # same model will be imported in a new database # named new.db . # # Before running this session file run plate.ses # to create plate.db # # This file can be run by starting a session of # Patran, and running this session file # through the "File","Session","Play" pulldown # menus on the menu bar. # # The function ugi_import_iges() # has the following arguments: # # ugi_import_iges # ( file_name, # group_name, # entity_toggle_values, # color_toggle_values, # color_method, # color_definition, # all_layers, # layer, # number_of_groups, # group_entity_ids, # group_entity_values, # group_color_values, # layer_pointers, # group_layers, # scale, # iges_count, # patran_count ) # #--------------------------------------------------------------------# Variable Declarations STRING s_file_name[32] STRING s_group_name[32] LOGICAL la_entity_toggle_values(35) LOGICAL la_color_toggle_values(10) STRING s_color_method[7] STRING s_color_definition[8] LOGICAL l_all_layers STRING s_layer[8] INTEGER i_number_of_groups = 1 INTEGER ia_group_entity_ids(2) LOGICAL laa_group_entity_values(20,2) LOGICAL laa_group_color_values