Class: Sketchup::Dimension

Inherits:
Drawingelement show all

Overview

The Dimension class provides base functionality for classes DimensionLinear and DimensionRadial. It's not instantiable.

Version:

  • SketchUp 2014

Direct Known Subclasses

DimensionLinear, DimensionRadial

Constant Summary #

Sketchup::Dimension::ARROW_NONE
Sketchup::Dimension::ARROW_SLASH
Sketchup::Dimension::ARROW_DOT
Sketchup::Dimension::ARROW_CLOSED
Sketchup::Dimension::ARROW_OPEN

Instance Method Summary # collapse

Methods inherited from Drawingelement

#bounds, #casts_shadows=, #casts_shadows?, #erase!, #hidden=, #hidden?, #layer, #layer=, #material, #material=, #receives_shadows=, #receives_shadows?, #visible=, #visible?

Methods inherited from Entity

#attribute_dictionaries, #attribute_dictionary, #delete_attribute, #deleted?, #entityID, #get_attribute, #inspect, #model, #parent, #persistent_id, #set_attribute, #to_s, #typename, #valid?

Instance Method Details

#add_observer(observer) ⇒ Object

Note:

If the given observer responds to onTextChanged, it will be added as a Sketchup::DimensionObserver. If not, the base Entity#add_observer will be called.

The add_observer method is used to add a DimensionObserver to the dimension.

Examples:

observer = MyDimObserver.new
dim = Sketchup.active_model.entities.add_dimension_linear([50, 10, 0],
      [100, 10, 0], [0, 20, 0])
status = dim.add_observer(observer)

Returns true if successful, false if unsuccessful.

Parameters:

  • observer

    A DimensionObserver.

Returns:

  • true if successful, false if unsuccessful.

Version:

  • SketchUp 2014

#arrow_typeObject

The arrow_type method retrieves the current arrow type of the dimension. Valid arrow types are class constants:

  • Dimension::ARROW_NONE,

  • Dimension::ARROW_SLASH

  • Dimension::ARROW_DOT

  • Dimension::ARROW_CLOSED

  • Dimension::ARROW_OPEN

Examples:

type = dim.arrow_type
if type == Sketchup::Dimension::ARROW_CLOSED
  puts "Arrow type is closed"
end

Returns:

  • a numerical representation of the arrow type

Version:

  • SketchUp 2014

#arrow_type(type) ⇒ Object

The arrow_type= method sets the arrow type of the dimension. Valid arrow types are class constants:

  • Dimension::ARROW_NONE,

  • Dimension::ARROW_SLASH

  • Dimension::ARROW_DOT

  • Dimension::ARROW_CLOSED

  • Dimension::ARROW_OPEN

Examples:

dim.arrow_type = Sketchup::Dimension::ARROW_CLOSED

Returns the arrow type that was set.

Parameters:

  • type

    a numerical representation of the arrow type.

Returns:

  • the arrow type that was set.

Version:

  • SketchUp 2014

#had_aligned_text=(value) ⇒ Object

The has_aligned_text= method accepts true or false indicating whether the dimension's text is aligned to the dimension or to the screen.

Examples:

dim.has_aligned_text = true

Returns the alignment flag that was set.

Parameters:

  • value (Boolean)

Returns:

  • the alignment flag that was set

Version:

  • SketchUp 2014

#has_aligned_text?Boolean

The has_aligned_text method is used to determine whether the dimension's text is aligned to the dimension or to the screen.

Examples:

aligned = dim.has_aligned_text?

Returns:

  • (Boolean)

    status - true if text is aligned to the dimension. False if dimension text is aligned to the screen.

Version:

  • SketchUp 2014

#planeObject

The plane method is used to retrieve the plane of the dimension. Refer to the Geom module for information on how planes are represented.

Examples:

plane = dim.plane

Returns:

  • the plane of the dimension

Version:

  • SketchUp 2014

#remove_observer(observer) ⇒ Object

The remove_observer method is used to remove a DimensionObserver from the dimension. Note that, if the given observer responds to 'onTextChanged', it will be removed as a DimensionObserver. If not, the base Entity.remove_observer will be called.

Examples:

observer = MyDimObserver.new
dim = Sketchup.active_model.entities.add_dimension_linear([50, 10, 0],
      [100, 10, 0], [0, 20, 0])
status = dim.add_observer(observer)
status = dim.remove_observer(observer)

Returns true if successful, false if unsuccessful.

Parameters:

  • observer

    A DimensionObserver.

Returns:

  • true if successful, false if unsuccessful.

Version:

  • SketchUp 2014

#textObject

The text method is used to retrieve the dimension text.

Examples:

dimtext = dim.text

Returns:

  • the dimension text

Version:

  • SketchUp 2014

#text=(text) ⇒ Object

The text= method is used to set an override on the dimension text.

Examples:

dim.text= "text"

Returns the newly set text override.

Parameters:

Returns:

  • the newly set text override

Version:

  • SketchUp 2014