mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-19 12:47:50 -06:00
More customizable options for DLP projector
This commit is contained in:
parent
be0ba4d5a2
commit
5ba2f72324
1 changed files with 190 additions and 105 deletions
|
@ -15,8 +15,11 @@ sub new {
|
||||||
show_bed => 1,
|
show_bed => 1,
|
||||||
zoom => 100,
|
zoom => 100,
|
||||||
exposure_time => 4,
|
exposure_time => 4,
|
||||||
|
bottom_exposure_time => 10,
|
||||||
settle_time => 4,
|
settle_time => 4,
|
||||||
|
bottom_layers => 3,
|
||||||
z_lift => 15,
|
z_lift => 15,
|
||||||
|
z_lift_speed => 50,
|
||||||
offset => [0,0],
|
offset => [0,0],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -33,10 +36,13 @@ sub new {
|
||||||
|
|
||||||
my $sizer = Wx::BoxSizer->new(wxVERTICAL);
|
my $sizer = Wx::BoxSizer->new(wxVERTICAL);
|
||||||
|
|
||||||
{
|
$self->config(Slic3r::Config->new_from_defaults(
|
||||||
$self->config(Slic3r::Config->new_from_defaults(qw(serial_port serial_speed bed_shape)));
|
qw(serial_port serial_speed bed_shape start_gcode end_gcode)
|
||||||
|
));
|
||||||
$self->config->apply(wxTheApp->{mainframe}->config);
|
$self->config->apply(wxTheApp->{mainframe}->config);
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
my $optgroup = Slic3r::GUI::ConfigOptionsGroup->new(
|
my $optgroup = Slic3r::GUI::ConfigOptionsGroup->new(
|
||||||
parent => $self,
|
parent => $self,
|
||||||
title => 'USB/Serial connection',
|
title => 'USB/Serial connection',
|
||||||
|
@ -45,6 +51,7 @@ sub new {
|
||||||
);
|
);
|
||||||
$sizer->Add($optgroup->sizer, 0, wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, 10);
|
$sizer->Add($optgroup->sizer, 0, wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, 10);
|
||||||
|
|
||||||
|
{
|
||||||
my $line = Slic3r::GUI::OptionsGroup::Line->new(
|
my $line = Slic3r::GUI::OptionsGroup::Line->new(
|
||||||
label => 'Serial port',
|
label => 'Serial port',
|
||||||
);
|
);
|
||||||
|
@ -91,6 +98,30 @@ sub new {
|
||||||
$line->append_widget($serial_test);
|
$line->append_widget($serial_test);
|
||||||
$optgroup->append_line($line);
|
$optgroup->append_line($line);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
my $optgroup = Slic3r::GUI::ConfigOptionsGroup->new(
|
||||||
|
parent => $self,
|
||||||
|
title => 'G-code',
|
||||||
|
config => $self->config,
|
||||||
|
label_width => 200,
|
||||||
|
);
|
||||||
|
$sizer->Add($optgroup->sizer, 0, wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, 10);
|
||||||
|
|
||||||
|
{
|
||||||
|
my $option = $optgroup->get_option('start_gcode');
|
||||||
|
$option->height(50);
|
||||||
|
$option->full_width(1);
|
||||||
|
$optgroup->append_single_option_line($option);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
my $option = $optgroup->get_option('end_gcode');
|
||||||
|
$option->height(50);
|
||||||
|
$option->full_width(1);
|
||||||
|
$optgroup->append_single_option_line($option);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
my $on_change = sub {
|
my $on_change = sub {
|
||||||
my ($opt_id, $value) = @_;
|
my ($opt_id, $value) = @_;
|
||||||
|
@ -120,8 +151,13 @@ sub new {
|
||||||
);
|
);
|
||||||
$sizer->Add($optgroup->sizer, 0, wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, 10);
|
$sizer->Add($optgroup->sizer, 0, wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, 10);
|
||||||
|
|
||||||
|
{
|
||||||
|
my $line = Slic3r::GUI::OptionsGroup::Line->new(
|
||||||
|
label => 'Display',
|
||||||
|
);
|
||||||
|
|
||||||
my @displays = 0 .. (Wx::Display::GetCount()-1);
|
my @displays = 0 .. (Wx::Display::GetCount()-1);
|
||||||
$optgroup->append_single_option_line(Slic3r::GUI::OptionsGroup::Option->new(
|
$line->append_option(Slic3r::GUI::OptionsGroup::Option->new(
|
||||||
opt_id => 'display',
|
opt_id => 'display',
|
||||||
type => 'select',
|
type => 'select',
|
||||||
label => 'Display',
|
label => 'Display',
|
||||||
|
@ -130,6 +166,25 @@ sub new {
|
||||||
values => [@displays],
|
values => [@displays],
|
||||||
default => $self->config2->{display},
|
default => $self->config2->{display},
|
||||||
));
|
));
|
||||||
|
$line->append_option(Slic3r::GUI::OptionsGroup::Option->new(
|
||||||
|
opt_id => 'zoom',
|
||||||
|
type => 'percent',
|
||||||
|
label => 'Zoom %',
|
||||||
|
tooltip => '',
|
||||||
|
default => $self->config2->{zoom},
|
||||||
|
min => 0.1,
|
||||||
|
max => 100,
|
||||||
|
));
|
||||||
|
$line->append_option(Slic3r::GUI::OptionsGroup::Option->new(
|
||||||
|
opt_id => 'offset',
|
||||||
|
type => 'point',
|
||||||
|
label => 'Offset',
|
||||||
|
tooltip => '',
|
||||||
|
default => $self->config2->{offset},
|
||||||
|
));
|
||||||
|
$optgroup->append_line($line);
|
||||||
|
}
|
||||||
|
|
||||||
$optgroup->append_single_option_line(Slic3r::GUI::OptionsGroup::Option->new(
|
$optgroup->append_single_option_line(Slic3r::GUI::OptionsGroup::Option->new(
|
||||||
opt_id => 'show_bed',
|
opt_id => 'show_bed',
|
||||||
type => 'bool',
|
type => 'bool',
|
||||||
|
@ -137,23 +192,6 @@ sub new {
|
||||||
tooltip => '',
|
tooltip => '',
|
||||||
default => $self->config2->{show_bed},
|
default => $self->config2->{show_bed},
|
||||||
));
|
));
|
||||||
$optgroup->append_single_option_line(Slic3r::GUI::OptionsGroup::Option->new(
|
|
||||||
opt_id => 'zoom',
|
|
||||||
type => 'percent',
|
|
||||||
label => 'Zoom',
|
|
||||||
sidetext => '%',
|
|
||||||
tooltip => '',
|
|
||||||
default => $self->config2->{zoom},
|
|
||||||
min => 0.1,
|
|
||||||
max => 100,
|
|
||||||
));
|
|
||||||
$optgroup->append_single_option_line(Slic3r::GUI::OptionsGroup::Option->new(
|
|
||||||
opt_id => 'offset',
|
|
||||||
type => 'point',
|
|
||||||
label => 'Offset',
|
|
||||||
tooltip => '',
|
|
||||||
default => $self->config2->{offset},
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -165,30 +203,64 @@ sub new {
|
||||||
);
|
);
|
||||||
$sizer->Add($optgroup->sizer, 0, wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, 10);
|
$sizer->Add($optgroup->sizer, 0, wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, 10);
|
||||||
|
|
||||||
$optgroup->append_single_option_line(Slic3r::GUI::OptionsGroup::Option->new(
|
{
|
||||||
|
my $line = Slic3r::GUI::OptionsGroup::Line->new(
|
||||||
|
label => 'Time (seconds)',
|
||||||
|
);
|
||||||
|
$line->append_option(Slic3r::GUI::OptionsGroup::Option->new(
|
||||||
|
opt_id => 'bottom_exposure_time',
|
||||||
|
type => 'i',
|
||||||
|
label => 'Bottom exposure',
|
||||||
|
tooltip => '',
|
||||||
|
default => $self->config2->{bottom_exposure_time},
|
||||||
|
));
|
||||||
|
$line->append_option(Slic3r::GUI::OptionsGroup::Option->new(
|
||||||
opt_id => 'exposure_time',
|
opt_id => 'exposure_time',
|
||||||
type => 'i',
|
type => 'i',
|
||||||
label => 'Exposure time',
|
label => 'Exposure',
|
||||||
sidetext => 'seconds',
|
|
||||||
tooltip => '',
|
tooltip => '',
|
||||||
default => $self->config2->{exposure_time},
|
default => $self->config2->{exposure_time},
|
||||||
));
|
));
|
||||||
$optgroup->append_single_option_line(Slic3r::GUI::OptionsGroup::Option->new(
|
$line->append_option(Slic3r::GUI::OptionsGroup::Option->new(
|
||||||
opt_id => 'settle_time',
|
opt_id => 'settle_time',
|
||||||
type => 'i',
|
type => 'i',
|
||||||
label => 'Settle time',
|
label => 'Settle',
|
||||||
sidetext => 'seconds',
|
|
||||||
tooltip => '',
|
tooltip => '',
|
||||||
default => $self->config2->{settle_time},
|
default => $self->config2->{settle_time},
|
||||||
));
|
));
|
||||||
|
$optgroup->append_line($line);
|
||||||
|
}
|
||||||
|
|
||||||
$optgroup->append_single_option_line(Slic3r::GUI::OptionsGroup::Option->new(
|
$optgroup->append_single_option_line(Slic3r::GUI::OptionsGroup::Option->new(
|
||||||
|
opt_id => 'bottom_layers',
|
||||||
|
type => 'i',
|
||||||
|
label => 'Bottom layers',
|
||||||
|
tooltip => '',
|
||||||
|
default => $self->config2->{bottom_layers},
|
||||||
|
));
|
||||||
|
|
||||||
|
{
|
||||||
|
my $line = Slic3r::GUI::OptionsGroup::Line->new(
|
||||||
|
label => 'Z Lift',
|
||||||
|
);
|
||||||
|
$line->append_option(Slic3r::GUI::OptionsGroup::Option->new(
|
||||||
opt_id => 'z_lift',
|
opt_id => 'z_lift',
|
||||||
type => 'f',
|
type => 'f',
|
||||||
label => 'Z Lift',
|
label => 'Distance',
|
||||||
sidetext => 'mm',
|
sidetext => 'mm',
|
||||||
tooltip => '',
|
tooltip => '',
|
||||||
default => $self->config2->{z_lift},
|
default => $self->config2->{z_lift},
|
||||||
));
|
));
|
||||||
|
$line->append_option(Slic3r::GUI::OptionsGroup::Option->new(
|
||||||
|
opt_id => 'z_lift_speed',
|
||||||
|
type => 'f',
|
||||||
|
label => 'Speed',
|
||||||
|
sidetext => 'mm/s',
|
||||||
|
tooltip => '',
|
||||||
|
default => $self->config2->{z_lift_speed},
|
||||||
|
));
|
||||||
|
$optgroup->append_line($line);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -410,14 +482,15 @@ sub start_print {
|
||||||
$self->config->serial_speed,
|
$self->config->serial_speed,
|
||||||
);
|
);
|
||||||
if (!$res || !$self->sender->wait_connected) {
|
if (!$res || !$self->sender->wait_connected) {
|
||||||
Slic3r::GUI::show_error($self, "Connection failed. Check serial port and speed.");
|
Slic3r::GUI::show_error(undef, "Connection failed. Check serial port and speed.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Slic3r::debugf "connected to " . $self->config->serial_port . "\n";
|
Slic3r::debugf "connected to " . $self->config->serial_port . "\n";
|
||||||
|
|
||||||
# TODO: replace this with customizable start G-code
|
# send custom start G-code
|
||||||
$self->sender->send("G28 Z", 1);
|
$self->sender->send($_, 1) for grep !/^;/, split /\n/, $self->config->start_gcode;
|
||||||
$self->sender->send(sprintf("G1 Z%.5f F5000", $self->config2->{z_lift}), 1);
|
$self->sender->send(sprintf("G1 Z%.5f F%d",
|
||||||
|
$self->config2->{z_lift}, $self->config2->{z_lift_speed}*60), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
# TODO: block until the G1 command has been performed
|
# TODO: block until the G1 command has been performed
|
||||||
|
@ -439,6 +512,9 @@ sub stop_print {
|
||||||
$self->timer->Stop;
|
$self->timer->Stop;
|
||||||
$self->_timer_cb(undef);
|
$self->_timer_cb(undef);
|
||||||
$self->screen->project_layers(undef);
|
$self->screen->project_layers(undef);
|
||||||
|
|
||||||
|
# send custom end G-code
|
||||||
|
$self->sender->send($_, 1) for grep !/^;/, split /\n/, $self->config->end_gcode;
|
||||||
$self->sender->disconnect if $self->sender;
|
$self->sender->disconnect if $self->sender;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -456,17 +532,26 @@ sub project_next_layer {
|
||||||
|
|
||||||
if ($self->sender) {
|
if ($self->sender) {
|
||||||
my $z = $self->current_layer_height;
|
my $z = $self->current_layer_height;
|
||||||
$self->sender->send(sprintf("G1 Z%.5f F5000", $z + $self->config2->{z_lift}), 1);
|
my $F = $self->config2->{z_lift_speed} * 60;
|
||||||
$self->sender->send(sprintf("G1 Z%.5f F5000", $z), 1);
|
if ($self->config2->{z_lift} != 0) {
|
||||||
|
$self->sender->send(sprintf("G1 Z%.5f F%d", $z + $self->config2->{z_lift}, $F), 1);
|
||||||
|
}
|
||||||
|
$self->sender->send(sprintf("G1 Z%.5f F%d", $z, $F), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
# TODO: we should block until G1 commands have been performed, see note below
|
# TODO: we should block until G1 commands have been performed, see note below
|
||||||
# TODO: subtract this waiting time from the settle_time
|
# TODO: subtract this waiting time from the settle_time
|
||||||
$self->delay(2, sub {
|
$self->delay(2, sub {
|
||||||
my @layers = @{ $self->_layers->{ $self->_heights->[$self->_layer_num] } };
|
my @layers = @{ $self->_layers->{ $self->_heights->[$self->_layer_num] } };
|
||||||
printf "id = %d, height = %s\n", $self->_layer_num, $self->_heights->[$self->_layer_num];
|
|
||||||
$self->screen->project_layers([ @layers ]);
|
$self->screen->project_layers([ @layers ]);
|
||||||
$self->delay($self->config2->{exposure_time}, sub {
|
|
||||||
|
# get exposure time
|
||||||
|
my $time = $self->config2->{exposure_time};
|
||||||
|
if ($self->_layer_num < $self->config2->{bottom_layers}) {
|
||||||
|
$time = $self->config2->{bottom_exposure_time};
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->delay($time, sub {
|
||||||
$self->settle;
|
$self->settle;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue