Commit Graph

53 Commits

Author SHA1 Message Date
Vojtech Bubnik
f92312b597 Fixed parsing of Config from AMF / 3MF if it started with an empty line.
This bug was introduced with e947a29fc8
2021-08-30 17:57:04 +02:00
Vojtech Bubnik
1d6ade1d9c Optimization of ConfigBase::equals() to not create intermediate
list of modified options.

Optimization of DynamicConfig::equals(), ::diff(), ::equal()
to iterate over the two compared std::map trees instead of
first generating a list of keys and then searching for each key
in the respective map.

Optimization of PresetCollection::current_is_dirty() and ::saved_is_dirty()
to call DynamicConfig::equals() instead of ::diff().
2021-08-23 10:47:47 +02:00
Vojtech Bubnik
d569789285 Fixes after merging 2.3.2/2.3.3 changes from stable to master. 2021-08-13 14:53:13 +02:00
bubnikv
26822347ed Forward compatibility, parameter susbtitution: Substitute vector values
(extruder specific) with their default, if the default
is a single value vector.
Show the "Physical Printers" label in the substitution window.
2021-08-13 13:48:28 +02:00
bubnikv
3a0b71deed Configuration compatibility - implemented substitution and reporting for vectors
of bools (including the nullable bools).
2021-08-13 13:48:12 +02:00
bubnikv
5b843aa291 Fix of the previous commit. 2021-08-13 13:47:07 +02:00
bubnikv
c7691ec95e Forward compatibility - config substitutions:
1) Verify whether a value looks like an enum
2) Always report substitution of an enum with a boolean.
2021-08-13 13:43:33 +02:00
Vojtech Bubnik
965c2f2c55 Improved error reporting when importing various configuration files:
1) Slic3r::RuntimeError was replaced with ConfigurationError,
   all exceptions thrown by the configuration layer are derived
   from ConfigurationError.
2) When parsing configuration files, ConfigurationError is catched and
   rethrown extended with the file name being parsed.
2021-08-13 13:37:24 +02:00
Vojtech Bubnik
856da036eb Fixed loading of system presets with incompatible system profile keys
before the "reconfigure" dialog is shown.

Replaced boost::filesystem::copy_file() with Slic3r::copy_file()
in config snapshot loading code.
2021-08-13 13:34:40 +02:00
Vojtech Bubnik
8e28ca6f4a Fixed reading of configuration from 3MF broken
with e947a29fc8
2021-08-13 10:52:54 +02:00
Vojtech Bubnik
e947a29fc8 Follow-up to 7c01ddf996
1) Starting with this commit, configuration block exported into G-code
   is delimited by "; prusaslicer_config = begin" and "; prusaslicer_config = end".
   These delimiters look like any other key / value configuration pairs
   on purpose to be compatible with older PrusaSlicer config parsing from G-code.
2) Config parser from G-code newly searches for "; generated by ..."
   comment over the complete G-code, thus it is compatible with various
   post processing scripts extending the G-code at the start.
3) Config parser from G-code parses PrusaSlicer version from
   the "; generated by PrusaSlicer ...." header and if the G-code was
   generated by PrusaSlicer 2.4.0-alpha0 and newer, it expects that
   the G-code already contains the "; prusaslicer_config = begin / end"
   tags and it relies on these tags to extract configuration.
4) A new simple and robust parser was written for reading project configuration
   from 3MF / AMF, while a heuristic parser to read config from G-code located
   at the end of the G-code file was used before.
2021-08-12 15:27:46 +02:00
Vojtech Bubnik
7a60e8cb3a Follow-up to 215ee293ae:
More robust CLI parser.
2021-08-11 09:49:23 +02:00
Lukas Matena
215ee293ae CLI parsing: allow giving explicit values for bool options, improved error reporting:
It is now possible to use e.g. --ensure-on-bed=0 for bools (meaning the same as --no-ensure-on-bed).
Using --no- prefix on non-boolean is an error (--no-ensure-on-bed=1)
Providing a value for --no- prefixed bool is an error (--no-loglevel 5)
2021-08-05 13:45:16 +02:00
Vojtech Bubnik
0f3cabb5d9 Support for forward compatibility of configurations, user and system
config bundles, project files (3MFs, AMFs). When loading these files,
the caller may decide whether to substitute some of the configuration
values the current PrusaSlicer version does not understand with
some reasonable default value, and whether to report it. If substitution
is disabled, an exception is being thrown as before this commit.
If substitution is enabled, list of substitutions is returned by the
API to be presented to the user. This allows us to introduce for example
new firmware flavor key in PrusaSlicer 2.4 while letting PrusaSlicer
2.3.2 to fall back to some default and to report it to the user.

When slicing from command line, substutions are performed by default
and reported into the console, however substitutions may be either
disabled or made silent with the new "config-compatibility" command
line option.

Substitute enums and bools only.  Allow booleans to be parsed as
    true: "1", "enabled", "on" case insensitive
    false: "0", "disabled", "off" case insensitive
This will allow us in the future for example to switch the draft_shield
boolean to an enum with the following values: "disabled" / "enabled" / "limited".

