mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2024-12-29 00:09:41 +00:00
Propagate information about partition() part to children()
This patch allows to customize the partitioned parts. The part is available in $idx variable and is either 0 or 1.
This commit is contained in:
parent
9717497174
commit
a2131ce23d
1 changed files with 4 additions and 0 deletions
|
@ -550,6 +550,8 @@ module partition_cut_mask(l=100, h=100, cutsize=10, cutpath="jigsaw", gap=0, anc
|
||||||
// partition(spread=12, gap=30, cutpath="dovetail") cylinder(h=50, d=80, center=false);
|
// partition(spread=12, gap=30, cutpath="dovetail") cylinder(h=50, d=80, center=false);
|
||||||
// partition(spread=20, gap=20, cutsize=15, cutpath="dovetail") cylinder(h=50, d=80, center=false);
|
// partition(spread=20, gap=20, cutsize=15, cutpath="dovetail") cylinder(h=50, d=80, center=false);
|
||||||
// partition(spread=25, gap=15, cutsize=[20,20], cutpath="dovetail") cylinder(h=50, d=80, center=false);
|
// partition(spread=25, gap=15, cutsize=[20,20], cutpath="dovetail") cylinder(h=50, d=80, center=false);
|
||||||
|
// Side Effects:
|
||||||
|
// `$idx` is set to 0 on the back part and 1 on the front part.
|
||||||
// Examples(2DMed):
|
// Examples(2DMed):
|
||||||
// partition(cutpath="sawtooth") cylinder(h=50, d=80, center=false);
|
// partition(cutpath="sawtooth") cylinder(h=50, d=80, center=false);
|
||||||
// partition(cutpath="sinewave") cylinder(h=50, d=80, center=false);
|
// partition(cutpath="sinewave") cylinder(h=50, d=80, center=false);
|
||||||
|
@ -566,12 +568,14 @@ module partition(size=100, spread=10, cutsize=10, cutpath="jigsaw", gap=0, spin=
|
||||||
rsize = v_abs(rot(spin,p=size));
|
rsize = v_abs(rot(spin,p=size));
|
||||||
vec = rot(spin,p=BACK)*spread/2;
|
vec = rot(spin,p=BACK)*spread/2;
|
||||||
move(vec) {
|
move(vec) {
|
||||||
|
$idx = 0;
|
||||||
intersection() {
|
intersection() {
|
||||||
children();
|
children();
|
||||||
partition_mask(l=rsize.x, w=rsize.y, h=rsize.z, cutsize=cutsize, cutpath=cutpath, gap=gap, spin=spin);
|
partition_mask(l=rsize.x, w=rsize.y, h=rsize.z, cutsize=cutsize, cutpath=cutpath, gap=gap, spin=spin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
move(-vec) {
|
move(-vec) {
|
||||||
|
$idx = 1;
|
||||||
intersection() {
|
intersection() {
|
||||||
children();
|
children();
|
||||||
partition_mask(l=rsize.x, w=rsize.y, h=rsize.z, cutsize=cutsize, cutpath=cutpath, gap=gap, inverse=true, spin=spin);
|
partition_mask(l=rsize.x, w=rsize.y, h=rsize.z, cutsize=cutsize, cutpath=cutpath, gap=gap, inverse=true, spin=spin);
|
||||||
|
|
Loading…
Reference in a new issue