bdf/utils Package

This is the pyNastran.bdf.rst file.

utils Module

Defines various utilities including:
  • parse_patran_syntax

  • parse_patran_syntax_dict

  • Position

  • PositionWRT

  • transform_load

pyNastran.bdf.utils.Position(xyz: NDArray3float, cid: int, model: BDF) np.ndarray[source]

Gets the point in the global XYZ coordinate system.

Parameters:
xyz(3,) ndarray

the position of the GRID in an arbitrary coordinate system

cidint

the coordinate ID for xyz

modelBDF()

the BDF model object

Returns:
xyz2(3,) ndarray

the position of the GRID in an arbitrary coordinate system

pyNastran.bdf.utils.PositionWRT(xyz: NDArray3float, cid: int, cid_new: int, model: BDF) NDArray3float[source]

Gets the location of the GRID which started in some arbitrary system and returns it in the desired coordinate system

Parameters:
xyz(3, ) float ndarray

the position of the GRID in an arbitrary coordinate system

cidint

the coordinate ID for xyz

cid_newint

the desired coordinate ID

modelBDF()

the BDF model object

Returns:
xyz_local(3, ) float ndarray

the position of the GRID in an arbitrary coordinate system

pyNastran.bdf.utils.get_femap_material_comments_dict(data_dict)[source]
pyNastran.bdf.utils.get_femap_property_comments_dict(data_dict)[source]
pyNastran.bdf.utils.get_xyz_cid0_dict(model: BDF, xyz_cid0: dict[int, NDArray3float] = None) dict[int, NDArray3float][source]

helper method

Parameters:
modelBDF()

a BDF object

xyz_cid0None / dict[int] = (3, ) ndarray

the nodes in the global coordinate system

Returns:
xyz_cid0_dict
pyNastran.bdf.utils.parse_femap_syntax(lines: list[str]) ndarray[source]

Parses the following syntax from FEMAP:

Add 1646 0 1 Add 1422 1502 1 Add 1505 1645 1

Returns:
out(n,) int np.ndarray

sorted ids

Note

A list of lines is expected ..

pyNastran.bdf.utils.parse_femap_syntax_copy(filename_lines: str | PurePath | list[str], combine_rows: bool = False) dict[int, ndarray][source]

Parses the following syntax from FEMAP (use Copy vs. Copy-As-List):

lines = [‘7203615,7203654,1 7203990,7204010,1 7204032,7204050,1’,

‘7203594,7203614,1 7203655,7203675,1 7203969,7203989,1 7204011,7204031,1’,]

Returns:
outdict[key, values]
keyint

the line number

values(n,) int np.ndarray

sorted ids

Note

assume_unique_row avoids combining the “groups” ..

pyNastran.bdf.utils.split_comment_to_femap_comment(comment: str) tuple[bool, str, tuple[str, int, str]][source]
Parameters:
commentstr

examples are as follows: [’$ Femap Region 12345 : Wing NSM’] [’$ Femap Property 100 : Wing Skin 20 Plies

$
$ Femap Layup 10120 Ply
‘]

[‘$$ Femap Material 202 : Steel:42

‘]

[’$ Femap Property 8000007 : Aileron, Steel Pin dia=.375’, ‘$ Femap PropShape 8000007 : 5,0,0.1875,0.,0.,0.,0.,0.’, ‘$ Femap PropMethod 8000007 : 5,0,1,0.’, ‘$ Femap PropOrient 8000007 : 5,0,0.,1.,2.,3.,4.,-1.,0.,0.’]

Returns:
is_passedbool

was the comment split successfully

base_comment

TODO: maybe remove this? empty if successful otherwise, just comment

word_id_nametuple[str, int, str]
wordstr

‘Femap Property’

idint

100

namestr

‘Wing Skin 20 Plies’

pyNastran.bdf.utils.split_eids_along_nids(model: BDF, eids: list[int], nids: list[int]) None[source]

Disassociate a list of elements along a list of nodes.

The expected use of this function is that you have two bodies that are incorrectly equivalenced and you would like to create duplicate nodes at the same location and associate the new nodes with one half of the elements.

Pick the nodes along the line and the elements along one side of the line.

Parameters:
modelBDF()

the BDF model

eidslist/tuple

element ids to disassociate

nidslist/tuple

node ids to disassociate

Implicitly returns model with additional nodes.

Notes

xref should be set to False for this function.

pyNastran.bdf.utils.transform_load(F: np.ndarray, M: np.ndarray, cid: int, cid_new: int, model: BDF) tuple[np.ndarray, np.ndarray][source]

Transforms a force/moment from an arbitrary coordinate system to another coordinate system.

Parameters:
Fxyz(3, ) float ndarray

the force in an arbitrary coordinate system

Mxyz(3, ) float ndarray

the moment in an arbitrary coordinate system

cidint

the coordinate ID for xyz

cid_newint

the desired coordinate ID

modelBDF()

the BDF model object

Returns:
Fxyz_local(3, ) float ndarray

the force in an arbitrary coordinate system

Mxyz_local(3, ) float ndarray

the force in an arbitrary coordinate system

write_path Module

Defines following useful methods:
  • write_include(filename, is_windows=True)

pyNastran.bdf.write_path._split_path(abspath: str, is_windows: bool) tuple[str, ...][source]

Takes a path and splits it into the various components.

This is a helper method for write_include

pyNastran.bdf.write_path._split_pathi(term: str) str[source]

If the segment is >72 characters, split it. Nastran ignores whitespace, so split at a place where there’s not whitespace.

pyNastran.bdf.write_path.write_include(filename: str | PurePath, is_windows: bool = None) str[source]

Writes a bdf INCLUDE file line given an imported filename.

Parameters:
filenamePathLike

the filename to write

is_windowsbool; default=None
True/FalseWindows has a special format for writing INCLUDE

files, so the format for a BDF that will run on Linux and Windows is different.

None : Check the platform

For a model that will run on Linux:
..code-block:: python

fname = r’/opt/NASA/test1/test2/test3/ test4/formats/pynastran_v0.6/pyNastran/bdf/model.inc’ write_include(fname, is_windows=False)

We want:
..code-block:: python
INCLUDE /opt/NASA/test1/test2/test3/test4/formats/pynastran_v0.6/

pyNastran/bdf/model.inc