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

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

Definition at line 309 of file gendrill_gerber_writer.cpp.

References AddAngles(), and RotatePoint().

Referenced by GERBER_WRITER::CreateDrillandMapFilesSet(), and GERBER_WRITER::createDrillFile().

310 {
311  wxSize size( aSize );
312  double orient = aOrient;
313 
314  /* The pad will be drawn as an oblong shape with size.y > size.x
315  * (Oval vertical orientation 0)
316  */
317  if( size.x > size.y )
318  {
319  std::swap( size.x, size.y );
320  orient = AddAngles( orient, 900 );
321  }
322 
323  int deltaxy = size.y - size.x; // distance between centers of the oval
324 
325  int cx = 0;
326  int cy = deltaxy / 2;
327  RotatePoint( &cx, &cy, orient );
328  aStart = wxPoint( cx, cy );
329  cx = 0; cy = -deltaxy / 2;
330  RotatePoint( &cx, &cy, orient );
331  aEnd = wxPoint( cx, cy );
332 }
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:288