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

Tree of Directions Revisited

image

We are in the process of possibly changing residences, so (during my coding fun times on Wednesday mornings with a friend) I revisited this project.  When I left it, it looked like this:

image

In fact, that was so not-cute that I had tried to go 2D with it instead.   

I revisited it, and went through several stages. 

First, I had to re-do how I called Google Maps – they no longer had a “free” tier that was usable, but they now had a “pay as you go” tier which equated to $5 for 1000 route requests.   No problem.  But, to keep costs low, I added a cache strategy so I didn’t ask for the same thing twice.  (Caveat: I think I forgot to turn off traffic, so different requests at different times were delayed by different amounts).

Then, I tried to create a surface underneath the plot.  I did this using some electrical engineering stuff I once helped somebody with – Here’s the plot + a surface underneath it.  Better, but not the awesome I was hoping:

image

I called that the “Minecraft” look.  (That’s a very rough draft with only 10×10, Its about the same at 50×50 except the squares are smaller). I went for something where I calculated the midpoint and drew a polyhedron from each of the four vertices, it looked a lot better:

image

(The previous were github previews of STL files; this is 3D Model Viewer built in to Windows).  

But, its still to .. Jaggedy.  So, I did a few things: First, I made it so rather than a spiderweb, I did a “ramp” effect (filling in underneath the path), as well as, I trimmed off all the residential streets (<30mph) at the ends of the routes.  This gave me a much better print, which is closer to what I had in mind when I started: something that showed “Which were the best ways to get places”:

image

However, I didn’t realize it, but I had done something even better.  Here’s Just the Ramps:

image

This is what I had been going for!  To heck with the surface print part!  You can see the mountain AND the detail!  This is commit a75a67 at https://github.com/sunnywiz/TreeOfDirection/.

Next direction — where I do the same thing for both addresses, and then figure out a way to do stuff in two colors (ie, two prints, but that join together).    In order to do this, I have to first force the bounding boxes to be exactly the same.

Also other things learned – 3D slicing has come a long way, I don’t need things to be perfectly combined as long as they don’t have holes in them.

Tree of Direction == Claws of Doom

https://github.com/sunnywiz/TreeOfDirection/commit/8058bc3598c189ded425f044bde39528e335d4fd

This was supposed to look pretty, but its not.

image

If I look at the simpler version in an isometric top down view, it might make more sense:

image

This is taking a grid of points on a map, and asking Google for the optimal route from home to that point.  This ends up creating .. I don’t know what to call it.  Its a decision tree, says Lamont .. yes, that’s a good name for it.   It also points out that Google has forgotten that a certain street doesn’t go through, and is incorrectly routing me down Old Henry Rd.

I’ve added something in red .. its the boundaries between “neighborhoods”.    Also note that 3 routes almost touch where my current work is, which is why there’s so much indecision about the “best” route to work.  Whereas, if you’re in the middle of a particular neighborhood, then there’s little choice.   This says the best way for me to get to the new work place will be 146->HurstBourne.

I think this is better done staying as  a 2D print.   I might need to learn.. PdfKit?   Something to generate PDF’s with.  I can get a poster-sized PDF printed for $5 via Office Max.     However, what I might do is overlay a few maps .. like “with heavy traffic” vs “without”, with transparency.   And a lot more detail.

I did learn a lot about using Google’s Directions API.   Very nice.  Polylines are pretty amazing – took a small string and it decoded into 22 points!!!   https://developers.google.com/maps/documentation/utilities/polylinealgorithm.

More to follow, I’m sure.

Commute, 3D Print: 2/3 gathering tracks, prototype

imageI should have written this a few weeks ago when this was fresh … but time has moved on.  I can’t pretend. 

Easiest way through it:

a) I did a prototype.  You can see a video of it .. pictures don’t do it justice .. at the following links:

https://www.instagram.com/p/BT-A9yrhNCv/

https://www.instagram.com/p/BT-BWXphF5I/

b) I used an Android program called “MyCarTracks” to then record my tracks.   I specifically used these options:

  • Autorecord – when turned on, mycartracks starts on boot and can be set up to start recording when the car starts moving.  This prunes out the GPS points when your car is on, but not moving yet.
  • It has the option of “don’t record a point till you’ve moved N*precision feet”, which gets rid of Jitter.  side effect though is time at stoplights ends up looking angular rather than vertical.
  • It allows track naming during or after the trip, to make it easier to identify tracks.
  • It allows export to CSV on the SD card; you don’t have to use their online service.

I tried to do the following routes – if Google Maps will let me:

image

It took several mornings – I had to go straight there, and NOT stop at Starbucks.   That can be hard, sometimes.   I also wanted to get it around 8am, during commute hours – mostly successful. 

c) I put all these maps together into my program, and …  ran into a problem.  Somehow, the code that writes out to a .STL file seems to stop at 32k.   So, I had to rejigger the code a bunch ..   I also changed it so that all the tracks would END “top-justified” at work, so that the shortest track was on top. 

image

