##  Col_RFStiff version 1.00

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

##  All rights reserved.

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

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

""" Add stiffener/continuity plates to a column and align with a beam.

    The default stiffener width based upon beam flange width: (bfb-twc)/2 + 0.0625 rounded off to the

    nearest 1/4".

    The default stiffener width based upon column "A" distance: (bfc-twc)/2 + 0.0625 rounded off to

    the nearest 1/4".

    The default stiffener thickness ("A" and "bf"): (beam tf + 0.03) rounded off to the nearest 1/8"

    The default stiffener length: mem1.depth-2 * mem1.tf - 0.0625 rounded off to the nearest 1/16".

    Thickness reference point on the stiffener material is "NS"

    If adding weld is elected, weld is added to the first stiffener only.

    The script performs an ASD code check using FF*5/3 (flange force * 1.67) and a default beam moment

    of Mr (0.66FySx/12).

    Stiffener offsets (if elected) are with respect to "Flush Top" at top stiffener and "Flush Bott"

    at bottom stiffener.

    The script does not account for the vertical dimensional offset due to beam slope and column depth.

    The user can account for it by selecting the "offset" option for stiffener alignment. The script

    does account for the gain in distance between the stiffeners due to beam slope.

  *****************************************************************************************************

    DISCLAIMER: The code check is for information only. Engineering evaluation of the calculations    *

                is required.                                                                          *

  *****************************************************************************************************

    Revision History

    R1 -    Allow for thicker top stiffener. Where the top of the column is flush with the top of the

            rigid frame beam, we usually make the top stiffener 1/4" (re: line 371) thicker and use a

            partial penetration groove weld on 3 sides.

    R2 -    Add extended shear tabs.

    R3 -    If make_top_thicker = "Yes", set condition so weld is added to first bottom stiffener,

            since top stiffener weld (BTC-P4-GF) will be added in IG.

    R4 -    Add option to set stiffener a vertical distance below top. Moved defaults to line 67.

            Edited hole pattern code to work in SDS/2 6.310 as follows:

            "Above Right">>"Above Left", "FS Face">>"NS Face", 0.0>>-45.0 group_rot, Slot direction 90.0>>0.0

            Create loops for column and beam members. Each joint gets a dialog box.

    R5 -    Update hole pattern code for SDS/2 version 6.325 (1/19/04)

            -45.0 >> 0.0 group_rot, Slot direction 0.0 >> 90.0, "Above Left" >> "Below Right"

            The combination of "Above Right" and "FS Face" also works

    Version 1.00 -  8/12/06 - Add capability to Save/Read script defaults from disk. Remove support for SDS/2 6.3xx.

                    Rework dialog boxes for tabs, group titles, image and organization.

                    Add support for partial depth extended shear tabs and stabilizer plates at bottom edge.

                    Add material usage descriptions:

                    Continuity Plate

                    Extended Shear Tab

                    Stabilizer

    ************************************************************

    ****NOTE: This version is not compatible with SDS/2 6.3.****

    ************************************************************            

 

    This script can be executed in plan, elevation, or isometric.

 

    This source is provided "as is."  All warranties are disclaimed.

    Developed in SDS/2 6.310  9/19/02 (Rev.4)  ***Will not work in 6.2xx***

 

    Developed by Bruce Vaughan, BV Detailing & Design, Inc. (BVD)  (615) 646-9239

    For comments, suggestions or questions call BVD at the number above.

 

    NOT FOR SALE

 

    Go to line "Defaults section" to set script defaults.

"""

# startup code begin

import sys

import traceback

import types

from param import *

from math import *

Units("feet")

saved_sds2_version = '7.002'

saved_python_version = (2, 1, 1, 'final', 0)

try:

    from shape import Shape

    from point import Point, PointLocate

    from member import Member, MemberLocate

    from mtrl_list import MtrlLocate, HoleLocate

    from cons_line import ConsLine

    from cons_circle import ConsCircle

    from rnd_plate import RndPlate

    from rect_plate import RectPlate

    from bnt_plate import BntPlate

    from rolled_section import RolledSection

    from weld_add import Weld

    from flat_bar import FlatBar

    from hole_add import Hole

    from bolt_add import Bolt

    from roll_plate import RollPl

    from sqr_bar import SqrBar

    from rnd_bar import RndBar

    from shr_stud import ShrStud

    from grate import Grate

    from grate_trd import GrateTrd

    from deck import Deck

    from mtrl_fit import MtrlFit

    from version import CurrentVersion, VersionCompare

    curr_version = CurrentVersion()

except ImportError:

    curr_version = 'None'

    def VersionCompare( v1, v2 ):

        return -1

if VersionCompare( curr_version, '6.311' ) >= 0:

    from job import Job

    from fab import Fabricator

if VersionCompare( curr_version, '6.312' ) >= 0:

    from plate_layout import PlateLayout

if VersionCompare( curr_version, '6.314' ) >= 0:

    from plate_layout import BntPlateLayout

if VersionCompare( curr_version, '6.4' ) >= 0:

    from mtrl_cut import MtrlCut

try:

    from os import path

    path_available = 1

except:

    path_available = 0

# startup code end

# start of defaults for stiffener plates xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

# xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

# Variables section

enable_default_import_export = "Enable"                 # default to enable or disable the importing and exporting of dialog dictionary variables "Enable" "Disable"

default_file_path = "C:/ParamDef/Col_RFStiff/"          # system path for defaults file

def_file = "Col_RFStiff.txt"                            # defaults file name

script_name = "Col_RFStiff_v1.00.py"

image_name1 = "C:\ParamImg\Col_RFStiff1.gif"

image_name2 = "C:\ParamImg\Col_RFStiff2.gif"

# Defaults section

add_shr_tab = "No"                      # default add extended shear tabs "Yes", "No"

add_stf_tb = "Both"                     # default add stiffeners "Both", "Top", Bott", "None"

which_side = "BS"                       # default side(s) for stiffeners "BS" "NS" "FS"

which_stiff = "User"                    # default which stiffener to accept "Beam bf", "Column A", "User"

stiff_width = 4.75                      # default "user" stiffener width

stiff_thk = 0.75                        # default "user" stiffener thickness

stiff_color = "None"                    # default stiffener finish "None", "Red Oxide", "Yellow Zinc", "Gray Oxide", "Sandblasted", "Blued Steel", "Galvanized"

stiff_grade = "A36"                     # default steel grade

top_align = "Flush Top"                 # default alignment "Flush Top", "Flush Bott", Align CL", "Offset"

bot_align = "Flush Bott"                # default alignment "Flush Top", "Flush Bott", Align CL", "Offset", "Vert Dist"

top_offset = 0.0                        # default offset top stiffener

bot_offset = 0.0                        # default offset bottom stiffener

stiff_clip = 1.0                        # default stiffener corner clip

ad_stf_weld = "Yes"                     # default for adding stiffener weld       "Yes" "No"

stf_weld_type = "Fillet"                # default for weld type "Fillet" "Bevel groove" "Square butt"

stf_weld_size = 0.3125                  # default stiffener weld size

stiff_calc = "Fixed"                    # Flag to calculate weld size based on stiffener thickness or to use default "stf_weld_size" "Fixed, "Calc"

