New options to multiply input object
This commit is contained in:
parent
b79737c657
commit
81085433fd
@ -37,7 +37,7 @@ Slic3r current features are:
|
|||||||
* use relative or absolute extrusion commands;
|
* use relative or absolute extrusion commands;
|
||||||
* center print around bed center point;
|
* center print around bed center point;
|
||||||
* multiple solid layers near horizontal external surfaces;
|
* multiple solid layers near horizontal external surfaces;
|
||||||
* ability to scale and rotate input object;
|
* ability to scale, rotate and multiply input object;
|
||||||
* use different speed for bottom layer.
|
* use different speed for bottom layer.
|
||||||
|
|
||||||
Roadmap includes the following goals:
|
Roadmap includes the following goals:
|
||||||
@ -46,7 +46,6 @@ Roadmap includes the following goals:
|
|||||||
* allow the user to customize initial and final GCODE commands;
|
* allow the user to customize initial and final GCODE commands;
|
||||||
* support material for internal perimeters;
|
* support material for internal perimeters;
|
||||||
* ability to infill in the direction of bridges;
|
* ability to infill in the direction of bridges;
|
||||||
* multiply input object;
|
|
||||||
* cool;
|
* cool;
|
||||||
* nice packaging for cross-platform deployment.
|
* nice packaging for cross-platform deployment.
|
||||||
|
|
||||||
|
@ -64,5 +64,8 @@ our $skirt_distance = 6; # mm
|
|||||||
# transform options
|
# transform options
|
||||||
our $scale = 1;
|
our $scale = 1;
|
||||||
our $rotate = 0;
|
our $rotate = 0;
|
||||||
|
our $multiply_x = 1;
|
||||||
|
our $multiply_y = 1;
|
||||||
|
our $multiply_distance = 6; # mm
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
@ -47,6 +47,20 @@ sub parse_file {
|
|||||||
$extents[$_][MAX] *= $Slic3r::scale;
|
$extents[$_][MAX] *= $Slic3r::scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# multiply object
|
||||||
|
my @multiply_offset = (
|
||||||
|
(($extents[X][MAX] - $extents[X][MIN]) + $Slic3r::multiply_distance),
|
||||||
|
(($extents[Y][MAX] - $extents[Y][MIN]) + $Slic3r::multiply_distance),
|
||||||
|
);
|
||||||
|
$extents[X][MAX] += $multiply_offset[X] * ($Slic3r::multiply_x-1);
|
||||||
|
$extents[Y][MAX] += $multiply_offset[Y] * ($Slic3r::multiply_y-1);
|
||||||
|
my @copies = ();
|
||||||
|
for (my $i = 0; $i < $Slic3r::multiply_x; $i++) {
|
||||||
|
for (my $j = 0; $j < $Slic3r::multiply_y; $j++) {
|
||||||
|
push @copies, [ $multiply_offset[X] * $i, $multiply_offset[Y] * $j ];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# initialize print job
|
# initialize print job
|
||||||
my $print = Slic3r::Print->new(
|
my $print = Slic3r::Print->new(
|
||||||
x_length => ($extents[X][MAX] - $extents[X][MIN]) / $Slic3r::resolution,
|
x_length => ($extents[X][MAX] - $extents[X][MIN]) / $Slic3r::resolution,
|
||||||
@ -67,7 +81,13 @@ sub parse_file {
|
|||||||
for X,Y,Z;
|
for X,Y,Z;
|
||||||
}
|
}
|
||||||
|
|
||||||
$self->_facet($print, @$facet);
|
foreach my $copy (@copies) {
|
||||||
|
my @copy_vertices = map [ @$_ ], @vertices; # clone vertices
|
||||||
|
foreach my $vertex (@copy_vertices) {
|
||||||
|
$vertex->[$_] += $copy->[$_] / $Slic3r::resolution for X,Y;
|
||||||
|
}
|
||||||
|
$self->_facet($print, $normal, @copy_vertices);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print "\n==> PROCESSING SLICES:\n";
|
print "\n==> PROCESSING SLICES:\n";
|
||||||
|
18
slic3r.pl
18
slic3r.pl
@ -56,6 +56,9 @@ GetOptions(
|
|||||||
# transform options
|
# transform options
|
||||||
'scale=i' => \$Slic3r::scale,
|
'scale=i' => \$Slic3r::scale,
|
||||||
'rotate=i' => \$Slic3r::rotate,
|
'rotate=i' => \$Slic3r::rotate,
|
||||||
|
'multiply-x=i' => \$Slic3r::multiply_x,
|
||||||
|
'multiply-y=i' => \$Slic3r::multiply_y,
|
||||||
|
'multiply-distance=i' => \$Slic3r::multiply_distance,
|
||||||
);
|
);
|
||||||
|
|
||||||
# validate configuration
|
# validate configuration
|
||||||
@ -100,6 +103,18 @@ GetOptions(
|
|||||||
# --scale
|
# --scale
|
||||||
die "Invalid value for --scale\n"
|
die "Invalid value for --scale\n"
|
||||||
if $Slic3r::scale <= 0;
|
if $Slic3r::scale <= 0;
|
||||||
|
|
||||||
|
# --multiply-x
|
||||||
|
die "Invalid value for --multiply-x\n"
|
||||||
|
if $Slic3r::multiply_x < 1;
|
||||||
|
|
||||||
|
# --multiply-y
|
||||||
|
die "Invalid value for --multiply-y\n"
|
||||||
|
if $Slic3r::multiply_y < 1;
|
||||||
|
|
||||||
|
# --multiply-distance
|
||||||
|
die "Invalid value for --multiply-distance\n"
|
||||||
|
if $Slic3r::multiply_distance < 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $stl_parser = Slic3r::STL->new;
|
my $stl_parser = Slic3r::STL->new;
|
||||||
@ -186,6 +201,9 @@ Usage: slic3r.pl [ OPTIONS ] file.stl
|
|||||||
Transform options:
|
Transform options:
|
||||||
--scale Factor for scaling input object (default: $Slic3r::scale)
|
--scale Factor for scaling input object (default: $Slic3r::scale)
|
||||||
--rotate Rotation angle in degrees (0-360, default: $Slic3r::rotate)
|
--rotate Rotation angle in degrees (0-360, default: $Slic3r::rotate)
|
||||||
|
--multiply-x Number of items along X axis (1+, default: $Slic3r::multiply_x)
|
||||||
|
--multiply-y Number of items along Y axis (1+, default: $Slic3r::multiply_y)
|
||||||
|
--multiply-distance Distance in mm between copies (default: $Slic3r::multiply_distance)
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
exit ($exit_code || 0);
|
exit ($exit_code || 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user