Rapid Prototyping and Improvement

Putting Banate CAD out has been a nice rewarding experience.  Responding to user feedback, making improvements and the like, is ongoing fun.  The great fun of Banate CAD for me is how quickly I can make progress.  The compile/try cycle is very fast.  I use the SciTE editor/environment to do my development.  It’s pretty good about showing errors, and helping you zero in on what’s wrong.  The fact that Lua is such a basic minimalist language actually makes things much easier.

As far as actually using Banate CAD is concerned, today on Thingiverse, I saw an entry for a Mobius Heart.  I thought, hmmm, how hard would it be for me to model that in Banate CAD?

To break this problem down, I first thought about the various things that are operating.  In the Mobius version, there are essentially 3 parametric equations operating at once.

One, determines the heart shape.  You can run this equation, like you would run a circle equation.  Go from 0 to 360, and it will tell you the x,y coordinates along that path.

In the above picture, I’ve essentially done exactly that.

The Second parametric curve would tell you the profile, or cross section of the thing in general.  This could be an ellipse, square, or anything (SuperEllipse).  As long as you could get a value for a parameter from 0..1.

The last parametric curve determines the twist, as you follow around the first curve.  This twist could modify the profile curve, and give you that mobius effect.

In this case, we essentially have a TriParametric thing.  As long as you can describe each of the curves independently, you could just plug them into something and get a mesh out of it.

Today I was adding  a BiParametric object.  This deals with everything from Ellipse, to Torus, and bicubic surfaces.  These shapes all have the same general thing going on.  The only thing that varies is when you ask for a value based on a u,v pair (parameters that vary from 0 to 1).

This is great fun because now that there is this BiParametric class, I can create an infinite variety of equations that can utilize it, without having to repeat that silly facet generation code all over the place.  This not only increases my speed in coding, but also reduces my errors, because all the hard stuff is concentrated into one simple place.

Not to allow the focus on 3D have all the fun, I’ve been adding various 2D objects as well.

Well, what good is that?  Isn’t this a CAD program?  Well, yes, but it’s more than just a CAD program, it is a visualization environment.  As such, I need to be able to do things like show dimension lines, bar graphs, and all that other stuff you see in typical 2D environments.  What Banate CAD does is understand the difference between a simple graphic, and a solid shape, which it could export as a .stl for example.   And of course, all good linear extrusions start with some 2D profiles, so this is the beginning of linear extrusions.

Besides all these fundamentals, one more major feature areas I need to add is the ability to do animations.  That doesn’t really add too much to the 3D capabilities, but it certainly gives some pizzazz to the visualization aspects of the thing.  And of course the trick is to do it all without creating such a huge bloated codebase that I can’t maintain over time.  And thus the introduction of the simple class mechanisms.

At any rate, Being able to rapidly lay out code is an extremely rewarding thing.  Being able to then leverage that code to create interesting designs is even more fun.