Using your second option, you may use BooleanFragments. Try at the end of your file:
// Surface{7,8,9,10,11,12} In Volume{1}; // Comment out this line Physical Volume(100) = {1}; aux() = BooleanFragments{ Volume{1}; Delete; }{ Surface{7:12}; Delete;}; Printf("", aux()); // For checking the numbers of the generated geometrical entities // For visibility Recursive Color Red{Volume{1};} Recursive Color Yellow{Surface{7:12};} With regard to your first option, you can only create rectangles in the XY plane, but you can translate and rotate to place them where you want. HTH Ruth — Prof. Ruth V. Sabariego KU Leuven Dept. Electrical Engineering ESAT/Electa, EnergyVille http://www.esat.kuleuven.be/electa http://www.energyville.be Free software: http://gmsh.info | http://getdp.info | http://onelab.info On 8 Feb 2018, at 22:13, Sathyanarayan Rao <sathyanarayan....@uclouvain.be<mailto:sathyanarayan....@uclouvain.be>> wrote: Dear GMSH team, I am trying to generate a cube with each face having a rectangular surface that will be later identified as a sensor. 1) In case I want to use rectangle command of opencascade is it possible to create rectangle other than in XY plane ? ``` SetFactory("OpenCASCADE"); Mesh.Algorithm3D = 4; // 3D mesh algorithm (1=Delaunay, 4=Frontal, 5=Frontal Delaunay, 6=Frontal Hex, 7=MMG3D, 9=R-tree) R = 0.05; w = R; Box(1) = {-R,-R,-R, 2*R,2*R,2*R}; Rectangle(10) = {-R/2,-R/2,-R, R,R}; Rectangle(11) = {-R/2,-R/2,R, R,R}; ``` 2) When I manually create surfaces in each face of the cube, they come as separate regions in 3D mesh. ``` SetFactory("OpenCASCADE"); Mesh.Algorithm3D = 4; // 3D mesh algorithm (1=Delaunay, 4=Frontal, 5=Frontal Delaunay, 6=Frontal Hex, 7=MMG3D, 9=R-tree) R = 0.05; R1 = R; w = R; Box(1) = {-R,-R,-R, 2*R,2*R,2*R}; q = 0.005; /* Right electrode */ RE = 300; Point(RE+1) = { R1, R1/2, R1/2, q}; Point(RE+2) = { R1, -R1/2, R1/2, q}; Point(RE+3) = { R1, -R1/2, -R1/2, q}; Point(RE+4) = { R1, R1/2, -R1/2, q}; Line(RE+13) = {RE+4, RE+1}; Line(RE+14) = {RE+1, RE+2}; Line(RE+15) = {RE+2, RE+3}; Line(RE+16) = {RE+3, RE+4}; Line Loop(RE+7) = {RE+16, RE+13, RE+14, RE+15}; Plane Surface(7) = {RE+7}; Physical Surface(10000) = {7}; /* Left electrode */ RE = 400; Point(RE+1) = { -R1, R1/2, R1/2, q}; Point(RE+2) = { -R1, -R1/2, R1/2, q}; Point(RE+3) = { -R1, -R1/2, -R1/2, q}; Point(RE+4) = { -R1, R1/2, -R1/2, q}; Line(RE+13) = {RE+4, RE+1}; Line(RE+14) = {RE+1, RE+2}; Line(RE+15) = {RE+2, RE+3}; Line(RE+16) = {RE+3, RE+4}; Line Loop(RE+7) = {RE+16, RE+13, RE+14, RE+15}; Plane Surface(8) = {RE+7}; Physical Surface(10001) = {8}; // create plate electrodes /* back electrode */ RE = 500; Point(RE+1) = { R1/2, -R1, R1/2, q}; Point(RE+2) = { -R1/2, -R1, R1/2, q}; Point(RE+3) = { -R1/2, -R1,-R1/2, q}; Point(RE+4) = { R1/2, -R1, -R1/2, q}; Line(RE+13) = {RE+4, RE+1}; Line(RE+14) = {RE+1, RE+2}; Line(RE+15) = {RE+2, RE+3}; Line(RE+16) = {RE+3, RE+4}; Line Loop(RE+7) = {RE+16, RE+13, RE+14, RE+15}; Plane Surface(9) = {RE+7}; Physical Surface(10002) = {9}; /* front electrode */ RE = 600; Point(RE+1) = { R1/2, R1, R1/2, q}; Point(RE+2) = { -R1/2, R1, R1/2, q}; Point(RE+3) = { -R1/2, R1,-R1/2, q}; Point(RE+4) = { R1/2, R1, -R1/2, q}; Line(RE+13) = {RE+4, RE+1}; Line(RE+14) = {RE+1, RE+2}; Line(RE+15) = {RE+2, RE+3}; Line(RE+16) = {RE+3, RE+4}; Line Loop(RE+7) = {RE+16, RE+13, RE+14, RE+15}; Plane Surface(10) = {RE+7}; Physical Surface(10003) = {10}; /* top electrode */ RE = 700; Point(RE+1) = { R1/2,R1/2,R1, q}; Point(RE+2) = { -R1/2,R1/2, R1,q}; Point(RE+3) = { -R1/2, -R1/2,R1, q}; Point(RE+4) = { R1/2, -R1/2,R1, q}; Line(RE+13) = {RE+4, RE+1}; Line(RE+14) = {RE+1, RE+2}; Line(RE+15) = {RE+2, RE+3}; Line(RE+16) = {RE+3, RE+4}; Line Loop(RE+7) = {RE+16, RE+13, RE+14, RE+15}; Plane Surface(11) = {RE+7}; Physical Surface(10004) = {11}; /* bottom electrode */ RE = 800; Point(RE+1) = { R1/2,R1/2,-R1, q}; Point(RE+2) = { -R1/2,R1/2, -R1,q}; Point(RE+3) = { -R1/2, -R1/2,-R1, q}; Point(RE+4) = { R1/2, -R1/2,-R1, q}; Line(RE+13) = {RE+4, RE+1}; Line(RE+14) = {RE+1, RE+2}; Line(RE+15) = {RE+2, RE+3}; Line(RE+16) = {RE+3, RE+4}; Line Loop(RE+7) = {RE+16, RE+13, RE+14, RE+15}; Plane Surface(12) = {RE+7}; Physical Surface(10005) = {12}; Surface{7,8,9,10,11,12} In Volume{1}; Physical Volume(100) = {1}; ``` Somehow the command "Surface{} In Volume" seems to not care for what I want. Please let me know how can I get a cube with each face having a rectangular surface with its own physical number. ________________________________ Best Regards, Sathyanarayan Rao, PhD student Earth and Life Institute/Environmental Sciences (ELI-e) Université catholique de Louvain c.037, Croix du Sud 2, Louvain-la-Neuve, Belgium Phone: 010473827 ( intercom 73827) ________________________________ _______________________________________________ gmsh mailing list gmsh@onelab.info<mailto:gmsh@onelab.info> http://onelab.info/mailman/listinfo/gmsh
_______________________________________________ gmsh mailing list gmsh@onelab.info http://onelab.info/mailman/listinfo/gmsh