## File format root nodes

Each table below describes the full tree of one of the sch-rnd file formats, from the root.

### li:cschem-buffer-v*

type:name | value | ver | description
--- | --- | --- | ---
li:cschem-buffer-v* |  |  | Buffer content (direct/indirect: same meaning as schematic sheet)
ha:obj_indirect.1 |  |  | Group of concrete objects ->
ha:obj_direct.2 |  |  | Group of concrete objects ->

### li:sch-rnd-conf-v1

type:name | value | ver | description
--- | --- | --- | ---
li:sch-rnd-conf-v1 |  |  | complete sch-rnd configuration tree
ha:overwrite |  |  | overwrite values while merging; children: a full or partial config tree
ha:prepend |  |  | prepend values while merging; children: a full or partial config tree
ha:append |  |  | append values while merging; children: a full or partial config tree

### ha:std_devmap.v*

type:name | value | ver | description
--- | --- | --- | ---
ha:std_devmap.v* |  |  | Device map for plugin std_devmap
ha:comp_attribs |  |  | Attributes to be set in the abstract component
ha:attrib |  |  | a hash of attributes
simple-attrib-key | string |  | attribute value without metadata (text node)
ha:detailed-attrib |  |  | attribute with metadata (hash node)
value | string |  | attribute value
prio | integer |  | priority value

### li:cschem-group-v*

type:name | value | ver | description
--- | --- | --- | ---
li:cschem-group-v* |  |  | concrete group (e.g. symbol)
ha:group.1 |  |  | Group of concrete objects ->

### ha:cschem-sheet-v*

type:name | value | ver | description
--- | --- | --- | ---
ha:cschem-sheet-v* |  |  | schematic sheet
ha:obj_indirect.1 |  |  | Group of concrete objects ->
ha:obj_direct.2 |  |  | Group of concrete objects ->
li:conf |  |  | complete sch-rnd configuration tree ->

## Common subtrees

Each table below describes a subtree that usually does not specify a whole tree (thus they are usually not a valid file on their own). These subtrees are described in a separate table because they are used from multiple other trees.

### ha:group.ID

type:name | value | ver | description
--- | --- | --- | ---
ha:group.ID |  |  | Group of concrete objects
uuid | minuid |  | instance UID
src_uuid | minuid |  | source UID
x | coord |  | xform: translate placement in x (horizontal) direction
y | coord |  | xform: translate placement in y (vertical) direction
rot | angle |  | xform: rotate placement
mirx | bool |  | xform: mirror placement left/right
miry | bool |  | xform: mirror placement child up/down
loclib_name | string |  | name in the local library (optional)
li:objects |  |  | List of child objects
ha:line.ID |  |  | Drawing object: straight line ->
ha:arc.ID |  |  | Drawing object: circular arc ->
ha:polygon.ID |  |  | Drawing object: polygon ->
ha:text.ID |  |  | Drawing object: straight line ->
ha:connection.ID |  |  | Logical object: connection between different groups ->
ha:pen.NAME |  |  | Logical object: a named pen used for drawing; names are unique within a group ->
ha:attrib |  |  | a hash of attributes
simple-attrib-key | string |  | attribute value without metadata (text node)
ha:detailed-attrib |  |  | attribute with metadata (hash node)
value | string |  | attribute value
prio | integer |  | priority value

### ha:group_ref.ID

type:name | value | ver | description
--- | --- | --- | ---
ha:group_ref.ID |  |  | Group reference to a concrete object within the same sheet or buffer
ref | oidpath |  | path relative to sheet root, to the referee (should be a group)
li:child_xform |  |  | List of child object transformation to be performed after placement
OIDPATH |  |  | list of transformations to be performed on referee children objects after placement; OIDPATH is relative to the referee group
movex | coord |  | xform: move child in x (horizontal) direction
movey | coord |  | xform: move child in y (vertical) direction
rot | angle |  | xform: rotate child
mirx | bool |  | xform: mirror child left/right
miry | bool |  | xform: mirror child up/down
remove | bool |  | xform: mirror child up/down
ha:attrib |  |  | a hash of attributes
simple-attrib-key | string |  | attribute value without metadata (text node)
ha:detailed-attrib |  |  | attribute with metadata (hash node)
value | string |  | attribute value
prio | integer |  | priority value

