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]
<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
<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.
<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; }
<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_>
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.