r/OpenPythonSCAD • u/WillAdams • May 26 '25
r/OpenPythonSCAD • u/gadget3D • May 22 '25
Sphere Art
You can create nice art from spheres when you dont keep its radius constant,
Instead you can make it dependent from the direction vector. Here is one example

"""
from openscad import *
from math import *
def r_func(vec):
radial = sqrt(vec[0]*vec[0]+vec[1]*vec[1])
axial = abs(vec[2])
hang=atan2(vec[1], vec[0])
vang=atan2(vec[2], radial)
r = 20 /max(radial, axial)
c=abs(hang-2*vang)
if c < 0.3:
r=r -1*cos(c*1.57/0.3)
return r
sphere(r_func,fn=40).show()
"""
r/OpenPythonSCAD • u/gadget3D • May 05 '25
Keep your workplace tidy with PythonSCAD
Look at my latest design at:
https://www.thingiverse.com/thing:7029416/files
Its basically just a Metal rod where you can easily stack and access all your tools in with Ease.
r/OpenPythonSCAD • u/alanbernstein • Apr 05 '25
Is there any builtin way to create a rounded 2d polygon or polyline?
It looks like path_extrude supports this, so I would hope other functions that accept a list of points can easily support it as well. But polygon does not seem to.
I can work on adding this if I can get a code pointer.
r/OpenPythonSCAD • u/Alacritous13 • Sep 07 '25
How am I suppose to import python file relative
I've been trying to set up a new project, it has a utilities file named "ALib" at the first level, and then all the other files will be going into folders at least one level lower. The SCAD equivalent is include <../ALib.scad>, but I'm having trouble figuring out the python equivalent. I thought it should be from ..ALib import *, but I'm getting an ImportError: attempted relative import with no known parent package error. I've tried from ALib import *, but this is importing the file from a whole different repo.
I'm working on a Windows system with version 2025.08.28 and 2025.07.23 running
Edit: ALib is a file not folder
Edit: Figured out a solution, I put it in the comments.
r/OpenPythonSCAD • u/WillAdams • Apr 04 '25
Did loading libraries change in the new version? (2025-04-02)
I think this happened in 2025-03-31 as well...
Trying to load:
from openscad import *
from gcodepreview import *
gc_file = "vcarvetest.nc"
gcp = gcodepreview(True, False, False)
gcp.previewgcodefile(gc_file)and am getting:
Running Python 3.11.5 in venv ''. ERROR: Traceback (most recent call last): File "<string>", line 3, in <module> ModuleNotFoundError: No module named 'gcodepreview'
Execution aborted
where File | Show Library Folder opens: C:\Users\willa\OneDrive\Documents\OpenSCAD\libraries
which contains:
"C:\Users\willa\OneDrive\Documents\OpenSCAD\libraries\gcodepreview.py" and "C:\Users\willa\OneDrive\Documents\OpenSCAD\libraries\gcodepreview.scad"
r/OpenPythonSCAD • u/DeepReef11 • Aug 11 '25
How to import libraries from libraries folder?
There are missing instructions on the wiki about importing libs: #wiki_loading_libraries
How can I make my own local lib and import it in pythonscad?
I have added file in ~/.local/share/OpenSCAD/libraries but wont import with from filename import *
r/OpenPythonSCAD • u/TurboProgrammer0815 • Dec 19 '25
How to use functions from OpenSCAD files?
Simple and short question:
How do I do this?
// func.scad
function foo() = 10;
# test.py
func = osuse("func.scad")
cube(func.foo())Looks straight forward, but I'm getting this error:
AttributeError: 'openscad.PyOpenSCAD' object has no attribute 'foo'
Does anyone have an idea?Simple and short question:How do I do this?// func.scad
function foo() = 10;
# test.py
func = osuse("func.scad")
cube(func.foo())Looks straight forward, but I'm getting this error:AttributeError: 'openscad.PyOpenSCAD' object has no attribute 'foo'Does anyone have an idea?
r/OpenPythonSCAD • u/PurchaseSpecific7699 • Mar 19 '25
Question: How to pass global variables via command-line (-D var=val) to OpenPythonSCAD (like in OpenSCAD)?
Hi everyone,
I have a simple question:
OpenSCAD supports passing global variables via the -D option.
Help says:
-D [ --D ] arg var=val -pre-define variablesI tried passing variables in a similar way to PythonSCAD, but it seems the Python script isnβt aware of those variables.
It would be highly appreciated if this could be supported!
Many thanks in advance β I really love this great project! π
r/OpenPythonSCAD • u/gadget3D • Oct 06 '24
New Version released
Today I have uploaded Version 2024-10-06 on pythonscad.org homepage
Its in sync with latest development master of openscad.org
and it got these fixes/additions
* Thread problem is fixed, linear_extrude, rotate_extrude and sphere, which can have a callback function work
with any recent python version now
* pyutil.py Containt some utility functions to easily create lofts.
* handles are still maintained when you color() them
* showing handles with O icon does not only show handles, but also their coorindate system
Let me know, when you find more bugs or have feature requests
r/OpenPythonSCAD • u/gadget3D • Dec 03 '24
new Version Windows installer 2024-12-02 is online
Apart from few bug fixes and synced to latest OpenSCAD version,
there is 1st support to import/export (easy) STEP files which can have faces, holes and rounded edges.
My next goal is also to export round edges back to STEP files.
r/OpenPythonSCAD • u/kolloid1 • Feb 23 '25
cmake texts mangled
Today (2/23/2025) I attempted to compile the latest sources from github and found that a couple of files are somewhat mangled: CmakeLists.txt (lines 484, 621 and others) and cmake/Modules/FindNettle.cmake (lines 1-26) have kept rests of what looks like a markup.
r/OpenPythonSCAD • u/gadget3D • Feb 13 '25
New function faces()
Many new options are possible since the new skin() function which also came with the possibility to placed 2d shapes arbritary in space.
One of this options is faces() functions, which takes a solid as input and returns it faces as arbritary-placed 2d shapes in a python list.
These can further be processed like in this example
Drawing a watch is not difficult in openscad, but in this example the right side faces of the inner cylinder is chosen and used as a baseplate to extude the arrow(outwards)
Many more options are possible. you could also offset or make csg oprations before turning them back to 3D
Since now we cannot only turn 2D shapes into 3D, but also visa verce - any number of times

