Restore removed data

Functions and definitions used in Python scripting should not be
removed.  Comments in header files should never be removed (only
updated/corrected)
This commit is contained in:
Seth Hillbrand 2022-08-20 08:40:08 -07:00
parent 28876bef90
commit af34835fdf
5 changed files with 184 additions and 0 deletions

View File

@ -321,6 +321,29 @@ void BOARD::Move( const VECTOR2I& aMoveVector ) // overload
Visit( inspector, nullptr, GENERAL_COLLECTOR::BoardLevelItems );
}
TRACKS BOARD::TracksInNet( int aNetCode )
{
TRACKS ret;
INSPECTOR_FUNC inspector = [aNetCode, &ret]( EDA_ITEM* item, void* testData )
{
PCB_TRACK* t = static_cast<PCB_TRACK*>( item );
if( t->GetNetCode() == aNetCode )
ret.push_back( t );
return INSPECT_RESULT::CONTINUE;
};
// visit this BOARD's PCB_TRACKs and PCB_VIAs with above TRACK INSPECTOR which
// appends all in aNetCode to ret.
Visit( inspector, nullptr, GENERAL_COLLECTOR::Tracks );
return ret;
}
bool BOARD::SetLayerDescr( PCB_LAYER_ID aIndex, const LAYER& aLayer )
{
if( unsigned( aIndex ) < arrayDim( m_layers ) )

View File

@ -1010,6 +1010,15 @@ public:
*/
std::tuple<int, double, double> GetTrackLength( const PCB_TRACK& aTrack ) const;
/**
* Collect all the TRACKs and VIAs that are members of a net given by aNetCode.
* Used from python.
*
* @param aNetCode gives the id of the net.
* @return list of track which are in the net identified by @a aNetCode.
*/
TRACKS TracksInNet( int aNetCode );
/**
* Get a footprint by its bounding rectangle at \a aPosition on \a aLayer.
*

View File

@ -83,6 +83,19 @@ const std::initializer_list<KICAD_T> GENERAL_COLLECTOR::BoardLevelItems = {
};
const std::initializer_list<KICAD_T> GENERAL_COLLECTOR::Footprints = {
PCB_FOOTPRINT_T
};
const std::initializer_list<KICAD_T> GENERAL_COLLECTOR::PadsOrTracks = {
PCB_PAD_T,
PCB_VIA_T,
PCB_TRACE_T,
PCB_ARC_T
};
const std::initializer_list<KICAD_T> GENERAL_COLLECTOR::FootprintItems = {
PCB_MARKER_T,
PCB_FP_TEXT_T,
@ -97,6 +110,42 @@ const std::initializer_list<KICAD_T> GENERAL_COLLECTOR::FootprintItems = {
PCB_FP_ZONE_T,
PCB_GROUP_T,
PCB_BITMAP_T
};
const std::initializer_list<KICAD_T> GENERAL_COLLECTOR::Tracks = {
PCB_TRACE_T,
PCB_ARC_T,
PCB_VIA_T
};
const std::initializer_list<KICAD_T> GENERAL_COLLECTOR::LockableItems = {
PCB_FOOTPRINT_T,
PCB_GROUP_T, // Can a group be locked?
PCB_TRACE_T,
PCB_ARC_T,
PCB_VIA_T
};
const std::initializer_list<KICAD_T> GENERAL_COLLECTOR::Zones = {
PCB_ZONE_T,
PCB_FP_ZONE_T
};
const std::initializer_list<KICAD_T> GENERAL_COLLECTOR::Dimensions = {
PCB_DIM_ALIGNED_T,
PCB_DIM_LEADER_T,
PCB_DIM_ORTHOGONAL_T,
PCB_DIM_CENTER_T,
PCB_DIM_RADIAL_T,
PCB_FP_DIM_ALIGNED_T,
PCB_FP_DIM_LEADER_T,
PCB_FP_DIM_ORTHOGONAL_T,
PCB_FP_DIM_CENTER_T,
PCB_FP_DIM_RADIAL_T
};

View File

@ -54,8 +54,19 @@ class COLLECTORS_GUIDE
public:
virtual ~COLLECTORS_GUIDE() {}
/**
* @return true if the given layer is visible, else false.
*/
virtual bool IsLayerVisible( PCB_LAYER_ID layer ) const = 0;
/**
* @return the preferred layer for HitTest()ing.
*/
virtual PCB_LAYER_ID GetPreferredLayer() const = 0;
/**
* @return true if should ignore locked items, else false.
*/
virtual bool IgnoreLockedItems() const = 0;
/**
@ -70,26 +81,82 @@ public:
*/
virtual bool IgnoreHiddenFPText() const = 0;
/**
* @return true if should ignore footprint text on back layers
*/
virtual bool IgnoreFPTextOnBack() const = 0;
/**
* @return true if should ignore footprint text on front layers.
*/
virtual bool IgnoreFPTextOnFront() const = 0;
/**
* @return true if should ignore FOOTPRINTs on Back Side.
*/
virtual bool IgnoreFootprintsOnBack() const = 0;
/**
* @return true if should ignore FOOTPRINTs on Front Side.
*/
virtual bool IgnoreFootprintsOnFront() const = 0;
/**
* @return true if should ignore Pads on Back Side.
*/
virtual bool IgnorePadsOnBack() const = 0;
/**
* @return true if should ignore PADSs on Front Side.
*/
virtual bool IgnorePadsOnFront() const = 0;
/**
* @return true if should ignore through-hole PADSs.
*/
virtual bool IgnoreThroughHolePads() const = 0;
/**
* @return true if should ignore PADSs on Front side and Back side.
*/
virtual bool IgnorePads() const
{
return IgnorePadsOnFront() && IgnorePadsOnBack() && IgnoreThroughHolePads();
}
/**
* @return true if should ignore footprint values.
*/
virtual bool IgnoreFPValues() const = 0;
/**
* @return true if should ignore footprint references.
*/
virtual bool IgnoreFPReferences() const = 0;
/**
* @return true if should ignore through-hole vias
*/
virtual bool IgnoreThroughVias() const = 0;
/**
* @return true if should ignore blind/buried vias
*/
virtual bool IgnoreBlindBuriedVias() const = 0;
/**
* @return true if should ignore micro vias
*/
virtual bool IgnoreMicroVias() const = 0;
/**
* @return true if should ignore tracks
*/
virtual bool IgnoreTracks() const = 0;
/**
* @return true if should ignore the interiors of zones
*/
virtual bool IgnoreZoneFills() const = 0;
virtual double OnePixelInIU() const = 0;
@ -156,17 +223,47 @@ public:
*/
static const std::initializer_list<KICAD_T> AllBoardItems;
/**
* A scan list for zones outlines only
*/
static const std::initializer_list<KICAD_T> Zones;
/**
* A scan list for all primary board items, omitting items which are subordinate to
* a FOOTPRINT, such as PAD and FP_TEXT.
*/
static const std::initializer_list<KICAD_T> BoardLevelItems;
/**
* A scan list for only FOOTPRINTs
*/
static const std::initializer_list<KICAD_T> Footprints;
/**
* A scan list for PADs, TRACKs, or VIAs
*/
static const std::initializer_list<KICAD_T> PadsOrTracks;
/**
* A scan list for primary footprint items.
*/
static const std::initializer_list<KICAD_T> FootprintItems;
/**
* A scan list for only TRACKs and ARCs
*/
static const std::initializer_list<KICAD_T> Tracks;
/**
* A scan list for TRACKs, VIAs, FOOTPRINTs
*/
static const std::initializer_list<KICAD_T> LockableItems;
/**
* A scan list for dimensions
*/
static const std::initializer_list<KICAD_T> Dimensions;
/**
* A scan list for items that can be dragged
*/

View File

@ -143,6 +143,12 @@ HANDLE_EXCEPTIONS(BOARD::TracksInNetBetweenPoints)
except:
self.this = this
# Convert these to lists to keep users from using them to delete
# items in the iterable while looping over it
def GetFootprints(self): return list(self.Footprints())
def GetDrawings(self): return list(self.Drawings())
def GetTracks(self): return list(self.Tracks())
def Save(self,filename):
return SaveBoard(filename,self)