• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python fieldWriter.print_card_8函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pyNastran.bdf.fieldWriter.print_card_8函数的典型用法代码示例。如果您正苦于以下问题:Python print_card_8函数的具体用法?Python print_card_8怎么用?Python print_card_8使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: cart3d_to_nastran_filename

def cart3d_to_nastran_filename(cart3d_filename, bdf_filename, log=None, debug=False):
    """
    Converts a Cart3D file to STL format.

    :param cart3d_filename: path to the input Cart3D file
    :param bdf_filename:    path to the output BDF file
    :param log:             a logger object (or None)
    :param debug:           True/False (used if log is not defined)
    """
    cart3d = Cart3DReader(log=log, debug=debug)
    (nodes, elements, regions, loads) = cart3d.read_cart3d(cart3d_filename)

    #bdf = BDF()
    #bdf.nodes = cart3d.nodes
    #bdf.elements = cart3d.elements
    #bdf.write_bdf(bdf_filename)
    #return
    f = open(bdf_filename, 'wb')
    f.write('CEND\n')
    f.write('BEGIN BULK\n')
    f.write('$Nodes\n')

    i = 0
    nid = 1
    cid = 0
    for node in nodes:
        card = print_card_16(['GRID', nid, cid] + list(node))
        f.write(card)

    eid = 1
    f.write('$Elements\n')
    for (n1, n2, n3), pid in zip(elements, regions):
        card = print_card_8(['CTRIA3', eid, pid, n1, n2, n3])
        f.write(card)
        eid += 1

    t = 0.1
    E = 1e7
    nu = 0.3
    f.write('$Properties\n')
    for pid in unique(regions):
        mid = pid
        card = print_card_8(['PSHELL', pid, mid, t])
        f.write(card)
        card = print_card_8(['MAT1', mid, E, None, nu])
        f.write(card)
    f.write('ENDDATA\n')
    f.close()
开发者ID:umvarma,项目名称:pynastran,代码行数:48,代码来源:cart3d_to_nastran.py


示例2: write_bdf

 def write_bdf(self, f, size=8):
     card = ['SPCADD', self.spc_id] + self.spc_ids
     #print "card = ", card
     if size == 8:
         f.write(print_card_8(card))
     else:
         f.write(print_card_16(card))
开发者ID:umvarma,项目名称:pynastran,代码行数:7,代码来源:spcadd.py


示例3: write_bdf

 def write_bdf(self, f, size=8, is_double=False):
     if self.n:
         card = ['GRDSET', None, self.cp, None, None, None, self.cd, self.seid]
         if size == 8:
             f.write(print_card_8(card))
         else:
             f.write(print_card_16(card))
开发者ID:umvarma,项目名称:pynastran,代码行数:7,代码来源:grid.py


示例4: write_bdf

 def write_bdf(self, f, size=8):
     for comp, nodes in iteritems(self.components):
         card = ['SPC1', self.constraint_id, comp] + list(nodes)
         if size == 8:
             f.write(print_card_8(card))
         else:
             f.write(print_card_16(card))
开发者ID:umvarma,项目名称:pynastran,代码行数:7,代码来源:spc1.py


示例5: write_bdf

 def write_bdf(self, f, size=8, is_double=False):
     #..todo:: collapse the IDs
     if self.n:
         spoint = list(self.spoint)
         spoint.sort()
         card = ['SPOINT'] + collapse_thru(spoint)
         f.write(print_card_8(card))
开发者ID:umvarma,项目名称:pynastran,代码行数:7,代码来源:spoint.py


示例6: write_bdf

 def write_bdf(self, size=8, is_double=False):
     card = self.reprFields()
     if size == 8:
         return self.comment() + print_card_8(card)
     elif is_double:
         return self.comment() + print_card_double(card)
     return self.comment() + print_card_16(card)
开发者ID:umvarma,项目名称:pynastran,代码行数:7,代码来源:coordinateSystems.py


