Skip to content

Commit 2b0787c

Browse files
authored
Implement advanced filler settings (#33)
* refactor to prepare for fractional cells * Implement advanced filler settings
1 parent 0c03cfb commit 2b0787c

14 files changed

Lines changed: 340 additions & 212 deletions

README.md

Lines changed: 44 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ For inserting magnets, check out [the jig](#jig).
4242
- [Latch Wall Strength](#latch-wall-strength)
4343
- [Height](#height)
4444
- [Steepness](#steepness)
45-
- [Half-sized cells](#half-sized-cells)
45+
- [Filler](#filler)
46+
- [None](#none)
47+
- [Integer Fraction](#integer-fraction)
48+
- [Dynamic](#dynamic)
4649
- [Corner radius](#corner-radius)
4750
- [Alignment](#alignment)
4851
- [Custom cell size](#custom-cell-size)
@@ -310,17 +313,50 @@ Steepness 5:
310313
<!-- openscad -o docs/images/click1-steepness-5.png --camera=0,0,0,40,0,10,100 -D plate_size='[42, 42]' -D click1=true -D click1_steepness=5 -->
311314
<img src="docs/images/click1-steepness-5.png" alt="Click latch with click1_steepness=5" />
312315

313-
## Half-sized cells
316+
## Filler
314317

315-
By default, if there isn't enough room for a full cell on the plate, GridFlock will attempt to fill up remaining space with half-sized cells.
318+
If the baseplate is not a multiple of 42mm, there's some room that can't be used for a full-sized cell. There are different options for what to do with this space.
316319

317-
<!-- openscad -o docs/images/half.png --camera=0,0,0,40,0,10,400 -D plate_size='[147, 147]' -D magnets=false -->
318-
<img src="docs/images/half.png" alt="Half cell" />
320+
The filler algorithm can be configured with the `filler_x` and `filler_y` properties.
319321

320-
You can turn off this behavior with the `do_half_x` and `do_half_y` options.
322+
### None
321323

322-
<!-- openscad -o docs/images/halfx.png --camera=0,0,0,40,0,10,400 -D plate_size='[147, 147]' -D magnets=false -D do_half_y=false -->
323-
<img src="docs/images/halfx.png" alt="Half cell, x only" />
324+
In `None` mode, the remaining space is simply filled with padding.
325+
326+
<!-- openscad -o docs/images/filler-none.png --camera=0,0,0,40,0,10,150 -D plate_size='[71, 42]' -D filler_x=0 -->
327+
<img src="docs/images/filler-none.png" alt="No filler" />
328+
329+
### Integer Fraction
330+
331+
In `Integer Fraction` mode, the remaining space is filled with reduced-size cells that are an integer fraction of the standard cell size. This is the default, configured to use half-size cells.
332+
333+
<!-- openscad -o docs/images/filler-half.png --camera=0,0,0,40,0,10,150 -D plate_size='[71, 42]' -D filler_x=1 -->
334+
<img src="docs/images/filler-half.png" alt="Half-cell filler" />
335+
336+
> [!NOTE]
337+
> The old `do_half_x` and `do_half_y` options have been removed.
338+
339+
You can change the fraction using the `filler_fraction` option, for example the value "3" for one-third size cells:
340+
341+
<!-- openscad -o docs/images/filler-third.png --camera=0,0,0,40,0,10,150 -D plate_size='[71, 42]' -D filler_x=1 -D filler_fraction=[3,3] -->
342+
<img src="docs/images/filler-third.png" alt="Third-cell filler" />
343+
344+
### Dynamic
345+
346+
In `Dynamic` mode, the remaining space is used up completely by a flexibly size cell.
347+
348+
<!-- openscad -o docs/images/filler-dynamic.png --camera=0,0,0,40,0,10,150 -D plate_size='[71, 42]' -D filler_x=2 -->
349+
<img src="docs/images/filler-dynamic.png" alt="Dynamic filler" />
350+
351+
Note that there is a minimum size of the dynamic filler cell, configured by `filler_minimum_size`. This ensures that the filler does not become so small that the geometry breaks. If the cell is too small, it will be added to the last cell instead, creating a cell that is slightly bigger than 42mm:
352+
353+
<!-- openscad -o docs/images/filler-dynamic-expand.png --camera=0,0,0,40,0,10,150 -D plate_size='[88, 42]' -D filler_x=2 -->
354+
<img src="docs/images/filler-dynamic-expand.png" alt="Dynamic filler expanded" />
355+
356+
If you wish to only create larger cells, not smaller cells, you can set the minimum size to 42:
357+
358+
<!-- openscad -o docs/images/filler-dynamic-expand-always.png --camera=0,0,0,40,0,10,150 -D plate_size='[120, 42]' -D filler_x=2 -D filler_minimum_size=[42,42] -->
359+
<img src="docs/images/filler-dynamic-expand-always.png" alt="Dynamic filler always expanded" />
324360

325361
## Corner radius
326362

39.3 KB
Loading
35.2 KB
Loading

docs/images/filler-dynamic.png

33.2 KB
Loading

docs/images/filler-half.png

34.8 KB
Loading

docs/images/filler-none.png

27.9 KB
Loading

docs/images/filler-third.png

40.6 KB
Loading

docs/images/half.png

-62.8 KB
Binary file not shown.

docs/images/halfx.png

-54.7 KB
Binary file not shown.

editor.toml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ head-extra = '<script defer src="https://um.yawk.at/script.js" data-website-id="
77

88
[[model]]
99
file = "gridflock.scad"
10-
description-extra-html = "<br>For detailed documentation, check the <a href='https://github.com/yawkat/GridFlock/blob/main/README.md'>README</a>.<br><b>Feb 16: I've turned off magnets by default because most people don't use them.</b> If you've saved a design with magnets, you will have to manually turn them on again below."
10+
description-extra-html = "<br>For detailed documentation, check the <a href='https://github.com/yawkat/GridFlock/blob/main/README.md'>README</a>.<br><b>Feb 16: I've turned off magnets by default because most people don't use them.</b> If you've saved a design with magnets, you will have to manually turn them on again below.<br>Feb 21: The do_half parameters have been superseded by the filler parameters."
1111
umami-track-render = []
1212
umami-track-export = ["magnets", "magnet_style", "connector_intersection_puzzle", "connector_edge_puzzle", "bed_size", "click1"]
1313

@@ -36,10 +36,6 @@ text = "Printer Presets"
3636
"Elegoo Neptune 4 Max" = [420, 420]
3737
"Elegoo Centauri Carbon" = [256, 256]
3838

39-
[model.param-metadata.do_half_x]
40-
help-link = "https://github.com/yawkat/GridFlock/blob/main/README.md#half-sized-cells"
41-
[model.param-metadata.do_half_y]
42-
help-link = "https://github.com/yawkat/GridFlock/blob/main/README.md#half-sized-cells"
4339
[model.param-metadata.solid_base]
4440
help-link = "https://github.com/yawkat/GridFlock/blob/main/README.md#solid-base"
4541
[model.param-metadata.bottom_chamfer]
@@ -89,6 +85,16 @@ help-link = "https://github.com/yawkat/GridFlock/blob/main/README.md#connector-h
8985
display-condition = {js = "connector_edge_puzzle"}
9086
[model.param-metadata.edge_puzzle_height_male_delta]
9187
display-condition = {js = "connector_edge_puzzle"}
88+
[model.param-metadata.filler_x]
89+
help-link = "https://github.com/yawkat/GridFlock/blob/main/README.md#filler"
90+
[model.param-metadata.filler_y]
91+
help-link = "https://github.com/yawkat/GridFlock/blob/main/README.md#filler"
92+
[model.param-metadata.filler_fraction]
93+
help-link = "https://github.com/yawkat/GridFlock/blob/main/README.md#integer-fraction"
94+
display-condition = {js = "filler_x == 1 || filler_y == 1"}
95+
[model.param-metadata.filler_minimum_size]
96+
help-link = "https://github.com/yawkat/GridFlock/blob/main/README.md#dynamic"
97+
display-condition = {js = "filler_x == 2 || filler_y == 2"}
9298
[model.param-metadata.numbering]
9399
help-link = "https://github.com/yawkat/GridFlock/blob/main/README.md#numbering"
94100
[model.param-metadata.number_depth]

0 commit comments

Comments
 (0)