[Gmsh] Use of OpenCASCADE with an STL file?

Christophe Geuzaine cgeuzaine at uliege.be
Mon Jan 7 21:56:37 CET 2019

> On 7 Jan 2019, at 05:24, Gavin Ridley <gavin.keith.ridley at gmail.com> wrote:
> Hello all,
> I'd like to define a volume using an OpenCASCADE Box entity, then subtract a volume defined by an STL from it.
> I have attempted to Merge my .stl file into the geometry with the OpenCASCADE kernel already loaded, then attempt the same operation as above. This is the behavior I expect to work, for instance, attempting:
> SetFactory("OpenCASCADE");
> Merge "dingding.stl"; 
> CreateGeometry; 
> Surface Loop(1) = {1};
> Volume(1) = {1}; 
> // And some more stuff... 
> Unexpectedly ends up giving:
> Error   : Unknown OpenCASCADE surface with tag 1
> Error   : 'dingding.geo', line 3 : Could not add surface loop
> Error   : Unknown OpenCASCADE surface loop with tag 1
> Error   : 'dingding.geo', line 4 : Could not add volume
> And without OpenCASCADE, the volume gets created successfully.

Indeed, OpenCASCADE does not support STL surfaces, while the built-in CAD kernel treats them as "discrete surfaces".

Note that as long as you don't want to do boolean operations on these surfaces, you can actually combine both CAD kernels, e.g. create a "Built-in" volume that is delimited by both a "Built-in" surface and an "OpenCASCADE" surface. Depending on your application this could do the trick.


> Is it the case that OpenCASCADE and merged .stl files are incompatible at the moment in gmsh? Ideally I'd like to generate a CFD mesh for an obstruction ( from.stl file) in a channel (from OpenCASCADE geometry), generating a boundary layer mesh as well around the STL file.
> -- 
> Thanks,
> Gavin Ridley
> _______________________________________________
> gmsh mailing list
> gmsh at onelab.info
> http://onelab.info/mailman/listinfo/gmsh

Prof. Christophe Geuzaine
University of Liege, Electrical Engineering and Computer Science 

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

More information about the gmsh mailing list