SGpartslistastext

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - 3D-Print/Production
Introduced first in SolidGeometry 5.2, Creation date: 2022-04-15, Last change: 2025-09-15

appends parts as text lines to a parts list and returns text lines

Description

VERY SIMILAR AS SGpartslist but based noct on cell lists but on text lines (easier to understand and use)
new parts are added by a string such as
* if there are several parts required or
if there is only one part

See Also: SGpartslist , sprintftext , SGpartsfuncparams , SGwriteMultipleSTL , SGpartslistfindproductcodes , productcode

Example Illustration

 missing image of SGpartslistastext(oldlist,addlist)

Syntax

[newlist,AParts]=SGpartslistastext(oldlist,[addlist])

Input Parameter

oldlist: parts list or empty as text string or cell list
addlist: parts list to add as as text string or cell list

Output Parameter

newlist: parts list as text list
AParts: parts list as cell list

Examples


SGpartslist([],'DIN912','DIN985','DINX'); pp=ans
SGpartslist(pp,'2 DIN912','3 DIN985','4 * DINX'); pp2=ans
SGpartslist(pp,pp2); pp3=ans
[~,b]=SGpartslist(pp,pp2)
[~,b]=SGpartslist([],b,b,b,b)




Copyright 2022-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, SGpartslistastext, is designed to append parts as text lines to a parts list and return the updated list as text lines. It is part of the SolidGeometry library and was introduced in version 5.2.

Input Parameters

  • oldlist: This is the existing parts list, which can be provided as a text string or a cell list. If it is a text string, it will be converted to a cell list using the SGpartslist function.
  • addlist: This is the list of parts to be added, provided as a text string or a cell list. It is extracted from the variable input arguments using the getfuncparams function.

Output Results

  • newlist: This is the updated parts list returned as a text list.
  • AParts: This is the updated parts list returned as a cell list.

Algorithm Steps

  1. The function begins by extracting the addlist from the variable input arguments using the getfuncparams function.
  2. It checks if oldlist is a character array (text string). If so, it converts it to a cell list using the SGpartslist function with an empty cell list as the first argument.
  3. If oldlist is already a cell list, it is directly assigned to OParts.
  4. The function then calls SGpartslist with OParts and addlist to generate the updated parts list.
  5. The outputs from SGpartslist are assigned to AParts and newlist, which are then returned as the function's outputs.

Example Usage

The function can be used to append parts to an existing list or create a new list from scratch. For example:

SGpartslist([], 'DIN912', 'DIN985', 'DINX'); % Creates a new list with these parts
pp = ans;
SGpartslist(pp, '2 DIN912', '3 DIN985', '4 * DINX'); % Appends quantities to the list
pp2 = ans;
SGpartslist(pp, pp2); % Combines lists
pp3 = ans;
[~, b] = SGpartslist(pp, pp2); % Retrieves the updated list
[~, b] = SGpartslist([], b, b, b, b); % Duplicates the list
Algorithm explaination created using ChatGPT on 2025-08-19 08:11. (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