r/OpenPythonSCAD • • Nov 16 '25

Having some fun with this software!

Post image
4 Upvotes

Learned about OpenSCAD recently for a 3D print project - AI helped me design a part that I'm currently printing, and while that goes, I'm having fun with SCAD coding.

The OpenRouter model Sherlock Think is performing well in writing OpenSCAD. Also, Gemini 2.5 Pro and Claude.


r/OpenPythonSCAD • • Mar 10 '26

๐Ÿ”ฅ Fully Parametric Double Cable Clip

Post image
1 Upvotes

r/OpenPythonSCAD • • 10d ago

Assistant tool

1 Upvotes

I tried the AI assistant tool like in OpenSCAD but it returns nothing (using LMstudio and qwen working in openScad)
anybody else with this issue?


r/OpenPythonSCAD • • Jun 17 '25

New Symbols True and False in CSG Operators

5 Upvotes

PythonSCAD was missing a symbol for and empty(void) object and a full filled object with unlimited size.

Why not using True and False for that ? It enables new algorithms easily

Interesting fact Even when shape is spinning wildly, result would never be a sphere ....


r/OpenPythonSCAD • • Jul 14 '25

Objects are now iteratable

5 Upvotes

In latest Commit. Objects are iteratable.

When iterating over an object, you get its childs one by one.

Below shown example does an union, because the difference is never actually executed.


r/OpenPythonSCAD • • Aug 29 '26

A Japanese teacher is publishing near-daily PythonSCAD lessons โ€” and it's a small masterclass in teaching CAD-as-code

18 Upvotes

If you want to see what it looks like when someone actually teaches parametric CAD from first principles, take a look at yokamak on Zenn (a Japanese dev-blogging platform, similar to dev.to): zenn.dev/yokamak โ€” he also mirrors most posts on Qiita.

Everything is in Japanese, but don't let that stop you โ€” Chrome's built-in page translator does a genuinely good job turning it into English (or whatever your native language is) on the fly, code comments included. Read that way, the series basically works as a free, ready-made PythonSCAD tutorial, not just an interesting blog to skim.

Yokamak teaches at a technical college in Hitoyoshi (Kyushu) and at a Tokyo metropolitan school's information-technology department, and he's been publishing an almost-daily series called ใ€Œ้ซ˜ๆ ก็”ŸใฎใŸใ‚ใฎPythonSCAD็ทด็ฟ’ๅธณใ€ โ€” roughly "A PythonSCAD practice notebook for high schoolers." It's aimed at students who are new to both programming and CAD, and it's now well past a dozen installments.

What makes it worth a look even if you don't read Japanese (the code and diagrams carry a lot of it on their own, and machine translation handles the rest fine):

  • He starts from real first principles. One early lesson has students compute a triangle's area using the shoelace formula, print the result to the console, and also render the triangle in PythonSCAD's 3D view โ€” so the math and the geometry validate each other.

  • He teaches the traps, not just the happy path. A follow-up lesson deliberately orders polygon vertices wrong, shows the resulting self-intersecting "bowtie" shape, and walks through why vertex winding order matters before generalizing to an n-gon area function with a for loop.

  • He shows real debugging, errors included. One post pastes an actual TypeError traceback from a nested-list indexing bug and works through the fix live, rather than presenting only clean, working code.

  • He connects PythonSCAD to other tools. There's a lesson exporting 2D polygon data out of Metasequoia (a Japanese 3D modeler) via its scripting API, reformatting it into PythonSCAD-ready code, and then extruding/rotating the imported profile โ€” a nice bridge between mouse-driven modeling and code-driven modeling.

  • He explores the object model itself, e.g. digging into PythonSCAD's documented "dynamic attributes" to pull .points and .size back off an already-built polygon object, rather than just calling functions and moving on.

  • The comments are genuinely useful. On the vertex-ordering lesson, a PythonSCAD contributor chimed in suggesting the reader try 3-tuple points [x, y, r] for per-vertex rounding, and polylines with 3D coordinates for annotation โ€” and yokamak turned around and posted a follow-up experiment using exactly that within a day.

