ModraUp Ruby API Documentation Ruby API Reference

Class: Layout::AngularDimension

Inherits:
Layout::Entity show all

Overview

Angle Dimension: The angle between two edges, with the arc of the dimension centered at the intersection of the two dimension lines. The connection points are on the edges being measured, and the extension points are at the ends of the arc. The value is the paper angle (in degrees), with the text, endpoints, and height sharing the same naming style as other dimensions.

end_offset_length=2 mm (the dimension line is fixed 2 mm away from the measured point); cannot connect (as in LayOut), instead, it is only associated when using the angle dimension tool to mark viewport model lines on the drawing sheet.

Note: ModraUp extension. Does not support entities, leader_line_type, and +start_offset_length=.

Examples:

Measure 45°

dim = Layout::AngularDimension.new(Geom::Point2d.new(3, 2), Geom::Point2d.new(2.5, 1.5),
                                   Geom::Point2d.new(3, 2), Geom::Point2d.new(2.707, 1.293), true)
dim.angle.radians  #=> 45.0

Class Method Summary # collapse

Instance Method Summary # collapse

Inherited from Layout::Entity

Class Method Details

Layout::AngularDimension.new(start_point, end_point, start_extent_point, end_extent_point, inner_angle) ⇒ Layout::AngularDimension

Create an angular dimension. The start_point and end_point are points on the measured edges, while the start_extent_point and end_extent_point are the endpoints of the dimension arc. The intersection of the two dimension lines (from the measured points to the extent points) is the center of the dimension arc, and the radius is the distance from the center to the start_extent_point.

Parameters:

  • start_point (Geom::Point2d) inch on the drawing sheet
  • end_point (Geom::Point2d)
  • start_extent_point (Geom::Point2d)
  • end_extent_point (Geom::Point2d)
  • inner_angle (Boolean) false AngularDimension (360° minus the angle between two rays)

Returns:

  • (Layout::AngularDimension)

Raises:

  • [ArgumentError] The dimension leaders are parallel, or the dimension arc is too small.

Examples:

Layout::AngularDimension.new(Geom::Point2d.new(3, 2), Geom::Point2d.new(2.5, 1.5),
                             Geom::Point2d.new(3, 2), Geom::Point2d.new(2.707, 1.293), true)

Instance Method Details

dimension.angle ⇒ Float

The angle measured in radians.

Returns:

  • (Float)

Examples:

Layout::AngularDimension.new(Geom::Point2d.new(3, 2), Geom::Point2d.new(2.5, 1.5),
                             Geom::Point2d.new(3, 2), Geom::Point2d.new(2.707, 1.293), true).angle

dimension.radius ⇒ Length

The distance from the center to the dimension arc.

Returns:

  • (Length)

Examples:

Layout::AngularDimension.new(Geom::Point2d.new(3, 2), Geom::Point2d.new(2.5, 1.5),
                             Geom::Point2d.new(3, 2), Geom::Point2d.new(2.707, 1.293), true).radius

dimension.radius = radius

Modify the dimension arc radius, one step undo; the measured point and the center remain unchanged.

Parameters:

  • radius (Length, Numeric) inch

Returns:

  • (Length, Numeric)

Raises:

  • [ArgumentError] Negative value or out of 0.1~1200 mm range

Examples:

d = Layout::AngularDimension.new(Geom::Point2d.new(3, 2), Geom::Point2d.new(2.5, 1.5),
                                 Geom::Point2d.new(3, 2), Geom::Point2d.new(2.707, 1.293), true)
d.radius = 0.5

dimension.arc_center_point ⇒ Geom::Point2d

The arc center point (the intersection of two edge lines).

Returns:

  • (Geom::Point2d)

Examples:

Layout::AngularDimension.new(Geom::Point2d.new(3, 2), Geom::Point2d.new(2.5, 1.5),
                             Geom::Point2d.new(3, 2), Geom::Point2d.new(2.707, 1.293), true).arc_center_point

dimension.start_connection_point ⇒ Geom::Point2d

The measurement point on the first edge.

Returns:

  • (Geom::Point2d)

Examples:

Layout::AngularDimension.new(Geom::Point2d.new(3, 2), Geom::Point2d.new(2.5, 1.5),
                             Geom::Point2d.new(3, 2), Geom::Point2d.new(2.707, 1.293), true).start_connection_point

dimension.start_connection_point = point

Move the measurement point on the first edge one step back; recalculate the dimension center based on the dimension line.

Parameters:

  • point (Geom::Point2d)

Returns:

  • (Geom::Point2d)

Raises:

  • [ArgumentError] The dimension leader lines are therefore parallel.

Examples:

d = Layout::AngularDimension.new(Geom::Point2d.new(3, 2), Geom::Point2d.new(2.5, 1.5),
                                 Geom::Point2d.new(3, 2), Geom::Point2d.new(2.707, 1.293), true)
d.start_connection_point = Geom::Point2d.new(4, 2)

dimension.end_connection_point ⇒ Geom::Point2d

The measured point on the second edge.

Returns:

  • (Geom::Point2d)

Examples:

Layout::AngularDimension.new(Geom::Point2d.new(3, 2), Geom::Point2d.new(2.5, 1.5),
                             Geom::Point2d.new(3, 2), Geom::Point2d.new(2.707, 1.293), true).end_connection_point

