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