Error adding dimension to columns

Hi everyone,

I had this script to add dimension using a filter by category and then selecting the elements in the model. It worked for grids and for walls, the only problem is when I select the category “Structural Columns” and then select the columns, the dimensions are not created.
I attached an image of the graph and the error I get.

Thanks :))