Last change of this documentation page: 2025-12-01 of SolidGeometry 5.6
chatas(chatname,message)- communicates with an openAI in a named chat based on a thread and assistant

chatas(chatname,message)% chatas(chatname,message) - communicates with an openAI in a named chat based on a thread and assistant
% (by Tim Lueth, SG-Lib, 2025-NOV-29 as class: ARTIFICIAL INTELLIGENCE)
%
% USE CAREFULLY: chatas was not being tested extensively
%
% The AssistantV2 and the thread are stored in an environment variable using
% openAIsetCHATenvironment, so that the chat can be stopped and continued on
% another computer at a different time, as long as the Assistant ID and Thread ID
% are known. Tim Lueth stores these in his "workdir" on a mobile hard drive, so
% that he can always activate the chat with the hard drive.
% This fnctn uses the name to identify and load the environment files created by
% openAIsetCHATenvironment (Status of: 2025-11-29)
%
% Introduced first in SolidGeometry 5.6
%
% See also: openAIsetCHATenvironment
%
% chatas([chatname,message])
% === INPUT PARAMETERS ===
% chatname: chatname
% message: message to the chat (assistant / thread)
%
% EXAMPLE:
% chatas SG womit erzeuge ich eine SG aus einer CPL durch extrusion in einer achse. Kann ich dabei kanten abrunden?
%
% See also: openAIsetCHATenvironment
%
%
% Copyright 2025 Tim C. Lueth

openAIsetCHATenvironment(Name,asstID,threadID)- sets environment variables for chats using Assistant V2 (Thread and Assistant)

openAIsetCHATenvironment(Name,asstID,threadID)% openAIsetCHATenvironment(Name,asstID,threadID) - sets environment variables for chats using Assistant V2 (Thread and Assistant)
% (by Tim Lueth, SG-Lib, 2025-NOV-29 as class: ARTIFICIAL INTELLIGENCE)
%
% USE CAREFULLY: openAIsetCHATenvironment was not being tested extensively
%
% SG-Lib solution for archiving the environment ids of chats in the workdir to
% call workdir(pwd) first (Status of: 2025-11-29)
%
% Introduced first in SolidGeometry 5.6
%
% See also: workdir
%
% EnvNam=openAIsetCHATenvironment(Name,asstID,threadID)
% === INPUT PARAMETERS ===
% Name: Name of Chat - Such as SG' - No spaces allowed, upper case
% asstID: assistant ID for the chat
% threadID: thread ID for the chat
% === OUTPUT RESULTS ======
% EnvNam: Environment to load
%
% EXAMPLE:
% openAIsetCHATenvironment('SG','asst_SlvhXemU8Jhw9m6CAIWZ9tTK','thread_zpkJIFeTvt9CZPIGlb5D4qp1')
% loadenv('OPENAICHAT_SG_ID.env')
% getenv('OPENAICHAT_SG_IDA')
% getenv('OPENAICHAT_SG_IDT')
%
% See also: workdir
%
%
% Copyright 2025 Tim C. Lueth

openAIsetAssistantInstructions(assID,newinstr)- renames an existing Assistant V2 with a new Name (CURL POST version)

openAIsetAssistantInstructions(assID,newinstr)% openAIsetAssistantInstructions(assID,newinstr) - renames an existing Assistant V2 with a new Name (CURL POST version)
% (by Tim Lueth & ChatGPT, SG-Lib, 2025-NOV-29 as class: ARTIFICIAL INTELLIGENCE)
%
% USE CAREFULLY: openAIsetAssistantInstructions was not being tested extensively
%
% Introduced first in SolidGeometry 5.6
%
% See also: openAIsetAssistantName, openAIsetVectorstoreName
%
% result=openAIsetAssistantInstructions(assID,newinstr)
% === INPUT PARAMETERS ===
% assID: Assistant ID
% newinstr: new inatructions for Assistant
% === OUTPUT RESULTS ======
% result: JSON result struct
%
% See also: openAIsetAssistantName, openAIsetVectorstoreName
%
%
% Copyright 2025 Tim C. Lueth

openAIgetThreadRuns(thrID)- Returns all runs of a given thread (Assistant v2, curl, macOS).

openAIgetThreadRuns(thrID)% openAIgetThreadRuns(thrID) - Returns all runs of a given thread (Assistant v2, curl, macOS).
% (by Tim Lueth & ChatGPT, SG-Lib, 2025-NOV-28 as class: ARTIFICIAL INTELLIGENCE)
%
% USE CAREFULLY: openAIgetThreadRuns was not being tested extensively
%
% Introduced first in SolidGeometry 5.6
%
% See also: openAIwaitForRunCurl, openAIstartRunCurl, openAIgetRunStatusCurl,
% openAIcreateThreadCurl
%
% [resp,data,use,tok]=openAIgetThreadRuns(thrID)
% === INPUT PARAMETERS ===
% thrID: Thread ID
% === OUTPUT RESULTS ======
% resp: JSON decoded struct of all RUNS
% data: data of resp
% use: usage of data
% tok: sum of all tokens of all runs
%
% EXAMPLE:
% [a,b,c,d]=openAIgetThreadRuns('thread_zpkJIFeTvt9CZPIGlb5D4qp1')
%
% See also: openAIwaitForRunCurl, openAIstartRunCurl, openAIgetRunStatusCurl,
% openAIcreateThreadCurl
%
%
% Copyright 2025 Tim C. Lueth

openAIdeleteThreadCurl(thread_id)- deletes a thread for security reasons as threads cannot be accessed if by user throught the API if the thread id is lost

openAIdeleteThreadCurl(thread_id)% openAIdeleteThreadCurl(thread_id) - deletes a thread for security reasons as threads cannot be accessed if by user throught the API if the thread id is lost
% (by Tim Lueth & ChatGPT, SG-Lib, 2025-NOV-28 as class: ARTIFICIAL INTELLIGENCE)
%
% USE CAREFULLY: openAIdeleteThreadCurl was not being tested extensively
%
% deletes a thread for security reasons as threads cannot be accessed or found if
% by user throught the API if the thread id has been lost (Status of: 2025-11-28)
%
% Introduced first in SolidGeometry 5.6
%
% See also: openAIcreateThreadCurl, OpenAIlogID, openAIdeleteuploadedFile,
% openAIdeleteFileFromVectorStoreCurl, openAIDeleteAssistantCurl,
% openAIdeleteVectorstore
%
% resp=openAIdeleteThreadCurl(thread_id)
% === INPUT PARAMETERS ===
% thread_id: thread id must be logged by OpenAIlogID as in
% === OUTPUT RESULTS ======
% resp:
%
% See also: openAIcreateThreadCurl, OpenAIlogID, openAIdeleteuploadedFile,
% openAIdeleteFileFromVectorStoreCurl, openAIDeleteAssistantCurl,
% openAIdeleteVectorstore
%
%
% Copyright 2025 Tim C. Lueth

openAIsetVectorstoreName(vector_store_id,new_name)- renames an existing Vectore-Store with a new Name (CURL POST version)

openAIsetVectorstoreName(vector_store_id,new_name)% openAIsetVectorstoreName(vector_store_id,new_name) - renames an existing Vectore-Store with a new Name (CURL POST version)
% (by Tim Lueth & ChatGPT, SG-Lib, 2025-NOV-28 as class: ARTIFICIAL INTELLIGENCE)
%
% USE CAREFULLY: openAIsetVectorstoreName was not being tested extensively
%
% Introduced first in SolidGeometry 5.6
%
% See also: openAIsetAssistantName
%
% resp=openAIsetVectorstoreName(vector_store_id,new_name)
% === INPUT PARAMETERS ===
% vector_store_id: Vectore-Store ID
% new_name: new name for Vectore-Store
% === OUTPUT RESULTS ======
% resp: JSON result struct
%
% See also: openAIsetAssistantName
%
%
% Copyright 2025 Tim C. Lueth

openAIsetAssistantName(assID,newName)- renames an existing Assistant V2 with a new Name (CURL POST version)

openAIsetAssistantName(assID,newName)% openAIsetAssistantName(assID,newName) - renames an existing Assistant V2 with a new Name (CURL POST version)
% (by Tim Lueth & ChatGPT, SG-Lib, 2025-NOV-28 as class: ARTIFICIAL INTELLIGENCE)
%
% USE CAREFULLY: openAIsetAssistantName was not being tested extensively
%
% Introduced first in SolidGeometry 5.6
%
% See also: openAIsetAssistantName, openAIsetAssistantInstructions,
% openAIsetVectorstoreName
%
% resp=openAIsetAssistantName(assID,newName)
% === INPUT PARAMETERS ===
% assID: Assistant ID
% newName: new name for Assistant
% === OUTPUT RESULTS ======
% resp: JSON result struct
%
% See also: openAIsetAssistantName, openAIsetAssistantInstructions,
% openAIsetVectorstoreName
%
%
% Copyright 2025 Tim C. Lueth

openAIgetInfo- prints a list of uploaded files, vectore-stores, assistants. Threads are hidden by the API in general

openAIgetInfo% openAIgetInfo - prints a list of uploaded files, vectore-stores, assistants. Threads are hidden by the API in general
% (by Tim Lueth, SG-Lib, 2025-NOV-28 as class: ARTIFICIAL INTELLIGENCE)
%
% USE CAREFULLY: openAIgetInfo was not being tested extensively
%
% Introduced first in SolidGeometry 5.6
%
% See also: openAIgetuploadedFiles, openAIgetVectorstores, openAIgetAssistantsCurl
%
% openAIgetInfo
%
% EXAMPLE:
% openAIgetInfo % plots the structure
%
% See also: openAIgetuploadedFiles, openAIgetVectorstores, openAIgetAssistantsCurl
%
%
% Copyright 2025 Tim C. Lueth

openAIdatestr(createdAI)- convertes the openAI date format into datenum into datestr (GMT)

openAIdatestr(createdAI)% openAIdatestr(createdAI) - convertes the openAI date format into datenum into datestr (GMT)
% (by Tim Lueth, SG-Lib, 2025-NOV-27 as class: ARTIFICIAL INTELLIGENCE)
%
% USE CAREFULLY: openAIdatestr was not being tested extensively
%
% Introduced first in SolidGeometry 5.6
%
% See also: OpenAIlogID
%
% ds=openAIdatestr(createdAI)
% === INPUT PARAMETERS ===
% createdAI: datenum of openAI (posix format)
% === OUTPUT RESULTS ======
% ds: datestring
%
% See also: OpenAIlogID
%
%
% Copyright 2025 Tim C. Lueth

OpenAIlogID(ID,desc)- records locally the ids of openAI structures which are not recorded anywhere, such as thread-IDs. Required to delete threads

OpenAIlogID(ID,desc)% OpenAIlogID(ID,desc) - records locally the ids of openAI structures which are not recorded anywhere, such as thread-IDs. Required to delete threads
% (by Tim Lueth, SG-Lib, 2025-NOV-27 as class: ARTIFICIAL INTELLIGENCE)
%
% USE CAREFULLY: OpenAIlogID was not being tested extensively
%
% OpenAIlogID can also be called with show or "thre" or "ass" or "run" to get
% "vs" threads, assistant, runs, vectores stores that were logged (Status of:
% 2025-11-27)
%
% Introduced first in SolidGeometry 5.6
%
% See also: openAIcreateThreadCurl
%
% ccc=OpenAIlogID([ID,desc])
% === INPUT PARAMETERS ===
% ID: ID of openAI files, vectorstores, assistant, threads, messages etc.
% desc: description, optionally
% === OUTPUT RESULTS ======
% ccc: content of fname=[workdir filesep 'openAI-' username '-IDs.txt']
%
%
% EXAMPLE:
% openAIOpenAIlogID('vs-xxxxxxx','Vectore store for Assistant') % log a vector sotre
% openAIOpenAIlogID show % shows the log file
% openAIOpenAIlogID ass % shows only the assistants of the log file
%
%
% See also: openAIcreateThreadCurl
%
%
% Copyright 2025 Tim C. Lueth

openAIgetMessagesCurl(thread_id)- returns the answer of an assistant's thread's message/question

openAIgetMessagesCurl(thread_id)% openAIgetMessagesCurl(thread_id) - returns the answer of an assistant's thread's message/question
% (by Tim Lueth & ChatGPT, SG-Lib, 2025-NOV-27 as class: ARTIFICIAL INTELLIGENCE)
%
% USE CAREFULLY: openAIgetMessagesCurl was not being tested extensively
%
% Introduced first in SolidGeometry 5.6
%
% answer=openAIgetMessagesCurl(thread_id)
% === INPUT PARAMETERS ===
% thread_id: thread id, independent on which agent responded to the question
% === OUTPUT RESULTS ======
% answer:
%
%
% Copyright 2025 Tim C. Lueth

openAIgetAssistantInfo(assistant_id)- returns the relevant inforation corresponding to an assistant ID

openAIgetAssistantInfo(assistant_id)% openAIgetAssistantInfo(assistant_id) - returns the relevant inforation corresponding to an assistant ID
% (by Tim Lueth & ChatGPT, SG-Lib, 2025-NOV-27 as class: ARTIFICIAL INTELLIGENCE)
%
% USE CAREFULLY: openAIgetAssistantInfo was not being tested extensively
%
% Introduced first in SolidGeometry 5.6
%
% resp=openAIgetAssistantInfo(assistant_id)
% === INPUT PARAMETERS ===
% assistant_id: assistant ID
% === OUTPUT RESULTS ======
% resp: JSON response struct
%
%
% Copyright 2025 Tim C. Lueth

openAIaddMessageCurl(thread_id,text)- adds a "message" to a recently created "thread"

openAIaddMessageCurl(thread_id,text)% openAIaddMessageCurl(thread_id,text) - adds a "message" to a recently created "thread"
% (by Tim Lueth & ChatGPT, SG-Lib, 2025-NOV-27 as class: ARTIFICIAL INTELLIGENCE)
%
% USE CAREFULLY: openAIaddMessageCurl was not being tested extensively
%
% Introduced first in SolidGeometry 5.6
%
% resp=openAIaddMessageCurl(thread_id,text)
% === INPUT PARAMETERS ===
% thread_id: thrad/chat ID
% text: Question/Message in the Chat
% === OUTPUT RESULTS ======
% resp: JSON response struct
%
%
% Copyright 2025 Tim C. Lueth

openAIgetRunStatusCurl(thrID,runID)- returns the status for a "thread" "run"

openAIgetRunStatusCurl(thrID,runID)% openAIgetRunStatusCurl(thrID,runID) - returns the status for a "thread" "run"
% (by Tim Lueth & ChatGPT, SG-Lib, 2025-NOV-27 as class: ARTIFICIAL INTELLIGENCE)
%
% USE CAREFULLY: openAIgetRunStatusCurl was not being tested extensively
%
% Introduced first in SolidGeometry 5.6
%
% See also: openAIwaitForRunCurl, openAIstartRunCurl
%
% resp=openAIgetRunStatusCurl(thrID,runID)
% === INPUT PARAMETERS ===
% thrID: Thread ID
% runID: Run ID
% === OUTPUT RESULTS ======
% resp: JSON response struct
%
% See also: openAIwaitForRunCurl, openAIstartRunCurl
%
%
% Copyright 2025 Tim C. Lueth

openAIwaitForRunCurl(thrid,runid)- uses openAIgetRunStatusCurl to wait for a thread run

openAIwaitForRunCurl(thrid,runid)% openAIwaitForRunCurl(thrid,runid) - uses openAIgetRunStatusCurl to wait for a thread run
% (by Tim Lueth & ChatGPT, SG-Lib, 2025-NOV-27 as class: ARTIFICIAL INTELLIGENCE)
%
% USE CAREFULLY: openAIwaitForRunCurl was not being tested extensively
%
% Introduced first in SolidGeometry 5.6
%
% See also: openAIgetRunStatusCurl, openAIstartRunCurl
%
% resp=openAIwaitForRunCurl(thrid,runid)
% === INPUT PARAMETERS ===
% thrid: Thread ID
% runid: Run ID
% === OUTPUT RESULTS ======
% resp: JSON response struct
%
% See also: openAIgetRunStatusCurl, openAIstartRunCurl
%
%
% Copyright 2025 Tim C. Lueth

openAIstartRunCurl(thrID,assID)- Starts an "assistant" "run" for a "thread"

openAIstartRunCurl(thrID,assID)% openAIstartRunCurl(thrID,assID) - Starts an "assistant" "run" for a "thread"
% (by Tim Lueth & ChatGPT, SG-Lib, 2025-NOV-27 as class: ARTIFICIAL INTELLIGENCE)
%
% USE CAREFULLY: openAIstartRunCurl was not being tested extensively
%
% 1st create an vector-store with documents for file-search
% 2nd create an empty thread (chat) to prepare a message
% 3rd send a message to the thread
% 4th let an assistant run using the vector-store to create an answer. Works as
% batch (Status of: 2025-11-27)
%
% Introduced first in SolidGeometry 5.6
%
% See also: openAIgetRunStatusCurl, openAIwaitForRunCurl
%
% runID=openAIstartRunCurl(thrID,assID)
% === INPUT PARAMETERS ===
% thrID: Thread ID
% assID: Assistant ID
% === OUTPUT RESULTS ======
% runID: Run ID
%
% See also: openAIgetRunStatusCurl, openAIwaitForRunCurl
%
%
% Copyright 2025 Tim C. Lueth

openAIcreateThreadCurl- creates an empty "thread" for a "message" and an "Assistant V2" (CURL version)

openAIcreateThreadCurl% openAIcreateThreadCurl - creates an empty "thread" for a "message" and an "Assistant V2" (CURL version)
% (by Tim Lueth & ChatGPT, SG-Lib, 2025-NOV-27 as class: ARTIFICIAL INTELLIGENCE)
%
% USE CAREFULLY: openAIcreateThreadCurl was not being tested extensively
%
% Introduced first in SolidGeometry 5.6
%
% See also: openAIgetThreadCurl, openAIdeleteThreadCurl
%
% thrID=openAIcreateThreadCurl
% === OUTPUT RESULTS ======
% thrID: Thread ID of an empty thread
%
% EXAMPLE:
% thrID=openAIcreateThreadCurl
%
% See also: openAIgetThreadCurl, openAIdeleteThreadCurl
%
%
% Copyright 2025 Tim C. Lueth

openAIgetAssistantsCurl- shows all assistants of your API Key (CURL version)

openAIgetAssistantsCurl% openAIgetAssistantsCurl - shows all assistants of your API Key (CURL version)
% (by Tim Lueth & ChatGPT, SG-Lib, 2025-NOV-27 as class: ARTIFICIAL INTELLIGENCE)
%
% USE CAREFULLY: openAIgetAssistantsCurl was not being tested extensively
%
% helpful to delete old agents, to protect IP from less friendly people (Status
% of: 2025-11-27)
%
% Introduced first in SolidGeometry 5.6
%
% See also: openAIcreateAssistantCurl, openAIDeleteAssistantCurl,
% openAIresetAssistantCurl
%
% [names,ids,resp]=openAIgetAssistantsCurl
% === OUTPUT RESULTS ======
% names: list of names
% ids: list of IDs
% resp: JSON struct
%
% EXAMPLE:
% [a,b,c]=openAIgetAssistantsCurl
%
% See also: openAIcreateAssistantCurl, openAIDeleteAssistantCurl,
% openAIresetAssistantCurl
%
%
% Copyright 2025 Tim C. Lueth

openAIcreateAssistantCurl(vectID,instr)- creates an openAI V2 assistant with CURL

openAIcreateAssistantCurl(vectID,instr)% openAIcreateAssistantCurl(vectID,instr) - creates an openAI V2 assistant with CURL
% (by Tim Lueth & ChatGPT, SG-Lib, 2025-NOV-27 as class: ARTIFICIAL INTELLIGENCE)
%
% USE CAREFULLY: openAIcreateAssistantCurl was not being tested extensively
%
% The body contains of
% '"tools":[{"type":"file_search"}],' ...
% '"tool_resources":{' ...
% '"file_search":{"vector_store_ids":["%s"]}' ...
% (Status of: 2025-11-27)
%
% Introduced first in SolidGeometry 5.6
%
% See also: openAIDeleteAssistantCurl, openAIgetAssistantsCurl,
% openAIresetAssistantCurl
%
% [assID,resp]=openAIcreateAssistantCurl(vectID,instr)
% === INPUT PARAMETERS ===
% vectID: Vector-store id
% instr: Instructions for the agent; default is especially for SG=Lib
% === OUTPUT RESULTS ======
% assID: Assistant ID
% resp: JSON response struct
%
% See also: openAIDeleteAssistantCurl, openAIgetAssistantsCurl,
% openAIresetAssistantCurl
%
%
% Copyright 2025 Tim C. Lueth

openAIDeleteAssistantCurl(assID)- deletes an v2 assistant based on its assistant ID (CURL version)

openAIDeleteAssistantCurl(assID)% openAIDeleteAssistantCurl(assID) - deletes an v2 assistant based on its assistant ID (CURL version)
% (by Tim Lueth & ChatGPT, SG-Lib, 2025-NOV-25 as class: ARTIFICIAL INTELLIGENCE)
%
% USE CAREFULLY: openAIDeleteAssistantCurl was not being tested extensively
%
% uses api_key = getenv("OPENAI_API_KEY");
% (Status of: 2025-11-27)
%
% Introduced first in SolidGeometry 5.6
%
% See also: openAIcreateAssistantCurl, openAIgetAssistantsCurl,
% openAIresetAssistantCurl
%
% resp=openAIDeleteAssistantCurl(assID)
% === INPUT PARAMETERS ===
% assID: assistant ID
% === OUTPUT RESULTS ======
% resp: JSON response struct
%
% See also: openAIcreateAssistantCurl, openAIgetAssistantsCurl,
% openAIresetAssistantCurl
%
%
% Copyright 2025 Tim C. Lueth

openAIgetVectorStoreFilesCurl(vid)- get files an their status within a vector store (CURL Version)

openAIgetVectorStoreFilesCurl(vid)% openAIgetVectorStoreFilesCurl(vid) - get files an their status within a vector store (CURL Version)
% (by Tim Lueth & ChatGPT, SG-Lib, 2025-NOV-25 as class: ARTIFICIAL INTELLIGENCE)
%
% USE CAREFULLY: openAIgetVectorStoreFilesCurl was not being tested extensively
%
% Introduced first in SolidGeometry 5.6
%
% See also: openAIgetVectorstores
%
% resp=openAIgetVectorStoreFilesCurl(vid)
% === INPUT PARAMETERS ===
% vid: vectore store id
% === OUTPUT RESULTS ======
% resp: response struct
%
% EXAMPLE:
% [a,b,c]=openAIgetVectorstores
% openAIgetVectorStoreFilesCurl(b{1})
%
% See also: openAIgetVectorstores
%
%
% Copyright 2025 Tim C. Lueth

openAIdeleteFileFromVectorStoreCurl(vid,fid)- deletes (failed) files from vectore stores (CURL Version)

openAIdeleteFileFromVectorStoreCurl(vid,fid)% openAIdeleteFileFromVectorStoreCurl(vid,fid) - deletes (failed) files from vectore stores (CURL Version)
% (by Tim Lueth & ChatGPT, SG-Lib, 2025-NOV-25 as class: ARTIFICIAL INTELLIGENCE)
%
% USE CAREFULLY: openAIdeleteFileFromVectorStoreCurl was not being tested
% extensively
%
% Introduced first in SolidGeometry 5.6
%
% See also: openAIgetVectorStoreFilesCurl
%
% resp=openAIdeleteFileFromVectorStoreCurl(vid,fid)
% === INPUT PARAMETERS ===
% vid: vector store id
% fid: file id
% === OUTPUT RESULTS ======
% resp: response struct
%
% EXAMPLE:
% openAIdeleteFileFromVectorStoreCurl('vs_692533bde7848191b125da2f725ba05e','file-RKj3gUYSLXNw2yDwwg48WK')
% openAIgetVectorStoreFilesCurl('vs_692533bde7848191b125da2f725ba05e')
%
% See also: openAIgetVectorStoreFilesCurl
%
%
% Copyright 2025 Tim C. Lueth

openAIaddFileToVectorstoreCurl(file_id,vector_id)- adds or registeras an uploaded file in a vector store for assistant use (CURL Version)

openAIaddFileToVectorstoreCurl(file_id,vector_id)% openAIaddFileToVectorstoreCurl(file_id,vector_id) - adds or registeras an uploaded file in a vector store for assistant use (CURL Version)
% (by Tim Lueth & ChatGPT, SG-Lib, 2025-NOV-25 as class: ARTIFICIAL INTELLIGENCE)
%
% USE CAREFULLY: openAIaddFileToVectorstoreCurl was not being tested extensively
%
% I do now used CURL to make sure that I do not use Matlab's interface
% Did work on (Status of: 2025-11-25)
%
% Introduced first in SolidGeometry 5.6
%
% See also: openAIgetuploadedFiles, openAIgetVectorstores
%
% resp=openAIaddFileToVectorstoreCurl(file_id,vector_id)
% === INPUT PARAMETERS ===
% file_id: file id by openAIgetuploadedFiles
% vector_id: vector_id by openAIgetVectorstores
% === OUTPUT RESULTS ======
% resp: response struct, enthält die batch_id
%
% EXAMPLE:
% fid=openAIuploadFile('/Volumes/LUETH-WIN/WIN AIM Matlab Libraries/SolidGeometry-Code/SGLIB_HTMLDOCU4GPT.zip')
% vid=openAIcreateVectorstore('SGLIB-docustore')
%
% See also: openAIgetuploadedFiles, openAIgetVectorstores
%
%
% Copyright 2025 Tim C. Lueth

openAIdownloadFile(fid)- dobwload an uploaded binary files from openAI even with 2024b (CURL Version)

openAIdownloadFile(fid)% openAIdownloadFile(fid) - dobwload an uploaded binary files from openAI even with 2024b (CURL Version)
% (by Tim Lueth & ChatGPT, SG-Lib, 2025-NOV-20 as class: ARTIFICIAL INTELLIGENCE)
%
% USE CAREFULLY: openAIdownloadFile was not being tested extensively
%
% Introduced first in SolidGeometry 5.6
%
% See also: openAIuploadFile, openAIdeleteuploadedFile, openAIgetuploadedFiles
%
% result=openAIdownloadFile(fid)
% === INPUT PARAMETERS ===
% fid: openAI file id
% === OUTPUT RESULTS ======
% result: json struct; use struct2cell(result.data)'
%
% EXAMPLE:
% result=openAIgetuploadedFiles;
% jsonencode(result.data)
% struct2cell(result.data)
% ids=elem2cell(result.data.id)
% openAIdownloadFile(ids{end})
%
% See also: openAIuploadFile, openAIdeleteuploadedFile, openAIgetuploadedFiles
%
%
% Copyright 2025 Tim C. Lueth

openAIgetuploadedFiles- get the list of uploaded binary files to openAI even with 2024b (CURL Version)

openAIgetuploadedFiles% openAIgetuploadedFiles - get the list of uploaded binary files to openAI even with 2024b (CURL Version)
% (by Tim Lueth & ChatGPT, SG-Lib, 2025-NOV-20 as class: ARTIFICIAL INTELLIGENCE)
%
% USE CAREFULLY: openAIgetuploadedFiles was not being tested extensively
%
% Introduced first in SolidGeometry 5.6
%
% See also: openAIuploadFile, openAIdeleteuploadedFile, openAIdownloadFile
%
% result=openAIgetuploadedFiles
% === OUTPUT RESULTS ======
% result: json struct; use struct2cell(result.data)'
%
% EXAMPLE:
% result=openAIgetuploadedFiles;
% jsonencode(result.data)
% struct2cell(result.data)
% ids=elem2cell(result.data.id)
% % openAIdeleteuploadedFile(ids{end})
%
% See also: openAIuploadFile, openAIdeleteuploadedFile, openAIdownloadFile
%
%
% Copyright 2025 Tim C. Lueth

openAIdeleteuploadedFile(fid)- deletes uploaded binary files to openAI even with 2024b (CURL Version)

openAIdeleteuploadedFile(fid)% openAIdeleteuploadedFile(fid) - deletes uploaded binary files to openAI even with 2024b (CURL Version)
% (by Tim Lueth & ChatGPT, SG-Lib, 2025-NOV-20 as class: ARTIFICIAL INTELLIGENCE)
%
% USE CAREFULLY: openAIdeleteuploadedFile was not being tested extensively
%
% Introduced first in SolidGeometry 5.6
%
% See also: openAIuploadFile, openAIgetuploadedFiles, openAIdownloadFile
%
% result=openAIdeleteuploadedFile(fid)
% === INPUT PARAMETERS ===
% fid: file name
% === OUTPUT RESULTS ======
% result: file id
%
% See also: openAIuploadFile, openAIgetuploadedFiles, openAIdownloadFile
%
%
% Copyright 2025 Tim C. Lueth

openAIuploadFile(fname)- upload binary files to openAI even with 2024b (CURL Version)

openAIuploadFile(fname)% openAIuploadFile(fname) - upload binary files to openAI even with 2024b (CURL Version)
% (by Tim Lueth & ChatGPT, SG-Lib, 2025-NOV-20 as class: ARTIFICIAL INTELLIGENCE)
%
% USE CAREFULLY: openAIuploadFile was not being tested extensively
%
% Introduced first in SolidGeometry 5.6
%
% See also: openAIdeleteuploadedFile, openAIgetuploadedFiles, openAIdownloadFile
%
% file_id=openAIuploadFile([fname])
% === INPUT PARAMETERS ===
% fname: file name
% === OUTPUT RESULTS ======
% file_id: file id
%
% See also: openAIdeleteuploadedFile, openAIgetuploadedFiles, openAIdownloadFile
%
%
% Copyright 2025 Tim C. Lueth

openAIgetmodels- returns all API GPT models of openAI - testing fnct for openAI (webread version)

openAIgetmodels% openAIgetmodels - returns all API GPT models of openAI - testing fnct for openAI (webread version)
% (by Tim Lueth & ChatGPT, SG-Lib, 2025-NOV-20 as class: ARTIFICIAL INTELLIGENCE)
%
% USE CAREFULLY: openAIgetmodels was not being tested extensively
%
% Introduced first in SolidGeometry 5.6
%
% See also: openAIgetVectorstores, openAIdeleteVectorstore,
% openAIcreateVectorstore
%
% [ccc,resp]=openAIgetmodels
% === OUTPUT RESULTS ======
% ccc: cell list of model ids
% resp: response struct
%
% EXAMPLE:
% openAIgetmodels
%
% See also: openAIgetVectorstores, openAIdeleteVectorstore,
% openAIcreateVectorstore
%
%
% Copyright 2025 Tim C. Lueth