Beyond this series he's also been poking at build123d as a natural next step after PythonSCAD (CSG-style "Algebra mode" first, since it's a near 1:1 mental model transfer, with Builder-mode sketch-driven modeling introduced later as a bridge to commercial CAD tools), and separately uses Pyxel to teach high-school math graphing in Python.

It's a nice example of someone documenting a teaching curriculum in public, in near-real-time, mistakes and all โ€” worth a follow if you're interested in PythonSCAD, OpenSCAD, or CAD/programming education generally.

๐Ÿ”— Series index / articles: https://zenn.dev/yokamak ๐Ÿ”— Mirror on Qiita: https://qiita.com/yokamak ๐Ÿ”— PythonSCAD: https://www.pythonscad.org/


r/OpenPythonSCAD • • Mar 19 '25

import python math in openpythonSCAD

4 Upvotes

Having trouble with a simple package import. Read through some other threads and still can't get it to work. import math

Installed: OpenSCAD-silicon-2025-01-30
Had python 3.12 installed, but couldn't import math, appended sys.path, but no luck
Installed python 3.13, and included the path in my sys.path and zshrc file.

Any ideas?


r/OpenPythonSCAD • • Jun 03 '26

PythonSCAD v1.0.0 "impletio" released

18 Upvotes

Hi everyone,

We are thrilled to announce PythonSCAD v1.0.0 โ€” our biggest release so far. This version marks a milestone: PythonSCAD has grown from a promising OpenSCAD fork with Python support into a mature, first-class tool for script-based 3D modeling. We have landed 83 pull requests since v0.20.0, covering everything from fundamental API architecture to a real IPython shell, native vector math, a completely refreshed Windows experience, full rebranding, and dozens of bug fixes.

API

We have again worked hard on improving what you can do in your design code.

Polyline improvements

