46static std::vector<BOARD_ITEM*>
initTextTable( std::vector<std::vector<PCB_TEXT*>> aContent,
48 VECTOR2I* aTableSize,
bool aDrawFrame =
true )
53 int nbCols = aContent.size();
56 for(
const std::vector<PCB_TEXT*>& col : aContent )
57 nbRows = std::max( nbRows,
static_cast<int>( col.size() ) );
60 nbCols = std::min( nbCols, 99 );
61 nbRows = std::min( nbRows, 99 );
66 std::vector<BOARD_ITEM*> table;
85 for( i = 0; i < nbRows; i++ )
88 for( i = 0; i < nbCols; i++ )
94 for(
const std::vector<PCB_TEXT*>& col : aContent )
106 int height = cell->GetBoundingBox().GetHeight() + 2 * ymargin;
107 int width = cell->GetBoundingBox().GetWidth() + 2 * xmargin;
108 rowHeight[j] = rowHeight[j] > height ? rowHeight[j] : height;
109 colWidth[i] = colWidth[i] > width ? colWidth[i] : width;
117 int height = std::accumulate( rowHeight, rowHeight + nbRows, 0 );
118 int width = std::accumulate( colWidth, colWidth + nbCols, 0 );
120 aTableSize->
x = width;
121 aTableSize->
y = height;
129 for( i = 0; i < nbRows; i++ )
136 table.push_back( line );
143 table.push_back( line );
146 for( i = 0; i < nbCols; i++ )
153 table.push_back( line );
160 table.push_back( line );
165 VECTOR2I pos( origin.
x + xmargin, origin.
y + ymargin );
167 for( std::vector<PCB_TEXT*>& col : aContent )
174 pos.
y = origin.
y + ymargin;
181 cell->SetTextPos( pos );
182 cell->SetLayer( aLayer );
183 pos.
y = pos.
y + rowHeight[j];
184 table.push_back( cell );
188 pos.
x = pos.
x + colWidth[i];
204 std::vector<std::vector<PCB_TEXT*>> texts;
207 std::unique_ptr<PCB_TEXT> headStyle = std::make_unique<PCB_TEXT>(
footprint );
211 headStyle->SetItalic(
false );
212 headStyle->SetTextPos(
VECTOR2I( 0, 0 ) );
213 headStyle->SetText(
_(
"Layer" ) );
218 std::unique_ptr<PCB_TEXT> dataStyle = std::make_unique<PCB_TEXT>(
footprint );
222 dataStyle->SetItalic(
false );
223 dataStyle->SetTextPos(
VECTOR2I( 0, 0 ) );
224 dataStyle->SetText(
_(
"Layer" ) );
233 std::vector<BOARD_STACKUP_ITEM*> layers = stackup.
GetList();
235 std::vector<PCB_TEXT*> colLayer;
236 std::vector<PCB_TEXT*> colType;
237 std::vector<PCB_TEXT*> colMaterial;
238 std::vector<PCB_TEXT*> colThickness;
239 std::vector<PCB_TEXT*> colColor;
240 std::vector<PCB_TEXT*> colEpsilon;
241 std::vector<PCB_TEXT*> colTanD;
244 t =
static_cast<PCB_TEXT*
>( headStyle->Duplicate() );
246 colLayer.push_back( t );
248 t =
static_cast<PCB_TEXT*
>( headStyle->Duplicate() );
250 colType.push_back( t );
252 t =
static_cast<PCB_TEXT*
>( headStyle->Duplicate() );
254 colMaterial.push_back( t );
256 t =
static_cast<PCB_TEXT*
>( headStyle->Duplicate() );
263 default: wxFAIL_MSG( wxT(
"Unhandled unit type" ) );
266 colThickness.push_back( t );
268 t =
static_cast<PCB_TEXT*
>( headStyle->Duplicate() );
270 colColor.push_back( t );
272 t =
static_cast<PCB_TEXT*
>( headStyle->Duplicate() );
274 colEpsilon.push_back( t );
276 t =
static_cast<PCB_TEXT*
>( headStyle->Duplicate() );
278 colTanD.push_back( t );
280 for(
int i = 0; i < stackup.
GetCount(); i++ )
284 for(
int sublayer_id = 0; sublayer_id < stackup_item->
GetSublayersCount(); sublayer_id++ )
286 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
300 ly_name =
_(
"Dielectric" );
309 colLayer.push_back( t );
311 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
313 colType.push_back( t );
315 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
317 colMaterial.push_back( t );
319 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
321 colThickness.push_back( t );
323 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
325 colColor.push_back( t );
327 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
329 stackup_item->
GetEpsilonR( sublayer_id ), false ) );
330 colEpsilon.push_back( t );
332 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
335 colTanD.push_back( t );
339 texts.push_back( colLayer );
340 texts.push_back( colType );
341 texts.push_back( colMaterial );
342 texts.push_back( colThickness );
343 texts.push_back( colColor );
344 texts.push_back( colEpsilon );
345 texts.push_back( colTanD );
346 std::vector<BOARD_ITEM*> table =
initTextTable( texts, aOrigin, aLayer, tableSize,
true );
353 commit.
Push(
_(
"Insert board stackup table" ) );
366 std::vector<BOARD_ITEM*> objects;
373 std::unique_ptr<PCB_TEXT> headStyle =
378 headStyle->SetItalic(
false );
379 headStyle->SetTextPos(
VECTOR2I( 0, 0 ) );
384 std::unique_ptr<PCB_TEXT> dataStyle =
389 dataStyle->SetItalic(
false );
390 dataStyle->SetTextPos(
VECTOR2I( 0, 0 ) );
396 t =
static_cast<PCB_TEXT*
>( headStyle->Duplicate() );
397 t->
SetText(
_(
"BOARD CHARACTERISTICS" ) );
399 objects.push_back( t );
404 std::vector<std::vector<PCB_TEXT*>> texts;
405 std::vector<PCB_TEXT*> colLabel1;
406 std::vector<PCB_TEXT*> colData1;
407 std::vector<PCB_TEXT*> colbreak;
408 std::vector<PCB_TEXT*> colLabel2;
409 std::vector<PCB_TEXT*> colData2;
411 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
412 t->
SetText(
_(
"Copper Layer Count: " ) );
413 colLabel1.push_back( t );
415 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
418 colData1.push_back( t );
423 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
424 t->
SetText(
_(
"Board overall dimensions: " ) );
425 colLabel1.push_back( t );
427 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
431 colData1.push_back( t );
433 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
434 t->
SetText(
_(
"Min track/spacing: " ) );
435 colLabel1.push_back( t );
437 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
441 colData1.push_back( t );
443 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
444 t->
SetText(
_(
"Copper Finish: " ) );
445 colLabel1.push_back( t );
447 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
449 colData1.push_back( t );
451 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
452 t->
SetText(
_(
"Castellated pads: " ) );
453 colLabel1.push_back( t );
455 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
457 colData1.push_back( t );
459 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
460 t->
SetText(
_(
"Board Thickness: " ) );
461 colLabel2.push_back( t );
463 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
465 colData2.push_back( t );
468 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
469 colLabel2.push_back( t );
470 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
471 colData2.push_back( t );
473 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
474 t->
SetText(
_(
"Min hole diameter: " ) );
475 colLabel2.push_back( t );
476 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
480 colData2.push_back( t );
482 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
483 t->
SetText(
_(
"Impedance Control: " ) );
484 colLabel2.push_back( t );
486 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
488 colData2.push_back( t );
490 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
491 t->
SetText(
_(
"Plated Board Edge: " ) );
492 colLabel2.push_back( t );
494 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
496 colData2.push_back( t );
498 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
499 t->
SetText(
_(
"Edge card connectors: " ) );
500 colLabel1.push_back( t );
502 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
509 colData1.push_back( t );
511 texts.push_back( colLabel1 );
512 texts.push_back( colData1 );
513 texts.push_back( colbreak );
514 texts.push_back( colLabel2 );
515 texts.push_back( colData2 );
522 objects.push_back( item );
529 commit.
Push( wxT(
"Board Characteristics" ) );
532 tableSize->
x = tableSize2.
x;
533 tableSize->
y = cursorPos.
y + tableSize2.
y
541 std::vector<BOARD_ITEM*>& aItems,
542 std::vector<BOARD_ITEM*>& aPreview,
548 bool cancelled =
false;
575 item->Move( cursorPosition - previousCursorPosition );
584 if( evt->IsCancelInteractive() )
590 else if( evt->IsMotion() )
595 item->Move( cursorPosition - previousCursorPosition );
599 previousCursorPosition = cursorPosition;
601 else if( evt->IsActivate() )
603 if( evt->IsMoveTool() )
622 if( aLayers !=
nullptr )
625 *aLayers, wxGetMousePosition() );
640 static_cast<PCB_GROUP*
>( item )->SetLayerRecursive( destLayer, 200 );
648 item->Move( cursorPosition );
656 commit.
Push( wxT(
"Placing items" ) );
689 layerSet = layerSet.reset(
F_Fab ).reset(
B_Fab );
693 if( ( layerSet &
LSET( layer ) ).count() )
698 std::vector<BOARD_ITEM*> preview;
699 std::vector<BOARD_ITEM*> items;
713 line3->
SetEnd( tableSize );
716 line4->
SetEnd( tableSize );
723 preview.push_back( line1 );
724 preview.push_back( line2 );
725 preview.push_back( line3 );
726 preview.push_back( line4 );
729 group->SetName(
"group-boardCharacteristics");
731 for(
auto item : table )
751 layerSet = layerSet.reset(
F_Fab ).reset(
B_Fab );
756 if( ( layerSet &
LSET( layer ) ).count() )
765 std::vector<BOARD_ITEM*> preview;
766 std::vector<BOARD_ITEM*> items;
780 line3->
SetEnd( tableSize );
783 line4->
SetEnd( tableSize );
790 preview.push_back( line1 );
791 preview.push_back( line2 );
792 preview.push_back( line3 );
793 preview.push_back( line4 );
796 group->SetName(
"group-boardStackUp" );
799 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=wxT("A commit"), 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...
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
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)
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)
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(EDA_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 AddChildrenToCommit(BOARD_COMMIT &aCommit)
Add all the immediate children of this group to the board commit.
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 StringFromValue(double aValue, bool aAddUnitLabel=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Converts aValue in internal units into a united string.
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
A lower-precision version of StringFromValue().
EDA_UNITS GetUserUnits() const
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.
double FromUserUnit(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnit, double aValue)
Return in internal units the value "val" given in a real unit such as "in", "mm" or "deg".
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.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
constexpr int mmToIU(double mm) const
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs