New option to rotate input object

This commit is contained in:
Alessandro Ranellucci 2011-09-26 16:07:12 +02:00
parent 8d13d4b21e
commit 404c76adc8
4 changed files with 16 additions and 3 deletions

View File

@ -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 input object; * ability to scale and rotate 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,7 @@ 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;
* input object transform (rotate, multiply); * multiply input object;
* cool; * cool;
* nice packaging for cross-platform deployment. * nice packaging for cross-platform deployment.

View File

@ -63,5 +63,6 @@ our $skirt_distance = 6; # mm
# transform options # transform options
our $scale = 1; our $scale = 1;
our $rotate = 0;
1; 1;

View File

@ -18,6 +18,16 @@ sub parse_file {
# open STL file # open STL file
my $stl = CAD::Format::STL->new->load($file); my $stl = CAD::Format::STL->new->load($file);
if ($Slic3r::rotate > 0) {
my $deg = Slic3r::Geometry::deg2rad($Slic3r::rotate);
foreach my $facet ($stl->part->facets) {
my ($normal, @vertices) = @$facet;
foreach my $vertex (@vertices) {
@$vertex = (@{ +(Slic3r::Geometry::rotate_points($deg, undef, [ $vertex->[X], $vertex->[Y] ]))[0] }, $vertex->[Z]);
}
}
}
# we only want to work with positive coordinates, so let's # we only want to work with positive coordinates, so let's
# find our object extents to calculate coordinate displacements # find our object extents to calculate coordinate displacements
my @extents = (map [99999999, -99999999], X,Y,Z); my @extents = (map [99999999, -99999999], X,Y,Z);

View File

@ -55,6 +55,7 @@ GetOptions(
# transform options # transform options
'scale=i' => \$Slic3r::scale, 'scale=i' => \$Slic3r::scale,
'rotate=i' => \$Slic3r::rotate,
); );
# validate configuration # validate configuration
@ -163,7 +164,7 @@ Usage: slic3r.pl [ OPTIONS ] file.stl
--solid-layers Number of solid layers to do for top/bottom surfaces --solid-layers Number of solid layers to do for top/bottom surfaces
(range: 1+, default: $Slic3r::solid_layers) (range: 1+, default: $Slic3r::solid_layers)
--fill-density Infill density (range: 0-1, default: $Slic3r::fill_density) --fill-density Infill density (range: 0-1, default: $Slic3r::fill_density)
--fill-angle Infill angle (range: 0-90, default: $Slic3r::fill_angle) --fill-angle Infill angle in degrees (range: 0-90, default: $Slic3r::fill_angle)
--temperature Extrusion temperature (default: $Slic3r::temperature) --temperature Extrusion temperature (default: $Slic3r::temperature)
Retraction options: Retraction options:
@ -181,6 +182,7 @@ 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)
EOF EOF
exit ($exit_code || 0); exit ($exit_code || 0);