extended_command
extended_command ¶
Base class for all extended commands.
Token ¶
Bases: GerberCode
Base class for creating Gerber token classes.
Source code in src/pygerber/gerberx3/tokenizer/tokens/bases/token.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
|
wrap
classmethod
¶
new
classmethod
¶
Create instance of this class.
Created to be used as callback in ParserElement.set_parse_action()
.
Source code in src/pygerber/gerberx3/tokenizer/tokens/bases/token.py
__init__ ¶
__repr__ ¶
get_debug_format ¶
ensure_type
classmethod
¶
Ensure that
Raise TypeError otherwise.
Source code in src/pygerber/gerberx3/tokenizer/tokens/bases/token.py
update_drawing_state ¶
get_token_position ¶
get_hover_message ¶
Return language server hover message.
Source code in src/pygerber/gerberx3/tokenizer/tokens/bases/token.py
get_operation_specific_info ¶
Return operation specific extra information about token.
find_closest_token ¶
Find token closest to specified position.
get_gerber_code_one_line_pretty_display ¶
ExtendedCommandToken ¶
Bases: Token
3.3 Commands.¶
Commands are the core syntactic element of the Gerber format. A Gerber file is a stream of commands. Commands define the graphics state, create graphical objects, defines apertures, manage attributes and so on.
Commands are built with words, the basic syntactic building block of a Gerber file. A word is a non-empty character string, excluding the reserved characters '' and '%', terminated with an ''
For historic reasons, there are two command syntax styles: word commands and extended commands.
command =
| extended_command
| word_command
;
word_command = word;
extended_command = '%' {word}+ '%';
Word commands are identified by a command code, the letter G, D or M followed by a positive
integer, e.g. G02
. Most word commands only consist of the command code, some also contain
coordinates.
Extended commands are identified by a two-character command code that is followed by parameters specific to the code. An extended command is enclosed by a pair of "%" delimiters
An overview of all commands is in section 2.8, a full description in chapters 3.5 and 5.
Example 1¶
The example below shows a stream of Gerber commands.
G04 Different command styles*
G75*
G02*
D10*
X0Y0D02*
X2000000Y0I1000000J0D01*
D11*
X0Y2000000D03*
M02*
Example 2¶
The example below shows a stream of Gerber extended commands.
%FSLAX26Y26*%
%MOMM*%
%AMDonut*
1,1,$1,$2,$3*
$4=$1x0.75*
1,0,$4,$2,$3*
%
%ADD11Donut,0.30X0X0*%
%ADD10C,0.1*%
See section 3.3 of The Gerber Layer Format Specification