d) And then it was time to stop.   I could have futzed with it forever ..   So, gulped, uploaded my image, ordered it printed.  And immediately:

imagee) Buyer’s regret.  Turns out I could have gotten it printed for significantly less money!   I found http://3dprintingpricecheck.com/  which led me to https://www.makexyz.com which supposedly would have printed my thing in resin for $27.90.    However, the dimensions .. maybe that’s smaller. 

So I called it “a learning experience”, and let it go, archived the project, and started a new one.

All the code is at http://github.com/sunnywiz/commute3d.  Including the final .STL (and most of the intermediate ones as well) and my GPS logs.

I’ll post some more pics and video when the print arrives.

Commute 3D print: 1/3: nodejs, openjscad, vscode

I have had a project in my brain for a long time – I think I first mentioned it in 2013*

The problem is, it wouldn’t go away.  It started to .. stink.  In my mind, stale, and stinking, and in my mind.   It had to be done.

The gist of the project is:

  • Take several ways of driving to work
  • Plot them out in 3D space with Time on the Z-Axis, in a virtual race as it were
  • Should be able to see things like stoplights show up as vertical bars

Well, I got tired of thinking about it, decided to do it.  I was spurred on by finding out that “jscad”, which I had known as openjscad.org, was now available as a node module — https://www.npmjs.com/package/jscad.  Okay, lets do this!

* Here’s a first reference: Car Stats: Boogers! Foiled!  1/11/2013  … There’s a few other posts just prior where I had been plotting interesting things from car track data, using powershell.

The implementation details

image

The above screenshot shows a sample output with some initial tracks, but .. they are the wrong tracks.  I’ll be recording the correct tracks later.

  • I created a “Base” for the sculpture by also drawing all the tracks along Z=0, but a little bit wider.
  • I made it a bit more stable by putting a “Pillar” up to the other end of the track, so its supported.

Code at: https://github.com/sunnywiz/commute3d .. the version as of 4/29/2017 11:57pm should be runnable to give the above output.

image

It took me probably 12 hours spread over 3 days …  here are some of the things I learned along the way:

chocolatey install nodejs

I’ve taken to using chocolatey to install windows packages so I don’t have to go hunt things down on the internet.   Most of my machines have it, its part of me setting up the machine.

I could totally install nodejs via chocolatey – and once installed, that gave me npm.

image

The command line, btw, would be:   cinst –y nodejs

npm init

This bit will seem silly to people who’ve been using it for a while, but these were the walls I had to hit.

image

Can’t npm install a package (everybody says “run this command” – it doesnt work) … until you’ve first “npm init” started a project.  I was thinking it was like CPAN where you added a package to a central repo and it was available, but nope, its more like “local depdency per project” more like nuget.  Makes sense, my CPAN (Perl) was was from 1998 and the world has changed since then.

node is awesome

It feels like the days of Perl way back.   Need something?  There’s a library.  Install it, use it, move on, solve the problem.  

VSCode is awesome

image

Editing and debugging is a LOT easier if you use an appropriate developer environment.  I tried vscode, and much to my surprise, I found it could:

  • Edit with intellisense (I knew this, but didn’t realize how fast it was)
  • Debug!  Watch!  Inspect!  OMG!   Very similar to Chrome Dev Tools.
  • Integrated terminal
  • Integrated git awareness and commits and pushes
  • Split screen yadda yadda
  • Very Nice.

nodejs asynchronous can be a learning curve

Take these two bits of code:

image

image

The first problem I had was that It would go to read all the tracks in … asynchronously.  I didn’t have a way to wait till all the tracks were read before it continued on to doing something with the tracks.

That lead me to some confusing code using “Promises.map”.  Then I found out that, most folks do const Promises = require(‘bluebird’)!    There’s a library that makes things easier.

So, if you’re not aware, and explaining to my future self:

  • Call readtracks .. its an async call
  • It returns a promise.
  • the implementation of readtracks eventually either calls resolve or reject (in my case, resolve).
  • At that point, the promise’s “then” clause gets run.
  • the glob … function (er, files)  is a “normal” nodejs callback strategy at the level below promises .. doesn’t rely on promises, its doing a directly specified callback.
  • the bluebird.map() basically does a foreach() on files, for each one, runs filename through a function, takes the result of that function, sticks it in an array.  It does this in a promise…
  • … which when its done with all the things, then calls resolve
  • the text fileName => readTrack(fileName) is the same as function(fileName) { return readTrack(fileName) }.
  • when you have promises, there’s a way of writing them out using “async” and “await”.    I didn’t try that.
  • the .then(resolve) is the same as .then(function( x ) { resolve(x); } )

The other beginner mistake that I kept making – I would forget to say “new” when I meant to create a new object.  Smile 

So I want to join two points in 3d space with a beam

I spent an embarrassingly long time trying to figure out how to take a cube, and scale it and rotate it and transform it so it acts as a beam between (x1,y1,z1) and (x2,y2,z2).

The answer is: 

image

The resolution:4 gives it four edges.

I need to view .STL files on my machine

3D Builder is a windows program that would let me do it, but it hung sometimes.

