Command of the Week - Rename & Reorder [Symbol Catalog Management] (Week 39)
This series is called the command of the week, but it could also explain a feature. The explanations will tend to explain the technical parts of the command, and is intended to highlight the basics (and complexities) of the command, and information about how to use it, but won't be a detailed tutorial. It is up to you to use it creatively in your maps.
Week 39 - Rename & ReorderWhen working with symbol catalogs, names and ordering are important. You'll normally want your symbol to have a fitting name (as well as a unique name to avoid naming collision with other symbols that might be used in the same map), and you want the order of symbols to make sense, especially if you plan on taking advantage of symbol groups, which in addition to providing a collapsing group to keep the catalog window more organized, you can also use features like random selection from the group, or on the fly swapping between symbols in the group when you are placing them. There are commands in the Symbol Manager window to both rename symbols, as well as change the order of them, but these commands operate on single symbols at a time, and is a hassle when you wish to do major changes.
To make this more efficient, CC3+ has a command to export the name of the symbols to a plain text file, which you can then open in any text editor to either rename OR reorder the symbols (Don't do both in one go). This also means that you can use an advanced text editor with good search/replace functionality to do advanced renaming, such as adding a specific suffix to all the symbols, clean up numbering or whatever you wish.
Where to find them?Menu: Symbols -> Rename & Reorder -> Create symdef name file, Import reordered symdefs, Import renamed symdefs
Command Line: SYMLST, SYMORDER, SYMRENAME
How to use themThe first thing to remember when using these features is that you can EITHER rename OR reorder your symbols using this method. If you need to do both, you MUST do it in two passes. Don't be tempted to fix that spelling mistake while you are reordering the symbols.
Open op the symbol catalog you wish to modify in the main map window (i.e. as a map, and not in the symbol catalog window). You can also open up a regular map if you just wish to change the symbol names in a map, for example to fix symbol name collisions.
When using these commands, the first thing you need to do is to export a text file containing your symbol names. This is done by using the 'Create symdef name file' command. You can save this file to any name you wish, but you should use the .LST file extension for this. This is the default extension provided by the save dialog, unless you override it. The extension makes life a bit easier, because when you try to import it again, those dialogs only list .LST files by default, so using this extension saves you a step later.
You'll end up with a plain text file containing all the symbol names from the file opened in step 1 above.
Open your symbol list in any text editor. I prefer a text editor with some advanced capabilities, such as Notepad++, but plain old Notepad will also work. Note that since this file carries the extension .LST instead of the more usual .TXT extension used by text files, you can't just double click on it, you have to open your desired text editor first, and from there, use the 'Open' command of that program, browse to the symbol name file, and open it. You may also need to change the filter in the open dialog to have it display all files, and not just common text file types.
Edit your symbol list file in the text editor. As stressed above, it is important that you EITHER change the order of the lines OR rename the symbols, but NEVER do both in one pass since CC3+ won't be able to determine which lines belongs to which symbol in that case.
Note that when renaming symbols, symbol names cannot be longer than 31 characters. CC3+ will automatically truncate names that are too long, but if you have multiple names all starting with the same 31 characters, they end up with the exact same name after being truncated, which will cause issues, so keep an eye on the length of the names.
Also, never remove lines from the file. Even if you see a symbol in there you don't want, delete it from the Symbol Manager in CC3+, don't just remove it from the list file.
I recommend you stick to normal English characters and number, spaces and simple punctuation (comma, full stop, brackets, dash, underscore). CC3+ does not support Unicode in Symbol names, so foreign characters and special symbols (like emoji) will not render and may theoretically cause issues.
Save your edited file. Usually, there is no reason not to save over the existing file, no need to save to a new file.
In CC3+, do either 'Import reordered symdefs' or 'Import renamed symdefs', depending on what you did. It is very important to select the appropriate option here though. If you select renamed when you really did reorder the symbols, you'll end up with a symbol catalog where all the symbols have the wrong names.
If you now need to do the other operation (for example doing reordering after you've just done a renaming), simply start again from step 2.
Notes and Advanced TIps
- When you need to do both rename and reorder, you don't need to export the list file twice. Just export it once, then do renaming, save it, import it as a rename file in CC3+, then continue working on the same file in your text editor, this time do the reordering, and then import this file into CC3+ again, this time as a reorder file. The reason this works is that exporting a new list file right after importing one will just produce an identical fiel to the one just imported anyway. Of course, it is important that you didn't do anything to the symbol catalog in the Symbol Manager in between, and that you continue working on the same .lst file all throughout, DON'T go back to the original export for the second pass.
- If you need to manipulate many symbol catalogs, keep using the same .lst file, just overwrite it for each export. Most advanced text editors will detect that the file has been changed on disk, prompting you to open it. Saves you from manually opening it for each symbol catalog you process, as well as the risk of opening the wrong file.
- The reason why it is important to only do rename OR reorder in each pass is that CC3+ needs to know how to apply the changed lines of text to the symbols. There are no hidden information in a text file that CC3+ can use to automatically assign the correct line to the correct symbol, so it needs to look at the the same content you can see in the text editor. When you tell it that you have reordered the symbols, CC3+ knows that the names in the file will match the existing symbols, so it just uses that to find the new ordering. Likewise, when you tell CC3+ to apply a rename, it knows that the order of the symbols are the same, so it just applies new names from the file in order. But if you have also done reordering in the file and tell CC3+ it is a rename, CC3+ won't have any way to detect this, so it will simply treat it as a rename operation, effectively swapping the names on the symbols. Likewise, if you have done renaming in a file you tell CC3+ is a reorder, it won't be able to match the symbol with an entry in the text file, causing the symbol to keep its old name, and appear at the end of the list.