Hi,

I created a list of cubes and I want to delete X number of cubes from that list but I want to be sure that the cubes that I delete has less that 6 adjacent.

So here is the steps that I want to do:

1 I want to count how many adjacent for each cube

2.delete one cube that has less that 6 adjacents

3.repeat step 1 and 2 X timesmodular form.dyn (77.4 KB)

Any help

You say â€śrepeat step 1 and 2 X timesâ€ť but is X a defined number of times or until you run out of cubes to delete?

And only one cube not many? And randomly selected?

What do you consider adjacent? Touching? Close?

And do they have to be cubes? (This getâ€™s a little tricky with corners touching each other.)

Are the cubes all the same size and on a grid? If so you could do a distance between centroids to eliminate the corners. Any distance equal to the length of a cube edge any one edge returning true would count towards the six.

It is an X number of cubes but I want to find how many adjacents each cube to delete one that has less than 6 adjacents then I want to count how many adjacent for each Cube after deleting the first one and delete the second which also has 6 adjacentsâ€¦and repeat this X number of times

And yes Random selection but everytime I want to shuffle the choice

List.Shuffle, or list.drop with a math.random will allow for that. Can you post a sketch and an image of your script so far?

All the cubes has the same size. They are next each other on cue direction but there is a void in the middle. I also uploaded the code.

What I mean how many of the Cube faces are touching other cubes faces

0,1,2,3,4,5 or 6

So in the photo you can see how they are adjacent

You can get the cubes center points, and then do a distance calc between the other centerpoints, and a list.sort and then get the item at index[5]. If that distance is equal to the cube edge, than that point has six faces tangential with other elements, and shouldnâ€™t be included in the delete list. If the length is greater than Include it in the set to drop items from.

Once you have the list you can use a list.shuffle node and a list.drop node or a list.remove item at index node with a random list of indices to remove Y number of blocks (I know you said one but I donâ€™t think that removing a variable will change the results, and will allow faster processing of the overall graph if youâ€™re after lets say a 25% reduction of cubes. I like the idea of removing X on the first run, X-1 on the second, X-2 in the thirdâ€¦)

Having said all that, there are a LOT of geometrical calculations there even with the simplified variable removal. You may be better off generating the cubes after pruning the list of points as it will be more efficient memory wise to remove points than it will to remove cubes.

1 Like

@Abdulaziz.Afandi Below is a way to distinguish cubes that have 6 adjacent cubes from those that donâ€™t.

Basically, the peripheral cubes have less than 6 adjacent cubes, right?

You should be able to proceed with the deleting based on this, I suppose

modular form-Vik.dyn (88.3 KB)

2 Likes

Some random deleting of peripheral cubes â€¦

2 Likes

interesting !

I know that removing points I faster in calculation â€¦ Any ideas how to do that?

Can I get a sketch or a screen shot , It will help me a lot.

Thank you

That is awesome for finding how many adjacent!

It is working fantastic.

Thank you that is really helpful,

1 Like