Hi Carsten,
OpenSCAD aim to directly describe a 3D design hierarchy, not merely execute code to spit out 3D objects.
The reason for not choosing an existing language for OpenSCAD is simply that we haven’t found any languages which fit our requirements.
So far, the closest conceptual match I’ve found is XSLT - and virtually everyone I’ve talked to having ever used XSLT would cringe on hearing those 4 letters :/
Once you look further however, you could probably model all of OpenSCAD’s behavior using a pure functional language. The challenge is that said languages tend to be less suitable for non-programmers to both read and write. Once we redefine some of OpenSCAD’s mistakes, we could probably define OpenSCAD as a syntactical front-end to such a pure functional evaluation engine.
Using a faster and more powerful CAD kernel is indeed on the radar. Sadly, the world of Open Source CAD kernels is severely limited. If we manage to get sufficient contributions or funding, working towards such a kernel would be doable. If you have any spare time, this would be a good place to start: https://github.com/openscad/openscad/wiki/Project%3A-Survey-of-CSG-algorithms
..or if someone has the experience to do so: Evaluate OpenCascade as an option. Most people I’ve talked to who’ve ever used that has strongly recommended me never to touch it though. ..but FreeCAD somehow manages.
-Marius
Hi Marius!
On 2015-05-14 16:22, Marius Kintel wrote:
OpenSCAD aim to directly describe a 3D design hierarchy, not merely
execute code to spit out 3D objects.
I do understand, and any language chosen would obviously have to support
the design hierarchy. As far as I can tell, many languages should be
able to do it. Personally, I use modules in OpenSCAD extensively, but I
would be even happier with a class concept with both member functions
and data members. A 3d hierarchy can be expressed also that way.
Anyway, this was just my thoughts. OpenSCAD has made decisions long ago,
which I respect. Perhaps one could keep the OpenSCAD language limited
and use it as an intermediate representation generated by the kind of
object oriented language I am dreaming of :-)
Using a faster and more powerful CAD kernel is indeed on the radar.
Sadly, the world of Open Source CAD kernels is severely limited.
If we manage to get sufficient contributions or funding, working
towards such a kernel would be doable. If you have any spare
time, this would be a good place to start:
https://github.com/openscad/openscad/wiki/Project%3A-Survey-of-CSG-algorithms
..or if someone has the experience to do so: Evaluate OpenCascade as an
option. Most people I’ve talked to who’ve ever used that has strongly
recommended me never to touch it though. ..but FreeCAD somehow manages.
The funny thing is, I evaluated CAS.CADE (as it was known at the time)
in about 1994-1995 for the work previously mentioned. It was marketed by
Matra Datavision in France and I even went to see them a couple of
times. They had what we thought was a curious idea of their own
home-grown language (CDL) encapsulating the C++ kernel. Nowadays it
looks like some finally agree with our thoughts at the time :
http://dev.opencascade.org/doc/overview/html/occt_dev_guides__cdl.html
"Please note that CDL is considered as obsolete and is to be removed in
one of future releases of OCCT." :-)
CAS.CADE was closed source and extremely expensive back then, but we
still struggled very hard to make use of it. The end result for us was
that it was dropped and replaced it with ACIS. Only a few years ago, I
discovered CAS.CADE had become quasi open source as OpenCascade (OCCT).
I also found there is now something called OCE - Open CASCADE Community
Edition https://github.com/tpaviot/oce/
I had the idea of trying OCE, but frankly not enough incentive and power
to do it, and my work is different now. OCE may probably be something to
be considered for OpenSCAD CAD kernel, I suspect OpenCascade has come a
long way since I saw it.
Sidenote: One thing that has struck me is that the compilation in
OpenSCAD is quite fast, but the rendering (F6) is extremely slow. I was
wondering if the generation of triangles for STL really needs the
graphical rendering to be completed first? If not, one could imagine a
function to export the compiled model to STL and use an external viewer
to speed things up when iterating on a complex design that takes forever
to render.
Carsten Arnholm
On 05/14/2015 06:58 PM, Carsten Arnholm wrote:
Sidenote: One thing that has struck me is that the compilation
in OpenSCAD is quite fast, but the rendering (F6) is extremely
slow. I was wondering if the generation of triangles for STL
really needs the graphical rendering to be completed first? If
not, one could imagine a function to export the compiled model
to STL and use an external viewer to speed things up when iterating
on a complex design that takes forever to render.
No, F6 being slow is mainly due to the CSG processing in CGAL.
While the OpenGL rendering itself is badly in need of improvement
(or should at least get additional support for GPU based rendering)
it's not the biggest factor in most cases.
Preview (F5) is fast as there is no CSG happening on mesh level, but
it's handled by OpenCSG using clever OpenGL rendering.
STL export needs the fully generated mesh which is generally not
available after just doing a preview.
ciao,
Torsten.
On May 14, 2015, at 12:58 PM, Carsten Arnholm arnholm@arnholm.org wrote:
Anyway, this was just my thoughts. OpenSCAD has made decisions long ago, which I respect. Perhaps one could keep the OpenSCAD language limited and use it as an intermediate representation generated by the kind of object oriented language I am dreaming of :-)
There are a number of projects doing this by implementing API front-ends for various programming languages, and generate OpenSCAD code.
Also, in the ongoing language revision discussions, one of the possible features we’re discussing is to allow functions to return shapes (i.e. unify the concept of functions and modules). This would make it possible for programmers to abstract away some of the things which has to be explicit today.
-Marius
On 2015-05-15 03:47, Marius Kintel wrote:
There are a number of projects doing this by implementing API
front-ends for various programming languages, and generate OpenSCAD
code.
Interesting, any links?
Also, in the ongoing language revision discussions, one of the
possible features we’re discussing is to allow functions to return
shapes (i.e. unify the concept of functions and modules). This would
make it possible for programmers to abstract away some of the things
which has to be explicit today.
Better abstraction features would be great, that is in essence what I
wanted. OpenSCAD is "The Programmers Solid 3D CAD Modeller" and as a
software engineer I would like to have similar abstraction capabilities
when "programming 3d models" as when programming applications. So a move
in that direction is good.
However, improving the modelling capabilities with general sweeping etc.
is just as important.
Thanks for the great work you are doing!
Carsten Arnholm
kintel wrote
There are a number of projects doing this by implementing API front-ends
for various programming languages, and generate OpenSCAD code.
Talking about this, I've been wondering why OpenSCAD doesn't have associated
array like {angle:30,r:3}.
It's not like OpenSCAD doesn't need it. The existence of lookup() and
search() seems to show that we do have such a need.
kintel wrote
Also, in the ongoing language revision discussions, one of the possible
features we’re discussing is to allow functions to return shapes (i.e.
unify the concept of functions and modules). This would make it possible
for programmers to abstract away some of the things which has to be
explicit today.
Cool. That would be a quantum leap. I'd also like to see the possibility of
local functions inside a function. Maybe like this:
function f ()=
let( function insider()=... )
do something with insider()
$ Runsun Pan, PhD
$ -- OpenScad_DocTest: doc and unit test ( Github , Thingiverse )
$ -- hash parameter model: here , here
$ -- Linux Mint 17.1 Rebecca x64 + OpenSCAD 2015.03.15/2015.04.01.nightly
--
View this message in context: http://forum.openscad.org/eval-tp12627p12656.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
On May 15, 2015, at 14:37 PM, runsun runsun@gmail.com wrote:
Talking about this, I've been wondering why OpenSCAD doesn't have associated
array like {angle:30,r:3}.
That would be an interesting addition. I’ll keep it on my mental checklist.
Cool. That would be a quantum leap. I'd also like to see the possibility of
local functions inside a function.
Yes, support for lambda functions would be part of that redesign.
-Marius
On May 15, 2015, at 08:38 AM, arnholm@arnholm.org wrote:
On 2015-05-15 03:47, Marius Kintel wrote:
There are a number of projects doing this by implementing API
front-ends for various programming languages, and generate OpenSCAD
code.
Interesting, any links?
I’m not following these very closely, so the state may vary quite a bit and I may have forgotten some:
https://github.com/avalero/OOML
https://github.com/Joaz/CrystalScad
https://github.com/farrellm/scad-clj
https://hackage.haskell.org/package/OpenSCAD-0.2.0.0
https://github.com/smcameron/opencscad
https://github.com/kevinmehall/pyscad
-Marius
runsun said:
Talking about this, I've been wondering why OpenSCAD doesn't have
associative
array like {angle:30,r:3}.
It's not like OpenSCAD doesn't need it. The existence of lookup() and
search() seems to show that we do have such a need.
I agree. Thanks for mentioning this; I will make sure to incorporate this
idea.
runsun also said:
I'd also like to see the possibility of
local functions inside a function. Maybe like this:
Nested functions are definitely part of the plan.
On 15 May 2015 at 14:37, runsun runsun@gmail.com wrote:
kintel wrote
There are a number of projects doing this by implementing API front-ends
for various programming languages, and generate OpenSCAD code.
Talking about this, I've been wondering why OpenSCAD doesn't have
associated
array like {angle:30,r:3}.
It's not like OpenSCAD doesn't need it. The existence of lookup() and
search() seems to show that we do have such a need.
kintel wrote
Also, in the ongoing language revision discussions, one of the possible
features we’re discussing is to allow functions to return shapes (i.e.
unify the concept of functions and modules). This would make it possible
for programmers to abstract away some of the things which has to be
explicit today.
Cool. That would be a quantum leap. I'd also like to see the possibility of
local functions inside a function. Maybe like this:
function f ()=
let( function insider()=... )
do something with insider()
$ Runsun Pan, PhD
$ -- OpenScad_DocTest: doc and unit test ( Github , Thingiverse )
$ -- hash parameter model: here , here
$ -- Linux Mint 17.1 Rebecca x64 + OpenSCAD 2015.03.15/2015.04.01.nightly
--
View this message in context:
http://forum.openscad.org/eval-tp12627p12656.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
On 2015-05-15 21:59, Marius Kintel wrote:
I’m not following these very closely, so the state may vary quite a bit and I may have forgotten some:
https://github.com/avalero/OOML
https://github.com/Joaz/CrystalScad
https://github.com/farrellm/scad-clj
https://hackage.haskell.org/package/OpenSCAD-0.2.0.0
https://github.com/smcameron/opencscad
https://github.com/kevinmehall/pyscad
Thank you!
I will have a look at these. OOML seems superficially similar to what I
was thinking about, but I just browsed it quickly so I could be wrong.
It does not seem like it is alive anymore, however. I will check it anyway.
Carsten Arnholm