discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: The nature of Python in OpenSCAD and future plans/features

GS
Guenther Sohler
Tue, Sep 5, 2023 8:12 PM

Hi William,

In the meantime, I am home and I managed to compile OpenSCAD for windows
again.
After it was working in my place, I also tested it in my wifes computer and
it's also working.
No Fancy requirements needed in. Just install Python 3.11.5 in addition.
If you are still interested, check my download site again. I updated the
instructions.
Let me know your experience, so I can improve.
Cheers

On Wed, Aug 30, 2023 at 11:50 PM William F. Adams via Discuss <
discuss@lists.openscad.org> wrote:

---------- Forwarded message ----------
From: "William F. Adams" willadams@aol.com
To: OpenSCAD General Discussion discuss@lists.openscad.org
Cc:
Bcc:
Date: Wed, 30 Aug 2023 21:49:14 +0000 (UTC)
Subject: [OpenSCAD] Re: The nature of Python in OpenSCAD and future
plans/features
Great news that it is possible to call Python from OpenSCAD --- is there
an example file showing that?

Getting the Customizer to work with Python in OpenSCAD would be awesome.

William

---------- Forwarded message ----------
From: "William F. Adams via Discuss" discuss@lists.openscad.org
To: OpenSCAD General Discussion discuss@lists.openscad.org
Cc: "William F. Adams" willadams@aol.com
Bcc:
Date: Wed, 30 Aug 2023 21:49:14 +0000 (UTC)
Subject: [OpenSCAD] Re: The nature of Python in OpenSCAD and future
plans/features


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

Hi William, In the meantime, I am home and I managed to compile OpenSCAD for windows again. After it was working in my place, I also tested it in my wifes computer and it's also working. No Fancy requirements needed in. Just install Python 3.11.5 in addition. If you are still interested, check my download site again. I updated the instructions. Let me know your experience, so I can improve. Cheers On Wed, Aug 30, 2023 at 11:50 PM William F. Adams via Discuss < discuss@lists.openscad.org> wrote: > > > > ---------- Forwarded message ---------- > From: "William F. Adams" <willadams@aol.com> > To: OpenSCAD General Discussion <discuss@lists.openscad.org> > Cc: > Bcc: > Date: Wed, 30 Aug 2023 21:49:14 +0000 (UTC) > Subject: [OpenSCAD] Re: The nature of Python in OpenSCAD and future > plans/features > Great news that it is possible to call Python from OpenSCAD --- is there > an example file showing that? > > Getting the Customizer to work with Python in OpenSCAD would be awesome. > > William > > > > > ---------- Forwarded message ---------- > From: "William F. Adams via Discuss" <discuss@lists.openscad.org> > To: OpenSCAD General Discussion <discuss@lists.openscad.org> > Cc: "William F. Adams" <willadams@aol.com> > Bcc: > Date: Wed, 30 Aug 2023 21:49:14 +0000 (UTC) > Subject: [OpenSCAD] Re: The nature of Python in OpenSCAD and future > plans/features > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
WF
William F. Adams
Wed, Sep 6, 2023 12:36 AM

Thanks!
Installing:
https://www.python.org/ftp/python/3.11.5/python-3.11.5-amd64.exe

and then running your installer and then enabling Python "just worked" perfectly!
Looking at:
http://www.guenther-sohler.net/openscad/

the things which I am curious about are:
 - Customizer integration --- this would be really welcome, but arguably not an issue, if one can call Python from w/in OpenSCAD - syntax for calling Python w/in an OpenSCAD file --- in particular, I want to be able to write out a text file.

Thanks! Installing: https://www.python.org/ftp/python/3.11.5/python-3.11.5-amd64.exe and then running your installer and then enabling Python "just worked" perfectly! Looking at: http://www.guenther-sohler.net/openscad/ the things which I am curious about are:  - Customizer integration --- this would be really welcome, but arguably not an issue, if one can call Python from w/in OpenSCAD - syntax for calling Python w/in an OpenSCAD file --- in particular, I want to be able to write out a text file.
WF
William F. Adams
Wed, Sep 6, 2023 1:22 AM

Unfortunately, my initial effort to write out a text file seems to interfere with the model being generated:
import os
h = 1w = 2d = 3
fn = os.path.basename(file)
f = open(fn, "a")f.write("cube",w,d,h)
cube([w,d,h]).output()
f.close()

Is there something about that which would keep things from working?
William

Unfortunately, my initial effort to write out a text file seems to interfere with the model being generated: import os h = 1w = 2d = 3 fn = os.path.basename(__file__) f = open(fn, "a")f.write("cube",w,d,h) cube([w,d,h]).output() f.close() Is there something about that which would keep things from working? William
WF
William F. Adams
Wed, Sep 6, 2023 2:28 AM

Experimenting a bit more, the following sort of worked:
import os
h = 1w = 2d = 3
fn = os.path.basename(name)
string = ("cube" + str(w) + str(d) + str(h))
f = open(fn, "a")f.write(string)
cube([w,d,h]).output()
f.close()

but I'm still mystified as to why:
fn = os.path.basename(file)
didn't work.

Experimenting a bit more, the following sort of worked: import os h = 1w = 2d = 3 fn = os.path.basename(__name__) string = ("cube" + str(w) + str(d) + str(h)) f = open(fn, "a")f.write(string) cube([w,d,h]).output() f.close() but I'm still mystified as to why: fn = os.path.basename(__file__) didn't work.