## KickerGPL.py Version 1.08

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

## All rights reserved.

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

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

""" This script will add kicker gusset plates to a W flange or Tube beam by picking

    points while in plan or elevation.

    The plates can be oriented vertically or normal to the beam.

    Thickness reference point on the plate material is alwalys "Center"

    A pin hole can be added optionally.

    An option to skew plates was added in 1.07.

 

    This script can be executed in plan or elevation.

 

    R1 -            Updated code

    6_3 Version -   Edited code for hole pattern differences with SDS/2 version 6.2xx as follows:

                    "FS Face" >> "NS Face", Hole group rotation 0.0 >> -135.0, "LL" >> "UR"

    R2 -            Updated code to work in SDS/2 6.323

                    Hole group rotation -135.0 >> 0.0; "UR">>"UL"

                    Add ability to select a long slot length other than SDS/2 calculated length

    R3 -            Modified code for selecting member. (3/8/04)

    Version 1.01 -  Test in SDS/2 Version 7.004 and update code

    Version 1.02 -  Add T&B option

    Version 1.03 -  Add ability to add plates to all members with same piece mark

    Version 1.04 -  Remove support for SDS/2 6.3xx

                    Modify dialog box

                    Add import/export defaults feature

    Version 1.05 -  (6/11/06) Add variable to offset selected points along beam 'X' axis

    Version 1.06 -  (8/12/06) Add material use description 'Kicker GPL'

                    If weld is added, all plates receive weld instead of only the first one added.

    Version 1.07 -  Add ability to rotate plates. Variable added: theta

                    Sort default file written to disk on variable names

    Version 1.08 -  Import modules, update code

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

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

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

 

    Originally developed in SDS2 6.245, Python 1.5.1    9/30/02 (R1)

    Tested in SDS/2 version 7.023, Python 2.2.1 ***Will not work in SDS/2 versions 6.xxx***

    This version requires SDS/2 version 7.025 or later

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

    For comments, suggestions or questions call BV at the number above, email bvaughan@bvdetailing

    or post to SDS/2 forum.

   

    Go to Defaults Section to edit script default values.

"""

def run_script():

    import os

    # startup code begin

    from math import cos, floor, pi, tan, sin, atan

    from param import yes_or_no, ResponseNotOK, Units, ClearSelection

    from param import Dialog, dim_print, Warning, dim

    from macrolib.FileDefaults import import_data, export_data

    # macrolib.pickle required

    from macrolib.MemSelection import mem_select

    # macrolib.MemCnt required

    from macrolib.Weld import mtrl_weld

    from macrolib.ExceptWarn import formatExceptionInfo

    from macrolib.angle import rtod, dtor

    from macrolib.kicker import kicker_pl, gpl_hole, add_kicker_pl

 

    Units("feet")

    from shape import Shape

    from point import Point, PointLocate

    from member import Member, MemberLocate

    from mtrl_list import MtrlLocate, HoleLocate

    from rect_plate import RectPlate

    from rolled_section import RolledSection

    from hole_add import Hole

    from bolt_add import Bolt

    from mtrl_fit import MtrlFit

    from job import Job

    from fab import Fabricator

    from mtrl_cut import MtrlCut

    # startup code end

    ## Variables Section ################################################

    # system path for defaults file

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

    # defaults file

    def_file = "Beam_KickerGPL.txt"

 

    # Dialog box image path and file name

    image_path = os.path.join(os.getcwd(), "macro", "Images")

 

    # Dialog box image path and file name

    image_name1 = os.path.join(image_path, "Beam_KickerGPL1.gif")

    image_name2 = os.path.join(image_path, "Beam_KickerGPL2.gif")

    image_name3 = os.path.join(image_path, "Beam_KickerGPL3.gif")

 

    # Enable or disable import/export dialog dictionary variables

    # ["Enable" "Disable"]

    enable_default_import_export = "Enable"

 

    finishList = ["None", "Red Oxide", "Yellow Zinc", "Gray Oxide", "Sandblasted", "Blued Steel", "Galvanized"]

    holeTypeList = ["Standard Round", "Short Slot", "Oversized Round", "Long Slot"]

    boltTypeList = Job().bolt_sched()

    mtrlGradeList = Job().steel_grades("Plate").keys()

    weldSizeList = ['3/16', '1/4', '5/16']

 

    ## Defaults Section #############################################

    # plate offset from the selected point locations

    points_x_offset = -0.1875

    # plate rotation from the orthogonal

    theta = 0.0

    # side(s) for gusset plates ("BS", "NS", "FS")

    which_side = "BS"

    # add plate at top or bottom flange ("Top", "Bott", "T&B")

    top_or_bott = "Bott"

    # plate width (width is vertical)

    gpl_width = 5.0

    # plate length (length is horizontal)

    gpl_length = 5.0

    # plate thickness

    gpl_thk = 0.375

    # plate clip dimension

    gpl_clip = 1.0

    # set plates normal to beam or vertical ("Normal", "Vertical")

    norm_or_vert = "Normal"

 

    matlcolor = "Yellow Zinc"

 

    matlgrade = "A36"

 

    # add hole for erection bolt ("Yes", "No")

    add_pin_hole = "Yes"

 

    # horizontal gage, distance from plate edge

    x_ga = 3.0

    # vertical gage, distance from plate edge

    y_ga = 3.0

    bolt_size = 0.75

    bolt_type = "A325"

    hole_type = "Standard Round"

    # long slot length where applicable - enter 0" to have SDS/2 calculate length

    long_slot_length = 0.0

 

    # add weld       ("Yes", "No")

    add_gpl_weld = "No"

 

    # weld type ("Fillet", "Square butt")

    gpl_weld_type = "Fillet"

    weld_size = "3/16"

    ## end Defaults and Variables Section ###############################

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

    ## Import defaults data if enabled

    if enable_default_import_export == "Enable":

        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

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

    ## Main program loop

    # Select member

    while True:

        bm_list = mem_select("Select a WF or HSS BEAM member", ['Beam',], ["W flange", "Tube"])

        if bm_list is None:

            break

        mem1 = bm_list[0]

 

        # If beam is a Tube, clipped corners are not required   

        if mem1.mtrl_type == "Tube":

            gpl_clip = 0.0

 

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

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

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

        dlg1 = Dialog("Add kicker gusset plates")

        dlg1.menu("print_doc", ("Yes", "No"), "No", "Print documentation only")

        dlg1.tabset_begin()

        dlg1.tab("General Information")

       

        dlg1.group_title("Location and orientation")

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

        dlg1.menu("top_or_bott", ("Top", "Bott", "T&B"), top_or_bott, "Top or bottom flange")

        dlg1.menu("norm_or_vert", ("Normal", "Vertical"), norm_or_vert, "Gusset plate orientation")

        dlg1.entry("points_x_offset", dim_print(points_x_offset), "Member 'X' offset distance from selected points to PL CL")

        dlg1.group_title_end

       

        dlg1.group_title("Dimensions, Color and Mtrl Grade")

        dlg1.entry("gpl_width", dim_print(gpl_width), "Plate width (vertical)")

        dlg1.entry("gpl_length", dim_print(gpl_length), "Plate length (horizontal)")

        dlg1.entry("gpl_thk", dim_print(gpl_thk), "Plate thickness")

        dlg1.entry("gpl_clip", dim_print(gpl_clip), "Clip dimension")

        dlg1.menu("matlcolor", finishList, matlcolor, "Material finish" )

        dlg1.menu("matlgrade", Job().steel_grades("Plate").keys(), matlgrade, "Material grade")

        dlg1.group_title_end

       

        dlg1.group_title("Additional Options")

        dlg1.entry("theta", theta, "Plate rotation about member 'Y' axis")

        dlg1.menu("add_pin_hole", ("Yes", "No"), add_pin_hole, "Add a pin hole")

        dlg1.menu("add_gpl_weld", ("Yes", "No"), add_gpl_weld, "Add weld" )

        dlg1.group_title_end

       

        dlg1.tab("Pin Hole Information")

        dlg1.group_title("Dimensions")

        dlg1.entry("x_ga", dim_print(x_ga), "Horizontal gage from edge of plate")

        dlg1.entry("y_ga", dim_print(y_ga), "Vertical gage from edge of plate")

        dlg1.group_title_end

        

        dlg1.group_title("Bolt Information")

        dlg1.entry("bolt_size", dim_print(bolt_size), "Enter bolt size")

        dlg1.menu("bolt_type", Job().bolt_sched(), bolt_type, "Bolt type in plate")

        dlg1.group_title_end

       

        dlg1.group_title("Hole Information")

        dlg1.menu("hole_type", holeTypeList, hole_type, "Hole type in plate")

        dlg1.group_title_end

       

        dlg1.group_title("'long slot length' = 0 to calculate length")

        dlg1.entry("long_slot_length", dim_print(long_slot_length), "Slot length (applies to 'Long Slot')")

        dlg1.group_title_end

 

        dlg1.tab("Weld Information")

        dlg1.group_title("Welding Data")

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

        dlg1.menu("weld_size", ("3/16", "1/4", "5/16"), weld_size, "Weld size")

        dlg1.group_title_end

        dlg1.group_title("Graphic showing multiple plates with vertical and normal orientation")

        dlg1.image(image_name3)

        dlg1.group_title_end

       

        dlg1.tab("Graphic Image")

        dlg1.column_group_begin()

        dlg1.column(0)

        dlg1.image(image_name1)

        dlg1.column(0)

        dlg1.image(image_name2)

        dlg1.column_group_end()

        dlg1.tabset_end()

        try:

            dd1 = dlg1.done()

        except ResponseNotOK:

            break 

       

        # Update the local namespace for next loop

        for key, value in dd1.items():

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

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

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

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

        if print_doc == "Yes":

            print __doc__

            break

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

        # Export defaults to disk if enabled

        if enable_default_import_export == "Enable":

            export_data(os.path.join(default_file_path, def_file), dd1)

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

 

        pt_list = [] 

        while 1:

            if (len(pt_list)) == 0:

                pt21 = PointLocate("Select gusset plate location or return")

            else:

                pt21 = PointLocate("Select another gusset plate location or return")

            if pt21 == None:

                break

            else:

                pt_list.append(pt21)

       

        rp_list = add_kicker_pl(pt_list, bm_list, dd1)

                       

        if not yes_or_no("Add kicker gusset plates to another member?"):

            break

 

## End run_script()

if __name__ == '__main__':

    try:

        run_script()

    finally:

        del run_script