広告
*[[hull:https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Transformations#hull]]の使い方 [#i83ee9ad]
hullは複数の図形を包含する図形を作ることができる。~
しかし凹んだ図形は作れないようだ
ネジ穴位置で外形ができたりするので便利
*例1 [#jde02d63]
**角が丸いボックス [#x22c5153]
testHull(20,10,5,2);
module testHull(x,y,z,r,center = false){
linear_extrude(height = z, center = center)
hull() {
translate([x/2-r,y/2-r,0]) circle(r);
translate([x/2-r,-y/2+r,0]) circle(r);
translate([-x/2+r,-y/2+r,0]) circle(r);
translate([-x/2+r,y/2-r,0]) circle(r);
}
}
**一つの頂点が丸まっている三角形 [#s6948f80]
rTriangle1();
module rTriangle1(){
linear_extrude(height = 5, center = true)
hull() {
polygon([[20,0],[0,20],[-20,0]]);
translate([0,20,0]) circle(d=5);
}
}
**すべての頂点が丸まっている三角形 [#wc6138cb]
rTriangle2();
module rTriangle2(){
linear_extrude(height = 5, center = true)
hull() {
translate([0,20,0]) circle(d=5);
translate([20,0,0]) circle(d=5);
translate([-20,0,0]) circle(d=5);
}
}
*例2 [#xb3c0ecb]
マニュアルには2次元図形しか扱えないようなことが書いてあるが実際は違うため3次元図形でもできる。~
minkowski()より使い勝手がいいと思う
test_hull();
module test_hull(){
hull(){
Spheres();
}
translate([40,0,0]) hull(){
Cylinders();
}
}
module Spheres(){
translate([4,4,-4]) sphere(d=2);
translate([-4,4,-4]) sphere(d=2);
translate([4,-4,-4]) sphere(d=2);
translate([-4,-4,-4]) sphere(d=2);
translate([4,4,4]) sphere(d=2);
translate([-4,4,4]) sphere(d=2);
translate([4,-4,4]) sphere(d=2);
translate([-4,-4,4]) sphere(d=2);
}
module Cylinders(){
cylinder(d=5,h=2,center=true);
translate([20,10,-10]) cylinder(d=5,h=2,center=true);
translate([-20,20,10]) cylinder(d=5,h=2,center=true);
}
#ref(OpenSCAD/hull/test_hull.png)
ネジ穴が開いた板や箱も簡単にできる
RBox();
points=[[10,10,0],[-10,10,0],[10,-10,0],[-10,-10,0]];
module RBox(){
difference(){
hull(){
for (p = points){
translate(p) cylinder(d=4, h=4,center=true);
}
}
for (p = points){
translate(p) cylinder(d=2, h=5,center=true);
}
}
}
#ref(OpenSCAD/hull/rbox.png)
広告 |