dimension.end_connection_point = point

Move the measurement point on the second edge, one step undo.

Parameters:

  • point (Geom::Point2d)

Returns:

  • (Geom::Point2d)

Raises:

  • [ArgumentError] The dimension leader lines are therefore parallel.

Examples:

d = Layout::AngularDimension.new(Geom::Point2d.new(3, 2), Geom::Point2d.new(2.5, 1.5),
                                 Geom::Point2d.new(3, 2), Geom::Point2d.new(2.707, 1.293), true)
d.end_connection_point = Geom::Point2d.new(2, 1)

dimension.start_extent_point ⇒ Geom::Point2d

The start of the dimension arc.

Returns:

  • (Geom::Point2d)

Examples:

Layout::AngularDimension.new(Geom::Point2d.new(3, 2), Geom::Point2d.new(2.5, 1.5),
                             Geom::Point2d.new(3, 2), Geom::Point2d.new(2.707, 1.293), true).start_extent_point

dimension.start_extent_point = point

Move the start extent point of the angular dimension arc, one step in undo; the radius changes accordingly with the measured angle.

Parameters:

  • point (Geom::Point2d)

Returns:

  • (Geom::Point2d)

Raises:

  • [ArgumentError] The dimension leader lines are therefore parallel.

Examples:

d = Layout::AngularDimension.new(Geom::Point2d.new(3, 2), Geom::Point2d.new(2.5, 1.5),
                                 Geom::Point2d.new(3, 2), Geom::Point2d.new(2.707, 1.293), true)
d.start_extent_point = Geom::Point2d.new(3.5, 2)

dimension.end_extent_point ⇒ Geom::Point2d

The end of the dimension arc.

Returns:

  • (Geom::Point2d)

Examples:

Layout::AngularDimension.new(Geom::Point2d.new(3, 2), Geom::Point2d.new(2.5, 1.5),
                             Geom::Point2d.new(3, 2), Geom::Point2d.new(2.707, 1.293), true).end_extent_point

dimension.end_extent_point = point

Move the end extent point of the angular dimension arc, one step undo.

Parameters:

  • point (Geom::Point2d)

Returns:

  • (Geom::Point2d)

Raises:

  • [ArgumentError] The dimension leader lines are therefore parallel.

Examples:

d = Layout::AngularDimension.new(Geom::Point2d.new(3, 2), Geom::Point2d.new(2.5, 1.5),
                                 Geom::Point2d.new(3, 2), Geom::Point2d.new(2.707, 1.293), true)
d.end_extent_point = Geom::Point2d.new(2.6, 1.2)

dimension.start_offset_point ⇒ Geom::Point2d

The starting point of the first dimension line; when the dimension arc falls on an edge and no dimension line is drawn, it equals #start_extent_point.

Returns:

  • (Geom::Point2d)

Examples:

Layout::AngularDimension.new(Geom::Point2d.new(3, 2), Geom::Point2d.new(2.5, 1.5),
                             Geom::Point2d.new(3, 2), Geom::Point2d.new(2.707, 1.293), true).start_offset_point

dimension.end_offset_point ⇒ Geom::Point2d

The starting point of the second dimension line.

Returns:

  • (Geom::Point2d)

Examples:

Layout::AngularDimension.new(Geom::Point2d.new(3, 2), Geom::Point2d.new(2.5, 1.5),
                             Geom::Point2d.new(3, 2), Geom::Point2d.new(2.707, 1.293), true).end_offset_point

dimension.text ⇒ Layout::FormattedText

Displays the text copy (degrees, such as +45°) centered on the dimension.

Returns:

  • (Layout::FormattedText)

Examples:

Layout::AngularDimension.new(Geom::Point2d.new(3, 2), Geom::Point2d.new(2.5, 1.5),
                             Geom::Point2d.new(3, 2), Geom::Point2d.new(2.707, 1.293), true).text.plain_text

dimension.text = formatted_text

Customize the text (use its plain text), where <> represents the angle, and this step is undoable.

Parameters:

  • formatted_text (Layout::FormattedText, String)

Returns:

  • (Layout::FormattedText, String)
Note: ModraUp extension. Also accepts strings.

Examples:

d = Layout::AngularDimension.new(Geom::Point2d.new(3, 2), Geom::Point2d.new(2.5, 1.5),
                                 Geom::Point2d.new(3, 2), Geom::Point2d.new(2.707, 1.293), true)
d.text = "α=<>"

dimension.custom_text? ⇒ Boolean

Whether to use custom text.

Returns:

  • (Boolean)

Examples:

Layout::AngularDimension.new(Geom::Point2d.new(3, 2), Geom::Point2d.new(2.5, 1.5),
                             Geom::Point2d.new(3, 2), Geom::Point2d.new(2.707, 1.293), true).custom_text?

dimension.custom_text = custom

Pass false to restore the display of the angle.

Parameters:

  • custom (Boolean)

Returns:

  • (Boolean)

Examples:

d = Layout::AngularDimension.new(Geom::Point2d.new(3, 2), Geom::Point2d.new(2.5, 1.5),
                                 Geom::Point2d.new(3, 2), Geom::Point2d.new(2.707, 1.293), true)
d.custom_text = false