kennetek / gridfinity-rebuilt-openscad

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

First implementation of open sides on X and Y side #104

Open basvdijk opened 1 year ago

basvdijk commented 1 year ago

First attempt to allow open sides on X and Y side

image

image

image

Added checkboxes in settings:

image

closes #103, closes #90

Ruudjhuu commented 1 year ago

I get the idea. and the feature seems to be wanted. However, it would be nice if this could be implemented in the utility file so the lite version could also have this feature.

Instead of generating all walls and then removing it, could we try to not generate all walls to begin with?

I think the implementation will somehow end up in sweep_rounded, make it able to pick which wall it should generate.

I added some comments to explain what some parts of this code is doing.

module sweep_rounded(w=10, h=10) {
    // Create half a sweep and circle it (fancy mirror)
    union() pattern_circular(2) {
        // Create two corners
        copy_mirror([1,0,0]) 
        translate([w/2,h/2,0])
        rotate_extrude(angle = 90, convexity = 4) 
        children();

        // Create wall X
        translate([w/2,0,0])
        rotate([90,0,0])
        linear_extrude(height = h, center = true)
        children();

        // Create wall Y
        rotate([0,0,90])
        translate([h/2,0,0])
        rotate([90,0,0])
        linear_extrude(height = w, center = true)
        children();
    }
}
basvdijk commented 1 year ago

It is not only the walls, but also the bottomplate. Therefore I chose to chop off the wall. For me the code is quite complex and hard to understand what goes when, where and why since it is quite abstracted. I first tried to implement this feature in the utility file, but failed to get it working.

I understand my code is a dirty solution, but at least it does the job and can already provide something to use. Could it be an idea to make a beta folder or something which contains the dirty solution, but already provides this functionality to the user?

Ruudjhuu commented 1 year ago

I gave it a 15 min try and I see there is a more involved then I thought. The cutters for the inside of the bin (walls, tabs, scoops) do also generate a piece of the wall. That wall piece overlaps with the sweep_rounded results. When disabling the cutters and change sweep_rounded a little bit I got this far which is by any means not perfect.

Regarding the beta folder. If someone wants to use this feature in this state, I think this pull request is a good place. Everyone is able to clone your repo or even the pull request branch if they want to use it. I consider the code changes in this pull request a POC instead of a alpha or beta release.

Your help is more then welcome to implement new features, if you have questions regarding the code base to understand it better. I am happy to help and try to give you answers. I do also not fully understand everything happening here.

image

code snippet for inspiration (does not classifies as good code at all). Also comment out line 32-36 of the utils file to disable the cutter logic. (not a long term solution of course)

module sweep_rounded(w=10, h=10) {
    remove_wall = true;

    union(){
        if(remove_wall) {
            sweep_corner(w,h)children();
        }
        else {
            pattern_circular(2)
            sweep_corner(w,h)children();
        }

        pattern_circular(2)
        sweep_y(w,h)
        children();

        if(remove_wall) {
            sweep_x(w,h)
            children();
        }
        else {
            pattern_circular(2)
            sweep_x(w,h)
            children();
        }
    }
}

module sweep_corner(w=10, h=10){
        copy_mirror([1,0,0]) 
        translate([w/2,h/2,0])
        rotate_extrude(angle = 90, convexity = 4) 
        children();
}

module sweep_x(w=10, h=10) {
    rotate([0,0,90])
    translate([h/2,0,0])
    rotate([90,0,0])
    linear_extrude(height = w, center = true)
    children();
}

module sweep_y(w=10, h=10) {
    translate([w/2,0,0])
    rotate([90,0,0])
    linear_extrude(height = h, center = true)
    children();
}
basvdijk commented 1 year ago

Updated PR. Code now supports to toggle all sides individually

image

schneems commented 1 year ago

Fwiw I would love a feature like this. Trimming off the sides with negative volume alone in a slicer is surprisingly tricky. The only pre-built "sideless" project I can find doesn't have much variation and doesn't include the "hole fix" https://www.printables.com/model/209998-gridfinity-sideless-bins-and-platforms.

chadlipscomb commented 3 months ago

I would really love to see a "Lite" variant of this. I'm trying to do that right now, but I'm totally new to OpenSCAD and am struggling.