openAIgetVectorstores- gets the names/IDs of all openAI vector store (CURL Version)

openAIgetVectorstores% openAIgetVectorstores - gets the names/IDs of all openAI vector store (CURL Version)
% (by Tim Lueth & ChatGPT, SG-Lib, 2025-NOV-20 as class: ARTIFICIAL INTELLIGENCE)
%
% USE CAREFULLY: openAIgetVectorstores was not being tested extensively
%
% Introduced first in SolidGeometry 5.6
%
% See also: openAIcreateVectorstore, openAIdeleteVectorstore
%
% [names,ids,resp]=openAIgetVectorstores
% === OUTPUT RESULTS ======
% names: names of vector stores
% ids: ids of vector stores
% resp: response struct
%
% EXAMPLE:
% idn=openAIcreateVectorstore('TEST-store'),
% [names,id,resp]=openAIgetVectorstore
% openAIdeleteVectorstores(idn)
% [names,id,resp]=openAIgetVectorstores
%
% See also: openAIcreateVectorstore, openAIdeleteVectorstore
%
%
% Copyright 2025 Tim C. Lueth

openAIdeleteVectorstore(store_id)- deletes an openAI vector store by its id (webwrite Version)

openAIdeleteVectorstore(store_id)% openAIdeleteVectorstore(store_id) - deletes an openAI vector store by its id (webwrite Version)
% (by Tim Lueth & ChatGPT, SG-Lib, 2025-NOV-20 as class: ARTIFICIAL INTELLIGENCE)
%
% USE CAREFULLY: openAIdeleteVectorstore was not being tested extensively
%
% Introduced first in SolidGeometry 5.6
%
% See also: openAIcreateVectorstore, openAIgetVectorstore
%
% resp=openAIdeleteVectorstore(store_id)
% === INPUT PARAMETERS ===
% store_id: Store id returned by openAigetVectorstores
% === OUTPUT RESULTS ======
% resp: response struct
%
% EXAMPLE:
% idn=openAIcreateVectorstore('TEST-store'),
% [names,id,resp]=openAIgetVectorstore
% openAIdeleteVectorstores(idn)
% [names,id,resp]=openAIgetVectorstores
%
% See also: openAIcreateVectorstore, openAIgetVectorstore
%
%
% Copyright 2025 Tim C. Lueth

openAIcreateVectorstore(stname)- creates an opAI vector store (CURL Version)

openAIcreateVectorstore(stname)% openAIcreateVectorstore(stname) - creates an opAI vector store (CURL Version)
% (by Tim Lueth & ChatGPT, SG-Lib, 2025-NOV-19 as class: ARTIFICIAL INTELLIGENCE)
%
% USE CAREFULLY: openAIcreateVectorstore was not being tested extensively
%
% Introduced first in SolidGeometry 5.6
%
% See also: openAIgetVectorstores, openAIdeleteVectorstore
%
% [id,resp]=openAIcreateVectorstore([stname])
% === INPUT PARAMETERS ===
% stname: Store name, must be unique in the SG-Lib, in contrast to openAI
% === OUTPUT RESULTS ======
% id: vectore-store id
% resp: response struct
%
% EXAMPLE:
% idn=openAIcreateVectorstore('TEST-store'),
% [names,id,resp]=openAIgetVectorstore
% openAIdeleteVectorstores(idn)
% [names,id,resp]=openAIgetVectorstores
%
% See also: openAIgetVectorstores, openAIdeleteVectorstore
%
%
% Copyright 2025 Tim C. Lueth

SGcreateDocuZIP4GPT- creates a zip file including all SG-Lib html files od the directory SGLIB_HELP_Structures

SGcreateDocuZIP4GPT% SGcreateDocuZIP4GPT - creates a zip file including all SG-Lib html files od the directory SGLIB_HELP_Structures
% (by Tim Lueth, SG-Lib, 2025-NOV-19 as class: ARTIFICIAL INTELLIGENCE)
%
% USE CAREFULLY: SGcreateDocuZIP4GPT was not being tested extensively
%
% Finally opens the wordir
% No xml allowed
% No png allowed
% No subdirs allowed (Status of: 2025-11-20)
%
% Introduced first in SolidGeometry 5.6
%
% See also: openAIcreateVectorstore
%
% fname=SGcreateDocuZIP4GPT
% === OUTPUT RESULTS ======
% fname: file name of the zip file
%
% See also: openAIcreateVectorstore
%
%
% Copyright 2025 Tim C. Lueth

chatimage2video(I,prompt,nvp)- creates a video file on disk by openAI' Sora (12 seconds cost about 2 Dollar) based on a picture

chatimage2video(I,prompt,nvp)% chatimage2video(I,prompt,nvp) - creates a video file on disk by openAI' Sora (12 seconds cost about 2 Dollar) based on a picture
% (by Tim Lueth & Robin Schregle, SG-Lib, 2025-NOV-18 as class: ARTIFICIAL
% INTELLIGENCE)
%
% USE CAREFULLY: chatimage2video was not being tested extensively
%
% requires at least "matlab-deep-learning-llms-with-matlab-4". 1st version by
% Robin Schregle
% The file will be written in a mp4 on desktop and the prompt is in a textfile
% with the same name
% Does use the matlab.net.http.RequestMessage interface. (Status of: 2025-11-25)
%
% Introduced first in SolidGeometry 5.6
%
% See also: chat, chatimage, chatvideo, chatpublication
%
% response=chatimage2video(I,prompt,nvp)
% === INPUT PARAMETERS ===
% I: Image or file name of the image. It will be resized to fit 1280x720 or other
% formats
% prompt: description of the video content - the more the better
% nvp: addition parameter such as "size", "720x1280"
% === OUTPUT RESULTS ======
% response: response from openAI - mp4Bytes = response.Body.Data;
%
% EXAMPLE:
% I=imread('peppers.png');
% chatimage2video(I,'Make a TUM MIMED Team eating the pepper imageand have fun',"Size","1280x720")
%
% See also: chat, chatimage, chatvideo, chatpublication
%
%
% Copyright 2025 Tim C. Lueth

SGfurnitureWedge4beamer- returns a wegde for a beamer

SGfurnitureWedge4beamer% SGfurnitureWedge4beamer - returns a wegde for a beamer
% (by Tim Lueth, SG-Lib, 2025-NOV-18 as class: COMPLETED CAD DESIGNS)
%
% =======================================================================
% DEVELOPER PROCEDURE (2025-11-26) - NOT INTENDED TO BE RELEASED
% =======================================================================
%
% Introduced first in SolidGeometry 5.6
%
% See also: SGfurniturespacer, SGfurniturewedges
%
% SGfurnitureWedge4beamer
%
% See also: SGfurniturespacer, SGfurniturewedges
%
%
% Copyright 2025 Tim C. Lueth

SGcreateJSONfnctSignatures4GPT(fnameML,fnameGPT)- Generates a JSON for GPT from the SG-Lib documentation "JSONfnctSignatures4Matlab"

SGcreateJSONfnctSignatures4GPT(fnameML,fnameGPT)% SGcreateJSONfnctSignatures4GPT(fnameML,fnameGPT) - Generates a JSON for GPT from the SG-Lib documentation "JSONfnctSignatures4Matlab"
% (by Tim Lueth, SG-Lib, 2025-NOV-17 as class: ARTIFICIAL INTELLIGENCE)
%
% USE CAREFULLY: SGcreateJSONfnctSignatures4GPT was not being tested extensively
%
% Typically used only once to create the (Status of: 2025-11-20)
%
% Introduced first in SolidGeometry 5.6
%
% See also: SGcreateJSONfnctSignatures4Matlab
%
% fnameGPT=SGcreateJSONfnctSignatures4GPT([fnameML,fnameGPT])
% === INPUT PARAMETERS ===
% fnameML: default is [SGlibpath filesep 'fnctnSignatures.json']
% fnameGPT: default is [SGlibpath filesep 'GPTfnctnSignatures.json']);
% === OUTPUT RESULTS ======
% fnameGPT: location of GPT JSON for SG-Lib default is fnameGPT
%
% EXAMPLE:
% GPTJSON=SGcreateJSONfnctSignatures4GPT % without paramters; the default values are used
%
% See also: SGcreateJSONfnctSignatures4Matlab
%
%
% Copyright 2025 Tim C. Lueth

FINdataPOP(,"force","DOI")- download ans saves the population of several countries from the world bank homepage

FINdataPOP(,% FINdataPOP(,"force","DOI") - download ans saves the population of several countries from the world bank homepage
% (by Tim Lueth, SG-Lib, 2025-NOV-15 as class: TUTORIAL)
%
% Introduced first in SolidGeometry 5.6
%
% See also: FINdataM2
%
% FINdataPOP([,"force","DOI"])
% "force": if used, the download of the new data is enforced
% "DOI": Day of interest to normalize the data
%
% EXAMPLE:
% FINdataPOP PT DK SE NO FI AT
%
% See also: FINdataM2
%
%
% Copyright 2025 Tim C. Lueth

FINdataM2EURread- delivers the EUR money supply M2 directly from European Central Bank apir

FINdataM2EURread% FINdataM2EURread - delivers the EUR money supply M2 directly from European Central Bank apir
% (by Tim Lueth, SG-Lib, 2025-NOV-15 as class: TUTORIAL)
%
% api.ecb.europa.eu
% (Status of: 2025-11-17)
%
% Introduced first in SolidGeometry 5.6
%
% See also: FINdataM2, FINdataM2USAread, FINdataM2CHFread
%
% [M2EUR,dates,values]=FINdataM2EURread
% === OUTPUT RESULTS ======
% M2EUR: [datum values] as coordinate list
% dates: datenum array
% values: vallue array
%
% EXAMPLE:
% FINdataM2EURread; M2CHF=ans
% FINdataM2
%
% See also: FINdataM2, FINdataM2USAread, FINdataM2CHFread
%
%
% Copyright 2025 Tim C. Lueth

chat2table(txt,"cell")- Take a char text and create a table or a cell array.

chat2table(txt,% chat2table(txt,"cell") - Take a char text and create a table or a cell array.
% (by Tim Lueth, SG-Lib, 2025-NOV-14 as class: ARTIFICIAL INTELLIGENCE)
%
% USE CAREFULLY: chat2table was not being tested extensively
%
% Introduced first in SolidGeometry 5.6
%
% See also: chat2diagram
%
% [TAB,code]=chat2table([txt,"cell"])
% === INPUT PARAMETERS ===
% txt: text desciption of a table
% "cell": if used, an cell instead of a table is returned
% === OUTPUT RESULTS ======
% TAB: matlab table
% code: code to create the matlab table; cann be used in a matlab file later
%
% EXAMPLE:
% chat zeige das Bevökerungswachstum der EU-Staaten im Euro-Raum seit 2000 im Jahresabständen; x=ans
% y=chat2table(x)
% y=chat2table(x,'cell')
% chat Stelle die Geldemengenentwicklung M2 der USA relativ zur Bevölkerungentwicklung der USA in den Jahren 1984 bis 2025 in jährlichen Abständen und jährlich Steigerung der letzten Zahl in Prozent dar; x=ans;
%
%
% See also: chat2diagram
%
%
% Copyright 2025 Tim C. Lueth

FINdataM2CHFread- delivers the CHF money supply M2 directly from Swiss National Bank

FINdataM2CHFread% FINdataM2CHFread - delivers the CHF money supply M2 directly from Swiss National Bank
% (by Tim Lueth, SG-Lib, 2025-NOV-14 as class: TUTORIAL)
%
% The API is explained on the page
% "https://data.snb.ch/de/topics/snb/cube/snbmonagg."
% https://data.snb.ch/de/topics/snb/cube/snbmonagg(sidebar:-/help_api/-) (Status
% of: 2025-11-14)
%
% Introduced first in SolidGeometry 5.6
%
% See also: FINdataM2, FINdataM2USAread
%
% [M2CHF]=FINdataM2CHFread
% === OUTPUT RESULTS ======
% [M2CHF]: [datum values] as coordinate list
%
% EXAMPLE:
% FINdataM2CHFread; M2CHF=ans
% FINdataM2
%
% See also: FINdataM2, FINdataM2USAread
%
%
% Copyright 2025 Tim C. Lueth

FINdataM2USAread- delivers the USD money supply M2 directly from FRED in St. Louis, USA, via API

FINdataM2USAread% FINdataM2USAread - delivers the USD money supply M2 directly from FRED in St. Louis, USA, via API
% (by Tim Lueth, SG-Lib, 2025-NOV-14 as class: TUTORIAL)
%
% You can ask for a cost-free FRED account at:
% "https://fredaccount.stlouisfed.org"
% You can ask for an cost-free API access at:
% "https://fred.stlouisfed.org/docs/api/api_key.html
% The fnctn stores the M2USD array as "M2USD.mat" and variable name M2USD.
% (Status of: 2025-11-14)
%
% Introduced first in SolidGeometry 5.6
%
% See also: FINdataM2, FINdataM2CHFread
%
% [M2USD,dates,values]=FINdataM2USAread
% === OUTPUT RESULTS ======
% M2USD: [datum values*1000] as coordinate list
% dates: dates as datetime struct
% values: values as double list
%
% EXAMPLE:
% FINdataM2USAread; M2USD=ans
% FINdataM2
%
%
% See also: FINdataM2, FINdataM2CHFread
%
%
% Copyright 2025 Tim C. Lueth

chatclipcorrect(lang)- prepares sepell checking and translation of the clipboard

chatclipcorrect(lang)% chatclipcorrect(lang) - prepares sepell checking and translation of the clipboard
% (by Tim Lueth, SG-Lib, 2025-NOV-13 as class: ARTIFICIAL INTELLIGENCE)
%
% USE CAREFULLY: chatclipcorrect was not being tested extensively
%
% Used for correcting and translating german and english text in emails
% It is used in combination with keyboard Maestro ("Shift-Command-C")
% "Above all, I am pleased that the genuine German spelling rules are used, and
% not the distorted pseudo-new German. Commas and capitalization as desired."
% (Status of: 2025-11-13)
%
% Introduced first in SolidGeometry 5.6
%
% See also: chat1
%
% corr=chatclipcorrect([lang])
% === INPUT PARAMETERS ===
% lang: languages - default is 'de en
% === OUTPUT RESULTS ======
% corr: corrected and optional translated text
%
% EXAMPLE:
% clipboard('copy', 'Es ist schön, si wider in munchn zu schauen')
% chatclipcorrect de en
%
%
% See also: chat1
%
%
% Copyright 2025 Tim C. Lueth

chatcode(descr,fname)- returns matlab code and writes a matlab fnct into the working directory

chatcode(descr,fname)% chatcode(descr,fname) - returns matlab code and writes a matlab fnct into the working directory
% (by Tim Lueth, SG-Lib, 2025-NOV-09 as class: ARTIFICIAL INTELLIGENCE)
%
% uses chatGPT to create Matlab fnctns based on a quit complete definition of the
% header (Status of: 2025-11-09)
%
% Introduced first in SolidGeometry 5.6
%
% See also: chat1, chat, chatpublication
%
% [flong,txt]=chatcode([descr,fname])
% === INPUT PARAMETERS ===
% descr: Complete header including input out parameter an their description
% fname: desired name of cuntin
% === OUTPUT RESULTS ======
% flong: full file name of the m file; Names start with CC_ and can get an
% additional
% txt: code of the matlba file
%
% EXAMPLE:
% chatcode(help('PLcircle')) % creates a func similar to the SG-Lib func
% chatcode(help('PLcircle')), CC_PLcircle(10,7)
% chatcode(help('normr')) % creates a func similar to "normr" of Matlab
%
% See also: chat1, chat, chatpublication
%
%
% Copyright 2025 Tim C. Lueth

testchatfunc(x,y)- returns the area of a square mit dimensions x and y

testchatfunc(x,y)% testchatfunc(x,y) - returns the area of a square mit dimensions x and y
% (by Tim Lueth, SG-Lib, 2025-NOV-09 as class: ARTIFICIAL INTELLIGENCE)
%
% This fnctn was declared as a single line in Tim Lueth's Filemaker database by
% input and output params.
% fnctn [a,b,c]=testchatfunc(x,y)
% Afterwards the explaination of the fnctn and the description of the parameter
% was added in the filemaker database. Then header was compiled by the FM
% database and copied into the clipboard(!) and into a variable A
% (A=clipboard('paste))
% Then chatcode(A) created the complete matlab code fnctn
% (Status of: 2025-11-09)
%
% Introduced first in SolidGeometry 5.6
%
% See also: chatcode
%
% [a,b,c]=testchatfunc(x,y)
% === INPUT PARAMETERS ===
% x: dimension in x
% y: dimension in y
% === OUTPUT RESULTS ======
% a: area
% b: area of a circle with radius x
% c: volume of a cylinder iwth radius x and height y
%
% EXAMPLE:
% [A,B,C]=testchatfunc(10,20)
%
% See also: chatcode
%
%
% Copyright 2025 Tim C. Lueth

isprocrunning(appname)- returns 0 if a process is not runnning, or the number of processes with this name

isprocrunning(appname)% isprocrunning(appname) - returns 0 if a process is not runnning, or the number of processes with this name
% (by Tim Lueth, SG-Lib, 2025-NOV-09 as class: CODING/DEVELOP)
%
% =======================================================================
% DEVELOPER PROCEDURE (2025-11-14) - NOT INTENDED TO BE RELEASED
% =======================================================================
%
% Introduced first in SolidGeometry 5.6
%
% See also: PIDofApp
%
% PN=isprocrunning(appname)
% === INPUT PARAMETERS ===
% appname: appname
% === OUTPUT RESULTS ======
% PN: Number of processes with this name
%
% EXAMPLE:
% isprocrunning('MATLAB')
% isprocrunning('Safari')
% isprocrunning('hgsdksjhfkjhskjf')
%
% See also: PIDofApp
%
%
% Copyright 2025 Tim C. Lueth

PIDofApp(appname)- returns a cell list with appname, processid cpu usage and folder if app is running

PIDofApp(appname)% PIDofApp(appname) - returns a cell list with appname, processid cpu usage and folder if app is running
% (by Tim Lueth, SG-Lib, 2025-NOV-09 as class: CODING/DEVELOP)
%
% =======================================================================
% DEVELOPER PROCEDURE (2025-11-09) - NOT INTENDED TO BE RELEASED
% =======================================================================
%
% In case of Batch jobs of MATLAB processes are listed, the first process is
% commandwindow
% In contrast to whoisPID this fnctn returns also the CPU usage. (Status of:
% 2025-11-09)
%
% Introduced first in SolidGeometry 5.6
%
% See also: whoisPID
%
% PID=PIDofApp([appname])
% === INPUT PARAMETERS ===
% appname: exact app name as listed in
% === OUTPUT RESULTS ======
% PID: char cell list (n x 4) {Appname}, {PID}, {CPU}, {Folder}
%
% EXAMPLE:
% PIDofApp('MATLAB')
%
% See also: whoisPID
%
%
% Copyright 2025 Tim C. Lueth

chatimage(descr)- creates a picture/sketch/diagram/image of a text using "dall-e-3"

chatimage(descr)% chatimage(descr) - creates a picture/sketch/diagram/image of a text using "dall-e-3"
% (by Tim Lueth & Robin Schregle, SG-Lib, 2025-NOV-06 as class: ARTIFICIAL
% INTELLIGENCE)
%
% requires at least "matlab-deep-learning-llms-with-matlab-4". First Version by
% Robin Schregle, it uses Matlabs openAIImages
% (Status of: 2025-11-09)
%
% Introduced first in SolidGeometry 5.6
%
% See also: chat, chatm, chatdiagramm
%
% [img,GPT]=chatimage([descr])
% === INPUT PARAMETERS ===
% descr: description of the picture
% === OUTPUT RESULTS ======
% img: image
% GPT: GPT Response of openAIImages
%
% EXAMPLE:
% chatimage('Draw an Aston Martin Sportscar near the Lake Garde like in the Quantum James Bond')
%
%
% See also: chat, chatm, chatdiagramm
%
%
% Copyright 2025 Tim C. Lueth

chatvideo(prompt,nvp)- creates a video file on disk by openAI' Sora (12 seconds cost about 2 Dollar)

chatvideo(prompt,nvp)% chatvideo(prompt,nvp) - creates a video file on disk by openAI' Sora (12 seconds cost about 2 Dollar)
% (by Tim Lueth & Robin Schregle, SG-Lib, 2025-NOV-06 as class: ARTIFICIAL
% INTELLIGENCE)
%
% requires at least "matlab-deep-learning-llms-with-matlab-4". 1st version by
% Robin Schregle
% The file will be written in a mp4 on desktop and the promt is in a textfile
% with the same name
% Does use the send interface. (Status of: 2025-11-25)
%
% Introduced first in SolidGeometry 5.6
%
% See also: chat, chatimage, chatpublication
%
% response=chatvideo(prompt,nvp)
% === INPUT PARAMETERS ===
% prompt: description of the video content - the more the better
% nvp: addition parameter such as "size", "720x1280"
% === OUTPUT RESULTS ======
% response: response from openAI - mp4Bytes = response.Body.Data;
%
% EXAMPLE:
% chatvideo('Create an video about an Aston Martin Sportscar near the Lake Garde like in the Quantum James Bond',"Size","1280x720")
%
% See also: chat, chatimage, chatpublication
%
%
% Copyright 2025 Tim C. Lueth

JAVAemailmsg2cell(msgs,)- reads email as text or creates an chatGPT answer

JAVAemailmsg2cell(msgs,)% JAVAemailmsg2cell(msgs,) - reads email as text or creates an chatGPT answer
% (by Tim Lueth, SG-Lib, 2025-NOV-05 as class: CODING/DEVELOP)
%
% USE CAREFULLY: JAVAemailmsg2cell was not being tested extensively
%
% Introduced first in SolidGeometry 5.6
%
% See also: JAVAemailServerImap, JAVAemailTUMimap, JAVAemailreadtextmessage
%
% [ttxt,Efrom,Edate,Esubj,Eto,ANSW]=JAVAemailmsg2cell(msgs,[])
% === INPUT PARAMETERS ===
% msgs:
% === OUTPUT RESULTS ======
% ttxt:
% Efrom:
% Edate:
% Esubj:
% Eto:
% ANSW:
%
% EXAMPLE:
% [msgs,store]=JAVAemailTUMimap('gu28yik','INBOX');
% JAVAemailmsg2cell(msgs(end))
%
% See also: JAVAemailServerImap, JAVAemailTUMimap, JAVAemailreadtextmessage
%
%
% Copyright 2025 Tim C. Lueth

chatm()- single line communication with openAI's chat gpt with persistent chat history and chat-memories.txt

chatm()% chatm() - single line communication with openAI's chat gpt with persistent chat history and chat-memories.txt
% (by Tim Lueth, SG-Lib, 2025-NOV-05 as class: ARTIFICIAL INTELLIGENCE)
%
% USE CAREFULLY: chatm was not being tested extensively
%
% In longer conversations with a lot of text to analyze, this fnctn will lead to
% an error by etensive use of the openAI models in OpenAIrequest
%
% chat1 - sends a single line to openAI API without history
% chat - opens a single line conversation using the chat history
% chatm - same as chat but writes also a memo in file "chat-memories.txt"
% chatGPT - opens the chatGPT web browser interface
% chatweb - opens the chatGPT web browser interface
%
% Uses OpenAIrequest. Make sure that your openAI API secret key is stored in a
% file called "OPENAI_API_KEY.env"
% (Status of: 2025-11-05)
%
% Introduced first in SolidGeometry 5.6
%
% See also: chat1, chatweb, chatGPT, chat, OpenAIrequest
%
% y=chatm([])
% === OUTPUT RESULTS ======
% y: Response from openAI when using your paid openAI API account
%
% EXAMPLE: % Difference between chat and chath
% chat1 what is the age of joe biden
% chat1 what ist the age of his wife
% chat what is the age of joe biden
% chat what ist the age of his wife
% chat clear % löscht die Erinnerung
% chat what ist the age of his wife
%
% See also: chat1, chatweb, chatGPT, chat, OpenAIrequest
%
%
% Copyright 2025 Tim C. Lueth

latin1ofUTF(txt)- Provides a latin1 code for UTF so that the ASCII files are read correctly.

latin1ofUTF(txt)% latin1ofUTF(txt) - Provides a latin1 code for UTF so that the ASCII files are read correctly.
% (by Tim Lueth, SG-Lib, 2025-NOV-05)
%
% USE CAREFULLY: latin1ofUTF was not being tested extensively
%
% The caraacters outsinde of latin1 just disappear (Status of: 2025-11-05)
%
% Introduced first in SolidGeometry 5.6
%
% See also: isUTF8, isUTF16file
%
% c=latin1ofUTF(txt)
% === INPUT PARAMETERS ===
% txt: uint8 text chain
% === OUTPUT RESULTS ======
% c: latin1 text chain
%
% EXAMPLE:
% chat create 200 chars including UTF8 chars such as greek characters, xxx=ans; isUTF8(xxx), latin1ofUTF(xxx)
%
% See also: isUTF8, isUTF16file
%
%
% Copyright 2025 Tim C. Lueth

isUTF8(txt)- Returns the number of codes that are not in the ASCII range 0..127 or the German umlauts.

isUTF8(txt)% isUTF8(txt) - Returns the number of codes that are not in the ASCII range 0..127 or the German umlauts.
% (by Tim Lueth, SG-Lib, 2025-NOV-05)
%
% USE CAREFULLY: isUTF8 was not being tested extensively
%
% It's hard for me to express, but Matlab still hasn't found a sensible way to
% handle Latin1, UTF8, UTF16, or iso files in 2024b. This is all the more
% annoying because the Matlab editor itself changes the encoding of files, but
% there is no way to recognize the file type in Matlab. In combination with the
% text-based chat fnctns, this makes it increasingly unsafe to use the text
% fnctns. The introduction of strings has not improved the situation in any way.
% (Status of: 2025-11-05)
%
% Introduced first in SolidGeometry 5.6
%
% [n,io,ochar]=isUTF8(txt)
% === INPUT PARAMETERS ===
% txt: text to check
% === OUTPUT RESULTS ======
% n: number of special chars
% io: position in char(txt)
% ochar: uint8 of the special chars
%
% EXAMPLE:
% chat create 200 chars including UTF8 chars such as greek characters, xxx=ans; isUTF8(xxx)
%
%
% Copyright 2025 Tim C. Lueth

html2char(tinp)- Converts HTML code in UTF8 into ASCII characters.

html2char(tinp)% html2char(tinp) - Converts HTML code in UTF8 into ASCII characters.
% (by Tim Lueth, SG-Lib, 2025-NOV-03 as class: TEXT/STRS/CHARS/LINKS)
%
% simple calls java fnctn java.net.URLEncoder.encode(tinp, 'UTF-8')
% or java.net.URLDecoder.decode(tinp, "UTF-8") (Status of: 2025-11-03)
%
% Introduced first in SolidGeometry 5.6
%
% See also: char2html
%
% tout=html2char(tinp)
% === INPUT PARAMETERS ===
% tinp: html UTF8 code
% === OUTPUT RESULTS ======
% tout: ascii code
%
% EXAMPLE:
% char2html("Bevölkerungsentwicklung")
% html2char(char2html("Bevölkerungsentwicklung"))
%
% See also: char2html
%
%
% Copyright 2025 Tim C. Lueth

chatdiagramm(data,fname,todo)- Generates MATLAB code to display a diagram based on OpenAI Chat.

chatdiagramm(data,fname,todo)% chatdiagramm(data,fname,todo) - Generates MATLAB code to display a diagram based on OpenAI Chat.
% (by Tim Lueth, SG-Lib, 2025-OKT-31 as class: ARTIFICIAL INTELLIGENCE)
%
% USE CAREFULLY: chatdiagramm was not being tested extensively
%
% written Oct 2025 for GPT 5.x (Status of: 2025-11-03)
%
% Introduced first in SolidGeometry 5.6
%
% See also: chatdestatisJSONfindtabs, destatisJSONreadtab
%
% y=chatdiagramm([data,fname,todo])
% === INPUT PARAMETERS ===
% data: A char text with data preferably in Excel format (columns separated by
% semicolons)
% fname: An optional Filename; default is titleofcaller
% todo: Explanation of what exactly is desired
% === OUTPUT RESULTS ======
% y: matlab code for execution
%
% EXAMPLE:
% destatisJSONfindtabs('promovierende')
% [a,b,c]=destatisJSONreadtab('21352-0002'); % Loads the table from destatis genesis
% chatdiagramm(c,'','Display the table as a chart') % draws a chart
% chatdiagramm(c,'','Display the table as a diagram') % draws a diagram
% chatdiagramm(c,'','Plot a graph showing the ratio of medicine to engineering.') % ratio calculatioo
%
%
% See also: chatdestatisJSONfindtabs, destatisJSONreadtab
%
%
% Copyright 2025 Tim C. Lueth

save2clipboard(var)- simply saves the content of a variable to the "clipboard" to use it with paste

save2clipboard(var)% save2clipboard(var) - simply saves the content of a variable to the "clipboard" to use it with paste
% (by Tim Lueth, SG-Lib, 2025-OKT-31 as class: TEXT/STRS/CHARS/LINKS)
%
% USE CAREFULLY: save2clipboard was not being tested extensively
%
% works with
% a) text and
% b) images (Status of: 2025-11-05)
%
% Introduced first in SolidGeometry 5.6
%
% See also: paste2code
%
% save2clipboard(var)
% === INPUT PARAMETERS ===
% var: variable to be saved into the cipboard
%
% EXAMPLE:
% c='This is a test'
% save2clipboard(c) % try command-v afterwards
% A=imread('peppers.png');
% save2clipboard(A) % copy in word afterwards
%
% See also: paste2code
%
%
% Copyright 2025 Tim C. Lueth

destatisJSONreadtab(tabnr,token)- can be used to download data tables of the german national data institute

destatisJSONreadtab(tabnr,token)% destatisJSONreadtab(tabnr,token) - can be used to download data tables of the german national data institute
% (by Tim Lueth, SG-Lib, 2025-OKT-31 as class: ARTIFICIAL INTELLIGENCE)
%
% =======================================================================
% DEVELOPER PROCEDURE (2025-11-03) - NOT INTENDED TO BE RELEASED
% =======================================================================
%
% Use destatisJSONfindtabs to search for data and this fnctn for extraxtion, and
% chatdiagramm for display (Status of: 2025-10-31)
%
% Introduced first in SolidGeometry 5.6
%
% See also: destatisJSONfindtabs, chatdiagramm
%
% [TAB,EXP,SRC,data]=destatisJSONreadtab([tabnr,token])
% === INPUT PARAMETERS ===
% tabnr: table number with respect to destatisJSONfindtabs
% token: private registered account API token
% === OUTPUT RESULTS ======
% TAB: part of source that is rthe real table
% EXP: part of source that is comment of the table
% SRC: complete source as text
% data: originl struct retured from destatis genesis
%
% EXAMPLE:
% destatisJSONfindtabs('promovierende')
% [a,b,c]=destatisJSONreadtab('21352-0002'); % Table of the doctorl titles sorted by faculty
% c
% chatdiagramm(c,'','Display the table as a diagram')
%
% See also: destatisJSONfindtabs, chatdiagramm
%
%
% Copyright 2025 Tim C. Lueth

destatisJSONfindtabs(term,token)- searches for tables in the destatis genesis data base api using the JSON POST API

destatisJSONfindtabs(term,token)% destatisJSONfindtabs(term,token) - searches for tables in the destatis genesis data base api using the JSON POST API
% (by Tim Lueth, SG-Lib, 2025-OKT-31 as class: ARTIFICIAL INTELLIGENCE)
%
% =======================================================================
% DEVELOPER PROCEDURE (2025-11-03) - NOT INTENDED TO BE RELEASED
% =======================================================================
%
% Introduced first in SolidGeometry 5.6
%
% See also: destatisJSONreadtab, chatdiagramm
%
% tabs=destatisJSONfindtabs([term,token])
% === INPUT PARAMETERS ===
% term: Search term
% token: private registered account API token
% === OUTPUT RESULTS ======
% tabs: cell {number-as-chars, description, time}
%
% EXAMPLE:
% destatisJSONfindtabs('promovierende',)
% destatisJSONfindtabs('Bevölkerungsentwicklung',) % 99911-0001
% destatisJSONfindtabs('Bevölkerung Deutschland',) % 48 entries
%
% See also: destatisJSONreadtab, chatdiagramm
%
%
% Copyright 2025 Tim C. Lueth

str2datenum(txt,loc)- converts am formatted date string into a date num for numerical analysis

str2datenum(txt,loc)% str2datenum(txt,loc) - converts am formatted date string into a date num for numerical analysis
% (by Tim Lueth, SG-Lib, 2025-OKT-31 as class: TEXT/STRS/CHARS/LINKS)
%
% There is only once chance in matlab by using try and catch to detect wrong
% dataformat. Therefor, this fnctn uses a persistant table of formats. The last
% "fnctning" or correct data format is stored in the first position in the table
% so that it is checked first during subsequent calls, thereby optimising speed.
% (Status of: 2025-11-03)
%
% Introduced first in SolidGeometry 5.6
%
% See also: num2strUP, sprintfvec, num2strCNT, datestr
%
% [dtn,wfmt]=str2datenum(txt,[loc])
% === INPUT PARAMETERS ===
% txt: text of date format
% loc: location default is 'de_DE'
% === OUTPUT RESULTS ======
% dtn: datenum
% wfmt: successful date format
%
% EXAMPLE:
% [a,b]=str2datenum('1.1.2024'), [a,b]=str2datenum('2024-okt-12')
%
% See also: num2strUP, sprintfvec, num2strCNT, datestr
%
%
% Copyright 2025 Tim C. Lueth

char2html(tinp)- converts german "Umlaute" and other speciel characters into UTF8 html code

char2html(tinp)% char2html(tinp) - converts german "Umlaute" and other speciel characters into UTF8 html code
% (by Tim Lueth, SG-Lib, 2025-OKT-31 as class: TEXT/STRS/CHARS/LINKS)
%
% simple call java fnctn java.net.URLEncoder.encode(tinp, 'UTF-8')
%
% java.net.URLDecoder.decode(tinp, "UTF-8") (Status of: 2025-11-03)
%
% Introduced first in SolidGeometry 5.6
%
% See also: char2rgb, html2char
%
% tout=char2html(tinp)
% === INPUT PARAMETERS ===
% tinp: string including UTH chars
% === OUTPUT RESULTS ======
% tout: A character string in which the special characters have been converted
% into UTF-8.
%
% EXAMPLE:
% char2html("Bevölkerungsentwicklung")
% html2char(char2html("Bevölkerungsentwicklung"))
%
% See also: char2rgb, html2char
%
%
% Copyright 2025 Tim C. Lueth

JAVAemailServerImap(account,FOI)- opens a JAVA mail server account

JAVAemailServerImap(account,FOI)% JAVAemailServerImap(account,FOI) - opens a JAVA mail server account
% (by Tim Lueth, SG-Lib, 2025-OKT-24 as class: CODING/DEVELOP)
%
% USE CAREFULLY: JAVAemailServerImap was not being tested extensively
%
% must be closed finally using store.close();
% there is also always a timeout (Status of: 2025-11-05)
%
% Introduced first in SolidGeometry 5.6
%
% [msgs,store]=JAVAemailServerImap([account,FOI])
% === INPUT PARAMETERS ===
% account: such as 'tim.lueth@ergosurg.com'
% FOI: Folder of interest; default is 'INBOX'
% === OUTPUT RESULTS ======
% msgs: ALL Messages of the FOLDER
% store: connection to the server
%
% EXAMPLE:
% [msgs,store]=JAVAemailServerImap('tim.lueth@ergosurg.com','INBOX','','imap.1und1.de')
%
%
% Copyright 2025 Tim C. Lueth

JAVAemailTUMimap(account,FOI,passw)- opens a JAVA imap mail server account with certificate for mail.tum.de

JAVAemailTUMimap(account,FOI,passw)% JAVAemailTUMimap(account,FOI,passw) - opens a JAVA imap mail server account with certificate for mail.tum.de
% (by Tim Lueth, SG-Lib, 2025-OKT-24 as class: CODING/DEVELOP)
%
% USE CAREFULLY: JAVAemailTUMimap was not being tested extensively
%
% This fnctn is independent on JAVAemailServerImap since an security certificate
% is requireed for mail.tum.de
% must be closed finally using store.close();
% there is also always a timeout (Status of: 2025-11-05)
%
% Introduced first in SolidGeometry 5.6
%
% See also: JAVAemailServerImap, JAVAemailreadtextmessage
%
% [msgs,store]=JAVAemailTUMimap([account,FOI,passw])
% === INPUT PARAMETERS ===
% account: default is gu28kix
% FOI: Folder of interest; default is 'INBOX'
% passw: password for email account. No F2A support
% === OUTPUT RESULTS ======
% msgs: ALL Messages of the FOLDER
% store: connection to the server
%
% EXAMPLE:
% [msgs,store]=JAVAemailTUMimap('gu28yik','INBOX');
% JAVAemailreadtextmessage(msgs(end))
%
% See also: JAVAemailServerImap, JAVAemailreadtextmessage
%
%
% Copyright 2025 Tim C. Lueth

memo()- memories of Tim Lueth on command line base automatically transfered into a text file

memo()% memo() - memories of Tim Lueth on command line base automatically transfered into a text file
% (by Tim Lueth, SG-Lib, 2025-OKT-21 as class: CODING/DEVELOP)
%
% =======================================================================
% DEVELOPER PROCEDURE (2025-10-24) - NOT INTENDED TO BE RELEASED
% =======================================================================
%
% It uses openAi chat for spell checking and translation (Status of: 2025-10-21)
%
% Introduced first in SolidGeometry 5.6
%
% See also: note, chat
%
% m=memo([])
% === OUTPUT RESULTS ======
% m: german and english entry as ascii string
%
% EXAMPLE:
% memo This memo func should be able to handle english or german memories
% memo Ich bin gespannt wir sich die Geldmenge M2 in USD/EUR/CHF weiter entwickeln wird
%
% See also: note, chat
%
%
% Copyright 2025 Tim C. Lueth

datetimearray(dateS,dateE)- creates a for time rows of financial data a vector of datenum dates

datetimearray(dateS,dateE)% datetimearray(dateS,dateE) - creates a for time rows of financial data a vector of datenum dates
% (by Tim Lueth, SG-Lib, 2025-OKT-21 as class: TUTORIAL)
%
% Introduced first in SolidGeometry 5.6
%
% See also: FINdataM2
%
% datevec=datetimearray(dateS,dateE)
% === INPUT PARAMETERS ===
% dateS:
% dateE:
% === OUTPUT RESULTS ======
% datevec:
%
% EXAMPLE:
% datetimearray('2024-01-01','2024-12-1')
%
% See also: FINdataM2
%
%
% Copyright 2025 Tim C. Lueth

FINdataM2(,"MIN","MAX","DOI")- loads excel sheets from FRED/EZB/SZB and shows them in a graph

FINdataM2(,% FINdataM2(,"MIN","MAX","DOI") - loads excel sheets from FRED/EZB/SZB and shows them in a graph
% (by Tim Lueth, SG-Lib, 2025-OKT-19 as class: TUTORIAL)
%
% =======================================================================
% DEVELOPER PROCEDURE (2025-11-14) - NOT INTENDED TO BE RELEASED
% =======================================================================
%
% You can ask for a cost-free FRED account at:
% "https://fredaccount.stlouisfed.org"
% You can ask for an cost-free API access at:
% "https://fred.stlouisfed.org/docs/api/api_key.html" (Status of: 2025-11-14)
%
% Introduced first in SolidGeometry 5.6
%
% See also: FINdataM2USAread
%
% [M2USD,M2EUR,M2CHF]=FINdataM2([,"MIN","MAX","DOI"])
% "MIN": 1st Date of the graph
% "MAX": lst Date of the graph
% "DOI": Date of interest to calibrate the 100% (1)
% === OUTPUT RESULTS ======
% M2USD: M2 USD
% M2EUR: M2 EUR
% M2CHF: M2 CHF
%
% See also: FINdataM2USAread
%
%
% Copyright 2025 Tim C. Lueth

wiesoweshalbwarum()- Fnct for using the "chatm" command with normal question words directly in the command line

wiesoweshalbwarum()% wiesoweshalbwarum() - Fnct for using the "chatm" command with normal question words directly in the command line
% (by Tim Lueth, SG-Lib, 2025-OKT-17 as class: ARTIFICIAL INTELLIGENCE)
%
% =======================================================================
% DEVELOPER PROCEDURE (2025-11-05) - NOT INTENDED TO BE RELEASED
% =======================================================================
%
% returns all possible question words that work according to the same principle
% (Status of: 2025-10-20)
%
% Introduced first in SolidGeometry 5.6
%
% See also: chat, chatm, chat1, finchat
%
% wiesoweshalbwarum([])
%
% EXAMPLE:
% depuseString wiesoweshalbwarum true % shows all the files that can be used directly as question
%
% See also: chat, chatm, chat1, finchat
%
%
% Copyright 2025 Tim C. Lueth

VLELofSGfeatureSurface(SG,)- creates edge list, contour indexe list and feature surface index list of a solid

VLELofSGfeatureSurface(SG,)% VLELofSGfeatureSurface(SG,) - creates edge list, contour indexe list and feature surface index list of a solid
% (by Tim Lueth, SG-Lib, 2025-SEP-29 as class: VLEL/SURFACES)
%
% USE CAREFULLY: VLELofSGfeatureSurface was not being tested extensively
%
% SGseparate is able to separate a solid into independent closed shells
% (Status of: 2025-10-01)
%
% Introduced first in SolidGeometry 5.6
%
% See also: VLELofSGfeatureEdge, SGseparate
%
% [VL,EL,CIL,FSIL,TT]=VLELofSGfeatureSurface(SG,[])
% === INPUT PARAMETERS ===
% SG:
% === OUTPUT RESULTS ======
% VL: Vertex list
% EL: Edge list
% CIL: Contour index list
% FSIL: feature surface index list
% TT: Transformation matrix of the center of a surface
%
% EXAMPLE:
% VLELofSGfeatureSurface(SGsample(54))
%
% See also: VLELofSGfeatureEdge, SGseparate
%
%
% Copyright 2025 Tim C. Lueth

SGsocketcover(I)- returns an image relief on top of a socket cover

SGsocketcover(I)% SGsocketcover(I) - returns an image relief on top of a socket cover
% (by Tim Lueth, SG-Lib, 2025-SEP-28 as class: COMPLETED CAD DESIGNS)
%
% The image can be loaded by imread oder imreadui (Status of: 2025-10-11)
%
% Introduced first in SolidGeometry 5.6
%
% See also: imreadui, CPLofimage, SGofCPLz, SGconcat
%
% SGall=SGsocketcover(I)
% === INPUT PARAMETERS ===
% I: Image that should become the relief
% === OUTPUT RESULTS ======
% SGall: Socket cover to print
%
% EXAMPLE:
% I=imreadui
% SGsocketcover(I)
%
%
% See also: imreadui, CPLofimage, SGofCPLz, SGconcat
%
%
% Copyright 2025 Tim C. Lueth

SGwriteSTEP(SG,FNAME)- This fnct exports Solid Geometries as STEP File to disk

SGwriteSTEP(SG,FNAME)% SGwriteSTEP(SG,FNAME) - This fnct exports Solid Geometries as STEP File to disk
% (by Tim Lueth & Robin Schregle, SG-Lib, 2025-SEP-26 as class: IMPORT/EXPORT)
%
% USE CAREFULLY: SGwriteSTEP was not being tested extensively
%
% ISO 10303-21 AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF
% Even if the SolidWorks import works on Windows, there are problems with many
% other STEP importers on Mac.
% There are also general problems with the self-intrusion of solids, such as
% SGsample(36). (Status of: 2025-09-26)
%
% Introduced first in SolidGeometry 5.6
%
% See also: STEPmanifoldsolidofSG, SGwriteSTL, VLFL_EXP74
%
% fname=SGwriteSTEP(SG,[FNAME])
% === INPUT PARAMETERS ===
% SG: Solid Geometry file name
% FNAME: File name
% === OUTPUT RESULTS ======
% fname: STEP file name
%
% EXAMPLE:
% SGwriteSTEP(SGbar,'A');
% SGwriteSTEP(SGsample(53),'B');
% SGwriteSTEP(SGsample(54),'C');
% SGwriteSTEP(SGsample(27),'D');
% for i=1:54;
% fn=sprintf('SGsample(%d)',i);
% dbprintf('"%s"',fn);
% cmd=sprintf('SGwriteSTEP(%s,''%s'');',fn,fn);
% eval(cmd);
% end
%
% See also: STEPmanifoldsolidofSG, SGwriteSTL, VLFL_EXP74
%
%
% Copyright 2025 Tim C. Lueth

VLFL_EXP74- Tutorial for testing the STEP exporter

VLFL_EXP74% VLFL_EXP74 - Tutorial for testing the STEP exporter
% (by Tim Lueth, SG-Lib, 2025-SEP-25 as class: TUTORIAL)
%
% createss samples of Solids using SGsample and exports it to SETP files in the
% desktopdir (Status of: 2025-09-26)
%
% Introduced first in SolidGeometry 5.6
%
% See also: SGwriteSTEP, SGsample
%
% VLFL_EXP74
%
% EXAMPLE:
% VLFL_EXP74
%
% See also: SGwriteSTEP, SGsample
%
%
% Copyright 2025 Tim C. Lueth

SGtoolboxdir- return the path during development or after toolbox installation

SGtoolboxdir% SGtoolboxdir - return the path during development or after toolbox installation
% (by Tim Lueth, SG-Lib, 2025-SEP-24 as class: FILE HANDLING)
%
% SGlibpath and SGtoolboxdir are the same fnctn (Status of: 2025-09-24)
%
% Introduced first in SolidGeometry 5.6
%
% See also: SGlibpath
%
% tbdir=SGtoolboxdir
% === OUTPUT RESULTS ======
% tbdir: toolboxdir
%
% EXAMPLE:
% SGtoolboxdir
%
% See also: SGlibpath
%
%
% Copyright 2025 Tim C. Lueth

SGreadSTEPstructure(fname)- reads in a simple STEP file structure generated by SG-Lib - not in general

SGreadSTEPstructure(fname)% SGreadSTEPstructure(fname) - reads in a simple STEP file structure generated by SG-Lib - not in general
% (by Tim Lueth, SG-Lib, 2025-SEP-24 as class: CODING/DEVELOP)
%
% =======================================================================
% DEVELOPER PROCEDURE (2025-09-26) - NOT INTENDED TO BE RELEASED
% =======================================================================
%
% Recommendation by Rold, Cömert, and Schregle to create a step exporter This
% fnctn was used to import a SETP file exported from SolidWorks (Robin Schregle)
% and display it hierarchically. With the help of manual reading and
% interpretation of this structure, the fnctns "SG2STEP" /
% "STEPmanifoldSolidBrepofSG" were then written. (Status of: 2025-09-25)
%
% Introduced first in SolidGeometry 5.6
%
% See also: SG2STEP
%
% ftxt=SGreadSTEPstructure([fname])
% === INPUT PARAMETERS ===
% fname: full file name of a step file ceated by any CAD system
% === OUTPUT RESULTS ======
% ftxt: text of a step file
%
% EXAMPLE:
% clc; SGreadSTEPstructure('/Users/timlueth/Desktop/STEPcube_10x10x10mm_BODY_ONLY.step'); ttxt=ans
%
% See also: SG2STEP
%
%
% Copyright 2025 Tim C. Lueth

STEPmanifoldSolidBrepofSG(SG,alpha,mm)- returns the text lines for a ISO-10303-21 AP242 Manifold Geometry Boundary Representation

STEPmanifoldSolidBrepofSG(SG,alpha,mm)% STEPmanifoldSolidBrepofSG(SG,alpha,mm) - returns the text lines for a ISO-10303-21 AP242 Manifold Geometry Boundary Representation
% (by Tim Lueth, SG-Lib, 2025-SEP-23 as class: IMPORT/EXPORT)
%
% This fnctn (originally named SG2STEP) is the core of SGwriteSTEP
% It was tested in September 2025 using Solidworks (Status of: 2025-09-26)
%
% Introduced first in SolidGeometry 5.6
%
% See also: SGreadSTEPstructure, SG2STEP
%
% [ttorg,mm]=STEPmanifoldSolidBrepofSG(SG,[alpha,mm])
% === INPUT PARAMETERS ===
% SG: Solid Geoemtry to create a Manifold Geometry Bopundary representation
% alpha: Limit angle for separating feature surfaces; default is 0.01
% mm: number of used step lines already for other BREPS; default is 0
% === OUTPUT RESULTS ======
% ttorg: STEP text lines for the Manifold Geometry Bopundary representation
% mm: last number of created step line
%
% EXAMPLE:
% STEPmanifoldSolidBrepofSG(SGbar);
% STEPmanifoldSolidBrepofSG(SGsample(53));
% STEPmanifoldSolidBrepofSG(SGsample(54));
% STEPmanifoldSolidBrepofSG(SGsample(27));
%
% See also: SGreadSTEPstructure, SG2STEP
%
%
% Copyright 2025 Tim C. Lueth

SGcreateToolboxHTMLfilesfromhelptoc(tboxdir)- creates the SGLIB_HELP_Structures/html documentation from the existing helptoc file in SGLIB_HELP_Structures

SGcreateToolboxHTMLfilesfromhelptoc(tboxdir)% SGcreateToolboxHTMLfilesfromhelptoc(tboxdir) - creates the SGLIB_HELP_Structures/html documentation from the existing helptoc file in SGLIB_HELP_Structures
% (by Tim Lueth, SG-Lib, 2025-SEP-21 as class: CODING/DEVELOP)
%
% =======================================================================
% DEVELOPER PROCEDURE (2025-09-21) - NOT INTENDED TO BE RELEASED
% =======================================================================
%
% parses the "helptoc.xml" file in "SGLIB_HELP_Structures/html" and creates a
% list of required html file that have to be copied by using.
% Copies into pcodedirTL
% 1) "SGLIB_HELP_Structures/info.xml" ==> Pointer to doc html folder
% 2) "SGLIB_HELP_Structures/helptoc.xml" ==> html search fileand toc file
% 3) "SGLIB_HELP_Structures/index.html" ==> html start point
% 4) "SGLIB_HELP_Structures/html/SGLIBPICS " ==> Folder with all pics
% 5) creates all missing tutorial html files using "mfile2mlxfile4markup"
% 6) copies all html files listed by helptoc2htmllist
% (Status of: 2025-09-21)
%
% Introduced first in SolidGeometry 5.6
%
% See also: helptoc2htmllist, mfile2mlxfile4markup,
% SGcreateToolboxHtmlfilesfromToolbox_test
%
% SGcreateToolboxHTMLfilesfromhelptoc([tboxdir])
% === INPUT PARAMETERS ===
% tboxdir:
%
% See also: helptoc2htmllist, mfile2mlxfile4markup,
% SGcreateToolboxHtmlfilesfromToolbox_test
%
%
% Copyright 2025 Tim C. Lueth

helptoc2htmllist(helptocfile)- reads the helptoc.xml file and creates a list of required html files

helptoc2htmllist(helptocfile)% helptoc2htmllist(helptocfile) - reads the helptoc.xml file and creates a list of required html files
% (by Tim Lueth, SG-Lib, 2025-SEP-21 as class: CODING/DEVELOP)
%
% =======================================================================
% DEVELOPER PROCEDURE (2025-09-21) - NOT INTENDED TO BE RELEASED
% =======================================================================
%
% parses the "helptoc.xml" file in "SGLIB_HELP_Structures/html" and creates a
% list of required html file that have to be copied
% used in SGcreateToolboxHTMLfilesfromhelptoc (Status of: 2025-09-21)
%
% Introduced first in SolidGeometry 5.6
%
% See also: SGcreateToolboxHTMLfilesfromhelptoc
%
% llc=helptoc2htmllist([helptocfile])
% === INPUT PARAMETERS ===
% helptocfile:
% === OUTPUT RESULTS ======
% llc:
%
% EXAMPLE:
% helptoc2htmllist
%
% See also: SGcreateToolboxHTMLfilesfromhelptoc
%
%
% Copyright 2025 Tim C. Lueth

pcodedirTLtouch- touches all files (not folders) in "pcodedirTL" to avoid warning with p and m files during toolbox execution

