FeResPost Web Site                     FeResPost Online User Manual

IV.2.2.1 Reading Bulk Data

The first example illustrates different versions of the call to “readBdf” method:

    require "FeResPost"
    include FeResPost

# Creates  and initializes the DataBase :

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

The first call to “readBdf” is the default instruction used to read the Bulk file in most examples.

A second bdf read operation is performed as follows:

    db=NastranDb.new()
    db.Name="tmpDB2"
    begin
        db.readBdf("unit_xyz_V1.bdf",[],"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

The revised version reads main file “unit_xyz_V1.bdf” that illustrates several possible interpretation of the “include” statements in Nastran Bulk Data Files. The user must uncomment the corresponding statement, and modify the absolute paths in the include statements of “unit_xyz_V1.bdf” file. (The “begin” and “rescue” statements have been added to remind the user of this necessary modification. An error message is issued if the reading fails.)

Include statement in the data file look as follows:

include ’/home/ferespost/Documents/FERESPOST/TESTSAT/
    MODEL/MESH/coordSys.bdf’
include /home/ferespost/Documents/FERESPOST/    ,
          TESTSAT/MODEL/MATS/mats.bdf
include ’../../MODEL/PROPS/props.bdf’
$
include ../../MODEL/MESH/elemNodes_pan_MX.bdf
    include ../../MODEL/MESH/elemNodes_pan_MY.bdf
include     ../../MODEL/MESH/elemNodes_pan_MZ.bdf
include ../../    MODEL/MES    H/elemNod    es_pan_PX.bdf
include ../../MODEL/MESH/    elemNodes_pan_PY.bdf

The example is given in file “RUBY/EX01/readBdf.rb”.

Another version of the example is given in file “RUBY/EX01/readBdf_V2.rb”. It illustrates the reading of Bulk Data Files containing include statements in which symbols are used. In that example, the call to “readBdf” looks as follows:

    symbols=Hash.new
    symbols["INCDIR"]="../../MODEL"

    db=NastranDb.new()
    db.Name="tmpDB2"
    db.readBdf("unit_xyz_V2.bdf",[],"bdf",symbols,true)

The variable “symbols” is a Hash containing the list of symbols that must be substituted in the include statements. (Only one symbol is defined in this case.) The include statements of the BDF file look as follows:

include INCDIR:/MESH/elemNodes_pan_MX.bdf
    include INCDIR:/MESH/elemNodes_pan_MY.bdf
include     INCDIR:/MESH/elemNodes_pan_MZ.bdf
include ../../    MODEL/MES    H/elemNod    es_pan_PX.bdf
include INCDIR:/MESH/    elemNodes_pan_PY.bdf

The example “readBdf_V3” proposes a slightly more complicated case of file inclusions in a main BDF.

In Example “readBdf_V7” one proposes to illustrate several functions allowing the manipulation of the database FEM entities. A list of Nastran cards corresponding to the FEM definition is build as follows:

    cards=[]
    db.each_coordSysId do |id|
        cards << db.fillCard("CoordSys",id)
    end
    db.each_nodeId do |id|
        cards << db.fillCard("Node",id)
    end
    db.each_elemId do |id|
        cards << db.fillCard("Element",id)
    end
    db.each_rbeId do |id|
        cards << db.fillCard("RBE",id)
    end
    db.each_materialId do |id|
        cards << db.fillCard("Material",id)
    end
    db.each_propertyId do |id|
        cards << db.fillCard("Property",id)
    end

Then, one builds a new database using these cards:

    db3=NastranDb.new()
    db3.Name="tmpDB3"
    db3.insertCards(cards);

Finally, one checks the content of the new database:

    db3.writeBdfLines("out.bdf","w","left","short","All");

    vectStr=NastranDb.writeNastranCardsToVectStr("left","short",cards);
    vectStr.each do |line|
        puts line
    end

Example “readBdf_V8” illustrates the reading of a model by several calls to “readBdf” methods:

    db.readBdf("D:/SHARED/FERESPOST/TESTSAT/MODEL/MESH/coordSys.bdf",nil,nil,nil,true,true)
    db.readBdf("D:/SHARED/FERESPOST/TESTSAT/MODEL/MATS/mats.bdf",nil,nil,nil,true,true)
    db.readBdf("../../MODEL/PROPS/props.bdf",nil,nil,nil,true,true)

    ...

    db.readBdf("../../MODEL/FIXAS/launch.bdf",nil,nil,nil,true,true)
    db.readBdf("../../MODEL/LOADS/unit_accel.bdf",nil,nil,nil,true,true)

This approach can be used to modify finite element model stored in a database during script execution.