Hi Raj, I must say I don't completely understand what is the problem. You shouldn't do direct memory allocation in python, use the wrapped core brl-cad code to do that...
For creating/reading/writing the bitv structures you should use the relevant functions you will find in libbu. They are available in the wrapped libbu from python, including the macros to set/read individual bits, or to iterate all bits. You can have a look at them by CTRL-clicking the "libbu" in pycharm and search for "bitv" and "BU_BITTEST". If there is a problem with those methods, please address the concrete method/problem here ! Cheers, Csaba On Sa, 2014-06-07 at 02:26 +0530, Raj Reddy wrote: > Hi all, > > > The brlcad bu_bitv is very intelligently implemented. But it turns out > to be very difficult to wrap that in the python code which is required > for BOT primitive > > > Below, I explain the situation further. > > > > -> The bu_bitv has a vector "bits" which is a unsigned char type of > data. (of size 2 as per the definition) > > > -> Now during the initialization of a bu_bitv, only the required > memory is allocated as required by the number of bits. So for example > if I have only 8 bits to store the api is programmed such that the > memory which will be allocated will be = sizeof(bu_bitv) - 2(substract > the 2) + 1 (allocate a byte for 8 bits) > > > ->Now while importing a structure in python code we cannot determine > whether extra memory has been allocated or not! > > > > Please suggest remedial measure I should adopt. I spent a long time > understanding the code and what is happening. ;-) Please use the below > links for understanding further. > > > bot structure : [1] > bit_v : [2] > > A typical usage of bit_v for bot : [3] > > > Cheers! > > Raj. > > [1] http://brlcad.org/xref/source/include/rtgeom.h#L620 > [2] http://brlcad.org/xref/source/include/bu.h#L1365 > [3] http://brlcad.org/xref/source/src/libged/typein.c#L1018 > > ------------------------------------------------------------------------------ > Learn Graph Databases - Download FREE O'Reilly Book > "Graph Databases" is the definitive new guide to graph databases and their > applications. Written by three acclaimed leaders in the field, > this first edition is now available. Download your free book today! > http://p.sf.net/sfu/NeoTech > _______________________________________________ > BRL-CAD Developer mailing list > brlcad-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/brlcad-devel ------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/NeoTech _______________________________________________ BRL-CAD Developer mailing list brlcad-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/brlcad-devel