## Query: advanced search, command line: function calls available

Functions listed below can be called from a query expression.

### List manipulation

#### llen(lst)

Determine length of a list.

Arguments:

- lst is the list (should be written as list(lst) to make sure no iteration is done)

Return value: integer length of the list.

#### mklist(args...)

Create a list of the objects passed.

Arguments:

Variable number of objects.

Return value: the list.

### Math & abstract geometry

#### distance(x1, y1, x2, y2)

Calculate the distance of two points.

Arguments:

- x1: first point, X coordinate
- y1: first point, Y coordinate
- x2: second point, X coordinate
- y2: second point, Y coordinate

Return value: floating point distance value in nanometers.

#### abs(number)

Returns the absolute value of a number

#### int(arg)

Returns the argument converted to an integer (truncating floating point numbers)

#### double(arg)

Returns the argument converted to a double precision number.

### Object accessors

#### obj_by_idpath(idpath)

Returns the object addressed by idpath.

Arguments:

- idpath is a string addressing an object on the board

Return value: the addressed object or void.

#### text_invalid_chars(obj)

Returns the number of invalid characters of a text object. An invalid character is not rendering with the current font of the text (it is out of range or the font does not have a symbol for the character).

Arguments:

- obj is a text object

Return value: a positive integer; 0 means all characters would render properly

### Misc

#### action(args...)

Execute a pcb-rnd action.

Arguments: variable nunmber of objects and constants.

Return value: invalid on error, or the return value of the action.

#### coord(str)

Converts str to coordinates. Useful when using attribute values.

Arguments:

- str is a string (number with units) or a numeric value (taken as nanometers)

Return value: integer length of the list.

#### isvoid(value)

Checks whether value is void (invalid).

Arguments:

- value is any value, typically a function call

Return value: 1 if value is void (invalid), 0 otherwise.

#### getconf(path)

Fetch the value of a config node

Arguments:

- path is a conf node path, e.g. editor/grid

Return value: invalid if the config node doesn't exist, else the value of the config node (converted to the most appropriate data type).

#### violation(i1, v1, ..., iN, vN)

Build a DRC violation report (a list object).

Arguments (a variable number of pairs of instruction and value):

- i is an instruction, see below.
- v is a value (a constant or an object)

Instruction is one of the following constants:

- DRCGRP1 - the following v is an object, part of group 1 of offending objects
- DRCGRP2 - the following v is an object, part of group 2 of offending objects
- DRCEXPECT - the following v is a numeric value that represent the expected value
- DRCMEASURE - the following v is a numeric value that represent the measured value that mismatches the expected value

Return value: a list suitable for the drc_query to process.