• No results found

Analysis Queries

In document CAM350 Ver.10 Macro Manual (Page 78-86)

These queries return various information found by the Analysis Menu commands they refer to. In each case, the Analysis command must be run either interactive, or in the course of the macro, for the query to return a value.

R = Real, I = Integer, S = String

Command Type Description/Example

Copperarea! R Returns total copper area for ON

layers in CAM Editor, and copper area for panel layers in Panel Editor. (Analysis > Copper Area must be run first).

Number_solder_bridges! I Reports the number of solder bridges found

(Analysis > Find Solder Bridges must be run first).

Number_layer_compares! I Reports the number of layer comparison errors found (Analysis

> Compare Layers must be run first).

Number_starved_thermals! I Reports the number of starved thermals found (Analysis > Find Starved Thermals must be run first).

Number_drill_errors! I Reports the number of drill errors found (Analysis > Check Drill must be run first).

Number_mill_errors! I Reports the number of mill errors found (Analysis>Check Mill must be run first).

Number_slivers! I Reports the number of

slivers--both mask and copper--found (Analysis > Copper Slivers or Analysis > Mask Slivers must be run first).

Number_acid_traps!

Number_acid_traps_ON_layers! I Reports the number of acid traps found (Analysis > Acid Traps must be run first). gap errors found (Analysis >

Minimum Gaps must be run first).

Number_minimum_width_errors!

Number_minimum_width_errors_ON_layers!

I

Reports the number of minimum width errors found (Analysis >

Minimum Widths must be run first).

Number_drc_errors I Reports the number of DRC errors

found (Analysis > DRC must be run first).

Number of violations for that particular histogram. (Analysis >

DRC Histogram must be run first).

Number_negplanethermconflicts! I Reports the number of negative plane thermal conflicts found (Analysis > Negative Plane Thermal Conflicts must be run first).

Number_pin_holes! I Reports the number of pin holes found (Analysis > Find Pin Holes

Analysis > Copper Area

Analysis > Find Solder Bridges Analysis > Compare Layers

Analysis > Find Starved Thermals Analysis > Check Drill

Analysis > Check Mill Analysis > Copper Slivers Analysis > Mask Slivers Analysis > Acid Traps Analysis > DRC

Analysis > DRC Histogram

Analysis > Negative Plane Thermal Conflicts Analysis > Find Pin Holes

Analysis > Part to Part Spacing Analysis > Silk to Solder Spacing

Analysis > Solder Mask to Trace Spacing

must be run first).

Number_Part2Part_errors! I Reports the number of part to part spacing errors found

(Analysis > Part to Part Spacing must be run first).

Number_SilkScreen_errors! I Reports the number of silkscreen to solder mask spacing errors found (Analysis > Silk to Solder Spacing must be run first).

Number_ElecSolder_errors! I Reports the number of solder mask to trace layer spacing errors found (Analysis > Solder Mask to Trace Spacing must be run first).

Forms

A form is a dialog box similar to a Windows-style dialog: it is used to query input from the user. Instead of relying upon combinations of Print and Input to obtain user-entered data, forms in BASIC allow macro

programmers to design a more powerful user interface by creating data entry forms which are custom-tailored to a specific job function. Forms relieve the macro programmer from having to follow the traditional method of using several input statements to get simple information from the user. If there is a choice between multiple options, the programmer may now list the options within a single Form instead of using Yes/No tree answers or having the user enter a number, letter, name, etc. to determine which path to follow. However, it is an

advanced piece of programming and not recommended for the beginning BASIC programmer.

Each form is comprised of a title bar, a control area, and one to three buttons at the bottom.

Example:

To add a form to a macro, you must use the macro commands listed below to create it, place controls inside the control area, and then display the form for user interaction. There are a number of input options available to the form writer: Input, Check, and Choice, as well as the ability to retrieve filenames from the user, and to Print descriptive lines in the form. All of these input controls can be assigned variables which can be used by the calling macro.

During the course of running a macro, the form is displayed on screen for the user to fill out. When the user has finished filling out the form, they press one of the buttons at the bottom of the form to delete it and continue the macro. If either the OK or the Yes button is pressed, the values entered into the input controls are saved in the user-supplied variables. If either the Cancel or the No button is pressed, the values entered into the controls are thrown away and the user's variables are left unchanged.

Each form must contain an OpenForm, a DisplayForm and a DeleteForm statement. The number of controls and print lines contained in the form can be variable; the only limitations occur depending on the type of display units chosen for the form:

Pixel display units show the form in direct screen resolution, giving you absolute control over the size of the form, but can make it more difficult to arrange the layout of the form, especially when dealing with line-spacing issues between the controls.

Character display assumes the width and height of a screen font as its display unit. This allows you to more easily space out lines and controls, but can result in limitations on the number of lines your form can display, dependant on the resolution of the screen the macro is running on.

Using either display mode, the form cannot be larger or wider than the CAM350 work area (which includes any toolbars that are currently turned on). To increase the available space in the work area, you may turn off the toolbars while the form is being displayed on screen, using the macro commands for View > Toolbar, View >

