## Beam_LifelineHoles.py Version 1.00
## Copyright (c) 2006
Bruce Vaughan, BV Detailing & Design, Inc.
## All rights
reserved.
## NOT FOR
############################################################################
"""
Add lifeline holes to WF beam top flange
NS, FS or BS at the LE, RE or BE.
Flange gage is obtained from the material
file.
This script can be executed in plan,
elevation, or isometric.
Version History:
1.00 - (
************************************************************
****NOTE: This version is not compatible
with
************************************************************
NOTE: This script reads and writes script
default data to/from a disc file.
Developed in
Developed by Bruce Vaughan, BV Detailing
& Design, Inc. (BVD)
For comments, suggestions or questions call
BVD at the number above,
email
bvdet@comcast.net, or post to the Detailing Forum.
Go to Defaults section to modify defaults.
"""
import os
from math import cos,
floor, pi, tan
from param import yes_or_no, ResponseNotOK, Units, ClearSelection, Dialog, dim_print,
Warning, dim
from macrolib.FileDefaults
import import_data, export_data
from macrolib.ExceptWarn
import formatExceptionInfo
from macrolib.MemSelection
import mem_select
Units("feet")
from shape import Shape
from point import Point, PointLocate
from member import Member, MemberLocate
from mtrl_list
import MtrlLocate, HoleLocate
from hole_add import
Hole
from job import Job
from fab import
Fabricator
def run_script():
#####################################################################
## Variables section
# system path for
defaults file
default_file_path
= os.path.join(os.getcwd(), "macro",
"Defaults")
# defaults file
name
def_file =
"Beam_LifelineHoles.txt"
# Path to image files and file names
image_path = os.path.join(os.getcwd(), "macro", "Images")
image_name1 = os.path.join(image_path, "Beam_LifelineHoles1.gif")
# enable or
disable the importing and exporting of dialog dictionary
# variables
"Enable" "Disable"
enable_default_import_export
= "Enable"
holeTypeList
= ["Standard Round", "Oversized Round", "Plug Weld
Hole"]
flgList
= ["Top Flange", "Bottom Flange", "Both Flanges"]
#####################################################################
## Defaults section
# minimum distance
from left end of material
dist_left = 6.0
# minimum distance
from right end of material
dist_right = 6.0
bolt_size = 0.75
# holeTypeList
hole_type =
"Plug Weld Hole"
# Job().bolt_sched()
bolt_type =
"A325N"
# nailer
hole spacing
nailer_spacing =
32.0
# ["Top Flange", "Bottom
Flange", "Both Flanges", "Web"]
which_flg =
"Top Flange"
# "LE", "RE",
"BE"
which_end =
"BE"
# "NS", "FS",
"BS"
which_side =
"BS"
#####################################################################
## Function definition section ##
#####################################################################
# hole pattern add
function
def lifeline_hole (mem, hl_ref_pt, x_off, y_off, ht, bd, bt, patt_type, which_flg):
try:
hole26 = Hole()
hole26.mtrl = [mem, ]
hole26.pt1 = hl_ref_pt
hole26.hole_type = ht
hole26.face = which_flg
hole26.valid_cnc = "Yes"
hole26.x_ref_offset = x_off
hole26.y_ref_offset = y_off
hole26.x_spa = 0.0
hole26.y_spa = 0.0
hole26.group_rot = 0.0
hole26.locate = patt_type
hole26.columns = 1
hole26.rows = 1
hole26.bolt_type = bt
hole26.bolt_dia = bd
hole26.slot_rot = 0.0
hole26.length = hole26.calc_slot_length()
hole26.hole_dia = hole26.calc_hole_size()
hole26.show_window =
"Yes"
hole26.create()
# hole
group add end
except:
yes_or_no("Error ading holes.\n" + formatExceptionInfo(),
"OK")
###########################################################################
## End function definitions
###############################################
###########################################################################
## import defaults data if enabled
if enable_default_import_export == "Enable":
dd0 = import_data(os.path.join(default_file_path, def_file))
if dd0:
for key,
value in dd0.items():
exec
"%s = %s" % (key, repr(value)) in None
###########################################################################
## Main program loop
######################################################
while True:
bm_list = mem_select("Select
if bm_list is None:
break
flg_gage = bm_list[0].gage
#############################################################
## DIALOG
#############################################################
dlg1 = Dialog(
"Add Lifeline Holes to WF Beams" )
dlg1.menu("print_doc", ("Yes", "No"),
"No", "Print documentation only")
dlg1.tabset_begin()
dlg1.tab("General
Information")
dlg1.column_group_begin()
dlg1.column(0)
dlg1.menu("which_flg", flgList, which_flg, "Select Flange(s)")
dlg1.group_title("Lifeline
hole pattern options")
dlg1.entry("dist_left", dim_print(dist_left), "Distance Left End")
dlg1.entry("dist_right", dim_print(dist_right), "Distance Right End")
dlg1.menu("which_side", ("NS", "FS",
"BS"), which_side, "Which Side")
dlg1.menu("which_end", ("LE", "RE",
"BE"), which_end, "Which End")
dlg1.group_title_end
dlg1.column(0)
dlg1.group_title("Bolt/Hole
Information")
dlg1.entry("flg_gage", dim_print(flg_gage), "Flange gage")
dlg1.entry("bolt_size", dim_print(bolt_size), "Bolt Size")
dlg1.menu("hole_type", holeTypeList, hole_type, "Hole type")
dlg1.menu("bolt_type", Job().bolt_sched(),
bolt_type, "Bolt type")
dlg1.group_title_end
dlg1.column_group_end()
# dlg1.image(image_name2)
dlg1.column_group_end()
dlg1.tab("Graphic
Image")
dlg1.image(image_name1)
dlg1.tabset_end()
try:
dd1 = dlg1.done()
except ResponseNotOK:
break
# Update the local namespace
for key, value
in dd1.items():
exec
"%s = %s" % (key, repr(value)) in None
###############################################################
## END DIALOG
###############################################################
if enable_default_import_export == "Enable":
export_data(os.path.join(default_file_path, def_file),
dd1)
if print_doc == "Yes":
print
__doc__
break
for bm in bm_list:
ref_WP1 = bm.left_location
+ bm.translate(bm.left.setback, 0.0, 0.0)
ref_WP2 = bm.right_location
+ bm.translate(-bm.right.setback, 0.0, 0.0)
if which_flg in ["Top Flange", "Both
Flanges"]:
if which_end in ["LE", "BE"]:
dd = {"NS": "Below Right",
"FS": "Above Right", "BS": "Center
Right"}
lifeline_hole(bm,
ref_WP1, dist_left, flg_gage/2, hole_type,\
bolt_size, bolt_type, dd[which_side], 1)
if which_end in ["RE", "BE"]:
dd = {"NS": "Below Left",
"FS": "Above Left", "BS": "Center
Left"}
lifeline_hole(bm,
ref_WP2, dist_right, flg_gage/2, hole_type,\
bolt_size,
bolt_type, dd[which_side], 1)
if which_flg in ["Bottom Flange", "Both
Flanges"]:
if which_end in ["LE", "BE"]:
dd = {"NS": "Above Right",
"FS": "Below Right", "BS": "Center
Right"}
lifeline_hole(bm,
ref_WP1, dist_left, flg_gage/2, hole_type,\
bolt_size, bolt_type, dd[which_side], 3)
if which_end in ["RE", "BE"]:
dd = {"NS": "Above Left",
"FS": "Below Left", "BS": "Center
Left"}
lifeline_hole(bm,
ref_WP2, dist_right, flg_gage/2, hole_type,\
bolt_size, bolt_type, dd[which_side], 3)
if not yes_or_no("Add nailer holes
to another WF beam"):
break
## End run_script()
##############################################################
if __name__ == '__main__':
try:
run_script()
finally:
ClearSelection()