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

Automatically make physical groups from existing tags #2

Open
nicola-sorace opened this issue Oct 7, 2023 · 5 comments
Open

Automatically make physical groups from existing tags #2

nicola-sorace opened this issue Oct 7, 2023 · 5 comments

Comments

@nicola-sorace
Copy link

It is common to create gmsh physical groups from existing cadquery tags:

with GeometryQL() as geo:
    geo = (
        geo.load(geom)
        .faces(tag="blade").addPhysicalGroup("blade").end()
        .faces(tag="domain-sides").addPhysicalGroup("domain-sides").end()
        .faces(tag="domain-top").addPhysicalGroup("domain-top").end()
        .faces(tag="domain-bottom").addPhysicalGroup("domain-bottom").end()
    )

It would often make sense for all tags to be transferred automatically. In cases where this is not desirable it could be enabled/disabled via a flag. Could also ignore tags that start with _.

@afshawnlotfi
Copy link
Member

Added to the next release TODO

@afshawnlotfi afshawnlotfi moved this to Todo in MeshQL Oct 8, 2023
@afshawnlotfi
Copy link
Member

@nicola-sorace Changes are here:
https://github.com/OpenOrion/meshql/tree/feature/auto-label

Let me know if this works for you

@nicola-sorace
Copy link
Author

@afshawnlotfi Looks good. In the case of overlapping tags it seems that the more recently defined ones win, which works pretty well. Could still add the "skip tags that start with underscores", but it doesn't seem as necessary now since I can just reorder them.

@nicola-sorace
Copy link
Author

This skips tags that start with underscores:

def _transfer_tags_to_physical_groups(self, skip_underscored=True):
    for tag, workplane in self._pre_split_workplane.ctx.tags.items():
        if skip_underscored and tag[0] == '_':
            continue
        self._add_physical_groups_for_objects(workplane.vals(), tag)

@afshawnlotfi
Copy link
Member

Yeah might just make the function publicly accessible and you can pass the underscore option in through the func params, instead of having a top-level option on load.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

2 participants