KiCad PCB EDA Suite
gendrill_gerber_writer.cpp File Reference

Functions to create drill files in gerber X2 format. More...

#include <fctsys.h>
#include <vector>
#include <plotter.h>
#include <kicad_string.h>
#include <pcb_edit_frame.h>
#include <pgm_base.h>
#include <build_version.h>
#include <class_board.h>
#include <pcbplot.h>
#include <pcbnew.h>
#include <gendrill_gerber_writer.h>
#include <wildcards_and_files_ext.h>
#include <reporter.h>
#include <gbr_metadata.h>
#include <class_module.h>

Go to the source code of this file.

Functions

static void convertOblong2Segment (wxSize aSize, double aOrient, wxPoint &aStart, wxPoint &aEnd)
 

Detailed Description

Functions to create drill files in gerber X2 format.

Functions to create the Gerber job file in JSON format.

Definition in file gendrill_gerber_writer.cpp.

Function Documentation

◆ convertOblong2Segment()

void convertOblong2Segment ( wxSize  aSize,
double  aOrient,
wxPoint &  aStart,
wxPoint &  aEnd 
)
static

Definition at line 248 of file gendrill_gerber_writer.cpp.

249 {
250  wxSize size( aSize );
251  double orient = aOrient;
252 
253  /* The pad will be drawn as an oblong shape with size.y > size.x
254  * (Oval vertical orientation 0)
255  */
256  if( size.x > size.y )
257  {
258  std::swap( size.x, size.y );
259  orient = AddAngles( orient, 900 );
260  }
261 
262  int deltaxy = size.y - size.x; // distance between centers of the oval
263 
264  int cx = 0;
265  int cy = deltaxy / 2;
266  RotatePoint( &cx, &cy, orient );
267  aStart = wxPoint( cx, cy );
268  cx = 0; cy = -deltaxy / 2;
269  RotatePoint( &cx, &cy, orient );
270  aEnd = wxPoint( cx, cy );
271 }
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:216
T AddAngles(T a1, T2 a2)
Add two angles (keeping the result normalized). T2 is here.
Definition: trigo.h:297

References AddAngles(), and RotatePoint().

Referenced by GERBER_WRITER::createDrillFile().