kennetek / gridfinity-rebuilt-openscad

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

Add `style_lip` as argument to `gridfinityInit` #155

Closed smkent closed 5 months ago

smkent commented 5 months ago

When used as a library, gridfinity-rebuilt-utility.scad accepts all the bin properties to use as arguments to gridfinityInit, cut, or other methods, with the sole exception of style_lip which must be defined in the calling file.

This change adds style_lip as an argument to gridfinityInit to ensure gridfinity-rebuilt-utility.scad can be used as a library.

smkent commented 5 months ago

This issue can be reproduced with a .scad file like this:

include <standard.scad>;
use <gridfinity-rebuilt-baseplate.scad>;
use <gridfinity-rebuilt-utility.scad>;

module __end_customizer_options__() { }

module bin() {
    gridx = 2;
    gridy = 2;
    gridz = 3;
    gridz_define = 0;
    style_lip = 0;
    enable_zsnap = 0;
    height_internal = 0;
    divx = 1;
    divy = 1;
    style_tab = 0;
    scoop = 1.0;
    div_base_x = 0;
    div_base_y = 0;
    style_hole = 0;
    only_corners = false;

    color("lemonchiffon") {
        gridfinityInit(gridx, gridy, height(gridz, gridz_define, 0, enable_zsnap), height_internal) {
            if (divx > 0 && divy > 0) {
                cutEqual(n_divx = divx, n_divy = divy, style_tab = style_tab, scoop_weight = scoop);
            }
        }
        gridfinityBase(gridx, gridy, l_grid, div_base_x, div_base_y, style_hole, only_corners=only_corners);
    }
}

bin();

which results in:

WARNING: Ignoring unknown variable 'style_lip' in file gridfinity-rebuilt-utility.scad, line 310
TRACE: assignment to 'ycutfirst' in file gridfinity-rebuilt-utility.scad, line 310
TRACE: called by 'block_cutter' in file gridfinity-rebuilt-utility.scad, line 92
TRACE: called by 'children' in file gridfinity-rebuilt-utility.scad, line 100
TRACE: called by 'children' in file gridfinity-rebuilt-utility.scad, line 298
TRACE: called by 'translate' in file gridfinity-rebuilt-utility.scad, line 297
TRACE: called by 'translate' in file gridfinity-rebuilt-utility.scad, line 296
TRACE: called by 'translate' in file gridfinity-rebuilt-utility.scad, line 295
TRACE: call of 'cut_move_unsafe(x = 0, y = 0, w = 2, h = 2)' in file gridfinity-rebuilt-utility.scad, line 292
TRACE: called by 'cut_move_unsafe' in file gridfinity-rebuilt-utility.scad, line 99
TRACE: called by 'translate' in file gridfinity-rebuilt-utility.scad, line 98
TRACE: call of 'cut_move(x = 0, y = 0, w = 2, h = 2)' in file gridfinity-rebuilt-utility.scad, line 97
TRACE: called by 'cut_move' in file gridfinity-rebuilt-utility.scad, line 91
Execution aborted

(I have OpenSCAD configured to stop rendering after the first warning)