SGTframeselectrename
by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Kinematics and Frames
Introduced first in SolidGeometry 5.1, Creation date: 2021-03-20, Last change: 2025-09-15
select frames, rename one, and remove the selected frames that were not renamed
Description
This function use usefull, if functions return several possible Frames of the same type and there is a wish afterwards to select one of those and remove the unused frames
Use it after SGTsetofRLcenter
See Also: SGTframeselect
, SGTremove
, SGTrename
, SGTsetofRLcenter
Example Illustration
Syntax
SG=SGTframeselectrename(SG,Fset,Sel,new)
Input Parameter
SG: | | Solid Geometry |
Fset: | | string selection has to start with |
Sel: | | string selection has to end with |
new: | | New Name for selection |
Output Parameter
SG: | | Solid Geoemtry with a renamed frame |
Copyright 2021-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, SGTframeselectrename, is designed to select, rename, and remove frames within a Solid Geometry (SG) object. It is particularly useful when multiple frames of the same type are returned, and there is a need to select one and remove the others.
Input Parameters
- SG: The Solid Geometry object containing frames.
- Fset: A string that specifies the starting pattern for frame selection.
- Sel: A string that specifies the ending pattern for frame selection.
- new: The new name for the selected frame. This is obtained from the function parameters or defaults to 'Selected'.
Output
- SG: The modified Solid Geometry object with the selected frame renamed and others removed.
Algorithm Steps
- Retrieve the new name for the selection using
getfuncparams.
- Select frames starting with
Fset using SGTframeselect.
- Select frames ending with
Sel using SGTframeselect with a flag for end selection.
- Identify frames to remove by finding frames that start with
Fset but do not end with Sel.
- Retrieve the names of frames to remove using
VLofT and SG.Tname.
- Identify the frame to rename by finding frames that both start with
Fset and end with Sel.
- If no frame matches the criteria for renaming, throw an error.
- Retrieve the name of the frame to rename.
- Log the renaming action using
dbprintf.
- Remove the identified frames using
SGTremove.
- Rename the selected frame using
SGTrename.
- If no output is expected, plot the SG object using
SGfigure and SGTplotalpha.
Algorithm explaination created using ChatGPT on 2025-08-19 08:05. (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