Polylines now participate correctly in difference() and intersection() operations (PR #572), and polyline preview has been improved (PR #575). After this fix, PythonSCAD is a great choice to "select" given areas from given imported 2D files and place correctly for an upcoming laser-cut. Polylines also work in 3D world, where they are a great choice to annotate direction vectors or even dimension arrows.

solid.c color property

A new read-only .c property on solid objects (PR #562) exposes the RGBA color of the root color() wrapper as a (r, g, b, a) tuple โ€” useful for reading back colors from a colored solid in Python code.

Native vector operations

Solid geometry objects now support arithmetic operators directly (PR #588): addition (+), subtraction (-), scaling (*), dot product, and cross product. This makes geometric expressions in Python feel natural without needing to call helper functions for every operation. Any Vector returned by PythonSCAD supports these calculations. For others simply use the vector() function.

from pythonscad import *
c=cube(10,center=True)
vec1=c.position
vec2=vector(4,5,6)
print(vec1)
print(vec2)
print(vec1+vec2)
print(vec1.norm()) # vector size

New + operator for union (#658)

We've added a new + operator which allows you to union objects:

from pythonscad import *
show(cube(10) + sphere(5))

It is an alias for the already existing | operator. You can continue to use - for difference and % for minkowski as before.

MultiToolExporter

A new MultiToolExporter helper in the pythonscad module (PR #585) makes it straightforward to split a single model into multiple per-tool or per-color output files โ€” a common need for multi-material or laser-cut workflows:

from pythonscad import *

background = cube([200, 100, 1]).color("blue")
star       = cylinder(r=20, h=2, fn=5).translate([100, 50, -0.5]).color("red")

exporter = MultiToolExporter("out/flag-", ".stl", mkdir=True)
exporter.append(("blue", background))  # blue part, minus the star area
exporter.append(("red",  star))        # red part (later entries win)
exporter.export()
# writes out/flag-blue.stl and out/flag-red.stl

# Or: one 3MF file with two named parts
export(dict(exporter.parts()), "flag.3mf")

Later entries "win" over earlier ones, so overlapping volume is assigned to exactly one output file.

Dynamic oversampling (new)

A new dynamic oversampling mode (PR #554) basically remeshes existing solids to a finer grid. Main purpose so far is to bake any texture onto the shape. The second parameter is the target grid to lay the texture on. Many different projection modes are possible, whereas triplanar might be the best starting point.

from pythonscad import *

model=cube([10,4,4],center=True) | cube([4,10,4], center=True) | cylinder(r=3,h=5,fn=20)


textured = oversample(
    model, 0.1, texture="../image/smiley.png", projection="triplanar",
    texturewidth=2, textureheight=2, texturedepth=0.2
)
textured.show()

Clean Python module layout: openscad / pythonscad / _openscad (new, breaking)

v1.0.0 restructures the Python surface into three distinct modules (PR #579):

  • _openscad โ€” the C extension (renamed from openscad). Rarely imported directly; it is the engine room.

  • openscad โ€” a pure-Python overlay that re-exports _openscad 1:1. The home for OpenSCAD-compatible additions and future per-symbol deprecation notices.

  • pythonscad โ€” a pure-Python overlay that re-exports openscad 1:1. The home for PythonSCAD-only features.

The drop-in guarantee: openscad.cube is _openscad.cube and pythonscad.cube is openscad.cube, so switching between from openscad import * and from pythonscad import * requires no other code change. All three modules are shipped in the pip wheel, each with a PEP 561 type-stub package (-stubs/) so IDEs can provide autocompletion for whichever import style you prefer.

New scripts and templates use from pythonscad import *. Existing designs using from openscad import * continue to work unmodified.

This is an internal change, but it is very important for the future of the project, as it allows us to add new Python features written in pure Python without needing to implement anything with the more cumbersome Python C API (like the MultiToolExporter mentioned above).

Note: As some new features which are exclusive to PythonSCAD will only be added to the pythonscad package, we recommend everyone to switch to from pythonscad import *.

Note: The C extension rename from openscad to _openscad is a breaking change for code that imported openscad directly as a C extension (not via the overlay). Any code using from openscad import * is unaffected though.

UI improvements

Inline Python trust bar

The blocking modal trust dialog that appeared before you could even read a Python file has been replaced with a non-intrusive inline bar above the editor (PR #667). You can now open, scroll, and review a file before deciding to trust it. The bar appears at the top of the editor (pushing the text down, never overlapping it), Preview and Render are disabled until trust is granted, and once you click "Trust Design" the customizer populates immediately.

External-editor workflows are smoother too: if you edit a trusted file in VS Code while PythonSCAD is open, it auto-trusts on reload without asking again.

Bugfixes and improvements to session management

A feature we introduced in the last release is session management. You might have seen it in programs like Visual Studio Code or Notepad++ already. When session management is enabled, PythonSCAD will automatically save all open tabs with all their changes to a session file when you close the program. When you start PythonSCAD again, it will automatically restore all tabs with all their unsaved changes. So no more annoying "Do you want to save Untitled.py?" popups when closing the program. No more "PythonSCAD is preventing Windows from shutting down."

You close the program and when you come back everything is just as you left it.

On top of that this also adds periodic autosave. So in case PythonSCAD crashes, or during a power failure, you won't lose more than a minute of work.

Note: In v0.20.0 where session management was first introduced, it was disabled by default. As it is now stable enough, we enabled it by default in v1.0.0. But this means if you've ever used v0.20.0 you need to enable session management in "Edit > Preferences > Advanced > User Interface".

Real IPython shell (--ipython) and basic REPL (--repl) (new)

pythonscad --ipython now launches a genuine IPython interactive shell โ€” the same rich In [N]: prompt, tab completion, history, and magic commands you get from the ipython command itself (PR #600). IPython is bundled inside the AppImage, macOS .app, and Windows installer so it is available out of the box without any extra pip install.

$ pythonscad --ipython
In [1]: from pythonscad import *
In [2]: cube(10).color("Tomato")

For a lighter, dependency-free prompt, the new --repl flag opens the basic embedded Python REPL. Distro packages (.deb, .rpm) declare python3-ipython as a recommended dependency rather than bundling it, keeping the package footprint small.

Title bar shows full path (new)

The main window title bar now displays the absolute file path of the open design (PR #576), so it's always clear exactly which file you're editing when working across multiple directories.

More PythonSCAD rebrand (new)

With v1.0.0, PythonSCAD is more thoroughly rebranded throughout (PRs #661, #669, #672, #676, #684, #686): About dialog, application metadata, desktop file IDs, localization strings, homepage URLs, and the macOS dock icon all show PythonSCAD consistently. Hopefully there are no more leftover "OpenSCAD" references in unexpected places.

Platform support

New Linux platform support

Pre-built packages are now available for Fedora 44 and Ubuntu 26.04 LTS (PR #624).

Windows improvements

v1.0.0 brings a significantly better Windows experience:

  • Per-user installer with on-demand UAC ([PR

    696](https://github.com/pythonscad/pythonscad/pull/696)): The installer no

    longer requires administrator rights by default. A "Just for me / For all users" page lets you choose. UAC elevation only fires if you explicitly request an all-users install โ€” a UAC shield icon on the Next button signals when elevation will be requested.

  • Code-signed Windows installer ([PR

    703](https://github.com/pythonscad/pythonscad/pull/703)): The Windows

    installer is now signed with a Certum code-signing certificate (CN=Open Source Developer Michael Postmann), so Windows SmartScreen will recognize it as coming from a known publisher and will no longer show the "Windows protected your PC" error message.

  • MSIX package ([PR

    638](https://github.com/pythonscad/pythonscad/pull/638)): A Windows

    Storeโ€“style .msix package is now produced alongside the traditional NSIS installer and ZIP archive. The MSIX Package is signed as well. For the time being both the installer and the MSIX package will be supported.

PythonSCAD is now available on PyPI

PythonSCAD v1.0.0 is now available on PyPI, so you can install it with pip install pythonscad and get the latest version. This version will not have a GUI, but combined with the export() function, you can have self-contained projects where you just deliver your Python design file combined with a requirements.txt file that lists pythonscad as a dependency.

Users could then create a Python virtual environment:

python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install -r requirements.txt
python design.py

Which would render your design into an output file. Great for automation.

Note: Be aware, though, that in this first iteration we do not yet provide pre-built wheels. This means that the pip install command will likely take 20+ minutes (depending on your machine of course). Also you're going to need a lot of build-dependencies installed on your system. The easiest way is to clone the repository and then run scripts/get-dependencies.py which will install all required dependencies for you. We are working on providing pre-built wheels for one of the next releases, which will make installation much faster and easier.

Reliability and bug fixes

v1.0.0 includes a large number of stability and correctness fixes across the board:

  • Resize now behaves consistently across all cases (#557).

  • Fillet calculation corrected (#625).

  • SVG import: title handling and osimport:stroke parameter fixed (#570, #577).

  • Session restore now persists per-window geometry (#627) and the macOS IPC socket name is shortened to fit system limits (#640).

  • Console output from compile and parse operations is now routed correctly to the console widget (#643).

  • Python binding robustness: multiple memory leaks, UB, and error-handling gaps resolved (#603, #608, #610, #611, #619).

  • CSG tree: missing CONCAT case in switch handled (#653).

  • Startup crash and double file dialog from the welcome screen fixed (#695).

  • Fontconfig 2.18.0 app-font scoring regression worked around (#691).

  • macOS: deprecated kUTTypePNG API replaced, dock icon corrected, theme mismatch in preferences fixed (#651, #675).

  • --define on the command line now works during animation too (#699).

  • Welcome dialog New button restored when Python support is disabled (#637).

Upstream changes

We have merged all changes from OpenSCAD into our codebase to bring in the latest bug fixes and enhancements from the upstream project (#559, #583).

Downloads

Pre-built packages are available for Linux (AppImage, .deb, .rpm), macOS (DMG), and Windows (installer, ZIP, and MSIX):

https://pythonscad.org/downloads/

As always, we would love to hear from you โ€” feedback and bug reports are very welcome!


r/OpenPythonSCAD • • Mar 03 '25

Which version of Python for PythonSCAD?

4 Upvotes

I know: https://www.python.org/ftp/python/3.11.5/python-3.11.5-amd64.exe is recommended on the download page --- does it break things to install 3.12?

What would be involved in upgrading to that latter version? I somehow have both 3.11 and 3.12 on one of my computers and I want to simplify down to just one....

If removing 3.12 is a good option, that's fine for me (at least for the nonce)


r/OpenPythonSCAD • • May 22 '25

Articulated objects

4 Upvotes

Access to all the points makes it easy to decorate any object like so:

```

from openscad import *

fn=20

obj = sphere(20,fn=8) # Sample object

pts, tris = obj.mesh()

for t in tris:

for i in range(len(t)):

i1=t[i-1]

i2=t[i]

if i2 > i1:

obj |= circle(1).path_extrude([pts[i1], pts[i2]])

for pt in pts:

obj |= sphere(2) + pt

obj.show()

```


r/OpenPythonSCAD • • Apr 26 '25

Just implemented 2D colored render

4 Upvotes

PythonSCAD can now be used to create colored 2D paintings and even export the result

Here is a small demo, but I am sure that there are way more optoins...

exported SVG file can be used in other tools, or just in firefox ...

You will never see this greeninsh default color for rendered 2D anymore


r/OpenPythonSCAD • • Jul 02 '25

Texture function?

2 Upvotes

There was a "Texture" function where a pixel image was wrapped around an object --- how usable is that? Could it be used to either make a different appearance for previewing? (say to make a part look as if it was made of brass?) or to apply an actual physical texture for manufacture (say fake woodgrain).

Has anyone given any thought to working up a technique to impart a different appearance for previewing? (my current project is brass and bamboo and Richlite, so achieving something like to the appearance of those materials would be awesome)

A quick search of the Tutorial area comes up empty and it's not on the Examples page....


r/OpenPythonSCAD • • Mar 23 '25

Using OpenPythonSCAD to created Helixes

3 Upvotes

Using v paramter(vertical displacement) makes its easy to create a Helix.

(yes its an undocumented feature even though it already exists for a year now)

Alternatively you can also linear_extrude/rotate_extrude a python function which returns the x-section as a polygon like this:

def profile(i)

return [[0,0],[10,0],[10,10+3*i],[0,10-3*i]

]


r/OpenPythonSCAD • • Aug 11 '25

Cool Mech kinematics script in PythonSCAD

8 Upvotes

I've spent several weekends rebuilding one of my prior OpenSCAD projects in PythonSCAD. After a very late night I've gotten it fully rigged with inverse kinematics, something that was straight up impossible in SCAD and was what forced the switch. I need to clean it up into a usable toolbox, but its promising to be significantly simpler to continue expanding on than the SCAD equivalent had.


r/OpenPythonSCAD • • Mar 07 '26

Updated gcodepreview to support dxflayers

Thumbnail
github.com
2 Upvotes

r/OpenPythonSCAD • • Jul 24 '25

Landscape modelling with PythonSCAD

6 Upvotes

With the new colored surface, textures become super easy.

Together with faces() and other auxiliary functions, landscape modelling becomes fairly user friendly.

The Source code can be found here: https://bpa.st/RT4Q


r/OpenPythonSCAD • • Jul 09 '25

How to get a list of handles

2 Upvotes

Is there a way to get a list of handles (or other arbitrary variables) stored to an object. I find myself needing to go through the all the handles with a for loop. If the list gets other variables in it, no big deal, I know how to check that what I got is actually a transformation matrix)

Edit: Version 2025.07.11 added new functionality. For SCAD object obj, code list(obj.dict().keys()) will produce a list of all assigned value names, both handles and others, which can then be filtered as needed.


r/OpenPythonSCAD • • Jul 12 '25

Updated to Python 3.12

3 Upvotes

The new Windows version is updated to this, but to get it to load libraries the *._pth files must be deleted from the installation directory if present (see discussion on the Google Group).


r/OpenPythonSCAD • • Sep 22 '25

noob has a some questions and a correction

3 Upvotes

I just started working with openpythnscad. I feel like a dinosaur, haven't done cad in too many years. I got what I wanted and wrote an stl file with the results. The reason for this is that there are on the order of 700 holes per plywood sheet to be drilled, and I am not the person to do that well, jig or not.

Things that confused/annoyed me. I assume all are pilot errors of some fashion. guidance would be greatly appreciated.

  • On the screen doing preview, the display is tiny and the console is large. I couldn't find any way to flip that.

  • I am used to IDE's where the update to a file is automatic when I edit. It took me a while to figure out I needed to save explicitly and ended up with vim rather that the display editor. It was so small (150 lines) that I didn't bother with pycharm.

  • I couldn't find a clean way to get top view rotated so y was the long axis or easily translate the view.

In the wiki, the rot(x,y,z) have the args as list of floats rather than single float. I used single float and it worked as expected.

Now comes the real question. I need to take this and turn it into gcode with feed speeds, etc. This is for a CNC router. What do people use for a simple cam tool that can deal with looking at the holes and slots that got removed and turning those into reasonable gcode.

thanks in advance,

jerry


r/OpenPythonSCAD • • Jan 17 '26

What is/was the last working build for Windows? Link?

Thumbnail
github.com
2 Upvotes

r/OpenPythonSCAD • • Apr 15 '25

MacOS build OpenSCAD-silicon-2025-04-08.dmg damaged message

Post image
2 Upvotes

Downloaded the latest version to see if previous issues were fixed, however, I get the attached error message when opening the downloaded file.


r/OpenPythonSCAD • • Aug 11 '25

neovim setup, I couldn't get nvim to grab the venv with VenvSelect

2 Upvotes

EDIT: solved by adding pyrightconfig.json at root project which contains:

{
    "venvPath": "/home/user/venvs/",
    "venv": "pythonscad"
}

where ~/venvs/pythonscad is where I created the venv (from pythonscad interface). But if you have nvim setup suggestion, I am interested.


I was wondering how to get the venv into nvim. Even if I select the venv in VenvSelect, pip installed libs don't get recognised. I wonder if it is needed to have the venv in the same folder as py scripts?


r/OpenPythonSCAD • • Jul 31 '25

How are masks applied to fillets?

3 Upvotes

I'm an openscad user who's using pythonscad more now. I switched to the precompiled Windows-binary 2025.07.23. I'm trying to understand how masks are applied to fillets.

I found this example:

    c=cube(1.5);
    
    
    mask=cube([30,1,1],center=True).color([0,0,50,0.1])
    
    
    demo = [
    ย  ย  #c.fillet(0.1), # really round, but just with masked edges(which are front)
    ย  ย  c.fillet(0.1,mask,fn=20), # really round, but just with masked edges(which are front)
    ]
    show([demo[0], mask])

Without the mask it seems to work the way I think it should. However the version (uncommented) with the mask seems to have an entirely different radius.

If someone could explain how the mask is applied to the fillet and if the above example is the expected behavior that would be great. Currently it seems like the edges/faces need to be within the masked volume?


r/OpenPythonSCAD • • Aug 15 '25

How to extend to add more functions?

4 Upvotes

Let say I want to make nrotx which would be rotx but negative. Is it possible to extend so that it works like rotx?

cube(10).nrotx(2)


r/OpenPythonSCAD • • May 19 '25

Did nimport() break for the 5.15 build?

4 Upvotes

On the 5.15 build, nimport() can download py files from github, but it is unable to import modules at runtime.

I have the exact setup as prior on an older build. The only difference is...I am on Windows 11 now instead of Windows 10.

Is this a known issue? I peeked at the github issues, but did not see any new issues.