Photo beads with OpenSCAD

Share your models and objects...
jsc
Posts: 1863
Joined: Thu Apr 10, 2014 4:00 am

Photo beads with OpenSCAD

Post by jsc » Sat Apr 26, 2014 3:37 am

So, this was featured by Thingiverse not too long ago, the pixel beads photo pane by anoved, and I had success printing out a 50x50 version, but it took six hours to render. I was wondering if it were possible to make it any faster, and after a few experiments I was able to cut the rendering time by almost 4x.
audrey.jpg
audrey.jpg (93.64 KiB) Viewed 3462 times
The photo is a 30x30, because I didn't want to spend 1.5 hours on a demo print, but really, the process is inherently low resolution and that's part of its charm.

The idea and 99% of the implementation is anoved's, I just made it slightly more tolerable to use.
http://www.thingiverse.com/thing:310541

User avatar
Tim
Posts: 1195
Joined: Thu Apr 10, 2014 2:19 pm
Location: Poolesville, Maryland
Contact:

Re: Photo beads with OpenSCAD

Post by Tim » Sat Apr 26, 2014 3:55 am

It looks like this is done with the "customizer" on thingiverse? How does that work? I think it uses OpenSCAD? This sounds awfully slow. . . I could probably write a bit of C code or Tcl/Tk code that would turn an image into an STL file in half a second or less. It sounds like a bunch of scripts or small tools like that would be useful, and apparently don't exist anywhere. Although I'm wondering if for this application, raw g-code with fine control over the extrusion rate (or alternatively, the speed) could yield superior results. I'm thinking in particular that you could run the same image pattern at different angles and get a strong mesh with the image buried in it. Or, this could be something that takes up weeks of my copious spare time. . .

jsc
Posts: 1863
Joined: Thu Apr 10, 2014 4:00 am

Re: Photo beads with OpenSCAD

Post by jsc » Sat Apr 26, 2014 4:31 am

The customizer is just a preprocessor that lets people modify parameters embedded in OpenSCAD files without knowing anything about it. The author puts all the parameters up front and comments them with a special syntax that gets them to show up in the customizer with appropriate selection UI.

OpenSCAD *can* be slow, but most of its slowness is due to the underlying use of CGAL, which works very hard to ensure manifold output. I think I read that the slowness comes when it needs to polygonize for output.

Extruding images into depth maps is built into OpenSCAD, and Simplify3D. I haven't tried it with OpenSCAD, but Ed Nisley has a series of posts on experiments with chocolate molds which uses it, and from the sounds of it it is similarly slow. Simplify3D's implementation is very very fast. I think the problem is that OpenSCAD is doing a lot of general case intersection checks or whatever. Multi-hour compile times are not uncommon.

The surface from bitmap converter can be used to create "lithopanes", see my post from a few days ago, but to do this sort of modeling it would be better to work at a very very high resolution, or better yet extrude vector 2D shapes. It would be useful to have a library of tools to do some very simple model manipulations, like "extrude this DXF/SVG shape by some amount", "split this object on the X axis", etc. without having to involve OpenSCAD and its heavy weight machinery, but I have not found anything like that. I would almost prefer a set of command line tools, like ImageMagick, over something like netfabb or meshmixer, which for all their utility end up being incomprehensible due to their UI.

User avatar
Tim
Posts: 1195
Joined: Thu Apr 10, 2014 2:19 pm
Location: Poolesville, Maryland
Contact:

Re: Photo beads with OpenSCAD

Post by Tim » Sat Apr 26, 2014 9:26 pm

Hmm, I guess "STL tools" will be my next project. : )

In the past, I have tried to get some information on the DXF format but was not very successful. I wrote an SVG format exporter for xcircuit, so I know a bit about that, enough to generate any kind of 2D shape and do basic transformations.

A set of simple command-line tools would be easy to start off simply with a few tools and add more over time. I think such a set of tools could be wildly popular. I find myself doing silly things like using blender to turn an ASCII STL file into a binary STL file so that wings3d can read it. . . one quick converter
script would go a long way!

jsc
Posts: 1863
Joined: Thu Apr 10, 2014 4:00 am

Re: Photo beads with OpenSCAD

Post by jsc » Sat Apr 26, 2014 9:32 pm

For converting ASCII to binary STLs, check out http://www.cs.princeton.edu/~min/meshconv/

Toby
Posts: 330
Joined: Wed Apr 09, 2014 9:44 pm

Re: Photo beads with OpenSCAD

Post by Toby » Sat Apr 26, 2014 9:49 pm

