ModraUp Ruby API Documentation Ruby API Reference

Class: Layout::ArcDimension

Inherits:
Layout::Entity show all

Overview

Arc length dimension for a circular arc: The dimension arc is concentric with the circular arc, the dimension lines are radial, and a circular arc symbol is drawn above the numeric value (GB/T 50001).

Note: ModraUp extension. LayOut does not have this feature.

Examples:

Semicircle, dimension arc on the outside by 5 mm

Layout::ArcDimension.new(Geom::Point2d.new(2, 2), Geom::Point2d.new(3, 2), Geom::Point2d.new(1, 2), 5.mm)

Class Method Summary # collapse

Instance Method Summary # collapse

Inherited from Layout::Entity

Class Method Details

Layout::ArcDimension.new(center_point, start_point, end_point, offset, counter_clockwise = true) ⇒ Layout::ArcDimension

Create a new arc dimension. The arc spans from the start_point around the center_point to the end_point in the direction on the paper plane, with the radius taken as the distance from the start_point to the center. The offset offset is the distance from the dimension arc to the arc, with negative values indicating an inner offset.

Parameters:

  • center_point (Geom::Point2d) inch on the drawing sheet
  • start_point (Geom::Point2d)
  • end_point (Geom::Point2d)
  • offset (Length, Numeric) inch
  • counter_clockwise (Boolean) Clockwise on the paper (default)

Returns:

  • (Layout::ArcDimension)

Raises:

  • [ArgumentError] The arc length is zero, or the dimension arc spans the center.

Examples:

Layout::ArcDimension.new(Geom::Point2d.new(2, 2), Geom::Point2d.new(3, 2), Geom::Point2d.new(2, 1), 0.2)

Instance Method Details

dimension.arc_center_point ⇒ Geom::Point2d

Center.

Returns:

  • (Geom::Point2d)

Examples:

Layout::ArcDimension.new(Geom::Point2d.new(2, 2), Geom::Point2d.new(3, 2), Geom::Point2d.new(2, 1), 0.2).arc_center_point

dimension.start_point ⇒ Geom::Point2d

Arc start point.

Returns:

  • (Geom::Point2d)

Examples:

Layout::ArcDimension.new(Geom::Point2d.new(2, 2), Geom::Point2d.new(3, 2), Geom::Point2d.new(2, 1), 0.2).start_point

dimension.end_point ⇒ Geom::Point2d

Arc endpoint.

Returns:

  • (Geom::Point2d)

Examples:

Layout::ArcDimension.new(Geom::Point2d.new(2, 2), Geom::Point2d.new(3, 2), Geom::Point2d.new(2, 1), 0.2).end_point

dimension.offset ⇒ Length

The distance of the arc dimension from the arc (negative values place it inside the arc).

Returns:

  • (Length)

Examples:

Layout::ArcDimension.new(Geom::Point2d.new(2, 2), Geom::Point2d.new(3, 2), Geom::Point2d.new(2, 1), 0.2).offset

dimension.offset = offset

Offset the arc dimension position, one step in the undo.

Parameters:

  • offset (Length, Numeric) inch

Returns:

  • (Length, Numeric)

Raises:

  • [ArgumentError] The dimension arc extends beyond the circle's center

Examples:

d = Layout::ArcDimension.new(Geom::Point2d.new(2, 2), Geom::Point2d.new(3, 2), Geom::Point2d.new(2, 1), 0.2)
d.offset = 8.mm

dimension.counter_clockwise? ⇒ Boolean

Does the arc on the drawing sheet turn counterclockwise from the start point to the end point.

Returns:

  • (Boolean)

Examples:

Layout::ArcDimension.new(Geom::Point2d.new(2, 2), Geom::Point2d.new(3, 2), Geom::Point2d.new(2, 1), 0.2).counter_clockwise?

dimension.arc_length ⇒ Length

Arc length on the plane (unscaled).

Returns:

  • (Length)

Examples:

Quarter-circle

Layout::ArcDimension.new(Geom::Point2d.new(2, 2), Geom::Point2d.new(3, 2), Geom::Point2d.new(2, 1), 0.2).arc_length

dimension.text ⇒ Layout::FormattedText

Display the copy of the text (arc length value; the arc symbol is drawn above the value, not within the text).

Returns:

  • (Layout::FormattedText)

Examples:

Layout::ArcDimension.new(Geom::Point2d.new(2, 2), Geom::Point2d.new(3, 2), Geom::Point2d.new(2, 1), 0.2).text.plain_text

dimension.text = formatted_text

Customize the text, use <> for the arc length, and perform one undo step.

Parameters:

  • formatted_text (Layout::FormattedText, String)

Returns:

  • (Layout::FormattedText, String)

Examples:

d = Layout::ArcDimension.new(Geom::Point2d.new(2, 2), Geom::Point2d.new(3, 2), Geom::Point2d.new(2, 1), 0.2)
d.text = "Unfolded <>"

dimension.custom_text? ⇒ Boolean

Whether to use custom text.

Returns:

  • (Boolean)

Examples:

Layout::ArcDimension.new(Geom::Point2d.new(2, 2), Geom::Point2d.new(3, 2), Geom::Point2d.new(2, 1), 0.2).custom_text?

dimension.custom_text = custom

Set false to restore the display of arc length.

Parameters:

  • custom (Boolean)

Returns:

  • (Boolean)

Examples:

Layout::ArcDimension.new(Geom::Point2d.new(2, 2), Geom::Point2d.new(3, 2), Geom::Point2d.new(2, 1), 0.2).custom_text = false

dimension.scale ⇒ Float

Scale factor (ratio).

Returns:

  • (Float)

Examples:

Layout::ArcDimension.new(Geom::Point2d.new(2, 2), Geom::Point2d.new(3, 2), Geom::Point2d.new(2, 1), 0.2).scale

dimension.scale = ratio

Set the scale factor for the radial dimension, and perform an undo step.

Parameters:

  • ratio (Numeric)

Returns:

  • (Numeric)

Raises:

  • [ArgumentError] must be a positive number

Examples:

1:50

d = Layout::ArcDimension.new(Geom::Point2d.new(2, 2), Geom::Point2d.new(3, 2), Geom::Point2d.new(2, 1), 0.2)
d.scale = 1.0 / 50

dimension.precision ⇒ Integer

Decimal places; -1 follows the model's setting.

Returns:

  • (Integer)

Examples:

Layout::ArcDimension.new(Geom::Point2d.new(2, 2), Geom::Point2d.new(3, 2), Geom::Point2d.new(2, 1), 0.2).precision

dimension.precision = digits

Set the decimal precision, with one step in undo.

Parameters:

  • digits (Integer) -1 or 0~3

Returns:

  • (Integer)

Raises:

  • [ArgumentError] Out of range

Examples:

d = Layout::ArcDimension.new(Geom::Point2d.new(2, 2), Geom::Point2d.new(3, 2), Geom::Point2d.new(2, 1), 0.2)
d.precision = 2