Support of arcs and arc movements (esp. for 3D printing)

19 views
Skip to first unread message

William Adams

unread,
Jul 22, 2025, 10:24:43 AMJul 22
to PythonSCAD
As discussed elsewhere, enabling support for this for 3D modeling is helpful in simplifying the CSG Tree (one element, rather than 90 as was being done), and it also has the potential to make DXFs much nicer/smoother (will definitely have to work up a generalized Bézier curve to arcs mechanism), and it has the potential to smooth out movement when writing out G-code _for those devices which support G2/G3 arcs_.

Apparently, it is pretty common for 3D printer firmwares to eschew support for this sort of movement (does anyone have a handy list of which ones do/don't support this?).

This becomes of moment since I just got a new 3D printer, and have been interested in:


for a while now, and it is my hope that the Python version can be imported into gcodepreview, and that the pairing will result in a solid surface 3D preview of how the file will print, with no need to load it into a slicer (it is my understanding that the various development environments used simply generate a wireframe).

Curious if anyone else has experimented with anything along these lines, and esp. how folks are doing at loading arbitrary Python libraries into Python 3.12 and accessing them from w/in (Open)PythonSCAD.

William

-- 
Sphinx of black quartz, judge my vow.

Guenther Sohler

unread,
Jul 22, 2025, 12:14:58 PMJul 22
to William Adams, PythonSCAD
yes, this fullgcodecontrol is indeed interesting.
If you realized your "project"  and have a gcode file available. i am eager to try it as-is in my printer




--
You received this message because you are subscribed to the Google Groups "PythonSCAD" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pythonscad+...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/pythonscad/322edad2-17a1-4d3f-9dce-2ba05709b978n%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

William Adams

unread,
Jul 22, 2025, 5:05:54 PMJul 22
to PythonSCAD
The G-code stuff has been on the back-burner for a while now --- but it's all in place and should work, except that one has to manually set up making multiple passes.

If you'll describe a cut you would like to make I'll gladly make a template/example file out of it.

William

William Adams

unread,
Nov 13, 2025, 11:24:14 PMNov 13
to PythonSCAD
I've been looking at this again, and am working on an update which will add support for 3D printing à la fullcontrolgcode.

3D printing requires control of the extruder, and matching volumetric calculations (or, more accurately, volumetric calculations which then determine the rate of extrusion).

Previewing in 3D/programming for 3D extrusion will likely want previewing not just the extruded shape, but also tracking the volume of material extruded and how it relates to the volume of the object being filled/the intersection of a just-extruded region with previously extruded material, and how large a void is left (presumably those two volumes would match up).

One concern is that G2/G3 support apparently is not common/guaranteed in 3D printer firmwares:


>available if a gcode_arcs config section is enabled

While it is possible to separately control the feed rate of the extrusion, and the length of material extruded:

    G1 F100 E5 ; Extrude 5 mm of filament at low speed to prime the nozzle

The normal usage is to move at a preset Feed rate in terms of motion, and while that movement is being made, extrude a given length of material:

    ; --- First layer adhesion test ---
    G1 Z0.2 ; Move nozzle to first layer height
    G1 X10 Y10 F3000 ; Move to starting position
    G1 F1800 ; Set slower speed for first layer
    G1 E0.8 ; Slight retraction before starting
    G1 X100 E10 ; Draw a line along X to test bed adhesion
    ; Comment: This line helps verify that the first layer sticks properly

My understanding is, in theory, if one had a layer height equal to the diameter of the filament, and wanted to extrude a circular cross-section of filament, the value for E would be equal to the distance traveled.

Apparently, the firmware control is limited so that the extrusion rate cannot be varied relative to the feed rate so that one could for example, decrease the speed, resulting in a trapezoidal extrusion.

Given all that, the idealized (normalized?) shape and dimensions of the extrusion would be controlled by:

 - layer height (for height along Z)
 - extrusion rate (for width in X/Y)

which would be previewed as a rounded cross section, so it should work to create a preview by calculating the volume of material which is being extruded, then determining the volume of a circle of radius layer height/2, subtract that from the extruded volume, then determine what width of rectangle cross section would be necessary at the specified length to make up the difference.

which should be enough to sleep on....

William

Guenther Sohler

unread,
Nov 14, 2025, 2:46:01 AMNov 14
to William Adams, PythonSCAD
Hi William,

This would be indeed a very nice extension to your gcodepreview, and I am eager being one of the 1st beta-Testers!

Of course cura can also preview the expected printing result, but gcodepreview could be an independent tool to show an alternative view.
It could even yield /forecast printing errors due to wrong slicer settings like under-extrusion and you could model gravity when support is missed 🤣


> My understanding is, in theory, if one had a layer height equal to the diameter of the filament, and wanted to extrude a circular cross-section of filament, the value for E would be equal to the distance traveled.
Yes, its matching my understanding.

Let me know when we can start testing!




William Adams

unread,
Nov 14, 2025, 4:02:53 PMNov 14
to PythonSCAD
Working on this now.

A further consideration is that what makes the most sense is an interface where one:

 - specifies the desired motion
 - the program has access to the layer height and the current extrusion width (naturally these can be over-ridden) and the filament diameter
 - the program calculates the necessary length of material to be extruded so as to output the necessary volume of material


William

William Adams

unread,
Nov 15, 2025, 1:23:44 PMNov 15
to PythonSCAD
Okay, I tried using skin() for modeling 3D printing as a test, but it got real complex, real quick --- it would be necessary to track which quadrant a given extrusion is in, and how much each is rotated.

Instead, we will model in 3D traditionally --- I think it will be easiest to walk through this at:


William

W W

unread,
Nov 15, 2025, 3:22:56 PMNov 15
to PythonSCAD
I am late to the thread :)

I dont have much to offer irt to gcode sadly. I havent had much experience in that realm.


>  and esp. how folks are doing at loading arbitrary Python libraries into Python 3.12 and accessing them from w/in (Open)PythonSCAD 

I have done two ways (both of which you probably already know. But just in case):
- /1/ nimport() which you must already know, since you added that doc :)
- /2/ If you are importing PIP packages, make sure you have the matching python version installed on your local machine, and point the pythonscad sys.path to the corresponding site-packages folder at runtime.

Admittedly I haven't used /2/ as much, since it's not as "portable" as self-contained nimport(). 

-W
Reply all
Reply to author
Forward
0 new messages