I have received some code to access the .cdb and pull node numbers and coordinates.
I know that it is then possible to pull mx, my, vx, vy, ny, nx for each element.
My question is; what command should i use, and where can i find it? i looked in the cdbase manual, but cannot find anything that resembles the CNODE and CQUAD commands used in my current code.
Does anyone know??
I got it working. I realized that i have to specify the entry ID, and also the sub number, so instead of
ie.value = py_sof_cdb_get(Index, 210, 0, byref(cquad_foc), byref(RecLen), 1)
it is supposed to be:
ie.value = py_sof_cdb_get(Index, 210, 1, byref(cquad_foc), byref(RecLen), 1)
But how can i get the dataframe to have both the corresponding quad element and LC?
The working code:
import os # for the environment variable necessary, this is a great tool
import platform # checks the python platform
import pandas as pd
import string
# import ipywidgets as widgets
from sofistik_daten import *
from Sofistik_Func import *
from ctypes import * # read the functions from the cdb
import math
######################
path = os.environ["Path"]
# 64bit DLLs
dllPath = r"C:\Program Files\SOFiSTiK\2023\SOFiSTiK 2023\interfaces\64bit"
dllPath += ";"
# other necessary DLLs
dllPath += r"C:\Program Files\SOFiSTiK\2023\SOFiSTiK 2023"
os.environ["Path"] = dllPath + ";" + path
# Get the DLL functions
myDLL = cdll.LoadLibrary(r"C:\Program Files\SOFiSTiK\2023\SOFiSTiK 2023\interfaces\64bit\sof_cdb_w-2023.dll")
py_sof_cdb_get = cdll.LoadLibrary("sof_cdb_w-2023.dll").sof_cdb_get
py_sof_cdb_get.restype = c_int
py_sof_cdb_kenq = cdll.LoadLibrary("sof_cdb_w-2023.dll").sof_cdb_kenq_ex
#End Region
############################
Index = c_int()
cdbIndex = 99
fileName = r"C:\python_test\T4_trappevæg_trafik\T4_trappevag_SLS_trafik_revA.cdb"
Index.value = myDLL.sof_cdb_init(fileName.encode('utf-8'), cdbIndex)
cdbStat = c_int()
cdbStat.value = myDLL.sof_cdb_status(Index.value)
pos = c_int(0)
datalen = c_int(0)
a = c_int()
ie = c_int(0)
datalen.value = sizeof(CQUAD_FOR)
RecLen = c_float(sizeof(cquad_for))
Elem_nr = []
mxx = []
myy = []
ny = []
print({'Ie value is': ie.value})
while ie.value < 2:
ie.value = py_sof_cdb_get(Index, 210, 1, byref(cquad_for), byref(RecLen), 1)
mxx.append(cquad_for.m_mxx)
myy.append(cquad_for.m_myy)
ny.append(cquad_for.m_ny)
print({'Ie value is': ie.value})
mxx = mxx[2:]
myy = myy[2:]
ny = ny[2:]
Data3 = {'mxx': mxx , 'myy': myy , 'ny': ny}
print(pd.DataFrame(Data3))
myDLL.sof_cdb_close(0)
cdbStat.value = myDLL.sof_cdb_status(Index.value)