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
[newlist,AParts]=SGpartslistastext(oldlist,[addlist])
oldlist: | parts list or empty as text string or cell list | |
addlist: | parts list to add as as text string or cell list |
newlist: | parts list as text list | |
AParts: | parts list as cell list |
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)
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.
SGpartslist function.getfuncparams function.addlist from the variable input arguments using the getfuncparams function.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.oldlist is already a cell list, it is directly assigned to OParts.SGpartslist with OParts and addlist to generate the updated parts list.SGpartslist are assigned to AParts and newlist, which are then returned as the function's outputs.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 listAlgorithm explaination created using ChatGPT on 2025-08-19 08:11. (Please note: No guarantee for the correctness of this explanation)