A Ruby script that reads Nastran BDF file

Purpose of the script

The script illustrates the reading of a Nastran model from a BDF file with the FeResPost Ruby extension.

Script

Ruby
require "FeResPost"
include FeResPost

# Creates  and initializes the DataBase :

db=NastranDb.new()
db.Name="tmpDB1"
db.readBdf("../../MODEL/MAINS/unit_xyz.bdf")

db=NastranDb.new()
db.Name="tmpDB2"
begin
    db.readBdf("unit_xyz_V1.bdf",["../../MODEL/MESH/"],"bdf",{},true)
rescue Exception => x then
    printf("\n\nMaybe you should modify the two first include statements in main file!\n")
    printf("**********************************************************************\n\n")
    raise x
end

Explanation

The different steps of the script are:

Note that in the example above, the model is read twice. The second reading illustrates several optional arguments of the “readBdf” method.

References

More information on this example, and on the functions it uses, is given in the FeResPost User Manual.

← Back to the examples