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
dwillington
dwillington•2y ago
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.
andybak
andybakOP•2y ago
Here. Drop this into a directory somewhere: https://gist.github.com/andybak/c700120232ca68a90adc791f75c8a16c Launch python then import it like this:
from ob import ob
from ob import ob
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:
ob.brush.move(2)
ob.brush.move(2)
dwillington
dwillington•2y ago
No description
dwillington
dwillington•2y ago
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
andybak
andybakOP•2y ago
You should only need quotes for strings. Does the moveto work without that?
dwillington
dwillington•2y ago
No description
dwillington
dwillington•2y ago
It takes quotes. It's okay, I can find a shortcut or reuse command history buffer
andybak
andybakOP•2y ago
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
dwillington
dwillington•2y ago
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
Want results from more Discord servers?
Add your server