smbSetPosition

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - SimMechanics
Introduced first in SolidGeometry 3.0, Creation date: 2016-11-13, Last change: 2025-09-14

Sets Position Size Orientation of Blocks



See Also: smbPosgcb , smbNewGridPos

Example Illustration

 missing image of smbSetPosition (BName,P,O,s)

Syntax

smbSetPosition(BName,[P,O,s])

Input Parameter

BName: Block name or gcs
P: Position
O: orientation('right','up','left','down'; default is is unchanged
s: size; default is unchanged

Examples

smbSetPosition(gcs,smbNewGridPos,'up')



Copyright 2016-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, smbSetPosition, is designed to set the position, size, and orientation of blocks in a Simulink model. It is part of the SolidGeometry library and was introduced in version 3.0.

Input Parameters

Algorithm Steps

  1. Initialize default values for position P, orientation O, and size s.
  2. Check if the user has provided a position. If so, update P with the provided value.
  3. Check if the user has provided an orientation. If so, update O with the provided value.
  4. Check if the user has provided a size. If so, update s with the provided value.
  5. If the size is not provided, calculate it based on the current block's position using get_param.
  6. If the orientation is not provided, retrieve the current orientation using get_param.
  7. Set the block's orientation using set_param with the updated or default orientation O.
  8. Set the block's position using set_param with the updated or default position P and size s.

The function is designed to be flexible, allowing users to specify only the parameters they wish to change, while leaving others unchanged.

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