Skip to content

Commit

Permalink
v2.4: now tags instead of mode, more scripts for simple mode
Browse files Browse the repository at this point in the history
tags are defined in the colors.ini file
you can apply them in the ui files.
you can now display a widget only on simple mode (hiding in other ones), so they can "move" from page to page.
  • Loading branch information
supermerill committed Feb 21, 2022
2 parents 76f2cbb + e6a7c9d commit 6ba0a33
Show file tree
Hide file tree
Showing 41 changed files with 1,718 additions and 1,299 deletions.
259 changes: 61 additions & 198 deletions resources/icons/notification_clippy.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 7 additions & 1 deletion resources/ui_layout/colors.ini
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,10 @@ splash_screen_editor = cars.jpg
splash_screen_gcodeviewer = prusa-gcodepreview.jpg
Gui_plater = 3C3C3C
Gui_plater_grid = D0D0D0

Tag_Simple = 7DF028
Tag_Advanced = FFDC00
Tag_Expert = E70000
Tag_SuSi = 2172eb
Tag_Prusa = ED6B21
#Tag_Teal = 00E7E7
#Tag_Pink = E700D7
105 changes: 97 additions & 8 deletions resources/ui_layout/print.as
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
// can be used by type int and enum (return the index)
// float get_float(string &in key)
// can be used by type float, percent and flaot_or_percent
// float get_computed_float(string &in key)
// get the float computed value of the field. Useful if it's a floatOrPercent that is computable.
// bool is_percent(string &in key)
// void get_string(string &in key, string &out get_val)
// can be used by type string and enum (return the enum_value, not the label)
Expand All @@ -28,8 +30,13 @@
// void set_string(string &in, string &in new_val))
// if an enum, it's one of the enum_value
//
// ask_for_refresh()
// ask for a OPTNAME_set() if in a OPTNAME_get()
//
//// Functions to define for each script widget ////
//
// note that you can't call set_thing() in an OPTNAME_get(), you can only call these in an OPTNAME_set()
//
// type bool:
// int OPTNAME_get()
// will return 1 if checkd, 0 if unchecked and -1 if half-checked (not all os, will be uncehcked if not available)
Expand Down Expand Up @@ -93,18 +100,12 @@ void s_overhangs_reset(bool set)
float compute_overlap()
{
float height = get_float("layer_height");
print("layer_height = " + height + "\n");
float width = get_computed_float("solid_infill_extrusion_width");
print("width = " + width + "\n");
if(height <= 0) return 1;
if(width <= 0) return 1;
float solid_spacing = (width - height * 0.215);
print("solid_spacing = " + solid_spacing + "\n");
float solid_flow = height * solid_spacing;
print("solid_flow = " + solid_flow + "\n");
float bridge_spacing = sqrt(solid_flow*1.2739);
print("bridge_spacing = " + bridge_spacing + "\n");
print("bridge_spacing/solid_spacing = " + (bridge_spacing / solid_spacing) + "\n");
return bridge_spacing / solid_spacing;
}

Expand All @@ -131,15 +132,13 @@ void s_not_thick_bridge_set(bool set)
{
bool var_set = false;
get_custom_bool(0,"not_thick_bridge", var_set);
print("Me with value " + var_set +" has to be set to " + set+"\n");
if (var_set != set) {
set_custom_bool(0,"not_thick_bridge", set);
}
if (set) {
if (get_int("bridge_type") != 2)
set_int("bridge_type", 2);
float overlap = compute_overlap();
print("overlap = " + overlap + "\n");
set_float("bridge_overlap", overlap);
set_float("bridge_overlap_min", overlap);
} else if (var_set != set) {
Expand All @@ -149,6 +148,96 @@ void s_not_thick_bridge_set(bool set)
}
}

// seam position
// spRandom [spNearest] spAligned spRear [spCustom] spCost
// ("Cost-based") ("Random") ("Aligned") ("Rear")
// -> Corners Nearest Random Aligned Rear Custom
int s_seam_position_get(string &out get_val)
{
int pos = get_int("seam_position");
string seam_pos;
get_string("seam_position", seam_pos);
if(pos < 5){
if (pos == 0) return 2;
return pos + 1;
} else {
float angle = get_float("seam_angle_cost");
float travel = get_float("seam_travel_cost");
if(angle > travel * 3.9 && angle < travel * 4.1) return 0;
if(travel > angle * 1.9 && travel < angle * 2.1) return 1;
}
return 5;
}

void s_seam_position_set(string &in set_val, int idx)
{
if (idx == 2 ) {
set_int("seam_position", 0);
} else if (idx <= 1) {
set_int("seam_position", 5);
if (idx == 0) {
set_percent("seam_angle_cost", 80);
set_percent("seam_travel_cost", 20);
} else {
set_percent("seam_angle_cost", 30);
set_percent("seam_travel_cost", 60);
}
} else if (idx < 5) {
set_int("seam_position", idx - 1);
} else {
set_int("seam_position", 5);
back_initial_value("seam_angle_cost");
back_initial_value("seam_travel_cost");
}
}

