teepee changed the topic of #openscad to: OpenSCAD - The Programmers Solid 3D CAD Modeller | This channel is logged! | Website: http://www.openscad.org/ | FAQ: https://goo.gl/pcT7y3 | Request features / report bugs: https://goo.gl/lj0JRI | Tutorial: https://bit.ly/37P6z0B | Books: https://bit.ly/3xlLcQq | FOSDEM 2020: https://bit.ly/35xZGy6 | Logs: https://bit.ly/32MfbH5
mmu_man has quit [Ping timeout: 276 seconds]
val has quit [Ping timeout: 276 seconds]
J25k1 has joined #openscad
J25k18 has quit [Ping timeout: 240 seconds]
val has joined #openscad
<gbruno> [github] jordanbrown0 opened issue #5853 (color(undef) inconsistent between Manifold and preview) https://github.com/openscad/openscad/issues/5853
J25k1 has quit [Quit: Client closed]
J25k1 has joined #openscad
J25k1 has quit [Quit: Client closed]
J25k1 has joined #openscad
howiemnt has quit [Remote host closed the connection]
howiemnt has joined #openscad
drfff has quit [Read error: Connection reset by peer]
snaked has quit [Read error: Connection reset by peer]
snaked has joined #openscad
<gbruno> [github] Zenmaster43 opened issue #5854 (Search field insertion point jumps to end after clicking earlier in field text and pressing any key) https://github.com/openscad/openscad/issues/5854
guerd has joined #openscad
Guest59 has joined #openscad
Guest59 has quit [Quit: Client closed]
teepee_ has joined #openscad
teepee has quit [Ping timeout: 264 seconds]
teepee_ is now known as teepee
splud has quit [Read error: Connection reset by peer]
splud has joined #openscad
guerd has quit [Ping timeout: 272 seconds]
J25k1 has quit [Quit: Client closed]
J25k1 has joined #openscad
chris64 has quit [Ping timeout: 260 seconds]
ToAruShiroiNeko has joined #openscad
crazy_imp has quit [Ping timeout: 276 seconds]
crazy_imp has joined #openscad
arebil has quit [Ping timeout: 265 seconds]
arebil has joined #openscad
J25k1 has quit [Quit: Client closed]
J25k1 has joined #openscad
howiemnt has quit [Remote host closed the connection]
howiemnt has joined #openscad
J25k1 has quit [Quit: Client closed]
J25k1 has joined #openscad
mmu_man has joined #openscad
J25k1 has quit [Quit: Client closed]
J25k1 has joined #openscad
L29Ah has left #openscad [#openscad]
L29Ah has joined #openscad
<gbruno> [github] jordanbrown0 closed issue #5852 (A suggestion to improve data sharing with the slicer) https://github.com/openscad/openscad/issues/5852
L29Ah has left #openscad [#openscad]
L29Ah has joined #openscad
L29Ah has left #openscad [#openscad]
L29Ah has joined #openscad
Guest70 has joined #openscad
<Guest70> I am trying to cause certain lines in a module to execute based on an input.  I have tried a number of things, none of which have worked.
<Guest70> module 4_pins (x_length,y_width,diameter,height,type)   Based on type, I want to execute one of two lines.       bottom_radius = pin_radius;
<Guest70>     bottom_radius = (diameter *.916) / 2;
<InPhase> Guest70: You'll need to use bottom_radius = (type == foo) ? pin_radius : (diameter * 0.916) / 2;
<InPhase> Any sort of condition that evaluates to a bool can be placed between = and ?
<Guest70> The obvious if (type==0) {bottom_radius = pin_radius;} else {bottom_radius = (diameter *.916)/2;} results in bottom radius results in errors.
<InPhase> Guest70: Yes, that only defines bottom_radius inside the if scope.
<InPhase> Guest70: It's different from the scoping rules of some other languages. Every time there's a { } it's a new scope context, and nothing bleeds back out.
J25k1 has quit [Quit: Client closed]
J25k1 has joined #openscad
<InPhase> Guest70: This is particularly important because it's a declarative language, so for example for "for" loops, it's a new scope for every iteration.
<InPhase> So for conditional assignments, we use that ternary operator approach with ? :
<Guest70> so how does this work?    bottom_radius = (type ==1) ? pin_radius:(diameter *.816)/2;     Will this set bottom_radius to be the same as pin radius if type is 1?  And why do I get an undefined on type
<Guest70> lets see if I can put it here
<Guest70> module 4_pins(x_length,y_width,diameter,height,type)
<Guest70> {
<Guest70> pin_radius=(diameter/2);
<Guest70>     bottom_radius = pin_radius;
<Guest70>     bottom_radius = (diameter *.916) / 2;
<Guest70>     echo( "Bottom radius",bottom_radius);
<Guest70>     color("Aqua")
<InPhase> If it becomes too cumbersome to use a ternary operator, you can also call a function to compute the value, and move the logic out of a location. Functions will return a value, but if statements don't. However inside the function you will find yourself using ternary operators.
<Guest70>     translate([0,0,-height])
<Guest70>     cylinder(height,pin_radius,bottom_radius);
<Guest70> echo ("pin radius ", pin_radius);
<Guest70>     color("Aqua")
<Guest70>     translate([x_length,0,-height])
<Guest70>     cylinder(height,pin_radius,pin_radius);
<Guest70> echo(x_length-pin_radius,0);
<Guest70>     color("Aqua")
<InPhase> paste?
<othx> paste is https://bpa.st for .scad files and other text like long error reports, https://pasteboard.co/ or https://imgur.com/ for images
<Guest70>     translate([x_length,y_width,-height])
<Guest70>     cylinder(height,pin_radius,pin_radius);
<Guest70> echo(x_length,y_width);
<InPhase> Use bpa.st, don't paste in the chat.
<InPhase> Just give the link to the posted code.
<Guest70> ok.
<InPhase> Also try a module name like FourPins. Starting identifiers with digits has been deprecated in the master branch, and will throw a warning on the next release about this.
<InPhase> The plan will be to remove support for this eventually, as it conflicts with too many planned and implemented features.
<InPhase> Permitting it in the first place was a small blunder. :)
<Guest70> This gives an undefined if the module is called without type passed in.  I would like to have type default to a specific value unless it is over ridden.  The concept here, is to set the module up such that it can be used to generate a support boss, (a cylinder) with either a straight pin for heat locking, or a tapered hole for putting a screw in.
<Guest70> By making the hole 3mm at the top, and something smaller at the bottom, a 3mm screw can be started in and will not need threading.
<Guest70> The coloring and echos are just for debugging.
<Guest70> Thanks for the help.  I got it flying....
<Guest70>     bottom_radius = (type ==0) ? pin_radius:(diameter *.916)/2;   this did the job.  All I have to say, is that SCAD is a weird language.  Why it doesn't work like C is beyond me.  IT is so C like.
<InPhase> Well because it's a declarative functional language, and C is imperative. :)
<InPhase> A decision was made early on that models are by their nature more declarative. There are some significant benefits to this sort of approach, when a problem domain permits it.
<InPhase> For example, calling a module or function will NEVER impact things outside of that module or function.
<InPhase> One always knows where to look for issues.
<InPhase> Guest70: To make type default, you just write: module FourPins(x_length, y_width, diameter, height, type=0)
<InPhase> s/default/have a default/
<InPhase> Guest70: Note also that you can do: color("Aqua") { onething; twothings; threethings; }
<gbruno> [github] AaronVerDow synchronize pull request #5850 (improve color utils) https://github.com/openscad/openscad/pull/5850
Guest70 has quit [Quit: Client closed]
teepee_ has joined #openscad
teepee has quit [Ping timeout: 264 seconds]
teepee_ is now known as teepee
decfed has left #openscad [#openscad]
<gbruno> [github] AaronVerDow opened issue #5855 (render-cgal_polygon-concave-simple test fails randomly) https://github.com/openscad/openscad/issues/5855
J25k1 has quit [Quit: Client closed]
J25k1 has joined #openscad
J25k1 has quit [Quit: Client closed]
J25k1 has joined #openscad
stealth_ has joined #openscad
<stealth_> nice, for me using openscad python is actually pretty fun and bit more explicit, plus i can use all the python editor tools :)
arebil has quit [Ping timeout: 268 seconds]
<stealth_> is there a way to add python package to openscad? i wonder if i can add my dynamic import library https://github.com/YoSTEALTH/Dynamic-Import
<teepee> depends on what installation you use
<stealth_> currently i am using the .appimage
<teepee> from the openscad website?
<stealth_> ya the latest one release yesterday
<teepee> then you should have a menu entry python->create virtual environment
<stealth_> o i c it, let me try
<teepee> use a new empty folder
<stealth_> hmm it added a lot of files
<teepee> that's promising
<teepee> close openscad, it needs to restart anyway
<stealth_> does it use system python but creates a virtual env from that?
<stealth_> ya
<teepee> it does not use the system python
<stealth_> o, so .appimage comes with its own python?
<teepee> yes
<stealth_> well that works too
<stealth_> where to i add my files?
<teepee> I'm not sure if you now can use the venv in normal way
<teepee> so far I only tested directly from openscad
<stealth_> you should have been able to use system python but this way is probably better to manage for you guys.
<teepee> not possible
<stealth_> even sublimetext comes with its own python
<teepee> what you can now try is activating the venv
<teepee> and see if you can run the openscad-python in there
<stealth_> o i c, give me a bit here, i have to add that into my editor build file
<teepee> yep, works for me...
<teepee> to activate the venv, in the top level folder: source bin/activate
<teepee> then you need to run the appimage for pip, e.g.: ~/bin/OpenSCAD-2025.04.23.ai25105-x86_64.AppImage --python-module pip list
<teepee> ~/bin/OpenSCAD-2025.04.23.ai25105-x86_64.AppImage --python-module pip install humanize
<teepee> running the file in the bin folder of the venv will *not* work
<stealth_> i see
<stealth_> says it has some issues with pip ssl
<teepee> hmm, no complaints here
<teepee> you did activate the venv?
<stealth_> think so, i just a simple `print('version:', sys.version_info)` gives me: "version: sys.version_info(major=3, minor=10, micro=12, releaselevel='final', serial=0)"
<stealth_> my system python version is 3.13.3
<teepee> not sure why it's not picking up the module, it should be in the appimage
<stealth_> maybe its running openscad and not openscad-python
<teepee> well, I need to get some sleep first...
<teepee> good night
<stealth_> my bad, good night.
califax_ has joined #openscad
califax has quit [Ping timeout: 264 seconds]
califax_ is now known as califax
<InPhase> stealth_: What platform?
<InPhase> teepee: I'm suspecting this is a missing libssl-dev. It might be that we have to bundle that with the dump out of the venv. You wouldn't have noticed because you have it. :)
<stealth_> InPhase, linux
<InPhase> stealth_: apt family?
<stealth_> InPhase, ya i think you need to include ssl as well with ./bin/...
<stealth_> arch
<InPhase> stealth_: Before we try anything, can you list your packages and tell me if you have libssl3, and also if you have libssl-dev?
<stealth_> i have openssl installed
<InPhase> Okay, and what about libssl3 and libssl-dev? These are different.
<stealth_> nothing like those, can't even instal it
<InPhase> libssl3 will have something like: /usr/lib/x86_64-linux-gnu/libssl.so.3 While libssl-dev will have something like: /usr/lib/x86_64-linux-gnu/libssl.a
<InPhase> My first guess would be libssl3 is missing, but I see one post online suggesting it might need the -dev.
<InPhase> So perhaps check for arch how to get libssl.so.3
<stealth_> well i have normal python installed on my system and its ssl pip are working fine. even my custom installed python has no issues with pip ssl
<InPhase> Can you check to see where you have this libssl.so.3 file at?
<InPhase> Maybe by running locate libssl.so.3
<stealth_> there is on is /usr/lib/libssl.so.3
<stealth_> there is one in /usr/lib/libssl.so.3
<InPhase> Well that sounds particularly easy to find, doesn't it.
<stealth_> must have a different installer name or maybe openssl installs it.
<InPhase> Check now for libssl.a
<stealth_> lib32-openssl installs it.
<InPhase> I see many suggestions that it needs to be the .a file
<stealth_> nothing found for libssl.a
<stealth_> i am just searching in /
<InPhase> Okay. And can you try to arch install that?
<InPhase> If that changes the behavior, we'll at least know which the missing element was.
<stealth_> install what?
<InPhase> Whatever package gives you libssl.a, for building with libssl.
<stealth_> don't think .a is included, mostly just .so since its compiled already, .as is for before compiling
<stealth_> well 1 of the solution i found is to just copy+paste files directly into virtual env site-packages folder, then i can import it.
<stealth_> its more of a hack vs actual solution.
<stealth_> now pip can't manage/delete it.
<InPhase> stealth_: I do not know why everyone online thinks specifically the .a files are required, but I've seen this in multiple locations now, so I think that is at least one of the issues. I can't be sure if that alone would fix it without a before/after comparison.
<stealth_> InPhase, dono, just a guess but internally pip might use ssl.py/ssl.so for ssl connections, this might be something you guys need to include in .appimage
<stealth_> https://github.com/python/cpython/blob/main/Lib/ssl.py python will find the correct ssl location/library that way.
<stealth_> another ongoing talk in #python is to use "uv" vs "pip" this "A single tool to replace pip, pip-tools, pipx, poetry, pyenv, twine, virtualenv, and more." https://github.com/astral-sh/uv
<stealth_> personally i have moved to using zig for python packaging that includes C, .so, ... it also gives me cross platform right out of the box and doesn't have to touch python setuptools for .so compilation.
<stealth_> zig as translation later is sooooo much better than using C.