mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-24 15:13:58 -06:00
Ported the G-code generator from Perl to C++.
Removed GCode.pm Removed the Perl bindigns for AvoidCrossingPerimeters, OozePrevention, SpiralVase, Wipe Changed the std::set of extruder IDs to vector of IDs. Removed some MSVC compiler warnings, removed obnoxious compiler warnings when compiling the Perl bindings.
This commit is contained in:
parent
72ae3585e4
commit
e90279c513
52 changed files with 1362 additions and 1632 deletions
|
@ -76,34 +76,17 @@ sub export_gcode {
|
|||
|
||||
{
|
||||
# open output gcode file if we weren't supplied a file-handle
|
||||
my ($fh, $tempfile);
|
||||
if ($params{output_fh}) {
|
||||
$fh = $params{output_fh};
|
||||
} else {
|
||||
$tempfile = "$output_file.tmp";
|
||||
Slic3r::open(\$fh, ">", $tempfile)
|
||||
or die "Failed to open $tempfile for writing\n";
|
||||
|
||||
# enable UTF-8 output since user might have entered Unicode characters in fields like notes
|
||||
binmode $fh, ':utf8';
|
||||
my $tempfile = "$output_file.tmp";
|
||||
my $gcode = Slic3r::GCode->new();
|
||||
my $result = $gcode->do_export($self, $tempfile);
|
||||
die $result . "\n" if ($result ne '');
|
||||
my $i;
|
||||
for ($i = 0; $i < 5; $i += 1) {
|
||||
last if (rename Slic3r::encode_path($tempfile), Slic3r::encode_path($output_file));
|
||||
# Wait for 1/4 seconds and try to rename once again.
|
||||
select(undef, undef, undef, 0.25);
|
||||
}
|
||||
|
||||
Slic3r::Print::GCode->new(
|
||||
print => $self,
|
||||
fh => $fh,
|
||||
)->export;
|
||||
|
||||
# close our gcode file
|
||||
close $fh;
|
||||
if ($tempfile) {
|
||||
my $i;
|
||||
for ($i = 0; $i < 5; $i += 1) {
|
||||
last if (rename Slic3r::encode_path($tempfile), Slic3r::encode_path($output_file));
|
||||
# Wait for 1/4 seconds and try to rename once again.
|
||||
select(undef, undef, undef, 0.25);
|
||||
}
|
||||
Slic3r::debugf "Failed to remove the output G-code file from $tempfile to $output_file. Is $tempfile locked?\n" if ($i == 5);
|
||||
}
|
||||
Slic3r::debugf "Failed to remove the output G-code file from $tempfile to $output_file. Is $tempfile locked?\n" if ($i == 5);
|
||||
}
|
||||
|
||||
# run post-processing scripts
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue