Openjscad.xyz to build some shelves

I did a thing.

The output of jscad

A thing (not quite finished, more vertical support needed)

It was an ask from my family. I did the initial planning in.. code!

https://github.com/sunnywiz/openjscad_xyz_stuff/blob/costco-box/costcoBoxes.js

Side effect of the code is it tells me how many 2x4x8’s to buy, and attempts to plan the cuts in them:

floor 0  of length  48.5  in piece  0 
floor 1  of length  48.5  in piece  1 
floor 2  of length  35  in piece  0 
floor 3  of length  35  in piece  1 
floor 4  of length  35  in piece  2 
vertical 0  of length  52  in piece  2 
vertical 1  of length  52  in piece  3 
vertical 2  of length  31  in piece  3 
vertical 3  of length  31  in piece  4 
vertical 4  of length  52  in piece  4 
vertical 5  of length  52  in piece  5 
vertical 6  of length  31  in piece  5 
vertical 7  of length  31  in piece  6 
vertical 8  of length  52  in piece  6 
vertical 9  of length  52  in piece  7 
vertical 10  of length  31  in piece  7 
vertical 11  of length  31  in piece  8 
ledge 0  of length  38  in piece  8 
ledge 1  of length  38  in piece  9 
ledge 2  of length  38  in piece  9 
ledge 3  of length  38  in piece  10 
ledge 4  of length  38  in piece  10 
ledge 5  of length  38  in piece  11 
ledge 6  of length  38  in piece  11 
ledge 7  of length  38  in piece  12 
ledge 8  of length  38  in piece  12 
ledge 9  of length  38  in piece  13 
ledge 10  of length  38  in piece  13 
ledge 11  of length  38  in piece  14 
top 0  of length  48.5  in piece  14 
top 1  of length  48.5  in piece  15 

There’s a bug though. I should have specified the width of the boxes as 22.5″, not 22″. Also, i had to re-measure where the rails go – ended up with the box at less than 17″, and the first rail at 15″, it was 15″, 32″, and 49″. Also, i really had to reinforce the vertical stuff so it didn’t .. parallelogram to the side.

The code is parametric of course. I plan to use the same code for the slightly smaller boxes. But i might use a smaller size of wood – this was overkill and way too heavy.

3D Printing Revisited

It would take too long (i don’t have the time) to write up the whole process, so to sum it up:

  • Dude posts video about 3d printing organizational trays (the guy who de-brands everything)
  • Wife shows me video on instagram
  • I say i can do that
  • I get approval for a 3D printer

I’m condensing the rest, so if you don’t know the words, well.. sorry. Research. Elegoo Neptune 3D Max. Not available. Sovol SV04 IDEX. Haven’t used 2nd extruder yet. Kinda stringy.

I had a booger of a time trying to get the first layer dialed in. Video:

openjscad is gone replaced with jscad v2, relearned it – github – https://github.com/sunnywiz/openjscad_xyz_stuff/releases/tag/print-1 –

I wish i could paste a link directly to the code rendering the model, but you can only do that for bundled single-js files, not project files at the moment.

Along the way I experimented with using Lego’s as a 3d measuring tool. There are several things i would improve about the above print. But that’s 2-3 other blog posts i don’t currently have time to write.

Now, with that out of the way, i’m trying to Dial the printer in more. The printer comes with a variant of Cura; i’m trying to bring it up with SuperSlicer (thank you Teaching Tech) which is a Prusa. I found somebody else’s config tonight, got that going, going through the calibration prints in that tonight. I have this problem with … something is gloopy and a bunch of filament goes bloop at the start of the print. Retraction print is starting now, but i think i need something along the lines of Coasting. But that’s in Cura, need to find that in Prusa.

My hope is to use the prusa-line of colorizing / multimaterial to make some interesting colorized things.

Future projects:

  • There’s a door latch strike thingy that needs some modification. That needs ABS or PETG.
  • There’s some bathroom organization stuff that I want to custom-print holders for
  • Molly has a pink necklace thing that needs some help, but that might need TPU.
  • Tons of little toy/trinkets for the grandkids. I’m holding back, so far i’ve only shown them a robot dude and flexirex.
  • I would love to redo my street map thing with the 300x300mm bed in higher detail, but i’d have to rewrite that with jscad v2. And of course, multicolor somehow?

That’s about it for now. Cheers

Fun Things Lately

I don’t know when I’ll have time to do a proper update, so here’s a list-dump of geeky stuff I’ve been up to lately:

  • I started playing Cities: Skylines two days ago.  My brain is processing all kinds of patterns around roadways and pedestrian paths and stuff like that. 
    • imageimage
    • Left was my 6th or so city.. Right is my 8th or so city.  I keep trying to get things “perfect”. 
    • I made a chart of “Noise Polluting” vs “Ground Polluting”, and another chart of “Who wants to be near whom”. 
    • My best idea so far is a big Triangle with Commercial, Industry, and Residential at each corner.
  • My 3D printer broke, and then resurrected itself – there’s a loose power wire going to the extruder.  Its jiggered so that it works for now.
  • I volunteered to make a unique 3D print for a fundraiser basket.  I started off in blender, ended up doing it mostly in OpenJSCAD.  Here are the draft (left) and almost-final-but-slight-oops (right):
  • At work, not much is new.    Still working in an fairly simple MVC app, which deals with gathering user input, filling out PDF’s, and submitting information to various external services.
    • A little bit of PDF parsing and modification that I’d never done before.
    • A little bit of image-detection using some System.Drawing libraries (to detect if what the user uploaded was a valid image)
    • Mostly churning through smaller tasks in preparation for a release.
    • A lot of dealing with configuration migration problems.   Finding a way to export and import configurations between environments so that changes only need to be hand-typed once, and then can be copied from environment to environment. 
    • Next week I get to start investigating 3 services I’ve never talked to before.  Exciting!

