123456789_123456789_123456789_123456789_123456789_

Class: Layout::Group

Relationships
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Entity
Instance Chain:
self, Entity
Inherits: Layout::Entity

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

Class Method Summary

Instance Attribute Summary

Entity - Inherited

#locked=

The #locked= method sets the Entity as locked or unlocked.

#locked?

The #locked? method returns whether the Entity is locked or unlocked.

#on_shared_layer?

The #on_shared_layer? method returns whether or not the Entity is on a shared Layer.

#style

The #style method returns the Style of the Entity.

#style=

The #style= method sets the Style of the Entity.

#untransformed_bounds

The #untransformed_bounds method returns the untransformed bounds of the Entity.

#untransformed_bounds=

The #untransformed_bounds= method sets the untransformed bounds of the Entity.

Instance Method Summary

Entity - Inherited

#==

The #== method checks to see if the two Entitys are equal.

#bounds

The #bounds method returns the 2D rectangular bounds of the Entity.

#document

The #document method returns the Document that the Entity belongs to, or nil if it is not in a Document.

#drawing_bounds

The #drawing_bounds method returns the 2D rectangular drawing bounds of the Entity.

#group

The #group method returns the Group the Entity belongs to, or nil if it is not in a Group.

#layer_instance

The #layer_instance method returns the LayerInstance that the Entity is on, or nil if it is not associated with a LayerInstance.

#move_to_group

The #move_to_group method moves the Entity into a Group.

#move_to_layer

The #move_to_layer method moves the Entity to the given Layer.

#page

The #page method returns the Page that the Entity belongs to, or nil if it is on a shared Layer or not in a Document.

#transform!

The #transform! method transforms the Entity with a given ::Geom::Transformation2d.

#transformation

The #transformation method returns the explicit ::Geom::Transformation2d.

Constructor Details

.new(entities) ⇒ Group

The #initialize method creates a new 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 Attribute Details

#scale_precisionFloat (rw)

The #scale_precision method returns the precision used for the scale of the 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 Group

Version:

  • LayOut 2018

#scale_precision=(precision) (rw)

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 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 Group

Version:

  • LayOut 2018

#scale_unitsInteger (rw)

The #scale_units method returns the units format used in the scale for the 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 Group does not have a scale factor

Version:

  • LayOut 2018

#scale_units=(units_format) (rw)

The #scale_units= method sets the the units format for the scale of the 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

Instance Method Details

#entitiesLayout::Entities

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

Examples:

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

Version:

  • LayOut 2018

#remove_scale_factor(resize_behavior)

The #remove_scale_factor method removes the scale factor from the 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 Group.

Examples:

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

Version:

  • LayOut 2018

#set_scale_factor(scale_factor, units_format, resize_behavior)

The #set_scale_factor method sets the the scale factor for the 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:

  • (LockedLayerError)

    if the Group is on a locked Layer

  • (LockedEntityError)

    if the Group is locked

  • (ArgumentError)

    if scale_factor is an invalid value

  • (ArgumentError)

    if the Group cannot be assigned a scale factor because it is already inheriting a scale factor from its parent

  • (ArgumentError)

    if a scale factor cannot be set for the Group

Version:

  • LayOut 2018

#ungroupBoolean

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

Examples:

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

Raises:

Version:

  • LayOut 2018