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