base_card Package

base_card Module

Inheritance diagram of pyNastran.bdf.cards.base_card
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(self, fields1, fields2)[source]

helper for __eq__

comment

accesses the comment

get_field(self, n)[source]

Gets a field based on it’s field number

Parameters:
n : int

the field number

Returns:
value : int/float/str/None

the value of the field

get_stats(self)[source]

Prints out an easy to read summary of the card

object_attributes(self, mode='public', keys_to_skip=None, filter_properties=False)[source]

See also

pyNastran.utils.object_attributes(…)

object_methods(self, mode='public', keys_to_skip=None)[source]

See also

pyNastran.utils.object_methods(…)

print_card(self, size=8, is_double=False)[source]

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

repr_fields(self)[source]

Gets the fields in their simplified form

Returns:
fields : List[varies]

the fields that define the card

rstrip(self)[source]
update_field(self, n, value)[source]

Updates a field based on it’s field number.

Parameters:
n : int

the field number

value : int/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(self)[source]

card checking method that should be overwritten

write_card(self, size=8, is_double=False)[source]

Writes the card with the specified width and precision

Parameters:
size : int (default=8)

size of the field; {8, 16}

is_double : bool (default=False)

is this card double precision

Returns:
msg : str

the string representation of the card

write_card_16(self, is_double=False)[source]
class pyNastran.bdf.cards.base_card.Element[source]

Bases: pyNastran.bdf.cards.base_card.BaseCard

defines the Element class

dummy init

Pid(self)[source]

Gets the Property ID of an element

Returns:
pid : int

the Property ID

_verify_unique_node_ids(self, required_node_ids, non_required_node_ids=None)[source]
get_node_positions(self, nodes=None)[source]

returns the positions of multiple node objects

get_node_positions_no_xref(self, model, nodes=None)[source]

returns the positions of multiple node objects

pid = 0
prepare_node_ids(self, nids, allow_empty_nodes=False)[source]

Verifies all node IDs exist and that they’re integers

validate_node_ids(self, allow_empty_nodes=False)[source]
verify_unique_node_ids(self)[source]
class pyNastran.bdf.cards.base_card.Material[source]

Bases: pyNastran.bdf.cards.base_card.BaseCard

Base Material Class

dummy init

Mid(self)[source]

returns the material ID of an element

Returns:
mid : int

the Material ID

TRef
cross_reference(self, model)[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(self)[source]

returns the material ID of an element

Returns:
mid : int

the Material ID

Pid(self)[source]

returns the property ID of an property

Returns:
pid : int

the Property ID

write_card_16(self, is_double=False)[source]
write_card_8(self)[source]
pyNastran.bdf.cards.base_card.break_word_by_trailing_integer(pname_fid)[source]

Splits a word that has a value that is an integer

Parameters:
pname_fid : str

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

Returns:
word : str

the value not in parentheses

value : int

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)[source]

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

Parameters:
pname_fid : str

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

Returns:
word : str

the value not in parentheses

value : int/str

the value in parenthese

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')