Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify process of creating planar shapes with holes #12

Closed
ghost opened this issue Jan 6, 2016 · 2 comments
Closed

Simplify process of creating planar shapes with holes #12

ghost opened this issue Jan 6, 2016 · 2 comments

Comments

@ghost
Copy link

ghost commented Jan 6, 2016

Hi @nschloe,

Great work! I have just started to work with Gmsh and thought a Python interface would be quite nice. Initially I wanted to develop it myself but then I found your package. I have some suggestions for a few small additions which would be much appreciated.

Currently, I want to mesh a rectangular domain with a polygonal-shaped hole (e.g. flow around a cylinder, airfoil, etc.). For this I need two Line Loops: one for the rectangle and one for the polygon. Then I define a Planar Surface using these two loops, et voila!

This can be done using your package quite straightforwardly by first creating points, then lines, then line loops and finally the planar surface. No problem. However, because you already provide the very sweet method add_polygon, I suggest you to also add something like add_polygon_loop. This way, the user does not have to create points and lines manually just for having a hole in a surface.

So you already have this:

def add_polygon(self, X, lcar):
        # Create points.
        p = [self.add_point(x, lcar) for x in X]
        # Create lines
        e = [self.add_line(p[k], p[k+1]) for k in range(len(p)-1)]
        e.append(self.add_line(p[-1], p[0]))
        ll = self.add_line_loop(e)
        s = self.add_plane_surface(ll)
        return s

from that you can create add_polygon_loop with no effort at all:

def add_polygon_loop(self, X, lcar):
        # Create points.
        p = [self.add_point(x, lcar) for x in X]
        # Create lines
        e = [self.add_line(p[k], p[k+1]) for k in range(len(p)-1)]
        e.append(self.add_line(p[-1], p[0]))
        ll = self.add_line_loop(e)
        return ll

Similar things can also be done for all other methods that provide planar shapes (e.g. for the circle, rectangle etc.).

I am going to fork your project and add this for the polygon case. I will send you a pull request when I'm done. Let me know what you think of this.

@ghost
Copy link
Author

ghost commented Jan 11, 2016

As of the merge of pull request #13: d4632cb, this issue can be closed.

@ghost ghost closed this as completed Jan 11, 2016
@wagenaartje
Copy link

wagenaartje commented Jun 6, 2022

Has this functionality been removed? I cannot seem to find the add_polygon_loop function. Edit: this 'hollow' functionality seems to have been replaced by occ.Geometry.boolean_difference!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant