tweak the fit of the parts

This commit is contained in:
Nick Estes
2026-08-04 12:27:31 -07:00
parent 45a77885f9
commit 69d9b956e6
41 changed files with 5378 additions and 324 deletions
+25
View File
@@ -44,13 +44,18 @@ config = YAML.safe_load_file(ROOT.join("case.yml"), permitted_classes: [],
permitted_symbols: [], aliases: false)
openscad = executable("OPENSCAD", "openscad")
blender = executable("BLENDER", "blender")
python = executable("PYTHON", "python3")
abort "OpenSCAD not found; install it or set OPENSCAD" unless openscad
abort "Blender not found; install it or set BLENDER" unless blender
parameters = config.fetch("parameters").merge(
"extra_cutouts" => config.fetch("resolved").fetch("extra_cutouts")
)
artwork = !parameters.fetch("lid_label", "").empty? ||
parameters.fetch("lid_logo_enabled", false)
abort "Python 3 not found; install it or set PYTHON" if artwork && !python
parts = %w[body lid] + config.fetch("outputs").fetch("coupons")
parts.concat(%w[lid_base lid_accent]) if artwork
buttons = %w[button_a button_b button_c button_reset]
if parameters["top_profile"] == "oled128x64" &&
buttons.any? { |name| parameters[name] }
@@ -80,6 +85,16 @@ begin
puts "Exporting #{part}.#{format}…"
export.call(directory.join("#{part}.#{format}"), part)
end
if artwork && format == "3mf"
puts "Packaging lid_multicolor.3mf…"
run!(
python, ROOT.join("tools/package_multimaterial_3mf.py").to_s,
directory.join("lid_base.3mf").to_s,
directory.join("lid_accent.3mf").to_s,
directory.join("lid_multicolor.3mf").to_s,
"--title", "#{config.fetch("name")} Lid"
)
end
end
assembly = scratch.join("assembly.stl")
@@ -97,6 +112,16 @@ begin
run!(blender, "--background", "-noaudio", "--python", renderer.to_s, "--",
mesh.to_s, previews.to_s, part, "iso", env: render_env)
end
if artwork
puts "Rendering multicolor lid preview…"
run!(
blender, "--background", "-noaudio", "--python",
ROOT.join("source/render_multicolor_lid.py").to_s, "--",
scratch.join("lid_base.stl").to_s,
scratch.join("lid_accent.stl").to_s,
previews.to_s, "lid_multicolor", parameters["lid_art_orientation"], env: render_env
)
end
backup = ROOT.join(".build-old-#{Process.pid}")
FileUtils.mkdir_p(backup)