sparkfunX / Buzzard

Software tools for EAGLE silkscreen generation
100 stars 18 forks source link

Subsampling seems to fail with certain values #13

Closed nseidle closed 4 years ago

nseidle commented 4 years ago

python buzzard.py "(R)" -u 0.1 -o lib works

python buzzard.py "(R)" -u 0.9 -o lib fails

I'm not sure I even need subsampling but wanted to capture the error while I had it.

nseidle commented 4 years ago

Ah, may not be subsampling at all.

python buzzard.py "[VIN]" -o lib fails in same way,

NPoole commented 4 years ago

Subsampling definitely fails with certain values, which is expected because there's a minimum number of times you can divide a line (the length of a segment surpasses the length of the line)

It doesn't seem like there's a great way to guess the optimal subsampling rate, but I'll play with setting a min/max and let buzzard "try again" with a bigger one when it fails.

This tag, in particular, works fine if you do python buzzard.py "[VIN]" -o lib -u 0.3

lewispg228 commented 4 years ago

Ran into this as well (look at me, checking the issues!!)

Just another point of reference, but

This worked: run makelabel -s 0.045 "[VREF)" -u 0.3

This failed: run makelabel -s 0.045 "[VREF)"

Also, I only encountered this issue when the combo of "[V" is included in the text.

Thanks for the work around!

NPoole commented 4 years ago

Okay, I finally figured this out. I was TOTALLY WRONG about what causes this error. It was a stupid error where a function (interpPt, if you're curious) was allowed to return an empty list in certain situations. In the JS implementation, that was fine, because when JS "concats" lists, an empty list is ignored. When I did the same thing in Python, it added the empty list as an entry. Later, when that empty list was evaluated as a "point," Python was like "Hey, this is supposed to be a complex number, not a list!"

So anyway, I fixed the function so it returns None instead of [] and then added some safeguards against appending empty lists to the points list.

TL;DR: Any subsampling value should return some kind of result now, all the way from trash (<0.001) to huge (>1)