[OpenSCAD] The OpenSCAD Language
arnholm at arnholm.org
arnholm at arnholm.org
Mon May 6 04:41:54 EDT 2019
On 2019-05-06 09:31, Troberg wrote:
> Well, I love my wife, but there are still things I wish she did
> Same thing here. I love OpenSCAD, but there are some situations where
> becomes extremely cumbersome to use, for example that I can't assign an
> object to a variable and then ask that variable about the object
> size, rotation et cetera).
Different software have different philosophies. In OpenSCAD, a design
choice was at one stage taken to use what is called a "functional
language" which by definition disallows the types of operations you
mention. I also raised this issue when starting to use OpenSCAD a few
years ago, and I soon realised that the OpenSCAD language was not going
to change in this area.
Back then someone stated along the lines that in CSG modelling you
describe data instead of programming. To me this is just a software
design choice, it is not in itself dictated by the CSG technique. You
can generate at a CSG model in different ways, not just by describing it
directly (also in OpenSCAD you could say algorithms are used). So I
started exploring what it would take to make a different design choice
wrt. scripting for CSG modelling.
The result is AngelCAD, now open source
A small taste of the AngelCAD language
In this context, objects can be assigned to variables that are allowed
to be modified at any time. The objects can be queried for information
about their bounding boxes etc., for example:
Sometimes, the styles of code in OpenSCAD and AngelCAD can be similar:
The design choice in AngelCAD was to use an existing language for CSG,
rather than invent a new one. The choice was AngelScript
http://www.angelcode.com/angelscript/sdk/docs/manual/doc_script.html , a
language that allows many different styles of writing code. It is easily
extended for CSG modelling in AngelCAD (ref. link above for details).
The strength of OpenSCAD is its wide adoption and user base, it has
brought CSG modelling "to the masses" which is a great achievement. It
is relatively simple to use for medium complex tasks, but sometimes it
is easier to express things using algorithms and even user defined data
types. You don't have to use such features in AngelCAD, but you can if
you want to.
More information about the Discuss