47static std::vector<BOARD_ITEM*>
initTextTable( std::vector<std::vector<PCB_TEXT*>> aContent,
49 VECTOR2I* aTableSize,
bool aDrawFrame =
true )
54 int nbCols = aContent.size();
57 for(
const std::vector<PCB_TEXT*>& col : aContent )
58 nbRows = std::max( nbRows,
static_cast<int>( col.size() ) );
61 nbCols = std::min( nbCols, 99 );
62 nbRows = std::min( nbRows, 99 );
67 std::vector<BOARD_ITEM*> table;
86 for( i = 0; i < nbRows; i++ )
89 for( i = 0; i < nbCols; i++ )
95 for(
const std::vector<PCB_TEXT*>& col : aContent )
107 int height = cell->GetBoundingBox().GetHeight() + 2 * ymargin;
108 int width = cell->GetBoundingBox().GetWidth() + 2 * xmargin;
109 rowHeight[j] = rowHeight[j] > height ? rowHeight[j] : height;
110 colWidth[i] = colWidth[i] > width ? colWidth[i] : width;
118 int height = std::accumulate( rowHeight, rowHeight + nbRows, 0 );
119 int width = std::accumulate( colWidth, colWidth + nbCols, 0 );
121 aTableSize->
x = width;
122 aTableSize->
y = height;
130 for( i = 0; i < nbRows; i++ )
137 table.push_back( line );
144 table.push_back( line );
147 for( i = 0; i < nbCols; i++ )
154 table.push_back( line );
161 table.push_back( line );
166 VECTOR2I pos( origin.
x + xmargin, origin.
y + ymargin );
168 for( std::vector<PCB_TEXT*>& col : aContent )
175 pos.
y = origin.
y + ymargin;
182 cell->SetTextPos( pos );
183 cell->SetLayer( aLayer );
184 pos.
y = pos.
y + rowHeight[j];
185 table.push_back( cell );
189 pos.
x = pos.
x + colWidth[i];
205 std::vector<std::vector<PCB_TEXT*>> texts;
208 std::unique_ptr<PCB_TEXT> headStyle = std::make_unique<PCB_TEXT>(
footprint );
212 headStyle->SetItalic(
false );
213 headStyle->SetTextPos(
VECTOR2I( 0, 0 ) );
214 headStyle->SetText(
_(
"Layer" ) );
219 std::unique_ptr<PCB_TEXT> dataStyle = std::make_unique<PCB_TEXT>(
footprint );
223 dataStyle->SetItalic(
false );
224 dataStyle->SetTextPos(
VECTOR2I( 0, 0 ) );
225 dataStyle->SetText(
_(
"Layer" ) );
234 std::vector<BOARD_STACKUP_ITEM*> layers = stackup.
GetList();
236 std::vector<PCB_TEXT*> colLayer;
237 std::vector<PCB_TEXT*> colType;
238 std::vector<PCB_TEXT*> colMaterial;
239 std::vector<PCB_TEXT*> colThickness;
240 std::vector<PCB_TEXT*> colColor;
241 std::vector<PCB_TEXT*> colEpsilon;
242 std::vector<PCB_TEXT*> colTanD;
245 t =
static_cast<PCB_TEXT*
>( headStyle->Duplicate() );
247 colLayer.push_back( t );
249 t =
static_cast<PCB_TEXT*
>( headStyle->Duplicate() );
251 colType.push_back( t );
253 t =
static_cast<PCB_TEXT*
>( headStyle->Duplicate() );
255 colMaterial.push_back( t );
257 t =
static_cast<PCB_TEXT*
>( headStyle->Duplicate() );
261 case EDA_UNITS::MILLIMETRES: t->
SetText(
_(
"Thickness (mm)" ) );
break;
262 case EDA_UNITS::INCHES: t->
SetText(
_(
"Thickness (inches)" ) );
break;
263 case EDA_UNITS::MILS: t->
SetText(
_(
"Thickness (mils)" ) );
break;
264 default: wxFAIL_MSG( wxT(
"Unhandled unit type" ) );
267 colThickness.push_back( t );
269 t =
static_cast<PCB_TEXT*
>( headStyle->Duplicate() );
271 colColor.push_back( t );
273 t =
static_cast<PCB_TEXT*
>( headStyle->Duplicate() );
275 colEpsilon.push_back( t );
277 t =
static_cast<PCB_TEXT*
>( headStyle->Duplicate() );
279 colTanD.push_back( t );
281 for(
int i = 0; i < stackup.
GetCount(); i++ )
285 for(
int sublayer_id = 0; sublayer_id < stackup_item->
GetSublayersCount(); sublayer_id++ )
287 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
301 ly_name =
_(
"Dielectric" );
310 colLayer.push_back( t );
312 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
314 colType.push_back( t );
316 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
318 colMaterial.push_back( t );
320 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
322 colThickness.push_back( t );
324 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
326 colColor.push_back( t );
328 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
330 stackup_item->
GetEpsilonR( sublayer_id ), false ) );
331 colEpsilon.push_back( t );
333 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
336 colTanD.push_back( t );
340 texts.push_back( colLayer );
341 texts.push_back( colType );
342 texts.push_back( colMaterial );
343 texts.push_back( colThickness );
344 texts.push_back( colColor );
345 texts.push_back( colEpsilon );
346 texts.push_back( colTanD );
347 std::vector<BOARD_ITEM*> table =
initTextTable( texts, aOrigin, aLayer, tableSize,
true );
354 commit.
Push(
_(
"Insert board stackup table" ) );
367 std::vector<BOARD_ITEM*> objects;
374 std::unique_ptr<PCB_TEXT> headStyle =
379 headStyle->SetItalic(
false );
380 headStyle->SetTextPos(
VECTOR2I( 0, 0 ) );
385 std::unique_ptr<PCB_TEXT> dataStyle =
390 dataStyle->SetItalic(
false );
391 dataStyle->SetTextPos(
VECTOR2I( 0, 0 ) );
397 t =
static_cast<PCB_TEXT*
>( headStyle->Duplicate() );
398 t->
SetText(
_(
"BOARD CHARACTERISTICS" ) );
400 objects.push_back( t );
405 std::vector<std::vector<PCB_TEXT*>> texts;
406 std::vector<PCB_TEXT*> colLabel1;
407 std::vector<PCB_TEXT*> colData1;
408 std::vector<PCB_TEXT*> colbreak;
409 std::vector<PCB_TEXT*> colLabel2;
410 std::vector<PCB_TEXT*> colData2;
412 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
413 t->
SetText(
_(
"Copper Layer Count: " ) );
414 colLabel1.push_back( t );
416 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
419 colData1.push_back( t );
424 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
425 t->
SetText(
_(
"Board overall dimensions: " ) );
426 colLabel1.push_back( t );
428 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
429 t->
SetText( wxString::Format( wxT(
"%s x %s" ),
432 colData1.push_back( t );
434 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
435 t->
SetText(
_(
"Min track/spacing: " ) );
436 colLabel1.push_back( t );
438 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
439 t->
SetText( wxString::Format( wxT(
"%s / %s" ),
442 colData1.push_back( t );
444 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
445 t->
SetText(
_(
"Copper Finish: " ) );
446 colLabel1.push_back( t );
448 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
450 colData1.push_back( t );
452 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
453 t->
SetText(
_(
"Castellated pads: " ) );
454 colLabel1.push_back( t );
456 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
458 colData1.push_back( t );
460 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
461 t->
SetText(
_(
"Board Thickness: " ) );
462 colLabel2.push_back( t );
464 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
466 colData2.push_back( t );
469 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
470 colLabel2.push_back( t );
471 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
472 colData2.push_back( t );
474 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
475 t->
SetText(
_(
"Min hole diameter: " ) );
476 colLabel2.push_back( t );
477 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
481 colData2.push_back( t );
483 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
484 t->
SetText(
_(
"Impedance Control: " ) );
485 colLabel2.push_back( t );
487 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
489 colData2.push_back( t );
491 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
492 t->
SetText(
_(
"Plated Board Edge: " ) );
493 colLabel2.push_back( t );
495 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
497 colData2.push_back( t );
499 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
500 t->
SetText(
_(
"Edge card connectors: " ) );
501 colLabel1.push_back( t );
503 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
510 colData1.push_back( t );
512 texts.push_back( colLabel1 );
513 texts.push_back( colData1 );
514 texts.push_back( colbreak );
515 texts.push_back( colLabel2 );
516 texts.push_back( colData2 );
523 objects.push_back( item );
530 commit.
Push( wxT(
"Board Characteristics" ) );
533 tableSize->
x = tableSize2.
x;
534 tableSize->
y = cursorPos.
y + tableSize2.
y
542 std::vector<BOARD_ITEM*>& aItems,
543 std::vector<BOARD_ITEM*>& aPreview,
549 bool cancelled =
false;
576 item->Move( cursorPosition - previousCursorPosition );
585 if( evt->IsCancelInteractive() )
591 else if( evt->IsMotion() )
596 item->Move( cursorPosition - previousCursorPosition );
600 previousCursorPosition = cursorPosition;
602 else if( evt->IsActivate() )
604 if( evt->IsMoveTool() )
623 if( aLayers !=
nullptr )
631 if( destLayer == PCB_LAYER_ID::UNDEFINED_LAYER )
642 static_cast<PCB_GROUP*
>( item )->SetLayerRecursive( destLayer, 200 );
650 item->Move( cursorPosition );
654 commit.
Push( wxT(
"Placing items" ) );
687 layerSet = layerSet.reset(
F_Fab ).reset(
B_Fab );
691 if( ( layerSet &
LSET( layer ) ).count() )
696 std::vector<BOARD_ITEM*> preview;
697 std::vector<BOARD_ITEM*> items;
711 line3->
SetEnd( tableSize );
714 line4->
SetEnd( tableSize );
721 preview.push_back( line1 );
722 preview.push_back( line2 );
723 preview.push_back( line3 );
724 preview.push_back( line4 );
727 group->SetName(
"group-boardCharacteristics");
729 for(
auto item : table )
749 layerSet = layerSet.reset(
F_Fab ).reset(
B_Fab );
754 if( ( layerSet &
LSET( layer ) ).count() )
763 std::vector<BOARD_ITEM*> preview;
764 std::vector<BOARD_ITEM*> items;
778 line3->
SetEnd( tableSize );
781 line4->
SetEnd( tableSize );
788 preview.push_back( line1 );
789 preview.push_back( line2 );
790 preview.push_back( line3 );
791 preview.push_back( line4 );
794 group->SetName(
"group-boardStackUp" );
797 group->AddItem( item );
constexpr EDA_IU_SCALE pcbIUScale
constexpr EDA_IU_SCALE unityScale
@ BS_EDGE_CONNECTOR_BEVELLED
@ BS_EDGE_CONNECTOR_IN_USE
@ BS_ITEM_TYPE_DIELECTRIC
virtual void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Revert the commit by restoring the modified items state.
Container for design settings for a BOARD object.
int GetBoardThickness() const
The full thickness of the board including copper and masks.
BOARD_STACKUP & GetStackupDescriptor()
int GetCopperLayerCount() const
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Manage one layer needed to make a physical board.
wxString GetTypeName() const
int GetSublayersCount() const
double GetEpsilonR(int aDielectricSubLayer=0) const
wxString GetColor(int aDielectricSubLayer=0) const
wxString GetLayerName() const
PCB_LAYER_ID GetBrdLayerId() const
int GetThickness(int aDielectricSubLayer=0) const
BOARD_STACKUP_ITEM_TYPE GetType() const
wxString GetMaterial(int aDielectricSubLayer=0) const
double GetLossTangent(int aDielectricSubLayer=0) const
Manage layers needed to make a physical board.
bool m_CastellatedPads
True if castellated pads exist.
const std::vector< BOARD_STACKUP_ITEM * > & GetList() const
bool SynchronizeWithBoard(BOARD_DESIGN_SETTINGS *aSettings)
Synchronize the BOARD_STACKUP_ITEM* list with the board.
bool m_HasDielectricConstrains
True if some layers have impedance controlled tracks or have specific constrains for micro-wave appli...
bool m_EdgePlating
True if the edge board is plated.
BS_EDGE_CONNECTOR_CONSTRAINTS m_EdgeConnectorConstraints
If the board has edge connector cards, some constrains can be specified in job file: BS_EDGE_CONNECTO...
wxString m_FinishType
The name of external copper finish.
bool GetBoardPolygonOutlines(SHAPE_POLY_SET &aOutlines, OUTLINE_ERROR_HANDLER *aErrorHandler=nullptr, bool aAllowUseArcsInPolygons=false)
Extract the board outlines and build a closed polygon from lines, arcs and circle items on edge cut l...
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
coord_type GetHeight() const
coord_type GetWidth() const
COMMIT & Add(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Notify observers that aItem has been added.
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
void SetCurrentCursor(KICURSOR aCursor)
Set the current cursor shape for this panel.
void SetStart(const VECTOR2I &aStart)
void SetEnd(const VECTOR2I &aEnd)
virtual void SetText(const wxString &aText)
virtual void ShowCursor(bool aEnabled)
Enable or disables display of cursor.
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
void ShowPreview(bool aShow=true)
void AddToPreview(VIEW_ITEM *aItem, bool aTakeOwnership=true)
LSET is a set of PCB_LAYER_IDs.
static LSET AllTechMask()
Return a mask holding all technical layers (no CU layer) on both side.
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
static TOOL_ACTION selectionClear
Clear the current selection.
PCB_LAYER_ID SelectOneLayer(PCB_LAYER_ID aDefaultLayer, LSET aNotAllowedLayersMask=LSET(), wxPoint aDlgPosition=wxDefaultPosition)
Show the dialog box for a layer selection.
virtual PCB_LAYER_ID GetActiveLayer() const
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Returns the BOARD_DESIGN_SETTINGS for the open project.
virtual BOARD_ITEM_CONTAINER * GetModel() const =0
virtual void SetActiveLayer(PCB_LAYER_ID aLayer)
A set of BOARD_ITEMs (i.e., without duplicates).
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
virtual void SetPosition(const VECTOR2I &aPos) override
RAII class that sets an value at construction and resets it to the original value at destruction.
Represent a set of closed polygons.
const BOX2I BBox(int aClearance=0) const override
Compute a bounding box of the shape, with a margin of aClearance a collision.
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
A lower-precision version of StringFromValue().
EDA_UNITS GetUserUnits() const
wxString StringFromValue(double aValue, bool aAddUnitLabel=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
Converts aValue in internal units into a united string.
PCB_LAYER_ID
A quick note on layer IDs:
bool IsValidLayer(int aLayerId)
Test whether a given integer is a valid layer index, i.e.
KICOMMON_API double FromUserUnit(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnit, double aValue)
Return in internal units the value aValue given in a real unit such as "in", "mm",...
KICOMMON_API wxString StringFromValue(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, double aValue, bool aAddUnitsText=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Returns the string from aValue according to aUnits (inch, mm ...) for display.
Class to handle a set of BOARD_ITEMs.
constexpr int mmToIU(double mm) const
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs