discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

PythonSCAD rocks!

TA
Todd Allen
Wed, May 7, 2025 6:12 PM

The new python-engine feature of recent development builds of OpenSCAD
motivated me to download PythonSCAD from https://pythonscad.org/download.php.
Python-engine in OpenSCAD incorporates PythonSCAD but less complete than
PythonSCAD's incorporation of OpenSCAD.  Running the following example
needs a PythonSCAD build but perhaps soon will also work directly in
OpenSCAD.

Let's start with a simple example from
https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad:
include <BOSL2/std.scad>
prismoid(50,30,25)
align(RIGHT)
color("lightblue")prismoid([10,5],[7,4],height=4,orient=RIGHT);
[image: align_10.png]

BOSL2 provides good tools for positioning and aligning basic 3d shapes.
But some things are still hard such as filleting the joint of the above
example.

We can fillet it in PythonSCAD by taking advantage of its offset() function
which when used with a negative offset to shrink a 3d object
fillets concave edges.  I made a file bosl2_example.scad containing:
include <BOSL2/std.scad>
module prismoids(oversize) {
os2 = oversize * 2;
down(oversize) prismoid(50+os2,30+os2,25+os2)
left(oversize) align(RIGHT)
color("lightblue")prismoid([10+os2,5+os2],[7+os2,4+os2],height=4+os2,
orient=RIGHT);
}

And a file fillet.py in the same directory containing:
from openscad import *
example = osinclude("bosl2_example.scad")
original = example.prismoids(oversize=0)
delta = 1.0
oversized = example.prismoids(oversize=delta)
filleted = oversized.offset(-delta, fa=10)
show([filleted,original.back(60)])

Preview of fillet.py in PythonSCAD:
[image: filleted_align_10.png]
The coloration did not pass from OpenSCAD into PythonSCAD properly and I've
stumbled on other issues suggesting PythonSCAD is less polished than
OpenSCAD but I'm excited enough by the potential that I plan on doing my
next project in PythonSCAD as it has other powerful capabilities such as
edges() and faces() which I expect will enable amazing new possibilities.
Currently OpenSCAD does not give one access to generated geometry and being
able to access and manipulate could be a game changer.

The new python-engine feature of recent development builds of OpenSCAD motivated me to download PythonSCAD from https://pythonscad.org/download.php. Python-engine in OpenSCAD incorporates PythonSCAD but less complete than PythonSCAD's incorporation of OpenSCAD. Running the following example needs a PythonSCAD build but perhaps soon will also work directly in OpenSCAD. Let's start with a simple example from https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad: include <BOSL2/std.scad> prismoid(50,30,25) align(RIGHT) color("lightblue")prismoid([10,5],[7,4],height=4,orient=RIGHT); [image: align_10.png] BOSL2 provides good tools for positioning and aligning basic 3d shapes. But some things are still hard such as filleting the joint of the above example. We can fillet it in PythonSCAD by taking advantage of its offset() function which when used with a negative offset to shrink a 3d object fillets concave edges. I made a file bosl2_example.scad containing: include <BOSL2/std.scad> module prismoids(oversize) { os2 = oversize * 2; down(oversize) prismoid(50+os2,30+os2,25+os2) left(oversize) align(RIGHT) color("lightblue")prismoid([10+os2,5+os2],[7+os2,4+os2],height=4+os2, orient=RIGHT); } And a file fillet.py in the same directory containing: from openscad import * example = osinclude("bosl2_example.scad") original = example.prismoids(oversize=0) delta = 1.0 oversized = example.prismoids(oversize=delta) filleted = oversized.offset(-delta, fa=10) show([filleted,original.back(60)]) Preview of fillet.py in PythonSCAD: [image: filleted_align_10.png] The coloration did not pass from OpenSCAD into PythonSCAD properly and I've stumbled on other issues suggesting PythonSCAD is less polished than OpenSCAD but I'm excited enough by the potential that I plan on doing my next project in PythonSCAD as it has other powerful capabilities such as edges() and faces() which I expect will enable amazing new possibilities. Currently OpenSCAD does not give one access to generated geometry and being able to access and manipulate could be a game changer.
GS
Guenther Sohler
Wed, May 7, 2025 6:32 PM

Thank you for the nice demonstration.
Please let us know where there are the biggest stumbling blocks so we can
set priorities correctly.

the lightblue color is not visible in the offset result, because offset
does a difference internally. green is the difference color.

On Wed, May 7, 2025 at 8:12 PM Todd Allen via Discuss <
discuss@lists.openscad.org> wrote:

The new python-engine feature of recent development builds of OpenSCAD
motivated me to download PythonSCAD from
https://pythonscad.org/download.php.  Python-engine in OpenSCAD
incorporates PythonSCAD but less complete than PythonSCAD's incorporation
of OpenSCAD.  Running the following example needs a PythonSCAD build but
perhaps soon will also work directly in OpenSCAD.

Let's start with a simple example from
https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad:
include <BOSL2/std.scad>
prismoid(50,30,25)
align(RIGHT)
color("lightblue")prismoid([10,5],[7,4],height=4,orient=RIGHT);
[image: align_10.png]

BOSL2 provides good tools for positioning and aligning basic 3d shapes.
But some things are still hard such as filleting the joint of the above
example.

We can fillet it in PythonSCAD by taking advantage of its offset()
function which when used with a negative offset to shrink a 3d object
fillets concave edges.  I made a file bosl2_example.scad containing:
include <BOSL2/std.scad>
module prismoids(oversize) {
os2 = oversize * 2;
down(oversize) prismoid(50+os2,30+os2,25+os2)
left(oversize) align(RIGHT)
color("lightblue")prismoid([10+os2,5+os2],[7+os2,4+os2],height=4+os2,
orient=RIGHT);
}

And a file fillet.py in the same directory containing:
from openscad import *
example = osinclude("bosl2_example.scad")
original = example.prismoids(oversize=0)
delta = 1.0
oversized = example.prismoids(oversize=delta)
filleted = oversized.offset(-delta, fa=10)
show([filleted,original.back(60)])

Preview of fillet.py in PythonSCAD:
[image: filleted_align_10.png]
The coloration did not pass from OpenSCAD into PythonSCAD properly and
I've stumbled on other issues suggesting PythonSCAD is less polished than
OpenSCAD but I'm excited enough by the potential that I plan on doing my
next project in PythonSCAD as it has other powerful capabilities such as
edges() and faces() which I expect will enable amazing new possibilities.
Currently OpenSCAD does not give one access to generated geometry and being
able to access and manipulate could be a game changer.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Thank you for the nice demonstration. Please let us know where there are the biggest stumbling blocks so we can set priorities correctly. the lightblue color is not visible in the offset result, because offset does a difference internally. green is the difference color. On Wed, May 7, 2025 at 8:12 PM Todd Allen via Discuss < discuss@lists.openscad.org> wrote: > The new python-engine feature of recent development builds of OpenSCAD > motivated me to download PythonSCAD from > https://pythonscad.org/download.php. Python-engine in OpenSCAD > incorporates PythonSCAD but less complete than PythonSCAD's incorporation > of OpenSCAD. Running the following example needs a PythonSCAD build but > perhaps soon will also work directly in OpenSCAD. > > Let's start with a simple example from > https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad: > include <BOSL2/std.scad> > prismoid(50,30,25) > align(RIGHT) > color("lightblue")prismoid([10,5],[7,4],height=4,orient=RIGHT); > [image: align_10.png] > > BOSL2 provides good tools for positioning and aligning basic 3d shapes. > But some things are still hard such as filleting the joint of the above > example. > > We can fillet it in PythonSCAD by taking advantage of its offset() > function which when used with a negative offset to shrink a 3d object > fillets concave edges. I made a file bosl2_example.scad containing: > include <BOSL2/std.scad> > module prismoids(oversize) { > os2 = oversize * 2; > down(oversize) prismoid(50+os2,30+os2,25+os2) > left(oversize) align(RIGHT) > color("lightblue")prismoid([10+os2,5+os2],[7+os2,4+os2],height=4+os2, > orient=RIGHT); > } > > And a file fillet.py in the same directory containing: > from openscad import * > example = osinclude("bosl2_example.scad") > original = example.prismoids(oversize=0) > delta = 1.0 > oversized = example.prismoids(oversize=delta) > filleted = oversized.offset(-delta, fa=10) > show([filleted,original.back(60)]) > > Preview of fillet.py in PythonSCAD: > [image: filleted_align_10.png] > The coloration did not pass from OpenSCAD into PythonSCAD properly and > I've stumbled on other issues suggesting PythonSCAD is less polished than > OpenSCAD but I'm excited enough by the potential that I plan on doing my > next project in PythonSCAD as it has other powerful capabilities such as > edges() and faces() which I expect will enable amazing new possibilities. > Currently OpenSCAD does not give one access to generated geometry and being > able to access and manipulate could be a game changer. > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
JD
John David
Wed, May 7, 2025 8:18 PM

BTW, I have not had time to play with my OpenSCAD code in PythonSCAD.  I
was not sure if I would be able to use some of OSC's advanced tools like
the new NURBS library.  With your example, I see that I need to make some
time and see if I can get colored SVG's to work properly (as part of my
laser cutter toolchain...

On Wed, May 7, 2025 at 2:33 PM Guenther Sohler via Discuss <
discuss@lists.openscad.org> wrote:

Thank you for the nice demonstration.
Please let us know where there are the biggest stumbling blocks so we can
set priorities correctly.

the lightblue color is not visible in the offset result, because offset
does a difference internally. green is the difference color.

On Wed, May 7, 2025 at 8:12 PM Todd Allen via Discuss <
discuss@lists.openscad.org> wrote:

The new python-engine feature of recent development builds of OpenSCAD
motivated me to download PythonSCAD from
https://pythonscad.org/download.php.  Python-engine in OpenSCAD
incorporates PythonSCAD but less complete than PythonSCAD's incorporation
of OpenSCAD.  Running the following example needs a PythonSCAD build but
perhaps soon will also work directly in OpenSCAD.

Let's start with a simple example from
https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad:
include <BOSL2/std.scad>
prismoid(50,30,25)
align(RIGHT)
color("lightblue")prismoid([10,5],[7,4],height=4,orient=RIGHT);
[image: align_10.png]

BOSL2 provides good tools for positioning and aligning basic 3d shapes.
But some things are still hard such as filleting the joint of the above
example.

