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

It should be possible to assign an optional label to objects #2125

Open
hannobraun opened this issue Dec 6, 2023 · 1 comment
Open

It should be possible to assign an optional label to objects #2125

hannobraun opened this issue Dec 6, 2023 · 1 comment
Labels
topic: core Issues relating to core geometry, operations, algorithms type: feature New features and improvements to existing features

Comments

@hannobraun
Copy link
Owner

The problem

Validation errors are a fact of life, when implementing new functionality. But understanding what's causing them can be very hard, as it's not easy to identify what an object in the error message actually is. The same is probably true when working on non-trivial models.

A solution: labels

I think there is a relatively simple thing that could be done to improve this: Making it possible to assign an optional label to objects, so you can clearly associate what you see in the output with what you defined in the code.

These labels can be created and perpetuated by operations. For examples, if you have a sketch with a half-edge labeled "abc", then sweeping that sketch can create a label for the respective side face, something like "side face swept from abc". But this can be done piecemeal, as required, and doesn't need to fall into the scope of this issue.

Implementation

It might make sense to implement these labels as a separate layer, as to not further complicate the object graph and core data structures. ("Layers" are a concept that doesn't yet exist in the code base, at the time of writing, but see #2116 and #2117 for some thoughts on them.)

One possible hurdle is, that if labels are not part of the core data structures themselves, we need some way to inject them into the code that formats objects for the validation error messages. This can probably be done by creating Debug/Display implementations not for Handle itself, but for another struct that Handle can provide. Something like this: handle.display_with_label(label).

@hannobraun hannobraun added type: feature New features and improvements to existing features topic: core Issues relating to core geometry, operations, algorithms labels Dec 6, 2023
@hannobraun
Copy link
Owner Author

Layers now exist. I've implemented them as part of my work on #2117. It should be relatively straight-forward to implement the layer proposed in the issue description, although the problem with Debug/Display implementations remains.

I've also come to the conclusion that the concept presented here is more widely applicable than just debug output. By assigning labels to objects and amending those in operations, it should be possible to query for those labels. I'm not sure though, if those amended labels should be specific to operations ("side face swept from half-edge a"), or if that should be handled through a generic lineage (#1904), meaning a face can be derived from a half-edge, and the mechanism through which that happened (e.g. sweeping) would be incidental.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: core Issues relating to core geometry, operations, algorithms type: feature New features and improvements to existing features
Projects
None yet
Development

No branches or pull requests

1 participant