Stream: Google Summer of Code

Topic: BRL-CAD Python Bindings


view this post on Zulip Ronan Coutinho (Feb 21 2024 at 18:19):

Hi, I'm Ronan Coutinho, a second year student pursuing BTech in Computer Science Engineering from BITS Pilani, India. I came across your GSOC 2024 Project Idea based on implementing bindings for the BRL-CAD functionality to Python language. I have a strong foundation of Python language as I have used it in previous projects. I am new to open source contributions but am eager to learn. Please guide me as to how I should get started and be able to contribute to this project.

view this post on Zulip Daniel Rossberg (Feb 22 2024 at 08:38):

An important point of the Python binding topic is the design of the API. You should learn about the currently available APIs (basic C API, TCL script, object oriented MOOSE), how they give the user access to BRL-CAD's features, and develop a concept for a Python interface.

view this post on Zulip Sean (Feb 22 2024 at 17:52):

@Ronan Coutinho welcome! There is a lot to learn on the python bindings topic, but you're welcome to propose whatever you think sounds like a great project idea, tailored to your knowledge. Do know that there has been some work in the past on python bindings for BRL-CAD that might be worth looking into. You don't have to use them, or you can build off what they did and take things further -- you propose what you want to do. Here's some links to related efforts:

https://medium.com/@Mr_Jaypee/brl-cads-python-procedural-geometry-990e3c286a63
https://brlcad.org/wiki/User:Schindler97/GSoC18/Project
https://brlcad.org/wiki/User:Schindler97/GSoC18/Log
https://brlcad.org/wiki/User:Krajkreddy/GSOC14/proposal
https://brlcad.org/wiki/User:Krajkreddy/GSOC14/summary
https://github.com/kanzure/python-brlcad

view this post on Zulip Ronan Coutinho (Feb 22 2024 at 19:25):

Thank you @Sean @Daniel Rossberg for giving me a direction to start my work. I will look into all related efforts in this project and will discuss with y'all about the feasibility of my ideas once I get a good understanding.

view this post on Zulip Ronan Coutinho (Feb 24 2024 at 09:49):

I'm following the setup instructions mentioned in https://github.com/kanzure/python-brlcad/blob/master/README_WIN.md for windows. I have python 2.7, pip, setuptools and mingw installed. When I run C:\Python27\Scripts\pip.exe install --upgrade brlcad I face this error. Could you'll please help me out.
image.png

view this post on Zulip Ronan Coutinho (Feb 25 2024 at 16:54):

@Sean @Daniel Rossberg I now tried using these commands git clone git@github.com:kanzure/python-brlcad.git
cd python-brlcad/
export BRLCAD_PATH=/usr/brlcad
python setup.py install and am getting the following error. What should the path be here? I tried putting the path of the folder where BRLCAD is installed but it gives me the below error. Please help me out.
image.png

view this post on Zulip Himanshu (Feb 25 2024 at 17:07):

Ronan Coutinho said:

Sean Daniel Rossberg I now tried using these commands git clone git@github.com:kanzure/python-brlcad.git
cd python-brlcad/
export BRLCAD_PATH=/usr/brlcad
python setup.py install and am getting the following error. What should the path be here? I tried putting the path of the folder where BRLCAD is installed but it gives me the below error. Please help me out.
image.png

It should be brlcad\Debug\ if you are in windows.

view this post on Zulip Daniel Rossberg (Feb 26 2024 at 10:50):

Hmm, you are on Windows, therefore the path should probably start with C:\. Where is your BRL-CAD installation? In addition, I'm in doubt that the python-brlcad will work with a current BRL-CAD version.

view this post on Zulip Sean (Feb 27 2024 at 18:57):

Glad to hear it @Ronan Coutinho feel free to ask follow-up questions as you learn. I certainly have my biases of what I'd like to see and am happy to share those thoughts with you sometime, but any proposal should be meaningful to you first.

It will help to compile BRL-CAD from source, and do one of the simple tutorials just so you get some familiarity.

view this post on Zulip Sean (Feb 27 2024 at 18:59):

As for the errors, I'm guessing the setup.py is out-of-date referencing ctypesgen-dev ... is that even still a thing?

view this post on Zulip Sean (Feb 27 2024 at 19:01):

That said, what daniel and himanshu said seem to be that last error -- you haven't specified where it can find BRL-CAD.

view this post on Zulip Ronan Coutinho (Mar 02 2024 at 17:29):

@Sean @Daniel Rossberg I tried to do the setup multiple times on windows trying all possibilities. I now dual booted my laptop assuming that setting up the development environment would be easier on linux. On linux terminal i created a python environment and then ran pip install -U brlcad. Please help me fix errors shown in the screenshot.
Screenshot-from-2024-03-03-04-28-07.png

view this post on Zulip Sean (Mar 02 2024 at 18:23):

@Ronan Coutinho as I mentioned, that previous work was developed several years ago now so the scripts are going to be out of date. Per the error message, it's saying "ctypesgen-dev" doesn't exist, which is not hard to imagine given how much time has passed. It's possible it's just renamed, maybe "ctypesgen" or something similar, or it's possible that entire code path was replaced with a different mechanism. A quick search indicates ctypesgen is still around, so probably just a matter of finding the right name. That said, there are going to be changes needed to get the previous walkthrough working. That's part of the effort for that project -- to figure that all out.. ;)

view this post on Zulip Sean (Mar 02 2024 at 18:23):

Do you have BRL-CAD installed from source and running?

view this post on Zulip Ronan Coutinho (Mar 02 2024 at 18:31):

@Sean Yes I have installed BRLCAD v 7.38.0 from https://github.com/BRL-CAD/brlcad/releases for windows

view this post on Zulip Ronan Coutinho (Mar 16 2024 at 05:54):

Hi @Sean @Daniel Rossberg @Himanshu Sekhar Nayak Firstly I apologize for being inactive as I had my semester exams going on.
I had a few suggestions for my project proposal.
1.Looking at the previous work done in this project most of the primitives have been wrapped in python-brlcad. I will complete the remaining, which are rcc, tec, trc, ellg 1, part, ars, spline , binunif. With tests and examples.
2.Apart from this I also want to update the install scripts for python brlcad and bring it upto date. A problem which I'm facing myself :)
3.Current version depends on Python 2.7x. I could extend support to python 3

  1. Creation of primitives based on feedback from community.
    These are the deliverables in my mind as of now. Please share your feedback and anything else you'd like to see in this project.

view this post on Zulip Himanshu (Mar 17 2024 at 09:04):

Ronan Coutinho said:

Hi Sean Daniel Rossberg Himanshu Sekhar Nayak Firstly I apologize for being inactive as I had my semester exams going on.
I had a few suggestions for my project proposal.
1.Looking at the previous work done in this project most of the primitives have been wrapped in python-brlcad. I will complete the remaining, which are rcc, tec, trc, ellg 1, part, ars, spline , binunif. With tests and examples.
2.Apart from this I also want to update the install scripts for python brlcad and bring it upto date. A problem which I'm facing myself :smile:
3.Current version depends on Python 2.7x. I could extend support to python 3

  1. Creation of primitives based on feedback from community.
    These are the deliverables in my mind as of now. Please share your feedback and anything else you'd like to see in this project.

Sounds good to me. What do you mean in your 4th point? I didn't understand.

view this post on Zulip Ronan Coutinho (Mar 17 2024 at 20:15):

Himanshu Sekhar Nayak said:

Ronan Coutinho said:

Hi Sean Daniel Rossberg Himanshu Sekhar Nayak Firstly I apologize for being inactive as I had my semester exams going on.
I had a few suggestions for my project proposal.
1.Looking at the previous work done in this project most of the primitives have been wrapped in python-brlcad. I will complete the remaining, which are rcc, tec, trc, ellg 1, part, ars, spline , binunif. With tests and examples.
2.Apart from this I also want to update the install scripts for python brlcad and bring it upto date. A problem which I'm facing myself :)
3.Current version depends on Python 2.7x. I could extend support to python 3

  1. Creation of primitives based on feedback from community.
    These are the deliverables in my mind as of now. Please share your feedback and anything else you'd like to see in this project.

Sounds good to me. What do you mean in your 4th point? I didn't understand.

I meant if any new primitive is being developed right now I could work on wrapping that as well. Or are the current primitives the only ones that would exist.

view this post on Zulip Sean (Mar 23 2024 at 22:18):

Ronan Coutinho said:

1.Looking at the previous work done in this project most of the primitives have been wrapped in python-brlcad. I will complete the remaining, which are rcc, tec, trc, ellg 1, part, ars, spline , binunif. With tests and examples.
2.Apart from this I also want to update the install scripts for python brlcad and bring it upto date. A problem which I'm facing myself :)
3.Current version depends on Python 2.7x. I could extend support to python 3

  1. Creation of primitives based on feedback from community.
    These are the deliverables in my mind as of now. Please share your feedback and anything else you'd like to see in this project.
  1. sounds good. ars could probably be ignored, but it would be nice from a completeness standpoint to have a full mapping for all entities.
  2. seems reasonable.
  3. anything new should be python 3...
  4. you should compare the list of primitives to what we have. I didn't see mention of brep, for example, or pnts, I'm sure there are others.

Depending on how the schedule works out, I think the importance here would be making it really simple with examples, well documented, as easy as absolutely possible to use on all platforms (mac, linux, windows), and proving that it works somehow -- perhaps by way of test cases (CI/CD).

view this post on Zulip Daniel Rossberg (Apr 04 2024 at 14:25):

Hi @Sakthi N, to make your proposal to be taken into consideration, you would have to be more active here, discuss your project with the potential mentors - and provide at least one patch.

view this post on Zulip Sakthi N (Apr 05 2024 at 03:45):

Hi @Daniel Rossberg , I shall be active in this chat in the upcoming days. I already have Python and MinGW. I shall install BRL CAD, go through other documentation on the github page, and get started.

view this post on Zulip Daniel Rossberg (Apr 05 2024 at 11:41):

:+1: I'm expecting your comments.


Last updated: Nov 16 2024 at 00:47 UTC