bdf_merge Module

defines:
  • bdf_merge(bdf_filenames, bdf_filename_out=None, renumber=True, encoding=None, size=8,

    is_double=False, cards_to_skip=None, log=None, skip_case_control_deck=False)

pyNastran.bdf.mesh_utils.bdf_merge._apply_scalar_cards(model: BDF, model2_renumber: BDF) None[source]

apply cards from model2 to model if they don’t exist in model

pyNastran.bdf.mesh_utils.bdf_merge._assemble_mapper(mappers: list[MAPPER], mapper_0: MAPPER, data_members: list[str], mapper_renumber: MAPPER | None = None) None[source]

Assemble final mappings from all original ids to the ids in the merged and possibly renumbered model.

Parameters:
mapperslist[mapper]
mapperdict[key]value
key???

???

value???

???

mapper_0mapper
key???

???

value???

???

data_memberslist[str]
list of things to include in the mappers?
data_members = [

‘coords’, ‘nodes’, ‘elements’, ‘masses’, ‘properties’, ‘properties_mass’, ‘materials’, ‘sets’, ‘rigid_elements’, ‘mpcs’,

]

mapper_renumberdict[key]: value; default=None
keystr

a BDF attribute

valuedict[id_old]id_new

a sub dictionary that is used to map the node/element/etc. ids

mapper = {

‘elements’ : eid_map, ‘nodes’ : nid_map, ‘coords’ : cid_map, …

}

Returns:
mappers_alllist[mappers]

One mapper for each bdf_filename

pyNastran.bdf.mesh_utils.bdf_merge._dict_key_to_key(dictionary) dict[int, int][source]

creates a dummy map from the nominal key to the nominal key

pyNastran.bdf.mesh_utils.bdf_merge._dicts_key_to_key(dictionaries: list[dict[int, Any]]) dict[int, int][source]

Creates a dummy map from the nominal key to the nominal key for multiple input dictionaries. This is intended for use with:

  • SPCs, MPCs, Loads

pyNastran.bdf.mesh_utils.bdf_merge._get_mapper_0(model: BDF) MAPPER[source]

Get the mapper for the first model.

Parameters:
modelBDF()

the bdf model object

Returns:
mapperdict[key]: value
keystr

a BDF attribute

valuedict[id_old]id_new

a sub dictionary that is used to map the node/element/etc. ids

mapper = {

‘elements’ : eid_map, ‘nodes’ : nid_map, ‘coords’ : cid_map, …

}

pyNastran.bdf.mesh_utils.bdf_merge._renumber_mapper(mapper_0: MAPPER, mapper_renumber: MAPPER)[source]

Renumbers a mapper

Parameters:
mapper_0dict[key]: value
keystr

a BDF attribute

valuedict[id_old]id_new

a sub dictionary that is used to map the node/element/etc. ids

mapper = {

‘elements’ : eid_map, ‘nodes’ : nid_map, ‘coords’ : cid_map, …

}

mapper_renumber???

???

Returns:
mapperdict[map_type]sub_mapper
map_type???

???

sub_mapperdict[key]value
key???

???

value???

???

pyNastran.bdf.mesh_utils.bdf_merge.bdf_merge(bdf_filenames: list[str], bdf_filename_out: str | None = None, renumber: bool = True, encoding: str | None = None, size: int = 8, is_double: bool = False, cards_to_skip: list[str] | None = None, skip_case_control_deck: bool = False, log: SimpleLogger | None = None) tuple[BDF, list[MAPPER]][source]

Merges multiple BDF into one file

Parameters:
bdf_filenameslist[str]

list of bdf filenames

bdf_filename_outstr / None

the output bdf filename (default=None; None -> no writing)

renumberbool

should the bdf be renumbered (default=True)

encodingstr

the unicode encoding (default=None; system default)

sizeint; {8, 16}; default=8

the bdf write precision

is_doublebool; default=False

the field precision to write

cards_to_skiplist[str]; (default=None -> don’t skip any cards)

There are edge cases (e.g. FLUTTER analysis) where things can break due to uncross-referenced cards. You need to disable entire classes of cards in that case (e.g. all aero cards).

skip_case_control_deckbool, optional, defaultFalse

If true, don’t consider the case control deck while merging.

Returns:
modelBDF

Merged model.

mappers_alllist[mapper]
mapperdict[bdf_attribute]old_id_to_new_id_dict

List of mapper dictionaries of original ids to merged

bdf_attributestr

a BDF attribute (e.g., ‘nodes’, ‘elements’)

old_id_to_new_id_dictdict[id_old]id_new

a sub dictionary that is used to map the node/element/etc. ids

mapper = {

‘elements’ : eid_map, ‘nodes’ : nid_map, ‘coords’ : cid_map, …

}

Supports

nodes: GRID coords: CORDx elements: CQUAD4, CTRIA3, CTETRA, CPENTA, CHEXA, CELASx, CBAR, CBEAM

CONM1, CONM2, CMASS

properties: PSHELL, PCOMP, PSOLID, PMASS materials: MAT1, MAT8

Todo

doesn’t support SPOINTs/EPOINTs ..

Warning

still very preliminary ..