s***@laposte.net
2018-10-29 17:13:46 UTC
Hi,
I am new to OpenSCAD, and I built a polyhedron which I can render with no problem.
However, when I try to substract a cylinder from it, I can visualize it (F5), but not render it (F6): the resulting render is empty. I have seen some similar problems from other people, but usually when importing stl files. The code is below (sorry for the complexity, the shape of the polyhedron was generated from outside).
Is there something wrong with the code? Do you encounter the same issue?
Thanks for any help,
Sébastien
difference() {
polyhedron(faces = [[19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0], [0, 1, 21, 20], [1, 2, 22, 21], [2, 3, 23, 22], [3, 4, 24, 23], [4, 5, 25, 24], [5, 6, 26, 25], [6, 7, 27, 26], [7, 8, 28, 27], [8, 9, 29, 28], [9, 10, 30, 29], [10, 11, 31, 30], [11, 12, 32, 31], [12, 13, 33, 32], [13, 14, 34, 33], [14, 15, 35, 34], [15, 16, 36, 35], [16, 17, 37, 36], [17, 18, 38, 37], [18, 19, 39, 38], [19, 0, 20, 39], [20, 21, 41, 40], [21, 22, 42, 41], [22, 23, 43, 42], [23, 24, 44, 43], [24, 25, 45, 44], [25, 26, 46, 45], [26, 27, 47, 46], [27, 28, 48, 47], [28, 29, 49, 48], [29, 30, 50, 49], [30, 31, 51, 50], [31, 32, 52, 51], [32, 33, 53, 52], [33, 34, 54, 53], [34, 35, 55, 54], [35, 36, 56, 55], [36, 37, 57, 56], [37, 38, 58, 57], [38, 39, 59, 58], [39, 20, 40, 59], [40, 41, 61, 60], [41, 42, 62, 61], [42, 43, 63, 62], [43, 44, 64, 63], [44, 45, 65, 64], [45, 46, 66, 65], [46, 47, 67, 66], [47, 48, 68, 67], [48, 49, 69, 68], [49, 50, 70, 69], [50, 51, 71, 70], [51, 52, 72, 71], [52, 53, 73, 72], [53, 54, 74, 73], [54, 55, 75, 74], [55, 56, 76, 75], [56, 57, 77, 76], [57, 58, 78, 77], [58, 59, 79, 78], [59, 40, 60, 79], [60, 61, 81, 80], [61, 62, 82, 81], [62, 63, 83, 82], [63, 64, 84, 83], [64, 65, 85, 84], [65, 66, 86, 85], [66, 67, 87, 86], [67, 68, 88, 87], [68, 69, 89, 88], [69, 70, 90, 89], [70, 71, 91, 90], [71, 72, 92, 91], [72, 73, 93, 92], [73, 74, 94, 93], [74, 75, 95, 94], [75, 76, 96, 95], [76, 77, 97, 96], [77, 78, 98, 97], [78, 79, 99, 98], [79, 60, 80, 99], [80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]], points = [[-12.1000000000, 0.6000000000, 2.4733413149], [-0.2645497289, -0.0128808879, 2.4733413149], [11.9344341747, -1.4086239445, 2.4733413149], [24.1355716448, -2.5542701643, 2.4733413149], [35.9774826150, -2.4168605418, 2.4733413149], [47.0987871087, 0.0365636260, 2.4733413149], [57.2529612666, 5.4496843894, 2.4733413149], [66.6402934955, 12.9518231698, 2.4733413149], [75.5697083075, 21.3041059427, 2.4733413149], [84.3501302148, 29.2676586838, 2.4733413149], [84.9947208658, 28.5062359773, 2.4733413149], [76.1429723223, 20.4779923324, 2.4733413149], [67.1410205492, 12.0578608568, 2.4733413149], [57.6774315256, 4.4947794099, 2.4733413149], [47.4407712304, -0.9623141489, 2.4733413149], [36.2291242397, -3.4356683946, 2.4733413149], [24.2910170177, -3.5741942466, 2.4733413149], [11.9907651653, -2.4192415160, 2.4733413149], [-0.3073156265, -1.0121603189, 2.4733413149], [-12.2389096666, -0.3943007714, 2.4733413149], [-12.1000000000, 0.1270378309, 7.4767584377], [-0.2645497289, -0.4858430570, 7.4767584377], [11.9344341747, -1.8815861136, 7.4767584377], [24.1355716448, -3.0272323334, 7.4767584377], [35.9774826150, -2.8898227109, 7.4767584377], [47.0987871087, -0.4363985431, 7.4767584377], [57.2529612666, 4.9767222203, 7.4767584377], [66.6402934955, 12.4788610007, 7.4767584377], [75.5697083075, 20.8311437736, 7.4767584377], [84.3501302148, 28.7946965147, 7.4767584377], [84.9947208658, 28.0332738082, 7.4767584377], [78.3312410826, 16.8515815611, 7.4767584377], [69.1485014005, 8.0008857770, 7.4767584377], [59.2936304543, 0.3859526016, 7.4767584377], [48.7084326467, -5.1379008975, 7.4767584377], [37.1619054951, -7.6851316458, 7.4767584377], [24.8828856821, -7.9305856419, 7.4767584377], [12.2166035420, -6.9439029250, 7.4767584377], [-0.4705620106, -5.2995812809, 7.4767584377], [-12.2389096666, -0.8672629405, 7.4767584377], [-12.1000000000, -0.0308238948, 12.5000000000], [-0.2645497289, -0.6437047827, 12.5000000000], [11.9344341747, -2.0394478393, 12.5000000000], [24.1355716448, -3.1850940591, 12.5000000000], [35.9774826150, -3.0476844366, 12.5000000000], [47.0987871087, -0.5942602689, 12.5000000000], [57.2529612666, 4.8188604946, 12.5000000000], [66.6402934955, 12.3209992750, 12.5000000000], [75.5697083075, 20.6732820479, 12.5000000000], [84.3501302148, 28.6368347890, 12.5000000000], [84.9947208658, 27.8754120825, 12.5000000000], [78.9262963850, 15.8362034527, 12.5000000000], [69.6943950981, 6.8684244385, 12.5000000000], [59.7331229699, -0.7606087627, 12.5000000000], [49.0531474556, -6.3026162734, 12.5000000000], [37.4155564369, -8.8699362381, 12.5000000000], [25.0438323598, -9.1444671741, 12.5000000000], [12.2780157076, -8.2035420741, 12.5000000000], [-0.5149535534, -6.4947077026, 12.5000000000], [-12.2389096666, -1.0251246662, 12.5000000000], [-12.1000000000, 0.1270378309, 17.5232415623], [-0.2645497289, -0.4858430570, 17.5232415623], [11.9344341747, -1.8815861136, 17.5232415623], [24.1355716448, -3.0272323334, 17.5232415623], [35.9774826150, -2.8898227109, 17.5232415623], [47.0987871087, -0.4363985431, 17.5232415623], [57.2529612666, 4.9767222203, 17.5232415623], [66.6402934955, 12.4788610007, 17.5232415623], [75.5697083075, 20.8311437736, 17.5232415623], [84.3501302148, 28.7946965147, 17.5232415623], [84.9947208658, 28.0332738082, 17.5232415623], [78.7634496000, 16.2287388054, 17.5232415623], [69.5450022043, 7.2930015653, 17.5232415623], [59.6128485300, -0.3321729292, 17.5232415623], [48.9588105122, -5.8692122925, 17.5232415623], [37.3461406360, -8.4310345089, 17.5232415623], [24.9997866233, -8.6976080565, 17.5232415623], [12.2612092466, -7.7441606233, 17.5232415623], [-0.5028050691, -6.0529812331, 17.5232415623], [-12.2389096666, -0.8672629405, 17.5232415623], [-12.1000000000, 0.6000000000, 22.5266586851], [-0.2645497289, -0.0128808879, 22.5266586851], [11.9344341747, -1.4086239445, 22.5266586851], [24.1355716448, -2.5542701643, 22.5266586851], [35.9774826150, -2.4168605418, 22.5266586851], [47.0987871087, 0.0365636260, 22.5266586851], [57.2529612666, 5.4496843894, 22.5266586851], [66.6402934955, 12.9518231698, 22.5266586851], [75.5697083075, 21.3041059427, 22.5266586851], [84.3501302148, 29.2676586838, 22.5266586851], [84.9947208658, 28.5062359773, 22.5266586851], [77.4852411417, 18.5436889190, 22.5266586851], [68.3723953242, 9.8594522949, 22.5266586851], [58.6687966940, 2.2645653588, 22.5266586851], [48.2183459157, -3.2334782825, 22.5266586851], [36.8012857663, -5.7521478605, 22.5266586851], [24.6540651349, -5.9562626915, 22.5266586851], [12.1292928529, -4.9045256155, 22.5266586851], [-0.4074498217, -3.3519227802, 22.5266586851], [-12.2389096666, -0.3943007714, 22.5266586851]]);
translate(v = [5.0, 123.0, 12.5]) {
rotate(a = 90, v = [103.5000000000, 69.1691761052]) {
cylinder(d = 10, h = 127.185440606789);
}
}
}
I am new to OpenSCAD, and I built a polyhedron which I can render with no problem.
However, when I try to substract a cylinder from it, I can visualize it (F5), but not render it (F6): the resulting render is empty. I have seen some similar problems from other people, but usually when importing stl files. The code is below (sorry for the complexity, the shape of the polyhedron was generated from outside).
Is there something wrong with the code? Do you encounter the same issue?
Thanks for any help,
Sébastien
difference() {
polyhedron(faces = [[19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0], [0, 1, 21, 20], [1, 2, 22, 21], [2, 3, 23, 22], [3, 4, 24, 23], [4, 5, 25, 24], [5, 6, 26, 25], [6, 7, 27, 26], [7, 8, 28, 27], [8, 9, 29, 28], [9, 10, 30, 29], [10, 11, 31, 30], [11, 12, 32, 31], [12, 13, 33, 32], [13, 14, 34, 33], [14, 15, 35, 34], [15, 16, 36, 35], [16, 17, 37, 36], [17, 18, 38, 37], [18, 19, 39, 38], [19, 0, 20, 39], [20, 21, 41, 40], [21, 22, 42, 41], [22, 23, 43, 42], [23, 24, 44, 43], [24, 25, 45, 44], [25, 26, 46, 45], [26, 27, 47, 46], [27, 28, 48, 47], [28, 29, 49, 48], [29, 30, 50, 49], [30, 31, 51, 50], [31, 32, 52, 51], [32, 33, 53, 52], [33, 34, 54, 53], [34, 35, 55, 54], [35, 36, 56, 55], [36, 37, 57, 56], [37, 38, 58, 57], [38, 39, 59, 58], [39, 20, 40, 59], [40, 41, 61, 60], [41, 42, 62, 61], [42, 43, 63, 62], [43, 44, 64, 63], [44, 45, 65, 64], [45, 46, 66, 65], [46, 47, 67, 66], [47, 48, 68, 67], [48, 49, 69, 68], [49, 50, 70, 69], [50, 51, 71, 70], [51, 52, 72, 71], [52, 53, 73, 72], [53, 54, 74, 73], [54, 55, 75, 74], [55, 56, 76, 75], [56, 57, 77, 76], [57, 58, 78, 77], [58, 59, 79, 78], [59, 40, 60, 79], [60, 61, 81, 80], [61, 62, 82, 81], [62, 63, 83, 82], [63, 64, 84, 83], [64, 65, 85, 84], [65, 66, 86, 85], [66, 67, 87, 86], [67, 68, 88, 87], [68, 69, 89, 88], [69, 70, 90, 89], [70, 71, 91, 90], [71, 72, 92, 91], [72, 73, 93, 92], [73, 74, 94, 93], [74, 75, 95, 94], [75, 76, 96, 95], [76, 77, 97, 96], [77, 78, 98, 97], [78, 79, 99, 98], [79, 60, 80, 99], [80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]], points = [[-12.1000000000, 0.6000000000, 2.4733413149], [-0.2645497289, -0.0128808879, 2.4733413149], [11.9344341747, -1.4086239445, 2.4733413149], [24.1355716448, -2.5542701643, 2.4733413149], [35.9774826150, -2.4168605418, 2.4733413149], [47.0987871087, 0.0365636260, 2.4733413149], [57.2529612666, 5.4496843894, 2.4733413149], [66.6402934955, 12.9518231698, 2.4733413149], [75.5697083075, 21.3041059427, 2.4733413149], [84.3501302148, 29.2676586838, 2.4733413149], [84.9947208658, 28.5062359773, 2.4733413149], [76.1429723223, 20.4779923324, 2.4733413149], [67.1410205492, 12.0578608568, 2.4733413149], [57.6774315256, 4.4947794099, 2.4733413149], [47.4407712304, -0.9623141489, 2.4733413149], [36.2291242397, -3.4356683946, 2.4733413149], [24.2910170177, -3.5741942466, 2.4733413149], [11.9907651653, -2.4192415160, 2.4733413149], [-0.3073156265, -1.0121603189, 2.4733413149], [-12.2389096666, -0.3943007714, 2.4733413149], [-12.1000000000, 0.1270378309, 7.4767584377], [-0.2645497289, -0.4858430570, 7.4767584377], [11.9344341747, -1.8815861136, 7.4767584377], [24.1355716448, -3.0272323334, 7.4767584377], [35.9774826150, -2.8898227109, 7.4767584377], [47.0987871087, -0.4363985431, 7.4767584377], [57.2529612666, 4.9767222203, 7.4767584377], [66.6402934955, 12.4788610007, 7.4767584377], [75.5697083075, 20.8311437736, 7.4767584377], [84.3501302148, 28.7946965147, 7.4767584377], [84.9947208658, 28.0332738082, 7.4767584377], [78.3312410826, 16.8515815611, 7.4767584377], [69.1485014005, 8.0008857770, 7.4767584377], [59.2936304543, 0.3859526016, 7.4767584377], [48.7084326467, -5.1379008975, 7.4767584377], [37.1619054951, -7.6851316458, 7.4767584377], [24.8828856821, -7.9305856419, 7.4767584377], [12.2166035420, -6.9439029250, 7.4767584377], [-0.4705620106, -5.2995812809, 7.4767584377], [-12.2389096666, -0.8672629405, 7.4767584377], [-12.1000000000, -0.0308238948, 12.5000000000], [-0.2645497289, -0.6437047827, 12.5000000000], [11.9344341747, -2.0394478393, 12.5000000000], [24.1355716448, -3.1850940591, 12.5000000000], [35.9774826150, -3.0476844366, 12.5000000000], [47.0987871087, -0.5942602689, 12.5000000000], [57.2529612666, 4.8188604946, 12.5000000000], [66.6402934955, 12.3209992750, 12.5000000000], [75.5697083075, 20.6732820479, 12.5000000000], [84.3501302148, 28.6368347890, 12.5000000000], [84.9947208658, 27.8754120825, 12.5000000000], [78.9262963850, 15.8362034527, 12.5000000000], [69.6943950981, 6.8684244385, 12.5000000000], [59.7331229699, -0.7606087627, 12.5000000000], [49.0531474556, -6.3026162734, 12.5000000000], [37.4155564369, -8.8699362381, 12.5000000000], [25.0438323598, -9.1444671741, 12.5000000000], [12.2780157076, -8.2035420741, 12.5000000000], [-0.5149535534, -6.4947077026, 12.5000000000], [-12.2389096666, -1.0251246662, 12.5000000000], [-12.1000000000, 0.1270378309, 17.5232415623], [-0.2645497289, -0.4858430570, 17.5232415623], [11.9344341747, -1.8815861136, 17.5232415623], [24.1355716448, -3.0272323334, 17.5232415623], [35.9774826150, -2.8898227109, 17.5232415623], [47.0987871087, -0.4363985431, 17.5232415623], [57.2529612666, 4.9767222203, 17.5232415623], [66.6402934955, 12.4788610007, 17.5232415623], [75.5697083075, 20.8311437736, 17.5232415623], [84.3501302148, 28.7946965147, 17.5232415623], [84.9947208658, 28.0332738082, 17.5232415623], [78.7634496000, 16.2287388054, 17.5232415623], [69.5450022043, 7.2930015653, 17.5232415623], [59.6128485300, -0.3321729292, 17.5232415623], [48.9588105122, -5.8692122925, 17.5232415623], [37.3461406360, -8.4310345089, 17.5232415623], [24.9997866233, -8.6976080565, 17.5232415623], [12.2612092466, -7.7441606233, 17.5232415623], [-0.5028050691, -6.0529812331, 17.5232415623], [-12.2389096666, -0.8672629405, 17.5232415623], [-12.1000000000, 0.6000000000, 22.5266586851], [-0.2645497289, -0.0128808879, 22.5266586851], [11.9344341747, -1.4086239445, 22.5266586851], [24.1355716448, -2.5542701643, 22.5266586851], [35.9774826150, -2.4168605418, 22.5266586851], [47.0987871087, 0.0365636260, 22.5266586851], [57.2529612666, 5.4496843894, 22.5266586851], [66.6402934955, 12.9518231698, 22.5266586851], [75.5697083075, 21.3041059427, 22.5266586851], [84.3501302148, 29.2676586838, 22.5266586851], [84.9947208658, 28.5062359773, 22.5266586851], [77.4852411417, 18.5436889190, 22.5266586851], [68.3723953242, 9.8594522949, 22.5266586851], [58.6687966940, 2.2645653588, 22.5266586851], [48.2183459157, -3.2334782825, 22.5266586851], [36.8012857663, -5.7521478605, 22.5266586851], [24.6540651349, -5.9562626915, 22.5266586851], [12.1292928529, -4.9045256155, 22.5266586851], [-0.4074498217, -3.3519227802, 22.5266586851], [-12.2389096666, -0.3943007714, 22.5266586851]]);
translate(v = [5.0, 123.0, 12.5]) {
rotate(a = 90, v = [103.5000000000, 69.1691761052]) {
cylinder(d = 10, h = 127.185440606789);
}
}
}