<linext_>
notice that if you were to follow the same API rules, it would be possible to import the customizer from thingiverse onto another web app like printables
<linext_>
...and given the new web rendering system, it could be more responsive
<linext_>
i wonder how much prusa could budget towards that feature
<linext_>
$10,000?
<linext_>
$100,000 ?
<linext_>
and how many hours it would take
<teepee>
what do you mean by import the customizer?
<linext_>
copy the API and rebuild it outside thingiverse
<teepee>
openscad already has the interface in the nightlies
<linext_>
it's very convenient for beginners to have a simple web interface to generate custom 3d models
<teepee>
yup
<linext_>
models.makewithtech.com requires an account
<teepee>
yeah, so does pretty much any of those websites
<Virindi>
just use an external editor like geany, and there are better highlight schemes :)
<J22>
doubtful if they don't know the syntax
<Scopeuk>
its not a complex language just add the keywords to its dictionary
hiredman has quit [Ping timeout: 248 seconds]
hiredman has joined #openscad
<J22>
well that was what i suggested, that we put keywords for the variables in the color schemes
<J22>
with the keyword-custom1 everybody can do them self but if we had a keyword4 for the variables already in - i think it would be an improvement
<Scopeuk>
I was talking about in external editors, I have written syntax highlighting rules for notepad++ which is use as my editor
rvt_ has joined #openscad
teepee has quit [Remote host closed the connection]
nedko has quit [Remote host closed the connection]
nedko has joined #openscad
rvt_ has quit [Quit: rvt_]
teepee has joined #openscad
rvt_ has joined #openscad
teepee has quit [Remote host closed the connection]
teepee has joined #openscad
SamantazFox has quit [Ping timeout: 246 seconds]
snaked has quit [Quit: Leaving]
snaked has joined #openscad
qeed_ has quit [Remote host closed the connection]
qeed has joined #openscad
rvt_ has quit [Quit: rvt_]
teepee has quit [Remote host closed the connection]
nedko has quit [Remote host closed the connection]
nedko has joined #openscad
teepee has joined #openscad
rvt_ has joined #openscad
one-star-chef has joined #openscad
rvt_ has quit [Quit: rvt_]
teepee has quit [Remote host closed the connection]
teepee has joined #openscad
used____ has joined #openscad
<phryk>
does openscad have any kind of container type for data?
<phryk>
dictionary, array, whatever.
<used____>
array
<teepee>
and objects, but those currently can only be created by reading a json file
<teepee>
in the nightly build
<phryk>
ah, alright. i can just do something like `some_array[x] = y` then, right?
<teepee>
nope
<phryk>
damn.
<phryk>
why not?
SamantazFox has joined #openscad
<used____>
Because of the "this is not an ordinary programming language" part
<used____>
in docs
<used____>
Which version of openscad introduced text shapes? Finding a release notes section in the files / docs website is next to impossible. Am I missing something?
<teepee>
there's actually quite a number of languages working that way
<used____>
teepee: yes, macro languages everyone runs away screaming from.
<teepee>
nope
<used____>
Like m4 and not only.
<used____>
Kidding.
<teepee>
pretty much any HDL language for example
<used____>
I mean the inability to assign variables dynamically in the usual way teepee
<teepee>
yes, you can't do that in VHDL / Verilog / ... either
<teepee>
what do you mean with text shapes? the text() module? I think that was released in 2015.03
<used____>
In structural Verilog etc, you can't. In behavioral, you can. You are right to compare openscad language with structural HDLs though.
<used____>
teepee: yes that I think.
<phryk>
So, I want to break an animation into phases and have info on each phase and how far along it is – how do I? is it just impossible to solve in a way that handles an arbitrary number of animation phases?
<crazy_imp>
teepee: looking at line 4 of the code "// 2) In animation fields, set FPS = 10, Steps = 300" - maybe it's time to make these settings accessible as variables? kinda like $fa / $fs?
<phryk>
mhh, but one approach i can gather from that. just making a function for what I'd usually use a container type. not efficient, but i guess it'll work…
<teepee>
crazy_imp: no, as read-only yes
<phryk>
functions can access variables from enclosing scopes tho, right?
<teepee>
yes, that should work, also as capture for function literals
<phryk>
i have no idea what that means. you talking about passing functions into functions?
<teepee>
yes
<crazy_imp>
teepee: why not write access too? it would be nice to bootstrap the fps and steps fields in the editor so you don't have to enter them again when you open your model the next day. or as compromise: if the user hits animate and the fields are empty, use the values found in the file (after asking)
<phryk>
ah, okay. mhh, but even the function syntax seems to be severely limited. like, i have to fit everything into a single calculation? i need something like if…elif…else
<phryk>
explicit if doesn't even seem to have an else, short-hand conditional assignment seems to, tho.
<teepee>
crazy_imp: because that would horribly mess with any GUI control
<phryk>
wat. this is a completely different notation than in the docs?
rvt_ has joined #openscad
<teepee>
phryk: no, it's function literals, which can be assigned to variables and passed around
<phryk>
teepee: if i have multiple statements in a function, how does it determine what it returns? is it just the last value like in lisp?
<teepee>
you can only have one expression at this point
<phryk>
/o\
<teepee>
that said you can have assignments via let()
<phryk>
yeah, but i need 3 ifs in a function… as it stands i have absolutely no idea how to do this. :/
<crazy_imp>
teepee: it wouldn't mess with anything if the user is prompted if they want to bootstrap the fields with the stored values. kinda like the modeline magic from vim (disabled by default)
<teepee>
crazy_imp: problem is there's no single "file loaded" - specifically when using reload-on-save
<phryk>
thanks a bunch. i think i can split this function into 3 functions to make up for the lack of multi-expression functions.
<phryk>
not elegant by a long shot, but should work…
<J22>
the animation is 0-1 so you have to know how many parts you want and how long each part should be .. make an array and done
<phryk>
J22: i want a solution that solves the problem for an arbitrary number of phases of equal length.
<phryk>
got the basic construction down, only calculation of the progress of the current phase is missing.
<J22>
1/4 for 4 1/5 for 5 and so on
<J22>
if($t>1/4&&$t<2/4) cube();
<phryk>
that's not what I'm trying to do.
<J22>
also recursion can be used for that
<crazy_imp>
teepee: hm. what about ditching the animation bar and making the variables read-write? they would show up in the customizer and you could even have different settings like a slow animation with a few frames or a fast one and you would have the option to ship a default with your .scad file. but thinking this further: you would always need to set the parameters in the file to get them to show up there -
<crazy_imp>
but on the other hand, you would certainly don't start an animation if you don't have $t in your code somewhere, at this point you may even have an idea if for the values for fps/steps. (might benefit of an animation_enabled variable or something like this)
<J22>
found out that for recursive string concatenation there was a sweet spot
<phryk>
animation_phase_t returns something akin to t, but for the specified animation phase.
<J22>
count from 0 not from 1
<phryk>
no. logic breaks down with floor() instead of ceil() and I can't be arsed to fix that, at least not now.
rvt_ has quit [Quit: rvt_]
<InPhase>
J22: Hmm. Oddly, search is linear with the number of elements, and the idx function I wrote is quadratic with the number of elements.
<InPhase>
J22: The search wins by a good margin even for pretty small dictionaries.
<InPhase>
I am confused about that idx function being quadratic though.
<InPhase>
teepee: You were involved with the tail recursion optimization of these sorts of things, right? Do you expect this would be linear with the size of d? function idx(d, k, i=0) = i>=len(d) ? undef : d[i][0]==k ? d[i][1] : idx(d, k, i+1);
used____ has left #openscad [#openscad]
<InPhase>
I'm not sure what implementation issue could even make such a thing go by N^2.
Guest73 has joined #openscad
<InPhase>
Oh, damn it. I'm looping over the key count.
Guest73 has quit [Client Quit]
<InPhase>
Of course it's N^2... That's the test getting longer. :)
<InPhase>
search then has only a trivial runtime difference for the portion that happens outside of OpenSCAD code, so it appears linear-like.
<InPhase>
So search is near native speed, and thus almost constant compared to OpenSCAD code itself.
<InPhase>
teepee: Ignore my question above. :)
<J22>
so using search is faster .. afaiu
<InPhase>
Yes, much. This is the new idx I've put in the dict.scad I created for my files: https://bpa.st/EQAQ
<teepee>
InPhase: hmm, not sure, in that order the call looks only on 2nd level
<InPhase>
Yep, false alarm. I fooled myself.
<J22>
foo returns only f
<InPhase>
Oh...
<InPhase>
That's a fail on the search approach then.
<InPhase>
It needs to match uniqueness.
<J22>
i think you need to put in a vector for that
<InPhase>
This is why I'm always afraid to use search. It tries too hard to be smart with strings, and ends up just hurting all possible usage.
<J22>
then foo ↦ undef
<InPhase>
I suppose function idx(d, k) = d[search([k], d)[0]][1]; works for the test cases. But does it fail for other usages?
<InPhase>
Like what if k is a list of points instead of a string?
<J22>
always use search with vectors .. better chance of working
<InPhase>
I suppose it still works if the key is a list of points.
<J22>
[[0,1,2]] will search for [0,1,2] else it would look for 0, 1,2 which is not what you want
<InPhase>
Yeah.
<J22>
because search can search for multiple at once the result of "foo" would be [f,o,o] but only the first is returned in the echo
<InPhase>
J22: Okay, now here's where search is stupid: d2 = [[[2,3], 5], [5,6], [[5,6], 11]]; echo(idx(d2, [5,6]));
<InPhase>
This produces "6" as the result.
<InPhase>
Again trying too hard to be clever in its searching.
<InPhase>
If you can see a fix to that too, I can use search. Otherwise, that's not generally reliable for a dict.
<J22>
with function idx(d, k) = d[search([k] ,d)[0]]; you get [5,6]
<InPhase>
Yeah, but I'm supposed to get 11. :)
<J22>
the echo (as i said) was written to only return the first
<InPhase>
The recursive one I wrote correctly grabs the 11. It checks only the key value that it's supposed to.
<InPhase>
https://bpa.st/D3WQ You can't even post-process and fix it. The first returns ONLY the bad result, while the second returns only the correct one, structured identically even though it found them at different nesting levels.
<InPhase>
This is such a bad design.
<J22>
search([k] ,d,num_returns_per_match=0)
<J22>
search will also give 11 the first occurance is 1 .. while d[1][1] should be empty
<InPhase>
That gives a list, but then I guess I'd need another function to iterate over the list of indices and check which one is actually right.
<J22>
for multiple results you have multiple .. having a list with mixed length vectors is also a bit unusual
<J22>
your code is only returning the first
<J22>
when using stings
<J22>
(also with points)
<J22>
if the [5,6] is the same vector as the others [[5,6]] so probably search should read the [5,6] as 5 and 6 compared to the others
<InPhase>
https://bpa.st/FKDQ Okay. So clean implementation is gone, but this mixes the fast performance with the correctness.
<J22>
still in question when you have a list with multiple correct results
<InPhase>
Well I returned the first one there, but dicts should not have duplicate keys, so the correct solution is a dict constructor that ensures this. :)
<InPhase>
Also union, insert, and remove functions.
<J22>
in a dict you also don't have vectors with different length Ü
<InPhase>
Well your keys and values can have different lengths and types, at least in Python.
<InPhase>
But you must have one key, one value, and no other entries in the list pretending to be a 2-tuple.
<J22>
but every entity in the array should be same size and not differently deep nested
<InPhase>
{5: 6, (5, 6): 11} This is a valid python dictionary. d[(5,6)] returns 11, d[5] returns 6.
<InPhase>
It's probably a sign of an idiot programmer, but it's valid. ;)
<InPhase>
There could be a few use-cases for it.
<J22>
ok mixing vector and numbers is an issue for »search«
<J22>
{(5):6,(5,6):11} wouldn't cause that problem
<J22>
so the primary key should be either a number or a vector (in a normal DB)
<J22>
it is like mixing "5" with [5] and 5
ur5us has joined #openscad
<J22>
echo("55"[0],["5","5"][0]);
<J22>
echo("55",["5","5"]);
drkow has quit [Read error: Connection reset by peer]
<InPhase>
I have that working already with the search with that filter routine I showed above.
<InPhase>
So this I think is okay unless I missed a failing testcase.
<InPhase>
J22, phryk: There, overkill on a dictionary implementation, with indexing, keys, values, input cleaning with dict, removal with dpop, insertion/overwrite with dset, and dunion to merge lists of dictionaries. https://bpa.st/26JQ
<phryk>
uuuugh, openscad still has that thing where it doesn't dump the last image of an animation :<
<dalias>
:/
<phryk>
can i somehow manually dump it? checking "Dump Pictures" and manually jumping to time 1 doesn't seem to do the trick :/
<teepee>
bugs not mentioned on github don't exist ;-)
<teepee>
it might assume looping animation where image@0 == image@1
<phryk>
wait, so it has fuck all in terms of comfort features for animations but assumes people take on the hassle of actually making animations loopable? what fresh madness is this
<teepee>
right, so someone is working on improving the animation stuff and maybe at some point may export to video/animated gif might make it, who knows
<teepee>
but
<teepee>
for now there's 2 option
<teepee>
1) late here I'm going to bed now
<phryk>
teepee: do you know who is doing this? if I someone's putting hours into this and i can get nightlies to build, i might be able to help testing stuff.
<teepee>
2) I'll kick you till the language has settled a tiny bit back to normal level