Syntax
B=SGTcopyasopponent(B,A,[NA,NB])
Input Parameter
B : | | Solid to receive the frame |
A : | | Solid that sends the frame |
NA : | | Name of the Solid to copy |
NB : | | optional new Name of B |
Output Parameter
B : | | Solid that received the frame |
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 algorithm is designed to copy a frame from one solid (A) to another solid (B) in a kinematic and frame context. It is part of the SolidGeometry library and is used to manage frames that cross surfaces.
Input Parameters
- B: The solid that will receive the frame.
- A: The solid that sends the frame.
- NA: The name of the frame in solid A to be copied.
- NB: (Optional) The new name for the frame in solid B.
Output
- B: The solid that has received the frame.
Algorithm Steps
- Retrieve the frame name
NA
from the input parameters using getfuncparams
.
- If
NB
is not provided, set it to NA
.
- Select the frame from solid A using
SGTframeselect
with the name NA
.
- Check if the frame selection is empty. If so, throw an error indicating no frame was found.
- Loop through each frame index found in
fs
:
- Retrieve the frame name
Ni
from solid A.
- Get the transformation
Ti
of the frame using SGTget
.
- If
Ti
is empty, throw an error indicating the frame was not found.
- Calculate the transformation
TB
for solid B using TofcrossedSG
.
- Replace the name
Ni
with NB
using strrepn
.
- Set the frame in solid B using
SGTset
.
- If no output is expected (
nargout==0
), plot the frames:
- Use
SGfigure
to set up the plot.
- Plot solid A with transparency using
SGplotalpha
.
- Plot solid B with transparency using
SGplotalpha
.
- Select frames from solid B using
SGTframeselect
with the name NB
.
- Loop through each frame and plot it using
SGTframeplot
.
Algorithm explaination created using ChatGPT on 2025-08-19 01:35. (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