I know this subject comes up every few months, but it seems to have run
longer than most times I can remember.
I wonder why people cannot understand that OpenSCAD is not a general
purpose programming language, it is a language for describing 3D
objects. As such, the creator of the language made design trade-offs
different than what you might make for Python or Java.
Over a pretty long programming career, I've seen people make a similar
mistake in general purpose languages. They confuse a design choice with
an error in judgment. In the end, they end up spending an inordinate
amount of time "fighting" the language, when they could be getting work
done.
I'm not going to try to say that OpenSCAD is perfect. Everyone here
knows there are deficiencies. Some people are even volunteering their
time to fix some of them. I really appreciate the work that has been
done to make OpenSCAD the tool that it is, and I definitely don't thank
the maintainers enough.
Many of the improvements I have seen in the last seven years of using
OpenSCAD have come from suggestions from this list. Almost all of them
have come from understanding the tool and pointing out a change within
the scope of the design.
Try to be respectful of the work that has gone into a tool we all use,
and assume that the maintainers made the choices they did for valid,
intelligent reasons.
Cannot say. Saying I would know, do not know, so cannot say.
-- Zathras - "The War without End"
Well, I love my wife, but there are still things I wish she did differently.
Same thing here. I love OpenSCAD, but there are some situations where it
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 (location,
size, rotation et cetera).
Besides, software is never perfect. It can always be better. When there is
nothing to improve, it dies. Once you accept that, it's easier to handle
flaws in software.
--
Sent from: http://forum.openscad.org/
On 2019-05-06 09:31, Troberg wrote:
Well, I love my wife, but there are still things I wish she did
differently.
Same thing here. I love OpenSCAD, but there are some situations where
it
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
(location,
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
https://arnholm.github.io/angelcad-docs/
A small taste of the AngelCAD language
https://gist.github.com/arnholm/2ad1cb525803695c73de37b84e480d4a
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:
https://gist.github.com/arnholm/23c482530fd1882c615f5e6e3c9eedca
Sometimes, the styles of code in OpenSCAD and AngelCAD can be similar:
https://gist.github.com/arnholm/98b007bb960e328ef9a986a96b412607
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.
Carsten Arnholm
Well, as nice as it looks, I have a parts library with several hundred parts
in OpenSCAD, and I have several external tools I've written to help extract
information from a running script and to extract code documentation. So, I'm
pretty mucheh stuck with OpenSCAD for now, unless something really epic
comes along.
--
Sent from: http://forum.openscad.org/
Hi Carsten
Couple of questions:
Is there a way to translate OpenSCAD code to AngelCAD?
And is AngelCAD able to export STEP files?
Thanks,
Alex Gibson
admg consulting
edumaker limited
. Project management
. Operations & Process improvement
. 3D Printing
-----Original Message-----
From: Discuss [mailto:discuss-bounces@lists.openscad.org] On Behalf Of
arnholm@arnholm.org
Sent: 06 May 2019 09:42
To: OpenSCAD general discussion
Subject: Re: [OpenSCAD] The OpenSCAD Language
On 2019-05-06 09:31, Troberg wrote:
Well, I love my wife, but there are still things I wish she did
differently.
Same thing here. I love OpenSCAD, but there are some situations where
it
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
(location,
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
https://arnholm.github.io/angelcad-docs/
A small taste of the AngelCAD language
https://gist.github.com/arnholm/2ad1cb525803695c73de37b84e480d4a
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:
https://gist.github.com/arnholm/23c482530fd1882c615f5e6e3c9eedca
Sometimes, the styles of code in OpenSCAD and AngelCAD can be similar:
https://gist.github.com/arnholm/98b007bb960e328ef9a986a96b412607
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.
Carsten Arnholm
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
On 2019-05-06 15:17, Alex Gibson wrote:
Is there a way to translate OpenSCAD code to AngelCAD?
And is AngelCAD able to export STEP files?
Hi Alex,
No effort has been made to translate OpenSCAD code to AngelCAD so the
answer is no. The opposite is possible, AngelCAD can generate an
OpenSCAD .csg file.
AngelCAD is mesh based as it uses xcsg ( https://github.com/arnholm/xcsg
) which again is based on Carve. This is similar to OpenSCAD that is
also mesh based using CGAL. When you ask about STEP, I guess you are
talking about boundary representation
https://en.wikipedia.org/wiki/Boundary_representation, a rather
different description of 3d geometry compared to mesh based Constructive
Solid Geometry (CSG). So just like OpenSCAD, AngelCAD/xcsg cannot export
B-REP STEP files. The export formats include (via xcsg)
--amf AMF output format (Additive Manufacturing
Format)
--csg CSG output format (OpenSCAD)
--dxf DXF output format (AutoCAD DXF - 2D only)
--svg SVG output format (Scalar Vector Graphics - 2D
only)
--stl STL output format (STereoLitography)
--astl STL output format (STereoLitography) - ASCII
--obj OBJ output format (Wavefront format)
--off OFF output format (Geomview Object File Format)
AngelCAD can import AMF, OBJ and OFF
Regards
Carsten Arnholm
The OpenSCAD language has the following limitations:
When I first got involved with OpenSCAD, I hoped to pitch in and fix these limitations. I wrote a number of design proposals, and created "OpenSCAD2" as a design proposal for fixing these limitations.
Once it became clear that I wouldn't be able to make these changes within the OpenSCAD project, I renamed OpenSCAD2 to Curv, and evolved the project in a different direction from OpenSCAD. The Curv language fixes all of the limitations that I listed above, and I changed the representation of shapes from triangle meshes to signed distance fields, which I believe is a more powerful representation. It can represent curved shapes and deeply iterated fractals using a mathematically exact representation, and there is a larger set of shape operations available. This representation also supports full colour 3D printing.
Carsten wrote:
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.
OpenSCAD is not a functional language. Functional programming is all about programming with functions. But functions are not values in OpenSCAD.
It would be fair to call OpenSCAD a domain-specific, declarative language.
It is untrue that functional languages "by definition" disallow the feature that Troberg wants: "I can't assign an object to a variable and then ask that variable about the object (location, size, rotation et cetera)."
Curv is a pure functional language (the strictest type of functional language), and it nevertheless supports all of the features I mentioned in the first paragraph, including assignment statements and mutable variables. Curv also supports the usual functional programming idioms: curried functions, pattern matching, full tail recursion optimization.
It would be possible, in principle, to extend OpenSCAD to support the same features. But it would be a big, disruptive change to the language, and that conflicts with OpenSCAD's conservative approach to change. OpenSCAD is almost 10 years old and the project has emphasized stability, incremental change and backwards compatibility.
AngelCAD certainly represents one approach to overcoming OpenSCAD's limitations.
However, AngelCAD is just CSG embedded in a general purpose imperative language. There is a lot of verbosity and boilerplate, compared to a domain-specific declarative language such as OpenSCAD or Curv. The lack of boilerplate is something that I really value about OpenSCAD.
AngelCAD:
shape@ main_shape()
{
cube@ cu = cube(size:45, center:true);
return cu;
}
void main()
{
shape@ obj = main_shape();
obj.write_xcsg(GetInputFullPath(),secant_tolerance:0.01);
}
OpenJSCAD:
function main ()
{
return cube({size: 45, center: true});
}
OpenSCAD:
cube(45, center=true);
Curv:
cube 45
Doug Moen.
On Mon, May 06, 2019 at 10:59:04AM -0400, Doug Moen wrote:
OpenSCAD:
cube(45, center=true);
Curv:
cube 45
OK ! I want to switch. Where do I download it?
-> https://github.com/curv3d/curv
It is not fair to compare the nondefault in one language with the
default on the other.
Openscad
cube (45);
curv:
cube 45 dontcenter=true
^^^^^^^^^^^^^^
don't know how to write that in curv yet.
Roger.
--
** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 **
** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 **
The plan was simple, like my brother-in-law Phil. But unlike
Phil, this plan just might work.
I am quite happy with openscad. It does every thing I want and is simple,
which is what I crave. The only thing I eny is speed.
On Mon, 6 May 2019, 16:40 Rogier Wolff, R.E.Wolff@bitwizard.nl wrote:
On Mon, May 06, 2019 at 10:59:04AM -0400, Doug Moen wrote:
OpenSCAD:
cube(45, center=true);
Curv:
cube 45
OK ! I want to switch. Where do I download it?
-> https://github.com/curv3d/curv
It is not fair to compare the nondefault in one language with the
default on the other.
Openscad
cube (45);
curv:
cube 45 dontcenter=true
^^^^^^^^^^^^^^
don't know how to write that in curv yet.
Roger.
--
** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110
**
** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 **
The plan was simple, like my brother-in-law Phil. But unlike
Phil, this plan just might work.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
As long as we're asking for stuff --- I just wish there was an easier way
to get curves / vectors out as something other than triangles or line
segment approximations.
Currently working through re-drawing parametric designs using METAPOST
based on the JSON output from the OpenSCAD customizer.
Would a 2D version of the OpenSCAD language which output nice SVG/PDF files
be that difficult to do? (or does it exist and I'm missing it?)
William
On Mon, May 6, 2019 at 11:46 AM nop head nop.head@gmail.com wrote:
I am quite happy with openscad. It does every thing I want and is simple,
which is what I crave. The only thing I eny is speed.
On Mon, 6 May 2019, 16:40 Rogier Wolff, R.E.Wolff@bitwizard.nl wrote:
On Mon, May 06, 2019 at 10:59:04AM -0400, Doug Moen wrote:
OpenSCAD:
cube(45, center=true);
Curv:
cube 45
OK ! I want to switch. Where do I download it?
-> https://github.com/curv3d/curv
It is not fair to compare the nondefault in one language with the
default on the other.
Openscad
cube (45);
curv:
cube 45 dontcenter=true
^^^^^^^^^^^^^^
don't know how to write that in curv yet.
Roger.
--
** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110
**
** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233
**
The plan was simple, like my brother-in-law Phil. But unlike
Phil, this plan just might work.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org