### ha:line.ID

type:name | value | ver | description
--- | --- | --- | ---
ha:line.ID |  |  | Drawing object: straight line
x1 | coord |  | start point, x coord
y1 | coord |  | start point, y coord
x2 | coord |  | end point, x coord
y2 | coord |  | end point, y coord
stroke | pen |  | pen to use
lock | bool |  | object is locked
floater | bool |  | "group lock" doesn't apply

### ha:arc.ID

type:name | value | ver | description
--- | --- | --- | ---
ha:arc.ID |  |  | Drawing object: circular arc
cx | coord |  | center point, x coord
cy | coord |  | center point, y coord
r | coord |  | radius
sang | angle |  | start angle
dang | angle |  | delta angle
sx | coord |  | start point, x coord
sy | coord |  | start point, y coord
ex | coord |  | end point, x coord
ey | coord |  | end point, y coord
stroke | pen |  | pen to use
lock | bool |  | object is locked
floater | bool |  | "group lock" doesn't apply

### ha:polygon.ID

type:name | value | ver | description
--- | --- | --- | ---
ha:polygon.ID |  |  | Drawing object: polygon
li:outline |  |  | ordered list of contour objects (no gaps allowed)
ha:line.ID |  |  | Drawing object: straight line ->
ha:arc.ID |  |  | Drawing object: circular arc ->
stroke | pen |  | pen used for outline objects
fill | pen |  | pen used for fill (no fill if not present)
lock | bool |  | object is locked
floater | bool |  | "group lock" doesn't apply

### ha:connection.ID

type:name | value | ver | description
--- | --- | --- | ---
ha:connection.ID |  |  | Logical object: connection between different groups
li:conn |  |  | list of objects participating in the connection (at least 2)
OIDPATH | oidpath |  | drawing object making the connection )

### ha:text.ID

type:name | value | ver | description
--- | --- | --- | ---
ha:text.ID |  |  | Drawing object: straight line
text | string |  | text string (or dyntext template)
x1 | coord |  | lower left x coord of text box
y1 | coord |  | lower left y coord of text box
x2 | coord |  | upper right corner of untrasformed box; present only if text size is bbox-specified
y2 | coord |  | upper right corner of untrasformed box; present only if text size is bbox-specified
rot | angle |  | rotaition around x1;y1
mirx | bool |  | mirror origin/bbox left/right
miry | bool |  | mirror origin/bbox up/down
halign | halign |  | horizontal alignment
dyntext | bool |  | if text string is a dyntext template
stroke | pen |  | pen to use
lock | bool |  | object is locked
floater | bool |  | "group lock" doesn't apply

### ha:pen.NAME

type:name | value | ver | description
--- | --- | --- | ---
ha:pen.NAME |  |  | Logical object: a named pen used for drawing; names are unique within a group
shape | shape |  | pen tip shape)
size | coord |  | diameter or side length
color | color |  | ink color
font_height | coord |  | height of text font for non-bbox-defined text
font_family | string |  | family hint for the font selector
font_style | string |  | style hint for the font selector
dash | hex4 |  | dash pattern
dash_period | coord |  | dash pattern length

## Types

type | description
--- | ---
angle | A decimal number without unit, representing an angle in degree. Can be positive or negative.
coord | A decimal integer.
double | Unitless numeric value in decimal format. Depending on context it is sometimes signed.
integer | Unitless integer value in decimal format. Depending on context it is sometimes signed.
hex4 | 4 digits of hexadecimal numbers (0-9, a-f, A-F)
bool | Single digit boolean value: 0 means false, 1 means true.
pen | Name of a pen defined in a parent group.
halign | One of: left, center, right, word_justify, justify.
shape | One of: round, square.
color | #rrggbb
minuid | An unique ID as generated by libminuid (24 ASCII characters).
none | No value.
string | Free form text data
oidpath | A slash separated list of integer object IDs (oids).

## Comments

ver column: Format version range the subtree may appear in.