[Swansea Hackspace] openscad maths

Justin Mitchell justin at discordia.org.uk
Thu Oct 30 13:48:48 GMT 2014


On Thu, 2014-10-30 at 13:37 +0000, Ceri Clatworthy wrote:
> Hi, going crazy here ...
> I need something like:

> test = 102; // 0x66
> if (test AND 1) {do something usefull @ poz 1};
> if (test AND 2) {do something usefull @ poz 2};

> e.g. draw the binary representation of a 16 bit number in
> cubes/spheres !!!

Doesn't look possible,
there are no bitwise operators that i can see, and
variables are evaluated at compile time so you cant even run a loop to
do it the long way around.

Either preprocess it, i.e. write a program that writes openscad.
or switch to openjscad which is an almost identical syntax except that
it uses javascript as the language, so can do less noddy operations






More information about the Hackspace mailing list