state_tracking_visitor
¶
The state_tracking_visitor
module contains definition of
StateTrackingVisitor
class.
CoordinateFormat
¶
Bases: _StateModel
Coordinate format information.
unpack_x
¶
unpack_x(coordinate: PackedCoordinateStr) -> Double
Unpack X coordinate using the current coordinate format.
unpack_y
¶
unpack_y(coordinate: PackedCoordinateStr) -> Double
Unpack X coordinate using the current coordinate format.
pack_x
¶
pack_x(coordinate: Double) -> PackedCoordinateStr
Unpack X coordinate using the current coordinate format.
pack_y
¶
pack_y(coordinate: Double) -> PackedCoordinateStr
Pack X coordinate using the current coordinate format.
Attributes
¶
ImageAttributes
¶
Bases: _StateModel
Legacy attributes of the image.
polarity
class-attribute
instance-attribute
¶
polarity: ImagePolarity = Field(default=None)
The name of the image. (Spec reference: 8.1.4)
rotation
class-attribute
instance-attribute
¶
The rotation of the image. (Spec reference: 8.1.5)
a_axis_mirroring
class-attribute
instance-attribute
¶
a_axis_mirroring: int = Field(default=0)
The mirroring of A axis of the image. (Spec reference: 8.1.7)
b_axis_mirroring
class-attribute
instance-attribute
¶
b_axis_mirroring: int = Field(default=0)
The mirroring of B axis of the image. (Spec reference: 8.1.7)
a_axis_offset
class-attribute
instance-attribute
¶
a_axis_offset: Optional[Double] = Field(default=0)
The offset of A axis of the image. (Spec reference: 8.1.8)
b_axis_offset
class-attribute
instance-attribute
¶
b_axis_offset: Optional[Double] = Field(default=0)
The offset of B axis of the image. (Spec reference: 8.1.8)
a_axis_scale
class-attribute
instance-attribute
¶
a_axis_scale: Optional[Double] = Field(default=0)
The scale of A axis of the image. (Spec reference: 8.1.9)
b_axis_scale
class-attribute
instance-attribute
¶
b_axis_scale: Optional[Double] = Field(default=0)
The scale of B axis of the image. (Spec reference: 8.1.9)
image_name
class-attribute
instance-attribute
¶
The name of the image. (Spec reference: 8.1.3)
file_name
class-attribute
instance-attribute
¶
The name of the file. (Spec reference: 8.1.6)
axis_correspondence
class-attribute
instance-attribute
¶
axis_correspondence: AxisCorrespondence = Field(
default=AX_BY
)
The axis correspondence. (Spec reference: 8.1.2)
Transform
¶
Bases: _StateModel
Aperture transformations.
polarity
class-attribute
instance-attribute
¶
polarity: Polarity = Field(default=Dark)
Aperture polarity set with LP command. (Spec reference: 4.9.2)
mirroring
class-attribute
instance-attribute
¶
mirroring: Mirroring = Field(default=NONE)
Aperture mirroring set with LM command. (Spec reference: 4.9.3)
rotation
class-attribute
instance-attribute
¶
Aperture rotation set with LR command. (Spec reference: 4.9.4)
scaling
class-attribute
instance-attribute
¶
Aperture scaling set with LS command. (Spec reference: 4.9.5)
ArcInterpolation
¶
ApertureStorage
¶
Bases: _StateModel
Storage for apertures.
apertures
class-attribute
instance-attribute
¶
apertures: Dict[ApertureIdStr, AD] = Field(
default_factory=dict
)
Aperture storage.
blocks
class-attribute
instance-attribute
¶
blocks: Dict[ApertureIdStr, AB] = Field(
default_factory=dict
)
Block aperture storage.
macros
class-attribute
instance-attribute
¶
Macro definition storage.
per_aperture_attributes
class-attribute
instance-attribute
¶
Attributes assigned to apertures during creation.
State
¶
Bases: _StateModel
Internal state of the compiler.
unit_mode
class-attribute
instance-attribute
¶
The draw units used for the Gerber file. (Spec reference: 4.2.1)
coordinate_format
class-attribute
instance-attribute
¶
coordinate_format: Optional[CoordinateFormat] = Field(
default=None
)
The coordinate format specification, including the number of decimals. (Spec reference: 4.2.2)
plot_mode
class-attribute
instance-attribute
¶
The plot mode. (Spec reference 4.7)
arc_interpolation
class-attribute
instance-attribute
¶
arc_interpolation: ArcInterpolation = Field(
default=SINGLE_QUADRANT
)
The arc interpolation mode. (Spec reference: 4.7.2)
current_aperture_id
class-attribute
instance-attribute
¶
current_aperture_id: Optional[ApertureIdStr] = Field(
default=None
)
The ID of currently selected aperture. (Spec reference: 8.6)
current_x
class-attribute
instance-attribute
¶
Current X coordinate value.
current_y
class-attribute
instance-attribute
¶
Current Y coordinate value.
coordinate_x
class-attribute
instance-attribute
¶
coordinate_x: Optional[Double] = Field(default=None)
Last X coordinate value set by CoordinateX node.
coordinate_y
class-attribute
instance-attribute
¶
coordinate_y: Optional[Double] = Field(default=None)
Last Y coordinate value set by CoordinateY node.
coordinate_i
class-attribute
instance-attribute
¶
coordinate_i: Optional[Double] = Field(default=None)
Last I coordinate value set by CoordinateI node.
coordinate_j
class-attribute
instance-attribute
¶
coordinate_j: Optional[Double] = Field(default=None)
Last J coordinate value set by CoordinateJ node.
transform
class-attribute
instance-attribute
¶
Current aperture transformation parameters.
apertures
class-attribute
instance-attribute
¶
apertures: ApertureStorage = Field(
default_factory=ApertureStorage
)
Container for different types of apertures.
attributes
class-attribute
instance-attribute
¶
attributes: Attributes = Field(default_factory=Attributes)
Container for holding currently active attributes.
image_attributes
class-attribute
instance-attribute
¶
image_attributes: ImageAttributes = Field(
default_factory=ImageAttributes
)
Container for holding legacy image attributes.
StateTrackingVisitor
¶
Bases: AstVisitor
StateTrackingVisitor
is a visitor class that tracks the internal state
defined in the Gerber X3 specification and modifies it according to Gerber
commands.
Additionally, it defines a set of higher level callback methods that extend
interface of AstVisitor
class.
on_draw_cw_arc_sq
¶
on_draw_cw_arc_sq(node: D01) -> None
Handle D01
node in clockwise circular interpolation single quadrant
mode.
on_draw_cw_arc_mq
¶
on_draw_cw_arc_mq(node: D01) -> None
Handle D01
node in clockwise circular interpolation multi quadrant mode.
on_draw_ccw_arc_sq
¶
on_draw_ccw_arc_sq(node: D01) -> None
Handle D01
node in counter-clockwise circular interpolation single quadrant
mode.
on_draw_ccw_arc_mq
¶
on_draw_ccw_arc_mq(node: D01) -> None
Handle D01
node in counter-clockwise circular interpolation multi quadrant
mode.
on_flash_circle
¶
Handle D03
node with ADC
aperture.
on_flash_rectangle
¶
Handle D03
node with ADR
aperture.
on_flash_obround
¶
Handle D03
node with ADO
aperture.
on_flash_polygon
¶
Handle D03
node with ADP
aperture.
on_flash_macro
¶
Handle D03
node with ADM
aperture.
on_in_region_draw_line
¶
on_in_region_draw_line(node: D01) -> None
Handle D01
node in linear interpolation mode in region.
on_in_region_draw_cw_arc_sq
¶
on_in_region_draw_cw_arc_sq(node: D01) -> None
Handle D01
node in clockwise circular interpolation single quadrant mode
within region statement.
on_in_region_draw_cw_arc_mq
¶
on_in_region_draw_cw_arc_mq(node: D01) -> None
Handle D01
node in clockwise circular interpolation multi quadrant mode
within region statement.
on_in_region_draw_ccw_arc_sq
¶
on_in_region_draw_ccw_arc_sq(node: D01) -> None
Handle D01
node in counter-clockwise circular interpolation single quadrant
mode within region statement.