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
califax has quit [Remote host closed the connection]
califax has joined #openscad
teepee has quit [Quit: bye...]
teepee has joined #openscad
ur5us has joined #openscad
redlizard_ has quit [Ping timeout: 260 seconds]
qeed_ has quit [Ping timeout: 252 seconds]
J1A8443 has joined #openscad
J1A844 has quit [Ping timeout: 252 seconds]
redlizard_ has joined #openscad
qeed has joined #openscad
peepsalot has quit [Quit: Connection reset by peep]
fling has quit [Ping timeout: 258 seconds]
fling has joined #openscad
ur5us has quit [Ping timeout: 246 seconds]
LordOfBikes has quit [Ping timeout: 264 seconds]
LordOfBikes has joined #openscad
<JordanBrown[m]> Oh, and as far as it ending up bad in the console...
<JordanBrown[m]> LOG(message_group::None, Location::NONE, "", "Loaded design '%1$s'.", editor->filepath.toLocal8Bit().constData());
<JordanBrown[m]> looks similarly ominous.
<InPhase> Yeah, worth rgrep'ing for each instance of that.
<JordanBrown[m]> I think it needs to be a rule that LOG() data is in UTF-8. If it ends up going to the tty, as for a CLI invocation, then some later step may need to take care of re-encoding it.
<JordanBrown[m]> Here's the diff for that message (and a related error message): https://bpa.st/EJHA
<JordanBrown[m]> There are a fair number more of those.
<InPhase> JordanBrown[m]: %1$s can receive a std::string. The .c_str() is not needed.
<JordanBrown[m]> Sounds good. Didn't know what kind of printf was under the covers.
<InPhase> Some boost library magic. But I gave that a test last week writing the exception logging, and it worked. :)
<JordanBrown[m]> And so it seems to.
<JordanBrown[m]> Tidbit: QString is always Unicode. Corollary: if you have a QString, keep it a QString, don't change it to something else except at boundaries.
<InPhase> Badly stored utf-16 unicode, but yes, unicode.
<JordanBrown[m]> Implementation detail invisible to us.
<InPhase> My preferred strategy is to avoid QString entirely unless interfacing with the gui.
<InPhase> But, in a group project, I go with the group standard.
<JordanBrown[m]> That was the problem with the Launch screen... the perfectly good QString file names were getting turned into std::string and then back into QString, and got corrupted along the way.
<InPhase> We clearly have Qt dependencies smashed all throughout this program.
<InPhase> Well I always convert out to utf-8, the one true standard.
<JordanBrown[m]> But alas std::string does not promise UTF-8.
<InPhase> Well, you just can't feed it junk food if you want it to be healthy.
<JordanBrown[m]> Not a small project, but it might be worth building a subclass that does promise UTF-8.
<JordanBrown[m]> Right. And you don't know that somebody has fed it junk food until it has gastrointestinal problems all over the carpet.
<JordanBrown[m]> Absent a UTF-8 subclass of std::string, maybe the rule should be that all std::string must be UTF-8 unless specifically commented otherwise.
<InPhase> I think that should be an all-the-time rule in modern code. :)
<JordanBrown[m]> I'm pretty sure we have real customers who are still using something non-Unicode.
<JordanBrown[m]> Alas, the file system is (at least historically, don't know about modern Linux) an encoding disaster area. The file system doesn't have a specified encoding; it uses whatever the user gives it. Two files in the same directory could be in different encodings.
<JordanBrown[m]> It seems really surprising that C++ doesn't have a standard string class that promises UTF-8.
<InPhase> Well, you can't really promise utf-8.
<InPhase> You can only promise that a particular byte sequence has no invalid utf-8 data.
<JordanBrown[m]> You can reject invalid sequences. And you can say "don't put non-UTF-8 data in here, dummy!"
<JordanBrown[m]> I wouldn't want to try to figure out the fraction (and of course it depends on patterns in real words) but my bet is that most 8859-1 sequences are not valid UTF-8 sequences.
<JordanBrown[m]> Of course, will Qt tell you easily what locale it's going to use? Not that I can tell so far...
<Friithian> where's my utf-32…
fling has quit [Ping timeout: 258 seconds]
fling has joined #openscad
<dalias> jordanbrown[m], "Two files in the same directory could be in different encodings." is exaggerating a problem that's not really there
<JordanBrown[m]> Depends on whether you want your program to work most of the time, or all of the time.
<dalias> no, it's about making up requirements or goals to support garbage
<dalias> it's more like "one file in a directory can consist of garbage that's not a valid multibyte character string"
<JordanBrown[m]> A more realistic scenario is that there's a file in the directory that is not in the same encoding as the user's locale's encoding.
<dalias> yes, and there's no need for most user-facing applications to support accessing that
<dalias> jordanbrown[m], that might have been a "realistic" situation 15 years ago
<dalias> now the only way it arises is if the user is intentionally doing broken things
<JordanBrown[m]> Well, like I said, I'm pretty sure we have real-world customers using non-UTF-8 locales.
<JordanBrown[m]> (At work, that is.)
<dalias> has any distro shipped non-utf-8 in the past decade?
<JordanBrown[m]> Solaris does.
<dalias> like yes, you can manually change the locale to a legacy one
<dalias> but afaik linux distros and bsds don't even ask you if you want to do that in the install process. you just pick your language and utf-8 is implied
<dalias> in any case, once you've picked the locale/encoding you're going to use, filenames in that encoding are all that normal apps need to care about. if you make garbage with encoding errors, that's pebkac gigo
<JordanBrown[m]> Unless you have multiple users with different selections.
<JordanBrown[m]> Don't get me wrong, I would be delighted to say "UTF-8 only, accept no substitutes".
<JordanBrown[m]> (It does look like Solaris defaults to UTF-8. I checked root on my test system, where I certainly haven't set anything custom, and it's UTF-8. I don't *think* it's an install-time question, but it has been a very long time since I've done a from-zero install.)
<dalias> now we're talking about the intersection of 3 niche cases
<JordanBrown[m]> My life is all about niche cases. The non-niche cases all just work :-)
<dalias> well in this case they're ones where folks actively chose to do wrong things
<JordanBrown[m]> Like I said, real customers. One of our subsystems rejects non-UTF-8 strings, and I remember a bug report where somebody tried to give it their non-UTF-8 file path.
<dalias> now i forgot what one of them was, but two are (1) using legacy encodings, (2) working in shared directories rather than doing something like version control where each of them could pull and push with the data converted to their preferred encoding, and (3) ... ?
<JordanBrown[m]> But I am thinking of Sun/Oracle customers, where a decade really isn't a very long time.
<JordanBrown[m]> Anyhow, my preference is to implement for anything that is legal and possible, whether or not it's reasonable. That way I don't get into trouble when somebody's idea of reasonable disagrees with mine.
<dalias> well i don't think there's anything reasonable you can do when the encoding isn't known beyond displaying invalid sequences as abstract bytes and doing it non-destructively
<JordanBrown[m]> Yes. And unfortunately that describes the file system. The best that you can do is to try to interpret it using the user's locale, and that's not guaranteed to work.
<dalias> btw re: the question about latin1 (or any latinN) appearing as valid utf-8, that basically can't happen for any actually meaningful-to-humans character sequences
<JordanBrown[m]> That's about what I figured, but I wasn't willing to say "can't happen".
<dalias> btw emacs does a great job of this. if you force it to treat everything as utf-8, and you open a file with non-utf-8 content, it will show it as hex or octal escapes, and preserve that non-destructively even if you save
<JordanBrown[m]> And note, the reason that this is coming up is that a relatively modern stack of software was screwing up the encoding.
ali1234 has quit [Remote host closed the connection]
ali1234 has joined #openscad
<JordanBrown[m]> Cool. Qt is defaulting to windows-1252.
<JordanBrown[m]> Should you ever want to know, the incantation is QTextCodec::codecForLocale()->name().constData()
<JordanBrown[m]> For some reason it returns the name as a QByteArray instead of a QString.
<dalias> where is it getting that default?
<JordanBrown[m]> Got me.
<dalias> from windows locale config? or just assuming it itself?
<JordanBrown[m]> I just retrieved it and printed it.
<dalias> what happens if you've followed the suggestion in my link to setlocale as utf8 variant of system
<JordanBrown[m]> Don't know. Right now I'm trying to stay inside the Qt universe.
<dalias> well qt might be doing the right thing if the setlocale() locale also is windows-1252...
<JordanBrown[m]> I think we want to avoid touching "the user's locale", except at perimeters.
<JordanBrown[m]> If we *change* "the user's locale", we risk breaking some user.
<JordanBrown[m]> If we translate data to "the user's locale", it may be a lossy translation.
<JordanBrown[m]> We should take data (which might only be CLI input) from the user's locale and translate it into Unicode, and when we write to the console we should translate that to the user's locale.
<JordanBrown[m]> When we need to touch a file using non-Qt mechanisms, we should use QFile's encode mechanism to encode into the file system encoding.
<JordanBrown[m]> But, better would be to use Qt file access mechanisms throughout.
<JordanBrown[m]> Clarification: when I say QFile's encoding mechanism, I mean for file names.
<JordanBrown[m]> For instance, use QFileInfo instead of stat().
fling has quit [Ping timeout: 258 seconds]
aiyion has quit [Ping timeout: 258 seconds]
fling has joined #openscad
aiyion has joined #openscad
<JordanBrown[m]> I think we can assert that all files are UTF-8. Any thoughts on that subject?
<JordanBrown[m]> (And there I mean their *contents*.)
RichardPotthoff has quit [Read error: Connection reset by peer]
RichardPotthoff has joined #openscad
J1A8443 has quit [Quit: Client closed]
J1A8443 has joined #openscad
ur5us has joined #openscad
<JordanBrown[m]> I replaced all but one of the {from|to}Local8Bit calls. Most of them translated straightforwardly into Qt constructs.
<JordanBrown[m]> The one that I haven't replaced is the one that translates from argv[]. I'm trying to figure out why MSYS2 gets it wrong. Cygwin gets it right.
<JordanBrown[m]> But it's past bedtime.
<JordanBrown[m]> I will self-review, test, and post a diff tomorrow.
hrberg has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
hrberg has joined #openscad
ur5us has quit [Ping timeout: 244 seconds]
aiyion has quit [Ping timeout: 258 seconds]
aiyion has joined #openscad
peepsalot has joined #openscad
noonien has quit [Quit: The Lounge - https://thelounge.chat]
J1A844315 has joined #openscad
J1A84431564 has joined #openscad
noonien has joined #openscad
J1A8443 has quit [Ping timeout: 252 seconds]
J1A844315 has quit [Ping timeout: 252 seconds]
J1A84431564 is now known as J1A84
Guest329 has joined #openscad
Guest329 has quit [Client Quit]
califax has quit [Remote host closed the connection]
teepee has quit [Read error: Connection reset by peer]
califax has joined #openscad
teepee has joined #openscad
ur5us has joined #openscad
fling has quit [Remote host closed the connection]
califax has quit [Read error: Connection reset by peer]
califax has joined #openscad
fling has joined #openscad
ur5us has quit [Remote host closed the connection]
ur5us has joined #openscad
fling has quit [Remote host closed the connection]
fling has joined #openscad
Guest1 has joined #openscad
Guest1 has quit [Client Quit]
ur5us has quit [Ping timeout: 244 seconds]
califax has quit [Remote host closed the connection]
califax has joined #openscad
califax has quit [Ping timeout: 258 seconds]
califax has joined #openscad
snaked has quit [Quit: Leaving]
fling has quit [Remote host closed the connection]
fling has joined #openscad
tachoknight has joined #openscad
p3ck has joined #openscad
p3ck has quit [Ping timeout: 244 seconds]
rawgreaze_ has joined #openscad
rawgreaze has quit [Ping timeout: 244 seconds]
rawgreaze_ is now known as rawgreaze
teepee has quit [Ping timeout: 258 seconds]
teepee has joined #openscad
califax has quit [Ping timeout: 258 seconds]
califax has joined #openscad
califax has quit [Remote host closed the connection]
califax has joined #openscad
califax has quit [Ping timeout: 258 seconds]
J1A84 has quit [Quit: Client closed]
J1A84 has joined #openscad
GNUmoon has quit [Read error: Connection reset by peer]
TheAssassin has quit [Remote host closed the connection]
GNUmoon2 has joined #openscad
TheAssassin has joined #openscad
califax has joined #openscad
oscadDummy has joined #openscad
<oscadDummy> someone out there?
<J1A84> oscadDummy  how can we help?
<othx> J1A84 linked to YouTube video "Shakespears Sister - Hello (Turn Your Radio On) (Official Video)" => 1 IRC mentions
<gbruno> [github] UserCain opened issue #4361 (Zoom with mouse wheel buggy) https://github.com/openscad/openscad/issues/4361
<teepee> uh, day of the classic music? :)
<oscadDummy> how to access children of children ?
<J1A84> your module need a variable for accessing it
<J1A84> else all children become one child on the next level (union)
<oscadDummy> so x = children(); for(i=[0:$children]){ x[i].children ??
<oscadDummy> somthing like that ?
<J1A84> children($idx) references the child object
<J1A84> so if your module has five children .. children(4) will access one of them .. if this child also has children you need to build a variable in the module so you can call the module  to access the children().
<J1A84> maybe you like to tell what you try to accomplish
<oscadDummy> module Teilchen(c,p){
<oscadDummy>    color(c)translate(p)sphere(d=2,$fn=20);
<oscadDummy> }
<oscadDummy>    posx = [0,0,0];
<oscadDummy>    posy = [0,10,-6];
<oscadDummy>    posz = [0,15,-5];
<oscadDummy>    for(i = [0:2]){
<oscadDummy>       co = "blue";
<oscadDummy>       pos=[posx[i],posy[i],posz[i]];
<oscadDummy>       Teilchen(co,pos);
<oscadDummy>    }
<J1A84> !paste
<J1A84> paste!
<oscadDummy> sorry https://bpa.st/TDHA
<J1A84> so sphere would be the only children() of  Teilchen()
<oscadDummy> but i got https://bpa.st/ZSSQ
<J1A84> sure  you call it in the for loop 3×
<oscadDummy> Yes
<oscadDummy> But then there should be 3 childern right?
<J1A84> these are not children
<J1A84> it is the same object
<J1A84> and there will be a union when putting the loop into a module
<oscadDummy> ok  I tried https://bpa.st/W2VQ
<J1A84> getting 3 blue spheres .. so what is the problem?
<J1A84> the pos variables are bit strange and repeating so you may have two spheres in the same place
<oscadDummy> https://bpa.st/O4IQ
<J1A84> oh  no i merged too much of your codes together Ü
<oscadDummy>  I try to generate a bunch of spheres and want to move them for an animation
<InPhase> oscadDummy: Can you explain in words the goal?
<InPhase> Okay, so mv is the moving module, and sphere should be given to it?
<J1A84> just make one loop and  move the spheres by the loop variable and $t
<oscadDummy> there should be a fixed move and a random move for each particle
<oscadDummy> so fixed+random for each
<InPhase> oscadDummy: Do you want the number of spheres to be parameterized?
<J1A84> when you say random .. you need to create a random coordinate set  so you can move towards this point with $t
<InPhase> oscadDummy: Or are you looking for something fixed like, "Here are 4 spheres I declare."
<oscadDummy> Background: I like to visualize a particle stream lets say from left to right. This should be overlayed with vectors
<oscadDummy> or better one vector
<J1A84> here  3 spheres move towards their endpoints
<oscadDummy> ok it seems that there is not the possibility to generate an object which has N spheres as children. Correct?
<J1A84> there is no need you create a loop
<J1A84> children are obejects like "line of code"
<oscadDummy> Sorry but I want to reuse the a stream object later
<J1A84> you can make a loop  i=[0:len(pos)-1]   and then random create  n  pos vectors ..
<oscadDummy> Ähhhm didn't you told me that this will generate a union?
<J1A84> you can put this loop in a module and address each sphere via the i index   .. but you can't call that module via a children(index); to access the objects from the loop inside
<oscadDummy> "and there will be a union when putting the loop into a module"
<J1A84> yes for the renderer this will be one object ..
<J1A84> that is why your module  Move(var=0)  needs a variable to access the  loop objects if you need to adress them
<oscadDummy> Ah, I think the penny dropped
<oscadDummy> so module my(p){ p.childeren(i) ?
<J1A84> this is not a notation you can use for objects
<J1A84> So  you want an animation with  n spheres  and the should move ?
<J1A84> i gave you code that does this - so please explain what you are missing
<J1A84>  module My(p) if i==p sphere();   would be some code that let you access one sphere from the loop
<J1A84> for(i=[0:5])if(i==p)sphere();
<J1A84> but it would not make much sense  as  you need a loop outside that could also directly access the objects without picking them from the module
<InPhase> oscadDummy: Will these spheres ever differ from each other aside from position? Or is it the same sized sphere?
<J1A84> maybe there is confusion about what a children is
<oscadDummy> First of all thanks for your patiance ! If I want to have 2 Streams one in blue one in red on e moves along the X-axis the other along the y-axis
<InPhase> oscadDummy: One possible morph of your code: https://bpa.st/3JGQ
<J1A84>  btw ..  we should not change the Heading in wiki as the cheatcheet links are now broken for children
<InPhase> oscadDummy: An alternate morphing of your code: https://bpa.st/TIIQ
<InPhase> oscadDummy: What sort of approach depends on what you're really trying to do.
<oscadDummy> What I really want is to have modules which create  objects which have children of the same type which I can access individually
<InPhase> oscadDummy: Yes, object creation is an active area of development planning, but you might have to wait a year. :)
<J1A84> you just create one loop for all  and  half of them have endpoints on x the other on y  ..  so the array of positions will determine where they go and what color they get
<InPhase> oscadDummy: For now your choices are utilizing syntactic children, or using parameter passing.
<InPhase> oscadDummy: But parameters currently cannot contain geometry, they can only instruct how to create it.
<oscadDummy> In Phase: thanks for your example but if you want to have 100 objects it is a lot to typing
<InPhase> oscadDummy: Say you had 100 objects, how would they differ?
<J1A84> just create  arrays with loops
<InPhase> oscadDummy: Explaining that better will help me show the solution strategy.
<oscadDummy> btw how to color the names in this chat
<oscadDummy> ?
<J1A84> if you use webchat .. it is random
<InPhase> It depends on what client you're using. Some comments might appear highlighted when your nick is used to address you.
<InPhase> oscadDummy: Like this.
<J1A84> i have blue colors for us three at the moment
<oscadDummy> Ok at a some time in the simulation some of the particles should change their  color
<InPhase> You are all light grey, just the way I like it.
<InPhase> oscadDummy: So color as a function of $t?
<InPhase> oscadDummy: Do they obey the same sort of motion?
<J1A84> color is just a vector .. so you can define start and end and move over $t
<oscadDummy> yes using a function x() = y*$t or similar
<J1A84> color([1,.5,.3]*$t)sphere(10);
<oscadDummy> InPhase: not there should be a liniar translation + a random move in 3D
<oscadDummy> oops linear
<J1A84> linear is one component of the translate vector and you add the random component
<oscadDummy> yes for each sphere= paricle
<oscadDummy> oops particle
<J1A84> so you create a rands(); array for those movements
<oscadDummy> why the hack i Have to create an huge array an con not use if(x() > a && x() < b)
<oscadDummy> or call rands instead at each step
<J1A84> for (i=[0:50]) translate([100*$t,0,0]+rands(-10,10,3)*$t)sphere(2);
<J1A84> scad has no variables .. these are all constants
<oscadDummy> that why i use functions
<J1A84> oh should be rands(-10,10,3,i)  you need i as seed .. else they jump arround
<oscadDummy> they should jump arround
<J1A84> this would be spontanious movement  that is not interpolated ..  so  frame 1 here frame 2 there
<InPhase> oscadDummy: https://bpa.st/IHCQ
<InPhase> oscadDummy: Please note that OpenSCAD does not store state from frame to frame. If you were thinking of using this to use a timestep calculation, it is the wrong starting tool.
<oscadDummy> the random part is not that much
<oscadDummy> compared with the linear move
<J1A84> yes that require random  points to move from .. to the next ..  can be done recuresivly
<J1A84> so you need to switch the  random vector all  20 frames or something like that
<InPhase> Brownian motion would be very challenging to simulate. Although it is possible, you will need to calculate all the timesteps up to the present at each frame.
<J1A84> just create one recursive particle that moves random  ..   that particle is then looped and translated linear
<InPhase> oscadDummy: You might be happier simulating the motion externally, saving the results into some text vector output, and then importing that into OpenSCAD as text if you want to use OpenSCAD as a display method.
<InPhase> oscadDummy: Although there are other tools not OpenSCAD that can work for displaying particle motion. Python with a simple Qt image window with pyside might be more desireable, for example.
<J1A84> the recursion would create a new random vector every n frames and move toward that
<oscadDummy> no: lets reduce this to one dimension x : x = f(t); f(t) = $t*dist + dist/10*rands(-1,1,1)[0]
<oscadDummy> InPhase: At a result I need an animated Gif which I can include in an powerpoint presentation
<oscadDummy> Sorry but powerpoint is an external requirement
<J1A84> for ([0:50]) translate([100,0,0]*$t+rands(-3,3,3))sphere(1);
<J1A84> please try this and tell me what need to be changed
<J1A84> to help you we need to understand how your result should look like
<InPhase> Well what OpenSCAD will make for you is a series of pngs. But you'll find the brownian motion simulation more difficult than in an imperative language with state updates. I could make it happen, because I'm used to making OpenSCAD do things it's not good at. But you might suffer less if you just run a simulation in Python, make a bunch of images, and either save them out as images and merge them, or
<InPhase> use something like the cv2 video writer.
<InPhase> oscadDummy: So as an OpenSCAD advocate, my recommendation is that if this is something you really need to work for your work, don't use OpenSCAD unless you have some reason not yet shared for using OpenSCAD. There are easier tools for this problem.
<J1A84> processing may also work .. at least the framerate is better than oSCAD
<oscadDummy> J1A84 : This moving particles are ony  a part of the game. So using n tools requier n times basic setup etc.
<oscadDummy> about your question about what needs to be changed. 1.) a bigger number particles 2.) an if branch for some time periode to change the color and size of one ore more particles
<J1A84> just add a bigger number and  a color ×$t   .. this is not a problem
<J1A84> does the particles behave as you want?
<oscadDummy> more or less
<oscadDummy> but that are details. I think I have made some wrong assumptions about openscad. I thought that a module creates an object where the objects which are created inside are accessable. Also i thought that there is a possibility to access the childern of a children like in c++ obj.subobj.subsubobj ..
<J1A84> for (i=[0:500]) translate([i+200*$t,0,0]+rands(-30,30,3))color([.5,.5,0]*$t+[1,1,1]*.5)sphere(1);
<J1A84> what now?
<J1A84> you can do  that .. but  SCAD is functional not like C++
<oscadDummy> Any way thanks for your patiance and help! I do not know if you are involved in the development of openscad but if so it would make the use much easier  if it would be possible to create objects which allow to have a bigger number of  childern which can be transformed by operator modules later-
<oscadDummy> I meand inside a loop
<oscadDummy> the creation
<J1A84> i understand why you say this .. but  you are just not used to the language ..   this is like .. "  oh Chinese would be so much better if i could use english"
<J1A84> and sure it is frustrating because your knowledge of programming just doesn't work here
<oscadDummy> *lol*
<J1A84> but if you know more about you would wonder how powerfull openSCAD is ..  if you like look at the examples from advent
<J1A84> adventcalender!
<J1A84> adventcalendar!
<J1A84> calendar!
<J1A84> pff
<oscadDummy> ok but as far as I can see the reason why this do not work ist that objects created insider of a for loop are put in a group.
<J1A84> no
<J1A84> you could use function literal to move inside the module to change the behavior  of  the  spheres
<J1A84> as i said you just need to build your module so you can access what you want
<oscadDummy> ????
<oscadDummy> sorry now im totally out of the path
<oscadDummy> can you give a simple example ?
<J1A84> But you don't want to learn a new programming language  - so just use what you know  as Inphase said - there is no need to use oSCAD
<J1A84> You need to understand that every variable you set can not be changed when the program run but for each $t you can define what it should be
<oscadDummy> I want to understand this language
<J1A84> also for each scope a new instance with a new variable (with the same name) can be created
<oscadDummy> but the selector example is at least as ever function in other languages
<oscadDummy> every functin
<oscadDummy> oops every function
<J1A84> if you go through the calendar designs you will see very sophisticated use of openSCAD .. or use the tutorial to learn the basics
teepee has quit [Ping timeout: 258 seconds]
<J1A84> or here https://github.com/thehans/funcutils/blob/master/string.scad   nice examples to change string data
<oscadDummy> ok, thanks for now. I'll play arround but I think the concept of this language should be a subject of redsign.
<oscadDummy> let is obsolet
<J1A84> if you know Lisp or haskell you would understand this more
<oscadDummy> I have played with lisp 25 years ago and didn't like it
<oscadDummy> ;-)
<J1A84> but for every  C++ programmer  it is a real challenge to change the mindset and wrap your head around this way
<J1A84> it is just a totaly different way to do things
<oscadDummy> may be. but it isn't intuitive
<J1A84> no programming is .. that is why you have to learn it
<J1A84> and if you understand how it works it becomes intuition
<oscadDummy> I started with 6500 assembler
TheAssass1n has joined #openscad
<J1A84> for yes from your standpoint it is not  Ü
<J1A84> so if you want to learn it .. just use it - but if you don't liked Lisp  .. this doesn't look good
TheAssassin has quit [Remote host closed the connection]
<J1A84> simple things like i+=1  are just not possible  and need recursion
<oscadDummy> and in the meantime i have programmed in several languages like APL Tk Forth Postscript vbs and other more or less wired languages ;-) Some of them had nice concepts otheres don't
<J1A84> functional and declarative
<oscadDummy> this is the reason why i don't like it. It makes programming more complicated and results in much more code
<J1A84> you would wonder  ..  it is much more powerful
teepee has joined #openscad
<J1A84> but if an imperative programmer  uses scad  it result in much more code  and i often see examples of 3 pages code that i can do in 10 lines
<oscadDummy> If I have to user recursion for incrementing a simple scalar what is powerfull in this?
<J1A84> you are just not used to it
<J1A84> if you want to learn scad  you need to unlearn what you know
<oscadDummy> you can do the sive of Eratosthenes in APL in one line but it is unreadable ;-)
<J1A84> because it will always lead you the wrong way
<oscadDummy> That may be but if it is so a good totorial would be helpfull
<J1A84> the are  .. have you read the tutorial?
<J1A84> tutorial!
<othx> tutorial is The OpenSCAD tutorial is a great place to learn how to create designs in OpenSCAD, and can be found at: https://en.wikibooks.org/wiki/OpenSCAD_Tutorial
<J1A84> and as i said check out the  adventcalendar  - if you understand what happening there you are a big step further  - but took me a while to understand how that works
<oscadDummy> What I have seen so far are snipets which are not explaining the concept which is underlying
<J1A84> i assume the newer programming languages were developed to make programming easier so you don't have to build that strange mindset
<J1A84> here https://files.openscad.org/advent-calendar-2019/18.scad   an examples of particles in a light cone
<J1A84> and all the magic is in the loop on line 36
<oscadDummy> Looks nice
<InPhase> Oh right. I forgot that would be a good example of particle dynamics in OpenSCAD, at least in limited form.
<InPhase> oscadDummy: If you understand how it works, you will see that it is cheating. There are no state updates.
<InPhase> But this is of course what is necessary in a fully declarative language.
<oscadDummy> One last remarke before  I have to leave. It would be nice if there would be not only examples like do this and that, but more what is the concept behind. I.e. in chapter 6 of the tutorial there are some examples of variable use. But at no place where the scope or the lifetime of the variable is mentioned, neither that they are not really
<oscadDummy> variables. From my point of view a software may be the hottest and efficent thing as long as it is hard to understand how it works it is worthless. I really appreaciate that people put a lot of work in this programm. Also the tutorial is not bad at all, but the set of people which are familar with lisp is very limited. So it could be a good idea to
<oscadDummy> take consider this and add a part to the turorial where the paradigma is explained.   Again thanks for your time and patiance!
<InPhase> oscadDummy: Those are in the manual. :)
<InPhase> We've separated it out for different audiences.
<InPhase> Highly experienced programmers will get more out of the manual.
<oscadDummy> InPhase: but would a version for dummys like me not more efficient in the tutorial ?
<InPhase> oscadDummy: It sounds to me like you have far more programming experience than the target audience of the tutorial. (I didn't write it, but I was there specifying the content, structure, and audience target.)
<J1A84> oscadDummy you are obviously highly experienced ..
<J1A84> so your nick is misleading Ü
<InPhase> oscadDummy: We have a ton of users who make successful usage of the language with no other programming background or very little. You're in the other camp of coming with some expectations which clash. :)
<oscadDummy> The more I know the more I know what I don't know
<InPhase> oscadDummy: Which is fair! I had some expectations mismatch when I started too. But for that, the manual fixes it up.
<J1A84> probably easier to do scad with no knowledge of contradictory languages
<oscadDummy> may be
<oscadDummy> The manual stated the "variables" are more like constants. Ok but if I use a for loop I have a real variable, because it chages its value at every step
<oscadDummy> and inside this loop i can use functions to get depending values.
<J1A84> no you create new instances
<J1A84> there exists a cube with i=0  .. and another with i=1 at the same time
<oscadDummy> so for every iteration i have an instance of that variable during the whole runtime of the script?
<oscadDummy> for(i=[0:9]{for(j=[0:9]){... there are 100 instances of j for the whole script?
<J1A84> it even get worse with recursions where you can  call the function with i=i+1
<oscadDummy> and what is the advantage of this?
<J1A84> yes you have 100 objects .. each with its own fix values  calculated and created
<J1A84> these scripts have no "runtime" they have a result
<J1A84> this is not like a program where you have input and output while it is running
<oscadDummy> ok the result is the picture
<oscadDummy> or scene
<oscadDummy> what ever
<J1A84> you start it  and it will give you results  .. but while it is running you can't change it
<oscadDummy> but if you use animation you will haver n results right?
<J1A84> animations are just  different start variables ($t) that automatically count up
<J1A84> and refresh the screen between ..  it is like alt+arrow
<oscadDummy> ok so there is no "history"
<J1A84> there is a cache for performance  (that you can flush)
<oscadDummy> every object is recalculated for every time step
<J1A84> yes if it is changed
<J1A84> when the animation run through once .. it normally speed up as now it is cached
<InPhase> The cache is there as an optimization, and is one that's made possible by the declarative nature of the language.
<oscadDummy> History in the meaning that I do not have a set of object which already preprocessed and only the attributes are changed at each time step
<InPhase> But a large part of the declarative nature's benefits are simply the organizational one, in which there is no mutable state to gain awareness of at the call of any module or function.
<oscadDummy> oops  I do  not hav = I have
<InPhase> Yet if you need to do state updates in calculations, you can still do this in a fashion by recursion, or by the C-style for loop syntactic sugar which is really just a tail recursion reformatted.
<J1A84> you can render()  objects  but that has to do with geometry and the preview
<oscadDummy> my understanding of recursion differs much from a loop!
<oscadDummy> ;-)
<InPhase> Tail recursion is just iteration with defined state across the boundaries.
<InPhase> oscadDummy: Here is "happy_grass.scad", with View, Animate, FPS: 30, Steps: 1500. https://bpa.st/ZCTQ What seems like it should be really hard without iteration and mutable state becomes really straightforward when you flip your brain around to the other mindset.
<J1A84> wheeee .. Ü
<InPhase> :)
<InPhase> J1A84: I made that one just because it makes me smile to watch it. :)
<J1A84> not even it uses hulls ..  just  plain blocks of happiness
<InPhase> And... it was on purpose that the one most out of synch is closest to the default camera position.
<oscadDummy> Really nice animation!
<oscadDummy> But where is the recusion ?
<InPhase> Link calls Link.
<oscadDummy> ok
<oscadDummy> got it
<linext> i finally got the openscad web assembly filesystem figured out
<InPhase> I could have done MakeChain by recursion also, iteratively, but I preferred to separate that out as a comprehension.
<J1A84> line 28 .. oh
<linext> if you want to try it, upload an SVG file from you computer... one is provided on the page as a sample
<linext> what this means is that import() will work and include() will work
<InPhase> linext: Nice progress. :)
<linext> the user just needs to specify the files using a FilePicker, the files stay on the client
<InPhase> linext: That makes yours officially much better than ThingiVerse's already.
<InPhase> linext: That, and not being the 2015.03 version...
<oscadDummy> in some cases recursion is definedly the better ( smarter) solution!
<linext> next i'm going to try uploading some local fonts and see if i openscad webassembly will use them
<InPhase> linext: The 50mm by 8mm code view window might be just a little bit too small.
<J1A84> inPhase you can drag it bigger
<linext> yea, it's just for troubleshooting
<InPhase> Oh. So you can.
<InPhase> oscadDummy: There are undoubtedly cases where it's not great. One case where it's not great, is physics simulation. :)
<J1A84> but why is that big ♫ there  .. and  i don't have any execute button
<oscadDummy> Ok guys, my whive threatens to beat me if I do not quit right now ;-=
<InPhase> oscadDummy: But that's not really the target use case for the language. It turns out the declarative approach makes modeling a lot cleaner though, so we have a consensus to keep it as such.
<InPhase> oscadDummy: Okay, later. :)
<J1A84> obey the force Ü
<oscadDummy> Again thanks a lot! have a nice week end!
oscadDummy has left #openscad [#openscad]
SamantazFox has quit [Remote host closed the connection]
SamantazFox has joined #openscad
<JordanBrown[m]> InPhase: Happy grass cool. I'm just amazed that I'm getting animation that is as smooth as it is. I'm getting 6fps, and I don't have a very high-powered computer.
<InPhase> JordanBrown[m]: Yeah, I can get just slightly over 30fps with it. It really looks like something that should be slower to animate, but it's not. :)
<InPhase> It's basically video-rate for me.
<InPhase> I'm confident I could push that model faster with something like ClosedPoints, but I wanted to see it done recursively with cubes.
<JordanBrown[m]> My computer was $600 from Costco in 2013.
<JordanBrown[m]> And mostly it performs fine for me.
<InPhase> Then a good result for that. :)
<JordanBrown[m]> OpenSCAD builds are the major reason that I'm thinking about upgrading...
<InPhase> I upgraded recently and my OpenSCAD builds went from 25 minutes to 2.5 minutes. Then peepsalot added some malloc changes a couple months later (I think it was that change) and they bumped up to 3.5 minutes.
<JordanBrown[m]> I think my minimum build time is about a minute - recompiling one file, relinking, and the overhead.
<JordanBrown[m]> Full build, yeah, about 25.
<InPhase> Desktop or laptop?
<JordanBrown[m]> desktop
<InPhase> Ok. My laptops tend to need fan cleaning to avoid performance impairments before they hit that age. But desktops it can sometimes go 15 years before the fans really get all clogged up.
<JordanBrown[m]> 2-core AMD A10-6700 at 3700MHz, 28GB.
<InPhase> At 20 years sometimes uncleaned desktops just start shutting down. :)
<JordanBrown[m]> I open it up every once in a while and blow it out.
<JordanBrown[m]> Now if only I kept a good way to blow it out in my office. Mostly I open it up and blow, trying not to breathe :-)
<InPhase> I received great accolades as a computer expert once when a neighbor brought open their non-working computer, I opened it up, closed my eyes, blew really hard as a massive puff of dust arose, turned it on to verify it worked, and gave it back to them. :)
<JordanBrown[m]> I wonder whether something like a hair dryer (with the heat off!) would blow enough.
<JordanBrown[m]> My compressor blows enough, but even the small one is too big to keep in the office.
<JordanBrown[m]> And the idea of paying for canned air is just offensive.
<JordanBrown[m]> I do wonder why nobody seems to make a refillable air can.
<InPhase> Well I was using a heat gun on a motherboard once and it slipped slightly in my hand, sending parts of the motherboard flying off. That was an unpleasant repair. So avoid heat...
<JordanBrown[m]> Yeah, if it was dedicated to the purpose of blowing out the computers, it might need to have the heater disconnected.
<JordanBrown[m]> But it doesn't seem like it would be high enough pressure.
<JordanBrown[m]> I had forgotten that I put another 16GB into this system. It came with 12GB, which was a lot at the time, but then I added more later.
<JordanBrown[m]> But I'm tempted to upgrade to some modern 8-CPU build monster.
<JordanBrown[m]> Do you happen to know how to get gdb to run a program and stop immediately? (Not stop at main, but at the first instruction.)
little_blossom has joined #openscad
<InPhase> JordanBrown[m]: I usually just run gdb inside of Qt Creator so I don't have to think about the manual instructions. And then I would just put a breakpoint at the first instruction.
<InPhase> JordanBrown[m]: If I used debuggers more I'd probably go memorize more of the nuanced instructions for running it manually, but this just isn't part of my development workflow.
<InPhase> Hence, firing up the gui for those rare cases simplifies things. :)
<JordanBrown[m]> If I knew how to say "the first instruction", I could put a breakpoint there. But since I want to look at what happens before main(), that's hard.
<Scopeuk> your debugger should be able to break at application address 0 in the crt
<Scopeuk> not sure how to do it with GDB though
LordOfBikes has quit [Ping timeout: 246 seconds]
LordOfBikes has joined #openscad
<JordanBrown[m]> doesn't seem to start at address zero. (and it shouldn't; address 0 shouldn't be mapped)
califax has quit [Ping timeout: 258 seconds]
califax has joined #openscad
LordOfBikes has quit [Ping timeout: 268 seconds]
snaked has joined #openscad
<InPhase> JordanBrown[m]: Oh, before main enters you mean.
<InPhase> JordanBrown[m]: That I don't know.
<JordanBrown[m]> right
<InPhase> starti?
<JordanBrown[m]> I want to look at what MSYS2's runtime does to the command line that Windows supplies, to yield the argv that the program sees.
<JordanBrown[m]> ah, thanks.
<JordanBrown[m]> I did some searches, but didn't hit that one.
<InPhase> First hit for me under "gdb breakpoint before main"
<InPhase> It always turns on the arcane magic of the words. :)
<JordanBrown[m]> yep
<InPhase> You can maybe also compile to assembly with -S. That might have it.
<InPhase> You said you were a C guy. Are you fluent enough in assembly to mentally parse that output?
<JordanBrown[m]> Nah, that only gives you what the compiler makes. The linker is what pulls in the startup runtime.
<JordanBrown[m]> Oh, sure.
<JordanBrown[m]> For whatever stupid and not-stupid reasons, source debuggers have never caught on at work.
LordOfBikes has joined #openscad
<JordanBrown[m]> Probably starting with the fact that nobody's got a source debugger for the kernel, and largely the cultural attitude is that nothing outside the kernel is interesting.
<JordanBrown[m]> I exaggerate a bit, but only a bit.
<InPhase> Hmm, yeah, the assembly I'm getting has nothing before main.
<JordanBrown[m]> It's a bit extra special on those rare occasions when I have to run a debugger on a SPARC program, but I manage.
<InPhase> Let me initialize a global...
<InPhase> Well... They're all getting const initialized.
<InPhase> constexpr
<JordanBrown[m]> Normal C globals that are initialized are initialized in the executable file; you just map the memory in and they're done.
<JordanBrown[m]> C++ is probably fancier.
<InPhase> Ah hah! Got something to run before main. :)
<JordanBrown[m]> yeah, so did I. __main.
<InPhase> I had to make a function assign an int to a volatile then return it and then initialize my global with that.
<JordanBrown[m]> and found a key thing: the runtime is coming from mingw, not msys2.
<JordanBrown[m]> I did it by breaking at main, then stepping a few instructions so it would get the stack set up, then looking at the stack trace and finding that __main was on the stack above it.
<InPhase> Ah.
<JordanBrown[m]> si
<JordanBrown[m]> (So when I deleted that message, what did it look like on IRC?)
<InPhase> "si"
<InPhase> Nothing deletes on IRC.
<JordanBrown[m]> that's the one I deleted. I guess the deletion didn't show on IRC.
<JordanBrown[m]> I didn't expect it to, but if I edit something it comes through as another copy on IRC, with a bit of extra markup.
<JordanBrown[m]> like tihs.
<JordanBrown[m]> * like this
<InPhase> I suppose that's what a human would sometimes do to indicate the same.
<JordanBrown[m]> right
<JordanBrown[m]> in Element, it gets edited and just says (edited) after the message.
<InPhase> I've grown in the habit of s/like tihs/like this/, especially here where people parse that well.
<InPhase> Texting my mother or something, I would use "like this*"
<JordanBrown[m]> yep.
<JordanBrown[m]> I tried deleting the "si" - typed it into the wrong window - and was curious what the deletion looked like on the IRC side. Sounds like "nothing".
<linext> what's the correct way to import fonts into openscad? drop them into the /fonts/ folder?
<linext> for running it via command-line
ur5us has joined #openscad
<JordanBrown[m]> For Windows, I think normal system-level font installation works.
<JordanBrown[m]> I've never installed anything into OpenSCAD proper, and I have a gazillion fonts.
<linext> for web assembly, it appears they get copied into the /fonts/ path
<linext> there's a /fonts/fonts.conf
<InPhase> linext: There's a 10-liberation.conf and Liberation-2.00.1 example uner fonts in the source repository.
<InPhase> s/uner/under/
<linext> here's what fonts.conf contains: https://i.ibb.co/mDmxh3B/image.png
<linext> nothing special
<linext> does it matter what type the fonts are?
<linext> the openscad.fonts.js appears to favor TTF
<linext> LiberationMono-Bold.ttf
<InPhase> Not sure. ttf is sure a good starting plan.
<linext> 12 variations of LiberationMono
<linext> i was thinking... maybe of making 3dcustomizer.net more like what codebender.cc used to be for Arduino
<linext> a great web UI that had features way beyond the standard IDE