Пример #1
0
 def _read_pload4(self, data, n):  ## inconsistent with DMAP
     """
     PLOAD4(7209,72,299) - the marker for Record 20
     """
     ntotal = 48  # 13*4
     nentries = (len(data) - n) // ntotal
     for i in range(nentries):
         edata = data[n:n + 48]
         #iiffffiiifffi   ssssssssssssssss
         out = unpack('2i 4f 3i 3f', edata)
         if self.is_debug_file:
             self.binary_debug.write('  PLOAD4=%s\n' % str(out))
         (sid, eid, p1, p2, p3, p4, g1, g34, cid, n1, n2, n3) = out
         #s1,s2,s3,s4,s5,s6,s7,s8,L1,L2,L3,L4,L5,L6,L7,L8
         #sdrlA = s1+s2+s3+s4
         #sdrlB = s5+s6+s7+s8
         #line_load_dirA = L1+L2+L3+L4
         #line_load_dirB = L5+L6+L7+L8
         sdrlA = None
         sdrlB = None
         line_load_dirA = None
         line_load_dirB = None
         load = PLOAD4.add_op2_data([
             sid, eid, [p1, p2, p3, p4], g1, g34, cid, [n1, n2, n3], sdrlA,
             sdrlB, line_load_dirA, line_load_dirB
         ])
         self._add_load_object(load)
         n += 48
     self.card_count['PLOAD4'] = nentries
     return n
Пример #2
0
    def _read_pload4_nx(self, data, n):  ## inconsistent with DMAP
        """
        PLOAD4(7209,72,299) - the marker for Record 20

        Word Name Type Description
        1 SID          I Load set identification number
        2 EID          I Element identification number
        3 P(4)        RS Pressures
        7 G1           I Grid point identification number at a corner of the face
        8 G34          I Grid point identification number at a diagonal from G1 or CTETRA corner
        9  CID         I Coordinate system identification number
        10 N(3)       RS Components of a vector coordinate system defined by CID
        """
        ntotal = 48  # 12*4
        nentries = (len(data) - n) // ntotal
        assert (len(data) - n) % ntotal == 0
        loads = []
        for i in range(nentries):
            edata = data[n:n + 48]
            out = unpack('2i 4f 3i 3f', edata)
            if self.is_debug_file:
                self.binary_debug.write('  PLOAD4=%s\n' % str(out))
            (sid, eid, p1, p2, p3, p4, g1, g34, cid, n1, n2, n3) = out

            surf_or_line = None
            line_load_dir = None
            load = PLOAD4.add_op2_data([
                sid, eid, [p1, p2, p3, p4], g1, g34, cid, [n1, n2, n3],
                surf_or_line, line_load_dir
            ])
            load.validate()
            loads.append(load)
            n += 48
        self.card_count['PLOAD4'] = nentries
        return n, loads
Пример #3
0
 def _read_pload4(self, data, n):  ## inconsistent with DMAP
     """
     PLOAD4(7209,72,299) - the marker for Record 20
     """
     #print("reading PLOAD4")
     ntotal = 48  # 13*4
     nentries = (len(data) - n) // ntotal
     for i in range(nentries):
         edata = data[n:n + 48]
                      #iiffffiiifffi   ssssssssssssssss
         out = unpack('2i4f3i3f', edata)
         if self.is_debug_file:
             self.binary_debug.write('  PLOAD4=%s\n' % str(out))
         (sid, eid, p1, p2, p3, p4, g1, g34, cid, n1, n2, n3) = out
         #s1,s2,s3,s4,s5,s6,s7,s8,L1,L2,L3,L4,L5,L6,L7,L8
         #sdrlA = s1+s2+s3+s4
         #sdrlB = s5+s6+s7+s8
         #ldirA = L1+L2+L3+L4
         #ldirB = L5+L6+L7+L8
         sdrlA = None
         sdrlB = None
         ldirA = None
         ldirB = None
         load = PLOAD4.add_op2_data(
             [sid, eid, [p1, p2, p3, p4], g1, g34,
              cid, [n1, n2, n3], sdrlA, sdrlB, ldirA, ldirB])
         self.add_load(load)
         n += 48
     self.card_count['PLOAD4'] = nentries
     return n
Пример #4
0
    def _read_pload4_msc(self, data, n):  ## inconsistent with DMAP
        """
        PLOAD4(7209,72,299) - the marker for Record 20

        Word Name Type Description
        1 SID          I Load set identification number
        2 EID          I Element identification number
        3 P(4)        RS Pressures
        7 G1           I Grid point identification number at a corner of the face
        8 G34          I Grid point identification number at a diagonal from G1 or CTETRA corner
        9  CID         I Coordinate system identification number
        10 N(3)       RS Components of a vector coordinate system defined by CID
        13 SDRL(2) CHAR4 Load set on element SURF or LINE
        15 LDIR(2) CHAR4 Load direction
        """
        ntotal = 64 * self.factor  # 16*4
        nentries = (len(data) - n) // ntotal
        assert (len(data) - n) % ntotal == 0
        loads = []
        if self.size == 4:
            s = Struct(self._endian + b'2i 4f 3i 3f 8s 8s')
        else:
            s = Struct(self._endian + b'2q 4d 3q 3d 16s 16s')

        for unused_i in range(nentries):
            edata = data[n:n + ntotal]
            out = s.unpack(edata)
            if self.is_debug_file:
                self.binary_debug.write('  PLOAD4=%s\n' % str(out))
            (sid, eid, p1, p2, p3, p4, g1, g34, cid, n1, n2, n3, surf_or_line,
             line_load_dir) = out

            surf_or_line = surf_or_line.rstrip().decode('latin1')
            line_load_dir = line_load_dir.rstrip().decode('latin1')
            if line_load_dir == '':
                # TODO: not 100%
                line_load_dir = 'NORM'

            # forces NX pload4 function to get called if it should be
            assert surf_or_line in ['SURF', 'LINE']
            assert line_load_dir in ['LINE', 'X', 'Y', 'Z', 'TANG', 'NORM'
                                     ], 'line_load_dir=%r' % line_load_dir

            load = PLOAD4.add_op2_data([
                sid, eid, [p1, p2, p3, p4], g1, g34, cid, [n1, n2, n3],
                surf_or_line, line_load_dir
            ])
            load.validate()
            loads.append(load)
            n += ntotal
        self.card_count['PLOAD4'] = nentries
        return n, loads