ComputerMaster86

Ruby - Area of Ployline

Recommended Posts

Would some be willing to tell me what the ruby code is for working with area of a polyline?

 

internal_area <-- I don't believe this is it.

 

Thank you all in advanced.

Share this post


Link to post
Share on other sites

%area% 

 

or just area in Ruby

Share this post


Link to post
Share on other sites

I can't seam to get area.round(2) to work.  I wonder if I need to name the macro a special name?

Share this post


Link to post
Share on other sites

Create a new macro named "Area.rounded"

  • Check "Evaluated"
  • Select Context "Owner"

enter the following in the macro

  • result = area.round(2).to_s

insert that macro in the Polyline Label.

Share this post


Link to post
Share on other sites

The result of the last operation is the value of the macro.

 

Joe: Is the string conversion really needed, or just the proper way to do it -- like explicitly assigning a value to result.

Snap2.jpg

Share this post


Link to post
Share on other sites

Thank you all so much.  I feel like my next steel re-roof job is going to be ten times easier once I set up all of my macros.

Share this post


Link to post
Share on other sites
1 hour ago, solver said:

Joe: Is the string conversion really needed, or just the proper way to do it -- like explicitly assigning a value to result.

Eric,

 

I do that so the it's easy to add (concatenate) the result.

example:

  • result = area.round(2).to_s + " sq.ft."
  • result = "Area = " + result

or, if you want to perform some other calculations:

  • x = area.round(2)
  • result = "Area = " + x.to_s + " sq.ft."

There are other ways of coding to get the same result.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

  • Member Statistics

    27465
    Total Members
    6254
    Most Online
    SuzLeigh
    Newest Member
    SuzLeigh
    Joined