r/OpenPythonSCAD • u/rebuyer10110 • Feb 14 '25
Is it possible for solids to have a bounding box property?
I see openscad has some built-in way to get bounding boxes, but only upon render.
Is it possible to get this info as a property for each solid? Or, it's not possible today because openscad can only calculate the bounding box upon render?
Why I ask: It makes writing helper functions a lot easier, if solids accompany its bounding box information.
EDIT: Solved. mesh() returning solid's vertices allows computing bounding box dynamically: https://www.reddit.com/r/OpenPythonSCAD/comments/1ip79tm/is_it_possible_for_solids_to_have_a_bounding_box/mctntjj/
r/OpenPythonSCAD • u/WillAdams • Oct 15 '24
Thoughts on how to work around 3D objects not being made immediately?
I am finding it awkward to work with the requirement/style of:
cu=cube([1,2,3])
output([cu])since I need to chain many hull operations together for my current project.
Is there some elegant/pythonic construction for this which I'm missing/not finding/unaware of?
Basically I need to be able to have a pair of def calls which get hulled together, and the sum of a series of them are then subtracted from a previously defined block.
r/OpenPythonSCAD • u/rebuyer10110 • Oct 15 '24
Is an inverse() function supported to invert a handle?
I typically follow the pattern of translating + rotating a component during assembly to do touch up work, and perform inverse movement to put the component back to its original position to prep for printing on the base plate.
I have been utilizing handles for this a lot.
The pain point I ran into: I really could use numpy's np.linalg.inv() to calculate the inverse eigen vector to restore a component back to its original position.
Questions:
Is there a way to import libraries I install from pip into pythonscad's run time? I see a File > Show Library Folder. Is that where I can place dependencies? It is still clunky for numpy since it has a chain of py files I would need to copy over.
Is there a built-in matrix inverse operator I can use right now?
r/OpenPythonSCAD • u/WillAdams • Nov 12 '24
Updated gcodepreview to v0.7 --- Python core works, and matching Python template, OpenSCAD files will need to be reworked
r/OpenPythonSCAD • u/WillAdams • Oct 21 '24
Developing (and loading) Python libraries using OpenPythonSCAD
Working on this, and figured it would be good to share what I have learned (and to correct anything which I misunderstood).
r/OpenPythonSCAD • u/WillAdams • Feb 08 '25
How to announce new versions? 2025-02-06 just went up
It's at the usual place: https://pythonscad.org/download.php
r/OpenPythonSCAD • u/gadget3D • Oct 20 '24
Raised embedded python version
Hi PythonSCADers,
Yesterday, I was able to raise the embedded python version up to version python3.12-5.2
and it works fine in my computer.
you can test it at https://pythonscad.org/PythonSCAD-2024.10.20-x86-64-Installer.exe
(it does not include libfive, not represented in name)
I am happy to receive feedback. If it works fine, i'd like to make it standard.
BTW rebuyer i am not sure, if yo noticed my answer due to the deep hierarchy of reddit threads,
Take the chance to answer you in the root of a thread. This is how how you can revert all your transformations in one step
baseplate = cube()
restore = moved_sq_3d.align(baseplate.origin, moved_sq_3d.origin)
or:
restore = moved_sq_3d.align(inv) # this needs external inversion
or you can do:
restore = moved_sq_3d.divmatrix(moved_sq_3d.origin) # this is even more direct
no need to do external matrix inversion
In general: align(object,dst,src)) is equivalent to
divmatrix(multmatrix(obj,dst),src)
(just more compact and efficient)

