Rhino Mac PyCharm autocomplete
Here is how I set up my PyCharm IDE to program in Rhino Mac, so I can have a nice autocompletion functionality for the RhinoCommon and rhinoscriptsyntax.
First, I install the python stubs to my created conda environment. This makes sure that we will have the autocomplete for the RhinoCommon API.
$ conda create -n your-env-name
$ conda activate your-env-name
$ pip install Rhino-stubs
To use specific environment in PyCharm, we will have to select the right environment for the project.
This can be set in PyCharm -> Preferences -> Project: your-project-name -> Python Interpreter
.
Normally, our environment python is located at ~/anaconda3/envs/your-env-name/bin/python
.
Finally, we have to mark rhinoscriptsyntax folder as a source, so PyCharm can recognise them. In macOS, this is located at: /Applications/Rhinoceros.app/Contents/Frameworks/RhCore.framework/Versions/A/Resources/ManagedPlugIns/RhinoDLR_Python.rhp/RssLib
.
We can do this in PyCharm -> Preferences -> Project: your-project-name -> Python Structure -> Add Content Root
. Make sure that both ghpythonlib
and rhinoscript
folders are selected and marked as sources.
Easy! We are done. Happy coding!