Hello Tuğçe, Did you assigned memory to the resource? rt_init_resource() expects a pointer to valid memory.
In general, it isn't easy to write a Python wrapper for BRL-CAD. I recommend to program it in C first. If this works, you can try to move your implementation to Python. Or, you could write a small wrapper/adapter in C, which exposes exactly the functionality you need with a simple, ctypes-friendly API. Regards, Daniel Am Fr., 17. Dez. 2021 um 15:17 Uhr schrieb Tuğçe Sena Koyuncu < tugcesena2...@gmail.com>: > Hi > We are working on a project to use ray tracing functionality of BRL CAD > with python. How can we achieve this? By using the ctypes module, we > loaded a dll library of BRL CAD and in particular used librt.c. By ctypes, > we wrapped the functions rt_dirbuilt(), rt_gettree(), rt_prep and finally > rt_shootray(). We implemented all needed structs and unions, including > application and partition structures. Application structure is initialized > with 0s as documentation stated. For hit and miss routines, we define > python functions and wrap them by using CFUNCTYPES to pass as valid C > arguments. Arguments of hit and miss functions are defined according to > documentation, too. However, when rt_shootray is called, the program > crashes and gives the following errors. "Corrupt application struct" error > raised in run mode and "OSError: exception: access violation writing > 0x000002B220192BE8" error raised in debug mode in PyCharm. "corrupt > application struct" error raised when the attributes of application > struct which are a_zero1 and a_zero2 are not 0 but both of them seem to be > zero in our code. What can cause this and how can we solve this? We also > use the function rt_init_resource since it gives another error when it's > not added even though the source code call this functions just in the > script. > > Thanks in advance. > [image: image.png] > > [image: image.png] > error from debugger mode > [image: image.png] > _______________________________________________ > BRL-CAD Users mailing list > brlcad-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/brlcad-users >
_______________________________________________ BRL-CAD Users mailing list brlcad-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/brlcad-users