CNC Box (Finger) Joint Box

Another consideration is I may try a totally different tool — one thing I’ve considered is a LiveCode or Python front-end which would allow better calculation of the settings, and which could then generate the appropriate .c2d file — if OpenSCAD were Applescriptable, I’d probably use that on the Mac side of the house and then port that to LiveCode for the PC implementation.

I really don’t understand why it’s so difficult to program things on modern systems. Really wish that it were as easy as on Oberon, or even on NeXTstep when one could use Display PostScript for this sort of thing.

Will,

I figured if I am going to participate in the Kickstarter, I might as well get my toes wet in OpenSCAD, so I went and downloaded it (for Windows10, that complained about a “dangerously unknown” exe file…sigh)

Side note: the defaut proposed version to download is 2015.03, which did not sound like a good sign. Indeed it does not have the Customizer. So I downloaded the latest experimental version, 2019.01-RC4. What happened during March 2015 an Jan 2019 ?.. no releases during 4 years ?

I opened the fingerjoint box, and love the interactive view (what’s more geeky than doing 3D modeling in code ! :slight_smile: )

But I then I tried saving the JSON file after creating a preset ("+" button), when I click “save preset”…nothing happens (at all, no log, no window, nothing). No json file saved anywhere that I could find.

Any idea what I missed ? which version of OpenSCAD are you using so that I try the exact same ?

That’s great! I’m going to be working on some documentation for this over the weekend. OpenSCAD seems to be in on-going development — I think there’s been some discussion of why no release recently in the discussion list/forum, but I haven’t tracked that.

I used a development snapshot: http://www.openscad.org/downloads.html#snapshots

and downloaded the 64-bit version with an installer: https://files.openscad.org/snapshots/OpenSCAD-2019.01-RC4-x86-64-Installer.exe

The JSON file should be saved in the same directory that the .scad file cncboxfingerjoint.scad is in.

1 Like

allright, my bad, the JSON file actually was generated, I had downloaded the .scad file into an obscure subdirectory, and searched for the wrong name. So all is good, thanks.

I’m game for trying to install the Lua/Tex/METAPOST thingy if you need a beta tester.

1 Like

Okay, thanks! I’ll put those files up this evening in the course of documenting things — in the meanwhile, download and install MikTeX:

https://miktex.org/

Probably the best way to do that is the all-in-one installer from https://www.lyx.org/

Here’s the .tex file — unzip and place it and the JSON.lua file (code for importing .json files into Lua) in the same directory as the .scad and .json file, the typeset it — that will make a .pdf which you can import into the drawing tool of your choice (I use Inkscape) and then resave as an SVG.

cncboxfingerjoint-tex.zip (20.9 KB)

I’m just stepping in here, but my understanding (followed up by a cursory reading of the .tex file) is that the output (in this case, a PDF) is generated by the .tex file solely from the parameters in the JSON data, correct? I should be able to write myself a bit of python to load the JSON data and generate an SVG directly, which could also avail itself to being a direct Inkscape import extension (since Inkscape import extensions in python are nothing more complicated than python scripts that take a filename and optional parameters as input, “do stuff”, and output an SVG to stdout).

I’d like to play around a bit, but since I’m currently just starting up the Zbrush+drawing tablet learning curve for a potentially personally pivotal project, I don’t really want to start installing OpenSCAD, MikTeX, et al (as that would certainly end up in an extended digression… sounds like way too much fun). Might I be able to get a zip of an example JSON file and corresponding generated PDF so I can skip the main parts and play around with some python processing?

1 Like

@ClayJar: this was on the tip of my tongue, but I self-censored myself to not commit to yet another rabbit hole :slight_smile: Very cool if you step in on this one, let’s see what Will thinks.

@Will:
So I installed MikTex, unpacked the lua & tex files, launched “TeXworks” UI (is that the right way to execute the tex file ?) then launched execution/rendering and got this error about LuaTeX not being found (even though the MikTex console / packages section shows that I do have Luatex85/Luatexbase installed ?):

