Edward-James Surveying banner

CSV to FBK Converter for Civil 3D

This is a utility written in Perl that converts a standard CSV file in PNEZD format into a FBK file that can be imported into Civil 3D.  The descriptions in the CSV file consist of short, easy-to-type commands that auto-generate linework when the FBK file is dumped into Civil 3D.  It is ideal for people with older data collectors that do not have a full alphanumeric keypad, as well as anyone who is trying to transition from Land Desktop to Civil 3D without getting bogged down in the details of the Equipment Database and the Survey Database.  Unfortunately, it may not be particularly easy to customize unless you have some programming experience.  But it may be used freely, without restriction. The code is not precompiled or hidden in any way; it may be freely edited and customized as desired.

Background

The entire FBK implementation leaves much to be desired.  Autodesk's implementation of the Survey Database is ignorant of GPS, which greatly reduces the usability of the entire feature.  The FBK format contains no provision for using a single field shot in multiple figures.  And the FBK implementation creates Survey Figures during the import process, rather than working on data that is already in C3D.  That means editing the data can be problematic, and many edits can only be performed by editing the FBK file and reimporting it, which can be a tedious, error-prone, and time-consuming task.

The net result is that the FBK functionality is a very unwelcome choice for professional surveyors, with limited capabilities.  But although it leaves much to be desired, it is far better than "connecting the dots", and drawing all linework manually in the office.  So while a more-productive choice is probably to purchase a third-party solution, such as the tools available from CadApps, Steltman, Dotsoft, Carlson, or others, the FBK solution can still provide significant productivity gains over manual methods.

The primary reason behind developing this utility was that we have some older data collectors that have only a numeric keypad.  Text is entered into these data collectors using a phone-style text entry, which is rather laborious.  We were able to dump alphanumeric Description Keys from Civil 3D into our data collectors, which let us enter point descriptions by typing only the first letter or two and then selecting the Description Key from a list, which works well.  But unfortunately, Civil 3D requires all Figure Commands to be placed inside of Notes in the data collector, and this feature does not work inside of Notes in our data collectors.  That meant that, in order to key figure commands in Notes the way Civil 3D wants us to, our field surveyors had to do a lot of painful typing on their data collectors.  This utility will parse a CSV dump of field data with linework commands embedded in the Point Descriptions, and turn it into a Civil 3D FBK file.  The field surveyors never need to use Notes, and can collect linework with very little typing in the data collectors.  And it was designed with numeric point codes in mind, so it does not confuse Point Code "1" with Point Code "10" or Point Code "100".

How it Works

Our surveyors use a list of numeric point codes; for example, a "Centerline of Pavement" shot is encoded with the point code "1" in our number system.  This utility parses the descriptions in the CSV file, and turns the numeric codes into an alphanumeric name, which is what gets dumped into Civil 3D.  This name is also used as the name of the Survey Figure.  For example, a point with the number "1" as the description would be inserted into Civil 3D as a shot with the description "CLPV".  If the point is part of a Survey Figure, the figure name would also be "CLPV".

In addition, a String Identifier may also be appended, so that multiple strings may be collected simultaneously.  For example, point code "3" is a "TOE" of slope.  A point with a description of "3.1" would come into Civil 3D with the description "TOE1", and "3.2" would be "TOE2", etc.

Figure Commands have one- or two-letter abbreviations.  For example, "B" is the same as the "BEG" command.  To begin a new figure, the surveyor would key something like "B 1" as the description.  In the FBK file, this becomes a Note line "BEG CLPV", followed by a sideshot with "CLPV" as the description.  If String Identifiers are used, then BEG, CONT, and END commands are added automatically, as-needed, and there is no need for the field surveyor to type them.  For example, two points with the description "1.1" would be connected together, even if there were intervening shots with different descriptions.

When using String Identifiers, it is also possible to use multiple descriptions for one point, separated by decimal points.  This allows the surveyor to take a single shot, and use that shot in multiple survey figures.  To accomplish this, the utility auto-generates additional points, so that each point code in the description gets inserted as a separate point.  For example, a shot with a description of "1.1.3.2" would result in TWO shots being inserted into Civil 3D - one with a "CLPV1" description, and the other with a "TOE2" description.  For a more complete description, including examples, see the following document:

FBK_from_CSV_using_Number_Codes.pdf

This document may be printed and given to the field surveyors to use as a reference.

Using the Utility

This utility is written using Perl, and is designed to be run from a Windows Command Prompt.  First, download and install a Perl compiler/interpreter, such as this (free) one:

ActiveState Perl Distribution

Download the Perl script below and place it in an easily-accessible directory (we use a /Perl directory on a network drive).  Then, so that you don't have to type any long path names, you may want to copy your CSV file to the same directory as the Perl script.  Then start a Windows Command Prompt, change to the directory containing the Perl script and CSV file, and run the script by typing the following at the Command Prompt:

perl fbk.pl MyFile.csv

If the routine creates any new point numbers (for points with multiple point codes, as in the "1.1.3.2" example above), the new points are numbered consecutively starting with the number 100000.  If you would like these points to be numbered starting at some other number, include that number as another argument to the perl script.  This command causes the new point numbers to start at 15000, instead of 100000:

perl fbk.pl MyFile.csv 15000

To download the utility, click on the following link:

fbk.zip (updated, including new .bat file, June 29, 2008)

The list of Point Codes is at the beginning of the Perl script.  This list contains the numeric code and its corresponding alphanumeric name, which should match the Description Keys and Figure Prefixes you have created in your Civil 3D drawing template.  I have left in a set of sample codes, which you may use and/or edit however you wish.

Simplifying the process

By performing a few additional steps, it can be much easier to run this process.  The download above contains a batch file, called fbk.bat.  Edit this batch file (in any text editor, such as Notepad) so that the paths point to the fbk.pl routine.  We keep the fbk.pl file in a Perl directory on our network drive, so the current setting is N:/Perl/fbk.pl.  Change this path in the .bat file so that it points to wherever you keep the fbk.pl file.

Now place the .bat file in a directory in your system Environment Path.  This is the Windows Environment Path, not the support path inside of Autocad.  One good location for the .bat file is the C:/Perl/bin directory, which gets created on your machine when you install the Perl interpreter.  By default, this directory should already be in your Environment Path.  Or, you can add a new directory to your environment path.  The environment path can be changed by right-clicking on My Computer, and going to the Advanced tab -> Environment Variables.

Once the .bat file is in a directory that is in your Environment Path, we can run it simply by typing "fbk" in the Command Prompt, from any directory.  So now, let's make it easy to open the Windows Command Prompt in any directory.

In Windows Explorer, go to Tools -> Folder Options -> File Types.  Select "Folder", as shown in the diagram below, and click on the "Advanced" button.  In the "Edit File Type" dialog that pops open, select "New..." to create a new action.  For the new Action, use "Command Prompt", and for the application used to perform the action, use "cmd.exe", as shown in the diagram.

Creating the "Command Prompt" action
Adding a new command action to the Windows right-click menu.

You should now be able to right-click on any directory and select "Command Prompt".  This will open a command window, right to the directory.  You may then run the Perl routine simply by typing "fbk" at the command prompt, as seen below. The result is an FBK file, contained in the same directory as the CSV file.

Running the routine from the Command Prompt
Converting the CSV file to an FBK file in the command window.