I guess that's a problem with the order of your commands and coherence. The coherence is active by default, so if you duplicate a volume that shares surfaces with another volume, you can loose them, I mean the numbering changes.
What you can do is setting the Coherence to 0, when extruding and duplicating and then put it back to 1. That is: Geometry.AutoCoherence=0; ==== your code === Coherence; Ruth -- Dr. Ir. Ruth V. Sabariego University of Liege, Electrical Engineering & Computer Science, Applied & Computational Electromagnetics (ACE), phone: +32-4-3663737 - fax: +32-4-3662910 - http://ace.montefiore.ulg.ac.be/ On 05 Jul 2012, at 17:21, Joseph Frippiat wrote: > 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; > > > _______________________________________________ > gmsh mailing list > [email protected] > http://www.geuz.org/mailman/listinfo/gmsh
_______________________________________________ gmsh mailing list [email protected] http://www.geuz.org/mailman/listinfo/gmsh
