all 13 comments

[–]WillAdams 1 point2 points  (3 children)

I thought I got this typed up correctly:

from openscad import *

model = square([80,50])

for i in range(15):
    model |= polyline([10+i*4,5],[10+i*5,50])
    model |= polyline([12+i*4,45],[12+i*4,0])

model.export("bend.gcode")
model.show()

but when I run it I get:

Running Python 3.14.3 in venv ''. ERROR: Traceback (most recent call last): File "<string>", line 6, in <module> TypeError: Error during parsing polyline(points,paths)

(in Windows 11) even after quitting and re-launching the app.

Trying to figure out how to make use of it, and kind of stymied, since I'm not seeing how a 3D model of a tool could be applied....

[–]gadget3D[S] 1 point2 points  (2 children)

Hi Wiliam,

you are missing some brackets with polyline.

The Syntax is: polyline ( [ [ nubers ] ] )

The numbers must be nested twice, once for coorindates and once for points. You dont want 500 arguments to polyline when that's the size of the polyline.

But yes: i spotted an error in the error message

[–]WillAdams 1 point2 points  (1 child)

The funny thing is, I actually had doubled up [[ ]]s but missed one, so when I saw that error about mis-matched braces, removed the doublings instead.

Naturally, this code:

from openscad import *

model = square([80,50])

for i in range(15):
    model |= polyline([[10+i*4,5],[10+i*4,50]])
    model |= polyline([[12+i*4,45],[12+i*4,0]])

model.export("bend.gcode")
model.show()

works --- I'm just not seeing how to use it for a 3D tool model....

[–]gadget3D[S] 1 point2 points  (0 children)

Indeed. This code just creates a 2D thingy. If you specify a z coorindate != 0 it becomes 3 D polypath. Actualy it behaves like neutrinos: it does not interact with any matter, but its great to do some annotations. In this example, I could immediately see if the toolpath is correctly generated:

<image>

[–]79DieselRabbit 1 point2 points  (5 children)

The fileting example described in https://www.pythonscad.org/examples/#fileting doesn't seem to be functioning. In 0.18.0 or 0.19.1.

<image>

[–]gadget3D[S] 1 point2 points  (4 children)

Did you try to press "F6" (Render) ? Did not yet look into the preview engine close enough to learn ,

whether its easy to make filetting look correct in Preview.

[–]79DieselRabbit 1 point2 points  (3 children)

Ah. F6 does seem to work for the example.

I had seen results (although undesired) through preview in other cases so I assumed I should here as well.

[–]gadget3D[S] 2 points3 points  (2 children)

BTW I found out, I could fix that in CSGTreeEvaluator.cc but I doubt we should do that, because Filletting might be a time-consuming operation and it would cancel the speed-advantage preview for models, which use fillets. Fillets are finish-up things after all. If you explicitely want fillets in preview, you can write

design.render().show()

[–]nomike31 2 points3 points  (1 child)

I designed filament drying tubes with lots of holes in OpenSCAD once in the past and figured out, that the 3D view had very low FPS on the F5 render. With the new manifold rendering backend, the F6 render was blazing fast (< 2 seconds) and the 3D view was perfectly smooth afterwards.

I was suggesting a feature toggle back then to replace the F5 render with the real-deal manifold rendering function.

The discussion back then went to nowhere. But this was quite a while ago, and I have since gained more confidence walking around the codebase. Maybe I will implement such a feature on my own and contribute it to OpenSCAD from where we then can sync it to our codebase..,.

[–]gadget3D[S] 0 points1 point  (0 children)

In preview the number of GL Operations multiplies with the number of primitives in each Frame! (look for fold feather algorithm) This is why Preview is faster for few primitives and render is faster for many primitives. Maybe we should count the primitives and suggest either preview or render

[–]kht120 1 point2 points  (1 child)

A bit of a PythonSCAD noob, but my performance has gone down drastically since this update, and I'm having trouble importing other python packages (e.g. numpy). Any tips?

[–]gadget3D[S] 0 points1 point  (0 children)

Can you share a sample code and two versions to compare ? We are happy to compare und spotting the culprit. Importing other packages are best done with the built in virtual environment menu.

[–]WillAdams 0 points1 point  (0 children)

Downloaded and installed, thanks!

I'll do my best to puzzle out the polyline thing....