I’m generating individual meshes for rectangular pipes (using square(...)
) and combining them with +
. I’d like to extract the external boundary of the union of these meshes to create a mesh without internal overlaps or duplicated boundaries. Is there a recommended way to do this, or do I need to reconstruct everything from border
definitions?
real L = 10.0; // vertical pipe
real H = 8.8; // horizontal pipe
real framed = 0.0635; // frame pipe dia. (2.5 in)
real branchd = 0.0254; // branch pipe dia. (1 in)
real spacing = 2.5; // distance between branch centers
real offset = 1.25; // distance from top-bot to first-last branch
int nbranches = int((L - 2*offset)/spacing) + 1;
func mesh addrect(real a, real b, real w, real h) {
int nx = 10;
int ny = 10;
return square(nx, ny, [a + w*x, b + h*y]);
}
mesh Th = addrect(0, 0, H, framed); // bottom
Th = Th
+ addrect(0, L - framed, H, framed) // top
+ addrect(0, 0, framed, L) // left
+ addrect(H - framed, 0, framed, L); // right
for (int i = 0; i < nbranches; ++i) {
real ypos = offset + i * spacing;
Th = Th + addrect(0, ypos - branchd/2, H, branchd);
}
plot(Th, wait=1, cmm="Piping mesh");