Tên Thẻ (Name Tag) - In 3D
Tạo tên thẻ độc đáo với hiệu ứng chữ nối liền, biến đổi độ cao ngẫu nhiên bằng font Arial Black. Mẫu này sử dụng thư viện ub.scad và yêu cầu bật tính năng textmetrics trong OpenSCAD v2023. Bạn có thể tùy chỉnh tên, font, kích thước và độ dày.
1.9K
Lượt Xem
59
Lượt Thích
281
Lượt Tải
Cập Nhật Dec 03, 2025
Mô tả
else use openSCAD v2023 with ub.scad library and activate “textmetrics” feature
(to be able to rate this model you need to download any file first)
use <ub.scad>;
//https://openscad.org/libraries.html
$fs=.5;
$fa=1;
text="Jack";
font="ArialBlack";
size=35;
spacing= - size*+0.10;
// thickness
hMinMax=[2,5];
//random height seed
seed=42; // rands(0,9999,1)[0];
h=rands(hMinMax[0],hMinMax[1],len(text),seed); // [5,2] will alternate the height 5,2,5,2… mm
//%T(0,-20)text(text,.72*pt(size),font,spacing=+0.7);
TextExtrude(text,font,size,spacing,h);
// DEMO
if ($preview)T(0,10) for(i=[0:10]){
randStr=
function (len=5,seed=42)
len>0?
str (
chr( rands(65,65+25,1,seed+len)[0] ),
randStr(len-1,seed=seed)
)
:
"" ;
T(0,i*pt(size))TextExtrude(randStr(round(rands(4,10,1,i)[0]), i) ,font,size,spacing,rands(size/10,size/4,len(text),i));
}
module TextExtrude(
text="TESTABC",
font="ArialBlack",
size=35,
spacing=size*-0.10,
h=[size/10,size/2],
){
rSize=.72*pt(size);
// you need textmetrics enabled
halign="left";
charWidth=[for(i=[0:len(text)-1])textmetrics(text[i],size,font,halign=halign).size.x];
charOffset=[for(i=[0:len(text)-1])textmetrics(text[i],size,font,halign=halign).offset.x];
charPos=[for(i=[0:len(text)-1])textmetrics(text[i],size,font,halign=halign).position.x];
charAdv=[0,for(i=[0:len(text)-2])textmetrics(text[i],size,font,halign=halign).advance.x];
//echo (textmetrics("A",size,font,"center").advance);
for(i=[0:len(text)-1]) translate([
vSum(charWidth,end:i)*0
+vSum(charOffset,end:i)
+vSum(charPos,end:i)
+vSum(charAdv,end:i)
+i*spacing
,0])
Color(i/len(text),rands(0,1,1)[0])
linear_extrude(h[i%len(h)]) text(text[i],rSize,font,halign=halign);
}
Giấy phép
File mô hình
Đang tải files, vui lòng chờ...
Vui lòng đăng nhập để bình luận.
Vui lòng đăng nhập để khoe bản in của bạn.
Chưa có bản in nào được khoe. Hãy là người đầu tiên!
Chưa có bình luận nào. Hãy là người đầu tiên!