apply the boolean operation in freecad (in the options you can choose "compsolid" mode) and then export to brep alternatively use the gmsh command "Coherence" I suggest you search online for further information on compsolids in freecad and thr coherence command in gmsh
On Fri, Apr 6, 2018, 03:05 Benedikt Oswald <benedikt.oswald@lspr.swiss> wrote: > Dear juan, thank you very much for your detailed answer! > > In fact, our workflow definitely requires geometry construction in > > Freecad and then meshing in gmsh; nevertheless, I > > will try to debug the problem along your suggested > > procedure. > > thanks again and greetings, Benedikt > > > > Am 05.04.18 um 17:22 schrieb Juan Sanchez: > > Hello Benedikt, > > > > I am using the OpenCascade factory to do the Boolean Operations in > > gmsh. This is using the pygmsh python module to help automate the > > process: > > > > https://github.com/nschloe/pygmsh/tree/master/pygmsh > > > > The boolean operations can then be performed using code like this: > > https://github.com/nschloe/pygmsh/issues/164 > > > > import pygmsh > > geom = pygmsh.opencascade.Geometry( > > characteristic_length_min=0.1, > > characteristic_length_max=0.1, > > ) > > > > def create_vol_volume(geom, h, w, l, x, z, cr, lcar=100): > > f = 0.5*w > > y = [-f,-f+cr, +f-cr, +f] > > z = [z, z + (h-cr), z + h] > > f = 0.5 * cr > > points = [] > > points.append(geom.add_point((x, y[0], z[0]), lcar=lcar)) > > points.append(geom.add_point((x, y[0], z[1]), lcar=lcar)) > > points.append(geom.add_point((x, y[1], z[1]), lcar=lcar)) > > points.append(geom.add_point((x, y[1], z[2]), lcar=lcar)) > > points.append(geom.add_point((x, y[2], z[2]), lcar=lcar)) > > points.append(geom.add_point((x, y[2], z[1]), lcar=lcar)) > > points.append(geom.add_point((x, y[3], z[1]), lcar=lcar)) > > points.append(geom.add_point((x, y[3], z[0]), lcar=lcar)) > > > > lines = [] > > lines.append(geom.add_line(points[0], points[1])) > > lines.append(geom.add_circle_arc(points[1], points[2], points[3])) > > > > lines.append(geom.add_line(points[3], points[4])) > > lines.append(geom.add_circle_arc(points[4], points[5], points[6])) > > lines.append(geom.add_line(points[6], points[7])) > > lines.append(geom.add_line(points[7], points[0])) > > > > line_loop=geom.add_line_loop(lines) > > surface=geom.add_plane_surface(line_loop) > > vol = geom.extrude(surface, translation_axis=[l, 0, 0])[1] > > return vol > > > > > > h_top=40 > > corner_radius=2.5 > > > > z_vol=0 > > h_vol=25 > > w_vol=10 > > l_vol=100 > > x_vol=-0.5*l_vol > > vol=create_vol_volume(geom, h=h_vol, w=w_vol, l=l_vol, x=x_vol, > > z=z_vol, cr=corner_radius) > > > > z_vol2=0 > > l_vol2=50 > > t_vol2=1 > > w_vol2=w_vol+2*t_vol2 > > h_vol2=h_vol+t_vol2 > > x_vol2=x_vol + 0.5*(l_vol-l_vol2) > > vol2=create_vol_volume(geom, h=h_vol2, w=w_vol2, l=l_vol2, x=x_vol2, > > z=z_vol2, cr=corner_radius) > > vol2=geom.boolean_difference([vol2], [vol], delete_first=True, > > delete_other=False) > > geom.boolean_fragments([vol2, vol], [], delete_first=True, > delete_other=False) > > print(geom.get_code()) > > > > > > And then you can label the volumes as physical volumes and mesh the > > resulting geo file. > > > > Regards, > > > > Juan > > > > On Thu, Apr 5, 2018 at 5:53 AM, Benedikt Oswald > > <benedikt.oswald@lspr.swiss> wrote: > >> Dear gmsh developers > >> > >> I recently tried to mesh a geometry (made in Freecad) which consists of > >> two volumes where a smaller volume was > >> > >> subtracted in Freecad from the larger one. When I mesh the two volumes I > >> would need tetrahedra > >> > >> and that are conformal between the two volumes. Would you have a > >> suggestion on how > >> > >> to achieve this ? At the moment, gmsh does not really produce a > >> conformal mesh. > >> > >> I attach the files in question. > >> > >> Thanks a lot in advance and greetings, Benedikt > >> > >> > >> > >> > ---------------------------------------------------------------------------------------------------------------------- > >> Dr. sc. techn. Benedikt Oswald - first engineer - LSPR AG - phone +41 > 43 366 90 74 > >> Grubenstrasse 9, CH-8045 Zürich, benedikt.oswald@lspr.swiss > >> > ---------------------------------------------------------------------------------------------------------------------- > >> > >> > >> _______________________________________________ > >> gmsh mailing list > >> gmsh@onelab.info > >> http://onelab.info/mailman/listinfo/gmsh > >> > > _______________________________________________ > > gmsh mailing list > > gmsh@onelab.info > > http://onelab.info/mailman/listinfo/gmsh > > -- > > ---------------------------------------------------------------------------------------------------------------------- > Dr. sc. techn. Benedikt Oswald - first engineer - LSPR AG - phone +41 43 > 366 90 74 > Grubenstrasse 9, CH-8045 Zürich, benedikt.oswald@lspr.swiss > > ---------------------------------------------------------------------------------------------------------------------- > > > _______________________________________________ > gmsh mailing list > gmsh@onelab.info > http://onelab.info/mailman/listinfo/gmsh > -- -- jeremy theler www.seamplex.com
_______________________________________________ gmsh mailing list gmsh@onelab.info http://onelab.info/mailman/listinfo/gmsh