下载库:
BOSL2
https://github.com/revarbat/BOSL2
ubuntu16.04 openscad2021版本
放入:/home/×××/.local/share/OpenSCAD/libraries/BOSL2
include <BOSL2/std.scad>
include <BOSL2/screws.scad>
include <BOSL2/metric_screws.scad>
module bolt_ynh(bolt_rot, screw_height, plane_exist, bolt_exist, screw_exist){
union(){
//螺栓orient
//UP, DOWN, FRONT, BACK, LEFT, and RIGHT LEFT+BACK
//螺栓自转spin
//details如果真正的模型应该用额外的细节来渲染。
zdistribute(-1-(screw_height)){
metric_bolt(headtype="hex", size=16, l=3.5+screw_height/2, coarse=false, shank=1.5, details=true, orient=UP, spin=bolt_rot);
}
ydistribute(35){
cube([25,10,3], anchor=TOP);
}
cylinder(r=20, h=3, anchor=TOP);
}
}
screw_height = 10;
bolt_rot = 10;
bolt_ynh(bolt_rot, screw_height);