[Gmsh] Cutting a hole out of a surface with BooleanDifference

Christophe Geuzaine cgeuzaine at uliege.be
Wed Sep 19 17:40:55 CEST 2018



> On 19 Sep 2018, at 16:43, Matthew Herman <m.w.herman at uu.nl> wrote:
> 
> Hello,
> 
> I am running Gmsh 4.0.1 and trying to use Boolean operators to subdivide (potentially complex) surfaces.
> As a simple test, I am cutting a circular hole through a surface. The following .geo file produces exactly what I expect (a hole in a square, planar surface):
> 
> SetFactory("OpenCASCADE");
> Mesh.CharacteristicLengthMin = 0.1;
> Mesh.CharacteristicLengthMax = 0.1;
> Point(1) = {0,0,1};
> Point(2) = {3,0,1};
> Point(3) = {3,3,1};
> Point(4) = {0,3,1};
> Line(1) = {1,2};
> Line(2) = {2,3};
> Line(3) = {3,4};
> Line(4) = {4,1};
> Line Loop(100) = {1,2,3,4};
> Plane Surface(100) = {100};
> Cylinder(200) = {1.5, 1.5, -2, 0, 0, 6, 0.5, 2*Pi};
> BooleanDifference{Surface{100};Delete;}{Volume{200};Delete;}
> 
> 
> In general, though, my surfaces are nonplanar, so I changed the coordinate of Point(1) and Plane Surface -> Surface in the .geo file:
> 
> SetFactory("OpenCASCADE");
> Mesh.CharacteristicLengthMin = 0.1;
> Mesh.CharacteristicLengthMax = 0.1;
> Point(1) = {0,0,1.2};
> Point(2) = {3,0,1};
> Point(3) = {3,3,1};
> Point(4) = {0,3,1};
> Line(1) = {1,2};
> Line(2) = {2,3};
> Line(3) = {3,4};
> Line(4) = {4,1};
> Line Loop(100) = {1,2,3,4};
> Surface(100) = {100};
> Cylinder(200) = {1.5, 1.5, -2, 0, 0, 6, 0.5, 2*Pi};
> BooleanDifference{Surface{100};Delete;}{Volume{200};Delete;}
> 
> 
> When I make this change, the Boolean difference operator no longer cuts a hole out of the curved surface. Gmsh also does not indicate any errors.
> Can someone please explain what is causing this behavior?

With OpenCASCADE the "Surface" command creates a "surface filling" - which I have a hard time understanding. For some reason there is something wrong in the orientation of wire in surface 100. You can get around this is Gmsh 4.0.1 by reversing line 1, i.e. by defining "Line(1) = {2,1};" - which is indeed very strange.

I have added a "forced" orientation fix in the creation of surface fillings in the GIT version. The next build should thus work without the hack...

Still, we need somebody with better insights into OpenCASCADE to better understand what the real problem/solution is. If anybody on the list can help, that would be great :-)

Christophe




> Thanks!
> 
> matt
> _______________________________________________
> gmsh mailing list
> gmsh at onelab.info
> http://onelab.info/mailman/listinfo/gmsh

— 
Prof. Christophe Geuzaine
University of Liege, Electrical Engineering and Computer Science 
http://www.montefiore.ulg.ac.be/~geuzaine

Free software: http://gmsh.info | http://getdp.info | http://onelab.info




More information about the gmsh mailing list