// s_wall_thickness
// set the perimeter_spacing & external_perimeter_spacing
// as m * 2 perimeter_spacing + n * 2 * external_perimeter_spacing = o * s_wall_thickness

float s_wall_thickness_get()
{
int nb_peri = 2;
get_custom_int(0,"wall_thickness_lines", nb_peri);
float ps = get_computed_float("perimeter_extrusion_spacing");
float eps = get_computed_float("external_perimeter_extrusion_spacing");
//print("s_wall_thickness_get "+ps+" "+eps+" *"+nb_peri+"\n");
if (nb_peri<2) nb_peri = 2;
return eps * 2 + (nb_peri-2) * ps;
}

void s_wall_thickness_set(float new_val)
{
float ne = get_float("nozzle_diameter");
float nb = new_val / ne;
int int_nb = int(floor(nb+0.1));
//print("float "+nb+" cast into "+int_nb+"\n");
if(int_nb > 1 && int_nb < 4){
float ext_spacing = new_val / int_nb;
set_float("external_perimeter_extrusion_spacing", ext_spacing);
set_float("perimeter_extrusion_spacing", ext_spacing);
set_custom_int(0,"wall_thickness_lines", int_nb);
}else if(int_nb > 3) {
//try with thin external
float ext_spacing = ne;
float spacing = (new_val - ext_spacing * 2) / (int_nb - 2);
if (spacing > ne * 1.5) {
// too different, get back to same value
ext_spacing = new_val / int_nb;
spacing = ext_spacing;
}
set_float("external_perimeter_extrusion_spacing", ext_spacing);
set_float("perimeter_extrusion_spacing", spacing);
set_custom_int(0,"wall_thickness_lines", int_nb);
}
// ask_for_refresh();
}

//TODO to replicate prusa:
// brim_type
// cooling
// xy compensation (both)


