[Gmsh] Use of OpenCASCADE with an STL file?

Christophe Geuzaine cgeuzaine at uliege.be
Tue Jan 8 18:51:31 CET 2019



> On 8 Jan 2019, at 06:03, Gavin Ridley <gavin.keith.ridley at gmail.com> wrote:
> 
> Thanks very much Dr. Geuzaine for the reply. I've tried what you suggest below but get "Error: Unknown surface 2". The GUI however tells me that surface 2 was created as a face of the Box(2). Why is surface 2 unknown here?

Here's a working example for Gmsh 4 :

-------------- next part --------------
A non-text attachment was scrubbed...
Name: hybrid.geo
Type: application/octet-stream
Size: 248 bytes
Desc: not available
URL: <http://onelab.info/pipermail/gmsh/attachments/20190108/1decf31b/attachment-0001.geo>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.stl
Type: application/octet-stream
Size: 211331 bytes
Desc: not available
URL: <http://onelab.info/pipermail/gmsh/attachments/20190108/1decf31b/attachment-0001.stl>
-------------- next part --------------


Christophe

> 
> // Goal: create mesh between box and stl surface contained within.
> Merge "dingding.stl";
> Surface Loop(1) = {1};
> SetFactory("OpenCASCADE");
> 
> // This box fully bounds the .stl
> Box(2) = {-10,-20,-10, 49,100,60};
> 
> // Switch back to built-in to make a volume using the
> // OpenCASCADE-created surfaces of Box(2)
> SetFactory("Built-in");
> Surface Loop(8) = {2, 3, 4, 5, 6, 7};
> Volume(10) = {8, 1};
> Physical Volume("inside") = {10};
> 
> 
> PS: have you considered creating a forum rather than a mailing list? In my opinion it would be more easily searchable. It seems paraview somewhat recently switched to that model. 
> 
> On Mon, Jan 7, 2019 at 3:56 PM Christophe Geuzaine <cgeuzaine at uliege.be> wrote:
> 
> 
> > 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.
> 
> Christophe
> 
> 
> > 
> > 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 
> http://www.montefiore.ulg.ac.be/~geuzaine
> 
> Free software: http://gmsh.info | http://getdp.info | http://onelab.info
> 
> 
> 
> -- 
> Thanks,
> Gavin Ridley

? 
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