Renders of STLs are now the correct colour. Fixes #71

This commit is contained in:
Chris Palmer 2020-04-05 16:18:24 +01:00
parent bc4e18d788
commit 7e0c5fdb6e
29 changed files with 175 additions and 76 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 137 KiB

After

Width:  |  Height:  |  Size: 137 KiB

View File

@ -1,67 +1,119 @@
[
{
"name": "base_assembly",
"big": null,
"count": 1,
"assemblies": {},
"vitamins": {
"insert(F1BM3): Heatfit insert M3": 2
"insert(F1BM3): Heatfit insert M3": {
"count": 2
}
},
"printed": {
"socket_box.stl": 1
"socket_box.stl": {
"count": 1,
"colour": "dimgrey"
}
},
"routed": {}
},
{
"name": "feet_assembly",
"big": null,
"count": 1,
"assemblies": {
"base_assembly": 1
},
"vitamins": {
"washer(M3_washer): Washer M3 x 7mm x 0.5mm": 8,
"screw(M3_dome_screw, 10): Screw M3 dome x 10mm": 4,
"nut(M3_nut, nyloc = true): Nut M3 x 2.4mm nyloc": 4
"washer(M3_washer): Washer M3 x 7mm x 0.5mm": {
"count": 8
},
"screw(M3_dome_screw, 10): Screw M3 dome x 10mm": {
"count": 4
},
"nut(M3_nut, nyloc = true): Nut M3 x 2.4mm nyloc": {
"count": 4
}
},
"printed": {
"foot.stl": 4
"foot.stl": {
"count": 4,
"colour": "darkorange"
}
},
"routed": {}
},
{
"name": "mains_in_assembly",
"big": null,
"count": 1,
"assemblies": {
"feet_assembly": 1
},
"vitamins": {
": Wire green & yellow 30/0.25mm strands, length 150mm - not shown": 1,
": Wire blue 30/0.25mm strands, length 150mm - not shown": 1,
": Wire brown 30/0.25mm strands, length 150mm - not shown": 2,
"tubing(HSHRNK32): Heatshrink sleeving ID 3.2mm x 15mm - not shown": 3,
"iec(IEC_inlet_atx): IEC inlet for ATX": 1,
"screw(M3_cs_cap_screw, 12): Screw M3 cs cap x 12mm": 2,
"washer(M3_washer): Washer M3 x 7mm x 0.5mm": 2,
"nut(M3_nut, nyloc = true): Nut M3 x 2.4mm nyloc": 2
": Wire green & yellow 30/0.25mm strands, length 150mm - not shown": {
"count": 1
},
": Wire blue 30/0.25mm strands, length 150mm - not shown": {
"count": 1
},
": Wire brown 30/0.25mm strands, length 150mm - not shown": {
"count": 2
},
"tubing(HSHRNK32): Heatshrink sleeving ID 3.2mm x 15mm - not shown": {
"count": 3
},
"iec(IEC_inlet_atx): IEC inlet for ATX": {
"count": 1
},
"screw(M3_cs_cap_screw, 12): Screw M3 cs cap x 12mm": {
"count": 2
},
"washer(M3_washer): Washer M3 x 7mm x 0.5mm": {
"count": 2
},
"nut(M3_nut, nyloc = true): Nut M3 x 2.4mm nyloc": {
"count": 2
}
},
"printed": {},
"routed": {}
},
{
"name": "main_assembly",
"big": null,
"count": 1,
"assemblies": {
"mains_in_assembly": 1
},
"vitamins": {
": Wire green & yellow 30/0.25mm strands, length 150mm - not shown": 1,
": Wire blue 30/0.25mm strands, length 150mm - not shown": 1,
"tubing(HSHRNK32): Heatshrink sleeving ID 3.2mm x 15mm - not shown": 5,
": Ferrule for 1.5mm^2 wire - not shown": 3,
"mains_socket(Contactum): Mains socket 13A": 1,
"screw(M3_cs_cap_screw, 20): Screw M3 cs cap x 20mm": 2,
"jack_4mm_shielded(\"blue\", 3, \"royalblue\"): 4mm shielded jack socket blue": 2,
"jack_4mm_shielded(\"brown\", 3, \"sienna\"): 4mm shielded jack socket brown": 1,
"jack_4mm_shielded(\"green\", 3): 4mm shielded jack socket green": 2
": Wire green & yellow 30/0.25mm strands, length 150mm - not shown": {
"count": 1
},
": Wire blue 30/0.25mm strands, length 150mm - not shown": {
"count": 1
},
"tubing(HSHRNK32): Heatshrink sleeving ID 3.2mm x 15mm - not shown": {
"count": 5
},
": Ferrule for 1.5mm^2 wire - not shown": {
"count": 3
},
"mains_socket(Contactum): Mains socket 13A": {
"count": 1
},
"screw(M3_cs_cap_screw, 20): Screw M3 cs cap x 20mm": {
"count": 2
},
"jack_4mm_shielded(\"blue\", 3, \"royalblue\"): 4mm shielded jack socket blue": {
"count": 2
},
"jack_4mm_shielded(\"brown\", 3, \"sienna\"): 4mm shielded jack socket brown": {
"count": 1
},
"jack_4mm_shielded(\"green\", 3): 4mm shielded jack socket green": {
"count": 2
}
},
"printed": {},
"routed": {}

View File

@ -173,7 +173,7 @@ module socket_box_stl() {
//
module base_assembly()
assembly("base") {
color(pp1_colour) render() /*clip(ymax = 0)*/ socket_box_stl();
stl_colour(pp1_colour) render() /*clip(ymax = 0)*/ socket_box_stl();
mains_socket_hole_positions(socket)
translate_z(height)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

View File

@ -33,7 +33,7 @@ assembly("box") {
y = [-1,-1,1,1][corner];
translate([x * (box_width(type) / 2 + 25 * exploded()), y * (box_depth(type) / 2 + 25 * exploded())])
rotate(corner * 90) {
color(pp2_colour) render()
stl_colour(pp2_colour) render()
box_corner_profile(type);
translate([box_hole_inset(type), box_hole_inset(type)])
@ -50,7 +50,7 @@ assembly("box") {
translate_z(z * (box_height(type) / 2 - box_corner_gap(type) + 50 * exploded()))
rotate([z * 90 - 90, 0, 0])
if(bezels && (z > 0 ? top : base))
color(pp1_colour) render() box_bezel(type, z < 0);
stl_colour(pp1_colour) render() box_bezel(type, z < 0);
translate_z(z * (box_height(type) / 2 + sheet_thickness + 50 * exploded()))
box_screw_hole_positions(type)

View File

@ -133,12 +133,12 @@ module round_grommet_hole(diameter, h = 100) //! Make a hole for a round grommet
drill(corrected_radius(diameter / 2) + wall + clearance, h);
module round_grommet_assembly(diameter, thickness, od = undef) {
color(pp1_colour)
stl_colour(pp1_colour)
translate_z(wall)
vflip()
round_grommet_top(diameter, thickness, od);
color(pp2_colour)
stl_colour(pp2_colour)
translate_z(-thickness)
vflip()
round_grommet_bottom(diameter, od);
@ -188,7 +188,7 @@ module mouse_grommet(r, thickness) { //! Make the STL for a mouse grommet
}
module mouse_grommet_assembly(r, thickness)
color(pp1_colour)
stl_colour(pp1_colour)
rotate([-90, 0, 0])
mouse_grommet(r, thickness);

View File

@ -120,7 +120,7 @@ module corner_block_assembly(screw = def_screw, name = false) //! The printed bl
assembly(str("corner_block_M", 20 * screw_radius(screw))) {
insert = screw_insert(screw);
color(name ? pp2_colour : pp1_colour)
stl_colour(name ? pp2_colour : pp1_colour)
render() corner_block(screw, name) children();
corner_block_h_holes(screw)

View File

@ -141,7 +141,7 @@ module door_hinge_assembly(top, door_thickness = 6) { //! The moving assembly th
translate([0, pin_y - (thickness + door_thickness / 2), dir * width / 2]) {
rotate([90, 0, 180])
color(pp2_colour) door_hinge(door_thickness);
stl_colour(pp2_colour) door_hinge(door_thickness);
rotate([90, 0, 0])
door_hinge_hole_positions()
@ -165,7 +165,7 @@ module door_hinge_static_assembly(top, sheet_thickness = 3) { //! The stationary
translate([pin_x, 0, -dir * (stat_width / 2 + washer_thickness(screw_washer(pin_screw)))])
rotate([90, 0, 0]) {
color(pp1_colour) door_hinge_stat_stl();
stl_colour(pp1_colour) door_hinge_stat_stl();
door_hinge_stat_hole_positions() {
screw_and_washer(stat_screw, stat_screw_length);

View File

@ -65,7 +65,7 @@ module door_latch_assembly(sheet_thickness = 3) { //! The assembly for a specifi
translate([0, -height - washer_thickness(washer)])
rotate([-90, 0, 0]) {
color(pp1_colour) render() door_latch_stl();
stl_colour(pp1_colour) render() door_latch_stl();
translate_z(nut_trap_depth)
vflip()

View File

@ -109,7 +109,7 @@ module fixing_block_assembly(screw = def_screw) pose([55, 180, 25], [0, 4.8, 4.8
assembly(str("fixing_block_M", 20 * screw_radius(screw))) {
translate_z(fixing_block_height(screw))
rotate([0, 180, 0])
color(pp1_colour) render() fixing_block(screw);
stl_colour(pp1_colour) render() fixing_block(screw);
insert = screw_insert(screw);

View File

@ -133,17 +133,17 @@ assembly(str("hinge_", type[0])) { //! Assembled hinge
vitamin(str(": Hinge pin ", w, " x ", 2 * hr, "mm"));
color(pp1_colour) hinge_male(type);
stl_colour(pp1_colour) hinge_male(type);
translate([0, -kr, kr]) {
rotate([0, 90, 0])
explode(w + 10)
color("silver") cylinder(r = hr , h = w, center = true);
stl_colour("silver") cylinder(r = hr , h = w, center = true);
rotate([-angle, 0, 0])
translate([0, -kr, -kr])
rotate(180)
color(pp2_colour) hinge_female(type);
stl_colour(pp2_colour) hinge_female(type);
}
}

View File

@ -73,7 +73,7 @@ module foot_assembly(t = 0, type = foot, flip = false) { //! Assembly with faste
screw_length = screw_longer_than(foot_thickness(type) + t + 2 * washer_thickness(washer) + nut_thickness(nut, true) - squeeze);
vflip() explode(15, true) {
color(pp4_colour) foot(type);
stl_colour(pp4_colour) foot(type);
if(t)
explode(15, true)
@ -136,7 +136,7 @@ assembly("insert_foot") {
insert = screw_insert(screw);
vflip()
color(pp1_colour) insert_foot(type);
stl_colour(pp4_colour) insert_foot(type);
translate_z(-foot_thickness(type))
insert(insert);

View File

@ -83,7 +83,7 @@ module handle_stl() { //! generate the STL
module handle_assembly() pose([225, 0, 150], [0, 0, 14]) //! Printed part with inserts in place
assembly("handle") {
translate_z(handle_height())
color(pp1_colour) vflip() handle_stl();
stl_colour(pp1_colour) vflip() handle_stl();
handle_screw_positions()
vflip()

View File

@ -101,7 +101,7 @@ module pcb_mount_assembly(pcb, thickness, height = 5) { //! A PCB mount assembly
translate_z(height)
pcb(pcb);
color(pp1_colour) pcb_mount(pcb, washers = false);
stl_colour(pp1_colour) pcb_mount(pcb, washers = false);
washer = screw_washer(screw);
nut = screw_nut(screw);
@ -110,7 +110,7 @@ module pcb_mount_assembly(pcb, thickness, height = 5) { //! A PCB mount assembly
pcb_mount_screw_positions(pcb) {
translate_z(height + t) {
color(pp2_colour) pcb_mount_washer_stl();
stl_colour(pp2_colour) pcb_mount_washer_stl();
translate_z(washer_thickness)
screw(screw, screw_length);

View File

@ -221,7 +221,7 @@ module pbox_base_screws(type, thickness = 0) //! Place the screws and
pbox_screw_positions(type) {
foot = pbox_foot(type);
if(foot)
color(pp4_colour)
stl_colour(pp4_colour)
foot(foot);
translate_z(foot ? foot_thickness(foot) : thickness)

View File

@ -147,7 +147,7 @@ assembly(str("PSU_shroud_", name)) {
translate_z(psu_shroud_height(type))
vflip()
color(pp1_colour) psu_shroud(type, cable_d, name, cables);
stl_colour(pp1_colour) psu_shroud(type, cable_d, name, cables);
psu_shroud_hole_positions(type)
vflip()

View File

@ -83,7 +83,7 @@ module ribbon_clamp_assembly(ways) pose([55, 180, 25]) //! Printed part with in
assembly(str("ribbon_clamp_", ways)) {
h = ribbon_clamp_height();
color(pp1_colour) render()
stl_colour(pp1_colour) render()
translate_z(h) vflip() ribbon_clamp(ways);
ribbon_clamp_hole_positions(ways)
@ -103,7 +103,7 @@ module ribbon_clamp_fastened_assembly(ways, thickness, screw = screw) { //! Clam
ribbon_clamp_assembly(ways);
color("red") translate_z(tape_thickness / 2)
stl_colour("red") translate_z(tape_thickness / 2)
cube([tape_l, tape_width, tape_thickness], center = true);
ribbon_clamp_hole_positions(ways)

View File

@ -62,7 +62,7 @@ module screw_knob_assembly(screw, length) //! Assembly with the screw in place
assembly(str("screw_knob_M", 20 * screw_radius(screw), "_", length)) {
translate_z(knob_height)
vflip()
color(pp1_colour) screw_knob(screw);
stl_colour(pp1_colour) screw_knob(screw);
translate_z(knob_height - knob_nut_trap_depth(screw))
rotate(-45)

View File

@ -92,7 +92,7 @@ assembly(str("socket_box_", type[0])) {
screw = mains_socket_screw(type);
insert = screw_insert(screw);
color(pp1_colour) render() socket_box(type);
stl_colour(pp1_colour) render() socket_box(type);
mains_socket_hole_positions(type)
translate_z(height)

View File

@ -111,7 +111,7 @@ assembly(str("SSR_shroud_", name)) {
translate_z(ssr_shroud_height(type))
vflip()
color(pp1_colour) ssr_shroud(type, cable_d, name);
stl_colour(pp1_colour) ssr_shroud(type, cable_d, name);
ssr_shroud_hole_positions(type)
insert(insert);
@ -135,7 +135,7 @@ module ssr_shroud_fastened_assembly(type, cable_d, thickness, name) //! Assembly
*translate_z(cable_d / 2)
rotate([90, 0, 0])
color(grey20)
stl_colour(grey20)
cylinder(d = cable_d, h = 20, center = true);
}
}

View File

@ -160,7 +160,7 @@ module strap_end(type = strap) { //! Generate the STL for end piece
//
module strap_end_assembly(type = strap)
assembly("strap_end") {
color(pp1_colour)
stl_colour(pp1_colour)
strap_end(type);
translate_z(strap_height(type) + strap_key(type))
@ -175,7 +175,7 @@ module strap_assembly(length, type = strap) { //! Assembly with screws in place
screw_length = screw_shorter_than(washer_thickness(washer) + washer_thickness(penny) + insert_length(insert) + panel_clearance + counterbore);
color(pp4_colour) strap(length, type);
stl_colour(pp4_colour) strap(length, type);
strap_screw_positions(length, type)
translate_z(strap_height(type))

View File

@ -5209,6 +5209,7 @@ The resulting flat BOM is shown but heirachical BOMs are also generated for real
| ```pose_hflip(exploded = undef)``` | Pose an STL or assembly for rendering to png by flipping around the Y axis, ```exploded = true for``` just the exploded view or ```false``` for unexploded only. |
| ```pose_vflip(exploded = undef)``` | Pose an STL or assembly for rendering to png by flipping around the X axis, ```exploded = true for``` just the exploded view or ```false``` for unexploded only. |
| ```stl(name)``` | Name an stl that will appear on the BOM, there needs to a module named ```<name>_stl``` to make it |
| ```stl_colour(colour)``` | Colour an stl where it is placed in an assembly |
| ```vitamin(description)``` | Describe a vitamin for the BOM entry and precede it with a module call that creates it, eg. "wigit(42): Type 42 widget" |
![bom](tests/png/bom.png)

View File

@ -46,6 +46,16 @@ def find_scad_file(mname):
return filename
return None
class Part:
def __init__(self, args):
self.count = 1
for arg in args:
arg = arg.replace('true', 'True').replace('false', 'False').replace('undef', 'None')
exec('self.' + arg)
def data(self):
return self.__dict__
class BOM:
def __init__(self, name):
self.name = name
@ -65,12 +75,17 @@ class BOM:
"big" : self.big,
"count" : self.count,
"assemblies" : assemblies,
"vitamins" : self.vitamins,
"printed" : self.printed,
"routed" : self.routed
"vitamins" : {v : self.vitamins[v].data() for v in self.vitamins},
"printed" : {p : self.printed[p].data() for p in self.printed},
"routed" : {r : self.routed[r].data() for r in self.routed}
}
def add_part(self, s):
args = []
match = re.match(r'^(.*?\.stl)\((.*)\)$', s) #look for name.stl(...)
if match:
s = match.group(1)
args = [match.group(2)]
if s[-4:] == ".stl":
parts = self.printed
else:
@ -79,9 +94,9 @@ class BOM:
else:
parts = self.vitamins
if s in parts:
parts[s] += 1
parts[s].count += 1
else:
parts[s] = 1
parts[s] = Part(args)
def add_assembly(self, ass, args = []):
if ass in self.assemblies:
@ -126,10 +141,10 @@ class BOM:
for ass in sorted(self.assemblies):
bom = self.assemblies[ass]
if part in bom.vitamins:
file.write("%2d|" % bom.vitamins[part])
file.write("%2d|" % bom.vitamins[part].count)
else:
file.write(" |")
print("%3d" % self.vitamins[part], description, file=file)
print("%3d" % self.vitamins[part].count, description, file=file)
if self.printed:
if self.vitamins:
@ -140,10 +155,10 @@ class BOM:
for ass in sorted(self.assemblies):
bom = self.assemblies[ass]
if part in bom.printed:
file.write("%2d|" % bom.printed[part])
file.write("%2d|" % bom.printed[part].count)
else:
file.write(" |")
print("%3d" % self.printed[part], part, file=file)
print("%3d" % self.printed[part].count, part, file=file)
if self.routed:
print(file=file)
@ -153,10 +168,10 @@ class BOM:
for ass in sorted(self.assemblies):
bom = self.assemblies[ass]
if part in bom.routed:
file.write("%2d|" % bom.routed[part])
file.write("%2d|" % bom.routed[part].count)
else:
file.write(" |")
print("%3d" % self.routed[part], part, file=file)
print("%3d" % self.routed[part].count, part, file=file)
if self.assemblies:
print(file=file)

View File

@ -29,6 +29,7 @@ import openscad
from tests import do_cmd, update_image, colour_scheme, background
from deps import mtime
from colorama import init
import json
def usage():
print("\nusage:\n\trender [target_config] - Render images of the stl and dxf files.");
@ -48,6 +49,20 @@ def render(target, type):
#
parts = bom_to_parts(bom_dir, type)
#
# Read the json bom to get the colours
#
bom_file = bom_dir + "/bom.json"
with open(bom_file) as json_file:
flat_bom = json.load(json_file)
things = { 'stl' : 'printed', 'dxf' : 'routed' }[type]
colours = {}
for ass in flat_bom:
for part in ass[things]:
obj = ass[things][part]
if "colour" in obj:
colours[part] = obj["colour"]
#
# Remove unused png files
#
for file in os.listdir(target_dir):
@ -55,7 +70,9 @@ def render(target, type):
if not file[:-4] + '.' + type in parts:
print("Removing %s" % file)
os.remove(target_dir + '/' + file)
#
# Render the parts
#
for part in parts:
part_file = target_dir + '/' + part
png_name = target_dir + '/' + part[:-4] + '.png'
@ -64,8 +81,13 @@ def render(target, type):
#
if mtime(part_file) > mtime(png_name):
png_maker_name = "png.scad"
colour = [0, 146/255, 0]
if part in colours:
colour = colours[part]
if not '[' in colour:
colour = '"' + colour + '"'
with open(png_maker_name, "w") as f:
f.write('color([0, 146/255, 0]) import("%s");\n' % part_file)
f.write('color(%s) import("%s");\n' % (colour, part_file))
cam = "--camera=0,0,0,70,0,315,500" if type == 'stl' else "--camera=0,0,0,0,0,0,500"
render = "--preview" if type == 'stl' else "--render"
tmp_name = 'tmp.png'

View File

@ -232,9 +232,10 @@ def tests(tests):
j = name.find(']]') + 2
name = name.replace(name[i : j], '[ ... ]')
desc = vit[1]
body += ['| %3d | %s | %s |' % (things[item], name, desc)]
body += ['| %3d | %s | %s |' % (things[item]["count"], name, desc)]
else:
body += ['| %3d | %s |' % (things[item], name)]
count = things[item] if thing == 'assemblies' else things[item]["count"]
body += ['| %3d | %s |' % (count, name)]
body += ['']
body += ['\n<a href="#top">Top</a>']

View File

@ -248,9 +248,9 @@ def views(target, do_assemblies = None):
for t in types:
for thing in ass[t]:
if thing in things[t]:
things[t][thing] += ass[t][thing]
things[t][thing] += ass[t][thing]["count"]
else:
things[t][thing] = ass[t][thing]
things[t][thing] = ass[t][thing]["count"]
for ass in flat_bom:
name = titalise(ass["name"][:-9]).replace(' ','&nbsp;')
print('| <span style="writing-mode: vertical-rl; text-orientation: mixed;">%s</span> ' % name, file = doc_file, end = '')
@ -265,7 +265,7 @@ def views(target, do_assemblies = None):
print(('| ' * len(flat_bom) + '| | **%s** |') % heading, file = doc_file)
for thing in sorted(things[t], key = lambda s: s.split(":")[-1]):
for ass in flat_bom:
count = ass[t][thing] if thing in ass[t] else 0
count = ass[t][thing]["count"] if thing in ass[t] else 0
print('| %s ' % pad(count if count else '.', 2, 1), file = doc_file, end = '')
name = ass["name"]
if name in totals:
@ -301,7 +301,7 @@ def views(target, do_assemblies = None):
print("|Qty|Description|", file = doc_file)
print("|---:|:----------|", file = doc_file)
for v in sorted(vitamins, key = lambda s: s.split(":")[-1]):
print("|%d|%s|" % (vitamins[v], v.split(":")[1]), file = doc_file)
print("|%d|%s|" % (vitamins[v]["count"], v.split(":")[1]), file = doc_file)
print("\n", file = doc_file)
printed = ass["printed"]
@ -310,7 +310,7 @@ def views(target, do_assemblies = None):
keys = sorted(list(printed.keys()))
for i in range(len(keys)):
p = keys[i]
print('%s %d x %s |' % ('\n|' if not (i % 3) else '', printed[p], p), file = doc_file, end = '')
print('%s %d x %s |' % ('\n|' if not (i % 3) else '', printed[p]["count"], p), file = doc_file, end = '')
if (i % 3) == 2 or i == len(printed) - 1:
n = (i % 3) + 1
print('\n|%s' % ('---|' * n), file = doc_file)
@ -326,7 +326,7 @@ def views(target, do_assemblies = None):
keys = sorted(list(routed.keys()))
for i in range(len(keys)):
r = keys[i]
print('%s %d x %s |' % ('\n|' if not (i % 3) else '', routed[r], r), file = doc_file, end = '')
print('%s %d x %s |' % ('\n|' if not (i % 3) else '', routed[r]["count"], r), file = doc_file, end = '')
if (i % 3) == 2 or i == len(routed) - 1:
n = (i % 3) + 1
print('\n|%s' % ('---|' * n), file = doc_file)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 95 KiB

View File

@ -101,9 +101,17 @@ module assembly(name, big = undef) { //! Name an assembly that will appear on
echo(str("~}", name, "_assembly"));
}
module stl_colour(colour) { //! Colour an stl where it is placed in an assembly
$stl_colour = colour;
color(colour)
children();
}
module stl(name) { //! Name an stl that will appear on the BOM, there needs to a module named ```<name>_stl``` to make it
if(bom_mode())
echo(str("~", name, ".stl"));
if(bom_mode()) {
colour = is_undef($stl_colour) ? pp1_colour : $stl_colour;
echo(str("~", name, ".stl(colour='", colour, "')"));
}
}
module dxf(name) { //! Name a dxf that will appear on the BOM, there needs to a module named ```<name>_dxf``` to make it