@echo off
setlocal


rem ### Edit ###
set OUTPUT_FOLDER=%~dp0

set E3DS_COMPONENT=XXX
set TIMEOUT=360


rem ### Do Not Edit ###
set INPUT_FILE_NAME=%1
set SCRIPT_FOLDER=%~dp0..\COMMON

set WORK_DIR=%OUTPUT_FOLDER%\work\%~n1
set RESULTS_DIR=%OUTPUT_FOLDER%\result\%~n1
set HONDA_SUPPLIER_SCRIPT=%SCRIPT_FOLDER%\apply_honda_setting.rb


rem ### STEP BOM/JT to XPDMXML ###
set PID=184691
if /i "%~x1" == ".stpx" (
  set PID=175691
)

rem ### elybatch
set ELYBATCH=%E3DS_COMPONENT%\tools\win\elybatch.exe
rem ### files
set CONFIG_FILE=%~dp0honda_config.cfg
set SCENARIOFILE=%~dp0honda_scenario.xml
set PARAMETER_FILE=%~dp0honda_psf_to_xpdmxml.prm

rem ### mkdir
mkdir %WORK_DIR%
mkdir %RESULTS_DIR%

call :TRANSLATE %INPUT_FILE_NAME%

GOTO :END


rem *******************************************************
:TRANSLATE

set OUTPUT_FILE_NAME=%RESULTS_DIR%\%~n1
set LOG_NAME=%WORK_DIR%\%~n1.log
set XML_LOG_NAME=%~n1.xml
set SCENARIOLOG=%~n1_scenario_log.xml

"%ELYBATCH%" -f"%CONFIG_FILE%" -p%PID% -w"%WORK_DIR%" -i%INPUT_FILE_NAME% -o"%OUTPUT_FILE_NAME%" -u"%LOG_NAME%" -X"%XML_LOG_NAME%" -c"%PARAMETER_FILE%" -t%TIMEOUT% -S"%SCENARIOFILE%" -U"%SCENARIOLOG%"

goto :EOF
rem *******************************************************


:END
endlocal
