Back to SDS/2 Parametric Scripts

 

## SpliceFraming.py Version 1.01

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

## All rights reserved.

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

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

"""

## Determine member objects at ends of a member

## Set attributes to string "None" if no member is found

## Types of object found for beams or columns:

##      Spliced member at left and right ends (coincident workpoint locations))

## Passing a beam member to this class that frames to a column may return

## a parallel beam member framing at the same location.

## Members must be parallel.

##

## Version 1.01 (11/27/06) -    Eliminate import types

"""

 

class SpliceSupport:

   

    def __init__(self, mem1, mem_type, prox = 0.05):

        from macrolib.L3D import DistancePointLine3D, LineLineIntersect3D

        from point import Point

        from member import Member, MemberAllocated

       

        if isinstance(mem_type, list):

            type_list = mem_type

        else:

            type_list = [mem_type, ]

           

        mi = 1               # member index

        self.right_member = "None"

        self.left_member = "None"

        while mi < MemberAllocated() and (self.right_member == "None" or self.left_member == "None"):

            try:

                mem2 = Member(mi)

            except:

                mi = mi + 1

            else:

                if mem1.number != mi:

                    if mem2.type in type_list:

                        ap = LineLineIntersect3D(mem1.left.location, mem1.right.location, mem2.left.location, mem2.right.location)

                        # Member 1 ends, Member 2 left end

                        a = DistancePointLine3D(mem1.left.location, mem1.right.location, mem2.left.location)

                        # Member 1 ends, Member 2 right end

                        b = DistancePointLine3D(mem1.left.location, mem1.right.location, mem2.right.location)

                        if self.right_member == "None":

                            if a.position == "RE" and a.dist < prox and ap.not_parallel() == 0:

                                self.right_member = mem2

                        if self.left_member == "None":

                            if b.position == "LE" and b.dist < prox and ap.not_parallel() == 0:

                                self.left_member = mem2

                           

                    mi = mi + 1

                else:

                    mi = mi + 1

# end class definition

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

 

def test_SpliceSupport():

    from member import Member, MemberLocate

    from param import yes_or_no, Warning, ClearSelection

    # Test SpliceSupport()

    while 1:

        ClearSelection()

        mem1 = MemberLocate("Select a MEMBER")

        # pass selected member and member type list to look for

        a = SpliceSupport(mem1, ["Beam", "Purlin", "Column", "Joist"], 10.5)

       

        if a.left_member != "None":

            Warning("A left end %s member object was found.\nMember # = %s\nMember piecemark = %s\nSection size = %s\n\n" % \

                    (a.left_member.type, a.left_member.number, a.left_member.piecemark, a.left_member.section_size))

        else:

            Warning("There was no left end member object found.")

 

        if a.right_member != "None":

            Warning("A right end %s member object was found.\nMember # = %s\nMember piecemark = %s\nSection size = %s\n\n" % \

                    (a.right_member.type, a.right_member.number, a.right_member.piecemark, a.right_member.section_size))

        else:

            Warning("There was no right end member object found.")

           

        if not yes_or_no("Again?"):

            break

    ## END test_mem_splice_object() #################################################

if __name__ == '__main__':

    try:

        test_SpliceSupport()

    finally:

        del test_SpliceSupport

        del SpliceSupport