<J23>
if you use random generation - never all look nice so i used manual seeds
<Vasiliy475>
Good day. Sunday becomes more britefull , when discovered render() foo. :)
fling has quit [Ping timeout: 255 seconds]
fling has joined #openscad
agnes_de_lion[m] has joined #openscad
Andy-pants has joined #openscad
Vasiliy475 has quit [Ping timeout: 260 seconds]
Andy-pants has quit [Ping timeout: 248 seconds]
Andy-pants has joined #openscad
Andy-pants has quit [Remote host closed the connection]
Andy-pants has joined #openscad
Andy-pants has quit [Ping timeout: 252 seconds]
<Av8r>
I'm contemplating extending the Export PDF Dialog with an "autoscale". If selected, this would scale the drawing by a computed integer value to fit the selected page size/orientation. Small models would be expanded, large models shrunk to fit. A scale annotation would be added (eg, "3:1" or "1:5" as appropriate). The scale and grid
<Av8r>
would be unchanged (they would represent the page, not the model - so if the scale was 5:1, 10 mm on the page scale would be 50mm of model. I might cap the scale integer at 10, or otherwise constrain it just so ludicrous scale values don't appear (eg, maybe after n=5, the range of available scales steps in 5 rather than 1). I've scaled the
<Av8r>
model for this purpose in the past, but by putting this in the dialog I don't have to undo the model changes. Thoughts?
<InPhase>
Av8r: What's the current behavior?
<InPhase>
Oh, I see.
<InPhase>
Yeah. I never use this feature obviously.
<Scopeuk>
I think it's currently 1:1 assuming mm base unit
<Scopeuk>
I could be mistaken
<InPhase>
Yeah, mm scaling, 0,0 bottom left corner, with scalebars shown.
<Scopeuk>
I think I used it once when I unrolled my model into a net and printed it to cut out and assemble before I owned my first printer, it's been a while
<InPhase>
Av8r: I think there's value in a center and fit on page. I don't see any need for imposed limits.
<InPhase>
Av8r: One would need to adjust the scalebars, which could put 0 in the middle for this mode.
<InPhase>
Av8r: It helps to think about usage workflows. But I suppose a sensible workflow for pdf export is just printed representations of things. Although I'm not sure what the overall usage is for 2D models with this.
<Av8r>
No Export options in the current release. I have a pull request for the dialog now, which provides some controls.
<InPhase>
Av8r: Can you provide examples of what you use it or intend to use it for?
<InPhase>
It would help to get more sense for the value of pdf export.
<InPhase>
In my brain it's kind of useless because it is not a design schematic, and I can't picture a pdf export I'd want which is not some sort of design schematic.
<InPhase>
But, some other things must exist for doing with it.
<InPhase>
We do have svg export for simply the 2D representations of things.
<Av8r>
It's described in the Feature request. (#4143). In the current release, the orientation is fixed at portrait. If the model extends across the x or y axis, the origin is placed in the center of the page, else it's the lower left. The new feature as implemented now centers the geometry on the page, so the origin will be where needed. The
<Av8r>
issue tracker has some examples.
<Av8r>
The purpose of the PDF export is to check dimensions. It is a 2D export.
<InPhase>
How does that differ from using the viewport/
<Av8r>
gbruno: #4538 would be a different feature, something that ImplicitCAD implements.
<InPhase>
(Just trying to see how people use it.)
<Scopeuk>
pdf is setup for printing, you could print the file at 1:1 and check it against parts it should fit to etc
<Scopeuk>
I've done it to see how my model for tanik track supports married with the real tracks
<InPhase>
Scopeuk: Fair, that's a usage I can see. Although this then requires 1:1.
<InPhase>
I suppose pdf export with autoscale from console could be used where the viewport doesn't exist, for dimension checking as a report. But the dialogue would only pop up if the viewport is open.
<InPhase>
Maybe it provides a scale report that can be conveniently shared with clients not using the program? That might be a thing of value.
<Av8r>
Other scales work; that's the reason to keep the autoscale in integers. For example, where I needed it was when I was making a panel slightly longer than a sheet of paper. I scaled it by 50%, and checked the dimensions against that. And also printed it (in sections) at 100%, then cut the paper and fit it against the priginal panel.
<Av8r>
I'm replicating a plastic battery box for my airplane; the cross-section is critical to match the battery so it can't move. This is too big to fit on a piece of paper. I keep finding uses for it, and it's nice to not have to recompile OpenSCAD to get the particular view I need.
<Av8r>
InPhase: the controls could be accessed from the command line (just populate the options structure before calling exportPdf()). I've not looked at adding command line arguments for that.
<teepee>
Av8r PR looks great from GUI side
<teepee>
it does crash from command line, so I suppose as simple solution it would need to give some fixed default options?
<Av8r>
teepee: I'll look at that. Must be another marshalling function which uses a different ExportInfo constructor/definition.
<teepee>
yep, coming from openscad.cc command line main()
<teepee>
I just tried openscad test.scad -o test.pdf
<teepee>
#5 0x0000555555610983 in main (argc=<optimized out>, argv=<optimized out>) at /home/tp/projects/o/openscad-branch/src/openscad.cc:1189
<teepee>
#4 0x0000555555606c12 in cmdline (cmd=...) at /home/tp/projects/o/openscad-branch/src/openscad.cc:426
<Av8r>
Oh, I think I know what I didn't include.
<Av8r>
It was on my ToDo list. The code in the Gui will always populate a default, but I was going to duplicate that within Export PDF. Ooops.
<Av8r>
Fortunately, trivial.
<teepee>
it does have options but some are not initialized it seeems
<teepee>
Orientation = (unknown: 0x44290fc0)
califax has quit [Ping timeout: 255 seconds]
<Av8r>
I'd done some other additional polishing, so I'll get that in an updated PR soon. What's the protocol with PRs for "try this one instead"? Just submit a new PR?
califax has joined #openscad
<Scopeuk>
I think if you update the branch the pr was pulled from it updates your pr
<Av8r>
Okay. Shouldn't take too long. I'm pretty sure I know exactly what to do - in fact the pseudo code is in my "notes" file, although I always refactor it a bit when I actually code it.
<teepee>
Av8r: you can just push to the same branch, the PR will pick up the additional commits automatically
<Av8r>
teepee: thanks! Getting ready to test now.
<Av8r>
Okay, put the default in the export_pdf method and it still seg faults. So the error is upstream. I was wanting to trace the command-line code; now's my opportunity...
<Av8r>
Fixed it. I was checking for a nullptr in the Export_Pdf method, but I failed to initialize the "options" ptr to nullptr in the typedef. All better now, and I didn't have to change openscad.cc. Will commit momentarily.
<gbruno>
[github] JonMcLin synchronize pull request #4537 (Implement ExportPdfOptions Dialog with paper selection and more (#4143, partial #649)) https://github.com/openscad/openscad/pull/4537
Guest12 has joined #openscad
Guest12 has quit [Client Quit]
<teepee>
default size is A3?
<Av8r>
Oops. was supposed to be A4; Fixed.
<Av8r>
Intent was they produce the same results as existing code.
<Av8r>
When I moved the defaults to the initializers I obviously got confused. ("4" is bigger than "3").
<gbruno>
[github] JonMcLin synchronize pull request #4537 (Implement ExportPdfOptions Dialog with paper selection and more (#4143, partial #649)) https://github.com/openscad/openscad/pull/4537
Vasiliy475 has joined #openscad
<Av8r>
I should take a look at how the current test for Export PDF works. The new features ought to be similar. Since there are multiple options, should I simply ensure at least one test case covers each option, or should test cases be atomic (one feature per test case)?
<Av8r>
teepee: looks like the current exportPdf Test will fail simply because the new code always centers the geometry on the page.
<teepee>
hmm, so that raises the question if we need the other behavior
<teepee>
meshugga: not sure as it's an image, but I think I see 6 x ? but only 5 x :
<Av8r>
It's the non-centered image that would be the problem. I could make the autocenter behavior an option; the previous behavior was simply set the origin in the lower left unless geometry crossed either axis, and in that case it puts it in the page center. Since that usually results in oddly-positioned images (at least with my asymmetric models)
<Av8r>
I didn't see much point in keeping it.
<meshugga>
teepee: oooooh thanks
<teepee>
Av8r: yeah, I tend to agree, so maybe we just go all-in and simply re-generate the test files. if someone loudly complains we can always try with another option later
<Av8r>
Any idea how those images are generated? I was looking in tests and scripts for clues, but nothing has jumped out yet.
<Av8r>
Maybe pillow since the tests run in python?
<teepee>
I've built the version anyway, I can run that
<teepee>
hmm, that did not work
<InPhase>
Av8r: Pillow support was added to the testing suite very recently, and pdfs are not currently using it. But now that the venv infrastructure is part of the testing suite, we should feel free to add whatever Python approaches will make pdf testing more robust. Just do so mindfully, so that we don't make the testing environment some oversized beast of many packages. Adding an extra package or two would
<InPhase>
be fine though.
<teepee>
ahh, because I named the binary openscad-nightly
<InPhase>
Av8r: Reach out if you want to do that and need guidance on how.
<InPhase>
Av8r: It's still moderately fresh in my brain.
<InPhase>
Av8r: A good fraction of the thinking of going venv for testing was precisely for this sort of flexibility going forward.
<Av8r>
Thanks. Let me follow some of these breadcrumbs, and I'll get back to you.
<teepee>
should be enough to run the above command with "-R pdf" in the <cmake-build-folder>/tests
<teepee>
otherwise let me know and I'll run the generate command
<InPhase>
It looks like our pdf export test current compares png files. This might be a misguided approach.
<InPhase>
I think it will actually work very poorly and unreliably for catching regressions with the image comparison.
<teepee>
yes, it converts via ghostscript
<InPhase>
The only version would have caught basically no changes, since "most of the page is white" would be a success. ;)
<InPhase>
The new method will still miss most things, because the features are all thin lines, which are ignored in image testing to avoid edge artifacts.
<teepee>
due to the resolution it did trigger on problem after I lowered the threshold
<teepee>
but it's indeed far from the perfect solution
<InPhase>
So pretty clearly we should have a different pdf testing method that actually looks at pdf content in some manner.
<InPhase>
Or, some sort of different image test if we need to do it by image.
<teepee>
yup, but it needs something that works on all platforms, so the new python probably brings more options
<InPhase>
Yep.
<Av8r>
A binary compare of the PDF file may work best, if we can exclude any date or path information in the PDF metadata. Rationale being that both images were produced by the same cairo library in OpenSCAD.
<Av8r>
So we could use pdf utils of some flavor to overwrite metadata in both the test reference file and the source file under test, then do a binary compare.
<InPhase>
Well we don't want cairo version upgrades to change the comparison.
<InPhase>
Also we might have different cairo versions between platforms, which is a problem.
<Av8r>
Let me look at some generated files; the pdf script inside is ascii (looks a lot like svg). The graphs are drawn as line strokes. Presumably cario is not converting them to bit maps.
<teepee>
might be worth a try, but we need to handle different library versions
<teepee>
e.g. even in code we have some backward compatibility for older cairo setting some meta data
Lagopus has quit [Read error: Connection reset by peer]
<InPhase>
It looks like we have various options like pdf-diff, and pypdf which extracts text so we could additionally do a diff on the text.
Lagopus has joined #openscad
<InPhase>
Oh, pdf-diff also does a text comparison itself, plus an image comparison.
<Av8r>
I've used pdftk, pdfutils, and pypdf. I'll look at pdf-diff.
<teepee>
is that python?
<teepee>
aha pypi
<Av8r>
There's a diff-pdf too on github
<teepee>
hmm, output is a png
<InPhase>
Nope, I guess pdf-diff does not look like it will do embedded images. It is only producing an image of the differences in the text. (Which while handy, is not the key requirement here.)
<InPhase>
diff-pdf looks abandoned. We'll want to avoid abandoned C++ code.
califax has quit [Ping timeout: 255 seconds]
<InPhase>
I'd sooner write a new custom comparator with Pillow than add in an abandoned C++ codebase.
califax has joined #openscad
<Av8r>
diff-pdf shows an update 3 weeks ago on github - "add pixel-difference tolerance"
teepee has quit [Ping timeout: 255 seconds]
teepee has joined #openscad
<InPhase>
One option: Converting the current pdf output to a 600dpi image makes it work with the current image comparator.
<teepee>
I guess that's better than adding: "dependency is wxWidgets >= 3.0"
<InPhase>
These are 4958x7016 images, file size 234kB, and memory estimates for the test staying under 1GB.
<InPhase>
The test should take approximately the same amount of time, since most of the time is spent just loading numpy.
<Av8r>
InPhase: I'm thinking that's best. It only compares the result. But the key would be to have the reference image in PDF. At test time, you use the same tool (Pillow or whatever) to translate the PDF to a high-resolution image, in a common format. PNG is lossless, so it should be suitable.
<InPhase>
I'd be fine with that. We'd just need a pdf loader to get it loaded as an image in 600dpi mode.
<InPhase>
It seems Pillow only writes pdfs and doesn't read them.
<teepee>
I suppose that would be poppler
<Av8r>
Let's see what we are already using.
<InPhase>
Possibly pdf2image as a library add.
<InPhase>
Yeah, maybe poppler
<teepee>
there's pdfreader but I don't see a way to render the whole page into an image
pah has quit [Ping timeout: 268 seconds]
pah has joined #openscad
<Av8r>
Poppler is installed in my Ubuntu 22.04, not sure if by default or it came along as a dependency. pdftoppm test.pdf > test.png generated a decent image, need to check the options.
teepee_ has joined #openscad
teepee has quit [Ping timeout: 255 seconds]
teepee_ is now known as teepee
<teepee>
IIRC we used ghostscript because the command line tools did not work across platforms. the python lib might noth have that issue
<Av8r>
I like the poppler -> imagemagick method. This imagemagick link has lots of good stuff. Suggests doing a signature compare before an image compare; only do the image compare if the signature compare is different. https://imagemagick.org/Usage/compare/#methods
Vasiliy475 has quit [Ping timeout: 260 seconds]
LordOfBikes has quit [*.net *.split]
foul_owl has quit [*.net *.split]
Sauvin has quit [*.net *.split]
Scopeuk has quit [*.net *.split]
redlizard has quit [*.net *.split]
guerd871 has quit [*.net *.split]
JakeSays has quit [*.net *.split]
crazy_imp has quit [*.net *.split]
rawgreaze has quit [*.net *.split]
leptonix_ has quit [*.net *.split]
Alexer-_ has quit [*.net *.split]
rapha has quit [*.net *.split]
rvt has quit [*.net *.split]
RoyK has quit [*.net *.split]
t4nk_freenode has quit [*.net *.split]
foul_owl has joined #openscad
JakeSays has joined #openscad
leptonix_ has joined #openscad
guerd871 has joined #openscad
rvt has joined #openscad
rapha has joined #openscad
RoyK has joined #openscad
t4nk_freenode has joined #openscad
redlizard has joined #openscad
Scopeuk has joined #openscad
crazy_imp has joined #openscad
LordOfBikes has joined #openscad
rawgreaze has joined #openscad
Alexer-_ has joined #openscad
Sauvin has joined #openscad
t4nk_freenode has quit [Max SendQ exceeded]
rawgreaze has quit [Max SendQ exceeded]
rawgreaze has joined #openscad
t4nk_freenode has joined #openscad
ur5us has joined #openscad
guso78 has quit [Ping timeout: 260 seconds]
guso78 has joined #openscad
teepee has quit [Ping timeout: 255 seconds]
teepee has joined #openscad
<InPhase>
Av8r: I just ran a venv test. Poppler has additional system depenencies, requiring poppler-cpp to be preinstalled. pdf2image does not, and depends only on Pillow.
<InPhase>
I didn't do a full test, only a venv test. But if both will work, pdf2image will be the better choice for minimal system dependency introduction.
<InPhase>
I see that pdf2image.convert_from_path takes a filename and a dpi setting (for which I measured that about 600 should work).
<guso78>
i just see, that openscad has "export obj already :)
<gbruno>
[github] t-paul closed pull request #4537 (Implement ExportPdfOptions Dialog with paper selection and more (#4143, partial #649)) https://github.com/openscad/openscad/pull/4537
<guso78>
its a pity, that this model does not have color information
snaked has quit [Ping timeout: 255 seconds]
guso78 has quit [Quit: Client closed]
guso78 has joined #openscad
teepee_ has joined #openscad
teepee has quit [Remote host closed the connection]
teepee_ is now known as teepee
guso78 has quit [Ping timeout: 260 seconds]
<phryk>
i recently updated my openscad and now it immediately segfaults. last output with '--debug all' is: QSettingsCached: QSettings::setValue(): recentFileList = ''
<phryk>
i don't suppose anyone has a hunch what's causing this?
<phryk>
version is… uh…
<phryk>
2021.01.01.20221206 according to my package manager, but according to openscad -v (which works, as does --help) it's 2023.03.02
<teepee>
sounds like a broken build. that's on Linux? which distro?
<phryk>
freebsd
<teepee>
hmm, I don't know anything about those. is there an ldd command?
<phryk>
indeed there is. that showed linker info or something?
<teepee>
looks normal, seems to use qt5 and no mixup I can see
<Av8r>
It doesn't look like presently there is a mean to set options from the command line. Maybe -O, with a syntax like -D? (opt=val), and perhaps a naming convention?
<phryk>
found the culprit.
<phryk>
an environment variable i have to deal with qt weirdness. "QT_QPA_PLATFORMTHEME"
<phryk>
if i delete that var, openscad starts…
<phryk>
or not… i mean i get to the startup dialog, but if i choose a file and try to open it, it segfaults again^^
castaway has quit [Ping timeout: 255 seconds]
teepee has quit [Remote host closed the connection]
teepee has joined #openscad
<teepee>
Av8r: yes, there was no options so far, so nothing prepared on commandline yet
<teepee>
I suppose some generic option passing would make sense so we can use it later for other things too
<teepee>
phryk: sounds like maybe the freebsd openscad package needs to be recompiled to cover changes in Qt - but that's just me guessing
<phryk>
teepee: no other changes to compile time options needed?
<teepee>
I don't know how it's built, but that could just be a case where the dynamic lib changed in an incompatible way
<teepee>
if you have access to older qt5 packages you could try if those help
<teepee>
but that's probably not a permanent fix as that could break other programs built against the newer version
<teepee>
(if that's the issue at all)
<phryk>
mhh, ports and pkg repo only ever have one version of a package… rebuilding i can try tho. i have a package builder set up somewhere.^^
<teepee>
rebuilding openscad should show if binary incompatibility is the issue
<phryk>
okay, added openscad to the packages the builder manages and started a bulk build. probably gonna take an hour or something because dependencies.
Lagopus has quit [Ping timeout: 248 seconds]
* teepee
crosses fingers
<phryk>
i guess this gives me a bit of time to think about how to structure my new webframework…^^
<Av8r>
Right now the options are for exports. If it's reasonable to expect that, then relatively generic names could be used. The parser could add options temporarily to a list, then once it finds a -o option, call some format-specific list reader to translate to the appropriate options structure. Alternatively, a naming convention could required a
<Av8r>
structure-specific prefix (eg "ExpPdfOpt.PaperSize=Letter"), and immediately populate a default structure. In the former case, probably ignore (with a message to stderr) when invalid options are found.
<teepee>
hmm, I think I like the specific one a bit better as it's easier to handle
<teepee>
I'm not sure how much it helps to combine things like SVG.PaperSize and PDF.PaperSize
<Av8r>
Okay, I'll start thinking about that. Having the command line options would allow better testing.
<teepee>
I've merged the changes with updated test images for now (it did pass locally at least)
<teepee>
whew, all green :)
<Av8r>
One unrelated question, while your here: I recall a long time ago seeing a forum thread about "BoundingBox". And as I recall, the gist of it was that there could not be a bounding box function in openscad. Clearly, CSG provides a boundingBox method (that is used for positioning in the ExportPDF). I guessing the problem with implementing
<Av8r>
that function in openscad syntax is that modules can't be passed to functions. But it occurs to me that it would be possible by operating like the "children()" module, which operates on the geometry of the current scope.
<Av8r>
On the export code, thanks for doing that!
<teepee>
I'm not sure it would work with children() due to the "inside-out" execution order
<teepee>
the old probe() PR did that by magically using the first child to "probe" and then pass values to the other children