Status Bar, and View > Layer Bar. Once the form has been deleted, these toolbars may be turned back on again.

STATEMENTS

These commands create, populate, and close the form. Each command has should appear in the sequence below: the exception is the AddForm command, which may be repeated multiple times to fill the form with controls, before calling the DisplayForm command brings the Form up on screen.

Note: Any parameters enclosed in brackets [] are optional. If these parameters are not specified in a macro, the system uses default values.

OpenForm

Creates a blank form and gives it the identifier n. This must be done before controls can be placed on a form.

Syntax:

OpenForm #n, width%, height%, title$, unit, buttons

#n is a number used to identify the form for adding controls, and for displaying and deleting the form. It must be in the range 1 to 255.

width% is the width of the forms control area (based on the setting for unit)

height% is the height of the form's control area (based on the setting for unit) This value does not make provisions for any buttons that you might put at the bottom of the form; you must factor those into the overall height of the form.

title$ is the text placed in the title bar.

unit is either PIXEL or CHARACTER. If the unit is PIXEL, then all form coordinates (as well as the form height and width) are in pixels. (Note that if you have a 640X480 display, then the display has 640 pixels across by 480 pixels down.) If unit is CHARACTER, then all form coordinates (as well as the form height and width) are in characters across and lines down. (A line is the height of a capital letter plus some space to separate it from the next line.)

buttons indicates which buttons will appear at the bottom of the form (these are not in the control area). You can choose between several combinations of buttons:

OK Just one button with "OK" on it.

OKCANCEL Two buttons, "OK" and "Cancel"

YESNO Two buttons, "Yes" and "No"

YESNOCANCEL Three buttons, "Yes", "No", and "Cancel"

PREVFINISH Two buttons, "Prev" and "Finish". Useful in conjunction with forms using the NEXT buttons below, or as a final form.

NEXTCANCEL Two buttons, "Next" and "Cancel".

NEXTFINISH Two buttons, "Next" and "Finish". Useful as the final form in a series.

PREVNEXT Two buttons, "Prev" and "Next".

PREVNEXTFINISH Three buttons, "Prev", "Next", and "Finish". Useful as the final form in a series.

AddForm

Adds a control to the form identified by n in OpenForm.

Syntax:

AddForm #n, x%, y%, prompt$, type[, variable][, options]

#n identifies the form to which the control is to be added.

x% is the distance the control is offset from the left side of the form; this value uses the unit set in OpenForm.

If CHARACTER, then this is the number of lines from the left of the control area.

If PIXEL, then this is the number of pixels from the left of the control area.

y% is the distance the control is offset from the top of the control area of the form (ignoring the distance for the title bar); this value is in the unit set in OpenForm.

If CHARACTER, then this is the number of lines from the top of the cotnrol area.

If PIXEL, this is the number of pixels from the top of the control area.

prompt$ is a character string (either a literal or a string variable) which is displayed as a prompt line.

type is the kind of control to be added. This is either PRINT, INPUT, CHECK or CHOICE. Two other controls may also be used here (GetOpenFilename and GetSaveFilename), but these alter the syntax of the AddForm command (see their descriptions for the proper syntax).

variable applies to all control types except PRINT. The control will have a default state, which is set based upon the value of the variable.

options are specific to each control type.

DisplayForm

Displays the form and waits for the user to fill it out. Control returns after the user presses one of the buttons specified in OpenForm (OK, Cancel, etc.)

Syntax:

DisplayForm #n[, where]

where indicates where the form is to be displayed within the main application window. The setting can be one of the following:CENTER, UPPERLEFT, UPPERRIGHT, LOWERLEFT or LOWERRIGHT. If not

specified, then CENTER is assumed.

DeleteForm

Frees the form ID n so that it can be reused. This should be called when the form is no longer needed.

Syntax:

DeleteForm #n

CONTROLS

Controls use the standard values explained in the AddForm command. However, each control may have unique variables:

Check

Displays a check box, which the user may check and uncheck with the mouse or keyboard.

Syntax:

AddForm #n, x%, y%, prompt$, Check, state%

state% is a variable that records the current state of the check box: 0 = off, 1 = on. It may be used initially to set the box state, but returns the value the user has set after the form is displayed.

Example:

AddForm #1, 0, 4, "Display summary", Check, SummaryState%

Choice

Displays radio buttons, surrounded by a box, which the user may select one option from, using the mouse or keyboard.

Syntax:

AddForm #n, x% y%, prompt$, Choice, which%, choice1$, choice2$[, choice3$, ...]

which% is the variable that returns the choice the user made: choices are numbered in sequence from 0 to n This value can be set initially to a specific choice before the form is displayed, but returns

whatever value the user chose while the form was displayed.

choicen$ represents the set of choices made available to the user. Each choice must have its own variable. Two or more choices must be given.

Example:

AddForm #1, 0, 5, "Choose a name", Name%, "Tom", "Dick", "Harry"

GetOpenFileName

