smbAddBlock

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

Auxiliary fnct to create Block for Simulink/SimScape



See Also: smbAddLine , smbAddFrame , smbAddFrameSensor

Example Illustration

 missing image of smbAddBlock (SysName,BlockName,LibPath,BlockExt)

Syntax

smbAddBlock([SysName,BlockName,LibPath,BlockExt])

Input Parameter

SysName: System Name; default is gcs
BlockName: Block name
LibPath: Library path
BlockExt: optional Block extension]

Examples


smbAddBlock('','SINUS','simulink/Sources/Sine Wave')




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, smbAddBlock, is designed to add a block to a Simulink or SimScape model. It is part of the SolidGeometry library and was introduced in version 3.1. The function takes up to four input parameters, which are used to specify the details of the block to be added.

Input Parameters

Algorithm Steps

  1. Initialize SysName to the current system (gcs) unless a different system name is provided as the first argument.
  2. Set BlockName to 'testblock' unless a different block name is provided as the second argument.
  3. Set LibPath to 'simulink/Continuous/Derivative' unless a different library path is provided as the third argument.
  4. Set BlockExt to an empty string unless a different block extension is provided as the fourth argument.
  5. Construct the full block name BName by concatenating SysName and BlockName with a '/' separator.
  6. Add the block to the system using the add_block function, specifying the library path and the full block name with the optional extension.
  7. Set the position of the newly added block using the smbSetPosition function.
  8. If there is an output argument, open the system in a tabbed view using open_system.
Algorithm explaination created using ChatGPT on 2025-08-19 01:25. (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