Advanced 3D printing with grasshopper + image attractors


I am new to the grasshopper community but have been working in CAD and 3d printing for about 10 years now. I recently purchased a clay printer and have been learning grasshopper from this book “advanced 3d printing with grasshopper.” The book does a good job at teaching you the fundamentals but at times could do better at explaining how to combine them.

I am currently running into 2 issues and I am stumped. The first is very simple. When I am using a weave pattern to create surface geometry, the points are moving tangent to the surface. When I flatten the vector I get unwanted geometry but the vectors arent tangent anymore which is great. Is there an alternative way to flatten the vectors? 2 files below, one with flatten option and the other not.
flatten (26.6 KB)
tangent (26.5 KB)

The last question I have is how to use image sampler as the attractor. I have re-read the chapter on this multiple times but it doesn’t do a good job at explaining how to apply this to the previous topic.

Took me awhile to locate the difference between your two GH files. Looks like you flatten the Brep CP ‘N’ output? (yellow group) Flatten is rarely a good idea, especially when you ignore the data tree structure. Text panels are good for that.

The orange Pt param is not initialized.

I see nothing about Image Sampler in this code?

P.S. By the way, the shape of this vase doesn’t change much after the ‘Number of layers / 2’ slider gets above 6 or so. Makes no difference at all in the end but fewer sections are often better.

P.P.S. The PLine component at the end is red with this error message:

  1. Data conversion failed from Curve to Point

Because the last Weave just before it is weaving curves on input ‘0’ with points on input ‘1’, which is clearly wrong! The uninitialized Pt param causes nulls to be in this mix, making it all a mess. CP and ReMap also fail. Surprised that the output looks reasonable at all.

Hi Joseph,

Thanks for the reply!
Yes I flattened the output in an attempt at keeping the translation to 1 plane vs tangent to the vectors. How would you modify the vectors to make them planar?

Apologies I forgot to email myself the file with image sampler included. I dont know where to begin with inserting this into the gh script. I did the best I could but im having trouble following what the book is implying. Here is the current GH file with the image sample integrated where I think it should be. (859.2 KB)
gh-image sampler.3dm (21.1 KB)

Kind of late in my day to revisit this, especially the Image Sampler part which might belong in a separate thread. Oh, I see your file now and doubt very much that Image Sampler is required or appropriate for this. Do this without Image Sampler.

And never run data through a text panel as you have done before and after Image Sampler.

That doesn’t make any sense to me. Oh, is this (white group) what you mean?

I ditched the Image Sampler. Looks decent now? Except for the clay printing issue that requires all these separate curves to be connected in one spiral? (15.3 KB)

I’m done for today. Early to bed, early to rise.

Hi Joseph,

I want to use an image sampler to create a more precise attractor. The curves and attractor points have a nice look, but a grey scale image would open up more possibilities. I will open up a separate topic now that this is sorted.
I integrated that into the script with the point attractors and it worked, thank you!

I appreciate the help, have a good evening.

I seriously doubt that Image Sampler is required for this. There are many ways without it to “open up more possibilities”.

I have no idea what you are talking about. What attractor :question: :man_facepalming:

Here 2 pages from the book. I’m sure there are many ways to add variance, but this is the next chapter I am trying to learn.

1 Like

There are many things wrong with this. (1.3 MB)

1 Like

image (151.3 KB)
im almost there but i cant figure out how to restructure the polyline to follow the points in a horizontal way instead of vertically. any ideas?

Flip Matrix? But it doesn’t look right…

P.S. I didn’t try to understand your whole model but it looks to me like you want to avoid the Weave of points? This image shows each branch of polylines as a separate color, without the PLine ‘V’ input flattened. When you flatten that input it becomes a single polyline (tool path?) as each branch connects to the next.

image (160.3 KB)

1 Like

I ended up using Josephs logic but in a different way. Im not sure if this is what you are looking for but try this.
image (156.6 KB)

amazing! it worked:). but now when i tried to spiralize it, it led to some weird problems (second image). any ideas? ill update if i fix it. (25.7 KB)

I am not at my computer but my guess is that the spiral logic won’t work with large loop, I had a similar issue but it’s wasn’t as drastic as yours.

In the book, there is a second method for connecting your contours. You have to input the amount of divisions as well as the amount of steps to create the spiral but it helped give me a more symmetrical look. It seemed to happen when I would creat larger loops. Smaller path variations didn’t affect it as much.

always keep in mind that spiralization happens between two consecutive layers (between two polylines belonging to consecutive layers)

this means that if you have “drastic” changes in polyline configuration between consecutive layers, then spiralization will most probably produce weird results

an important point is about the number of points per layer: as you are dividing each layer-curve into a given amount of points, those are of course equally distributed along the layer-curve itself, which means the point distribution is not equal if curves are not very very similar

this means that when you are calculating spiralization and pushing points up sequentially, it will happen that were your layer-curve is simple (lower density) it will be raising with a given slope, while where your layer-curve is complex (higher point density) it will move up with a higher slope (like running up faster)

I’m not saying to avoid spiralization in these cases :slight_smile: but just keep in mind all these variables because they lead to a much higher complexity when it’s time to print

Here’s the way I did something similar for a regular FDM printer:

  1. Make basic smooth surface using Loft or Surface of Rotation
  2. Intersect 1 with a series of horizontal planes. This yields a bunch of horizontal closed curves.
    3.Divide each curve from 2 into a bunch of points (200 in my case)
  3. Make a horizontal vector from the center of each curve from 2 to each of the curve’s points from 3.
  4. Extend the length of each vector a small random amount and make a new point
  5. Make an Interpolated curve from each of the points in 5
  6. Loft the curves from 6

I use a standard slicer (PrusaSLicer) to slice the resulting Loft shape after adding the necessary bottom and (for me) the sidewall thickness.

I realize the OP wants to use attractor points to make exterior decorations, but this should be fairly easy to do by using a different method for for step 4. After this the results could be printed using Spiral Vase Mode found on every standard slicer program.


Hello, I have the same book but it is impossible to reproduce the same diagram as on the book, I would like to do the same thing by inserting an image on a shape and then printing it in ceramic, could you have had the whole code?

You need to tighten one of your axis for better surface finish.

I can’t reproduce an image on my vase with more or less thickness

Actually the problem was a partially clogged nozzle and incorrect flow rate setting. But that’s all fixed now.

I want to reproduce this gcode in order to put an image on my gcode that looks like this photo