assign_type Module

Parses Nastran fields

pyNastran.bdf.bdf_interface.assign_type.blank(card: pyNastran.bdf.bdf_interface.bdf_card.BDFCard, ifield: int, fieldname: str, default=None) → None[source]
Parameters
cardBDFCard()

BDF card as a list

ifieldint

field number

fieldnamestr

name of field

defaultNone

the default value for the field (default=None)

pyNastran.bdf.bdf_interface.assign_type.check_string(svalue: str, ifield: int, fieldname: str) → str[source]

strings can’t have the following characters: ‘ ‘ strings can’t have the following characters in the 0th position: ‘.’, ‘+’, ‘-’, 1-9

pyNastran.bdf.bdf_interface.assign_type.components_or_blank(card: pyNastran.bdf.bdf_interface.bdf_card.BDFCard, ifield: int, fieldname: str, default: Optional[str] = None) → Optional[str][source]
Parameters
cardBDFCard()

BDF card as a list

ifieldint

field number

fieldnamestr

name of field

defaultstr, None

the default value for the field (default=None)

Returns
componentsstr

a string of the dofs ‘0’ or ‘123456’ (not all are required)

pyNastran.bdf.bdf_interface.assign_type.double(card: pyNastran.bdf.bdf_interface.bdf_card.BDFCard, ifield: int, fieldname: str, end: str = '') → float[source]

Casts a value to a double

Parameters
cardBDFCard()

BDF card as a list

ifieldint

field number

fieldnamestr

name of field

Returns
valuefloat

the value from the desired field

pyNastran.bdf.bdf_interface.assign_type.double_or_blank(card: pyNastran.bdf.bdf_interface.bdf_card.BDFCard, ifield: int, fieldname: str, default: Optional[float] = None, end: str = '') → float[source]

Casts a value to a double/blank

Parameters
cardBDFCard()

BDF card as a list

ifieldint

field number

fieldnamestr

name of field

defaultdouble, None

the default value for the field (default=None)

pyNastran.bdf.bdf_interface.assign_type.double_or_string(card: pyNastran.bdf.bdf_interface.bdf_card.BDFCard, ifield: int, fieldname: str) → Union[float, str][source]

Casts a value to a double/string

Parameters
cardBDFCard()

BDF card as a list

ifieldint

field number

fieldnamestr

name of field

pyNastran.bdf.bdf_interface.assign_type.double_string_or_blank(card: pyNastran.bdf.bdf_interface.bdf_card.BDFCard, ifield: int, fieldname: str, default=None)[source]

Casts a value to an double/string/blank

Parameters
cardBDFCard()

BDF card as a list

ifieldint

field number

fieldnamestr

name of field

defaultdouble, None

the default value for the field (default=None)

Returns
valuefloat / str / None

the typed value

raises SyntaxError

if there is an invalid type ..

pyNastran.bdf.bdf_interface.assign_type.exact_string_or_blank(card: pyNastran.bdf.bdf_interface.bdf_card.BDFCard, ifield: int, fieldname: str, default=None)[source]
Parameters
cardBDFCard()

BDF card as a list

ifieldint

field number

fieldnamestr

name of field

defaultstr, None

the default value for the field (default=None)

Returns
valuevaries

the value of the field

pyNastran.bdf.bdf_interface.assign_type.fields(func, card, fieldname, i, j=None) → List[Any][source]

Todo

improve fieldname

pyNastran.bdf.bdf_interface.assign_type.integer(card: pyNastran.bdf.bdf_interface.bdf_card.BDFCard, ifield: int, fieldname: str) → int[source]

Casts a value to an integer

Parameters
cardBDFCard()

BDF card as a list

ifieldint

field number

fieldnamestr

name of field

pyNastran.bdf.bdf_interface.assign_type.integer_double_or_blank(card: pyNastran.bdf.bdf_interface.bdf_card.BDFCard, ifield: int, fieldname: str, default=None)[source]

Casts a value to an integer/double/blank

Parameters
cardBDFCard()

BDF card as a list

ifieldint

field number

fieldnamestr

name of field

defaultint / float / None

the default value for the field (default=None)

pyNastran.bdf.bdf_interface.assign_type.integer_double_or_string(card: pyNastran.bdf.bdf_interface.bdf_card.BDFCard, ifield: int, fieldname: str) → Union[int, float, str][source]

Casts a value to an integer/double/string

Parameters
cardBDFCard()

BDF card as a list

ifieldint

field number

fieldnamestr

name of field

Returns
valuevaries

the value of the field

pyNastran.bdf.bdf_interface.assign_type.integer_double_string_or_blank(card: pyNastran.bdf.bdf_interface.bdf_card.BDFCard, ifield: int, fieldname: str, default=None)[source]
Parameters
cardBDFCard()

BDF card as a list

ifieldint

field number

fieldnamestr

name of field

defaultint, float, str, None (default=None)

the default value for the field

Returns
valueint, float, str, None

the field value

pyNastran.bdf.bdf_interface.assign_type.integer_or_blank(card: pyNastran.bdf.bdf_interface.bdf_card.BDFCard, ifield: int, fieldname: str, default: Optional[int] = None) → int[source]

Casts a value to an integer

Parameters
cardBDFCard()

BDF card as a list

ifieldint

field number

fieldnamestr

name of field

defaultint, None

the default value for the field (default=None)

pyNastran.bdf.bdf_interface.assign_type.integer_or_double(card: pyNastran.bdf.bdf_interface.bdf_card.BDFCard, ifield: int, fieldname: str) → Union[int, float][source]

Casts a value to an integer/double

Parameters
cardBDFCard()

BDF card as a list

ifieldint

field number

fieldnamestr

name of field

Returns
valueint/float

the value with the proper type

raises SyntaxError

if there’s an invalid type ..

pyNastran.bdf.bdf_interface.assign_type.integer_or_string(card: pyNastran.bdf.bdf_interface.bdf_card.BDFCard, ifield: int, fieldname: str) → Union[int, str][source]

Casts a value to an integer/string

Parameters
cardBDFCard()

BDF card as a list

ifieldint

field number

fieldnamestr

name of field

defaultint / str

the default value for the field (default=None)

pyNastran.bdf.bdf_interface.assign_type.integer_string_or_blank(card: pyNastran.bdf.bdf_interface.bdf_card.BDFCard, ifield: int, fieldname: str, default=None)[source]

Casts a value to an integer/string/blank

Parameters
cardBDFCard()

BDF card as a list

ifieldint

field number

fieldnamestr

name of field

defaultint, str, None

the default value for the field (default=None)

pyNastran.bdf.bdf_interface.assign_type.interpret_value(value_raw: Optional[str], card: Union[str, pyNastran.bdf.bdf_interface.bdf_card.BDFCard] = '') → Union[int, float, str, None][source]

Converts a value from nastran format into python format.

Parameters
raw_valuestr

a string representation of a value

cardstr

???

Returns
valuevaries

the Nastran reprentation of the value

pyNastran.bdf.bdf_interface.assign_type.loose_string_or_blank(card: pyNastran.bdf.bdf_interface.bdf_card.BDFCard, ifield: int, fieldname: str, default=None)[source]
Parameters
cardBDFCard()

BDF card as a list

ifieldint

field number

fieldnamestr

name of field

defaultstr, None

the default value for the field (default=None)

Returns
valuevaries

the value of the field

pyNastran.bdf.bdf_interface.assign_type.modal_components(card: pyNastran.bdf.bdf_interface.bdf_card.BDFCard, ifield: int, fieldname: str) → int[source]

Gets the modal components (allows a -1 value); used by TIC

Parameters
cardBDFCard()

BDF card as a list

ifieldint

field number

fieldnamestr

name of field

pyNastran.bdf.bdf_interface.assign_type.modal_components_or_blank(card: pyNastran.bdf.bdf_interface.bdf_card.BDFCard, ifield: int, fieldname: str, default: any = None) → int[source]

Gets the modal components (allows a -1 value); used by TIC

Parameters
cardBDFCard()

BDF card as a list

ifieldint

field number

fieldnamestr

name of field

pyNastran.bdf.bdf_interface.assign_type.parse_components(card: pyNastran.bdf.bdf_interface.bdf_card.BDFCard, ifield: int, fieldname: str) → str[source]
Parameters
cardBDFCard()

BDF card as a list

ifieldint

field number

fieldnamestr

name of field

Returns
componentsstr

a string of the dofs ‘0’ or ‘123456’ (not all are required)

pyNastran.bdf.bdf_interface.assign_type.string(card: pyNastran.bdf.bdf_interface.bdf_card.BDFCard, ifield: int, fieldname: str) → str[source]

Casts a value to a string

Parameters
cardBDFCard()

BDF card as a list

ifieldint

field number

fieldnamestr

name of field

Returns
valuestr

the value of the field

pyNastran.bdf.bdf_interface.assign_type.string_or_blank(card: pyNastran.bdf.bdf_interface.bdf_card.BDFCard, ifield: int, fieldname: str, default=None)[source]
Parameters
cardBDFCard()

BDF card as a list

ifieldint

field number

fieldnamestr

name of field

defaultstr, None

the default value for the field (default=None)

Returns
valuevaries

the value of the field