Struggling with python scripting. How do you check if a face is selected?

Well, i think i WANT to take it into consideration.
I mean, if an object is scaled (say 1,1,3), i want my script to reflect and show the areas as they are in the viewport. That is to say, the areas as they’d be if scale was applied.

My problem is how to take scale into account ??? From a mathematical point of view, i simply don’t know what to do with the scale factor so that areas are calculated properly…

look at the n panel and try to understand the relationship between dimensions and scale

usually like on a plane it 's dim = 2 with scale = 1

so you need to remember this dim=2 then by changing scale you can find the real size of area

but why do you say what it would be if scale was applied ?
quote
the areas as they’d be if scale was applied.

happy 2.5

why not using a temp mesh copy and apply transformations there…


import bpy
sce = bpy.context.scene
obj = bpy.context.object

mes = obj.data.copy()
mes.transform(obj.matrix_world)
area = [f.area for f in mes.faces if f.select]
bpy.data.meshes.remove(mes)

print (sum(area))

Good idea Liero, I thought of that but i didn’t nkow that “transform” method.
Well done !

So here is the script, meant to be used as an addon:
http://glp.lescigales.org/it/blender/scripts/faces_area.py

I mentionned liero and zmj as author too.

Thanks to all: that’ll be extremely usefull very soon !