ParaScript
workspace.para
Language
RUN SOLVER
DOWNLOAD STL
setup { name: "Broom", units: "mm", coordinate_system: "Z-up" } parameters { handle: { radius: 11.0, length: 1000.0, embed: 14.0 }, hang: { radius: 4.0, from_top: 30.0 }, head: { width: 240.0, depth: 50.0, height: 24.0 }, ferrule: { radius: 16.0, height: 36.0, bite: 1.0 }, bristles: { height: 90.0, bite: 3.0, top: { width: 220.0, depth: 36.0 }, bottom: { width: 300.0, depth: 68.0 } } } def pi = 3.14159265359 def Bristles = Component( solid: coords => let bottom = Surface2D( max_u: $bristles.bottom.width, min_v: u => 0.0, max_v: u => $bristles.bottom.depth, formula: u => v => Vector(coords: coords, x: u - ($bristles.bottom.width / 2.0), y: v - ($bristles.bottom.depth / 2.0), z: 0.0)) in let top = Surface2D( max_u: $bristles.top.width, min_v: u => 0.0, max_v: u => $bristles.top.depth, formula: u => v => Vector(coords: coords, x: u - ($bristles.top.width / 2.0), y: v - ($bristles.top.depth / 2.0), z: $bristles.height)) in let f = t => b => u => 0.5*(($bristles.height-u)*b / $bristles.height) + 0.5*(u*t / $bristles.height) in let face = bottom => top => x_projection => y_projection => let max_v = f(t: top, b: bottom) in Surface2D( max_u: $bristles.height, min_v: u => 0.0-max_v(u: u), max_v: max_v, formula: u => v => Vector(coords: coords, x: x_projection(u: u, v: v), y: y_projection(u: u, v: v), z: u ) ) in let front = face( bottom: $bristles.bottom.width, top: $bristles.top.width, x_projection: u=>v=>v, y_projection: u=>v=>f( t: $bristles.top.depth, b: $bristles.bottom.depth, u: u)) in let back = face( bottom: $bristles.bottom.width, top: $bristles.top.width, x_projection: u=>v=>v, y_projection: u=>v=>0.0-f( t: $bristles.top.depth, b: $bristles.bottom.depth, u: u)) in let left = face( bottom: $bristles.bottom.depth, top: $bristles.top.depth, x_projection: u=>v=>0.0-f( t: $bristles.top.width, b: $bristles.bottom.width, u: u), y_projection:u=>v=>v) in let right = face( bottom: $bristles.bottom.depth, top: $bristles.top.depth, x_projection: u=>v=>f( t: $bristles.top.width, b: $bristles.bottom.width, u: u), y_projection:u=>v=>v) in Solid3D(faces: [ bottom, top, back, front, left, right ]), expose: coords => { up: Vector(coords: coords, x: 0.0, y: 0.0, z: 1.0), right: Vector(coords: coords, x: 1.0, y: 0.0, z: 0.0), top: Vector(coords: coords, x: 0.0, y: 0.0, z: $bristles.height) } ) def Broom = let socket = $ferrule.height - $ferrule.bite + $handle.embed in let handle_bottom = $head.height - $handle.embed in let handle_top = handle_bottom + $handle.length in let bristle_tip = $bristles.bite - $bristles.height in let stick = Component( solid: join( frame: Cylinder( radius: $handle.radius, height: $handle.length), placed: Cylinder( radius: $hang.radius, height: $handle.radius * 2.0 + 8.0), using: frame => placed => align( planar: meet( frame: frame.forward, placed: placed.up), translation: meet( frame: frame.top.offset(x: 0.0, y: 0.0, z: 0.0 - $hang.from_top), placed: placed.center), rotation: meet( frame: frame.right, placed: placed.right) ), combine: frame => placed => frame - placed ), expose: coords => { up: Vector(coords: coords, x: 0.0, y: 0.0, z: 1.0), right: Vector(coords: coords, x: 1.0, y: 0.0, z: 0.0), bottom: Vector(coords: coords, x: 0.0, y: 0.0, z: 0.0) } ) in let collar = Component( solid: join( frame: Box( width: $head.width, depth: $head.depth, height: $head.height), placed: Cylinder( radius: $ferrule.radius, height: $ferrule.height) using: frame => placed => align( planar: meet( frame: frame.up, placed: placed.up), translation: meet( frame: frame.top.offset(x: 0.0, y: 0.0, z: 0.0 - $ferrule.bite), placed: placed.bottom), rotation: meet( frame: frame.right, placed: placed.right) ), combine: frame => placed => frame + placed ), expose: coords => { up: Vector(coords: coords, x: 0.0, y: 0.0, z: 1.0), right: Vector(coords: coords, x: 1.0, y: 0.0, z: 0.0), top: Vector(coords: coords, x: $head.width / 2.0, y: $head.depth / 2.0, z: $head.height - $ferrule.bite + $ferrule.height) } ) in let headed = Component( solid: join( frame: collar, placed: stick, using: frame => placed => align( planar: meet( frame: frame.up, placed: placed.up), translation: meet( frame: frame.top.offset(x: 0.0, y: 0.0, z: 0.0 - socket), placed: placed.bottom), rotation: meet( frame: frame.right, placed: placed.right) ), combine: frame => placed => frame + placed ), expose: coords => { up: Vector(coords: coords, x: 0.0, y: 0.0, z: 1.0), right: Vector(coords: coords, x: 1.0, y: 0.0, z: 0.0), seat: Vector(coords: coords, x: $head.width / 2.0, y: $head.depth / 2.0, z: 0.0) } ) in Component( solid: join( frame: headed, placed: Bristles, using: frame => placed => align( planar: meet( frame: frame.up, placed: placed.up), translation: meet( frame: frame.seat.offset(x: 0.0, y: 0.0, z: $bristles.bite), placed: placed.top), rotation: meet( frame: frame.right, placed: placed.right) ), combine: frame => placed => frame + placed ), expose: coords => { origin: Vector(coords: coords, x: $head.width / 2.0, y: $head.depth / 2.0, z: (handle_top + bristle_tip) / 2.0) } ) export(Broom)
Model
Solid sides
Drag to turn. Pinch to zoom. Two fingers pan.