base_card Package

base_card Module

Inheritance diagram of pyNastran.bdf.cards.base_card
defines:
  • BaseCard()

  • Element()

  • Property()

  • Material()

  • word, num = break_word_by_trailing_integer(pname_fid)

  • word, num = break_word_by_trailing_parentheses_integer_ab(pname_fid)

class pyNastran.bdf.cards.base_card.BaseCard[source]

Bases: object

Defines a series of base methods for every card class (e.g., GRID, CTRIA3) including:

  • deepcopy()

  • get_stats()

  • validate()

  • object_attributes(mode=’public’, keys_to_skip=None)

  • object_methods(self, mode=’public’, keys_to_skip=None)

  • comment

  • update_field(self, n, value)

_is_same_fields_long(fields1, fields2)[source]

helper for __eq__

abstract classmethod add_card(card, comment='')[source]
property comment

accesses the comment

get_field(n: int) → Union[int, float, str, None][source]

Gets a field based on it’s field number

Parameters
nint

the field number

Returns
valueint/float/str/None

the value of the field

get_stats() → str[source]

Prints out an easy to read summary of the card

object_attributes(mode: str = 'public', keys_to_skip: Optional[List[str]] = None, filter_properties: bool = False) → List[str][source]

See also

pyNastran.utils.object_attributes(…)

object_methods(mode: str = 'public', keys_to_skip: Optional[List[str]] = None) → List[str][source]

See also

pyNastran.utils.object_methods(…)

print_card(size: int = 8, is_double: bool = False) → str[source]

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

abstract raw_fields()[source]
repr_fields() → List[Union[int, float, str, None]][source]

Gets the fields in their simplified form

Returns
fieldsList[varies]

the fields that define the card

rstrip() → str[source]
abstract property type
update_field(n: int, value: Union[int, float, str, None]) → None[source]

Updates a field based on it’s field number.

Parameters
nint

the field number

valueint/float/str/None

the value to update the field to

.. note::

This is dynamic if the card length changes.

update_field can be used as follows to change the z coordinate
of a node::
>>> nid = 1
>>> node = model.nodes[nid]
>>> node.update_field(3, 0.1)
validate() → None[source]

card checking method that should be overwritten

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

Writes the card with the specified width and precision

Parameters
sizeint (default=8)

size of the field; {8, 16}

is_doublebool (default=False)

is this card double precision

Returns
msgstr

the string representation of the card

write_card_16(is_double: bool = False) → str[source]
class pyNastran.bdf.cards.base_card.Element[source]

Bases: pyNastran.bdf.cards.base_card.BaseCard

defines the Element class

dummy init

Pid() → int[source]

Gets the Property ID of an element

Returns
pidint

the Property ID

_verify_unique_node_ids(required_node_ids, non_required_node_ids=None) → None[source]
get_node_positions(nodes: Optional[Any] = None) → numpy.ndarray[source]

returns the positions of multiple node objects

get_node_positions_no_xref(model: BDF, nodes: List[Any] = None) → np.ndarray[source]

returns the positions of multiple node objects

pid = 0
prepare_node_ids(nids: List[int], allow_empty_nodes: bool = False) → None[source]

Verifies all node IDs exist and that they’re integers

validate_node_ids(nodes: List[int], allow_empty_nodes: bool = False) → None[source]
verify_unique_node_ids() → None[source]
class pyNastran.bdf.cards.base_card.Material[source]

Bases: pyNastran.bdf.cards.base_card.BaseCard

Base Material Class

dummy init

Mid() → Any[source]

returns the material ID of an element

Returns
midint

the Material ID

property TRef
cross_reference(model: BDF) → None[source]

dummy cross reference method for a Material

class pyNastran.bdf.cards.base_card.Property[source]

Bases: pyNastran.bdf.cards.base_card.BaseCard

Base Property Class

dummy init

Mid() → int[source]

returns the material ID of an element

Returns
midint

the Material ID

Pid() → int[source]

returns the property ID of an property

Returns
pidint

the Property ID

write_card_16(is_double: bool = False) → str[source]
write_card_8() → str[source]
pyNastran.bdf.cards.base_card.break_word_by_trailing_integer(pname_fid: str) → Tuple[str, str][source]

Splits a word that has a value that is an integer

Parameters
pname_fidstr

the DVPRELx term (e.g., A(11), NSM(5))

Returns
wordstr

the value not in parentheses

valueint

the value in parentheses

Examples

>>> break_word_by_trailing_integer('T11')
('T', '11')
>>> break_word_by_trailing_integer('THETA11')
('THETA', '11')
pyNastran.bdf.cards.base_card.break_word_by_trailing_parentheses_integer_ab(pname_fid: str) → Tuple[str, str][source]

Splits a word that has a value that can be A/B as well as an integer

Parameters
pname_fidstr

the DVPRELx term; A(11), NSM(5), NSM(B)

Returns
wordstr

the value not in parentheses

valueint/str

the value in parentheses

Examples

>>> break_word_by_trailing_parentheses_integer('A(11)')
('A', '11')
>>> break_word_by_trailing_parentheses_integer('NSM(11)')
('NSM', '11')
>>> break_word_by_trailing_parentheses_integer('NSM(B)')
('NSM', 'B')
pyNastran.bdf.cards.base_card.write_card(comment: str, card: List[Optional[int, float, str]], size: int, is_double: bool) → str[source]