commit 73663d861b50e0af335b579c203b5e5742d854ff Author: Diogo Diniz Date: Sat Aug 15 23:24:21 2026 +0100 chore: Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..73a1085 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +out.scad +**__pycache__/ diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..1397c27 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,38 @@ +[build-system] +requires = ["setuptools", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "tag_3d" +version = "0.1.0" +authors = [{ name = "Didas72" }] +requires-python = ">=3.9" +dependencies = [ "solidpython2 == 2.1.*", "libdsps" ] + +[tool.ruff] +line-length = 120 +indent-width = 4 + +[tool.ruff.lint] +select = ["ALL"] +ignore = [ + # Conflicting + "D203", + "D212", + "COM812", + + # Allow 'TODO' and 'HACK' in code + "FIX002", + "TD002", + "TD003", + "FIX004", + + "CPY001" +] + +[tool.ruff.format] +quote-style = "double" +indent-style = "space" + +[tool.mypy] +strict = true diff --git a/tag_3d/__init__.py b/tag_3d/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tag_3d/__main__.py b/tag_3d/__main__.py new file mode 100644 index 0000000..5994ffb --- /dev/null +++ b/tag_3d/__main__.py @@ -0,0 +1,13 @@ +# noqa: D100 + +from solid2 import scad_render_to_file + +from tag_3d.proto import gen_tag + + +def _main() -> None: + tag = gen_tag() + scad_render_to_file(tag, "out.scad") + +if __name__ == "__main__": + _main() diff --git a/tag_3d/proto.py b/tag_3d/proto.py new file mode 100644 index 0000000..6e5647c --- /dev/null +++ b/tag_3d/proto.py @@ -0,0 +1,65 @@ +"""Prototype model for scooby tag.""" + +import solid2 as sp + +TAG_DEPTH = 25.00 + +BONE_CORE_WIDTH = 55.00 +BONE_CORE_HEIGHT = 45.00 +BONE_JOINT_R = 18.00 +BONE_JOINT_DIST_RATIO = .6 + +DISP_OUT_HEIGHT = 31.80 +DISP_OUT_WIDTH = 37.32 +DISP_VIS_HEIGHT = 28.40 +DISP_VIS_WIDTH = 28.40 +DISP_VIS_THICK = 1.00 +DISP_THICK = 1.00 + +SEP_THICK = 3.00 + +MICRO_DEPTH = 16.00 +MICRO_WIDTH = 47.00 +MICRO_HEIGHT = 23.00 + +XX = .2 + +def gen_bone() -> sp.OpenSCADObjectPlus: + core = sp.up(TAG_DEPTH/2)(sp.cube([BONE_CORE_WIDTH, BONE_CORE_HEIGHT, TAG_DEPTH], center=True)) + + joint = sp.cylinder(TAG_DEPTH, r=BONE_JOINT_R, center=False) + joint2 = sp.union()( + sp.forward(+BONE_JOINT_R*BONE_JOINT_DIST_RATIO)(joint), + sp.forward(-BONE_JOINT_R*BONE_JOINT_DIST_RATIO)(joint), + ) + joint_l = sp.left(BONE_CORE_WIDTH/2)(joint2) + joint_r = sp.right(BONE_CORE_WIDTH/2)(joint2) + + bone = sp.union()( + core, + joint_l, + joint_r, + ) + return bone + +def gen_display_mask() -> sp.OpenSCADObjectPlus: + visible = sp.up(DISP_VIS_THICK/2)(sp.cube([DISP_VIS_WIDTH, DISP_VIS_HEIGHT, DISP_VIS_THICK+XX], center=True)) + visible = sp.up(DISP_THICK)(visible) + fit = sp.up(DISP_THICK/2)(sp.cube([DISP_OUT_WIDTH, DISP_OUT_HEIGHT, DISP_THICK], center=True)) + fit = sp.left((DISP_OUT_WIDTH-DISP_VIS_WIDTH)/2)(fit) + mask = sp.union()(visible, fit) + mask = sp.forward((DISP_OUT_HEIGHT-DISP_VIS_HEIGHT)/4)(mask) + return mask + +def gen_tag() -> sp.OpenSCADObjectPlus: + bone = gen_bone() + + positive = sp.union()( + bone + ) + + mask = gen_display_mask() + mask = sp.up(TAG_DEPTH-DISP_THICK-DISP_VIS_THICK)(mask) + + final = positive - mask + return final