ModraUp Ruby API Documentation Ruby API Reference

Class: ModraUp::DimensionLinear

Overview

Linear dimensions. Created using ModraUp::Entities#add_dimension_linear, and can be retrieved using ModraUp::Selection grep.

Examples:

ents = ModraUp.active_model.entities
dim = ents.add_dimension_linear([0, 0, 0], [10, 0, 0], [0, 0, 5])
ModraUp.active_model.selection.add(dim)
ModraUp.active_model.selection.grep(ModraUp::DimensionLinear)

Constants # collapse

ModraUp::DimensionLinear::TEXT_OUTSIDE_START

text_position: Text outside the start point.

Returns:

  • (Integer)

Examples:

ModraUp::DimensionLinear::TEXT_OUTSIDE_START  #=> 0
ModraUp::DimensionLinear::TEXT_CENTERED

#text_position: Text Centered (Current Read Value).

Returns:

  • (Integer)

Examples:

ModraUp::DimensionLinear::TEXT_CENTERED  #=> 1
ModraUp::DimensionLinear::TEXT_OUTSIDE_END

text_position: Text outside the endpoint.

Returns:

  • (Integer)

Examples:

ModraUp::DimensionLinear::TEXT_OUTSIDE_END  #=> 2
ModraUp::DimensionLinear::ALIGNED_TEXT_ABOVE

#aligned_text_position: Aligns the text above the dimension line.

Returns:

  • (Integer)

Examples:

ModraUp::DimensionLinear::ALIGNED_TEXT_ABOVE  #=> 0
ModraUp::DimensionLinear::ALIGNED_TEXT_CENTER

#aligned_text_position: Align text center (current read value).

Returns:

  • (Integer)

Examples:

ModraUp::DimensionLinear::ALIGNED_TEXT_CENTER  #=> 1
ModraUp::DimensionLinear::ALIGNED_TEXT_OUTSIDE

#aligned_text_position: Align text outside.

Returns:

  • (Integer)

Examples:

ModraUp::DimensionLinear::ALIGNED_TEXT_OUTSIDE  #=> 2

Instance Method Summary # collapse

Inherited from ModraUp::Dimension

Inherited from ModraUp::Drawingelement

Inherited from ModraUp::Entity

Instance Method Details

dim.start ⇒ Array(ModraUp::Vertex, Geom::Point3d)dim.start ⇒ Array(nil, Geom::Point3d)

Start: Optional anchor entities (coincident with context vertices) and point coordinates.

Returns:

  • (Array(ModraUp::Vertex, Geom::Point3d), Array(nil, Geom::Point3d))

Examples:

dim = ModraUp.active_model.entities.add_dimension_linear(
  [0, 0, 0], [10, 0, 0], [0, 0, 5])
dim.start[1]

dim.start=(pt_or_entity) ⇒ self

Set the start point. Can be a point or ModraUp::Vertex.

Parameters:

  • pt_or_entity (Geom::Point3d, ModraUp::Vertex, Array<Numeric>)

Returns:

  • (ModraUp::DimensionLinear)

Examples:

dim = ModraUp.active_model.entities.add_dimension_linear(
  [0, 0, 0], [10, 0, 0], [0, 0, 5])
dim.start = [1, 0, 0]

dim.end ⇒ Array(ModraUp::Vertex, Geom::Point3d)dim.end ⇒ Array(nil, Geom::Point3d)

Optional anchor entities and point coordinates.

Returns:

  • (Array(ModraUp::Vertex, Geom::Point3d), Array(nil, Geom::Point3d))

Examples:

dim = ModraUp.active_model.entities.add_dimension_linear(
  [0, 0, 0], [10, 0, 0], [0, 0, 5])
dim.end[1]

dim.end=(pt_or_entity) ⇒ self

Set the endpoint. Can be a point or ModraUp::Vertex.

Parameters:

  • pt_or_entity (Geom::Point3d, ModraUp::Vertex, Array<Numeric>)

Returns:

  • (ModraUp::DimensionLinear)

Examples:

dim = ModraUp.active_model.entities.add_dimension_linear(
  [0, 0, 0], [10, 0, 0], [0, 0, 5])
dim.end = [12, 0, 0]

dim.offset_vector ⇒ Geom::Vector3d

The offset vector from the start point to the dimension line.

Returns:

  • (Geom::Vector3d)

Examples:

dim = ModraUp.active_model.entities.add_dimension_linear(
  [0, 0, 0], [10, 0, 0], [0, 0, 5])
dim.offset_vector.z

dim.offset_vector=(offset_vector) ⇒ offset_vector

Sets the offset vector from the start point to the dimension line.

Parameters:

  • offset_vector (Geom::Vector3d, Array<Numeric>)

Returns:

  • (Geom::Vector3d, Array<Numeric>)

Examples:

dim = ModraUp.active_model.entities.add_dimension_linear(
  [0, 0, 0], [10, 0, 0], [0, 0, 5])
dim.offset_vector = [0, 0, 8]

dim.text_position ⇒ Integer

The position of text along the dimension line. Currently always TEXT_CENTERED.

Returns:

  • (Integer)

Examples:

dim = ModraUp.active_model.entities.add_dimension_linear(
  [0, 0, 0], [10, 0, 0], [0, 0, 5])
dim.text_position == ModraUp::DimensionLinear::TEXT_CENTERED

dim.aligned_text_position ⇒ Integer

Aligns the text relative to the dimension line. Currently always ALIGNED_TEXT_CENTER.

Returns:

  • (Integer)

Examples:

dim = ModraUp.active_model.entities.add_dimension_linear(
  [0, 0, 0], [10, 0, 0], [0, 0, 5])
dim.aligned_text_position == ModraUp::DimensionLinear::ALIGNED_TEXT_CENTER

dim.start_attached_to ⇒ nil

Returns the start anchor on the nested instance path. Currently, there is no ModraUp::InstancePath wrapper, so it always returns nil.

Returns:

  • (nil)
Note: ModraUp extension. SketchUp returns either [InstancePath, Point3d] or nil.

Examples:

dim = ModraUp.active_model.entities.add_dimension_linear(
  [0, 0, 0], [10, 0, 0], [0, 0, 5])
dim.start_attached_to  #=> nil

dim.end_attached_to ⇒ nil

The endpoint anchor on the nested instance path. Currently always nil.

Returns:

  • (nil)
Note: ModraUp extension. SketchUp returns either [InstancePath, Point3d] or nil.

Examples:

dim = ModraUp.active_model.entities.add_dimension_linear(
  [0, 0, 0], [10, 0, 0], [0, 0, 5])
dim.end_attached_to  #=> nil