The OpenSCAD scripting language is fine. It works, don't fix it!
There has been and are many similar "issues" in other domains, e.g. CSOUND (for sound synthesis), PostScript... What I find important is to have a stable and reliable scripting langue. Then we can design and write any kind of high-level tool that outputs, for example, OpenSCAD script. If you want a quick preview at the high-level stage, then you'll have to generate that separately yourself.
I find OpenSCAD extremely useful and attractive. It has exactly the functionality that some of the early (1980s) CAD systems had, that focused on specifying geometries by text that then rendered graphically and/or converted to Gerber code (and other formats).
/mikael
On 26 Nov 2020, at 16:49, acraigwest@gmail.commailto:acraigwest@gmail.com wrote:
EXTERNAL EMAIL: This email originated from outside of the University of Limerick. Do not click on links or open attachments unless you recognize the sender's email address and know the content is safe.
Java isn't javascript...
Also, most professional programmers I know still work in Java. Most of us still hate javascript, although since nodejs is a thing I have found it to be useful...
Personally I like the openSCAD language, but do support adding a few things...
On Thu, 26 Nov 2020, 11:37 David, <ainut@hiwaay.netmailto:ainut@hiwaay.net> wrote:
BUT -- no one uses Java or Javascript anymore. Everyone hates it but just a few people. If there is no one to support it, especially for FREE! then it is doomed as a target.
On 11/26/20 4:36 AM, Tim Hawkins wrote:
I would rather we used JavaScript instead of python, V8 has extension mechanisms that would allow it to be embedded inside the existing app, and have the openscad objects and backend plugged in. Plus JS is block structured rather than indent structured, which is the same as the current implementation, which minimizes impact on people.
There are 1000's of JavaScript embeddable editors that do full syntax highlighting, folding and dynamic formatting, there are very few for python.
On Thu, Nov 26, 2020, 14:34 MichaelAtOz <oz.at.michael@gmail.commailto:oz.at.michael@gmail.com> wrote:
One unique aspect of OpenSCAD is preview.
Having a usually snappy visualisation of your geometry is invaluable.
This is where enhancements come in conflict.
Because preview does not actually make geometry you can't have features
which require the geometry to be calculated, it will kill the advantage of
preview.
Like getting a vector of the points of an object.
g = render() { someObjects(); } // caching may help, but it would be
painful.
extremely simple programs. The simplest program in OpenSCAD is
"cube(10);".
That plus Preview, is OpenSCAD.
If OpenSCAD did not have Preview, I doubt it would have the uptake it has.
Thus anything without both will no longer be OpenSCAD. It is a niche.
OpenSCAD Admin - email* me if you need anything, or if I've done something stupid...
Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.
--
Sent from: http://forum.openscad.org/
OpenSCAD mailing list
Discuss@lists.openscad.orgmailto:Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
OpenSCAD mailing list
Discuss@lists.openscad.orgmailto:Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
OpenSCAD mailing list
Discuss@lists.openscad.orgmailto:Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
EXTERNAL EMAIL: This email originated from outside of the University of Limerick. Do not click on links or open attachments unless you recognize the sender's email address and know the content is safe.
OpenSCAD mailing list
Discuss@lists.openscad.orgmailto:Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
If you think the OpenSCAD language is "fine" then probably you're not trying
to do anything nontrivial. I mean, if you want to throw a few cubes and
cylinders out somewhere it's fine. But if you want to write nontrivial
geometric algorithms (to fill in the missing functionality) then challenges
quickly mount. Algorithms in the literature may be O(N*log(N)) but that
assumes you have actual data structures. In OpenSCAD it may turn out to be
O(N^3) instead. In many cases it just doesn't seem practical to implement
efficient algorithms. My offset() code for example (which computes the
offset to a polygon defined by a point list, similar to the offset module)
doesn't always work because I couldn't find a way to implement a robust
algorithm in OpenSCAD, and it can be slow. When you need 50 offset calls to
make a shape that adds up.
The lack of data structures can be a significant source of frustration just
in general, and in terms of code readability and maintainability. (And if
you implement data structures in OpenSCAD they end up horribly inefficient
and clumsy due to the immutability of data, which mean that every change to
a data structure requires completely rewriting the data.)
If libraries supply functionality then users can use them without having to
understand the internals. But trying to write the libraries can be a
challenge given the limitations of OpenSCAD.
Mikael at UL wrote
The OpenSCAD scripting language is fine. It works, don't fix it!
There has been and are many similar "issues" in other domains, e.g. CSOUND
(for sound synthesis), PostScript... What I find important is to have a
stable and reliable scripting langue. Then we can design and write any
kind of high-level tool that outputs, for example, OpenSCAD script. If you
want a quick preview at the high-level stage, then you'll have to generate
that separately yourself.
I find OpenSCAD extremely useful and attractive. It has exactly the
functionality that some of the early (1980s) CAD systems had, that focused
on specifying geometries by text that then rendered graphically and/or
converted to Gerber code (and other formats).
/mikael
On 26 Nov 2020, at 16:49,
acraigwest@
<mailto:
acraigwest@
> wrote:
EXTERNAL EMAIL: This email originated from outside of the University of
Limerick. Do not click on links or open attachments unless you recognize
the sender's email address and know the content is safe.
Java isn't javascript...
Also, most professional programmers I know still work in Java. Most of us
still hate javascript, although since nodejs is a thing I have found it to
be useful...
Personally I like the openSCAD language, but do support adding a few
things...
On Thu, 26 Nov 2020, 11:37 David, <
ainut@
<mailto:
ainut@
>> wrote:
BUT -- no one uses Java or Javascript anymore. Everyone hates it but just
a few people. If there is no one to support it, especially for FREE! then
it is doomed as a target.
On 11/26/20 4:36 AM, Tim Hawkins wrote:
I would rather we used JavaScript instead of python, V8 has extension
mechanisms that would allow it to be embedded inside the existing app, and
have the openscad objects and backend plugged in. Plus JS is block
structured rather than indent structured, which is the same as the current
implementation, which minimizes impact on people.
There are 1000's of JavaScript embeddable editors that do full syntax
highlighting, folding and dynamic formatting, there are very few for
python.
On Thu, Nov 26, 2020, 14:34 MichaelAtOz <
oz.at.michael@
<mailto:
oz.at.michael@
>> wrote:
One unique aspect of OpenSCAD is preview.
Having a usually snappy visualisation of your geometry is invaluable.
This is where enhancements come in conflict.
Because preview does not actually make geometry you can't have features
which require the geometry to be calculated, it will kill the advantage of
preview.
Like getting a vector of the points of an object.
g = render() { someObjects(); } // caching may help, but it would be
painful.
extremely simple programs. The simplest program in OpenSCAD is
"cube(10);".
That plus Preview, is OpenSCAD.
If OpenSCAD did not have Preview, I doubt it would have the uptake it has.
Thus anything without both will no longer be OpenSCAD. It is a niche.
OpenSCAD Admin - email* me if you need anything, or if I've done
something stupid...
Unless specifically shown otherwise above, my contribution is in the
Public Domain; to the extent possible under law, I have waived all
copyright and related or neighbouring rights to this work. Obviously
inclusion of works of previous authors is not included in the above.
--
Sent from: http://forum.openscad.org/
OpenSCAD mailing list
Discuss@.openscad
<mailto:
Discuss@.openscad
Discuss@.openscad
<mailto:
Discuss@.openscad
Discuss@.openscad
<mailto:
Discuss@.openscad
>
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
EXTERNAL EMAIL: This email originated from outside of the University of
Limerick. Do not click on links or open attachments unless you recognize
the sender's email address and know the content is safe.
OpenSCAD mailing list
Discuss@.openscad
<mailto:
Discuss@.openscad
Discuss@.openscad
--
Sent from: http://forum.openscad.org/
"most professional programmers I know still work in Java"
Wow. Just wow. Java has been over for so long.
That is not the point. The point is that we will never get anywhere
trying to force our particular personal favorite language on this community.
Jon
But if you want to write nontrivial geometric algorithms (to fill in the
missing functionality) then challenges quickly mount.
Yes no doubt they would but I can make everything I need without nontrivial
geometric algorithms. I do just compose cube and cylinders in the main plus
a few sweeps, isn't that what CSG is? If you don't want to make
geometry with CSG then OpenSCAD doesn't seem to be the right tool. It is
certainly not a good language for coding algorithms.
On Thu, 26 Nov 2020 at 18:29, adrianv avm4@cornell.edu wrote:
If you think the OpenSCAD language is "fine" then probably you're not
trying
to do anything nontrivial. I mean, if you want to throw a few cubes and
cylinders out somewhere it's fine. But if you want to write nontrivial
geometric algorithms (to fill in the missing functionality) then challenges
quickly mount. Algorithms in the literature may be O(N*log(N)) but that
assumes you have actual data structures. In OpenSCAD it may turn out to be
O(N^3) instead. In many cases it just doesn't seem practical to implement
efficient algorithms. My offset() code for example (which computes the
offset to a polygon defined by a point list, similar to the offset module)
doesn't always work because I couldn't find a way to implement a robust
algorithm in OpenSCAD, and it can be slow. When you need 50 offset calls
to
make a shape that adds up.
The lack of data structures can be a significant source of frustration just
in general, and in terms of code readability and maintainability. (And if
you implement data structures in OpenSCAD they end up horribly inefficient
and clumsy due to the immutability of data, which mean that every change to
a data structure requires completely rewriting the data.)
If libraries supply functionality then users can use them without having to
understand the internals. But trying to write the libraries can be a
challenge given the limitations of OpenSCAD.
Mikael at UL wrote
The OpenSCAD scripting language is fine. It works, don't fix it!
There has been and are many similar "issues" in other domains, e.g.
CSOUND
(for sound synthesis), PostScript... What I find important is to have a
stable and reliable scripting langue. Then we can design and write any
kind of high-level tool that outputs, for example, OpenSCAD script. If
you
want a quick preview at the high-level stage, then you'll have to
generate
that separately yourself.
I find OpenSCAD extremely useful and attractive. It has exactly the
functionality that some of the early (1980s) CAD systems had, that
focused
on specifying geometries by text that then rendered graphically and/or
converted to Gerber code (and other formats).
/mikael
On 26 Nov 2020, at 16:49,
acraigwest@
<mailto:
acraigwest@
> wrote:
EXTERNAL EMAIL: This email originated from outside of the University of
Limerick. Do not click on links or open attachments unless you recognize
the sender's email address and know the content is safe.
Java isn't javascript...
Also, most professional programmers I know still work in Java. Most of us
still hate javascript, although since nodejs is a thing I have found it
to
be useful...
Personally I like the openSCAD language, but do support adding a few
things...
On Thu, 26 Nov 2020, 11:37 David, <
ainut@
<mailto:
ainut@
>> wrote:
BUT -- no one uses Java or Javascript anymore. Everyone hates it but
just
a few people. If there is no one to support it, especially for FREE!
then
it is doomed as a target.
On 11/26/20 4:36 AM, Tim Hawkins wrote:
I would rather we used JavaScript instead of python, V8 has extension
mechanisms that would allow it to be embedded inside the existing app,
and
have the openscad objects and backend plugged in. Plus JS is block
structured rather than indent structured, which is the same as the
current
implementation, which minimizes impact on people.
There are 1000's of JavaScript embeddable editors that do full syntax
highlighting, folding and dynamic formatting, there are very few for
python.
On Thu, Nov 26, 2020, 14:34 MichaelAtOz <
oz.at.michael@
<mailto:
oz.at.michael@
>> wrote:
One unique aspect of OpenSCAD is preview.
Having a usually snappy visualisation of your geometry is invaluable.
This is where enhancements come in conflict.
Because preview does not actually make geometry you can't have features
which require the geometry to be calculated, it will kill the advantage
of
preview.
Like getting a vector of the points of an object.
g = render() { someObjects(); } // caching may help, but it would be
painful.
extremely simple programs. The simplest program in OpenSCAD is
"cube(10);".
That plus Preview, is OpenSCAD.
If OpenSCAD did not have Preview, I doubt it would have the uptake it
has.
Thus anything without both will no longer be OpenSCAD. It is a niche.
OpenSCAD Admin - email* me if you need anything, or if I've done
something stupid...
Unless specifically shown otherwise above, my contribution is in the
Public Domain; to the extent possible under law, I have waived all
copyright and related or neighbouring rights to this work. Obviously
inclusion of works of previous authors is not included in the above.
--
Sent from: http://forum.openscad.org/
OpenSCAD mailing list
Discuss@.openscad
<mailto:
Discuss@.openscad
Discuss@.openscad
<mailto:
Discuss@.openscad
Discuss@.openscad
<mailto:
Discuss@.openscad
>
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
EXTERNAL EMAIL: This email originated from outside of the University of
Limerick. Do not click on links or open attachments unless you recognize
the sender's email address and know the content is safe.
OpenSCAD mailing list
Discuss@.openscad
<mailto:
Discuss@.openscad
Discuss@.openscad
--
Sent from: http://forum.openscad.org/
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
On 11/26/2020 10:31 AM, jon wrote:
That is not the point. The point is that we will never get anywhere
trying to force our particular personal favorite language on this
community.
I wouldn't characterize a Python (or JavaScript or Forth or FORTRAN or
TECO) based tool as OpenSCAD.
I would characterize it more as an alternative that people might choose
to move to.
In a sense, the OpenSCAD community is also the "I want to write a
program to generate geometry" community, and so starting a discussion
here makes some sense, but if it goes much beyond a "what if" discussion
then it needs to split into a different project.
On Thu, 26 Nov 2020 11:28:44 -0700 (MST)
adrianv avm4@cornell.edu wrote:
If you think the OpenSCAD language is "fine" then probably you're not trying
to do anything nontrivial.
Or you are using it as intended - it's not a "language" in the classic
interpretive sense - it's a data structure with some compression features.
My tools output OpenSCAD, it's great for that. I think it's kind of
meaningless to talk about replacing OpenSCAD's language with python
because they are just not the same thing. OpenSCAD is a definition,
python would produce a program which instantiated and bound objects to
some kind of scene. By all means go and build that - but you will end up
working at the library level with csg libraries, or outputting an openscad
file of the resulting construct. The former means you can query internal
state more easily, the latter is easy to do and has been done many times
already.
Either way you don't end up with anything connected to OpenSCAD beyond
perhaps being able to recycle code.
Alan
Note that I'm not taking a position on the OpenSCAD language being replaced.
I'm just making observations about challenges and limitations.
What does it mean to use a language "as intended"? You can only model
things the original designer imagined? Seems like a weird way to think
about things. When computer languages are released into the wild users will
use them to do what they want, not what the designers imagined. Where's
the threshold for a model being "wrong" for OpenSCAD? Note that OpenSCAD
certainly is a language in the classical sense. It's got functions and
recursion and can theoretically do anything. It's just that doing things is
not always easy, or efficient. The code is harder to write. Of course,
once it's written then the complexity is hidden, and the actual models are
easy to construct.
The question about what OpenSCAD is "for" I think leads to the question of
whether it's a toy environment or an environment for real design. The
driving problem I generally struggle with is that every edge and corner in
my 3d printed models should be filleted or rounded, and this tends to be
very difficult, even though my models are pretty simple. I think I may have
this problem mostly solved, but it wasn't easy. Is there a better tool for
this, for constructing simple models with specified parametric dimensions,
where parts can have roundovers applied without a struggle?
Alan Cox-2 wrote
On Thu, 26 Nov 2020 11:28:44 -0700 (MST)
adrianv <
avm4@
> wrote:
If you think the OpenSCAD language is "fine" then probably you're not
trying
to do anything nontrivial.
Or you are using it as intended - it's not a "language" in the classic
interpretive sense - it's a data structure with some compression features.
My tools output OpenSCAD, it's great for that. I think it's kind of
meaningless to talk about replacing OpenSCAD's language with python
because they are just not the same thing. OpenSCAD is a definition,
python would produce a program which instantiated and bound objects to
some kind of scene. By all means go and build that - but you will end up
working at the library level with csg libraries, or outputting an openscad
file of the resulting construct. The former means you can query internal
state more easily, the latter is easy to do and has been done many times
already.
Either way you don't end up with anything connected to OpenSCAD beyond
perhaps being able to recycle code.
Alan
OpenSCAD mailing list
Discuss@.openscad
--
Sent from: http://forum.openscad.org/
On 11/26/2020 11:31 AM, Alan Cox wrote:
My tools output OpenSCAD, it's great for that. I think it's kind of
meaningless to talk about replacing OpenSCAD's language with python
because they are just not the same thing. OpenSCAD is a definition,
python would produce a program which instantiated and bound objects to
some kind of scene. By all means go and build that - but you will end
up working at the library level with csg libraries, or outputting an
openscad file of the resulting construct. The former means you can
query internal state more easily, the latter is easy to do and has
been done many times already.
Either way you don't end up with anything connected to OpenSCAD beyond
perhaps being able to recycle code.
I don't really understand this assertion.
Here's a simple OpenSCAD model:
// Curtain rod screw base
//
// |d4|
// |<d3>|
// |<-d2->|
//
// -- | |
// h3 | |
// -- || ||
// | || ||
// h2 || ||
// | || ||
// -- ================
// h1 ================
// -- ================
//
// |<----d1---->|
$fs = 0.5;
d1 = 16.8;
d2 = 9.5; // 10 is too big, 9 is a little too small
d3 = 6.5;
d4 = 4.5;
nub = 0.5;
h1 = 2;
h23 = 16.5;
h3 = 5;
h2 = h23 - h3;
h123 = h1 + h2 + h3;
h12 = h1 + h2;
difference() {
union () {
cylinder(h=h1, d=d1);
cylinder(h=h123, d=d2);
cylinder(h=h123, d=d2+nub*2, $fn=3);
}
cylinder(h=h123*3, d=d4, center=true);
translate([0,0,h12]) cylinder(h=h3*3, d=d3);
}
Here's that same model (modulo that I don't have a trivial way to make
equilateral triangles) expressed in my Python-based prototype:
# Curtain rod screw base
#
# |d4|
# |<d3>|
# |<-d2->|
#
# -- | |
# h3 | |
# -- || ||
# | || ||
# h2 || ||
# | || ||
# -- ================
# h1 ================
# -- ================
#
# |<----d1---->|
d1 = 16.8
d2 = 9.5 # 10 is too big, 9 is a little too small
d3 = 6.5
d4 = 4.5
nub = 0.5
h1 = 2
h23 = 16.5
h3 = 5
h2 = h23 - h3
h123 = h1 + h2 + h3
h12 = h1 + h2
Difference(
Union(
Cylinder(d1/2, h1),
Cylinder(d2/2, h123),
# I don't have a trivial way to do a triangle yet
# cylinder(d2/2+nub, h123)
),
Cylinder(d4/2, h123*3, True),
Cylinder(d3/2, h3*3).translate([0,0,h2])
).add()
Sure looks awfully similar to me.
(I think I could have it do keyword-based arguments, so have "r=xxx,
h=yyy" style arguments. I just haven't.)
I'm not saying that this particular library is the greatest possible
answer, just that you can have a Python-based infrastructure that looks
a lot like OpenSCAD. Most OpenSCAD constructs would translate across
pretty directly. Same for JavaScript. (Maybe just for fun I should
translate my Python infrastructure over to run under Node.js.)
For practical purposes, what's the difference? (And yes, one answer is
"in Python you could XXX", but the responses to that are "but you don't
have to" and "yes, you can, and that's the point".)
(If you're wondering, this is a curtain-rod mounting part. You screw it
to the wall, and then you mash the wooden curtain rod holder down onto
it. We lost one of the plastic pieces that came with the curtain rod
holder.)
Design note: I'm torn between Union(a, b), a.union(b), and a+b as ways
to represent "union", and similarly for the other operators. Right now
I've implemented the first two.
I think the point of the discussion is that at the moment, OpenSCAD is a
great tool but, like any tool, it has it's limitations.
Where I, as a newbie, would like to get is more 'programmatic' structure
in the building of our tools. That is, for example, 'includes' that
don't eat it's young while trying to be parsed. More streamlined
lexicology. Variables that can be either global or local, depending
upon the particular syntax the designer/programmer declares.
Implementation of 'libraries' that we can share with each other, like
the parametric design of screws and nust, or 3D printable items that can
be called as assemblies or subassemblies. And suchlike.
Am I the only one?
David
On 11/26/20 2:03 PM, adrianv wrote:
Note that I'm not taking a position on the OpenSCAD language being replaced.
I'm just making observations about challenges and limitations.
What does it mean to use a language "as intended"? You can only model
things the original designer imagined? Seems like a weird way to think
about things. When computer languages are released into the wild users will
use them to do what they want, not what the designers imagined. Where's
the threshold for a model being "wrong" for OpenSCAD? Note that OpenSCAD
certainly is a language in the classical sense. It's got functions and
recursion and can theoretically do anything. It's just that doing things is
not always easy, or efficient. The code is harder to write. Of course,
once it's written then the complexity is hidden, and the actual models are
easy to construct.
The question about what OpenSCAD is "for" I think leads to the question of
whether it's a toy environment or an environment for real design. The
driving problem I generally struggle with is that every edge and corner in
my 3d printed models should be filleted or rounded, and this tends to be
very difficult, even though my models are pretty simple. I think I may have
this problem mostly solved, but it wasn't easy. Is there a better tool for
this, for constructing simple models with specified parametric dimensions,
where parts can have roundovers applied without a struggle?
Alan Cox-2 wrote
On Thu, 26 Nov 2020 11:28:44 -0700 (MST)
adrianv <
avm4@
> wrote:
If you think the OpenSCAD language is "fine" then probably you're not
trying
to do anything nontrivial.
Or you are using it as intended - it's not a "language" in the classic
interpretive sense - it's a data structure with some compression features.
My tools output OpenSCAD, it's great for that. I think it's kind of
meaningless to talk about replacing OpenSCAD's language with python
because they are just not the same thing. OpenSCAD is a definition,
python would produce a program which instantiated and bound objects to
some kind of scene. By all means go and build that - but you will end up
working at the library level with csg libraries, or outputting an openscad
file of the resulting construct. The former means you can query internal
state more easily, the latter is easy to do and has been done many times
already.
Either way you don't end up with anything connected to OpenSCAD beyond
perhaps being able to recycle code.
Alan
OpenSCAD mailing list
Discuss@.openscad
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
--
Sent from: http://forum.openscad.org/
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
MichaelAtOz oz.at.michael@gmail.com
wrote:
One unique aspect of OpenSCAD is preview.
Having a usually snappy visualisation of your geometry is invaluable.
An excellent point and one which I agree w/ wholeheartedly, and it is why I use OpenSCAD and BlockSCAD (and wanted to be successful w/ OpenJSCAD when I thought learning JavaScript was a good idea).
What is the internal model used?
One of the big things for TeX/LaTeX is that a PDF is generated and then displayed interactively and for the various editors one can switch between different compilers and even different scripting languages.
Would it be possible to have OpenSCAD preview languages such as:
http://www.plasm.net/
The page I linked before lists a number of such tools.
I suspect that there's some internal representation of the 3D object for performance reasons and that generating and viewing an STL to preview is not workable since it would be too slow?
William