How to calculate the number of specific faces according to their size or area in a complex model?

Hi everyone,

I am in a facade company. My job is checking the number of different panel types in sketchup with excel or auto cad drawing. In sketchup basically we have different size of rectangles representing the panels. However, for a large project it is difficult to calculate the total number of each size, and sometimes you cannot avoid a mistake. So I am asking is there any solution in Ruby (or possible plugin) that I can filter some faces or check the number of them according to the given conditions ( it could be length, width, area.etc).

Or is there any solutions to this question, hope you could leave some ideas.

Thank you very much for the help.

If you want to automate a process, you need to be very, very specific because there won’t be a human with knowledge that can interprete what is meant to be done.

For example, a SketchUp model usually contains a lot of rectangles that are not panels, so you need an unambiguous criterium to distinguish panels from other rectangles so that the (stupid) program does not count any rectangle as panel. Ideally your panel is a component definition with a specific name and that contains exactly one rectangle.

Another challenge is that a model can be organised as a nested hierarchy of groups/components (building, building part, room, panel) which can all be scaled, so for the final size of a panel all scalings need to be considered. Ideally, we can assume your model does not scale components to any size other than the natural size of their component definition (100%), that would simplify the task, otherwise it is more complicated to compare the size of panels.

Similarly, due to the model hierarchy, the actual number of component instances can be multiplied if a parent component has multiple instances.

If that is all clarified, the solution is basically to find all occurences of panels (component instances whose defition has the given name), get their size, group by same size and then count the number of panels in each group. This can be done with Ruby.

1 Like

@otakutarou, have you tried the File (menu) > Generate Report… function yet ?

1 Like

Thanks, that’s really helpful. I suppose the priority is that making sure the model has a very organised hierarchy and clear components structure. This is the foundation of everything, so we should have a well-organised model from the beginning of the work.

Well I think this only reflects the components feature rather than face information (saying if they are not in any group or components). Anyway, I will try it later. Thanks for the help.

You can calculate the number of component instances with Selection Toys. This will only be useful if you have a small amount of component definitions. If you have hundreds of wall panels that you want check the amount of in your model, then this will be a lot of work. If you have less than ten sizes of panel components, then this will allow you to count them accurately with ease. Just select the component, right click > instances > select all, then check the number of instances with Entity Info. The great thing about selection toys is it can even select nested instances and out of group instances, so you don’t have to prepare your model (other than making sure the panels are components).

Selection Toys is in the Extension Warehouse:

I believe for this very straight-forward approach, it is a prerequisite that the selected instances are not within a nested hierarchy (in which the parent component definition itself occurs multiple times).

But you can not select instances based on the size of used area, which is what the OP wanted, I guess?

Though Ruby might give a solution for models already created, the best option for future use is to give useful names to the panels, possibly restrict their scaling via Dynamic Components and then use different types depending on size. If given logically names, it would be easy to use Window->Model Info->Statistics and paste info in a spreadsheet or use Generate Report. You can use a selection in Generate Report as well and if you use components, the ‘select instances’ also pops up in the components panel…

Whoops… You’re right. There are certain conditions where you can select all and others where it doesn’t work.

My method doesn’t search for geometry based on the size, but you can tell how many instances are in the model with entity info.


Now, you can tell how many 2’ x 2’ panels, 6’ x 2’ panels, & 6’ x 6’ panels are in the model. You can calculate the total number of each size with Entitity info alone. No need for Selection Toys.
05%20PM 19%20PM
Note where it says 128 in model & 32 in model. Entity Info counts the number of each size for you, but you have to make them a component and write the dimensions in the name. So you know the measurements.

In ruby, I assume an experienced coder could write something to count components with a certain volume, but I have a hunch that’s unnecessary for counting panels of a certain size. Entity Info works just fine for counting panels.

I plus to this.
The idea is very simple.

All i need is to count the number of rectangles in a model.
I cant find such plugin. Maybe someone can post a Ruby script for this?

It should at first count the number of rectangles and group rectangles of the same size to one component.

Im building houses, I need Sketchup to count all boards in my house. I dont want to choose each board and make a component (all boards are different sizes) of it, there are thousand of boards in a project.

I want sketchup to find all rectangles, assign them one or another component and after this I will only generate a report and see total number of boards (rectangles, components) of each type
@Forestr @MikeWayzovski @otakutarou @DanRathbun @Aerilius @slbaumgartner @quantj

Is your house model just a thin skin of rectangles surrounding the house shape? Otherwise I don’t understand your question, as fully-modeled “boards” in 3D have thickness - they are rectangular parallelepipeds with six rectangular faces each.

Does your model have any existing organizing structure of groups or components? That’s relevant because groups and component instances can be scaled, and the scale must be taken into account when determining the actual size of each rectangle.

Could you clarify your actual goal, please? Do you really need to have your model reconstructed as a bunch of component instances based on rectangle size (the task you are reluctant to do manually) so that the standard reporting tool can count them for you? Or do you really just need a tally of the number of each size rectangle found? A Ruby script to do the latter directly would be less complex than one that automates the replacement with components.

If all your boards are different sizes, then you could probably generate a report of their dimensions. According to the SketchUp blog, you can use file -> generate report to make a list of the x y z lengths of groups and components in SketchUp Pro. Just make sure the groups don’t have stray geometry, so you get accurate dimensions.

Also, I’d recommend copying your thousand boards to a new file before generating the report, so the report only contains information about the boards.

Here’s the tutorial on the SketchUp Blog.

Like @slbaumgartner said, what is your final goal?
If for estimates, try Estimator
(Affiliate link)
You get the total of boards needed for the project, assign different cost to it like sawcosts, transport, labor, waist etc. Instantly while designing.

Rectangular parallepipeds, you a right.
To generate walls I use House builder sketchup extension, which helps me alot and I dont need to model each and every board in my house frame.
But house builder makes groups, but not components.
I order to generate report, I need components.
My goal is to count all boards at the model with their exact dimensions.

@MikeWayzovski @Forestr


If you want to achieve your goal, then you have to model every board.

I have never had to know each board with their exact dimensions, an estimated number should be enough to built.
While building, one might loose a board or place some that was intentionally for another spot , etc.
If you want to build like that, you would need to calculate a substantial percentage overhead for organization.

If you want to achieve your goal, then you have to model every board.

Mike, Maybe there is a way to rename all groups to components, using Ruby?
Can someone help with that? Steve? @slbaumgartner

Renaming doesn’t do the trick, you can call a group ‘Component’, but that doesn’t make it one. But why do you want components, persé ?
You can generate reports for groups, just the same?

check out the Medeek extension, as well:

Wow @MikeWayzovski Mike, thanks alot for this help, thought reports were just for components…cool video bro)) thanks for that. Will also check the new extension, looks great from a first look

1 Like