Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option: Export to PLY for HR prints #276

Merged
merged 5 commits into from
Oct 20, 2020

Conversation

DRracer
Copy link
Collaborator

@DRracer DRracer commented Oct 19, 2020

Description

This is a proof of concept how to "save" the virtual prints for later examination/sharing.
I was looking for the simplest file format which would retain the necessary properties.
PLY looked like a good option supporting triangles, vertex normals and triangle/vertex colors.

The Export is available through context menu 3DVisuals->ExportPLY

Behaviour/ Breaking changes

This option shouldn't break any existing functionality, it adds a new option under context menu.

Have you tested the changes?

Yes, did one print, exported the intermediate results multiple times into a PLY file and loaded it with MeshLab.
MeshLab looks like a good option for loading PLY, it understands even the vertex normals (must be switched on after loading the model).

Other

@vintagepc please have a look at it and please feel free to improve the code to fit into the UI better if necessary.

Linked issues:

n/a

D.R.racer added 4 commits October 6, 2020 17:41
+avoid using std::vector when not necessary (replace with std::array)

Constants VectorPrealoc and VectorPrealoc3 serve as initial preallocated
size of the vectors, may be fine tuned for balanced usage of RAM
This is a proof of concept how to "save" the virtual prints for later examination/sharing.
I was looking for the simplest file format which would retain the necessary properties.
PLY looked like a good option supporting triangles, vertex normals and triangle/vertex colors.
@DRracer DRracer requested a review from vintagepc October 19, 2020 16:59
@DRracer DRracer marked this pull request as draft October 19, 2020 16:59
@codecov-io
Copy link

codecov-io commented Oct 19, 2020

Codecov Report

Merging #276 into master will decrease coverage by 0.78%.
The diff coverage is 3.70%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #276      +/-   ##
==========================================
- Coverage   88.55%   87.76%   -0.79%     
==========================================
  Files         137      138       +1     
  Lines        6290     6344      +54     
==========================================
- Hits         5570     5568       -2     
- Misses        720      776      +56     
Impacted Files Coverage Δ
utility/GLPrint.cpp 95.71% <0.00%> (-0.76%) ⬇️
utility/GLPrint.h 60.00% <ø> (ø)
utility/MK3SGL.h 100.00% <ø> (ø)
utility/PLYExport.cpp 0.00% <0.00%> (ø)
utility/MK3SGL.cpp 88.22% <25.00%> (-1.03%) ⬇️
utility/MK3S_Bear.h 60.00% <0.00%> (-40.00%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 27dabcb...672c0ee. Read the comment docs.

@vintagepc
Copy link
Owner

I'm surprised this hasn't cropped up as a feature request sooner 😛

I'll take a peek later this afternoon. I have some thoughts for improvements. There's no great way to do a "prompt for user input on demand" with freeglut, but if we tag this as a scriptable then one could easily set the output filename if --terminal is enabled.

@DRracer
Copy link
Collaborator Author

DRracer commented Oct 19, 2020

... it has appeared shortly after the HR visualization, but we didn't want to overwhelm you with feature requests :) .
Setting a filename via cmdline or terminal is probably enough, one usually does one print to analyze and then quits the sim.

@vintagepc
Copy link
Owner

That's true, though I could see a use case for it both in automated testing and if one wants to save midway to snapshot a particular layer that is later going to be covered.

@DRracer
Copy link
Collaborator Author

DRracer commented Oct 19, 2020

I completely agree, using the export for automated testing is another interesting idea - it would be more stable than relying on GL renderings.

@vintagepc
Copy link
Owner

Surprisingly the renderings themselves are quite stable; just not portable. The only issue I've encountered is that I think the Github servers get overloaded and things go south. I'm seeing a trend where I have no issues with tests on PRs that I push in the morning but as the day goes on things get progressively slower until they start timing out.

utility/PLYExport.cpp Outdated Show resolved Hide resolved
utility/PLYExport.cpp Outdated Show resolved Hide resolved
@vintagepc
Copy link
Owner

vintagepc commented Oct 20, 2020

Just pushed some changes:

  • Cleanup, filename support in scripting/terminal
  • Fix export if --colour-extrusion is off
  • Return actual export result (timeout or finished)
  • Add PLY to test prints for comparison.
  • Made exporter static
  • Added the usual file header preamble.
  • Fixed lint complaints

@DRracer
Copy link
Collaborator Author

DRracer commented Oct 20, 2020

Oh, you just did the fixes ... I was trying to push mine :) . No problem...

@vintagepc
Copy link
Owner

Yeah, those weren't "Fix this" comments, more just "FYIs" or making sure I hadn't missed a subtlety about the exporting.

@vintagepc vintagepc marked this pull request as ready for review October 20, 2020 16:41
@vintagepc
Copy link
Owner

vintagepc commented Oct 20, 2020

Damn random test timeouts... Anyway, I'll merge this once they go through and the test coverage bot is satisfied 😉

@vintagepc vintagepc added this to the v1.1 milestone Oct 20, 2020
@vintagepc vintagepc merged commit ebfd173 into vintagepc:master Oct 20, 2020
@vintagepc
Copy link
Owner

Merged. Thanks for the contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants