FeResPost Web Site                     FeResPost Online User Manual

III.1.1.4 Writing Bulk lines

Method “writeBdfLines” is used to output the model or part of the model into a text file with a format compatible with Nastran BDF cards. The method has 5 or 6 arguments :

1.
A string containing the name of the file to which the Nastran cards are printed.
2.
A string corresponding to the opening mode for the file. Valid values are “w” and “w+” (for append mode).
3.
A first format String argument specifying whether the fields in the cards output are left or right aligned. This argument may have three values: “left”, “right” or a void String. If the String is void, the format defaults to “left”.
4.
A second format String argument specifying whether the fields in the cards output are narrow or wide. This argument may have three values: “short”, “wide” or a void String. If the String is void, the format defaults to “short”.
5.
A third String argument corresponding to the type of entities that must be printed. The method scans the String argument and searches sub-strings that specify whether an entity type is to be printed or not. The sub-strings that are searched are “All”, “CoordSys”, “Nodes”, “Elements”, “RBEs”, “MPCs”, “Properties”, “Materials”.
6.
The last argument is optional and corresponds to the Group for which cards are to be printed. It can be a String or a Group argument. If its type is String, then the corresponding Group defined in the DataBase is considered. Note that “Properties” and “Materials” are not printed if the Group argument is provided.

The “writeBdfLines” method must be used for debugging purposes only. The user must keep in mind that some entities are not totally supported and their output may be problematic.

One first singleton method may be used to output formatted Nastran cards. This method can be used, for example, to produce Nastran cards for inclusion in a Bulk Data File. The method name is “writeNastranCard” and has five or six arguments (the “output card name” argument is optional):

1.
A String containing the name of the file to which the Nastran card is printed.
2.
A String corresponding to the opening mode for the output file. Valid values are “w” and “w+” (for append mode).
3.
A first format String argument specifying whether the fields in the card output are left or right aligned. This argument may have three values: “left”, “right” or a void String. If the String is void, the format defaults to “left”.
4.
A second format String argument specifying whether the fields in the card output are narrow or wide. This argument may have three values: “short”, “wide” or a void String. If the String is void, the format defaults to “short”.
5.
A String corresponding to the name of the output card. This name cannot have more than 8 characters and should correspond to a valid Nastran BDF card name. THIS ARGUMENT IS OPTIONAL.
6.
An Array containing the fields to be printed. Possible types for the elements of this Array are Real, Integer and String:

Examples of calls to the method follow:

   NastranDb.writeNastranCard("output.bdf","w+","right","short",card)  
   NastranDb.writeNastranCard("output.bdf","w+","right","short","RBE2",card)

Another singleton method called “writeNastranCards” allows to output several Nastran cards. This method has the same arguments as “writeNastranCard” except that the last argument is an Array of Arrays, each element of the “big” Array corresponding to one Nastran card. The other arguments are the same, which means:

Remark that when “writeNastranCards” is called with 5 arguments, it is possible, with a single call, to output different types of Nastran cards (“FORCE”, “MOMENT”,...). This is not possible when the method is called with 6 arguments. Examples of calls to the method follow:

   NastranDb.writeNastranCards("output.bdf","w+","right","short",cards)  
   NastranDb.writeNastranCards("output.bdf","w+","right","short","RBE2",cards)

The use of “writeNastranCard” and “writeNastranCards” methods is clarified in section IV.2.5.1.

Method “writeNastranCardToVectStr” is similar to “writeNastranCard”. It produces a formatted BDF output but returns it in an Array of Strings, each String corresponding to one line in the output. The three or four arguments of the method are as follows:

1.
A first format String argument specifying whether the fields in the card output are left or right aligned. This argument may have three values: “left”, “right” or a void String. If the String is void, the format defaults to “left”.
2.
A second format String argument specifying whether the fields in the card output are narrow or wide. This argument may have three values: “short”, “wide” or a void String. If the String is void, the format defaults to “short”.
3.
A String corresponding to the name of the output card. This name cannot have more than 8 characters and should correspond to a valid Nastran BDF card name. HERE AGAIN, THE ARGUMENT IS OPTIONAL.
4.
An Array containing the fields to be printed. Possible types for the elements of this Array are Real, Integer and String:

Examples of calls to these two methods follow:

   lines=[]  
   lines+=NastranDb.writeNastranCardToVectStr("right","short",card)  
   lines+=NastranDb.writeNastranCardToVectStr("right","short","RBE2",card)  
   lines+=NastranDb.writeNastranCardsToVectStr("right","short",cards)  
   lines+=NastranDb.writeNastranCardsToVectStr("right","short","RBE2",cards)  
   puts lines

As has been done for the “writeNastranCard” method, a “writeNastranCardsToVectStr” singleton method is defined in the “NastranDb” class. A single call to the method allows the output of several Nastran cards in an Array of Strings. The last argument of the method is an Array or Arrays.