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’)

pyNastran.bdf.mesh_utils.mirror_mesh.__mirror_elements(model: BDF, mirror_model: BDF, nid_offset: int, eid_offset: int, cid_offset: int, plane: str = 'xz') None[source]

mirrors model.elements

pyNastran.bdf.mesh_utils.mirror_mesh.__mirror_masses(model: BDF, mirror_model: BDF, nid_offset: int, eid_offset: int) None[source]

mirrors model.masses

pyNastran.bdf.mesh_utils.mirror_mesh.__mirror_mpcs(model: BDF, mirror_model: BDF, nid_offset: int) None[source]

mirrors model.rigid_elements

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

mirrors model.rigid_elements

pyNastran.bdf.mesh_utils.mirror_mesh._asymmetrically_mirror_coords(model: BDF, mirror_model: BDF, cids_nominal_set: set[int], cid_offset: int, plane: str = 'xz') None[source]

leave i the same, flip j, and invert k

TODO: doesn’t handle CORD1x

pyNastran.bdf.mesh_utils.mirror_mesh._asymmetrically_mirror_coords2(model: BDF, mirror_model: BDF, cids_nominal_set: set[int], cid_offset: int, plane: str = 'xz') None[source]

We’ll invert i, but not j, which will invert k.

This will allow us to mirror material coordinate systems (defined in x). Additionally, we can mirror CGAP coordinate systems (defined in x) as well as some arbitrary y-direction. We’ll try to make y look mirrored.

pyNastran.bdf.mesh_utils.mirror_mesh._get_cid_offset(model: BDF, use_cid_offset: bool) int[source]
pyNastran.bdf.mesh_utils.mirror_mesh._get_eid_offset(model: BDF, use_eid_offset: bool) int[source]
pyNastran.bdf.mesh_utils.mirror_mesh._mirror_aero(model: BDF, mirror_model: BDF, nid_offset: int, plane: str = 'xz') None[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

  • AELIST - handle boxes

  • AESURF - only supports names of length 7 or less (appends an M to the name) - handles AELIST - doesn’t handle coords well - doesn’t handle second AESURF

Doesnt consider:
  • AERO

  • AEFORCE

  • AEPRES

  • CAERO2/3/4/5

  • PAERO1/2/3/4/5

  • AESURFS

pyNastran.bdf.mesh_utils.mirror_mesh._mirror_elements(model: BDF, mirror_model: BDF, nid_offset: int, use_eid_offset: bool = True, plane: str = 'xz') int[source]

Mirrors the elements

Parameters:
modelBDF

the base model

modelBDF

the mirrored model

mirror_modelBDF

the mirrored model

nid_offsetint

the node id offset

use_eid_offsetbool; default=True

what is this for???

elements:
0dCELAS1, CELAS2, CELAS3, CELAS4, CDAMP1, CDAMP2, CDAMP3, CDAMP4, CDAMP5

CFAST, CBUSH, CBUSH1D

1d: CROD, CONROD, CTUBE, CBAR, CBEAM, CBEAM3 2d : CTRIA3, CQUAD4, CTRIA6, CQUAD8, CQUAD, CTRIAR, CQUADR 3d : ??? missing : CVISC, CTRIAX, CTRIAX6, CQUADX, CQUADX8, CCONEAX

rigid_elements:

loaded: RBE2, RBE3, RBAR missing: RBAR1

mass_elements:

loaded: CONM2 missing CONM1, CMASS1, CMASS2, CMASS3, CMASS4

plotels:

loaded: PLOTEL missing: ???

Notes

Doesn’t handle CBAR/CBEAM offsets Doesn’t handle CBEAM SPOINTs Do I need to invert the solids?

pyNastran.bdf.mesh_utils.mirror_mesh._mirror_loads(model: BDF, mirror_model: BDF, nid_offset: int = 0, eid_offset: int = 0) None[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, PLOAD4

  • TEMP, QVOL, QHBDY, QBDY1, QBDY2, QBDY3

pyNastran.bdf.mesh_utils.mirror_mesh._mirror_nodes(model: BDF, mirror_model: BDF, plane: str = 'xz') tuple[int, str][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: BDF, mirror_model: BDF, plane: ndarray[Any, dtype[float64]], use_nid_offset: bool = True) tuple[int, str][source]

Mirrors the GRIDs about an arbitrary plane

Parameters:
modelBDF

the original geometry

mirror_modelBDF

the location of the new geometry

plane(3,3) float ndarray

3 vectors that defines the origin, zaxis and xzplane; same as a CORD2R

use_nid_offsetbool

should the node offset be applied

Returns:
nid_offsetint

the node id offset

planestr

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: str) tuple[int, str][source]

gets the index fo the mirror plane

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

Mirrors the model about the symmetry plane

Parameters:
bdf_filenamestr / BDF()

str : the bdf filename BDF : the BDF model object

planestr; {‘xy’, ‘yz’, ‘xz’}; default=’xz’

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

Returns:
modelBDF()

BDF : the BDF model object

nid_offsetint

the offset node id

eid_offsetint

the offset element id

pyNastran.bdf.mesh_utils.mirror_mesh.bdf_mirror_plane(bdf_filename: str | BDF, plane: ndarray[Any, dtype[float64]], mirror_model=None, log=None, debug: bool = True, use_nid_offset: bool = True)[source]

mirrors a model about an arbitrary plane

pyNastran.bdf.mesh_utils.mirror_mesh.write_bdf_symmetric(bdf_filename: str | BDF, out_filename=None, encoding=None, size: int = 8, is_double: bool = False, enddata: bool | None = None, close: bool = True, plane: str = 'xz', log=None)[source]

Mirrors the model about the symmetry plane

Parameters:
bdf_filenamestr / BDF()

str : the bdf filename BDF : the BDF model object

out_filenamevaries; default=None

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

encodingstr; default=None -> system specified encoding

the unicode encoding latin1, and utf8 are generally good options

sizeint; {8, 16}

the field size

is_doublebool; default=False

False : small field True : large field

enddatabool; default=None

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

closebool; default=True

should the output file be closed

planestr; {‘xy’, ‘yz’, ‘xz’}; default=’xz’

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

Returns:
modelBDF()

BDF : the BDF model object

nid_offsetint

the offset node id

eid_offsetint

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