我對 Openscad 還很陌生,并且撰寫了一個小程式來創建一個帶有傾斜前部的儀器箱。這現在效果很好,所以我想“引數化”盒子的大小和顯示切口,這樣制作不同尺寸的盒子所需的心理體操就更少了。
我嘗試過(但它不起作用)是這個(部分)-首先是盒子外殼的引數串列-
//Box outer shell
outer_start = "0.00,0.00";
outer_top_left = "0.00,30.00";
outer_top_right = "45.00,30.00";
outer_slope_bottom = "60.00,5.00";
outer_bottom_right = "60.00,0.00";
然后嘗試將它們放入多邊形點串列中-
polygon(points = [
[outer_start],
[outer_top_left],
[outer_top_right],
[outer_slope_bottom],
[outer_bottom_right]
]
而且它不起作用!Openscad 沒有顯示任何錯誤,只是在預覽螢屏中沒有繪制框。如果我在點串列中手動輸入數字,它可以正常作業并完全按照我的意愿繪制框。
我搜索了谷歌和各種郵件串列,沒有任何結果(我能找到)與此相關,所以有人可以讓我擺脫痛苦并告訴我我做錯了什么嗎?更好的是,如何做對!
謝謝,肯。
uj5u.com熱心網友回復:
多邊形的點引數必須是 2 個元素向量(x 和 y 值)的向量。所以這樣寫你的代碼:
//Box outer shell
outer_start = [0.00,0.00];
outer_top_left = [0.00,30.00];
outer_top_right = [45.00,30.00];
outer_slope_bottom = [60.00,5.00];
outer_bottom_right = [60.00,0.00];
polygon(points = [
outer_start,
outer_top_left,
outer_top_right,
outer_slope_bottom,
outer_bottom_right
]);
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/442243.html
