Moved stl file copy to module
This commit is contained in:
parent
d10118d14b
commit
77838e186b
2 changed files with 16 additions and 7 deletions
|
@ -14,6 +14,7 @@ import subprocess as sp
|
||||||
import urllib.error
|
import urllib.error
|
||||||
|
|
||||||
from .grafana import Silencer
|
from .grafana import Silencer
|
||||||
|
from .stl import copy_stl
|
||||||
|
|
||||||
|
|
||||||
_t0 = time()
|
_t0 = time()
|
||||||
|
@ -68,13 +69,8 @@ if config.getboolean('stl', 'copy', fallback=False):
|
||||||
log.error(f'STL from directory does not exist ({stl_in})')
|
log.error(f'STL from directory does not exist ({stl_in})')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
stl_dir = case_dir.joinpath('constant', 'triSurface')
|
log.info(f'Copying stl directory ({stl_in})')
|
||||||
if stl_dir.exists():
|
copy_stl(stl_in, case_dir)
|
||||||
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)
|
|
||||||
|
|
||||||
if config.getboolean('blockMesh', 'enable', fallback=False):
|
if config.getboolean('blockMesh', 'enable', fallback=False):
|
||||||
log.info('Running blockMesh')
|
log.info('Running blockMesh')
|
||||||
|
|
13
openfoam/run/stl.py
Normal file
13
openfoam/run/stl.py
Normal 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)
|
Reference in a new issue