Back to SDS/2 Parametric Scripts
## VB_BeamFraming.py Version 1.00
##
Copyright (c) 2007 Bruce Vaughan, BV Detailing & Design, Inc.
##
All rights reserved.
##
NOT FOR
###############################################################################
"""
##
Determine beam member objects at ends of a vertical brace member
##
Set attributes to string "None" if no member is found
##
May not work properly if 'swap member ends' is used on the beam or VB
##
Members must be parallel
##
The brace WP must fall within the beam depth
##
The brace LE must coincide with the beam LE, same for RE
##
Version 1.00 (
"""
from macrolib.L3D import DistancePointLine3D, LineLineIntersect3D
from point import Point
from member import Member, MemberLocate, MemberAllocated
from param import yes_or_no,
Warning, ClearSelection
class VB_BeamSupport(object):
def __init__(self,
mem1, mem_type='Beam'):
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
mem2.type in [mem_type, ]:
# Check that members are
parallel in plan
pt1 = Point(mem1.left.location.x,
mem1.left.location.y, 0.0)
pt2 = Point(mem1.right.location.x,
mem1.right.location.y, 0.0)
ap = LineLineIntersect3D(pt1, pt2,
mem2.left.location, mem2.right.location)
# Beam ends, VB right end
a = DistancePointLine3D(mem2.left.location,
mem2.right.location, mem1.right.location)
# Beam ends, VB left end
b = DistancePointLine3D(mem2.left.location,
mem2.right.location, mem1.left.location)
if
self.right_member == "None":
if
a.position == "RE" and (a.dist
<= mem2.depth) and (ap.not_parallel() == False):
if
mem1.right.location.z <= mem2.right.location.z:
self.right_member = mem2
if
self.left_member == "None":
if
b.position == "LE" and (b.dist
<= mem2.depth) and (ap.not_parallel() == False):
if
mem1.left.location.z <= mem2.left.location.z:
self.left_member = mem2
mi =
mi + 1
# end class definition
#####################################################################
def
test_VB_BeamSupport():
while 1:
ClearSelection()
mem1 = MemberLocate("Select a
VB MEMBER")
a = VB_BeamSupport(mem1)
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_VB_BeamSupport()
finally:
del VB_BeamSupport