// Last edited on 2010-05-16 00:02:27 by stolfilocal // STRUCTURAL BARS //////////////////////////////////////////////////// // Dimensions of standard extruded aluminum bars: #declare bar_extruded_2x2_wdt = 20; #declare bar_extruded_3x3_wdt = 30; #declare bar_extruded_5x5_wdt = 50; #macro extruded_bar_hole_radius(wdt) // Radius of hole in centre of extruded bar. ((wdt)/40*3) #end #macro extruded_bar(wdt,len) // A slotted extruded aluminum bar with square {wdt} by {wdt} section and length {len}. // Centered on the Z axis, extends from Z = 0 to Z = {len}. // No texture. // Notable coords perp to face (asuming width 2.0): #local A = 1.00; // Outer surface. #local B = 0.80; // Inner side of lip. #local C = 0.40; // Chamfer at bottom of slot. #local D = 0.30; // Bottom of slot. #local G = 0.90; // Outer wall of hole. #local H = 0.40; // Inner wall of hole. // Notable coords para to face (asuming width 2.0): #local M = 0.20; // Lip of slot. #local N = 0.30; // Side wall of slot. #local P = 0.20; // Chamfer at bottom of slot. // central hole: #local hrad = extruded_bar_hole_radius(wdt); #debug "\n" #debug concat("len = ", str(len,6,1), "\n") #debug concat("hrad = ", str(hrad,6,1), "\n") difference{ prism{ 0+eps len-eps 65 // Main outline <-A,-A>, <-A,-M>, <-B,-M>, <-B,-N>, <-C,-N>, <-D,-P>, <-D,+P>, <-C,+N>, <-B,+N>, <-B,+M>, <-A,+M>, <-A,+A>, <-M,+A>, <-M,+B>, <-N,+B>, <-N,+C>, <-P,+D>, <+P,+D>, <+N,+C>, <+N,+B>, <+M,+B>, <+M,+A>, <+A,+A>, <+A,+M>, <+B,+M>, <+B,+N>, <+C,+N>, <+D,+P>, <+D,-P>, <+C,-N>, <+B,-N>, <+B,-M>, <+A,-M>, <+A,-A>, <+M,-A>, <+M,-B>, <+N,-B>, <+N,-C>, <+P,-D>, <-P,-D>, <-N,-C>, <-N,-B>, <-M,-B>, <-M,-A>, <-A,-A> // Holes <-H,-H>, <-H,-G>, <-G,-G>, <-G,-H>, <-H,-H> <+H,-H>, <+H,-G>, <+G,-G>, <+G,-H>, <+H,-H> <-H,+H>, <-H,+G>, <-G,+G>, <-G,+H>, <-H,+H> <+H,+H>, <+H,+G>, <+G,+G>, <+G,+H>, <+H,+H> rotate 90*x scale < wdt/2-eps, wdt/2-eps, 1 > } cylinder{ (0-eps)*z, (len+eps)*z, hrad } } #end #macro holed_bar(szX,szY,szZ,hrad,hspc,hfst,nh) // A holed steel bar with square {szX} by {szY} section and length {szZ}. // Holes have radius {hrad} and spacing {hspc} center-to-center. // Centered on the Z axis, extends from Z = 0 to Z = {szZ}. // The first hole is centered {hfst} from min-Z end. // There are {nh} holes. // No texture. #local thk = 1.00; // Wall thickness difference{ box{ < -szX/2+eps, -szY/2+eps, 0+eps >, < +szX/2-eps, +szY/2-eps, szZ-eps > } box{ < -szX/2+thk-eps, -szY/2+thk-eps, 0-eps >, < +szX/2-thk+eps, +szY/2-thk+eps, szZ+eps > } #local hz = hfst; // Z of next hole. #local i = 0; // Hole index, from 0. #while (i < nh) cylinder{ < 0, -szY/2-eps, hz >, < 0, +szY/2+eps, hz >, hrad } #local hz = hz + hspc; #local i = i + 1; #end } #end #macro rectangular_tube(szX,szY,szZ) // A smooth hollow steel bar with square {szX} by {szY} section and length {szZ}. // Centered on the Z axis, extends from Z = 0 to Z = {szZ}. // No texture. #local thk = 1.00; // Wall thickness difference{ box{ < -szX/2+eps, -szY/2+eps, 0+eps >, < +szX/2-eps, +szY/2-eps, szZ-eps > } box{ < -szX/2+thk-eps, -szY/2+thk-eps, 0-eps >, < +szX/2-thk+eps, +szY/2-thk+eps, szZ+eps > } } #end #macro flat_corner_plate(xlen,zlen,wdt,thk,hrad,h1dst,h2dst) // Flat corner ("L") plate of thickness {thk}. // The vertical leg axis is the Z axis, the horiz leg axis is the X axis. // Horiz arm extends {xlen} towards +X, vert arm extends {zlen} towards -Z. // Both arms have width {wdt}. // Holes are placed at {h1dst} distance from origin // and {h2dst} distance from tips. #local hole = cylinder{ < 0, -thk/2-eps, 0 >, < 0, +thk/2+eps, 0 >, hrad } difference{ box{ < -wdt/2+eps, -thk/2+eps, -zlen+eps >, < +xlen-eps, +thk/2-eps, +wdt/2-eps > } box{ < +wdt-eps, -thk/2-eps, -zlen-eps >, < +xlen/2+eps, +thk/2+eps, -wdt/2-eps > } object{ hole translate < h1dst, 0, 0 > } object{ hole translate < xlen-h2dst, 0, 0 > } object{ hole translate < 0, 0, -h1dst > } object{ hole translate < 0, 0, -zlen+h2dist > } } #end #macro flat_tee_plate(xlen,zlen,wdt,thk,hrad,h1dst,h2dst) // Flat three-legged ("T") plate of thickness {thk}. // The vertical leg axis is the Z axis, the horiz leg axis is the X axis. // Horiz arm extends from {-xlen/1} to {+xlen/2} in X. // Vert arm extends {zlen} towards -Z. // Both arms have width {wdt} // Holes are placed at {h1dst} distance from origin on // vert leg and at {h2dst} from the three tips. #local hole = cylinder{ < 0, -thk/2-eps, 0 >, < 0, +thk/2+eps, 0 >, hrad } difference{ box{ < -xlen/2+eps, -thk/2+eps, -zlen+eps >, < +xlen/2-eps, +thk/2-eps, +wdt/2-eps > } box{ < +wdt/2-eps, -thk/2-eps, -zlen-eps >, < +xlen/2+eps, +thk/2+eps, -wdt/2+eps > } box{ < -xlen/2-eps, -thk/2-eps, -zlen-eps >, < -wdt/2+eps, +thk/2+eps, -wdt/2+eps > } object{ hole translate < -xlen/2+h2dst, 0, 0 > } object{ hole translate < +xlen/2-h2dst, 0, 0 > } object{ hole translate < 0, 0, -h1dst > } object{ hole translate < 0, 0, -zlen+h2dst > } } #end #macro device_holder(szX,szY,szZ,wdt,thk,hrad,h1dst,h2dst) // The device-side half is a horizontal plate with top face at Z=0, // extending from 0 to {szX} in X and from {-szY/2} to {+szY/2} in Y. // The rig-side half is a vertical strip with back side at X=0 // extending down to Z = {-szZ}. The strip has with {wdt} and is // centered in Y. It has two holes with radius {hrad} at distances // {hdst1,hdst2} from the tip. #local big_hole = cylinder{ < 0-eps, 0, 0 >, < thk+eps, 0, 0 >, hrad+eps } difference{ union{ box{ < 0+2*eps, -szY/2+eps, -thk+eps >, < szX-eps, +szY/2-eps, 0-eps > } box{ < 0+eps, -wdt/2+eps, -szZ+eps > < thk-eps, +wdt/2-eps, 0-eps > } } object{ big_hole translate -h1dst*z } object{ big_hole translate (-szZ+h2dst)*z } } #end #debug "loaded pst_bars.inc\n"