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
kintel has joined #openscad
<gbruno> [github] Rotzbua ready_for_review pull request #5063 (fix(python): invalid escape sequences) https://github.com/openscad/openscad/pull/5063
Guest6 has joined #openscad
Guest6 has quit [Client Quit]
LordOfBikes has quit [Ping timeout: 252 seconds]
snaked has joined #openscad
LordOfBikes has joined #openscad
mmu_man has quit [Ping timeout: 256 seconds]
erectus has quit [Remote host closed the connection]
J24k19 has joined #openscad
erectus has joined #openscad
J24k35 has quit [Ping timeout: 250 seconds]
<kintel> guso78 The double rotatePolygon() is a bug. No idea how that happened..
kintel has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kintel has joined #openscad
<gbruno> [github] kintel closed pull request #5063 (fix(python): invalid escape sequences) https://github.com/openscad/openscad/pull/5063
<gbruno> [github] kintel closed issue #5040 (Chore: remove python 2 specific code) https://github.com/openscad/openscad/issues/5040
<gbruno> [github] kintel pushed 2 modifications (fix(python): invalid escape sequences (#5063) Convert regex with escape sequences to raw string to avoid invalid escape sequence.) https://github.com/openscad/openscad/commit/6449751cde1e63f109ac611cdfd2f1a561f8d375
<gbruno> [github] kintel pushed 1 modifications (Remove duplicate rotatePolygon()) https://github.com/openscad/openscad/commit/c2901158f0e615228e49f3a60b88505cbf79413a
<gbruno> [github] kintel opened pull request #5119 (Remove duplicate rotatePolygon()) https://github.com/openscad/openscad/pull/5119
<gbruno> [github] kintel closed pull request #5119 (Remove duplicate rotatePolygon()) https://github.com/openscad/openscad/pull/5119
<gbruno> [github] kintel pushed 1 modifications (Remove duplicate rotatePolygon() (#5119)) https://github.com/openscad/openscad/commit/1057a82e9f79d6ccb4693e69d291c41a812a5108
<gbruno> [github] kintel pushed 1 modifications (Test M1 on CircleCI) https://github.com/openscad/openscad/commit/f4c2bc7f60562bcb6bcb1307c2ab30e17dfae091
<gbruno> [github] kintel pushed 1 modifications (Test M1 on CircleCI) https://github.com/openscad/openscad/commit/fc5297e8492ba2e3bb04f3a6b01330e095db60ab
pca006132 has quit [Remote host closed the connection]
pca006132 has joined #openscad
kintel has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
TheCoffeMaker has quit [Ping timeout: 268 seconds]
TheCoffeMaker has joined #openscad
TheCoffeMaker has quit [Excess Flood]
TheCoffeMaker has joined #openscad
TheCoffeMaker has quit [Excess Flood]
TheCoffeMaker has joined #openscad
mohammad1722 has joined #openscad
guso78k has joined #openscad
<guso78k> kintel, I supposed so. I  could not make out a  "feature" calling "extrudePolygon" twice using some hidden "global" variables even though evaluating the CSG tree appears to have two stages. In any case it was much fun to me when the guys here were kidding about "degenerate #justalittleffold". Was hoping to see a fix like "speeding up
<guso78k> rotateExtrude by 100%" O:3
mtinman has quit [Quit: Leaving.]
mohammad1722 has quit [Ping timeout: 250 seconds]
guso78k has quit [Quit: Client closed]
<Virindi> hmm. is there any way to say is_undef but for a function? like, if function xyz is defined, call it. otherwise do something else
J24k19 has quit [Quit: Client closed]
J24k19 has joined #openscad
guso78k has joined #openscad
TheCoffeMaker has quit [Ping timeout: 268 seconds]
TheCoffeMaker has joined #openscad
TheCoffeMaker has quit [Excess Flood]
guso78k has quit [Quit: Client closed]
mmu_man has joined #openscad
<J24k19> Virindi  is_undef(f(x))?a:f(x);
<Virindi> sure, okay. but then I get WARNING: Ignoring unknown function 'f'
TheCoffeMaker has joined #openscad
<Virindi> can't just have meaningless warnings because then I would miss real warnings :)
TheCoffeMaker has quit [Ping timeout: 256 seconds]
TheCoffeMaker has joined #openscad
TheCoffeMaker has quit [Excess Flood]
TheCoffeMaker has joined #openscad
TheCoffeMaker has quit [Excess Flood]
TheCoffeMaker has joined #openscad
mmu_man has quit [Ping timeout: 256 seconds]
TheCoffeMaker has quit [Ping timeout: 245 seconds]
mmu_man has joined #openscad
TheCoffeMaker has joined #openscad
TheCoffeMaker has quit [Excess Flood]
TheCoffeMaker has joined #openscad
TheCoffeMaker has quit [Ping timeout: 255 seconds]
TheCoffeMaker_ has joined #openscad
J24k19 has quit [Quit: Client closed]
J24k19 has joined #openscad
BeginnerHasAQues has joined #openscad
BeginnerHasAQues has quit [Client Quit]
TheCoffeMaker_ has quit [Ping timeout: 268 seconds]
TheCoffeMaker has joined #openscad
TheCoffeMaker has quit [Excess Flood]
<J24k19> virindy you sure need to have the function you want to use defined
TheCoffeMaker has joined #openscad
<J24k19> Virindi
<J24k19> you also need to define the variables used
TheCoffeMaker has quit [Excess Flood]
<J24k19> echo( is_undef(undef)?true:false;);
<Virindi> huh, that's the whole point. I want to have an optional function
<J24k19> you can't use something if you didn't define it - maybe paste some sample code so i understand what you trying to do
<J24k19> paste!
<othx> paste is https://www.3dcustomizer.net/paste for .scad files, https://bpa.st for text, https://pasteboard.co/ or https://imgur.com/ for images
<Virindi> echo(is_undef(f())? true: false);
<Virindi> what I asked...I want something similar to
<Virindi> except where no warning is generated if f() is not defined
<J24k19> the whole point of a warning is that you do something that can't work
<Virindi> echo(is_undef(f())? true: false);
<Virindi> produces
<Virindi> WARNING: Ignoring unknown function 'f' in file...
<Virindi> yes of course, I am not sure how I am being unclear, I am confused
TheCoffeMaker has joined #openscad
<J24k19> interestingly enough this isn't an error
<Virindi> with a variable, I can have an optional variable. I can say is_undef(x) and if x is never assigned, there is no warning. However, I cannot do the same with a function.
<J24k19> If you write a function in your code that is not existent - this has to cause a warning because you can't do that
<Virindi> I literally want to test if a function is defined or not.
<J24k19> you can use function as literal
<J24k19> i think there is is_function
<Virindi> ...without generating a warning
<Virindi> there is. however, it does not work as you are saying. first f() is evaluated, then the result is passed to is_function
teepee_ has joined #openscad
<Virindi> is_function(f()) throws a warning if f() is not defined.
<J24k19> echo(is_function(x));   but you still need to define x
<Virindi> no.
<Virindi> echo(is_function(f())? true: false);
<Virindi> WARNING: Ignoring unknown function 'f'
<J24k19> In what universe you have a function in your code that is not defined that will not cause a problem
<J24k19> x=function () 1;echo(is_function(x));
<Virindi> for modularity of course. if custom_xyz_function() is defined, compute xyz with that. otherwise use the default one
<Virindi> so somewhere else in the world, if custom_xyz_function() is defined it overrides the behavior for computing xyz
<J24k19> there are other ways to do this - please paste your example and i can show you how this can be done
teepee has quit [Ping timeout: 260 seconds]
teepee_ is now known as teepee
<J24k19> you module has variables defined .. now you can check if these are undef or function and build a conditional or assert them
<Virindi> I was just asking if it was possible to programmatically determine if a function exists, I guess you are saying the answer is 'no'.
<teepee> in release version, no
<Virindi> release? I am using nightly 2024.04.13
<J24k19> undef and non existent are not the same
<Virindi> I know that J24k19!
<Virindi> did you not read my original question
<teepee> then it should be possible with function literals
<teepee> but you must not use f() inside the undef call as that already *calls* the function there
<Virindi> I want some method to determine if a particular function exists, and store that into a boolean, without throwing a warning.
<Virindi> how, then, teepee?
<Virindi> temp = f(); // WARNING
<Virindi> echo(is_function(temp));
<Virindi> and
<Virindi> echo(is_function(f())); // WARNING
<J24k19> you can only evaluate the result of a function - therefor the function need to exist, but you can evaluate a variable that can be a function  but therefor that variable need to exist
<Virindi> just say no, please stop telling me why I don't actually need what I was asking about
<J24k19> because that would not be true
<J24k19> but preventing warnings for bad coding skills is not possible
<Virindi> it's not bad coding if the entire purpose of the code is to check if f() exists
<Virindi> such a thing is in place for variables. is_undef()
<J24k19> maybe you don't understand what functional programming means
<Virindi> if as you say using an undefined thing is "bad coding skills" then why does is_undef() suppress the same warning for variables?
<Virindi> according to your logic, it should not.
<J24k19> it is not like imperative programming
<Virindi> hmm
<teepee> echo(is_function(f())); <--- this first calls f() and then checks if the RETURN value is a function!
<Virindi> so you have to define the function as a variable in the first place
<Virindi> yeah I figured as much there.
<J24k19> a non existent variable is undef but also a=undef;
<J24k19> a non existent function can't compute
<Virindi> you can't assign a variable to an existing function and do this, but you can if you treat it like a variable in the definition. I see
<J24k19> you telling the programm use the function .. so it answers "there is no function with that name"
<Virindi> thanks teepee
TheCoffeMaker has quit [Ping timeout: 268 seconds]
<J24k19> as i told you before you can use literals - guess you haven't understood me
<Virindi> J24k19: if you say, echo(is_undef(foo)); and foo has never been defined, openscad DOES NOT output a warning :P
<Virindi> personally I am very happy it does not because I make extensive use of that
<J24k19> again because foo=undef  and non existent foo  ist both undef.  so foo can be your function (as literal)  but if you calling a function f(x)  you explicitly say "please compute this existent function"
<J24k19> maybe try with is_num(foo)  which will cause a warning if foo is not defined
<J24k19> undefined variables that are used should cause an error not just a warning
<J24k19> but modules work even with cylinder(undef);
<teepee> that's the classical script vs. typed language, which today tends to move towards more typed checks
<teepee> openscad is old enough to have started with that script style, just go on somehow and maybe give a warning
<J24k19> like GPT4 .. you get something but don't expect to be what you want
<teepee> a bit more predictable, but yeah, something like that
<teepee> with things like "stop on first warning" things are moving into the direction of more checks, more help against random errors or typos
<J24k19> i mean i prefer to use a conditional instead of a assert(); that stops everything
<J24k19> like expecting a vec3 but input is vec2 .. just adding a 0 making it a vec3
TheCoffeMaker has joined #openscad
TheCoffeMaker has quit [Excess Flood]
TheCoffeMaker has joined #openscad
<teepee> it often also depends on context, like it might be ok in an application, but considered rude in a library (like a c++ library doing calling exit() to end the whole program)
<J24k19> at least you should throw a warning to let you know that your input being corrected
TheCoffeMaker has quit [Ping timeout: 260 seconds]
<Virindi> I come from the c/c++ world and having actual compile time checking, I just can't handle not having it. It blows my mind that people would rather errors occur at runtime than on the developer's box when they hit compile
<Virindi> I carefully watch for warnings and correct them, in openscad :)
<J24k19> "stop at first warning" doesn't leave you any choice
TheCoffeMaker has joined #openscad
TheCoffeMaker has quit [Read error: Connection reset by peer]
mmu_man has quit [Ping timeout: 268 seconds]
TheCoffeMaker has joined #openscad
mmu_man has joined #openscad
TheCoffeMaker has quit [Ping timeout: 268 seconds]
mmu_man has quit [Ping timeout: 268 seconds]
mmu_man has joined #openscad
TheCoffeMaker has joined #openscad
TheCoffeMaker has quit [Excess Flood]
TheCoffeMaker has joined #openscad
TheCoffeMaker has quit [Ping timeout: 252 seconds]
TheCoffeMaker has joined #openscad
TheCoffeMaker has quit [Excess Flood]
TheCoffeMaker has joined #openscad
TheCoffeMaker has quit [Read error: Connection reset by peer]
TheCoffeMaker has joined #openscad
TheCoffeMaker has quit [Ping timeout: 272 seconds]
TheCoffeMaker has joined #openscad
TheCoffeMaker has quit [Excess Flood]
snaked has quit [Quit: Leaving]
crazy_imp has quit [Ping timeout: 245 seconds]
TheCoffeMaker has joined #openscad
crazy_imp has joined #openscad
R2robot has joined #openscad
<InPhase> Virindi: Did you understand the part about how function literals give the capability if you initially define functions that might or might not be there as function literals?
<InPhase> Virindi: This is the bit of the language intended to give more dynamic and flexible behavior like that.
<InPhase> Virindi: An envisioned workflow for dynamic behavior like that would be passing or omitting a function as a parameter. One could also imagine special variable functions existing or not in different calls. If a standard function is missing from the lexical scope however, this is much more like the case of a C syntax error that would arise and could not be avoided (it requires some fancy SFINAE
<InPhase> shenanigans in C++ to handle that sort of thing dynamically at compile time, and very few languages can actually do that sort of thing).
<InPhase> Except that OpenSCAD does several things that should probably be syntax errors through the warning mechanism, for historical reasons. The warning approach was probably an attempt to be more tolerant and beginner friendly, which it achieves in certain cases and fails at in others.
<Virindi> yeah of course C++ offers better ways to handle module to module interaction :)
<Virindi> in openscad it is always a hack
<Virindi> but yeah it seems that assigning a function to a variable is what I wanted
<Virindi> my partner just asked me if we can implement newton's method in openscad
<Virindi> he wants to draw a catenary curve exactly
<Virindi> talk about causing yourself pain
<InPhase> Virindi: Should be straightforward.
<Virindi> I assume the approach would be just to use recursion as if it were a loop
<InPhase> Yep.
<InPhase> Make sure to make it tail recursion as well, so it optimizes right.
<Virindi> wait. openscad doesn't have hyperbolic trig? ugh no :(
<InPhase> It's pretty formulaic really if you do some sort of d=0 depth counter.
<Virindi> alrighty
<Virindi> openscad should have hyperbolic trig so I don't have to have those functions in there :)
<InPhase> Virindi: function sinh(a) = (exp(a)-exp(-a))/2; function cosh(a) = (exp(a)+exp(-a))/2;
<InPhase> Not exactly a hard implementation. ;)
<Virindi> yeah I know.
<Virindi> how exactly would tail recursion look in openscad anyway? since a function is a single expression. would it be like:
<Virindi> function f(iteration) = (iteration!=0)? ...calculate... : f(x);
<Virindi> er
<Virindi> function f(iteration) = (iteration!=0)? ...calculate... : bottom_level_result;
<Virindi> also is it possible to debug such a thing? as in, can you print inside a function at all? print is a statement, right, so it can't be inserted into an expression?
<Virindi> ah, the opposite
<InPhase> echo fits just fine.
<InPhase> Virindi: Some formulaic thinking demonstrated: https://bpa.st/DTWQ
<Virindi> we already got newton working :)
<InPhase> Also, if you ever want more demos of how to do wilder things with functions, this library is good for some examples: https://github.com/thehans/funcutils
<Virindi> cool
<Virindi> this is just like, draw a wire in an assembly more correctly :)
<InPhase> Things like zip, shuffle, slice, csv parsing...
guso78k has joined #openscad
guso78k has quit [Client Quit]
Guest0 has joined #openscad
<Guest0> hello everyone, I created a model then got a stl file.I want to pint it but it becomes solid
<Guest0> use <MCAD/boxes.scad>
<Guest0> $fa = 1;
<Guest0> $fs = 0.4;
<Guest0> ct_r = 2.05;
<Guest0> ct_h = 2.1;
<Guest0> difference() {
<Guest0>     roundedBox([40, 12, 4], radius = 2, sidesonly = false);
<Guest0>     translate([15, 2.4, 4])
<Guest0>         cylinder(h = ct_h, r = ct_r, center = true);
<Guest0>     translate([15, -2.4, 4])
<Guest0>         cylinder(h = ct_h, r = ct_r, center = true);
<Guest0>     translate([0, 2.4, 4])
<Guest0>         cylinder(h = ct_h, r = ct_r, center = true);
<Guest0>     translate([0, -2.4, 4])
<Guest0>         cylinder(h = ct_h, r = ct_r, center = true);
<Guest0>     translate([-15, 2.4, 4])
<Guest0>         cylinder(h = ct_h, r = ct_r, center = true);
<Guest0>     translate([-15, -2.4, 4])
<Guest0> how can i get what i wanted
<J24k19> Guest10 paste!
<J24k19> paste!
<othx> paste is https://www.3dcustomizer.net/paste for .scad files, https://bpa.st for text, https://pasteboard.co/ or https://imgur.com/ for images
<J24k19> You probably need to difference a rounded box from the first .. but a little smaller .. can't see where your difference ended
<Guest0> oh, I find the question
<Guest0> it's the translate, I made the z 4
<J24k19> yes that is a void inside like to stop the print and putting something in .. also use roundedCube(size, r, sidesonly, center)
califax has quit [Remote host closed the connection]
califax has joined #openscad
Guest0 has quit [Quit: Client closed]
<J24k19> also you can loop this   for(posX=[15,0,-15], posY=[2.4,-2.4])translate([posX,posY])cylinder(ct_h,r=ct_r,center=true);
mmu_man has quit [Ping timeout: 264 seconds]
Guest0 has joined #openscad
califax has quit [Remote host closed the connection]
mmu_man has joined #openscad
Guest0 has quit [Quit: Client closed]
califax has joined #openscad
J24k75 has joined #openscad
J24k19 has quit [Ping timeout: 250 seconds]
califax has quit [Remote host closed the connection]
oieieio has joined #openscad
mohammad1722 has joined #openscad
califax has joined #openscad
califax has quit [Remote host closed the connection]
califax has joined #openscad
<gbruno> [github] petaflot closed issue #5118 (simple helper (add one button) to reset time) https://github.com/openscad/openscad/issues/5118
<gbruno> [github] petaflot opened issue #5120 (slicer integration and parameters) https://github.com/openscad/openscad/issues/5120
mohammad1722 has quit [Ping timeout: 250 seconds]
cart_ has joined #openscad
califax has quit [Remote host closed the connection]
oieieio has quit [Quit: Client closed]
califax has joined #openscad
califax has quit [Remote host closed the connection]
califax has joined #openscad
R2robot has quit [Ping timeout: 245 seconds]
R2robot has joined #openscad
oieieio has joined #openscad
cart_ has quit [Ping timeout: 264 seconds]
mmu_man has quit [Ping timeout: 246 seconds]
MatrixBot12 has quit [Ping timeout: 255 seconds]
mmu_man has joined #openscad
Guest11 has joined #openscad
Guest11 has quit [Client Quit]
MatrixBot12 has joined #openscad
Guest76 has joined #openscad
<teepee> who runs MatrixBot12 ?
<teepee> and is it doing what the name says
Guest76 has quit [Quit: Client closed]
<Scopeuk> It does appear to be a bot (instance responses), it doesn't appear to have any useful info or help commands
linext has quit [Quit: Leaving]
teepee_ has joined #openscad
teepee has quit [Ping timeout: 260 seconds]
teepee_ is now known as teepee
linext has joined #openscad
teepee has quit [Remote host closed the connection]
teepee has joined #openscad
snaked has joined #openscad
mmu_man has quit [Ping timeout: 268 seconds]