Class: Layout::LinearDimension
- Inherits:
-
Layout::Entity
- Object
- Layout::Entity
- Layout::LinearDimension
Overview
Constants # collapse
- Layout::LinearDimension::DIMENSION_LINE_ALIGNED
The dimension line is parallel to the line connecting two points.
- Layout::LinearDimension::DIMENSION_LINE_VERTICAL
Vertical dimension.
- Layout::LinearDimension::DIMENSION_LINE_HORIZONTAL
Horizontal dimension.
Class Method Summary # collapse
-
.new(start_point, end_point, height) ⇒ Layout::LinearDimension
Create a linear dimension. height is the distance from the dimension line to the start point, with a positive value on the left side of the direction from start to end (above the dimension line when annotated from left to right).
-
.create_chain(points, height, mode: :continuous, orientation: Layout::LinearDimension::DIMENSION_LINE_HORIZONTAL) ⇒ Array<Layout::LinearDimension>
A chain of horizontally or vertically aligned dimensions (not yet added to the document).:continuous segments are connected end-to-end sharing a single dimension line;:baseline all segments start from the first point and incrementally offset vertically (offset 7 mm). The first segment is the baseline, and:height determines the position of the dimension line. After adding to the document, the entire chain aligns to the baseline, and when associated with a viewport, it updates with the viewport.
Instance Method Summary # collapse
-
#connect(start_connection, end_connection) ⇒ Layout::LinearDimension
Connect two endpoints to model points in the viewport, one step undoable (takes effect upon addition if not already added). If one end is nil, it is not associated. During writing, recalculate the paper position and value based on the viewport.
-
#disconnect ⇒ Layout::LinearDimension
Disconnect the association, leaving the dimension in its current position; a single undo step.
-
#start_connection_point ⇒ Layout::ConnectionPoint, nil
The connection point at the start; nil if unconnected or the viewport has been deleted.
-
#end_connection_point ⇒ Layout::ConnectionPoint, nil
The connection point at the end.
-
#start_extent_point ⇒ Geom::Point2d
The measured start extent point (paper inches).
-
#end_extent_point ⇒ Geom::Point2d
The end extent point of the measured feature.
-
#start_extent_point= ⇒ Geom::Point2d
Move the start extent point one step back, undoing the change. Like dragging in the interface: the associated endpoint will be disassociated.
-
#end_extent_point= ⇒ Geom::Point2d
Move the end point, one step undo.
-
#start_offset_point ⇒ Geom::Point2d
The start of the dimension line.
-
#end_offset_point ⇒ Geom::Point2d
The end of the dimension line.
-
#text ⇒ Layout::FormattedText
The copy of the displayed dimension text (formatted in model units for model length when associated), located at the center of the dimension; this copy does not affect the dimension.
-
#text= ⇒ Layout::FormattedText, String
Customize the text (use plain text), where <> represents the measurement value, and allow one step of undo.
-
#custom_text? ⇒ Boolean
Whether to use custom text.
-
#custom_text= ⇒ Boolean
Pass false to restore the measurement value display; use #text= to set custom text.
-
#scale ⇒ Float
Scale factor (ratio). Automatically equals the viewport scale when associated.
-
#scale= ⇒ Numeric
Set the scale factor for unassociated dimensions, undoing the last change.
-
#auto_scale? ⇒ Boolean
Is the scale automatically derived from the associated viewport.
-
#orientation ⇒ Integer
Orientation: DIMENSION_LINE_ALIGNED, DIMENSION_LINE_HORIZONTAL, or DIMENSION_LINE_VERTICAL.
-
#orientation= ⇒ Integer
Set the orientation, one step in the undo.
-
#precision ⇒ Integer
Decimal places; -1 follows the model's setting.
-
#precision= ⇒ Integer
Set the decimal precision, with one step in undo.
-
#chain_mode ⇒ Symbol, nil
The group type: :continuous, :baseline, or nil if not grouped.
-
#chain_members ⇒ Array<Layout::LinearDimension>
All dimensions in the same group (including itself), in the order defined within the group; an empty array if not grouped or not added to the document.
Inherited from Layout::Entity
-
#bounds ⇒ Geom::Bounds2d
The bounding box after rotation, in paper inches.
-
#untransformed_bounds ⇒ Geom::Bounds2d
Unrotated bounds (x, y, width, height), paper inches.
-
#untransformed_bounds= ⇒ Geom::Bounds2d
Modify position and size, with one undo step. The rules are the same as for the layout: the view preserves scale on resize (default) when Layout::SketchUpModel#preserve_scale_on_resize? is true, otherwise it scales by height only; dimensions and leaders only move and do not scale. If they extend beyond the paper edge, they are clipped back within the paper.
-
#style ⇒ Layout::Style
A copy of the current style. Modifying the copy does not affect the object; use #style= to apply the changes.
-
#style= ⇒ Layout::Style
Apply the style, undoing one step. Only apply properties relevant to the object type (e.g., text ignoring line type).
-
#page ⇒ Layout::Page, nil
The current page; objects on shared layers or those not yet added to the document are nil.
-
#document ⇒ Layout::Document, nil
Belongs to a Layout::Entity document; is nil if not added yet.
-
#on_shared_layer? ⇒ Boolean
Returns true if the entity is on a shared layer.
-
#layer_instance ⇒ Layout::LayerInstance, nil
The layer it resides on; nil if not added yet.
-
#move_to_layer(layer, pages = nil) ⇒ Layout::Entity
Move to another layer, one undo step. Objects on a shared layer remain on their associated page when moved to a regular layer.
-
#rotation ⇒ Float
Rotation angle around the bounding box center (degrees).
-
#rotation= ⇒ Numeric
Rotate around the bounding box center, one step in undo. Dimensions and leaders do not accept rotation (they follow their endpoints).
-
#get_attribute(dictionary, key, default = nil) ⇒ Object
Read plugin data on the object. Plugins can use this to identify objects they generate, such as re-creating automatic leader and dimension annotations.
-
#set_attribute(dictionary, key, value) ⇒ Object
Save plugin data on the object with a single undo step. Values can only be types that JSON can represent (nil, true, false, numbers, strings, Array, Hash), and a single object should not exceed 64 KB.
-
#delete_attribute(dictionary) ⇒ Boolean
Delete a key or an entire dictionary.
-
#attribute_dictionary(name, create = false) ⇒ Hash, nil
A copy of a dictionary.
-
#locked? ⇒ Object
Unsupported: OpenSu does not support object-level locking (please lock the layer).
-
#locked= ⇒ Object
Unsupported: OpenSu does not support object-level locking (please lock the layer).
-
#transform!(transformation) ⇒ Object
Unsupported: OpenSu does not support Geom::Transformation2d. For translation, use #untransformed_bounds=, and for rotation, use #rotation=.
-
#group ⇒ Object
Does not support: OpenSu drawings cannot be grouped.
-
#== ⇒ Boolean
Returns whether the two references identify the same drawing entity.
-
#eql?(other) ⇒ Boolean
Like #==, used as a key in a Hash.
-
#hash ⇒ Integer
Hash value consistent with #eql?.
-
#inspect ⇒ String
A brief description.
Class Method Details
Layout::LinearDimension.new(start_point, end_point, height) ⇒ Layout::LinearDimension
Create a linear dimension. height is the distance from the dimension line to the start point, with a positive value on the left side of the direction from start to end (above the dimension line when annotated from left to right).
Layout::LinearDimension.create_chain(points, height, mode: :continuous, orientation: Layout::LinearDimension::DIMENSION_LINE_HORIZONTAL) ⇒ Array<Layout::LinearDimension>
A chain of horizontally or vertically aligned dimensions (not yet added to the document).:continuous segments are connected end-to-end sharing a single dimension line;:baseline all segments start from the first point and incrementally offset vertically (offset 7 mm). The first segment is the baseline, and:height determines the position of the dimension line. After adding to the document, the entire chain aligns to the baseline, and when associated with a viewport, it updates with the viewport.
Instance Method Details
dimension.connect(start_connection, end_connection) ⇒ Layout::LinearDimension
Connect two endpoints to model points in the viewport, one step undoable (takes effect upon addition if not already added). If one end is nil, it is not associated. During writing, recalculate the paper position and value based on the viewport.
dimension.disconnect ⇒ Layout::LinearDimension
Disconnect the association, leaving the dimension in its current position; a single undo step.
dimension.start_connection_point ⇒ Layout::ConnectionPoint, nil
The connection point at the start; nil if unconnected or the viewport has been deleted.
dimension.end_connection_point ⇒ Layout::ConnectionPoint, nil
The connection point at the end.
dimension.start_extent_point ⇒ Geom::Point2d
The measured start extent point (paper inches).
dimension.end_extent_point ⇒ Geom::Point2d
The end extent point of the measured feature.
dimension.start_extent_point = point
Move the start extent point one step back, undoing the change. Like dragging in the interface: the associated endpoint will be disassociated.
dimension.end_extent_point = point
Move the end point, one step undo.
dimension.start_offset_point ⇒ Geom::Point2d
The start of the dimension line.
dimension.end_offset_point ⇒ Geom::Point2d
The end of the dimension line.
dimension.text ⇒ Layout::FormattedText
The copy of the displayed dimension text (formatted in model units for model length when associated), located at the center of the dimension; this copy does not affect the dimension.
dimension.text = formatted_text
Customize the text (use plain text), where <> represents the measurement value, and allow one step of undo.
dimension.custom_text? ⇒ Boolean
Whether to use custom text.
dimension.custom_text = custom
Pass false to restore the measurement value display; use #text= to set custom text.
dimension.scale ⇒ Float
Scale factor (ratio). Automatically equals the viewport scale when associated.
dimension.scale = ratio
Set the scale factor for unassociated dimensions, undoing the last change.
dimension.auto_scale? ⇒ Boolean
Is the scale automatically derived from the associated viewport.
dimension.orientation ⇒ Integer
Orientation: DIMENSION_LINE_ALIGNED, DIMENSION_LINE_HORIZONTAL, or DIMENSION_LINE_VERTICAL.
dimension.orientation = orientation
Set the orientation, one step in the undo.
dimension.precision ⇒ Integer
Decimal places; -1 follows the model's setting.
dimension.precision = digits
Set the decimal precision, with one step in undo.
dimension.chain_mode ⇒ Symbol, nil
The group type: :continuous, :baseline, or nil if not grouped.
dimension.chain_members ⇒ Array<Layout::LinearDimension>
All dimensions in the same group (including itself), in the order defined within the group; an empty array if not grouped or not added to the document.