Ungrouping a voxelized aggregation

I am experimenting with voxels using the n-gon plugin. When I get the voxelized output, it is in one single combined mesh. How can I get individual cubes separated?

VOXEL CLUSTER query.gh (97.7 KB)

While reverse engineering on that is possible … in fact you have 4 realistic options:

  1. Contact the fella who did n-gon (I have no idea what is and what it does).
  2. Search this or the old Forum for solutions that attempt to do it via native GH components. If memory serves well there’s some attempts around.
  3. DIY: Get a Box (on a per GeometryBase object basis) and divide recursively (or iteratively) while checking the resulting sub boxes for complying to your rules (some sort of pt containment or other). Note: if use a containment rule then turn Breps to Meshes for speed.
  4. Learn how to code (best option by a huge margin).


2 Likes

NGonGh.zip (228.4 KB)
VOXEL CLUSTER query.gh (113.3 KB)

I made additional output pt that gives position of each box center.
You need to replace NGonGh.gha file with the zipped file attached.

1 Like

I ensured that the file was unblocked and replaced the NGonGh.gha file with yours.

I am getting the following error when I open your script.

A white box is coming at the location of your component.

The ngon plugin itself is not loading with your .gha file. With .gha file that was already present on my system, the plugin loads fine.

Can you try to find voxel component in NGon tab as you did initially?
Also it would be good to get a screenshot of Rhino Command line to see if there are no loading errors.

The entire ngon plugin toolbar is missing. I suppose there is some issue in the loading of the plugin.

Here is the screenshot of the Rhino command line.

Ok, it seems this is what is causing the issue:

You installed plugin via package manager for rhino7.
And there is another installation in standard libraries folder.

I suggest:

  1. Delete everything from the first path of your screenshot.
  2. Replace the .gha, I attached previously, in the second path of your screenshot.

Let me know if that works.

Awesome! Thanks. It worked. :+1:t3:What is the 0.5 slider doing?

The native grasshopper center box component creates a box in its original code using an interval (-boxsize * 0.5,boxsize * 0.5)

The scale of one voxel box is 1/scale, so the center box input is created using an interval (-1/scale *0.5,1/scale *0.5) which is (0.5/scale) as a grasshopper input.

1 Like

I already know this.

What exactly is scale input in the voxel size? I was just using it intuitively by sliding, how does it measure the length of each box side?

The voxel size is a scale of a unit:

for (int i = 0; i < pts.Count; i++) {
                v.Add(pts[i], new NGonsCore.Voxel((int)(pts[i].X), (int)(pts[i].Y), (int)(pts[i].Z)) * scale);
            }

So it is equal to RhinoUnit/Scale.

I don’t understand coding. Can you explain in terms of millimeters?

If I want to have a box of, say 15mm, what should the scale set to and the mathematical formula for the same?

ezgif.com-gif-maker (1)

To get rhino units simply divide 0.1/RhinoUnits: