Once the board context is successfully opened and a board variable has been created, the statement is executed. Within the scope of the statement the board variable can be accessed to retrieve further data from the board.
If the current editor window does not contain a board drawing, an error message is given and the ULP is terminated.
Check if there is a board
By using the board statement without an argument you can check if the current editor window contains a board drawing. In that case, board behaves like an integer constant, returning 1 if there is a board drawing in the current editor window, and 0 otherwise.
Accessing board from a schematic
If the current editor window contains a schematic drawing, you can still
access that schematic's board by preceding the board statement
with the prefix project, as in
project.board(B) { ... }
This will open a board context regardless whether the current editor window
contains a board or a schematic drawing. However, there must be an editor
window containing that board somewhere on the desktop!
Example
if (board)
board(B) {
B.elements(E)
printf("Element: %s\n", E.name);
}
Index | Copyright © 1999 CadSoft Computer GmbH |