##  StudCount.py Version 1.00

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

##  All rights reserved.

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

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

'''

Calculate the number of studs from the individual stud counts found in

text entities extracted from the selected DXF files.

Stud count string format: [36] or [14,2,2,14]

 

The text must start with an open bracket character '['.

 

The disc files containing the stud information must be DXF files of the

erection views or erection sheets. The script will summarize the

quantities found between the brackets.

 

To increase the reliability and accuracy of the stud counts, it is

advisable to limit the use of brackets in SDS/2 labels in the

applicable EVUs to showing stud counts.

'''

import os

from param import select_multiple_files

from macrolib.TextDXF import parseDXFtext, sumStuds

from macrolib.FileDefaults import import_data, export_data

 

# system path for defaults file

default_file_path = os.path.join(os.getcwd(), "macro", "Defaults")

def_file = "StudCount.txt"

script_name = "StudCount_v1.00.py"

 

dir_name = os.getcwd()

 

dd0 = import_data(os.path.join(default_file_path, def_file))

if dd0:

    for key, value in dd0.items():

        exec "%s = %s" % (key, repr(value)) in None

 

studList = []

 

for fn in select_multiple_files(dir_name):

    studList.append(sumStuds(parseDXFtext(fn)))

    print 'There were %d studs counted in file %s' % (studList[-1], fn)

 

export_data(os.path.join(default_file_path, def_file), {'dir_name': os.path.dirname(fn)}, script_name)

 

print '\nTotal number of shear connector studs counted: %d' % sum(studList)

# print studList