示例7: write_bdf

    def write_bdf(self, f, size=8, property_id=None):
        #print('PBARL.n = %s' % self.n)
        if self.n:
            if property_id is None:
                i = arange(self.n)
            else:
                i = searchsorted(self.property_id, property_id)
            #print('i = %s' % i)
            #cid = [cid if cid != 0 else '' for cid in self.coord_id]

            #group = set_blank_if_default(self.group, 'MSCBMLO')
            #list_fields = ['PBARL', self.pid, self.Mid(), group, self.Type, None,
                           #None, None, None] + self.dim + [self.nsm]

            #self.model.log.debug('*pbarl write pids=%s' % self.property_id)
            for (j, pid, mid, group, Type, nsm) in zip(count(), self.property_id[i], self.material_id[i],
                        self.group[i], self.Type[i], self.nsm[i]):
                dim = self.dim[j]
                sgroup = set_blank_if_default(group, 'MSCBMLO')

                list_fields = ['PBARL', pid, mid, group, Type, None,
                               None, None, None] + dim + [nsm]
                if size == 8:
                    f.write(print_card_8(list_fields))
                else:
                    f.write(print_card_16(list_fields))
开发者ID:umvarma,项目名称:pynastran,代码行数:26,代码来源:pbarl.py


示例8: write_bdf

    def write_bdf(self, f, size=8, element_ids=None):
        if self.n:
            if element_ids is None:
                i = arange(self.n)
            else:
                i = searchsorted(self.element_id, self.element_id)

            offt = 0
            ga = None
            gb = None
            x1 = None
            x2 = None
            x3 = None
            for (eid, pid, n, pin, wa, wb) in zip(self.element_id[i], self.property_id[i], self.node_ids[i],
                    self.pin_flags[i], self.wa[i], self.wb[i]):

                pa = set_blank_if_default(pin[0], 0)
                pb = set_blank_if_default(pin[1], 0)

                w1a = set_blank_if_default(wa[0], 0.0)
                w2a = set_blank_if_default(wa[1], 0.0)
                w3a = set_blank_if_default(wa[2], 0.0)
                w1b = set_blank_if_default(wb[0], 0.0)
                w2b = set_blank_if_default(wb[1], 0.0)
                w3b = set_blank_if_default(wb[2], 0.0)
                #(x1, x2, x3) = self.getX_G0_defaults()
                #offt = set_blank_if_default(offt, 'GGG')
                #list_fields = ['CBAR', self.eid, self.Pid(), self.Ga(), self.Gb(), x1, x2,
                #          x3, offt, pa, pb, w1a, w2a, w3a, w1b, w2b, w3b]
                card = ['CBEAM', eid, pid, n[0], n[1], x1, x2, x3, offt,
                        pa, pb, w1a, w2a, w3a, w1b, w2b, w3b]
                f.write(print_card_8(card))
开发者ID:sukhbinder,项目名称:cyNastran,代码行数:32,代码来源:cbeam.py


示例9: write_bdf

    def write_bdf(self, f, size, is_double, coord_id=None):
        assert size in [8, 16], size
        assert is_double in [True, False], is_double

        if self.n:
            #if coord_id is None:
            i = arange(self.n)
            #else:
                #assert len(unique(coord_id))==len(coord_id), unique(coord_id)
                #i = searchsorted(self.coord_id, coord_id)

            if size == 8:
                for cid, coord in iteritems(self.coords):
                    if cid > 0:
                        list_fields = [coord.type, cid, coord.rid] + list(coord.e1) + list(coord.e2) + list(coord.e3)
                        f.write(print_card_8(list_fields))
            else:
                if is_double:
                    for cid, coord in iteritems(self.coords):
                        if cid > 0:
                            list_fields = [coord.type, cid, coord.rid] + list(coord.e1) + list(coord.e2) + list(coord.e3)
                            f.write(print_card_16(list_fields))
                else:
                    for cid, coord in iteritems(self.coords):
                        if cid > 0:
                            list_fields = [coord.type, cid, coord.rid] + list(coord.e1) + list(coord.e2) + list(coord.e3)
                            f.write(print_card_double(list_fields))
开发者ID:umvarma,项目名称:pynastran,代码行数:27,代码来源:coord.py


示例10: write_bdf

 def write_bdf(self, f, size=8):
     card = ['NLPCI', self.nlpci_id, self.Type, self.minalr,
             self.maxalr, self.scale, None, self.desiter, self.mxinc]
     if size == 8:
         f.write(print_card_8(card))
     else:
         f.write(print_card_16(card))
开发者ID:umvarma,项目名称:pynastran,代码行数:7,代码来源:nlpci.py


