FACEAREA function has me pulling my hair out! All I get is errors!

Hello,
I am new to the forum, but fairly experienced in SU.
I am a cabinetmaker and have been working on developing a set of dynamic components that represent the different types of cabinets I make, exactly how I make them. My goal is to be able to quickly put together a kitchen with its different components, then pull reports for material estimation, cut lists, pricing, etc.
I want to use the FACEAREA(“MaterialName”) function to pull the square footage of painted surfaces on the cabinet, so I can more accurately estimate the amount of paint to order. I can’t seem to get it to work for me…

Here is a simple component I made to illustrate my problem:
CUBES.skp (19.8 KB)

It is a component with two groups, each being a 10" cube. One cube is the default material. The other is painted with the standard material “Metal Corrugated Shiny.”
I created an attribute for both called “PAINT” with the formula:
=FACEAREA("Metal Corrugated Shiny”)
And all I get is an error. I have tried to get this function to work a hundred different ways, on other components, in SU 2016, different methods of painting the faces, etc…
Any advice would be greatly appreciated!
Thanks in advance!
-Michael

Here is an example of one of the cabinets I am developing, for those who may be curious. It doesn’t have the FACEAREA function incorporated yet, as I have not been able to get it to work…
BASE CABINET 1d1dr.skp (148.7 KB)

I don’t do much with Dynamic Components, so this could be off the mark…but I notice that you have painted the component as a whole with your texture, not the individual faces inside it. Could that be the problem?

Thanks for the response!
I have tried painting the object as a whole, opening it up and painting an individual face, opening it up and selecting the whole object and painting the selection. Any way I apply the material, it doesn’t want to work…
When I change the function to
=FACEAREA()
it works correctly, and gives me the total area of all the faces, inside and out.

Area=FACEAREA(Material)

Reports front AND back face areas, so you must ensure that the backs do not have the material applied.
Otherwise you need to use Area / 2 on it to half it and get the true area !

See this similar issue The Material Function in Dynamic Components • sketchUcation • 1 from last year.

The problem is the double quote character you are using.

If you don’t know anything about programing this may not mean much to you. But notice the difference between the starting and ending quote. This just shows the difference of the ASCII value.

This was a huge difficulty for me to figure out the first time I used a Mac. The more I edited things the more things broke…

I checked out your cabinet and set up cabmaker plugin to create it exactly how you build cabinets. I would have to make 1 change as you use a stretcher between door and drawer.

base 24 1dr1d.skp (1.1 MB)

Dynamic components is about my only experience programming…
How do I type the different character?
I would have never figured that out…
Thanks for the help!

I’m not familiar with Mac I only have one for testing. It seems there should be a system setting for using curly brackets. A simple online search should get you some details.

I believe that on Mac this is called smart quotes and there is a system preference setting for it. On my phone now so I can’t look for the setting.

Thanks Neil!
Smart quotes eliminated.
Now the function doesn’t result in an error, but unfortunately it only reports “0.”
I tried making a cube, triple clicked it, and painted the selection with a material.
Then I turned the cube into a component, and gave it an attribute with the FACEAREA(“MaterialType”) function.
All I get is “0”
I think I must be painting it at the wrong time or in the wrong way, but I have tried every variation/method I could think of.

Maybe this will help explain:
This is the example model from the SU Help Centers Dynamic Components SketchUp Function Examples:
(FACEAREA Function | 3D Warehouse)
I open the attributes for the center cube, make a new custom attribute with the formula: =FACEAREA(“brick”), and it correctly returns “4.”
Then i double click on the component, select a face with the default material, and paint the “brick” material on it. The formula still spits out “4” when “8” should be the correct answer now. The entity info for each of the painted face is exactly the same, yet the one that I painted is not calculated…
What am I doing wrong?

I created a 2" X 2" cube (in your model) and added the formula into on click event for “material1”
I then painted 2 faces with material1 (from the list for model materials)

It returns 8.

There is a gotcha. I scaled the cube by a factor of 2 and it still returns 8. In this case you need to include the transformation information for the component.

I’m just throwing this out as a possible issue. If I load materials a second time such as “maple” then it shows up in the model as “maple_1” so when I try to reference it as “maple” then it does return a big fat 0 because the applied material was actually “maple_1”

Just something to watch out for.

I can get it to give me the right results now, but it still isn’t quite right…
I can make a 2" cube, set up an attribute named PAINT, with the function =FACEAREA(“Metal_Corrugated_Shiny”).
I then go into the object and paint a faces with the named material.
The result from the PAINT attribute doesn’t change until I click on the formula and hit enter.
I tried hitting the refresh icon at the top of the attributes window. I tried closing the window and opening it back up, but neither would update the results.
All of the other attributes show updated values as soon as a change is made.
For some reason, this function will not…

I set up a new attribute called paint and stuck the formula in there and duplicated your problem.

Then I put the formula REDRAW() into the onclick attribute. The formula in the paint attribute now updates properly but only after a click event.

I have figured out how to achieve my original goal (calculate the square footage of painted area on a cabinet part) on one component:
LADDER BASE.skp (47.2 KB)
For my application, the painted surfaces are a set variable once the component is completed. Meaning, I don’t need to be able to change which surfaces are painted. I use simple math to compensate for the FACEAREA results not changing when you scale.
Once I got LADDER BASE working, I started to apply the same painting and calculating technique to my BASE CABINET component. There I ran into another weird issue:
BASE CABINET 1d1dr.skp (147.2 KB)
Look at the difference in the PAINTSQFT attribute of LEFT STILE and RIGHT STILE.
For some reason LEFT STILE’s PAINTSQFT is 1000x as much as RIGHT STILE.

Your left stile at the component level is painted.
Your right stile at the component level is not.

I deleted the left stile and created a new one and added in the formulas and it shows the correct area.

Hi,
pretty new to SU and am just beginning to look into dynamic components.
I have tried to look all over the web first to check up on sources of information or examples and having tried the relevant ones, I am at a total loss as per the heading of the original post here.
I wish to be able to extract, areas for painting, sheet linings, cladding, roofing and whatever else I feel it worth trying to get take off information, for mid project assessment.

The documentation is clear but the language while not unfamiliar is not something I usually deal with so all of it and syntax is beyond my grasp right now.
I grabbed a couple of screen dumps from my setup to illustrate the precise order but cannot yet see how to add attachments here so sorry about that.
I have tried : =FACEAREA(“MaterialName”) =FACEAREA(“Material Name”) FACEAREA(“MaterialName”) =(FACEAREA()/2(“MaterialName”) and a range of other options to try and make sure i have the order correct and no spaces where there should not be any and tried some with spaces.
A couple of times I have been able to get an output, and I am aware generally about painted faces vs unpainted faces, and SU taking both sides, of all faces in the component and the numbers I have been getting out are wrong relative to the various components I have tried, such as making an 8’ x 4’ sheet x 3/4" thick, or a single polygon/face.
Tried painting one side or both.
tried adding the OnClick function with a REDRAW() in case that changed anything but no luck there.
Have tried adding a custom Material parameter in case SU requires this to be in the Attributes applet for reference (no documentation describing much of this stuff ), however that produced no change.

Have also tried using the FACES() function with equal lack of anything more than a 0 or 0cm.
Have tried all combinations of Details options for the attribute with similar frustration.
Similarly, when Generate Report is used it is reading with the Attribute dialogue to saying…nothin going on.

My copy is a clean install, of a new license in 2017 and copy this year and I have only had a couple of crashes since installing the software. It is pretty stable.

I appreciate that there is huge wisdom and knowledge in the community and for the range of functions and language uses, there seems a lack of useful tutorials and tips for these functions relative to beginners or those with less language savvy experience. I am extremely frustrated now as I have spent days trying to locate relative information and get no joy so here is hoping someone out there has gone through this and has some solid step by step type information or can direct me to where to access that in depth but pitched at beginner level articles, tutorials or experienced wisdom .
thanks