// Last edited on 2011-05-11 17:08:04 by stolfilocal // Crane, FHM, and other gadgets for unit #4. #macro un4_crane_with_winch(wX) // The overhead crane with the winch. // The crane's platform is centered on the Z-axis, with wheel-rail contact at Z=0. // The winch is centered at position {wX} from the crane's center. // The crane extends below the Z=0 plane (beams) // and slighly above it (rails for the winch box). #local cr_Z = un4_crane_rel_top_Z; // Z from crane wheel bot to crane top surf. #local wr_sz_Z = un4_winch_rail_size_Z; // Z size of winch rails. union{ object{ un4_crane_platform() } object{ un4_crane_winch() translate wX*x translate (cr_Z + wr_sz_Z)*z } } #end #macro un4_crane_platform() // The overhead crane without the winch box, // centered on the Z-axis, with wheel-rail contact at Z=0. // The crane extends below the Z=0 plane (lower part of beams) // and above it (upper part of beams + rails for the winch box). #local crane_sz_X = un4_crane_frame_size_X; // X size of crane's frame. #local crane_sz_Y = un4_crane_frame_size_Y; // Y size of crane's frame. #local beam_sz_X = crane_sz_X; #local beam_sz_Y = un4_crane_beam_size_Y; // Y size of crane's main beam. #local beam_sz_Z = un4_crane_beam_size_Z; // Z size of crane's main beam. #local cross_sz_X = un4_crane_cross_size_X; // X size of crane's crosspiece. #local cross_sz_Y = crane_sz_Y; #local cross_sz_Z = un4_crane_cross_size_Z; // Z size of crane's crosspiece. #local thin_sz_X = un4_crane_beam_thin_size_X; // X size of thin part of crane's beam. #local taper_sz_X = un4_crane_beam_taper_size_X; // X size of crane beam's width transition. #local x0 = beam_sz_X/2; #local x1 = x0 - thin_sz_X; #local x2 = x1 - taper_sz_X; #local z0 = 0; #local z1 = -cross_sz_Z; #local z2 = -beam_sz_Z; // The S longbeam, with top surf at Z=0: #local longbeam = prism{ linear_spline 0+eps, +beam_sz_Y-eps, 9, < -x0+2*eps, z0-eps >, < -x0+2*eps, z1+eps >, < -x1+eps, z1+eps >, < -x2+eps, z2+eps >, < +x2-eps, z2+eps >, < +x1-eps, z1+eps >, < +x0-eps, z1+eps >, < +x0-eps, z0-2*eps >, < -x0-eps, z0-2*eps > translate -crane_sz_Y/2*y } // The W crosspiece, with top surf at Z=0: #local crosspiece = box{ <0+eps, -crane_sz_Y/2+2*eps, -cross_sz_Z+eps >, translate -crane_sz_X/2*x } // The crane's frame without the winch rails, with top surf at Z=0: #local main_frame = union{ object{ longbeam } object{ longbeam scale <+1,-1,+1> } object{ crosspiece } object{ crosspiece scale <-1,+1,+1> } texture{ tx_crane_frame } } #local rail_sz_X = un4_winch_rail_size_X; // X size of crane winch rail. #local rail_sz_Y = un4_winch_rail_size_Y; // Y size of crane winch rail. #local rail_sz_Z = un4_winch_rail_size_Z; // Z size of crane winch rail. #local rail_sp_Y = un4_winch_rail_spacing_Y; // Y spacing of crane winch rails. // A winch rail, with bottom at Z=0, centered in Y at 0: #local winch_rail = box { < -rail_sz_X/2, -rail_sz_Y/2, 0 > + epsv, < +rail_sz_X/2, +rail_sz_Y/2, rail_sz_Z > - epsv texture{ tx_winch_rail } } // Both winch rails, with bottom at Z=0, symmetric on N beam: #local winch_rails = union{ object{ winch_rail translate -rail_sp_Y/2*y } object{ winch_rail scale <+1,-1,+1> translate +rail_sp_Y/2*y } translate (+crane_sz_Y/2-beam_sz_Y/2)*y } #local wheel_sz_X = un4_crane_wheel_size_X; // X width of crane wheels. #local wheel_sp_X = un4_crane_rail_spacing_X; // X spacing bwtween crane rail midlines. #local wheel_R = un4_crane_wheel_rad; // Radius of crane wheels. #local wheel_sp_Y = cross_sz_Y - max(beam_sz_Y, wheel_R); #local wheel_pos_Z = un4_crane_rel_top_Z; // Z from crane wheel bot to top crane surf. // A West wheel, centered in Y, properly placed in X, // placed in Z assuming top surf of crane is at Z=0: #local wheel = cylinder{ < -wheel_sz_X/2+eps, 0, 0 >, < +wheel_sz_X/2+eps, 0, 0 >, wheel_R-eps translate < -wheel_sp_X/2, 0, +wheel_R-wheel_pos_Z > texture{ tx_crane_wheel } } // The wheel set: #local wheels = union{ object{ wheel translate -wheel_sp_Y/2*y } object{ wheel translate +wheel_sp_Y/2*y } object{ wheel translate -wheel_sp_Y/2*y scale <-1,+1,+1> } object{ wheel translate +wheel_sp_Y/2*y scale <-1,+1,+1> } } // The crane frame with wheels and winch rails, // crane rail-wheel contact at Z=0: union{ object{ main_frame } object{ winch_rails } object{ wheels } bounded_by{ box{ < -crane_sz_X/2, -crane_sz_Y/2, -beam_sz_Z > - 2*epsv, < +crane_sz_X/2, +crane_sz_Y/2, +rail_sz_Z > + 2*epsv } } translate wheel_pos_Z*z } #end #macro un4_crane_winch() // The winch box that slides E-W atop the crane frame. // Centered on Z axis with rail-wheel contact at Z=0. #local box_sz_X = un4_crane_winch_box_size_X; // X size of winch box. #local box_sz_Y = un4_crane_winch_box_size_Y; // Y size of winch box. #local box_sz_Z = un4_crane_winch_box_size_Z; // Z size of winch box. #local bot_Z = un4_crane_winch_box_bot_Z; // Z of box bottom rel to wheel contact. // Wheels! box{ < -box_sz_X/2, -box_sz_Y/2, 0 > + epsv, < +box_sz_X/2, +box_sz_Y/2, box_sz_Z > - epsv texture{ tx_winch_box } translate bot_Z*z } #end