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 or report bugs: https://goo.gl/lj0JRI | Tutorial: https://bit.ly/37P6z0B | Books: https://bit.ly/3xlLcQq | FOSDEM 2020: https://bit.ly/35xZGy6 | Logs: https://libera.irclog.whitequark.org/openscad | don't ask to ask
pah has quit [Ping timeout: 268 seconds]
pah_ has joined #openscad
pah_ has quit [Ping timeout: 268 seconds]
ccox has quit []
ccox has joined #openscad
ferdna has joined #openscad
pah has joined #openscad
default_ has joined #openscad
default__ has quit [Ping timeout: 268 seconds]
ferdna has quit [Quit: Leaving]
ferdna has joined #openscad
default__ has joined #openscad
default_ has quit [Ping timeout: 268 seconds]
oldlaptop has quit [Ping timeout: 264 seconds]
oldlaptop has joined #openscad
default_ has joined #openscad
default__ has quit [Ping timeout: 268 seconds]
default__ has joined #openscad
default_ has quit [Ping timeout: 268 seconds]
default_ has joined #openscad
default__ has quit [Ping timeout: 268 seconds]
default__ has joined #openscad
default_ has quit [Ping timeout: 260 seconds]
<JakeSays> InPhase: so.. is it possible to capture the children passed in to a module and use them in a nested module?
<InPhase> Let's not say "passed in to", but the children of a module, yes.
<InPhase> the children(i) call does this, with $children being the count of them.
<JakeSays> InPhase: doesn't children() provide access to the module's children only? i need for a nested module to access its parents children
<InPhase> Then you give them to it.
<InPhase> https://github.com/rcolyer/threads-scad/blob/master/threads.scad#L347 Line 347, the children of ScrewHole are made into a child of difference().
<InPhase> There is no mechanism to leap out of scope and grab them. But you distribute them where they are needed.
<JakeSays> i need them three nested modules deep
<InPhase> Design your code so that they get passed along where needed.
<InPhase> Or, if that's cumbersome, try a different approach. :)
<JakeSays> it is kind of messy
<JakeSays> what's the different approach
<JakeSays> it would be convenient if i could do 'foo = children();'
<InPhase> Sounds like an XY.
The_Jag has joined #openscad
<InPhase> I like edge cases of OpenSCAD, so I am happy to discuss them. :) But bigger picture would help with solving the real question.
<JakeSays> it's not an xy problem.
peeps[zen] has joined #openscad
<JakeSays> i have a module that has submodules that it uses to organize its code.
peepsalot has quit [Ping timeout: 268 seconds]
<InPhase> Can you show it?
<JakeSays> one of those sub modules (a sub-sub-module actually) needs the main module's children to use as holes
The_Jag_ has quit [Ping timeout: 264 seconds]
<JakeSays> InPhase: go to line 74
<JakeSays> i want to be able to pass those 'translate()..' blocks as children to number()
<JakeSays> basically they carve out holes in the sides for wires
ur5us has quit [Remote host closed the connection]
ur5us has joined #openscad
<JakeSays> er, make that line 86
<JakeSays> no. 74. lol
<InPhase> Ah, good thing I stepped away for a few minutes so you could find the line number. ;)
<InPhase> Let's see.
<JakeSays> lol indeed
<InPhase> There is no number() on line 74?
<JakeSays> number() is the top level module
<JakeSays> the goal is to print covers for these: https://imgur.com/a/1RWRghV
<InPhase> Did someone turn 178?
<JakeSays> lol no it's part of my street address
<InPhase> Ah. :)
<InPhase> Suitable for Christmas then I guess. :)
<JakeSays> i'm making house numbers that delivery people can see
<JakeSays> well, that's just one pattern. i can make them do just about anything
<InPhase> In my experience, much of the reason that delivery people cannot see the house number, is because they are searching for it on the wrong house.
<InPhase> I deduce this from all the photos of other people's porches that I get with my packages on them.
<JakeSays> the house numbers in my neighborhood are small and black and far from a light source. really bad design.
<InPhase> I have two on my house, illuminated by the two street lamps directly in front of my house.
<JakeSays> i'll be able to put in delivery instructions: "if the house number isn't painfully, annoyingly visible, you are at the WRONG house!"
<InPhase> It should help, except for the above problem. But I hope you are successful. :)
<InPhase> Now... The translates... Can you explain if you want to abstract away the translates themselves, the translates with the cubes, or just the translate vectors?
<JakeSays> well, the translates could be anything. the idea is to define a shape to subtract from the outline
<JakeSays> they just happen to be translated cubes in this example
<InPhase> So basically, if digit is 7, you want to use some digit7 module?
<InPhase> Do you actually want this to be a set of 10 children?
ur5us has quit [Ping timeout: 268 seconds]
<JakeSays> currently i have the if (digit == 7) {} because i can't parameterize the shapes, so i have to hard code them.
<InPhase> Ok. So what you actually want is to pass the shapes for the 3 numbers in as children, such as: number() One() Seven() Eight(); ?
<InPhase> I mean...
<InPhase> number() { One(); Seven(); Eight(); }
<JakeSays> refresh the gist
<JakeSays> i added a comment
<JakeSays> no, each number is drawn separately. i have other files (number1.scad, etc) that use the number() module
<JakeSays> one call to number() draws a single digit
<InPhase> So just: number() Seven();
<InPhase> And then make Seven()'s contents show up in there where you have the if digit?
<JakeSays> number(7) { translate() cube(); }
<JakeSays> basically yeah
ur5us has joined #openscad
<InPhase> Have you tried just putting children() in there instead of children_of_module_number() ?
<JakeSays> yes, but sides(); doesn't have any children
<JakeSays> see line 95
<InPhase> Oh, right, you nested super heavy.
<JakeSays> yes
<InPhase> So what you do is put children() after top() on line 25, after topCore() on lines 116, 124, and 128, and after sides() on line 95. Then, children() where you have "children_of_module_number()"
<InPhase> Doing anything other than passing it along would require module literals, which are not yet available.
<JakeSays> won't that render the children at each children(); ?
<InPhase> Definitely not.
<InPhase> It only passes them. They only manifest when used.
<JakeSays> ah
<JakeSays> so the last children() would be the 'use'?
<InPhase> It will be a "use" if it's unpassed. "Foo() children();" passes it as a child again. "children();" by itself renders it as a geometry.
<JakeSays> ah ok.
<InPhase> "Foo(); children();" on one line is a nasty typo which will call Foo() with no children, and display the children() as a geometry. ;)
<InPhase> Sort of like how translate([10,0,0]); cube(5); does not translate the cube.
<JakeSays> well, for now i'll just pass in the translate and cube parameters. it'll limit the shape to just cubes, but it's better than keeping track of all of the children()'s
<InPhase> Also, stylistically, I have come to regard it as easier to read OpenSCAD code when the modules are not nested like that syntactically. While you would have the same call-chain, and you'd still need to pass children() along, you can do this without nesting.
<JakeSays> oh i know nesting isn't needed. i do it because it fits the way i think, and my general coding style. i'm big on encapsulation.
<InPhase> A reason to not nest, is that with nesting it becomes harder to see what each piece of the problem does. number() for example is 132 lines long. top() opens on line 42, but has its critical behavior on line 113.
<InPhase> top() would be a tiny easy to parse module if isolated separately above number().
<JakeSays> but top is only applicable in the context of number()
<JakeSays> also moving top outside number doesn't reduce the size of top
<InPhase> Yeah, I hear you. And that would be great if module() were just a set of module methods. But that's just not how the syntax goes in this language. It starts executing and keeps going. :)
<InPhase> So you never know what each module actually does until you read the whole thing.
<JakeSays> i dont think it's an issue of syntax. it's an implementation detail.
<JakeSays> if i could define modules after their use, then the meat of top() would be at the top of top()
<JakeSays> we need objectscad. lol. or scad++
<InPhase> Well, you CAN define modules after their use.
<InPhase> You did it with top() and bottom(). :)
<JakeSays> you can??
<JakeSays> i did??
<InPhase> You did.
<JakeSays> lol well duh. i sure did.
<InPhase> It's an order-independent declarative language. :)
<JakeSays> very cool!
<InPhase> Except now with variable warnings...
<JakeSays> i will put the meat before the potatoes
<JakeSays> what?
<InPhase> Well x = y; y = 5; now gives a warning about the y.
<JakeSays> yeah that makes sense
<InPhase> I guess too many people were shooting themselves in the foot of confusion with those.
<JakeSays> i would consider that an error
<InPhase> It's not really, given the declarative nature. But that's fine. I habitually do it in the standard order anyway.
<JakeSays> to me the distinction between variables and modules/functions is valid in this case.
<InPhase> Well is function literal foo a variable or a function here? Because this works without error or warning. echo(foo()); foo = function() 5;
<InPhase> So does this: echo(bar()); foo = function() 5; bar = foo;
<InPhase> This doesn't! bar = foo; echo(bar()); foo = function() 5;
<InPhase> Some of that absurdity is due to the weird scoping of echo. Its processing comes after.
<JakeSays> i think 'function literal' is too confusing.
<JakeSays> you have a variable that can be a function, just like it can be a bool, or a number, or a string, etc.
<JakeSays> making the distinction between function literal and variable is unnecessary
<InPhase> I attemptd to reformat your code to see if I could make it more parseable to my eyes: https://bpa.st/H57A
<InPhase> I think it helps to put an artificial comment marker for the end of behavior, and for the modules that are acting like classes, moving the geometry parts into a "constructor", which here I chose to call Display in each.
<InPhase> I still think it gets a little too nested, unwrapping with 7 closing braces at the end like it's Lisp. But with this more rigid approach I can at least convince myself that it's safe to limit where I read to when I want to know what something does.
<JakeSays> Display() doesn't add value for me
<JakeSays> i also don't like opening braces on the same line as their statement
<JakeSays> moving the module statements up front makes sense, but not the ctor part
pah_ has joined #openscad
pah has quit [Ping timeout: 260 seconds]
ferdna has quit [Quit: Leaving]
pah has joined #openscad
pah_ has quit [Ping timeout: 268 seconds]
pah has quit [Ping timeout: 268 seconds]
pah has joined #openscad
pah has quit [Ping timeout: 268 seconds]
pah has joined #openscad
GNUmoon has joined #openscad
pah is now known as pa
arebil has joined #openscad
mhroncok has joined #openscad
Guest89 has joined #openscad
Guest89 has quit [Quit: Client closed]
ur5us has quit [Ping timeout: 268 seconds]
Jack21 has joined #openscad
<Jack21> is there a way to set the limit for recursion detection - right now it seems i can't get over 6863
pa has quit [Ping timeout: 260 seconds]
pah has joined #openscad
<teepee> not directly, it's limited by stack memory - which should be changable at least on Linux
<teepee> if possible, changing to tail recursion removes the memory limit and goes to 1 million or so
<Jack21> i see thought there was a limit in settings like for render objects or for loop elements
<Jack21> so u guess csv parsing a bigger list of points like elevation data is not possible with https://github.com/thehans/funcutils/blob/master/string.scad
pah has quit [Ping timeout: 268 seconds]
<teepee> might be possible to change, depending on how much data you have, using "ulimit -s" could help if it's just short of working
pah has joined #openscad
<teepee> considering we now almost have a JSON import, reading CSV would probably not be very complicated to add
<Jack21> i opened the files in a editor and just replaced the character to import - just thought it could work directly within scad
<teepee> yeah, that could work in some cases
pah_ has joined #openscad
pah has quit [Ping timeout: 260 seconds]
pah_ has quit [Ping timeout: 268 seconds]
pah has joined #openscad
pah is now known as pa
pa has quit [Ping timeout: 268 seconds]
pah has joined #openscad
pah has quit [Ping timeout: 268 seconds]
pah has joined #openscad
ochafik has joined #openscad
ochafik has quit [Remote host closed the connection]
ochafik has joined #openscad
ochafik has quit [Ping timeout: 260 seconds]
pah has quit [Ping timeout: 268 seconds]
pah has joined #openscad
<Jack21> found a way to join chunks so each recursion is lower<6k) and joint with other lower 6k so limit now is ~ 6k^2
lastrodamo has joined #openscad
<Jack21> as the loop limit is "already" 1M this should be enough
Jack21 has quit [Quit: Client closed]
Jack21 has joined #openscad
GNUmoon has quit [Ping timeout: 276 seconds]
GNUmoon has joined #openscad
Guest43 has joined #openscad
Guest43 has quit [Client Quit]
Jack21 has quit [Quit: Client closed]
The_Jag has quit [Read error: Connection reset by peer]
The_Jag has joined #openscad
pah_ has joined #openscad
pah has quit [Ping timeout: 268 seconds]
incal has joined #openscad
snaked has quit [Quit: Leaving]
Jack21 has joined #openscad
ochafik has joined #openscad
ochafik has quit [Remote host closed the connection]
GNUmoon has quit [Ping timeout: 276 seconds]
GNUmoon has joined #openscad
GNUmoon has quit [Ping timeout: 276 seconds]
GNUmoon has joined #openscad
mhroncok has quit [Quit: Leaving.]
peeps[zen] has quit [Ping timeout: 268 seconds]
peepsalot has joined #openscad
ochafik has joined #openscad
ochafik has quit [Remote host closed the connection]
pah_ is now known as pa
pa has quit [Changing host]
pa has joined #openscad
ochafik has joined #openscad
ochafik has quit [Remote host closed the connection]
ochafik has joined #openscad
peepsalot has quit [Read error: Connection reset by peer]
pa has quit [Ping timeout: 260 seconds]
peepsalot has joined #openscad
pah has joined #openscad
pah has quit [Ping timeout: 264 seconds]
pah has joined #openscad
pah is now known as pa
ochafik has quit [Remote host closed the connection]
ochafik has joined #openscad
ochafik has quit [Remote host closed the connection]
ochafik has joined #openscad
ochafik has quit [Ping timeout: 268 seconds]
lastrodamo has quit [Quit: Leaving]
pah has joined #openscad
pa has quit [Ping timeout: 268 seconds]
pah has quit [Ping timeout: 268 seconds]
pah_ has joined #openscad
ur5us has joined #openscad
GNUmoon has quit [Ping timeout: 276 seconds]
Jack21 has quit [Quit: Client closed]
GNUmoon has joined #openscad
ferdna has joined #openscad