当前位置: 首页>>代码示例>>Python>>正文


Python PBEAM.add_op2_data方法代码示例

本文整理汇总了Python中pyNastran.bdf.bdf.PBEAM.add_op2_data方法的典型用法代码示例。如果您正苦于以下问题:Python PBEAM.add_op2_data方法的具体用法?Python PBEAM.add_op2_data怎么用?Python PBEAM.add_op2_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyNastran.bdf.bdf.PBEAM的用法示例。


在下文中一共展示了PBEAM.add_op2_data方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _read_pbeam

# 需要导入模块: from pyNastran.bdf.bdf import PBEAM [as 别名]
# 或者: from pyNastran.bdf.bdf.PBEAM import add_op2_data [as 别名]
    def _read_pbeam(self, data, n):
        """
        PBEAM(5402,54,262) - the marker for Record 14
        .. todo:: add object
        """
        struct1 = Struct(b(self._endian + '4if'))
        struct2 = Struct(b(self._endian + '16f'))
        struct3 = Struct(b(self._endian + '16f'))
        ntotal = 1072  # 44+12*84+20
        nproperties = (len(data) - n) // ntotal
        print('')
        #assert nproperties > 0, 'ndata-n=%s n=%s datai\n%s' % (len(data)-n, n, self.show_data(data[n:100+n]))
        ndata = len(data)
        while n < ndata:
        #while 1: #for i in range(nproperties):
            edata = data[n:n+20]
            n += 20
            data_in = list(struct1.unpack(edata))
            if self.is_debug_file:
                self.log.info('PBEAM pid=%s mid=%s nsegments=%s ccf=%s x=%s\n' % tuple(data_in))
            (pid, mid, nsegments, ccf, x) = data_in
            self.log.info('PBEAM pid=%s mid=%s nsegments=%s ccf=%s x=%s' % tuple(data_in))

            # Constant cross-section flag: 1=yes and 0=no
            # what is 2?
            assert ccf in [0, 1, 2], '  PBEAM pid=%s mid=%s nsegments=%s ccf=%s x=%s\n' % tuple(data_in)
            for i in range(11):
                edata = data[n:n+64]
                if len(edata) != 64:
                    endpack = []
                    raise RuntimeError('PBEAM unexpected length i=%s...' % i)
                n += 64
                pack = struct2.unpack(edata)
                (soi, xxb, a, i1, i2, i12, j, nsm, c1, c2,
                 d1, d2, e1, e2, f1, f2) = pack

                if soi == 0.0:
                    so_str = 'NO'
                elif soi == 1.0:
                    so_str = 'YES'
                else:
                    raise NotImplementedError('PBEAM pid=%s i=%s x/xb=%s soi=%s' % (pid, i, xxbi, soi))

                pack2 = (so_str, xxb, a, i1, i2, i12, j, nsm, c1, c2,
                         d1, d2, e1, e2, f1, f2)
                data_in.append(pack2)
                if self.is_debug_file:
                    self.binary_debug.write('     %s\n' % str(pack))
                self.log.info('    i=%-2s' % i + ' so=%s xxb=%.1f a=%g i1=%g i2=%g i12=%g j=%g nsm=%g '
                              'c=[%s,%s] d=[%s,%s] e=[%s,%s] f=[%s,%s]' % (tuple(pack2)))
            edata = data[n:n+64]
            if len(edata) != 64:
                endpack = []
                raise RuntimeError('PBEAM unexpected length 2...')
                #break
            else:
                endpack = struct3.unpack(edata)
                n += 64

            assert len(endpack) == 16, endpack
            (k1, k2, s1, s2, nsia, nsib, cwa, cwb, # 8
             m1a, m2a, m1b, m2b, n1a, n2a, n1b, n2b ) = endpack # 8 -> 16
            self.log.info('    k=[%s,%s] s=[%s,%s] nsi=[%s,%s] cw=[%s,%s] '
                          'ma=[%s,%s] mb=[%s,%s] na=[%s,%s] nb=[%s,%s]' % (tuple(endpack)))
            data_in.append(endpack)

            prop = PBEAM.add_op2_data(data_in)
            self._add_op2_property(prop)
        self.card_count['PBEAM'] = nproperties
        return n
开发者ID:FrankNaets,项目名称:pyNastran,代码行数:72,代码来源:ept.py


注:本文中的pyNastran.bdf.bdf.PBEAM.add_op2_data方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。