Back to SDS/2 Parametric Scripts

## Weld.py

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

## All rights reserved.

## Version 1.02 (11/19/06) - Add conditional if tail == "None":

##                                               tail = ""

## Version 1.03 (5/8/07) - Add option for all around weld, defaults to 'No'

## Version 1.04 (11/16/07) - Add weld code for SDS/2 7.1xx

## Version 1.05 (11/18/07) - Modify variable names for consistency

## Version 1.06 (11/19/07) - Modify weld type code in 7.0 version

## Version 1.07 (11/20/07) - Modify code for tail text

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

"""

Function to add weld.

The last four arguments are optional. Values assigned are defaults.

Additional optional arguments can be added, but they must be placed

at the end of the argument list for compatibility with existing code.

'weld_size' can be a string ("3/16" for example) or a float (0.1875).

 

Valid weld types:

    Fillet

    Square groove

    Bevel groove

    V groove

    J groove

    U groove

    Flare bevel groove

    Flare V groove

    Plug

    Backing weld

       

"""

from weld_add import Weld

from param import dim, Warning

from version import CurrentVersion, VersionCompare

curr_version = CurrentVersion()

 

if VersionCompare(curr_version, '7.1') < 0:

   

    def mtrl_weld(toList, weldList, sz, wtype, stgr_len=0.0, \

                  stgr_spa=0.0, stgr='No', tail="", around="No"):

        # Allow "Fillet", "Flair Bevel, and "Square Butt" weld types

        # NOTE: INTERMITTENT WELD DOES NOT WORK PROPERLY FOR HSS MATERIAL AT RADIUS CORNERS

        # Allow flair bevel in combination with fillet

        # Warning("This is version 7.0")

        dd = {"fillet": ("Yes", "Yes", "No"), \

              "square butt": ("No", "No", "Yes"), \

              "flair bevel": ("No", "Yes", "No")

              }

        allow_fillet, allow_flair_bevel, allow_square = dd[wtype.lower()]

       

        if tail.lower() == "none":

            tail = ""

        # weld add begin

        try:

            weld9 = Weld()

            # will weld the first object in the mtrl list ([mtrl1, ])

            weld9.mtrl =  weldList

            # mem.main_mtrl() should be in weld_to list unless the material is user (reprocess --> welds disappear)

            # can be multiple mtrl objects

            weld9.weld_to = toList

            weld9.min_size = dim(sz)

            weld9.max_size = 1

            weld9.min_length = 1

            weld9.max_gap = 0.5

            weld9.stagger_length = dim(stgr_len)

            weld9.stagger_spacing = dim(stgr_spa)

            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 = around

            weld9.stagger = stgr

            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 = "No"

            weld9.allow_v = "No"

            weld9.allow_j = "No"

            weld9.allow_u = "No"

            weld9.allow_flare_bevel = allow_flair_bevel

            weld9.allow_flare_v = "No"

            weld9.allow_plug = "No"

            weld9.allow_backing = "No"

            weld9.tail_text = tail

            weld9.show_window = "No"

            weld9.create()

        except:

            Warning("The weld add was unsuccessful")

            # weld add end

else:

   

    def mtrl_weld(toList, weldList, sz, wtype, stgr_len=0.0, stgr_spa=0.0, \

                  stgr='No', tail="", around="No"):

        '''Valid weld types:

            Fillet

            Square groove

            Bevel groove

            V groove

            J groove

            U groove

            Flare bevel groove

            Flare V groove

            Plug

            Backing weld

        '''

        # Warning("This is version 7.1")

        wtype = wtype.lower().capitalize()

        if wtype == 'Flare v groove':

            wtype = 'Flare V groove'

 

        if tail.lower() == "none":

            tail = ""

                   

        try:

        # weld add begin

            weld1 = Weld()

            # will weld the first object in the mtrl list ([mtrl1, ])

            weld1.mtrl = weldList

            # mem.main_mtrl() should be in weld_to list unless the

            # material is user (reprocess --> welds disappear)

            # can be multiple mtrl objects

            weld1.weld_to = toList

            weld1.weld_type_sgl_dbl = "Single"

            weld1.weld_type = wtype

            weld1.size = dim(sz)

            weld1.length = 1.5

            weld1.left_setback = 0

            weld1.right_setback = 0

            weld1.all_around = around

            weld1.field_weld = "No"

            weld1.stagger = stgr

            weld1.stagger_length = stgr_len

            weld1.stagger_spacing = stgr_spa

            weld1.left_termination = 0

            weld1.right_termination = 0

            weld1.use_prequalified = "Yes"

            weld1.root_opening = 0

            weld1.root_face = 0

            weld1.groove_angle = 0

            weld1.flare_groove_rad = 0

            weld1.fillet_back = "No"

            weld1.contour = "None"

            weld1.max_gap = 0.25

            weld1.inside = "No"

            weld1.joint_type = "None"

            weld1.penetration = "None"

            weld1.process = "None"

            weld1.position = "None"

            weld1.tail_text = tail

            weld1.show_window = "No"

            weld1.create()

            # weld add end

        except:

            Warning("The weld add was unsuccessful")

 

 

        '''

        char    *pm_menu_joint[] =      { "None", "B butt joint", "C corner joint",

                                          "T T-joint", "BC butt or corner joint",

                                          "TC T- or corner joint",

                                          "BTC butt, T-, or corner joint"};

 

        char    *pm_menu_pent[] =       { "None", "L limited thickness, full-pen",

                                          "U unlimited thickness, full-pen",

                                          "P partial-pen"};

 

        char    *pm_menu_proc[] =       { "None", "S submerged arc welding (SAW)",

                                          "G gas metal arc welding (GMAW)",

                                          "F flux cored arc welding (FCAW)"};

 

        char    *pm_menu_pos[] =        { "None", "F  flat", "H horizontal",

                                          "V vertical", "OH overhead"};

        '''