tail_text = "TYP"                       # default weld tail text

prt_code_chk = "No"                     # default to print ASD code check "Yes" "No"

top_stiff_extra = "1/8"

# end of defaults for stiffeners

# start of defaults for extended shear tabs xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

which_side_NS = "Right"                 # locate NS plate which side of column CL (right is preferred) "Right", "Left"

which_side_FS = "Left"                  # locate FS plate which side of column CL (left is preferred) "Right", "Left"

full_part_depth = "Partial Depth"       # ("Full Depth", "Partial Depth")

dist_1st = 3.0                          # distance to first hole from T/S

no_cols = 2                             # number of bolt columns (2 columns = double gage)

row_spa = 3.0                           # spacing of bolt rows

col_spa = 3.0                           # spacing of bolt columns

pl_thk = 0.5                            # thickness of plate material

vert_ed = 1.5                           # vertical edge distace from hole to edge of cope

add_bott_stab = "Yes"                   # ("Yes", "No")   

stab_width = "5 1/2"                    #

prep_list = ["Cope Top", "Cope Bott", "Clip Top", "Clip Bott"] # ["Cope Top", "Cope Bott", "Clip Top", "Clip Bott", "None"]

clip_dim = 0.75                         # shear plate clip dimension

pl_end_gap = 1.0                        # dimension from end of beam material to edge of cope

pl_color = "None"                       # shear plate finish "None", "Red Oxide", "Yellow Zinc", "Gray Oxide", "Sandblasted", "Blued Steel", "Galvanized"

pl_grade = "A36"                        # steel grade

bolt_size = 0.75                        # bolt diameter

hole_type_web = "Short Slot"            # hole type in web leg "Standard Round", "Short Slot", "Oversized Round", "Long Slot"

bolt_type_web = "A325N"                 # bolt type in web leg "A325N" "A307" "A325SC"

tab_weld_type = "Fillet"                # weld type "Fillet" "Bevel groove" "Square Butt"

tab_weld_size = 0.3125                  # weld size to column web

tabstf_weld_size = 0.25                 # weld size to stiffener

# set defaults for extended shear tab end  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

# Define functions xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

# Function definitions

def form_script_variables():

    # All variables are defined as strings in defaults section. Defaults are saved to disk as dlg.done() defines them.

    # Default variables must be reformatted for imported data or for the second loop if not importing data.

    # Only floating point numbers need be reformatted. Integers should be formatted in the dialog box.

    global stiff_width, stiff_thk, top_offset, bot_offset, stiff_clip, stf_weld_size, top_stiff_extra

    stiff_width = dim_print(dim(stiff_width))

    stiff_thk = dim_print(dim(stiff_thk))

    top_offset = dim_print(dim(top_offset))

    bot_offset = dim_print(dim(bot_offset))

    stiff_clip = dim_print(dim(stiff_clip))

    stf_weld_size = dim_print(dim(stf_weld_size))

    top_stiff_extra = dim_print(dim(top_stiff_extra))

 

def form_script_variables2():

    global dist_1st, row_spa, col_spa, pl_thk, vert_ed, stab_width, clip_dim, pl_end_gap, bolt_size, tab_weld_size, tabstf_weld_size

    dist_1st = dim_print(dim(dist_1st))

    row_spa = dim_print(dim(row_spa))

    col_spa = dim_print(dim(col_spa))

    pl_thk = dim_print(dim(pl_thk))

    vert_ed = dim_print(dim(vert_ed))

    stab_width = dim_print(dim(stab_width))

    clip_dim = dim_print(dim(clip_dim))

    pl_end_gap = dim_print(dim(pl_end_gap))

    bolt_size = dim_print(dim(bolt_size))

    tab_weld_size = dim_print(dim(tab_weld_size))

    tabstf_weld_size = dim_print(dim(tabstf_weld_size))   

 

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

## Function definitions for saving default values to disk

## See Python file "Script_Defaults.py" for usage documentation

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

def import_data(file):

    try:

        ff = open(file)

    except:

        print "There was an error opening the default data file. Please check your directory path and that file exists."

        return 0

    else:

        dd = {}

        key_values_list = ff.readlines()[3:]

        ff.close()

        for ii in key_values_list:

            key_name, key_value = ii.split("=", 1)

            dd[key_name.strip()] = key_value.strip()

        return dd

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

def export_data(file_name, dd_list, script_name): # pass script name for default file

    try:

        f = open(file_name, "w")

        f.write("Defaults file for script " + script_name + "\nVariable Name = Value Name\n\n")

        for jj in dd_list:

            for key_name in jj.keys():

                key_value = jj[key_name]

                f.write("%s = %s\n" % (key_name, key_value))

        f.close()

    except:

        dd_list = 0

        print "There was an error exporting the default data to disk. Please check your directory path. "

    return dd_list

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

# convert radians to degrees

def rtod ( r ):

    return (r * 180.0 / pi)

# convert degrees to radians

def dtor ( d ):

    return (d * pi / 180.0)

# returns Fy of member based upon member grade (mem.grade)

# if member grade is not listed, the function will return 65.0

def ret_Fy (mem):

    if mem.grade == "A992":

        Fy = 50.0

    elif mem.grade == "A36":

        Fy = 36.0

    elif mem.grade == "A572-50":

        Fy = 50.0

    elif mem.grade == "A500B":

        Fy = 46.0

    else:

        Fy = 65.0

        print "Material grade not listed - returning 65 ksi"

    return Fy   

# xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

# define function to return the WP at the column CL

def ret_WP(mem11, mem12):

    global which_end

    dist1 = Point(mem11.left_location.x, mem11.left_location.y, 0.000000).dist(Point(mem12.left_location.x, mem12.left_location.y, 0.000000))

    dist2 = Point(mem11.left_location.x, mem11.left_location.y, 0.000000).dist(Point(mem12.right_location.x, mem12.right_location.y, 0.000000))

    if dist1 < dist2:

        pt1 = Point(mem11.left_location.x, mem11.left_location.y, mem12.left_location.z)

       

        which_end = "left end"

    else:

        pt1 = Point(mem11.left_location.x, mem11.left_location.y, mem12.right_location.z)

        which_end = "right end"

    return (pt1, which_end)

# xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

# add rectangular plate material

# returns a rectangular plate object

def stiff_pl(mem, pnt1, pnt2, pl_thk, rotpl):

    rot_arg = (rotpl[0], rotpl[1], (rotpl[2] - 0.0))

    # rectangular plate begin

    rp11 = RectPlate()

    rp11.member = mem

    rp11.pt1 = pnt1

    rp11.pt2 = pnt2

    rp11.grade = stiff_grade

    rp11.origin = "NS"

    rp11.top_oper_left = "Clip"

    rp11.top_length_left = stiff_clip

    rp11.top_clip_left = stiff_clip

    rp11.top_oper_right = "Clip"

    rp11.top_length_right = stiff_clip

    rp11.top_clip_right = stiff_clip

    rp11.bottom_oper_left = "None"

    rp11.bottom_oper_right = "None"

    rp11.width = stiff_width

    rp11.thick = pl_thk

    rp11.work_pt_dist = rp11.pt1.dist( rp11.pt2 )

    rp11.setback_left = 0

    rp11.setback_right = 0

    rp11.web_cut_angle_left = 0

    rp11.web_cut_angle_right = 0

    rp11.length = stiff_length

    rp11.mtrl_type = "Plate"

    rp11.mtrl_usage = "Continuity Plate"

    rp11.finish = stiff_color

    rp11.ref_pt_offset = (0.000000, 0.000000, 0.000000)

    rp11.add()

    rp11.rotate(rp11.member, rot_arg)

    # rectangular plate end

    return rp11

