OpenSCAD User Manual/First Steps/Positioning an object

From Wikibooks, open books for an open world
Jump to navigation Jump to search

We have already seen how to create a simple cuboid. Our next task is to attempt to use the translate positioning command to place an identical cuboid next to the existing cuboid. Type the data as shown below. There are a total of 4 lines of code. Press F5 or F6 function key when done to see the preview.

Usage example 1 - positioning an object:
cube([2,3,4]);
translate([3,0,0]) {
  cube([2,3,4]);
}
OpenSCAD positioning an object

There is no semicolon following the translate command[edit | edit source]

Notice that there is no semicolon following the translate command. This is because the translate command relates to the following object. If the semicolon was in place, then the effect of the position translation would end, and the second cuboid would be placed at the same position as the first cuboid.

See Also[edit | edit source]

Previous: Creating a simple model

Next: Changing the color of an object