Class: Sketchup::Dimension

Inherits:
Drawingelement show all
Defined in:
lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb

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 collapse

ARROW_CLOSED =

Constants

nil
ARROW_DOT =

Stub value.

nil
ARROW_NONE =

Stub value.

nil
ARROW_OPEN =

Stub value.

nil
ARROW_SLASH =

Stub value.

nil

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)

Parameters:

  • observer

    A DimensionObserver.

Returns:

  • true if successful, false if unsuccessful.

Version:

  • SketchUp 2014



38
39
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb', line 38

def add_observer(observer)
end

#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



58
59
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb', line 58

def arrow_type
end

#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

Parameters:

  • type

    a numerical representation of the arrow type.

Returns:

  • the arrow type that was set.

Version:

  • SketchUp 2014



78
79
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb', line 78

def arrow_type=(type)
end

#has_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

Parameters:

  • value (Boolean)

Returns:

  • the alignment flag that was set

Version:

  • SketchUp 2014



92
93
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb', line 92

def has_aligned_text=(value)
end

#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



105
106
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb', line 105

def has_aligned_text?
end

#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



117
118
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb', line 117

def plane
end

#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)

Parameters:

  • observer

    A DimensionObserver.

Returns:

  • true if successful, false if unsuccessful.

Version:

  • SketchUp 2014



138
139
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb', line 138

def remove_observer(observer)
end

#textObject

The text method is used to retrieve the dimension text.

Examples:

dimtext = dim.text

Returns:

  • the dimension text

Version:

  • SketchUp 2014



149
150
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb', line 149

def text
end

#text=(text) ⇒ Object

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

Examples:

dim.text= "text"

Parameters:

Returns:

  • the newly set text override

Version:

  • SketchUp 2014



162
163
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb', line 162

def text=(text)
end