OpenSCAD空間幾何布爾運算

原文地址(英): https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/CSG_Modelling#differenceide

Union:合併

建立一個合併的對象,使用union操做符,以下圖所示。spa

Usage example:

union() {
        cylinder (h = 4, r=1, center = true, $fn=100);
        rotate ([90,0,0]) cylinder (h = 4, r=0.9, center = true, $fn=100);
}

    注意: union是隱含的,當未使用時。但當兩個對象相交時,就成爲必然的操做。code

Union

difference:切割

    從主對象中把全部字對象挖出,以下所示:對象

    Usage example:
ci

difference() {
        cylinder (h = 4, r=1, center = true, $fn=100);
        rotate ([90,0,0]) cylinder (h = 4, r=0.9, center = true, $fn=100);
}


Difference


intersection:求交

    建立全部子對象的交集,保留重疊的部分。以下所示:get

Usage example:

intersection() {
        cylinder (h = 4, r=1, center = true, $fn=100);
        rotate ([90,0,0]) cylinder (h = 4, r=0.9, center = true, $fn=100);
}


Intersection


render:渲染

老是計算CSG model(even in OpenCSG preview mode).it

Usage example:
render(convexity = 1) { ... }


convexity Integer. The convexity parameter specifies the maximum number of front sides (back sides) a ray intersecting the object might penetrate. This parameter is only needed for correctly displaying the object in OpenCSG preview mode and has no effect on the polyhedron rendering.


Openscad convexity.jpg

This image shows a 2D shape with a convexity of 4, as the ray indicated in red crosses the 2D shape a maximum of 4 times. The convexity of a 3D shape would be determined in a similar way. Setting it to 10 should work fine for most cases.io

相關文章
相關標籤/搜索