This document describes how RailCOMPLETE uses 2D symbols from a DNA, and how to create the symbols.
RailCOMPLETE expects a 2D symbol library. This should be a single dwg file with all the available
blocks in the blocktable. The name of the file is set by the DNA through the <SymbolLibraryPath>
element. The blocks will be inserted with insertion point at the blocks position(0,0)
.
AutoLISP files are text files that can be written in any text editor. In order to get the best working experience we recommend using Visual Studio Code (VS Code, a general text editor) with the AutoCAD AutoLISP extension. See Autodesk’s documentation for help setting this up. Another option is using the built in Visual LISP Integrated Development Environment in AutoCAD. See Autodesk’s documentation for more info.
The code for constructing the symbol blocks is found in the [adm]/2D
folder. If using VS Code we
recommend opening the 2D folder with VS Code.
The source code is located in the _SRC
folder. Inside _SRC
the folder Utilities
contains
files defining utility and helper functions used by the main code to help with drawing the symbols. The “Main” folder contains the code that actually draws the symbols. This is organized by the “99_Main.lsp” file which contains functions calling a function for each subject matter.
The code for each subject matter is organized by a main file and a folder, with the main file calling functions contained in the folder, with the functions in the folder actually drawing the symbols. For
example in the Norwegian DNA the C:MAIN
function in 99_main.lsp
calls 23_GENERATE-TRACK-AND-EMBANKMENT-OBJECTS
in 23_TrackAndEmbankment.lsp
which calls BUFFER-STOPS
in
TrackAndEmbankmend/Buffer Stop.lsp
which creates schematic and annotative blocks for three kinds of buffer stops.
The code contains a lot of comments, and is hopefully quite readable. All functions drawing symbols should contain sketches of the symbols in comments. See _CODING_STYLE_GUIDE_/_The good and the bad coding example.lsp
for tips on how to write nice code for this project.
To interact with the code: Change the symbols adm
and github
in one of the files in the _BOOTSTRAPS
folder to fit the location of the lisp files on your system. Once edited you can run this file. In VS Code this is done by - making sure AutoCAD is running with an open drawing -
press F5
or click the Start debugging
button.
Running the bootstrap file will load some functions from the _2D Symbol Library Commands.lsp
file.
The most important functions are (MkLib)
and (Init)
.
(MkLib)
builds the complete 2D library. This can take a long time, depending on the resolution of certain symbol groups. To build, attach to a blank drawing, run (MkLib)
and save the drawing once the function is finished.(Init)
readies the environment for interactive use. Many symbol drawing functions use constants and helper functions set ut by this function. After running (Init)
, you can run load and run the code for specific symbols. This is mainly useful when developing and debugging.