ansys/pyaedt

Add "ignore errors" flag to import_materials_from_file

isaacwaldron opened this issue · 2 comments

Description of the feature

Customer has requested a flag to allow ignoring errors that occur when importing materials with import_materials_from_file, e.g. missing keys that are treated as required. When successful, the method currently returns a list of the names of the imported materials. If backwards compatibility is desired, we could retain the existing return signature and expect the user to compare the imported materials against the expected values (i.e. the keys of the JSON's materials dictionary). If not required, we could extend the return signature to return an additional list of materials that could not be imported due to error.

Steps for implementing the feature

  1. Add an ignore_errors flag to the method call signature, defaulting to False.
  2. (Optional) add materials_failed_to_import sequence of material names to method return signature.
  3. Implement logic to ignore errors during material read, optionally retaining a list of material names that failed to import.

Useful links and references

No response

@isaacwaldron You seem to be pretty up to date with the problem, would you like to work on it ? :D
If not, could you add an example of data provided by a user with missing keys ?

@isaacwaldron Do you still plan to work on this ? Btw, I'd go with keeping the same signature if possible.