Grasshopper

algorithmic modeling for Rhino

Maybe there is a tool for this but I can't find it.

The 3D printer I am using takes in a bitmap file, and where there is a white pixel, it deposits material and where there is black, it doesn't.

Each pixel corresponds to a certain fraction of a millimetre (about 0.033).

Is there something that allows me to convert 2D projection of a solid geometry to a B/W bitmap. So I can select a certain height, project it onto the XY plane and convert it to a bitmap.

Thanks!

Tim

Views: 1866

Replies to This Discussion

No, but it wouldn't be too difficult to code up using a C# component. If you have a set of curves whose interior are supposed to be white, and a rectangle that describes the bitmap outline, and the horizontal and vertical resolution you're after, I can try and throw something together.

There have already been various components posted in the forum over the years that generate bitmaps though. You could try and find one of them first.

Attachments:

The Width and Height numbers control the size of the bitmap. It is outputted as a rectangle so you can see where it is in 3D space. The Factor input allows you to shrink your pixels. A Factor of 1 means each Rhino unit becomes a single pixel. A factor of 10 means each unit is represented by 10x10 = 100 pixels.

Outlines must be a single list of closed curves. Polylines are converted precisely, smooth curves will be discretized, though hopefully not visibly. All the curves are drawn consecutively, so if two of them overlap, the intersection will remain black, it will not go white.

The File must be a location on your disk (png extension) that is writeable. My value won't work because it's located on my desktop which involves my user name.

I figured you did not want anti-aliasing in your image, but if yes, or if you want more control over per-shape colours, that's all possible.

Thank you so much for providing the solution. It works perfectly! Though I had to comment out the curve.ToPolyline call and move the  curve.TryGetPolyline(out polyline); out of the if statement.

Does the number of parameter change for that method in the new version of RhinoCommon?

http://developer.rhino3d.com/api/RhinoCommon/html/Overload_Rhino_Ge...

As the factor is going to be a very small number, the size of the bitmap may get huge (i have to save it as a .bmp with no compression). I will deal with that when it comes up.

Does the number of parameter change for that method in the new version of RhinoCommon?

Oh could well be. I'm only testing on Rhino WIP now and I keep forgetting that not all SDK methods and types are available to older versions.

Btw. I got tired of always writing these specific script components for making images, so I started a little project that is a bit more generic. It'll be available to RhinoWIP users only but the first test of it can be seen here.

I did not do anything special yet in order to handle huge bitmaps, but then RhinoWIP is 64-bit only so memory limitations should no longer really apply.

Great! Thanks!

I tried using RhinoWIP but a number of plugins that I depend on isn't working yet.

Really? I thought all plug-ins work on RhinoWIP. Not Rhino for Mac mind, the work-in-progress of Rhino6 for Windows.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service