CabMasterPro User Guide
In This Topic
    Constants
    In This Topic

    Constants are very similar to normal variables, except for the fact that their value cannot be changed once it has been set. They can be used to simplify formula and make them more readable by using a word to represent a value. When a formula is evaluated, the constants are simply replaced by the value they represent.

    Example: Instead of using the formula area = 3.141 * radius * radius, we can replace the 3.141 with the predefined constant PI. We end up with the formula area = PI * radius * radius, which has exactly the same result as the first, but is easier to understand at a glance.

    The names of constants are not case sensitive, but they are traditionally written in uppercase to distinguish them from normal variables.

    Predefined Constants

    Name Value Possible Uses
    TRUE or YES Boolean constants Comparison operations, for example
    IF (x <= y) = FALSE THEN ...
    FALSE or NO
    SQRT2 Square root of 2 (i.e. 1.414214) Typically used in trigonometric formulas
    PI 3.141593 Formulas involving circles or arcs
    TAB A horizontal tab character Formatting text, e.g. on labels
    ENDL A newline character
    RND A random number between 0 and 1 This is a constant that acts the same as the Rand function. Can be exactly 0 but never exactly 1
    #N/A or NA Indicates "Not Available" Can be returned by User Defined Functions and checked for by using the IsNA function
    #ERR! Represents an error condition Can also be returned by User Defined Functions and checked for with IsErr
    #EMPTY An empty, blank, or zero value Any value which is zero (in any units, like 0.0 cm) or blank (like the empty string "")

    Folders

    Name Value
    BackupFolder
    BitmapFolder
    DataFolder
    LibraryFolder
    ReportFolder
    TableFolder
    TemplateFolder
    ToolDataFolder
    These variables represent the location of the corresponding CabMasterPro folders. The folders could be anywhere, with each one being specified in the File Locations dialog.

    A default install will put these folders into place as subfolders of the ProgramFolder, which is the folder where you install CabMasterPro. But in practice, users can relocate these folders, e.g. to a network folder. So you should use these variables when referring to files, to ensure they are found in the correct location.
    ProgramFolder Represents the location of the CabMasterPro folder e.g. the value (in a typical install) is "C:\AllMasterSoftware\CabMasterPro".
    DocumentPath
    DocumentTitle
    DocumentPath is the full path with filename for the current drawing e.g. c:\mydrawings\greenhouse.qid
    DocumentTitle is just the subname of the DocumentPath e.g. "greenhouse"
    DrawingFolder
    DrawingSubfolder
    These are slightly different in that, though still a CabMasterPro folder, they can vary for each drawing.
    DrawingFolder refers to the directory you have saved your drawing to (by default the same as DataFolder (e.g. "c:\Data"), but you can save in other locations).
    DrawingSubfolder is a folder under DrawingFolder with this drawing's name (e.g. "c:\Data\Q1234.qid").
    BasedOnLibraryFolder If the currently open library has a catalog, the catalog can be based on a library in another folder. In that case, BasedOnLibraryFolder will give you the path for that base library. Usually, however, this returns the same string as LibraryFolder.
    MyDocumentsFolder Returns the full path to the Windows Documents folder. It usually depends on the Windows username you have logged in as, and would typically be something like “C:\Users\daveb\Documents”
    MyDocumentsProductFolder Returns the full path to a subfolder of the Windows Documents folder, with the product family name. This would typically be something like "C:\Users\daveb\Documents\AllMasterSoftware".
    PictureFolder Alias of BitmapFolder

    Lock Information

    Name Value Possible Uses
    HasComponents Boolean Tests if current lock supports component breakdowns (cutting lists). Returns true if it has support and false if it does not.
    HasCompReports Boolean Tests if product can report components individually rather than aggregated (as in designer only products with no cutting lists).
    HasDoorprofiler Boolean Tests if current lock supports Door Profiler extensions to machining. Returns true if it has support and false if it does not.
    HasMachView Boolean Tests if current lock supports the MachView addon.
    HasMachining Boolean Tests if current lock supports machining (Machine Center). Returns true if it has support and false if it does not.

    Date and Time

    Name Value
    Create_DTM Creation date and time for current drawing
    Lastsave_DTM Date and time this drawing was last saved
    Now The date and time now
    See Format (Miscellaneous Functions) for more information on displaying dates and times.

    Colours

    Name Value Possible Uses
    BLACK   These constants return the RGB (red-green-blue) codes for the specified colour. A sample of each colour is given in the Value column to the left.

    They can be used in place of an RGB function, for example RGB(255,0,255) can be replaced with the constant MAGENTA, which is much more readable. See also PickColor function.

    These codes can be used in fields which usually open a Color Select dialog, such as line and fill style tabs. To formula-control these fields, click the colour preview square which opens the Colour Selection dialog, select Cancel on the dialog, and you will then be able to access the formula box for that colour field.
    RED  
    GREEN  
    YELLOW  
    BLUE  
    CYAN  
    MAGENTA  
    WHITE  
    LIGHTGRAY  
    DARKRED  
    DARKGREEN  
    DARKBLUE  
    DARKCYAN  
    DARKGRAY  
    DARKYELLOW  
    DARKMAGENTA