This is pdfTeX, Version 3.14159265-2.6-1.40.20 (MiKTeX 2.9.7000 64-bit)
entering extended mode
(C:/Users/Julien/Desktop/temp/testWillTEXLUA/cncboxfingerjoint.tex
LaTeX2e <2018-12-01>

======================================================================
starting package maintenance...
installation directory: "C:\Program Files\MiKTeX 2.9"
package repository: http://mirror.ibcp.fr/pub/CTAN/systems/win32/miktex/tm/packages/
visiting repository http://mirror.ibcp.fr/pub/CTAN/systems/win32/miktex/tm/packages/...
repository type: remote package repository
loading package repository manifest...
downloading http://mirror.ibcp.fr/pub/CTAN/systems/win32/miktex/tm/packages/miktex-zzdb1-2.9.tar.lzma...
0.19 MB, 0.29 Mbit/s
package repository digest: fe01a3e779a07ee6db226628bc13c979
going to download 176793 bytes
going to install 5 file(s) (1 package(s))
downloading http://mirror.ibcp.fr/pub/CTAN/systems/win32/miktex/tm/packages/luatex85.tar.lzma...
0.18 MB, 9.69 Mbit/s
extracting files from luatex85.tar.lzma...
======================================================================
("C:\Program Files\MiKTeX 2.9\tex/generic/luatex85\luatex85.sty")
("C:\Program Files\MiKTeX 2.9\tex/latex/base\article.cls"
Document Class: article 2018/09/03 v1.4i Standard LaTeX document class
("C:\Program Files\MiKTeX 2.9\tex/latex/base\size10.clo"))
======================================================================
starting package maintenance...
installation directory: "C:\Program Files\MiKTeX 2.9"
package repository: http://mirror.ibcp.fr/pub/CTAN/systems/win32/miktex/tm/packages/
package repository digest: fe01a3e779a07ee6db226628bc13c979
going to download 425322 bytes
going to install 6 file(s) (1 package(s))
downloading http://mirror.ibcp.fr/pub/CTAN/systems/win32/miktex/tm/packages/luacode.tar.lzma...
0.43 MB, 14.18 Mbit/s
extracting files from luacode.tar.lzma...
======================================================================

("C:\Program Files\MiKTeX 2.9\tex/lualatex/luacode\luacode.sty"
("C:\Program Files\MiKTeX 2.9\tex/generic/oberdiek\ifluatex.sty")

! Package luacode Error: LuaTeX is required for this package. Aborting..

See the luacode package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.51     to prevent additional errors.}
                                       
?

EDIT: which configuration should be used in the drop-down menu ? It was initially set to “pdfLatex+MakeIndex+BibTeX”, I tried changing to LuaLaTeX+MakeIndex+BibTeX, which got me other kind of errors, see screenshot, but I have no idea what I am doing with this so enlighten me please :slight_smile:

@ClayJar Correct, the LuaLaTeX/METAPOST stuff looks at the JSON file and creates a page based on that — METAPOST can go straight to SVG as well, but there’s no reason one couldn’t use pretty much any tool for this. I’ve been looking at using TPL (Tool Path Language) from: https://tplang.org/ which is based on JavaScript.

Here: cncfingerjointbox_JSON_PDF.zip (8.7 KB)

I need to work out some things there — in particular, the current placement of the lines for the joinery (discussed previously in this thread) is only suited for very thin stock.

Other tools which were considered were LiveCode and Nodebox and Processing.

@Julien My apologies — should have mentioned just using plain LuaLaTeX — there’s no need for any index or other processing — hopefully once you make that change it’ll run to completion. For production I would probably put all the referenced files into one .zip archive so that it could run in the background.

Selecting “LuaLaTeX” and rerunning got me this: any idea what I am still doing wrong ?

This is LuaTeX, Version 1.10.0 (MiKTeX 2.9.7000 64-bit) 
 restricted system commands enabled.
(./cncboxfingerjoint.tex
LaTeX2e <2018-12-01>

luaotfload | main : initialization completed in 1.050 seconds
("C:/Program Files/MiKTeX 2.9/tex/generic/luatex85/luatex85.sty")
("C:/Program Files/MiKTeX 2.9/tex/latex/base/article.cls"
Document Class: article 2018/09/03 v1.4i Standard LaTeX document class
("C:/Program Files/MiKTeX 2.9/tex/latex/base/size10.clo"))
("C:/Program Files/MiKTeX 2.9/tex/lualatex/luacode/luacode.sty"
("C:/Program Files/MiKTeX 2.9/tex/generic/oberdiek/ifluatex.sty")
("C:/Program Files/MiKTeX 2.9/tex/luatex/luatexbase/luatexbase.sty"
("C:/Program Files/MiKTeX 2.9/tex/luatex/ctablestack/ctablestack.sty")))
("C:/Program Files/MiKTeX 2.9/tex/luatex/luamplib/luamplib.sty")
("C:/Program Files/MiKTeX 2.9/tex/latex/tools/calc.sty")
("C:/Program Files/MiKTeX 2.9/tex/latex/xcolor/xcolor.sty"
("C:/Program Files/MiKTeX 2.9/tex/latex/graphics-cfg/color.cfg")
("C:/Program Files/MiKTeX 2.9/tex/latex/graphics-def/luatex.def"))
("C:/Program Files/MiKTeX 2.9/tex/latex/forloop/forloop.sty"
("C:/Program Files/MiKTeX 2.9/tex/latex/base/ifthen.sty"))[\directlua]:9: attem
pt to index a nil value (field 'Sample')
stack traceback:
	[\directlua]:9: in main chunk.
\luacode@dbg@exec ...code@maybe@printdbg {#1} #1 }
                                                  
l.185 \end{luacode}

Oh yes, there’s one other thing.

I disabled the \typein of querying for which Saved Preset would be used:

%\typein[\boxspecification]{What preset is to be used?}

and instead, hard-coded it to:

\newcommand{\boxspecification}{Sample}

You’ll need to either name your pre-set “Sample”, or change that line in the .tex file to match your name — please avoid using underscores or special characters.

Another reason to use METAPOST (besides the fact that I want to learn it so I can leverage that to learn METAFONT so as to do a typeface design I’ve been working on for decades) is that it allows analysis of paths and intersection, which some of the boxes require:

Renamed my preset to “Sample”, and success:

So to sum up what I did for other members, the workflow is easy enough:

  1. install OpenSCAD (2019 RC4, not the latest stable 2015 version)
  2. open the .scad file, modify the parameters in the Customizer, then create a “Sample” preset with the “+” button, hit “Save Preset” to get the JSON file.
  3. install MikTeX, launch TexWorks, open the .tex file, select “LuaLaTeX” in the drop-down menu, hit the “play” button, and voilà, the PDF.

Not having to open Inkscape to get from the PDF to an SVG would be a good improvment to the workflow.

1 Like

METAPOST will directly create an SVG — I just need to structure the files to allow for that.

1 Like

Hey, Will, will one be able to make the finger cuts a bit deeper - and before they come out of the fixture use a 90 deg Vbit to put a chamfer on the ends of the fingers so they will be proud, and finished, when assembled?

I’m still not sure how you’re doing this as once it stated that all four pieces should be milled at the same time and then it was two. Have you done a video - or do one when this is all completed?

Thanks for the work. Don’t know where your kick-starter is located, but I’ll kick in a few bucks if it is still open. Location??

Thanks!

Working on a video and set of photos now.

The Kickstarter is at: https://www.kickstarter.com/projects/designinto3d/design-into-3d-a-book-of-customizable-project-desi

Leaving the fingers proud and chamfering is an interesting idea — it’d make assembly easier if nothing else — I’ll see if I can work that in as an option.

Hit Kickstarter. Thanks for the link.

1 Like

Working up a design:

which makes this:

cncboxfingerjoint-cigarbox.pdf (8.7 KB)

which can then be opened in Inkscape and resaved as an SVG:

cncboxfingerjoint-cigarbox

Which can then be opened in Carbide Create. Use the two boxes which have three boxes to cut the sides and front and back — the top and bottom can be cut directly from the geometry for them. It will be necessary to draw in the geometry for the dividers.

Then use the structures at the top left to cut the fingerjoints using the fixture at: https://cutrocket.com/p/5cb25f3380844/

1 Like

That .svg will need to be sized down to 75% of the size

The sides will need to have mirrored slots for the sliding lid added:

cncfingerjointbox_cigarbox_sides_front-back.c2d (43.5 KB)