为什么差异功能不起作用(openSCAD)?

时间:2014-09-12 13:43:45

标签: openscad

我尝试学习如何使用openSCAD。我正在阅读(也在观看)很多教程,但我无法理解以下代码无效的原因。你能帮我吗?

difference() {

     polygon(
             points=[[2,0],[1.6,2.6],[2.2,3.4],[5.6,4],[11.4,3.4],[11.4,0.6],[10,-1.6],[7.6,-2.4],[4.4,-1.8]]);

     polygon(// right len holder in

             points=[[2.4,0],[2,2.6],[2.5,3.1],[5.6,3.6],[11,3],[11,0.6],[9.8,-1.2],[7.6,-2],[4.4,-1.45]]);}

1 个答案:

答案 0 :(得分:2)

您的顶级对象是2D对象,使用linear_extrude来获取3D对象:

h = 10;
difference() {
    linear_extrude(height=h) polygon(
         points=[[2,0],[1.6,2.6],[2.2,3.4],[5.6,4],[11.4,3.4],[11.4,0.6],[10,-1.6],[7.6,-2.4],[4.4,-1.8]]);

     linear_extrude(height=h) polygon(// right len holder in

         points=[[2.4,0],[2,2.6],[2.5,3.1],[5.6,3.6],[11,3],[11,0.6],[9.8,-1.2],[7.6,-2],[4.4,-1.45]]);

}