[Gmsh] How to duplicate things "programmatically"?

Joseph Frippiat frippiat.j at kst.be
Thu Jul 5 17:21:21 CEST 2012


Hello,

I try to duplicate a volume and 2 surfaces programmatically and I cann't.
I can duplicate the volume OR the surfaces but not both of them.

Thanks for any help.

Here is my code (the problematic part of it)  :

/// l'inducteur 2 (le plus en arrière)
//pind2 = point arrière inducteur 2
pind2[]+=newp; Point(newp) = { 0, 0,                      -e1-e2+isol, 
lcgros}; // 1
pind2[]+=newp; Point(newp) = { (r1+isol)*Sin[angle/2], 
(r1+isol)*Cos[angle/2], -e1-e2+isol, lcgros}; // 2
pind2[]+=newp; Point(newp) = { (r2-isol)*Sin[angle/2], 
(r2-isol)*Cos[angle/2], -e1-e2+isol, lcgros}; // 3
pind2[]+=newp; Point(newp) = {-(r2-isol)*Sin[angle/2], 
(r2-isol)*Cos[angle/2], -e1-e2+isol, lcgros}; // 4
pind2[]+=newp; Point(newp) = {-(r1+isol)*Sin[angle/2], 
(r1+isol)*Cos[angle/2], -e1-e2+isol, lcgros}; // 5

//lind2 = ligne arrière inducteur 2
lind2[]+=newl; Line(newl)   = {pind2[1], pind2[2]};
lind2[]+=newl; Circle(newl) = {pind2[2], pind2[0], pind2[3]};
lind2[]+=newl; Line(newl)   = {pind2[3], pind2[4]};
lind2[]+=newl; Circle(newl) = {pind2[4], pind2[0], pind2[1]};

//llind2 = line loop arrière inducteur 2
llind2=newll; Line Loop(newll) = {lind2[]};

//surfind2 = surface arrière inducteur 2
surfind2=news; Plane Surface(news) = {llind2};

//volind2 = volume inducteur 2
out[] = Extrude {0, 0, e2-2*isol} { Surface{surfind2}; };
volind2=out[1];
surfdind2=out[2]; // surface droite inducteur 2
surfgind2=out[4]; // surface gauche inducteur 2
Delete out;

/// L'inducteur 1 (le plus en avant, identique à l'inducteur 2)
//volind1 = volume inducteur 1
//volind1 = Translate {0, 0, e2+2*e1} { Duplicata{ Volume{volind2};} };
//surfdind1 = Translate {0, 0, e2+2*e1} { Duplicata{ Surface{surfdind2}; 
} };
//surfgind1 = Translate {0, 0, e2+2*e1} { Duplicata{ Surface{surfgind2}; 
} };
out[] = Translate {0, 0, e2+2*e1} { Duplicata{ Volume{volind2}; 
Surface{surfdind2,surfgind2};} };
volind1=out[0];
surfdind1=out[1];
surfgind1=out[2];
Delete out;





More information about the gmsh mailing list