Back to SDS/2 Parametric Scripts

 

##  Beam_BPL_Pourstop.py Version 1.12

##  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 bent plate pour stop material to the top of a beam member. Only beam members are supported.

 

      Each run of bent plate can be continuous or broken up into pieces of a variable maximum length. The user

      can add multiple runs to each selected member. The user can modify the variable that controls the shortest

      allowable length to add. A warning will be displayed if the last piece in a run is too short.

 

    Note that bent plate material may not cut properly at each end if in one piece. This is a limitation of

    SDS/2 at the present time.     

 

    The user can elect to add the bent plates to all members with the same piecemark.

 

    If enabled, the script will read/write dialog box default values from/to disk. Go to the "Variables Section"

    to modify the system path and file name and to disable or enable this feature.

 

    Option 1:     When prompted, press enter or right click (return) and the user can enter bent plate setbacks

                directly into the dialog box. The setbacks are measured from the member workpoints

                (mem.left.location and mem.right.location). The user can be in any model orientation. Multiple

                runs can be added.

    Option 2:     When prompted, pick the start point and end point of each bent plate run. The points must be

                picked from left to right with respect to the member line. To work as intended, the user should

                be in plan, but results may be satisfactory if in elevation parallel to the member work line.

                The user will get a dialog box for each run.

 

      Closure plates at the ends of bent plate runs can be added. The closure plates can be capped or nested.

      The height and length of the closures will match the bent plate dimensions if '0.0' is entered for the

      dimensions.

 

    Bent plates can be coped around columns that support the member ends. The program automatically reads the

    columns that support the beam (not applicable to cantilever or continuous beam framing), and the user has

    the option to attempt to cope the first and/or last bent plate in any run. Two cope options are available.

    The script uses Cut Layout. If an attempt to cope one of the bent plates fails, a message is returned. Cope

    dimensions are rounded up to a variable increment accessed in the Variables Section.

 

    For increased productivity using pick points, the user should pick the start and end points at the start

    and end locations of the vertical leg. The start and end point offsets from the member line (member "X"

    and "Z" coodinates) can be overridden in the dialog box. The user can offset the bent plate run in the

    member "Y" direction.

 

    A reprocess may be required to combine piece marks when adding bent plates to all members with the same mark.    

 

    There is no check of amount of lap onto the beam flange.

 

    There is no check for determining a requirement for bent plate kickers or outrigger plates.    

 

    NOTE:

    This script will read and write the defaults to a disk file if so enabled in the "Defaults section". The

    first time the script is executed the defaults file will be created. Subsequent script executions will

    import the defaults used in the previous execution. Set the variable "enable_default_import_export" to

    "Disable" to disable this feature.

 

    Revision History:

    Version 1.00 -      Update for SDS/2 version 7.023

    Version 1.01 -  Pass cut horizontal leg if x_dist_* > *_bpl_setback - eliminates the annoying warning

                    windows in many cases

    Version 1.02 -  Modify dialog box - make bent plate width prominent

                    Create 'closure_plate_type_left' and 'closure_plate_type_right'

                    Change 'column_left' to 'column_right' one place in dialog box code

    Version 1.03 -  Made correction to code that calculates ang_cut_right:

                    while ang_cut_right > 90.0:

                        ang_cut_left = ang_cut_right - 180.0

                    Edit general instructions

                    Fixed remaining 'closure_plate_type' >> 'closure_plate_type_left' 'closure_plate_type_right'

    Version 1.04 -  Develop function 'polar_pt_3D'

                    Abbreviate some lengthy point calculations in 'cope around column' section

                    Add construction line function for debugging and testing

    Version 1.05 -  Edit general instructions

                    Edit note for function 'polar_pt_3D'

                    Add variables 'weld_inter_length' and 'weld_inter_spa' to the dialog box

    Version 1.06 -  Reorganize "General Information" tab in dialog box

    (4/25/06)       Comment out "Skewed to column - 'Cope to End'" image on "Graphic Image" tab

    Version 1.07 -  Reword explanatory note in dialog box:

                    dlg1.line("A '-' SLAB EDGE distance adds BPL material FS of member line.

                                'Which side of member line' sets the toe direction.") TO

                    dlg1.line("A '-' SLAB EDGE distance adds BPL material FS of member line.

                                'Toe bent plate away from NS or FS' sets the toe direction.")

    Version 1.08 -  Recode polar_pt_3D --> PolarPt3D

    Version 1.09 (10/28/06) -   Import modules from macrolib

                                Create function to run script - all variables are local - delete from

                                    global namespace upon exit

                                Add option in dialog box to print documentation only

                                Use 'os.getcwd()' to determine the current working directory (SDS/2 root data)).

    Version 1.10 (11/07/06) -   Add dialog box at beginning of main program to import custom default values file.

                                Add option above main dialog box tabs to export custom default values file.

    Version 1.11 (11/22/06) -   Modify module name 'ColumnFraming' and calls

                                import macrolib.Weld.mtrl_weld and delete function pl_weld

                                Rework calculation of setbacks and offsets

    Version 1.12 (11/27/06) -   Eliminate imports string and types

   

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

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

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

           

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

 

    BEAM_BNTPL_POURSTOP.py was originally developed by Christopher Keyack (April 2004) for Design Data   

 

    Versions 0.99 - 1.03 were developed and tested in SDS2 7.023 (April 16-21, 2006) 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.

 

    'formatExceptionInfo()' is an exception handling function that formats the exception info into a

    string for display and was developed by Phil Adams [padams@colloquiuminc.com]. The function is

    used in this script by permission.

 

    NOT FOR SALE

 

    Go to 'Variables section' to turn off the importing and exporting of the default file

    Go to 'Variables section' to edit system paths for image and default files

    Go to 'Defaults section' to edit script defaults.

 

    Required files from folder 'macrolib' on SDS/2 system path:

        pickle.py (required for FileDefaults)

        FileDefaults.py

        MemCnt.py

        angle.py

        ExceptWarn.py

        L3D.py (required for ColumnFraming)

        ColumnFraming.py

        round_length.py

        PolarPt.py

        Weld.py

 

    Required folders:

        "system path"/macrolib

        "system path"/Defaults

        "system path"/Images

 

"""

def run_script():

    # startup code begin

    from math import cos, sin, atan2, ceil, tan

    from param import yes_or_no, ResponseNotOK, Units, ClearSelection, Dialog, dim_print, Warning, dim

    import macrolib.pickle

    from macrolib.FileDefaults import import_data, export_data, job_Defaults_path, data_Defaults_path, check_Defaults_dir

    from macrolib.MemCnt import member_count

    from macrolib.angle import rtod, dtor

    from macrolib.ExceptWarn import formatExceptionInfo

    from macrolib.ColumnFraming import ColumnSupport, ColumnCondition

    from macrolib.round_length import round_length_next

    from macrolib.PolarPt import polar_pt_hor, PolarPt3D

    from macrolib.Weld import mtrl_weld

   

    import os

    import sys

    Units("feet")

    from job import Job

    from shape import Shape

    from point import Point, PointLocate

    from member import Member, MemberLocate

    from cons_line import ConsLine

    from rect_plate import RectPlate

    from bnt_plate import BntPlate

    from rolled_section import RolledSection

    from weld_add import Weld

    from mtrl_cut import MtrlCut

    # startup code end

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

    drv_letter, drv_path = os.path.splitdrive(os.getcwd())

    ## Variables section

    # system path for default values files

    # auto save path

    default_file_path = data_Defaults_path()

    # user save path

    job_default_file_path = os.path.join(job_Defaults_path(), "Beam_BPL_Pourstop")

    # default values file name

    def_file = "Beam_BPL_Pourstop_v1_12.txt"

    script_name = "Beam_BPL_Pourstop_v1.12.py"

    # default to enable or disable the automatic importing and exporting of dialog dictionary variables

    # ("Enable", "Disable")

    enable_default_import_export = "Enable"

    """

        The saving and importing of default files requires that a subdirectory 'Defaults' exists.

        The 'Defaults' directory for automatic import/export is returned by 'data_Defaults_path()' ('SDS/2 root data/macro/Defaults)

        The 'Defaults' directory for user import/export is returned by 'job_Defaults_path()'('job directory'/macro/Defaults')

    """

    # check if automatic defaults directory exists

    if enable_default_import_export == "Enable":

        if not check_Defaults_dir(default_file_path):

            Warning("Edit the parametric and change variable 'enable_default_import_export' value to 'Disable'")

           

    # check if user defaults directory exists

    if not check_Defaults_dir(job_default_file_path):

        job_default_file_path = default_file_path

   

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

    image_name = os.path.join(image_path, "Beam_BPL_Pourstop.gif")

    image_name1 = os.path.join(image_path, "Beam_BPL_Pourstop1.gif")    # Min. Cope

    image_name2 = os.path.join(image_path, "Beam_BPL_Pourstop2.gif")    # Cope to End

    image_name3 = os.path.join(image_path, "Beam_BPL_Pourstop3.gif")    # 'End Cap'

    image_name4 = os.path.join(image_path, "Beam_BPL_Pourstop4.gif")    # 'Nested'

    image_name5 = os.path.join(image_path, "Beam_BPL_Pourstop5.gif")    # Vertical leg cut

    image_name6 = os.path.join(image_path, "Beam_BPL_Pourstop6.gif")    # Closure Plate

    image_name7 = os.path.join(image_path, "Beam_BPL_Pourstop7.gif")    # Weld

   

    # cope dimensions are rounded up to this increment (not in dialog box)

    cope_round_increment = 0.0625              

   

    ### Defaults section ######################################################

    # ("FS", "NS") if 'left_bpl_z_offset' is < 0, default is set to "FS" else set to "NS"

    which_side = "FS"                          

    bpl_thk = 0.25                                                # thickness of bent plate

    bpl_width = 11.0                                        # width of bent plate

    bpl_height = 6.0                                        # height of bent plate

    max_length = 120.0                                      # maximum length of bent plate material

    min_length = 1.0                                        # minimum length of bent plate to be added

    # add bent plate material in one continuous piece or break into pieces using "max_length" - ("Break", "Cont")

    break_or_cont = "Break"                                

 

    # A vertical offset of 0 places the horizontal leg of the bent plate on top of the beam

    vertical_offset = 0.25                                  # vertical offset dimension (lowers or raises horizontal leg)

    left_bpl_setback = -12.0                          # bent plate material setback left end - negative number extends - pick points sets this variable

    right_bpl_setback = -12.0                         # bent plate material setback right end - negative number extends - - pick points sets this variable

    left_bpl_z_offset = 12.0                          # distance from beam CL to bent plate vertical leg left end - pick points sets this variable

    right_bpl_z_offset = 12.0                         # distance from beam CL to bent plate vertical leg right end - pick points sets this variable

 

    closure_plate_thk = 0.25

    closure_plate_cut_dim = 0.5

    closure_plate_length_left = 0.0                   # value is calculated if == 0

    closure_plate_length_right = 0.0                  # value is calculated if == 0

    closure_plate_height_left = 0.0                   # value is calculated if == 0

    closure_plate_height_right = 0.0                  # value is calculated if == 0

    closure_plate_cut_type = "Clip"                   # ["Clip", "Cope"]

    closure_plate_type_left = "Nested"          # ["Nested", "End Cap"]

    closure_plate_type_right = "Nested"         # ["Nested", "End Cap"]

 

    end_closure_left = "Yes"                          # add end closure to left end

    end_closure_right = "Yes"                         # add end closure to right end

 

    cope_left = "Yes"                                       # cope bent plate around column left end

    cope_type_left = "Cope to End"              # ("Min. Cope", "Cope to End")

    cope_clear_left = 0.5                                   # cope clearance left end

    cope_right = "Yes"                                      # cope bent plate around column right end

    cope_type_right = "Min. Cope"               # ("Min. Cope", "Cope to End")

    cope_clear_right = 0.5                                # cope clearance left end

 

    cut_vert_leg_left = "Yes"                         # cut vertical leg down to edge of bend radius left end

    cut_left_length = 6.0

    cut_vert_leg_right = "Yes"                              # cut vertical leg down to edge of bend radius right end

    cut_right_length = 12.0

 

    bpl_grade = "A36"                                       # Job().steel_grades("Plate").keys()

    bpl_finish = "Gray Oxide"                         # ("None", "Red Oxide", "Yellow Zinc", "Gray Oxide", "Sandblasted", "Blued Steel", "Galvanized")

    closure_grade = "A36"                                   # Job().steel_grades("Plate").keys()

    closure_finish = "Yellow Oxide"                   # ("None", "Red Oxide", "Yellow Zinc", "Gray Oxide", "Sandblasted", "Blued Steel", "Galvanized")

 

 

    ## WELDING DEFAULTS - TAIL NOTE IS NOT SUPPORTED IN THIS VERSION

    add_bpl_weld = "Yes"                        # add weld bent plate      "Yes" "No"

    ## weld type is limited to 'Fillet'

    bpl_weld_type = "Fillet"                    # weld type "Fillet"

    ## Weld Size is common to bent plate weld and closure weld

    weld_size = "3/16"                          # weld size "3/16", "1/4"

    ## Intermittent only applies to bent plate weld

    weld_stagger = "Opposite"                   # stagger weld to bent plate "No" "Opposite" "Offset"

    weld_inter_length = 2.0                     # intermittent weld length

    weld_inter_spa = 12.0                       # intermittent weld spacing

    add_weld_bpl_to_bpl = "Yes"                 # butt weld bent plate to bent plate

    add_closure_weld = "Yes"                    # add weld closure plate

    ### End Defaults and Variables Sections ###################################

    ### FUNCTION DEFINITIONS ##################################################

    ## Make cope in bent plate horizontal leg

    def cope_at_column(mtrl, p1, p2, p3, p4):

        try:

            # mtrl cut begin

            mcut1 = MtrlCut()

            mcut1.mtrl = [mtrl, ]

            mcut1.rotate = (0,0,0)

            mcut1.pts.append( (p1, 0.5) )

            mcut1.pts.append( (p2, 0.5) )

            mcut1.pts.append( (p3, 0.5) )

            mcut1.pts.append( (p4, 0.5) )

            mcut1.pts.append( (p1, 0.5) )

            mcut1.cut("Layout")

            return 1

        except:

            Warning(formatExceptionInfo())

            return 0

        # mtrl cut end

    ## Make cope in bent plate vertical leg

    def cope_vert_leg(mtrl, p1, p2, p3, p4):

        try:

            # mtrl cut begin

            mcut1 = MtrlCut()

            mcut1.mtrl = [mtrl, ]

            mcut1.rotate = (90,0,0)

            mcut1.pts.append( (p1, 0.5) )

            mcut1.pts.append( (p2, 0.5) )

            mcut1.pts.append( (p3, 0.5) )

            mcut1.pts.append( (p4, 0.5) )

            mcut1.pts.append( (p1, 0.5) )

            mcut1.cut("Layout")

            return 1

        except:

            Warning(formatExceptionInfo())

            return 0

        # mtrl cut end

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

    ## Add construction lines for debugging and testing bpl cuts around columns

    def const_lines(p1, p2, p3, p4, i):

        # construction line begin

        cl1 = ConsLine()

        cl1.pt1 = p1

        cl1.pt2 = p2

        cl1.pen = i

        cl1.add()

        # construction line end

        # construction line begin

        cl1 = ConsLine()

        cl1.pt1 = p2

        cl1.pt2 = p3

        cl1.pen = i

        cl1.add()

        # construction line end

        # construction line begin

        cl1 = ConsLine()

        cl1.pt1 = p3

        cl1.pt2 = p4

        cl1.pen = i

        cl1.add()

        # construction line end

        # construction line begin

        cl1 = ConsLine()

        cl1.pt1 = p4

        cl1.pt2 = p1

        cl1.pen = i

        cl1.add()

        # construction line end

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

    ## ****** Material Add Functions *******

    ## Add bent plate material

    def add_bpl(mem, pt1, pt2, plate_grade, thk, hor_leg, vert_leg, plate_finish, rot):

        bp1 = BntPlate()

        bp1.member = mem

        bp1.pt1 = pt1

        bp1.pt2 = pt2

        bp1.grade = plate_grade

        bp1.centered = "No"

        bp1.top_oper_left = "None"

        bp1.top_oper_right = "None"

        bp1.bottom_oper_left = "None"

        bp1.bottom_oper_right = "None"

        bp1.width = 0

        bp1.thick = thk

        bp1.bend_angle = -90.0

        bp1.bend_radius = (thk * 2.0000)

        bp1.leg = hor_leg

        bp1.osl = vert_leg

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

        bp1.setback_left = 0.0000

        bp1.setback_right = 0.0000

        bp1.web_cut_angle_left = 0

        bp1.web_cut_angle_right = 0

        bp1.length = bp1.work_pt_dist - bp1.setback_left - bp1.setback_right

        bp1.mtrl_type = "Bent plate"

        bp1.finish = plate_finish

        bp1.ref_pt_offset = (0.000000, 0.0000, 0.000000)

        bp1.add()

        bp1.rotate(bp1.member, rot)

        return bp1

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

    ## Add closure plate material

    def add_closure(mem1, pt1, pt2, plate_grade, operat_type, operat_dim, vert_dim, thk, plate_finish, dim_off, rot, cl_type):

        p1 = RectPlate()

        p1.member = mem1

        p1.pt1 = pt1

        p1.pt2 = pt2

        p1.grade = plate_grade

        p1.origin = "FS"

        p1.bottom_oper_left = "None"

        p1.bottom_oper_right = "None"

        if cl_type == "End Cap" or operat_dim == 0.0:

             p1.top_oper_left = "None"

        elif operat_type == "Cope":

             p1.top_oper_left = "Cope"

             p1.top_length_left = operat_dim

             p1.top_cope_left = operat_dim

        elif operat_type == "Clip":

             p1.top_oper_left = "Clip"

             p1.top_length_left = operat_dim

             p1.top_cope_left = operat_dim

        p1.top_oper_right = "None"

        p1.width = vert_dim

        p1.thick = thk

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

        p1.setback_left = 0

        p1.setback_right = 0

        p1.web_cut_angle_left = 0

        p1.web_cut_angle_right = 0

        p1.length = p1.work_pt_dist - p1.setback_left - p1.setback_right

        p1.mtrl_type = "Plate"

        p1.finish = plate_finish

        p1.ref_pt_offset = dim_off

        p1.add()

        p1.rotate(p1.member, rot)

        return p1

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

    ## End function definitions ###############################################

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

    ## import auto defaults data if enabled

    if enable_default_import_export == "Enable":

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

        if dd0:

            if isinstance(dd0, list):

                for dd in dd0:

                    for key, value in dd.items():

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

            elif isinstance(dd0, dict):

                for key, value in dd0.items():

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

            else:

                Warning("Invalid data - Reverting to original defaults")

 

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

    ## Main program loop ######################################################

    print_doc = "No"

    while 1:

        ClearSelection()

        ## DIALOG BOX FOR IMPORT DEFAULT VALUES FILE

        dlg11 = Dialog("Initial Options")

        dlg11.group_title("Import User Default Values File")

        dlg11.menu('import_yes_or_no', ('Yes', 'No'), 'No', 'Import file?               ')

        dlg11.file('import_file', os.path.join(job_default_file_path, "*.txt"), "Enter file name or browse")

        try:

            dd11 = dlg11.done()

        except ResponseNotOK:

            break

        # Import user default values file       

        if dlg11.import_yes_or_no == "Yes":

            dd0 = import_data(dlg11.import_file)

            if dd0:

                if isinstance(dd0, list):

                    for dd in dd0:

                        for key, value in dd.items():

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

                elif isinstance(dd0, dict):

                    for key, value in dd0.items():

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

                else:

                    Warning("Invalid data - Reverting to original defaults")

       

        # Select beam member

        bm_list = []

        z = 1

        try:

            # Exit if user selected 'Yes' for 'Print parametric script documentation only' in dialog box

            while z:

                if print_doc == "Yes":

                    break

                else:

                    mem1 = MemberLocate("Select a BEAM member")

                   

                if mem1 == None:

                    break

                else:

                    if mem1.type == "Beam":

                        if mem1.mtrl_type in ["W flange", "Tube", "Channel", "W Tee", "Angle"]:

                            # limit selection to one member

                            z = 0

                            bm_list.append(mem1)

                        else:

                            Warning("%s beam material is not supported." % (mem1.mtrl_type))

                    else:

                        Warning("You picked a %s. You must pick a Beam." % (mem1.type))

                       

            if len(bm_list) < 1:

                break

            chk_mem_list = member_count(bm_list[0])

           

            if len(chk_mem_list) > 1:

                if yes_or_no("Add bent plates to all members with the same piecemark (%s members with mark %s)?" % \

                             (len(chk_mem_list), bm_list[0].piecemark)) == 1:

                    bm_list = chk_mem_list

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

            # Check framing conditions at ends of beam

            # Find the column if the work point of the beam is within 2" of the column member line

            col_find = ColumnSupport(mem1, 2.0)

            column_left = col_find.left_member

            column_right = col_find.right_member

            if column_left <> "None":

                frame_left = ColumnCondition(column_left, mem1, 2.0)

                left_end_face = frame_left.beam_face()

                left_end_col = column_left.piecemark

            else:

                frame_left = None

                left_end_face = "None"

                left_end_col = "None"

 

            if column_right <> "None":

                frame_right = ColumnCondition(column_right, mem1, 2.0)

                right_end_face = frame_right.beam_face()

                right_end_col = column_right.piecemark

            else:

                frame_right = None

                right_end_face = "None"

                right_end_col = "None"

 

            ## Start loop for adding bent plate runs ##########################

            redo = 1

            while redo == 1:

                ptWP1 = PointLocate("Select bent plate left end point or RETURN")

                if ptWP1 <> None:

                    ptWP2 = PointLocate("Select bent plate right end point")

                    if ptWP2 == None:

                        input_option = "Entry"

                    else:

                        input_option = "Points"

                else:

                    input_option = "Entry"

                   

                # if input_option is "Points", calculate x and z member coordinates and set default values

                if input_option == "Points":

                    # Calculate setbacks and offsets

                    ptWP1_loc = mem1.trans_to_local(ptWP1 - mem1.left.location)

                    ptWP2_loc = mem1.trans_to_local(mem1.right.location - ptWP2)

                    left_bpl_setback = ptWP1_loc.x - ptWP1_loc.y * tan(dtor(mem1.slope))

                    right_bpl_setback = ptWP2_loc.x - ptWP2_loc.y * tan(dtor(mem1.slope))

                    left_bpl_z_offset = ptWP1_loc.z

                    right_bpl_z_offset = -ptWP2_loc.z

                   

                # Set which_side to "FS" if left point is on FS, "NS" if left point is on NS, do nothing if on CL

                if dim(left_bpl_z_offset) < 0.0:

                    which_side = "FS"

                elif dim(left_bpl_z_offset) > 0.0:

                    which_side = "NS"

                else:

                    pass

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

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

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

                dlg1 = Dialog("Add bent plate pour stop to member " + mem1.piecemark )

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

                dlg1.menu("default_save", ("Yes", "No"), "No", "Save dialog box values to user's disk file         ")

                dlg1.tabset_begin()

                dlg1.tab("General Information")

                dlg1.column_group_begin()

                dlg1.line("A '-' SLAB EDGE distance adds BPL material FS of member line. 'Toe bent plate away from NS or FS' sets the toe direction.")

               

                dlg1.column(0)

                dlg1.group_title("LEFT END")

                dlg1.label(left_end_col + " - " + left_end_face, "Column member and framing face        ")

                if frame_left:

                    dlg1.label(frame_left.beam_angle(), "Relative rotation")

                else:

                    dlg1.line(" ")

                dlg1.entry("left_bpl_setback", dim_print(left_bpl_setback), "Setback from member WP")

                dlg1.entry("left_bpl_z_offset", dim_print(left_bpl_z_offset), "'SLAB EDGE' distance")

                dlg1.group_title_end

 

                dlg1.column(0)

                dlg1.group_title("RIGHT END")

                dlg1.label(right_end_col + " - " + right_end_face, "Column member and framing face      ")

                if frame_right:

                    dlg1.label(frame_right.beam_angle(), "Relative rotation")

                else:

                    dlg1.line(" ")

                dlg1.entry("right_bpl_setback", dim_print(right_bpl_setback), "Setback from member WP")

                dlg1.entry("right_bpl_z_offset", dim_print(right_bpl_z_offset), "'SLAB EDGE' distance")

                dlg1.group_title_end           

 

                dlg1.column_group_end()

                dlg1.column_group_begin()           

                dlg1.group_title("BENT PLATE DIMENSIONS")

                dlg1.entry("bpl_width", dim_print(bpl_width), "Horizontal leg dimension")

                dlg1.entry("bpl_height", dim_print(bpl_height), "Vertical leg dimension")

                dlg1.entry("bpl_thk", dim_print(bpl_thk), "Thickness")

                dlg1.entry("vertical_offset", dim_print(vertical_offset), "Vertical offset dimension")

                dlg1.group_title_end

                dlg1.column_group_end()

 

                dlg1.column_group_begin()           

                dlg1.column(0)           

                dlg1.group_title("ADDITIONAL INFORMATION")

                dlg1.menu("which_side", ("NS", "FS"), which_side, "Toe bent plate away from NS or FS")

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

                dlg1.menu("bpl_finish", ("None", "Red Oxide", "Yellow Zinc", "Gray Oxide", "Sandblasted", "Blued Steel", "Galvanized"), \

                          bpl_finish, "Material finish" )

                dlg1.group_title_end

 

                dlg1.column(0)           

                dlg1.group_title("LENGTH OPTIONS")

                dlg1.menu("break_or_cont", ("Break", "Cont"), break_or_cont, "Break or Continuous")

                dlg1.entry("max_length", dim_print(max_length), "Maximum length ('Break' option)")

                dlg1.entry("min_length", dim_print(min_length), "Minimum length ('Break' option)")

                dlg1.group_title_end

                dlg1.column_group_end()

               

                dlg1.tab("Cuts in BPL")

                dlg1.column_group_begin()

                dlg1.column(0)

                dlg1.group_title("Left End Horizontal Leg")

                if column_left <> "None":

                    dlg1.menu("cope_left", ("Yes", "No"), cope_left, "Cope around column")

                    dlg1.menu("cope_type_left", ("Min. Cope", "Cope to End"), cope_type_left, "Type of cope")

                    dlg1.entry("cope_clear_left", dim_print(cope_clear_left), "Minimum clearance")

                else:

                    dlg1.line("No column was found at the left end.")

                    dlg1.line("Horizontal leg cut is disabled.")

                    dlg1.line(" ")

                    dlg1.line(" ")

                dlg1.group_title_end

               

                dlg1.group_title("Cope to End")

                dlg1.image(image_name2)

                dlg1.group_title_end

                

                dlg1.group_title("Left End Vertical Leg")

                dlg1.menu("cut_vert_leg_left", ("Yes", "No"), cut_vert_leg_left, "Cut vertical leg")

                dlg1.entry("cut_left_length", dim_print(cut_left_length), "Length of cut")    

                dlg1.group_title_end

               

                dlg1.column(0)

                dlg1.group_title("Right End Horizontal Leg")

                if column_right <> "None":

                    dlg1.menu("cope_right", ("Yes", "No"), cope_right, "Cope around column")

                    dlg1.menu("cope_type_right", ("Min. Cope", "Cope to End"), cope_type_right, "Type of cope")

                    dlg1.entry("cope_clear_right", dim_print(cope_clear_right), "Minimum clearance")

                else:

                    dlg1.line("No column was found at the right end.")

                    dlg1.line("Horizontal leg cut is disabled.")

                    dlg1.line(" ")

                    dlg1.line(" ")

                dlg1.group_title_end

                

                dlg1.group_title("Min. Cope")

                dlg1.image(image_name1)

                dlg1.group_title_end

               

                dlg1.group_title("Right End Vertical Leg")

                dlg1.menu("cut_vert_leg_right", ("Yes", "No"), cut_vert_leg_right, "Cut vertical leg")

                dlg1.entry("cut_right_length", dim_print(cut_right_length), "Length of cut")   

                dlg1.group_title_end

               

                dlg1.column_group_end()

 

                dlg1.tab("Closure Plates")

                dlg1.column_group_begin()

                dlg1.column(0)

                dlg1.group_title("LEFT END CLOSURE INFORMATION")

                dlg1.menu("end_closure_left", ("Yes", "No"), end_closure_left, "Close left end of this bent plate run")

                dlg1.menu("closure_plate_type_left", ("End Cap", "Nested"), closure_plate_type_left, "Type of closure plate")

                dlg1.entry("closure_plate_length_left", dim_print(closure_plate_length_left), "Closure plate length")

                dlg1.entry("closure_plate_height_left", dim_print(closure_plate_height_left), "Closure plate height")

                dlg1.group_title_end

               

                dlg1.group_title("'Nested' CLOSURE TYPE")

                dlg1.image(image_name4)

                dlg1.group_title_end

                dlg1.column(0)

                dlg1.group_title("RIGHT END CLOSURE INFORMATION")

                dlg1.menu("end_closure_right", ("Yes", "No"), end_closure_right, "Close right end of this bent plate run")

                dlg1.menu("closure_plate_type_right", ("End Cap", "Nested"), closure_plate_type_right, "Type of closure plate")

                dlg1.entry("closure_plate_length_right", dim_print(closure_plate_length_right), "Closure plate length")

                dlg1.entry("closure_plate_height_right", dim_print(closure_plate_height_right), "Closure plate height")

                dlg1.group_title_end

               

                dlg1.group_title("'End Cap' CLOSURE TYPE")

                dlg1.image(image_name3)

                dlg1.group_title_end

                dlg1.column_group_end()

               

                dlg1.column_group_begin()

                dlg1.column(0)

                dlg1.group_title("ADDITIONAL CLOSURE PLATE INFORMATION")

                dlg1.entry("closure_plate_thk", dim_print(closure_plate_thk), "Closure plate thickness")

                dlg1.menu("closure_plate_cut_type", ("Clip", "Cope"), closure_plate_cut_type, "Type of cut for 'Nested' closure plate")

                dlg1.entry("closure_plate_cut_dim", dim_print(closure_plate_cut_dim), "'Nested' closure plate cut dimension")

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

                dlg1.menu("closure_finish", ("None", "Red Oxide", "Yellow Zinc", "Gray Oxide", "Sandblasted", "Blued Steel", "Galvanized"), \

                          closure_finish, "Material finish" )

                dlg1.group_title_end

                dlg1.column(0)

                dlg1.group_title("CLIP AND COPE")

                dlg1.image(image_name6)

                dlg1.group_title_end

 

                dlg1.tab("Welding")

                dlg1.group_title("Bent Plate Weld")

                dlg1.menu("add_bpl_weld", ("Yes", "No"), add_bpl_weld, "Add weld to bent plates                             ")

                dlg1.menu("bpl_weld_type", ("Fillet", ), bpl_weld_type, "Bent plate weld type")

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

                dlg1.menu("add_weld_bpl_to_bpl", ("Yes", "No"), add_weld_bpl_to_bpl, "Add 1/8\" butt weld bent plate to bent plate")

                dlg1.group_title_end

                dlg1.group_title("Continuous or Intermittent Bent Plate Weld")

                dlg1.menu("weld_stagger", ("No", "Opposite", "Offset"), weld_stagger, "Intermittent weld to bent plates")

                dlg1.entry("weld_inter_length", dim_print(weld_inter_length), "Intermittent weld length")

                dlg1.entry("weld_inter_spa", dim_print(weld_inter_spa), "Intermittent weld spacing")

                dlg1.group_title_end

                dlg1.group_title("Closure Plate Weld")

                dlg1.menu("add_closure_weld", ("Yes", "No"), add_closure_weld, "Add weld to closure plates")

                dlg1.group_title_end

               

                dlg1.tab("Graphic Images")

                dlg1.column_group_begin()

                dlg1.column(0)

                dlg1.group_title("Vertical Leg Cut")

                dlg1.image(image_name5)

                dlg1.group_title_end

                dlg1.column(0)

                dlg1.group_title("Welds")

                dlg1.image(image_name7)

                dlg1.group_title_end

                dlg1.column_group_end()

                #dlg1.group_title("Skewed to column - 'Cope to End'")

                #dlg1.image(image_name)

                #dlg1.group_title_end

               

                dlg1.tabset_end()

               

                try:

                    dd1 = dlg1.done()

                except ResponseNotOK:

                    break

 

                # Update the local namespace

                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

                dd_list = [dd1, ]

                # User save default values to disk

                if default_save == "Yes":

                    dlg3 = Dialog("Save Current Dialog Values To Disk")

                    dlg3.file_save('export_file', os.path.join(job_default_file_path, "BentPL.txt"), "Enter file name or browse")

                    try:

                        dd3 = dlg3.done()

                    except ResponseNotOK:

                        break

                    dd_list.append(dd3)

                    export_data(dd3['export_file'], dd_list)

                               

                # Auto export default values to disk if enabled

                if enable_default_import_export == "Enable":

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

           

                # determine member coordinate of start and end points of bent plate

                ptWP1_loc = Point(left_bpl_setback, vertical_offset, left_bpl_z_offset)

                ptWP2_loc = Point((mem1.right.location.dist(mem1.left.location) - right_bpl_setback), vertical_offset, right_bpl_z_offset)

               

                # calculate skew of bent plate run with respect to member line in degrees

                angle_bpl_run = rtod(atan2((ptWP1_loc.z - ptWP2_loc.z), (ptWP2_loc.x - ptWP1_loc.x)))

               

                # actual length of bent plate run

                bpl_run_dist = ptWP1_loc.dist(ptWP2_loc)

               

                # calculate number of pieces

                if break_or_cont == "Cont":

                    no_pcs = 1

                else:

                    no_pcs = int(ceil(bpl_run_dist / max_length))

                _cont = 1

               

                # create list of start and end points

                if no_pcs == 1:

                    start_end_pts_list = [ptWP1_loc, ptWP2_loc]

                else:

                    start_end_pts_list = [ptWP1_loc, ]

                    pt_1st = ptWP1_loc

                    remaining_run_dist = bpl_run_dist

                    for i in range(no_pcs):

                        if remaining_run_dist <= max_length:

                            bp_length = remaining_run_dist

                        else:

                            bp_length = max_length

                            remaining_run_dist = remaining_run_dist - bp_length

                        if bp_length >= min_length:                 # script will not put in a plate less than 'min_length' long

                            pt_calc2 = polar_pt_hor(pt_1st, bp_length, angle_bpl_run)

                            start_end_pts_list.append(pt_calc2)

                            pt_1st = pt_calc2

                        else:

                            _cont = yes_or_no("The last piece of bent plate will not be added since it would be %s long."+\

                                              "\nThe minimum length set by the user is %s.\nClick 'No' to cancel this run" % \

                                              (dim_print(bp_length), dim_print(min_length)))

               

                if _cont == 0:

                    break

               

                if which_side == "NS":

                    start_end_pts_list.reverse()

                    y_rot = 180.0 - angle_bpl_run

                else:

                    y_rot = -angle_bpl_run

 

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

                ## Start beam loop ########################

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

                for bi in range(len(bm_list)):

                    # create empty list of bent plate material

                    bpl_matl_list = []

                    ### Add bent plate material, cut vertical leg and add weld

                    object_no = 0

                    last_object = len(start_end_pts_list)-1

                    for i in range(len(start_end_pts_list)-1):

                        # calculate global point coordinates

                        object_no = object_no + 1

                        pt1 = bm_list[bi].left.location + bm_list[bi].translate(start_end_pts_list[i].x, \

                                                                                start_end_pts_list[i].y, start_end_pts_list[i].z)

                        pt2 = bm_list[bi].left.location + bm_list[bi].translate(start_end_pts_list[i+1].x, \

                                                                                start_end_pts_list[i+1].y, start_end_pts_list[i+1].z)

                        bpl1 = (add_bpl(bm_list[bi], pt1, pt2, bpl_grade, bpl_thk, bpl_width, bpl_height, bpl_finish, (-90.0, y_rot, 0.0)))

                       

                        # cut vertical leg

                        if cut_vert_leg_left == "Yes":

                            if (which_side == "FS" and object_no == 1) or (which_side == "NS" and object_no == last_object):

                                pt1 = bm_list[bi].left.location + bm_list[bi].translate((left_bpl_setback + cut_left_length), \

                                                                                        bpl_height + 6.0, 0.0)

                                pt2 = pt1 + bm_list[bi].translate(0.0, -(bpl_height + 6.0 - (3.0 * bpl_thk)), 0.0)

                                pt3 = pt2 + bm_list[bi].translate(-(cut_left_length + 6.0), 0.0, 0.0)

                                pt4 = pt3 + bm_list[bi].translate(0.0, (bpl_height + 6.0 - (3.0 * bpl_thk)), 0.0)

                                cope_vert_leg(bpl1, pt1, pt2, pt3, pt4)

 

                        if cut_vert_leg_right == "Yes":

                            if (which_side == "NS" and object_no == 1) or (which_side == "FS" and object_no == last_object):

                                pt1 = bm_list[bi].right.location + bm_list[bi].translate((-right_bpl_setback + 6.0), bpl_height + 6.0, 0.0)

                                pt2 = pt1 + bm_list[bi].translate(0.0, -(bpl_height + 6.0 - (3.0 * bpl_thk)), 0.0)

                                pt3 = pt2 + bm_list[bi].translate(-(cut_right_length + 6.0), 0.0, 0.0)

                                pt4 = pt3 + bm_list[bi].translate(0.0, (bpl_height + 6.0 - (3.0 * bpl_thk)), 0.0)   

                                cope_vert_leg(bpl1, pt1, pt2, pt3, pt4)

                               

                        bpl_matl_list.append(bpl1)

                        if add_bpl_weld == "Yes":

                            mtrl_weld([bm_list[bi], ], [bpl1, ], weld_size, bpl_weld_type, weld_inter_length, weld_inter_spa, weld_stagger)

                           

                    if add_weld_bpl_to_bpl == "Yes":

                        if len(bpl_matl_list) > 1:

                            for i in range (len(bpl_matl_list)):

                                if i+1 < len(bpl_matl_list):

                                    mtrl_weld([bpl_matl_list[i], ], [bpl_matl_list[i+1], ], 0.0625, "Square", 0.0, 0.0, "No")

                    ##### ADD CLOSURE PLATES ##################################

                    """ Closure plates are added before bent plates are cut

                        because certain material indices may change when the

                        cuts are made. If material indices change, weld add

                        may be unsuccessful.

                    """

                    # calculate offsets

                    x_off = bpl_thk * sin(dtor(angle_bpl_run))

                    x_off_cl = closure_plate_thk * cos(dtor(angle_bpl_run))

                    y_off = bpl_thk

                    z_off = bpl_thk * cos(dtor(angle_bpl_run))

                    z_off_cl = closure_plate_thk * sin(dtor(angle_bpl_run))

                   

                    if end_closure_left == "Yes":

                        # if length or width == 0.0, calculate dimensions

                        if closure_plate_type_left == "Nested":

                            if closure_plate_length_left <= 0.0:

                                closure_plate_length_left = bpl_width - bpl_thk

                            if closure_plate_height_left <= 0.0:

                                closure_plate_height_left = bpl_height - bpl_thk

                        elif closure_plate_type_left == "End Cap":

                            if closure_plate_length_left <= 0.0:

                                closure_plate_length_left = bpl_width

                            if closure_plate_height_left <= 0.0:

                                closure_plate_height_left = bpl_height               

                        if which_side == "FS":

                            rot_arg = (180.0, 90.0 - angle_bpl_run, 0.0)

                            if closure_plate_type_left == "Nested":

                                ptWP1 = bm_list[bi].left.location + bm_list[bi].translate(start_end_pts_list[0].x + x_off, \

                                                                                          start_end_pts_list[0].y + y_off, \

                                                                                          start_end_pts_list[0].z + z_off)

                            elif closure_plate_type_left == "End Cap":

                                ptWP1 = bm_list[bi].left.location + bm_list[bi].translate(start_end_pts_list[0].x - x_off_cl, \

                                                                                          start_end_pts_list[0].y, \

                                                                                          start_end_pts_list[0].z + z_off_cl)

                        elif which_side == "NS":

                            rot_arg = (180.0, -90.0 - angle_bpl_run, 0.0)

                            if closure_plate_type_left == "Nested":

                                ptWP1 = bm_list[bi].left.location + bm_list[bi].translate(start_end_pts_list[-1].x - x_off + x_off_cl, \

                                                                                          start_end_pts_list[-1].y + y_off, \

                                                                                          start_end_pts_list[-1].z - z_off -z_off_cl)

                            elif closure_plate_type_left == "End Cap":

                                ptWP1 = bm_list[bi].left.location + bm_list[bi].translate(start_end_pts_list[-1].x, \

                                                                                          start_end_pts_list[-1].y, \

                                                                                          start_end_pts_list[-1].z)

                

                        ptWP2 = ptWP1 + bm_list[bi].translate(closure_plate_length_left, 0.0, 0.0)

                        rp1 = add_closure(bm_list[bi], ptWP1, ptWP2, closure_grade, closure_plate_cut_type, closure_plate_cut_dim, \

                                          closure_plate_height_left, closure_plate_thk, closure_finish, (0.0, 0.0, 0.0), rot_arg, \

                                          closure_plate_type_left)

                       

                        if add_closure_weld == "Yes":

                            mtrl_weld(bpl_matl_list, [rp1, ], weld_size, "Fillet", 0.0, 0.0, "No")

                           

                    if end_closure_right == "Yes":

                        # if length or width == 0.0, calculate dimensions

                        if closure_plate_type_right == "Nested":

                            if closure_plate_length_right <= 0.0:

                                closure_plate_length_right = bpl_width - bpl_thk

                            if closure_plate_height_right <= 0.0:

                                closure_plate_height_right = bpl_height - bpl_thk

                        elif closure_plate_type_right == "End Cap":

                            if closure_plate_length_right <= 0.0:

                                closure_plate_length_right = bpl_width

                            if closure_plate_height_right <= 0.0:

                                closure_plate_height_right = bpl_height               

                        if which_side == "FS":

                            rot_arg = (180.0, 90.0 - angle_bpl_run, 0.0)

                            if closure_plate_type_right == "Nested":

                                ptWP1 = bm_list[bi].left.location + bm_list[bi].translate(start_end_pts_list[-1].x + x_off - x_off_cl, \

                                                                                          start_end_pts_list[-1].y + y_off, \

                                                                                          start_end_pts_list[-1].z + z_off + z_off_cl)

                            elif closure_plate_type_right == "End Cap":

                                ptWP1 = bm_list[bi].left.location + bm_list[bi].translate(start_end_pts_list[-1].x, \

                                                                                          start_end_pts_list[-1].y, \

                                                                                          start_end_pts_list[-1].z)

                        elif which_side == "NS":

                            rot_arg = (180.0, -90.0 - angle_bpl_run, 0.0)

                            if closure_plate_type_right == "Nested":

                                ptWP1 = bm_list[bi].left.location + bm_list[bi].translate(start_end_pts_list[0].x - x_off, \

                                                                                          start_end_pts_list[0].y + y_off, \

                                                                                          start_end_pts_list[0].z - z_off)

                            elif closure_plate_type_right == "End Cap":

                                ptWP1 = bm_list[bi].left.location + bm_list[bi].translate(start_end_pts_list[0].x + x_off_cl, \

                                                                                          start_end_pts_list[0].y, \

                                                                                          start_end_pts_list[0].z - z_off_cl)

                               

                        ptWP2 = ptWP1 + bm_list[bi].translate(closure_plate_length_right, 0.0, 0.0)

                        rp1 = add_closure(bm_list[bi], ptWP1, ptWP2, closure_grade, closure_plate_cut_type, closure_plate_cut_dim, \

                                          closure_plate_height_right, closure_plate_thk, closure_finish, (0.0, 0.0, 0.0), rot_arg, \

                                          closure_plate_type_right)

                       

                        if add_closure_weld == "Yes":

                            mtrl_weld(bpl_matl_list, [rp1, ], weld_size, "Fillet", 0.0, 0.0, "No")

                           

                    ##### END ADD CLOSURE PLATES ####################################################################################################################

                    ##### COPE BENT PLATES AROUND COLUMN ############################################################################################################

                    # Find column members for this beam

                    col_find = ColumnSupport(bm_list[bi], 2.0)

                    column_left = col_find.left_member

                    column_right = col_find.right_member

                    if column_left <> "None":

                        frame_left = ColumnCondition(column_left, bm_list[bi], 2.0)

                        left_end_face = frame_left.beam_face()

                       

                    if column_right <> "None":

                        frame_right = ColumnCondition(column_right, bm_list[bi], 2.0)

                        right_end_face = frame_right.beam_face()

                       

                    # Prepare to cope bent plate around column at left end

                    if cope_left == "Yes" and column_left <> "None" and len(bpl_matl_list) > 0:

                        ptWP_left = Point(column_left.left.location.x, column_left.left.location.y, bm_list[bi].left.location.z)

                        if left_end_face in ["Face A", "Face C"]:

                            x_dist_left = round_length_next((column_left.depth/2 + cope_clear_left), cope_round_increment)

                            y_dist_left = round_length_next((column_left.bf/2 + cope_clear_left), cope_round_increment)

                            ang_cut_left = frame_left.beam_angle()

                        else:

                            x_dist_left = round_length_next((column_left.bf/2 + cope_clear_left), cope_round_increment)

                            y_dist_left = round_length_next((column_left.depth/2 + cope_clear_left), cope_round_increment)

                            ang_cut_left = frame_left.beam_angle() + 90.0

                            while ang_cut_left > 90.0:

                                ang_cut_left = ang_cut_left - 180.0

                        # create clear points list

                        aclr = dtor(ang_cut_left) # angle cut left in radians

                        clear_pt_list_left = [(ptWP_left + bm_list[bi].translate(((x_dist_left*cos(aclr)) + (y_dist_left*sin(aclr))), 0.0, \

                                                                                 -((y_dist_left*cos(aclr)) - (x_dist_left*sin(aclr))))),\

                                              (ptWP_left + bm_list[bi].translate(((x_dist_left*cos(aclr)) - (y_dist_left*sin(aclr))), 0.0, \

                                                                                 ((y_dist_left*cos(aclr)) + (x_dist_left*sin(aclr))))),\

                                              (ptWP_left + bm_list[bi].translate(-((x_dist_left*cos(aclr)) + (y_dist_left*sin(aclr))), 0.0, \

                                                                                 ((y_dist_left*cos(aclr)) - (x_dist_left*sin(aclr))))),\

                                              (ptWP_left + bm_list[bi].translate(-((x_dist_left*cos(aclr)) - (y_dist_left*sin(aclr))), 0.0, \

                                                                                 -((y_dist_left*cos(aclr)) + (x_dist_left*sin(aclr)))))]

                       

                        if x_dist_left - cope_round_increment > left_bpl_setback:

                            make_cope_left = "Yes"

                        else:

                            make_cope_left = "No"

                           

                    else:

                        make_cope_left = "No"

                        

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

                    # Prepare to cope bent plate around column at right end

                    if cope_right == "Yes" and column_right <> "None" and len(bpl_matl_list) > 0:

                        ptWP_right = Point(column_right.left.location.x, column_right.left.location.y, bm_list[bi].right.location.z)

                       

                        if right_end_face in ["Face A", "Face C"]:

                            x_dist_right = round_length_next((column_right.depth/2 + cope_clear_right), cope_round_increment)

                            y_dist_right = round_length_next((column_right.bf/2 + cope_clear_right), cope_round_increment)

                            ang_cut_right = frame_right.beam_angle() + 180.0

                        else:

                            x_dist_right = round_length_next((column_right.bf/2 + cope_clear_right), cope_round_increment)

                            y_dist_right = round_length_next((column_right.depth/2 + cope_clear_right), cope_round_increment)

                            ang_cut_right = frame_right.beam_angle() - 90.0

                            while ang_cut_right > 90.0:

                                ang_cut_right = ang_cut_right - 180.0

                               

                        # create clear points list

                        acrr = dtor(ang_cut_right) # angle cut right in radians

                        clear_pt_list_right = [(ptWP_right + bm_list[bi].translate(((x_dist_right*cos(acrr)) + (y_dist_right*sin(acrr))), 0.0, \

                                                                                   -((y_dist_right*cos(acrr)) - (x_dist_right*sin(acrr))))),\

                                               (ptWP_right + bm_list[bi].translate(((x_dist_right*cos(acrr)) - (y_dist_right*sin(acrr))), 0.0, \

                                                                                   ((y_dist_right*cos(acrr)) + (x_dist_right*sin(acrr))))),\

                                               (ptWP_right + bm_list[bi].translate(-((x_dist_right*cos(acrr)) + (y_dist_right*sin(acrr))), 0.0, \

                                                                                   ((y_dist_right*cos(acrr)) - (x_dist_right*sin(acrr))))),\

                                               (ptWP_right + bm_list[bi].translate(-((x_dist_right*cos(acrr)) - (y_dist_right*sin(acrr))), 0.0, \

                                                                                   -((y_dist_right*cos(acrr)) + (x_dist_right*sin(acrr)))))]

                       

                        if x_dist_right - cope_round_increment > right_bpl_setback:

                            make_cope_right = "Yes"

                        else:

                            make_cope_right = "No"

                           

                    else:

                        make_cope_right = "No"

                       

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

                    # pt_dist is a real nubmer used to calculate points beyond the bent plate material for cut layouts

                    pt_dist = 100.0

                    # Make cope around column at left end NS

                    if which_side == "NS" and make_cope_left == "Yes":

                        ptcut1 = PolarPt3D(clear_pt_list_left[1], clear_pt_list_left[0], pt_dist)

                        ptcut2 = clear_pt_list_left[1]

                       

                        if cope_type_left == "Min. Cope":

                            #NS Left Min.

                            ptcut3 = clear_pt_list_left[2]

                            ptcut4 = PolarPt3D(clear_pt_list_left[2], clear_pt_list_left[3], pt_dist)

                        elif cope_type_left == "Cope to End":

                            #NS Left Extend

                            ptcut3 = PolarPt3D(clear_pt_list_left[1], clear_pt_list_left[2], pt_dist)

                            ptcut4 = PolarPt3D(ptcut1, PolarPt3D(clear_pt_list_left[2], clear_pt_list_left[3], pt_dist), pt_dist)

                       

                        cope_at_column(bpl_matl_list[-1], ptcut1, ptcut2, ptcut3, ptcut4)

                       

                        # const_lines(ptcut1, ptcut2, ptcut3, ptcut4, "Cyan")

                        # const_lines(clear_pt_list_right[0], clear_pt_list_right[1], clear_pt_list_right[2], clear_pt_list_right[3], "Green")

                   

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

                    # Make cope around column at right end NS

                    if which_side == "NS" and make_cope_right == "Yes":

                        ptcut3 = clear_pt_list_right[2]

                        ptcut4 = PolarPt3D(ptcut3, clear_pt_list_right[3], pt_dist)

                       

                        if cope_type_right == "Min. Cope":

                            #NS Right Min.

                            ptcut1 = PolarPt3D(clear_pt_list_right[1], clear_pt_list_right[0], pt_dist)

                            ptcut2 = clear_pt_list_right[1]

                        elif cope_type_right == "Cope to End":

                            #NS Right Extend

                            ptcut1 = PolarPt3D(ptcut4, PolarPt3D(clear_pt_list_right[1], clear_pt_list_right[0], pt_dist), pt_dist)

                            ptcut2 = PolarPt3D(clear_pt_list_right[2], clear_pt_list_right[1], pt_dist)

                           

                        cope_at_column(bpl_matl_list[0], ptcut1, ptcut2, ptcut3, ptcut4)

                       

                        # const_lines(ptcut1, ptcut2, ptcut3, ptcut4, "Cyan")

                        # const_lines(clear_pt_list_right[0], clear_pt_list_right[1], clear_pt_list_right[2], clear_pt_list_right[3], "Green")

                       

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

                    # Make cope around column at right end FS

                    if which_side == "FS" and make_cope_right == "Yes":

                        ptcut3 = PolarPt3D(clear_pt_list_right[3], clear_pt_list_right[2], pt_dist)

                        ptcut4 = clear_pt_list_right[3]

                       

                        if cope_type_right == "Min. Cope":

                            #FS Right Min

                            ptcut1 = clear_pt_list_right[0]

                            ptcut2 = PolarPt3D(clear_pt_list_right[0], clear_pt_list_right[1], pt_dist)

                        elif cope_type_right == "Cope to End":

                            #FS Right Extend

                            ptcut1 = PolarPt3D(clear_pt_list_right[3], clear_pt_list_right[0], pt_dist)

                            ptcut2 = PolarPt3D(ptcut3, PolarPt3D(clear_pt_list_right[0], clear_pt_list_right[1], pt_dist), pt_dist)

                           

                        cope_at_column(bpl_matl_list[-1], ptcut3, ptcut4, ptcut1, ptcut2)

                       

                        # const_lines(ptcut1, ptcut2, ptcut3, ptcut4, "Cyan")

                        # const_lines(clear_pt_list_right[0], clear_pt_list_right[1], clear_pt_list_right[2], clear_pt_list_right[3], "Green")

                       

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

                    # Make cope around column at left end FS

                    if which_side == "FS" and make_cope_left == "Yes":

                        ptcut1 = clear_pt_list_left[0]

                        ptcut2 = PolarPt3D(clear_pt_list_left[0], clear_pt_list_left[1], pt_dist)

                       

                        if cope_type_left == "Min. Cope":

                            #FS left Min

                            ptcut3 = PolarPt3D(clear_pt_list_left[3], clear_pt_list_left[2], pt_dist)

                            ptcut4 = clear_pt_list_left[3]

                        elif cope_type_left == "Cope to End":

                            #FS Left Extend

                            ptcut3 = PolarPt3D(ptcut2, PolarPt3D(clear_pt_list_left[3], clear_pt_list_left[2], pt_dist), pt_dist)

                            ptcut4 = PolarPt3D(clear_pt_list_left[0], clear_pt_list_left[3], pt_dist)

                           

                        cope_at_column(bpl_matl_list[0], ptcut3, ptcut4, ptcut1, ptcut2)

                       

                        # const_lines(ptcut1, ptcut2, ptcut3, ptcut4, "Cyan")

                        # const_lines(clear_pt_list_right[0], clear_pt_list_right[1], clear_pt_list_right[2], clear_pt_list_right[3], "Green")

                   

                    ##### END COPE BENT PLATES AROUND COLUMN ##################

                redo = yes_or_no("Add another bent plate run to the same member?")

        except:

            Warning(formatExceptionInfo())

            break

    ## END run_script() #######################################################

if __name__ == '__main__':

    try:

        run_script()

    finally:

        del run_script