kennetek / gridfinity-rebuilt-openscad

A ground-up rebuild of the stock gridfinity bins in OpenSCAD
Other
1.27k stars 186 forks source link

first pass at generating stacking tabs #122

Open rpedde opened 1 year ago

rpedde commented 1 year ago

This is a bit hacky, but represents a proof of concept for trying to make the sort of stacking tabs discussed in #81

rpedde commented 1 year ago

I'm clearly not very skilled at openscad and honestly have a hard time just reading it. Well aware this is a mess, but mostly I'm offering it up in the hopes that it encourages someone to try something better. If there is something that might be salvageable here, I'd be willing to clean it up to point that it was acceptable.

Not sure how to do this in a reasonable way that fits to the lip well without someting like f360's loft command.

Brunius commented 1 year ago

Thanks for your effort; there's some stuff in there you figured out that I would've looked at and gone "no way am I learning this".

I've had a bit of a go at rewriting your module to be a little prettier; both in terms of output and code (though I will fully admit my code still has a little way to go). My rewrite is below:

module lip_tab(x, y) {

    //Calculate rotation of lip based on which edge it is on
    rot = (x == $gxx) ? 0 : ((x == 0) ? 180 : ((y == $gyy) ? 90 : 270));
    wall_thickness = r_base-r_c2+d_clear*2;

    translate(
        [(x * l_grid) - ((l_grid * $gxx / 2)),
         (y * l_grid) - ((l_grid * $gyy / 2)),
         $dh+h_base]) {
        rotate([0, 0, rot]) 
        translate([-r_base-d_clear,-r_base,0]) {
            //Extrude the wall profile in circle; same as you would at a corner of bin
            //Intersection - limit it to the section where the lip would not interfere with the base
            intersection() {
                translate([wall_thickness, -r_base*1.5, 0]) cube([wall_thickness, r_base*5, (h_lip)*5]);
                translate([0,0,-$dh]) union() {
                    rotate_extrude(angle=90) profile_wall();
                    translate([0, r_base*2, 0]) rotate_extrude(angle=-90) profile_wall();
                }
            }
            //Fill the gap between rotational extrusions (think of it as the gap between bins, if this was multiple bins instead of tabs)
            difference() {
                translate([wall_thickness, 0, -h_lip*0.5]) cube([(r_base-wall_thickness)-r_f1, r_base*2, h_lip*1.5]);
                cylinder(h=h_lip*3, r=r_base-r_f1, center=true);
                translate([0, r_base*2, 0]) cylinder(h=h_lip*3, r=r_base-r_f1, center=true);
            }
        }
    }
}

This resolves some of your magic numbers, and has a smoother outline. I haven't printed any yet (as my printer is in pieces after a move), but as best I can tell it should be fine (tbc when the other half of the boxes arrive)

I can't figure out if there's any way for me to formally add this to the PR; it might be something you simply have to cut + paste to add (or I could make a PR for your repo, merge it there, then it should be added to this PR, I think?)

rpedde commented 1 year ago

Was out of town for a week, and didn't get a chance until recently to update and print some of these. I updated this pr with your suggestions. I agree, this generates nicer outlines. It doesn't seem to "latch" as nicely as the fusion 360 version does (although I do think this represents a great improvement over stock), and I'm not entirely sure why that is. I'll maybe take a deeper look at that to see what's going on there.

@Brunius: I appreciate the help, and if you want to make a pr to my branch from fc8dc87c, I'll can revert this and pull in your commit so that you get correctly identified as the author.

Brunius commented 4 months ago

I've finally got my printer back together, and been able to print it!

I see what you mean about not latching as nicely - it doesn't take much effort to simply slide it past the notch (if you're not looking for it, you won't notice it).

What do you think the solution would be - enlargen it? Vertically, or horizontally? Or both?

Brunius commented 4 months ago

I've just printed another, with the wall_thickness variable changed to include -r_c1

    wall_thickness = r_base-r_c2+d_clear*2-r_c1;

This works much better, in my opinion, while still staying within the footprint of the wall.

rpedde commented 4 months ago

I've rebased this to current. I agree these actually fit a lot better, but there seem to be some artifacts on the top, and the tabs seem to be just a little too tall and too wide. If those were taken care of, I think this would be a winner. I'll mess with it a bit more, although I didn't have luck before trying to determine what the wall widths were, so no promises.

artifacts