SGfigureeval

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - User interface
Introduced first in SolidGeometry 4.7, Creation date: 2019-06-16, Last change: 2025-09-14

executes a command line and echos the command in SGfigure



See Also: , SGfigurepapermode

Example Illustration

 missing image of SGfigureeval(codestr)

Syntax

SGfigureeval(codestr)

Input Parameter

codestr: code to execute

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

Algorithm Steps

  1. The function begins by calling getfuncparams to process any additional parameters passed through varargin. The result is stored in sd.
  2. A persistent variable a is declared to store the annotation object.
  3. The codestr is modified to replace double quotes with single quotes, ensuring compatibility with MATLAB's eval function.
  4. A string textstr is created to display the command being executed, prefixed with >>.
  5. The height of the annotation box, hl, is initially set to 0.08. If the length of textstr exceeds 68 characters, hl is doubled.
  6. The dimensions of the annotation box are defined in dim.
  7. Any existing annotation stored in a is deleted, and the figure is cleared using clf.
  8. An annotation is created with the specified dimensions and properties, including font size, background color, and vertical alignment.
  9. The previous annotation is deleted, and the command in codestr is executed using eval.
  10. A new annotation is created to reflect the executed command.
  11. The function camlightTL is called to adjust the lighting, and shg is used to bring the figure window to the front.
  12. 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).
  13. The function SGfigurepapermode is called, which likely adjusts the figure for paper mode.
  14. The position of the current axes is adjusted to accommodate the annotation box, ensuring the plot remains visible and properly aligned.
  15. 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