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

PNG, SVG or Both in Documentation? #27

Closed
jmwright opened this issue Apr 21, 2024 · 5 comments
Closed

PNG, SVG or Both in Documentation? #27

jmwright opened this issue Apr 21, 2024 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@jmwright
Copy link
Contributor

During the hackathon we were limited to SVG output (outlines and hidden lines only). After seeing the renders on the field dissection microscope (a variant of the OpenFlexure microscope) on Experiment.com, I developed a Gist that provides a method of outputting similar PNG renders from CadQuery.

I have two questions:

  1. Do we want to incorporate PNG export in the auto-documentation?
  2. If so, how do we want to incorporate it?

We could use a mix of SVG and PNG depending on the situation (SVG for views where hidden lines need to be seen, or with exploded views listing the parts). We could also just decide to use one or the other.

The Gist I provided above is not complete (no camera or image size control), but I can push it forward and work on getting it integrated into CadQuery if there is interest.

@jmwright jmwright added the enhancement New feature or request label Apr 21, 2024
@jmwright jmwright self-assigned this Apr 21, 2024
@julianstirling
Copy link
Collaborator

While I think that SVG should be universal, I have seen more website viewing issues with SVG, so I think PNG is great.

I don't understand the technicalities enough about the hidden lines. Is there a reason the means that hidden lines will be seen differently if we choose PNG over SVG? If so, do you have and example of the differences?

@jmwright
Copy link
Contributor Author

@julianstirling I'm using the VTK library that OpenCASCADE is usually paired with to export the PNG images, and I haven't seen anything that would allow hidden lines to be included in those renders. So the rendering of the PNG will only show the outside faces of the object (at least for now), whereas with SVG export I can request to see hidden interior lines. However, the SVG export won't show shaded faces the way the PNG images will, so there are pros and cons to each type of export.

Hidden line example in SVG: https://codeberg.org/7BIndustries/poc-stereoscope/raw/branch/main/docs/images/stereoscope_center_piece_with_screws_in_assembly_exploded_annotated_side_view.svg

The PNG exports will look similar to your dissection microscope images I linked above.

@jmwright
Copy link
Contributor Author

I generated a few sample images in both PNG and SVG format to help illustrate the differences. I got the views as close as I could, but the camera settings between the PNG and SVG renderers are not 1-to-1. The renders are of a simple assembly with two cubes in it, and the camera is set to Y-up in the exports because that is the default with SVG. The PNG export Gist has been updated with both camera and image size control (as well as a parallel projection toggle).

SVG with Hidden Lines

sample

SVG without Hidden Lines

sample_no_hidden

PNG

sample

Screenshot of Assembly from CQ-editor for Reference

Screenshot from 2024-04-22 11-21-48

@drayde
Copy link
Contributor

drayde commented Apr 22, 2024

I vote for having both options :-)

@jmwright
Copy link
Contributor Author

jmwright commented May 1, 2024

I think this question has been answered, and the work is being tracked in #34 . Closing.

@jmwright jmwright closed this as completed May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants