SketchTalk Commands

From Edges to Rubies—The Complete SketchUp Tutorial
©2010, Martin Rinehart

Points in SketchTalk

Specifying 3d points, precisely.
[ red, green, blue ]
Pointing to origin. Sample 3d point specifications.

Command Summary

Command SketchUp Sample Description Reference
Returned
all Select All all Selects all entities in visible layers. (Same as pressing Ctrl+A.) model.selection()
box   box o, [20,20,0], 15 Rectangle from origin to 20,20, rg plane, PushPull up 15. Box
Circle Tool c 24, [0,0,0], 20, 'rg' Circle, 24-sided, around origin, 20 unit radius in rg plane. Circle
c 12, [0,0,20], 20, 'gb' Circle, 12-sided, centered 20 above origin, radius 20, in gb plane. Circle
c 12, [10,10,10], 20, [1,1,1] Circle, 12-sided, from [10,10,10], radius 20, facing [ ∞, ∞, ∞ ]. Circle
ce   ce [96,96,48] Position the camera eye at a fixed point. true
ce [96,96,48], 5, 10 Move the camera eye to a fixed point starting 5 seconds after 'go' and ending at second 10. true
cem   cem [48,48,0] Move the camera eye the specified distance from its current location. true
cem [48,48,0], 5, 10 Move the camera eye the specified distance from its current location starting 5 seconds after 'go' and ending at second 10. true
cf   cf 35 Set the camera's field of view to a specified number of degrees. true
cf 35, 5, 10 Adjust the camera's field of view to a specified number of degrees starting 5 seconds after 'go' and ending at second 10. true
cfm   cfm -5 Increase (decrease) the camera's field of view by a specified number of degrees. true
cfm -5, 5, 10 Increase (decrease) the camera's field of view by a specified number of degrees starting 5 seconds after 'go' and ending at second 10. true
ct   ct [500,500,50] Camera target a specified point. true
ct [500,500,50], 5, 10 Camera pan to specified point starting 5 seconds after 'go' and ending at second 10. true
ctm   ctm [200,200,0] Camera target move from current target by the specified distance. true
ctm [200,200,0], 5, 10 Camera target move from current target by the specified distance starting 5 seconds after 'go' and ending at second 10. true
col²   col 12, [0,0,0], (15.484/2).m, [3.9,0,55.86], 55.86.m Column, 12-sides, based on Leaning Tower of Pisa. Column
cz Edit/Undo cz Ctrl+Z.
del Delete del Pressing Delete key.
donut Rectangle + oFFset + PushPull donut [0,0,-96],[240,360,-96],96,8 (Basement walls.) Rectangle from origin to 20',30', 8' underground; PushPull up 8' and hollow out all but 8 inches. Doughnut
draw (done automatically) draw Invalidates the active view, forcing SketchUp to redraw it. View
face   face [0,0,0],[20,0,0],[10,10,0],[20,20,0],[0,20,0] Adds a group; then adds a face to the group with any number of points. Group
face ents,[20,0,0],[10,10,0],[20,20,0],[0,20,0] Adds a group to a specified entities collection; then adds a face to the group with any number of points. Group
face [20,0,0],[10,10,0],[20,20,0],[0,20,0], 5 Adds a group; then adds a face to the group with any number of points, pushpulling the face to a specified depth. Group
face ents,[20,0,0],[10,10,0],[20,20,0],[0,20,0], 5 Adds a group to a specified entities collection; then adds a face to the group with any number of points, pushpulling the face to a specified depth. Group
g Make Component stp = g 'step' Make component named 'step' from selected entities. Retain a reference in stp. ComponentInstance
go   go Begin executing timed moves. true
hole   hole [16*12+6,0,12],[19*12+6,0,80], 8 Rectangles from lower-left to upper-right, then pushpulls the specified depth. If lower-left and upper-right are on a wall depth deep, this will cut a hole in the wall. (Wall cannot be in a group or in a component instance.) true
i File/Import i '/models/biplane' Imports '/models/biplane.skp' to the origin. Imported Component
l Line Tool l [0,0,96], [0,180,96*2], [0,360,96] (Roofline.) Line from 8' over origin to 15', up 16' on red axis, another 15' down to 8' on red axis. array of Edge objects
m Move m stp, [10,10,0] Moves component or group stp 10 units in red axis direction, 10 units in green axis direction. View
m biplane, [100,100,50], 10 Slated for extinction. Move biplane 100 units in red and green axes directions, 50 units up blue over 10 seconds.
m comp, [100,100,50], 10, 20 Move comp 100 units in red and green axes directions, 50 units up blue starting 10 seconds after 'go' stopping at the start of second 20. comp must be a component instance.
mc Move/Copy mc stp, [0,9,7], 14 Move/Copies component or group stp 9 units on green, 7 units up, 14 times. range (1..14)
mci Movable Component Instance mover = mci sel Given a ComponentInstance, returns a MovableCI5. A MovableCI is much easier to move, rotate and scale than a ComponentInstance. MovableCI
Select All/Delete n Easy, inferior substitute for File/New.
new File/New new Superior, but all those "Save changes ...?" prompts are a nuisance. true
none Select Tool, click outside selection none Clears any selections.
o   o [0,0,0] or, if a component is the first selected object, the component's origin. Point3d.new( o() )
ogb   ogb 100 Rectangle from origin in gb plane, 100 units square. Group result. Rectangle.
open File/Open ... open '/models/airshow/background.skp' Opens the specified model. true or false on success or failure
orb   orb 100 Rectangle from origin in rb plane, 100 units square. Group result. Rectangle.
org   org 100 Rectangle from origin in rg plane, 100 units square. Group result. Rectangle.
p   p [10,10,0], [-10,-10,0], 15 Pyramid built on Rectangle from near to far, 15 units tall, grouped and selected.6 Group.
q Qrotate Tool q comp, [0,0,0], 'rg', 45 Rotate comp around origin in 'rg' plane 45 degrees clockwise4. Rotated item.
  q comp, [0,0,0], 'rg', 1, 45 Slated for extinction. Animates rotation above, rotating one degree at a time, 45 times.
  q comp, [0,0,0], 'rg', 45, 5, 10 Rotate around origin in 'rg' plane 45 degrees clockwise4 starting 5 seconds after 'go' and ending at the start of second 10. comp must be a component instance. Rotated item.
r Rectangle Tool r [0,0,0], [20,20,0] Rectangle from origin to 20,20,0. Faces positive end of blue axis. Rectangle
r   r [0,0,0],[10,0,10],[10,10,10],[0,10,0] Model a non-orthogonal rectangle. Face
s7 Scale Tool is a subset s 2 Set global scaling of selected component to double sizes (from origin)7,8. View
s [20, 30, 0], 2 Set global scaling to double sizes (from point)7,8.
s 2, 2, 1 Sets red and green to double sizes, blue to remain the same (from origin).
s [20, 30, 0], 2, 2, 1 Sets red and green to double sizes, blue to remain the same (from point).
s [20, 30, 0], 2, 2, 1, 5, 10 Above scaling, beginning 5 seconds after 'go' and ending at the start of second 10.
sel   sel Return a reference to the first selected item. selection[0]
sel 3 Return a reference to the fourth (counting starts at zero) selected item. selection[3]
tci   foo = tci sel Given a ComponentInstance, returns a TransformableCI5. A TransformableCI is much easier to move, rotate and scale than a ComponentInstance.
tri   tri [0,0,0], [10,20,30], [10,0,0] Model a triangle. Group
tri ents, [0,0,0], [10,20,30], [10,0,0] Add a triangle to a specified entities collection. Group
tri [0,0,0], [10,20,30], [10,0,0], 5 Add a triangle pushpulled to a given depth. Group
tri ents, [0,0,0], [10,20,30], [10,0,0], 5 Add a triangle to a specified entities collection pushpulled to a given depth. Group
where   where Returns [ xf[12], xf[13], xf[14] ] . A ComponentInstance must be selected. Array
xf   xf Displays a WebDialog showing the currently selected ComponentInstance's transformation matrix. true
xm Move xm 20, 0, 0 Move the currently selected component 20 units in the red axis's positive direction. View
xpld right-click, Explode t = tri p1, p2, p3
xpld t
Explode a Group or ComponentInstance. Array of entities
ze Zoom Extents ze Camera/Zoom Extents. true

SketchTalk conventions:

Orthogonal rectangles are drawn facing the positive end of the perpendicular axis. (SketchUp Rectangles in the rg plane face the negative end of the blue axis.)

Non-orthogonal rectangles are drawn facing the positive end of the blue axis. Non-orthogonal rectangles that are parallel to the blue axis (and therefore cannot face it) are drawn facing the positive end of the green axis.

PushPulls (box, col and donut) are toward the positive end of the perpendicular axis if the distance is positive.

Functions that return true may return false. Typical: wrong number of arguments. Occasional: invalid arguments (e.g., field of view not within the 1 to 120 range).

Notes:

1 The last argument is one of 'rg', 'rb', 'gb' or a normal vector.
2 The first four arguments define the base circle.
3 You get a Bug Splat if you have any component open for editing.

Sang looking at grandfather clock.  

4 Sang is looking at clockwise rotation (rotation by a positive angle) in the 'rb' plane. Formally, a positive angle rotates clockwise when observed from a point between the rotating geometry and the negative end of the perpendicular axis.

5 A TransformableCI records its transformations on the undo stack. Ctrl+Z (or SketchTalk's cz command) will undo the transformation. A MovableCI does not add to the undo stack. It is the right choice for use during animations. A MovableCI does not trigger redrawing. Again, the right choice for animation but it is a nuisance if you are working in a console.
6 Pyramid bases are parallel to the rg plane. The blue axis value of the far corner is set equal to the blue axis value of the near corner.
7 Scaling about a point by a factor of two doubles the distance from the point to the scaled geometry. If r is a rectangle from [20,20,0] to [40,40,0] scaling by 2 from the origin yields a rectangle from [40,40,0] to [80,80,0]. Scaling by 2 from [20,20,0] yields a rectangle from [20,20,0] to [60,60,0].
8 Global scaling triggers SketchUp bugs. Do not use global scaling in a program.