CabMasterPro User Guide
In This Topic
    Action Functions
    In This Topic

    Action functions are those which interact directly with the user in some way, like displaying a message box for example.

    This does not necessarily mean they are Action Only functions... these ones can be used in any formula.



    AddToLibrary [Action Only]
    Saves current item to library
    Syntax AddToLibrary(libraryname)
    Inputs This takes the currently selected item and adds it to the library named in the parameter libraryname.
    Outputs Save current item to current or named library
    Notes Allows adding to current or named library

    BrowseDXF [Action Only]
    Browse for DXF with a file dialog
    Syntax BrowseDXF(folder,filename[[,relfolder],initfolder])
    Inputs Puts up a file dialog for user selection
    Outputs Returns yes and sets variables folder,filename provided user presses OK after selecting a file during browse. The browsing starts in initfolder (default BitmapFolder) and the value returned in the variable specified by folder is a path relative to relfolder (default BitmapFolder)
    Notes The square brackets indicate the optional 3rd and 4th params for the relative base folder and the initial browsing folder.
    • browsedxf(folder,filename) - set variables folder (relative to BitmapFolder) and filename
    • browsedxf(folder,filename,initfolder) - set variables folder (relative to initfolder) and filename
    • browsedxf(folder,filename,relfolder,initfolder) - set variables folder filename (relative to relfolder)
    Examples browsedxf("myfoldervar","myfilevar",LibraryFolder,BitmapFolder)

    This starts browsing in the BitmapFolder but when the user selects a dxf file, the path returned is relative to the LibraryFolder.
    See Also BrowseFile, BrowseImage, BrowseModel

    BrowseImage [Action Only]
    Browse for image with a file dialog
    Syntax BrowseImage (folder,filename)
    Inputs Puts up a file dialog for user selection
    Outputs Returns yes if selected, and set variables folder (relative to BitmapFolder) and filename.
    See Also BrowseFile, BrowseDXF, BrowseModel

    BrowseModel [Action Only]
    Browse for model with a file dialog
    Syntax BrowseModel(folder,filename)
    Inputs Puts up a file dialog for user selection
    Outputs Returns yes if selected, and set variables folder (relative to BitmapFolder) and filename.
    See Also BrowseFile, BrowseImage, BrowseDXF

    Confirm
    Pops up a message box which asks the user a Yes or No question
    Syntax Confirm (message)
    Inputs Message is displayed in the dialog box, as well as a Yes and a No button
    Outputs A value of type "Yes/No" is returned, depending on the button that was clicked
    Examples Confirm ("Do you wish to continue?") displays this: Confirm
    See Also EditText, MsgBox, ShowFriendlyPages

    EditLength
    Opens a dialog prompt which allows the user to edit a length variable, then returns the modified variable
    Syntax EditLength (var)
    Inputs Var is the length which the user may choose to edit or accept without changes
    Outputs The edited variable is returned. If the user clicks Cancel, the original string variable is returned
    See Also Confirm, MsgBox, ShowFriendlyPages, EditString, EditText, EditWholenum

    EditString
    Opens a single line prompt which allows the user to edit a text string, then returns the modified string
    Syntax EditString (text)
    Inputs Text is the original string that is displayed to the user. They may choose to edit this or accept it without changes
    Outputs The edited string is returned. If the user clicks Cancel, the original string text is returned
    Notes Any newline characters in the textbox (i.e. where the user pressed Enter) will be included in the returned string
    See Also Confirm, MsgBox, ShowFriendlyPages, EditLength, EditText, EditWholenum

    EditText
    Opens a multi line textbox which allows the user to edit a text string, then returns the modified string
    Syntax EditText (var [,title])
    Inputs Var is the original string that is displayed to the user. They may choose to edit this or accept it without changes. Title is an optional heading for the textbox.
    Outputs The edited string is returned. If the user clicks Cancel, the original string text is returned
    Notes Any newline characters in the textbox (i.e. where the user pressed Enter) will be included in the returned string
    Examples EditText ("Change this text if desired") displays this: Edittext2
    See Also Confirm, MsgBox, ShowFriendlyPages, EditLength, EditString, EditWholenum

    EditWholenum
    Opens a dialog prompt which allows the user to edit a length variable, then returns the modified variable
    Syntax EditWholenum (var)
    Inputs var is an integer which the user may choose to edit or accept without changes
    Outputs The edited variable is returned. If the user clicks Cancel, the original string variable is returned
    See Also Confirm, MsgBox, ShowFriendlyPages, EditLength, EditString, EditText

    MsgBox
    Displays a message dialog with an OK button to the user
    Syntax MsgBox (message)
    Inputs Message is the text to print on the dialog
    Outputs Returns the string message
    Notes Alert and MsgBox is useful for displaying results or status information to the user. For error messages, you should use MsgBoxLog
    Examples MsgBox ("The table update was successful") displays this: Msgbox
    See Also Confirm, EditText, MsgBoxLog, ShowFriendlyPages

    MsgBoxLog
    Adds a message of the specified category to the program log
    Syntax MsgBoxLog (category, message)
    Inputs Message is the text to be added to the log, and should describe what has happened. Category is optional, and describes the type of error message, such as "Missing File" or "Invalid Data" for example. If this is omitted, the type is set to "User-Defined"
    Outputs Returns the message of the last MsgBoxLog used in the formula
    Notes MsgBoxLog is best used when many errors may be generated by a formula, where it would be inconvenient for the user to click OK on multiple MsgBoxes. This is because all the errors are stored in the program log, and then when the formula is finished a dialog appears asking: "Several errors have occurred. Do you want to see them now?". Clicking Yes to this question opens the log, which lists all errors that happened, along with their category. If a single MsgBoxLog occurs in a formula, it is displayed on the dialog itself
    Examples MsgBoxLog ("Missing Bitmap", "Could not find the required texture") displays this when the formula finishes: Msgboxlog
    See Also MsgBox

    PickColor [Action Only]
    Launches a color-picker dialog
    Syntax PickColor (colorvar)
    Inputs ColorVar name of color variable
    Outputs Launches a color picker dialog with the default set to the current value of the color variable whose name was passed in. If the user clicks OK, update the variable and return true. If the user clicks Cancel, leave the variable as-is and return false.
    Notes There is not a special type for color but it is simply stored as a whole number in a middleware variable and can then be used anywhere that a color value is needed.
    Examples The dialog lets the end user pick a color and it then gets returned as an integer representing the RGB components of the color.

    Each component (R G and B) is a number from 1 to 255.
    The integer is R + 256*G + 256*256*B.

    For example pure red is 255 and pure green is 256*256 = 65,280

    PreviewCurrent [Action Only]
    Sets the current selection for the preview pane, perhaps causing it to change what is displayed
    Syntax PreviewCurrent (level, name)
    Inputs Level is a single character 'v' 'h' 'f' 'c' or 'm'.
    Name is the name of something at that level.
    Notes Here is what to supply as the name (2nd parameter) for each level:
    • e: Element name. Only applies to compound items.
    • v: VSection name, expect either "main" or "extn"
    • h: HSection name, one of the HSection names in the current VSection of this cabinet.
    • f: Face name, expect one of the ten valid facenames "Back","Right","Front","Left","Top","Bottom","BackLeft","BackRight","FrontRight","FrontLeft"
    • c: Component name for one of the components in the current HSection.
    • m: MachineStep name for one of the machine steps in the current component.
    There is also an optional _OnShow variable in cabinet level All Answers and this is executed whenever the cabinet is selected into the preview pane.
    Examples PreviewCurrent('h', "topsection") sets the HSection called "topsection" as the currently selected one for display in the preview pane
    See Also PreviewDonorFaceShadows, PreviewMachining, PreviewHilite

    PreviewDonorFaceShadows [Action Only]
    Turns the face shadows on/off in the preview pane
    Syntax PreviewDonorFaceShadows (yesno)
    Inputs Yesno is yes or no. If yes, the preview pane shows a shadow of the face of the donor section.
    See Also PreviewCurrent, PreviewMachining, PreviewHilite

    PreviewElevation [Action Only]
    Turns the elevation on/off in the preview pane
    Syntax PreviewElevation (yesno)
    Inputs YesNo is yes or no. Default: On.
    See Also PreviewMachining, PreviewCurrent, PreviewDonorFaceShadows, PreviewHilite

    PreviewHilite [Action Only]
    Turns on highlighting of the type of object requested in the preview pane
    Syntax PreviewHilite (hilitetype)
    Inputs Hilitetype is a number from 0 to 5.
    Notes Here are the meanings of the available hilitetype's:
    • 0: turn off highlighting - HiliteNone
    • 1: highlight VSection (main or extension) - HiliteVSection
    • 2: highlight current HSection (or current component within it) - HiliteHSection
    • 3: highlight current face of a section - HiliteFace
    • 4: highlight current machinestep of a component - HiliteMachineStep
    • 5: highlight current sequenced step within a machine step sequence
    - HiliteMachineStepSeq
    Examples PreviewHilite(2) turns on hsection in the preview pane, causing it to be shaded to highlight it in the ortho view
    See Also PreviewCurrent, PreviewDonorFaceShadows, PreviewMachining

    PreviewMachining [Action Only]
    Turns the machining on/off in the preview pane
    Syntax PreviewMachining (yesno)
    Inputs YesNo is yes or no. Default: Off. When it is no, the preview pane shows an ortho view of the cabinet. When it is yes, the preview pane shows machining for the currently selected component in the currently selected section in the cabinet, if that component has any machining. Otherwise, it still shows the ortho preview
    Notes There is also an optional _OnShow variable in cabinet level All Answers and this is executed whenever the cabinet is selected into the preview pane.
    Examples PreviewMachining(yes) sets the mode to machining in the preview pane. You also need to select a current component (eg using PreviewCurrent) to see machining in the preview pane
    See Also PreviewCurrent, PreviewDonorFaceShadows, PreviewHilite, PreviewElevation

    PreviewShowMachining [Action Only]
    Shows machining in 3D wireframe view, plan view etc in preview pane
    Syntax PreviewShowMachining (yesno)
    Inputs YesNo is yes or no. Default: On.
    See Also PreviewMachining, PreviewCurrent, PreviewDonorFaceShadows, PreviewHilite

    PreviewType [Action Only]
    Make preview pane show selected viewtype, if available.
    Syntax PreviewType (viewtype)
    Inputs ViewType 0=mach, 1=ortho, 2=3Dwire, 3=3Dhidden, 4=3Dsolid,
    5=3Dtextured, 6=elev, 7=plan, 8=construction
    See Also PreviewCurrent, PreviewMachining, PreviewHilite

    Report [Action Only]
    Generates a report of the specified type from the drawing.
    Syntax Report (rptfile, doreportitem)
    Inputs rptfile is the filename of the report to be used. This can be any .rpt file in your CabMasterPro Reports folder. If this is omitted, the Select Report dialog will appear.
    The optional parameter doreportitem defaults to no. If set to yes, then the report is run on the current item, not the whole drawing.
    Examples Report("Hardware.rpt") will display a hardware report on the current drawing.
    Report() will prompt the user to select a style of report.

    RunCmdLine
    Run a command line with params, waits for completion
    Syntax RunCmdLine (cmdline, directory, silent)
    Inputs

    cmdline is the only required parameter.
    If directory is included, sets the current directory.
    Silent is optional Yes/No

    Examples RunCmdLine("xcopy Bitmap\*.* """ & BitmapFolder & """ /Y /E /C /Q /H /R", ProgramFolder & "\Temp", Yes)
       will silently run an xcopy cmd line with the current directory set to the Temp subfolder of ProgramFolder.
    RunCmdLine("cmd /c rmdir /S /Q Temp", ProgramFolder, Yes)
       will run with the current directory as ProgramFolder and silently removes the Temp subfolder and its subfolders.
    See Also Shell

    Shell
    Runs an external program or opens a document in its associated application
    Syntax Shell (operation, file, parameters, directory)
    Inputs File is the only required parameter, and is the location of the program or document you wish to launch.
    If operation is included, this is the action performed on the document. Actions for a file type are listed when a file is right-clicked in Explorer; for example a text file might have actions of "Open" and "Print". If operation is omitted or is an empty string, the default action (usually "Open") is used, which is appears on the right-click menu in bold.
    If parameters are included, typically when file is an executable, they are passed to the program via the command line.
    If directory is included, it is used as the startup folder when the document is launched.
    Notes If the specified operation does not exist for file, nothing will happen.
    Examples Shell ("c:\somepage.html") will open a HTML page in the default web browser.
    Shell ("print", "info.doc") will print a document from the current directory
    Shell ("", "scandisk.exe", "/a /n") will launch the ScanDisk application with the default action (Open) with the parameters "/a /n"
    See Also RunCmdLine

    ShellWait
    Runs an external program or opens a document in its associated application and waits for user to click a button to say it has finished.
    Syntax ShellWait (operation, file, parameters, directory)
    Inputs File is the only required parameter, and is the location of the program or document you wish to launch.
    If operation is included, this is the action performed on the document. Actions for a file type are listed when a file is right-clicked in Explorer; for example a text file might have actions of "Open" and "Print". If operation is omitted or is an empty string, the default action (usually "Open") is used, which is appears on the right-click menu in bold.
    If parameters are included, typically when file is an executable, they are passed to the program via the command line.
    If directory is included, it is used as the startup folder when the document is launched
    Notes If the specified operation does not exist for file, nothing will happen.
    Examples ShellWait ("c:\somepage.html") will open a HTML page in the default web browser and wait until you confirm it has finished.
    ShellWait ("print", "info.doc") will print a document from the current directory and wait for you to confirm it has finished
    ShellWait ("", "scandisk.exe", "/a /n") will launch the ScanDisk application with the default action (Open) with the parameters and wait until you confirm it has finished."/a /n"

    ShowFriendlyPages [Action Only]
    Displays a friendly page dialog with title and qiq as supplied.
    Syntax ShowFriendlyPages(title,qiqfilename,substitutions,names,context)
    Inputs Substitutions is an array of string values that can be substituted into the supplied field, replacing occurences of the special marker tags.
    Names is a list of corresponding names, so the subsitution can be made by name, rather than positional (which is more fragile if changes are made).
    Context is an optional context for the variables being edited (eg "section[drawer1]")
    Note: Names, Substitutions and Context are optional parameters. You can even call ShowFriendlyPages with one param, the qiqfilename.
    Notes Replace markers in the QID file that match elements in the names array with corresponding elements in the substitution array. If only one substitution, just use a string.
    Substitution markers in the field are of the form "~xxx~" OR "xxx", where xxx can be either a name for a substitution or the number (1-based).
    "~xxx~" substitutes the value in directly as is, that is the marker is deleted and the corresponding value from the substitutions array replaces it.
    " `xxx` " substitutes the value within quotes (i.e. literal string) that is, the value from the substitutions array is first put in quotes, and then replaces the marker. See Default Parameters for more details.
    Examples SHOWFRIENDLYPAGES("Materials Selection","myqiqname",["carcass","laminate"],["SECTION","MATERIAL"])

    ShowFriendlyWizard [Action Only]
    Runs a friendly page wizard with title and qiq as supplied
    Syntax ShowFriendlyWizard(title,qiqfilename,substitutions,names,context)
    Inputs Substitutions is an array of string values that can be substituted into the supplied field, replacing occurences of the special marker tags.
    Names is a list of corresponding names, so the subsitution can be made by name, rather than positional (which is more fragile if changes are made).
    Context is an optional context for the variables being edited (eg "section[drawer1]")
    Note: Names, Substitutions and Context are optional parameters. You can even call ShowFriendlyWizard with one param, the qiqfilename.
    Outputs Similar to ShowFriendlyPages but a wizard prompts you in sequence to work through the pages left to right, with a "Next" prompt after each.

    ShowPage [Action Only]
    Changes the property sheet to display the friendly page with selected categoryname and pagename.
    Syntax ShowPage(categoryname,pagename)
    Inputs categoryname is the name of the category to display.
    pagename is the name of the page in that category to display.
    Notes The categoryname can be qualified with a section name, eg section:categoryname, or vsection:section:category.
    Examples ShowPage("extn:drawer3:MyDetails","Sizes") would look for a page named "Sizes" in the extension (extn) Vsection, and Hsection "drawer3", with categoryname "MyDetails" and then immediately make that page the active page being displayed.

    WriteHostDXF [Action Only]
    Write DXF to specified file+path and notify host.
    Syntax WriteHostDXF(filepath,dblsided)
    Inputs filepath to write DXF to
    dblsided is yesno for host to display doublesided.