Managing Symbol Libraries
Source code
Although 2D symbols are loaded at run time from a single binary library file, the source code may be spread over several directories and files.
Source code for the symbols resides in: project/sde/src/appmodule/symbol
Here appmodule is one of pm, pi, or pd.
There can be subdirectories under "symbol". The symbol directory should have at least one subdirectory: Private. This directory stores symbols which are not intended to be shown in the selection list of the "Insert 2D Symbol" command. Typically this includes:
- custom text (Text)
- custom lines (Line)
- custom dimension end symbols (Dimension)
- common "math" routines, i.e. script language routines which are not 2D symbols but are useful in constructing 2D symbols.
Subdirectory names are inserted into the symbol library as pseudo symbols.
The name of any subdirectory for symbol directory must be a valid script language function name. It cannot start with number and must not include "-", etc... Symbol names must also not overlap subdirectory names.
All source code files are expected to have the extension name.asy.
Compilation
The compilation of separate script source files to a single binary library is run via a shell script. This script first builds a combined source file into a temporary file and then compiles it.
The script works as follows:
- %PMS_HOME%/include/sym.h is included at the beginning of the source file.
- The directory named symbol is scanned recursively and all files ending in ".h" are added to the source file.
- The same directory is scanned again recursively to find all files ending ".asy"; these are added to the source, except those under subdirectory Private.
- %PMS_HOME%/include/symutls.h is included into the source. Names of the functions in this file are not shown in the 'Insert Symbol' selection list.
- Subdirectory Private is scanned recursively and all ".asy" files are added to the source. Names of the functions in this file are not shown in the 'Insert Symbol' selection list.
- The CADMATIC script compiler ( DM _ SC ) is invoked to compile the source file into binary format library to the directory: project/sde/hosttype.bin/appmodule/lib.
Note: Any error messages at compilation or at run time refer to the source file in /tmp.
The shell scripts that do the compilation are:
- Cre_pd2dsym.sh
- Cre_pm2dsym.sh
- Cre_pi2dsym.sh
The shell scripts remove the combined source file after the compilation, unless the option
Interface for inserting 2D symbols
Insert menu
The basic method to insert a 2D symbol is to first select "Insert Symbol" from the main menu of the 2D drafting module. Then the user can select from a menu the symbol with correct name.
The insert menus are generated at run time based on the original source file/directory layout prior the compilation of the 2D symbol library. Only symbols in Private are recursively removed from the selection list.
Menu icons
It is possible to furnish the menu selections (2D symbols or submenu selections) with an icon.
The name of the icon must be:
name.2ds
where name is either the name of the 2D symbol or the base name of the subdirectory.
Icons are searched from the standard places.