mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 01:07:57 -06:00
Allow to use config options in start/end G-code
This commit is contained in:
parent
f2032686da
commit
d0807aa807
3 changed files with 27 additions and 14 deletions
|
@ -619,4 +619,23 @@ sub validate {
|
|||
$Slic3r::solid_infill_speed ||= $Slic3r::infill_speed;
|
||||
}
|
||||
|
||||
sub replace_options {
|
||||
my $class = shift;
|
||||
my ($string, $more_variables) = @_;
|
||||
|
||||
if ($more_variables) {
|
||||
my $variables = join '|', keys %$more_variables;
|
||||
$string =~ s/\[($variables)\]/$more_variables->{$1}/eg;
|
||||
}
|
||||
|
||||
# build a regexp to match the available options
|
||||
my $options = join '|',
|
||||
grep !$Slic3r::Config::Options->{$_}{multiline},
|
||||
keys %$Slic3r::Config::Options;
|
||||
|
||||
# use that regexp to search and replace option names with option values
|
||||
$string =~ s/\[($options)\]/Slic3r::Config->serialize($1)/eg;
|
||||
return $string;
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue