Sign in to follow this  
wjmdes

Polyline Labels

Recommended Posts

The polyline labels are great, however any idea to get rid of the many decimal points?

Share this post


Link to post
Share on other sites

Thank you, now I need to Figure out how to make it in acres...

Share this post


Link to post
Share on other sites

referenced ? obj=referenced : obj=owner

obj.area/43560.round(3)

Share this post


Link to post
Share on other sites

hmmm, getting 15 decimal places....

Share this post


Link to post
Share on other sites

Sorry, try this:

 

referenced ? obj=referenced : obj=owner

(obj.area/43560).round(3)

Share this post


Link to post
Share on other sites

I think Joe means:

 

(obj.area/43560).round(3)

Thanks Gerry,

You beat me to it by about 5 seconds.  ;)

Share this post


Link to post
Share on other sites

That worked, thank you....  Is it possible to center text in a label?

Share this post


Link to post
Share on other sites

Labels are not "Rich Text" so generally the answer is no.  However, there is a .center(n) method for text strings in Ruby.  For that macro we would have to first change the value from numeric to string using .to_s and add the " acres" and then center it.

 

Here's the revised macro:

 

referenced ? obj=referenced : obj=owner

((obj.area/43560).round(3).to_s + " acres").center(20)

Share this post


Link to post
Share on other sites

My question is...how can I learn to use Ruby myself?  Joe...is there a book you would recommend?  Does Chief offer any good info related to Ruby that I just don't know about?

Share this post


Link to post
Share on other sites

Steve,

 

Google Ruby for a variety of information.

 

I personally just use http://ruby-doc.org/core-2.2.2

 

There is the "Little Book of Ruby" which is pretty basic.  Start with this and Chief's Ruby "Tutorial".  Then migrate to the above link which has the complete documentation.

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
Sign in to follow this  

  • Member Statistics

    28889
    Total Members
    9156
    Most Online
    lwcdnet
    Newest Member
    lwcdnet
    Joined
  • Similar Content

    • By JiAngelo
      Love the idea....but what's the use of an "Object Specific Area (%area%) that doesn't round?
       
      My old method, a text macro %ObjectArea% [=area.round] was context "Reference Object" and didn't work on labels.  Re-contexting it to "Owner Object" broke the macro on my other referenced objects, but it then started working for use in polyline labels.  In the short term I've created two duplicate macros labeled %ObjectArea-Owner% and %ObjectArea-Referenced% - cumbersome but it works.  I'd rather not have to duplicate all my macros - but I love not having to chase and ensure the arrows and referenced objects remain touching when I'm moving things around.  
      Next, unless I'm missing something, Labels are all the same size, they all map to the same layer "Polylines, Labels", so their text properties are identical and, thus far, I cannot find how to differentiate them - so again, I'm forced to find a work around, versus just plain working..
       
      Last, when are you "chief" guys going to hire Joe Carrick? - He seems to be the only guy out there explaining what the manual you've refuse thus far to provide for Ruby and Macros....And I'm tired of piecing it together by scouring this forum.  (For instance, I just found Joe has posted a method which tests and thereby combines both my separate macro's above - I just don't have time to learn it just yet cause I have to get some actual work done tonight.) 
       
      Very frustrating.