### Example Interface Data File Path Source: https://docs.sofistik.com/2026/en/cdb_interfaces/introduction/about_cdb/structure.html This path indicates the location of example interface data files provided with the SOFiSTiK installation. ```text C:\\2026\SOFiSTiK 2026\interfaces\examples\ ``` -------------------------------- ### Example Project Path Source: https://docs.sofistik.com/2026/en/cdb_interfaces/fortran/configure.html Locates an existing Fortran project example for connecting to the CDB database. ```plaintext C:\\2026\SOFiSTiSTIK 2026\interfaces\examples\fortran\connect_to_cdb ``` -------------------------------- ### Example Project Path Source: https://docs.sofistik.com/2026/en/cdb_interfaces/cpp/configure.html Locates an example project for connecting to the CDB. This path may vary based on your SOFiSTiK installation. ```plaintext C:\\2026\SOFiSTiK 2026\interfaces\examples\c++\connect_to_cdb ``` -------------------------------- ### Connect to CDB Example Source: https://docs.sofistik.com/2026/en/cdb_interfaces/vba/configure.html This VBA code snippet demonstrates how to connect to CDB. Ensure the necessary DLLs are accessible. ```VBA Declare Function AQU_GET_SECT Lib "cdb_w31.dll" Alias "VB_AQU_GET_SECT" _ (ByVal KW As Long, ByVal nr As Long, ByVal XABS As Single, _ ByVal LFC As Long, ByRef IERG As Long, ByRef SERG As Single) ``` -------------------------------- ### C++ Example: Using sof_lib_ps2cs for Text Decoding Source: https://docs.sofistik.com/2026/en/cdb_interfaces/cpp/examples/cpp_example5.html This C++ code demonstrates loading the SOFiSTiK CDB interface DLL, obtaining function pointers, initializing a CDB connection, and using the sof_lib_ps2cs function to convert integer codes to text. Ensure the DLL path and database file path are correct for your installation. ```cpp //+============================================================================+ //| Company: SOFiSTiK AG | //| Version: SOFiSTIK 2026 | //+============================================================================+ //////////////////////////////////////////////////////////////////////////////// // ABOUT: // In this example we will show how to use the sof_lib_ps2cs() function // sof_lib_ps2cs() converts integer values to string #include #include #include #include // Include SOFiSTiK Libraries from : // --> "... interfaces/examples/c++" #include "cdbase.h" #include "cdbtypeall.h" #include "cdbtypecon.h" #include "cdbtypegeo.h" #include "cdbtypelfc.h" #include "cdbtypemat.h" #include "cdbtypesct.h" #include "cdbtypesys.h" #include "cdbtypeten.h" using namespace std; typedef unsigned int pckcode; typedef void(*PS2CS)(pckcode*, char*, int); typedef int(*INITPRT)(char*, int); typedef int(*STATUSPRT)(int); typedef int(*CLOSEPRT)(int); typedef int(*GETPRT)(int, int, int, void*, int*, int); using namespace std; int main() { // Load the library HINSTANCE hInst = LoadLibrary("C:\\Program Files\\SOFiSTiK\\2026\\SOFiSTiK 2026\\interfaces\\64bit\\sof_cdb_w-2026.dll"); if (!hInst) { cout << "Coult not Load the Library" << endl; system("pause"); return EXIT_FAILURE; } // Resolve the function adress INITPRT sof_cdb_init = (INITPRT)GetProcAddress(hInst, "sof_cdb_init"); if (!sof_cdb_init) { cout << "Could not locate the function!" << endl; system("pause"); return EXIT_FAILURE; } STATUSPRT sof_cdb_status = (STATUSPRT)GetProcAddress(hInst, "sof_cdb_status"); if (!sof_cdb_status) { cout << "Could not locate the function!" << endl; system("pause"); return EXIT_FAILURE; } PS2CS sof_lib_ps2cs = (PS2CS)GetProcAddress(hInst, "sof_lib_ps2cs"); if (!sof_lib_ps2cs) { cout << "Could not locate the function!" << endl; system("pause"); return EXIT_FAILURE; } CLOSEPRT sof_cdb_close = (CLOSEPRT)GetProcAddress(hInst, "sof_cdb_close"); if (!sof_cdb_close) { cout << "Could not locate the function!" << endl; system("pause"); return EXIT_FAILURE; } GETPRT sof_cdb_get = (GETPRT)GetProcAddress(hInst, "sof_cdb_get"); if (!sof_cdb_get) { cout << "Could not locate the function!" << endl; return EXIT_FAILURE; } // Connect to CDB /* Index = 0 initialise CDBASE and open scratch data base only Index > 0 open an existing data base with exactly tis index (STATUS=UNKNOWN) = somehow obsolete call, use 99! Index = 99 test if NAME is a valid database and open the base if possible. Return with the assigned index. If the file does not exist, it will be created. Index = 97 open the database via pvm Return with the assigned index. Index = 96 open a scratch database, filename is the path to use or NULL. Index = 95 open in read-only mode Index = 94 create a new data base (STATUS=NEW) */ int index = 99; char* fileName = "S:\\test\\155852\\155852.cdb"; int ie = sof_cdb_init(fileName, index); if (ie < 0) { cout << "ERROR: Index= " << ie << " < 0 - see clib1.h for meaning of error codes" << endl; cout << "Press any to close the program"; system("pause"); return(0); } else if(ie == 0) { cout << "ERROR: Index= " << ie << " - The File is not a database" << endl; cout << "Press any to close the program"; system("pause"); return(0); } // Get Status // int sof_cdb_status (int ie); cout << "The CDB Status: " << sof_cdb_status(ie) << endl; int datalen = sizeof(tagCDB_LC_CTRL); int *datalenptr; datalenptr = &datalen; tagCDB_LC_CTRL clc_ctrl; char s[17*4+1]; // 17 array elements × 4 + include 0 int len = sizeof(s); // &clc_ctrl pass the address of the struct to pointer ``` -------------------------------- ### Set Additional Include Directories Source: https://docs.sofistik.com/2026/en/cdb_interfaces/fortran/configure.html Configures the project to search for header files within the specified Fortran examples directory. ```plaintext C:\\2026\SOFiSTiSTIK 2026\interfaces\examples\fortran ``` -------------------------------- ### CDBASE @KEY Usage Example Source: https://docs.sofistik.com/2026/en/cdb_interfaces/cadinp/template/at_key.html This example demonstrates selecting a specific section ('SECT_PLA') and filtering it by a third selection string ('SEL3') with a value of 101. It also shows how the 'ID' is handled by default and by the selection string. ```cdbase @KEY SECT_PLA KWL 2 SEL3 101 LET#N @WPN //ID (=6) is defined by default via SECT_PLA, //but counts also all sections string (=sel1) ``` -------------------------------- ### VB.NET Example to Read Node Properties Source: https://docs.sofistik.com/2026/en/cdb_interfaces/vb_net/examples/vb_net_example2.html This snippet demonstrates how to initialize a connection to a CDB file, read node data, and process it. It requires setting environment variables for the SOFiSTIK installation path. The data extracted includes node number, internal node number, fixity, bit codes, and X, Y, Z coordinates. ```vb.net Imports System.Runtime.InteropServices Module main 'In this example, 64bit DLLs are used Public Declare Function sof_cdb_init Lib "sof_cdb_w-2026.dll" Alias "VB_sof_cdb_init" ( ByVal name_ As String, ByVal InitType_ As Integer ) As Integer Public Declare Function sof_cdb_status Lib "sof_cdb_w-2026.dll" Alias "VB_sof_cdb_status" ( ByVal Index_ As Integer ) As Integer Public Declare Function sof_cdb_close Lib "sof_cdb_w-2026.dll" Alias "VB_sof_cdb_close" ( ByVal Index_ As Integer ) As Integer Public Declare Function sof_cdb_get Lib "sof_cdb_w-2026.dll" Alias "VB_sof_cdb_get" ( ByVal Index_ As Integer, ByVal kwh_ As Integer, ByVal kwl_ As Integer, ByRef data As CNODE, ByRef datalen_ As Integer, ByVal pos_ As Integer ) As Integer Sub Main() Dim Filename As String Dim Index As Integer Dim Path As String Dim analysisPath As String Dim datalen As Integer Dim data As New CNODE Dim analysisPath2 As String 'Path of the SOFiSTIK Directory analysisPath = "C:\sofistik_installation\trunk\SOFiSTIK trunk\interfaces\64bit" analysisPath2 = "C:\sofistik_installation\trunk\SOFiSTIK trunk" 'Set the environment variable Path = Environment.GetEnvironmentVariable("path") Path = analysisPath2 + ";" + analysisPath + ";" + Path Environment.SetEnvironmentVariable("path", Path) 'Filename = full path with name of the cdb Filename = "S:\test\simple_span_girder.cdb" ' To connect to the CDB Index = sof_cdb_init(Filename, 99) If Index < 0 Then Console.WriteLine("ERROR: Index= " & Index & " < 0 - see clib1.h for meaning of error codes") Console.ReadKey() Exit Sub ElseIf Index = 0 Then Console.WriteLine("ERROR: Index= " & Index & " - The File is not a database") Console.ReadKey() Exit Sub End If ' Redim the m_XYZ array ' This step is necessary because in VB.NET fixed array in structures are not supported ReDim data.m_XYZ(2) ' Get the data-length datalen = Marshal.SizeOf(data) ' Print the values Console.WriteLine( "{0,-15} {1,-15} {2,-15} {3,-15} {4,-15} {5,-15} {6,-15}", "m_NR", "m_INR", "m_KFIX", "m_NCOD", "m_X", "m_Y", "m_Z") Do While sof_cdb_get(Index, 20, 0, data, datalen, 1) < 2 Console.WriteLine( "{0,-15} {1,-15} {2,-15} {3,-15} {4,-15} {5,-15} {6,-15}", data.m_NR, data.m_INR, data.m_KFIX, data.m_NCOD, data.m_XYZ(0), data.m_XYZ(1), data.m_XYZ(2)) datalen = Marshal.SizeOf(data) Loop 'This outputs the status of the CDB, please refer to cdbase.chm for more details Console.WriteLine("Index: " & Index) Console.WriteLine("CDB Status: " & sof_cdb_status(Index)) 'Close the CDB Call sof_cdb_close(0) 'Check the CDB Status If sof_cdb_status(Index) = 0 Then Console.WriteLine("CDB closed succesfully, status = 0") End If Console.Write("Press any to close the program") Console.ReadKey() End Sub End Module ``` -------------------------------- ### VB.NET Example: Connect to CDB Source: https://docs.sofistik.com/2026/en/cdb_interfaces/vb_net/examples/vb_net_example1.html This snippet shows how to initialize a connection to the CDB, check its status, and close the connection. Ensure the necessary DLLs are in the system's PATH environment variable. ```vb.net Imports System.Runtime.InteropServices Module main 'In this example, 64bit DLLs are used Public Declare Function sof_cdb_init Lib "sof_cdb_w-2026.dll" Alias "VB_sof_cdb_init" ( ByVal name As String, ByVal InitType As Integer ) As Integer Public Declare Function sof_cdb_status Lib "sof_cdb_w-2026.dll" Alias "VB_sof_cdb_status" ( ByVal Index As Integer ) As Integer Public Declare Function sof_cdb_close Lib "sof_cdb_w-2026.dll" Alias "VB_sof_cdb_close" ( ByVal Index As Integer ) As Integer Sub Main() Dim Filename As String Dim Index As Integer Dim Path As String Dim analysisPath As String Dim analysisPath2 As String 'Path of the SOFiSTIK Directory analysisPath = "C:\sofistik_installation\trunk\SOFiSTIK trunk\interfaces\64bit" analysisPath2 = "C:\sofistik_installation\trunk\SOFiSTIK trunk" 'Set the environment variable Path = Environment.GetEnvironmentVariable("path") Path = analysisPath2 + ";" + analysisPath + ";" + Path Environment.SetEnvironmentVariable("path", Path) 'Filename = full path with name of the cdb Filename = "S:\test\test.cdb" ' To connect to the CDB we will use Index = sof_cdb_init(Filename, 99) If Index < 0 Then Console.WriteLine("ERROR: Index= " & Index & " < 0 - see clib1.h for meaning of error codes") Console.ReadKey() Exit Sub ElseIf Index = 0 Then Console.WriteLine("ERROR: Index= " & Index & " - The File is not a database") Console.ReadKey() Exit Sub End If ' Output the index and status Console.WriteLine("Index: " & Index) 'This outputs the status of the CDB, please refer to cdbase.chm for more details Console.WriteLine("CDB Status: " & sof_cdb_status(Index)) ' Close the CDB Call sof_cdb_close(0) 'Check if CDB closed succesfully If sof_cdb_status(Index) = 0 Then Console.WriteLine("CDB closed succesfully, status = 0") End If ' Press any key to close the program Console.Write("Press any to close the program") Console.ReadKey() End Sub End Module ``` -------------------------------- ### C++ Example: Connect to CDB Source: https://docs.sofistik.com/2026/en/cdb_interfaces/cpp/examples/cpp_example1.html This snippet shows how to initialize a connection to the CDB using `sof_cdb_init`, check its status with `sof_cdb_status`, and close the connection with `sof_cdb_close`. Ensure the `fileName` path is correctly set and the appropriate DLLs are used. ```cpp int main() { // In this example debug 64bit dlls are used (Visual Studio Platform 64bit) // Connect to CDB // int sof_cdb_init ( char* FileName, int Index); /* Index = 0 initialise CDBASE and open scratch data base only Index > 0 open an existing data base with exactly tis index (STATUS=UNKNOWN) = somehow obsolete call, use 99! Index = 99 test if NAME is a valid database and open the base if possible. Return with the assigned index. If the file does not exist, it will be created. Index = 97 open the database via pvm Return with the assigned index. Index = 96 open a scratch database, filename is the path to use or NULL. Index = 95 open in read-only mode Index = 94 create a new data base (STATUS=NEW) */ int index = 99; char* fileName = "S:\\test\\cdbPath.cdb"; int ie = sof_cdb_init(fileName, index); if (ie < 0) { cout << "ERROR: Index= " << ie << " < 0 - see clib1.h for meaning of error codes" << endl; cout << "Press any to close the program"; system("pause"); return(0); } else if(ie == 0) { cout << "ERROR: Index= " << ie << " - The File is not a database" << endl; cout << "Press any to close the program"; system("pause"); return(0); } // Get Status // int sof_cdb_status (int ie); cout << "The CDB Status: " << sof_cdb_status(ie) << endl; // Close the CDB // int sof_cdb_close (int ie); sof_cdb_close(0); cout << "The CDB Status after closing: " << sof_cdb_status(ie) << endl; system("pause"); return 0; } ``` -------------------------------- ### Reinforcement Iteration Example Source: https://docs.sofistik.com/2026/en/cdb_interfaces/c_sharp/examples/c_sharp_example4.html Illustrates the iterative calculation process for As1 reinforcement. It shows how to decrement the 'epss' value and increment the 'epsc' value in each iteration. ```csharp // Iterate epss epss = Convert.ToSingle(epss - 0.001); // Iterate epsc epsc = Convert.ToSingle(epsc + 0.1); ``` -------------------------------- ### Check Python Platform Architecture Source: https://docs.sofistik.com/2026/en/cdb_interfaces/python/configure.html Determines and prints the architecture (32-bit or 64-bit) of the current Python installation. ```python # Check the python platform (32bit or 64bit) print ("Python architecture=", platform.architecture()) sofPlatform = str(platform.architecture()) ``` -------------------------------- ### Setting Environment Path for SOFiSTiK DLLs in C# Source: https://docs.sofistik.com/2026/en/cdb_interfaces/c_sharp/configure.html This example demonstrates how to set the system environment path to include SOFiSTiK DLL directories before calling DLL functions. This is crucial for the application to locate the necessary libraries. ```csharp int index = 0; int status = 0; int datalen; string directory1 = @"C:\sofistik_installation\2024\SOFiSTiK 2024\interfaces\64bit"; string directory2 = @"C:\sofistik_installation\2024\SOFiSTiK 2024"; string cdbPath = @"S:\test\simple_span_girder.cdb"; // Get the path string path = Environment.GetEnvironmentVariable("path"); // Set the new path environment variable + SOFiSTiK dlls path path = directory1 + ";" + directory2 + ";" + path; // Set the path variable (to read the data from CDB) System.Environment.SetEnvironmentVariable("path", path); ``` -------------------------------- ### Load SOFiSTiK DLLs and Initialize CDB Connection Source: https://docs.sofistik.com/2026/en/cdb_interfaces/python/examples/python_example1.html This snippet shows how to load the correct 32-bit or 64-bit SOFiSTiK DLLs using `ctypes` and `os.add_dll_directory`. It then initializes a connection to a specified CDB file and retrieves its status. Ensure the DLL paths are correct for your installation. ```python from ctypes import cdll, c_int import os sofPlatform = "64Bit" if sofPlatform.find("32Bit") < 0: # Set environment variable for the dll files print ("Hint: 64bit DLLs are used") # Set DLL dir path - new in PY 3.8 for ctypes # See: https://docs.python.org/3/whatsnew/3.8.html#ctypes os.add_dll_directory(r"C:\sofistik_installation\2026\SOFiSTiK 2026\interfaces\64bit") os.add_dll_directory(r"C:\sofistik_installation\2026\SOFiSTiK 2026") # Get the DLL functions myDLL = cdll.LoadLibrary("sof_cdb_w-2026.dll") py_sof_cdb_get = cdll.LoadLibrary("sof_cdb_w-2026.dll").sof_cdb_get py_sof_cdb_get.restype = c_int py_sof_cdb_kenq = cdll.LoadLibrary("sof_cdb_w-2026.dll").sof_cdb_kenq_ex else: # Set environment variable for the DLL files print ("Hint: 32bit DLLs are used") # Set DLL dir path - new in PY 3.8 for ctypes # See: https://docs.python.org/3/whatsnew/3.8.html#ctypes os.add_dll_directory(r"C:\sofistik_installation\2026\SOFiSTiK 2026\interfaces\32bit") os.add_dll_directory(r"C:\sofistik_installation\2026\SOFiSTiK 2026") # Get the DLL functions myDLL = cdll.LoadLibrary("cdb_w31.dll") py_sof_cdb_get = cdll.LoadLibrary("cdb_w31.dll").sof_cdb_get py_sof_cdb_get.restype = c_int py_sof_cdb_kenq = cdll.LoadLibrary("cdb_w31.dll").sof_cdb_kenq_ex # Connect to CDB Index = c_int() cdbIndex = 99 # input the cdb path here fileName = r"S:\test\test_file.cdb" # important: Unicode call! Index.value = myDLL.sof_cdb_init(fileName.encode('utf8'), cdbIndex) # get the CDB status cdbStat = c_int() cdbStat.value = myDLL.sof_cdb_status(Index.value) # Print the Status of the CDB print ("CDB Status:", cdbStat.value) # Close the CDB, 0 - will close all the files myDLL.sof_cdb_close(0) # Print again the status of the CDB, if status = 0 -> CDB Closed successfully cdbStat.value = myDLL.sof_cdb_status(Index.value) if cdbStat.value == 0: print ("CDB closed successfully, status = 0") ``` -------------------------------- ### Load DLL Functions Source: https://docs.sofistik.com/2026/en/cdb_interfaces/python/configure.html Loads the 'sof_cdb_w-2026.dll' and specifically the 'sof_cdb_get' function, setting its return type to c_int. This example uses the 64-bit DLL. ```python # Get the DLL functions myDLL = cdll.LoadLibrary("sof_cdb_w-2026.dll") py_sof_cdb_get = cdll.LoadLibrary("sof_cdb_w-2026.dll").sof_cdb_get py_sof_cdb_get.restype = c_int ``` -------------------------------- ### Check Python Platform Source: https://docs.sofistik.com/2026/en/cdb_interfaces/python/examples/python_example4.html Determines and prints the architecture (32-bit or 64-bit) of the current Python installation. This is important for ensuring compatibility with the correct DLLs. ```python # Check the python platform (32bit or 64bit) print "The path variable=", os.environ["Path"] print "Python architecture=", platform.architecture() ``` -------------------------------- ### CDBASE @KEY Error Example 1 Source: https://docs.sofistik.com/2026/en/cdb_interfaces/cadinp/template/at_key.html This error message indicates that the specified CDBASE structure does not support the @KEY command with the given parameters. ```cdbase +++++ error no. 10143 in program SOF_VAR CDBASE.CDB does not contain a suitable structure for @KEY STU5 ``` -------------------------------- ### Select Nodal Support Forces with #CDB_IER Source: https://docs.sofistik.com/2026/en/cdb_interfaces/cadinp/template/hash_cdb_len.html This example shows how to use #CDB_IER to manage record length checks when selecting nodal support forces. It initializes variables and loops, checking #CDB_IER to determine if data is within the read length before printing. ```CADiNP LET#CDB_LEN 0 LET#CDB_IER 0 @KEY N_Disp 1 LOOP //CDB_IER=0 , because NR is within the read length LET#NR @NR IF #CDB_IER<2 //CDB_IER=1 , because PY is outside the read length LET#PY @PY IF #CDB_IER<1 TXA Node #(#NR,5.0) PY = #(#PY,7.3) kN ENDIF ENDIF ENDLOOP #CDB_IER<2 ``` -------------------------------- ### Set Environment Variable and Run XLSM via Batch Source: https://docs.sofistik.com/2026/en/cdb_interfaces/vba/configure.html Use this batch script to set the SOFiSTiK installation path in the environment variables and then launch an Excel workbook. Ensure all Excel instances are closed before running. ```batch set local set path=C:\\2026\SOFiSTiK 2026; \ %path% start "" "C:\exampleFolder\exampleWorkbook.xlsm" exit ``` -------------------------------- ### Python Example: Reading Node Properties from CDB Source: https://docs.sofistik.com/2026/en/cdb_interfaces/python/examples/python_example2.html This script connects to a CDB file, reads node data including node number, internal node number, degrees of freedom, additional bit code, and coordinates. It handles DLL loading for both 32-bit and 64-bit Python environments and prints the retrieved node information. ```python # import all types from sofistik_daten.py, original file can be found by following # --> examples/python/sofistik_daten.py from sofistik_daten import * import os # for the environment variable necessary import platform # checks the python platform from ctypes import * # read the functions from the cdb # This example has been tested with Python 3.7 (64-bit) print("The path variable=", os.environ["Path"]) # Check the python platform (32bit or 64bit) print("Python architecture=", platform.architecture()) sofPlatform = str(platform.architecture()) # Get the DLL (32bit or 64bit DLL) if sofPlatform.find("32Bit") < 0: # Set environment variable for the DLL files print("Hint: 64bit DLLs are used") path = os.environ["Path"] # 64bit DLLs dllPath = r"C:\sofistik_installation\trunk\SOFiSTIK trunk\interfaces\64bit" dllPath += ";" # other necessary DLLs dllPath += r"C:\sofistik_installation\trunk\SOFiSTIK trunk" os.environ["Path"] = dllPath + ";" + path # Get the DLL functions myDLL = cdll.LoadLibrary("sof_cdb_w-2026.dll") py_sof_cdb_get = cdll.LoadLibrary("sof_cdb_w-2026.dll").sof_cdb_get py_sof_cdb_get.restype = c_int py_sof_cdb_kenq = cdll.LoadLibrary("sof_cdb_w-2026.dll").sof_cdb_kenq_ex else: # Set environment variable for the dll files print("Hint: 32bit DLLs are used") path = os.environ["Path"] # 32bit DLLs dllPath = r"C:\sofistik_installation\trunk\SOFiSTIK trunk\interfaces\32bit" os.environ["Path"] = dllPath + ";" + path # Get the DLL functions myDLL = cdll.LoadLibrary("cdb_w31.dll") py_sof_cdb_get = cdll.LoadLibrary("cdb_w31.dll").sof_cdb_get py_sof_cdb_get.restype = c_int py_sof_cdb_kenq = cdll.LoadLibrary("cdb_w31.dll").sof_cdb_kenq_ex # Connect to CDB Index = c_int() cdbIndex = 99 # Set the CDB Path # e.g. fileName = "S:\test\read_nodes.cdb" fileName = r"S:\test\read_nodes.cdb" # important: Unicode call! Index.value = myDLL.sof_cdb_init(fileName.encode('utf-8'), cdbIndex) cdbStat = c_int() # get the CDB status cdbStat.value = myDLL.sof_cdb_status(Index.value) # Print the Status of the CDB print("CDB Status:", cdbStat.value) pos = c_int(0) datalen = c_int(0) a = c_int() ie = c_int(0) datalen.value = sizeof(CNODE) RecLen = c_int(sizeof(cnode)) """ do while ie == 0, see cdbase.chm, Returnvalue. = 0 -> No error = 1 -> Item is longer than Data = 2 -> End of file reached = 3 -> Key does not exist """ while ie.value < 2: ie.value = py_sof_cdb_get(Index, 20, 0, byref(cnode), byref(RecLen), 1) print("{:10d}{:10d}{:10d}{:10d}{:10.2f}{:10.2f}{:10.2f}".format( cnode.m_nr, # node-number cnode.m_inr, # internal node-number cnode.m_kfix, # degree of freedoms cnode.m_ncod, # additional bit code cnode.m_xyz[0], # x coordinates cnode.m_xyz[1], # y coordinates cnode.m_xyz[2]) # z coordinates ) # Always read the length of record before sof_cdb_get is called RecLen = c_int(sizeof(cnode)) # Close the CDB, 0 - will close all the files myDLL.sof_cdb_close(0) # Print again the status of the CDB, if status = 0 -> CDB Closed successfully cdbStat.value = myDLL.sof_cdb_status(Index.value) if cdbStat.value == 0: print("CDB closed successfully, status = 0") ``` -------------------------------- ### Copying a Subset of an Array (from start index) Source: https://docs.sofistik.com/2026/en/cdb_interfaces/cadinp/template/let_sto.html Copies all elements of array A starting from index 3 to array B. ```SOFiSTIK LET#B #A(3:) ``` -------------------------------- ### Copying a Subset of an Array (with start and end index) Source: https://docs.sofistik.com/2026/en/cdb_interfaces/cadinp/template/let_sto.html Copies 3 elements from array A, starting at index 2 (elements at indices 2, 3, and 4), to array B. ```SOFiSTIK LET#B #A(2:4) ``` -------------------------------- ### Declare and Get Concrete Material Data Type in VBA Source: https://docs.sofistik.com/2026/en/cdb_interfaces/vba/examples/vba_example4.html Shows how to declare a variable for the concrete material data type (CMAT_CONC) and get its length. This is a prerequisite for reading concrete material properties from the CDB. ```VBA 'Declare variables (data types) for concrete Dim data As CMAT_CONC datalen = Len(data) ``` -------------------------------- ### Fortran Program to Connect to CDB Source: https://docs.sofistik.com/2026/en/cdb_interfaces/fortran/examples/fortran_example1.html This Fortran program demonstrates how to connect to a CDB file using the `cdinit` function. It checks the connection status and then closes the connection. Ensure the CDB path is correctly specified. ```fortran program connect_to_CDB implicit none ! Variables integer :: nid, l, ie, index, istat character(len=30) :: filename character(len=72) :: text index = 99 ! input here the CDB name or the CDB path filename = "S:\\test\\connect_to_cdb.cdb" ! Connect to CDB ! In this example 64bit debug DLL is used call cdinit(filename, index) if (nid > 0) then write(*,*) " cdb_init of ", filename," succesfull ", nid else write(*,*) " cdb_init of ", filename," not succesfull ", nid endif ! Check status call cdstat(index, istat) print *, "CDB status is: ", istat ! Lets close the CDB now call cdclose(0) ! Check status again, if closed, status = 0 call cdstat(index, istat) print *, "CDB status is: ", istat ! Press key to close the program print *, "Press key to close the program" read (*,*) end program connect_to_CDB ``` -------------------------------- ### Fortran CDB Initialization Source: https://docs.sofistik.com/2026/en/cdb_interfaces/fortran/examples/fortran_example4.html Connects to a specified CDB database file using `cdinit`. Checks for successful connection and reports the assigned database index. ```fortran ! Define the parameters for cdinti() ! nid = 99, test if NAME is a valid database and open the base if possible. ! Return with the assigned index. ! If the file does not exist, it will be created. nid=99 file = "simple_span_girder.cdb" !name of the cdb or the full path ! Connect to the CDB call cdinit(file,nid) if (nid > 0) then write(*,*) " cdb_init of ", file," successful ", nid else write(*,*) " cdb_init of ", file," not successful ", nid endif ``` -------------------------------- ### CDB Initialization Source: https://docs.sofistik.com/2026/en/cdb_interfaces/c_sharp/examples/c_sharp_example4.html Shows how to initialize the CDB connection using sof_cdb_init(). The returned index is used for subsequent CDB operations. ```csharp index = sof_cdb_init() ``` -------------------------------- ### Expand SOFiSTiK Path in Environment Variable (VBA) Source: https://docs.sofistik.com/2026/en/cdb_interfaces/vba/configure.html This function retrieves the SOFiSTiK 2026 installation path from the registry, appends the appropriate interface directory (32-bit or 64-bit), and then updates the system's PATH environment variable. It includes error handling for cases where the SOFiSTiK installation is not found or if setting the environment variable fails. ```VBA Public Function expandPath() Dim Path As String Dim analysisPath As String 'Get the environment path and add the SOFiSTiK directory to "Path" variable Path = Environ("Path") analysisPath = ReadRegStr(HKEY_LOCAL_MACHINE, "SOFTWARE\SOFiSTiK\InstallLocation", "sofistik_2026", 64) #If VBA7 And Win64 Then If analysisPath <> "" Then analysisPath = analysisPath + "\interfaces\64bit" #Else If analysisPath <> "" Then analysisPath = analysisPath + "\interfaces\32bit" #End If If analysisPath = "" Then MsgBox "No installation for SOFiSTiK 2026 found." expandPath = False Exit Function End If 'Add the SOFiSTiK dll path to Environment Variable Path = analysisPath + ";" + Path Dim lSuccess As Long lSuccess = SetEnvironmentVariable("Path", Path) 'Check if successfully If lSuccess = 0 Then MsgBox "Der Aufruf der Funktion SetEnvironmentVariable ist fehlgeschlagen." & vbNewLine & _ "Der von Err.LastDllError gelieferte Fehlercode ist " & CStr(Err.LastDllError), _ vbCritical, _ ``` -------------------------------- ### Connect to CDB using C# Source: https://docs.sofistik.com/2026/en/cdb_interfaces/c_sharp/examples/c_sharp_example1.html This snippet shows how to initialize a connection to the CDB database. Ensure the project is configured and use index 99 for sof_cdb_init. Error codes are detailed in clib1.h. ```csharp // Connect to CDB, int sof_cdb_init ( char* FileName, int Index); // Always use index 99, for more details see cdbase.chm index = sof_cdb_init("S:\\test\\test.cdb", 99); if (index < 0) { Console.WriteLine("ERROR: Index = " + index + " < 0 - see clib1.h for meaning of error code"); return; } else if(index == 0) { Console.WriteLine("ERROR: Index = " + index + " - The file is not a database"); return; } status = sof_cdb_status(index); Console.WriteLine("Index: " + index); Console.WriteLine("Status: " + status); sof_cdb_close(0); ``` -------------------------------- ### Using TXB to Add Text to Output Source: https://docs.sofistik.com/2026/en/cdb_interfaces/cadinp/template/txa_txb.html Demonstrates the usage of the TXB command to append text to the output. It shows how to format numerical values with specified integer and decimal places, and how to append string literals. ```SOFiSTIK +PROG TEMPLATE HEAD LET#A 2.35 TXB #(#A,0.3) ! 0 represents the number of integer places ! 3 represents the decimal places ! => output "2.350" TXB #(#A,5.5) ! 0 represents the number of integer places ! 3 represents the decimal places ! => output " 2.35000" LET#TXT "DUMMY TEXT" TXB #TXT ! => output "DUMMY TEXT" END ``` -------------------------------- ### Connecting to CDB in C# Source: https://docs.sofistik.com/2026/en/cdb_interfaces/c_sharp/examples/c_sharp_example4.html Initializes a connection to a SOFiSTiK CDB (database) file using the `sof_cdb_init` function and checks the connection status. Ensure the PATH environment variable is correctly set before calling this function. ```csharp // connect to CDB index = sof_cdb_init(cdbPath, 99); // check if sof_cdb_flush is working status = Program.sof_cdb_status(index); ``` -------------------------------- ### Define Working Directory Source: https://docs.sofistik.com/2026/en/cdb_interfaces/fortran/configure.html Specifies the root directory for the SOFiSTiK 2026 installation, which is essential for the project to find necessary files. ```plaintext C:\\2026\SOFiSTiSTIK 2026 ``` -------------------------------- ### Working Directory Configuration Source: https://docs.sofistik.com/2026/en/cdb_interfaces/cpp/configure.html Specifies the working directory for the project. Ensure this path correctly points to your SOFiSTiK 2026 installation. ```plaintext C:\\2026\SOFiSTiK 2026 ``` -------------------------------- ### Connect to CDB with Python Source: https://docs.sofistik.com/2026/en/cdb_interfaces/python/examples/python_example1.html This script demonstrates connecting to a SOFiSTiK CDB file using Python. It handles loading the correct DLLs based on the Python architecture (32-bit or 64-bit) and initializes the CDB connection. Ensure the `fileName` variable points to your desired CDB file. ```python import os # for the environment variable necessary, this is a great tool import platform # checks the python platform import string from ctypes import * # read the functions from the cdb # This example has been tested with Python 3.7 (64-bit) print ("The path variable=", os.environ["Path"]) # Check the python platform (32bit or 64bit) print ("Python architecture=", platform.architecture()) sofPlatform = str(platform.architecture()) # Get the DLLs (32bit or 64bit DLL) if sofPlatform.find("32Bit") < 0: # Set environment variable for the dll files print ("Hint: 64bit DLLs are used") path = os.environ["Path"] # 64bit DLLs dllPath = r"C:\sofistik_installation\trunk\SOFiSTiK trunk\interfaces\64bit" dllPath += ";" # other necessary DLLs dllPath += r"C:\sofistik_installation\trunk\SOFiSTiK trunk" os.environ["Path"] = dllPath + ";" + path # Get the DLL functions myDLL = cdll.LoadLibrary("sof_cdb_w-2026.dll") py_sof_cdb_get = cdll.LoadLibrary("sof_cdb_w-2026.dll").sof_cdb_get py_sof_cdb_get.restype = c_int py_sof_cdb_kenq = cdll.LoadLibrary("sof_cdb_w-2026.dll").sof_cdb_kenq_ex else: # Set environment variable for the DLL files print ("Hint: 32bit DLLs are used") path = os.environ["Path"] # 32bit DLLs dllPath = r"C:\sofistik_installation\trunk\SOFiSTiK trunk\interfaces\32bit" os.environ["Path"] = dllPath + ";" + path # Get the DLL functions myDLL = cdll.LoadLibrary("cdb_w31.dll") py_sof_cdb_get = cdll.LoadLibrary("cdb_w31.dll").sof_cdb_get py_sof_cdb_get.restype = c_int py_sof_cdb_kenq = cdll.LoadLibrary("cdb_w31.dll").sof_cdb_kenq_ex # Connect to CDB Index = c_int() cdbIndex = 99 # input the cdb path here fileName = r"S:\test\test_file.cdb" # important: Unicode call! Index.value = myDLL.sof_cdb_init(fileName.encode('utf-8'), cdbIndex) # get the CDB status cdbStat = c_int() cdbStat.value = myDLL.sof_cdb_status(Index.value) # Print the Status of the CDB print ("CDB Status:", cdbStat.value) # Close the CDB, 0 - will close all the files myDLL.sof_cdb_close(0) # Print again the status of the CDB, if status = 0 -> CDB Closed successfully cdbStat.value = myDLL.sof_cdb_status(Index.value) if cdbStat.value == 0: print ("CDB closed successfully, status = 0") ``` -------------------------------- ### Modify CDB Path Example Source: https://docs.sofistik.com/2026/en/cdb_interfaces/fortran/examples/fortran_example1.html This snippet shows how to modify the `filename` variable to specify the path to the CDB file. If the file does not exist, it will be created. ```fortran filename = "connect_to_cdb.cdb" ``` -------------------------------- ### CDBASE @KEY Error Example 2 Source: https://docs.sofistik.com/2026/en/cdb_interfaces/cadinp/template/at_key.html This error occurs when the @KEY command is used without providing the required numerical value for KWL. ```cdbase +++++ error no. 10144 in program SOF_VAR This index @KEY requires an explicit definition of a number at KWL ``` -------------------------------- ### Setting Up Environment Variables for SOFiSTiK DLLs Source: https://docs.sofistik.com/2026/en/cdb_interfaces/c_sharp/examples/c_sharp_example4.html Configures the system's PATH environment variable to include the directories containing the SOFiSTiK 64-bit DLLs and the main SOFiSTiK directory. This is crucial for the program to locate and load the necessary libraries. ```csharp int index = 0; int status = 0; int datalen; string directory1 = @"C:\Program Files\SOFiSTIK\2024\SOFiSTIK 2024\interfaces\64bit"; string directory2 = @"C:\Program Files\SOFiSTIK\2024\SOFiSTIK 2024"; string cdbPath = @"S:\test\single_span_girder.cdb"; // Get the path string path = Environment.GetEnvironmentVariable("path"); // Set the new path environment variable + SOFiSTiK dlls path path = directory1 + ";" + directory2 + ";" + path; // Set the path variable (to read the data from CDB) System.Environment.SetEnvironmentVariable("path", path); ``` -------------------------------- ### Connect to CDB Database Source: https://docs.sofistik.com/2026/en/cdb_interfaces/cpp/examples/cpp_example4.html Initializes and connects to a SOFiSTiK CDB database file. The `sof_cdb_init` function is used with a specified file path and index to open or create the database. Error handling is included to report connection issues. ```cpp // ****************************************************** // * Connect to CDB * // * int sof_cdb_init ( char* FileName, int Index); * // ****************************************************** /* Index = 0 initialise CDBASE and open scratch data base only Index > 0 open an existing data base with exactly tis index (STATUS=UNKNOWN) = somehow obsolete call, use 99! Index = 99 test if NAME is a valid database and open the base if possible. Return with the assigned index. If the file does not exist, it will be created. Index = 97 open the database via pvm Return with the assigned index. Index = 96 open a scratch database, filename is the path to use or NULL. Index = 95 open in read-only mode Index = 94 create a new data base (STATUS=NEW) */ int index = 99; // cdb path char* fileName = "S:\\test\\simple_span_girder.cdb"; int ie = sof_cdb_init(fileName, index); if (ie < 0) { cout << "ERROR: Index= " << ie << " < 0 - see clib1.h for meaning of error codes" << endl; cout << "Press any to close the program"; system("pause"); return(0); } else if(ie == 0) { cout << "ERROR: Index= " << ie << " - The File is not a database" << endl; cout << "Press any to close the program"; system("pause"); return(0); } ``` -------------------------------- ### CDB Get Function Usage Source: https://docs.sofistik.com/2026/en/cdb_interfaces/c_sharp/examples/c_sharp_example4.html Demonstrates the usage of the sof_cdb_get function for reading data from the CDB. The condition '< 2' indicates reading until the end of the record. ```csharp while (sof_cdb_get(index, 1, 1, &mat_conc, ref datalen, 1) < 2) ```