示例11: write_bdf

    def write_bdf(self, f, size=8, element_ids=None):
        if self.n:
            if element_ids is None:
                i = arange(self.n)
            else:
                i = searchsorted(self.element_id, self.element_id)

            for (eid, pid, n, is_g0, g0, x, is_offt, offt, bit, pin, wa, wb, sa, sb) in zip(
                    self.element_id[i], self.property_id[i], self.node_ids[i],
                    self.is_g0[i], self.g0[i], self.x[i],
                    self.is_offt[i], self.offt[i], self.bit[i],
                    self.pin_flags[i], self.wa[i], self.wb[i], self.sa[i], self.sb[i]):

                x1 = g0 if is_g0 else x[0]
                x2 = 0 if is_g0 else x[1]
                x3 = 0 if is_g0 else x[2]
                offt_bit = offt if is_offt else bit
                #print('is_offt=%s offt=%s bit=%s offt_bit=%s' % (is_offt, offt, bit, offt_bit))

                pa = set_blank_if_default(pin[0], 0)
                pb = set_blank_if_default(pin[1], 0)

                w1a = set_blank_if_default(wa[0], 0.0)
                w2a = set_blank_if_default(wa[1], 0.0)
                w3a = set_blank_if_default(wa[2], 0.0)
                w1b = set_blank_if_default(wb[0], 0.0)
                w2b = set_blank_if_default(wb[1], 0.0)
                w3b = set_blank_if_default(wb[2], 0.0)

                sa = set_blank_if_default(sa, 0)
                sb = set_blank_if_default(sb, 0)
                card = ['CBEAM', eid, pid, n[0], n[1], x1, x2, x3, offt_bit,
                        pa, pb, w1a, w2a, w3a, w1b, w2b, w3b,
                        sa, sb]
                f.write(print_card_8(card))
开发者ID:umvarma,项目名称:pynastran,代码行数:35,代码来源:cbeam.py


示例12: write_bdf

    def write_bdf(self, f, size=8, element_ids=None):
        if self.n:
            if element_ids is None:
                i = arange(self.n)
            else:
                i = searchsorted(self.element_id, self.element_id)

            for (eid, pid, n, is_g0, g0, x, offt, pin, wa, wb) in zip(
                self.element_id[i], self.property_id[i], self.node_ids[i],
                self.is_g0[i], self.g0[i], self.x[i],
                self.offt[i],
                self.pin_flags[i], self.wa[i], self.wb[i]):

                pa = set_blank_if_default(pin[0], 0)
                pb = set_blank_if_default(pin[1], 0)

                w1a = set_blank_if_default(wa[0], 0.0)
                w2a = set_blank_if_default(wa[1], 0.0)
                w3a = set_blank_if_default(wa[2], 0.0)
                w1b = set_blank_if_default(wb[0], 0.0)
                w2b = set_blank_if_default(wb[1], 0.0)
                w3b = set_blank_if_default(wb[2], 0.0)
                x1 = g0 if is_g0 else x[0]
                x2 = 0 if is_g0 else x[1]
                x3 = 0 if is_g0 else x[2]

                offt = set_string8_blank_if_default(offt, 'GGG')
                card = ['CBAR', eid, pid, n[0], n[1], x1, x2, x3, offt,
                        pa, pb, w1a, w2a, w3a, w1b, w2b, w3b]
                if size == 8:
                    f.write(print_card_8(card))
                else:
                    f.write(print_card_16(card))
开发者ID:umvarma,项目名称:pynastran,代码行数:33,代码来源:cbar.py


示例13: write_bdf

 def write_bdf(self, f, size=8, property_id=None):
     if self.n:
         #print "PSOLID.property_id =", self.property_id
         for (pid, mid, stress) in zip(
              self.property_id, self.material_id, self.stress_strain):
             stress_strain = set_blank_if_default(stress_strain, 'GRID')
             card = ['PLSOLID', pid, mid, stress_strain]
             f.write(print_card_8(card))
开发者ID:umvarma,项目名称:pynastran,代码行数:8,代码来源:plsolid.py


示例14: write_bdf

 def write_bdf(self, f, size=8, is_double=False):
     #..todo:: collapse the IDs
     if self.n:
         card = ['EPOINT'] + list(self.epoint)
         if size == 8:
             f.write(print_card_8(card))
         else:
             f.write(print_card_16(card))
