<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