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


Python BDF.add_node方法代码示例

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


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

示例1: get_mass

# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.bdf.BDF import add_node [as 别名]
    def get_mass(self,nid1, nid2, xyz1, xyz2, eid, pid, mid, A, J, c, nsm, E, G, nu, rho, L):
        """tests a CROD and a CONROD"""
        model = BDF(debug=False)
        lines = ['conrod,%i, %i, %i, %i, %f, %f, %f, %f' % (eid, nid1, nid2, mid, A, J, c, nsm)]
        card = model.process_card(lines)
        card = BDFCard(card)
        conrod = CONROD(card)
        model.add_element(conrod)

        lines = ['crod,%i, %i, %i, %i' % (eid+1, pid, nid1, nid2)]
        card = model.process_card(lines)
        card = BDFCard(card)
        crod = CROD(card)
        model.add_element(crod)

        lines = ['ctube,%i, %i, %i, %i' % (eid+2, pid+1, nid1, nid2)]
        card = model.process_card(lines)
        card = BDFCard(card)
        ctube = CTUBE(card)
        model.add_element(ctube)

        lines = ['prod,%i, %i, %f, %f, %f, %f' % (pid, mid, A, J, c, nsm)]
        card = model.process_card(lines)
        card = BDFCard(card)
        prod = PROD(card)
        model.add_property(prod)

        #self.pid = integer(card, 1, 'pid')
        #self.mid = integer(card, 2, 'mid')
        #self.OD1 = double(card, 3, 'OD1')
        #self.t = double_or_blank(card, 4, 't', self.OD1 / 2.)
        #self.nsm = double_or_blank(card, 5, 'nsm', 0.0)
        #self.OD2 = double_or_blank(card, 6, 'OD2', self.OD1)
        OD1 = sqrt(4*A/pi)
        t = 0.
        OD2 = OD1
        lines = ['ptube,%i, %i, %f, %f, %f, %f' % (pid+1, mid, OD1, t, nsm, OD2)]
        card = model.process_card(lines)
        card = BDFCard(card)
        ptube = PTUBE(card)
        model.add_property(ptube)

        lines = ['mat1,%i, %.2e, %.2e, %f, %f' % (mid, E, G, nu, rho)]
        card = model.process_card(lines)
        card = BDFCard(card)
        card = MAT1(card)
        model.add_structural_material(card)

        lines = ['grid,%i, %i, %f, %f, %f' % (nid1, 0, xyz1[0], xyz1[1], xyz1[2])]
        card = model.process_card(lines)
        card = BDFCard(card)
        card = GRID(card)
        model.add_node(card)

        lines = ['grid,%i, %i, %f, %f, %f' % (nid2, 0, xyz2[0], xyz2[1], xyz2[2])]
        card = model.process_card(lines)
        card = BDFCard(card)
        card = GRID(card)
        model.add_node(card)

        model.cross_reference()
        mass = L * (rho * A + nsm)

        # conrod
        self.assertEquals(conrod.Eid(), eid)
        self.assertEquals(conrod.Pid(), None)
        self.assertEquals(conrod.Mid(), mid)
        self.assertEquals(conrod.Length(), L)
        self.assertEquals(conrod.Nsm(), nsm)
        self.assertEquals(conrod.Mass(), mass)
        self.assertEquals(conrod.E(), E)
        self.assertEquals(conrod.G(), G)
        self.assertEquals(conrod.Area(), A)
        self.assertEquals(conrod.J(), J)
        self.assertEquals(conrod.C(), c)
        self.assertEquals(conrod.Rho(), rho)

        # crod
        self.assertEquals(crod.Eid(), eid+1)
        self.assertEquals(crod.Pid(), pid)
        self.assertEquals(crod.Mid(), mid)
        self.assertEquals(crod.Length(), L)
        self.assertEquals(crod.Nsm(), nsm)
        self.assertEquals(crod.Mass(), mass)
        self.assertEquals(crod.E(), E)
        self.assertEquals(crod.G(), G)
        self.assertEquals(crod.Area(), A)
        self.assertEquals(crod.J(), J)
        self.assertEquals(crod.C(), c)
        self.assertEquals(crod.Rho(), rho)
        #self.assertEquals(crod.Nu(), nu)

        # prod
        self.assertEquals(prod.Pid(), pid)
        self.assertEquals(prod.Mid(), mid)
        self.assertEquals(prod.Nsm(), nsm)
        self.assertEquals(prod.E(), E)
        self.assertEquals(prod.G(), G)
        self.assertEquals(prod.Area(), A)
        self.assertEquals(prod.J(), J)
#.........这里部分代码省略.........
开发者ID:umvarma,项目名称:pynastran,代码行数:103,代码来源:test_rods.py

示例2: test_spline2

# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.bdf.BDF import add_node [as 别名]
    def test_spline2(self):
        """checks the SPLINE2 card"""
        #| SPLINE2 | EID  | CAERO |  ID1  |  ID2  | SETG | DZ | DTOR | CID |
        #|         | DTHX | DTHY  | None  | USAGE |      |    |      |     |
        #+---------+------+-------+-------+-------+------+----+------+-----+
        #| SPLINE2 |   5  |   8   |  12   | 24    | 60   | 0. | 1.0  |  3  |
        #|         |  1.  |       |       |       |      |    |      |     |

        cid = 3
        origin = [0., 0., 0.]
        xaxis = [1., 0., 0.]
        xyplane = [0., 1., 0.]
        coord = CORD2R.add_axes(cid, rid=0, origin=origin,
                                xaxis=xaxis, yaxis=None, zaxis=None,
                                xyplane=xyplane, yzplane=None, xzplane=None,
                                comment='comment')
        eid = 8
        pid = 10
        cp = 0
        nsb = 4
        nint = 2
        lsb = None
        lint = None
        p1 = [0., 0., 0.]
        x12 = 42.
        igid = None
        caero2 = CAERO2(eid, pid, igid, p1, x12,
                        cp=cp, nsb=nsb, nint=nint, lsb=lsb, lint=lint,
                        comment='this is a caero')
        #caero = CAERO2(eid, pid, cp, nsb, nint, lsb, lint, igid, p1, x12)

        sid = 60
        ids = [7, 13]
        set_obj = SET1(sid, ids, is_skin=False, comment='set card')
        grid7 = GRID(nid=7, cp=0, xyz=[7., 0., 0.], cd=0, ps='', seid=0, comment='')
        grid13 = GRID(nid=13, cp=0, xyz=[13., 0., 0.], cd=0, ps='', seid=0, comment='')

        model = BDF(log=None)
        model.add_coord(coord)
        model.add_caero(caero2)
        model.add_set(set_obj)
        model.add_node(grid7)
        model.add_node(grid13)

        eid = 5
        caero = 8
        id1 = 12
        id2 = 24
        setg = 60
        dz = 0.
        dtor = 1.0
        cid = 3
        dthx = 1.
        dthy = None
        usage = None
        card = ['SPLINE2', eid, caero, id1, id2, setg, dz, dtor, cid,
                dthx, dthy, None, usage]

        bdf_card = BDFCard(card, has_none=True)
        spline_a = SPLINE2.add_card(bdf_card, comment='spline2_a')
        spline_a.write_card()

        spline_b = SPLINE2(eid, caero, id1, id2, setg, dz, dtor, cid, dthx,
                           dthy, usage, comment='spline2_b')
        spline_b.validate()
        spline_b.write_card()
        spline_b.cross_reference(model)
        spline_b.write_card()
开发者ID:hurlei,项目名称:pyNastran,代码行数:70,代码来源:test_aero.py


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