The easier route was to drag the model over to http://www.viewstl.com/  (which is what I did for the screenshot with this blog post).

Netfabb got Bought Out

Once upon a time, I found some really nice software .. which I thought I liked enough to give them real money.   Looking back, I cant find a record of giving them money… I guess I intended to at one point.

In the time that I haven’t been doing 3D printing, apparently AutoDesk bought them out, and.. the new cost is $125 PER MONTH.  Uh, no.   While researching for this blog post, I did manage to find a binary of the old netfabb Studio Basic, so I snagged that.   I saved my emails with the keys that I had used to activate it in the past, and those seemed to work, so Yay!

CSG Unioning of 1000+ things takes a long time

I also discovered console.time() while benching this.

When running the program, I end up with a bunch of CSG’s, but they’re all intersecting.  I need to merge them together to get a printable thing.

That code, when run for a larger print (100 tracks), took all of 18 hours to do the merging.  That was … too much.   So, I tried to write a program to make the merging easier.

1029 items (spheres, cylinders, boxes) unioned together, NO DEBUGGER, yielding a CSG with 11935 polygons:

  • If I union them in a for loop one after the other
    • 34 minutes!
    • It gets slower over time.
    • there’s a O(N^2) probably that happens under the hood – it has to re-consider the same shape over and over as it tries to add new shapes.
  • If I union them using a binary tree tactic:
    • 42 seconds!!!
  • The actual numbers:
    • image
  • There’s probably libraries out there that specializing in union arrays of CSGs, rather than two objects at a time.   Maybe I’ll upgrade at some point.

image

Note that if I upload the non-unioned version to somebody like sculpteo, they have an “auto-fixer” tool that fixes things pretty quickly, this is not absolutely necessary.  Just .. feels mathematically clean to do it.

I did try to write the above fancyUnion using promises, but .. didn’t help.  Node still only uses one thread, it did not branch out to multithreading. 

3 Major sources of Documentation for jscad / openjscad / csg:

Conclusion

Code is written!   

I’m going to hopefully get some tracks recorded over this week.

I’ll make another post of how the printing process goes with the real sculpture.

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!

House Print 4/N: “Second Beta”

image

I have 3.5 floors printed!  And they go together!  With Stairs!

image image
image image

There are some problems:

image I forgot to cut a section out of the “concrete” that the family room sits on to make room for the stairs from the basement up to the family room.

I also had a hard time getting the steps on the left to fit – I had to resort to my wife’s Dremel to cut some of it down to size.   (Incidentally, a Dremel doesn’t cut it, it selectively melts it via friction)

image I did not make the basement 7ft high like it really is.   Thus, the kitchen is than in reality – and the stairs are the wrong height.

In this same picture, you can also see the problem I have with trying to get the stairs to fit.   
The kitchen wall does not line up with the bedroom wall.

image I ran out of filament with 3 pieces of the bedroom to go.   If I had not made mistakes, I could have gotten the whole thing in a 1kg spool.   (In the pictures above, notice the bedroom has no upper section)

I have ordered a 2kg (5.5 lb) spool of white (“Studio Line White” from JustPLA.com);  With it I’m going to start over.  This time:

  • Correct the basement height
  • Put the stairs in from the start so they get “cut” correctly.  
  • I want to reflect where the ground level is better.

~~~~~~~

For this blog post, I snapped this tag:

https://github.com/sunnywiz/housejscad/tree/Post4

image

When I get time, I plan on making a how-to video – for my own benefit, since a year from now I won’t remember the details:

  • How to create the blueprint
  • How to size the blueprint to create the text overlap
  • How to use the code to generate the STL’s
  • How to use the Join libraries to make the pieces possibly fit each other
  • How to use the Cut libraries to make things printable on my print bed and Plate them
  • How to use the Microsoft / NetFabb Cloud service to fix the model
  • How to use Blender to section the shells off into separate prints
  • How I glued things together (as best as I have found so far)

Pewee, we have a problem (House Print 3/N)

(I live in Pewee Valley, KY, not Houston, TX)

image

This is the 1:48 scale print of the fourth floor.   The source is here:  https://github.com/sunnywiz/housejscad/tree/Post3  and the STL files you are seeing here are bedroom0.stl, bedroom1.stl, and bedroom2.stl.

Problem: The top half doesn’t quite fit the bottom half.   This is because the top half isn’t large enough to hold the shape together – when the roof prints, its warm, and as it cools, it wants to shrink, and so it wants to curve.  The bottom print wants to do the same, but the walls are large enough to prevent this from happening.

Solution: no-roof.  Which, my wife points it, is the way to go:  then you can easily play with the furniture inside.   The side effect of that is, in the current iteration, I won’t be doing top/bottom alignment tabs (similar to the “cross” thing on the left side of the picture). 

Otherwise, the 1:48 scale is working well.  Here is the same bottom half, but with Victorian doll furniture inside it:

image

The checkerboard at the bottom of the picture is also working well as a place to glue things.  Here it is glued to the next piece:

image

Pretty proud of it so far! 

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.