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

Allowing users to specify objects . object attributes not direclty in the source #32

Open
shimwell opened this issue May 16, 2021 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers hacktoberfest help wanted Extra attention is needed

Comments

@shimwell
Copy link
Contributor

When specifying the object to :select: there is a check to see if this object is the source.keys()

If the object is not in the source keys then an error is raised.
https://github.com/Peque/sphinxcadquery/blob/0b7050c0204b8b2c6f7e6912eaee97ca02b9e776/sphinxcadquery/sphinxcadquery.py#L69

In my case I have wrapped the CadQuery object with another object.

My cadquery object is not directly in the source so it is not found

For my use case it would be better if that RaiseError was swapped to a Warning as and I would be able to enter :select: my_reactor.solid

For example here I have to do cadquery_object = my_reactor.solid and then set :select: cadquery_object
https://paramak--836.org.readthedocs.build/en/836/example_neutronics_simulations.html#ball-reactor-ipynb

Ideally I would not include the cadquery_object = my_reactor.solid line in the example.

I admit this is quite a niche use case but something for consideration

@shimwell shimwell changed the title Allowing Allowing users to specify objects . object attributes not direclty in the source May 16, 2021
@Peque Peque added enhancement New feature or request good first issue Good for newcomers hacktoberfest help wanted Extra attention is needed labels May 16, 2021
@Peque
Copy link
Collaborator

Peque commented May 16, 2021

Yeah, we should probably check recursively for keys (i.e.: select.split(".") would give ["my_reactor", "solid"] and my_reactor should be in source.keys() and solid in my_reactor). Maybe there is a better (more direct) way to do this with Python than a for loop...

I'm in for allowing :select: my_reactor.solid (with the dot). 😊

@shimwell
Copy link
Contributor Author

I shall give eval(source) a try locally it should handle strings that have a variable or a variable with attribute.

It also returns an error if the variable / variable attribute combo is not found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers hacktoberfest help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants