[Gmsh] coloring 2d surfaces

jeremy theler jeremy at talador.com.ar
Wed Apr 24 00:38:24 CEST 2013


Dear all,

Find attached a simple geometry 2D file with a central square surronded by two 
symmetrical rectangles. Assume the central square is made of one material and 
the two rectangles are made of another one. Hence, I have two physical 
entities, one with the central square and other with the two rectangles.

Now, for the automatic preparation of figures for a report by means of a bash 
script, I would like to have gmsh to paint the meshes of the rectangles in one 
color (say red) and the central square in another one (say green).

By entering 

Color Green {Surface {12};}
Color Red {Surface {14, 16};}

I get the two rectangles in different kinds of red (see attached png). I have 
tried to reference the physical entity with no luck.

Moreover, I did not get how the property Mesh.ColorCarousel works.


BTW, the geo file is just and example I made up in order to ask the question. 
What I want to accomplish involves more surfaces and physical entities, but 
the geo files are also only two-dimensional geometries.

Any help would be appreciated.
Thanks in advance.
--
jeremy

-------------- next part --------------
lc = 0.2;
a = 2;
b = 1;
h = 2;

Point(1) = {-0.5*a,   0, 0, lc};
Point(2) = { 0.5*a,   0, 0, lc};
Point(3) = { 0.5*a+b, 0, 0, lc};
Point(4) = { 0.5*a+b, h, 0, lc};
Point(5) = { 0.5*a,   h, 0, lc};
Point(6) = {-0.5*a,   h, 0, lc};
Point(7) = {-0.5*a-b, h, 0, lc};
Point(8) = {-0.5*a-b, 0, 0, lc};
Point(9) = {-0.5*a,   0, 0, lc};

Line(1) = {1, 2};
Line(2) = {2, 3};
Line(3) = {3, 4};
Line(4) = {4, 5};
Line(5) = {5, 6};
Line(6) = {6, 7};
Line(7) = {7, 8};
Line(8) = {8, 1};
Line(9) = {2, 5};
Line(10) = {1, 6};

Line Loop(11) = {1, 9, 5, -10};
Plane Surface(12) = {11};
Line Loop(13) = {9, -4, -3, -2};
Plane Surface(14) = {13};
Line Loop(15) = {8, 10, 6, 7};
Plane Surface(16) = {15};

Physical Surface(17) = {12};
Physical Surface(18) = {16, 14};

Color Green {Surface {12};}
Color Red {Surface {14, 16};}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: color.png
Type: image/png
Size: 56248 bytes
Desc: not available
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20130423/a408c2aa/attachment.png>