Back to SDS/2 Parametric Scripts

 

## material_list.py Version 1.00 (module macrolib.material_list)

## Copyright (c) 2007 Bruce Vaughan, BV Detailing & Design, Inc.

## All rights reserved.

## NOT FOR SALE. The software is provided "as is" without any warranty.

############################################################################

"""

Return a list of the material found on a member

"""

from macrolib.columnize import columnize

 

def mem_mtrl_list(mem):

ml = []

i = 0

while True:

try:

m = mem.material(i)

ml.append(m)

i += 1

except:

return ml

 

if __name__ == '__main__':

from member import MemberLocate

mem = MemberLocate('Select member')

mList = mem_mtrl_list(mem)

cw = 18

print '%s%s%s\n%s' % (columnize('member mtrl index', cw, 'Center'), \

columnize('material object', 2*cw, 'Center'),\

columnize('material piecemark', cw, 'Center'), \

"-"*(4*cw))

for m in mList:

print '%s%s%s' % (columnize(str(mList.index(m)), cw, 'Center'), \

columnize(repr(m), 2*cw, 'Center'), \

columnize(m.piecemark, cw, 'Center'))

 

member mtrl index material object material piecemark

------------------------------------------------------------------------

0 <gen_mtrl object at 0x09222728> BP3

1 <gen_mtrl object at 0x092227E8> p20

2 <gen_mtrl object at 0x092228C0> p20

3 <gen_mtrl object at 0x09222740> p23

4 <gen_mtrl object at 0x09222860> p23

5 <gen_mtrl object at 0x09222908> p21

6 <gen_mtrl object at 0x09222710> p21

7 <gen_mtrl object at 0x092229C8> w147