Back to SDS/2 Parametric Scripts
## Mem_Mtrl.py Version 1.00
## Copyright (c) 2007 Bruce Vaughan, BV
Detailing & Design, Inc.
## All rights reserved.
## NOT FOR
############################################################################
"""
Search the current
job for members and recap the material in a dictionary.
The script will
compile the member material if mem.left.location.x is
within
'prox' of 'elev' (see
function member_elev_list())
"""
from mtrl_list import MtrlLocate
from member import Member, MemberLocate,
MemberAllocated
from macrolib.columnize
import columnize
from macrolib.material_list
import mem_mtrl_list
cw
= 10
def member_elev_list(elev=0.0, prox=72.0, seq_list='All', mtype=['Column',]):
mem_list = []
for mi in xrange(1, MemberAllocated(), 1):
try:
mem = Member(mi)
except:
pass
else:
if mem.type in mtype:
if
abs(mem.left.location.z - elev)
<= prox:
if
seq_list == 'All':
mem_list.append(mem)
else:
if
mem2.sequence in seq_list:
mem_list.append(mem)
return mem_list
def member_mtrl_dict(mem_list):
mtrlDict
= {}
for mem in mem_list:
mList
= mem_mtrl_list(mem)
for m in mList:
if mtrlDict.has_key(m.piecemark):
mtrlDict[m.piecemark][0] += 1
else:
mtrlDict[m.piecemark]
= [1, m.description]
return mtrlDict
mtrlDict
= member_mtrl_dict(member_elev_list())
keyList
= mtrlDict.keys()
keyList.sort()
s = '%s%s%s\n' % (columnize('sub mark', cw, 'Center'), \
columnize('quantity', cw, 'Center'), \
columnize('description', cw, 'Center'))
print '%s%s' % (s, '='*len(s))
for key in keyList:
print '%s%s%s' % (columnize(key, cw, 'Center'), \
columnize(str(mtrlDict[key][0]), cw, 'Center'), \
columnize(str(mtrlDict[key][1]), cw, 'Center'))
"""
sub mark quantity description
================================
BP1
2 PL2 1/4x20
BP2
4 PL2x20
BP3
20 PL1 3/4x20
BP4
8 PL1 1/2x20
BP5
4 PL1x14
BP6
6 PL4x24
hss10
1 HSS6x6x1/2
hss6
1 HSS6x6x1/2
hss7
1 HSS6x6x1/2
hss9
1 HSS6x6x1/2
p11
2 FL5/8x8
p12
2 PL1x12
p13
6 PL3/4x5 1/2
p20
68 FL1/2x8
p21
68 FL3/8x9
p22
4 PL3/8x6 1/2
p23
40 PL1/8x8
p30
2 FL3/8x4
p31
4 FL3/8x4
p40
12 FL3/8x5
p43
4 FL3/8x4
p6
2 PL1x26 1/4
p8
12 FL3/4x8
p9
4 PL5/8x16 3/4
w10
2 W12x53
w119
2 W12x106
w14
1 W12x120
w145
1 W12x58
w147
2 W12x65
w148
1 W12x53
w149
2 W12x53
w152
2 W12x53
w159
1 W12x53
w161
2 W12x58
w166
2 W12x58
w167
2 W12x58
w229
1 W12x58
w230
1 W12x65
w231
1 W12x65
w232
4 W12x65
w233
2 W12x65
w234
2 W12x65
w235
1 W12x79
w236
2 W12x96
w237
2 W12x106
w245
1 W12x96
w56
1 W12x120
w94
2 W12x106
"""