About Localizing or Modifying Subassembly Codes

For localization purposes, the AutoCAD Civil 3D stock subassemblies use an external codes file to define the point, link, and shape codes referenced in the subassemblies.

The external codes file is named C3DStockSubassemblyScripts.codes and is located in the same folder as the C3DStockSubassemblyScripts.dvb file and/or C3DStockSubassemblies.dll file. By default, on English-language based systems, this location is typically C:\ProgramData\Autodesk\C3D <version>\enu. For non-English-language-based systems, the “enu” location corresponds to the appropriate language or region.

The codes file is associated with each subassembly with the CodesSpecific module in the .dvb file. The following sections explain the definition of the code files and how to edit it or add point, link, and shape codes to it.

The CodesSpecific module is in the CodesSpecific.vb file of the C3DStockSubassemblies VB project in the case of .NET subassemblies, and in the .dvb file in the case of VBA subassemblies.

Understanding the C3DStockSubassemblyScripts.codes File

You can open the C3DStockSubassemblyScripts.Codes file with any text editor. Add comments in this file by adding // in front of a sentence. Do not leave any blank lines in the file. Each code line is separated with a return character. Each code definition is comprised of the following components, separated by commas:

Note: Codes files must be saved in Unicode format. For example, if you are using Notepad to update the codes file, when you save the file, the Save As dialog box lets you choose an encoding method. Make sure you choose Unicode.

The following is an example of a code definition line in the C3DStockSubassemblyScripts.codes file:

38,BottomCurb,BottomCurb,Bottom of curb for a curb without gutter.

The Index number is: 38

The Localized Code is: BottomCurb

The Original Code is: BottomCurb

The Code Description is: Bottom of curb for a curb without gutter.

Modifying Default Codes for AutoCAD Civil 3D Stock Subassemblies

To change or localize code display names, open the C3DStockSubassemblyScripts.codes file in a text editor and change the Localized Code and or corresponding code description.

For example, the display name of the Curb Bottom can be changed by editing the following bolded components in the C3DStockSubassemblyScripts.codes file as follows:

38,BottomKerb,BottomCurb,Bottom of kerb for a kerb without gutter

Adding a New Code to the AutoCAD Civil 3D Stock Subassemblies

If you want to modify existing subassemblies to new codes, or add a new subassembly module, and you would like to use the same structure as default content, for .NET subassemblies you can do the following:

  1. Add <New Code> at the end of the C3DStockSubassemblyScripts.Codes file, with a new index, localized name, original code, and optional description.
  2. In the CodesSpecific.vb of the C3DStockSubassemblies VB project, add the following at the end of the AllCodes structure: Public <New Code> as CodeType
  3. In the CodesSpecific.vb of the With/End With block of the FillCodeStructure routine, add the following at the end: GetFromCollection colCodesAndDescriptionHashtable, n, .<NewCode>
  4. Declare the default value, in case the codes file is not found, for the CodesDefault(<New Code Index>) in InitializeDefaults() function of the CodesSpecific module.
  5. Change the size of array CodesDefault in the CodesSpecific module in the Dim statement.

A new code added using these procedures can be used for any existing or new .NET-coded subassemblies in AutoCAD Civil 3D Stock Subassemblies.

For VBA subassemblies, you can do the following:

  1. Add <New Code> at the end of the C3DStockSubassemblyScripts.Codes file, with a new index, localized name, and optional description.
  2. In the CodesSpecific module of C3DStockSubassemblyScripts.dvb file, add the following at the end of the AllCodes structure: g_s<New Code> as CodeType
  3. In the CodesSpecific file, in the With/End With block of the FillCodeStructure routine, add the following at the end: GetFromCollection colCodesAndDescriptionHashtable, n, .g_s<NewCode>
  4. Declare the default value, in case the codes file is not found, for the g_arrDefaults(<New Code Index>) in InitializeDefaults() function of the CodesSpecific module.
  5. Change the size of array g_arrDefault in the CodesSpecific module.

A new code added using these procedures can be used for any existing or new VBA-coded subassemblies in AutoCAD Civil 3D Stock Subassemblies.

Note: The process of associating point codes is primarily done for easy localization of default content. If you are writing custom subassemblies, you do not have to follow this procedure. You can create a new module that contains a customized list of codes your subassemblies can reference. You can also bypass this process by hard-coding strings locally within each module.

Localizing Subassembly Catalogs and Tool Palettes

The default subassemblies are generally defined for a wide range of clients and geographical regions. You may want to change some of the display names of catalogs, palettes, tools, or tool variables as applicable to various situations and languages. These catalogs and tool palettes are composed in XML format, in .atc files, and can be edited.

Note: By default, on English-language-based systems, the AutoCAD Civil 3D subassembly tool catalog .atc files are installed to C:\ProgramData\Autodesk\C3D <version>\enu\Tool Catalogs\Road Catalog.

The following list identifies the data element values you can change in the subassembly tool catalog .atc file for localization purposes:

Note: Only the values of a data element should be changed, not the data element name itself (such as Width in the BasicLane subassembly). These data elements are global variable names that are used in subassembly scripts.

Installing Country Kits, Customized Codes Files, or Locale-specific Codes Files

If you plan to install a country kit that contains a region-specific codes file, or, if you plan to install (use) a codes file that contains region-specific content, you must do the following before installing the country kit, or before installing the customized codes file.

Make a backup copy of the region-specific or customized codes file, rename it to the default name of your installed codes file (for example, for English version products, the default codes file is named C3DStockSubassemblyScripts_US.codes) and copy it to the following location: C:\ProgramData\Autodesk\C3D <version>\enu. For non-English-language based systems, the “enu” location should correspond to the appropriate locale.

Note that when AutoCAD Civil 3D is first installed on a new machine, the following two versions of the codes file are installed:

The C3DStockSubassemblyScripts_<locale>.codes file (in this example, C3DStockSubassemblyScripts_US.codes) is installed to provide a backup mechanism for securing codes file content.

When a country kit that contains a region-specific codes file is installed, the localized codes file is installed to C3DStockSubassemblyScripts.codes overwriting the existing file, and a copy is made at C3DStockSubassemblyScripts_<locale>.codes. If you have modified your C3DStockSubassemblyScripts.codes file, this is why it is important to make a backup of it before installing the country kit, or locale-specific codes file.

Troubleshooting Codes File Issues

If you are experiencing unexpected results when using customized subassemblies, or when performing certain AutoCAD Civil 3D corridor modeling tutorials, this may be due to the drawing attempting to reference codes file information that it cannot find. In some cases, these issues can be resolved by updating your existing codes file so that it contains the necessary information.