mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-31 23:02:06 +00:00
Port EditGCodeDialog from PrusaSlicer (#3417)
This is a port of the EditGCodeDialog from PrusaSlicer 2.7.x. There were
a few changes made to make it a bit more functional. Also, it isn't
quite fully complete, but it should be in a very usable state.
General Changes:
- Implement UndoValueUIManager and EditValueUI in Field
- Implement EditGCodeDialog and add buttons to the tabs
- Other minor changes to accommodate the new classes
Differences from PrusaSlicer's Implementation:
- backported to wxWidgets 3.1.5 (reverse commit 8770c4b7 after updating
to 3.2.x)
- icons have been updated to use Orca colors
- improve the report that tells you if certain placeholders have not
been defined properly for the dialog. It now shows all issues at once
rather than having to fix then recompile to see the next issue.
- allow the use of the cmake option `ORCA_CHECK_GCODE_PLACEHOLDERS` to
toggle the above report since our workflow rarely uses debug mode.
- if a custom gcode value is not set when checking gcode placeholders, a
testing value is set. Custom gcode is not parsed if it is empty, and the
only way to check if the placeholders are all defined is by running the
placeholder operation on the custom gcode.
- some calls to `print.config()` in Gcode.cpp were changed to `m_config`
to support the above testing values feature (only m_config is modified
with the placeholders and `print.config()` would return an empty string)
- a macro has been added to quickly add a definition to
SlicingStatesConfigDefs with less boiler plate (it could technically be
used for any ConfigOptionDef, but that would hurt interoperability with
PS. I tried to not use the macro for too many PS defined definitions.)
- the presets are now also categorized by the page they are on in their
tab
<table>
<tr>
<td>Prusa
<td>Orca
<tr>
<td>
<img
src="https://github.com/SoftFever/OrcaSlicer/assets/24759591/27cb4f48-d225-4563-9aeb-b2b461f8bff5"
/>
<td>
<img
src="https://github.com/SoftFever/OrcaSlicer/assets/24759591/4fcd8cde-2427-4d1a-a0ed-1738b570b919"
/>
</table>
TODO:
- [x] Make sure all linux fixes have been applied
- [x] Finish adding "universal" gcode options
- [x] add search function to dataview (maybe?)
- [x] determine if any options are being left out of the preset
categories by getting options from Tab rather than Presets. If so,
consider adding outside of the groupings
This commit is contained in:
@@ -13,6 +13,10 @@ include(PrecompiledHeader)
|
||||
string(TIMESTAMP COMPILE_TIME %Y%m%d-%H%M%S)
|
||||
set(SLIC3R_BUILD_TIME ${COMPILE_TIME})
|
||||
|
||||
if(NOT DEFINED ORCA_CHECK_GCODE_PLACEHOLDERS)
|
||||
set(ORCA_CHECK_GCODE_PLACEHOLDERS "0")
|
||||
endif()
|
||||
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libslic3r_version.h.in ${CMAKE_CURRENT_BINARY_DIR}/libslic3r_version.h @ONLY)
|
||||
|
||||
if (MINGW)
|
||||
|
||||
@@ -1786,6 +1786,8 @@ public:
|
||||
// Create a default option to be inserted into a DynamicConfig.
|
||||
ConfigOption* create_default_option() const;
|
||||
|
||||
bool is_scalar() const { return (int(this->type) & int(coVectorType)) == 0; }
|
||||
|
||||
template<class Archive> ConfigOption* load_option_from_archive(Archive &archive) const {
|
||||
if (this->nullable) {
|
||||
switch (this->type) {
|
||||
@@ -1973,6 +1975,7 @@ public:
|
||||
out.push_back(kvp.first);
|
||||
return out;
|
||||
}
|
||||
bool empty() { return options.empty(); }
|
||||
|
||||
// Iterate through all of the CLI options and write them to a stream.
|
||||
std::ostream& print_cli_help(
|
||||
|
||||
@@ -1585,6 +1585,21 @@ void GCode::do_export(Print* print, const char* path, GCodeProcessorResult* resu
|
||||
|
||||
check_placeholder_parser_failed();
|
||||
|
||||
#if ORCA_CHECK_GCODE_PLACEHOLDERS
|
||||
if (!m_placeholder_error_messages.empty()){
|
||||
std::ostringstream message;
|
||||
message << "Some EditGcodeDialog defs were not specified properly. Do so in PrintConfig under SlicingStatesConfigDef:" << std::endl;
|
||||
for (const auto& error : m_placeholder_error_messages) {
|
||||
message << std::endl << error.first << ": " << std::endl;
|
||||
for (const auto& str : error.second)
|
||||
message << str << ", ";
|
||||
message.seekp(-2, std::ios_base::end);
|
||||
message << std::endl;
|
||||
}
|
||||
throw Slic3r::PlaceholderParserError(message.str());
|
||||
}
|
||||
#endif
|
||||
|
||||
BOOST_LOG_TRIVIAL(debug) << "Start processing gcode, " << log_memory_info();
|
||||
// Post-process the G-code to update time stamps.
|
||||
|
||||
@@ -2936,6 +2951,42 @@ void GCode::process_layers(
|
||||
|
||||
std::string GCode::placeholder_parser_process(const std::string &name, const std::string &templ, unsigned int current_extruder_id, const DynamicConfig *config_override)
|
||||
{
|
||||
// Orca: Added CMake config option since debug is rarely used in current workflow.
|
||||
// Also changed from throwing error immediately to storing messages till slicing is completed
|
||||
// to raise all errors at the same time.
|
||||
#if !defined(NDEBUG) || ORCA_CHECK_GCODE_PLACEHOLDERS // CHECK_CUSTOM_GCODE_PLACEHOLDERS
|
||||
if (config_override) {
|
||||
const auto& custom_gcode_placeholders = custom_gcode_specific_placeholders();
|
||||
|
||||
// 1-st check: custom G-code "name" have to be present in s_CustomGcodeSpecificOptions;
|
||||
//if (custom_gcode_placeholders.count(name) > 0) {
|
||||
// const auto& placeholders = custom_gcode_placeholders.at(name);
|
||||
if (auto it = custom_gcode_placeholders.find(name); it != custom_gcode_placeholders.end()) {
|
||||
const auto& placeholders = it->second;
|
||||
|
||||
for (const std::string& key : config_override->keys()) {
|
||||
// 2-nd check: "key" have to be present in s_CustomGcodeSpecificOptions for "name" custom G-code ;
|
||||
if (std::find(placeholders.begin(), placeholders.end(), key) == placeholders.end()) {
|
||||
auto& vector = m_placeholder_error_messages[name + " - option not specified for custom gcode type (s_CustomGcodeSpecificOptions)"];
|
||||
if (std::find(vector.begin(), vector.end(), key) == vector.end())
|
||||
vector.emplace_back(key);
|
||||
}
|
||||
// 3-rd check: "key" have to be present in CustomGcodeSpecificConfigDef for "key" placeholder;
|
||||
if (!custom_gcode_specific_config_def.has(key)) {
|
||||
auto& vector = m_placeholder_error_messages[name + " - option has no definition (CustomGcodeSpecificConfigDef)"];
|
||||
if (std::find(vector.begin(), vector.end(), key) == vector.end())
|
||||
vector.emplace_back(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
auto& vector = m_placeholder_error_messages[name + " - gcode type not found in s_CustomGcodeSpecificOptions"];
|
||||
if (vector.empty())
|
||||
vector.emplace_back("");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
PlaceholderParserIntegration &ppi = m_placeholder_parser_integration;
|
||||
try {
|
||||
ppi.update_from_gcodewriter(m_writer);
|
||||
@@ -3528,7 +3579,7 @@ LayerResult GCode::process_layer(
|
||||
m_last_height = height;
|
||||
|
||||
// Set new layer - this will change Z and force a retraction if retract_when_changing_layer is enabled.
|
||||
if (! print.config().before_layer_change_gcode.value.empty()) {
|
||||
if (! m_config.before_layer_change_gcode.value.empty()) {
|
||||
DynamicConfig config;
|
||||
config.set_key_value("layer_num", new ConfigOptionInt(m_layer_index + 1));
|
||||
config.set_key_value("layer_z", new ConfigOptionFloat(print_z));
|
||||
@@ -3551,7 +3602,7 @@ LayerResult GCode::process_layer(
|
||||
|
||||
auto insert_timelapse_gcode = [this, print_z, &print]() -> std::string {
|
||||
std::string gcode_res;
|
||||
if (!print.config().time_lapse_gcode.value.empty()) {
|
||||
if (!m_config.time_lapse_gcode.value.empty()) {
|
||||
DynamicConfig config;
|
||||
config.set_key_value("layer_num", new ConfigOptionInt(m_layer_index));
|
||||
config.set_key_value("layer_z", new ConfigOptionFloat(print_z));
|
||||
@@ -3579,7 +3630,7 @@ LayerResult GCode::process_layer(
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!print.config().time_lapse_gcode.value.empty()) {
|
||||
if (!m_config.time_lapse_gcode.value.empty()) {
|
||||
DynamicConfig config;
|
||||
config.set_key_value("layer_num", new ConfigOptionInt(m_layer_index));
|
||||
config.set_key_value("layer_z", new ConfigOptionFloat(print_z));
|
||||
@@ -3589,7 +3640,7 @@ LayerResult GCode::process_layer(
|
||||
"\n";
|
||||
}
|
||||
}
|
||||
if (! print.config().layer_change_gcode.value.empty()) {
|
||||
if (! m_config.layer_change_gcode.value.empty()) {
|
||||
DynamicConfig config;
|
||||
config.set_key_value("layer_num", new ConfigOptionInt(m_layer_index));
|
||||
config.set_key_value("layer_z", new ConfigOptionFloat(print_z));
|
||||
@@ -4287,6 +4338,33 @@ void GCode::apply_print_config(const PrintConfig &print_config)
|
||||
m_writer.apply_print_config(print_config);
|
||||
m_config.apply(print_config);
|
||||
m_scaled_resolution = scaled<double>(print_config.resolution.value);
|
||||
|
||||
#if ORCA_CHECK_GCODE_PLACEHOLDERS
|
||||
// If the gcode value is empty, set a value so that the check code within the parser is run
|
||||
for (auto opt : std::initializer_list<ConfigOptionString*>{
|
||||
&m_config.machine_start_gcode,
|
||||
&m_config.machine_end_gcode,
|
||||
&m_config.before_layer_change_gcode,
|
||||
&m_config.layer_change_gcode,
|
||||
&m_config.time_lapse_gcode,
|
||||
&m_config.change_filament_gcode,
|
||||
&m_config.change_extrusion_role_gcode,
|
||||
&m_config.printing_by_object_gcode,
|
||||
&m_config.machine_pause_gcode,
|
||||
&m_config.template_custom_gcode,
|
||||
}) {
|
||||
if (opt->empty())
|
||||
opt->set(new ConfigOptionString(";VALUE FOR TESTING"));
|
||||
}
|
||||
for (auto opt : std::initializer_list<ConfigOptionStrings*>{
|
||||
&m_config.filament_start_gcode,
|
||||
&m_config.filament_end_gcode
|
||||
}) {
|
||||
if (opt->empty())
|
||||
for (int i = 0; i < opt->size(); ++i)
|
||||
opt->set_at(new ConfigOptionString(";VALUE FOR TESTING"), i, 0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void GCode::append_full_config(const Print &print, std::string &str)
|
||||
|
||||
@@ -158,6 +158,7 @@ struct LayerResult {
|
||||
};
|
||||
|
||||
class GCode {
|
||||
|
||||
public:
|
||||
GCode() :
|
||||
m_origin(Vec2d::Zero()),
|
||||
@@ -522,6 +523,10 @@ private:
|
||||
double m_last_mm3_per_mm;
|
||||
#endif // ENABLE_GCODE_VIEWER_DATA_CHECKING
|
||||
|
||||
#if ORCA_CHECK_GCODE_PLACEHOLDERS
|
||||
std::map<std::string, std::vector<std::string>> m_placeholder_error_messages;
|
||||
#endif
|
||||
|
||||
Point m_last_pos;
|
||||
bool m_last_pos_defined;
|
||||
|
||||
|
||||
@@ -2041,6 +2041,7 @@ std::string Print::export_gcode(const std::string& path_template, GCodeProcessor
|
||||
const Vec3d origin = this->get_plate_origin();
|
||||
gcode.set_gcode_offset(origin(0), origin(1));
|
||||
gcode.do_export(this, path.c_str(), result, thumbnail_cb);
|
||||
|
||||
//BBS
|
||||
result->conflict_result = m_conflict_result;
|
||||
return path.c_str();
|
||||
|
||||
@@ -6614,6 +6614,386 @@ void DynamicPrintAndCLIConfig::handle_legacy(t_config_option_key &opt_key, std::
|
||||
}
|
||||
}
|
||||
|
||||
// SlicingStatesConfigDefs
|
||||
|
||||
// Create a new config definition with a label and tooltip
|
||||
// Note: the L() macro is already used for LABEL and TOOLTIP
|
||||
#define new_def(OPT_KEY, TYPE, LABEL, TOOLTIP) \
|
||||
def = this->add(OPT_KEY, TYPE); \
|
||||
def->label = L(LABEL); \
|
||||
def->tooltip = L(TOOLTIP);
|
||||
|
||||
ReadOnlySlicingStatesConfigDef::ReadOnlySlicingStatesConfigDef()
|
||||
{
|
||||
ConfigOptionDef* def;
|
||||
|
||||
def = this->add("zhop", coFloat);
|
||||
def->label = L("Current z-hop");
|
||||
def->tooltip = L("Contains z-hop present at the beginning of the custom G-code block.");
|
||||
}
|
||||
|
||||
ReadWriteSlicingStatesConfigDef::ReadWriteSlicingStatesConfigDef()
|
||||
{
|
||||
ConfigOptionDef* def;
|
||||
|
||||
def = this->add("position", coFloats);
|
||||
def->label = L("Position");
|
||||
def->tooltip = L("Position of the extruder at the beginning of the custom G-code block. If the custom G-code travels somewhere else, "
|
||||
"it should write to this variable so PrusaSlicer knows where it travels from when it gets control back.");
|
||||
|
||||
def = this->add("e_retracted", coFloats);
|
||||
def->label = L("Retraction");
|
||||
def->tooltip = L("Retraction state at the beginning of the custom G-code block. If the custom G-code moves the extruder axis, "
|
||||
"it should write to this variable so PrusaSlicer deretracts correctly when it gets control back.");
|
||||
|
||||
def = this->add("e_restart_extra", coFloats);
|
||||
def->label = L("Extra deretraction");
|
||||
def->tooltip = L("Currently planned extra extruder priming after deretraction.");
|
||||
|
||||
// Options from PS not used in Orca
|
||||
// def = this->add("e_position", coFloats);
|
||||
// def->label = L("Absolute E position");
|
||||
// def->tooltip = L("Current position of the extruder axis. Only used with absolute extruder addressing.");
|
||||
}
|
||||
|
||||
OtherSlicingStatesConfigDef::OtherSlicingStatesConfigDef()
|
||||
{
|
||||
ConfigOptionDef* def;
|
||||
|
||||
def = this->add("current_extruder", coInt);
|
||||
def->label = L("Current extruder");
|
||||
def->tooltip = L("Zero-based index of currently used extruder.");
|
||||
|
||||
def = this->add("current_object_idx", coInt);
|
||||
def->label = L("Current object index");
|
||||
def->tooltip = L("Specific for sequential printing. Zero-based index of currently printed object.");
|
||||
|
||||
def = this->add("has_wipe_tower", coBool);
|
||||
def->label = L("Has wipe tower");
|
||||
def->tooltip = L("Whether or not wipe tower is being generated in the print.");
|
||||
|
||||
def = this->add("initial_extruder", coInt);
|
||||
def->label = L("Initial extruder");
|
||||
def->tooltip = L("Zero-based index of the first extruder used in the print. Same as initial_tool.");
|
||||
|
||||
def = this->add("initial_tool", coInt);
|
||||
def->label = L("Initial tool");
|
||||
def->tooltip = L("Zero-based index of the first extruder used in the print. Same as initial_extruder.");
|
||||
|
||||
def = this->add("is_extruder_used", coBools);
|
||||
def->label = L("Is extruder used?");
|
||||
def->tooltip = L("Vector of bools stating whether a given extruder is used in the print.");
|
||||
|
||||
// Options from PS not used in Orca
|
||||
// def = this->add("initial_filament_type", coString);
|
||||
// def->label = L("Initial filament type");
|
||||
// def->tooltip = L("String containing filament type of the first used extruder.");
|
||||
|
||||
// def = this->add("has_single_extruder_multi_material_priming", coBool);
|
||||
// def->label = L("Has single extruder MM priming");
|
||||
// def->tooltip = L("Are the extra multi-material priming regions used in this print?");
|
||||
|
||||
new_def("initial_no_support_extruder", coInt, "Initial no support extruder", "Zero-based index of the first extruder used for printing without support. Same as initial_no_support_tool.");
|
||||
new_def("in_head_wrap_detect_zone", coBool, "In head wrap detect zone", "Indicates if the first layer overlaps with the head wrap zone.");
|
||||
}
|
||||
|
||||
PrintStatisticsConfigDef::PrintStatisticsConfigDef()
|
||||
{
|
||||
ConfigOptionDef* def;
|
||||
|
||||
def = this->add("extruded_volume", coFloats);
|
||||
def->label = L("Volume per extruder");
|
||||
def->tooltip = L("Total filament volume extruded per extruder during the entire print.");
|
||||
|
||||
def = this->add("total_toolchanges", coInt);
|
||||
def->label = L("Total toolchanges");
|
||||
def->tooltip = L("Number of toolchanges during the print.");
|
||||
|
||||
def = this->add("extruded_volume_total", coFloat);
|
||||
def->label = L("Total volume");
|
||||
def->tooltip = L("Total volume of filament used during the entire print.");
|
||||
|
||||
def = this->add("extruded_weight", coFloats);
|
||||
def->label = L("Weight per extruder");
|
||||
def->tooltip = L("Weight per extruder extruded during the entire print. Calculated from filament_density value in Filament Settings.");
|
||||
|
||||
def = this->add("extruded_weight_total", coFloat);
|
||||
def->label = L("Total weight");
|
||||
def->tooltip = L("Total weight of the print. Calculated from filament_density value in Filament Settings.");
|
||||
|
||||
def = this->add("total_layer_count", coInt);
|
||||
def->label = L("Total layer count");
|
||||
def->tooltip = L("Number of layers in the entire print.");
|
||||
|
||||
// Options from PS not used in Orca
|
||||
/* def = this->add("normal_print_time", coString);
|
||||
def->label = L("Print time (normal mode)");
|
||||
def->tooltip = L("Estimated print time when printed in normal mode (i.e. not in silent mode). Same as print_time.");
|
||||
|
||||
def = this->add("num_printing_extruders", coInt);
|
||||
def->label = L("Number of printing extruders");
|
||||
def->tooltip = L("Number of extruders used during the print.");
|
||||
|
||||
def = this->add("print_time", coString);
|
||||
def->label = L("Print time (normal mode)");
|
||||
def->tooltip = L("Estimated print time when printed in normal mode (i.e. not in silent mode). Same as normal_print_time.");
|
||||
|
||||
def = this->add("printing_filament_types", coString);
|
||||
def->label = L("Used filament types");
|
||||
def->tooltip = L("Comma-separated list of all filament types used during the print.");
|
||||
|
||||
def = this->add("silent_print_time", coString);
|
||||
def->label = L("Print time (silent mode)");
|
||||
def->tooltip = L("Estimated print time when printed in silent mode.");
|
||||
|
||||
def = this->add("total_cost", coFloat);
|
||||
def->label = L("Total cost");
|
||||
def->tooltip = L("Total cost of all material used in the print. Calculated from filament_cost value in Filament Settings.");
|
||||
|
||||
def = this->add("total_weight", coFloat);
|
||||
def->label = L("Total weight");
|
||||
def->tooltip = L("Total weight of the print. Calculated from filament_density value in Filament Settings.");
|
||||
|
||||
def = this->add("total_wipe_tower_cost", coFloat);
|
||||
def->label = L("Total wipe tower cost");
|
||||
def->tooltip = L("Total cost of the material wasted on the wipe tower. Calculated from filament_cost value in Filament Settings.");
|
||||
|
||||
def = this->add("total_wipe_tower_filament", coFloat);
|
||||
def->label = L("Wipe tower volume");
|
||||
def->tooltip = L("Total filament volume extruded on the wipe tower.");
|
||||
|
||||
def = this->add("used_filament", coFloat);
|
||||
def->label = L("Used filament");
|
||||
def->tooltip = L("Total length of filament used in the print.");*/
|
||||
}
|
||||
|
||||
ObjectsInfoConfigDef::ObjectsInfoConfigDef()
|
||||
{
|
||||
ConfigOptionDef* def;
|
||||
|
||||
def = this->add("num_objects", coInt);
|
||||
def->label = L("Number of objects");
|
||||
def->tooltip = L("Total number of objects in the print.");
|
||||
|
||||
def = this->add("num_instances", coInt);
|
||||
def->label = L("Number of instances");
|
||||
def->tooltip = L("Total number of object instances in the print, summed over all objects.");
|
||||
|
||||
def = this->add("scale", coStrings);
|
||||
def->label = L("Scale per object");
|
||||
def->tooltip = L("Contains a string with the information about what scaling was applied to the individual objects. "
|
||||
"Indexing of the objects is zero-based (first object has index 0).\n"
|
||||
"Example: 'x:100% y:50% z:100'.");
|
||||
|
||||
def = this->add("input_filename_base", coString);
|
||||
def->label = L("Input filename without extension");
|
||||
def->tooltip = L("Source filename of the first object, without extension.");
|
||||
|
||||
new_def("input_filename", coString, "Full input filename", "Source filename of the first object.");
|
||||
new_def("plate_name", coString, "Plate name", "Name of the plate sliced.");
|
||||
}
|
||||
|
||||
DimensionsConfigDef::DimensionsConfigDef()
|
||||
{
|
||||
ConfigOptionDef* def;
|
||||
|
||||
const std::string point_tooltip = L("The vector has two elements: x and y coordinate of the point. Values in mm.");
|
||||
const std::string bb_size_tooltip = L("The vector has two elements: x and y dimension of the bounding box. Values in mm.");
|
||||
|
||||
def = this->add("first_layer_print_convex_hull", coPoints);
|
||||
def->label = L("First layer convex hull");
|
||||
def->tooltip = L("Vector of points of the first layer convex hull. Each element has the following format:"
|
||||
"'[x, y]' (x and y are floating-point numbers in mm).");
|
||||
|
||||
def = this->add("first_layer_print_min", coFloats);
|
||||
def->label = L("Bottom-left corner of first layer bounding box");
|
||||
def->tooltip = point_tooltip;
|
||||
|
||||
def = this->add("first_layer_print_max", coFloats);
|
||||
def->label = L("Top-right corner of first layer bounding box");
|
||||
def->tooltip = point_tooltip;
|
||||
|
||||
def = this->add("first_layer_print_size", coFloats);
|
||||
def->label = L("Size of the first layer bounding box");
|
||||
def->tooltip = bb_size_tooltip;
|
||||
|
||||
def = this->add("print_bed_min", coFloats);
|
||||
def->label = L("Bottom-left corner of print bed bounding box");
|
||||
def->tooltip = point_tooltip;
|
||||
|
||||
def = this->add("print_bed_max", coFloats);
|
||||
def->label = L("Top-right corner of print bed bounding box");
|
||||
def->tooltip = point_tooltip;
|
||||
|
||||
def = this->add("print_bed_size", coFloats);
|
||||
def->label = L("Size of the print bed bounding box");
|
||||
def->tooltip = bb_size_tooltip;
|
||||
|
||||
new_def("first_layer_center_no_wipe_tower", coFloats, "First layer center without wipe tower", point_tooltip);
|
||||
new_def("first_layer_height", coFloat, "First layer height", "Height of the first layer.");
|
||||
}
|
||||
|
||||
TemperaturesConfigDef::TemperaturesConfigDef()
|
||||
{
|
||||
ConfigOptionDef* def;
|
||||
|
||||
new_def("bed_temperature", coInts, "Bed temperature", "Vector of bed temperatures for each extruder/filament.")
|
||||
new_def("bed_temperature_initial_layer", coInts, "Initial layer bed temperature", "Vector of initial layer bed temperatures for each extruder/filament. Provides the same value as first_layer_bed_temperature.")
|
||||
new_def("bed_temperature_initial_layer_single", coInt, "Initial layer bed temperature (initial extruder)", "Initial layer bed temperature for the initial extruder. Same as bed_temperature_initial_layer[initial_extruder]")
|
||||
new_def("chamber_temperature", coInts, "Chamber temperature", "Vector of chamber temperatures for each extruder/filament.")
|
||||
new_def("overall_chamber_temperature", coInt, "Overall chamber temperature", "Overall chamber temperature. This value is the maximum chamber temperature of any extruder/filament used.")
|
||||
new_def("first_layer_bed_temperature", coInts, "First layer bed temperature", "Vector of first layer bed temperatures for each extruder/filament. Provides the same value as bed_temperature_initial_layer.")
|
||||
new_def("first_layer_temperature", coInts, "First layer temperature", "Vector of first layer temperatures for each extruder/filament.")
|
||||
}
|
||||
|
||||
|
||||
TimestampsConfigDef::TimestampsConfigDef()
|
||||
{
|
||||
ConfigOptionDef* def;
|
||||
|
||||
def = this->add("timestamp", coString);
|
||||
def->label = L("Timestamp");
|
||||
def->tooltip = L("String containing current time in yyyyMMdd-hhmmss format.");
|
||||
|
||||
def = this->add("year", coInt);
|
||||
def->label = L("Year");
|
||||
|
||||
def = this->add("month", coInt);
|
||||
def->label = L("Month");
|
||||
|
||||
def = this->add("day", coInt);
|
||||
def->label = L("Day");
|
||||
|
||||
def = this->add("hour", coInt);
|
||||
def->label = L("Hour");
|
||||
|
||||
def = this->add("minute", coInt);
|
||||
def->label = L("Minute");
|
||||
|
||||
def = this->add("second", coInt);
|
||||
def->label = L("Second");
|
||||
}
|
||||
|
||||
OtherPresetsConfigDef::OtherPresetsConfigDef()
|
||||
{
|
||||
ConfigOptionDef* def;
|
||||
|
||||
def = this->add("print_preset", coString);
|
||||
def->label = L("Print preset name");
|
||||
def->tooltip = L("Name of the print preset used for slicing.");
|
||||
|
||||
def = this->add("filament_preset", coString);
|
||||
def->label = L("Filament preset name");
|
||||
def->tooltip = L("Names of the filament presets used for slicing. The variable is a vector "
|
||||
"containing one name for each extruder.");
|
||||
|
||||
def = this->add("printer_preset", coString);
|
||||
def->label = L("Printer preset name");
|
||||
def->tooltip = L("Name of the printer preset used for slicing.");
|
||||
|
||||
def = this->add("physical_printer_preset", coString);
|
||||
def->label = L("Physical printer name");
|
||||
def->tooltip = L("Name of the physical printer used for slicing.");
|
||||
|
||||
// Options from PS not used in Orca
|
||||
// def = this->add("num_extruders", coInt);
|
||||
// def->label = L("Number of extruders");
|
||||
// def->tooltip = L("Total number of extruders, regardless of whether they are used in the current print.");
|
||||
}
|
||||
|
||||
|
||||
static std::map<t_custom_gcode_key, t_config_option_keys> s_CustomGcodeSpecificPlaceholders{
|
||||
// Machine Gcode
|
||||
{"machine_start_gcode", {}},
|
||||
{"machine_end_gcode", {"layer_num", "layer_z", "max_layer_z", "filament_extruder_id"}},
|
||||
{"before_layer_change_gcode", {"layer_num", "layer_z", "max_layer_z"}},
|
||||
{"layer_change_gcode", {"layer_num", "layer_z", "max_layer_z"}},
|
||||
{"timelapse_gcode", {"layer_num", "layer_z", "max_layer_z"}},
|
||||
{"change_filament_gcode", {"layer_num", "layer_z", "max_layer_z", "next_extruder", "previous_extruder", "fan_speed",
|
||||
"first_flush_volume", "flush_length_1", "flush_length_2", "flush_length_3", "flush_length_4",
|
||||
"new_filament_e_feedrate", "new_filament_temp", "new_retract_length",
|
||||
"new_retract_length_toolchange", "old_filament_e_feedrate", "old_filament_temp", "old_retract_length",
|
||||
"old_retract_length_toolchange", "relative_e_axis", "second_flush_volume", "toolchange_count", "toolchange_z",
|
||||
"travel_point_1_x", "travel_point_1_y", "travel_point_2_x", "travel_point_2_y", "travel_point_3_x",
|
||||
"travel_point_3_y", "x_after_toolchange", "y_after_toolchange", "z_after_toolchange"}},
|
||||
{"change_extrusion_role_gcode", {"layer_num", "layer_z", "extrusion_role", "last_extrusion_role"}},
|
||||
{"printing_by_object_gcode", {}},
|
||||
{"machine_pause_gcode", {}},
|
||||
{"template_custom_gcode", {}},
|
||||
//Filament Gcode
|
||||
{"filament_start_gcode", {"filament_extruder_id"}},
|
||||
{"filament_end_gcode", {"layer_num", "layer_z", "max_layer_z", "filament_extruder_id"}},
|
||||
};
|
||||
|
||||
const std::map<t_custom_gcode_key, t_config_option_keys>& custom_gcode_specific_placeholders()
|
||||
{
|
||||
return s_CustomGcodeSpecificPlaceholders;
|
||||
}
|
||||
|
||||
CustomGcodeSpecificConfigDef::CustomGcodeSpecificConfigDef()
|
||||
{
|
||||
ConfigOptionDef* def;
|
||||
|
||||
// Common Defs
|
||||
def = this->add("layer_num", coInt);
|
||||
def->label = L("Layer number");
|
||||
def->tooltip = L("Index of the current layer. One-based (i.e. first layer is number 1).");
|
||||
|
||||
def = this->add("layer_z", coFloat);
|
||||
def->label = L("Layer z");
|
||||
def->tooltip = L("Height of the current layer above the print bed, measured to the top of the layer.");
|
||||
|
||||
def = this->add("max_layer_z", coFloat);
|
||||
def->label = L("Maximal layer z");
|
||||
def->tooltip = L("Height of the last layer above the print bed.");
|
||||
|
||||
def = this->add("filament_extruder_id", coInt);
|
||||
def->label = L("Filament extruder ID");
|
||||
def->tooltip = L("The current extruder ID. The same as current_extruder.");
|
||||
|
||||
// change_filament_gcode
|
||||
new_def("previous_extruder", coInt, "Previous extruder", "Index of the extruder that is being unloaded. The index is zero based (first extruder has index 0).");
|
||||
new_def("next_extruder", coInt, "Next extruder", "Index of the extruder that is being loaded. The index is zero based (first extruder has index 0).");
|
||||
new_def("relative_e_axis", coBool, "Relative e-axis", "Indicates if relative positioning is being used");
|
||||
new_def("toolchange_count", coInt, "Toolchange count", "The number of toolchanges throught the print");
|
||||
new_def("fan_speed", coNone, "", ""); //Option is no longer used and is zeroed by placeholder parser for compatability
|
||||
new_def("old_retract_length", coFloat, "Old retract length", "The retraction length of the previous filament");
|
||||
new_def("new_retract_length", coFloat, "New retract length", "The retraction lenght of the new filament");
|
||||
new_def("old_retract_length_toolchange", coFloat, "Old retract length toolchange", "The toolchange retraction length of the previous filament");
|
||||
new_def("new_retract_length_toolchange", coFloat, "New retract length toolchange", "The toolchange retraction length of the new filament");
|
||||
new_def("old_filament_temp", coInt, "Old filament temp", "The old filament temp");
|
||||
new_def("new_filament_temp", coInt, "New filament temp", "The new filament temp");
|
||||
new_def("x_after_toolchange", coFloat, "X after toolchange", "The x pos after toolchange");
|
||||
new_def("y_after_toolchange", coFloat, "Y after toolchange", "The y pos after toolchange");
|
||||
new_def("z_after_toolchange", coFloat, "Z after toolchange", "The z pos after toolchange");
|
||||
new_def("first_flush_volume", coFloat, "First flush volume", "The first flush volume");
|
||||
new_def("second_flush_volume", coFloat, "Second flush volume", "The second flush volume");
|
||||
new_def("old_filament_e_feedrate", coInt, "Old filament e feedrate", "The old filament extruder feedrate");
|
||||
new_def("new_filament_e_feedrate", coInt, "New filament e feedrate", "The new filament extruder feedrate");
|
||||
new_def("travel_point_1_x", coFloat, "Travel point 1 x", "The travel point 1 x");
|
||||
new_def("travel_point_1_y", coFloat, "Travel point 1 y", "The travel point 1 y");
|
||||
new_def("travel_point_2_x", coFloat, "Travel point 2 x", "The travel point 2 x");
|
||||
new_def("travel_point_2_y", coFloat, "Travel point 2 y", "The travel point 2 y");
|
||||
new_def("travel_point_3_x", coFloat, "Travel point 3 x", "The travel point 3 x");
|
||||
new_def("travel_point_3_y", coFloat, "Travel point 3 y", "The travel point 3 y");
|
||||
new_def("flush_length_1", coFloat, "Flush Length 1", "The first flush length");
|
||||
new_def("flush_length_2", coFloat, "Flush Length 2", "The second flush length");
|
||||
new_def("flush_length_3", coFloat, "Flush Length 3", "The third flush length");
|
||||
new_def("flush_length_4", coFloat, "Flush Length 4", "The fourth flush length");
|
||||
|
||||
// change_extrusion_role_gcode
|
||||
std::string extrusion_role_types = "Possible Values:\n[\"Perimeter\", \"ExternalPerimeter\", "
|
||||
"\"OverhangPerimeter\", \"InternalInfill\", \"SolidInfill\", \"TopSolidInfill\", \"BottomSurface\", \"BridgeInfill\", \"GapFill\", \"Ironing\", "
|
||||
"\"Skirt\", \"Brim\", \"SupportMaterial\", \"SupportMaterialInterface\", \"SupportTransition\", \"WipeTower\", \"Mixed\"]";
|
||||
|
||||
new_def("extrusion_role", coString, "Extrusion role", "The new extrusion role/type that is going to be used\n" + extrusion_role_types);
|
||||
new_def("last_extrusion_role", coString, "Last extrusion role", "The previously used extrusion role/type\nPossible Values:\n" + extrusion_role_types);
|
||||
}
|
||||
|
||||
const CustomGcodeSpecificConfigDef custom_gcode_specific_config_def;
|
||||
|
||||
#undef new_def
|
||||
|
||||
uint64_t ModelConfig::s_last_timestamp = 1;
|
||||
|
||||
static Points to_points(const std::vector<Vec2d> &dpts)
|
||||
|
||||
@@ -1464,6 +1464,74 @@ public:
|
||||
CLIMiscConfigDef();
|
||||
};
|
||||
|
||||
typedef std::string t_custom_gcode_key;
|
||||
// This map containes list of specific placeholders for each custom G-code, if any exist
|
||||
const std::map<t_custom_gcode_key, t_config_option_keys>& custom_gcode_specific_placeholders();
|
||||
|
||||
// Next classes define placeholders used by GUI::EditGCodeDialog.
|
||||
|
||||
class ReadOnlySlicingStatesConfigDef : public ConfigDef
|
||||
{
|
||||
public:
|
||||
ReadOnlySlicingStatesConfigDef();
|
||||
};
|
||||
|
||||
class ReadWriteSlicingStatesConfigDef : public ConfigDef
|
||||
{
|
||||
public:
|
||||
ReadWriteSlicingStatesConfigDef();
|
||||
};
|
||||
|
||||
class OtherSlicingStatesConfigDef : public ConfigDef
|
||||
{
|
||||
public:
|
||||
OtherSlicingStatesConfigDef();
|
||||
};
|
||||
|
||||
class PrintStatisticsConfigDef : public ConfigDef
|
||||
{
|
||||
public:
|
||||
PrintStatisticsConfigDef();
|
||||
};
|
||||
|
||||
class ObjectsInfoConfigDef : public ConfigDef
|
||||
{
|
||||
public:
|
||||
ObjectsInfoConfigDef();
|
||||
};
|
||||
|
||||
class DimensionsConfigDef : public ConfigDef
|
||||
{
|
||||
public:
|
||||
DimensionsConfigDef();
|
||||
};
|
||||
|
||||
class TemperaturesConfigDef : public ConfigDef
|
||||
{
|
||||
public:
|
||||
TemperaturesConfigDef();
|
||||
};
|
||||
|
||||
class TimestampsConfigDef : public ConfigDef
|
||||
{
|
||||
public:
|
||||
TimestampsConfigDef();
|
||||
};
|
||||
|
||||
class OtherPresetsConfigDef : public ConfigDef
|
||||
{
|
||||
public:
|
||||
OtherPresetsConfigDef();
|
||||
};
|
||||
|
||||
// This classes defines all custom G-code specific placeholders.
|
||||
class CustomGcodeSpecificConfigDef : public ConfigDef
|
||||
{
|
||||
public:
|
||||
CustomGcodeSpecificConfigDef();
|
||||
};
|
||||
extern const CustomGcodeSpecificConfigDef custom_gcode_specific_config_def;
|
||||
|
||||
// This class defines the command line options representing actions.
|
||||
extern const CLIActionsConfigDef cli_actions_config_def;
|
||||
|
||||
|
||||
@@ -144,6 +144,11 @@ const std::string& sys_shapes_dir();
|
||||
// Return a full path to the custom shapes gallery directory.
|
||||
std::string custom_shapes_dir();
|
||||
|
||||
// Set a path with shapes gallery files.
|
||||
void set_custom_gcodes_dir(const std::string &path);
|
||||
// Return a full path to the system shapes gallery directory.
|
||||
const std::string& custom_gcodes_dir();
|
||||
|
||||
// Set a path with preset files.
|
||||
void set_data_dir(const std::string &path);
|
||||
// Return a full path to the GUI resource files.
|
||||
|
||||
@@ -10,5 +10,6 @@
|
||||
//#define SLIC3R_RC_VERSION "@SLIC3R_VERSION@"
|
||||
#define BBL_RELEASE_TO_PUBLIC @BBL_RELEASE_TO_PUBLIC@
|
||||
#define BBL_INTERNAL_TESTING @BBL_INTERNAL_TESTING@
|
||||
#define ORCA_CHECK_GCODE_PLACEHOLDERS @ORCA_CHECK_GCODE_PLACEHOLDERS@
|
||||
|
||||
#endif /* __SLIC3R_VERSION_H */
|
||||
|
||||
@@ -265,6 +265,18 @@ const std::string& sys_shapes_dir()
|
||||
return g_sys_shapes_dir;
|
||||
}
|
||||
|
||||
static std::string g_custom_gcodes_dir;
|
||||
|
||||
void set_custom_gcodes_dir(const std::string &dir)
|
||||
{
|
||||
g_custom_gcodes_dir = dir;
|
||||
}
|
||||
|
||||
const std::string& custom_gcodes_dir()
|
||||
{
|
||||
return g_custom_gcodes_dir;
|
||||
}
|
||||
|
||||
// Translate function callback, to call wxWidgets translate function to convert non-localized UTF8 string to a localized one.
|
||||
Slic3r::I18N::translate_fn_type Slic3r::I18N::translate_fn = nullptr;
|
||||
static std::string g_data_dir;
|
||||
|
||||
Reference in New Issue
Block a user