I would like to use my compas package in Rhino.
According to documentation additional packages to compas are installed like this: python -m compas_rhino.install -p compas_mypackage
Does it have anything to do with that the package has linked library that is coming from pybind11 and I must use RPC: - rpc (compas.dev)
Update I guess the solution is below. Just would be good to know if there is a way to check if a process has been started?
If I skip these lines, would the proxy start automatically if no process was started?
from compas.rpc import Proxy
proxy = Proxy('compas_wood.joinery') # import module
proxy.test() # run function from the module
What is necessary to know when publishing your own package and running on Rhino?
I am able to call the package rhino python, so the package is found:
if you have a package that has wrappers for C++ code, you have to make sure that the functions for working with geometry in Rhino are separated from the functions relying on C++. the former are probably needed to create input data for and visualize the results of the latter. calls to the C++ wrappers will have to be made through RPC. therefore the pure Python “Rhino code” and the “C++ wrapper code” will have to reside in different modules in your package so they can be imported independently.
manually adding paths to the Python Module Search Paths is never needed, and will certainly not help to run C++ code directly in Rhino, since this is simply not possible.
when you create an RPC proxy, it will automatically try to reconnect to an existing server. if none is found, it will start a new one.
manually stopping and starting the server (i.e. proxy.restart_server()) is only needed if you want to reload the code that is running on the server, for example after making changes…