开发者ID:umvarma,项目名称:pynastran,代码行数:8,代码来源:epoint.py


示例15: test_print_card_8

    def test_print_card_8(self):
        self.assertEqual(print_card_8(['GRID',1]),'GRID           1\n')
        self.assertEqual(print_card_8(['GRID', 1, None, None, None, None, None,
                                     None, None, 1]),
                         'GRID           1\n               1\n',
                         print_card_8(['GRID', 1, None, None, None, None, None,
                                     None, None, 1]))

        self.assertEqual(print_card_8(['GRID', 1, None, None, None, None, None,
                                     None, None,
                                     1, None]),
                         'GRID           1\n               1\n',
                         print_card_8(['GRID', 1, None, None, None, None, None,
                                     None, None,
                                     1, None]))

        self.assertEqual(print_card_8(['GRID', 1, None, None, None, None, None,
                                     None, None,
                                     None,None,None,None,None,None,None,None,
                                     1, None]),
                         'GRID           1\n+\n               1\n',
                         print_card_8(['GRID', 1, None, None, None, None, None,
                                     None, None,
                                     None,None,None,None,None,None,None,None,
                                     1, None]))
开发者ID:sukhbinder,项目名称:cyNastran,代码行数:25,代码来源:test_field_writer.py


示例16: write_bdf

 def write_bdf(self, f, size=8):
     if self.n:
         n = 0
         for lid, t in zip(self.load_id, self.temperature_default):
             card = ['TEMPD', lid, t]
             if size == 8:
                 f.write(print_card_8(card))
             else:
                 f.write(print_card_16(card))
开发者ID:umvarma,项目名称:pynastran,代码行数:9,代码来源:temp.py


示例17: write_bdf

 def write_bdf(self, f, size=8, element_ids=None):
     if self.n:
         if element_ids is None:
             i = arange(self.n)
         else:
             i = searchsorted(self.element_id, element_ids)
         for (eid, pid, n) in zip(self.element_id[i], self.property_id[i], self.node_ids[i, :]):
             card = ['CPENTA', eid, pid, n[0], n[1], n[2], n[3], n[4], n[5]]
             f.write(print_card_8(card))
开发者ID:sukhbinder,项目名称:cyNastran,代码行数:9,代码来源:cpenta6.py


示例18: write_bdf

    def write_bdf(self, f, size, is_double):
        for acsid, rcsid, c, b, S, symXZ, symXY in zip(self.acsid,
            self.rcsid, self.cRef, self.bRef, self.SRef, self.symXZ, self.symXY):

            #symXZ = set_blank_if_default(self.symXZ, 0)
            #symXY = set_blank_if_default(self.symXY, 0)
            list_fields = ['AEROS', acsid, rcsid, c,
                  b, S, symXZ, symXY]
            f.write(print_card_8(list_fields))
开发者ID:umvarma,项目名称:pynastran,代码行数:9,代码来源:aeros.py


示例19: write_bdf

 def write_bdf(self, f, size=8, element_ids=None):
     if self.n:
         if element_ids is None:
             i = arange(self.n)
         else:
             assert len(unique(element_ids))==len(element_ids), unique(element_ids)
             i = searchsorted(self.element_id, element_ids)
         for (eid, pid, n) in izip(self.element_id[i], self.property_id[i], self.node_ids[i]):
             card = ['CTRIA3', eid, pid, n[0], n[1], n[2]]
             f.write(print_card_8(card))
开发者ID:sukhbinder,项目名称:cyNastran,代码行数:10,代码来源:ctria3.py


示例20: write_bdf

    def write_bdf(self, f, size=8, lids=None):
        if self.n:
            for (lid, nid, cid, mag, xyz) in zip(
                 self.load_id, self.node_id, self.coord_id, self.mag, self.xyz):

                card = ['MOMENT', lid, nid, cid, mag, xyz[0], xyz[1], xyz[2] ]
                if size == 8:
                    f.write(print_card_8(card))
                else:
                    f.write(print_card_16(card))
开发者ID:umvarma,项目名称:pynastran,代码行数:10,代码来源:moment.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python fieldWriter.set_blank_if_default函数代码示例发布时间:2022-05-25
下一篇:
Python fieldWriter.print_card函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap