Get Area of trimmed Face


(Willem Derks) #1

Hi,

In Python I’m trying to get the Area of the trimmes face of a Brep.
However for now all I cab find is, which gives the area of the untrimmed face.

            Area = Rhino.Geometry.AreaMassProperties
            dblArea = Area.Compute(srf).Area

As Mitch pointed out; the code can be condensed to this:

dblArea = Rhino.Geometry.AreaMassProperties.Compute(srf).Area

How would I get the area of the trimmed surface only?

EDIT: I think I might have solved this myself.
From the Brep I was getting the surface list : Brep.Faces

These are apparently the untimmed versions of the NURBS surfaces.
When passing the Brep.Faces list I did get the Area’s of the trimmed faces.

Thanks
-Willem


#2

Hi Willem,

I don’t know if it’s the best way, but I do this:

import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino

ID=rs.GetObject("Select Brep",8+16,True)
brep=sc.doc.Objects.Find(ID).Geometry
for i in range(brep.Faces.Count):
    area=Rhino.Geometry.AreaMassProperties.Compute(brep.Faces[i]).Area
    print area

Cheers, --Mitch


(Willem Derks) #3

Hi Mitch,

Thanks, my coding is still a little convoluted due to many iterations and various attempts to get something to work. Good you just pointed out this can be condensed. As you might know I’m still working on getting Python and Rhino Common basics in my head.

-Willem