53 lines
1.3 KiB
OpenSCAD
53 lines
1.3 KiB
OpenSCAD
|
|
linear_extrude(1)
|
|
pattern(1000, 1, 4){
|
|
// square(size=[50, 50], center=true);
|
|
scale_uniform(3){
|
|
import("/home/bart/Downloads/laura_bag_1.svg");
|
|
}
|
|
}
|
|
|
|
module pattern(mesh_size, line_width, spacing){
|
|
union(){
|
|
intersection(){
|
|
mesh(mesh_size, line_width, spacing);
|
|
children(0);
|
|
}
|
|
// calculate border
|
|
difference(){
|
|
children(0);
|
|
offset(r=-line_width){
|
|
children(0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
module mesh(size, line_width, spacing){
|
|
// Note that mesh always has to be even.
|
|
// This translates into the first lines being perfectly centered.
|
|
|
|
// Start by calculating amount of spacings
|
|
n_size = (size-line_width)/(line_width+spacing);
|
|
|
|
step = line_width + spacing;
|
|
for(i=[0:n_size/2]){
|
|
// vertical lines
|
|
translate([i*step, 0, 0])
|
|
square(size=[line_width, size], center=true);
|
|
translate([-i*step, 0, 0])
|
|
square(size=[line_width, size], center=true);
|
|
|
|
// horizontal lines
|
|
translate([0, i*step, 0])
|
|
square(size=[size, line_width], center=true);
|
|
translate([0, -i*step, 0])
|
|
square(size=[size, line_width], center=true);
|
|
}
|
|
}
|
|
|
|
module scale_uniform(my_scale){
|
|
scale([my_scale, my_scale]){
|
|
children(0);
|
|
}
|
|
} |