Syntax
fname=gcasnapshot([cax,fname])
Input Parameter
cax : | | axis to snap, default is gca |
fname : | | optional file name; default is desktopdir(expname) .png |
Output Parameter
Examples
SGliblogo(5)
gcasnapshot(gca)
Copyright 2020-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth
Algorithm (Workflow)
This function, gcasnapshot
, is designed to capture a snapshot of a graphical axis in MATLAB and save it as a PNG file. It is part of the Solid Geometry library and is used to document the correct assembly of mechanisms.
Input Parameters
- cax: The graphical axis (Solid Geometry) to be captured and written as an STL file.
- fname: The filename for the STL and PNG files.
Output
- fname: The filename of the generated STL file.
Algorithm Steps
- Retrieve the graphical axis (
cax
) from the input parameters using getfuncparams
. If not provided, use the current axis (gca
).
- Retrieve the filename (
fname
) from the input parameters using getfuncparams
. If not provided, use a default directory and experiment name.
- Append the
.png
extension to the filename.
- Capture the current frame of the specified axis using
getframe
and extract the image data (cdata
).
- Write the captured image data to a PNG file using
imwrite
.
- If no output is requested (
nargout==0
), read the image back using imread
and display it in a new figure window with imshow
.
- Set the name of the figure window to the filename.
- Return to the original figure window.
Example Usage
To use this function, call it with a Solid Geometry object and a desired filename:
SGwriteSTLplot(SGbox, 'test')
Algorithm explaination created using ChatGPT on 2025-08-19 00:58. (Please note: No guarantee for the correctness of this explanation)
Last html export of this page out of FM database by TL: 2025-09-21