Let grd2xyz option -T write STL output file#5955
Merged
PaulWessel merged 19 commits intomasterfrom Nov 6, 2021
Merged
Conversation
These are used by 3-D printers.
joa-quim
approved these changes
Nov 6, 2021
Contributor
|
Very interesting. Have not studied the man-page or anything yet, but should this work?: Maybe due to need of having input in projected units, so tried: |
Member
Author
|
Oops, had a dumb bug where I wrote n_columns when I meant n_rows, so it crashed the first time someone tried a case where n_rows < n_cols... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
STL is the format used by 3-D printers. This PR simply implements a new -T[b] option in grd2xyz that represents the grid in the form of a triangularized 3-D body by enclosing the surface triangulation with the four sides and base to make an enclosed volume. We can either write an ASCII or binary representation, as explained in the STL documentation. With the help of a UH colleague who has a 3D printer I have implemented, debugged, and tested this option and I think it is stable enough to be included in 6.3. Below is an example of a quick-and-dirty 3D print from my colleague using the GMT-produced STL which apparently worked much better than Matlab (the full-resolution version will take 48 hours to print, apparently). I have added this figure to the grd2xyz documentation:
Because this is just an isolated option in one module, all tests pass and there are no potential issues. At the moment, there is no virtual file used to write this printer-specific data so that calling it from the externals will require sending output to a file. I doubt anyone in the externals would need to capture this in memory, e.g.
STL = gmt.grd2xyz (some grid, STL=binary);but if so we can implement that later.