Back to SDS/2 Parametric Scripts
## GPlate.py Version 1.04
##
Copyright (c) 2007 Bruce Vaughan, BV Detailing & Design, Inc.
##
All rights reserved.
##
NOT FOR
################################################################################
"""
Add
gusset and connection plate material to members to and for a vertical brace
member.
Add
a
Add
hole patterns to gusset plates.
Function
'mem_mtrl_list' returns a list of material on a
member. An
appears each time this function is called. THIS CANNOT BE DISABLED.
Works
with VB_Hovenza.py
Version
History:
Version
1.01 (
Version
1.02 (
Version
1.03 (
Version 1.04 (
"""
from point import Point
from rect_plate import RectPlate
from hole_add import Hole
from param import Warning, yes_or_no, dim_print
from mtrl_fit import MtrlFit
from bolt_add import Bolt
from math import cos, sin, tan, pi, ceil
from macrolib.ExceptWarn import formatExceptionInfo
from macrolib.angle import dtor, rtod
from macrolib.AngleBetMemTrue import trueAngleBetweenMembers
from macrolib.angle import rtod, dtor
from macrolib.round_length import round_length_next
from macrolib.Weld import mtrl_weld
##
Returns a rectangular plate object
##
If bpl=True, the corner is clipped at the plate
origin
def
add_gusset(mem, p1, p2, w,
t, clipL, clipW, rot,
offset, grade, finish, bpl=False):
if bpl:
clip_top_left
= "Clip"
else:
clip_top_left
= "None"
# rectangular
plate begin
rp1 = RectPlate()
rp1.member = mem
rp1.pt1 = p1
rp1.pt2 = p2
rp1.grade = grade
rp1.origin = "Center"
rp1.top_oper_left = clip_top_left
rp1.top_length_left = 1.0
rp1.top_clip_left = 1.0
rp1.top_oper_right = "None"
rp1.top_length_right = 0.0
rp1.top_clip_right = 0.0
rp1.bottom_oper_left = "None"
rp1.bottom_oper_right =
"Clip"
rp1.bottom_length_right = clipL
rp1.bottom_clip_right = clipW
rp1.width = w
rp1.thick = t
rp1.work_pt_dist = p1.dist(p2)
rp1.setback_left = 0
rp1.setback_right = 0
rp1.web_cut_angle_left = 0
rp1.web_cut_angle_right = 0
rp1.length = p1.dist(p2)
rp1.mtrl_type = "Plate"
rp1.mtrl_usage = ""
rp1.finish = finish
rp1.ref_pt_offset = offset
rp1.add()
rp1.rotate(rp1.member,
rot)
# rectangular
plate end
return rp1
##
Returns a rectangular plate object
##
def
add_end_gusset(mem, p1, p2,
w, t, clipL, clipW, rot,
offset, grade, finish, thk_ref='Center'):
# Do not clip
plate if width dimension is less than 1/2"
if clipW < 0.5:
clipL = 0.0
clipW = 0.0
clip_str =
'None'
else:
clip_str
= 'Clip'
# rectangular
plate begin
rp1 = RectPlate()
rp1.member = mem
rp1.pt1 = p1
rp1.pt2 = p2
rp1.grade = grade
rp1.origin = thk_ref
rp1.top_oper_left = clip_str
rp1.top_length_left = clipL
rp1.top_clip_left = clipW
rp1.top_oper_right = "None"
rp1.top_length_right = 0.0
rp1.top_clip_right = 0.0
rp1.bottom_oper_left = clip_str
rp1.bottom_length_left = clipL
rp1.bottom_clip_left = clipW
rp1.bottom_oper_right =
"None"
rp1.bottom_length_right = 0.0
rp1.bottom_clip_right = 0.0
rp1.width = w
rp1.thick = t
rp1.work_pt_dist = p1.dist(p2)
rp1.setback_left = 0
rp1.setback_right = 0
rp1.web_cut_angle_left = 0
rp1.web_cut_angle_right = 0
rp1.length = p1.dist(p2)
rp1.mtrl_type = "Plate"
rp1.mtrl_usage = ""
rp1.finish = finish
rp1.ref_pt_offset = offset
rp1.add()
rp1.rotate(rp1.member,
rot)
# rectangular
plate end
return rp1
##
Returns a rectangular plate object
## clipxx are tuples
(clip_length, clip_width)
def
add_spl_gusset1s(mem, p1, p2, w, t, clipUL, clipLL, clipUR, clipLR, rot, offset,
grade, finish, thk_ref='Center'):
# Do not clip
plate if length dimension is less than 1/4"
if clipUL[0] < 0.25:
clipLUL = 0.0
clipWUL
= 0.0
clip_strUL
= 'None'
else:
clipLUL = clipUL[0]
clipWUL = clipUL[1]
clip_strUL
= 'Clip'
if clipLL[0] < 0.25:
clipLLL = 0.0
clipWLL = 0.0
clip_strLL
= 'None'
else:
clipLLL = clipLL[0]
clipWLL = clipLL[1]
clip_strLL
= 'Clip'
if clipUR[0] < 0.25:
clipLUR = 0.0
clipWUR = 0.0
clip_strUR
= 'None'
else:
clipLUR = clipUR[0]
clipWUR = clipUR[1]
clip_strUR
= 'Clip'
if clipLR[0] < 0.25:
clipLLR = 0.0
clipWLR
= 0.0
clip_strLR
= 'None'
else:
clipLLR = clipLR[0]
clipWLR = clipLR[1]
clip_strLR
= 'Clip'
# rectangular
plate begin
rp1 = RectPlate()
rp1.member = mem
rp1.pt1 = p1
rp1.pt2 = p2
rp1.grade = grade
rp1.origin = thk_ref
rp1.top_oper_left = clip_strUL
rp1.top_length_left = clipLUL
rp1.top_clip_left = clipWUL
rp1.top_oper_right = clip_strUR
rp1.top_length_right = clipLUR
rp1.top_clip_right = clipWUR
rp1.bottom_oper_left = clip_strLL
rp1.bottom_length_left = clipLLL
rp1.bottom_clip_left = clipWLL
rp1.bottom_oper_right = clip_strLR
rp1.bottom_length_right = clipLLR
rp1.bottom_clip_right = clipWLR
rp1.width = w
rp1.thick = t
rp1.work_pt_dist = p1.dist(p2)
rp1.setback_left = 0
rp1.setback_right = 0
rp1.web_cut_angle_left = 0
rp1.web_cut_angle_right = 0
rp1.length = p1.dist(p2)
rp1.mtrl_type = "Plate"
rp1.mtrl_usage = ""
rp1.finish = finish
rp1.ref_pt_offset = offset
rp1.add()
rp1.rotate(rp1.member,
rot)
# rectangular
plate end
return rp1
def
markCNC(m, p):
try:
hole26 = Hole()
hole26.mtrl = [m, ]
hole26.pt1 = p
hole26.hole_type = 'Standard
Round'
hole26.face = 'FS Face'
hole26.valid_cnc =
"Yes"
hole26.x_ref_offset = 0.0
hole26.y_ref_offset = 0.0
hole26.x_spa = 0.0
hole26.y_spa = 0.0
hole26.group_rot = 0.0
hole26.locate =
"Center"
hole26.columns = 1
hole26.rows = 1
hole26.bolt_type = 'Auto'
hole26.bolt_dia = 0.0
hole26.slot_rot = 0.0
hole26.length =
hole26.calc_slot_length()
hole26.hole_dia = 0.0
hole26.show_window =
"Yes"
hole26.create()
except:
pass
# end function definition
def
add_pattern(m, pt, ang, xoff, xspa, yspa,
xcols, yrows, bolt_size, bolt_type,\
hltype='Standard Round', face='NS Face', slot_len=False, ref="Above"):
if yrows % 2 == 0:
yoff = yspa/2
else:
yoff = 0.0
no_rows = int(ceil(yrows/2.0))
if slot_len:
str = "slot_len"
else:
str = "hole26.calc_slot_length()"
try:
# hole
group add begin
hole26 = Hole()
hole26.mtrl = [m, ]
hole26.pt1 = pt
hole26.hole_type = hltype
hole26.face = face
hole26.valid_cnc =
"Yes"
hole26.x_ref_offset = yoff
hole26.y_ref_offset = xoff
hole26.x_spa = yspa
hole26.y_spa = xspa
hole26.group_rot = -90.0 - rtod(ang)
hole26.locate = ref
hole26.columns = no_rows
hole26.rows = xcols
hole26.bolt_type = bolt_type
hole26.bolt_dia = bolt_size
hole26.slot_rot = 0.0
hole26.length = eval(str)
hole26.hole_dia =
hole26.calc_hole_size()
hole26.show_window =
"Yes"
hole26.create()
except: pass
# hole group add
end
def
mem_mtrl_list(mem):
ml = []
i = 0
while 1:
try:
m = mem.material(i)
ml.append(m)
i +=
1
except:
return
ml
def
bpl_gusset(mem1, memc,
face, which_end, dd, gpl_inc='1/2'):
# update local
namespace with dd variables
for key, value
in dd.items():
exec
"%s = %s" % (key, repr(value)) in None
colx_offset =
memc.left.setback
if face in
['Face A', 'Face C']:
coly_offset
= memc.depth/2.0
else:
coly_offset
= memc.tw/2.0
if which_end == 'LE':
betAng = trueAngleBetweenMembers(mem1.left.location,
mem1.right.location,\
memc.left.location, memc.right.location)
# distance
from brace WP to edge of end gusset plate
end_gusset_dist
= mem1.left.setback - mtrl_clr - (hor_ed
* 2) - (hor_spa * (no_cols-1))
tie_end_dist
= end_gusset_dist - end_clr
- (2*hor_ed) - ((no_cols-1)*hor_spa)
tie_diff
= mem1.left.setback - tie_end_dist
else:
betAng = pi - trueAngleBetweenMembers(mem1.left.location,
mem1.right.location,\
memc.left.location,
memc.right.location)
# distance
from brace WP to edge of end gusset plate
end_gusset_dist
= mem1.right.setback - mtrl_clr - (hor_ed * 2) - (hor_spa *
(no_cols-1))
tie_end_dist
= end_gusset_dist - end_clr
- (2*hor_ed) - ((no_cols-1)*hor_spa)
tie_diff
= mem1.right.setback - tie_end_dist
# the tie plate length is calculated
tie_pl_length
= (hor_ed * 4) + (hor_spa *
2 * (no_cols-1)) + end_clr
# the splice plate width is the minimum
of user entered or calculated required width
splice_pl_width
= min(splice_pl_width, (vert_ed * 2) + (vert_spa *
(no_rows-1)))
# check brace
connection clearance, return false if clearance is less than variable 'spl_type_clear'
chk_result1, setb1 = chk_clr(tie_end_dist, betAng,
splice_pl_width/2, coly_offset, spl_type_clear)
chk_result2, setb2 = chk_clr(tie_end_dist, pi/2-betAng, splice_pl_width/2, colx_offset, spl_type_clear)
if chk_result1
< spl_type_clear or chk_result2 < spl_type_clear:
Warning("""There
is %s clearance which is less than %s\".\nThe
minimum required setback is %s.\nSelect
"OK" to abort""" % \
(dim_print(min(chk_result1,
chk_result2)), dim_print(spl_type_clear),
dim_print(max(setb1, setb2)+tie_diff)))
return
False
gpl_length = round_length_next(((end_gusset_dist-end_clr)*cos(betAng) +\
sin(betAng)*splice_pl_width/2) - colx_offset, gpl_inc)
gpl_width = round_length_next(((end_gusset_dist-end_clr)*sin(betAng) +\
cos(betAng)*splice_pl_width/2) - coly_offset,
gpl_inc)
# calculate clip dimensions
distx
= (end_gusset_dist-end_clr)*cos(betAng)
disty
= (end_gusset_dist-end_clr)*sin(betAng)
distx1 = gpl_length
+ colx_offset
disty1 = gpl_width
+ coly_offset
dimy
= disty - (distx1-distx)/tan(betAng)
dimx
= distx - (disty1-disty)*tan(betAng)
clipx
= distx1-dimx
clipy
= disty1-dimy
if face ==
'Face A':
ptWP1 = memc.left.location
+ memc.translate(memc.left.setback, memc.depth/2,
0.0)
rot =
(180.0, 0.0, 0.0)
elif
face == 'Face B':
ptWP1 = memc.left.location
+ memc.translate(memc.left.setback, 0.0,
memc.tw/2)
rot =
(-90.0, 0.0, 0.0)
elif
face == 'Face C':
ptWP1 = memc.left.location
+ memc.translate(memc.left.setback, -memc.depth/2,
0.0)
rot =
(0.0, 0.0, 0.0)
else: # Face D
ptWP1 = memc.left.location
+ memc.translate(memc.left.setback, 0.0,
-memc.tw/2)
rot =
(90.0, 0.0, 0.0)
ptWP2 = ptWP1 + memc.translate(gpl_length, 0.0, 0.0)
rp
= add_gusset(memc, ptWP1,
ptWP2, gpl_width, splice_pl_thk,
clipx, clipy,\
rot,
(-colx_offset, coly_offset,
0.0), gusset_grade, gusset_finish,
bpl=True)
xoff
= end_gusset_dist - end_clr
- hor_ed - hor_spa*(no_cols-1)
add_pattern(rp,
memc.left.location, betAng,
xoff, hor_spa, vert_spa, no_cols,\
no_rows,
bolt_size_spl, bolt_type_spl,
hole_type_spl)
if add_weld == "Yes":
mtrl_weld(mem_mtrl_list(memc), [rp,], bpl_weld_size,
weld_type)
return rp
def
end_gusset(mem1, which_end,
dd):
# update local
namespace with dd variables
for key, value
in dd.items():
exec
"%s = %s" % (key, repr(value)) in None
splice_pl_width
= min(splice_pl_width, (vert_ed * 2) + (vert_spa *
(no_rows-1)))
# the end plate length is calculated
end_pl_length
= brace_lap + mtrl_clr + (hor_ed * 2) + (hor_spa *
(no_cols-1))
end_pl_taper_width
= min(splice_pl_width,
mem1.depth + (2 * taper_width_proj))
if which_end == 'LE':
ptWP3 = mem1.left.location + mem1.translate(mem1.left.setback+brace_lap,
splice_pl_width/2, 0.0)
end_rotate
= (0.0, 180.0, 0.0)
hlWP = mem1.left.location +
mem1.translate(mem1.left.setback, 0.0, 0.0)
else:
ptWP3 = mem1.right.location + mem1.translate(-(mem1.right.setback+brace_lap),
splice_pl_width/2, 0.0)
end_rotate
= (0.0, 0.0, 0.0)
hlWP = mem1.right.location +
mem1.translate(-mem1.right.setback, 0.0, 0.0)
ptWP4 = ptWP3 + mem1.translate(end_pl_length, 0.0, 0.0)
clipW
= (splice_pl_width - end_pl_taper_width)
/ 2.0
off = (brace_lap, -splice_pl_width/2, 0.0)
rpend
= add_end_gusset(mem1, ptWP3, ptWP4, splice_pl_width, end_pl_thk,\
brace_lap, clipW, end_rotate, off, gusset_grade, gusset_finish)
add_pattern(rpend,
hlWP, 0.0, mtrl_clr+hor_ed,
hor_spa, vert_spa, no_cols,\
no_rows,
bolt_size_spl, bolt_type_spl,
hole_type_spl)
return rpend
def
tie_plate(mem1, which_end, dd):
# update local
namespace with dd variables
for key, value
in dd.items():
exec
"%s = %s" % (key, repr(value)) in None
tie_pl_width
= min(splice_pl_width, (vert_ed * 2) + (vert_spa *
(no_rows-1)))
tie_pl_length
= (hor_ed*4) + end_clr +
(((no_cols-1) * hor_spa) *2)
thk_off = max(splice_pl_thk/2, end_pl_thk/2)
if which_end == 'LE':
ptWP1 = mem1.left.location + mem1.translate(mem1.left.setback-mtrl_clr-tie_pl_length,
tie_pl_width/2, thk_off)
offset
= (tie_pl_length+mtrl_clr, -tie_pl_width/2, -thk_off)
else:
ptWP1 = mem1.right.location + mem1.translate(-(mem1.right.setback-mtrl_clr),
tie_pl_width/2, thk_off)
offset
= (-mtrl_clr, -tie_pl_width/2, -thk_off)
ptWP3 = ptWP1 + mem1.translate(0.0,
-tie_pl_width, -splice_pl_thk)
ptWP2 = ptWP1 + mem1.translate(tie_pl_length, 0.0, 0.0)
ptWP4 = ptWP3 + mem1.translate(tie_pl_length, 0.0, 0.0)
tie_rotateNS
= (0.0, 0.0, 0.0)
tie_rotateFS
= (0.0, 180.0, 180.0)
rpNS
= add_end_gusset(mem1, ptWP1, ptWP2, tie_pl_width, tie_pl_thk, 0.0,
0.0,\
tie_rotateNS, offset, gusset_grade,
gusset_finish, thk_ref='FS')
hlWP
= rpNS.pt1+rpNS.translate(0.0, -tie_pl_width/2, 0.0)
add_pattern(rpNS,
hlWP, 0.0, hor_ed, hor_spa, vert_spa, no_cols,\
no_rows,
bolt_size_spl, bolt_type_spl,
hole_type_spl)
add_pattern(rpNS,
hlWP, 0.0, ((hor_ed*3)+end_clr+((no_cols-1)*hor_spa)), hor_spa, vert_spa, no_cols,\
no_rows,
bolt_size_spl, bolt_type_spl,
hole_type_spl)
rpFS
= add_end_gusset(mem1, ptWP3, ptWP4, tie_pl_width, tie_pl_thk, 0.0,
0.0,\
tie_rotateFS,
offset, gusset_grade, gusset_finish,
thk_ref='FS')
hlWP
= rpFS.pt1+rpFS.translate(0.0, -tie_pl_width/2, 0.0)
add_pattern(rpFS,
hlWP, 0.0, hor_ed, hor_spa, vert_spa, no_cols,\
no_rows,
bolt_size_spl, bolt_type_spl,
hole_type_spl)
add_pattern(rpFS,
hlWP, 0.0, ((hor_ed*3)+end_clr+((no_cols-1)*hor_spa)), hor_spa, vert_spa, no_cols,\
no_rows,
bolt_size_spl, bolt_type_spl,
hole_type_spl)
return [rpNS, rpFS]
def
spl_gusset(mem1, memvb, memthru, which_end, dd):
# update local
namespace with dd variables
for key, value
in dd.items():
exec
"%s = %s" % (key, repr(value)) in None
splice_pl_width
= min(splice_pl_width, (vert_ed * 2) + (vert_spa *
(no_rows-1)))
betAng
= trueAngleBetweenMembers(mem1.left.location,
mem1.right.location,\
memvb.left.location, memvb.right.location)
if
mem1.left.location.z > memvb.left.location.z:
high_end
= 'LE'
rot_flg
= -1
else:
high_end
= 'RE'
rot_flg
= 1
## Add connection material at left end
of brace
if which_end == 'LE' and memthru !=
'None':
ptCtr = mem1.left.location
dist_left
= memthru.right.setback - mtrl_clr
- (2*hor_ed) - ((no_cols-1)*hor_spa)
- end_clr
dist_right
= mem1.left.setback - mtrl_clr - (2*hor_ed) - ((no_cols-1)*hor_spa) -
end_clr
# check
brace connection clearance, return false if clearance is less than variable 'spl_type_clear'
tie_end_left
= dist_left - (2*hor_ed) -
((no_cols-1)*hor_spa)
tcL = memthru.right.setback
- tie_end_left
tie_end_right
= dist_right - (2*hor_ed) -
((no_cols-1)*hor_spa)
tcR = mem1.left.setback - tie_end_right
chk_resultL,
setbL = chk_clr(tie_end_left, betAng,
splice_pl_width/2, memvb.depth/2.0, spl_type_clear)
chk_resultR,
setbR = chk_clr(tie_end_right, betAng, splice_pl_width/2, memvb.depth/2.0, spl_type_clear)
if chk_resultL < spl_type_clear
or chk_resultR < spl_type_clear:
Warning("""There is %s clearance which is less than
%s\".\nThe minimum required setback is %s.\nSelect "OK" to abort""" % \
(dim_print(min(chk_resultL, chk_resultR)), dim_print(spl_type_clear), dim_print(max(setbL+tcL, setbR+tcR))))
return
False
ptWP1 = mem1.left.location + mem1.translate(-dist_left,
splice_pl_width/2, 0.0)
ptWP2 = ptWP1 + memvb.translate(dist_left + dist_right, 0.0, 0.0)
rot =
(0.0, 0.0, rtod(betAng*rot_flg))
offset
= (dist_left, -splice_pl_width/2, 0.0)
rp = add_end_gusset(memvb, ptWP1, ptWP2, splice_pl_width,
splice_pl_thk, 0.0, 0.0,\
rot, offset, gusset_grade, gusset_finish, thk_ref='Center')
## Add connection material at right end
of brace
elif
which_end == 'RE' and memthru
!= 'None':
ptCtr = mem1.right.location
dist_right
= memthru.left.setback - mtrl_clr
- (2*hor_ed) - ((no_cols-1)*hor_spa)
- end_clr
dist_left
= mem1.right.setback - mtrl_clr - (2*hor_ed) - ((no_cols-1)*hor_spa) -
end_clr
# check
brace connection clearance, return false if clearance is less than variable 'spl_type_clear'
tie_end_left
= dist_left - (2*hor_ed) -
((no_cols-1)*hor_spa)
tcL = mem1.right.setback - tie_end_left
tie_end_right
= dist_right - (2*hor_ed) -
((no_cols-1)*hor_spa)
tcR = memthru.left.setback
- tie_end_right
chk_resultL,
setbL = chk_clr(tie_end_left, betAng,
splice_pl_width/2, memvb.depth/2.0, spl_type_clear)
chk_resultR,
setbR = chk_clr(tie_end_right, betAng, splice_pl_width/2, memvb.depth/2.0, spl_type_clear)
if chk_resultL < spl_type_clear
or chk_resultR < spl_type_clear:
Warning("""There is %s clearance which is less than
%s\".\nThe minimum required setback is %s.\nSelect "OK" to abort""" % \
(dim_print(min(chk_resultL, chk_resultR)), dim_print(spl_type_clear), dim_print(max(setbL+tcL, setbR+tcR))))
return
False
ptWP1 = mem1.right.location + mem1.translate(-dist_left,
splice_pl_width/2, 0.0)
ptWP2 = ptWP1 + memvb.translate(dist_left + dist_right, 0.0, 0.0)
rot =
(0.0, 0.0, rtod(betAng*rot_flg))
offset
= (dist_left, -splice_pl_width/2, 0.0)
rp
= add_end_gusset(memvb,
ptWP1, ptWP2, splice_pl_width, splice_pl_thk,
0.0, 0.0,\
rot, offset, gusset_grade, gusset_finish, thk_ref='Center')
hole_right = dist_right - hor_ed -
((no_cols-1)*hor_spa)
hole_left = dist_left - hor_ed - ((no_cols-1)*hor_spa)
add_pattern(rp,
ptCtr, 0.0, hole_right, hor_spa, vert_spa, no_cols,\
no_rows,
bolt_size_spl, bolt_type_spl,
hole_type_spl, ref="Above")
add_pattern(rp,
ptCtr, 0.0, hole_left, hor_spa, vert_spa, no_cols,\
no_rows,
bolt_size_spl, bolt_type_spl,
hole_type_spl, ref="Below")
if add_weld == "Yes":
mtrl_weld([memvb.main_mtrl(),],
[rp,], spl_weld_size, weld_type)
return rp
def
spl_gusset1s(mem1, memvb, memthru,
which_end, dd):
# update local
namespace with dd variables
for key, value
in dd.items():
exec
"%s = %s" % (key, repr(value)) in None
splice_pl_width
= min(splice_pl_width, (vert_ed * 2) + (vert_spa *
(no_rows-1)))
betAng
= trueAngleBetweenMembers(mem1.left.location,
mem1.right.location,\
memvb.left.location, memvb.right.location)
if betAng > pi/2:
calc_ang
= abs(betAng - pi)
else:
calc_ang
= betAng
## Add connection material at left end
of brace
if which_end == 'LE' and memthru ==
'None':
ptCtr = mem1.left.location
if
mem1.right.location.z < memvb.right.location.z:
high_end
= 'LE'
endAng = -(pi/2) + betAng
rot_flg
= -1
else:
high_end
= 'RE'
endAng = (pi/2) - betAng
rot_flg
= 1
# if
angle is less than 40 deg or greater than 140 deg, eliminate sharp corner
if betAng < 0.7 or betAng >
2.44:
dist_left
= (memvb.depth/2+1)/sin(betAng)
+ ((splice_pl_width/2)-1)/tan(calc_ang)
clip_length
= abs((splice_pl_width-1)/tan(betAng))
clip_width
= splice_pl_width-1
else:
dist_left
= (memvb.depth/2+1)/sin(betAng)
+ (splice_pl_width/2)/tan(calc_ang)
clip_length
= abs(splice_pl_width/tan(betAng))
clip_width
= splice_pl_width
if endAng <= 0.0:
clipUL = (clip_length, clip_width)
clipLL = (0.0, 0.0)
else:
clipUL = (0.0, 0.0)
clipLL = (clip_length, clip_width)
dist_right
= mem1.left.setback - mtrl_clr - (2*hor_ed) - ((no_cols-1)*hor_spa) -
end_clr
# check
brace connection clearance, return false if clearance is less than variable 'spl_type_clear'
tie_end_right
= dist_right - (2*hor_ed) -
((no_cols-1)*hor_spa)
tcR = mem1.left.setback - tie_end_right
chk_resultR,
setbR = chk_clr(tie_end_right, betAng, splice_pl_width/2, memvb.depth/2.0, spl_type_clear)
if chk_resultR < spl_type_clear:
Warning("""There is %s clearance which is less than
%s\".\nThe minimum required setback is %s.\nSelect "OK" to abort""" % \
(dim_print(chk_resultR), dim_print(spl_type_clear), dim_print(setbR+tcR)))
return
False
ptWP1 = mem1.left.location + mem1.translate(-dist_left,
splice_pl_width/2, 0.0)
ptWP2 = ptWP1 + memvb.translate(dist_left + dist_right, 0.0, 0.0)
rot =
(0.0, 0.0, rtod(betAng*rot_flg))
offset
= (dist_left, -splice_pl_width/2, 0.0)
rp = add_spl_gusset1s(memvb,
ptWP1, ptWP2, splice_pl_width, splice_pl_thk,
clipUL, clipLL, (0.0, 0.0),
(0.0, 0.0),\
rot, offset, gusset_grade, gusset_finish, thk_ref='Center')
hole_right
= dist_right - hor_ed -
((no_cols-1)*hor_spa)
add_pattern(rp,
ptCtr, 0.0, hole_right, hor_spa, vert_spa, no_cols,\
no_rows,
bolt_size_spl, bolt_type_spl,
hole_type_spl, ref="Above")
if add_weld == "Yes":
mtrl_weld([memvb.main_mtrl(),],
[rp,], spl_weld_size, weld_type)
## Add connection material at right end
of brace
elif
which_end == 'RE' and memthru
== 'None':
ptCtr = mem1.right.location
if
mem1.left.location.z < memvb.left.location.z:
high_end
= 'RE'
endAng = (pi/2) - betAng
rot_flg
= 1
else:
high_end
= 'LE'
endAng = -(pi/2) + betAng
rot_flg
= -1
# if
angle is less than 40 deg or greater than 140 deg, eliminate sharp corner
if betAng < 0.7 or betAng >
2.44:
dist_right
= (memvb.depth/2+1)/sin(betAng)
+ ((splice_pl_width/2)-1)/tan(calc_ang)
clip_length
= abs((splice_pl_width-1)/tan(betAng))
clip_width
= splice_pl_width-1
else:
dist_right
= (memvb.depth/2+1)/sin(betAng)
+ (splice_pl_width/2)/tan(calc_ang)
clip_length
= abs(splice_pl_width/tan(betAng))
clip_width
= splice_pl_width
if endAng <= 0.0:
clipUR = (0.0, 0.0)
clipLR = (clip_length, clip_width)
else:
clipUR = (clip_length, clip_width)
clipLR = (0.0, 0.0)
# print
betAng, high_end, rot_flg,
dist_left
= mem1.right.setback - mtrl_clr - (2*hor_ed) - ((no_cols-1)*hor_spa) -
end_clr
# check
brace connection clearance, return false if clearance is less than variable 'spl_type_clear'
tie_end_left
= dist_left - (2*hor_ed) -
((no_cols-1)*hor_spa)
tcL = mem1.right.setback - tie_end_left
chk_resultL,
setbL = chk_clr(tie_end_left, betAng,
splice_pl_width/2, memvb.depth/2.0, spl_type_clear)
if chk_resultL < spl_type_clear:
Warning("""There
is %s clearance which is less than %s\".\nThe
minimum required setback is %s.\nSelect
"OK" to abort""" % \
(dim_print(chk_resultL), dim_print(spl_type_clear), dim_print(setbL+tcL)))
return
False
ptWP1 = mem1.right.location + mem1.translate(-dist_left,
splice_pl_width/2, 0.0)
ptWP2 = ptWP1 + memvb.translate(dist_left + dist_right, 0.0, 0.0)
rot = (0.0,
0.0, rtod(betAng*rot_flg))
offset
= (dist_left, -splice_pl_width/2, 0.0)
rp = add_spl_gusset1s(memvb,
ptWP1, ptWP2, splice_pl_width, splice_pl_thk,
(0.0, 0.0), (0.0, 0.0), clipUR, clipLR,\
rot, offset, gusset_grade, gusset_finish, thk_ref='Center')
hole_left
= dist_left - hor_ed -
((no_cols-1)*hor_spa)
add_pattern(rp,
ptCtr, 0.0, hole_left, hor_spa, vert_spa, no_cols,\
no_rows,
bolt_size_spl, bolt_type_spl,
hole_type_spl, ref="Below")
if add_weld == "Yes":
mtrl_weld([memvb.main_mtrl(),], [rp,], spl_weld_size, weld_type)
return rp
def
bolt_match(m, m_list_match):
try:
# bolt
add begin
bolt1 = Bolt()
bolt1.mtrl = [m, ]
bolt1.match = m_list_match
bolt1.show_window =
"No"
bolt1.direction =
"In"
bolt1.add_match()
# bolt
add end
except:
Warning('Bolt
add was unsuccessful.')
def
fit_mtrl(mfit_list, mfitto_list):
# mtrl
fit begin
mfit1 = MtrlFit()
mfit1.mtrl = mfit_list
mfit1.to = mfitto_list
# mfit1.frame_type = "Field
weld"
mfit1.clear = 0.03125
mfit1.show_window = "No"
mfit1.fit("Exact")
def
chk_clr(d, a, w, obj_clr, min_clr=1.0):
return
(d*sin(a) - w*abs(cos(a)) - obj_clr),
((obj_clr + min_clr) /
sin(a) + w / abs(tan(a)))
##
End script
if
__name__ == '__main__':
from member
import Member, MemberLocate
ml = mem_mtrl_list(MemberLocate("Select
a MEMBER"))
for i in ml:
print i