The file “COMEX/EX01/testClaCom.py” contains the python program lines for automation of CLA calculations with python. One gives below some explanation about how the program works.
First, some python standard packages must be imported to allow the OLE automation to be used in the program. Therefore, the following statements are added at the beginning of the program:
Then the program defines several methods that are used in the main program:
The lamID argument is used to obtain a copy of the laminate from the dataBase. Then, the definition and the properties are written in the output stream. The programming lines that perform these operations are easy to understand and require no additional explanation.
At the beginning of the method, the ClaLam and ClaLoad objects are retrieved from the dataBase and the laminate load response is calculated as follows:
(Note that the ply result calculation is requested at bottom, mid and upper layers of each ply.) Then several results are extracted from the ClaLam object and printed in output stream:
Note that other results could be calculated as failure indices. This is left as an exercise. Note also that the interpretation of ply results requires some understanding of the structure of results returned by methods like “getPliesStresses”, “getPliesStrains”, “getReserveFactors”... The information provided in Part II of this manual and in Chapter VI.0 should be sufficient, even though it requires to spend some time on the analysis of the example.
No “main” function is defined in the program. Instead, the last lines of the program file contain the instructions that perform the main analysis.
First the component must be accessed and a ClaDb object created and initialized. This is done as follows:
Note that the access to the application requires the full name of the application that includes the version identification. This means that the name will have to be changed if another version of the component is used. The initialization of the ClaDb object involves the reading of “test.ndf” neutral data file.
The output of the results is done in a disk file:
Note that the use of iterators with python is easy. For those who know python, to understand the following lines should not be a problem:
One first makes a loop on the laminates and prints their properties. Then, inside the loop on the laminates, a loop on the loads stored in the dataBase is done and the laminate load response is calculated and printed. The criteria that are calculated are: “TsaiHill”, “Ilss” and “YamadaSun”.
When the program is run, the FeResPost component application window exhibits the number of component objects referenced, and the number of references. You may stop the program at several locations to check this information. (By adding windows message boxes for example.)