123456789_123456789_123456789_123456789_123456789_

Class: Layout::LinearDimension

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

Overview

References a linear dimension entity. A LinearDimension is composed of the following sub-entities:

  • two ‘extension lines’ that connect to the Entity being dimensioned.

  • a ‘dimension line’ connecting the ends of the leaders. This may be represented by one or two Paths depending on appearance.

  • an optional ‘leader line’ that is used for small LinearDimensions.

  • a ‘dimension text’ that displays the LinearDimension‘s text.

There are six points that may be modified for a LinearDimension:

  • two ‘connection points’ that define the start and end of the LinearDimension.

  • two ‘extent points’ that define the start and end of the dimension line and are the ends of the two extension lines.

  • two ‘offset points’ that define the starting points of the extension lines.

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(start_point, end_point, height) ⇒ LinearDimension

The #initialize method creates a new disconnected LinearDimension.

Examples:

start_point = Geom::Point2d.new(1, 1)
end_point = Geom::Point2d.new(5, 5)
height = 1.0
dim = Layout::LinearDimension.new(start_point, end_point, height)

Parameters:

Version:

  • LayOut 2018

Instance Attribute Details

#auto_scale=(uses_auto_scale) (rw)

The #auto_scale= method sets whether the scale for the LinearDimension is set automatically.

Examples:

start_point = Geom::Point2d.new(1, 1)
end_point = Geom::Point2d.new(5, 5)
height = 1.0
dim = Layout::LinearDimension.new(start_point, end_point, height)
dim.auto_scale = true

Parameters:

  • uses_auto_scale (Boolean)

Raises:

Version:

  • LayOut 2018

#auto_scale?Boolean (rw)

The #auto_scale? method returns whether the scale for the LinearDimension is set automatically.

Examples:

start_point = Geom::Point2d.new(1, 1)
end_point = Geom::Point2d.new(5, 5)
height = 1.0
dim = Layout::LinearDimension.new(start_point, end_point, height)
uses_auto_scale = dim.auto_scale?

Version:

  • LayOut 2018

#custom_text=(uses_custom_text) (rw)

The #custom_text= method sets whether the LinearDimension uses custom text. When true, the LinearDimension will display a custom string that doesn’t change. When false, it will display the length measurement and will update automatically.

Examples:

start_point = Geom::Point2d.new(1, 1)
end_point = Geom::Point2d.new(5, 5)
height = 1.0
dim = Layout::LinearDimension.new(start_point, end_point, height)
dim.custom_text = true

Parameters:

  • uses_custom_text (Boolean)

Raises:

Version:

  • LayOut 2018

#custom_text?Boolean (rw)

The #custom_text? method returns whether the LinearDimension uses custom text. When true, the LinearDimension will display a custom string that doesn’t change. When false, it will display the length measurement and will update automatically.

Examples:

start_point = Geom::Point2d.new(1, 1)
end_point = Geom::Point2d.new(5, 5)
height = 1.0
dim = Layout::LinearDimension.new(start_point, end_point, height)
# returns false
uses_custom_text = dim.custom_text?

Version:

  • LayOut 2018

#end_connection_pointGeom::Point2d (rw)

The #end_connection_point method returns the paper space location for the second connection.

Examples:

start_point = Geom::Point2d.new(1, 1)
end_point = Geom::Point2d.new(5, 5)
height = 1.0
dim = Layout::LinearDimension.new(start_point, end_point, height)
end_connection = dim.end_connection_point

Version:

  • LayOut 2018

#end_connection_point=(end_point) (rw)

The #end_connection_point= method sets the paper space location for the second connection.

Examples:

start_point = Geom::Point2d.new(1, 1)
end_point = Geom::Point2d.new(5, 5)
height = 1.0
dim = Layout::LinearDimension.new(start_point, end_point, height)
dim.end_connection_point = Geom::Point2d.new(6, 6)

Parameters:

Raises:

Version:

  • LayOut 2018

#end_extent_pointGeom::Point2d (rw)

The #end_extent_point method returns the paper space location for the end of the dimension line.

Examples:

start_point = Geom::Point2d.new(1, 1)
end_point = Geom::Point2d.new(5, 5)
height = 1.0
dim = Layout::LinearDimension.new(start_point, end_point, height)
end_ext_point = dim.end_extent_point

Returns:

Version:

  • LayOut 2018

#end_extent_point=(end_extent) (rw)

The #end_extent_point= method sets the paper space location for the end of the dimension line.

Examples:

start_point = Geom::Point2d.new(1, 1)
end_point = Geom::Point2d.new(5, 5)
height = 1.0
dim = Layout::LinearDimension.new(start_point, end_point, height)
end_ext_point = Geom::Point2d.new(5, 6)
dim.end_extent_point = end_ext_point

