fs_coordinate_format
fs_coordinate_format ¶
Coordinate format token.
FrozenGeneralModel ¶
Bases: BaseModel
Model with common set of general purpose features.
Source code in src/pygerber/common/frozen_general_model.py
IncrementalCoordinatesNotSupportedError ¶
Bases: ParserError
Raised when incremental coordinates are selected. (Spec. 8.2.1.2).
InvalidCoordinateLengthError ¶
Bases: ParserError
Raised when coordinate string is too long.
UnsupportedCoordinateTypeError ¶
Bases: ParserError
Raised for unsupported coordinate types.
ZeroOmissionNotSupportedError ¶
Bases: ParserError
Raised when incremental coordinates are selected. (Spec. 8.2.1.2).
GerberCodeEnum ¶
Bases: GerberCode
, Enum
Enum with GerberCode interface implementation.
Source code in src/pygerber/gerberx3/tokenizer/helpers/gerber_code_enum.py
get_gerber_code ¶
Get gerber code represented by this token.
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
Source code in src/pygerber/gerberx3/tokenizer/tokens/bases/extended_command.py
get_gerber_code_one_line_pretty_display ¶
GerberCode ¶
Interface of object which can be converted to gerber code.
Source code in src/pygerber/gerberx3/tokenizer/tokens/bases/gerber_code.py
Coordinate ¶
Bases: GerberCode
, FrozenGeneralModel
Coordinate data.¶
A number whose interpretation is determined by the FS command. It is used to specify the X and Y coordinates of a point in the image plane and a distance or offset in the X and Y direction.
Source code in src/pygerber/gerberx3/tokenizer/tokens/coordinate.py
new
classmethod
¶
Create new Coordinate object.
Source code in src/pygerber/gerberx3/tokenizer/tokens/coordinate.py
get_gerber_code ¶
Get gerber code represented by this token.
Source code in src/pygerber/gerberx3/tokenizer/tokens/coordinate.py
CoordinateSign ¶
CoordinateType ¶
Bases: Enum
Type of coordinate axis/meaning.
Source code in src/pygerber/gerberx3/tokenizer/tokens/coordinate.py
Backend ¶
Bases: ABC
Drawing backend interface.
Source code in src/pygerber/backend/abstract/backend_cls.py
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 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
|
__init__ ¶
create_aperture_handle ¶
Create new aperture handle.
Source code in src/pygerber/backend/abstract/backend_cls.py
get_private_aperture_handle ¶
get_private_aperture_handle(
public_aperture_handle: PublicApertureHandle,
) -> PrivateApertureHandle
Get private aperture handle.
draw ¶
Execute all draw actions to create visualization.
Source code in src/pygerber/backend/abstract/backend_cls.py
finalize_aperture_creation ¶
get_result_handle
abstractmethod
¶
get_aperture_handle_cls
abstractmethod
¶
get_draw_circle_cls
abstractmethod
¶
get_draw_rectangle_cls
abstractmethod
¶
get_draw_polygon_cls
abstractmethod
¶
get_draw_commands_handle_cls
abstractmethod
¶
get_draw_paste_cls
abstractmethod
¶
get_draw_region_cls
abstractmethod
¶
get_draw_vector_line_cls
abstractmethod
¶
get_draw_arc_cls
abstractmethod
¶
DrawCommand ¶
Bases: ABC
Description of aperture component.
Source code in src/pygerber/backend/abstract/draw_commands/draw_command.py
State ¶
Bases: FrozenGeneralModel
GerberX3 interpreter state.
Source code in src/pygerber/gerberx3/parser/state.py
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 |
|
region_boundary_points
class-attribute
instance-attribute
¶
Points defining the shape of the region.
is_output_image_negation_required
class-attribute
instance-attribute
¶
In Gerber specification deprecated IP command is mentioned. It can set image polarity to either positive, the usual one, or to negative. Under negative image polarity, image generation is different. Its purpose is to create a negative image, clear areas in a dark background. The entire image plane in the background is initially dark instead of clear. The effect of dark and clear polarity is toggled. The entire image is simply reversed, dark becomes white and vice versa. This effect can be achieved by simply inverting colors of output image.
apertures
class-attribute
instance-attribute
¶
Collection of all apertures defined until given point in code.
macros
class-attribute
instance-attribute
¶
Collection of all macros defined until given point in code.
get_units ¶
get_coordinate_parser ¶
Get coordinate parser or raise CoordinateFormatNotSetError.
get_current_aperture ¶
Get current aperture or raise ApertureNotSelectedError.
parse_coordinate ¶
Parse, include substitution with current and conversion to Offset.
Source code in src/pygerber/gerberx3/parser/state.py
CoordinateFormat ¶
Bases: ExtendedCommandToken
Description of coordinate format token.
See: - section 4.1.1 of The Gerber Layer Format Specification Revision 2023.03 - https://argmaster.github.io/pygerber/latest/gerber_specification/revision_2023_03.html - section 4.2.2 of The Gerber Layer Format Specification Revision 2023.03 - https://argmaster.github.io/pygerber/latest/gerber_specification/revision_2023_03.html
Source code in src/pygerber/gerberx3/tokenizer/tokens/fs_coordinate_format.py
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/fs_coordinate_format.py
update_drawing_state ¶
Set coordinate parser.
Source code in src/pygerber/gerberx3/tokenizer/tokens/fs_coordinate_format.py
get_gerber_code ¶
Get gerber code represented by this token.
Source code in src/pygerber/gerberx3/tokenizer/tokens/fs_coordinate_format.py
TrailingZerosMode ¶
Bases: GerberCodeEnum
Coordinate format mode.
GerberX3 supports only one, L, the other is required for backwards compatibility.
Source code in src/pygerber/gerberx3/tokenizer/tokens/fs_coordinate_format.py
CoordinateMode ¶
Bases: GerberCodeEnum
Coordinate format mode.
GerberX3 supports only one, A, the other required for backwards compatibility.
Source code in src/pygerber/gerberx3/tokenizer/tokens/fs_coordinate_format.py
AxisFormat ¶
Bases: FrozenGeneralModel
, GerberCode
Wrapper for single axis format.
Source code in src/pygerber/gerberx3/tokenizer/tokens/fs_coordinate_format.py
get_gerber_code ¶
Get gerber code represented by this token.
CoordinateParser ¶
Bases: FrozenGeneralModel
Coordinate Parser class.
Source code in src/pygerber/gerberx3/tokenizer/tokens/fs_coordinate_format.py
new
classmethod
¶
new(
x_format: AxisFormat,
y_format: AxisFormat,
coordinate_mode: CoordinateMode = CoordinateMode.Absolute,
zeros_mode: TrailingZerosMode = TrailingZerosMode.OmitLeading,
) -> Self
Update coordinate parser format configuration.
Source code in src/pygerber/gerberx3/tokenizer/tokens/fs_coordinate_format.py
parse ¶
Parse raw coordinate data.