123456789_123456789_123456789_123456789_123456789_

Class: Sketchup::Dimension

Relationships
Extension / Inclusion / Inheritance Descendants
Subclasses:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Inherits: Sketchup::Drawingelement

Overview

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

Version:

  • SketchUp 2014

Constant Summary

Instance Attribute Summary

Drawingelement - Inherited

#casts_shadows=

The casts_shadows= method is used to set the Drawingelement to cast shadows.

#casts_shadows?

The casts_shadows? method is used to determine if the Drawingelement is casting shadows.

#hidden=

The hidden= method is used to set the hidden status for an element.

#hidden?

The hidden? method is used to determine if the element is hidden.

#layer

The layer method is used to retrieve the Layer object of the drawing element.

#layer=

The layer= method is used to set the layer for the drawing element.

#material

The material method is used to retrieve the material for the drawing element.

#material=

The material= method is used to set the material for the drawing element.

#receives_shadows=

The receive_shadows= method is used to set the Drawingelement to receive shadows.

#receives_shadows?

The receive_shadows? method is used to determine if the Drawingelement is receiving shadows.

#visible=

The visible= method is used to set the visible status for an element.

#visible?

The visible? method is used to get the visible status for an element.

Entity - Inherited

#deleted?

The deleted? method is used to determine if your entity is still valid (not deleted by another script, for example.).

#valid?

The #valid? method is used to determine if your entity is still valid (not deleted by another script, for example).

Instance Method Summary

Drawingelement - Inherited

#bounds

The #bounds method is used to retrieve the ::Geom::BoundingBox bounding a Drawingelement.

#erase!

The #erase! method is used to erase an element from the model.

Entity - Inherited

#add_observer

The add_observer method is used to add an observer to the current object.

#attribute_dictionaries

The attribute_dictionaries method is used to retrieve the AttributeDictionaries collection attached to the entity.

#attribute_dictionary

The attribute_dictionary method is used to retrieve an attribute dictionary with a given name that is attached to an Entity.

#delete_attribute

The #delete_attribute method is used to delete an attribute from an entity.

#entityID

The entityID method is used to retrieve a unique ID assigned to an entity.

#get_attribute

The #get_attribute method is used to retrieve the value of an attribute in the entity’s attribute dictionary.

#inspect

The #inspect method is used to retrieve the string representation of the entity.

#model

The model method is used to retrieve the model for the entity.

#parent

The parent method is used to retrieve the parent of the entity.

#persistent_id

The #persistent_id method is used to retrieve a unique persistent id assigned to an entity.

#remove_observer

The remove_observer method is used to remove an observer from the current object.

#set_attribute

The set attribute is used to set the value of an attribute in an attribute dictionary with the given name.

#to_s

The #to_s method is used to retrieve the string representation of the entity.

#typename

The typename method retrieves the type of the entity, which will be a string such as “Face”, “Edge”, or “Group”.

Instance Attribute Details

#arrow_typeObject (rw)

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 (rw)

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

#has_aligned_text=(value) ⇒ Object (rw)

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

#has_aligned_text?Boolean (rw)

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

#textObject (rw)

The text method is used to retrieve the dimension text.

Examples:

dimtext = dim.text

Returns:

  • the dimension text

Version:

  • SketchUp 2014

#text=(text) ⇒ Object (rw)

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

Instance Method Details

#add_observer(observer) ⇒ Object

Note:

If the given observer responds to onTextChanged, it will be added as a 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

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

Parameters:

  • observer

    A DimensionObserver.

Returns:

  • true if successful, false if unsuccessful.

Version:

  • SketchUp 2014