base_card Package

base_card Module

digraph inheritance8d9d52593d { bgcolor=transparent; rankdir=LR; size=""; "pyNastran.bdf.cards.base_card.BaseCard" [URL="#pyNastran.bdf.cards.base_card.BaseCard",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Defines a series of base methods for every card class"]; "pyNastran.bdf.cards.base_card.Element" [URL="#pyNastran.bdf.cards.base_card.Element",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="defines the Element class"]; "pyNastran.bdf.cards.base_card.BaseCard" -> "pyNastran.bdf.cards.base_card.Element" [arrowsize=0.5,style="setlinewidth(0.5)"]; "pyNastran.bdf.cards.base_card.Material" [URL="#pyNastran.bdf.cards.base_card.Material",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Base Material Class"]; "pyNastran.bdf.cards.base_card.BaseCard" -> "pyNastran.bdf.cards.base_card.Material" [arrowsize=0.5,style="setlinewidth(0.5)"]; "pyNastran.bdf.cards.base_card.Property" [URL="#pyNastran.bdf.cards.base_card.Property",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Base Property Class"]; "pyNastran.bdf.cards.base_card.BaseCard" -> "pyNastran.bdf.cards.base_card.Property" [arrowsize=0.5,style="setlinewidth(0.5)"]; }
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: str

accesses the comment

get_field(n: int) 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: list[str] | None = None, filter_properties: bool = False) list[str][source]

See also

pyNastran.utils.object_attributes(…)

object_methods(mode: str = 'public', keys_to_skip: list[str] | None = 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[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: str
update_field(n: int, value: 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: 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: Any = None) 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: BaseCard

Base Material Class

dummy init

Mid() Any[source]

returns the material ID of an element

Returns:
midint

the Material ID

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

dummy cross reference method for a Material

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

Bases: 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.read_ids_thru(card: BDFCard, ifield0: int, base_str: str = 'ID%d') list[int][source]

Helper for loading:

[‘ROTORG’, rotor_id, id1, id2, id3, …] [‘ROTORG’, rotor_id, 1, THRU, 10]

pyNastran.bdf.cards.base_card.write_card(comment: str, card: list[int | float | str | None], size: int, is_double: bool) str[source]