Hi Raj,

I'm also actively working on python-brlcad, see below some answers to
your questions.

On Fr, 2014-02-28 at 17:47 +0530, K RAJ KOUSHIK REDDY wrote:

> I browsed your code. I find that it uses BRL-CAD APIs. I am not sure
> how you are using this. Are you using any of the tools or libraries
> mentioned at [1].

python-brlcad uses ctypes to wrap the BRL_CAD libraries. That could be
done by hard-coding the loading of the libraries in python files, which
means python-brlcad versions would be tightly coupled to the BRL-CAD
version they wrap.

Instead of doing that, a dynamic wrapper generator is used: ctypesgen

That one will read the BRL-CAD headers (*.h), and generate the ctypes
wrapper code which is then written into a python file. The code which
does that lives in: brlcad/install/*.py

The code generation will happen as a post-install step when you install
python-brlcad package, and the generated files are written in the
brlcad._bindings.lib* packages (you can find them in your python's
site-packages subdirs after installing python_brlcad, but they of course
are not present in the source code you checked out as they are generated
later).

This forms a layer of bare bindings into the BRL-CAD APIs, all the rest
of the python code builds on top of that to add python syntax sugar to
the calls.

> Can you point to an example which showcases the above ? I fail to
> understand how are you parsing the header files. (Please consider
> explaining or elaborating further.)

If you want to see things in motion, you could do:

 * install BRL-CAD and put the bin dir on your PATH;

 * install python + numpy;

 * check out python-brlcad;

 * install a python debugger, set up a break-point in
brlcad/install/post_install.py#main, and debug:

    python setup.py install --user

The --user flag will allow you to run that without being root on linux,
on windows I'm not sure it's needed.

I'm using PyCharm to do debugging, it's a great IDE (if you, like me,
like JetBrains products, and have the necessary few GB of extra memory
it needs):

http://www.jetbrains.com/pycharm/

Debugging through that code will show you step by step what happens...
but that part of the things is pretty well under control, the bulk of
future code is needed for building on top of the bare BRL-CAD APIs to
make things easy to execute !

If you want examples on how that is done, the code in
brlcad/ctypes_adaptors.py or wdb.py is a good start. A good IDE will
help you navigating that too...

I would be glad to help out with any problems you encounter, I'd like
this project to get in a shape where it is easy to deploy and use !

Cheers,
Csaba



------------------------------------------------------------------------------
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-devel

Reply via email to