-
Notifications
You must be signed in to change notification settings - Fork 0
/
rectangle_rounded.as
35 lines (27 loc) · 865 Bytes
/
rectangle_rounded.as
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// AngelCAD sample: rectangle_rounded.as
// demonstrate creating a rounded rectangle using 2d minkowski
shape@ main_shape()
{
double sz = 50;
// create a rounded rectangle using 2d minkowski
// object a represents the 'path'
shape2d@ path = rectangle(dx:sz,dy:sz*0.5,center:true);
// object b represents the 'brush'
shape2d@ brush = circle(r:sz/10);
// move the 'brush' along the 'path'
shape2d@ myshape= minkowski2d(a:path,b:brush);
bool STL=true; // change to false to create DXF
if(STL) {
// STL requires 3d, so extrude in z-direction
return linear_extrude(myshape,height:sz*0.1);
}
else {
// alternatively, return as 2d object to create DXF file
return myshape;
}
}
void main()
{
shape@ obj = main_shape();
obj.write_xcsg(GetInputFullPath(),secant_tolerance:-1.0);
}