Skip to content

Commit be3287e

Browse files
committed
faster logo build by cutting logo out of stl instead of re-rendering full case every build.
1 parent ebe1765 commit be3287e

4 files changed

Lines changed: 13 additions & 5 deletions

File tree

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ render/assembly.gif: assembly.scad $(SRCS)
5050
# $3: logo part (main|highlight)
5151
# $4: logo mode (normal|inverted)
5252
define logo-part-rule
53-
export/logo/$(1)/$(shell basename $(2))-$(4)-$(3).stl: src/$(2).scad logo/$(1)/$(shell basename $(2)).svg
53+
export/logo/$(1)/$(shell basename $(2))-$(4)-$(3).stl: src/$(2).scad logo/$(1)/$(shell basename $(2)).svg export/$(2).stl
5454
@mkdir -p $$(shell dirname $$@)
55-
$$(OPENSCAD) $$(OPENSCAD_OPTIONS) -D orient_for_printing=true -D logo_enabled=true -D 'logo_mode="$(4)"' -D 'logo_part="$(3)"' -D 'logo_name="$(1)"' -o $$@ $$<
55+
$$(OPENSCAD) $$(OPENSCAD_OPTIONS) -D orient_for_printing=true -D logo_enabled=true -D logo_use_prebuild=true -D 'logo_mode="$(4)"' -D 'logo_part="$(3)"' -D 'logo_name="$(1)"' -o $$@ $$<
5656

5757
logo-$1-$4: export/logo/$(1)/$(shell basename $(2))-$(4)-$(3).stl
5858
logo-$1: export/logo/$(1)/$(shell basename $(2))-$(4)-$(3).stl

src/MainCase/MainCase.scad

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,11 @@ if (logo_generate_templates) {
575575
MainCase();
576576
} else {
577577
GenerateWithLogo() {
578-
MainCase();
578+
if (logo_use_prebuild) {
579+
import("../../export/MainCase/MainCase.stl");
580+
} else {
581+
MainCase();
582+
}
579583

580584
mirror([0, 1, 0])
581585
rotate([0, 0, -90])

src/MainCase/MainCaseLid.scad

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,11 @@ if (logo_generate_templates) {
133133
MainCaseLid();
134134
} else {
135135
GenerateWithLogo() {
136-
MainCaseLid();
137-
136+
if (logo_use_prebuild) {
137+
import("../../export/MainCase/MainCaseLid.stl");
138+
} else {
139+
MainCaseLid();
140+
}
138141
mirror([1, 0, 0])
139142
translate([-104, -72-72, 0])
140143
import(str("../../logo/", logo_name, "/MainCaseLid.svg"));

variables.scad

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ logo_convexity = 10; // Increase if you get artifacts in the logo
290290
// Please do not modify these, they are overwritten by the Makefile when you
291291
// generate parts with logos.
292292
logo_enabled = false; // set to true to generate logos into parts that support it
293+
logo_use_prebuild = false; // used by makefile to speed up logo file export
293294
logo_generate_templates = false; // set to true to generate 2D template SVGs
294295
logo_name = "OpenBikeSensor"; // name of a folder inside `logo/`
295296
logo_mode = "normal"; // "normal" or "inverted"

0 commit comments

Comments
 (0)