Added "enum_bitmask.hpp" - support for type safe sets of options.
See for example PresetBundle::load_configbundle(...
LoadConfigBundleAttributes flags) for an example of intended usage.

WIP: GUI for reporting the list of config substitutions needs to be
implemented by @YuSanka.
2021-06-27 16:57:05 +02:00
Lukas Matena
c5c6f51ae0 Fixed third batch of locale-dependent calls 2021-05-24 12:20:29 +02:00
Vojtech Bubnik
d9ed9149ae 1) Moved first_layer_heigth frrom PrintObjectConfig to PrintConfig.
Thus the first_layer_height is no more object specific. That makes
   a lot of sense due to the brim calculation being performed over
   all layers at once and due to future merging of supports of
   different objects at first layer.
2) Because now first_layer_height is print specific, the relative
   first layer height derived from the object layer height was partially
   disabled: First the relative first layer height is converted to
   an absolute value when importing config, second the side text
   was changed from "mm or %" to "mm". Still the UI allows entering %.

Both changes may be controversial, let's wait for user feedback.
2021-04-21 12:09:43 +02:00
enricoturri1966
e44c1006d5 #6117 - Allow import of gcode files processed by ArcWelder 2021-02-24 09:46:42 +01:00
Vojtech Bubnik
fb29325b14 Fix of G-code Viewer not loading .gco files #5536
".gcode", ".gco", ".g" and ".ngc" were considered to be G-code file
extensions by the G-code import / export file dialogs, but not by
various other functions. Now the G-code extension is tested by
a single function is_gcode_file(string).
2021-01-05 12:26:11 +01:00
Vojtech Bubnik
7b9f2093bb Configuration layer: Support for vectors of FloatsOrPercents and
FloatsOrPercentsNullable, to support further filament overrides
of Print preset values, namely Avoid Crossing Perimeters.
2020-12-14 15:58:47 +01:00
David Kocik
0a4ce079e8 escape_ampersand function and changed order of printer names and pictures in config wizard 2020-11-11 16:08:27 +01:00
Vojtech Bubnik
067cde85f1 WIP Refactoring of exceptions:
1) All slicer's exceptions are now derived from Slic3r::Exception.
2) New exceptions are defined for slicing errors.
3) Exceptions are propagated to the Plater to show.
It remains to modify the slicing back-end to throw the new SlicingError
exceptions instead of std::runtime_error and to show the other exceptions
by a message dialog instead of a notification.
2020-09-14 18:03:22 +02:00
bubnikv
b843a094f6 Slic3r::format(), Slic3r::GUI::format_wxstr():
wrappers around boost::format using C++17 variadic templates,
replacing the ugly and verbose
	(boost::format("template") % arg1 % arg2).str()
syntax.
The wrappers also implictely convert input parameters including the template
from wxString to UTF8.

The new format wrapper has been applied at multiple places as a start,
also some double macros _(L()) with new single macro _L().
2020-04-01 09:49:04 +02:00
bubnikv
8d7f88b381 Imported error reporting when loading presets with option keys
or option values that our poor software does not understand.
This applies to configs added by some forks of slic3r, for example
slic3r++
PrusaSlicer has encountered an error: Failed loading the preset file: #3909
2020-03-25 16:04:11 +01:00
bubnikv
059bdb4711 Implemented handling of complex ConfigOptionFloatOrPercent chains
by the PlaceholderParser.

Namely, all the options with the "ratio_over" reference are now handled
correctly by the PlaceholderParser with the exception
of the "first_layer_extrusion_width", which overrides speed of extrusions
by their respective extrusion type.

Also the various extrusion widths (extrusion_width, first_layer_extrusion_width,
external_perimeter_extrusion_width etc.) produce the same numbers
as if ran through the back-end, with the assumption of not overriding
layer height by the variable layer height editing tool or layer height
modifiers.
2020-02-04 15:27:38 +01:00
bubnikv
9406b50447 Const correctness improvements:
removed some unnecessary const_casts that remove const.
2020-01-03 16:33:04 +01:00
bubnikv
fd3651d994 Fixed C++17 incompatibility. 2019-12-18 18:14:06 +01:00
bubnikv
13cc74ef0a Ported test_config.cpp from upstream Slic3r.
Extended ConfigBase with set() functions similar to the upstream Slic3r.
ConfigBase::set_deserialize() newly throws if the operation fails.
Extrusion width parameters are newly tested for negative values.
2019-10-18 11:53:19 +02:00
bubnikv
c228a49fe0 Ported test_support_material from upstream Slic3r.
Reworked the FFF testing framework & ConfigBase::set_deserialize()
for more compact tests: set_deserialize() now accepts list
of key / value pairs.

