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

add a method to get the list of available template #137

Open
gmalinve opened this issue Jun 21, 2023 · 6 comments · May be fixed by #147
Open

add a method to get the list of available template #137

gmalinve opened this issue Jun 21, 2023 · 6 comments · May be fixed by #147
Assignees
Labels
enhancement New features or code improvements good first issue Easy to solve for newcomers

Comments

@gmalinve
Copy link
Contributor

If it's possible it would be nice to have a method to get the list of all available templates and all their details.
Thanks!

@gmalinve gmalinve added the enhancement New features or code improvements label Jun 21, 2023
@jgsdavies jgsdavies assigned jgsdavies and unassigned jgsdavies Jun 21, 2023
@jgsdavies jgsdavies added the good first issue Easy to solve for newcomers label Jun 21, 2023
@gmalinve
Copy link
Contributor Author

it would be good to have as output the details shown in the template's window (type, application, drive etc.)

@jgsdavies jgsdavies assigned jgsdavies and JackB-Ansys and unassigned jgsdavies Jun 27, 2023
@jgsdavies
Copy link
Collaborator

jgsdavies commented Jun 27, 2023

The way Motor-CAD finds the template info is by searching the .mtt files in the templates folder. The files are plain text so just need to loop through and pull out:
'main_title'
Lots of extra info (type/drive type etc) in 'DataFile_Notes'

I think it would make sense to return this as a list of dictionaries e.g.
[{'template': 'e9', 'winding type': 'stranded'}, {'template': 'i1', 'winding type': 'distributed'}]

Try to get all the same info as templates form if possible.

@ravi-ansys
Copy link
Collaborator

@jgsdavies I may need a suggestion. I have now the templates in dictionary format. i added under geometry .py file. Check branch add_template_list.
However i doubt it is not attached to Motor-CAD object. May you suggest where to add this list of template in code.

@jgsdavies
Copy link
Collaborator

jgsdavies commented Jul 25, 2023

Hi @ravi-ansys, not sure this is the best way to do this since it won't update if the Motor-CAD templates change.

My suggestion is:

  • Get file path of \templates folder. This will be under \Motor-CAD Data\templates. You can get the directory of the current Motor-CAD with: image
  • Loop through all files in this folder with .mtt extension and retrieve the appropriate info directly from the .mot file e.g.
    image

@ravi-ansys
Copy link
Collaborator

@jgsdavies thanks for the tip. I wasn't aware about the command to get the installation director.
Should i put the template list method (reading the .mtt files with Data_File_notes) under rpc_methos_geometry.py

@jgsdavies
Copy link
Collaborator

@ravi-ansys Try writing this as a script first and then we can think about where it can live. The issue with rpc_methods_geometry.py (or any of the methods files) is that we don't have access to the other functions, e.g. get_variable

@ravi-ansys ravi-ansys linked a pull request Jul 27, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New features or code improvements good first issue Easy to solve for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants