Naming conventions

General rules

The child library parts automatically inherit all parameters of the parent in the subtype hierarchy.
Parameters are identified by their name, so inherited and original parameters can have the same name.
It is the responsibility of the library author to avoid conflicts by using descriptive parameter names prefixed with abbreviated library part names.
For handler parameters and user-defined parameters, GRAPHISOFT has introduced a parameter naming convention in its libraries.

Note:
Handlers add extra functionality to library parts (e.g. doors and windows cut holes in walls).
Parameter names with the prefix ac_ are reserved for special parameters associated with handlers (e.g. “ac_corner_window”).
Check the standard Library subtype templates for the complete list.
Standard GRAPHISOFT parameter names are marked with the gs_ prefix (e.g. “gs_frame_pen”). Please check the library parts for reference.
Use these parameters in your GDL scripts to ensure full compatibility with GRAPHISOFT libraries and macros.
FM_ is reserved for ArchiFM (e.g. FM_Type).

Variable names

Variable and parameter names should be related with the function of the parameter.
mixedCase: starts with a lowercase letter; every new word should start with an uppercase letter. E.g.: size, bRotAngle180, upperLeftCorner

Don’t use one or two letter variable names – no one will know what you meant (not even you, after a few months).
You should use a prefix in generally used variable names to denote general categories.
This can spare time when someone needs to find out the type of a variable or parameter.
Don’t forget to replace the prefix if you change the meaning of a variable or parameter.

Variable/parameter prefixes

Prefix Meaning Example
i General integer value / integer index iRiser
n Integer value – amount of something nRiser
b Boolean value bHandrail
st String type value stPanelTypes
x X coordinate of a point xRailPos
y Y coordinate of a point yRailPos
pen Pen color penContour
lt Linetype ltContour
fill Fill type fillMainBody
mat Surface type matCover

Using underscores (_) is recommended for distinguishing variables and parameters in the same script:
use single underscore (_) prefix for a variable in a script,
and double (__) for a variable declared and used only inside a subroutine section.
Do not use underscores in the beginning of parameter names, or to separate words in a name.
Historical names coming from subtypes are exceptions.

Example:

_iDoorTypes = iDoorTypes
! "_iDoorTypes" variable gets the value of "iDoorTypes" parameter
gosub "exampleScript"
end

"exampleScript":
__iDoorTypes = _iDoorTypes * 3
! "__iDoorTypes" subroutine variable gets the value of 3 times "_iDoorTypes" variable
return

Capitalization

  • Commands should be written consistently lowercase or uppercase according to your taste. GRAPHISOFT recommends lowercase.
  • GDL global variables should always be written uppercase for easier script reading.
  • The following keywords should be lowercase: call, goto, gosub, parameters.