[Ruby] RfE: Sketchup::Page animation query / setter methods needed

Oh wow…

… I just realized there always was a workaround for the boolean query method. (Depending upon …)

Example:

def page_used_in_animation?( page )
#
# Returns false if page's label is the page's name
#  surrounded by parenthesis, otherwise true.
#  ( Works even if user manually named the scene
#    page using parenthesis around the name. )
  #
  if page.is_a?( Sketchup::Page )
    if page.label.length - page.name.length == 2 &&
    page.label[0,1] == '(' && page.label[-1,1] == ')'
      return false
    else
      return true
    end
  else
    fail(
      TypeError,
      "Sketchup::Page instance expected as argument.",
      caller
    )
  end
  #
end

EDIT: Fixed code example. (Had boolean result reversed.)

… but this depends upon scene page labels being surrounded by parenthesis when excluded from animation, in all language builds.

?

1 Like