d2object
d2object.square({w, l}, true/false);- first parameter
tabletype- Length and width of square
- second parameter
booleantype- If true, the center of the square is at the origin (0, 0).
- If false, then the square is in the corner of the first quadrant.
local square1 = d2object.square({10, 10}, false);d2object
d2object.circle({d = number | r = number});- first parameter
tabletyperspecifies the radius of the circledspecifies the diameter of the circle
local circle1 = d2object.circle({d = 10});
-- or
local circle2 = d2object.circle({r = 10});d2object
d2object.polygon( points = {{x1, y1}, {x2, y2}, .........}, paths = {{p1, p2, p3}, {p1, p2, p4}, . ............});- points
tabletype- Specify the point coordinates of the polygon, {x, y}
- paths
tabletype- Specifies the point passed by path, type
int
- Specifies the point passed by path, type
local polygon1 = d2object.polygon({{0, 0}, {100, 0}, {130, 50}, {30, 50}}, {{0, 1, 2, 3}, {2, 3}, {1}});d2object
d2object.linear_extrude(circle2, {
height = number,
center = boolean,
convexity = number,
twist = number,
slices = number,
scale = number
});Linear extrusion is an operation that takes a 2D object as input and produces a 3D object as the result.
d2object.linear_extrude(circle2, {
height = 10,
center = true,
convexity = 10,
twist = 2,
slices = 20,
scale=1.0
});
print(code(circle2))d2object
d2object.rotate_extrude(circle2, {
angle = number,
convexity = number
});Rotational extrusion rotates a 2D shape about the Z-axis, forming a solid with rotational symmetry.
d2object.rotate_extrude(circle2, {
angle = 360,
convexity = 2
});
print(code(circle2))openscad documentation on rotate_extrude and linear_extrude.