From d9452879caab004d220940933aaa6222afead8f9 Mon Sep 17 00:00:00 2001 From: Craig Warren Date: Tue, 6 Jun 2017 11:06:34 +0100 Subject: [PATCH] Corrected bug with replacing #tx_steps and #rx_steps commands in 3D models. --- tools/inputfile_old2new.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tools/inputfile_old2new.py b/tools/inputfile_old2new.py index 5f555a94..d7324f48 100644 --- a/tools/inputfile_old2new.py +++ b/tools/inputfile_old2new.py @@ -157,18 +157,24 @@ while(lindex < len(inputlines)): if model2D: # Syntax of old command: #tx_steps: dx dy replacement = '#src_steps: {} {} {}'.format(params[0], params[1], 0) - print("Command '{}', replaced with '{}'".format(inputlines[lindex], replacement)) - inputlines.pop(lindex) - inputlines.insert(lindex, replacement) + else + # Syntax of old command: #tx_steps: dx dy dz + replacement = '#src_steps: {} {} {}'.format(params[0], params[1], params[2]) + print("Command '{}', replaced with '{}'".format(inputlines[lindex], replacement)) + inputlines.pop(lindex) + inputlines.insert(lindex, replacement) lindex += 1 elif cmdname == '#rx_steps': if model2D: # Syntax of old command: #rx_steps: dx dy replacement = '#rx_steps: {} {} {}'.format(params[0], params[1], 0) - print("Command '{}', replaced with '{}'".format(inputlines[lindex], replacement)) - inputlines.pop(lindex) - inputlines.insert(lindex, replacement) + else + # Syntax of old command: #rx_steps: dx dy dz + replacement = '#rx_steps: {} {} {}'.format(params[0], params[1], params[2]) + print("Command '{}', replaced with '{}'".format(inputlines[lindex], replacement)) + inputlines.pop(lindex) + inputlines.insert(lindex, replacement) lindex += 1 elif cmdname == '#medium':