Therefore you might not want to use the same kind of variable name, since in order to get the tag you'll have to use s2 instead of simply s2. Keep in mind that copy will return a variable of the same kind (list of tuples), i.e. NB: when copying only one entity, I think either the inner parentheses or the brackets are superfluous, and otherwise you have to provide a list of tuples of the form. It's the same thing with transformations such as rotate, symmetrize etc. Regarding your error with copy, you have to specify the dimension of the entity to be copied, and not just the tag (check the documentation, which refers to dimTag). But I found this discussion in the Gmsh mailing list archive, which may be helpful. It's probably too late, but you never know. Is there a better way to do this than what I am trying to do with the dilation? In the end, what I want to accomplish is the following: draw a spline through a list of points, create a scaled copy of this spline, draw lines between the start and end points, and create a plane surface bounded by the two splines and lines. These can all be done from the Geometry Menu under Elementary entities->Add->New. Assuming I was able to accomplish the same with the API, how do I then refer to the three new points that the scaled spline goes through, for example, if I wanted to draw a line between the start point of the original spline and that of the scaled spline? In a single plane (2D), create the geometry by first creating all points, then combining the points into lines, and then the lines into a surface. Am I missing something here? I have tried, for example, to call () before attempting to call copy(), but this had no effect.įinally, when I use the dilate transformation in the Gmsh GUI using Modules - Geometry - Elementary entities - Transform - Scale, checking the Apply scaling on copy option in the dialog, on the example spline from above, I indeed get a scaled version of the curve as expected, including the three points. The error code, 1, seems to indicate that the tag of the original spline ( s1) cannot be found when copy() is called. I get ValueError: ('gmshModelGeoCopy returned non-zero error code: ', 1). Secondly, when I try to make a copy of a spline like in this example: p1 = (-1, 0.5, 0, 0.1)
But is there any way to get the full Gmsh script out of the API? I assume this has something to do with the _unrolled part. This extension does the trick mostly, but it seems that any meshing operations (such as marking curves as transfinite) or transformations (such as dilate) are not written to the output file when using gmsh.write('test.geo_unrolled'). geo_unrolled extension is supported for the gmsh.write() function, but not just.
I looked through the source code of the Gmsh API and found that the. There are a few issues I am running into:įirst of all, I would like to be able to write Gmsh script files (. geo examples used to obtain the above graphs.I am trying to write a script that will automatically mesh geometries for CFD analysis using the Gmsh Python API. I hope someone has a concrete idea or even a hunch on where to find the solution for the issue.įor completeness I'm adding the simplified. As the geometry is constructed, commands are automatically. We then rotate three copies of the shape and unite them all, and apply one more fillet. I should note that I believe I need the unite step to tie the different geometrical features together, that I've tried many different minor variations to produce 3D results like the one depicted above but none resulted in the intended mesh and that my web search was unhelpful. Creating a 3D model using constructive solid geometry (new in Gmsh 3.0) We create a simple part by computing the boolean difference between a block and a cylinder and applying a parametric fillet. the sphere outside is not meshed, only the cut section. What the above showcases is the intended behaviour in 2D where (continuous) interfaces are retained, but although in 3D the sphere locations are still visible from the outside, the internal surface is no longer existent, i.e. I can graphically depict this by performing the 2D mesh step, in both 2D and 3D: Lost and volumes are actually united completely removing the interface. I do the equivalent in 3D, my volumetric geometrical information is This works like a charm in 2D, however, when whenever I incorporate inclusions I perform a unite step, such that the different geometrical features are recognized but the interfacesĪre joined in the mesh.I'm using the OpenCASCADE geometry kernel because this facilitates convenient boolean operations to remove parts of the inclusions outside my considered domain box. In an attempt to create three-dimensional volumes with inclusions in Gmsh I stumble upon a problem which was non-existent in the two-dimensional case.