Ability to scale input object
This commit is contained in:
parent
c2a62891da
commit
bfad101c8c
@ -35,6 +35,7 @@ Slic3r current features are:
|
||||
* use relative or absolute extrusion commands;
|
||||
* center print around bed center point;
|
||||
* multiple solid layers near horizontal external surfaces;
|
||||
* ability to scale input object;
|
||||
* use different speed for bottom layer.
|
||||
|
||||
Roadmap includes the following goals:
|
||||
@ -43,7 +44,7 @@ Roadmap includes the following goals:
|
||||
* allow the user to customize initial and final GCODE commands;
|
||||
* support material for internal perimeters;
|
||||
* ability to infill in the direction of bridges;
|
||||
* input object transform (scale, rotate, multiply);
|
||||
* input object transform (rotate, multiply);
|
||||
* cool;
|
||||
* nice packaging for cross-platform deployment.
|
||||
|
||||
|
@ -59,4 +59,7 @@ our $retract_speed = 40; # mm/sec
|
||||
our $skirts = 1;
|
||||
our $skirt_distance = 6; # mm
|
||||
|
||||
# transform options
|
||||
our $scale = 1;
|
||||
|
||||
1;
|
||||
|
@ -30,6 +30,12 @@ sub parse_file {
|
||||
}
|
||||
}
|
||||
|
||||
# scale extents
|
||||
for (X,Y,Z) {
|
||||
$extents[$_][MIN] *= $Slic3r::scale;
|
||||
$extents[$_][MAX] *= $Slic3r::scale;
|
||||
}
|
||||
|
||||
# initialize print job
|
||||
my $print = Slic3r::Print->new(
|
||||
x_length => ($extents[X][MAX] - $extents[X][MIN]) / $Slic3r::resolution,
|
||||
@ -46,7 +52,7 @@ sub parse_file {
|
||||
# transform vertex coordinates
|
||||
my ($normal, @vertices) = @$facet;
|
||||
foreach my $vertex (@vertices) {
|
||||
$vertex->[$_] = sprintf('%.0f', ($vertex->[$_] + $shift[$_]) / $Slic3r::resolution)
|
||||
$vertex->[$_] = sprintf('%.0f', ($Slic3r::scale * $vertex->[$_] + $shift[$_]) / $Slic3r::resolution)
|
||||
for X,Y,Z;
|
||||
}
|
||||
|
||||
|
10
slic3r.pl
10
slic3r.pl
@ -50,6 +50,9 @@ GetOptions(
|
||||
# skirt options
|
||||
'skirts=i' => \$Slic3r::skirts,
|
||||
'skirt-distance=i' => \$Slic3r::skirt_distance,
|
||||
|
||||
# transform options
|
||||
'scale=i' => \$Slic3r::scale,
|
||||
);
|
||||
|
||||
# validate configuration
|
||||
@ -90,6 +93,10 @@ GetOptions(
|
||||
# --fill-density
|
||||
die "Invalid value for --fill-density\n"
|
||||
if $Slic3r::fill_density < 0 || $Slic3r::fill_density > 1;
|
||||
|
||||
# --scale
|
||||
die "Invalid value for --scale\n"
|
||||
if $Slic3r::scale <= 0;
|
||||
}
|
||||
|
||||
my $stl_parser = Slic3r::STL->new;
|
||||
@ -167,6 +174,9 @@ Usage: slic3r.pl [ OPTIONS ] file.stl
|
||||
(default: $Slic3r::skirt_distance)
|
||||
-o, --output File to output gcode to (default: <inputfile>.gcode)
|
||||
|
||||
Transform options:
|
||||
--scale Factor for scaling input object (default: $Slic3r::scale)
|
||||
|
||||
EOF
|
||||
exit $exit_code || 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user