We can fillet it in PythonSCAD by taking advantage of its offset()
function which when used with a negative offset to shrink a 3d object
fillets concave edges.  I made a file bosl2_example.scad containing:
include <BOSL2/std.scad>
module prismoids(oversize) {
os2 = oversize * 2;
down(oversize) prismoid(50+os2,30+os2,25+os2)
left(oversize) align(RIGHT)
color("lightblue")prismoid([10+os2,5+os2],[7+os2,4+os2],height=4+os2,
orient=RIGHT);
}

And a file fillet.py in the same directory containing:
from openscad import *
example = osinclude("bosl2_example.scad")
original = example.prismoids(oversize=0)
delta = 1.0
oversized = example.prismoids(oversize=delta)
filleted = oversized.offset(-delta, fa=10)
show([filleted,original.back(60)])

Preview of fillet.py in PythonSCAD:
[image: filleted_align_10.png]
The coloration did not pass from OpenSCAD into PythonSCAD properly and
I've stumbled on other issues suggesting PythonSCAD is less polished than
OpenSCAD but I'm excited enough by the potential that I plan on doing my
next project in PythonSCAD as it has other powerful capabilities such as
edges() and faces() which I expect will enable amazing new possibilities.
Currently OpenSCAD does not give one access to generated geometry and being
able to access and manipulate could be a game changer.


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

BTW, I have not had time to play with my OpenSCAD code in PythonSCAD. I was not sure if I would be able to use some of OSC's advanced tools like the new NURBS library. With your example, I see that I need to make some time and see if I can get colored SVG's to work properly (as part of my laser cutter toolchain... On Wed, May 7, 2025 at 2:33 PM Guenther Sohler via Discuss < discuss@lists.openscad.org> wrote: > Thank you for the nice demonstration. > Please let us know where there are the biggest stumbling blocks so we can > set priorities correctly. > > the lightblue color is not visible in the offset result, because offset > does a difference internally. green is the difference color. > > > > > > > On Wed, May 7, 2025 at 8:12 PM Todd Allen via Discuss < > discuss@lists.openscad.org> wrote: > >> The new python-engine feature of recent development builds of OpenSCAD >> motivated me to download PythonSCAD from >> https://pythonscad.org/download.php. Python-engine in OpenSCAD >> incorporates PythonSCAD but less complete than PythonSCAD's incorporation >> of OpenSCAD. Running the following example needs a PythonSCAD build but >> perhaps soon will also work directly in OpenSCAD. >> >> Let's start with a simple example from >> https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad: >> include <BOSL2/std.scad> >> prismoid(50,30,25) >> align(RIGHT) >> color("lightblue")prismoid([10,5],[7,4],height=4,orient=RIGHT); >> [image: align_10.png] >> >> BOSL2 provides good tools for positioning and aligning basic 3d shapes. >> But some things are still hard such as filleting the joint of the above >> example. >> >> We can fillet it in PythonSCAD by taking advantage of its offset() >> function which when used with a negative offset to shrink a 3d object >> fillets concave edges. I made a file bosl2_example.scad containing: >> include <BOSL2/std.scad> >> module prismoids(oversize) { >> os2 = oversize * 2; >> down(oversize) prismoid(50+os2,30+os2,25+os2) >> left(oversize) align(RIGHT) >> color("lightblue")prismoid([10+os2,5+os2],[7+os2,4+os2],height=4+os2, >> orient=RIGHT); >> } >> >> And a file fillet.py in the same directory containing: >> from openscad import * >> example = osinclude("bosl2_example.scad") >> original = example.prismoids(oversize=0) >> delta = 1.0 >> oversized = example.prismoids(oversize=delta) >> filleted = oversized.offset(-delta, fa=10) >> show([filleted,original.back(60)]) >> >> Preview of fillet.py in PythonSCAD: >> [image: filleted_align_10.png] >> The coloration did not pass from OpenSCAD into PythonSCAD properly and >> I've stumbled on other issues suggesting PythonSCAD is less polished than >> OpenSCAD but I'm excited enough by the potential that I plan on doing my >> next project in PythonSCAD as it has other powerful capabilities such as >> edges() and faces() which I expect will enable amazing new possibilities. >> Currently OpenSCAD does not give one access to generated geometry and being >> able to access and manipulate could be a game changer. >> _______________________________________________ >> 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 >
GS
Guenther Sohler
Wed, May 7, 2025 9:22 PM

Just note, that there exists an experimental windows installer which can do
colored 2D rendering. It basically works, but it will require  some more
brain power to get all crests clean.
You can trick it a little bit by making the shapes 100% translucent and get
nice shapes::

https://imgur.com/a/gu3xmms

But actually 2D in openscad/pythonscad should be non-intersecting.

On Wed, May 7, 2025 at 10:19 PM John David via Discuss <
discuss@lists.openscad.org> wrote:

BTW, I have not had time to play with my OpenSCAD code in PythonSCAD.  I
was not sure if I would be able to use some of OSC's advanced tools like
the new NURBS library.  With your example, I see that I need to make some
time and see if I can get colored SVG's to work properly (as part of my
laser cutter toolchain...

On Wed, May 7, 2025 at 2:33 PM Guenther Sohler via Discuss <
discuss@lists.openscad.org> wrote:

Thank you for the nice demonstration.
Please let us know where there are the biggest stumbling blocks so we can
set priorities correctly.

the lightblue color is not visible in the offset result, because offset
does a difference internally. green is the difference color.

On Wed, May 7, 2025 at 8:12 PM Todd Allen via Discuss <
discuss@lists.openscad.org> wrote:

The new python-engine feature of recent development builds of OpenSCAD
motivated me to download PythonSCAD from
https://pythonscad.org/download.php.  Python-engine in OpenSCAD
incorporates PythonSCAD but less complete than PythonSCAD's incorporation
of OpenSCAD.  Running the following example needs a PythonSCAD build but
perhaps soon will also work directly in OpenSCAD.

Let's start with a simple example from
https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad:
include <BOSL2/std.scad>
prismoid(50,30,25)
align(RIGHT)
color("lightblue")prismoid([10,5],[7,4],height=4,orient=RIGHT);
[image: align_10.png]

BOSL2 provides good tools for positioning and aligning basic 3d shapes.
But some things are still hard such as filleting the joint of the above
example.

We can fillet it in PythonSCAD by taking advantage of its offset()
function which when used with a negative offset to shrink a 3d object
fillets concave edges.  I made a file bosl2_example.scad containing:
include <BOSL2/std.scad>
module prismoids(oversize) {
os2 = oversize * 2;
down(oversize) prismoid(50+os2,30+os2,25+os2)
left(oversize) align(RIGHT)

color("lightblue")prismoid([10+os2,5+os2],[7+os2,4+os2],height=4+os2,
orient=RIGHT);
}

And a file fillet.py in the same directory containing:
from openscad import *
example = osinclude("bosl2_example.scad")
original = example.prismoids(oversize=0)
delta = 1.0
oversized = example.prismoids(oversize=delta)
filleted = oversized.offset(-delta, fa=10)
show([filleted,original.back(60)])

Preview of fillet.py in PythonSCAD:
[image: filleted_align_10.png]
The coloration did not pass from OpenSCAD into PythonSCAD properly and
I've stumbled on other issues suggesting PythonSCAD is less polished than
OpenSCAD but I'm excited enough by the potential that I plan on doing my
next project in PythonSCAD as it has other powerful capabilities such as
edges() and faces() which I expect will enable amazing new possibilities.
Currently OpenSCAD does not give one access to generated geometry and being
able to access and manipulate could be a game changer.


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


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Just note, that there exists an experimental windows installer which can do colored 2D rendering. It basically works, but it will require some more brain power to get all crests clean. You can trick it a little bit by making the shapes 100% translucent and get nice shapes:: https://imgur.com/a/gu3xmms But actually 2D in openscad/pythonscad should be non-intersecting. On Wed, May 7, 2025 at 10:19 PM John David via Discuss < discuss@lists.openscad.org> wrote: > BTW, I have not had time to play with my OpenSCAD code in PythonSCAD. I > was not sure if I would be able to use some of OSC's advanced tools like > the new NURBS library. With your example, I see that I need to make some > time and see if I can get colored SVG's to work properly (as part of my > laser cutter toolchain... > > On Wed, May 7, 2025 at 2:33 PM Guenther Sohler via Discuss < > discuss@lists.openscad.org> wrote: > >> Thank you for the nice demonstration. >> Please let us know where there are the biggest stumbling blocks so we can >> set priorities correctly. >> >> the lightblue color is not visible in the offset result, because offset >> does a difference internally. green is the difference color. >> >> >> >> >> >> >> On Wed, May 7, 2025 at 8:12 PM Todd Allen via Discuss < >> discuss@lists.openscad.org> wrote: >> >>> The new python-engine feature of recent development builds of OpenSCAD >>> motivated me to download PythonSCAD from >>> https://pythonscad.org/download.php. Python-engine in OpenSCAD >>> incorporates PythonSCAD but less complete than PythonSCAD's incorporation >>> of OpenSCAD. Running the following example needs a PythonSCAD build but >>> perhaps soon will also work directly in OpenSCAD. >>> >>> Let's start with a simple example from >>> https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad: >>> include <BOSL2/std.scad> >>> prismoid(50,30,25) >>> align(RIGHT) >>> color("lightblue")prismoid([10,5],[7,4],height=4,orient=RIGHT); >>> [image: align_10.png] >>> >>> BOSL2 provides good tools for positioning and aligning basic 3d shapes. >>> But some things are still hard such as filleting the joint of the above >>> example. >>> >>> We can fillet it in PythonSCAD by taking advantage of its offset() >>> function which when used with a negative offset to shrink a 3d object >>> fillets concave edges. I made a file bosl2_example.scad containing: >>> include <BOSL2/std.scad> >>> module prismoids(oversize) { >>> os2 = oversize * 2; >>> down(oversize) prismoid(50+os2,30+os2,25+os2) >>> left(oversize) align(RIGHT) >>> >>> color("lightblue")prismoid([10+os2,5+os2],[7+os2,4+os2],height=4+os2, >>> orient=RIGHT); >>> } >>> >>> And a file fillet.py in the same directory containing: >>> from openscad import * >>> example = osinclude("bosl2_example.scad") >>> original = example.prismoids(oversize=0) >>> delta = 1.0 >>> oversized = example.prismoids(oversize=delta) >>> filleted = oversized.offset(-delta, fa=10) >>> show([filleted,original.back(60)]) >>> >>> Preview of fillet.py in PythonSCAD: >>> [image: filleted_align_10.png] >>> The coloration did not pass from OpenSCAD into PythonSCAD properly and >>> I've stumbled on other issues suggesting PythonSCAD is less polished than >>> OpenSCAD but I'm excited enough by the potential that I plan on doing my >>> next project in PythonSCAD as it has other powerful capabilities such as >>> edges() and faces() which I expect will enable amazing new possibilities. >>> Currently OpenSCAD does not give one access to generated geometry and being >>> able to access and manipulate could be a game changer. >>> _______________________________________________ >>> 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 >> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
WF
William F. Adams
Thu, May 8, 2025 12:24 AM

On Wednesday, May 7, 2025 at 05:23:16 PM EDT, Guenther Sohler via Discuss discuss@lists.openscad.org wrote:

But actually 2D in openscad/pythonscad should be non-intersecting.

I will note that it is possible  to make arbitrary, even intersecting/over-lapping with the dxf support I worked up in:

https://github.com/WillAdams/gcodepreview

William

On Wednesday, May 7, 2025 at 05:23:16 PM EDT, Guenther Sohler via Discuss <discuss@lists.openscad.org> wrote: > But actually 2D in openscad/pythonscad should be non-intersecting. I will note that it is possible  to make arbitrary, even intersecting/over-lapping with the dxf support I worked up in: https://github.com/WillAdams/gcodepreview William
TA
Todd Allen
Thu, May 8, 2025 12:50 AM

the lightblue color is not visible in the offset result, because offset

does a difference internally. green is the difference color.

Thanks, I was also thinking the parent prismoid was being affected by the
blue color of the child prismoid although I now see it is just the default
color (which is different from the default yellow of the .scad) and it
stays the same no matter what color is set for the child.

I will follow up soon with some other issues after I've spent a bit more
time looking at them to hopefully avoid reporting ones caused by my
misconceptions.

On Wed, May 7, 2025 at 1:33 PM Guenther Sohler via Discuss <
discuss@lists.openscad.org> wrote:

Thank you for the nice demonstration.
Please let us know where there are the biggest stumbling blocks so we can
set priorities correctly.

the lightblue color is not visible in the offset result, because offset
does a difference internally. green is the difference color.

On Wed, May 7, 2025 at 8:12 PM Todd Allen via Discuss <
discuss@lists.openscad.org> wrote:

The new python-engine feature of recent development builds of OpenSCAD
motivated me to download PythonSCAD from
https://pythonscad.org/download.php.  Python-engine in OpenSCAD
incorporates PythonSCAD but less complete than PythonSCAD's incorporation
of OpenSCAD.  Running the following example needs a PythonSCAD build but
perhaps soon will also work directly in OpenSCAD.

Let's start with a simple example from
https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad:
include <BOSL2/std.scad>
prismoid(50,30,25)
align(RIGHT)
color("lightblue")prismoid([10,5],[7,4],height=4,orient=RIGHT);
[image: align_10.png]

BOSL2 provides good tools for positioning and aligning basic 3d shapes.
But some things are still hard such as filleting the joint of the above
example.

We can fillet it in PythonSCAD by taking advantage of its offset()
function which when used with a negative offset to shrink a 3d object
fillets concave edges.  I made a file bosl2_example.scad containing:
include <BOSL2/std.scad>
module prismoids(oversize) {
os2 = oversize * 2;
down(oversize) prismoid(50+os2,30+os2,25+os2)
left(oversize) align(RIGHT)
color("lightblue")prismoid([10+os2,5+os2],[7+os2,4+os2],height=4+os2,
orient=RIGHT);
}

And a file fillet.py in the same directory containing:
from openscad import *
example = osinclude("bosl2_example.scad")
original = example.prismoids(oversize=0)
delta = 1.0
oversized = example.prismoids(oversize=delta)
filleted = oversized.offset(-delta, fa=10)
show([filleted,original.back(60)])

Preview of fillet.py in PythonSCAD:
[image: filleted_align_10.png]
The coloration did not pass from OpenSCAD into PythonSCAD properly and
I've stumbled on other issues suggesting PythonSCAD is less polished than
OpenSCAD but I'm excited enough by the potential that I plan on doing my
next project in PythonSCAD as it has other powerful capabilities such as
edges() and faces() which I expect will enable amazing new possibilities.
Currently OpenSCAD does not give one access to generated geometry and being
able to access and manipulate could be a game changer.


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

> the lightblue color is not visible in the offset result, because offset does a difference internally. green is the difference color. Thanks, I was also thinking the parent prismoid was being affected by the blue color of the child prismoid although I now see it is just the default color (which is different from the default yellow of the .scad) and it stays the same no matter what color is set for the child. I will follow up soon with some other issues after I've spent a bit more time looking at them to hopefully avoid reporting ones caused by my misconceptions. On Wed, May 7, 2025 at 1:33 PM Guenther Sohler via Discuss < discuss@lists.openscad.org> wrote: > Thank you for the nice demonstration. > Please let us know where there are the biggest stumbling blocks so we can > set priorities correctly. > > the lightblue color is not visible in the offset result, because offset > does a difference internally. green is the difference color. > > > > > > > On Wed, May 7, 2025 at 8:12 PM Todd Allen via Discuss < > discuss@lists.openscad.org> wrote: > >> The new python-engine feature of recent development builds of OpenSCAD >> motivated me to download PythonSCAD from >> https://pythonscad.org/download.php. Python-engine in OpenSCAD >> incorporates PythonSCAD but less complete than PythonSCAD's incorporation >> of OpenSCAD. Running the following example needs a PythonSCAD build but >> perhaps soon will also work directly in OpenSCAD. >> >> Let's start with a simple example from >> https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad: >> include <BOSL2/std.scad> >> prismoid(50,30,25) >> align(RIGHT) >> color("lightblue")prismoid([10,5],[7,4],height=4,orient=RIGHT); >> [image: align_10.png] >> >> BOSL2 provides good tools for positioning and aligning basic 3d shapes. >> But some things are still hard such as filleting the joint of the above >> example. >> >> We can fillet it in PythonSCAD by taking advantage of its offset() >> function which when used with a negative offset to shrink a 3d object >> fillets concave edges. I made a file bosl2_example.scad containing: >> include <BOSL2/std.scad> >> module prismoids(oversize) { >> os2 = oversize * 2; >> down(oversize) prismoid(50+os2,30+os2,25+os2) >> left(oversize) align(RIGHT) >> color("lightblue")prismoid([10+os2,5+os2],[7+os2,4+os2],height=4+os2, >> orient=RIGHT); >> } >> >> And a file fillet.py in the same directory containing: >> from openscad import * >> example = osinclude("bosl2_example.scad") >> original = example.prismoids(oversize=0) >> delta = 1.0 >> oversized = example.prismoids(oversize=delta) >> filleted = oversized.offset(-delta, fa=10) >> show([filleted,original.back(60)]) >> >> Preview of fillet.py in PythonSCAD: >> [image: filleted_align_10.png] >> The coloration did not pass from OpenSCAD into PythonSCAD properly and >> I've stumbled on other issues suggesting PythonSCAD is less polished than >> OpenSCAD but I'm excited enough by the potential that I plan on doing my >> next project in PythonSCAD as it has other powerful capabilities such as >> edges() and faces() which I expect will enable amazing new possibilities. >> Currently OpenSCAD does not give one access to generated geometry and being >> able to access and manipulate could be a game changer. >> _______________________________________________ >> 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 >
TA
Todd Allen
Fri, May 9, 2025 4:36 PM

Please let us know where there are the biggest stumbling blocks so we can

set priorities correctly.

I would be most helped by improved documentation.  This page
https://pythonscad.org/tutorial/site/python_new/ lists several functions
new to PythonSCAD but doesn't say much about them.  I would like to know
about the parameters and return values of each function and ideally
examples of using them.  I find some of that here
https://raw.githubusercontent.com/pythonscad/pythonscad/refs/heads/master/libraries/python/openscad.pyi
but I am still struggling to figure out how to make use of these
functions.  For instance I would like to use the function faces().  It
gives me a list of edges.  I have not found documentation of an edge or how
to use it.

I downloaded source code from https://github.com/pythonscad/pythonscad.  It
looks like most of the new functions available in PythonSCAD are
implemented in src/geometry in .cc files.  This limits accessibility to
developers.  Those of us who want to be users might be better served by
features implemented in python as libraries which we could inspect, learn
from and perhaps adapt to our needs.

On Wed, May 7, 2025 at 1:33 PM Guenther Sohler via Discuss <
discuss@lists.openscad.org> wrote:

Thank you for the nice demonstration.
Please let us know where there are the biggest stumbling blocks so we can
set priorities correctly.

the lightblue color is not visible in the offset result, because offset
does a difference internally. green is the difference color.

On Wed, May 7, 2025 at 8:12 PM Todd Allen via Discuss <
discuss@lists.openscad.org> wrote:

The new python-engine feature of recent development builds of OpenSCAD
motivated me to download PythonSCAD from
https://pythonscad.org/download.php.  Python-engine in OpenSCAD
incorporates PythonSCAD but less complete than PythonSCAD's incorporation
of OpenSCAD.  Running the following example needs a PythonSCAD build but
perhaps soon will also work directly in OpenSCAD.

Let's start with a simple example from
https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad:
include <BOSL2/std.scad>
prismoid(50,30,25)
align(RIGHT)
color("lightblue")prismoid([10,5],[7,4],height=4,orient=RIGHT);
[image: align_10.png]

BOSL2 provides good tools for positioning and aligning basic 3d shapes.
But some things are still hard such as filleting the joint of the above
example.

We can fillet it in PythonSCAD by taking advantage of its offset()
function which when used with a negative offset to shrink a 3d object
fillets concave edges.  I made a file bosl2_example.scad containing:
include <BOSL2/std.scad>
module prismoids(oversize) {
os2 = oversize * 2;
down(oversize) prismoid(50+os2,30+os2,25+os2)
left(oversize) align(RIGHT)
color("lightblue")prismoid([10+os2,5+os2],[7+os2,4+os2],height=4+os2,
orient=RIGHT);
}

And a file fillet.py in the same directory containing:
from openscad import *
example = osinclude("bosl2_example.scad")
original = example.prismoids(oversize=0)
delta = 1.0
oversized = example.prismoids(oversize=delta)
filleted = oversized.offset(-delta, fa=10)
show([filleted,original.back(60)])

Preview of fillet.py in PythonSCAD:
[image: filleted_align_10.png]
The coloration did not pass from OpenSCAD into PythonSCAD properly and
I've stumbled on other issues suggesting PythonSCAD is less polished than
OpenSCAD but I'm excited enough by the potential that I plan on doing my
next project in PythonSCAD as it has other powerful capabilities such as
edges() and faces() which I expect will enable amazing new possibilities.
Currently OpenSCAD does not give one access to generated geometry and being
able to access and manipulate could be a game changer.


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

> Please let us know where there are the biggest stumbling blocks so we can set priorities correctly. I would be most helped by improved documentation. This page https://pythonscad.org/tutorial/site/python_new/ lists several functions new to PythonSCAD but doesn't say much about them. I would like to know about the parameters and return values of each function and ideally examples of using them. I find some of that here https://raw.githubusercontent.com/pythonscad/pythonscad/refs/heads/master/libraries/python/openscad.pyi but I am still struggling to figure out how to make use of these functions. For instance I would like to use the function faces(). It gives me a list of edges. I have not found documentation of an edge or how to use it. I downloaded source code from https://github.com/pythonscad/pythonscad. It looks like most of the new functions available in PythonSCAD are implemented in src/geometry in .cc files. This limits accessibility to developers. Those of us who want to be users might be better served by features implemented in python as libraries which we could inspect, learn from and perhaps adapt to our needs. On Wed, May 7, 2025 at 1:33 PM Guenther Sohler via Discuss < discuss@lists.openscad.org> wrote: > Thank you for the nice demonstration. > Please let us know where there are the biggest stumbling blocks so we can > set priorities correctly. > > the lightblue color is not visible in the offset result, because offset > does a difference internally. green is the difference color. > > > > > > > On Wed, May 7, 2025 at 8:12 PM Todd Allen via Discuss < > discuss@lists.openscad.org> wrote: > >> The new python-engine feature of recent development builds of OpenSCAD >> motivated me to download PythonSCAD from >> https://pythonscad.org/download.php. Python-engine in OpenSCAD >> incorporates PythonSCAD but less complete than PythonSCAD's incorporation >> of OpenSCAD. Running the following example needs a PythonSCAD build but >> perhaps soon will also work directly in OpenSCAD. >> >> Let's start with a simple example from >> https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad: >> include <BOSL2/std.scad> >> prismoid(50,30,25) >> align(RIGHT) >> color("lightblue")prismoid([10,5],[7,4],height=4,orient=RIGHT); >> [image: align_10.png] >> >> BOSL2 provides good tools for positioning and aligning basic 3d shapes. >> But some things are still hard such as filleting the joint of the above >> example. >> >> We can fillet it in PythonSCAD by taking advantage of its offset() >> function which when used with a negative offset to shrink a 3d object >> fillets concave edges. I made a file bosl2_example.scad containing: >> include <BOSL2/std.scad> >> module prismoids(oversize) { >> os2 = oversize * 2; >> down(oversize) prismoid(50+os2,30+os2,25+os2) >> left(oversize) align(RIGHT) >> color("lightblue")prismoid([10+os2,5+os2],[7+os2,4+os2],height=4+os2, >> orient=RIGHT); >> } >> >> And a file fillet.py in the same directory containing: >> from openscad import * >> example = osinclude("bosl2_example.scad") >> original = example.prismoids(oversize=0) >> delta = 1.0 >> oversized = example.prismoids(oversize=delta) >> filleted = oversized.offset(-delta, fa=10) >> show([filleted,original.back(60)]) >> >> Preview of fillet.py in PythonSCAD: >> [image: filleted_align_10.png] >> The coloration did not pass from OpenSCAD into PythonSCAD properly and >> I've stumbled on other issues suggesting PythonSCAD is less polished than >> OpenSCAD but I'm excited enough by the potential that I plan on doing my >> next project in PythonSCAD as it has other powerful capabilities such as >> edges() and faces() which I expect will enable amazing new possibilities. >> Currently OpenSCAD does not give one access to generated geometry and being >> able to access and manipulate could be a game changer. >> _______________________________________________ >> 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 >
TP
Torsten Paul
Fri, May 9, 2025 6:48 PM

On 09.05.25 18:36, Todd Allen via Discuss wrote:

Please let us know where there are the biggest stumbling blocks so we
can set priorities correctly.

In my view that is:

  • Support for virtual environments
  • Continued integration into OpenSCAD

ciao,
Torsten.

On 09.05.25 18:36, Todd Allen via Discuss wrote: > Please let us know where there are the biggest stumbling blocks so we > can set priorities correctly. In my view that is: * Support for virtual environments * Continued integration into OpenSCAD ciao, Torsten.
GS
Guenther Sohler
Fri, May 9, 2025 7:37 PM

I see your vision, Torsten,

There are just 2 obstacles:

Virtual Environments is nothing which I am familiar with(probably neither
you), I am not the right person to drive that because I am missing the
intent there.

As for the continued integration:  I see further features which meet the
OpenSCAD "Standards" of Maturity and Safety.
However I feel the next step of integration is to  improve the
accessibility of python in openscad and this is windows platforms.

I am happy to share my MINGW+MXE compilation setup but right now CMakeLists
of openscad+pythonscad is too different/obfuscated.
This is why I try to take small steps here.
The PR i am referring to is:  https://github.com/openscad/openscad/pull/5697
which would approximately be midway.

C U :)

