SGTrename

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Kinematics and Frames
Introduced first in SolidGeometry 5.0, Creation date: 2020-09-06, Last change: 2025-09-14

renames a frame of a solid geometry



See Also: SGTremove , SGTset , SGTget , SGTsetofFS

Example Illustration

 missing image of SGTrename(SG,Norg,Nnew,rm);

Syntax

SG=SGTrename(SG,Norg,Nnew,[rm]);

Input Parameter

SG: Solid geometry
Norg: Original name
Nnew: New name
rm: if true; existing frame Nnew is deleted first; default is false

Output Parameter

SG: Solid geometry with changed frame name

Examples


B=SGbox
B=SGTrename(B,'B','C')
B=SGTrename(B,'C','B')
B=SGTrename(B,'B','F')
B=SGTrename(B,'B','F',true)




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, SGTrename, is designed to rename a frame within a solid geometry object. It is part of the SG-Library and was introduced in SolidGeometry 5.0.

Input Parameters

Output

Algorithm Steps

  1. Retrieve the rm parameter using getfuncparams. If not provided, default to false.
  2. Find the index of the frame with the name Nnew in SG.Tname.
  3. Find the index of the frame with the name Norg in SG.Tname. If not found, throw an error indicating the frame does not exist.
  4. Check if a frame with the name Nnew already exists:
  5. Rename the frame by updating SG.Tname at the index of Norg to Nnew.
  6. If no output is requested (nargout==0), plot the solid geometry using SGfigure and SGTplotalpha.

Example Usage

The function can be used as follows:

B = SGbox;
B = SGTrename(B, 'B', 'C');
B = SGTrename(B, 'C', 'B');
B = SGTrename(B, 'B', 'F');
B = SGTrename(B, 'B', 'F', true);

In these examples, a solid geometry object B is created and its frame names are changed using SGTrename.

Algorithm explaination created using ChatGPT on 2025-08-19 01:20. (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