[Gmsh] Use of OpenCASCADE with an STL file?

Gavin Ridley gavin.keith.ridley at gmail.com
Tue Jan 8 19:50:24 CET 2019


Thanks Dr. Geuzaine, this appears to work flawlessly. For anyone on the
mailing list who seeks to do a similar input with a box rather than sphere,
this is input that works:

SetFactory("OpenCASCADE");
> Box(1) = {-10,-20,-10, 49,100,60}; // Change to suit needs
> Delete { Volume{1}; }
>
> SetFactory("Built-in");
> Merge "thing.stl";
> Surface Loop(1) = {1,2,3,4,5,6};
> Surface Loop(2) = {7};
> Volume(9) = {2};
> Volume(10) = {2,1};
> Physical Surface("walls") = {6, 1, 2, 5};
> Physical Surface("inlet") = {3};
> Physical Surface("outlet") = {4};
> Physical Surface("thing") = {7};
> Physical Volume("inside") = {10};
>

On Tue, Jan 8, 2019 at 12:51 PM Christophe Geuzaine <cgeuzaine at uliege.be>
wrote:

>
>
> > 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 :
>
>
>
> 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
>
>

-- 
Thanks,
Gavin Ridley
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://onelab.info/pipermail/gmsh/attachments/20190108/13041229/attachment.html>


More information about the gmsh mailing list