//test:
// setting:script:bool:easy:depends$enforce_full_fill_volume:label$fullfill-lol:s_fullfill
Expand Down
52 changes: 38 additions & 14 deletions resources/ui_layout/print.ui
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
page:Perimeters & Shell:shell
group:Vertical shells
setting:width$6:perimeters
setting:tags$Simple$SuSi:script:float:depends$perimeter_spacing$external_perimeter_spacing:label$Wall Thickness:tooltip$Change the perimeter extrusion width to ensure that there is an exact number of perimeters for this wall value. It won't put the width below the nozzle diameter, and up to double the size of the nozzle.:s_wall_thickness
setting:spiral_vase
recommended_thin_wall_thickness_description
group:Horizontal shells
Expand All @@ -15,6 +16,15 @@ group:Horizontal shells
end_line
top_bottom_shell_thickness_explanation
setting:enforce_full_fill_volume
group:title_width$0:Infill
line:_
setting:tags$Simple:label_left:label_width$6:label$Sparse:width$8:sidetext_width$1:fill_density
setting:tags$Simple:label_width$0:label$_:fill_pattern
end_line
line:_
setting:tags$Simple:label_left:label_width$20:label$Top:top_fill_pattern
end_line
setting:tags$Simple:sidetext_width$0:infill_dense
group:Quality
line:Only one perimeter
setting:label_width$8:label$On first layer:only_one_perimeter_first_layer
Expand Down Expand Up @@ -62,9 +72,10 @@ group:Advanced
setting:width$5:gap_fill_last
end_line
line:Seam
setting:label_width$12:sidetext_width$0:seam_position
setting:width$3:sidetext_width$0:seam_angle_cost
setting:width$3:sidetext_width$0:seam_travel_cost
setting:tags$Simple$Advanced$Prusa$SuSi:script:enum$corners$Corners$nearest$Nearest$random$Random$aligned$Aligned$rear$Rear$custom$Custom:depends$seam_position$seam_angle_cost$seam_travel_cost:label$Seam position:label_width$12:sidetext_width$0:tooltip$Position of perimeters' starting points.\nCustom can be defeined in Advanced or Expert mode.:s_seam_position
setting:tags$Expert:label_width$12:sidetext_width$0:seam_position
setting:tags$Advanced$Expert$SuSi:width$3:sidetext_width$0:seam_angle_cost
setting:tags$Advanced$Expert$SuSi:width$3:sidetext_width$0:seam_travel_cost
end_line
line:One-loop perimeters
setting:sidetext_width$0:label$_:perimeter_loop
Expand Down Expand Up @@ -126,8 +137,8 @@ group:Other
page:Infill:infill
group:title_width$0:Infill
line:_
setting:label_left:label_width$6:label$Sparse:width$8:sidetext_width$1:fill_density
setting:label_width$0:label$_:fill_pattern
setting:tags$Advanced$Expert$Prusa:label_left:label_width$6:label$Sparse:width$8:sidetext_width$1:fill_density
setting:tags$Advanced$Expert$Prusa:label_width$0:label$_:fill_pattern
setting:label$_:width$18:infill_connection
end_line
line:_
Expand All @@ -139,7 +150,7 @@ group:title_width$0:Infill
setting:label$_:width$18:infill_connection_solid
end_line
line:_
setting:label_left:label_width$20:label$Top:top_fill_pattern
setting:tags$Advanced$Expert$Prusa:label_left:label_width$20:label$Top:top_fill_pattern
setting:label$_:width$18:infill_connection_top
end_line
line:_
Expand All @@ -150,7 +161,7 @@ group:Reducing printing time
setting:infill_every_layers
setting:infill_only_where_needed
line:Supporting dense layer
setting:sidetext_width$0:label$_:infill_dense
setting:tags$Advanced$Expert$SuSi:sidetext_width$0:label$_:infill_dense
setting:width$20:infill_dense_algo
end_line
group:sidetext_width$5:Advanced
Expand Down Expand Up @@ -185,7 +196,7 @@ group:title_width$19:Ironing post-process (This will go on top of infills and pe

page:Skirt & Brim:skirt+brim
group:Skirt
setting:skirts
setting:tags$Advanced$Expert$Prusa:skirts
line:Distance
setting:skirt_distance
setting:label$from brim:skirt_distance_from_brim
Expand All @@ -195,11 +206,11 @@ group:Skirt
setting:skirt_brim
setting:min_skirt_length
group:Brim
setting:brim_width
setting:tags$Advanced$Expert$Prusa:brim_width
setting:brim_inside_holes
setting:brim_width_interior
line:Brim ears
setting:label$_:sidetext_width$0:brim_ears
setting:tags$Advanced$Expert$Prusa:label$_:sidetext_width$0:brim_ears
setting:width$3:sidetext_width$1:brim_ears_max_angle
setting:width$3:sidetext_width$3:brim_ears_detection_length
setting:brim_ears_pattern
Expand All @@ -209,8 +220,8 @@ group:Brim
page:Support material:support

group:Support material
setting:support_material
setting:support_material_auto
setting:tags$Advanced$Expert$Prusa:support_material
setting:tags$Advanced$Expert$Prusa:support_material_auto
setting:support_material_threshold
setting:support_material_enforce_layers
group:Raft
Expand All @@ -235,7 +246,7 @@ group:Options for support material and raft
setting:support_material_spacing
setting:support_material_angle
setting:support_material_closing_radius
setting:support_material_buildplate_only
setting:tags$Advanced$Expert$Prusa:support_material_buildplate_only
setting:sidetext_width$7:support_material_xy_spacing
setting:dont_support_bridges
setting:support_material_synchronize_layers
Expand Down Expand Up @@ -410,7 +421,7 @@ page:Output options:output+page_white
group:Plater
setting:duplicate_distance
group:Sequential printing
setting:complete_objects
setting:tags$Advanced$Expert$Prusa:complete_objects
setting:complete_objects_one_skirt
setting:complete_objects_one_brim
setting:complete_objects_sort
Expand All @@ -432,6 +443,7 @@ group:Post-processing milling
setting:milling_extra_size
setting:milling_after_z
setting:milling_speed

page:Notes:note
group:no_title:Notes
setting:full_width:height$25:notes
Expand All @@ -443,3 +455,15 @@ group:Profile dependencies
setting:compatible_printers
setting:full_width:color:compatible_printers_condition
parent_preset_description

page:Support & Other:wrench
group:Support Material
setting:tags$Simple:support_material
setting:tags$Simple:support_material_auto
setting:tags$Simple:support_material_buildplate_only
group:Skirt & Brim
setting:tags$Simple:skirts
setting:tags$Simple:brim_width
setting:tags$Simple:sidetext_width$0:brim_ears
group:Sequential printing
setting:tags$Simple:complete_objects
11 changes: 6 additions & 5 deletions resources/ui_layout/printer_sla.ui
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@

page:General:printer
group:Output Method
setting:output_format
group:Size and coordinates
bed_shape
setting:max_print_height
Expand All @@ -26,9 +24,9 @@ group:Tilt
setting:area_fill
group:Corrections
line:Printer scaling correction
setting:label$X:id$0:relative_correction
setting:label$Y:id$1:relative_correction
setting:label$Z:id$2:relative_correction
setting:label$X:relative_correction_x
setting:label$Y:relative_correction_y
setting:label$Z:relative_correction_z
end_line
setting:absolute_correction
setting:first_layer_size_compensation
Expand All @@ -39,6 +37,9 @@ group:Exposure
setting:max_exposure_time
setting:min_initial_exposure_time
setting:max_initial_exposure_time
group:Output
setting:output_format
setting:sla_output_precision
group:Thumbnails
line:Size for Gcode
setting:id$0:label$Small:thumbnails
Expand Down
Loading

0 comments on commit 6ba0a33

Please sign in to comment.