PinePhoneBoy/src/platform.scad

67 lines
1.4 KiB
OpenSCAD
Raw Normal View History

2021-01-20 11:56:26 +00:00
include <export.scad>
2021-01-02 09:43:54 +00:00
// dependency: https://github.com/revarbat/BOSL
include <BOSL/constants.scad>
use <BOSL/transforms.scad>
use <BOSL/shapes.scad>
use <BOSL/masks.scad>
use <BOSL/sliders.scad>
2021-01-20 11:56:26 +00:00
use <specs_platform.scad>
use <specs_strap.scad>
use <strap_common.scad>
2021-01-20 14:55:17 +00:00
use <platform_common.scad>
2021-01-20 11:56:26 +00:00
2021-01-02 09:43:54 +00:00
// DEBUG:
//validation = 1;
//xray = 1;
2021-01-20 11:56:26 +00:00
// PROP >>
module prop_arm() {
2021-01-02 09:43:54 +00:00
$fn=$preview ? 10 : 30;
arm_size=[200, 55, 40];
color("gray")
down(arm_size.z/2) {
cuboid(arm_size, fillet=16, edges=EDGES_X_ALL);
left(arm_size.x*0.6) scale([1, 1, 0.8]) yrot(90) cylinder(d1=arm_size.y*1.4, d2=arm_size.y*0.95, h=arm_size.x/2);
}
2021-01-02 09:43:54 +00:00
}
2021-01-20 11:56:26 +00:00
module model_prop_arm() {
if (is_not_export()) down(3) prop_arm();
}
// <<<
2021-01-02 09:43:54 +00:00
2021-01-20 11:56:26 +00:00
// Blocks:
module platform(base) {
size=get_platform_size();
top=!base;
up(top?size.z:0)
color(top?"Olive":"YellowGreen")
cube(size, center=true);
2021-01-02 09:43:54 +00:00
2021-01-20 11:56:26 +00:00
module strap_connectors() {
2021-01-20 14:55:17 +00:00
down(size.z/2) foreach_platform_strap_connector() {
link_connector_pin();
2021-01-02 09:43:54 +00:00
}
}
2021-01-20 11:56:26 +00:00
if (base) {
strap_connectors();
2021-01-02 09:43:54 +00:00
}
}
2021-01-20 11:56:26 +00:00
// Models:
module model_platform_harness() {
platform(base=false);
}
2021-01-20 11:56:26 +00:00
module model_platform_strap() {
platform(base=true);
2021-01-02 09:43:54 +00:00
}
2021-01-20 11:56:26 +00:00
// Export:
if (is_model(MODEL_PLATFORM_HARNESS)) model_platform_harness();
if (is_model(MODEL_PLATFORM_STRAP)) model_platform_strap();
if (is_model(MODEL_DEMO)) model_prop_arm();