Tutorial :: Adding distance to a routefile

Many route developers often find that they need to add in an extra bit of distance in part of their route, or indeed add a whole other line to the existing one. Routefile code usually starts at 0m. However, if you wanted to a 30km (30,000m) section of line to the beginning of your route code, to create a longer route (such as what will happen in the Network North West), you would have to add 30,000 metres to every single distance in your routefile. This is very tedious, and can be complicated. It often leads to mistypes when done by hand, and causes the route to malfunction if done incorrectly.

The diagram below shows route code from Harcroft v2, and the numbers enclosed in the red square are the distances. You would have to add 30,000m to each of those numbers, and the rest which are not visible in this small screenshot - "Oh god!" you think...?




I have, however, come up with a great way to overcome this problem, with the help of my Dad. Follow these instructions to add "x" amount of distance in metres to your routefile. 

Step 1

Open your route folder, and double click on your required CSV routefile.

Step 2

Scroll down to your distances in the With Track section, and click in your "0" metres distance cell/box. Check what the cell number is eg: A1, and note it down.

Step 3

Drag downwards/highlight to select all your distances, and then "Right click > Copy" the distances you have selected.

Step 4

Now click "File > New" , and a new Spreadsheet should appear.

Step 5

Look at the cell number you noted down. What is it? Find the same cell in your new Spreadsheet. Eg: A1 in your new sheet.  

Step 6

Paste your copied values into this box, and they should line up (cell number wise) with your original .csv code ones.
Now click "File > Save As" and save your new normal Excel (.xls) file as something simple into your route folder, where you .csv file lives.


Step 7

Jump back to you .csv file, and to your "0m" cell. This formula that you need to paste into the box is as follows:
 


=SUM([Book1.xls]Sheet1!A396+10000) - Highlight and copy this code!

All the variables can be changed accordingly to suit your needs.


Step 8

One that formula is paste into your "0m" cell, paste the same formula into your next couple of distances whether they be 25m or whatever). Simply change the cell number to suit it. So, the next one down from 0m/A396, would be 25m /A397 etc.

Step 9

Once this is done is above 3 or 4 of you first distances, simply highlight these 3 or 4, and drag the highlighting box down over all your distances. Once they are all highlighted, just let go, and you'll see all your distances have had the same distance added to them.

Step 10

  • Click "File > Save".
  • Close you .csv file down from Excel.
  • Go to your route folder, and drag your newly edited .csv file into Notepad. 
  • Click "File > Save As", and save it as what ever you like, and add .csv to the end. 
  • Change the "Save as type:" to All Files
  • Click save.
Your file should now work.

Don't delete your saved .xls document - that will have to stay unfortunately. If you are clever enough though, you could adapt the formula you used to direct your .csv to look for your .xls file in a completely different directory, to get it out of the way.

All projects on this page are
This add-on contains copyright material

All content on this page is © to BVE Routes & Trains unless stated otherwise in the ReadMe.

Back To Top▲
This page is valid CSS! This page is valid HTML 4.01! All Text, Files & Images are Copyright© 2005-2010 BVE Routes & Trains. Design is Copyright© 2007 David Astarita and © 2008 BVE Routes & Trains . Unless otherwise stated. All rights reserved.