mesh_utils Package

bdf_equivalence Module

defines:
model = bdf_equivalence_nodes(bdf_filename, bdf_filename_out, tol,
renumber_nodes=False, neq_max=4, xref=True, node_set=None, size=8, is_double=False, remove_collapsed_elements=False, avoid_collapsed_elements=False, crash_on_collapse=False, log=None, debug=True)
pyNastran.bdf.mesh_utils.bdf_equivalence._check_for_referenced_nodes(model, node_set, nids, all_nids, nodes_xyz)[source]

helper function for _eq_nodes_setup

pyNastran.bdf.mesh_utils.bdf_equivalence._eq_nodes_final(nid_pairs, model, tol, node_set=None, debug=False)[source]

apply nodal equivalencing to model

pyNastran.bdf.mesh_utils.bdf_equivalence._eq_nodes_setup_node(model, renumber_nodes=False)[source]

helper function for _eq_nodes_setup

pyNastran.bdf.mesh_utils.bdf_equivalence._eq_nodes_setup_node_set(model, node_set, renumber_nodes=False)[source]

helper function for _eq_nodes_setup

pyNastran.bdf.mesh_utils.bdf_equivalence._get_tree(nodes_xyz, msg='')[source]

gets the kdtree

pyNastran.bdf.mesh_utils.bdf_equivalence._get_xyz_cid0(model, nids)[source]

gets xyz_cid0

pyNastran.bdf.mesh_utils.bdf_equivalence._nodes_xyz_nids_to_nid_pairs(nodes_xyz, nids, tol, log, inew, node_set=None, neq_max=4, debug=False)[source]

helper for equivalencing

pyNastran.bdf.mesh_utils.bdf_equivalence.bdf_equivalence_nodes(bdf_filename, bdf_filename_out, tol, renumber_nodes=False, neq_max=4, xref=True, node_set=None, size=8, is_double=False, remove_collapsed_elements=False, avoid_collapsed_elements=False, crash_on_collapse=False, log=None, debug=True)[source]

Equivalences nodes; keeps the lower node id; creates two nodes with the same

Parameters:
bdf_filename : str / BDF

str : bdf file path BDF : a BDF model that is fully valid (see xref)

bdf_filename_out : str

a bdf_filename to write

tol : float

the spherical tolerance

renumber_nodes : bool

should the nodes be renumbered (default=False)

neq_max : int

the number of “close” points (default=4)

xref : bool

does the model need to be cross_referenced (default=True; only applies to model option)

node_set : List[int] / (n, ) ndarray; default=None

the list/array of nodes to consider (not supported with renumber_nodes=True)

size : int; {8, 16}; default=8

the bdf write precision

is_double : bool; default=False

the field precision to write

remove_collapsed_elements : bool; default=False (unsupported)
True : 1D/2D/3D elements will not be collapsed;

CELASx/CDAMP/MPC/etc. are not considered

False : no elements will be removed

avoid_collapsed_elements : bool; default=False (unsupported)
True : only collapses that don’t break 1D/2D/3D elements will be considered;

CELASx/CDAMP/MPC/etc. are considered

False : element can be collapsed

crash_on_collapse : bool; default=False
stop if nodes have been collapsed

False: blindly move on True: rereads the BDF which catches doubled nodes (temporary);

in the future collapse=True won’t need to double read; an alternative is to do Patran’s method of avoiding collapse)

debug : bool

bdf debugging

log : logger(); default=None

bdf logging

Returns:
model : BDF()

The BDF model corresponding to bdf_filename_out

Warning

I doubt SPOINTs/EPOINTs work correctly ..

Warning

xref not fully implemented (assumes cid=0) ..

Todo

node_set stil does work on the all the nodes in the big kdtree loop, which is very inefficient

Todo

remove_collapsed_elements is not supported ..

Todo

avoid_collapsed_elements is not supported ..

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

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

pyNastran.bdf.mesh_utils.bdf_merge._assemble_mapper(mappers, mapper_0, data_members, mapper_renumber=None)[source]

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

Parameters:
mappers : List[mapper]
mapper : dict[key] : value
key : ???

???

value : ???

???

mapper_0 : mapper
key : ???

???

value : ???

???

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

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

]

mapper_renumber : dict[key]: value; default=None
key : str

a BDF attribute

