logoalt Hacker News

TOGoStoday at 6:47 AM1 replyview on HN

> The awful thing about OpenSCAD is that what one can model in 3D is limited by one's ability to mathematically stretch, rotate, and/or arrange spheres, cylinders, and cubes in 3D.

Not at all. You can build any polyhedron you want using the polyhedron command.

Which would be an enormous pain to write out by hand every time, but I wrote a function once upon a time to generate a polyhedron from a stack of layers, each of which is a list of points, and haven't had to mess with old cubes and spheres since.

One annoying thing is that the default way of writing programs in OpenSCAD uses 'modules', which are a bit limited compared to functions (you can't store them as values to to functions or other modules). I worked around that by writing a module that interprets arrays (think S-expressions) that representing the shape, and then just build up that S-expression-like thing with functions and whatever.

Once you've built your own programming language inside OpenSCAD it's perfectly usable. :-)

This might sound like sarcasm but I actually do prefer this to dealing with Python's mutable state jungle / package management nightmare.


Replies

WillAdamstoday at 1:55 PM

Fair point.

This sounds _fascinating_ have you posted your code or written this up in a math journal? Link?

I don't touch polyhedrons in OpenSCAD because the logic of point placement mystifies me --- a tool such as you describe would make life a lot easier for a lot of folks, esp. if there was a way to use it to import a series of SVG files which could be used to define the points interactively.

I sometimes wonder if the key to future computer usage would be a series of Domain Specific Languages each intended for a given task:

- 3D == OpenSCAD

- 2D == METAPOST

- SQL == databases

- TeX == text/page composition

- sed == text

(and yes, I know this is the Unix ideal)

but such languages seem to be most successful and most approachable to typical users when they are paired with a front-end which affords editing, previewing, and, direct interaction.

I'm actually nuking my Python install right now, because I got it into a state where I couldn't get Fullcontrol G-code to run, so I agree that the state of Python package population is pitiful, hence of course, the XKCD:

https://xkcd.com/1987/

show 1 reply