Class: Layout::Group

Inherits:
Entity show all

Overview

A group is a special type of Entity that does not belong to a Layer and contains other Entitys as children. A Group's children may include other Groups, allowing for a hierarchical tree structure of Entitys. A Group must contain at least one child and will be automatically collapsed if an operation is performed that results in the Group being empty.

Version:

  • LayOut 2018

Constant Summary #

Layout::Group::RESIZE_BEHAVIOR_NONE
Layout::Group::RESIZE_BEHAVIOR_BOUNDS
Layout::Group::RESIZE_BEHAVIOR_BOUNDS_AND_FONTS

Instance Method Summary # collapse

Methods inherited from Entity

#==, #bounds, #document, #drawing_bounds, #group, #layer_instance, #locked=, #locked?, #move_to_group, #move_to_layer, #on_shared_layer?, #page, #style, #style=, #transform!, #transformation, #untransformed_bounds, #untransformed_bounds=

Constructor Details

#initialize(entities) ⇒ Layout::Group

The #initialize method creates a new Layout::Group.

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
entities = doc.shared_entities
entities.each { |entity|
  entity_array.push(entity)
}
group = Layout::Group.new(entity_array)

Parameters:

Raises:

  • (ArgumentError)

    if entities is empty.

  • (ArgumentError)

    if entities contains Entitys that belong to different Documents

  • (ArgumentError)

    if entities contains a mix of Entitys that belong to a Document and Entitys that don't belong to a Document

  • (ArgumentError)

    if entities contains Entitys on both shared and non-shared Layers, or on non-shared Layers belonging to different Pages

  • (ArgumentError)

    if entities contains the same Entity more than once

Version:

  • LayOut 2018

Instance Method Details

#entitiesLayout::Entities

The #entities method returns the Entities that belong to the Layout::Group.

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
group = doc.shared_entities.first
entities = group.entities

Returns:

Version:

  • LayOut 2018

#remove_scale_factor(resize_behavior) ⇒ Object

The #remove_scale_factor method removes the scale factor from the Layout::Group.

The resize behavior can be one of the following values:

Layout::Group::RESIZE_BEHAVIOR_NONE
Layout::Group::RESIZE_BEHAVIOR_BOUNDS
Layout::Group::RESIZE_BEHAVIOR_BOUNDS_AND_FONTS

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
group = doc.shared_entities.first
group.remove_scale_factor(true)

Parameters:

  • resize_behavior (Integer)

Raises:

Version:

  • LayOut 2018

#scale_factorFloat?

The #scale_factor method returns the the scale factor associated with the Layout::Group.

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
group = doc.shared_entities.first
scale = group.scale_factor

Returns:

  • (Float, nil)

Version:

  • LayOut 2018

#scale_precisionFloat

The #scale_precision method returns the precision used for the scale of the Layout::Group.

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
group = doc.shared_entities.first
precision = group.scale_precision

Returns:

  • (Float)

    the number specifying the precision for the Layout::Group

Version:

  • LayOut 2018

#scale_precision=(precision) ⇒ Object

Note:

LayOut only allows for a finite set of precision values for each units setting, so it will set the precision to the closest valid setting for the specified units. See the “Units” section of LayOut's “Document Setup” dialog for a reference of the available precisions for each units setting.

The #scale_precision= method sets the precision for the scale of the Layout::Group.

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
group = doc.shared_entities.first
group.scale_precision = 0.0001

Parameters:

  • precision (Float)

    The double specifying the precision for the Layout::Group

Version:

  • LayOut 2018

#scale_unitsInteger

The #scale_units method returns the units format used in the scale for the Layout::Group.

The units format can be any of the following values:

Layout::Document::FRACTIONAL_INCHES
Layout::Document::DECIMAL_INCHES
Layout::Document::DECIMAL_FEET
Layout::Document::DECIMAL_MILLIMETERS
Layout::Document::DECIMAL_CENTIMETERS
Layout::Document::DECIMAL_METERS
Layout::Document::DECIMAL_POINTS

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
group = doc.shared_entities.first
units = group.scale_units

Returns:

  • (Integer)

    units The units format of the scale factor

Raises:

  • (ArgumentError)

    if the Layout::Group does not have a scale factor

Version:

  • LayOut 2018

#scale_units=(units_format) ⇒ Object

The #scale_units= method sets the the units format for the scale of the Layout::Group.

The units format can be any of the following values:

Layout::Document::FRACTIONAL_INCHES
Layout::Document::DECIMAL_INCHES
Layout::Document::DECIMAL_FEET
Layout::Document::DECIMAL_MILLIMETERS
Layout::Document::DECIMAL_CENTIMETERS
Layout::Document::DECIMAL_METERS
Layout::Document::DECIMAL_POINTS

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
group = doc.shared_entities.first
group.scale_units = Layout::Document::DECIMAL_FEET

Parameters:

  • units_format (Integer)

Raises:

Version:

  • LayOut 2018

#set_scale_factor(scale_factor, units_format, resize_behavior) ⇒ Object

The #set_scale_factor method sets the the scale factor for the Layout::Group.

The units format can be any of the following values:

Layout::Document::FRACTIONAL_INCHES
Layout::Document::DECIMAL_INCHES
Layout::Document::DECIMAL_FEET
Layout::Document::DECIMAL_MILLIMETERS
Layout::Document::DECIMAL_CENTIMETERS
Layout::Document::DECIMAL_METERS
Layout::Document::DECIMAL_POINTS

The resize behavior can be one of the following values:

Layout::Group::RESIZE_BEHAVIOR_NONE
Layout::Group::RESIZE_BEHAVIOR_BOUNDS
Layout::Group::RESIZE_BEHAVIOR_BOUNDS_AND_FONTS

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
group = doc.shared_entities.first
group.set_scale_factor(2.0, Layout::Group::RESIZE_BEHAVIOR_BOUNDS)

Parameters:

  • scale_factor (Float)
  • units_format (Integer)
  • resize_behavior (Integer)

Raises:

Version:

  • LayOut 2018

#ungroupBoolean

The #ungroup method removes all Entitys from the Layout::Group and deletes the Layout::Group.

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
group = doc.shared_entities.first
group.ungroup

Returns:

  • (Boolean)

Raises:

Version:

  • LayOut 2018