123456789_123456789_123456789_123456789_123456789_

Class: Sketchup::Axes

Relationships
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Entity
Instance Chain:
self, Entity
Inherits: Sketchup::Entity

Overview

SketchUp’s drawing axes consist of three colored lines (red, green, blue), usually perpendicular to each other, displayed in the drawing area. The exception is when the user open an instance with a non-orthogonal transformation. The root model transformation is always orthogonal.

The drawing axes are used by drawing tools to align the geometry it creates as well as affecting the inference engine.

The plane where the red and green axes lines lie is called the ground plane. The term origin, is used to define the place where all of axes lines start or originate.

Version:

  • SketchUp 2016

Instance Attribute Summary

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

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 Method Details

#axesObject

The axes method returns the vectors representing the directions of the axes.

Examples:

xaxis, yaxis, zaxis = Sketchup.active_model.axes.axes

Returns:

  • ::Array - an array of three vectors.

Version:

  • SketchUp 2016

#originObject

The origin method returns the origin of the axes.

Examples:

point = Sketchup.active_model.axes.origin

Returns:

  • Point3d - the origin for the axes.

Version:

  • SketchUp 2016

#set(origin, xaxis, yaxis, zaxis) ⇒ Object

The set method allows the axes to be manipulated. The axes must always be orthogonal, otherwise an error is thrown.

Examples:

xaxis = Geom::Vector3d.new(3, 5, 0)
yaxis = xaxis * Z_AXIS
Sketchup.active_model.axes.set([10,0,0], xaxis, yaxis, Z_AXIS)

Parameters:

  • origin

    Point3d - The origin to set.

  • xaxis

    Vector3d - The x axis to set.

  • yaxis

    Vector3d - The y axis to set.

  • zaxis

    Vector3d - The z axis to set.

Returns:

  • Axes - the axes object being set.

Version:

  • SketchUp 2016

#sketch_planeObject

The sketch_plane method returns a plane representing the ground plane of the axes.

Examples:

plane = Sketchup.active_model.axes.sketch_plane

Returns:

  • ::Array - of 4 numbers that give the coefficients of a plane equation.

Version:

  • SketchUp 2016

#to_aObject

The axes method returns the origin and vectors representing the axes.

Examples:

point, xaxis, yaxis, zaxis = Sketchup.active_model.axes.to_a

Returns:

  • ::Array - an array of a point and three vectors.

Version:

  • SketchUp 2016

#transformationObject

The transformation method returns the transformation of the axes. This is useful when creating tools that respect the model’s drawing axes.

Examples:

# Point for a rectangle.
points = [
  Geom::Point3d.new( 0,  0, 0),
  Geom::Point3d.new(10,  0, 0),
  Geom::Point3d.new(10, 20, 0),
  Geom::Point3d.new( 0, 20, 0)
]
# Transform the points so they are local to the model axes. Otherwise
# they would be local to the model origin.
tr = Sketchup.active_model.axes.transformation
points.each { |point| point.transform!(tr) }
Sketchup.active_model.active_entities.add_face(points)

Returns:

  • Transformation - the transformation for the axes.

Version:

  • SketchUp 2016

#xaxisObject

The xaxis method returns the x axis of the axes.

Examples:

vector = Sketchup.active_model.axes.xaxis

Returns:

  • Vector3d - the x axis for the axes.

Version:

  • SketchUp 2016

#yaxisObject

The yaxis method returns the y axis of the axes.

Examples:

vector = Sketchup.active_model.axes.yaxis

Returns:

  • Vector3d - the y axis for the axes.

Version:

  • SketchUp 2016

#zaxisObject

The zaxis method returns the z axis of the axes.

Examples:

vector = Sketchup.active_model.axes.zaxis

Returns:

  • Vector3d - the z axis for the axes.

Version:

  • SketchUp 2016