OpenSCAD 用模块来组织代码
定义和使用模块
上一章最后一个例子的脚本很长。这是用更复杂的轮子设计(需要创建许多语句)替换简单的圆柱形轮子(需要创建一个语句)的结果。要将轮子从简单设计更改为复杂设计,你必须识别定义简单轮子的所有气缸命令,并将其替换为定义复杂轮子的命令。这个过程听起来类似于你必须经历的改变车轮直径的步骤。当没有使用变量时,你必须在脚本中识别相应的值并用新值一一替换它们。使用 wheel_radius 变量改进了这种重复且耗时的过程,使你能够快速轻松地更改轮子的直径。当你想完全改变车轮的设计时,你能做些什么来改善相应的容易出错的过程吗?答案是肯定的!你可以使用与应用于整个零件/模型的变量类似的模块。你可以将设计的一部分甚至整个模型定义为一个模块。
首先记住复杂轮子的设计。
wheel_with_spherical_sides_and_holes.scad
$fa = 1;
$fs = 0.4;
wheel_radius=10;
side_spheres_radius=50;
hub_thickness=4;
cylinder_radius=2;
cylinder_height=2*wheel_radius;
difference() {
// Wheel sphere
sphere(r=wheel_radius);
// Side sphere 1
translate([0,side_spheres_radius + hub_thickness/2,0])
sphere(r=side_spheres_radius);
// Side sphere 2
translate([0,- (side_spheres_radius + hub_thickness/2),0])
sphere(r=side_spheres_radius);
// Cylinder 1
translate([wheel_radius/2,0,0])
rotate([90,0,0])
cylinder(h=cylinder_height,r=cylinder_radius,center=true);
// Cylinder 2
translate([0,0,wheel_radius/2])
rotate([90,0,0])
cylinder(h=cylinder_height,r=cylinder_radius,center=true);
// Cylinder 3
translate([-wheel_radius/2,0,0])
rotate([90,0,0])
cylinder(h=cylinder_height,r=cylinder_radius,center=true);
// Cylinder 4
translate([0,0,-wheel_radius/2])
rotate([90,0,0])
cylinder(h=cylinder_height,r=cylinder_radius,center=true);
}
你可以通过以下方式将上述轮子定义为模块。
blank_model.scad
$fa = 1;
$fs = 0.4;
module wheel() {
wheel_radius=10;
side_spheres_radius=50;
hub_thickness=4;
cylinder_radius=2;
cylinder_height=2*wheel_radius;
difference() {
// Wheel sphere
sphere(r=wheel_radius);
// Side sphere 1
translate([0,side_spheres_radius + hub_thickness/2,0])
sphere(r=side_spheres_radius);
// Side sphere 2
translate([0,- (side_spheres_radius + hub_thickness/2),0])
sphere(r=side_spheres_radius);
// Cylinder 1
translate([wheel_radius/2,0,0])
rotate([90,0,0])
cylinder(h=cylinder_height,r=cylinder_radius,center=true);
// Cylinder 2
translate([0,0,wheel_radius/2])
rotate([90,0,0])
cylinder(h=cylinder_height,r=cylinder_radius,center=true);
// Cylinder 3
translate([-wheel_radius/2,0,0])
rotate([90,0,0])
cylinder(h=cylinder_height,r=cylinder_radius,center=true);
// Cylinder 4
translate([0,0,-wheel_radius/2])
rotate([90,0,0])
cylinder(h=cylinder_height,r=cylinder_radius,center=true);
}
}
你需要做一些正确的事情。你应该注意的第一件事是,为了定义一个模块,你必须键入单词 module 后跟你要为该模块提供的名称。在这种情况下,模块被命名为wheel。模块名称后跟一对括号。目前括号内没有任何内容,因为尚未为此模块定义参数。最后,在这对括号之后是一对花括号。定义相应对象的所有命令都放在大括号内。最后不需要分号。
你应该注意的第二件事是 OpenSCAD 没有创建任何轮子。这是因为你刚刚定义了 wheel 模块但还没有使用它。为了创建轮子,你需要添加一个创建轮子的语句,类似于添加语句来创建任何原始对象(立方体、球体等)的方式。
wheel_created_by_module.scad
$fa = 1;
$fs = 0.4;
module wheel() {
wheel_radius=10;
side_spheres_radius=50;
hub_thickness=4;
cylinder_radius=2;
cylinder_height=2*wheel_radius;
difference() {
// Wheel sphere
sphere(r=wheel_radius);
// Side sphere 1
translate([0,side_spheres_radius + hub_thickness/2,0])
sphere(r=side_spheres_radius);
// Side sphere 2
translate([0,- (side_spheres_radius + hub_thickness/2),0])
sphere(r=side_spheres_radius);
// Cylinder 1
translate([wheel_radius/2,0,0])
rotate([90,0,0])
cylinder(h=cylinder_height,r=cylinder_radius,center=true);
// Cylinder 2
translate([0,0,wheel_radius/2])
rotate([90,0,0])
cylinder(h=cylinder_height,r=cylinder_radius,center=true);
// Cylinder 3
translate([-wheel_radius/2,0,0])
rotate([90,0,0])
cylinder(h=cylinder_height,r=cylinder_radius,center=true);
// Cylinder 4
translate([0,0,-wheel_radius/2])
rotate([90,0,0])
cylinder(h=cylinder_height,r=cylinder_radius,center=true);
}
}
wheel();
你可以将定义模块视为扩展 OpenSCAD 脚本语言。当你定义了一个轮子模块时,它就像拥有一个额外的可用原始对象。在这种情况下,新对象是你定义的轮子。然后,你可以像使用任何其他可用原语一样使用此模块。
car_with_wheels_created_by_module.scad
尝试在汽车脚本中定义上述车轮模块。尝试使用定义的车轮模块创建汽车的车轮。
module wheel() {
wheel_radius=10;
side_spheres_radius=50;
hub_thickness=4;
cylinder_radius=2;
cylinder_height=2*wheel_radius;
difference() {
// Wheel sphere
sphere(r=wheel_radius);
// Side sphere 1
translate([0,side_spheres_radius + hub_thickness/2,0])
sphere(r=side_spheres_radius);
// Side sphere 2
translate([0,- (side_spheres_radius + hub_thickness/2),0])
sphere(r=side_spheres_radius);
// Cylinder 1
translate([wheel_radius/2,0,0])
rotate([90,0,0])
cylinder(h=cylinder_height,r=cylinder_radius,center=true);
// Cylinder 2
translate([0,0,wheel_radius/2])
rotate([90,0,0])
cylinder(h=cylinder_height,r=cylinder_radius,center=true);
// Cylinder 3
translate([-wheel_radius/2,0,0])
rotate([90,0,0])
cylinder(h=cylinder_height,r=cylinder_radius,center=true);
// Cylinder 4
translate([0,0,-wheel_radius/2])
rotate([90,0,0])
cylinder(h=cylinder_height,r=cylinder_radius,center=true);
}
}
$fa = 1;
$fs = 0.4;
base_height = 10;
top_height = 14;
track = 35;
body_roll = 0;
wheels_turn = 0;
rotate([body_roll,0,0]) {
// Car body base
cube([60,20,base_height],center=true);
// Car body top
translate([5,0,base_height/2+top_height/2 - 0.001])
cube([30,20,top_height],center=true);
}
// Front left wheel
translate([-20,-track/2,0])
rotate([0,0,wheels_turn])
wheel();
// Front right wheel
translate([-20,track/2,0])
rotate([0,0,wheels_turn])
wheel();
// Rear left wheel
translate([20,-track/2,0])
rotate([0,0,0])
wheel();
// Rear right wheel
translate([20,track/2,0])
rotate([0,0,0])
wheel();
// Front axle
translate([-20,0,0])
rotate([90,0,0])
cylinder(h=track,r=2,center=true);
// Rear axle
translate([20,0,0])
rotate([90,0,0])
cylinder(h=track,r=2,center=true);
参数化模块
车轮模块中指定的车轮设计有许多可用于定制的变量。这些变量在轮模块定义的大括号内定义。因此,虽然可以自定义轮子模块的输出,但轮子模块本身只能创建一个版本的轮子,该版本对应于已定义变量的值。这意味着车轮模块不能用于为前后轴创建不同的车轮。如果你对参数化设计的良好实践有所了解,你应该意识到这样的事情是不可取的。如果轮子模块可以用于创建不同版本的轮子,那就更好了。为此,在 wheel 模块中定义和使用的变量,需要定义为轮模块的参数。这可以通过以下方式完成。
wheel_created_by_parameterized_module.scad
$fa = 1;
$fs = 0.4;
module wheel(wheel_radius, side_spheres_radius, hub_thickness, cylinder_radius) {
cylinder_height=2*wheel_radius;
difference() {
// Wheel sphere
sphere(r=wheel_radius);
// Side sphere 1
translate([0,side_spheres_radius + hub_thickness/2,0])
sphere(r=side_spheres_radius);
// Side sphere 2
translate([0,- (side_spheres_radius + hub_thickness/2),0])
sphere(r=side_spheres_radius);
// Cylinder 1
translate([wheel_radius/2,0,0])
rotate([90,0,0])
cylinder(h=cylinder_height,r=cylinder_radius,center=true);
// Cylinder 2
translate([0,0,wheel_radius/2])
rotate([90,0,0])
cylinder(h=cylinder_height,r=cylinder_radius,center=true);
// Cylinder 3
translate([-wheel_radius/2,0,0])
rotate([90,0,0])
cylinder(h=cylinder_height,r=cylinder_radius,center=true);
// Cylinder 4
translate([0,0,-wheel_radius/2])
rotate([90,0,0])
cylinder(h=cylinder_height,r=cylinder_radius,center=true);
}
}
wheel(wheel_radius=10, side_spheres_radius=50, hub_thickness=4, cylinder_radius=2);
你应该注意括号内模块参数的定义。你还应该注意到,每个参数的值不再分配在模块定义的大括号内。相反,每次调用模块时都会定义参数的值。因此,该模块现在可用于创建不同版本的车轮。
car_with_wheels_created_by_parameterized_module.scad
尝试在汽车脚本中定义上述车轮模块。尝试使用车轮模块创建汽车的车轮。调用轮子模块时,将 10、50、4 和 2 的值传递给相应的 wheel_radius、side_spheres_radius、hub_thickness 和 cylinder_radius 参数。
module wheel(wheel_radius, side_spheres_radius, hub_thickness, cylinder_radius) {
cylinder_height=2*wheel_radius;
difference() {
// Wheel sphere
sphere(r=wheel_radius);
// Side sphere 1
translate([0,side_spheres_radius + hub_thickness/2,0])
sphere(r=side_spheres_radius);
// Side sphere 2
translate([0,- (side_spheres_radius + hub_thickness/2),0])
sphere(r=side_spheres_radius);
// Cylinder 1
translate([wheel_radius/2,0,0])
rotate([90,0,0])
cylinder(h=cylinder_height,r=cylinder_radius,center=true);
// Cylinder 2
translate([0,0,wheel_radius/2])
rotate([90,0,0])
cylinder(h=cylinder_height,r=cylinder_radius,center=true);
// Cylinder 3
translate([-wheel_radius/2,0,0])
rotate([90,0,0])
cylinder(h=cylinder_height,r=cylinder_radius,center=true);
// Cylinder 4
translate([0,0,-wheel_radius/2])
rotate([90,0,0])
cylinder(h=cylinder_height,r=cylinder_radius,center=true);
}
}
$fa = 1;
$fs = 0.4;
base_height = 10;
top_height = 14;
track = 35;
body_roll = 0;
wheels_turn = 0;
rotate([body_roll,0,0]) {
// Car body base
cube([60,20,base_height],center=true);
// Car body top
translate([5,0,base_height/2+top_height/2 - 0.001])
cube([30,20,top_height],center=true);
}
// Front left wheel
translate([-20,-track/2,0])
rotate([0,0,wheels_turn])
wheel(wheel_radius=10, side_spheres_radius=50, hub_thickness=4, cylinder_radius=2);
// Front right wheel
translate([-20,track/2,0])
rotate([0,0,wheels_turn])
wheel(wheel_radius=10, side_spheres_radius=50, hub_thickness=4, cylinder_radius=2);
// Rear left wheel
translate([20,-track/2,0])
rotate([0,0,0])
wheel(wheel_radius=10, side_spheres_radius=50, hub_thickness=4, cylinder_radius=2);
// Rear right wheel
translate([20,track/2,0])
rotate([0,0,0])
wheel(wheel_radius=10, side_spheres_radius=50, hub_thickness=4, cylinder_radius=2);
// Front axle
translate([-20,0,0])
rotate([90,0,0])
cylinder(h=track,r=2,center=true);
// Rear axle
translate([20,0,0])
rotate([90,0,0])
cylinder(h=track,r=2,center=true);
示例
尝试在汽车脚本中定义一个 wheel_radius、side_spheres_radius、hub_thickness 和 cylinder_radius 变量,并相应地分配 10、50、4 和 2 的值。在调用wheel模块时,尝试使用这些变量来定义wheel_radius、side_spheres_radius、hub_thickness和cylinder_radius参数的值。
wheel_radius=10;
side_spheres_radius=50;
hub_thickness=4;
cylinder_radius=2;
wheel(wheel_radius=wheel_radius, side_spheres_radius=side_spheres_radius, hub_thickness=hub_thickness, cylinder_radius=cylinder_radius);
car_with_different_wheels.scad
尝试为前后轴定义不同的 wheel_radius、side_spheres_radius、hub_thickness 和 cylinder_radius 变量。尝试为这些变量分配你喜欢的值组合。请记住还要在轮模块的各个调用中编辑变量的名称。
module wheel(wheel_radius, side_spheres_radius, hub_thickness, cylinder_radius) {
cylinder_height=2*wheel_radius;
difference() {
// Wheel sphere
sphere(r=wheel_radius);
// Side sphere 1
translate([0,side_spheres_radius + hub_thickness/2,0])
sphere(r=side_spheres_radius);
// Side sphere 2
translate([0,- (side_spheres_radius + hub_thickness/2),0])
sphere(r=side_spheres_radius);
// Cylinder 1
translate([wheel_radius/2,0,0])
rotate([90,0,0])
cylinder(h=cylinder_height,r=cylinder_radius,center=true);
// Cylinder 2
translate([0,0,wheel_radius/2])
rotate([90,0,0])
cylinder(h=cylinder_height,r=cylinder_radius,center=true);
// Cylinder 3
translate([-wheel_radius/2,0,0])
rotate([90,0,0])
cylinder(h=cylinder_height,r=cylinder_radius,center=true);
// Cylinder 4
translate([0,0,-wheel_radius/2])
rotate([90,0,0])
cylinder(h=cylinder_height,r=cylinder_radius,center=true);
}
}
$fa = 1;
$fs = 0.4;
base_height = 10;
top_height = 14;
track = 35;
body_roll = 0;
wheels_turn = 0;
wheel_radius_front=10;
side_spheres_radius_front=50;
hub_thickness_front=4;
cylinder_radius_front=2;
wheel_radius_rear=12;
side_spheres_radius_rear=30;
hub_thickness_rear=8;
cylinder_radius_rear=3;
rotate([body_roll,0,0]) {
// Car body base
cube([60,20,base_height],center=true);
// Car body top
translate([5,0,base_height/2+top_height/2 - 0.001])
cube([30,20,top_height],center=true);
}
// Front left wheel
translate([-20,-track/2,0])
rotate([0,0,wheels_turn])
wheel(wheel_radius=wheel_radius_front, side_spheres_radius=side_spheres_radius_front,
hub_thickness=hub_thickness_front, cylinder_radius=cylinder_radius_front);
// Front right wheel
translate([-20,track/2,0])
rotate([0,0,wheels_turn])
wheel(wheel_radius=wheel_radius_front, side_spheres_radius=side_spheres_radius_front,
hub_thickness=hub_thickness_front, cylinder_radius=cylinder_radius_front);
// Rear left wheel
translate([20,-track/2,0])
rotate([0,0,0])
wheel(wheel_radius=wheel_radius_rear, side_spheres_radius=side_spheres_radius_rear,
hub_thickness=hub_thickness_rear, cylinder_radius=cylinder_radius_rear);
// Rear right wheel
translate([20,track/2,0])
rotate([0,0,0])
wheel(wheel_radius=wheel_radius_rear, side_spheres_radius=side_spheres_radius_rear,
hub_thickness=hub_thickness_rear, cylinder_radius=cylinder_radius_rear);
// Front axle
translate([-20,0,0])
rotate([90,0,0])
cylinder(h=track,r=2,center=true);
// Rear axle
translate([20,0,0])
rotate([90,0,0])
cylinder(h=track,r=2,center=true);
定义模块参数的默认值
你可以将轮模块参数的特定值组合设置为默认值。这可以通过以下方式实现。
示例
$fa = 1;
$fs = 0.4;
module wheel(wheel_radius=10, side_spheres_radius=50, hub_thickness=4, cylinder_radius=2) {
cylinder_height=2*wheel_radius;
difference() {
// Wheel sphere
sphere(r=wheel_radius);
// Side sphere 1
translate([0,side_spheres_radius + hub_thickness/2,0])
sphere(r=side_spheres_radius);
// Side sphere 2
translate([0,- (side_spheres_radius + hub_thickness/2),0])
sphere(r=side_spheres_radius);
// Cylinder 1
translate([wheel_radius/2,0,0])
rotate([90,0,0])
cylinder(h=cylinder_height,r=cylinder_radius,center=true);
// Cylinder 2
translate([0,0,wheel_radius/2])
rotate([90,0,0])
cylinder(h=cylinder_height,r=cylinder_radius,center=true);
// Cylinder 3
translate([-wheel_radius/2,0,0])
rotate([90,0,0])
cylinder(h=cylinder_height,r=cylinder_radius,center=true);
// Cylinder 4
translate([0,0,-wheel_radius/2])
rotate([90,0,0])
cylinder(h=cylinder_height,r=cylinder_radius,center=true);
}
}
wheel_created_by_default_parameters.scad
你应该注意到默认值是在模块定义的括号内分配的。通过定义模块参数的默认值,你可以更灵活地使用轮模块。例如,使用模块最简单的方法是在调用它时不指定任何参数。
…
wheel();
…
如果调用 wheel 模块时未指定参数值,则使用该参数的默认值。默认值可以设置为最常用的车轮版本。在调用 wheel 模块时,可以通过为相应的参数分配一个新值来覆盖默认值。没有或任何数量的默认值可以被覆盖。因此,通过指定默认值,车轮模块可以以下列任何方式以及更多方式使用。
wheel_with_thicker_hub.scad
…
wheel(hub_thickness=8);
…
wheel_with_thicker_hub_and_larger_radius.scad
…
wheel(hub_thickness=8, wheel_radius=12);
…
在 wheel 模块的定义中包含默认值。尝试通过覆盖任意数量的默认值来创建几个轮子。你能做一个像下面这样的轮子吗?
wheel_with_larger_side_radius.scad
…
wheel(side_spheres_radius=10);
…
将整个模型分成模块
模块的使用是 OpenSCAD 的一个非常强大的特性。你应该开始将模型视为模块的组合。例如,汽车模型可以被认为是车身、车轮和车轴模块的组合。这开启了进一步重用和重新组合模块以创建不同模型的可能性。
car_with_different_wheels_and_default_body_and_axle.scad
尝试定义一个主体和一个轴模块。车身和车桥模块应具备哪些参数?尝试使用车身、车轮和车轴模块重建汽车。为车轮模块的参数提供一组与前轮相对应的默认值。通过在脚本中定义适当的变量,在创建后轮时将不同的值传递给轮模块。也为车身和车桥模块的参数设置默认值。
module wheel(wheel_radius=10, side_spheres_radius=50, hub_thickness=4, cylinder_radius=2) {
cylinder_height=2*wheel_radius;
difference() {
// Wheel sphere
sphere(r=wheel_radius);
// Side sphere 1
translate([0,side_spheres_radius + hub_thickness/2,0])
sphere(r=side_spheres_radius);
// Side sphere 2
translate([0,- (side_spheres_radius + hub_thickness/2),0])
sphere(r=side_spheres_radius);
// Cylinder 1
translate([wheel_radius/2,0,0])
rotate([90,0,0])
cylinder(h=cylinder_height,r=cylinder_radius,center=true);
// Cylinder 2
translate([0,0,wheel_radius/2])
rotate([90,0,0])
cylinder(h=cylinder_height,r=cylinder_radius,center=true);
// Cylinder 3
translate([-wheel_radius/2,0,0])
rotate([90,0,0])
cylinder(h=cylinder_height,r=cylinder_radius,center=true);
// Cylinder 4
translate([0,0,-wheel_radius/2])
rotate([90,0,0])
cylinder(h=cylinder_height,r=cylinder_radius,center=true);
}
}
module body(base_height=10, top_height=14, base_length=60, top_length=30, width=20, top_offset=5) {
// Car body base
cube([base_length,width,base_height],center=true);
// Car body top
translate([top_offset,0,base_height/2+top_height/2 - 0.001])
cube([top_length,width,top_height],center=true);
}
module axle(track=35, radius=2) {
rotate([90,0,0])
cylinder(h=track,r=2,center=true);
}
$fa = 1;
$fs = 0.4;
wheelbase = 40;
track = 35;
body_roll = 0;
wheels_turn = 0;
wheel_radius_rear=12;
// Body
rotate([body_roll,0,0]) {
body();
}
// Front left wheel
translate([-wheelbase/2,-track/2,0])
rotate([0,0,wheels_turn])
wheel();
// Front right wheel
translate([-wheelbase/2,track/2,0])
rotate([0,0,wheels_turn])
wheel();
// Rear left wheel
translate([wheelbase/2,-track/2,0])
rotate([0,0,0])
wheel(wheel_radius=wheel_radius_rear);
// Rear right wheel
translate([wheelbase/2,track/2,0])
rotate([0,0,0])
wheel(wheel_radius=wheel_radius_rear);
// Front axle
translate([-wheelbase/2,0,0])
axle();
// Rear axle
translate([wheelbase/2,0,0])
axle();
car_with_six_wheels.scad
尝试重复使用车身、车轮和车轴模块来创建类似于以下内容的车辆。创建6个轮子的车子模型
module wheel(wheel_radius=10, side_spheres_radius=50, hub_thickness=4, cylinder_radius=2) {
cylinder_height=2*wheel_radius;
difference() {
// Wheel sphere
sphere(r=wheel_radius);
// Side sphere 1
translate([0,side_spheres_radius + hub_thickness/2,0])
sphere(r=side_spheres_radius);
// Side sphere 2
translate([0,- (side_spheres_radius + hub_thickness/2),0])
sphere(r=side_spheres_radius);
// Cylinder 1
translate([wheel_radius/2,0,0])
rotate([90,0,0])
cylinder(h=cylinder_height,r=cylinder_radius,center=true);
// Cylinder 2
translate([0,0,wheel_radius/2])
rotate([90,0,0])
cylinder(h=cylinder_height,r=cylinder_radius,center=true);
// Cylinder 3
translate([-wheel_radius/2,0,0])
rotate([90,0,0])
cylinder(h=cylinder_height,r=cylinder_radius,center=true);
// Cylinder 4
translate([0,0,-wheel_radius/2])
rotate([90,0,0])
cylinder(h=cylinder_height,r=cylinder_radius,center=true);
}
}
module body(base_height=10, top_height=14, base_length=60, top_length=30, width=20, top_offset=5) {
// Car body base
cube([base_length,width,base_height],center=true);
// Car body top
translate([top_offset,0,base_height/2+top_height/2 - 0.001])
cube([top_length,width,top_height],center=true);
}
module axle(track=35, radius=2) {
rotate([90,0,0])
cylinder(h=track,r=2,center=true);
}
$fa = 1;
$fs = 0.4;
track = 35;
body_roll = 0;
wheels_turn = 0;
base_length = 100;
top_length = 75;
top_offset = 5;
front_axle_offset = 30;
rear_axle_1_offset = 10;
rear_axle_2_offset = 35;
wheel_radius = 12;
// Body
rotate([body_roll,0,0]) {
body(base_length=base_length, top_length=top_length, top_offset=top_offset);
}
// Front left wheel
translate([-front_axle_offset,-track/2,0])
rotate([0,0,wheels_turn])
wheel(wheel_radius=wheel_radius);
// Front right wheel
translate([-front_axle_offset,track/2,0])
rotate([0,0,wheels_turn])
wheel(wheel_radius=wheel_radius);
// Rear left wheel 1
translate([rear_axle_1_offset,-track/2,0])
rotate([0,0,0])
wheel(wheel_radius=wheel_radius);
// Rear right wheel 1
translate([rear_axle_1_offset,track/2,0])
rotate([0,0,0])
wheel(wheel_radius=wheel_radius);
// Rear left wheel 2
translate([rear_axle_2_offset,-track/2,0])
rotate([0,0,0])
wheel(wheel_radius=wheel_radius);
// Rear right wheel 2
translate([rear_axle_2_offset,track/2,0])
rotate([0,0,0])
wheel(wheel_radius=wheel_radius);
// Front axle
translate([-front_axle_offset,0,0])
axle();
// Rear axle 1
translate([rear_axle_1_offset,0,0])
axle();
// Rear axle 2
translate([rear_axle_2_offset,0,0])
axle();