Netfabb can also do the conversion form ascii to binary in case that's better than Blender. Netfabb loads pretty quick at least. I haven't gone near blender in about 6 years, and I don't plan on doing it any time soon.

Netfabb can also do the basic x,y,z slicing- you can set an offset too I'm pretty sure. It's in the main screen so it's easy and fast. Get in, slice, get out before you have time to realize how painful the interface is.

The snag with DIY tools is the file formats. It's not hard to write software to do the basic stuff you want and output it to a given format. The problem is reading those formats into your software in the first place. Like I have simple extrusion algorithms etc that can easily be adjusted to take in any reasonable JSON format. But just try getting an arbitrary SVG file into such a format so you can run it through my software. It's a nightmare. No doubt someone has an open source SVG to JSON converter somewhere, but the time spent wrestling with such a beast just isn't worth it.

User avatar
Tim
Posts: 1195
Joined: Thu Apr 10, 2014 2:19 pm
Location: Poolesville, Maryland
Contact:

Re: Photo beads with OpenSCAD

Post by Tim » Sat Apr 26, 2014 10:52 pm

Case in point, wings3d claims to read SVG paths, but when I throw something simple at it, it just spits back an error message. Haven't yet delved into to what it's looking for. SVG may be too general-purpose, like PostScript, but at least it's meant to describe geometry and there are certain lines that you should be able to parse out of it fairly easily, like paths, curves, etc.

But just for straightforward things, like describing a curve with a few bezier points, extruding it, and then writing an STL file is easy to do with a standalone tool that does not require invoking a whole design environment (maybe netfabb can be handled without too much trouble, but isn't it better to do the job with minimal code/time/effort/memory/energy?). Believe me, I don't like using blender, either, but it was the first thing I found that would do the conversion job.

It's just that there's stuff like photo beads, lithopanes, and other neat hacks that are pretty simple in theory, but don't really fit into the model of various design environments. It probably fits the model of OpenSCAD more than any of the others, but still OpenSCAD really isn't the right tool for the job.

But I should be coding, not yakking.

Toby
Posts: 330
Joined: Wed Apr 09, 2014 9:44 pm

Re: Photo beads with OpenSCAD

Post by Toby » Sun Apr 27, 2014 4:07 pm

I don't know if you guys might be interested in "TobyCad". It's designed to be something like what you're talking about- a basic tool for drawing in 2d and making 3d objects, with the ability to plugin arbitrary code to do whatever you want. It's so minimalistic (and a bit quirky) that I thought no one using blender, openscad, etc would be interested, but if you're frustrated with those tools you might have a use for it.

It's written in javascript to run locally in the browser. So no compiling, OS, or server issues to worry about. If you can write C-code then you can add plugins and load them from your disk. Since it's just a web page, it runs in any browser that supports HTML5. I only use it in Chrome on my laptop so it's probably tuned to that environment, but if others try it I think any compatibility issues would quickly be found and fixed.

I wanted to keep it simple. My first commandment was, "Thou shalt have no cascading menus." The second was, "Thou shalt use no IDE." I edit the code in Notepad++. Here's a screen shot of a recent project:
cad2d.PNG
cad2d.PNG (22.93 KiB) Viewed 3426 times
These are the 2D shapes I needed to generate the parts for a mold I was building. Here's a pic of the assembled mold that came out of it:
DSC00260.JPG
DSC00260.JPG (89.39 KiB) Viewed 3426 times
(Sorry for the religious symbols. I needed a test case that had 3d detail on every side and I like medieval looking things. The white stuff in the picture is the plaster that stuck to the PLA after casting.)

If you're interested let me know and we can figure out the best place to host the software.

jsc
Posts: 1863
Joined: Thu Apr 10, 2014 4:00 am

Re: Photo beads with OpenSCAD

Post by jsc » Sun Apr 27, 2014 4:10 pm

That looks interesting. I'd like to try it out.

The best way for sharing code is either github, if you speak it, or a tar or zip file, if you don't. If it's too big to attach, do you use Dropbox?

Toby
Posts: 330
Joined: Wed Apr 09, 2014 9:44 pm

Re: Photo beads with OpenSCAD

Post by Toby » Sun Apr 27, 2014 5:59 pm

Ok, give me few days to clean up the code and make it presentable, plus add some basic documentation. This software started out as a hack to generate Escher-like tilings of the plane, then morphed into an Origami crease pattern generator, and is only now a general way to draw in 2D and generate 3D models. I still get odd messages sometimes like "You cannot delete the edge of the paper!"

Post Reply