Question

7 views
Skip to first unread message

Matthieu Hendriks

unread,
Aug 1, 2025, 6:56:39 AMAug 1
to PythonSCAD
Is it possible to do object oriented programming in pythonopenscad. 
And if yes is there a working example?

For object oriented there would be something like

OOObj=cube(40).translate([x.y.z]).morph(abc).color("purple").selfDefinedFunctions(...) 

show(OOObj.get())

Guenther Sohler

unread,
Aug 1, 2025, 7:11:44 AMAug 1
to Matthieu Hendriks, PythonSCAD
Yes, of course its possible and your code is almost correct

you can write:

OOObj = cube(10) 
# OOObj is already an OOObject and you can apply methods on it

obj2 = OOObjj.right(10) # right is a method of each Obeject

do display you can write

obj2.show()
or
show(obj2)

HTH

--
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/f54e5a19-b570-4e0e-a025-a48764d52012n%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

William Adams

unread,
Aug 7, 2025, 10:38:51 AMAug 7
to PythonSCAD
For classes to use to make objects, note that we have a bit written on this at:


William
Reply all
Reply to author
Forward
0 new messages