PCL
PCL
What is PCL ?
PCL is an acronym for Patran Command Language. It is a fully functional programming language, i.e. IFTHEN, FOR Users can create functions in MSC.Patran. Functions can perform multiple tasks, and can eliminate repetitive steps. Create a PCL function. Compile the PCL function in either MSC.Patran or in the external PCL compiler. Once the PCL function is compiled it can be executed in MSC.Patran using the command window(line), or by including it in a library and have that loaded during the start of MSC.Patran.
S9-1
PCL BASICS
RETURN gap_opening
END FUNCTION
S9-2
To compile a function type the following command in the command window(line) of MSC.Patran:
!!input pcl_function_filename.pcl
To execute the function in MSC.Patran type the following command in the command window:
S9-3
Alternatively, it is possible to compile PCL functions in the command prompt(e.g. C:\>) environment.
At the command prompt execute p3pclcomp.exe to enter the PCL environment. The commands for this environment are same as those in the MSC.Patran environment.
S9-4
It is possible to generate a library of PCL functions and have that library loaded during the start of MSC.Patran. To create a library use the following command:
To add a PCL function to a library use the following command to compile, then assign it:
To load a library during the start of MSC.Patran the following line needs to be added to the p3epilog.pcl file.
sys_library(ADD, library_name.plb)
S9-5
Sometimes a still image in the MSC.Patran viewport will be captured for a report or presentation. Due to the default color settings of MSC.Patran the background will be black, and it may be necessary to change the background color to white and the entities which are colored white to black. Other changes of the colors may be necessary. The changes may need to be made before the image is captured. The steps used in MSC.Patran to change the background color from black to white are:
Access the Color Palette. Switch the background color specification from black to white. Switch the entities which are colored white to being colored black.
Instead of performing these three steps every time MSC.Patran is used, create a PCL function and use it to perform the color swapping task. The simplest method to create such a function is to perform the above tasks in a new MSC.Patran database, and then extract the function representing the above tasks from the session file.
S9-6
Manual steps
Create an MSC.Patran database and access the color palette in the Display menu. Use the RGB option to change the colors. Change a color by sliding each color bar left or right. The color is determined by the intensity of all three colors mixed together.
S9-7
Black to White
PAT302, Section 9, June 2003 S9-8
White to Black
Add two entries in the text file to create a PCL function Save the file, calling it swap_bw.pcl
FUNCTION swap_b_to_w() ga_lookup_colors_set( "standard_colortable", 0, 16, [[1., 1., 1.][1., 0., 0.][ @ 0., 1., 0.][1., 1., 0.][0., 0., 1.][1., 0., 1.][0., 1., 1.][0., 0., 0.][1., @ 0.47, 0.][1., 0.80000001, 0.][0., 0.5, 0.][0., 0.75, 0.][0., 0., 0.67000002][ @ 0., 0.60000002, 1.][1., 0.40000001, 1.][1., 0.75, 1.]] )
END FUNCTION
S9-9
Now the icon is shown in the MSC.Patran Toolbar after it has been loaded.
S9-10
Create the model that the PCL function will be used for to create the pressure load.
(0,0,0)
(6.283,2,0)
(0,-2,2)
S9-11
Create the model that the PCL function will be used for to create the pressure load.
S9-12
Create the Spatial PCL Function field using the complied PCL function hydro_pressure.
Type the function name and the variables in the Scalar Function box.
S9-13
Create the pressure load using the field created from the PCL function.
S9-14
S9-15