Parameters:

Raises:

Version:

  • LayOut 2018

#end_offset_length=(offset_length) (writeonly)

The #end_offset_length= method sets the length of the offset from the second ConnectionPoint to the start of the second extension line. The ConnectionPoint and extent point will not move.

Examples:

start_point = Geom::Point2d.new(1, 1)
end_point = Geom::Point2d.new(5, 5)
height = 1.0
dim = Layout::LinearDimension.new(start_point, end_point, height)
end_ext_point = Geom::Point2d.new(5, 6)
dim.end_offset_length = 0.5

Parameters:

Raises:

Version:

  • LayOut 2018

#leader_line_typeInteger (rw)

The #leader_line_type method returns the type of leader line the LinearDimension is using.

The leader line type can be one of the following:

Layout::LinearDimension::LEADER_LINE_TYPE_SINGLE_SEGMENT
Layout::LinearDimension::LEADER_LINE_TYPE_TWO_SEGMENT
Layout::LinearDimension::LEADER_LINE_TYPE_BEZIER
Layout::LinearDimension::LEADER_LINE_TYPE_HIDDEN

Examples:

start_point = Geom::Point2d.new(1, 1)
end_point = Geom::Point2d.new(5, 5)
height = 1.0
dim = Layout::LinearDimension.new(start_point, end_point, height)
type = dim.leader_line_type

Version:

  • LayOut 2018

#leader_line_type=(type) (rw)

The #leader_line_type= method sets the type of leader line the LinearDimension is using.

The leader line type can be one of the following:

Layout::LinearDimension::LEADER_LINE_TYPE_SINGLE_SEGMENT
Layout::LinearDimension::LEADER_LINE_TYPE_TWO_SEGMENT
Layout::LinearDimension::LEADER_LINE_TYPE_BEZIER
Layout::LinearDimension::LEADER_LINE_TYPE_HIDDEN

Examples:

start_point = Geom::Point2d.new(1, 1)
end_point = Geom::Point2d.new(5, 5)
height = 1.0
dim = Layout::LinearDimension.new(start_point, end_point, height)
dim.leader_line_type = Layout::LinearDimension::LEADER_LINE_TYPE_BEZIER

Parameters:

  • type (Integer)

    The leader line type

Raises:

  • (ArgumentError)

    if leader_line_type is not a valid leader line type

  • (LockedLayerError)

    if the LinearDimension is on a locked Layer

  • (LockedEntityError)

    if the LinearDimension is locked

Version:

  • LayOut 2018

#scaleNumeric (rw)

The #scale method returns the scale being used for the LinearDimension.

Examples:

start_point = Geom::Point2d.new(1, 1)
end_point = Geom::Point2d.new(5, 5)
height = 1.0
dim = Layout::LinearDimension.new(start_point, end_point, height)
scale = dim.scale

Returns:

Version:

  • LayOut 2018

#scale=(scale) (rw)

The #scale= method sets the scale being used for the LinearDimension.

Examples:

start_point = Geom::Point2d.new(1, 1)
end_point = Geom::Point2d.new(5, 5)
height = 1.0
dim = Layout::LinearDimension.new(start_point, end_point, height)
dim.scale = 1.5

Parameters:

Raises:

Version:

  • LayOut 2018

#start_connection_pointGeom::Point2d (rw)

The #start_connection_point method returns the paper space location for the first connection.

Examples:

start_point = Geom::Point2d.new(1, 1)
end_point = Geom::Point2d.new(5, 5)
height = 1.0
dim = Layout::LinearDimension.new(start_point, end_point, height)
start_connection = dim.start_connection_point

Version:

  • LayOut 2018

#start_connection_point=(start_point) (rw)

The #start_connection_point= method sets the paper space location for the first connection.

Examples:

start_point = Geom::Point2d.new(1, 1)
end_point = Geom::Point2d.new(5, 5)
height = 1.0
dim = Layout::LinearDimension.new(start_point, end_point, height)
dim.start_connection_point = Geom::Point2d.new(2, 2)

Parameters:

Raises:

Version:

  • LayOut 2018

#start_extent_pointGeom::Point2d (rw)

The #start_extent_point method returns the paper space location for the start of the dimension line.

Examples:

start_point = Geom::Point2d.new(1, 1)
end_point = Geom::Point2d.new(5, 5)
height = 1.0
dim = Layout::LinearDimension.new(start_point, end_point, height)
start_ext_point = dim.start_extent_point

Returns:

Version:

  • LayOut 2018

#start_extent_point=(start_extent) (rw)

The #start_extent_point= method sets the paper space location for the start of the dimension line.

Examples:

start_point = Geom::Point2d.new(1, 1)
end_point = Geom::Point2d.new(5, 5)
height = 1.0
dim = Layout::LinearDimension.new(start_point, end_point, height)
start_ext_point = Geom::Point2d.new(2, 3)
dim.start_extent_point = start_ext_point

Parameters:

Raises:

Version:

  • LayOut 2018

#start_offset_length=(offset_length) (writeonly)

The #start_offset_length= method sets the length of the offset from the first ConnectionPoint to the start of the first extension line. The ConnectionPoint and extent point will not move.

Examples:

start_point = Geom::Point2d.new(1, 1)
end_point = Geom::Point2d.new(5, 5)
height = 1.0
dim = Layout::LinearDimension.new(start_point, end_point, height)
end_ext_point = Geom::Point2d.new(5, 6)
dim.start_offset_length = 0.5

Parameters:

Raises:

Version:

  • LayOut 2018

#textLayout::FormattedText (rw)

Note:

With the addition of auto-text in dimensions for LayOut 2019.2, the copy of the dimension text incorrectly provided the plain text when requesting the display text. This has been fixed for LayOut 2020.1.

The #text method returns a copy of the LinearDimension‘s FormattedText.

Examples:

start_point = Geom::Point2d.new(1, 1)
end_point = Geom::Point2d.new(5, 5)
height = 1.0
dim = Layout::LinearDimension.new(start_point, end_point, height)
text = dim.text

Version:

  • LayOut 2018

#text=(formatted_text) (rw)

The #text= method sets the LinearDimension‘s FormattedText.

Examples:

start_point = Geom::Point2d.new(1, 1)
end_point = Geom::Point2d.new(5, 5)
height = 1.0
dim = Layout::LinearDimension.new(start_point, end_point, height)
anchor_type = Layout::FormattedText::ANCHOR_TYPE_TOP_LEFT
dim.text = Layout::FormattedText.new("Hello LayOut", start_point, anchor_type)

Parameters:

Raises:

Version:

  • LayOut 2018

Instance Method Details

#connect(start_connection, end_connection)

The #connect method connects the LinearDimension to one or two Entitys using the provided ConnectionPoints. The LinearDimension must be in the same Document as the Entitys, and on the same Page if the Entitys are on non-shared Layers.

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
point_1 = Geom::Point2d.new(5, 7.5)
point_2 = Geom::Point2d.new(8.5, 9)
table = Layout::Rectangle.new([point_1, point_2])
doc.add_entity(table, doc.layers.first, doc.pages.first)
start_point = Layout::ConnectionPoint.new(table, point_1)
end_point = Layout::ConnectionPoint.new(table, point_2)
height = 1.0
dim = Layout::LinearDimension.new(Geom::Point2d.new(1, 1),
  Geom::Point2d.new(5, 5), height)
dim.connect(start_point, end_point)

Parameters:

Raises:

Version:

  • LayOut 2018

#disconnect

The #disconnect method disconnects the LinearDimension from its ConnectionPoints. The dimension will not be adjusted by disconnecting from its ConnectionPoints.

Examples:

start_point = Geom::Point2d.new(1, 1)
end_point = Geom::Point2d.new(5, 5)
height = 1.0
dim = Layout::LinearDimension.new(start_point, end_point, height)
dim.disconnect

Raises:

Version:

  • LayOut 2018

#end_offset_pointGeom::Point2d

The #end_offset_point method returns the paper space location for the end of the first extension line. The first extension line runs from this offset point to the end extent point.

Examples:

start_point = Geom::Point2d.new(1, 1)
end_point = Geom::Point2d.new(5, 5)
height = 1.0
dim = Layout::LinearDimension.new(start_point, end_point, height)
end_offset = dim.end_offset_point

Returns:

Version:

  • LayOut 2018

#entitiesLayout::Entities

The #entities method returns the Entities that represent the LinearDimension in its exploded form. Depending on the appearance of the LinearDimension, this may return anywhere from four to six Entitys: start extension line, end extension line, one or two dimension lines, dimension text, and optionally the leader line.

Examples:

start_point = Geom::Point2d.new(1, 1)
end_point = Geom::Point2d.new(5, 5)
height = 1.0
dim = Layout::LinearDimension.new(start_point, end_point, height)
entites = dim.entities

Version:

  • LayOut 2018

#start_offset_pointGeom::Point2d

The #start_offset_point method returns the paper space location for the start of the first extension line. The first extension line runs from this offset point to the start extent point.

Examples:

start_point = Geom::Point2d.new(1, 1)
end_point = Geom::Point2d.new(5, 5)
height = 1.0
dim = Layout::LinearDimension.new(start_point, end_point, height)
start_offset = dim.start_offset_point

Returns:

Version:

  • LayOut 2018