Object types

The EAGLE data structures are stored in XML files:

These data files contain a hierarchy of objects. In a User Language Program you can access these hierarchies through their respective builtin access statements:

library(L) { ... }
schematic(S) { ... }
board(B) { ... }

These access statements set up a context within which you can access all of the objects contained in the library, schematic or board.

The properties of these objects can be accessed through members. There are two kinds of members:

Data members immediately return the requested data from an object. For example, in

board(B) {
  printf("%s\n", B.name);
  }

the data member name of the board object B returns the board's name. Data members can also return other objects, as in

board(B) {
  printf("%f\n", B.grid.size);
  }

where the board's grid data member returns a grid object, of which the size data member then returns the grid's size.

Loop members are used to access multiple objects of the same kind, which are contained in a higher level object:

board(B) {
  B.elements(E) {
    printf("%-8s %-8s\n", E.name, E.value);
    }
  }

This example uses the board's elements() loop member function to set up a loop through all of the board's elements. The block following the B.elements(E) statement is executed in turn for each element, and the current element can be referenced inside the block through the name E.

Loop members process objects in alpha-numerical order, provided they have a name.

A loop member function creates a variable of the type necessary to hold the requested objects. You are free to use any valid name for such a variable, so the above example might also be written as

board(MyBoard) {
  MyBoard.elements(TheCurrentElement) {
    printf("%-8s %-8s\n", TheCurrentElement.name, TheCurrentElement.value);
    }
  }

and would do the exact same thing. The scope of the variable created by a loop member function is limited to the statement (or block) immediately following the loop function call.

Object hierarchy of a Library

LIBRARY
  GRID
  LAYER
  DEVICESET
    DEVICE
    GATE
  FOOTPRINT
    CONTACT
      PAD
      SMD
    CIRCLE
    HOLE
    RECTANGLE
    FRAME
    DIMENSION
    TEXT
    WIRE
    POLYSHAPE
      WIRE
    POLYCUTOUT
      WIRE
  PACKAGE3D
  SYMBOL
    PIN
    CIRCLE
    RECTANGLE
    FRAME
    DIMENSION
    TEXT
    WIRE
    POLYSHAPE
      WIRE

Object hierarchy of a Schematic

SCHEMATIC
  GRID
  LAYER
  LIBRARY
  ATTRIBUTE
  VARIANTDEF
  COMPONENT
    ATTRIBUTE
    VARIANT
  SHEET
    CIRCLE
    RECTANGLE
    FRAME
    DIMENSION
    TEXT
    WIRE
    POLYSHAPE
      WIRE
    INSTANCE
      ATTRIBUTE
    MODULEINST
    BUS
      SEGMENT
        LABEL
          TEXT
          WIRE
        WIRE
    NET
      SEGMENT
        JUNCTION
        PINREF
        PORTREF
        TEXT
        WIRE
  MODULE
    PORT
    COMPONENT
    SHEET
      (same as above)

Object hierarchy of a Board

BOARD
  GRID
  LAYER
  LIBRARY
  ATTRIBUTE
  VARIANTDEF
  CIRCLE
  HOLE
  RECTANGLE
  FRAME
  DIMENSION
  TEXT
  WIRE
  POLYSHAPE
    WIRE
  POLYCUTOUT
    WIRE
  ELEMENT
    ATTRIBUTE
    VARIANT
  SIGNAL
    CONTACTREF
    POLYPOUR
      WIRE
    VIA
    WIRE