ansys / pyworkbench

PyWorkbench
http://workbench.docs.pyansys.com/
MIT License
2 stars 1 forks source link

Save and Archive Feature with Workbench Client #127

Open abhishekchitwar opened 5 days ago

abhishekchitwar commented 5 days 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