SGofgca

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - SG/Solids
Introduced first in SolidGeometry 3.0, Creation date: 2016-07-05, Last change: 2025-09-14

returns the solid of the current figure

Description

This procedure can be used to write STL file of the current figure, or to print the edges of the edge list
SG.VL,
SG.FL,
SG.FEL,
SG.FC,
SG.alpha


See Also: VLFLofgca , VLofgca , PSofgca , SGofgca2subplots

Example Illustration

 missing image of SGofgca(hgca)

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

Output Results

Algorithm Steps

  1. Retrieve the axis handle using getfuncparams. If no handle is provided, use the current axis (gca).
  2. 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.
  3. Retrieve the current view angles using view.
  4. Check if the SG structure is not empty and contains a field FL. If FL is empty, set SG to an empty array.
  5. 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