KiCad PCB EDA Suite
pcbplot.h File Reference

Go to the source code of this file.

Classes

class  BRDITEMS_PLOTTER
 

Macros

#define PLOT_MIN_SCALE   0.01
 
#define PLOT_MAX_SCALE   100.0
 

Functions

PLOTTERStartPlotBoard (BOARD *aBoard, const PCB_PLOT_PARAMS *aPlotOpts, int aLayer, const wxString &aFullFileName, const wxString &aSheetName, const wxString &aSheetPath)
 Open a new plotfile using the options (and especially the format) specified in the options and prepare the page for plotting. More...
 
void PlotBoardLayers (BOARD *aBoard, PLOTTER *aPlotter, const LSEQ &aLayerSequence, const PCB_PLOT_PARAMS &aPlotOptions)
 Plot a sequence of board layer IDs. More...
 
void PlotInteractiveLayer (BOARD *aBoard, PLOTTER *aPlotter)
 Plot interactive items (hypertext links, properties, etc.). More...
 
void PlotOneBoardLayer (BOARD *aBoard, PLOTTER *aPlotter, PCB_LAYER_ID aLayer, const PCB_PLOT_PARAMS &aPlotOpt)
 Plot one copper or technical layer. More...
 
void PlotStandardLayer (BOARD *aBoard, PLOTTER *aPlotter, LSET aLayerMask, const PCB_PLOT_PARAMS &aPlotOpt)
 Plot copper or technical layers. More...
 
void PlotLayerOutlines (BOARD *aBoard, PLOTTER *aPlotter, LSET aLayerMask, const PCB_PLOT_PARAMS &aPlotOpt)
 Plot copper outline of a copper layer. More...
 
void BuildPlotFileName (wxFileName *aFilename, const wxString &aOutputDir, const wxString &aSuffix, const wxString &aExtension)
 Complete a plot filename. More...
 
const wxString GetGerberProtelExtension (int aLayer)
 
const wxString GetGerberFileFunctionAttribute (const BOARD *aBoard, int aLayer)
 Return the "file function" attribute for aLayer, as defined in the Gerber file format specification J1 (chapter 5). More...
 
void AddGerberX2Header (PLOTTER *aPlotter, const BOARD *aBoard, bool aUseX1CompatibilityMode=false)
 Calculate some X2 attributes as defined in the Gerber file format specification J4 (chapter 5) and add them the to the gerber file header. More...
 
void AddGerberX2Attribute (PLOTTER *aPlotter, const BOARD *aBoard, int aLayer, bool aUseX1CompatibilityMode)
 Calculate some X2 attributes as defined in the Gerber file format specification and add them to the gerber file header. More...
 

Macro Definition Documentation

◆ PLOT_MAX_SCALE

#define PLOT_MAX_SCALE   100.0

Definition at line 51 of file pcbplot.h.

◆ PLOT_MIN_SCALE

#define PLOT_MIN_SCALE   0.01

Definition at line 50 of file pcbplot.h.

Function Documentation

◆ AddGerberX2Attribute()

void AddGerberX2Attribute ( PLOTTER aPlotter,
const BOARD aBoard,
int  aLayer,
bool  aUseX1CompatibilityMode 
)

Calculate some X2 attributes as defined in the Gerber file format specification and add them to the gerber file header.

TF.GenerationSoftware TF.CreationDate TF.ProjectId TF.FileFunction TF.FilePolarity

Parameters
aPlotteris the current plotter.
aBoardis the board, needed to extract some info.
aLayeris the layer number to create the attribute for.
aUseX1CompatibilityModeset to false to generate X2 attributes, true to use X1 compatibility (X2 attributes added as structured comments, starting by "G04 #@! " followed by the X2 attribute.

Definition at line 342 of file pcbplot.cpp.

344{
345 AddGerberX2Header( aPlotter, aBoard, aUseX1CompatibilityMode );
346
347 wxString text;
348
349 // Add the TF.FileFunction
350 text = GetGerberFileFunctionAttribute( aBoard, aLayer );
351 aPlotter->AddLineToHeader( makeStringCompatX1( text, aUseX1CompatibilityMode ) );
352
353 // Add the TF.FilePolarity (for layers which support that)
355
356 if( !text.IsEmpty() )
357 aPlotter->AddLineToHeader( makeStringCompatX1( text, aUseX1CompatibilityMode ) );
358}
void AddLineToHeader(const wxString &aExtraString)
Add a line to the list of free lines to print at the beginning of the file.
Definition: plotter.h:168
static wxString & makeStringCompatX1(wxString &aText, bool aUseX1CompatibilityMode)
Definition: pcbplot.cpp:264
void AddGerberX2Header(PLOTTER *aPlotter, const BOARD *aBoard, bool aUseX1CompatibilityMode)
Calculate some X2 attributes as defined in the Gerber file format specification J4 (chapter 5) and ad...
Definition: pcbplot.cpp:276
const wxString GetGerberFileFunctionAttribute(const BOARD *aBoard, int aLayer)
Return the "file function" attribute for aLayer, as defined in the Gerber file format specification J...
Definition: pcbplot.cpp:81
static const wxString GetGerberFilePolarityAttribute(int aLayer)
Definition: pcbplot.cpp:203

References AddGerberX2Header(), PLOTTER::AddLineToHeader(), GetGerberFileFunctionAttribute(), GetGerberFilePolarityAttribute(), makeStringCompatX1(), and text.

Referenced by StartPlotBoard().

◆ AddGerberX2Header()

void AddGerberX2Header ( PLOTTER aPlotter,
const BOARD aBoard,
bool  aUseX1CompatibilityMode = false 
)

Calculate some X2 attributes as defined in the Gerber file format specification J4 (chapter 5) and add them the to the gerber file header.

TF.GenerationSoftware TF.CreationDate TF.ProjectId file format attribute is not added

Parameters
aPlotteris the current plotter.
aBoardis the board, needed to extract some info.
aUseX1CompatibilityModeset to false to generate X2 attributes, true to use X1 compatibility (X2 attributes added as structured comments, starting by "G04 #@! " followed by the X2 attribute

Definition at line 276 of file pcbplot.cpp.

277{
278 wxString text;
279
280 // Creates the TF,.GenerationSoftware. Format is:
281 // %TF,.GenerationSoftware,<vendor>,<application name>[,<application version>]*%
282 text.Printf( wxT( "%%TF.GenerationSoftware,KiCad,Pcbnew,%s*%%" ), GetBuildVersion() );
283 aPlotter->AddLineToHeader( makeStringCompatX1( text, aUseX1CompatibilityMode ) );
284
285 // creates the TF.CreationDate attribute:
288 aPlotter->AddLineToHeader( text );
289
290 // Creates the TF,.ProjectId. Format is (from Gerber file format doc):
291 // %TF.ProjectId,<project id>,<project GUID>,<revision id>*%
292 // <project id> is the name of the project, restricted to basic ASCII symbols only,
293 // Rem: <project id> accepts only ASCII 7 code (only basic ASCII codes are allowed in
294 // gerber files) and comma not accepted.
295 // All illegal chars will be replaced by underscore.
296 //
297 // <project GUID> is a string which is an unique id of a project.
298 // However Kicad does not handle such a project GUID, so it is built from the board name
299 wxFileName fn = aBoard->GetFileName();
300 wxString msg = fn.GetFullName();
301
302 // Build a <project GUID>, from the board name
303 wxString guid = GbrMakeProjectGUIDfromString( msg );
304
305 // build the <project id> string: this is the board short filename (without ext)
306 // and all non ASCII chars and comma are replaced by '_'
307 msg = fn.GetName();
308 msg.Replace( wxT( "," ), wxT( "_" ) );
309
310 // build the <revision id> string. All non ASCII chars and comma are replaced by '_'
311 wxString rev = ExpandTextVars( aBoard->GetTitleBlock().GetRevision(), aBoard->GetProject() );
312 rev.Replace( wxT( "," ), wxT( "_" ) );
313
314 if( rev.IsEmpty() )
315 rev = wxT( "rev?" );
316
317 text.Printf( wxT( "%%TF.ProjectId,%s,%s,%s*%%" ), msg.ToAscii(), guid, rev.ToAscii() );
318 aPlotter->AddLineToHeader( makeStringCompatX1( text, aUseX1CompatibilityMode ) );
319
320 // Add the TF.SameCoordinates to specify that all gerber files uses the same origin and
321 // orientation, and the registration between files is OK.
322 // The parameter of TF.SameCoordinates is a string that is common to all files using the
323 // same registration. The string value has no meaning; it is just a key.
324 // Because there is no mirroring/rotation in Kicad, only the plot offset origin can create
325 // incorrect registration, so we create a key from plot offset options.
326 //
327 // Currently the key is "Original" when using absolute Pcbnew coordinates, and the PY and PY
328 // position of the auxiliary axis when using it.
329 // If we ever add user-settable absolute Pcbnew coordinates, we'll need to change the way
330 // the key is built to ensure file only using the *same* axis have the same key.
331 wxString registration_id = wxT( "Original" );
332 VECTOR2I auxOrigin = aBoard->GetDesignSettings().GetAuxOrigin();
333
334 if( aBoard->GetPlotOptions().GetUseAuxOrigin() && auxOrigin.x && auxOrigin.y )
335 registration_id.Printf( wxT( "PX%xPY%x" ), auxOrigin.x, auxOrigin.y );
336
337 text.Printf( wxT( "%%TF.SameCoordinates,%s*%%" ), registration_id.GetData() );
338 aPlotter->AddLineToHeader( makeStringCompatX1( text, aUseX1CompatibilityMode ) );
339}
wxString GetBuildVersion()
Get the full KiCad version string.
const VECTOR2I & GetAuxOrigin()
TITLE_BLOCK & GetTitleBlock()
Definition: board.h:638
const wxString & GetFileName() const
Definition: board.h:306
const PCB_PLOT_PARAMS & GetPlotOptions() const
Definition: board.h:635
PROJECT * GetProject() const
Definition: board.h:446
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:704
bool GetUseAuxOrigin() const
const wxString & GetRevision() const
Definition: title_block.h:86
wxString ExpandTextVars(const wxString &aSource, const PROJECT *aProject)
Definition: common.cpp:58
wxString GbrMakeProjectGUIDfromString(const wxString &aText)
Build a project GUID using format RFC4122 Version 1 or 4 from the project name, because a KiCad proje...
wxString GbrMakeCreationDateAttributeString(GBR_NC_STRING_FORMAT aFormat)
@ GBR_NC_STRING_FORMAT_X1
Definition: gbr_metadata.h:61
@ GBR_NC_STRING_FORMAT_X2
Definition: gbr_metadata.h:62

References PLOTTER::AddLineToHeader(), ExpandTextVars(), GBR_NC_STRING_FORMAT_X1, GBR_NC_STRING_FORMAT_X2, GbrMakeCreationDateAttributeString(), GbrMakeProjectGUIDfromString(), BOARD_DESIGN_SETTINGS::GetAuxOrigin(), GetBuildVersion(), BOARD::GetDesignSettings(), BOARD::GetFileName(), BOARD::GetPlotOptions(), BOARD::GetProject(), TITLE_BLOCK::GetRevision(), BOARD::GetTitleBlock(), PCB_PLOT_PARAMS::GetUseAuxOrigin(), makeStringCompatX1(), text, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by AddGerberX2Attribute(), GERBER_WRITER::createDrillFile(), PLACEFILE_GERBER_WRITER::CreatePlaceFile(), and GENDRILL_WRITER_BASE::genDrillMapFile().

◆ BuildPlotFileName()

void BuildPlotFileName ( wxFileName *  aFilename,
const wxString &  aOutputDir,
const wxString &  aSuffix,
const wxString &  aExtension 
)

Complete a plot filename.

It forces the output directory, adds a suffix to the name, and sets the specified extension. The suffix is usually the layer name and replaces illegal file name character in the suffix with an underscore character.

Parameters
aFilenameis the file name to initialize that contains the base filename.
aOutputDiris the path.
aSuffixis the suffix to add to the base filename.
aExtensionis the file extension.

Definition at line 361 of file pcbplot.cpp.

363{
364 // aFilename contains the base filename only (without path and extension)
365 // when calling this function.
366 // It is expected to be a valid filename (this is usually the board filename)
367 aFilename->SetPath( aOutputDir );
368
369 // Set the file extension
370 aFilename->SetExt( aExtension );
371
372 // remove leading and trailing spaces if any from the suffix, if
373 // something survives add it to the name;
374 // also the suffix can contain some not allowed chars in filename (/ \ . : and some others),
375 // so change them to underscore
376 // Remember it can be called from a python script, so the illegal chars
377 // have to be filtered here.
378 wxString suffix = aSuffix;
379 suffix.Trim( true );
380 suffix.Trim( false );
381
382 wxString badchars = wxFileName::GetForbiddenChars(wxPATH_DOS);
383 badchars.Append( "%." );
384
385 for( unsigned ii = 0; ii < badchars.Len(); ii++ )
386 suffix.Replace( badchars[ii], wxT("_") );
387
388 if( !suffix.IsEmpty() )
389 aFilename->SetName( aFilename->GetName() + wxT( "-" ) + suffix );
390}

Referenced by DIALOG_EXPORT_SVG::ExportSVGFile(), PCBNEW_JOBS_HANDLER::JobExportGerbers(), PLOT_CONTROLLER::OpenPlotfile(), and DIALOG_PLOT::Plot().

◆ GetGerberFileFunctionAttribute()

const wxString GetGerberFileFunctionAttribute ( const BOARD aBoard,
int  aLayer 
)

Return the "file function" attribute for aLayer, as defined in the Gerber file format specification J1 (chapter 5).

The returned string includes the "%TF.FileFunction" attribute prefix and the "*%" suffix.

Parameters
aBoardis the board, needed to get the total count of copper layers.
aLayeris the layer number to create the attribute for.
Returns
The attribute, as a text string

Definition at line 81 of file pcbplot.cpp.

82{
83 wxString attrib;
84
85 switch( aLayer )
86 {
87 case F_Adhes:
88 attrib = wxT( "Glue,Top" );
89 break;
90
91 case B_Adhes:
92 attrib = wxT( "Glue,Bot" );
93 break;
94
95 case F_SilkS:
96 attrib = wxT( "Legend,Top" );
97 break;
98
99 case B_SilkS:
100 attrib = wxT( "Legend,Bot" );
101 break;
102
103 case F_Mask:
104 attrib = wxT( "Soldermask,Top" );
105 break;
106
107 case B_Mask:
108 attrib = wxT( "Soldermask,Bot" );
109 break;
110
111 case F_Paste:
112 attrib = wxT( "Paste,Top" );
113 break;
114
115 case B_Paste:
116 attrib = wxT( "Paste,Bot" );
117 break;
118
119 case Edge_Cuts:
120 // Board outline.
121 // Can be "Profile,NP" (Not Plated: usual) or "Profile,P"
122 // This last is the exception (Plated)
123 attrib = wxT( "Profile,NP" );
124 break;
125
126 case Dwgs_User:
127 attrib = wxT( "OtherDrawing,Comment" );
128 break;
129
130 case Cmts_User:
131 attrib = wxT( "Other,Comment" );
132 break;
133
134 case Eco1_User:
135 attrib = wxT( "Other,ECO1" );
136 break;
137
138 case Eco2_User:
139 attrib = wxT( "Other,ECO2" );
140 break;
141
142 case B_Fab:
143 // This is actually a assembly layer
144 attrib = wxT( "AssemblyDrawing,Bot" );
145 break;
146
147 case F_Fab:
148 // This is actually a assembly layer
149 attrib = wxT( "AssemblyDrawing,Top" );
150 break;
151
152 case B_Cu:
153 attrib.Printf( wxT( "Copper,L%d,Bot" ), aBoard->GetCopperLayerCount() );
154 break;
155
156 case F_Cu:
157 attrib = wxT( "Copper,L1,Top" );
158 break;
159
160 default:
161 if( IsCopperLayer( aLayer ) )
162 attrib.Printf( wxT( "Copper,L%d,Inr" ), aLayer+1 );
163 else
164 attrib.Printf( wxT( "Other,User" ), aLayer+1 );
165 break;
166 }
167
168 // This code adds a optional parameter: the type of copper layers.
169 // Because it is not used by Pcbnew (it can be used only by external autorouters)
170 // user do not really set this parameter.
171 // Therefore do not add it.
172 // However, this code is left here, for perhaps a future usage.
173#if 0
174 // Add the signal type of the layer, if relevant
175 if( IsCopperLayer( aLayer ) )
176 {
177 LAYER_T type = aBoard->GetLayerType( ToLAYER_ID( aLayer ) );
178
179 switch( type )
180 {
181 case LT_SIGNAL:
182 attrib += wxT( ",Signal" );
183 break;
184 case LT_POWER:
185 attrib += wxT( ",Plane" );
186 break;
187 case LT_MIXED:
188 attrib += wxT( ",Mixed" );
189 break;
190 default:
191 break; // do nothing (but avoid a warning for unhandled LAYER_T values from GCC)
192 }
193 }
194#endif
195
196 wxString fileFct;
197 fileFct.Printf( wxT( "%%TF.FileFunction,%s*%%" ), attrib );
198
199 return fileFct;
200}
LAYER_T
The allowed types of layers, same as Specctra DSN spec.
Definition: board.h:147
@ LT_POWER
Definition: board.h:150
@ LT_MIXED
Definition: board.h:151
@ LT_SIGNAL
Definition: board.h:149
LAYER_T GetLayerType(PCB_LAYER_ID aLayer) const
Return the type of the copper layer given by aLayer.
Definition: board.cpp:508
int GetCopperLayerCount() const
Definition: board.cpp:563
bool IsCopperLayer(int aLayerId)
Tests whether a layer is a copper layer.
Definition: layer_ids.h:827
@ B_Adhes
Definition: layer_ids.h:97
@ Edge_Cuts
Definition: layer_ids.h:113
@ Dwgs_User
Definition: layer_ids.h:109
@ F_Paste
Definition: layer_ids.h:101
@ Cmts_User
Definition: layer_ids.h:110
@ F_Adhes
Definition: layer_ids.h:98
@ B_Mask
Definition: layer_ids.h:106
@ B_Cu
Definition: layer_ids.h:95
@ Eco1_User
Definition: layer_ids.h:111
@ F_Mask
Definition: layer_ids.h:107
@ B_Paste
Definition: layer_ids.h:100
@ F_Fab
Definition: layer_ids.h:120
@ F_SilkS
Definition: layer_ids.h:104
@ Eco2_User
Definition: layer_ids.h:112
@ B_SilkS
Definition: layer_ids.h:103
@ F_Cu
Definition: layer_ids.h:64
@ B_Fab
Definition: layer_ids.h:119
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:932

References B_Adhes, B_Cu, B_Fab, B_Mask, B_Paste, B_SilkS, Cmts_User, Dwgs_User, Eco1_User, Eco2_User, Edge_Cuts, F_Adhes, F_Cu, F_Fab, F_Mask, F_Paste, F_SilkS, BOARD::GetCopperLayerCount(), BOARD::GetLayerType(), IsCopperLayer(), LT_MIXED, LT_POWER, LT_SIGNAL, and ToLAYER_ID().

Referenced by AddGerberX2Attribute().

◆ GetGerberProtelExtension()

const wxString GetGerberProtelExtension ( int  aLayer)
Returns
the appropriate Gerber file extension for aLayer

Definition at line 42 of file pcbplot.cpp.

43{
44 if( IsCopperLayer( aLayer ) )
45 {
46 if( aLayer == F_Cu )
47 return wxT( "gtl" );
48 else if( aLayer == B_Cu )
49 return wxT( "gbl" );
50 else
51 return wxString::Format( wxT( "g%d" ), aLayer+1 );
52 }
53 else
54 {
55 switch( aLayer )
56 {
57 case B_Adhes: return wxT( "gba" );
58 case F_Adhes: return wxT( "gta" );
59
60 case B_Paste: return wxT( "gbp" );
61 case F_Paste: return wxT( "gtp" );
62
63 case B_SilkS: return wxT( "gbo" );
64 case F_SilkS: return wxT( "gto" );
65
66 case B_Mask: return wxT( "gbs" );
67 case F_Mask: return wxT( "gts" );
68
69 case Edge_Cuts: return wxT( "gm1" );
70
71 case Dwgs_User:
72 case Cmts_User:
73 case Eco1_User:
74 case Eco2_User:
75 default: return wxT( "gbr" );
76 }
77 }
78}
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200

References B_Adhes, B_Cu, B_Mask, B_Paste, B_SilkS, Cmts_User, Dwgs_User, Eco1_User, Eco2_User, Edge_Cuts, F_Adhes, F_Cu, F_Mask, F_Paste, F_SilkS, Format(), and IsCopperLayer().

Referenced by PCBNEW_JOBS_HANDLER::JobExportGerbers(), PLOT_CONTROLLER::OpenPlotfile(), and DIALOG_PLOT::Plot().

◆ PlotBoardLayers()

void PlotBoardLayers ( BOARD aBoard,
PLOTTER aPlotter,
const LSEQ aLayerSequence,
const PCB_PLOT_PARAMS aPlotOptions 
)

Plot a sequence of board layer IDs.

Parameters
aBoardis the board to plot.
aPlotteris the plotter to use.
aLayerSequenceis the sequence of layer IDs to plot.
aPlotOptionsare the plot options (files, sketch). Has meaning for some formats only.

Definition at line 69 of file plot_board_layers.cpp.

71{
72 wxCHECK( aBoard && aPlotter && aLayers.size(), /* void */ );
73
74 for( LSEQ seq = aLayers; seq; ++seq )
75 PlotOneBoardLayer( aBoard, aPlotter, *seq, aPlotOptions );
76}
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
Definition: layer_ids.h:493
void PlotOneBoardLayer(BOARD *aBoard, PLOTTER *aPlotter, PCB_LAYER_ID aLayer, const PCB_PLOT_PARAMS &aPlotOpt)
Plot one copper or technical layer.

References PlotOneBoardLayer().

Referenced by PCBNEW_JOBS_HANDLER::JobExportDxf(), PCBNEW_JOBS_HANDLER::JobExportGerber(), PCBNEW_JOBS_HANDLER::JobExportGerbers(), PCBNEW_JOBS_HANDLER::JobExportPdf(), PCB_PLOT_SVG::Plot(), DIALOG_PLOT::Plot(), and PLOT_CONTROLLER::PlotLayers().

◆ PlotInteractiveLayer()

void PlotInteractiveLayer ( BOARD aBoard,
PLOTTER aPlotter 
)

Plot interactive items (hypertext links, properties, etc.).

Definition at line 79 of file plot_board_layers.cpp.

80{
81 for( const FOOTPRINT* fp : aBoard->Footprints() )
82 {
83 std::vector<wxString> properties;
84
85 properties.emplace_back( wxString::Format( wxT( "!%s = %s" ),
86 _( "Reference designator" ),
87 fp->Reference().GetShownText() ) );
88
89 properties.emplace_back( wxString::Format( wxT( "!%s = %s" ),
90 _( "Value" ),
91 fp->Value().GetShownText() ) );
92
93 for( const auto& [ name, value ] : fp->GetProperties() )
94 properties.emplace_back( wxString::Format( wxT( "!%s = %s" ), name, value ) );
95
96 properties.emplace_back( wxString::Format( wxT( "!%s = %s" ),
97 _( "Footprint" ),
98 fp->GetFPIDAsString() ) );
99
100 properties.emplace_back( wxString::Format( wxT( "!%s = %s" ),
101 _( "Description" ),
102 fp->GetDescription() ) );
103
104 properties.emplace_back( wxString::Format( wxT( "!%s = %s" ),
105 _( "Keywords" ),
106 fp->GetKeywords() ) );
107
108 aPlotter->HyperlinkMenu( fp->GetBoundingBox(), properties );
109 }
110}
const char * name
Definition: DXF_plotter.cpp:56
FOOTPRINTS & Footprints()
Definition: board.h:311
virtual void HyperlinkMenu(const BOX2I &aBox, const std::vector< wxString > &aDestURLs)
Create a clickable hyperlink menu with a rectangular click area.
Definition: plotter.h:466
#define _(s)

References _, BOARD::Footprints(), Format(), PLOTTER::HyperlinkMenu(), and name.

Referenced by PCBNEW_JOBS_HANDLER::JobExportPdf(), DIALOG_PLOT::Plot(), PLOT_CONTROLLER::PlotLayer(), and PLOT_CONTROLLER::PlotLayers().

◆ PlotLayerOutlines()

void PlotLayerOutlines ( BOARD aBoard,
PLOTTER aPlotter,
LSET  aLayerMask,
const PCB_PLOT_PARAMS aPlotOpt 
)

Plot copper outline of a copper layer.

Parameters
aBoardis the board to plot.
aPlotteris the plotter to use.
aLayerMaskis the mask to define the layers to plot.
aPlotOptis the plot options. Has meaning for some formats only.

Plot copper outline of a copper layer.

Definition at line 704 of file plot_board_layers.cpp.

706{
707 BRDITEMS_PLOTTER itemplotter( aPlotter, aBoard, aPlotOpt );
708 itemplotter.SetLayerSet( aLayerMask );
709
710 SHAPE_POLY_SET outlines;
711
712 for( LSEQ seq = aLayerMask.Seq( aLayerMask.SeqStackupBottom2Top() ); seq; ++seq )
713 {
714 PCB_LAYER_ID layer = *seq;
715
716 outlines.RemoveAllContours();
717 aBoard->ConvertBrdLayerToPolygonalContours( layer, outlines );
718
720
721 // Plot outlines
722 std::vector<VECTOR2I> cornerList;
723
724 // Now we have one or more basic polygons: plot each polygon
725 for( int ii = 0; ii < outlines.OutlineCount(); ii++ )
726 {
727 for( int kk = 0; kk <= outlines.HoleCount(ii); kk++ )
728 {
729 cornerList.clear();
730 const SHAPE_LINE_CHAIN& path =
731 ( kk == 0 ) ? outlines.COutline( ii ) : outlines.CHole( ii, kk - 1 );
732
733 aPlotter->PlotPoly( path, FILL_T::NO_FILL );
734 }
735 }
736
737 // Plot pad holes
739 {
740 int smallDrill = ( aPlotOpt.GetDrillMarksType() == DRILL_MARKS::SMALL_DRILL_SHAPE )
742 INT_MAX;
743
744 for( FOOTPRINT* footprint : aBoard->Footprints() )
745 {
746 for( PAD* pad : footprint->Pads() )
747 {
748 if( pad->HasHole() )
749 {
750 std::shared_ptr<SHAPE_SEGMENT> slot = pad->GetEffectiveHoleShape();
751
752 if( slot->GetSeg().A == slot->GetSeg().B ) // circular hole
753 {
754 int drill = std::min( smallDrill, slot->GetWidth() );
755 aPlotter->Circle( pad->GetPosition(), drill, FILL_T::NO_FILL );
756 }
757 else
758 {
759 // Note: small drill marks have no significance when applied to slots
760 aPlotter->ThickSegment( slot->GetSeg().A,
761 slot->GetSeg().B,
762 slot->GetWidth(), SKETCH, nullptr );
763 }
764 }
765 }
766 }
767 }
768
769 // Plot vias holes
770 for( PCB_TRACK* track : aBoard->Tracks() )
771 {
772 const PCB_VIA* via = dyn_cast<const PCB_VIA*>( track );
773
774 if( via && via->IsOnLayer( layer ) ) // via holes can be not through holes
775 aPlotter->Circle( via->GetPosition(), via->GetDrillValue(), FILL_T::NO_FILL );
776 }
777 }
778}
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:109
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
void ConvertBrdLayerToPolygonalContours(PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aOutlines) const
Build a set of polygons which are the outlines of copper items (pads, tracks, vias,...
Definition: board.cpp:2272
TRACKS & Tracks()
Definition: board.h:308
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Return an LSEQ from the union of this LSET and a desired sequence.
Definition: lset.cpp:411
LSEQ SeqStackupBottom2Top() const
Return the sequence that is typical for a bottom-to-top stack-up.
Definition: lset.cpp:475
Definition: pad.h:60
DRILL_MARKS GetDrillMarksType() const
virtual void ThickSegment(const VECTOR2I &start, const VECTOR2I &end, int width, OUTLINE_MODE tracemode, void *aData)
Definition: plotter.cpp:549
virtual void Circle(const VECTOR2I &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH)=0
virtual void PlotPoly(const std::vector< VECTOR2I > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=nullptr)=0
Draw a polygon ( filled or not ).
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
Represent a set of closed polygons.
int HoleCount(int aOutline) const
Return the reference to aIndex-th outline in the set.
void Simplify(POLYGON_MODE aFastMode)
const SHAPE_LINE_CHAIN & CHole(int aOutline, int aHole) const
int OutlineCount() const
Return the number of vertices in a given outline/hole.
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
double m_SmallDrillMarkSize
The diameter of the drill marks on print and plot outputs (in mm), when the "Drill marks" option is s...
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:59
@ SKETCH
Definition: outline_mode.h:26
constexpr int mmToIU(double mm) const
Definition: base_units.h:89

References SHAPE_POLY_SET::CHole(), PLOTTER::Circle(), BOARD::ConvertBrdLayerToPolygonalContours(), SHAPE_POLY_SET::COutline(), BOARD::Footprints(), ADVANCED_CFG::GetCfg(), PCB_PLOT_PARAMS::GetDrillMarksType(), SHAPE_POLY_SET::HoleCount(), ADVANCED_CFG::m_SmallDrillMarkSize, EDA_IU_SCALE::mmToIU(), NO_DRILL_SHAPE, NO_FILL, SHAPE_POLY_SET::OutlineCount(), pad, path, pcbIUScale, PLOTTER::PlotPoly(), SHAPE_POLY_SET::PM_FAST, SHAPE_POLY_SET::RemoveAllContours(), LSET::Seq(), LSET::SeqStackupBottom2Top(), BRDITEMS_PLOTTER::SetLayerSet(), SHAPE_POLY_SET::Simplify(), SKETCH, SMALL_DRILL_SHAPE, PLOTTER::ThickSegment(), BOARD::Tracks(), and via.

Referenced by PlotOneBoardLayer().

◆ PlotOneBoardLayer()

void PlotOneBoardLayer ( BOARD aBoard,
PLOTTER aPlotter,
PCB_LAYER_ID  aLayer,
const PCB_PLOT_PARAMS aPlotOpt 
)

Plot one copper or technical layer.

It prepares options and calls the specialized plot function according to the layer type.

Parameters
aBoardis the board to plot.
aPlotteris the plotter to use.
aLayeris the layer id to plot.
aPlotOptis the plot options (files, sketch). Has meaning for some formats only.

Definition at line 113 of file plot_board_layers.cpp.

115{
116 PCB_PLOT_PARAMS plotOpt = aPlotOpt;
117 int soldermask_min_thickness = aBoard->GetDesignSettings().m_SolderMaskMinWidth;
118
119 // Set a default color and the text mode for this layer
120 aPlotter->SetColor( BLACK );
121 aPlotter->SetTextMode( aPlotOpt.GetTextMode() );
122
123 // Specify that the contents of the "Edges Pcb" layer are to be plotted in addition to the
124 // contents of the currently specified layer.
125 LSET layer_mask( aLayer );
126
127 if( IsCopperLayer( aLayer ) )
128 {
129 // Skip NPTH pads on copper layers ( only if hole size == pad size ):
130 // Drill mark will be plotted if drill mark is SMALL_DRILL_SHAPE or FULL_DRILL_SHAPE
131 if( plotOpt.GetFormat() == PLOT_FORMAT::DXF )
132 {
133 plotOpt.SetSkipPlotNPTH_Pads( false );
134 PlotLayerOutlines( aBoard, aPlotter, layer_mask, plotOpt );
135 }
136 else
137 {
138 plotOpt.SetSkipPlotNPTH_Pads( true );
139 PlotStandardLayer( aBoard, aPlotter, layer_mask, plotOpt );
140 }
141 }
142 else
143 {
144 switch( aLayer )
145 {
146 case B_Mask:
147 case F_Mask:
148 plotOpt.SetSkipPlotNPTH_Pads( false );
149
150 // Disable plot pad holes
152
153 // Plot solder mask:
154 if( soldermask_min_thickness == 0 )
155 {
156 if( plotOpt.GetFormat() == PLOT_FORMAT::DXF )
157 PlotLayerOutlines( aBoard, aPlotter, layer_mask, plotOpt );
158 else
159 PlotStandardLayer( aBoard, aPlotter, layer_mask, plotOpt );
160 }
161 else
162 {
163 PlotSolderMaskLayer( aBoard, aPlotter, layer_mask, plotOpt,
164 soldermask_min_thickness );
165 }
166
167 break;
168
169 case B_Adhes:
170 case F_Adhes:
171 case B_Paste:
172 case F_Paste:
173 plotOpt.SetSkipPlotNPTH_Pads( false );
174
175 // Disable plot pad holes
177
178 if( plotOpt.GetFormat() == PLOT_FORMAT::DXF )
179 PlotLayerOutlines( aBoard, aPlotter, layer_mask, plotOpt );
180 else
181 PlotStandardLayer( aBoard, aPlotter, layer_mask, plotOpt );
182
183 break;
184
185 case F_SilkS:
186 case B_SilkS:
187 if( plotOpt.GetFormat() == PLOT_FORMAT::DXF && plotOpt.GetDXFPlotPolygonMode() )
188 // PlotLayerOutlines() is designed only for DXF plotters.
189 // and must not be used for other plot formats
190 PlotLayerOutlines( aBoard, aPlotter, layer_mask, plotOpt );
191 else
192 PlotStandardLayer( aBoard, aPlotter, layer_mask, plotOpt );
193
194 // Gerber: Subtract soldermask from silkscreen if enabled
195 if( aPlotter->GetPlotterType() == PLOT_FORMAT::GERBER
196 && plotOpt.GetSubtractMaskFromSilk() )
197 {
198 if( aLayer == F_SilkS )
199 layer_mask = LSET( F_Mask );
200 else
201 layer_mask = LSET( B_Mask );
202
203 // Create the mask to subtract by creating a negative layer polarity
204 aPlotter->SetLayerPolarity( false );
205
206 // Disable plot pad holes
208
209 // Plot the mask
210 PlotStandardLayer( aBoard, aPlotter, layer_mask, plotOpt );
211 }
212
213 break;
214
215 // These layers are plotted like silk screen layers.
216 // Mainly, pads on these layers are not filled.
217 // This is not necessary the best choice.
218 case Dwgs_User:
219 case Cmts_User:
220 case Eco1_User:
221 case Eco2_User:
222 case Edge_Cuts:
223 case Margin:
224 case F_CrtYd:
225 case B_CrtYd:
226 case F_Fab:
227 case B_Fab:
228 plotOpt.SetSkipPlotNPTH_Pads( false );
230
231 if( plotOpt.GetFormat() == PLOT_FORMAT::DXF && plotOpt.GetDXFPlotPolygonMode() )
232 // PlotLayerOutlines() is designed only for DXF plotters.
233 // and must not be used for other plot formats
234 PlotLayerOutlines( aBoard, aPlotter, layer_mask, plotOpt );
235 else
236 PlotStandardLayer( aBoard, aPlotter, layer_mask, plotOpt );
237
238 break;
239
240 default:
241 plotOpt.SetSkipPlotNPTH_Pads( false );
243
244 if( plotOpt.GetFormat() == PLOT_FORMAT::DXF && plotOpt.GetDXFPlotPolygonMode() )
245 // PlotLayerOutlines() is designed only for DXF plotters.
246 // and must not be used for other plot formats
247 PlotLayerOutlines( aBoard, aPlotter, layer_mask, plotOpt );
248 else
249 PlotStandardLayer( aBoard, aPlotter, layer_mask, plotOpt );
250
251 break;
252 }
253 }
254}
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:532
Parameters and options when plotting/printing a board.
PLOT_FORMAT GetFormat() const
void SetDrillMarksType(DRILL_MARKS aVal)
void SetSkipPlotNPTH_Pads(bool aSkip)
PLOT_TEXT_MODE GetTextMode() const
bool GetDXFPlotPolygonMode() const
bool GetSubtractMaskFromSilk() const
virtual PLOT_FORMAT GetPlotterType() const =0
Returns the effective plot engine in use.
virtual void SetTextMode(PLOT_TEXT_MODE mode)
Change the current text mode.
Definition: plotter.h:515
virtual void SetLayerPolarity(bool aPositive)
Set the current Gerber layer polarity to positive or negative by writing %LPD*% or %LPC*% to the Gerb...
Definition: plotter.h:506
virtual void SetColor(const COLOR4D &color)=0
@ BLACK
Definition: color4d.h:42
@ F_CrtYd
Definition: layer_ids.h:117
@ Margin
Definition: layer_ids.h:114
@ B_CrtYd
Definition: layer_ids.h:116
void PlotStandardLayer(BOARD *aBoard, PLOTTER *aPlotter, LSET aLayerMask, const PCB_PLOT_PARAMS &aPlotOpt)
Plot a copper layer or mask.
static void PlotSolderMaskLayer(BOARD *aBoard, PLOTTER *aPlotter, LSET aLayerMask, const PCB_PLOT_PARAMS &aPlotOpt, int aMinThickness)
void PlotLayerOutlines(BOARD *aBoard, PLOTTER *aPlotter, LSET aLayerMask, const PCB_PLOT_PARAMS &aPlotOpt)
Plot outlines of copper layer.

References B_Adhes, B_CrtYd, B_Fab, B_Mask, B_Paste, B_SilkS, BLACK, Cmts_User, Dwgs_User, DXF, Eco1_User, Eco2_User, Edge_Cuts, F_Adhes, F_CrtYd, F_Fab, F_Mask, F_Paste, F_SilkS, GERBER, BOARD::GetDesignSettings(), PCB_PLOT_PARAMS::GetDXFPlotPolygonMode(), PCB_PLOT_PARAMS::GetFormat(), PLOTTER::GetPlotterType(), PCB_PLOT_PARAMS::GetSubtractMaskFromSilk(), PCB_PLOT_PARAMS::GetTextMode(), IsCopperLayer(), BOARD_DESIGN_SETTINGS::m_SolderMaskMinWidth, Margin, NO_DRILL_SHAPE, PlotLayerOutlines(), PlotSolderMaskLayer(), PlotStandardLayer(), PLOTTER::SetColor(), PCB_PLOT_PARAMS::SetDrillMarksType(), PLOTTER::SetLayerPolarity(), PCB_PLOT_PARAMS::SetSkipPlotNPTH_Pads(), and PLOTTER::SetTextMode().

Referenced by PlotBoardLayers(), and PLOT_CONTROLLER::PlotLayer().

◆ PlotStandardLayer()

void PlotStandardLayer ( BOARD aBoard,
PLOTTER aPlotter,
LSET  aLayerMask,
const PCB_PLOT_PARAMS aPlotOpt 
)

Plot copper or technical layers.

This is not used for silk screen layers because these layers have specific requirements. This is mainly for pads.

Parameters
aBoardis the board to plot.
aPlotteris the plotter to use.
aLayerMaskis the mask to define the layers to plot.
aPlotOptis the plot options (files, sketch). Has meaning for some formats only.

aPlotOpt has 3 important options which are set depending on the layer type to plot: SetEnablePlotVia( bool aEnable ) aEnable = true to plot vias, false to skip vias (has meaning only for solder mask layers) SetSkipPlotNPTH_Pads( bool aSkip ) aSkip = true to skip NPTH Pads, when the pad size and the pad hole have the same size. Used in GERBER format only. SetDrillMarksType( DrillMarksType aVal ) aVal = no hole, small hole, actual hole size

Plot copper or technical layers.

Silk screen layers are not plotted here.

pads not connected to copper are optionally not drawn

Vias not connected to copper are optionally not drawn

Definition at line 262 of file plot_board_layers.cpp.

264{
265 BRDITEMS_PLOTTER itemplotter( aPlotter, aBoard, aPlotOpt );
266
267 itemplotter.SetLayerSet( aLayerMask );
268
269 OUTLINE_MODE plotMode = aPlotOpt.GetPlotMode();
270 bool onCopperLayer = ( LSET::AllCuMask() & aLayerMask ).any();
271 bool onSolderMaskLayer = ( LSET( 2, F_Mask, B_Mask ) & aLayerMask ).any();
272 bool onSolderPasteLayer = ( LSET( 2, F_Paste, B_Paste ) & aLayerMask ).any();
273 bool onFrontFab = ( LSET( F_Fab ) & aLayerMask ).any();
274 bool onBackFab = ( LSET( B_Fab ) & aLayerMask ).any();
275 bool sketchPads = ( onFrontFab || onBackFab ) && aPlotOpt.GetSketchPadsOnFabLayers();
276
277 // Plot edge layer and graphic items
278 itemplotter.PlotBoardGraphicItems();
279
280 // Draw footprint texts:
281 for( const FOOTPRINT* footprint : aBoard->Footprints() )
282 itemplotter.PlotFootprintTextItems( footprint );
283
284 // Draw footprint other graphic items:
285 for( const FOOTPRINT* footprint : aBoard->Footprints() )
286 itemplotter.PlotFootprintGraphicItems( footprint );
287
288 // Plot footprint pads
289 for( FOOTPRINT* footprint : aBoard->Footprints() )
290 {
291 aPlotter->StartBlock( nullptr );
292
293 for( PAD* pad : footprint->Pads() )
294 {
295 OUTLINE_MODE padPlotMode = plotMode;
296
297 if( !( pad->GetLayerSet() & aLayerMask ).any() )
298 {
299 if( sketchPads &&
300 ( ( onFrontFab && pad->GetLayerSet().Contains( F_Cu ) ) ||
301 ( onBackFab && pad->GetLayerSet().Contains( B_Cu ) ) ) )
302 {
303 padPlotMode = SKETCH;
304 }
305 else
306 {
307 continue;
308 }
309 }
310
312 if( onCopperLayer && !pad->FlashLayer( aLayerMask ) )
313 continue;
314
316
317 // If we're plotting a single layer, the color for that layer can be used directly.
318 if( aLayerMask.count() == 1 )
319 {
320 color = aPlotOpt.ColorSettings()->GetColor( aLayerMask.Seq()[0] );
321 }
322 else
323 {
324 if( ( pad->GetLayerSet() & aLayerMask )[B_Cu] )
325 color = aPlotOpt.ColorSettings()->GetColor( B_Cu );
326
327 if( ( pad->GetLayerSet() & aLayerMask )[F_Cu] )
328 color = color.LegacyMix( aPlotOpt.ColorSettings()->GetColor( F_Cu ) );
329
330 if( sketchPads && aLayerMask[F_Fab] )
331 color = aPlotOpt.ColorSettings()->GetColor( F_Fab );
332 else if( sketchPads && aLayerMask[B_Fab] )
333 color = aPlotOpt.ColorSettings()->GetColor( B_Fab );
334 }
335
336 VECTOR2I margin;
337 int width_adj = 0;
338
339 if( onCopperLayer )
340 width_adj = itemplotter.getFineWidthAdj();
341
342 if( onSolderMaskLayer )
343 margin.x = margin.y = pad->GetSolderMaskExpansion();
344
345 if( onSolderPasteLayer )
346 margin = pad->GetSolderPasteMargin();
347
348 // not all shapes can have a different margin for x and y axis
349 // in fact only oval and rect shapes can have different values.
350 // Round shape have always the same x,y margin
351 // so define a unique value for other shapes that do not support different values
352 int mask_clearance = margin.x;
353
354 // Now offset the pad size by margin + width_adj
355 VECTOR2I padPlotsSize = pad->GetSize() + margin * 2 + VECTOR2I( width_adj, width_adj );
356
357 // Store these parameters that can be modified to plot inflated/deflated pads shape
358 PAD_SHAPE padShape = pad->GetShape();
359 VECTOR2I padSize = pad->GetSize();
360 VECTOR2I padDelta = pad->GetDelta(); // has meaning only for trapezoidal pads
361 double padCornerRadius = pad->GetRoundRectCornerRadius();
362
363 // Don't draw a 0 sized pad.
364 // Note: a custom pad can have its pad anchor with size = 0
365 if( pad->GetShape() != PAD_SHAPE::CUSTOM
366 && ( padPlotsSize.x <= 0 || padPlotsSize.y <= 0 ) )
367 continue;
368
369 switch( pad->GetShape() )
370 {
372 case PAD_SHAPE::OVAL:
373 pad->SetSize( padPlotsSize );
374
375 if( aPlotOpt.GetSkipPlotNPTH_Pads() &&
377 ( pad->GetSize() == pad->GetDrillSize() ) &&
378 ( pad->GetAttribute() == PAD_ATTRIB::NPTH ) )
379 {
380 break;
381 }
382
383 itemplotter.PlotPad( pad, color, padPlotMode );
384 break;
385
386 case PAD_SHAPE::RECT:
387 pad->SetSize( padPlotsSize );
388
389 if( mask_clearance > 0 )
390 {
391 pad->SetShape( PAD_SHAPE::ROUNDRECT );
392 pad->SetRoundRectCornerRadius( mask_clearance );
393 }
394
395 itemplotter.PlotPad( pad, color, padPlotMode );
396 break;
397
399 // inflate/deflate a trapezoid is a bit complex.
400 // so if the margin is not null, build a similar polygonal pad shape,
401 // and inflate/deflate the polygonal shape
402 // because inflating/deflating using different values for y and y
403 // we are using only margin.x as inflate/deflate value
404 if( mask_clearance == 0 )
405 {
406 itemplotter.PlotPad( pad, color, padPlotMode );
407 }
408 else
409 {
410 PAD dummy( *pad );
411 dummy.SetAnchorPadShape( PAD_SHAPE::CIRCLE );
412 dummy.SetShape( PAD_SHAPE::CUSTOM );
413 SHAPE_POLY_SET outline;
414 outline.NewOutline();
415 int dx = padSize.x / 2;
416 int dy = padSize.y / 2;
417 int ddx = padDelta.x / 2;
418 int ddy = padDelta.y / 2;
419
420 outline.Append( -dx - ddy, dy + ddx );
421 outline.Append( dx + ddy, dy - ddx );
422 outline.Append( dx - ddy, -dy + ddx );
423 outline.Append( -dx + ddy, -dy - ddx );
424
425 // Shape polygon can have holes so use InflateWithLinkedHoles(), not Inflate()
426 // which can create bad shapes if margin.x is < 0
427 int maxError = aBoard->GetDesignSettings().m_MaxError;
428 int numSegs = GetArcToSegmentCount( mask_clearance, maxError, FULL_CIRCLE );
429 outline.InflateWithLinkedHoles( mask_clearance, numSegs,
431 dummy.DeletePrimitivesList();
432 dummy.AddPrimitivePoly( outline, 0, true );
433
434 // Be sure the anchor pad is not bigger than the deflated shape because this
435 // anchor will be added to the pad shape when plotting the pad. So now the
436 // polygonal shape is built, we can clamp the anchor size
437 dummy.SetSize( VECTOR2I( 0, 0 ) );
438
439 itemplotter.PlotPad( &dummy, color, padPlotMode );
440 }
441
442 break;
443
445 {
446 // rounding is stored as a percent, but we have to change the new radius
447 // to initial_radius + clearance to have a inflated/deflated similar shape
448 int initial_radius = pad->GetRoundRectCornerRadius();
449 pad->SetSize( padPlotsSize );
450 pad->SetRoundRectCornerRadius( std::max( initial_radius + mask_clearance, 0 ) );
451
452 itemplotter.PlotPad( pad, color, padPlotMode );
453 break;
454 }
455
457 if( mask_clearance == 0 )
458 {
459 // the size can be slightly inflated by width_adj (PS/PDF only)
460 pad->SetSize( padPlotsSize );
461 itemplotter.PlotPad( pad, color, padPlotMode );
462 }
463 else
464 {
465 // Due to the polygonal shape of a CHAMFERED_RECT pad, the best way is to
466 // convert the pad shape to a full polygon, inflate/deflate the polygon
467 // and use a dummy CUSTOM pad to plot the final shape.
468 PAD dummy( *pad );
469 // Build the dummy pad outline with coordinates relative to the pad position
470 // and orientation 0. The actual pos and rotation will be taken in account
471 // later by the plot function
472 dummy.SetPosition( VECTOR2I( 0, 0 ) );
473 dummy.SetOrientation( ANGLE_0 );
474 SHAPE_POLY_SET outline;
475 int maxError = aBoard->GetDesignSettings().m_MaxError;
476 int numSegs = GetArcToSegmentCount( mask_clearance, maxError, FULL_CIRCLE );
477 dummy.TransformShapeToPolygon( outline, UNDEFINED_LAYER, 0, maxError,
478 ERROR_INSIDE );
479 outline.InflateWithLinkedHoles( mask_clearance, numSegs,
481
482 // Initialize the dummy pad shape:
483 dummy.SetAnchorPadShape( PAD_SHAPE::CIRCLE );
484 dummy.SetShape( PAD_SHAPE::CUSTOM );
485 dummy.DeletePrimitivesList();
486 dummy.AddPrimitivePoly( outline, 0, true );
487
488 // Be sure the anchor pad is not bigger than the deflated shape because this
489 // anchor will be added to the pad shape when plotting the pad.
490 // So we set the anchor size to 0
491 dummy.SetSize( VECTOR2I( 0, 0 ) );
492 dummy.SetPosition( pad->GetPosition() );
493 dummy.SetOrientation( pad->GetOrientation() );
494
495 itemplotter.PlotPad( &dummy, color, padPlotMode );
496 }
497
498 break;
499
501 {
502 // inflate/deflate a custom shape is a bit complex.
503 // so build a similar pad shape, and inflate/deflate the polygonal shape
504 PAD dummy( *pad );
505 SHAPE_POLY_SET shape;
506 pad->MergePrimitivesAsPolygon( &shape );
507
508 // Shape polygon can have holes so use InflateWithLinkedHoles(), not Inflate()
509 // which can create bad shapes if margin.x is < 0
510 int maxError = aBoard->GetDesignSettings().m_MaxError;
511 int numSegs = GetArcToSegmentCount( mask_clearance, maxError, FULL_CIRCLE );
512 shape.InflateWithLinkedHoles( mask_clearance, numSegs, SHAPE_POLY_SET::PM_FAST );
513 dummy.DeletePrimitivesList();
514 dummy.AddPrimitivePoly( shape, 0, true );
515
516 // Be sure the anchor pad is not bigger than the deflated shape because this
517 // anchor will be added to the pad shape when plotting the pad. So now the
518 // polygonal shape is built, we can clamp the anchor size
519 if( mask_clearance < 0 ) // we expect margin.x = margin.y for custom pads
520 dummy.SetSize( padPlotsSize );
521
522 itemplotter.PlotPad( &dummy, color, padPlotMode );
523 break;
524 }
525 }
526
527 // Restore the pad parameters modified by the plot code
528 pad->SetSize( padSize );
529 pad->SetDelta( padDelta );
530 pad->SetShape( padShape );
531 pad->SetRoundRectCornerRadius( padCornerRadius );
532 }
533
534 aPlotter->EndBlock( nullptr );
535 aPlotter->Bookmark( footprint->GetBoundingBox(), footprint->GetReference(), _( "Footprints" ) );
536 }
537
538 // Plot vias on copper layers, and if aPlotOpt.GetPlotViaOnMaskLayer() is true,
539 // plot them on solder mask
540
541 GBR_METADATA gbr_metadata;
542
543 bool isOnCopperLayer = ( aLayerMask & LSET::AllCuMask() ).any();
544
545 if( isOnCopperLayer )
546 {
549 }
550
551 aPlotter->StartBlock( nullptr );
552
553 for( const PCB_TRACK* track : aBoard->Tracks() )
554 {
555 const PCB_VIA* via = dyn_cast<const PCB_VIA*>( track );
556
557 if( !via )
558 continue;
559
560 // vias are not plotted if not on selected layer, but if layer is SOLDERMASK_LAYER_BACK
561 // or SOLDERMASK_LAYER_FRONT, vias are drawn only if they are on the corresponding
562 // external copper layer
563 LSET via_mask_layer = via->GetLayerSet();
564
565 if( aPlotOpt.GetPlotViaOnMaskLayer() )
566 {
567 if( via_mask_layer[B_Cu] )
568 via_mask_layer.set( B_Mask );
569
570 if( via_mask_layer[F_Cu] )
571 via_mask_layer.set( F_Mask );
572 }
573
574 if( !( via_mask_layer & aLayerMask ).any() )
575 continue;
576
577 int via_margin = 0;
578 double width_adj = 0;
579
580 if( aLayerMask[B_Mask] || aLayerMask[F_Mask] )
581 via_margin = via->GetSolderMaskExpansion();
582
583 if( ( aLayerMask & LSET::AllCuMask() ).any() )
584 width_adj = itemplotter.getFineWidthAdj();
585
586 int diameter = via->GetWidth() + 2 * via_margin + width_adj;
587
589 if( onCopperLayer && !via->FlashLayer( aLayerMask ) )
590 continue;
591
592 // Don't draw a null size item :
593 if( diameter <= 0 )
594 continue;
595
596 // Some vias can be not connected (no net).
597 // Set the m_NotInNet for these vias to force a empty net name in gerber file
598 gbr_metadata.m_NetlistMetadata.m_NotInNet = via->GetNetname().IsEmpty();
599
600 gbr_metadata.SetNetName( via->GetNetname() );
601
602 COLOR4D color = aPlotOpt.ColorSettings()->GetColor(
603 LAYER_VIAS + static_cast<int>( via->GetViaType() ) );
604
605 // Set plot color (change WHITE to LIGHTGRAY because the white items are not seen on a
606 // white paper or screen
607 aPlotter->SetColor( color != WHITE ? color : LIGHTGRAY );
608 aPlotter->FlashPadCircle( via->GetStart(), diameter, plotMode, &gbr_metadata );
609 }
610
611 aPlotter->EndBlock( nullptr );
612 aPlotter->StartBlock( nullptr );
614
615 // Plot tracks (not vias) :
616 for( const PCB_TRACK* track : aBoard->Tracks() )
617 {
618 if( track->Type() == PCB_VIA_T )
619 continue;
620
621 if( !aLayerMask[track->GetLayer()] )
622 continue;
623
624 // Some track segments can be not connected (no net).
625 // Set the m_NotInNet for these segments to force a empty net name in gerber file
626 gbr_metadata.m_NetlistMetadata.m_NotInNet = track->GetNetname().IsEmpty();
627
628 gbr_metadata.SetNetName( track->GetNetname() );
629 int width = track->GetWidth() + itemplotter.getFineWidthAdj();
630 aPlotter->SetColor( itemplotter.getColor( track->GetLayer() ) );
631
632 if( track->Type() == PCB_ARC_T )
633 {
634 const PCB_ARC* arc = static_cast<const PCB_ARC*>( track );
635
636 // ThickArc expects only positive angle arcs, so flip start/end if
637 // we are negative
638 if( arc->GetAngle() < ANGLE_0 )
639 {
640 aPlotter->ThickArc( arc->GetCenter(), arc->GetEnd(), arc->GetStart(),
641 width, plotMode, &gbr_metadata );
642 }
643 else
644 {
645 aPlotter->ThickArc( arc->GetCenter(), arc->GetStart(), arc->GetEnd(),
646 width, plotMode, &gbr_metadata );
647 }
648 }
649 else
650 {
651 aPlotter->ThickSegment( track->GetStart(), track->GetEnd(), width, plotMode,
652 &gbr_metadata );
653 }
654 }
655
656 aPlotter->EndBlock( nullptr );
657
658 // Plot filled ares
659 aPlotter->StartBlock( nullptr );
660
661 NETINFO_ITEM nonet( aBoard );
662
663 for( const ZONE* zone : aBoard->Zones() )
664 {
665 for( PCB_LAYER_ID layer : zone->GetLayerSet().Seq() )
666 {
667 if( !aLayerMask[layer] )
668 continue;
669
670 SHAPE_POLY_SET mainArea = zone->GetFilledPolysList( layer )->CloneDropTriangulation();
671 SHAPE_POLY_SET islands;
672
673 for( int i = mainArea.OutlineCount() - 1; i >= 0; i-- )
674 {
675 if( zone->IsIsland( layer, i ) )
676 {
677 islands.AddOutline( mainArea.CPolygon( i )[0] );
678 mainArea.DeletePolygon( i );
679 }
680 }
681
682 itemplotter.PlotFilledAreas( zone, layer, mainArea );
683
684 if( !islands.IsEmpty() )
685 {
686 ZONE dummy( *zone );
687 dummy.SetNet( &nonet );
688 itemplotter.PlotFilledAreas( &dummy, layer, islands );
689 }
690 }
691 }
692
693 aPlotter->EndBlock( nullptr );
694
695 // Adding drill marks, if required and if the plotter is able to plot them:
697 itemplotter.PlotDrillMarks();
698}
int color
Definition: DXF_plotter.cpp:57
ZONES & Zones()
Definition: board.h:317
COLOR4D GetColor(int aLayer) const
@ GBR_APERTURE_ATTRIB_VIAPAD
aperture used for vias.
Definition: gbr_metadata.h:102
Metadata which can be added in a gerber file as attribute in X2 format.
Definition: gbr_metadata.h:205
void SetNetName(const wxString &aNetname)
Definition: gbr_metadata.h:229
void SetApertureAttrib(GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB aApertAttribute)
Definition: gbr_metadata.h:209
GBR_NETLIST_METADATA m_NetlistMetadata
An item to handle object attribute.
Definition: gbr_metadata.h:262
void SetNetAttribType(int aNetAttribType)
Definition: gbr_metadata.h:219
@ GBR_NETINFO_NET
print info associated to a net (TO.N attribute)
bool m_NotInNet
true if a pad of a footprint cannot be connected (for instance a mechanical NPTH, ot a not named pad)...
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:102
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:773
Handle the data for a net.
Definition: netinfo.h:67
EDA_ANGLE GetAngle() const
Definition: pcb_track.cpp:1146
virtual VECTOR2I GetCenter() const override
This defaults to the center of the bounding box if not overridden.
Definition: pcb_track.h:322
bool GetSkipPlotNPTH_Pads() const
bool GetSketchPadsOnFabLayers() const
bool GetPlotViaOnMaskLayer() const
OUTLINE_MODE GetPlotMode() const
COLOR_SETTINGS * ColorSettings() const
const VECTOR2I & GetStart() const
Definition: pcb_track.h:114
const VECTOR2I & GetEnd() const
Definition: pcb_track.h:111
virtual void Bookmark(const BOX2I &aBox, const wxString &aName, const wxString &aGroupName=wxEmptyString)
Create a bookmark to a symbol.
Definition: plotter.h:477
virtual void FlashPadCircle(const VECTOR2I &aPadPos, int aDiameter, OUTLINE_MODE aTraceMode, void *aData)=0
virtual void StartBlock(void *aData)
calling this function allows one to define the beginning of a group of drawing items,...
Definition: plotter.h:538
virtual void ThickArc(const VECTOR2I &aCentre, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aWidth, OUTLINE_MODE aTraceMode, void *aData)
Definition: plotter.cpp:592
virtual void EndBlock(void *aData)
calling this function allows one to define the end of a group of drawing items for instance in SVG or...
Definition: plotter.h:547
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new hole to the given outline (default: last) and returns its index.
void DeletePolygon(int aIdx)
Delete aIdx-th polygon and its triangulation data from the set.
bool IsEmpty() const
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Add a new vertex to the contour indexed by aOutline and aHole (defaults to the outline of the last po...
int NewOutline()
Creates a new hole in a given outline.
SHAPE_POLY_SET CloneDropTriangulation() const
Creates a new empty polygon in the set and returns its index.
void InflateWithLinkedHoles(int aFactor, int aCircleSegmentsCount, POLYGON_MODE aFastMode)
Perform outline inflation/deflation, using round corners.
const POLYGON & CPolygon(int aIndex) const
Handle a list of polygons defining a copper zone.
Definition: zone.h:57
@ WHITE
Definition: color4d.h:46
@ LIGHTGRAY
Definition: color4d.h:45
static constexpr EDA_ANGLE & FULL_CIRCLE
Definition: eda_angle.h:427
static constexpr EDA_ANGLE & ANGLE_0
Definition: eda_angle.h:429
@ ERROR_INSIDE
int GetArcToSegmentCount(int aRadius, int aErrorMax, const EDA_ANGLE &aArcAngle)
@ LAYER_VIAS
Meta control for all vias opacity/visibility.
Definition: layer_ids.h:193
@ UNDEFINED_LAYER
Definition: layer_ids.h:60
OUTLINE_MODE
Definition: outline_mode.h:25
@ NPTH
like PAD_PTH, but not plated
PAD_SHAPE
The set of pad shapes, used with PAD::{Set,Get}Shape()
Definition: pad_shapes.h:35
std::vector< FAB_LAYER_COLOR > dummy
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:102
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
Definition: typeinfo.h:103
VECTOR2< int > VECTOR2I
Definition: vector2d.h:590

References _, SHAPE_POLY_SET::AddOutline(), LSET::AllCuMask(), ANGLE_0, SHAPE_POLY_SET::Append(), B_Cu, B_Fab, B_Mask, B_Paste, BLACK, PLOTTER::Bookmark(), CHAMFERED_RECT, CIRCLE, SHAPE_POLY_SET::CloneDropTriangulation(), color, PCB_PLOT_PARAMS::ColorSettings(), SHAPE_POLY_SET::CPolygon(), CUSTOM, SHAPE_POLY_SET::DeletePolygon(), dummy, PLOTTER::EndBlock(), ERROR_INSIDE, F_Cu, F_Fab, F_Mask, F_Paste, PLOTTER::FlashPadCircle(), BOARD::Footprints(), FULL_CIRCLE, GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_CONDUCTOR, GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_VIAPAD, GBR_NETLIST_METADATA::GBR_NETINFO_NET, PCB_ARC::GetAngle(), GetArcToSegmentCount(), PCB_ARC::GetCenter(), COLOR_SETTINGS::GetColor(), BRDITEMS_PLOTTER::getColor(), BOARD::GetDesignSettings(), PCB_PLOT_PARAMS::GetDrillMarksType(), PCB_TRACK::GetEnd(), BRDITEMS_PLOTTER::getFineWidthAdj(), PCB_PLOT_PARAMS::GetPlotMode(), PCB_PLOT_PARAMS::GetPlotViaOnMaskLayer(), PCB_PLOT_PARAMS::GetSketchPadsOnFabLayers(), PCB_PLOT_PARAMS::GetSkipPlotNPTH_Pads(), PCB_TRACK::GetStart(), SHAPE_POLY_SET::InflateWithLinkedHoles(), SHAPE_POLY_SET::IsEmpty(), LAYER_VIAS, LIGHTGRAY, BOARD_DESIGN_SETTINGS::m_MaxError, GBR_METADATA::m_NetlistMetadata, GBR_NETLIST_METADATA::m_NotInNet, SHAPE_POLY_SET::NewOutline(), NO_DRILL_SHAPE, NPTH, SHAPE_POLY_SET::OutlineCount(), OVAL, pad, PCB_ARC_T, PCB_VIA_T, BRDITEMS_PLOTTER::PlotBoardGraphicItems(), BRDITEMS_PLOTTER::PlotDrillMarks(), BRDITEMS_PLOTTER::PlotFilledAreas(), BRDITEMS_PLOTTER::PlotFootprintGraphicItems(), BRDITEMS_PLOTTER::PlotFootprintTextItems(), BRDITEMS_PLOTTER::PlotPad(), SHAPE_POLY_SET::PM_FAST, RECT, ROUNDRECT, LSET::Seq(), GBR_METADATA::SetApertureAttrib(), PLOTTER::SetColor(), BRDITEMS_PLOTTER::SetLayerSet(), GBR_METADATA::SetNetAttribType(), GBR_METADATA::SetNetName(), SKETCH, PLOTTER::StartBlock(), PLOTTER::ThickArc(), PLOTTER::ThickSegment(), BOARD::Tracks(), TRAPEZOID, UNDEFINED_LAYER, via, WHITE, VECTOR2< T >::x, VECTOR2< T >::y, and BOARD::Zones().

Referenced by PlotOneBoardLayer(), and PlotSolderMaskLayer().

◆ StartPlotBoard()

PLOTTER * StartPlotBoard ( BOARD aBoard,
const PCB_PLOT_PARAMS aPlotOpts,
int  aLayer,
const wxString &  aFullFileName,
const wxString &  aSheetName,
const wxString &  aSheetPath 
)

Open a new plotfile using the options (and especially the format) specified in the options and prepare the page for plotting.

Returns
the plotter object if OK, NULL if the file is not created (or has a problem).

Definition at line 1126 of file plot_board_layers.cpp.

1129{
1130 // Create the plotter driver and set the few plotter specific options
1131 PLOTTER* plotter = nullptr;
1132
1133 switch( aPlotOpts->GetFormat() )
1134 {
1135 case PLOT_FORMAT::DXF:
1136 DXF_PLOTTER* DXF_plotter;
1137 DXF_plotter = new DXF_PLOTTER();
1138 DXF_plotter->SetUnits( aPlotOpts->GetDXFPlotUnits() );
1139
1140 plotter = DXF_plotter;
1141 break;
1142
1143 case PLOT_FORMAT::POST:
1144 PS_PLOTTER* PS_plotter;
1145 PS_plotter = new PS_PLOTTER();
1146 PS_plotter->SetScaleAdjust( aPlotOpts->GetFineScaleAdjustX(),
1147 aPlotOpts->GetFineScaleAdjustY() );
1148 plotter = PS_plotter;
1149 break;
1150
1151 case PLOT_FORMAT::PDF:
1152 plotter = new PDF_PLOTTER();
1153 break;
1154
1155 case PLOT_FORMAT::HPGL:
1156 HPGL_PLOTTER* HPGL_plotter;
1157 HPGL_plotter = new HPGL_PLOTTER();
1158
1159 // HPGL options are a little more convoluted to compute, so they get their own function
1160 ConfigureHPGLPenSizes( HPGL_plotter, aPlotOpts );
1161 plotter = HPGL_plotter;
1162 break;
1163
1165 // For Gerber plotter, a valid board layer must be set, in order to create a valid
1166 // Gerber header, especially the TF.FileFunction and .FilePolarity data
1167 if( aLayer < PCBNEW_LAYER_ID_START || aLayer >= PCB_LAYER_ID_COUNT )
1168 {
1169 wxLogError( wxString::Format(
1170 "Invalid board layer %d, cannot build a valid Gerber file header",
1171 aLayer ) );
1172 }
1173
1174 plotter = new GERBER_PLOTTER();
1175 break;
1176
1177 case PLOT_FORMAT::SVG:
1178 plotter = new SVG_PLOTTER();
1179 break;
1180
1181 default:
1182 wxASSERT( false );
1183 return nullptr;
1184 }
1185
1187 renderSettings->LoadColors( aPlotOpts->ColorSettings() );
1188 renderSettings->SetDefaultPenWidth( pcbIUScale.mmToIU( 0.0212 ) ); // Hairline at 1200dpi
1189
1190 if( aLayer >= 0 && aLayer < GAL_LAYER_ID_END )
1191 renderSettings->SetLayerName( aBoard->GetLayerName( ToLAYER_ID( aLayer ) ) );
1192
1193 plotter->SetRenderSettings( renderSettings );
1194
1195 // Compute the viewport and set the other options
1196
1197 // page layout is not mirrored, so temporarily change mirror option for the page layout
1198 PCB_PLOT_PARAMS plotOpts = *aPlotOpts;
1199
1200 if( plotOpts.GetPlotFrameRef() && plotOpts.GetMirror() )
1201 plotOpts.SetMirror( false );
1202
1203 initializePlotter( plotter, aBoard, &plotOpts );
1204
1205 if( plotter->OpenFile( aFullFileName ) )
1206 {
1207 plotter->ClearHeaderLinesList();
1208
1209 // For the Gerber "file function" attribute, set the layer number
1210 if( plotter->GetPlotterType() == PLOT_FORMAT::GERBER )
1211 {
1212 bool useX2mode = plotOpts.GetUseGerberX2format();
1213
1214 GERBER_PLOTTER* gbrplotter = static_cast <GERBER_PLOTTER*> ( plotter );
1215 gbrplotter->DisableApertMacros( plotOpts.GetDisableGerberMacros() );
1216 gbrplotter->UseX2format( useX2mode );
1217 gbrplotter->UseX2NetAttributes( plotOpts.GetIncludeGerberNetlistInfo() );
1218
1219 // Attributes can be added using X2 format or as comment (X1 format)
1220 AddGerberX2Attribute( plotter, aBoard, aLayer, not useX2mode );
1221 }
1222
1223 plotter->StartPlot( wxT( "1" ) );
1224
1225 // Plot the frame reference if requested
1226 if( aPlotOpts->GetPlotFrameRef() )
1227 {
1228 PlotDrawingSheet( plotter, aBoard->GetProject(), aBoard->GetTitleBlock(),
1229 aBoard->GetPageSettings(), &aBoard->GetProperties(), wxT( "1" ), 1,
1230 aSheetName, aSheetPath, aBoard->GetFileName() );
1231
1232 if( aPlotOpts->GetMirror() )
1233 initializePlotter( plotter, aBoard, aPlotOpts );
1234 }
1235
1236 // When plotting a negative board: draw a black rectangle (background for plot board
1237 // in white) and switch the current color to WHITE; note the color inversion is actually
1238 // done in the driver (if supported)
1239 if( aPlotOpts->GetNegative() )
1240 {
1241 BOX2I bbox = aBoard->ComputeBoundingBox();
1242 FillNegativeKnockout( plotter, bbox );
1243 }
1244
1245 return plotter;
1246 }
1247
1248 delete plotter->RenderSettings();
1249 delete plotter;
1250 return nullptr;
1251}
const PAGE_INFO & GetPageSettings() const
Definition: board.h:632
BOX2I ComputeBoundingBox(bool aBoardEdgesOnly=false) const
Calculate the bounding box containing all board items (or board edge segments).
Definition: board.cpp:1253
const std::map< wxString, wxString > & GetProperties() const
Definition: board.h:338
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:474
void SetUnits(DXF_UNITS aUnit)
Set the units to use for plotting the DXF file.
void UseX2format(bool aEnable)
void UseX2NetAttributes(bool aEnable)
void DisableApertMacros(bool aDisable)
Disable Aperture Macro (AM) command, only for broken Gerber Readers.
PCB specific render settings.
Definition: pcb_painter.h:72
void LoadColors(const COLOR_SETTINGS *aSettings) override
void SetDefaultPenWidth(int aWidth)
void SetLayerName(const wxString &aLayerName)
bool GetNegative() const
bool GetMirror() const
DXF_UNITS GetDXFPlotUnits() const
void SetMirror(bool aFlag)
double GetFineScaleAdjustY() const
bool GetUseGerberX2format() const
bool GetIncludeGerberNetlistInfo() const
double GetFineScaleAdjustX() const
bool GetPlotFrameRef() const
bool GetDisableGerberMacros() const
Base plotter engine class.
Definition: plotter.h:110
virtual bool OpenFile(const wxString &aFullFilename)
Open or create the plot file aFullFilename.
Definition: plotter.cpp:74
void SetRenderSettings(RENDER_SETTINGS *aSettings)
Definition: plotter.h:140
virtual bool StartPlot(const wxString &aPageNumber)=0
RENDER_SETTINGS * RenderSettings()
Definition: plotter.h:141
void ClearHeaderLinesList()
Remove all lines from the list of free lines to print at the beginning of the file.
Definition: plotter.h:176
void SetScaleAdjust(double scaleX, double scaleY)
Set the 'fine' scaling for the postscript engine.
void PlotDrawingSheet(PLOTTER *plotter, const PROJECT *aProject, const TITLE_BLOCK &aTitleBlock, const PAGE_INFO &aPageInfo, const std::map< wxString, wxString > *aProperties, const wxString &aSheetNumber, int aSheetCount, const wxString &aSheetName, const wxString &aSheetPath, const wxString &aFilename, COLOR4D aColor, bool aIsFirstPage)
@ GAL_LAYER_ID_END
Definition: layer_ids.h:260
@ PCB_LAYER_ID_COUNT
Definition: layer_ids.h:137
void AddGerberX2Attribute(PLOTTER *aPlotter, const BOARD *aBoard, int aLayer, bool aUseX1CompatibilityMode)
Calculate some X2 attributes as defined in the Gerber file format specification and add them to the g...
Definition: pcbplot.cpp:342
static void FillNegativeKnockout(PLOTTER *aPlotter, const BOX2I &aBbbox)
Prefill in black an area a little bigger than the board to prepare for the negative plot.
static void ConfigureHPGLPenSizes(HPGL_PLOTTER *aPlotter, const PCB_PLOT_PARAMS *aPlotOpts)
Calculate the effective size of HPGL pens and set them in the plotter object.
static void initializePlotter(PLOTTER *aPlotter, const BOARD *aBoard, const PCB_PLOT_PARAMS *aPlotOpts)
Set up most plot options for plotting a board (especially the viewport) Important thing: page size is...

References AddGerberX2Attribute(), PLOTTER::ClearHeaderLinesList(), PCB_PLOT_PARAMS::ColorSettings(), BOARD::ComputeBoundingBox(), ConfigureHPGLPenSizes(), GERBER_PLOTTER::DisableApertMacros(), DXF, FillNegativeKnockout(), Format(), GAL_LAYER_ID_END, GERBER, PCB_PLOT_PARAMS::GetDisableGerberMacros(), PCB_PLOT_PARAMS::GetDXFPlotUnits(), BOARD::GetFileName(), PCB_PLOT_PARAMS::GetFineScaleAdjustX(), PCB_PLOT_PARAMS::GetFineScaleAdjustY(), PCB_PLOT_PARAMS::GetFormat(), PCB_PLOT_PARAMS::GetIncludeGerberNetlistInfo(), BOARD::GetLayerName(), PCB_PLOT_PARAMS::GetMirror(), PCB_PLOT_PARAMS::GetNegative(), BOARD::GetPageSettings(), PCB_PLOT_PARAMS::GetPlotFrameRef(), PLOTTER::GetPlotterType(), BOARD::GetProject(), BOARD::GetProperties(), BOARD::GetTitleBlock(), PCB_PLOT_PARAMS::GetUseGerberX2format(), HPGL, initializePlotter(), KIGFX::PCB_RENDER_SETTINGS::LoadColors(), EDA_IU_SCALE::mmToIU(), PLOTTER::OpenFile(), PCB_LAYER_ID_COUNT, pcbIUScale, PDF, PlotDrawingSheet(), POST, PLOTTER::RenderSettings(), KIGFX::RENDER_SETTINGS::SetDefaultPenWidth(), KIGFX::RENDER_SETTINGS::SetLayerName(), PCB_PLOT_PARAMS::SetMirror(), PLOTTER::SetRenderSettings(), PSLIKE_PLOTTER::SetScaleAdjust(), DXF_PLOTTER::SetUnits(), PLOTTER::StartPlot(), SVG, ToLAYER_ID(), GERBER_PLOTTER::UseX2format(), and GERBER_PLOTTER::UseX2NetAttributes().

Referenced by PCBNEW_JOBS_HANDLER::JobExportDxf(), PCBNEW_JOBS_HANDLER::JobExportGerber(), PCBNEW_JOBS_HANDLER::JobExportGerbers(), PCBNEW_JOBS_HANDLER::JobExportPdf(), PLOT_CONTROLLER::OpenPlotfile(), PCB_PLOT_SVG::Plot(), and DIALOG_PLOT::Plot().