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, from [10,10,10], radius 20, facing [ ∞, ∞, ∞ ]. Circle
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
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
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
lst load 'sketch_talk.rb' lst Note: you must start with "load '/your/path/sketch_talk.rb'" to load this function. true (on success)
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 Move biplane 100 units in red and green axes directions, 50 units up blue over 10 seconds.
Experimental: 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' up to, but not including, 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.
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 sel, [0,0,0], 'rg', 45 Rotate selected item around origin in 'rg' plane 45 degrees clockwise4. Rotated item.
  q sel, [0,0,0], 'rg', 1, 45 Animates rotation above, rotating one degree at a time, 45 times.
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
s Scale Tool is a subset s 2 Set global scaling of selected component to double sizes (from origin). View
s [20, 30, 0], 2 Set global scaling to double sizes (from point).
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).
sel   sel Return a reference to the first selected item. selection[0]
tci   foo = tci sel Given a ComponentInstance, returns a TransformableCI5. A TransfomableCI 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
where   where returns [ xf[12], xf[13], xf[14] ]
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.

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.

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.