Fixed an incorrect assert in LayerRegion.
2019-10-17 17:09:15 +02:00
bubnikv
69c8b1cd21 new cheaper constructor for DynamicPrintConfig from FullPrintConfig:
DynamicPrintConfig::full_print_config()
new cheaper constructors of DynamicConfig / DynamicPrintConfig from ConfigBase
Unit tests: ported test_model from upstream Slic3r, thanks @lordofhyphens
Unit tests refactored to use less autos and initializer lists for readibility,
DynamicPrintConfig is handled by value, not by shared pointer.
2019-10-16 11:16:50 +02:00
tamasmeszaros
f29e18dad2 Fix crashing test executable on gcc 4.9 2019-10-02 14:42:28 +02:00
Lukas Matena
7861fa5086 Whitespace changes to supress misleading indentation warnings
These appear in newer gcc when spaces and tabs are mixed
2019-09-24 16:01:01 +02:00
bubnikv
3b1a44c084 WIP: Nullable configuration value concept, implemented for
ConfigOptionFloatsNullable, ConfigOptionIntsNullable,
ConfigOptionPercentsNullable, ConfigOptionBoolsNullable.

retract override values were added to the Filament profile:
vector of floats: "retract_length", "retract_lift", "retract_lift_above",
	"retract_lift_below", "retract_speed", "deretract_speed",
	"retract_restart_extra", "retract_before_travel",
vector of bools: "retract_layer_change", "wipe"
vector of percents: "retract_before_wipe"
2019-07-23 14:15:42 +02:00
bubnikv
9fd0c55eb8 Simplified the "cereal" includes to not clash with Perl includes 2019-07-04 22:09:14 +02:00
bubnikv
497b01f24a Trying to fix some template resolution on Linux 2019-07-04 21:02:08 +02:00
bubnikv
c7cc760067 Merge remote-tracking branch 'origin/master' into vb_undo_redo 2019-07-04 20:22:15 +02:00
bubnikv
da3583b1db Fix of https://github.com/prusa3d/PrusaSlicer/issues/2516 2019-06-27 09:48:19 +02:00
bubnikv
a710e7e7e4 WIP: Undo / Redo stack.
Integration of the "cereal" serialization library.
Serialization / deserialization of the DynamicConfig / DynamicPrintConfig.
DynamicPrintConfig serializes ordinal identifiers instead
of the option key strings to conserve space.
2019-06-26 13:26:49 +02:00
bubnikv
84965dcb44 Fix of "PrusaSlicer 2.0.0.-rc+ g-code error when importing #2304" 2019-05-21 09:41:46 +02:00
bubnikv
a61e833536 Implemented the "Support for support enforcers only" quick selection.
Reduced some memory leaks due to the ConfigDef::default_value pointer.
2019-05-03 18:01:39 +02:00
bubnikv
5fc37238e0 Fixed missing include on OSX 2019-03-17 15:04:34 +01:00
bubnikv
2bb4b4e691 Command line - improved error handling 2019-03-17 14:35:54 +01:00
bubnikv
c7ba650097 Help for the FFF / SLA command line parameters.
Removed the cli parameter from most options as it is derived
from the option key. Options without CLI parameter are now marked
with cli = nocli.
2019-03-13 19:17:26 +01:00
bubnikv
18025cc669 Reworked the command line interface based on the current state
of the upstream.
Thanks @alexrj, @lordofhyphens for the original code of slic3r.cpp
2019-03-13 15:44:50 +01:00
bubnikv
8515852efc Ignore the extra "Process Serial Number" parameter generated by the OSX finder
https://stackoverflow.com/questions/10242115/os-x-strange-psn-command-line-parameter-when-launched-from-finder
2019-01-09 14:09:08 +01:00
bubnikv
5b1c1d5922 Fixed a bug in the Win32 start wrapper (wrong number of parameters was passed for the GUI slic3r.exe).
Reworked command line processing for the GUI slic3r. Now the config is loaded first, then the model files (also the configs from AMF/3MF are applied), and lastly the free standing parameters are applied.
Fixed unescaping for command line parameters. The string parameters are now not unescaped, string vector parameters are unescaped only if enquoted.
Tab::load_current_preset() - disabled CallAfter for predictability. With CallAfter, it was difficult to call the method in sequence with other methods.
Fixed some missing ->Destroy() calls on dialogs created from MainFrame
Fixed some compiler warnings.
2019-01-09 10:43:17 +01:00
bubnikv
8d1b854acb Replaced all wxString.ToStdString() with wxString.ToUTF8().data()
to be sure that the strings are correctly converted to UTF8.
2019-01-03 14:34:53 +01:00
bubnikv
e9990ed79e Fix of SPE-691 Slicer crash after extruder change
Added synchronization of GCodePreviewData between the front end / back end
(GCodePreview data is only used if PrintStep psGCodeExport is finished).
Added reset of GCodePreviewData on Print::apply() to conserve RAM.
2018-12-19 14:47:16 +01:00
bubnikv
6888fefc2e Fixed constness of Config::env_ 2018-12-10 10:44:30 +01:00
bubnikv
c586ca4ae0 Implemented compatible_printer / compatible_printer_condition
for filaments and SLA materials.

Fixed compatible_printers / compatible_prints dialog to show
system profiles as well.
2018-12-04 17:56:49 +01:00
Vojtech Kral
3e4af381c9 Fix rendering performance on macOS 2018-11-08 15:31:29 +01:00