def test_uset(self): """checks the USET/USET1 cards""" model = BDF(debug=False) uset1a = USET1('MYSET1', [1, 'THRU', 10], 4, comment='uset') fields = ['USET1', 'MYSET2', 5, 1, 2, 3, 4, 5, 6, 7, 8, 10, 9] model.add_card(fields, 'USET1', comment='uset1') model._add_uset_object(uset1a) #model._add_uset_object(uset1b) uset1a.write_card() #uset1b.write_card() useta = USET('MYSET3', [1, 2, 3, 4, 5], [5, 4, 3, 2, 1], comment='uset') fields = ['USET', 'MYSET4', 1, 2, 3, 4, 5, 5, 4, 3, 2, 1] model.add_card(fields, 'USET', comment='uset') model._add_uset_object(useta) nids = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] for nid in nids: model.add_grid(nid, [float(nid), 0., 0.]) useta.validate() model.validate() useta.write_card() save_load_deck(model, run_save_load_hdf5=True)
def _read_uset(self, data, n): """ USET(2010,20,193) - Record 63 (sid, nid, comp), ... """ s = Struct(b(self._endian + '3i')) ntotal = 12 #self.show_data(data, types='is') nelements = (len(data) - n) // ntotal for i in range(nelements): edata = data[n:n + ntotal] out = s.unpack(edata) if self.is_debug_file: self.binary_debug.write(' USET=%s\n' % str(out)) #(sid, id, component) = out set_obj = USET.add_op2_data(out) self._add_uset_object(set_obj) n += ntotal self.increase_card_count('USET', len(self.usets)) return n