pcodedirTLtouch% pcodedirTLtouch - touches all files (not folders) in "pcodedirTL" to avoid warning with p and m files during toolbox execution
% (by Tim Lueth, SG-Lib, 2025-SEP-21 as class: CODING/DEVELOP)
%
% =======================================================================
% DEVELOPER PROCEDURE (2025-09-21) - NOT INTENDED TO BE RELEASED
% =======================================================================
%
% Introduced first in SolidGeometry 5.6
%
% See also: ftouch, ftouchcreationdate
%
% ant=pcodedirTLtouch
% === OUTPUT RESULTS ======
% ant: answer of system command
%
% EXAMPLE:
% pcodedirTLtouch % touches the pcodedirTL folder
%
% See also: ftouch, ftouchcreationdate
%
%
% Copyright 2025 Tim C. Lueth

SGcreateToolboxHtmlfilesfromToolbox_test- Simply moves the results of VLFL_Toolbox_test to pcodedir

SGcreateToolboxHtmlfilesfromToolbox_test% SGcreateToolboxHtmlfilesfromToolbox_test - Simply moves the results of VLFL_Toolbox_test to pcodedir
% (by Tim Lueth, SG-Lib, 2025-SEP-20 as class: CODING/DEVELOP)
%
% =======================================================================
% DEVELOPER PROCEDURE (2025-09-21) - NOT INTENDED TO BE RELEASED
% =======================================================================
%
% During VLFL_Toolbox_test, the workdir is changed to separate the html files
% from the workdir's html files.
% The html folder that is filled by publishing all examples or demos of name
% "VLFL_EXP00" is located at
% [desktopdir 'Toolbox_test' pcodedirTL html]. Those files have to be copied into
% pcodedirTL / html so that they are later found as examples after packing the
% Toolbox
%
% 1) VLFL_Toolbox_make
% 2) Create html files in folder "SGLIB_HELP_Structures" using FM Database
% 3)
% repair json file - copy json file (part of VLFL_Toolbox_make)
% SGcreateToolboxMfilesfromPfiles(pcodedirTL); (part of VLFL_Toolbox_make)
%
%
%
%
% VLFL_Toolbox_test(1:80,'noinp')
% VLFL_Toolbox_test(1:80,'isinp')
%
% (Status of: 2025-09-21)
%
% Introduced first in SolidGeometry 5.6
%
% See also: SGcreateToolboxfromFolder, SGcreateToolboxHTMLfilesfromhelptoc
%
% SGcreateToolboxHtmlfilesfromToolbox_test
%
% See also: SGcreateToolboxfromFolder, SGcreateToolboxHTMLfilesfromhelptoc
%
%
% Copyright 2025 Tim C. Lueth

SGcreateToolboxMfilesfromPfiles(tboxdir)- searches the pcodeTLdir for p-file and adds the help text as m-file, if no m-file exist

SGcreateToolboxMfilesfromPfiles(tboxdir)% SGcreateToolboxMfilesfromPfiles(tboxdir) - searches the pcodeTLdir for p-file and adds the help text as m-file, if no m-file exist
% (by Tim Lueth, SG-Lib, 2025-SEP-19 as class: CODING/DEVELOP)
%
% =======================================================================
% DEVELOPER PROCEDURE (2025-09-21) - NOT INTENDED TO BE RELEASED
% =======================================================================
%
% it uses pcodeTLaddmfilehelp
% and removes anyway 'VLFLlicense.m*', 'VLFLlicenseTL.*', 'VLFL_Toolbox_make.*'])
% for some reason in pcode and pcodeTL some m files are missing. (Status of:
% 2025-09-20)
%
% Introduced first in SolidGeometry 5.6
%
% See also: pcodeTLaddmfilehelp
%
% SGcreateToolboxMfilesfromPfiles([tboxdir])
% === INPUT PARAMETERS ===
% tboxdir: default is pcodedirTL
%
% See also: pcodeTLaddmfilehelp
%
%
% Copyright 2025 Tim C. Lueth

pcodeTLaddmfilehelp (fname)- creates a short m-file just with the help text from the original m-file if a p-file exist

pcodeTLaddmfilehelp (fname)% pcodeTLaddmfilehelp (fname) - creates a short m-file just with the help text from the original m-file if a p-file exist
% (by Tim Lueth, SG-Lib, 2025-SEP-19 as class: CODING/DEVELOP)
%
% =======================================================================
% DEVELOPER PROCEDURE (2025-09-20) - NOT INTENDED TO BE RELEASED
% =======================================================================
%
% For some reasons, some p-files in the pcodeTL folder do not have a
% corresponding m-file with the help text. This fnctn does the job for ONE SINGLE
% fnctn name. It is used by fnctn "SGcreateToolboxMfilesfromPfiles" and is part
% of "SGcreateToolboxfunctdependenciesfromFolder" (Status of: 2025-09-20)
%
% Introduced first in SolidGeometry 5.6
%
% See also: pcodeTL, SGcreateToolboxfunctdependenciesfromFolder,
% SGcreateToolboxfromFolder
%
% pcodeTLaddmfilehelp(fname)
% === INPUT PARAMETERS ===
% fname: str with SGlib command
%
% See also: pcodeTL, SGcreateToolboxfunctdependenciesfromFolder,
% SGcreateToolboxfromFolder
%
%
% Copyright 2025 Tim C. Lueth

SGcreateToolboxfunctdependenciesfromFolder(tboxdir)- Creates a dependecy analysis of a later toolbox folder and writes a text of missing files in current pcodedirTL

SGcreateToolboxfunctdependenciesfromFolder(tboxdir)% SGcreateToolboxfunctdependenciesfromFolder(tboxdir) - Creates a dependecy analysis of a later toolbox folder and writes a text of missing files in current pcodedirTL
% (by Tim Lueth, SG-Lib, 2025-SEP-19 as class: CODING/DEVELOP)
%
% =======================================================================
% DEVELOPER PROCEDURE (2025-09-21) - NOT INTENDED TO BE RELEASED
% =======================================================================
%
% Takes about 3h on M3 Pro. for 2000 fnctns (Status of: 2025-09-19)
%
% Introduced first in SolidGeometry 5.6
%
% See also: SGcreateToolboxfromFolder
%
% SGcreateToolboxfunctdependenciesfromFolder([tboxdir])
% === INPUT PARAMETERS ===
% tboxdir:
%
% EXAMPLE:
% SGcreateToolboxfunctdependenciesfromFolder(desktopdir('2025-09-17_TL_PCODE'))
%
% See also: SGcreateToolboxfromFolder
%
%
% Copyright 2025 Tim C. Lueth

SGcreateToolboxfromFolder(tboxdir)- packs a SG-Lib toolbox after VLFL_Toolbox_Make has been used

SGcreateToolboxfromFolder(tboxdir)% SGcreateToolboxfromFolder(tboxdir) - packs a SG-Lib toolbox after VLFL_Toolbox_Make has been used
% (by Tim Lueth, SG-Lib, 2025-SEP-19 as class: CODING/DEVELOP)
%
% =======================================================================
% DEVELOPER PROCEDURE (2025-09-19) - NOT INTENDED TO BE RELEASED
% =======================================================================
%
% Since packaging of a Toolbox gets more an more difficult and extremely slow by
% the Mathworks Interface, the following fnctn ist use:
%
% Step 09: The toolbox options are created using
% "matlab.addons.toolbox.ToolboxOptions"
% Step 10: The toolbox is packed by using "matlab.addons.toolbox.packageToolbox"
% (Status of: 2025-09-19)
%
% Introduced first in SolidGeometry 5.6
%
% See also: SGcreateToolboxMfilesfromPfiles
%
% SGcreateToolboxfromFolder([tboxdir])
% === INPUT PARAMETERS ===
% tboxdir: default is pcodedirTL
%
% EXAMPLE:
% SGcreateToolboxfromFolder(desktopdir('2025-09-17_TL_PCODE')))
% SGcreateToolboxfromFolder(pcodedirTL)
%
% See also: SGcreateToolboxMfilesfromPfiles
%
%
% Copyright 2025 Tim C. Lueth

VLFL_EXP73- Tutorial for testing the chat fncts for the openAI interface

VLFL_EXP73% VLFL_EXP73 - Tutorial for testing the chat fncts for the openAI interface
% (by Tim Lueth, SG-Lib, 2025-SEP-18 as class: TUTORIAL)
%
% Introduced first in SolidGeometry 5.6
%
% See also: chat, chat1
%
% VLFL_EXP73
%
% EXAMPLE:
% VLFL_EXP73
%
% See also: chat, chat1
%
%
% Copyright 2025 Tim C. Lueth

cellstradjustlen(OCC)- adjust in each col of acell array or table the length of char string

cellstradjustlen(OCC)% cellstradjustlen(OCC) - adjust in each col of acell array or table the length of char string
% (by Tim Lueth, SG-Lib, 2025-SEP-16 as class: CODING/DEVELOP)
%
% USE CAREFULLY: cellstradjustlen was not being tested extensively
%
% works with cell cols und tabel cols
% required for cell2mat, since some positive matlab concepts have changed over
% time. (Status of: 2025-09-18)
%
% Introduced first in SolidGeometry 5.6
%
% See also: cell2mat, uniquecell
%
% CC=cellstradjustlen(OCC)
% === INPUT PARAMETERS ===
% OCC: Original cell array or table
% === OUTPUT RESULTS ======
% CC: cell array or table in which all strings of a column have the same length
%
% EXAMPLE:
% cell2mat({'A';'A B'; 'A B C'; 'A D'}) % fails adjust strlen in column
% cellstradjustlen({'A';'A B'; 'A B C'; 'A D'}) % adjust strlen in column
% cell2mat(cellstradjustlen({'A';'A B'; 'A B C'; 'A D'})) % does work now
%
% See also: cell2mat, uniquecell
%
%
% Copyright 2025 Tim C. Lueth

CPLremovecollinearpoints(CPL)- removes 2D/3D collinear point with different results for opened and closed CPL/CVL

CPLremovecollinearpoints(CPL)% CPLremovecollinearpoints(CPL) - removes 2D/3D collinear point with different results for opened and closed CPL/CVL
% (by Tim Lueth, SG-Lib, 2025-SEP-14 as class: CPL/CLOSED POLYGON LISTS)
%
% USE CAREFULLY: CPLremovecollinearpoints was not being tested extensively
%
% For closed and opend CPL/CVL in 2D/3D. Start and end points can be removed for
% closed CPL/CVL if there is no kink when it is a closed contour.If it is an open
% contour, be aware that start an endpoint will remain, even they are collinear
% points (Status of: 2025-09-14)
%
% Introduced first in SolidGeometry 5.6
%
% See also: CPLinsertcollinearpoints, CVLremstraightAmin, CVLaddauxpoints
%
% CPLremovecollinearpoints(CPL)
% === INPUT PARAMETERS ===
% CPL: 2D/3D open or closed CPL; Behavior differers
%
% EXAMPLE:
% CPLremovecollinearpoints(circshift(CPLaddauxpoints(PLsquare(10),1), 0)) % open CPL remain Start/End
% CPLremovecollinearpoints(circshift(CPLaddauxpoints(PLsquare(10),1),-1)) % open CPL remain Start/End
% CPLremovecollinearpoints(circshift(CPLaddauxpoints(PLsquare(10),1),+1)) % open CPL remain Start/End
%
% CPLremovecollinearpoints(closedCPL((circshift(CPLaddauxpoints(PLsquare(10),1), 0)))) % closed CPL
% CPLremovecollinearpoints(closedCPL((circshift(CPLaddauxpoints(PLsquare(10),1), 0)))) % closed CPL
% CPLremovecollinearpoints(closedCPL((circshift(CPLaddauxpoints(PLsquare(10),1), 0)))) % closed CPL
%
%
% See also: CPLinsertcollinearpoints, CVLremstraightAmin, CVLaddauxpoints
%
%
% Copyright 2025 Tim C. Lueth

PLELofCPLunchng(CPL)- creates a 2D/3D PLEL exactly as give in the CPL/CVL - THIS CREATES PROBLEMS WITH CLOSED CPLS

PLELofCPLunchng(CPL)% PLELofCPLunchng(CPL) - creates a 2D/3D PLEL exactly as give in the CPL/CVL - THIS CREATES PROBLEMS WITH CLOSED CPLS
% (by Tim Lueth, SG-Lib, 2025-SEP-14 as class: PLEL/POINT LIST/EDGE LIST)
%
% =======================================================================
% DEVELOPER PROCEDURE (2025-09-14) - NOT INTENDED TO BE RELEASED
% =======================================================================
%
% ONLY FOR TESTING - CREATES PROBLEMS WITH DOUBLED PLOINTS AND EDGES OF LENGTH 0
% FOR CLOSED CPLS
% speed optimized fnctn
% more or less for testing: Better use "PLELofCPLplain(CPL,'open')" or
% "PLELofCPLplain(CPL,'closed')"
% While PLELofCPLplain returns always opened or closed CPLs, this fnctn is mainly
% for testing mathworks products (DELAUNAYTRI, DELAUNAY, triangulation, polybool,
% polyshape, delaunaytriangulation etc.)
% but als ELreconnect and ELofELmesh (Status of: 2025-09-14)
%
% Introduced first in SolidGeometry 5.6
%
% See also: PLELofCPLplain
%
% [NPL,NEL]=PLELofCPLunchng(CPL)
% === INPUT PARAMETERS ===
% CPL: nan separated contours in 2D or 3D
% === OUTPUT RESULTS ======
% NPL: Complete point list as it was given as CPL (including all doubles etc.)
% NEL: Complete edge list as it was given as CPL open if open, closed if closed
%
% EXAMPLE:
% PLELofCPLunchng([PLcircle(1);nan nan;closedCPL(PLcircle(1)+[5 0])]) % 2D
% PLELofCPLunchng(VLaddz([PLcircle(1);nan nan;closedCPL(PLcircle(1)+[5 0])])); % 3D
%
% See also: PLELofCPLplain
%
%
% Copyright 2025 Tim C. Lueth

openedCVL(CVL,lim)- closes all contours in CPL(2D) and CVL(3D) after removal of all consecutive identical points.

openedCVL(CVL,lim)% openedCVL(CVL,lim) - closes all contours in CPL(2D) and CVL(3D) after removal of all consecutive identical points.
% (by Tim Lueth, SG-Lib, 2025-SEP-14 as class: CPL/CLOSED POLYGON LISTS)
%
% USE CAREFULLY: openedCVL was not being tested extensively
%
% just calls "openedCPL" which ist the same fnctnlity.
% new speed optimized fnctn of 2025 to replace PLofCPL in future
% It removes all consecutive identical points.
% concept same as VLremsuccident
% ii=vecnormr(CPLi-circshift(CPLi,-1))>lim; OCPLi=CPLi(ii,:);
% (Status of: 2025-09-14)
%
% Introduced first in SolidGeometry 5.6
%
% See also: PLofCPL, CPLofPL, openedCPL, closedCPL, closedCVL
%
% NCVL=openedCVL(CVL,[lim])
% === INPUT PARAMETERS ===
% CVL: Contour 2D or 3D with NaN embedded contours
% lim: default is 1e-12 for removal of succeding points
% === OUTPUT RESULTS ======
% NCVL: New contours 2D/3D with all open contours without any consecutive
% identical point
%
% EXAMPLE:
% openedCVL(CPLsample(47)) % 2D case
% openedCVL(VLaddz(CPLsample(47))) % 3D case
% openedCVL(VLaddz(closedCVL(CPLsample(47)))) % 3D case with all closed before
%
%
% See also: PLofCPL, CPLofPL, openedCPL, closedCPL, closedCVL
%
%
% Copyright 2025 Tim C. Lueth

closedCVL(CVL,lim)- closes all contours in CPL(2D) and CVL(3D) after removal of all consecutive identical point before

closedCVL(CVL,lim)% closedCVL(CVL,lim) - closes all contours in CPL(2D) and CVL(3D) after removal of all consecutive identical point before
% (by Tim Lueth, SG-Lib, 2025-SEP-14 as class: CPL/CLOSED POLYGON LISTS)
%
% USE CAREFULLY: closedCVL was not being tested extensively
%
% just calls "closedCPL" which ist the same fnctnlity.
% new speed optimized fnctn of 2025 to replace CPLofPL in future
% It removes all consecutive identical points and adds the first as last again
% concept same as VLremsuccident
% ii=vecnormr(CPLi-circshift(CPLi,-1))>lim; OCPLi=CPLi(ii,:);
% (Status of: 2025-09-14)
%
% Introduced first in SolidGeometry 5.6
%
% See also: PLofCPL, CPLofPL, openedCPL, closedCPL, openedCVL
%
% NCVL=closedCVL(CVL,[lim])
% === INPUT PARAMETERS ===
% CVL: Contour 2D or 3D with NaN embedded contours
% lim: default is 1e-12 for removal of succeding points
% === OUTPUT RESULTS ======
% NCVL: New contours 2D/3D with all closed contours openedCPL, closedCPL, without
% any consecutive identical point
%
% EXAMPLE:
% closedCVL(openedCVL(CPLsample(47))) % 2D case
% closedCVL(VLaddz(CPLsample(47))) % 3D case
% closedCVL(VLaddz(openedCVL(CPLsample(47)))) % 3D case with opening before
%
%
% See also: PLofCPL, CPLofPL, openedCPL, closedCPL, openedCVL
%
%
% Copyright 2025 Tim C. Lueth

closedCPL(CPL,lim)- closes all contours in CPL(2D) and CVL(3D) without any other change beside removal of all consecutive identical point before

closedCPL(CPL,lim)% closedCPL(CPL,lim) - closes all contours in CPL(2D) and CVL(3D) without any other change beside removal of all consecutive identical point before
% (by Tim Lueth, SG-Lib, 2025-SEP-14 as class: CPL/CLOSED POLYGON LISTS)
%
% USE CAREFULLY: closedCPL was not being tested extensively
%
% new speed optimized fnctn of 2025 to replace CPLofPL in future
% It removes all consecutive identical points and adds the first as last again
% concept same as VLremsuccident
% ii=vecnormr(CPLi-circshift(CPLi,-1))>lim; OCPLi=CPLi(ii,:);
% (Status of: 2025-09-14)
%
% Introduced first in SolidGeometry 5.6
%
% See also: PLofCPL, CPLofPL, openedCPL, openedCVL, closedCVL
%
% NCPL=closedCPL(CPL,[lim])
% === INPUT PARAMETERS ===
% CPL: Contour 2D or 3D with NaN embedded contours
% lim: default is 1e-12 for removal of succeding points
% === OUTPUT RESULTS ======
% NCPL: New contours 2D/3D with all closed contours without any consecutive
% identical point
%
% EXAMPLE:
% closedCPL(PLofCPL(CPLsample(47))) % 2D case
% closedCPL(VLaddz(CPLsample(47))) % 3D case
% closedCPL(VLaddz(openedCPL(CPLsample(47)))) % 3D case with opening before
%
%
% See also: PLofCPL, CPLofPL, openedCPL, openedCVL, closedCVL
%
%
% Copyright 2025 Tim C. Lueth

openedCPL(CPL,lim)- opens all contours in CPL(2D) and CVL(3D) without any other change beside removal of all consecutive identical points.

openedCPL(CPL,lim)% openedCPL(CPL,lim) - opens all contours in CPL(2D) and CVL(3D) without any other change beside removal of all consecutive identical points.
% (by Tim Lueth, SG-Lib, 2025-SEP-14 as class: CPL/CLOSED POLYGON LISTS)
%
% USE CAREFULLY: openedCPL was not being tested extensively
%
% new speed optimized fnctn of 2025 to replace PLofCPL in future
% It removes all consecutive identical points.
% concept same as VLremsuccident
% ii=vecnormr(CPLi-circshift(CPLi,-1))>lim; OCPLi=CPLi(ii,:);
% (Status of: 2025-09-14)
%
% Introduced first in SolidGeometry 5.6
%
% See also: PLofCPL, CPLofPL, closedCPL, openedCVL, closedCVL
%
% NCPL=openedCPL(CPL,[lim])
% === INPUT PARAMETERS ===
% CPL: Contour 2D or 3D with NaN embedded contours
% lim: default is 1e-12 for removal of succeding points
% === OUTPUT RESULTS ======
% NCPL: New contours 2D/3D with all open contours without any consecutive
% identical point
%
% EXAMPLE:
% openedCPL(CPLsample(47)) % 2D case
% openedCPL(VLaddz(CPLsample(47))) % 3D case
% openedCPL(VLaddz(CPLofPL(CPLsample(47)))) % 3D case with all closed before
%
%
% See also: PLofCPL, CPLofPL, closedCPL, openedCVL, closedCVL
%
%
% Copyright 2025 Tim C. Lueth

CPLplotasPSplain(CPL)- Plots each individual embedded CPL as a separate contour.

CPLplotasPSplain(CPL)% CPLplotasPSplain(CPL) - Plots each individual embedded CPL as a separate contour.
% (by Tim Lueth, SG-Lib, 2025-SEP-13 as class: VISUALIZATION)
%
% USE CAREFULLY: CPLplotasPSplain was not being tested extensively
%
% Due to the constant expansion of polyshape, it is necessary to have fnctns that
% can still clearly represent the underlying CPL before a simplify (split point
% separation), orientation change, or removal of collinear points occurs by
% default. (Status of: 2025-09-13)
%
% Introduced first in SolidGeometry 5.6
%
% See also: CPLplotasPS, CPSplot, CPLplothatched
%
% h=CPLplotasPSplain(CPL)
% === INPUT PARAMETERS ===
% CPL: CPL with nan separated CPLi
% === OUTPUT RESULTS ======
% h: handle
%
% EXAMPLE:
% CPL=[PLcircle(10);nan nan;PLcircle(10)+4];
% SGfigure; CPLplotasPSplain(CPL);
% SGfigure; CPLplotasPSplain(CPLsample(47));
%
% See also: CPLplotasPS, CPSplot, CPLplothatched
%
%
% Copyright 2025 Tim C. Lueth

PLELofCPLplain(CPL,"open","closed")- returns a PL and EL and a modified CPL based on the explicit qish of "open" or "closed"

PLELofCPLplain(CPL,% PLELofCPLplain(CPL,"open","closed") - returns a PL and EL and a modified CPL based on the explicit qish of "open" or "closed"
% (by Tim Lueth, SG-Lib, 2025-SEP-13 as class: PLEL/POINT LIST/EDGE LIST)
%
% USE CAREFULLY: PLELofCPLplain was not being tested extensively
%
% Works with 2D and 3D contours. "plain" means here that there is no splitpoint
% separation or descomposition done!
% This fnctn of 2025 is required, since the original fnctn of 2014 was modified
% 2018 using the polyshape concept, which was modified by mathwork, so that since
% 2024, the original concept had to be used again. Since there is in general a
% problem how to handle closed and open contours, which sometimes is used
% explicitly and sometimes implicitly, this fnctn returns on default closed
% contours
% Remember, if you use CPLrepair in 2D, this can change the orientation of the
% CPLs. (Status of: 2025-09-13)
%
% Introduced first in SolidGeometry 5.6
%
% See also: PLELofCPL, PLELofCPLsplitpoints
%
% [NPL,NEL,NCPL]=PLELofCPLplain([CPL,"open","closed"])
% === INPUT PARAMETERS ===
% CPL: Closed Polygon list including nan separated contours
% "open": if used, the results describe an open contour
% "closed": if use, the results describe an closed contour
% === OUTPUT RESULTS ======
% NPL: New Point List
% NEL: New Edge List
% NCPL: New CPL, open or closed as required;
%
% EXAMPLE:
% PLELofCPLplain(CVLsample(18));
% PLELofCPLplain(CVLsample(18),'open');
% PLELofCPLplain(CPLsample(47));
% PLELofCPLplain(CPLrepair(CPLsample(47))); % separate contours first in 2D
%
% See also: PLELofCPL, PLELofCPLsplitpoints
%
%
% Copyright 2025 Tim C. Lueth

PLELradialEdgesofCPL(CPL,R,"open","closed")- Creates 2D/3D radial edges in closed contours and open paths

PLELradialEdgesofCPL(CPL,R,% PLELradialEdgesofCPL(CPL,R,"open","closed") - Creates 2D/3D radial edges in closed contours and open paths
% (by Tim Lueth, SG-Lib, 2025-SEP-13 as class: PLEL/POINT LIST/EDGE LIST)
%
% USE CAREFULLY: PLELradialEdgesofCPL was not being tested extensively
%
% This fnctn from 2025 always interprets the input parameter as a closed path.
% There is no check for path overlaps in 2D or 3D. This fnctn also works with VL
% (3D); this fnctn does not remove collinear points. This fnctn does not correct
% overlaps and intersections of contours. It does not change the orientation. The
% starting point will possibly moved in case of closed contours, if there is a
% kink at the start point.
% For paths instead of contours, "open" must be used explicitly.
%
% Some other effects of matlab made it necessary to reimplement the fnctn in 2025
% PLELofCPL (2014) was reimplemented by Tim Lueth (2018) using the polyshape
% class, but matlab changed the behavior of polyshape several times (collinear
% points, etc.), which made it impossible to track the influences of the changes.
% Even empty CPLs became a problem in 2024.
% This fnctn is NOT using PLELofCPL anymore.
% This fnctn uses ELofn to create the edge lists
% This fnctn uses "VLremsuccident" to open CPLs
% This fnctn uses VLtangentcirc to create the arcs.
% It uses selectNaN to separate nan separated contours.
% The concept of "open" will be used in future (Status of: 2025-09-13)
%
% Introduced first in SolidGeometry 5.6
%
% See also: VLremsuccident, VLtangentcirc
%
% [NPL,NEL,NCPL]=PLELradialEdgesofCPL(CPL,[R,"open","closed"])
% === INPUT PARAMETERS ===
% CPL: open or closed point list in 2D or 3D
% R: maximum radius >0 ; default is 1
% "open": if used, the result will be an open path not a contour
% "closed": if used, the result will a closed contour; this is default.
% === OUTPUT RESULTS ======
% NPL: New Point list; with modified start point
% NEL: New edge list;
% NCPL: NEW CPL list; open or closed as defined
%
% EXAMPLE:
% PLELradialEdgesofCPL(VLaddz(CPLofPL(PLsquare)))
% PLELradialEdgesofCPL(VLaddz(CPLofPL(PLsquare)),'open')
% [a,b,c]=PLELradialEdgesofCPL(VLaddz(CPLsample(3))); SGfigure; VLplot(c,'b*-'); c
% [a,b,c]=PLELradialEdgesofCPL(VLaddz(CPLsample(3)),'open'); SGfigure; VLplot(c,'b*-'); c
%
% See also: VLremsuccident, VLtangentcirc
%
%
% Copyright 2025 Tim C. Lueth

CVLinsertcollinearpoints(CVL,d)- inserts collinear auxiliary points that a minimum point distance is guaranteed

CVLinsertcollinearpoints(CVL,d)% CVLinsertcollinearpoints(CVL,d) - inserts collinear auxiliary points that a minimum point distance is guaranteed
% (by Tim Lueth, SG-Lib, 2025-SEP-12 as class: PL/POINT LISTS)
%
% USE CAREFULLY: CVLinsertcollinearpoints was not being tested extensively
%
% slightly different to RLaddauxpoints and CPLaddauxpoints
% does not create collinear auxiliary points if an edge is missing!
% Only if start and end point are the same, the last edge is also processed.
% Same as:
% PLinsertcollinearpoints == CPLinsertcollinearpoints ==
% CVLinsertcollinearpoints (Status of: 2025-09-12)
%
% Introduced first in SolidGeometry 5.6
%
% See also: RLaddauxpoints, CPLaddauxpoints, VLremsuccident,
% PLinsertcollinearpoints, CPLinsertcollinearpoints
%
% CVLN=CVLinsertcollinearpoints(CVL,[d])
% === INPUT PARAMETERS ===
% CVL: Point list without nan, open or closed
% d: maximum point distance to guarantee
% === OUTPUT RESULTS ======
% CVLN: Point list with collinear auxiliary points, open or closed as PL
%
% EXAMPLE:
% CVLinsertcollinearpoints(CVLsample(3),1) % open edge, identical point removed
% CVLinsertcollinearpoints(CVLsample(8),1) % closed contour, identical point removed
% CVLinsertcollinearpoints(CVLsample(16),1) % Does work also in 3D
% CVLinsertcollinearpoints(CVLsample(18),1) % Does work also with nan separated contours
%
% See also: RLaddauxpoints, CPLaddauxpoints, VLremsuccident,
% PLinsertcollinearpoints, CPLinsertcollinearpoints
%
%
% Copyright 2025 Tim C. Lueth

CPLinsertcollinearpoints(CPL,d)- inserts collinear auxiliary points that a minimum point distance is guaranteed

CPLinsertcollinearpoints(CPL,d)% CPLinsertcollinearpoints(CPL,d) - inserts collinear auxiliary points that a minimum point distance is guaranteed
% (by Tim Lueth, SG-Lib, 2025-SEP-12 as class: PL/POINT LISTS)
%
% USE CAREFULLY: CPLinsertcollinearpoints was not being tested extensively
%
% slightly different to RLaddauxpoints and CPLaddauxpoints
% does not create collinear auxiliary points if an edge is missing!
% Only if start and end point are the same, the last edge is also processed.
% Same as:
% PLinsertcollinearpoints == CPLinsertcollinearpoints ==
% CVLinsertcollinearpoints (Status of: 2025-09-12)
%
% Introduced first in SolidGeometry 5.6
%
% See also: RLaddauxpoints, CPLaddauxpoints, VLremsuccident,
% PLinsertcollinearpoints, CVLinsertcollinearpoints
%
% CPLN=CPLinsertcollinearpoints(CPL,[d])
% === INPUT PARAMETERS ===
% CPL: Point list without nan, open or closed
% d: maximum point distance to guarantee
% === OUTPUT RESULTS ======
% CPLN: Point list with collinear auxiliary points, open or closed as PL
%
% EXAMPLE:
% CPLinsertcollinearpoints(PLsample(3),1) % open edge, identical point removed
% CPLinsertcollinearpoints(PLsample(8),1) % closed contour, identical point removed
% CPLinsertcollinearpoints(VLsample(16),1) % Does work also in 3D
% CPLinsertcollinearpoints(VLsample(18),1) % Does work also with nan separated contours
%
% See also: RLaddauxpoints, CPLaddauxpoints, VLremsuccident,
% PLinsertcollinearpoints, CVLinsertcollinearpoints
%
%
% Copyright 2025 Tim C. Lueth

PLinsertcollinearpoints(PL,d)- inserts collinear auxiliary points that a minimum point distance is guaranteed

PLinsertcollinearpoints(PL,d)% PLinsertcollinearpoints(PL,d) - inserts collinear auxiliary points that a minimum point distance is guaranteed
% (by Tim Lueth, SG-Lib, 2025-SEP-12 as class: PL/POINT LISTS)
%
% USE CAREFULLY: PLinsertcollinearpoints was not being tested extensively
%
% slightly different to RLaddauxpoints and CPLaddauxpoints
% does not create collinear auxiliary points if an edge is missing!
% Only if start and end point are the same, the last edge is also processed.
% Same as:
% PLinsertcollinearpoints == CPLinsertcollinearpoints ==
% CVLinsertcollinearpoints (Status of: 2025-09-12)
%
% Introduced first in SolidGeometry 5.6
%
% See also: RLaddauxpoints, CPLaddauxpoints, VLremsuccident,
% CPLinsertcollinearpoints, CVLinsertcollinearpoints
%
% PLN=PLinsertcollinearpoints(PL,[d])
% === INPUT PARAMETERS ===
% PL: Point list without nan, open or closed
% d: maximum point distance to guarantee
% === OUTPUT RESULTS ======
% PLN: Point list with collinear auxiliary points, open or closed as PL
%
% EXAMPLE:
% PLinsertcollinearpoints(PLsample(3),1) % open edge, identical point removed
% PLinsertcollinearpoints(PLsample(8),1) % closed contour, identical point removed
% PLinsertcollinearpoints(VLsample(16),1) % Does work also in 3D
% PLinsertcollinearpoints(VLsample(18),1) % Does work also with nan separated contours
%
% See also: RLaddauxpoints, CPLaddauxpoints, VLremsuccident,
% CPLinsertcollinearpoints, CVLinsertcollinearpoints
%
%
% Copyright 2025 Tim C. Lueth

SGconverthtmldoc2UTF8- converts all files of an html file into UTF-8

SGconverthtmldoc2UTF8% SGconverthtmldoc2UTF8 - converts all files of an html file into UTF-8
% (by Tim Lueth, SG-Lib, 2025-SEP-12 as class: FILE HANDLING)
%
% =======================================================================
% DEVELOPER PROCEDURE (2025-09-12) - NOT INTENDED TO BE RELEASED
% =======================================================================
%
% Some browser such as Microsoft edge are unable to process UTF-16 html files, ot
% at least not a mix of, or at least in combination on windows. Therefor this
% fnctn converts als html files of "SGLIB_HELP_Structures/html" to UTF-8 (Status
% of: 2025-09-12)
%
% Introduced first in SolidGeometry 5.6
%
% See also: isUTF16file
%
% SGconverthtmldoc2UTF8
%
% See also: isUTF16file
%
%
% Copyright 2025 Tim C. Lueth

isUTF16file(fname,"UTF")- detects UTF16 files and converts them into UTF-8

isUTF16file(fname,% isUTF16file(fname,"UTF") - detects UTF16 files and converts them into UTF-8
% (by TIm Lueth & Robin Schregle, SG-Lib, 2025-SEP-12 as class: FILE HANDLING)
%
% =======================================================================
% DEVELOPER PROCEDURE (2025-09-12) - NOT INTENDED TO BE RELEASED
% =======================================================================
%
% When matlab reads UTF-16 files as 'uint8', all characters are actually read,
% and it can be recognized manually that when BOM (FFFE) is at the start, the
% character string at the beginning [255 254] refers to UTF-16. Then the ASCII
% characters can be determined with xx=xx(3:2:end). However, if the type 'char'
% is used during reading, then with UTF-16 files only every second character is
% read "automatically," but the first character is a 255, which is meaningless
% because it is part of the BOM code. For this reason, readtextfile and
% writetextfile use the ASCII type unsigned byte or uint8. (Status of: 2025-09-12)
%
% Introduced first in SolidGeometry 5.6
%
% See also: readtextfile, writetextfile
%
% is16=isUTF16file([fname,"UTF"])
% === INPUT PARAMETERS ===
% fname: full file name
% "UTF": if used, the wile will be written as UTF-8
% === OUTPUT RESULTS ======
% is16: true if utb-16 otherwise false
%
% See also: readtextfile, writetextfile
%
%
% Copyright 2025 Tim C. Lueth

Tflipz(T)- rotates / flips the ez axis of a HT matrix around by by 90 degree

Tflipz(T)% Tflipz(T) - rotates / flips the ez axis of a HT matrix around by by 90 degree
% (by Tim Lueth, SG-Lib, 2025-SEP-11 as class: KINEMATICS AND FRAMES)
%
% in contrast to TflipR, which changes into left hand system, this fnctn rotate
% around the y axis to flip the z vector, same as Trotate(eye(4),'y',pi),
% Tflipz(eye(4)) but more accurate (Status of: 2025-09-11)
%
% Introduced first in SolidGeometry 5.6
%
% See also: Tflipz, TflipR
%
% TN=Tflipz(T)
% === INPUT PARAMETERS ===
% T: Standard HT matrix
% === OUTPUT RESULTS ======
% TN: rotate around y by 180 deg
%
% EXAMPLE:
% Trotate(eye(4),'y',pi), Tflipz(eye(4))
%
% See also: Tflipz, TflipR
%
%
% Copyright 2025 Tim C. Lueth

SGofgcfsubplots(ind)- takes the current gcf, collects all patches in the subplots and creates a cell list of solids/patches

SGofgcfsubplots(ind)% SGofgcfsubplots(ind) - takes the current gcf, collects all patches in the subplots and creates a cell list of solids/patches
% (by Tim Lueth, SG-Lib, 2025-SEP-08 as class: VISUALIZATION)
%
% USE CAREFULLY: SGofgcfsubplots was not being tested extensively
%
% if nargout==0; the solids are plotted using SGplotcell (Status of: 2025-09-08)
%
% Introduced first in SolidGeometry 5.6
%
% See also: SGofgca, VLFLofgca, VLofgca, PSofgca, SGplotmultiple, SGofgca2subplots
%
% SG=SGofgcfsubplots([ind])
% === INPUT PARAMETERS ===
% ind: indices of the axis that should be considered
% === OUTPUT RESULTS ======
% SG: cell array of solids in all subplots
%
% EXAMPLE:
% loadweb JACO_robot.mat; SGsurfaces(JC1);
% SGofgca2subplots
% SGofgcfsubplots
%
%
% See also: SGofgca, VLFLofgca, VLofgca, PSofgca, SGplotmultiple, SGofgca2subplots
%
%
% Copyright 2025 Tim C. Lueth

SGlaundryrackholder- Special design for attaching a canvas picture to a wall-mounted folding clothes horse

SGlaundryrackholder% SGlaundryrackholder - Special design for attaching a canvas picture to a wall-mounted folding clothes horse
% (by Tim Lueth, SG-Lib, 2025-SEP-03 as class: COMPLETED CAD DESIGNS)
%
% =======================================================================
% DEVELOPER PROCEDURE (2025-09-08) - NOT INTENDED TO BE RELEASED
% =======================================================================
%
% Designed for Tiny Tusculum. The picture of Iseltwald Castle hangs in
% TinyTusculum so that it completely covers the wall-mounted foldable clothes
% horse. The picture has been specially framed to size, but must be attached to
% the wall using a clamp construction, and this attachment must support the
% center bar of the framed picture. The clamp must be movable on the wall bracket
% in order to align and tilt the picture. (Status of: 2025-09-03)
%
% Introduced first in SolidGeometry 5.6
%
% See also: SGBAUHAUSbox
%
% SGlaundryrackholder
%
% EXAMPLE:
% SGlaundryrackholder
%
% See also: SGBAUHAUSbox
%
%
% Copyright 2025 Tim C. Lueth
Most recent SG-Lib (5.5.5 - 2025)

Last Change Oct 6th 2025 for SG-Lib 5.5.5 (2025) 236 MB