Register Applicable Program Namespaces

Level

Requirement

Applies to

ObjectARX, .NET and ObjectDBX modules

Program namespace is a rather broad definition of the places where loaded applications can make entries to register specific objects, data, or entry points. If you are adding elements to a container in which other applications may also add elements, chances are it is an applicable namespace. Notable exceptions include menu labels and other user interface constructs.

In addition to logical application names, applicable program namespaces include the following:

AcRx-registered class names

Names of classes using the ObjectARX runtime identifiable class facility are registered when an ObjectARX application is loaded. Attempting to register a class name twice in a single program session prevents the application from loading. If two applications that are supplied by different vendors have a common class name, they will mutually exclude each other until one of them is re-released with a different class name. To avoid conflicts, registered classes must have unique names.

For example:

class WxyzDataObject : public AcDbObject { ...

class WxyzVanity : public AcDbEntity { ...

Object class DXF name

Note: Classes published prior to AutoCAD 2000 are an exception to this rule.

New root-level dictionary entries

The names of the entries in the root level of the named object dictionary should start with a unique prefix. If an application needs to use the named object dictionary, it should create a single root-level entry of an object that, in turn, may own other objects pertaining to the application. Such entries can be instances of any appropriate object class, whether custom or built-in. AutoCAD generally uses instances of AcDbDictionary. The application is then free to construct whatever structure it requires inside this container object, using any name keys. You do not need to prefix objects nested in dictionaries or similar containers maintained by your application, except when you want the container to be manipulated by the user or other applications. In that case, the container defines another global namespace.

All additions to dictionaries that were not created by your application

If you add named objects to a dictionary that was not created by your application, consider prefixing your keys and names with a unique name unless the user specifies the name.

For example:

;; AutoLISP
(dictadd enameDict "WXYZ_Dict" enameXRecord);

// ObjectARX
pDictionary->setAt(ACRX_T("WXYZ_Dict"), pXRecord, idXRecord);

Symbol table entries

To avoid name conflicts between user-specified entries and those entries managed by applications for internal use, consider adding a unique prefix to the entries in all symbol tables managed by your application.

System registry paths under the AutoCAD root path

If you create a registry path under the AutoCAD root path (for example, to store application data), consider adding a unique prefix to the entry.

Command names for programmatic use

Create at least one version of each command with a unique prefix. Use this version whenever you call your own commands from the user interface or an application. For user convenience, you can provide a version of the commands without the unique prefix.

For example:

;; AutoLISP
(defun C:WXYZTILE ()
    (princ "\nDo Something!")
)

AcEd-registered command and group names

Command-group names should start with a unique prefix to allow for unique command-name searches across command groups. The unique prefix is optional for command names.

For example:

acedRegCmds->addCommand(ACRX_T("WXYZBathroom"), 
   ACRX_T("WXYZVANITY"), // Unique global name 
   ACRX_T("VANITY"), // Name for localization 
   ACRX_CMD_MODAL, 
   lpfnVanityCommand);

Global document symbols for LISP

If you are creating global document symbols, consider appending a prefix to the symbol's name.

For example:

*WXYZ-GLOB*

Summary info

The top level of any directory path added to the AutoCAD search paths should start with a unique prefix. (In other words, subdirectories do not need to repeat it.) Any file added to the search paths should include a unique prefix in its file name to prevent conflicts between directories.

For example:

C:\Program Files
  Autodesk
    AutoCAD 2021
      Fonts
      Sample
      Support
        WXYZBathroom
          Sinks
          Countertops
          Fonts
  Common Files
    Autodesk Shared
      WXYZBathroomEnu24.dbx
      WXYZBathroomDeu24.dbx
      AcmeEntities24.dbx

If your application must place common files in a location that is not yet listed in the %PATH% environment variable, append your separate location to the %PATH% setting. Do not add directories that contain product-dependent files to the path, such as ObjectARX applications.

Customization element IDs, file names, and group identifiers

Customization element IDs, group names, and file names should start with a unique prefix. Remember that associated context help file names are assumed to be <CUSTOMIZATIONGROUP>.chm.

Use the prefixed version of your commands in conjunction with the elements added to the user interface.

Help file names

Help file names should start with a unique prefix because they are to be located in the AutoCAD library search paths.

Application-specific CHM files should also start with a unique prefix. Before adding new commands, perform a check to see whether the command name already exists. The command and its help explanation should be included with a reference to the name of the application to which the command relates.

Support files

Consider adding a unique prefix to each and every support file that is specific to your application: DWT files, custom hatch patterns and linetypes, blocks among others.