bdf_card Module

Inheritance diagram of pyNastran.bdf.bdf_interface.bdf_card

Defines the BDFCard class that is passed into the various Nastran cards.

class pyNastran.bdf.bdf_interface.bdf_card.BDFCard(card: List[str], has_none: bool = True)[source]

Bases: object

A BDFCard is a list that has a default value of None for fields out of range.

Parameters
cardList[str]

the split values for the card

has_nonebool; default=True

helps with a special case to speed up runtime

# definitely bad
card = [‘GRID’, ‘1’, ‘’, ‘1.0’, ‘2.0’, ‘3.0’]
BDFCard(card, has_none=False)
# definitely correct
card = [‘GRID’, ‘1’, None, ‘1.0’, ‘2.0’, ‘3.0’]
BDFCard(card, has_none=True)
# ???
card = [‘GRID’, ‘1’, ‘’, 1.0, 2.0, 3.0]
BDFCard(card, has_none=True)
field(i: int, default: Union[int, float, str, None] = None) → Union[int, float, str, None][source]

Gets the ith field on the card

Parameters
iint

the ith field on the card (following list notation)

defaultint/float/str/None

the default value for the field

Returns
valueint/float/str/None

the value on the ith field

fields(i: int = 0, j: Optional[int] = None, defaults: Any = None) → List[Any][source]

Gets multiple fields on the card

Parameters
iint > 0

the ith field on the card (following list notation)

jint / None

int : the jth field on the card None : last field on the card

defaultsList[int/float/str]

the default value for the field (as a list) len(defaults)=i-j-1

Returns
valuesList[varies]

int/float/str the values on the ith-jth fields

index(value)[source]
pop()[source]
write_card(size: int = 8, is_double: bool = False) → str[source]

prints the card in 8/16/16-double format