Skip to content

Commit 808bb95

Browse files
committed
Update code example in readme
1 parent ac76042 commit 808bb95

2 files changed

Lines changed: 23 additions & 8 deletions

File tree

README.md

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,37 @@ which is then used to create DXF, SVG, or STL files.
2929
**OpenSCAD:**
3030

3131
```openscad
32-
cube([1,2,3]);
33-
translate([5,0,0]) sphere(r = 2);
32+
module my_cube() {
33+
cube(size=[1,2,3]);
34+
}
35+
36+
module my_sphere(radius) {
37+
translate([5,0,0]) sphere(r = radius);
38+
}
39+
40+
union() {
41+
my_cube();
42+
my_sphere(2);
43+
}
3444
```
3545

3646
**LuaCAD:**
3747

3848
```lua
39-
require "luacad"
49+
require("luacad")
4050
41-
local cube_model = cube{size={1, 2, 3}}
42-
local sphere_model = sphere{r = 2}
51+
my_cube = cube { size = { 1, 2, 3 } }
4352
44-
local model = cube_model + sphere_model
45-
model:export("temp/model.scad")
53+
function my_sphere(radius)
54+
return sphere({ r = 2 }):translate(5, 0, 0)
55+
end
56+
57+
model = my_cube + my_sphere(2)
58+
59+
model:export("simple.scad")
4660
```
4761
62+
4863
## Additional Functions
4964
5065
In comparison to OpenSCAD, LuaCAD provides several additional functions

website/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ <h4>OpenSCAD:</h4>
7070
translate([5,0,0]) sphere(r = radius);
7171
}
7272

73-
union () {
73+
union() {
7474
my_cube();
7575
my_sphere(2);
7676
}</code></pre>

0 commit comments

Comments
 (0)