Back to SDS/2 Parametric Scripts

 

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

## BeamFraming.py Version 1.02 (11/27/06)

## 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 the beam objects supporting a selected beam.

    Limitation: If the beam is sloping, it must either frame into the member line of the

                supporting beam or lie on a parallel plane. The normal unit vector of the

                selected beam needs to be located at the 'RE' or 'LE' as determined by

                LineLineIntersect3D.

"""

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

## Class definition to find supporting beams

from macrolib.L3D import LineLineIntersect3D

from point import Point

from member import Member, MemberAllocated

 

class BeamSupport:

    def __init__(self, memA, proximity):

        self.mem1 = memA

        i = 1                       # member index

        self.left_member  = "None"

        self.right_member = "None"

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

            try:

                self.mem2 = Member(i)

            except:

                i = i + 1

            else:

                if self.mem1.number != i:

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

                        b = LineLineIntersect3D(memA.left.location, memA.right.location, self.mem2.left.location, self.mem2.right.location)

                        if b.not_parallel() == 1:

                            if b.Pmem1.z - b.Pmem2.z < 0:

                                z_offset = -b.inters_dist

                            else:

                                z_offset = b.inters_dist

                            if b.position == "LE" and (z_offset > -(self.mem2.depth + proximity)) \

                               and (z_offset < (memA.depth + proximity)) and b.on_segment2 == 1:

                                # Set this beam to be the left member

                                self.left_member = self.mem2

                            elif b.position == "RE" and (z_offset > -(self.mem2.depth + proximity)) \

                                 and (z_offset < (memA.depth + proximity)) and b.on_segment2 == 1:

                                # Set this beam to be the right beam

                                self.right_member = self.mem2

                    i = i + 1

                else:

                    i = i + 1

# end class definition

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

def test_BeamSupport():

    from member import MemberLocate

   

    mem1 = MemberLocate("Select a BEAM MEMBER")

    a = BeamSupport(mem1, 1.0)

    if a.left_member == "None":

        print "No supporting beam member was found at the left end"

    else:

        print "Member object at left end = ", a.left_member.size, a.left_member.type, a.left_member.piecemark

    if a.right_member == "None":

        print "No supporting beam member was found at the right end"

    else:

        print "Member object at right end = ", a.right_member.size, a.right_member.type, a.right_member.piecemark

    print "\nObject:"

    print a

    print "\nObject Attributes:"

    for i in range(len(a.__dict__)):

        print a.__dict__.keys()[i] + " =", a.__dict__.values()[i]

## end test_BeamSupport() #########################################################

if __name__ == '__main__':

    try:

        test_BeamSupport()

    finally:

        del test_BeamSupport

        del BeamSupport