[OpenSCAD] Fusion360 and OpenSCAD

Carsten Arnholm arnholm at arnholm.org
Thu Oct 6 15:17:35 EDT 2016


On 06. okt. 2016 18:58, Torsten Paul wrote:
> On 10/06/2016 01:33 PM, arnholm at arnholm.org wrote:
>> I have been experimenting with extracting 2d profiles from
>> hand drawings, so they can be used to obtain 3d-printable
>> models.
>> See for example http://www.printrbottalk.com/forum/download/file.php?id=11168
>>
> Nice, what was used for the image->vector conversion?
> The "some experimental code" sounds like it's not using
> any existing tool or library?

No, it is a new library + application I have been playing with lately to 
do this. It is experimental as noted but solves some difficult examples 
already. It does not use any pre-existing tool or library (just 
wxWidgets for the application GUI).

Another example, this time a famous logo:

The starting point, a B/W image
https://gyazo.com/5a256235cf21905c5946a4971c50e2ed

The white areas are triangulated into a mesh (home-grown triangulator). 
Rather dense triangles in this case:
https://gyazo.com/79195935193fa14ff73e725e0807f4e8

The contours are identified from the mesh, note the colours of the inner 
and outer contours, it is automatic
https://gyazo.com/c048ff34f3a1599ddc9234f9775ec3ac

The contours are exported as Angelscript source code and extruded in my 
CSG application (using carve for 3d booleans). Below is OpenSCAD used as 
a viewer of the resulting polyhedron:

Linear extrude
https://gyazo.com/bae667e63d29c7526d59b99693f7f7af

Rotate extrude (20 degrees)
https://gyazo.com/52a0cef818160c151b9b9b4c86762ef5

It would no doubt be possible to use the exact same approach to export 
to .scad format and let OpenSCAD do the extrusions, but I have not done it.

I had a quick look at the potrace algorithm now, since you mentioned it.
http://potrace.sourceforge.net/potrace.pdf
Nice paper, the approach is quite different from mine, but some very 
good ideas there.

Originally, I had a similar idea as your trace(...) command of 
integrating image->vector conversion into my CSG application, but now I 
think it really is impractical because the conversion needs to be 
inspected and possibly redone with other parameters before it can be 
accepted and used in a 3d model. So I found it easier to handle it 
separately as shown above. The result is easy to integrate with other 
modeling code since the profiles become source code functions returning 
2d shapes (equivalent to an OpenSCAD module), you just copy/paste the 
generated functions.

The potrace integration idea is nice but I suspect it might be subject 
to difficult user issues if integrated too tightly.

I have briefly used potrace with OpenSCAD in the past 
http://arnholm.org/a-reverse-3d-printing-experiment/, but I didn't know 
the algorithm used by potrace.

Just my thoughts.

Carsten Arnholm








More information about the Discuss mailing list