value : dict[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_all : List[mappers]

One mapper for each bdf_filename

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

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

pyNastran.bdf.mesh_utils.bdf_merge._dicts_key_to_key(dictionaries)[source]

creates a dummy map from the nominal key to the nominal key for multiple input dictionaries

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

Get the mapper for the first model.

Parameters:
model : BDF()

the bdf model object

Returns:
mapper : dict[key]: value
key : str

a BDF attribute

value : dict[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_renumber)[source]

Renumbers a mapper

Parameters:
mapper_0 : dict[key]: value
key : str

a BDF attribute

value : dict[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:
mapper : dict[map_type]
map_type : ???

???

sub_mapper : dict[key] : value
key : ???

???

value : ???

???

pyNastran.bdf.mesh_utils.bdf_merge.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)[source]

Merges multiple BDF into one file

Parameters:
bdf_filenames : List[str]

list of bdf filenames

bdf_filename_out : str / None

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

renumber : bool

should the bdf be renumbered (default=True)

encoding : str

the unicode encoding (default=None; system default)

size : int; {8, 16}; default=8

the bdf write precision

is_double : bool; default=False

the field precision to write

cards_to_skip : List[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_deck : bool, optional, default

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

Returns:
model : BDF

Merged model.

mappers_all : List[mapper]
mapper : Dict[bdf_attribute] : old_id_to_new_id_dict

List of mapper dictionaries of original ids to merged

bdf_attribute : str

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

old_id_to_new_id_dict : dict[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 ..

bdf_renumber Module

defines:
bdf_renumber(bdf_filename, bdf_filename_out, size=8, is_double=False,
starting_id_dict=None, round_ids=False, cards_to_skip=None, log=None, debug=False)
superelement_renumber(bdf_filename, bdf_filename_out=None, size=8, is_double=False,
starting_id_dict=None, cards_to_skip=None, log=None, debug=False)
pyNastran.bdf.mesh_utils.bdf_renumber._create_mid_map(model, mid)[source]

builds the mid_map

pyNastran.bdf.mesh_utils.bdf_renumber._create_nid_maps(model, starting_id_dict, nid)[source]

builds the nid_maps

pyNastran.bdf.mesh_utils.bdf_renumber._get_bdf_model(bdf_filename, cards_to_skip=None, log=None, debug=False)[source]

helper method

pyNastran.bdf.mesh_utils.bdf_renumber._update_case_control(model, mapper)[source]

Updates the case control deck; helper method for bdf_renumber.

Parameters:
model : BDF()

the BDF object

mapper : dict[str] = List[int]

Defines the possible case control header values for each entry (e.g. LOAD)

pyNastran.bdf.mesh_utils.bdf_renumber._update_case_key(key, elemental_quantities, seti2, eid_map, nid_map)[source]

Updates a Case Control SET card. A set may have an elemental result or a nodal result.

pyNastran.bdf.mesh_utils.bdf_renumber._update_coords(model, starting_id_dict, cid, cid_map)[source]

updates the coords

pyNastran.bdf.mesh_utils.bdf_renumber._update_elements(model, starting_id_dict, eid, eid_map, mass_id_map, rigid_elements_map)[source]

updates the elements

pyNastran.bdf.mesh_utils.bdf_renumber._update_materials(unused_model, starting_id_dict, mid, mid_map, all_materials)[source]
pyNastran.bdf.mesh_utils.bdf_renumber._update_mpcs(model, starting_id_dict, mpc_id, mpc_map)[source]

updates the mpcs

pyNastran.bdf.mesh_utils.bdf_renumber._update_nodes(model, starting_id_dict, nid, nid_map)[source]

updates the nodes

pyNastran.bdf.mesh_utils.bdf_renumber._update_properties(model, starting_id_dict, pid, properties_map, properties_mass_map)[source]

updates the properties

pyNastran.bdf.mesh_utils.bdf_renumber._update_spcs(model, starting_id_dict, spc_id, spc_map)[source]

updates the spcs

pyNastran.bdf.mesh_utils.bdf_renumber._write_bdf(model, bdf_filename_out, size=8, is_double=False)[source]

helper method

pyNastran.bdf.mesh_utils.bdf_renumber.bdf_renumber(bdf_filename, bdf_filename_out, size=8, is_double=False, starting_id_dict=None, round_ids=False, cards_to_skip=None, log=None, debug=False)[source]

Renumbers a BDF

Parameters:
bdf_filename : str / BDF

str : a bdf_filename (string; supported) BDF : a BDF model that has been cross referenced and is fully valid (an equivalenced deck is not valid)

bdf_filename_out : str / None

str : a bdf_filename to write None : don’t write the BDF

size : int; {8, 16}; default=8

the bdf write precision

is_double : bool; default=False

the field precision to write

starting_id_dict : dict, None (default=None)

None : renumber everything starting from 1 dict : {key : starting_id}

key : str

the key (e.g. eid, nid, cid, …)

starting_id : int, None

int : the value to start from None : don’t renumber this key

round_ids : bool; default=False

Should a rounding up be applied for each variable? This makes it easier to read a deck and verify that it’s been renumbered properly. This only really applies when starting_id_dict is None

cards_to_skip : List[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).

Returns:
model : BDF()

a renumbered BDF object corresponding to bdf_filename_out

mapper : Dict[bdf_attribute]

List of mapper dictionaries of original ids to merged bdf_attribute : str

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

old_id_to_new_id_dict : dict[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, …

}

Todo

bdf_model option for bdf_filename hasn’t been tested ..

Todo

add support for subsets (e.g. renumber only a subset of nodes/elements) ..

Todo

doesn’t support partial renumbering ..

Todo

doesn’t support element material coordinate systems ..

..warning :: spoints might be problematic…check
..warning :: still in development, but it usually brutally crashes

if it’s not supported

..warning :: be careful of card unsupported cards (e.g. ones not read in)
Supports
  • GRIDs - no superelements

  • COORDx

  • elements
    • CELASx/CONROD/CBAR/CBEAM/CQUAD4/CTRIA3/CTETRA/CPENTA/CHEXA
    • RBAR/RBAR1/RBE1/RBE2/RBE3/RSPLINE/RSSCON
  • properties
    • PSHELL/PCOMP/PCOMPG/PSOLID/PSHEAR/PBAR/PBARL PROD/PTUBE/PBEAM
  • mass
    • CMASSx/CONMx/PMASS
  • aero - FLFACT - SPLINEx - FLUTTER

  • partial case control - METHOD/CMETHOD/FREQENCY - LOAD/DLOAD/LSEQ/LOADSET…LOADSET/LSEQ is iffy - SET cards

    • nodes
    • elements
    • SPC/MPC/FLUTTER/FLFACT
  • constraints
    • SPC/SPCADD/SPCAX/SPCD
    • MPC/MPCADD
    • SUPORT/SUPORT1
  • solution control/methods
    • TSTEP/TSTEPNL
    • NLPARM
    • EIGB/EIGC/EIGRL/EIGR
  • sets
    • USET
  • other
    • tables
    • materials
    • loads/dloads
Not Done
  • SPOINT
  • any cards with SPOINTs - DMIG/DMI/DMIJ/DMIJI/DMIK/etc. - CELASx - CDAMPx
  • superelements
  • aero cards - CAEROx - PAEROx
  • thermal cards?
  • optimization cards
  • SETx
  • PARAM,GRDPNT,x; where x>0
  • GRID SEID
  • case control - STATSUB - SUBCASE - global SET cards won’t be renumbered properly

Examples

Renumber Everything; Start from 1

>>> bdf_renumber(bdf_filename, bdf_filename_out, size=8, is_double=False,
                 round_ids=False)

Renumber Everything; Start Material IDs from 100

>>> starting_id_dict = {
    'mid' : 100,
}
>>> bdf_renumber(bdf_filename, bdf_filename_out, size=8, is_double=False,
                 starting_ids_dict=starting_ids_dict, round_ids=False)

Only Renumber Material IDs

>>> starting_id_dict = {
    'cid' : None,
    'nid' : None,
    'eid' : None,
    'pid' : None,
    'mid' : 1,
    'spc_id' : None,
    'mpc_id' : None,
    'load_id' : None,
    'dload_id' : None,
‘method_id’ : None, ‘cmethod_id’ : None, ‘spline_id’ : None, ‘table_id’ : None, ‘flfact_id’ : None, ‘flutter_id’ : None, ‘freq_id’ : None, ‘tstep_id’ : None, ‘tstepnl_id’ : None, ‘suport_id’ : None, ‘suport1_id’ : None, ‘tf_id’ : None, ‘set_id’ : None,

} >>> bdf_renumber(bdf_filename, bdf_filename_out, size=8, is_double=False,

starting_ids_dict=starting_ids_dict, round_ids=False)
pyNastran.bdf.mesh_utils.bdf_renumber.get_renumber_starting_ids_from_model(model)[source]

Get the starting ids dictionary used for renumbering with ids greater than those in model.

Parameters:
model : BDF

BDF object to get maximum ids from.

Returns:
starting_id_dict : dict {str

Dictionary from id type to starting id.

pyNastran.bdf.mesh_utils.bdf_renumber.get_starting_ids_dict_from_mapper(model, mapper)[source]
pyNastran.bdf.mesh_utils.bdf_renumber.superelement_renumber(bdf_filename, bdf_filename_out=None, size=8, is_double=False, starting_id_dict=None, cards_to_skip=None, log=None, debug=False)[source]

Renumbers a superelement

Parameters:
bdf_filename : str / BDF

str : a bdf_filename (string; supported) BDF : a BDF model that has been cross referenced and is fully valid (an equivalenced deck is not valid)

bdf_filename_out : str / None

str : a bdf_filename to write None : don’t write the BDF

size : int; {8, 16}; default=8

the bdf write precision

is_double : bool; default=False

the field precision to write

starting_id_dict : dict, None (default=None)

None : renumber everything starting from 1 dict : {key : starting_id}

key : str

the key (e.g. eid, nid, cid, …)

starting_id : int, None

int : the value to start from None : don’t renumber this key

cards_to_skip : List[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).

Returns:
model : BDF()

a renumbered BDF object corresponding to bdf_filename_out

collapse_bad_quads Module

defines:
  • convert_bad_quads_to_tris(model, eids_to_check=None, xyz_cid0=None,
    min_edge_length=0.0)
pyNastran.bdf.mesh_utils.collapse_bad_quads.convert_bad_quads_to_tris(model, eids_to_check=None, xyz_cid0=None, min_edge_length=0.0)[source]

A standard quad is a nice rectangle. If an edge is collapsed, it’s a triangle. Change the element type.

Parameters:
model : BDF()

a BDF model that has not had it’s properties/load xref’d, but is valid such that it could

eids : list; (default=None -> all CQUAD4s)

the subset of element ids to check

xyz_cid0 : (n, 3) ndarray

nodes in cid=0

min_edge_length : float; default=0.0

what is classified as “short”

.. warning:: Don’t cross reference properties/loads
.. todo:: check for bad xref

convert Module

defines:
  • convert(model, units_to, units=None)
pyNastran.bdf.mesh_utils.convert._convert_aero(model, xyz_scale, time_scale, weight_scale)[source]
Converts the aero cards
  • CAEROx, PAEROx, SPLINEx, AECOMP, AELIST, AEPARAM, AESURF
Supports: AERO, AEROS, CAERO1, CAERO2, TRIM*, MONPNT1, FLUTTER FLFACT-rho/vel
GUST, AESURF, PAERO2

Skips: PAERO1, AESTAT, AESURFS, AECOMP, AELIST Doesn’t support:CAERO3-5, PAERO3-5, SPLINEx, AEPARAM, AELINK, AEPRESS, AEFORCE, *probably not done

pyNastran.bdf.mesh_utils.convert._convert_constraints(model, xyz_scale)[source]

Converts the spc/mpcs

Supports: SPC1, SPC, SPCAX Implicitly supports: MPC, MPCADD, SPCADD

pyNastran.bdf.mesh_utils.convert._convert_coordinates(model, xyz_scale)[source]

Converts the coordinate systems

Supports: CORD1x, CORD2x

pyNastran.bdf.mesh_utils.convert._convert_dconstr(model, dconstr, pressure_scale)[source]

helper for _convert_optimization

pyNastran.bdf.mesh_utils.convert._convert_desvars(desvars, scale)[source]

scales the DVPREL/DVCREL/DVMREL DESVAR values

pyNastran.bdf.mesh_utils.convert._convert_dvcrel1(dvcrel, xyz_scale)[source]

helper for _convert_optimization

pyNastran.bdf.mesh_utils.convert._convert_dvprel1(dvprel, xyz_scale, mass_scale, weight_scale)[source]

helper for _convert_optimization

pyNastran.bdf.mesh_utils.convert._convert_elements(model, xyz_scale, time_scale, mass_scale, weight_scale)[source]

Converts the elements

Supports: CTRIA3, CTRIA6, CTRIAR, CQUAD4, CQUAD8, CQUADR,
CELAS2, CELAS4, CDAMP2, CDAMP4, CBUSH, CONROD, CBAR, CBEAM, GENEL, CONM2, CMASS4
Skips : CELAS1, CELAS3, CDAMP3, CDAMP5, CCONEAX,
CROD, CTUBE, CVISC, CBUSH1D, CQUAD, CSHEAR, CTRIAX, CTRIAX6, CTETRA, CPENTA, CHEXA, CPYRAM, CMASS1, CMASS3,

NX Skips: CTRAX3, CTRAX6, CPLSTN3, CPLSTN6, CPLSTN4’, CPLSTN8, CQUADX4, CQUADX8 *intentionally

pyNastran.bdf.mesh_utils.convert._convert_loads(model, xyz_scale, time_scale, weight_scale, temperature_scale)[source]

Converts the loads

Supports:
  • dloads: RLOAD1*, TLOAD1*
  • loads: FORCE, FORCE1, FORCE2, MOMENT, MOMENT1, MOMENT2
    GRAV, ACCEL1, PLOAD, PLOAD1, PLOAD2, PLOAD4, RANDPS
  • combinations: DLOAD, LOAD
  • probably not done
pyNastran.bdf.mesh_utils.convert._convert_materials(model, xyz_scale, mass_scale, weight_scale, temperature_scale)[source]

Converts the materials

Supports: MAT1, MAT2, MAT3, MAT8, MAT9, MAT10, MAT11

pyNastran.bdf.mesh_utils.convert._convert_nodes(model, xyz_scale)[source]

Converts the nodes

Supports: GRID

pyNastran.bdf.mesh_utils.convert._convert_optimization(model, xyz_scale, mass_scale, weight_scale)[source]

Converts the optimization objects

Limited Support: DESVAR, DCONSTR, DVCREL1, DVPREL1

pyNastran.bdf.mesh_utils.convert._convert_pbar(prop, xyz_scale, area_scale, area_moi_scale, nsm_bar_scale)[source]

converts a PBAR

pyNastran.bdf.mesh_utils.convert._convert_pbeam(prop, xyz_scale, area_scale, area_moi_scale, nsm_bar_scale)[source]

converts a PBEAM

pyNastran.bdf.mesh_utils.convert._convert_pbeam3(prop, xyz_scale, area_scale, area_moi_scale, nsm_bar_scale)[source]

converts a PBEAM3

pyNastran.bdf.mesh_utils.convert._convert_pbush(prop, velocity_scale, mass_scale, stiffness_scale)[source]
pyNastran.bdf.mesh_utils.convert._convert_pbush1d(model, prop, xyz_scale, area_scale, mass_scale, damping_scale, stiffness_scale)[source]
pyNastran.bdf.mesh_utils.convert._convert_properties(model, xyz_scale, time_scale, mass_scale, weight_scale, temperature_scale)[source]

Converts the properties

Supports: PELAS, PDAMP, PDAMP5, PVISC, PROD, PBAR, PBARL, PBEAM, PBEAML,
PSHELL, PSHEAR, PCOMP, PCOMPG, PELAS, PTUBE, PBUSH, PCONEAX, PGAP, PBUSH1D

Skips : PSOLID, PLSOLID, PLPLANE, PIHEX

Skips are unscaled (intentionally)

pyNastran.bdf.mesh_utils.convert._get_dload_scale(dload, xyz_scale, velocity_scale, accel_scale, force_scale)[source]

LOAD asssumes force

pyNastran.bdf.mesh_utils.convert._scale_caero(caero, xyz_scale, xyz_aefacts)[source]
pyNastran.bdf.mesh_utils.convert._scale_term(name, coeffs, terms, scales)[source]
pyNastran.bdf.mesh_utils.convert._set_wtmass(model, gravity_scale)[source]

set the PARAM,WTMASS

ft-lbm-s-lbf-psf : 1. / 32.2 in-lbm-s-lbf-psi : 1. / (32.2*12) m-kg-s-N-Pa : 1. mm-Mg-s-N-Mpa : 1. in-slinch-s-lbf-psi : 1. ft-slug-s-lbf-psf : 1. in-slug-s-lbf-psi : 1 / 12.

1 slug * 1 ft/s^2 = 1 lbf 1 slinch * 1 in/s^2 = 1 lbf 1 slinch = 12 slug

F = m*a 386 lbf = 1 slinch * 386 * in/s^2 32 lbf = 1 slug * 32 * ft/s^2 1 N = 1 kg * 9.8 m/s^2

1 lbf = g_scale * 1 slinch * 1 in/s^2 1 lbf = g_scale * 12 slug * 1 in/s^2 –> g_scale = 1/12.

pyNastran.bdf.mesh_utils.convert._setup_scale_by_terms(scales, terms, quiet=False)[source]

determines the mass, length, time scaling factors

pyNastran.bdf.mesh_utils.convert.convert(model, units_to, units=None)[source]

Converts a model from a set of defined units

Parameters:
model : BDF

cross references the model (default=True)

units_to : List[str]

[length, mass, time] length = {in, ft, m, cm, mm} mass = {g, kg, Mg, lbm, slug, slinch} time = {s}

units : list

overwrites model.units

pyNastran.bdf.mesh_utils.convert.convert_length(length_from, length_to)[source]

Determines the length scale factor

We crate a gravity_scale_length for any non-standard unit (ft, m)

pyNastran.bdf.mesh_utils.convert.convert_mass(mass_from, mass_to, log)[source]

determines the mass, weight, gravity scale factor

We apply a gravity_scale_mass for any unit not {kg, slug}. Then we convert to N.

So for SI, if we have kg, we have a base unit, and the length is assumed to be m, so we have a consistent system and gravity_scale_mass is 1.0.

For lbm:
F = m*a 1 lbf = 1 lbm * 1 ft/s^2 32 lbf = 1 slug * 32 ft/s^2 gscale = 1/g F = gscale * m * a 1 lbf = gscale * 1 lbm * 32 ft/s^2 –> gscale = 1/32
For slug:
F = gscale * m * a 32 lbf = gscale * 1 slug * 32 ft/s^2 –> gscale = 1
For slinch:
F = gscale * m * a 386 lbf = gscale * 1 slinch * 12*32 in/s^2 1 slinch = 12 slug 12 in = 1 ft 386 lbf = gscale * 12 slug * 32 ft/s^2 –> gscale = 1

TODO: slinch/slug not validated

pyNastran.bdf.mesh_utils.convert.get_scale_factors(units_from, units_to, log)[source]

[length, mass, time] [in, lb, s]

pyNastran.bdf.mesh_utils.convert.scale_by_terms(bdf_filename, terms, scales, bdf_filename_out=None, encoding=None, log=None, debug=True)[source]

Scales a BDF based on factors for 3 of the 6 independent terms

Parameters:
bdf_filename : str / BDF()

a BDF filename

terms : List[str]; length=3

the names {M, L, T, F, P, V} mass, length, time, force, pressure, velocity

scales : List[float]; length=3

the scaling factors

bdf_filename_out : str; default=None

a BDF filename to write

Returns:
model : BDF()

the scaled BDF

pyNastran.bdf.mesh_utils.convert.scale_model(model, xyz_scale, mass_scale, time_scale, weight_scale, gravity_scale, convert_nodes=True, convert_elements=True, convert_properties=True, convert_materials=True, convert_aero=True, convert_constraints=True, convert_loads=True, convert_optimization=True)[source]

Performs the model scaling

delete_bad_elements Module

defines:
  • model = delete_bad_shells(model, max_theta=175., max_skew=70., max_aspect_ratio=100.,
    max_taper_ratio=4.0)
  • eids_to_delete = get_bad_shells(model, xyz_cid0, nid_map, max_theta=175., max_skew=70.,
    max_aspect_ratio=100., max_taper_ratio=4.0)
pyNastran.bdf.mesh_utils.delete_bad_elements.delete_bad_shells(model, min_theta=0.1, max_theta=175.0, max_skew=70.0, max_aspect_ratio=100.0, max_taper_ratio=4.0)[source]

Removes bad CQUAD4/CTRIA3 elements

Parameters:
model : BDF ()

this should be equivalenced

min_theta : float; default=0.1

the maximum interior angle (degrees)

max_theta : float; default=175.

the maximum interior angle (degrees)

max_skew : float; default=70.

the maximum skew angle (degrees)

max_aspect_ratio : float; default=100.

the max aspect ratio

taper_ratio : float; default=4.0

the taper ratio; applies to CQUAD4s only

pyNastran.bdf.mesh_utils.delete_bad_elements.element_quality(model, nids=None, xyz_cid0=None, nid_map=None)[source]

Gets various measures of element quality

Parameters:
model : BDF()

a cross-referenced model

nids : (nnodes, ) int ndarray; default=None

the nodes of the model in sorted order includes GRID, SPOINT, & EPOINTs

xyz_cid0 : (nnodes, 3) float ndarray; default=None

the associated global xyz locations

nid_map : Dict[nid]->index; default=None

a mapper dictionary

Returns:
quality : Dict[name]

Various quality metrics names : min_interior_angle, max_interior_angle, dideal_theta,

max_skew_angle, max_aspect_ratio, area_ratio, taper_ratio, min_edge_length

values : The result is np.nan if element type does not define

the parameter. For example, CELAS1 doesn’t have an aspect ratio.

Notes

  • pulled from nastran_io.py
pyNastran.bdf.mesh_utils.delete_bad_elements.get_bad_shells(model, xyz_cid0, nid_map, min_theta=0.1, max_theta=175.0, max_skew=70.0, max_aspect_ratio=100.0, max_taper_ratio=4.0)[source]

Get the bad shell elements

Parameters:
model : BDF()

the model object

xyz_cid0 : (N, 3) float ndarray

the xyz coordinates in cid=0

nid_map : dict[nid]
nid : int

the node id

index : int

the index of the node id in xyz_cid0

min_theta : float; default=0.1

the maximum interior angle (degrees)

max_theta : float; default=175.

the maximum interior angle (degrees)

max_skew : float; default=70.

the maximum skew angle (degrees)

max_aspect_ratio : float; default=100.

the max aspect ratio

taper_ratio : float; default=4.0

the taper ratio; applies to CQUAD4s only

Returns:
eids_failed : List[int]

element ids that fail the criteria

shells with a edge length=0.0 are automatically added
pyNastran.bdf.mesh_utils.delete_bad_elements.get_min_max_theta(faces, all_node_ids, nid_map, xyz_cid0)[source]

get the min/max thetas for CTETRA, CPENTA, CHEXA, CPYRAM

pyNastran.bdf.mesh_utils.delete_bad_elements.get_node_map(model)[source]

gets an nid->inid mapper

pyNastran.bdf.mesh_utils.delete_bad_elements.quad_quality(element, p1, p2, p3, p4)[source]

gets the quality metrics for a quad

pyNastran.bdf.mesh_utils.delete_bad_elements.tri_quality(p1, p2, p3)[source]

gets the quality metrics for a tri

export_mcids Module

Defines:
  • nodes, bars = export_mcids(bdf_filename, csv_filename=None)
pyNastran.bdf.mesh_utils.export_mcids._add_elements(nid, eid, nodes, bars, centroid, iaxis, jaxis, export_both_axes, export_xaxis)[source]

adds the element data

pyNastran.bdf.mesh_utils.export_mcids._export_coord_axes(nodes, bars, csv_filename)[source]

save the coordinate systems in a csv file

pyNastran.bdf.mesh_utils.export_mcids._export_quad(elem, nodes, iply, nid, eid, pids_failed, bars, export_both_axes, export_xaxis, consider_property_rotation)[source]
pyNastran.bdf.mesh_utils.export_mcids._export_tria(elem, nodes, iply, nid, eid, pids_failed, bars, export_both_axes, export_xaxis, consider_property_rotation)[source]

helper method for export_mcids

pyNastran.bdf.mesh_utils.export_mcids._get_elements(model, eids)[source]
pyNastran.bdf.mesh_utils.export_mcids._rotate_mcid(elem, pid_ref, iply, imat, jmat, normal, consider_property_rotation=True)[source]

rotates a material coordinate system

pyNastran.bdf.mesh_utils.export_mcids.export_mcids(bdf_filename, csv_filename=None, eids=None, export_xaxis=True, export_yaxis=True, iply=0, log=None, debug=False)[source]

Exports the element material coordinates systems for non-isotropic materials.

Parameters:
bdf_filename : str/BDF

a bdf filename or BDF model

csv_filename : str; default=None

str : the path to the output csv None : don’t write a CSV

eids : List[int]

the element ids to consider

export_xaxis : bool; default=True

export the x-axis

export_yaxis : bool; default=True

export the x-axis

iply : int; default=0

TODO: not validated the ply to consider

PSHELL

iply location —- ——–

0 mid1 or mid2 1 mid1 2 mid2 3 mid3 4 mid4

PCOMP/PCOMPG

iply location —- ——– 0 layer1 1 layer2

Returns:
nodes : (nnodes, 3) float list

the nodes

bars : (nbars, 2) int list

the “bars” that represent the x/y axes of the coordinate systems

mirror_mesh Module

This file defines:
  • model, nid_offset, eid_offset = bdf_mirror(bdf_filename, plane=’xz’)
  • model, nid_offset, eid_offset = write_bdf_symmetric(
    bdf_filename, out_filename=None, encoding=None, size=8, is_double=False, enddata=None, close=True, plane=’xz’)
  • model = make_symmetric_model(
    bdf_filename, plane=’xz’, zero_tol=1e-12, log=None, debug=True)
pyNastran.bdf.mesh_utils.mirror_mesh.__mirror_elements(model, mirror_model, nid_offset, eid_offset)[source]

mirrors model.elements

pyNastran.bdf.mesh_utils.mirror_mesh.__mirror_rigid_elements(model, mirror_model, nid_offset, eid_offset)[source]

mirrors model.rigid_elements

pyNastran.bdf.mesh_utils.mirror_mesh._asymmetrically_mirror_aero_coords(model, aero_cids_set, cid_offset, plane='xz')[source]

we’ll leave i the same, flip j, and invert k

pyNastran.bdf.mesh_utils.mirror_mesh._mirror_aero(model, nid_offset, plane)[source]

Mirrors the aero cards

Considers:
  • AEROS
  • doesn’t consider sideslip
  • CAERO1
  • doesn’t consider sideslip
  • considers Cp
  • considers lchord/lspan/nchord/nspan
  • SPLINE1 - handle boxes
  • SET1 - handle nodes
Doesnt consider:
  • AELIST
  • AESURF
  • AERO
  • AEFORCE
  • AEPRES
  • CAERO2/3/4/5
  • PAERO1/2/3/4/5
  • AESURFS
pyNastran.bdf.mesh_utils.mirror_mesh._mirror_elements(model, mirror_model, nid_offset, use_eid_offset=True)[source]

Mirrors the elements

elements:
0d : CELAS1, CELAS2, CELAS3, CELAS4, CDAMP1, CDAMP2, CDAMP3, CDAMP4, CDAMP5
CFAST, CBUSH, CBUSH1D

2d : CTRIA3, CQUAD4, CTRIA6, CQUAD8, CQUAD, CTRIAR, CQUADR 3d : ??? missing : CVISC, CTRIAX, CTRIAX6, CQUADX, CQUADX8, CCONEAX

rigid_elements:
loaded: RBE2, RBE3 missing: RBAR, RBAR1
mass_elements:
loaded: CONM2 missing CONM1, CMASS1, CMASS2, CMASS3, CMASS4

Notes

Doesn’t handle CBAR/CBEAM offsets Doesn’t handle CBEAM SPOINTs

pyNastran.bdf.mesh_utils.mirror_mesh._mirror_loads(model, nid_offset=0, eid_offset=0)[source]

Mirrors the loads. A mirrored force acts in the same direction.

Considers:
  • PLOAD4
    • no coordinate systems (assumes cid=0)
  • FORCE, FORCE1, FORCE2, MOMENT, MOMENT1, MOMENT2
  • PLOAD, PLOAD2
  • TEMP, QVOL, QHBDY, QBDY1, QBDY2, QBDY3
pyNastran.bdf.mesh_utils.mirror_mesh._mirror_nodes(model, plane='xz')[source]

Mirrors the GRIDs

Warning

doesn’t consider coordinate systems; it could, but you’d need 20 new coordinate systems

Warning

doesn’t mirror SPOINTs, EPOINTs

pyNastran.bdf.mesh_utils.mirror_mesh._mirror_nodes_plane(model, mirror_model, plane, use_nid_offset=True)[source]

Mirrors the GRIDs about an arbitrary plane

Parameters:
model : BDF

???

mirror_model : BDF

???

plane : str

???

use_nid_offset : bool

???

Returns:
nid_offset : int

the node id offset

plane : str

the sorted plane; ZX -> xz

Warning

doesn’t consider coordinate systems; it could, but you’d need 20 new coordinate systems

Warning

doesn’t mirror SPOINTs, EPOINTs ..

https://mathinsight.org/distance_point_plane
pyNastran.bdf.mesh_utils.mirror_mesh._plane_to_iy(plane)[source]

gets the index fo the mirror plane

pyNastran.bdf.mesh_utils.mirror_mesh.bdf_mirror(bdf_filename, plane='xz', log=None, debug=True)[source]

Mirrors the model about the symmetry plane

Parameters:
bdf_filename : str / BDF()

str : the bdf filename BDF : the BDF model object

plane : str; {‘xy’, ‘yz’, ‘xz’}; default=’xz’

the plane to mirror about xz : +y/-y yz : +x/-x xy : +z/-z

Returns:
model : BDF()

BDF : the BDF model object

nid_offset : int

the offset node id

eid_offset : int

the offset element id

pyNastran.bdf.mesh_utils.mirror_mesh.bdf_mirror_plane(bdf_filename, plane, mirror_model=None, log=None, debug=True, use_nid_offset=True)[source]

mirrors a model about an arbitrary plane

pyNastran.bdf.mesh_utils.mirror_mesh.get_model(bdf_filename, log=None, debug=True)[source]

helper method

pyNastran.bdf.mesh_utils.mirror_mesh.make_symmetric_model(bdf_filename, plane='xz', zero_tol=1e-12, log=None, debug=True)[source]

Makes a symmetric model from a full model

Parameters:
bdf_filename : str / BDF()

str : the bdf filename BDF : the BDF model object

plane : str; {‘xy’, ‘yz’, ‘xz’}; default=’xz’

the plane to mirror about xz : +y/-y yz : +x/-x xy : +z/-z

zaero_tol : float; default=1e-12

the symmetry plane tolerance

Returns:
model : BDF()

BDF : the BDF model object

## TODO: doesn’t handle elements straddling the centerline
pyNastran.bdf.mesh_utils.mirror_mesh.write_bdf_symmetric(bdf_filename, out_filename=None, encoding=None, size=8, is_double=False, enddata=None, close=True, plane='xz', log=None)[source]

Mirrors the model about the symmetry plane

Parameters:
bdf_filename : str / BDF()

str : the bdf filename BDF : the BDF model object

out_filename : varies; default=None

str - the name to call the output bdf file - a file object StringIO() - a StringIO object None - pops a dialog

encoding : str; default=None -> system specified encoding

the unicode encoding latin1, and utf8 are generally good options

size : int; {8, 16}

the field size

is_double : bool; default=False

False : small field True : large field

enddata : bool; default=None

bool - enable/disable writing ENDDATA None - depends on input BDF

close : bool; default=True

should the output file be closed

plane : str; {‘xy’, ‘yz’, ‘xz’}; default=’xz’

the plane to mirror about xz : +y/-y yz : +x/-x xy : +z/-z

Returns:
model : BDF()

BDF : the BDF model object

nid_offset : int

the offset node id

eid_offset : int

the offset element id

Notes

Updates the BDF object to be symmetric
  • see bdf_mirror if you don’t want to write the model

Doesn’t equivalence nodes on the centerline.

Considers
  • nodes : GRID
  • elements, rigid_elements, mass_elements : see _mirror_elements
  • loads : see _mirror_loads
  • aero cards : see _mirror_aero

extract_bodies Module

defines:
  • extract_bodies(bdf_filename)
pyNastran.bdf.mesh_utils.extract_bodies.extract_bodies(bdf_filename, mpc_id=0)[source]

Finds the isolated bodies

Parameters:
bdf_filename : str/BDF

str : the path the the *.bdf file BDF : a BDF() boject

mpc_id : int; default=0

0 : consider all MPCs >0 : use this MPC set not supported

Considers:
  • elements
  • rigid_elements
Doesn’t consider:
  • elements_mass
  • MPC
  • MPCADD
  • DMIx
Doesn’t support:
  • xref
  • duplicate element ids
  • large values

find_closest_nodes Module

defines:
  • nids_close = find_closest_nodes(nodes_xyz, nids, xyz_compare, neq_max, tol)
  • ieq = find_closest_nodes_index(nodes_xyz, xyz_compare, neq_max, tol)
pyNastran.bdf.mesh_utils.find_closest_nodes._not_equal_nodes_build_tree(nodes_xyz, xyz_compare, tol, neq_max=4, msg='')[source]

helper function for bdf_equivalence_nodes

Parameters:
nodes_xyz : (Nnodes, 3) float ndarray

the source points

xyz_compare : (Ncompare, 3) float ndarray

the xyz points to compare to

tol : float

the max spherical tolerance

neq_max : int; default=4

the number of close nodes

msg : str; default=’‘

error message

Returns:
kdt : cKDTree()

the kdtree object

ieq : int ndarray

The indices of nodes_xyz where the nodes in xyz_compare are close??? neq_max = 1:

(N, ) int ndarray

neq_max > 1:

(N, N) int ndarray

slots : int ndarray

The indices of nodes_xyz where the nodes in xyz_compare are close??? neq_max = 1:

(N, ) int ndarray

neq_max > 1:

(N, N) int ndarray

msg : str; default=’‘

error message

pyNastran.bdf.mesh_utils.find_closest_nodes.find_closest_nodes(nodes_xyz, nids, xyz_compare, neq_max=1, tol=None, msg='')[source]

Finds the closest nodes to an arbitrary set of xyz points

Parameters:
nodes_xyz : (Nnodes, 3) float ndarray

the source points (e.g., xyz_cid0)

nids : (Nnodes, ) int ndarray

the source node ids (e.g.; nid_cp_cid[:, 0])

xyz_compare : (Ncompare, 3) float ndarray

the xyz points to compare to; xyz_to_find

tol : float; default=None

the max spherical tolerance None : the whole model

neq_max : int; default=1.0

the number of “close” points

msg : str; default=’‘

custom message used for errors

Returns:
nids_close: (Ncompare, ) int ndarray

the close node ids

pyNastran.bdf.mesh_utils.find_closest_nodes.find_closest_nodes_index(nodes_xyz, xyz_compare, neq_max, tol, msg='')[source]

Finds the closest nodes to an arbitrary set of xyz points

Parameters:
nodes_xyz : (Nnodes, 3) float ndarray

the source points

xyz_compare : (Ncompare, 3) float ndarray

the xyz points to compare to

neq_max : int

the number of “close” points (default=4)

tol : float

the max spherical tolerance

msg : str; default=’‘

error message

Returns:
slots : (Ncompare, ) int ndarray

the indices of the close nodes corresponding to nodes_xyz

find_coplanar_elements Module

pyNastran.bdf.mesh_utils.find_coplanar_elements.find_coplanar_triangles(bdf_filename, eids)[source]

finds coplanar triangles

Parameters:
bdf_filename : str

the path to the bdf input file

eids : list

the element ids to consider

force_to_pressure Module

pyNastran.bdf.mesh_utils.force_to_pressure.force_to_pressure(bdf_filename, bdf_filename_out=None)[source]

converts FORCE cards to PLOAD4s for a shell model

free_edges Module

defines:
edges = free_edges(model, eids=None) edges = non_paired_edges(model, eids=None)
pyNastran.bdf.mesh_utils.free_edges._get_edge_to_eids_map(model, eids=None)[source]

helper method

pyNastran.bdf.mesh_utils.free_edges.free_edges(model, eids=None, maps=None)[source]

Gets the free edges for shell elements. A free edge is an edge that is only connected to 1 shell element.

Parameters:
model : BDF()

the BDF model

eids : List[int]; default=None

a subset of elements to consider

maps : List[…] (default=None -> calculate)
the output from _get_maps(eids, map_names=None,

consider_0d=False, consider_0d_rigid=False, consider_1d=False, consider_2d=True, consider_3d=False)

pyNastran.bdf.mesh_utils.free_edges.non_paired_edges(model, eids=None, maps=None)[source]

Gets the edges not shared by exactly 2 elements. This is useful for identifying rib/spar intersections.

Parameters:
model : BDF()

the BDF model

eids : List[int]; default=None

a subset of elements to consider

maps : List[…] (default=None -> calculate)
the output from _get_maps(eids, map_names=None,

consider_0d=False, consider_0d_rigid=False, consider_1d=False, consider_2d=True, consider_3d=False)

Returns:
non_paired_edges : List[(int nid1, int nid2), …]

the non-paired edges

free_faces Module

defines:
  • get_element_faces(model, element_ids=None)
  • get_solid_skin_faces(model)
  • write_skin_solid_faces(model, skin_filename,
    write_solids=False, write_shells=True, size=8, is_double=False, encoding=None)
pyNastran.bdf.mesh_utils.free_faces._write_shells(bdf_file, model, eid_set, face_map, eid_shell, pid_shell, mid_shell, mids_to_write)[source]

helper method for _write_skin_solid_faces

pyNastran.bdf.mesh_utils.free_faces._write_skin_solid_faces(model, skin_filename, face_map, nids_to_write, eids_to_write, mids_to_write, eid_set, eid_shell, pid_shell, mid_shell, write_solids=False, write_shells=True, size=8, is_double=False, encoding=None)[source]

helper method for write_skin_solid_faces

Parameters:
model : BDF()

the BDF object

skin_filename : str

the file to write

face_map : dict[sorted_face]

sorted_face : List[int, int, int] / List[int, int, int, int] face : List[int, int, int] / List[int, int, int, int]

nids_to_write : List[int, int, …]

list of node ids to write

eids_to_write : List[int, int, …]

list of element ids to write

mids_to_write : List[int, int, …]

list of material ids to write

eid_set : Set[int]

is the type right???

eid_shell : int

the next id to use for the shell id

pid_shell : int

the next id to use for the shell property

mid_shell : int

the next id to use for the shell material

write_solids : bool; default=False

write solid elements that have skinned faces

write_shells : bool; default=True

write shell elements

size : int; default=/8

the field width

is_double : bool; default=False

double precision flag

encoding : str; default=None -> system default

the string encoding

pyNastran.bdf.mesh_utils.free_faces.get_element_faces(model, element_ids=None)[source]

Gets the elements and faces that are skinned from solid elements. This includes internal faces.

Parameters:
model : BDF()

the BDF object

element_ids : List[int] / None

skin a subset of element faces default=None -> all elements

Returns:
eid_faces : (int, List[(int, int, …)])

value1 : element id value2 : face

pyNastran.bdf.mesh_utils.free_faces.get_solid_skin_faces(model)[source]

Gets the elements and faces that are skinned from solid elements This doesn’t include internal faces.

Parameters:
model : BDF()

the BDF object

Returns:
eid_set : Dict[tuple(int, int, …)] = List[int]

key : sorted face value : list of element ids with that face

face_map : Dict[tuple(int, int, …)] = List[int]

key : sorted face value : unsorted face

pyNastran.bdf.mesh_utils.free_faces.main()[source]

docopt interface

pyNastran.bdf.mesh_utils.free_faces.write_skin_solid_faces(model, skin_filename, write_solids=False, write_shells=True, size=8, is_double=False, encoding=None, punch=False, log=None)[source]

Writes the skinned elements

Parameters:
model : BDF() or str

BDF : the BDF object str : bdf_filename and the read_bdf method is called

skin_filename : str

the file to write

write_solids : bool; default=False

write solid elements that have skinned faces

write_shells : bool; default=False

write shell elements

size : int; default=8

the field width

is_double : bool; default=False

double precision flag

encoding : str; default=None -> system default

the string encoding

log : logger; default=None

a python logging object

punch : bool; default=False

is this a punch file; should be used by the read_bdf if model is a string unused

get_oml Module

defines:
  • eids_oml = get_oml_eids(bdf_filename, eid_start, theta_tol=30.,
    is_symmetric=True, consider_flippped_normals=True)
pyNastran.bdf.mesh_utils.get_oml.get_oml_eids(bdf_filename, eid_start, theta_tol=30.0, is_symmetric=True, consider_flippped_normals=True)[source]

extracts the OML faces (outer mold line)

Parameters:
bdf_filename : str or BDF()

the bdf filename

eid_start : int

the element to start from

theta_tol : float; default=30.

the angular tolerance in degrees

is_symmetric : bool; default=True

is the y=0 plane considered to be part of the OML

consider_flippped_normals : bool; default=True

if you extracted the free faces from tets, you can get flipped normals this considers a 180 degree error to be 0.0, which will cause other problems

pyNastran.bdf.mesh_utils.get_oml.main()[source]

runs the test problem

remove_unused Module

defines some methods for cleaning up a model
  • model = remove_unused(bdf_filename, remove_nids=True, remove_cids=True,
    remove_pids=True, remove_mids=True)
pyNastran.bdf.mesh_utils.remove_unused._remove(model, nids_used, cids_used, pids_used, pids_mass_used, mids_used, spcs_used, mpcs_used, pconv_used, tableht_used, tableh1_used, unused_desvars_used, remove_nids=True, remove_cids=True, remove_pids=True, remove_mids=True, remove_spcs=True, remove_mpcs=True, unused_remove_desvars=True)[source]

actually removes the cards

pyNastran.bdf.mesh_utils.remove_unused._remove_thermal(model, pconv_used, tableht_used, tableh1_used)[source]

removes some thermal cards

pyNastran.bdf.mesh_utils.remove_unused._store_dresp1(model, ids, nids_used, pids_used)[source]

helper for remove_unused

pyNastran.bdf.mesh_utils.remove_unused._store_elements(card_type, model, ids, nids_used, pids_used, mids_used, cids_used)[source]
pyNastran.bdf.mesh_utils.remove_unused._store_loads(model, unused_card_type, unused_ids, nids_used, eids_used, cids_used)[source]

helper for remove_unused

pyNastran.bdf.mesh_utils.remove_unused._store_masses(card_type, model, ids, nids_used, pids_mass_used, cids_used)[source]

handles masses

pyNastran.bdf.mesh_utils.remove_unused._store_nsm(model, ids, pids_used)[source]

helper for remove_unused

pyNastran.bdf.mesh_utils.remove_unused.remove_unused(bdf_filename, remove_nids=True, remove_cids=True, remove_pids=True, remove_mids=True)[source]

Takes an uncross-referenced bdf and removes unused data

removes unused:
  • nodes
  • properties
  • materials
  • coords

split_cbars_by_pin_flag Module

defines:
  • model, pin_flag_map = split_cbars_by_pin_flag(
    bdf_filename, pin_flags_filename=None, bdf_filename_out=None)
pyNastran.bdf.mesh_utils.split_cbars_by_pin_flag.split_cbars_by_pin_flag(bdf_filename, pin_flags_filename=None, bdf_filename_out=None, debug=False)[source]

Splits bar elements if they have a pin flag. That way you can each side of the element (A/B) a unique color based on the pin flag. This doesn’t split non-pin flagged bars.

Parameters:
bdf_filename : str; BDF

str : use the read_bdf method BDF : assume it’s a model

pin_flags_filename : str; default=None

the pin flag file to write this is optional as you may need to define your own map

bdf_filename_out : str; default=None

write the updated deck

debug : bool/None; default=True
used to set the logger if no logger is passed in

True: logs debug/info/error messages False: logs info/error messages None: logs error messages

Returns:
model : BDF()

the BDF object

pin_flag_map : dict[eid]
eid : int

the element id

pin_flag : int

the bar pin flag

pyNastran.bdf.mesh_utils.split_cbars_by_pin_flag.write_pin_flag_map(pin_flag_map, pin_flags_filename)[source]

writes the pin flag map

split_elements Module

defines:
  • split_line_elements(bdf_model, eids, neids=2,
    eid_start=1, nid_start=1)
pyNastran.bdf.mesh_utils.split_elements.split_elements(bdf_filename)[source]

unimplemented method for splitting elements

pyNastran.bdf.mesh_utils.split_elements.split_line_elements(bdf_model, eids, neids=2, eid_start=1, nid_start=1)[source]

Splits a set of element ids

Parameters:
eids : List[int]

element ids to split

neids : int; default=5

how many elements should a single bar be split into min=2

eid_start : int; default=1

the starting element id

nid_start : int; default=1

the starting node id

Returns:
eids_out : List[int]

the list of elements that have been added

eid_end : int; default=1

the final element id

nid_end : int; default=1

the final node id

A—–*—–B; neids=2
A–*–B; neids=4

utils Module

defines:
bdf merge (IN_BDF_FILENAMES)… [-o OUT_BDF_FILENAME]
bdf equivalence IN_BDF_FILENAME EQ_TOL
bdf renumber IN_BDF_FILENAME [-o OUT_BDF_FILENAME]
bdf mirror IN_BDF_FILENAME [-o OUT_BDF_FILENAME] [–plane PLANE] [–tol TOL]
bdf export_mcids IN_BDF_FILENAME [-o OUT_GEOM_FILENAME]
bdf split_cbars_by_pin_flags IN_BDF_FILENAME [-o OUT_BDF_FILENAME]

pyNastran.bdf.mesh_utils.utils._union(xval, iunion, ix)[source]

helper method for filter

pyNastran.bdf.mesh_utils.utils.cmd_line(argv=None, quiet=False)[source]

command line interface to multiple other command line scripts

pyNastran.bdf.mesh_utils.utils.cmd_line_bin(argv=None, quiet=False)[source]

bins the model into nbins

pyNastran.bdf.mesh_utils.utils.cmd_line_convert(argv=None, quiet=False)[source]

command line interface to bdf_merge

pyNastran.bdf.mesh_utils.utils.cmd_line_create_vectorized_numbered(argv=None, quiet=False)[source]
pyNastran.bdf.mesh_utils.utils.cmd_line_equivalence(argv=None, quiet=False)[source]

command line interface to bdf_equivalence_nodes

pyNastran.bdf.mesh_utils.utils.cmd_line_export_caero_mesh(argv=None, quiet=False)[source]

command line interface to export_caero_mesh

pyNastran.bdf.mesh_utils.utils.cmd_line_export_mcids(argv=None, quiet=False)[source]

command line interface to export_mcids

pyNastran.bdf.mesh_utils.utils.cmd_line_filter(argv=None, quiet=False)[source]

command line interface to bdf filter

pyNastran.bdf.mesh_utils.utils.cmd_line_merge(argv=None, quiet=False)[source]

command line interface to bdf_merge

pyNastran.bdf.mesh_utils.utils.cmd_line_mirror(argv=None, quiet=False)[source]

command line interface to write_bdf_symmetric

pyNastran.bdf.mesh_utils.utils.cmd_line_renumber(argv=None, quiet=False)[source]

command line interface to bdf_renumber

pyNastran.bdf.mesh_utils.utils.cmd_line_scale(argv=None, quiet=False)[source]
pyNastran.bdf.mesh_utils.utils.cmd_line_split_cbars_by_pin_flag(argv=None, quiet=False)[source]

command line interface to split_cbars_by_pin_flag

pyNastran.bdf.mesh_utils.utils.cmd_line_transform(argv=None, quiet=False)[source]

command line interface to export_caero_mesh