On Fri, May 9, 2025 at 8:48 PM Torsten Paul via Discuss <
discuss@lists.openscad.org> wrote:

On 09.05.25 18:36, Todd Allen via Discuss wrote:

Please let us know where there are the biggest stumbling blocks so we
can set priorities correctly.

In my view that is:

  • Support for virtual environments
  • Continued integration into OpenSCAD

ciao,
Torsten.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

I see your vision, Torsten, There are just 2 obstacles: Virtual Environments is nothing which I am familiar with(probably neither you), I am not the right person to drive that because I am missing the intent there. As for the continued integration: I see further features which meet the OpenSCAD "Standards" of Maturity and Safety. However I feel the next step of integration is to improve the accessibility of python in openscad and this is windows platforms. I am happy to share my MINGW+MXE compilation setup but right now CMakeLists of openscad+pythonscad is too different/obfuscated. This is why I try to take small steps here. The PR i am referring to is: https://github.com/openscad/openscad/pull/5697 which would approximately be midway. C U :) On Fri, May 9, 2025 at 8:48 PM Torsten Paul via Discuss < discuss@lists.openscad.org> wrote: > On 09.05.25 18:36, Todd Allen via Discuss wrote: > > Please let us know where there are the biggest stumbling blocks so we > > can set priorities correctly. > > In my view that is: > * Support for virtual environments > * Continued integration into OpenSCAD > > ciao, > Torsten. > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
TP
Torsten Paul
Fri, May 9, 2025 8:02 PM

On 09.05.25 21:37, Guenther Sohler via Discuss wrote:

Virtual Environments is nothing which I am familiar with(probably
neither you), I am not the right person to drive that because I am
missing the intent there.

Note that I'm not saying it's necessarily something you
have to do. I'm just saying if nobody (except me) cares
about integration, there might come a day where it becomes
impossible, and that would be a very sad day in my opinion.

As far as I'm aware it's the only way that allows people to
be flexible in regard to the python version.

If you use the AppImage, the Python version is fixed in that
build. So for people to use external libraries, those have
to match exactly the python version in the AppImage.

Virtual environments are one solution for that. There may
be others, I'm happy to hear about those. Or if people think
venvs are useless and it's just me thinking they are a must.

E.g. right now the OpenSCAD AppImage nightly builds against
Python 3.10.12. My local Debian has Python 3.13.3. So using
anything (well most things?) installed via the Debian Python
version is not going to work in the AppImage.

I believe Python support without the easy ability to use
external libraries is pretty limited. It's by no means useless
but one of the huge benefits of Python is the vast number
of libraries doing all sorts of things OpenSCAD scripting
will never do (which is the reason why I think it's good to
have both).

As for the continued integration:  I see further features
which meet the OpenSCAD "Standards" of Maturity and Safety.

I don't see a problem with safety. If you enable python, you
have none. Just as if you use Python itself. It's neither
better nor worse.

The default is Python = OFF, so you can use OpenSCAD scripts
randomly downloaded from the internet in a relatively safe
way. It's not going to do bitcoin mining behind your back or
trying to steal you data.

If you enable Python, you can use and do whatever you want,
including (see above) installing packages via PyPi so you
could directly download data from a database via SQLAlchemy
and run a flask webserver sharing webpages and dynamically
generated 3MFs.

ciao,
Torsten.

On 09.05.25 21:37, Guenther Sohler via Discuss wrote: > Virtual Environments is nothing which I am familiar with(probably > neither you), I am not the right person to drive that because I am > missing the intent there. Note that I'm not saying it's necessarily something *you* have to do. I'm just saying if nobody (except me) cares about integration, there might come a day where it becomes impossible, and that would be a very sad day in my opinion. As far as I'm aware it's the only way that allows people to be flexible in regard to the python version. If you use the AppImage, the Python version is fixed in that build. So for people to use external libraries, those have to match exactly the python version in the AppImage. Virtual environments are one solution for that. There may be others, I'm happy to hear about those. Or if people think venvs are useless and it's just me thinking they are a must. E.g. right now the OpenSCAD AppImage nightly builds against Python 3.10.12. My local Debian has Python 3.13.3. So using anything (well most things?) installed via the Debian Python version is not going to work in the AppImage. I believe Python support without the easy ability to use external libraries is pretty limited. It's by no means useless but one of the huge benefits of Python is the vast number of libraries doing all sorts of things OpenSCAD scripting will never do (which is the reason why I think it's good to have both). > As for the continued integration:  I see further features > which meet the OpenSCAD "Standards" of Maturity and Safety. I don't see a problem with safety. If you enable python, you have none. Just as if you use Python itself. It's neither better nor worse. The default is Python = OFF, so you can use OpenSCAD scripts randomly downloaded from the internet in a relatively safe way. It's not going to do bitcoin mining behind your back or trying to steal you data. If you enable Python, you can use and do whatever you want, including (see above) installing packages via PyPi so you could directly download data from a database via SQLAlchemy and run a flask webserver sharing webpages and dynamically generated 3MFs. ciao, Torsten.