// AngelCAD code. Sweep a profile with holes along a path
shape2d@ profile_with_holes()
{
rectangle outer(100,100,center:true); // outer border
rectangle rl(65,10,center:true); // long rect. hole
shape2d@ rl1 = rotate_z(deg:0)*translate(0,-40)*rl;
shape2d@ rl2 = rotate_z(deg:90)*translate(0,-40)*rl;
shape2d@ rl3 = rotate_z(deg:180)*translate(0,-40)*rl;
shape2d@ rl4 = rotate_z(deg:270)*translate(0,-40)*rl;
rectangle rs(25,10,center:true); // short rect. hole
shape2d@ rs1 = rotate_z(deg:45)*translate(0,-20)*rs;
shape2d@ rs2 = rotate_z(deg:135)*translate(0,-20)*rs;
shape2d@ rs3 = rotate_z(deg:225)*translate(0,-20)*rs;
shape2d@ rs4 = rotate_z(deg:315)*translate(0,-20)*rs;
// compute & return final profile
return outer - (rl1 + rl2 + rl3 + rl4)
- (rs1 + rs2 + rs3 + rs4)
- rectangle(10,10,center:true);
}
shape@ main_shape()
{
array<pos3d@> p = { pos3d(0,0,0), pos3d(0,0,30), pos3d(25,20, 200) };
array<vec3d@> v = { vec3d(0,1,0), vec3d(0.1,1,0), vec3d(0.3,1,0) };
spline_path@ path = spline_path(p,v);
return sweep(profile_with_holes(),path);
}
void main()
{
shape@ obj = main_shape();
obj.write_xcsg(GetInputFullPath());
}
Last active
January 22, 2019 07:55
-
-
Save arnholm/931bba4633ca344a3ffe0698b945395f to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment