63 std::unique_ptr<ARRAY_OPTIONS> array_opts;
67 int ret = dialog.ShowModal();
69 if( ret != wxID_OK || array_opts ==
nullptr )
76 std::vector<EDA_ITEM*> all_added_items;
79 for(
int ptN = 0; ptN < array_opts->GetArraySize(); ptN++ )
90 item = static_cast<FOOTPRINT*>( item )->
GetParent();
111 switch( item->
Type() )
129 this_item = static_cast<PCB_GROUP*>( item )->DeepDuplicate();
142 items_for_this_block.
Add( this_item );
152 static_cast<PCB_GROUP*>( this_item )->RunOnDescendants(
161 static_cast<FOOTPRINT*>( this_item )->RunOnChildren(
168 commit.
Add( this_item );
175 commit.
Modify( this_item );
182 if( this_item && array_opts->ShouldNumberItems() )
187 PAD&
pad = static_cast<PAD&>( *this_item );
189 if(
pad.CanHaveNumber() )
192 pad.SetNumber( newNumber );
204 for(
EDA_ITEM* item : items_for_this_block )
205 all_added_items.push_back( item );
211 commit.
Push(
_(
"Create an array" ) );
static TOOL_ACTION selectItems
Select a list of items (specified as the event parameter)
static TOOL_ACTION selectionClear
Clear the current selection.
COMMIT & Modify(EDA_ITEM *aItem)
Create an undo entry for an item that has been already modified.
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
virtual VECTOR2I GetCenter() const
Returns the center point of the selection area bounding box.
class PCB_DIM_LEADER, a leader dimension (graphic item)
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
virtual void Add(EDA_ITEM *aItem)
class PCB_GROUP, a set of BOARD_ITEMs
virtual void Rotate(const wxPoint &aRotCentre, double aAngle)
Rotate this object.
COMMIT & Add(EDA_ITEM *aItem)
Notify observers that aItem has been added.
class PCB_DIM_CENTER, a center point marking (graphic item)
PCB_BASE_FRAME & m_parent
class PCB_TEXT, text on a layer
class PCB_ARC, an arc track segment on a copper layer
class PAD, a pad in a footprint
virtual wxPoint GetPosition() const
class PCB_TRACK, a track segment (segment on a copper layer)
Options that govern the setup of an "array" of multiple item.
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
virtual void Move(const wxPoint &aMoveVector)
Move this object.
Simple class that sequentially provides numbers from an ARRAY_OPTIONS object, making sure that they d...
class ZONE, a copper pour area
static void TransformItem(const ARRAY_OPTIONS &aArrOpts, int aIndex, BOARD_ITEM &aItem)
Transform a BOARD_ITEM from the given ARRAY_OPTIONS and an index into the array.
class PCB_TARGET, a target (graphic item)
class FOOTPRINT, a footprint
virtual TRANSFORM GetTransform(int aN, const VECTOR2I &aPos) const =0
Get the transform of the n-th point in the array.
wxString GetNextPadNumber()
Get the next available pad name.
int Size() const
Returns the number of selected parts.
A base class for most all the KiCad significant classes used in schematics and boards.
virtual void Push(const wxString &aMessage=wxT("A commit"), bool aCreateUndoEntry=true, bool aSetDirtyBit=true) override
Revert the commit by restoring the modified items state.
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
class PCB_VIA, a via (like a track segment on a copper layer)
const PCB_SELECTION m_selection
BOARD_ITEM_CONTAINER * GetParent() const
class PCB_SHAPE, a segment not on copper layers
virtual BOARD_ITEM * Duplicate() const
Create a copy of this BOARD_ITEM.
KICAD_T Type() const
Returns the type of object.