Knitting patterns on a surface in Grasshopper


Last week I have been visiting my brother in Barcelona. Maybe I should blame the maritime environment if I started experimenting with knots and threads. So, what I am going to show you today is a method to digitally knit yarn in Grasshopper. A similar definition to make a chaining fabric is provided at the end of the tutorial as well.

The stockinette stitch pattern

Download this Grasshopper definition (Update for GH 0.7+)

We are going to model the common stockinette stitch pattern at first, because this stitch can be easily adjusted to other knitting, chaining or weaving fabric compositions.

  1. The Grasshopper file starts from a straightforward definition of a knitting tile made out of curves, a surface and some parameters. This tile is illustrated in the picture above and is exactly the one marked in the dashed “component” box. The tile is surrounded by a rectangle in the grasshopper canvas, so that you can quickly adjust it to other definitions, in case you should need.
  2. A containing box is created, departing from the input curves. We are particularly lucky this time, because the open part of the curves can be exactely used to define the boundary box.
  3. This tile of curves is then repeated on the surface using the surface morphing component of Grasshopper, which is particularly useful because it maintains the geometrical continuity of what is being positioned.
  4. All curves are joined and rebuit using a custom-written C# method.
  5. The piping component finally produces the pipes.


Chaining pattern

Download the chain definition (Update for GH 0.7+)

By minimally modifying the previous definition, we can obtain a series of chains on a surface. It similarly works with one tile, which is then copied on the surface. We could expand this definition by making each newly formed link (a closed curve) periodic.


16 Responses to “Knitting patterns on a surface in Grasshopper”

  • dark fay-der Says:

    wowow i wanna make the same for my shiny knights chainmail, this really rocks, thank you so very much for your good manual!!

  • Giulio Says:

    hey my pleasure

  • Jess In Says:

    oh wow, this is definition is deliciously elegant… I tried scripting a crochet pattern a few weeks ago but mine’s so primitive by comparison! Thanks so much for sharing

  • R2112 Says:

    nice one…

  • J.L Says:

    That’s gorgeous. Thank you for sharing.

  • S. A Says:

    Thanks a lot man. As Walter Sobchak once said, the beauty of it is in the simplicity.

  • marishk Says:

    I do have a question, I am trying to populate a surface with a non square base in a chain , but my definition is using a box, so i cannot intersect my components. I want to have a chain like yours but generated with my individual component, how can i make it?
    thanks for sharing!!

  • Giulio Piacentino Says:

    Hi Marishk, thank you. I think it’s necessary to see a little sketch or examples to understand what you are trying to do… Have you thought about maybe opening a discussion on ?

  • Johan Says:

    hey, i really love the definition! i’m working on a similar issue on my school project and this really was an eyeopener!
    there is only one thing i don’t get. What’s the purpose of the C# rebuilding script in the end – can i skip it? because if i try to offset the outcome line instead of piping, i noticed, that gh does not offset the whole line, at one end of the original line the offset is missing, but if i offset the lines before applying the C# script, it works just fine and the offset really matches the original!
    so my question would be – is it really neccessary to apply the script if i’m not piping but offsetting and later on lofting… Can you explain the script?

    and another question : how would you change the issue of all the knots having the same height – i see they are controlled by Z interval. Is it possible to somehow variate this interval – perhaps whit a guideline curve on the surface i morph on? any suggestions ?

    just to give a taste what im working on:

    Vienna, Austria

  • Giulio Piacentino Says:

    Hi Johan, the rebuild script is there because this definition is a bit old already, and at that time there was no “native” Gh curve rebuilding component. Adding to that, the piping was a bit less robust back then, so it would now and then fail. In the newer Grasshopper the script is not necessary any longer (try replacing the piping component and you’ll see it has more options now).
    Variating the Z interval is actually difficult… the curves do not coincide any longer if two adjacent intervals are not the same, or extreme care is used in choosing these intervals and positioning the curves. There might be a couple of working cases I guess, but only with curves, points and single surfaces.
    Thanks for linking to your work: it looks great (and somehow “Angewandte”? :) ).
    – Giulio

  • Johan Says:

    studio prix ;) the “braiding” you see in the landscape is actually manually done in maya, so the next move would be doing it parametrically correct in GH :)

    thanks for the reply – will give it some effort over the weekend and hopefully show what i come up with.

    – johan

  • siavash Says:

    tanks it helped me alot

  • Doug Says:

    Beautiful, parametric piece.

  • Matt Says:

    Hi Giulio,
    I’m relatively new to GH and don’t quite understand where the points (P input) come from that create initial surface definition. Are they the points that are defining the pattern curves? In other words, how is the S input of the surface morph created? Thanks a lot! I love the definition.

  • Giulio Piacentino Says:

    Hi Matt, those points are just referenced by coordinates in Rhino (meaning they do not reference an ID, I just drew the logic there). HIH, – Giulio

  • donkeypunch Says:

    Thank you. The work you do is incredible.

Leave a Reply