Skip to content

Commit

Permalink
tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
lijon committed Feb 27, 2024
1 parent 5bb27fc commit 7ab5ee5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
17 changes: 8 additions & 9 deletions box.scad
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function lerp_index(v,x) = let(i=floor(x), a = v[i], b = v[min(i+1,len(v)-1)], f

// takes a list of [x,y,R] or [x,y,z,R] points and returns a rounded/chamfered path.
// where R is positive for circular and negative for chamfer.
function rpath(points, closed=true) =
function rpath(points) =
let(
path = [for(p = points) slice(p,0,-2)],
r = [for(p = points) last(p)],
Expand All @@ -71,15 +71,14 @@ function rpath(points, closed=true) =

// like path_sweep2d for closed path, that fills the hole (bottom). for easy creation of boxes from side profile and top path.
// the profile is oriented so that X+ points outwards and Y+ points upwards.
module path_sweep2d_fill(profile, path) {
path_sweep2d(profile,path,closed=true) children();
module path_sweep2d_fill(profile, path, fill = true) {
path_sweep2d(profile, path, closed = true) children();

fill = [
for(p=[profile[0],last(profile)])
up(p.y,path3d(offset(path,delta=p.x+0.001,closed=true)))
];
//skin(bot,slices=0);
vnf_polyhedron(vnf_vertex_array(fill,caps=true,col_wrap=true));
if(fill) {
a = [for(p = [profile[0], last(profile)])
path3d(offset(path, delta = p.x+0.001, closed = true), p.y)];
vnf_polyhedron(vnf_vertex_array(a, caps = true, col_wrap = true));
}
}

function vector_name(v) =
Expand Down
3 changes: 2 additions & 1 deletion examples/laserbox.scad
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ module toggle_switch(anchor=BOTTOM,spin) {

//cut_inspect(LEFT,ofs=[-21.1,0,0]) // inspect only laser mount
//cut_inspect(BACK)
box_make(print=true, explode=30.1)
//projection(cut=true) down(box_sz.z/2) this gives CGAL error
box_make(print=true, explode=30.1, hide_previews=false)
box_shell_base_lid(box_sz,rsides=6,wall_sides=1.6,wall_top=2,base_height=3,rim_height=2,rbot_inside=1,rtop_inside=1)
{
size = $parent_size;
Expand Down

0 comments on commit 7ab5ee5

Please sign in to comment.