///////////////////////// // Geometric Inputs radius = 3.25; blc = radius/1; Box = 3*radius; lc = radius/1; ts = 1; // height of toroid tx = radius; // radial width of toroid, measured in centre of ring tl = 0; // centre of rotation ///////////////////////////////////// // Large Bounding box X0 = -Box; X1 = Box; Y0 = -Box; Y1 = Box; Z0 = -Box; Z1 = Box; pp = newp; Point(pp) = {X0, Y0, Z0, blc}; Point(pp+1) = {X1, Y0, Z0, blc}; Point(pp+2) = {X1, Y1, Z0, blc}; Point(pp+3) = {X0, Y1, Z0, blc}; lv = newl; Line(lv) = {pp,pp+1}; Line(lv+1) = {pp+1,pp+2}; Line(lv+2) = {pp+2,pp+3}; Line(lv+3) = {pp+3,pp}; Line Loop(lv+4) = {lv, lv+1, lv+2, lv+3}; bs = news; Plane Surface(bs) = {lv+4}; v[] = Extrude {0, 0, Z1-Z0} { Surface{bs}; }; ///////////////////////////////////////// // Make a toroid tpp = newp; Point(tpp ) = { tx, 0, 0, lc}; Point(tpp+1) = { ts+tx, 0, 0, lc}; Point(tpp+2) = { tx, ts, 0, lc}; Point(tpp+3) = { tx, -ts, 0, lc}; Point(tpp+4) = {-ts+tx, 0, 0, lc}; cc = newc; Circle(cc ) = {tpp+1, tpp, tpp+2}; Circle(cc+1) = {tpp+2, tpp, tpp+4}; Circle(cc+2) = {tpp+4, tpp, tpp+3}; Circle(cc+3) = {tpp+3, tpp, tpp+1}; ll = newll; Line Loop(ll) = {cc, cc+1, cc+2, cc+3}; rs = news; ps = news; Plane Surface(ps) = {ll}; tv1[] = Extrude {{0, 1, 0},{-tl,0,0}, 2*Pi/3} { Surface{ps} ;}; tv2[] = Extrude {{0, 1, 0},{-tl,0,0}, 2*Pi/3} { Surface{tv1[0]};}; tv3[] = Extrude {{0, 1, 0},{-tl,0,0}, 2*Pi/3} { Surface{tv2[0]};}; cv = newv; Compound Volume(cv) = {tv1[1], tv2[1], tv3[1] }; //cs = news; //Compound Surface(cs) = {tv1[0], tv2[0], tv3[0] }; // Not correct? Surface{tv1[0]} In Volume{v[1]}; //Surface{tv2[0]} In Volume{v[1]}; //Surface{tv3[0]} In Volume{v[1]}; Physical Volume(1) = {v[1]};