ansys / pyworkbench

PyWorkbench
http://workbench.docs.pyansys.com/
MIT License
3 stars 4 forks source link

Save and Archive Feature with Workbench Client #127

Closed abhishekchitwar closed 3 weeks ago

abhishekchitwar commented 1 month ago

šŸ“ Description of the feature

I would like to request an enhancement for saving and archiving projects in the Workbench Client.

This enhancement involves the use of the launch_workbench() function.

šŸ’” Steps for implementing the feature

Implement methods such as save_project and archive_project.


def save_project(self, project_name):  
  workdir = GetServerWorkingDirectory()  
  path = os.path.join(workdir, f"{project_name}.wbpj")  
  save_string = f"""import os  
workdir = GetServerWorkingDirectory()  
path = os.path.join(workdir, "{project_name}.wbpj")  
Save(FilePath=path, Overwrite=True)"""  
  self.run_script_string(save_string)  
def archive_project(self, project_name):  
  workdir = GetServerWorkingDirectory()  
  path = os.path.join(workdir, f"{project_name}.wbpz")  
  archive_string = f"""import os  
workdir = GetServerWorkingDirectory()  
path = os.path.join(workdir, "{project_name}.wbpz")  
Archive(FilePath=path , IncludeExternalImportedFiles=True)"""  
  self.run_script_string(archive_string)  

šŸ”— Useful links and references

No response

franknli commented 3 weeks ago

This is now implemented by the new download_project_archive function, which will be available as release 0.7.0.