def on_aperture_event(self, event):
     aperture = event.data.Graphics['CurrentAperture']
     # print 'APERTURE: '+ str(aperture)
     # turtle.pen(fillcolor="black", pencolor="black", pensize=int(100*float(aperture['Modifiers'][0])))
     # turtle.pen(fillcolor="black", pencolor="black")
     self.event_dispatcher.dispatch_event(
         GerberReader.OperationEvent(GerberReader.OperationEvent.ACK, self))
Beispiel #2
0
	def on_flash_event(self, event):
		"""
		Event handler for ASK event type
		"""
		print 'FLASH'
		self.event_dispatcher.dispatch_event(
			GerberReader.OperationEvent ( GerberReader.OperationEvent.ACK, self )
		)
    def on_move_event(self, event):
        """
		Event handler for MOVE event type
		"""
        point = event.data.Graphics['CurrentPoint']
        print 'MOVE: ' + str(point)
        turtle.penup()
        goto(point)
        self.event_dispatcher.dispatch_event(
            GerberReader.OperationEvent(GerberReader.OperationEvent.ACK, self))
    def on_flash_event(self, event):
        """
		Event handler for FLASH event type
		"""
        setLevelPolarity(event.data.Graphics['LevelPolarity'])
        aperture = event.data.Graphics['CurrentAperture']
        if 'C' in aperture['Standard']:
            StandardCircle(aperture['Standard']['C'],
                           event.data.Graphics['CurrentPoint'])
        if 'R' in aperture['Standard']:
            StandardRectangle(aperture['Standard']['R'],
                              event.data.Graphics['CurrentPoint'])
        if 'O' in aperture['Standard']:
            StandardObround(aperture['Standard']['O'],
                            event.data.Graphics['CurrentPoint'])
        if 'P' in aperture['Standard']:
            StandardPolygon(aperture['Standard']['P'],
                            event.data.Graphics['CurrentPoint'])
        if 'Primitives' in aperture:
            for p in aperture['Primitives']:
                if 'Comment' in p:
                    PrimitiveComment(p['Comment'])
                elif 'Circle' in p:
                    PrimitiveCircle(p['Circle'],
                                    event.data.Graphics['CurrentPoint'])
                elif 'VectorLine' in p:
                    PrimitiveVectorLine(p['VectorLine'],
                                        event.data.Graphics['CurrentPoint'])
                elif 'CenterLine' in p:
                    PrimitiveCenterLine(p['CenterLine'],
                                        event.data.Graphics['CurrentPoint'])
                elif 'LowerLeftLine' in p:
                    PrimitiveLowerLeftLine(p['LowerLeftLine'],
                                           event.data.Graphics['CurrentPoint'])
                elif 'Outline' in p:
                    PrimitiveOutline(p['Outline'],
                                     event.data.Graphics['CurrentPoint'])
                elif 'Polygon' in p:
                    PrimitivePolygon(p['Polygon'],
                                     event.data.Graphics['CurrentPoint'])
                elif 'Moire' in p:
                    PrimitiveMoire(p['Moire'],
                                   event.data.Graphics['CurrentPoint'])
                elif 'Thermal' in p:
                    PrimitiveThermal(p['Thermal'],
                                     event.data.Graphics['CurrentPoint'])
        self.event_dispatcher.dispatch_event(
            GerberReader.OperationEvent(GerberReader.OperationEvent.ACK, self))
    def on_draw_event(self, event):
        """
		Event handler for DRAW event type
		"""
        point = event.data.Graphics['CurrentPoint']
        aperture = event.data.Graphics['CurrentAperture']
        interpolation = event.data.Graphics['InterpolationMode']
        setLevelPolarity(event.data.Graphics['LevelPolarity'])
        setExposure('ON')

        if interpolation == 'LIN':
            drawLine(aperture, point)
        elif interpolation in ['CW', 'CCW']:
            drawArc(aperture, point, interpolation)
        print 'DRAW: ' + str(point) + ' Interpolation: ' + str(
            event.data.Graphics['InterpolationMode']) + ' Region: ' + str(
                event.data.Graphics['RegionMode']) + ' Quadrant: ' + str(
                    event.data.Graphics['QuadrantMode'])

        self.event_dispatcher.dispatch_event(
            GerberReader.OperationEvent(GerberReader.OperationEvent.ACK, self))
    def on_quadrant_event(self, event):

        self.event_dispatcher.dispatch_event(
            GerberReader.OperationEvent(GerberReader.OperationEvent.ACK, self))
    def on_levelpolarity_event(self, event):
        setLevelPolarity(event.data.Graphics['LevelPolarity'])

        self.event_dispatcher.dispatch_event(
            GerberReader.OperationEvent(GerberReader.OperationEvent.ACK, self))
    def on_interpolation_event(self, event):

        self.event_dispatcher.dispatch_event(
            GerberReader.OperationEvent(GerberReader.OperationEvent.ACK, self))
    def on_region_event(self, event):
        setRegion(event.data.Graphics['RegionMode'])

        self.event_dispatcher.dispatch_event(
            GerberReader.OperationEvent(GerberReader.OperationEvent.ACK, self))