List: discuss@lists.openscad.org
From: Guenther Sohler
Re: python support for openscad
Sun, Jul 23, 2023 7:45 PM
internal vertices to
read them and work with the coordinates.
Unfortunately this is not as easy, because often a model is developed in
OpenCSG and there are no coordinates available in OpenSCG.
If you accept the fact that a full render has to be performed to get
coordinates of a submodule. It's just a matter of a PR.
If somebody guarantees, that such a PR will actually be accepted/merged,
time to develop on such a PR would not be an issue.
My Main Problem with SCAD language is that variables cannot be reassigned,
once they are set -> could probably be solved with most other interpreter
languages.
The main benefit I see with python is not the opposite of the previous
statement. Python is just any interpreter language choice. but its very
easy to learn and very easy to read.
PLUS: it has many accompanying libraries which will help you to do fancy
stuff with OpenSCAD.
for example this one:
http://guenther-sohler.net/openscad/examples/qrcode.txt
these few lines of code creates an qr code display object , which you can
scan with your mobile. (Yes, i have seen openscad qr code libs, but this
one appears easier and has more options)
And your second statement : OpenSCAD has datastructures is also valid.
Polyhedra are composed of triangles which are stored as coordinates only!
It would be much better to compose triangles from
indices into a global vertex array. This is something I am right now
working on.(some ctests are not passed for my PR)
Information which could also be stored with the "indexed " polygons is: a
lookup table from point -> which triangles use this point.
And Yes, I like your fillet and I personally appreciate , if Sanjeev's
knowledge could go into GeomtryEvaluator.cc
In the End, I'd like to see openscad become more powerful by being able to
change variables once they are set and to use external libs.
And yes, I know that I am aware that people might see this as a security
risk, but those people can stay safe and do not even need to bother when
not activating it.
The rest and the interested people instead can leverage the new power
coming from python.
Thank you for reading
On Sun, Jul 23, 2023 at 9:08 PM Adrian Mariano
wrote:
> I've been working on BOSL2 for a while with Revar, and we have 60k lines
> of OpenSCAD code. Based on that experience, I think that the problem with
> the OpenSCAD language is NOT fundamentally that it is functional. The
> benefit of python is NOT fundamentally that it is procedural. There are
> two basic problems with OpenSCAD for doing more complicated user space
> processing. One is the inability to gain access to geometry, so to do user
> space design, everything from the ground up has to be done "outside" of the
> OpenSCAD geometry engine. The second problem is about efficiency.
> OpenSCAD has no data structures. Graphics algorithms assume access to
> sophisticated and efficient data structures like a priority queue or a tree
> or other kinds of things that are impossible to implement efficiently in
> OpenSCAD. So, yeah, you can implement the data structure, but instead of
> being O(log N) or whatever it will be O(N^2). So then trying to implement
> that process that uses that data structure in user space becomes
> intractable. It's not clear to me that this limitation is fundamentally
> about the language being functional.
>
> Note that the filleting process displayed by Sanjeev is straight forward
> to implement in principle. You just find the intersection of two things
> and put a fillet there. Two complications arise for doing this in
> userspace in OpenSCAD. The first is representing the things, because
> again, you can't use the geometry engine to do it. Now maybe a solution to
> that problem is coming? The second complication is dealing with
> self-intersections of the resulting polyhedron, because that's intractable
> in OpenSCAD. Really it seems like OpenSCAD should have a primitive that
> accepts a series of profiles and links them together into a polyhedron,
> even if it's self-intersecting.
>
> Here's examples of doing the fillet problem entirely in OpenSCAD
> userspace. There are many examples at the link below. I show a single one
> in this message.
>
>
> https://github.com/BelfrySCAD/BOSL2/wiki/rounding.scad#functionmodule-join_prism
>
> [image: image.png]
>
>
> On Sun, Jul 23, 2023 at 1:14 PM Sanjeev Prabhakar <
> sprabhakar2006@gmail.com> wrote:
>
>> Sure
>> I will try to explain the logic maybe in a day or two for the benefit of
>> all who maybe interested in geometry manipulations.
>>
>>
>>
>> _______________________________________________
>> OpenSCAD mailing list
>> To unsubscribe send an email to discuss-leave@lists.openscad.org
>>
> _______________________________________________
> OpenSCAD mailing list
> To unsubscribe send an email to discuss-leave@lists.openscad.org
>