I’m pleased to announce the second release of ImplicitCAD: 0.0.1. (The first release was 0.0.0 because 0 is the true first ordinal.)

The point of this release is somewhat arbitrarily chosen. We were over due for one and no clean break was in sight. Then I woke up with a nasty headache and couldn’t seem to code, so I thought I’d do a release instead.

I’m going to try and martial together my thoughts and discuss changes in this release and what’s coming up. The TL;DR is that ImplicitCAD is going exciting places and if you are willing to tolerate bugs and file bug reports, you should become a beta user for it.

What has changed in this release of ImplicitCAD?

Bounding Box Determination

Previously, ImplicitCAD required users to provide the bounding boxes for their objects. This was tedious and irritating. And clearly something a computer should be handling.

And with this release, ImplicitCAD will have your computer do it for you.

Now you can write:

import Graphics.Implicit out = union [ rectR 0 (-40,-40) (40,40), translate (40,40) (circle 30) ] main = writeSVG 2 "test.svg" out

Where previously the following was needed:

import Graphics.Implicit out = union [ rectR 0 (-40,-40) (40,40), translate (40,40) (circle 30) ] main = writeSVG 2 (-40,-40) (70,70) "test.svg" out

Symbolic Rendering

Normally ImplicitCAD renders using a modified version of the Marching Cubes algorithm. For some objects, though, there are obvious ways to render them. ImplicitCAD now tries to do just that, falling back to cubes if it can’t.

Symbolic rendering is faster and produces nicer meshes at the same resolution of rendering. So when it can be used, it is a massive improvement for the end user. 🙂

OpenSCAD Parsing

Because of its popularity, ImplicitCAD is working to provide backwards compatibility with OpenSCAD. (Also, people have an irrational fear of Haskell.)

To this end, we provide the extopenscad tool, which runs a extended version of OpenSCAD. The extensions allow you to use the features that are new to ImplicitCAD while still enjoying the syntax of OpenSCAD. It does not yet have full backwards compatibility.

I’m really excited about some of the improvements we’ve made to OpenSCAD. A few demonstrations follow:

Proper programmatic capabilities — in OpenSCAD, there were a number of troubling limitations including not being able to reassign variables in loops:

a = 5; for (c = [1, 2, 3]) { echo(c); a = a*c; echo(a); }

1.0 5.0 2.0 10.0 3.0 30.0 Nothing to render

Functional programming!

echo(map(cos, [0, pi/2, pi]));

Rounding (r=?) for just about everything!

linear_extrude (40, r=8) union (r=5) { translate ([-10,-10]) square (30, r=3); translate ([ 10, 10]) square (30, r=3); }

Higher order modules! Notice that twist is a function!

linear_extrude (height = 40, center=true, twist(h) = 35*cos(h*2*pi/60)) { union ( r = 8) { circle (10); translate ([22,0]) circle (10); translate ([0,22]) circle (10); translate ([-22,0]) circle (10); translate ([0,-22]) circle (10); } }

(These examples and more are available on thingiverse!)

Epic Refactoring

A ludicrous amount of code has changed since 0.0.0 (keep in mind that Haskell is a lot more dense than other other languages, so 2.5K lines of code is a much bigger project than some X0K lines of code in C projects I’ve worked on). A lot of that has been me trying to make the code approachable — I think that needs to be a priority, so that other people can extend ImplicitCAD. I got a lot of awesome advice from r/haskell (thanks in particular to Peaker the awesome essay length code review; I’m still working on using the feedback).

What’s Next?

Backwards Compatible OpenSCAD Parsing

There’s still a long ways to go with OpenSCAD parsing. There’s known bugs (like the lack of user defined modules — this is nearly implemented) and unknown bugs (these lurk deep in the code base, waiting to attack unsuspecting users).

This is something you can help with! Report bugs! They bight, I don’t!

More Symbolic Rendering

I think symbolic rendering can be extended to cover the majority of common use cases. I want to see this become a reality!

GCode Generation

Presently the only thing I really support is Hacklab‘s laser cutter. Really, it is compilers all over again and a lot of consideration needs to be given to how to implement GCode generation. People at my GTALUG talk recommended I study GCC’s architecture. This seems like sound reasoning to me.

Metadata

Adding metadata to objects is a clearly necessary step. One of my friends wants to use ImplicitCAD for generating models for some of his projects, but needs to be able to attach metadata about holes (exact radius, is there any threading?, and so on).

Performance Work

ImplicitCAD can’t guarantee Lipschitz Continuity (c=1) any more, so I had to gave up my Marching Cubes variant. This makes me very sad. Thankfully, I’ve hatched a plot to reacquire my beautiful algorithm…

Unit Testing via Algebraic Topology

Here’s an interesting problem: You want to unit test a CAD program. It gives you triangle meshes when you ask it to render objects. Obviously, there isn’t one ‘right’ triangle mesh. As long as it approximates the object, we’re pretty happy. And it is entirely valid for the triangle mesh to change if we update algorithms.

One test we can do is to calculate topological invariants of the triangle mesh and make sure they match the object.

As you may have gathered, I enjoy hitting computer science problems over the head with massively oversized mathematical hammers. Call it a hobby.

Also, it gives me an excuse to write a Topology library for Haskell.

I’m going to start with Euler Characteristic but I’d eventually like to calculate Homology Groups (the algorithms involved look interesting, at a glance at least).

More Refactoring

I want ImplicitCAD to break the stereotypes of unapproachable Haskell code. In fact, I intend for it to be a super approachable project.

You can help! Take a glance at the code and tell me what your experience was like.

Hijacking This Post for Important Transmissions

The third Toronto RepRap User Group Meeting is happening on February the 27th. If you live in Toronto and are reading this post, you should probably come!

You can keep up to date with the progress of ImplicitCAD by following my twitter account.

Share this: Twitter

Reddit

Like this: Like Loading... Related

Tags: 3d printing, CAD, haskell, ImplicitCAD, openscad, reprap