API Bindings for js and python
Mainly - the advantage is live, interactive use with full autocomplete. So my poor brain doesn't have to remember the commands (even though I made them 🤔 )
9 Replies
Sure, autocomplete would be cool. Maybe I can move off Notepad++ ha
BTW, I've keeping a record of my own comments learned from experimentation with the API. I would love to add these below...
https://docs.openbrush.app/user-guide/open-brush-api/api-commands
Currently it's quite sparse but I wanted to add many more examples of what to expect with certain brushes, draw path with hull brushes, etc.
Here. Drop this into a directory somewhere: https://gist.github.com/andybak/c700120232ca68a90adc791f75c8a16c
Launch python then import it like this:
actually you probably want to pip install ipython to get autocomplete. launch ipython instead of python.
you should then be able to type api commands get get tab autocomplate and completion suggestions. the syntax is nearly identical to the api except you pass params like this:
![No description](https://utfs.io/f/5cdc9367-57ba-4d8d-bfb9-62e38f4eea82-1nq2cb.png)
cp /root/temp/tmp/ob.py ~/venv_3.8/lib/python3.8/site-packages/.
ipython
from ob import ob
I will continue messing with it...On first go though, I hate having to add parenthesis and quotes but, once a command is in buffer I just "up arrow" back to it and modify. I also do send commands to my Quest IP_ADDRESS, but I guess I can change the ob.py file. I will have to play with REPL environment, could really speed up development
You should only need quotes for strings. Does the moveto work without that?
![No description](https://utfs.io/f/c8150e4f-5184-410e-bd9b-6f0006142fe3-1nq2cb.png)
It takes quotes. It's okay, I can find a shortcut or reuse command history buffer
ah - it's just a bug where it thinks "position" is a single parameter when it actually should be three params
I forgot to special case vectors as params
I made a few small updates in my own repo, I think I fixed "brush.move.to" and support for overriding localhost...
https://github.com/dwillington/open-brush/blob/main/docs/api_bindings/ob.py