MichaelRKessler commited on
Commit
6b2e8b8
·
1 Parent(s): 92bb652

Change default color of gcode and updated readme

Browse files
Files changed (2) hide show
  1. README.md +13 -1
  2. app.py +3 -3
README.md CHANGED
@@ -31,7 +31,19 @@ Then open the local Gradio URL in your browser, upload an STL file, and generate
31
  - Lets you step through the slice stack in the browser
32
  - Exports a ZIP containing the generated TIFF images
33
 
34
- ## Notes
 
 
 
 
 
 
 
 
 
 
 
 
35
 
36
  - G-code generation uses the slicer's `Pixel Size/Fill Width` for XY step distance by passing `fil_width=pixel_size` into `generate_snake_path_gcode()`.
37
 
 
31
  - Lets you step through the slice stack in the browser
32
  - Exports a ZIP containing the generated TIFF images
33
 
34
+ ## Behavior and Implementation Notes
35
+
36
+ ### Reference TIFF Stack Alignment
37
+
38
+ When you click **Generate Reference TIFF Stack**, the app combines available TIFF stacks layer-by-layer.
39
+
40
+ - If source TIFFs have different dimensions, each layer is placed on a canvas using the largest width and height.
41
+ - Layers are centered in X and Y before merging.
42
+ - Pixel merge uses a black-wins rule: a pixel is black in the reference if any source has black at that pixel.
43
+ - Alignment is centered image placement, not bottom-left anchoring.
44
+ - If image-size differences are odd, centering may produce a one-pixel shift due to integer rounding.
45
+
46
+ ### G-code XY Step Size
47
 
48
  - G-code generation uses the slicer's `Pixel Size/Fill Width` for XY step distance by passing `fil_width=pixel_size` into `generate_snake_path_gcode()`.
49
 
app.py CHANGED
@@ -677,7 +677,7 @@ def render_toolpath(
677
  travel_opacity: float = 0.55,
678
  print_opacity: float = 1.0,
679
  travel_color: str = "#969696",
680
- print_color: str = "#1f77b4",
681
  ) -> tuple[Any, str, dict]:
682
  if source == GCODE_SOURCE_UPLOAD:
683
  path = uploaded_path
@@ -1170,7 +1170,7 @@ def build_demo() -> gr.Blocks:
1170
  gcode_button = gr.Button("Generate G-Code", variant="primary")
1171
 
1172
  with gr.Row():
1173
- gcode_file_1 = gr.File(label="Download G-Code Shape 1")
1174
  gcode_file_2 = gr.File(label="Download G-Code Shape 2")
1175
  gcode_file_3 = gr.File(label="Download G-Code Shape 3")
1176
 
@@ -1238,7 +1238,7 @@ def build_demo() -> gr.Blocks:
1238
  print_color_picker = gr.Dropdown(
1239
  label="Print (G1) color",
1240
  choices=[("Blue", "#1f77b4"), ("Orange", "#ff7f0e"), ("Green", "#2ca02c"), ("Red", "#d62728"), ("Purple", "#9467bd"), ("Pink", "#e377c2"), ("Black", "#000000"), ("White", "#ffffff")],
1241
- value="#1f77b4",
1242
  allow_custom_value=False,
1243
  )
1244
  toolpath_plot = gr.Plot(label="Tool Path", elem_id="toolpath_plot")
 
677
  travel_opacity: float = 0.55,
678
  print_opacity: float = 1.0,
679
  travel_color: str = "#969696",
680
+ print_color: str = "#ff7f0e",
681
  ) -> tuple[Any, str, dict]:
682
  if source == GCODE_SOURCE_UPLOAD:
683
  path = uploaded_path
 
1170
  gcode_button = gr.Button("Generate G-Code", variant="primary")
1171
 
1172
  with gr.Row():
1173
+ gcode_file_1 = gr.File(label="Download G-Code Shape 1", interactive=False)
1174
  gcode_file_2 = gr.File(label="Download G-Code Shape 2")
1175
  gcode_file_3 = gr.File(label="Download G-Code Shape 3")
1176
 
 
1238
  print_color_picker = gr.Dropdown(
1239
  label="Print (G1) color",
1240
  choices=[("Blue", "#1f77b4"), ("Orange", "#ff7f0e"), ("Green", "#2ca02c"), ("Red", "#d62728"), ("Purple", "#9467bd"), ("Pink", "#e377c2"), ("Black", "#000000"), ("White", "#ffffff")],
1241
+ value="#ff7f0e",
1242
  allow_custom_value=False,
1243
  )
1244
  toolpath_plot = gr.Plot(label="Tool Path", elem_id="toolpath_plot")