How to Add Area function in Sketchup Dynamic Components

I am a beginner in Sketchup…!!!

I tried to understand ruby language to edit Dynamic components…
However, it is so difficult for me…
So, i need your help.

I want to add area on face number in Component Attribues.
If a shape is exactly rectangular i can calculate with funtion =lenx * leny
but, when a shape is not rectangular, i think it is easy to use the data of area that we can get by the menu on the right mouse…

guys, do you understand my problem??.. uffff


The language for DCs is not ruby, I don’t think its given a name other than some that can’t be repeated on this forum. However to get an area in the DC you use the facearea() formula, this will return the area of a single worded material like blue but not light blue, it does not compute the space between. If you use facearea(“”) it will return all, both front and back faces. The return value is in square inches, so if you are using metric, you must multiply this by 2.54*2.54 to get square centimeters and divide by 10000 to get square meters. The component needs to have a scaler DC embedded in it to update the material texture and the formula. otherwise it will not work.
Attached is an example, wall 1 has no scaler where as wall 2 does. Credit for the scaler is to Tig
area and volume.skp (775.0 KB)
The facearea measures the backface of the rear face of the wall which is painted “0009_Linen”
If you change the internal raw geometry, then you need to do a redraw after exit to recalculate the DC. So if you enter the second wall and cut an opening from the front for a window, then after closing and doing a redraw the area should be correct, despite the reveals being painted with the brick texture. However if you cut from the back, because the pushpull will create a reveal with the same properties as the rear, the facearea will include the reveals as well as the “0009_Linen” is on the back face; so work out your requirements with care.

check out the help files

1 Like

thanks a lot!!!
I got the solution.

Can I ask one more?? How to count number of components??
I can get the numbers by generated report menu.
But i need to put number of components in the DC (components Attributes)

You would need a ruby script to do that, may be private message me a working example and explain what items you are counting and which DC needs the count

Could you give you e mail address?