Grafted wrong

Happened while frantically preparing for a presentation. Glad I kept it.

Autocompletion for Rhino/Grasshopper python scripts in Vim

UPDATE: Jedi now supports pep-0484 so installing Rhino-Stubs should be enough.

Steve Baer at McNeel posted on the McNeel forum about the Python package Rhino-Stubs he had created and how to use it in PyCharm for autocompletion and type hints for Rhino/Grasshopper scripts. Here's the thread and here's the full explanation on Steve's blog.

I've started to write a lot of Python scripts in Grasshopper which usually means you write using the built in editor if you want autocompletion. Since I already copy my scripts to a git repository for version control I jumped at the chance to do more of the scripting in an external editor. While PyCharm has an OK Vim plugin I still longed for the comfort of trusty Vim.

The Rhino-Stubs package provides Python stubs as described in PEP-484 and PEP-561, and my initial research led me to an issue on the jedi repository (a widely used autocompletion engine for python). However, I also found another source of stubs, gtalarico/ironpython-stubs in another format. The repo's wiki includes instructions for integration with Atom, VS Code and Sublime Code, and I used these instructions to integrate the stubs with Vim and Jedi through vim-jedi.

Here are the steps needed in case someone else wants to try it.


These instructions assumes that you have a Linux environment with an installation of Vim that has been compiled with python support, and that you have Python 2 installed. Other autocompletion plugins might interfere with jedi-vim, disable them if you are having trouble.


  1. Install the Vim plugin jedi-vim.
  2. Clone or download gtalarico/ironpython-stubs. The repo will be referenced in the next steps.



  1. Append the path to the stubs to the PYTHONPATH variable in your shell profile (e.g. .bash_profile/.bashrc/.zshrc) using the command export PYTHONPATH=${PYTHONPATH}:/path/to/iron-python-stubs/release/stubs.min
  2. Put let g:jedi-vim#force_py_version = '2' in your .vimrc if you have Python 3 in your environment.

In a virtualenv

  1. Create a new virtualenv with the command virtualenv -p python2 my_ironpy_scripts. Replace python2 with the path to your Python 2 executable if python2 doesn't work.
  2. Create a file called .pth in my_ironpy_scripts/lib/python2.X/site-packages/ containing the absolute or relative path to the ironpython-stubs. E.g. /path/to/ironpython-stubs/release/stubs.min
  3. source bin/activate and start editing, jedi-vim will use your virtualenv with the added path to the stubs.


You are now ready to complete using jedi-vim, the standard keymap is <C>-<Space>. I use ervandew/supertab to map completions to <Tab>.

I've tried to use the same method with the stubs provided by Rhino-Stubs, but haven't gotten it to work. If someone figures it out, please let me know. This would be interesting because Rhino-Stubs provides better support for RhinoInside.

Migrated to Hugo

I've decided to decouple my portfolio from my blog, mainly to avoid maintaining a Jekyll template that works with both my portfolio content and my blog posts. It felt like this was a good time to try out Hugo. Confusing but refreshing.

I've decided to use page bundles and worked out a shortcode based on Hugo's embedded figure shortcode. glob is either the file name of the image, or a glob.

// /layouts/shortcodes/pbfig.html
{{ $img := $.Page.Resources.GetMatch (.Get "glob")}}
<figure{{ with .Get "class" }} class="{{.}}"{{ end }}>
    {{ if .Get "link"}}<a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>{{ end }}
        <img src="{{ $img.RelPermalink }}" {{ if or (.Get "alt") (.Get "caption") }}alt="{{ with .Get "alt"}}{{.}}{{else}}{{ .Get "caption" }}{{ end }}" {{ end }}{{ with .Get "width" }}width="{{.}}" {{ end }}{{ with .Get "height" }}height="{{.}}" {{ end }}/>
    {{ if .Get "link"}}</a>{{ end }}
    {{ if or (or (.Get "title") (.Get "caption")) (.Get "attr")}}
    <figcaption>{{ if isset .Params "title" }}
        <h4>{{ .Get "title" }}</h4>{{ end }}
        {{ if or (.Get "caption") (.Get "attr")}}<p>
        {{ .Get "caption" }}
        {{ with .Get "attrlink"}}<a href="{{.}}"> {{ end }}
            {{ .Get "attr" }}
        {{ if .Get "attrlink"}}</a> {{ end }}
        </p> {{ end }}
    {{ end }}

And to use it in your markdown.

{{< pbfig glob="" alt="" >}}

The post Hugo Page Resources and how to use them is a great resource to understand Page Bundles.

Update 2019-05-01: I've put the sites back together, and replace my own shortcode with Kaushal Modi's.

Patterns, not work

I made this from assets found in a ROM of Ocarina of Time.

Form finding for bachelor project

Rotation animation of frozen BOIDs movement

In this project we use Grasshopper to develop forms, I have tried to model agents’ movement in a vector field using Boids.

I have based my script on this tutorial from the blog Generative Landscapes. I have yet to decide if the lines represent a structure or movement.

Ars Paradoxica deciphering spreadsheet

Deciphering spreadsheet

I listen to the beautiful audiodrama Ars Paradoxica. In the end of each episode a series of numbers are read. I put together a spreadsheet to decipher these, take a look if you'd like.

The cipher's used are Vigenére, Caesarian shift and Atbash.

Update: The spreadsheet contains deciphering methods for episode 1-23. I haven't solved the cipher for later episodes.


Wonderful gem found on