[Grasshopper] How to use Clean Tree to remove and organize null, invalid, and empty data

[Grasshopper] How to use Clean Tree to remove and organize null, invalid, and empty data Grasshopper component EN

This guide explains how to use Clean Tree to remove and organize null, invalid, and empty data.

Clean Tree1
Clean Tree2

On the Grasshopper, it is represented by either of the two above.


↑Youtube Channel

Deleting and organizing null, invalid, and empty data

Using Clean Tree allows you to remove and organize Null, Invalid, and Empty data.

Therefore, in some cases, it is possible to resolve the error state.

Components used

Components used: ①Point ②Merge ③Line

First, let’s create and examine a Null (when a value does not exist).

Enter the number 0 into the first terminal of the first Merge.

For the remaining four terminals of the first Merge, input the four coordinate data sets: 100,0,0, 200,0,0, 300,0,0, and 400,0,0.

Enter the number 0 into the first terminal of the second Merge as well.

For the remaining four terminals of the second Merge, input the four coordinate data sets: 100,100,0; 200,100,0; 300,100,0; 400,100,0.

eight points are created

Then, connect the coordinate data to the Point.

Then, the coordinate data is converted into point data at that location.

In this way, eight points are created.

Since only a numerical value is entered into the first terminal of Merge, nothing happens.

Graft

At this point, right-click the two Merge(R) and select “Graft”.

a line is created

Then, connect the two Merge to the line(A and B).

Then, as shown in the image above, a line is created by connecting the two points.

And a total of four lines were created.

error

Additional Component: ①Clean Tree

However, when we check Line, it shows an error message.

This is because you must input point data into Line, but since you are inputting numerical data, an error is occurring.

When we connect a Panel to the Line and examine the data, the first branch is null.

The remaining four are displayed correctly as “Line,” indicating that line data has been created.

In this state, connect the Line to the Clean Tree(T).

Then, the null in the first branch was deleted.

Flatten

However, if we leave it as is, the {0;0} branch will remain.

By flattening the data into a single branch, you can eliminate empty layers.

Right-click the Clean Tree(T) and select “Flatten”.

the data was consolidated into a single branch

Then, the data was consolidated into a single branch, and the empty branch disappeared.

To preserve the branch structure

Additional Component: ① Boolean Toggle

To preserve the branch structure, input True into the Clean Tree(E).

This time, we were inputting the information for True using a Boolean Toggle.

Then, we were able to delete the empty branch while maintaining the branch structure.

Invalid

Next, let’s look at the Invalid state.

Set the coordinate data entered into the first Merge to the origin position of 0,0,0 for both.

no line is created

A line connects two points to form a line, but if the points are at the same location, no line is created.

In such cases, “Invalid Line” will be displayed.

remove the invalid line

In this state, connecting the line to the Clean Tree will remove the invalid line.

nullとInvalidがどちらも存在する場合

Let’s consider the case where both null and Invalid exist.

In this case too, you can use Clean Tree to remove null and Invalid values in bulk.

However, in some cases, it may be necessary to leave null or invalid data.

To retain null data

To retain null data, enter False into the Clean Tree(N).

This time, we are inputting False information using a Boolean Toggle.

Then, the invalid data was deleted, but the null data remained.

To retain invalid data

To retain invalid data, enter False into the Clean Tree(X).

Then, the null data was deleted, but the invalid data remained.

List of Grasshopper articles using Clean Tree component↓

Comment

Translate »