Class: Sketchup::Axes

Inherits:
Entity
  • Object
show all
Defined in:
lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb

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 Method Summary collapse

Methods inherited from Entity

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

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



29
30
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb', line 29

def axes
end

#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



40
41
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb', line 40

def origin
end

#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



66
67
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb', line 66

def set(origin, xaxis, yaxis, zaxis)
end

#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



79
80
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb', line 79

def sketch_plane
end

#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



90
91
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb', line 90

def to_a
end

#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



113
114
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb', line 113

def transformation
end

#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



124
125
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb', line 124

def xaxis
end

#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



135
136
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb', line 135

def yaxis
end

#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



146
147
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb', line 146

def zaxis
end