Sketchup Blog - News and Notes from the Sketchup folks

Adding custom attributes to your reports

In a blog post I wrote awhile back, I talked about using SketchUp Pro to generate tabular reports -- lists, basically -- from the groups and components in your models. I created a simple picket fence, then generated a report that helped me figure out how much lumber I'd need to build it.

In the picket fence example, I used attributes (Length, Width, etc) that pre-exist for every group and component SketchUp creates. I didn't need to add any of my own attributes to do the calculations I wanted; the information I needed was included in the generated report automatically.

With SketchUp Pro, it's easy to add your own custom attributes to groups and components. Taking the fence example, I'd like to make it easier to do two things when I design a fence and generate a report:

  • estimate construction costs
  • estimate how much paint I'll need to paint the fence
Adding a custom Cost attribute

I'll use the Post component to illustrate what I'm doing. Each post is 5.5 feet long. 4x4 lumber (from which the posts will be cut) is available in 8, 10, 12 and 16 foot lengths; of these, buying 12 foot lengths will result in the least waste and therefore the lowest cost. Since a 12 foot 4x4 costs $16.97 and yields 2 posts, the cost of a single post is $8.48.

To add a custom Cost attribute to my Post component, I do the following:

  1. Select an instance of the Post component in the model.
  2. Right-click on the component and choose Dynamic Components > Component Attributes from the context menu.
  3. Click Add attribute in the Component Attributes dialog box and type Cost, then hit Enter.
  4. In the blank field (box) next to the word "Cost", type =8.48 and hit Enter.
Use the Component Attributes dialog box in SketchUp Pro to add a custom attribute to a component.

Now my Post component includes a custom attribute called Cost whose value is 8.48. This value is fixed; it isn’t based on a formula that includes other values. Adding a formula here is entirely possible, though. If Cost could be calculated based on another attribute (like LenZ, perhaps), it would make sense to enter a formula that does just that. If lumber were $1.43 per linear foot, the formula might look like this: =LenZ*1.43

Adding a custom Area attribute to estimate paint quantity

In order to be able to estimate how much paint I'll need to cover my fence, I need to calculate its surface area. Luckily, the Component Attributes dialog box includes a handy function that makes this relatively easy: FACEAREA returns (calculates) the total surface area (in square inches) of a given material in any component. If you don't specify a material, FACEAREA returns the total surface area of every face in your component -- both sides of every face, actually. To get the surface area of just the outside (where you're most likely to paint), all you have to do is divide by 2. To convert square inches to square feet, divide by 144.

To add a custom Area attribute, here's what I do:

1. Select an instance of the Post component in the model.
2. Right-click on the component and choose Dynamic Components > Component Attributes from the context menu.
3. Click Add attribute in the Component Attributes dialog box and type Area, then hit Enter.
4. In the blank field (box) next to the word "Area", type =(FACEAREA()/2)/144 and hit Enter.

Calculate surface area by using the FACEAREA function. Divide by 2 to get just the outside area; divide by 144 to convert from square inches to square feet.

Of course, the area shown by my new Area attribute is bigger than the area I actually plan to paint; it includes the part of the post that's buried underground. If I'd wanted to be more precise, I could have included something in my formula that accounted for this. I'd rather buy more paint than I need, so I'll leave it as-is.

Using custom attributes in reports

Any custom attributes you add to a group or component automatically appear in your reports. After adding the Cost and Area attributes to my Post component, generating a report (File > Generate Report...), and deleting the attribute columns I don’t need, here’s what I end up with:

Custom attributes you add to your components automatically appear in your generated reports.

It bears mentioning that adding custom attributes to your components before you start modeling with them makes things easier. If you add a formula-based custom attribute to a single instance of a component, you might need to redraw (Right-click > Dynamic Components > Redraw) each additional instance separately to get it to update.

Posted by Aidan Chopra, SketchUp Evangelist

Permalink | Links to this post |
The comments you read here belong only to the person who posted them. We do, however, reserve the right to remove off-topic comments.


Anonymous said...

The above comments (Chinese characters) lead to kiddy-porn. You might want to check that.

Brian Chabot said...

STILL no SketchUp for Linux? No I don't want to make it work with Wine. I want it to install directly. You did it with Earth. Until you do it with SketchUp, I am not interested.

Mark said...

Thanks for the info. I'm hoping to get this incorporated into our system to figure out how much of our product is needed.

stainless steel said...

sketchup has help us loads in price and design many thanks
Walkin Wardrobe

August said...
This comment has been removed by a blog administrator.
August said...

Hey Brian, I sympathize about a Linux version. Unfortunately, to justify a port, they need paying customers. Most of those right now seem to be architects. If you can find numbers of how many architecture firms, or even architecture schools, use Linux or Solaris, you may be able to make a case. Good luck. I hope you succeed. Me, I'm more tool-centered than OS-centered. I'll use whatever OS lets me use the tools I want.

Andrew Dwight said...

I run a building company in Sydney Australia. I only use Sketchup to do my material and component take offs. I do use generate reports on components but I find in larger more complex models the information output can be overwhelming . I have been working on a ruby script that will do this and I have it working, there are a lot of bugs but for anyone that is interested in doing quality take offs from sketchup it will be a big time saver. I hope when it is perfected it will be included in SU8. i should have a youtube video for you all soon.

viewsion ltd said...

Zees ees beeutifool... I love eet.. Allez l'Aidan!

Rory Walsh said...

Interesting stuff Andrew.

Do you think you cold use this approach to work out Whole Building Heat Losses?

Heat Losses = (Area of Element) * (U-value of Element) * (Difference in Temperature Between inside and outside).

Could be a handy time saver for engineers....