Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 3D Printer PLA Lubricator
- // Copyright (C) 2013 Charles Yates
- // Released under the LGPL.
- // Provides a small box to hold a cut sponge which should be lubricated with WD40.
- // PLA can be threaded through the filament holes. Additional WD40 can be squirted
- // through the grills provided on the lid. Customisation options provided.
- function base( p )
- {
- return difference(
- cube( { size: [ p.w + 2 * p.s, p.b + 2 * p.s, p.h + p.s ] } ),
- cube( { size: [ p.w, p.b, p.h ] } ).translate( p.s, p.s, p.s ),
- cylinder( { r: p.r, h: p.b + 2 * p.s } ).rotateX( -90 ).translate( [ p.s + p.w / 2, 0, p.s + p.h / 2 ] )
- );
- }
- function top( p )
- {
- var top = union(
- cube( { size: [ p.w + 2 * p.s, p.b + 2 * p.s, p.s ] } ),
- difference(
- cube( { size: [ p.w, p.b, p.s ] } ).translate( [ p.s, p.s, p.s ] ),
- cube( { size: [ p.w - 2 * p.s, p.b - 2 * p.s, p.s ] } ).translate( [ p.s * 2, p.s * 2, p.s ] )
- )
- );
- var grill = [ ];
- function position( p, i ) { return i * p.g + p.s * 2 + 2 * ( i + 1 ); }
- for ( var i = 0; position( p, i ) + p.g < p.b; i ++ )
- grill.push( cube( { size: [ p.w - p.s * 2 - 2, p.g, p.s ] } ).translate( [ p.s * 2 + 1, position( p, i ), 0 ] ) );
- return difference(
- top,
- union( grill )
- );
- }
- function getParameterDefinitions()
- {
- return [
- { name: 'w', type: 'float', initial: 24, caption: "Width:" },
- { name: 'b', type: 'float', initial: 50, caption: "Breadth:" },
- { name: 'h', type: 'float', initial: 12, caption: "Height:" },
- { name: 's', type: 'float', initial: 1.5, caption: "Support:" },
- { name: 'r', type: 'float', initial: 1.8, caption: "Radius:" },
- { name: 'g', type: 'float', initial: 3, caption: "Grill:" }
- ];
- }
- function main( p )
- {
- return union(
- base( p ),
- top( p ).translate( [ - p.w - 5 * p.s, 0, 0 ] )
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement