PCL and Customization > Modifying the Database Using PCL > Examples of Modifying the Database
   
Examples of Modifying the Database
The following session file is an example of how the commands described in this chapter can be used to load analysis code specific data about a new analysis code into a Patran database.
codeindent10 1: “John Code”, a hypothetical structural analysis code
The following session file loads the open database with the analysis code definitions for “John Code”, a hypothetical and simplistic structural analysis code. This example is delivered with Patran in the $P3_HOME/customization directory under the name “load_johncode.ses.” In order to run this session file, follow these steps:
1. Within Patran, open the target database. This database can be devoid of analysis code examples, like “base.db” or can already contain analysis code definitions, like “template.db”.
2. Run the $P3_HOME/customization/load_johncode.ses session file through the “Play Session File” functionality on the main “File” menu.
$  Initialize variables
INTEGER status, bar_code, plate_code, solid_code
$  Define new analysis code
status = db_create_analysis_code(20001, “John Code”, “.in”, “.out”, 1, [1], 1 )
!‘status‘
$  Define the generic element types, element properties and material properties
load_generics()
$  Get PATRAN topology codes
status = fem_get_patran25_etop(2,2,bar_code)
!‘status‘
status = fem_get_patran25_etop(4,4,plate_code)
!‘status‘
status = fem_get_patran25_etop(8,8,solid_code)
!‘status‘
$  Define element types
status = db_create_selected_etype_wc ( 1, 7, 13, 42, 1, 2, bar_code, 20, 1, 1, 36, 1 )
!‘status‘
status = db_create_selected_etype_wc(1,7,27, 42, 1, 2, bar_code, 20, 1, 1, 36, 2 )
!‘status‘
status = db_create_selected_etype_wc ( 1, 7, 1, 24, 1, 1, plate_code, 19, 1, @
1, 54, 1 )
!‘status‘
status = db_create_selected_etype_wc( 1,7,1,24,1,3, plate_code, 19,1,4,54, 2)
!‘status‘
status = db_create_selected_etype_wc ( 1, 7, 1, 30, 1, 1, solid_code, 15, 1, 1, 71, 5)
!‘status‘
$  Re-create element type summary table
status = elementprops_def_create.make_elem_summary()
!‘status‘
$  Define element property words
status = db_create_allowable_phys_prop( 7, 13, “Material Reference,” 1, @
[5,0,0,0,0,0,0,0,0,0], 5, 0, “ ”, “ ”, “ ”)
!‘status‘
status = db_create_allowable_phys_prop( 7, 1027, “Outside Radius,” 1, @
    [1,0,0,0,0,0,0,0,0,0], 1, 0, “ ”, “prop > 0.”, “ ” )
!‘status‘
status = db_create_allowable_phys_prop( 7, 1, “Cross Sectional Area,” 1, @
 
status = db_create_matl_prop_alias ( 7, 1, 1, 2, 503, “Stress/Strain Curve,” 3 )
!‘status‘
$  Define the material records
status = db_create_allowable_matl_prop ( 7, 1, 1, 1, [0,0,0,0,0], [1, 2, 5, 16, 24, 30], 6 )
!‘status‘
status = db_create_allowable_matl_prop ( 7, 1, 1, 2, [0,0,0,0,0], [503], 1 )
!‘status‘
$  Assign the already existing definitions for FORCE and DISPLACEMENT
$  to John Code
status = db_add_lbc_type_for_ac( 7, 6 )
!‘status‘
status = db_add_lbc_type_for_ac( 7, 7 )
!‘status‘
$  Define MPC types Explicit, Rigid(Fixed), Rigid(Pinned)
status = db_create_mpc_type_def ( 41, “Explicit,” FALSE, FALSE, TRUE, “Constant Term,” @
                        FALSE, FALSE, TRUE, 1, 1, 1, 1, TRUE, TRUE, 0, 1, 1, 1 )
!‘status‘
status = db_create_mpc_type_def ( 42, “Rigid(Fixed),” FALSE, FALSE, FALSE, “ ”, @
                        FALSE, FALSE, FALSE, 0, 1, 0, 1, FALSE, FALSE, 1, 1, 0, 1 )
!‘status‘
status = db_create_mpc_type_def ( 43, “Rigid(Pinned),” FALSE, FALSE, FALSE, “ ”, @
                        FALSE, FALSE, FALSE, 0, 1, 0, 1, FALSE, FALSE, 1, 1, 0, 1 )
!‘status‘
$  Associate MPC types with the new analysis code
status = db_create_valid_mpc_type ( 41, 7, 1, 6, [1, 2, 3, 4, 5, 6] )
!‘status‘
status = db_create_valid_mpc_type ( 42, 7, 1, 0, [0] )
!‘status‘
status = db_create_valid_mpc_type ( 43, 7, 1, 0, [0] )
!‘status‘
$  Define generic element property verification parameters
status = db_set_elem_verification_parms ( “John Code”, 1, 5.0 )
!‘status‘
status = db_set_elem_verification_parms ( “John Code”, 2, 30.0 )
!‘status‘
status = db_set_elem_verification_parms ( “John Code”, 3, 5.0 )
!‘status‘
status = db_set_elem_verification_parms ( “John Code”, 4, 30.0 )
!‘status‘
status = db_set_elem_verification_parms ( “John Code”, 5, 7.0 )
!‘status‘
status = db_set_elem_verification_parms ( “John Code”, 6, 0.8 )
!‘status‘
status = db_set_elem_verification_parms ( “John Code”, 7, 5.0 )
!‘status‘
status = db_set_elem_verification_parms ( “John Code”, 8, 30.0 )
!‘status‘
status = db_set_elem_verification_parms ( “John Code”, 9, 0.15 )
!‘status‘
status = db_set_elem_verification_parms ( “John Code”, 10, 30.0 )
!‘status‘
status = db_set_elem_verification_parms ( “John Code”, 11, 5.0 )
!‘status‘
 
status = db_set_elem_verification_parms ( “John Code”, 12, 30.0 )
!‘status‘
status = db_set_elem_verification_parms ( “John Code”, 13, 0.8 )