pyyeti.nastran.n2p.make_uset

pyyeti.nastran.n2p.make_uset(dof, nasset=0, xyz=None)[source]

Make a uset DataFrame

Parameters:
  • dof (1d or 2d array_like) – dof can be input in 2 different ways (as input to expanddof()):

    1. 1d array. Each element is assumed to be a GRID ID. All 6 DOF associated with the ID will be included in the output.

    2. 2d 2-column DOF array. Each row is: [ID, DOF]. Here, DOF specifies which degrees-of-freedom of the ID to find. The DOF can be input in the same way as Nastran accepts it: 0 or any combo of digits 1-6; eg, 123456 for all 6. For this routine, all 6 DOF are required for each GRID.

  • nasset (str, integer, or list_like of str or integers; optional) – Specifies the Nastran set membership. If string type, the function mkusetmask() is used to get the integer equivalent. Length must be 1 or equal the number of rows in dof.

  • xyz (2d array_like or None; optional) – Specifies the [‘x’, ‘y’, ‘z’] columns of the DataFrame (see pyyeti.nastran.op2.OP2.rdn2cop2() for description). If None, these columns are filled with NaNs. Otherwise, the number of rows must match the number of rows in dof (before expansion). For each GRID in dof that take up only one row (so that expanddof() will expand it to 6 rows), the corresponding row in xyz specifies the location in basic; the coordinate system information is set to be basic as well. For each GRID that is already expanded, the corresponding 6 rows in xyz specify location (in basic) and provides all the coordinate system information as described in pyyeti.nastran.op2.OP2.rdn2cop2().

Returns:

pandas DataFrame – A DataFrame similar to what is output by pyyeti.nastran.op2.OP2.rdn2cop2().

Raises:

ValueError – When the DOF for any GRID is not the complete set of 1-6. When the number of rows in xyz does not match the number of rows in dof (if xyz is not None). When the number of rows in nasset does not match the number of rows in dof (and is not 1).

Examples

Create a uset table with one GRID (id 1) in the b-set, and one SPOINT (id 2) in the q-set. The GRID is located at (1., 2., 3.) in basic. SPOINTs have no location, so (0., 0., 0.) is used for the SPOINT.

>>> from pyyeti.nastran import n2p
>>> n2p.make_uset(dof=[[1, 123456],
...                    [2, 0]],
...               nasset=['b',
...                       'q'],
...               xyz=[[1, 2, 3],
...                    [0, 0, 0]])
         nasset    x    y    z
id dof...
1  1    2097154  1.0  2.0  3.0
   2    2097154  0.0  1.0  0.0
   3    2097154  0.0  0.0  0.0
   4    2097154  1.0  0.0  0.0
   5    2097154  0.0  1.0  0.0
   6    2097154  0.0  0.0  1.0
2  0    4194304  0.0  0.0  0.0