IX.1.1.2 Reading a Nastran model with IronRuby
“readBdf_V2_rb.rb” contains an IronRuby version of C# example “readBdf_V2.cs”. The first call to
“readBdf is done as follows:
...
bdfName=System::String.new("unit_xyz_V2.bdf")
symbols=Hash.new
symbols["INCDIR"]="../../MODEL"
db=NastranDb.new()
db.Name="tmpDB2"
begin
db.readBdf(bdfName,[],System.String("bdf"),symbols,true)
rescue Exception => x then
...
Of course, this call fails because ruby standard Arrays or Hashes cannot be used as CLI Arrays or
dictionaries. Instead, the following statements work:
...
symbols=System::Collections::Generic::Dictionary[System::String,System::String].new
symbols.Add("INCDIR","../../MODEL");
db.readBdf(bdfName,System::Array[System::String].new(0),System::String.new("bdf"),symbols,true)
...
The example illustrates the difficulty of marshaling CLI data types with IronRuby. We expect this to
be true for all interpreted languages.