AutoText value for label in Layout

I want to display the value of a face area in Layout using Ruby.
I add a label to my face using AutoText for Fae area and the value is displayed correctly in Layout
But now I want to print this area in the Ruby Concole.
Here is the code

doc ="D:/Documents/Salle de bains 09-10.layout")
pages = doc.pages
for page in pages
  puts "PAGENAME : " +
  for entity in page.entities
    if(entity.is_a? Layout::Label)
      puts entity
      puts "* LABEL ENTITY"
      lines = entity.text.display_text.split(/\n+|\r+/).reject(&:empty?)
      puts "  - DISPLAY TEXT : "
      for line in lines
          puts "    . " + line

Unfortunately "<FaceArea>" is printed instead of the value of the area in the Ruby console any suggestion to print the value of the area ?

I guess you missed to add page parameter to #display_text:

Passing an invalid Page will prevent an auto-text tag from being substituted with its display representation.

should be:

lines = entity.text.display_text(page).split(/\n+|\r+/).reject(&:empty?)
1 Like

Thank for your reply but does not change anything.
I think I must retrieve the entity on which the label is connected for getting the FaceArea value, but don’t know how to do that.

Strange. :confused:
If the Auto-text is one of these:

My suggestion is working. I have no idea what is the problem with <FaceArea> ??
Can be a bug, or lack of my knowledge… :blush:

auto_text_definitions work very well for a document but for an entity it gives the autotext and not its value
Define Label

View Label

Result in Ruby Console