Functions similarly to the Windows "Open" file dialog box: obtains a filename from the user by displaying a Windows-style drop down list. The returned filename can be used for file input/output purposes.

Syntax:

AddForm #n, x%, y%, prompt$, GetOpenFilename, filename$[, filter$[, filter_desc$[, FLAG[, FLAG]]]]

filename$ is the variable which will return the retrieved filename. Returns the full filepath of the file.

filter$ is a file filter to limit which file types are displayed (such as *.txt). More than one file type can be indicated by separating them with semi-colons ( "*.gbr;*.lgr"). If omitted, the default will be *.*.

filter_desc$ describes filter$ (e.g. "Gerber files").

FLAG is any one of the following:

NoFileMustExist Does not verify if the file exists or not.

NoPathMustExist Does not verify if the path exists or not.

NoChangeDir Will not allow the user to change the current working directory.

Multiple FLAGS are permitted, separated by commas. If none of the above FLAGS are used, then their opposite (default) functions will be used.

Example:

AddForm #1, 0, 5, "Open file:", GetOpenFilename, Read$, "*.txt","Text Files", NoFileMustExist

GetSaveFileName

Functions similarly to the Windows "Save As" file dialog box: obtains a filename from the user by displaying a Windows-style drop down list. The returned filename can be used for file input/output purposes.

Syntax:

AddForm #n,x%,y%,prompt$,GetSaveFilename,filename$[,default_ext$[,filter[,filter_desc$[,FLAG [,FLAG]]]]]

filename$ is the variable which will return the retrieved filename. Returns the full filepath of the file.

default_ext$ is the default extension of the file being saved. It is a three character string with no period (e.g. "txt").

filter$ is a file filter to limit which files are displayed (such as "*.txt"). If omitted, will be "*.*".

filter_desc$ describes filter$ (e.g. "Text files").

FLAG is any one of the following:

NoOverWritePrompt If the filename already exists, it does not prompt the user to verify before overwriting it.

PathMustExist Requires the saved file's path to already exist.

NoChangeDir Will not allow the user to change the current working directory.

Multiple FLAGS are permitted, separated by commas. If none of the above FLAGS are used, then the opposite, default functions will be used.

Example:

AddForm #1, 0, 5, "Please select a file to save", GetSaveFilename, Save$,

"gbr","*.gbr","Gerber Files", PathMustExist

Input

Accepts typed input from the user. There are three types of input controls: integer, real, and string:

1. Integer Input

Syntax for integer controls:

AddForm #n, x%, y%, prompt$, Input, integer%[, low% to high%]

Example:

AddForm #1, 0, 1, "Enter the current year:", Input, Year%, 1990 to 2999 2. Real Input

Syntax for real controls:

AddForm #n, x%, y%, prompt$, Input, real#[, low# to high#]

Example:

AddForm #1, 0, 2, "Enter the offset in Inches:", Input, Offset#, 0.0 to 5.0 3. String Input

Syntax for string controls:

AddForm #n, x%, y%, prompt$, Input, string$[, width%]

Example:

AddForm#1, 0, 3, "Enter file name:", Input, Filename$, 80

Arguments for these commands are as follows:

integer% is used to retrieve the interger value entered by the user.

real# is used to retrieve the real value entered by the user.

string$ returns the string entered by the user.

low% to high% is an optional range of values which the user input must lie within. The control will automatically validate this range, if it is present. It may be used for either integer or real input values.

width% is the optional string width (in characters) of the input box. If width% is not given, then the width of the control is approximately 21 characters. The input box automatically scrolls to the left if more characters are entered.

Print

Prints "dumb" text on the form, useful for information or instructions.

Syntax:

AddForm #n, x%, y%, prompt$, Print[, width%]

width% is the width (in characters) of the text. If necessary, the string will wrap either at this width%

number of characters or at the right edge of the control area (whichever is less).

prompt$ is the text to be displayed on the form.

Example:

AddForm #1, 0, 0, "this is a string", Print, 40

FUNCTIONS

All these functions are used to check if a given button is pressed. They return n, which is either a 1 or a 0 and may all be used in a Boolean expression. These functions only refer to the buttons on the bottom of the form, they are not used by the macro programmer to add buttons to a form.

BUTTON FUNCTIONS

OTHER FUNCTIONS OpenNameOK SaveNameOK

Both functions check to see if the last GetOpenFileName or GetSaveFileName were completed properly (by the user selecting a file and pressing OK)..

Syntax:

OpenNameOK(n) = ok%

SaveNameOK(n) = ok%

n is the number of the form ok% is the returned value:

1 = completed 0 = not completed

Example:

IF OpenName(1) = 0 THEN Error% = 1 IF SaveName(1) = 1 THEN GOTO 500

FileExists

May be used to determine if the file returned by GetOpenFileName or GetSaveFileName exists.

Syntax:

Button Function

OK FORMOK(n)

CANCEL FORMCANCEL(n)

YES FORMYES(n)

NO FORMNO(n)

In document CAM350 Ver.10 Macro Manual (Page 78-86)

Related documents