Syntax
SGfigureeval(codestr)
Input Parameter
Examples
SGfigureeval('SGofCPLcommand("c 1, h 5, g 5 21, h 7")');
Copyright 2019-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, SGfigureeval
, is designed to execute a command line and display the command in a graphical user interface, specifically within the context of the SolidGeometry library. Below is a detailed explanation of the algorithm and its parameters.
Input Parameters
- codestr: A string containing the code to be executed. This is the primary input for the function.
- varargin: Additional optional parameters that can be passed to the function. These are processed by the
getfuncparams
function.
Algorithm Steps
- The function begins by calling
getfuncparams
to process any additional parameters passed through varargin
. The result is stored in sd
.
- A persistent variable
a
is declared to store the annotation object.
- The
codestr
is modified to replace double quotes with single quotes, ensuring compatibility with MATLAB's eval
function.
- A string
textstr
is created to display the command being executed, prefixed with >>
.
- The height of the annotation box,
hl
, is initially set to 0.08. If the length of textstr
exceeds 68 characters, hl
is doubled.
- The dimensions of the annotation box are defined in
dim
.
- Any existing annotation stored in
a
is deleted, and the figure is cleared using clf
.
- An annotation is created with the specified dimensions and properties, including font size, background color, and vertical alignment.
- The previous annotation is deleted, and the command in
codestr
is executed using eval
.
- A new annotation is created to reflect the executed command.
- The function
camlightTL
is called to adjust the lighting, and shg
is used to bring the figure window to the front.
- If
sd
is false, the title of the figure is set to an empty string. Otherwise, it is set to the current date and time using datestr(now)
.
- The function
SGfigurepapermode
is called, which likely adjusts the figure for paper mode.
- The position of the current axes is adjusted to accommodate the annotation box, ensuring the plot remains visible and properly aligned.
- The axes are set to equal scaling using
axis equal
.
Algorithm explaination created using ChatGPT on 2025-08-19 01:13. (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