# add weld xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

def stiff_weld(weld_to_list, rl5, weld_size, weld_type, tt):

    if weld_type == "Fillet":

        allow_fillet = "Yes"

        allow_bevel = "No"

        allow_square = "Yes"

    elif weld_type == "Bevel groove":

        allow_fillet = "No"

        allow_bevel = "Yes"

        allow_square = "No"

    else:

        allow_fillet = "Yes"

        allow_bevel = "No"

        allow_square = "Yes"

    try:

        # weld add begin

        weld9 = Weld()

        weld9.mtrl = [rl5, ]

        weld9.weld_to = weld_to_list

        weld9.min_size = weld_size

        weld9.max_size = 1

        weld9.min_length = 1

        weld9.max_gap = 0.25

        weld9.stagger_length = 3

        weld9.stagger_spacing = 12

        weld9.holdback_length = 0

        weld9.root_face = 0

        weld9.root_opening = 0

        weld9.b_groove_angle = 45

        weld9.v_groove_angle = 60

        weld9.all_around = "No"

        weld9.stagger = "No"

        weld9.inside = "No"

        weld9.auto_size = 0

        weld9.full_penetration = "No"

        weld9.fillet_back = "No"

        weld9.holdback_end = 0

        weld9.prequalified = "No"

        weld9.backing_bar = 0

        weld9.spacer = 0

        weld9.contour = "None"

        weld9.allow_fillet = allow_fillet

        weld9.allow_square = allow_square

        weld9.allow_bevel = allow_bevel

        weld9.allow_v = "No"

        weld9.allow_j = "No"

        weld9.allow_u = "No"

        weld9.allow_flare_bevel = "No"

        weld9.allow_flare_v = "No"

        weld9.allow_plug = "No"

        weld9.allow_backing = "No"

        weld9.tail_text = ""

        weld9.show_window = "No"

        weld9.create()

        # weld add end

    except:

        pass

# add the shear tab xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

def plate_add(mem, pnt1, pnt2, rot1):

    rot_arg = (rot1[0], rot1[1], (rot1[2]))

    if cope_top:

        leftb_op = "Cope"

        cope_l_len = cope_top[0]

        cope_l_dep = cope_top[1]

    else:

        leftb_op = "None"

        cope_l_len = 0.0

        cope_l_dep = 0.0

    if cope_bott:

        rightb_op = "Cope"

        cope_r_len = cope_bott[0]

        cope_r_dep = cope_bott[1]

    else:

        rightb_op = "None"

        cope_r_len = 0.0

        cope_r_dep = 0.0

    if clip_top:

        leftt_op = "Clip"

        left_len = clip_top[0]

        left_dep = clip_top[1]

    else:

        leftt_op = "None"

        left_len = 0.0

        left_dep = 0.0

    if clip_bott:

        rightt_op = "Clip"

        right_len = clip_bott[0]

        right_dep = clip_bott[1]

    else:

        rightt_op = "None"

        right_len = 0.0

        right_dep = 0.0       

    # rectangular plate begin

    rp1 = RectPlate()

    rp1.member = mem

    rp1.pt1 = pnt1

    rp1.pt2 = pnt2

    rp1.grade = pl_grade

    rp1.origin = "FS"

    rp1.top_oper_left = leftt_op

    rp1.top_length_left = left_len

    rp1.top_clip_left = left_dep

    rp1.top_oper_right = rightt_op

    rp1.top_length_right = right_len

    rp1.top_clip_right = right_dep

    rp1.bottom_oper_left = leftb_op

    rp1.bottom_length_left = cope_l_len

    rp1.bottom_cope_left = cope_l_dep 

    rp1.bottom_oper_right = rightb_op

    rp1.bottom_length_right = cope_r_len

    rp1.bottom_cope_right = cope_r_dep

    rp1.width = pl_width

    rp1.thick = pl_thk

    rp1.work_pt_dist = rp1.pt1.dist( rp1.pt2 )

    rp1.setback_left = 0

    rp1.setback_right = 0

    rp1.web_cut_angle_left = 0

    rp1.web_cut_angle_right = 0

    rp1.length = pl_length

    rp1.mtrl_type = "Plate"

    rp1.mtrl_usage = "Extended Shear Tab"

    rp1.finish = pl_color

    rp1.ref_pt_offset = (0.000000, 0.000000, 0.000000)

    rp1.add()

    rp1.rotate(rp1.member, rot_arg)

    # rectangular plate end

    return rp1

# xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

# add holes to shear tab

# slots are rotated perpendicular to length of material

def pl_holes (rp1):

    try:

        # hole group add begin

        hole26 = Hole()

        hole26.mtrl = [rp1, ]

        hole26.pt1 = hole26.mtrl.location

        hole26.hole_type = hole_type_web

        hole26.face = "NS Face"

        hole26.valid_cnc = "Yes"

        hole26.x_ref_offset = hole_dim_x

        hole26.y_ref_offset = hole_dim_y

        hole26.x_spa = row_spa

        hole26.y_spa = col_spa

        hole26.group_rot = 0.0

        hole26.locate = "Below Right"

        hole26.columns = no_rows

        hole26.rows = no_cols

        hole26.bolt_type = bolt_type_web

        hole26.bolt_dia = bolt_size

        hole26.slot_rot = 90.0

        hole26.length = hole26.calc_slot_length()

        hole26.hole_dia = hole26.calc_hole_size()

        hole26.show_window = "Yes"

        hole26.create()

        # hole group add end

    except:

        pass

 

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

def stabilizer_pl(bm, pnt1, pnt2, rotpl):

    # rectangular plate begin

    rp12 = RectPlate()

    rp12.member = bm

    rp12.pt1 = pnt1

    rp12.pt2 = pnt2

    rp12.grade = pl_grade

    rp12.origin = "NS"

    rp12.top_oper_left = "None"

    rp12.top_length_left = 0.0

    rp12.top_clip_left = 0.0

    rp12.top_oper_right = "None"

    rp12.top_length_right = 0.0

    rp12.top_clip_right = 0.0

    rp12.bottom_oper_left = "None"

    rp12.bottom_oper_right = "None"

    rp12.width = stab_width

    rp12.thick = pl_thk

    rp12.work_pt_dist = rp12.pt1.dist(rp12.pt2)

    rp12.setback_left = 0

    rp12.setback_right = 0

    rp12.web_cut_angle_left = 0

    rp12.web_cut_angle_right = 0

    rp12.length = stiff_length

    rp12.mtrl_type = "Plate"

    rp12.mtrl_usage = "Stabilizer"

    rp12.finish = pl_color

    rp12.ref_pt_offset = (0.000000, 0.000000, 0.000000)

    rp12.add()

    rp12.rotate(rp12.member, rotpl)

    # rectangular plate end

    return rp12

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

# Default number of bolt rows (bolt columns with respect to plate material)

def row_list(matl):

    if matl[0:2] == "W8":

        return 2

    elif matl[0:3] == "W10":

        return 2

    elif matl[0:3] == "W12":

        return 3

    elif matl[0:3] == "W14":

        return 3

    elif matl[0:3] == "W16":

        return 4

    elif matl[0:3] == "W18":

        return 5

    elif matl[0:3] == "W21":

        return 5

    elif matl[0:3] == "W24":

        return 6

    elif matl[0:3] == "W27":

        return 7

    else:

        return 8

# Minimum length (depth) of partial depth extended shear tab

def tab_length(matl):

    if matl[0:2] == "W8":

        return 6.0

    elif matl[0:3] == "W10":

        return 6.75

    elif matl[0:3] == "W12":

        return 9.75

    elif matl[0:3] == "W14":

        return 11.75

    elif matl[0:3] == "W16":

        return 13.75

    elif matl[0:3] == "W18":

        return 15.75

    elif matl[0:3] == "W21":

        return 18.625

    elif matl[0:3] == "W24":

        return 18.625

    elif matl[0:3] == "W27":

        return 18.625

    else:

        return 21.0

# xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

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

# a exception handler function to format the exception info into a string for dialog display -  credit Phil Adams [padams@colloquiuminc.com]

def formatExceptionInfo(maxTBlevel=5):

      cla, exc, trbk = sys.exc_info()

      excName = cla.__name__

      try:

            excArgs = exc.__dict__["args"]

      except KeyError:

            excArgs = "<none>"

      excTb = traceback.format_tb(trbk, maxTBlevel)

      #- build the return string ready to be displayed

      _str = "Error: " + excName + "\nDesc: "

      for i in range(len(excArgs)):

            _str = _str + excArgs[i] + "\n"

      #for ii in range(len(excTb)):

      _str = _str + excTb.pop() # + "\n"

      return _str

 

#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

   

# End function definitions

# Start main program loop xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

count = 0

if enable_default_import_export == "Enable":

    try:

        globals().update(import_data(default_file_path + def_file))

        if isinstance(prep_list, types.StringType):

            try:

                prep_list = eval(prep_list)

            except:

                prep_list = ["None"]

                Warning("Error reading 'prep_list'")

    except:

        Warning("There was a problem importing data - reverting to original defaults")

while 1:

    ClearSelection()

    count = count + 1

    col_list = []

    bm_list = []

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

    try:

        z = 1

        # Select column members

        while z:

            if len(col_list) == 0:

                mem1 = MemberLocate("Select a WF column member.")

            else:

                mem1 = MemberLocate("Select an additional WF column member.")

            if mem1 == None:

                break

            else:

                if mem1.type == "Column":

                    if mem1.mtrl_type == "W flange":

                        col_list.append(mem1)

                    else:

                        Warning(mem1.mtrl_type + " column material is not supported.")

                else:

                    Warning("You picked a " + mem1.type + ". You must pick a Column.")

        if len(col_list) < 1:

            break

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

        z = 1

        # Select beam members

        ClearSelection()

        while z:

            try:

                if len(bm_list) == 0:

                    mem2 = MemberLocate("Select first BEAM or JOIST member")

                else:

                    mem2 = MemberLocate("Select additional BEAM/JOIST or RETURN")

                if mem2 == None:

                    break

                else:

                    if mem2.type in ["Beam", "Joist", "Horizontal Brc"]:

                        bm_list.append(mem2)

                    else:

                        Warning("You picked a " + mem2.type + ". You must pick a Beam or Joist.")

            except:

                yes_or_no("User canceled the operation.\n" + formatExceptionInfo(), "OK")

                bm_list = []

                break

        if len(bm_list) < 1:

            Warning("You did not pick any beams. Exiting script.")

            break

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

        ClearSelection()

        # begin loop for columns

        for ci in range(len(col_list)):

            pt_list = []

            for bi in range(len(bm_list)):

                list1 = ret_WP(col_list[ci], bm_list[bi])

                pt_list.append(list1[0])

            # begin loop for beams

            for bi in range(len(bm_list)):

            # xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

                # Check to see if top of beam is within 1/2" of top of column and sets default for "make_top_thicker"

                pt_WP = pt_list[bi]

                if pt_WP.dist(col_list[ci].right_location) < 0.5:

                    make_top_thicker = "Yes"

                else:

                    make_top_thicker = "No"

                # xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

                # if not tail_text:

                #     tail_text = "TYP"

                if top_align != "Offset":

                    top_offset = dim_print(0.0)

                if bot_align != "Offset":

                    bot_offset = dim_print(0.0)

                # calculate stiffener defaults and code check properties

                stiff_width_bf = dim_print(round(((bm_list[bi].bf - col_list[ci].tw) / 2 + 0.0625) * 4.0) / 4.0)

                stiff_width_A = dim_print(round(((col_list[ci].bf - col_list[ci].tw) / 2 + 0.0625) * 4.0) / 4.0)

                stiff_thk_bf = dim_print(round((bm_list[bi].tf + 0.03) * 8.0) / 8.0)

                stiff_thk_A = dim_print(round((bm_list[bi].tf + 0.03) * 8.0) / 8.0)

                stiff_length = dim_print(round((col_list[ci].depth-col_list[ci].tf*2-0.0625)*16)/16)

                if stiff_calc == "Calc":

                    if which_stiff == "User":

                        stf_weld_size = dim_print(round((dim(stiff_thk)*0.75+0.02)*16)/16)

                    elif which_stiff == "Column A":

                        stf_weld_size = dim_print(round((dim(stiff_thk_A)*0.75+0.02)*16)/16)

                    else:

                        stf_weld_size = dim_print(round((dim(stiff_thk_bf)*0.75+0.02)*16)/16)

                net_stf_area_bf = round((dim(stiff_width_bf) - dim(stiff_clip)) * dim(stiff_thk_bf) * 2.0 * 1000.0) / 1000.0

                net_stf_area_A = round((dim(stiff_width_A) - dim(stiff_clip)) * dim(stiff_thk_A) * 2.0 * 1000.0) / 1000.0

                Sx = bm_list[bi].Ix/(bm_list[bi].depth/2)

                Fyb = ret_Fy(bm_list[bi])

                Fyc = ret_Fy(col_list[ci])

                Mr = round(0.67*Fyb*Sx/12.0*100)/100.0

                Flg_force = round(Mr*12.0/(bm_list[bi].depth-bm_list[bi].tf)*100)/100.0

                Pbf = round(Flg_force*5.0/3.0*100)/100.0

                Pfb = round(col_list[ci].tf*col_list[ci].tf*Fyc/0.16*100.0)/100.0

                Pwb = round((4100.0*col_list[ci].tw**3*Fyc**0.5/(col_list[ci].depth-2*col_list[ci].k))*100.0)/100.0

                PwoPwi = round(Fyc*col_list[ci].tw*(bm_list[bi].tf+5.0*col_list[ci].k)*100.0)/100.0

                # Determine ASD stiffener requirements - K1-9 quantities are stiffener cross-sectional area required

                stiff_str = "No stiffeners required"

                flg = 0

                flg1 = 0

                if Pbf>Pfb:

                    stiff_str = "K1-1"

                    flg = 1

                if Pbf>Pwb:

                    if flg:

                        stiff_str = stiff_str + ", K1-8"

                    else:

                        stiff_str = "K1-8"

                    flg1 = 1

                if Pbf>PwoPwi:

                    if flg or flg1!=0:

                        stiff_str = stiff_str + ", K1-9"

                    else:

                        stiff_str = "K1-9"

                    stiff_str = stiff_str + " (" + str(round((Pbf-PwoPwi)/36.0*1000)/1000) + " A36,  " + str(round((Pbf-PwoPwi)/50.0*1000)/1000) + " V50)"

                form_script_variables()

                dd_list = []

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

                ##  Dialog Box 1

                dlg1 = Dialog( "Column stiffener/continuity plates and extended shear tabs" )

       

                dlg1.tabset_begin()

                dlg1.tab("Stiffener Information")

                dlg1.column_group_begin()

                dlg1.column(0)

                dlg1.group_title("Extended shear tabs")

                dlg1.menu( "add_shr_tab", ("Yes", "No"), add_shr_tab, "Add extended shear tabs          " )

                dlg1.group_title_end

                dlg1.group_title("General Information")

                dlg1.menu( "add_stf_tb", ("Both", "Top", "Bott", "None"), add_stf_tb, "Stiffeners at which beam flanges" )

                dlg1.menu( "which_side", ("BS", "NS", "FS"), which_side, "Which side(s) of column web?" )

                dlg1.menu( "stiff_color", ("None", "Red Oxide", "Yellow Zinc", "Gray Oxide", "Sandblasted", "Blued Steel", "Galvanized"), stiff_color, "Stiffener finish" )

                dlg1.menu( "stiff_grade", Job().steel_grades("Plate").keys(), stiff_grade, "Select stiffener steel grade" )

                dlg1.group_title_end

               

                dlg1.group_title("Stiffener alignment")

                dlg1.menu( "top_align", ("Flush Top", "Flush Bott", "Align CL", "Offset"), top_align, "Top stiffener alignment")

                dlg1.menu( "bot_align", ("Flush Top", "Flush Bott", "Align CL", "Offset", "Vert Dist"), bot_align, "Bottom stiffener alignment")

                dlg1.entry( "top_offset", top_offset, "Top stiffener offset (+=UP)" )

                dlg1.entry( "bot_offset", bot_offset, "Bottom stiffener offset (-=DN)" )

                dlg1.menu( "make_top_thicker", ("Yes", "No"), make_top_thicker, "Make top stiffener thicker?" )

                dlg1.entry( "top_stiff_extra", top_stiff_extra, "Top stiffener extra thickness" )

                dlg1.group_title_end

               

                dlg1.column(0)

                dlg1.group_title("Member Information")

                dlg1.line("Column #" + str(ci + 1) + ", Beam #" + str(bi + 1))

                dlg1.line(col_list[ci].size + " at location " + dim_print(col_list[ci].left_location.x) + " , " + dim_print(col_list[ci].left_location.y) + " , " +\

                          dim_print(col_list[ci].left_location.z))

                dlg1.line(bm_list[bi].size + " at location " + dim_print(pt_WP.x) + " , " + dim_print(pt_WP.y) + " , " + dim_print(pt_WP.z))

                dlg1.group_title_end

                dlg1.group_title("Stiffener Size Options")

                dlg1.line("ASD code check: " + stiff_str)

                dlg1.line("Stiffener size Beam bf: " + stiff_width_bf + "x" + stiff_thk_bf)

                dlg1.line("Stiffener size Column A: " + stiff_width_A + "x" + stiff_thk_A)

                dlg1.menu( "which_stiff", ("Beam bf", "Column A", "User"), which_stiff, "Select which stiffener size to apply")

                dlg1.group_title_end

                           

                dlg1.group_title("'User' size stiffener dimensions")

                dlg1.entry( "stiff_width", stiff_width, "Stiffener width" )

                dlg1.entry( "stiff_thk", stiff_thk, "Stiffener thickness" )

                dlg1.group_title_end

                dlg1.group_title("Typical stiffener dimensions")

                dlg1.entry( "stiff_length", stiff_length, "Stiffener length (typ.)" )

                dlg1.entry( "stiff_clip", stiff_clip, "Stiffener clip dimension (typ.)" )

                dlg1.group_title_end           

               

                dlg1.tab("Welding")

                dlg1.group_title("Welding for stiffener")

                dlg1.menu( "ad_stf_weld", ("Yes", "No"), ad_stf_weld, "Add weld to stiffener" )

                dlg1.menu( "stf_weld_type", ("Fillet", "Square butt", "Bevel groove"), stf_weld_type, "Weld type" )

                dlg1.entry( "stf_weld_size", stf_weld_size, "Stiffener weld size")

                # dlg1.entry( "tail_text", tail_text, "Tail text for stiffener weld")

                dlg1.group_title_end

                

                dlg1.tab("Code Check")

                dlg1.group_title("Code check")

                dlg1.group_title_end

                dlg1.menu( "prt_code_chk", ("Yes", "No"), prt_code_chk, "Print ASD code check?" )

                dlg1.image(image_name1)

                dlg1.tabset_end()

                try:

                    dd1 = dlg1.done()

                except ResponseNotOK:

                    break

                globals().update(dd1)

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

                ## END DIALOG BOX 1 -----------------------------------------------------------------------------------------------------------------#

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

                dd_list.append(dd1)

               

                # determine stiffener dimensions xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

                if which_stiff == "Beam bf":

                    stiff_width = dim(stiff_width_bf)

                    stiff_thk = dim(stiff_thk_bf)

                elif which_stiff == "Column A":

                    stiff_width = dim(stiff_width_A)

                    stiff_thk = dim(stiff_thk_A)

                # Net area of specified stiffeners xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

                net_stf_area = round((dim(stiff_width) - dim(stiff_clip)) * dim(stiff_thk) * 2.0 * 1000.0) / 1000.0

                ## ASD 9th Edition Code Check ##########################################################################################################

                if prt_code_chk == "Yes":

                    stiff_reqd = "No"

                    print "Joint No.", count

                    print "Column size:", col_list[ci].size, col_list[ci].piecemark

                    print "Beam size:", bm_list[bi].size, bm_list[bi].piecemark

                    print "Mr:", Mr, " k-ft"

                    print "Flange force:", Flg_force

                    print "Factored flange force (Pbf):", Pbf

                    print "Flange bending (Pfb):", Pfb

                    print "Web buckling (Pwb):", Pwb

                    print "Web yielding (PwoPwi):", PwoPwi

                    if Pbf>Pfb:

                        print "Stiffener required per ASD K1-1."

                        stiff_reqd = "Yes"

                    if Pbf>Pwb:

                        print "Stiffener required per ASD K1-8."

                        stiff_reqd = "Yes"

                    if Pbf>PwoPwi:

                        print "Stiffener required per ASD K1-9."

                        print "Stiffener area required per ASD K1-9 (in2):",round((Pbf-PwoPwi)/36.0*1000)/1000, "(A36),", round((Pbf-PwoPwi)/50.0*1000)/1000, "(V50)"

                        print "Area of default stiffeners (bf): (2)", stiff_width_bf, "x", stiff_thk_bf, "=", net_stf_area_bf, "in2 (clip =", stiff_clip, ")"

                        print "Area of default stiffeners (A): (2)", stiff_width_A, "x", stiff_thk_A, "=", net_stf_area_A, "in2 (clip =", stiff_clip, ")"

                        print "Area of specified stiffeners: (2)", stiff_width, "x", stiff_thk, "=", net_stf_area, "in2 (clip =", stiff_clip, ")"

                        stiff_reqd = "Yes"

                    if stiff_reqd == "Yes":

                        print "Minimum stiffener size =", round((bm_list[bi].bf/3.0 - col_list[ci].tw/2.0)*1000)/1000, "x", round(bm_list[bi].tf/2*1000)/1000

                    else:

                        print "Stiffeners are not required."

                    print "\n"

                ## End ASD 9th Edition Code Check ##########################################################################################################

               

                # Adjust thickness of top stiffener if necessary

                if make_top_thicker == "Yes":

                    stiff_thk_top = stiff_thk + top_stiff_extra

                else:

                    stiff_thk_top = stiff_thk

                # Calculate member depth due to slope

                mem2_depth = round(bm_list[bi].depth / cos(dtor(bm_list[bi].slope)) * 16.0) / 16.0

               

                # Set work points for adding stiffeners

                if top_align == "Flush Top":

                    pt_WP_top = pt_WP

                elif top_align == "Flush Bott":

                    pt_WP_top = pt_WP + col_list[ci].translate(stiff_thk_top-bm_list[bi].tf, 0.0, 0.0)

                elif top_align == "Align CL":

                    pt_WP_top = pt_WP + col_list[ci].translate(stiff_thk_top/2-bm_list[bi].tf/2, 0.0, 0.0)

                elif top_align == "Offset":

                    pt_WP_top = pt_WP + col_list[ci].translate(top_offset, 0.0, 0.0)

 

                if bot_align == "Flush Top":

                    pt_WP_bot = pt_WP + col_list[ci].translate(-mem2_depth+bm_list[bi].tf-stiff_thk, 0.0, 0.0)

                elif bot_align == "Flush Bott":

                    pt_WP_bot = pt_WP + col_list[ci].translate(-mem2_depth, 0.0, 0.0)

                elif bot_align == "Align CL":

                    pt_WP_bot = pt_WP + col_list[ci].translate(-mem2_depth+bm_list[bi].tf/2-stiff_thk/2, 0.0, 0.0)

                elif bot_align == "Offset":

                    pt_WP_bot = pt_WP + col_list[ci].translate(-mem2_depth+bot_offset, 0.0, 0.0)

                elif bot_align == "Vert Dist":

                    dlg3 = Dialog( "Bott stiff vertical dist" )

                    dlg3.entry("vert_dist", dim_print(mem2_depth-stiff_thk), "Enter vertical dist to top of bott stiff" )

                    try:

                        dd1 = dlg3.done()

                    except ResponseNotOK:

                        break

                    pt_WP_bot = pt_WP + col_list[ci].translate(-dlg3.vert_dist-stiff_thk, 0.0, 0.0)

               

                ## Add stiffeners ##########################################################################

                stf_mtrl_list_ns = []

                stf_mtrl_list_fs = []

                if add_stf_tb == "Top" or add_stf_tb == "Both":

                    if which_side == "NS" or which_side == "BS":

                        pt11 = pt_WP_top + col_list[ci].translate(0.0, stiff_length / 2, col_list[ci].tw / 2)

                        pt12 = pt11 + col_list[ci].translate(0.0, -stiff_length, 0.0)

                        rp11 = stiff_pl(col_list[ci], pt11, pt12, stiff_thk_top,(-90.0, 0.0, -90.0))

                        stf_mtrl_list_ns.append(rp11)

                        if ad_stf_weld == "Yes" and make_top_thicker == "No":

                            stiff_weld([col_list[ci], ], rp11, stf_weld_size, stf_weld_type, "")         

                    if which_side == "FS" or which_side == "BS":

                        pt11 = pt_WP_top + col_list[ci].translate(0.0, -stiff_length / 2, -col_list[ci].tw / 2)

                        pt12 = pt11 + col_list[ci].translate(0.0, stiff_length, 0.0)

                        rp12 = stiff_pl(col_list[ci], pt11, pt12, stiff_thk_top, (90.0, 0.0, 90.0))

                        stf_mtrl_list_fs.append(rp12)

                        if ad_stf_weld == "Yes" and make_top_thicker == "No":

                            stiff_weld([col_list[ci], ], rp12, stf_weld_size, stf_weld_type, "")

                           

                if add_stf_tb == "Bott" or add_stf_tb == "Both":

                    if which_side == "NS" or which_side == "BS":

                        pt11 = pt_WP_bot + col_list[ci].translate(0.0, -stiff_length / 2, col_list[ci].tw / 2)

                        pt12 = pt11 + col_list[ci].translate(0.0, stiff_length, 0.0)

                        rp13 = stiff_pl(col_list[ci], pt11, pt12, stiff_thk, (-90.0, 0.0, 90.0))

                        stf_mtrl_list_ns.append(rp13)

                        if ad_stf_weld == "Yes":

                            stiff_weld([col_list[ci], ], rp13, stf_weld_size, stf_weld_type, "")              

                    if which_side == "FS" or which_side == "BS":

                        pt11 = pt_WP_bot + col_list[ci].translate(0.0, stiff_length / 2, -col_list[ci].tw / 2)

                        pt12 = pt11 + col_list[ci].translate(0.0, -stiff_length, 0.0)

                        rp14 = stiff_pl(col_list[ci], pt11, pt12, stiff_thk, (90.0, 0.0, -90.0))

                        stf_mtrl_list_fs.append(rp14)

                        if ad_stf_weld == "Yes":

                            stiff_weld([col_list[ci], ], rp14, stf_weld_size, stf_weld_type, "")

                ## End add stiffeners ##########################################################################

                            

                ## Add extended shear tab and stabilizer plate #################################################

                if add_shr_tab == "Yes":

                    counter = 0

                    mem3 = MemberLocate("Add shear tab - Select beam member")

                    if mem3 != None:

                        if mem3.mtrl_type == "W flange":

                            if mem3.type != "Beam":

                                print "You picked a " + mem3.type + ". You should have picked a beam."

                                pick_success = 0

                            else:

                                pick_success = 1

                        else:

                            print mem3.mtrl_type + " beam material is not supported.  "

                            pick_success = 0

                    else:

                        pick_success = 0

                    while pick_success == 1:

                        # Calculate WP at top of beam and center of column 'pt_WP'

                        pt_WP =  ret_WP(col_list[ci], mem3)[0]

                        if which_end == "left end":

                            matl_setback = mem3.left.setback

                        else:

                            matl_setback = mem3.right.setback

                        # set shear tab variables

                        no_rows = row_list(mem3.size)

                        end_ed = dim_print(dim(bolt_size) * 2.0)

                        pl_width = dim_print(round((matl_setback - col_list[ci].tw/2 + dim(end_ed)*2 + (int(no_cols) - 1)*dim(col_spa) + 0.12) * 4.0) / 4.0)

                        form_script_variables2()

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

                        ##  Dialog Box 2

                        dlg2 = Dialog( "Column connection assembly shear tab" )

                        dlg2.tabset_begin()

                        dlg2.tab("Shear Tab Information")

                        dlg2.column_group_begin()

                        dlg2.column(0)

                        dlg2.group_title("Shear Tab Information" )

                        dlg2.menu("add_shear_tab", ("Yes", "No"), "Yes", "Add extended shear tab            ")

                        dlg2.menu("which_side_NS", ("Right", "Left"), which_side_NS, "NS plate on which side of col CL")

                        dlg2.menu("which_side_FS", ("Right", "Left"), which_side_FS, "FS plate on which side of col CL")

                        dlg2.menu("pl_grade", Job().steel_grades("Plate").keys(), pl_grade, "Steel grade for shear tab")

                        dlg2.menu("pl_color", ("None", "Red Oxide", "Yellow Zinc", "Gray Oxide", "Sandblasted", "Blued Steel", "Galvanized"), pl_color, "Plate finish")

                        dlg2.group_title_end

                       

                        dlg2.group_title("Shear Tab Dimensions")

                        dlg2.entry("dist_1st", dist_1st, "Distance to first bolt row")

                        dlg2.entry("no_rows", int(no_rows), "Number of bolt rows")

                        dlg2.entry("no_cols", int(no_cols), "Number of bolt cols")

                        dlg2.entry("row_spa", row_spa, "Bolt row spacing")

                        dlg2.entry("col_spa", col_spa, "Bolt column spacing")

                        dlg2.entry("end_ed", end_ed, "End of matl to 1st bolt column")

                        dlg2.entry("pl_thk", pl_thk, "Thickness of shear plate")

                        dlg2.entry("pl_width", pl_width, "Width of shear plate")

                        dlg2.entry("pl_end_gap", pl_end_gap, "End of matl to cope edge")

                        dlg2.entry("vert_ed", vert_ed, "Cope vert E.D from holes")

                        dlg2.entry("clip_dim", clip_dim, "Clip dimension")

                        dlg2.group_title_end

                        dlg2.group_title("Tab Depth Options")

                        dlg2.menu("full_part_depth", ("Full Depth", "Partial Depth"), full_part_depth, "'Full' or 'Partial' depth")

                        dlg2.line("If 'Partial Depth' is selected, 'Cope Bott' and \n'Clip Bott' will be disabled automatically")

                        dlg2.group_title_end

                       

                        dlg2.column(0)

                        dlg2.group_title("Member Information")

                        dlg2.line("Member size: " + mem3.size + "        Piecemark: " + mem3.piecemark)

                        dlg2.line("Reaction Left end: " + " %0.1f"%mem3.left.shear + " kips")

                        dlg2.line("Reaction Right end: " + " %0.1f"%mem3.right.shear + " kips")

                        dlg2.group_title_end

                        

                        dlg2.checkbutton("prep_list", ["Cope Top", "Cope Bott", "Clip Top", "Clip Bott", "None"], prep_list, "Shear plate end preparation" )

                       

                        dlg2.group_title("Partial Depth Tab Stabilizer")

                        dlg2.menu("add_bott_stab", ("Yes", "No"), add_bott_stab, "Add shear tab bottom edge stabalizer plate")

                        dlg2.line("Thickness will match shear tab thickness")

                        dlg2.entry("stab_width", stab_width, "Stabilizer plate width")

                        dlg2.group_title("Bolt information")

                        dlg2.entry( "bolt_size", bolt_size, "Enter bolt size")

                        dlg2.menu( "hole_type_web", ("Standard Round", "Short Slot", "Oversized Round", "Long Slot"), hole_type_web, "Hole type in shear tab")

                        dlg2.menu( "bolt_type_web", ("A325N", "A325SC", "A307", "A490N"), bolt_type_web, "Bolt type in shear tab")

                        dlg2.group_title_end

                        dlg2.group_title("Welding")

                        dlg2.entry( "tab_weld_size", tab_weld_size, "Shear tab weld to column web size")

                        dlg2.entry( "tabstf_weld_size", tabstf_weld_size, "Shear tab weld to column web size")

                        dlg2.menu( "tab_weld_type", ("Fillet", "Square butt", "Bevel groove"), tab_weld_type, "Shear tab weld type" )

                        dlg2.group_title_end

                        dlg2.tab("Image")

                        dlg2.image(image_name2)

                        try:

                            dd2 = dlg2.done()

                        except ResponseNotOK:

                            break

                        try:

                            prep_list = dd2['prep_list']

                        except KeyError:

                            prep_list = ["None"]

                            Warning("Error setting 'prep_list")

                        globals().update(dd2)

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

                        ## END DIALOG BOX 2 -----------------------------------------------------------------------------------------------------------------#

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

                       

                        ## Add extended shear tab ############################################################################################################

                        if add_shear_tab == "Yes":

                            stiff_oo = pt_WP_top.dist(pt_WP_bot)

                            # determine whether plate is NS or FS of column web

                            net_angle = col_list[ci].rotation - mem3.plan_rotation

                            if which_end == "left end" and net_angle > 0.0 or which_end == "right end" and net_angle < 0.0:

                                case_no = "Case NS"

                                rot_argument = (-90.0, 0.0, 180.0)

                                webside_flg = 1

                            else:

                                case_no = "Case FS"

                                rot_argument = (-90.0, 180.0, 0.0)

                                webside_flg = -1

                            if case_no == "Case NS":

                                if which_side_NS == "Right":

                                    y_off = -mem3.tw/2

                                else:

                                    y_off = mem3.tw/2 + pl_thk

                            if case_no == "Case FS":

                                if which_side_FS == "Left":

                                    y_off = mem3.tw/2

                                else:

                                    y_off = -mem3.tw/2 - pl_thk

                                   

                            dist_stf = pt_WP_top.z - pt_WP.z + dist_1st

                            hole_dim_x = dist_stf - stiff_thk_top

                            hole_dim_y = matl_setback + end_ed - col_list[ci].tw/2

                            # Check to see if plate is wide enough to accomodate the hole pattern

                            if (hole_dim_y + (no_cols-1)*col_spa + 0.75) > pl_width:

                                Add_ch = yes_or_no("Plate width will not accomodate hole pattern. Adjust?")

                                if Add_ch == 1:

                                    # Recalculate plate width

                                    pl_width = (round((matl_setback - col_list[ci].tw/2 + dim(end_ed)*2 + (no_cols - 1)*col_spa + 0.12) * 4.0) / 4.0)

                                   

                            # Calculate depth (material length) of extended shear tab   

                            if full_part_depth == "Full Depth":

                                """

                                if isinstance(stiff_oo, types.StringType):

                                    print "stiff_oo is a string"

                                elif isinstance(stiff_thk_top, types.StringType):

                                    print "stiff_thk_top is a string"

                                elif isinstance(stiff_thk, types.StringType):

                                    print "stiff_thk is a string"

                                """

                                pl_length = stiff_oo - stiff_thk_top - stiff_thk

                            else:

                                pl_length = max(hole_dim_x + (no_rows-1)*row_spa + vert_ed, tab_length(mem3.size))

                               

                            if "None" in prep_list:

                                cope_top = 0

                                cope_bott = 0

                                clip_top = 0

                                clip_bott = 0

                                prep_list = ["None", ]

                                dd2['prep_list'] = ["None", ]

                            else:       

                                if "Cope Top" in prep_list:

                                    cope_top = [(dist_stf - vert_ed - stiff_thk_top), round((pl_width + col_list[ci].tw/2 - matl_setback + pl_end_gap) * 4.0) / 4.0]

                                else:

                                    cope_top = 0

                                if "Cope Bott" in prep_list and full_part_depth == "Full Depth":

                                    cope_bott = [(stiff_thk_top + pl_length - dist_stf - (no_rows-1)*row_spa - vert_ed), \

                                                 round((pl_width + col_list[ci].tw/2 - matl_setback + pl_end_gap) * 4.0) / 4.0]

                                else:

                                    cope_bott = 0

                                if "Clip Top" in prep_list:

                                    clip_top = [clip_dim, clip_dim]

                                else:

                                    clip_top = 0

                                if "Clip Bott" in prep_list and full_part_depth == "Full Depth":

                                    clip_bott = [clip_dim, clip_dim]

                                else:

                                    clip_bott = 0

                            # add extended shear tabs, holes, and weld

                            pt11 = pt_WP_top + col_list[ci].translate(-stiff_thk_top, y_off, webside_flg * col_list[ci].tw/2)

                            pt12 = pt11 + col_list[ci].translate(-pl_length, 0.0, 0.0)

                            rp21 = plate_add(col_list[ci], pt11, pt12, rot_argument)

                            pl_holes (rp21)

                            if add_bott_stab == "Yes" and full_part_depth == "Partial Depth":

                                if case_no == "Case NS":

                                    pt11 = pt_WP_top + col_list[ci].translate(-(stiff_thk_top+pl_length+pl_thk), stiff_length/2, col_list[ci].bf/2)

                                    pt12 = pt11 + col_list[ci].translate(stiff_length, 0.0, 0.0)

                                    rp101 = stabilizer_pl(col_list[ci], pt11, pt12, (90.0, 0.0, -90.0))

                                    if ad_stf_weld == "Yes":

                                        stiff_weld([col_list[ci], rp21], rp101, tabstf_weld_size, tab_weld_type, "")

                                else:

                                    pt11 = pt_WP_top + col_list[ci].translate(-(stiff_thk_top+pl_length+pl_thk), -stiff_length/2, -col_list[ci].bf/2)

                                    pt12 = pt11 + col_list[ci].translate(stiff_length, 0.0, 0.0)

                                    rp101 = stabilizer_pl(col_list[ci], pt11, pt12, (-90.0, 0.0, 90.0))

                                    if ad_stf_weld == "Yes":

                                        stiff_weld([col_list[ci], rp21], rp101, tabstf_weld_size, tab_weld_type, "")

                           

                            if ad_stf_weld == "Yes":

                                if case_no == "Case NS":

                                    weld_mtrl_list = stf_mtrl_list_ns

                                else:

                                    weld_mtrl_list = stf_mtrl_list_fs

                                stiff_weld([col_list[ci], ], rp21, tab_weld_size, tab_weld_type, "")

                                stiff_weld(weld_mtrl_list, rp21, tabstf_weld_size, tab_weld_type, "")

 

                            counter = counter + 1

                            if counter == 1:

                                ad_opp_tab = yes_or_no("Add same shear tab on opposite side of column web?")

                                if ad_opp_tab == 1:

                                    if case_no == "Case NS":

                                        case_no = "Case FS"

                                        rot_argument = (-90.0, 180.0, 0.0)

                                        webside_flg = -1

                                    else:

                                        case_no = "Case NS"

                                        rot_argument = (-90.0, 0.0, 180.0)

                                        webside_flg = 1

                                    y_off = y_off * -1

                                    pt11 = pt_WP_top + col_list[ci].translate(-stiff_thk_top, y_off, webside_flg * col_list[ci].tw/2)

                                    pt12 = pt11 + col_list[ci].translate(-pl_length, 0.0, 0.0)

                                    rp31 = plate_add(col_list[ci], pt11, pt12, rot_argument)

                                    pl_holes (rp31)

                                    if add_bott_stab == "Yes":

                                        if case_no == "Case NS":

                                            pt11 = pt_WP_top + col_list[ci].translate(-(stiff_thk_top+pl_length+pl_thk), stiff_length/2, col_list[ci].bf/2)

                                            pt12 = pt11 + col_list[ci].translate(stiff_length, 0.0, 0.0)

                                            rp102 = stabilizer_pl(col_list[ci], pt11, pt12, (90.0, 0.0, -90.0))

                                            if ad_stf_weld == "Yes":

                                                stiff_weld([col_list[ci], rp31], rp102, tabstf_weld_size, tab_weld_type, "")

                                        else:

                                            pt11 = pt_WP_top + col_list[ci].translate(-(stiff_thk_top+pl_length+pl_thk), -stiff_length/2, -col_list[ci].bf/2)

                                            pt12 = pt11 + col_list[ci].translate(stiff_length, 0.0, 0.0)

                                            rp102 = stabilizer_pl(col_list[ci], pt11, pt12, (-90.0, 0.0, 90.0))

                                            if ad_stf_weld == "Yes":

                                                stiff_weld([col_list[ci], rp31], rp102, tabstf_weld_size, tab_weld_type, "")                               

                                   

                                    if case_no == "Case NS":

                                        weld_mtrl_list = stf_mtrl_list_ns

                                    else:

                                        weld_mtrl_list = stf_mtrl_list_fs

                                    stiff_weld([col_list[ci], ], rp31, tab_weld_size, tab_weld_type, "")

                                    stiff_weld(weld_mtrl_list, rp31, tabstf_weld_size, tab_weld_type, "")

                                   

                                    pick_success = 0

                                else:

                                    mem3 = MemberLocate("Add shear tab - Select opp. beam member")

                                    if mem3 != None:

                                        if mem3.mtrl_type == "W flange":

                                            if mem3.type != "Beam":

                                                print "You picked a " + mem3.type + ". You should have picked a beam."

                                                pick_success = 0

                                            else:

                                                pick_success = 1

                                        else:

                                            print mem3.mtrl_type + " beam material is not supported.  "

                                            pick_success = 0

                                    else:

                                        pick_success = 0

                            else:

                                pick_success = 0

                        else:

                            pick_success = 0

 

        # Export defaults to disk if enabled

        try:

            dd_list.append(dd2)

        except:

            dd_list.append({'prep_list': prep_list, })

        if enable_default_import_export == "Enable":

                export_data(default_file_path + def_file, dd_list, script_name)

        Add_pls = yes_or_no("Add additional column stiffeners/continuity plates?")

        if Add_pls == 0:

            break

    except:

        Warning(formatExceptionInfo(1))

        break

# end script xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx