Syntax
SG=SGofgca([hgca])
Input Parameter
hgca : | | optional axis handle |
Output Parameter
SG : | | Solid Geometry of the patches/facets of the current figure |
Examples
save the current figure as STL-File
[VL,FL,FEL]=VLFLofgca;
VLFLwriteSTL(VL,FL);
VLELplots (VL,FEL,'k',1)
Copyright 2016-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, SGofgca
, is designed to extract the solid geometry of the current figure in MATLAB. It can be used to write an STL file of the current figure or to print the edges of the edge list. The function is part of the SolidGeometry library and was introduced in version 3.0.
Input Parameters
- hgca: An optional axis handle. If not provided, the current axis is used by default.
Output Results
- SG: A structure containing the solid geometry of the patches/facets of the current figure. It includes the following fields:
- SG.VL: Vertex list.
- SG.FL: Face list.
- SG.FEL: Face edge list.
- SG.FC: Face colors.
- SG.alpha: Transparency (alpha) values.
Algorithm Steps
- Retrieve the axis handle using
getfuncparams
. If no handle is provided, use the current axis (gca
).
- Call
VLFLofgca
with the axis handle to obtain the vertex list, face list, face edge list, face colors, and alpha values, and store them in the SG
structure.
- Retrieve the current view angles using
view
.
- Check if the
SG
structure is not empty and contains a field FL
. If FL
is empty, set SG
to an empty array.
- If no output is requested (
nargout==0
), perform the following:
- Store the current figure handle.
- Create a new figure with a random identifier.
- Call
SGtitle
to set the title of the figure.
- Set the view to a predefined angle (-30, 30).
- Plot the solid geometry with transparency using
SGplotalpha
.
- Restore the original view angles.
- Return to the original figure.
Algorithm explaination created using ChatGPT on 2025-08-19 00:55. (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