The example illustrates the manipulation of CLA objects units. The example is presented in directory “TESTSAT/RUBY/EX18”, in file “testMatUnits.rb”.
The sequence of operations is simple:
A DataBase is read from neutral file “”.
Then engineering constants of all the laminates in the DataBase are saved into file “oldUnits.txt”.
The units of all materials in the DataBase are modified using method “changeUnitsAllMaterials”.
The modified DataBase is saved into file “testUnits.ndf”.
Then engineering constants of all the laminates in the modified DataBase are saved into file “newUnits.txt”.
The two files “oldUnits.txt” and “newUnits.txt” may be compared. They should contain equivalent results.
The part of interest of the example is the modification units for all the materials in the database:
oldUnits=db.getUnits newUnits=oldUnits.clone newUnits["F"]="lbf" newUnits["L"]="mm" newUnits["T"]="oF" puts oldUnits puts newUnits db.each_material do |id,mat| mat.changeUnits(newUnits) db.insertMaterial(mat) end
(Note that in the example, it was deliberately decided not to use the “changeUnitsAllMaterials” method of the ClaDb class.)
The user may test the outputs with or without units systems modifications to verify if the results are affected by the modification of units. (They should not be modified.)