Using OpenJSCAD to print a house (2/N): Small Print!

I advanced the code significantly:

https://github.com/sunnywiz/housejscad/releases/tag/Post2

  • I introduced a “TwoD” class to take the pain out of working in the 2-D character space.
  • I traced out my house’s 4th floor plan to a text file, so I’m dealing with the real thing now rather than test data.
  • I got my 3D printer back up and running – didn’t need any re-calibration after 6 months of no-use.  I had to go read the powerpoint of the presentation I gave a while back to re-remember what to do.
  • The result is this print, which is 1:72 scale, and took about 4 hours (1 failed print included):  

image

Its in two pieces so that:

  • I don’t have to print support structures for the doorways and windows
  • We see things at eye-level, or about 5.5 feet; the model is 8 feet; this makes the model feel overly tall.  With a removable section a little lower, this becomes more “playable”. (I need to move the cut line up though to be at about 5 feet.  Or, move the windows down a bit)

I’ll do a full “How To” video at some point in the future – I’m not quite done yet.  There’s some bleeding edge stuff in the “cuts” branch at the moment:

  • I’ve learned how to do real drag-and-drop libraries, in a separate file, which will work with OpenJSCAD
  • I’m working on a cutting algorithm that will let me cut with tabs.  Its workable now, but needs some fine tuning on gap distances.
  • We’ve (wife and I) decided to do the final print in 1:48 scale – there’s a lot of toy furniture out there available at that scale.  And it will be printed in white.

More to follow at some point.

Using OpenJSCAD to Print a House (1/N)

Since before I got my 3D printer, I’ve wanted to make a scale replica of my house.   I tried doing it with Legos once – it was cost prohibitive.

I came up with a workflow where I drew out the entire house in SweetHome3D, and then exported that, but I ran into manifold problems and stuff like that.

So I did one of the floors in Sketchup.  However, that was a painfully task – and the resulting model was still too big (I want 1:24 or 1:36 scale).  I’d have to slice up the model to print out individual pieces, which means I wanted to cut them in such a way that they joined together with some kind of self-aligning joint.

I was about to try it again, but the sheer amount of detail that I had to go through kept holding me back.  I wanted a formula.

A recent blog post brought my attention to OpenJSCAD. and an Idea formed in my head:

Convert THIS: image
Into THIS: image

I had tried to do something similar in OpenSCAD before, however, because that language doesn’t have procedural elements, I ran into all kinds of problems.   Fresh new start!

So I set about to do it.

As you can see by this screenshot, I succeeded.

The code is here: https://github.com/sunnywiz/housejscad.  It took me about 2 hours.   You can see the commit log, I committed every time I figured even a small piece of the puzzle out.

UPDATE 2/1/2015:  the code as of this blog post is tagged with “Post1”, ie https://github.com/sunnywiz/housejscad/releases/tag/Post1  — the code has since evolved. Another blog post is in the works.  I guess I could “release to main” every time I do a blog post.  Heh.

The Code

  • Provide a translation of map character to 1x1x10 primitive anchored at 0,0,0
  • convert the template into a 2D Array, so that I can look for chunks of repeated stuff.
  • Walk the pattern, looking for chunks.  Rather than get fancy, I made a list of all chunk sizes from 6×6 down to 2×1, and check for each one at a time.
    • There are more efficient ways to do this, but IAGNI.
  • If a chunk is found, generate the primitive for that chunk, scale it up, and add it to the list.  “Consume” the characters which we just generated.
  • When all done, union everything together.

Notes about the Code

  • The resulting file is not manifold, however, NetFabb fixes that pretty easily and reliably.
  • The chunking is necessary if I want to represent steps in an area.    Otherwise, I didn’t need it.
  • You can define any mapping you want .. from a character to a function that returns a CSG.
  • Could probably use this to generate dungeon levels pretty easily.  Or, maybe take a game of NetHack and generate out the level?  Coolness!

Where would it go from here

  • Lay out an actual template of (part of) the house, and fine tune it from there.
    • Probably involve adding “and I want the result to be exactly 150 by 145mm” type scaling.
    • The functions will probably start taking arguments like (dx,dy) => so that the function can draw something intelligent for an area that is dx by dy in size.
    • I just noticed, the output is mirrored due to axes being different between R,C and Y,X
  • Preferably, I’d like to create a object / class that does this work, rather than the current style of coding.  IAGNI at the moment.  Then, maybe running in node, I could take the different floors and convert then into objects, and then do further manipulation on them..
    • Like slice them into top and bottom pieces.  Windows and doors print a lot better upside down – no support material necessary.
    • Would also need to slice them into horizontal pieces.  My build platform is limited to 6” square.
  • I live in a very 90-degree-angle house.   Thus, this kind of solution would work for me.  Sorry if you live in a circular, or slightly angled, house, this solution is not for you.    Buy me a house, and I’ll build you a solutiion. 😛
    • Seriously thinking about this.  I’d probably have a template of “points”, and then a language of “Draw a wall from A to D to E”;  and then “place a door on wall from A to D at the intersection of F”  or something like that.

A fun night of short and sweet coding.  I had to look up a lot of javascript primitives, mostly around arrays of arrays, and checking for undefined.

Some day I’ll get that “doll” house printed.  Then I can make scale sizes of all my furniture from Lego’s!  Fun fun.