Forgot password?

Create an account!

Forum

« back

General – how to get "Face area"

Messages

Please log in to write a message.

  • 7. fredx (Jun 09, 2011 14.45):

    Thank you ledisnomad !

    very helpful, just what i was looking for !

  • 6. ledisnomad (Jun 09, 2011 14.29):

    NOTE: You can convert units by editing this line:

    Call Rhino.Print("Area = " & arrArea(0))

    For example, if your model is in millimeters and you want meters:

    Call Rhino.Print("Area = " & arrArea(0)/1000000)

    Or inches to feet:

    Call Rhino.Print("Area = " & arrArea(0)/144)

    You get the idea.

  • 5. ledisnomad (Jun 09, 2011 14.26):

    Hey, fredx. Quick fix for what you want... in this new script you to pick the polysurface then the individual and it tells you the area of just that surface in the command line box.

    Option Explicit
    'Script written by Damon Sidel
    'Script copyrighted by Damon Sidel
    'Script version Wednesday, June 08, 2011 8:26 AM

    Call SurfaceAreaFromPolySrf()
    Sub SurfaceAreaFromPolySrf()
            Dim strObj : strObj = Rhino.GetObject("Select the polysurface to evaluate",16,True)
            If IsNull(strObj) Then Exit Sub
            Dim arrSrfs : arrSrfs = Rhino.ExplodePolysurfaces(strObj)       
            Dim strSrf : strSrf = Rhino.GetObject("Select the surface",8,False)
            If IsNull(strSrf) Then Exit Sub 
            Dim arrArea : arrArea = Rhino.SurfaceArea(strSrf)       
            Call Rhino.Print("Area = " & arrArea(0))       
            Call Rhino.DeleteObjects(arrSrfs)
    End Sub
  • 4. fredx (Jun 09, 2011 09.58):

    Hi guys,

    Thanks for your suggestions, it starts to get to an aproximation for what i was loooking .... however i was looking for something even more simple, just the area of one of those surface that i select

    i was thinking maybe join some rhino commands in one script:

    1-dupfaceborder (gives a polyline from a face)
    2-area (gives the area of that polyline)
    3-delete polyline

    this combination will show the area of the surface (from a polysurface) that i select without having extra object in the end.

    i don't know so much about rhinoscripting that why i'm wasking around if you can help me. Thank you all for the time that you are spend on it.

  • 3. ledisnomad (Jun 08, 2011 21.26):

    Hi, fredx.

    Here is a quick script that adds text to the center of each surface from a polysurface. It takes Johannes' suggestion, explodes it, finds the area of each surface, but keeps the original and deletes the new faces as it goes. Hope it works for your needs.

    Option Explicit
    'Script written by Damon Sidel
    'Script copyrighted by Damon Sidel
    'Script version Wednesday, June 08, 2011 1:13:48 PM

    Call PolysurfaceArea()
    Sub PolysurfaceArea()
            Dim strObj : strObj = Rhino.GetObject("Select the polysurface to evaluate",16,True)
            If IsNull(strObj) Then Exit Sub
            Dim textHeight : textHeight = Rhino.GetReal("Height of text",1000)
            Dim arrSrfs : arrSrfs = Rhino.ExplodePolysurfaces(strObj)
            Dim i, arrArea, ctrPt
            For i=0 To UBound(arrSrfs)
                    arrArea = Rhino.SurfaceArea(arrSrfs(i))
                    ctrPt = Rhino.SurfaceAreaCentroid(arrSrfs(i))
                    Call Rhino.AddText(CStr(arrArea(0)),ctrPt(0),textHeight)
                    Call Rhino.DeleteObject(arrSrfs(0))
            Next
    End Sub
  • 2. Johannes (Jun 08, 2011 13.09):

    hi,

    you need to get the id of a single surface... try to explode the polysrf to get all id`s...

    johannes

  • 1. fredx (Jun 08, 2011 12.55):

    Hello

    i want to make something simple, to get the area of a face from a polysurface ....

    the comand area just give the area of the total surfaces that compose the polysurface...

    any ideas how to get it?

Recommend

Why are these buttons gray?