本文整理汇总了Python中pyNastran.bdf.bdf.BDF.writeBDF方法的典型用法代码示例。如果您正苦于以下问题:Python BDF.writeBDF方法的具体用法?Python BDF.writeBDF怎么用?Python BDF.writeBDF使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyNastran.bdf.bdf.BDF
的用法示例。
在下文中一共展示了BDF.writeBDF方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: makeTruss
# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.bdf.BDF import writeBDF [as 别名]
def makeTruss():
model = BDF('')
p1 = array([0., 0., 0.]) * 12.
p2 = array([10., 0., 0.]) * 12.
p3 = array([10., 10., 0.]) * 12.
p4 = array([0., 10., 0.]) * 12.
p5 = array([0., 0., 10.]) * 12.
p6 = array([10., 0., 10.]) * 12.
p7 = array([10., 10., 10.]) * 12.
p8 = array([0., 10., 10.]) * 12.
nodes = [p1, p2, p3, p4, p5, p6, p7, p8]
for i, node in enumerate(nodes):
spc = None
if node[2] == 0.:
spc = str(123456)
grid = ['GRID', i + 1, None, node[0], node[1], node[2], None, spc]
model.add_card(grid, 'GRID')
# c conrods
Ac = 4. # in^2
Jc = 60. # in4
Ixc = 650. # in4
Iyc = 65. # in4
Ec = 29000.
Gc = None
nub = 0.3
#id
c1 = [5, 1]
c2 = [6, 2]
c3 = [7, 3]
c4 = [8, 4]
cRods = [c1, c2, c3, c4]
mid1 = 99
mat1 = ['MAT1', mid1, Ec, Gc, nub]
i = 1
i = addRods(model, cRods, mat1, i, Ac, Jc)
# b conrods
Ab = 3.2
Jb = 43.
Ixb = 450.
Iyb = 32.
Eb = 29000.
Gb = None
nub = 0.3
b1 = [1, 2]
b2 = [2, 3]
b3 = [3, 4]
b4 = [4, 1]
b5 = [5, 6]
b6 = [6, 7]
b7 = [7, 8]
b8 = [8, 5]
bRods = [b1, b2, b3, b4, b6, b7, b8]
mid2 = 22
mat1 = ['MAT1', mid2, Eb, Gb, nub]
i = addRods(model, bRods, mat1, i, Ab, Jb)
scaleFactor = 1.
loadID = 123
load = ['LOAD', loadID, scaleFactor, 1., loadID]
model.add_card(load, 'LOAD')
force = ['FORCE', loadID, 3, None, 100., 1., 0., 0.]
model.add_card(force, 'FORCE')
model.writeBDF('frame.bdf')
print "done"
return model
示例2: makeTruss2
# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.bdf.BDF import writeBDF [as 别名]
def makeTruss2():
"""
@code
^
|1000 lb
|
12 |
*
*1-----A------2 34
| D B |
| \ / C
F / \ | 20"
| / \ |
*3-----E------4 78
*56
40"
@endcode
where:
* \* indicates a constraint
* 1234 are nodes
* ABCDEF are rods
* the truss is 20" by 40"
* E = 1e7 psi
* B and D do not touch, but cross at the diagonal
* 12,34,56,78 are the degrees of freedom
"""
model = BDF('')
#model.executiveControlLines = ['SOL 101']
#model.caseControlDeck = None
#model.iSolLine = 0
p1 = array([0., 20., 0.])
p2 = array([40., 20., 0.])
p3 = array([0., 0., 0.])
p4 = array([40., 0., 0.])
E = 1e7 # psi
nu = 0.3
G = None # default is used
J = 0. # not needed
nodes = [p1, p2, p3, p4]
for i, node in enumerate(nodes):
spc = None
if node[0] == 0.: # if x==0
spc = str(123456)
grid = ['GRID', i + 1, None, node[0], node[1], node[2], None, spc]
model.add_card(grid, 'GRID')
#id
cA = [1, 2]
cB = [2, 3]
cC = [2, 4]
cD = [1, 4]
cE = [3, 4]
cF = [1, 3]
cRods = [cA, cB, cC, cD, cE, cF]
mid1 = 199
mat1 = ['MAT1', mid1, E, G, nu]
A = [1.0, 0.5, 1.0, 0.5, 1.0, 1.0]
i = 0
i = addRods(model, cRods, mat1, i, A, J)
scaleFactor = 1.
loadID = 123
load = ['LOAD', loadID, scaleFactor, 1., loadID]
model.add_card(load, 'LOAD')
force = ['FORCE', loadID, 2, None, 1000., 0., 1., 0.]
model.add_card(force, 'FORCE')
model.writeBDF('conrod.bdf')
print "done"
return model