Image Based Mapping

Hi (First-time poster),

I’ve attached the grasshopper file I’m working with.

I’m using the line drawings this program creates to then CNC models.

But I’m looking for help to be able to control the distance between the lines. They currently are drawn 1mm apart, I would like to control this distance so I can match the width my CNC tools can cut into the material.

Any questions, let me know

Image Based (38.3 KB)

If more information is required, I’ll attach some screenshots.

This first one shows the geometry produced when using the grasshopper script, each line is 1mm apart.

This shows the width of my tool at different cutting depths. (From 0.5mm to 2mm)

One of the images I’ve converted and opened in CAD and then scaled to 6.5mm per line, but then it means my final piece is now 1.2m x 2m, which is too big to make in one piece, I’m looking for the same effect but on a 500mmx500m piece.

I will be getting smaller tools, so the width they cut is smaller. But I still would like to control the distance between each line, without losing the image quality from the 1mm gaps.

hey there, welcome to the forum :slight_smile:

not very clear to me what you are trying to achieve… you want to tool only the black part of your images, right?
I see no Z component is present on the lines in your definition, could you please explain a bit more about the workflow you want to use, or the final result you would like to achieve?

I’m trying to produce these line patterns using a CNC router, so when I load this geometry into my CNC software and then tell the tool what depth to mill at, this is where I add my Z component.

Producing the below after milling has completed.

I am wanting to control how far apart on the Y axis the lines appear, when the image mapper is used. If I can control the distance between each line, I can then program how deep I need to mill into my material.

Does this explain it better?

so whenever your original image has color white, which means “nothing happening here, tooling go straight” you want to keep the Y value of your original grid of points

while when the color of the image becomes black (or fades to black in a gradient of grays) you want the trajectory of your tooling to move up, is this right?

Yes that is sort of right, so you can produce these sort of 3D images just using 2D lines

I’m just using black and white images to produce the lines.

So when the line hits a black area it will move down the Y then continue until it reaches a white area, making the line go up on the Y

this might be a dirty prototype of that, but it’s kind of slow :slight_smile:

Image Based (45.0 KB)

I did rewrite it followind my weird mind, but probably you can just apply several Remap components to your script and will get a perfect result

the parts I focused more are X and Y final size (of course)

“standard” Y toolpath offset: if your image was completely white, you end up with parallel horizontal lines with this distance

how many color samples are collected for each mm influences how much steep / jagged your curve is when it finds black pixels

and the last slider is a factor of the Y toolpath offset to indicating how much a black pixel will make the toolpath deviate, for instance if standard Y offset (white color) is 2mm, a factor of 0.5 will make the toolpath raise 2*0.5 = 1mm up/down

raising the factor to 1 will make toolpaths merge wherever the color is black and the above line was white:

changing this connection will make your curve deviate up or deviate down for darker pixels

decreasing the amount of samples per mm along X will give you smoother curves, but also a less definite perception of the contours:

this for sure can be improved a lot in terms of speed and functionality, it’s just a dirty prototype :slight_smile:

[edit] two important things:

  • the image sampler must be set with both X and Y domains as “0 to 1”
  • when you manually set the X/Y size in mm of the working area, you must input two numbers that have same ratio as length/height of the image you are using in the image sampler (calculate ratio with pixels, then apply to sizes in mm) otherwise you will get some weird results :slight_smile: (for instance, if your image is x=500_pixels y=1000_pixels also your final sizes in mm must be x=something_mm y=2*something_mm)

Thanks for the reply and prototype.
I will give it a go this afternoon, using the instructions you have provided.
I’ll let you know how it goes.