<ali1234>
this could even allow me to complete my dream of writing openscad in a blender text data resource attached to an object, and having the resulting 3d mesh instantly appear in the scene viewer
<guso78k>
yep possible. did some attempts to run openscad in jupyter. everything but the graphics work :')
<ali1234>
i was also thinking about what stealth_ said about syntax
<ali1234>
i could not think of a way to make it really work the way openscad does due to pythons (lack of) scoping
<guso78k>
IMHO lack of scoping is not a disadvantage, but thats my personal opinion
<guso78k>
and yes: there many workarounds for scoped openscad. basically its always recursion.
<ali1234>
the best i could come up with is some trick along the lines of "with difference(): cube(); cube(); ..."
<ali1234>
but with doesn't create a scope so even this would need extreme inspect magic and probably totally changing how the code gets compiled
<stealth_>
you talking about how to have it rendering without having to pass var around? its like how print() puts data into stdout.
<ali1234>
but it can't be implemented in a way that won't break with every python update
<stealth_>
many ways to go about it, if you have `cube() - cube()` you can stdout the result of it in operator class
<ali1234>
python doesn't have operator classes as such
<ali1234>
you can't directly override what "-" does, you can only override how individual classes react to it
<ali1234>
the main problem is if you have a bare function call like "cube()" then the result just vanishes immediately. it probably still exists in the memory pool but there's no way to retrieve it
<ali1234>
but if you adjust cube() so that it writes to stdout instead of returning geometry, then it writes to stdout no matter where you call it
<stealth_>
you can store like a tree structure on start of the file.
<ali1234>
then what?
<ali1234>
where do you add things to the tree?
<stealth_>
like `if not holder: holder = []`, inside each function have it upload render to `holder.append(["data", parent=?])`
<ali1234>
yeah but what is parent?
<stealth_>
another way you can have `cube()` above that have `@holder()` this will get initialize at runtime.
<stealth_>
`@holder()def cube(...): ...`
<stealth_>
its how flask and other framework cache url paths at runtime.
<ali1234>
yes but you still haven't said how you are going to obtain the values you want to store
<ali1234>
okay well i can't get pythonscad to work, either the appimage or building it myself. it just says "error: python not found. is it installed?"
<ali1234>
self-build behaves different. it doesn't recognize python files at all. it won't even let me open them, and if i type one out manually it just produces a syntax error because it wants openscad
<stealth_>
sorry, i have no clue about that library and its working.
guso78k has quit [Quit: Client closed]
<ali1234>
got it working. i must have been missing some library - but not one that makes the build fail
J25k70 has quit [Quit: Client closed]
J25k70 has joined #openscad
badcad has joined #openscad
J25k70 has quit [Quit: Client closed]
J25k70 has joined #openscad
J25k40 has joined #openscad
J25k70 has quit [Ping timeout: 240 seconds]
<ali1234>
okay i have a LOT of feedback about how this works
badcad has quit [Quit: Client closed]
lastrodamo has joined #openscad
drfff has quit [Ping timeout: 252 seconds]
drfff has joined #openscad
hyperair has quit [Ping timeout: 260 seconds]
_whitelogger has joined #openscad
mmu_man has quit [Ping timeout: 260 seconds]
Guest69 has joined #openscad
L29Ah has quit [Ping timeout: 248 seconds]
<Guest69>
hi all, I posted a similar question on /r/openscad as well. Is there a way to 'jump' to particular faces on a object? for e.g. if I have a cube, I want to to be able to specify a named faced to add another object to, is there such a capability?
hyperair has joined #openscad
hyperair has quit [Ping timeout: 252 seconds]
Guest2 has joined #openscad
hyperair has joined #openscad
guso78k has joined #openscad
<guso78k>
ali1234, https://bpa.st/SA6A, our past is also nice, build123d follow such an approach
<guso78k>
in pythonscad its something like: MyShape(10,2,Sphere(5)+[123]).color("red")
<guso78k>
but can also add the with: syntax
<guso78k>
pythonscad suports oprators for boolean ops, like solidpython does, but its not a layout on top of openscad, its native instead
Guest64 has joined #openscad
Guest64 has quit [Client Quit]
Guest2 has quit [Quit: Client closed]
guso78k has quit [Quit: Client closed]
stealth_ has quit [Quit: Leaving]
guso78k has joined #openscad
hyperair has quit [Read error: Connection reset by peer]
<guso78k>
ali1234, please share your feedback with me. the message "Python not found, is it installed" means, that python cannot find its std library at startup. you can best provide that by having python installed in the system
<ali1234>
obviously i do have python installed, but it is python 3.12, and the appimage is looking for 3.11 (not 3.12 as the webpage claims)
hyperair has joined #openscad
<ali1234>
also you have a typo on the webpage irc link. it says "#pyopencad" instead of "#pyopenscad"
<ali1234>
openscad.cube((1,2,3)).show() doesn't work - functions should accept any sequence of appropriate length
<ali1234>
there is another typo in the tutorial section of the website. it refers to "os_import" but this function is called "osimport"
<ali1234>
i dont understand how osinclude() or osuse() are supposed to be used
<ali1234>
and i don't understand what output() even does
<ali1234>
if the module is run headless, how do we export geometry?
<ali1234>
is output just a synonym for show?
<ali1234>
if you call show multiple times, only the last one does anything
Reisga2449 has joined #openscad
misterfish has joined #openscad
<guso78k>
thank you for the feedback, will resolve all of them
<guso78k>
outrput == show, yes
<guso78k>
on headless build , you can get the geomtryw ith:
<guso78k>
export(solid, "filename.extension") e.g.
<guso78k>
exporting with 3mf even supports exporting multiple individual shapes by using a dict of solids instead of a solid
<ali1234>
cool. so you can export different things to two separate files from within the same script... even from within a loop. that's huge
<ali1234>
i'm not sure how show() should work
<ali1234>
but having only the last one do anything doesn't seem ideal
<ali1234>
okay build123d looks interesting. but how does it work?
<ali1234>
Guest69: not easily possible in basic openscad but i think some libraries like bosl2 add such features, or the python wrappers also support it i think
<ali1234>
ah build123d is doing inspect magic, like i said :)
<ali1234>
still, interesting that someone actually already did it
<ali1234>
apparently quite successfully too since that repo is still updating
<guso78k>
only last show() in the script will have an effect. you can can type: a=cube([1,2,3]) and then a.show(), then press F5 or F6
<guso78k>
build123d is brother of cadquery. but pythonscad can also display with small tricks
<ali1234>
i noticed manifold itself has a python wrapper too
<guso78k>
build123 suports with: python statement, and apparently implement enter and exit methods
<ali1234>
yes, that's why it is so interesting. i much prefer that syntax
<guso78k>
need to catch up now and correct your findings :)
<ali1234>
i dont like method chaining very much
<ali1234>
it just makes super long lines
<guso78k>
i think the with: behaviour can be implemented in python language only
<ali1234>
what do you mean?
<ali1234>
like patching python interpreter?
<ali1234>
build123d does it by inspecting the stack to find the context so it doesn't need patched interpreter
<ali1234>
it is a bit hacky though
<ali1234>
it doesn't behave like "normal" python code, which can be surprising. that's the downside to it
<guso78k>
a1234, if you can come up with an usable way to integrate with: with pythonscad, i am happy to merge .
<ali1234>
i'll keep thinking about it. maybe there is a nicer way to get the syntax benefits without the behind-the-scenes hackery
guerd has joined #openscad
mmu_man has joined #openscad
bunnyhamer has joined #openscad
L29Ah has joined #openscad
bunnyhamer has quit [Quit: Client closed]
teepee_ has joined #openscad
<guso78k>
ali1234: scad() function has only one string argument and the embedded scad code MUST return geometry to work. no submodule calling is supported. simplest example is :
<guso78k>
scad("cube([1,2,3]);") but also more sophisticated scad is possible as long as it directly returns geometry
<guso78k>
what you probably want is osinclude - matches to openscad include or osuse which matches to to openscad use
<guso78k>
you can try:
<guso78k>
lib = osuse("scadfile")
<guso78k>
then : lib.my_scad_module(1,2).show() e.g.
teepee has quit [Ping timeout: 264 seconds]
teepee_ is now known as teepee
<guso78k>
but osuse is known to have some memory issues and does not yet work reliable
guso78k has quit [Quit: Client closed]
guso78k has joined #openscad
<JakeSays>
the single biggest issue with python based scad tools is... python.
<guso78k>
its an issue and a chance at the same time
<JakeSays>
a chance for what?
<guso78k>
python brings many intersting language features which openscad is lacking or need to go complicated detours. and it comes with a great pip library. but after all: its a matter of taste
<JakeSays>
the language itself is not worth using it.
<guso78k>
i prefer to use tabs instead of backets and quotes - this is my taste
<JakeSays>
and those with blocks..
<JakeSays>
guso78k: quotes?
<guso78k>
sorry, i meant paranthesis ;)
<JakeSays>
i see lots of parens in those build123d examples
<guso78k>
this a set of many small example invocations and comparable with openscad. but as soon as functions/modules are involved, openscad uses {()} where as python uses tab indents and this needs less quotes, braces
<JakeSays>
yes, and more tabs
<JakeSays>
i much prefer braces
<JakeSays>
and you also have those silly with constructs
<gbruno>
[github] t-paul pushed 5 additions 4 modifications 1 removals (Python in OpenSCAD (#5690) Add first python module (`cube()`). Switch hash library from crypto++ to nettle. --------- Co-authored-by: Guenther Sohler <guenther.sohler@photeon.com> Co-authored-by: Torsten Paul <Torsten.Paul@gmx.de>) https://github.com/openscad/openscad/commit/69998f854a22524558639d864780c0446624131b
<teepee>
I'm not a huge fan of python, including the tab/spacing thing
<guso78k>
some guys love python and some do hate it. it appears, that there is nothing in between O:3
J25k40 has quit [Quit: Client closed]
<JakeSays>
there isn't
J25k40 has joined #openscad
<teepee>
but it has the benefit of being widely used, having impressive support and documentation
<teepee>
with conrolling resources in a 100% safe way is a good solution
<teepee>
C++ does that well with RAII
<JakeSays>
teepee: well, it's good in the sense that python w/o it would be a leaky mess, but it's not good that its needed at all
<teepee>
in java it's a bit annoying but mostly solved with expressions in try()
<JakeSays>
i'm speaking specifically about using it as a scad
<teepee>
huh? in any language using *actual* resources, there is NO way around some sort of solution
misterfish has quit [Ping timeout: 252 seconds]
<teepee>
in scad essentially being "just" an evaluation it might be difficult to find an actual use case
<teepee>
anyway, if we solve one language, adding more is probably not too hard
<teepee>
specifically sandboxed ones
<JakeSays>
teepee: no, my point is that when you adapt a language (python) to function as a hacked up dsl (scad'ish), you need to expose things like lifetime management to the developer
<teepee>
I don't see it as DSL, we have that
<teepee>
adding python enables use cases a strict dsl makes difficult
<JakeSays>
with openscad i can focus on my design, not on dealing with things out of scope
<teepee>
yes, and therefore I like it and it's not going to be replaced
<JakeSays>
teepee: wait, you're not adding python to openscad, are you?
<teepee>
but we will not add database access to scad
<teepee>
the first patch for that is included for a year
<JakeSays>
for what?
<JakeSays>
i mean, what's it used for?
<teepee>
"it" refers to what exactly?
<JakeSays>
python
<teepee>
optional (when enabled at compile time) 2nd langue that can be edited and run directly in the openscad application generating meshes for export
<JakeSays>
how does it relate to scad?
<JakeSays>
scad the language
<teepee>
pretty much not at all
<JakeSays>
does it have access to openscad internals?
<teepee>
yes, that's the point of integration
<teepee>
e.g. all the render stuff exists once independent of how the design was created
<JakeSays>
do you have a link to an example? i'm not getting how it's used
<teepee>
it generates the node tree openscad uses internally
<teepee>
mesh processing afterwards is the same openscad code that already exists
<JakeSays>
right. totally makes sense now.
<JakeSays>
that would be fairly straight forward to do in c#
<teepee>
the integration is also not the biggest concern
<JakeSays>
what is?
<teepee>
getting builds on various platforms and distributions is
<JakeSays>
you mean builds of openscad with the c# integration?
<teepee>
we distribute lots of builds ready to use for people
<teepee>
integrating new dependencies is always a challange
<JakeSays>
right. i think it wouldn't add too many pain points with .net
<teepee>
Debian, Ubuntu, Snap, AppImage, Flatpak, Docker, MacOS, Windows
<teepee>
I suppose chances are good, it's well supported everywhere. good startiing point
<JakeSays>
yeah, and the .net runtime + supporting libraries could be packaged with openscad fairly easily
<teepee>
probably trivial for linux distro builds
<teepee>
no idea how that works in the container formats
<JakeSays>
teepee: basically the .net build process would produce a standalone build that contains everything needed to use c# in openscad. the contents of the build would be copied into the openscad build directory and then packaged just like you'd package any other libraries (like qt, etc)
<teepee>
that sounds strange
<JakeSays>
how so?
<teepee>
results from one build copied into the other build?
<JakeSays>
well, not so much copied as the openscad build would invoke the .net build and have it deposit the results in an appropriate location.
<teepee>
aha!
<teepee>
[ 67s] -- Found Python: /usr/bin/python3 (found version "3.13.2") found components: Interpreter Development Development.Module Development.Embed
<teepee>
[ 67s] -- Found Nettle: /usr/lib/x86_64-linux-gnu/libnettle.so (found suitable version "3.10", minimum required is "3.4")
<teepee>
[ 67s] -- Python enabled, using Nettle 3.10
<JakeSays>
yeah, see with .net there are no external dependencies. it's much cleaner.
<teepee>
that's probably fine for some of the build, linux distro builds should use the deps shipped
<teepee>
it's also a big no-no for linux distros
<JakeSays>
i disagree. i much prefer a clean, packaged solution
<teepee>
just saying it's against most distro policies for security reasons
<JakeSays>
they don't support shipping libraries with apps?
<teepee>
they usually want to fix a shared lib and ship that
<teepee>
not dig through thousands of apps, searching for dependencies and rebuild and ship all those
<JakeSays>
oh right. i forget that distros build everything from source.
<JakeSays>
how many distros do you support
<JakeSays>
teepee: the list you pasted only shows two - debian and ubuntu
<teepee>
for dev-snapshots we had debian/ubuntu/fedora/opensuse - currently limited a bit more
<teepee>
as I could not keep things updated
<JakeSays>
right
<teepee>
but releases are usually maintained by people from the distros
<JakeSays>
man that sure seems like a lot of work on their part
<teepee>
yes, including lots of repeated work
<teepee>
but shared across more people at least
<JakeSays>
no wonder they're always way behind on versions
<teepee>
it simply depends on the time and motivation of those people
<JakeSays>
right
<teepee>
the more known the app, the more likely it's very up-to-date
<JakeSays>
i wrote a wayland compositor a couple of years ago. it was based on a version of wlroots that debian didn't support, so i had to build it and all its deps (including mesa). that was a ton of fun.
<teepee>
yes, and we usually support at least the previous debian and ubuntu lts
<church_>
getting some slackware/gentoo wibes :)
Guest69 has quit [Quit: Client closed]
feep has quit [Ping timeout: 244 seconds]
feep has joined #openscad
<ali1234>
guso78: what is the difference between osinclude and osuse?
<buZz>
and TI / maemoleste have made it so we can run 5.x/6.x kernels with working 3d acceleration
<buZz>
yeah richkid toys
<buZz>
not really relevant
<buZz>
:)
<teepee>
yeah, expensive as it's probably mostly hand made
<teepee>
maybe framework computer comes up with something. they have an announcement event soon
<buZz>
i kinda doubt anyone will make a real portable device with qwerty keyboard anytime soon
<buZz>
i mean, one that doesnt cost 2 months of rent
<teepee>
probably not the mass market right now
<buZz>
hmhm
<buZz>
people cant type anymore
<church_>
still, even with manifold, more complified shapes take some computing power, so i'd rather think some remote rendering, if on mobile device. also openscad is about text input, i find it awkward/slow to type well in touch-screen only gadgets
<church_>
so while port can be done .. is there real need for that?
<buZz>
indeed, i dont consider touchscreen only devices to be user oriented
<buZz>
i'm talking about a specific device that i tried to get openscad running on prior :)
<buZz>
did totally work with mesa's fakeOpenGL
<buZz>
but insanely slow :D
<church_>
well, it sounds like "can it run Doom" .. most probably can .. but does it makes it worthwile to spend time/efforts on developing that port? :)
<buZz>
as it aligns with -my- desire to have a portable openscad terminal, it makes it worthwhile for -me- to do by myself ;)
<buZz>
dont forget , i'm not employed for this, nor gain any finances from my 'work' on it
<church_>
"terminal" also sounds to my ears as something "remote" :) .. unix sysadmin roots, serial terminals and all that :D
<buZz>
i doubt i'll get OpenSCAD working on my DEC VT420
<church_>
but remote .. i know that i'd probably implement rather some client-server type interface to pass code for rendering elsewhere
<buZz>
but you could totally use openscad 'headless'
<buZz>
and just display the renders or stl exports elsewhere
<buZz>
btw, often i just do '$fa=5;$fs=5;' on 'renders on slow machines'
<buZz>
and only up that later for final exports
<church_>
there obviously are many means to reduce quality for sake of rendering speed .. i just ranted in general, that if one wants to mess with heavy stuff (eg. minkowski) .. also regarding coding/text input efficiency & ergonomics
<buZz>
droid4 types like a dream , i tell you :)
<buZz>
almost as fluent as the 'zipit z2' , but a pxa270 is -wayyyy- too slow for openscad ;)
<buZz>
also 64MB ram isnt very suitable :D
<church_>
don't mind me much. i'm the type to whine even if generic PC/MAC keyboard is not of ergonomic shape :)
<buZz>
i've been daily-ing a Surface Pro 5 since last year :D
<church_>
also rendering some poorly coded stuff for me at maxed quality, often shows me RAM usage of 10-15GB :D
<buZz>
i didnt expect to like it
<buZz>
but the keyboard is urrrrrf
<ali1234>
guso78: okay but that isn't actually useful in python, because those geometries will never do anything unless you show() them? i suppose it might give a performance increase?
<ali1234>
and what actually prevents module import working with scad()?
<JakeSays>
buZz: i'd love to have one of those old phones
<buZz>
JakeSays: if you join maemo leste as developer, you might be able to get one for free from their collection :)
<buZz>
imho the only really annoying thing of droid4 , is limited to 3G , which they disabled here in .nl
<buZz>
so it'll be 2G/edge max speed
<buZz>
(well, or wifi)
<JakeSays>
buZz: well, i want to replace its guts with something else
<buZz>
oh, well, not sure then ;)
<buZz>
these devices are HIGHLY integrated
<buZz>
but finding 'broken' cellphones should be easy?
<buZz>
you'll likely safe them money by taking it home, instead of them tearing it down for raw materials
<JakeSays>
i mostly want the keyboard
<buZz>
you know, blackberry keyboards can be had easily
<JakeSays>
but yeah, probably shouldn't be too hard to find broken ones
<JakeSays>
oh?
<buZz>
and they're just i2c devices iirc
<JakeSays>
oh that's cool
<buZz>
including a tiny optical trackball
<buZz>
you can even buy them on a breakout for 'arduino use' etc
<J25k40>
that would be a nice scadvent .. each day something is added
<InPhase>
J25k40: See... If the little plastic strands start snapping off of the stem, then you know you've had too much to drink.
guso78k has quit [Quit: Client closed]
<InPhase>
Also, I just made up that functional form for a wine glass, aiming to mesh it with your pattern, and I like the shape of that glass. I'm going to save that.
<InPhase>
I'm not sure if there's a printer in the world yet that can print that and have it come out right. :)
<InPhase>
But, it is pretty anyway.
<church_>
also if it will be made/printed, i suspect that cleaning dirt that gets into that viewed mesh, might be slight PITA :)
<church_>
s/viewed/weaved/
<InPhase>
church_: That's why you charge a lot for it.
<InPhase>
church_: That way only rich people will have it, and they can afford to pay for the cleaning labor.
<church_>
As in - from guys, that buy new rolls royce, when ashbin of old one is full? :)
<InPhase>
You would also need to print it out of unobtanium filament to get the right properties, so there will be time to invent the cleaning nanobots required.
<church_>
then no problems, IIRC i had half of spool of unobtanium in shed. It's even reinforced with beskar threads