Moved stl file copy to module

This commit is contained in:
Edgar P. Burkhart 2022-01-26 18:06:08 +01:00
parent d10118d14b
commit 77838e186b
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
2 changed files with 16 additions and 7 deletions

View file

@ -14,6 +14,7 @@ import subprocess as sp
import urllib.error
from .grafana import Silencer
from .stl import copy_stl
_t0 = time()
@ -68,13 +69,8 @@ if config.getboolean('stl', 'copy', fallback=False):
log.error(f'STL from directory does not exist ({stl_in})')
sys.exit(1)
stl_dir = case_dir.joinpath('constant', 'triSurface')
if stl_dir.exists():
log.info(f'Deleting stl directory ({stl_dir})')
shutil.rmtree(stl_dir)
log.info(f'Copying stl directory ({stl_in} -> {stl_dir})')
shutil.copytree(stl_in, stl_dir)
log.info(f'Copying stl directory ({stl_in})')
copy_stl(stl_in, case_dir)
if config.getboolean('blockMesh', 'enable', fallback=False):
log.info('Running blockMesh')

13
openfoam/run/stl.py Normal file
View file

@ -0,0 +1,13 @@
import shutil
import logging
log = logging.getLogger('stl')
def copy_stl(stl, case):
stl_dir = case.joinpath('constant', 'triSurface')
if stl_dir.exists():
log.info(f'Deleting stl directory ({stl_dir})')
shutil.rmtree(stl_dir)
log.info(f'Copying stl directory ({stl} -> {stl_dir})')
shutil.copytree(stl, stl_dir)