Loading eeschema/class_netlist_object.cpp +6 −4 Original line number Diff line number Diff line Loading @@ -347,12 +347,14 @@ wxString NETLIST_OBJECT::GetShortNetName() const if( m_netNameCandidate->m_Type == NET_PIN ) { if( m_Link ) SCH_COMPONENT* link = (SCH_COMPONENT*)m_netNameCandidate->m_Link; if( link ) // Should be always true { netName = wxT("Net-<"); netName << ( (SCH_COMPONENT*) m_Link )->GetRef( &m_SheetList ); netName << wxT("-Pad") << LIB_PIN::ReturnPinStringNum( m_PinNum ); netName << wxT(">"); netName << link->GetRef( &m_netNameCandidate->m_SheetList ); netName << wxT("-Pad") << LIB_PIN::ReturnPinStringNum( m_netNameCandidate->m_PinNum ) << wxT(">"); } } else Loading eeschema/class_netlist_object.h +6 −0 Original line number Diff line number Diff line Loading @@ -164,6 +164,12 @@ public: */ void SetNetNameCandidate( NETLIST_OBJECT* aCandidate ); /** * @return true if an item has already a net name candidate * and false if not ( m_netNameCandidate == NULL ) */ bool HasNetNameCandidate() { return m_netNameCandidate != NULL; } /** * Function GetPinNum * returns a pin number in wxString form. Pin numbers are not always Loading eeschema/netlist.cpp +41 −18 Original line number Diff line number Diff line Loading @@ -467,26 +467,40 @@ void NETLIST_OBJECT_LIST::findBestNetNameForEachNet() // (to avoid net names changes when the net is not modified, // even if components are moved or deleted and undelete or replaced, as long // the reference is kept) netcode = 0; // Build the list of items with no net names NETLIST_OBJECT_LIST list; for( unsigned ii = 0; ii < size(); ii++ ) { item = GetItem( ii ); if( !item->HasNetNameCandidate() ) list.push_back( item ); } if( list.size() == 0 ) return; idxstart = 0; candidate = NULL; item = NULL; for( unsigned ii = 0; ii <= size(); ii++ ) netcode = list.GetItemNet( 0 ); for( unsigned ii = 0; ii <= list.size(); ii++ ) { if( ii == size() ) // last item already found netcode = -2; else item = GetItem( ii ); if( ii < list.size() ) item = list.GetItem( ii ); if( netcode != item->GetNet() ) // End of net found if( netcode != item->GetNet() || ii >= list.size() ) // End of net found { if( candidate ) { for (unsigned jj = idxstart; jj < ii; jj++ ) GetItem( jj )->SetNetNameCandidate( candidate ); { NETLIST_OBJECT* obj = list.GetItem( jj ); obj->SetNetNameCandidate( candidate ); } } if( netcode == -2 ) if( ii >= list.size() ) break; netcode = item->GetNet(); Loading @@ -494,10 +508,18 @@ void NETLIST_OBJECT_LIST::findBestNetNameForEachNet() idxstart = ii; } if( item->m_Type == NET_PIN && item->GetShortNetName().IsEmpty() ) // Search all pins having no net name candidate yet, i.e. on nets // having no labels if( item->m_Type == NET_PIN ) { // A candidate is found: select the better between the previous // and this one // A candidate is found, however components which are not in // netlist are not candidate because some have their reference // is changed each time the netlist is built (power components) // and anyway they are not a good candidate SCH_COMPONENT* link = (SCH_COMPONENT*)item->m_Link; if( link->IsInNetlist() ) { // select the better between the previous and this one item->SetNetNameCandidate( item ); // Needed to calculate GetShortNetName if( candidate == NULL ) candidate = item; Loading @@ -509,6 +531,7 @@ void NETLIST_OBJECT_LIST::findBestNetNameForEachNet() } } } } /* Loading eeschema/sch_component.cpp +9 −0 Original line number Diff line number Diff line Loading @@ -1888,6 +1888,15 @@ bool SCH_COMPONENT::doIsConnected( const wxPoint& aPosition ) const return false; } /* return true if the component is in netlist * which means this is not a power component, or something * like a component reference starting by # */ bool SCH_COMPONENT::IsInNetlist() const { SCH_FIELD* rf = GetField( REFERENCE ); return ! rf->GetText().StartsWith("#"); } void SCH_COMPONENT::Plot( PLOTTER* aPlotter ) { Loading eeschema/sch_component.h +7 −0 Original line number Diff line number Diff line Loading @@ -365,6 +365,13 @@ public: bool IsConnectable() const { return true; } /** * @return true if the component is in netlist * which means this is not a power component, or something * like a component reference starting by # */ bool IsInNetlist() const; void GetConnectionPoints( vector< wxPoint >& aPoints ) const; SEARCH_RESULT Visit( INSPECTOR* inspector, const void* testData, Loading Loading
eeschema/class_netlist_object.cpp +6 −4 Original line number Diff line number Diff line Loading @@ -347,12 +347,14 @@ wxString NETLIST_OBJECT::GetShortNetName() const if( m_netNameCandidate->m_Type == NET_PIN ) { if( m_Link ) SCH_COMPONENT* link = (SCH_COMPONENT*)m_netNameCandidate->m_Link; if( link ) // Should be always true { netName = wxT("Net-<"); netName << ( (SCH_COMPONENT*) m_Link )->GetRef( &m_SheetList ); netName << wxT("-Pad") << LIB_PIN::ReturnPinStringNum( m_PinNum ); netName << wxT(">"); netName << link->GetRef( &m_netNameCandidate->m_SheetList ); netName << wxT("-Pad") << LIB_PIN::ReturnPinStringNum( m_netNameCandidate->m_PinNum ) << wxT(">"); } } else Loading
eeschema/class_netlist_object.h +6 −0 Original line number Diff line number Diff line Loading @@ -164,6 +164,12 @@ public: */ void SetNetNameCandidate( NETLIST_OBJECT* aCandidate ); /** * @return true if an item has already a net name candidate * and false if not ( m_netNameCandidate == NULL ) */ bool HasNetNameCandidate() { return m_netNameCandidate != NULL; } /** * Function GetPinNum * returns a pin number in wxString form. Pin numbers are not always Loading
eeschema/netlist.cpp +41 −18 Original line number Diff line number Diff line Loading @@ -467,26 +467,40 @@ void NETLIST_OBJECT_LIST::findBestNetNameForEachNet() // (to avoid net names changes when the net is not modified, // even if components are moved or deleted and undelete or replaced, as long // the reference is kept) netcode = 0; // Build the list of items with no net names NETLIST_OBJECT_LIST list; for( unsigned ii = 0; ii < size(); ii++ ) { item = GetItem( ii ); if( !item->HasNetNameCandidate() ) list.push_back( item ); } if( list.size() == 0 ) return; idxstart = 0; candidate = NULL; item = NULL; for( unsigned ii = 0; ii <= size(); ii++ ) netcode = list.GetItemNet( 0 ); for( unsigned ii = 0; ii <= list.size(); ii++ ) { if( ii == size() ) // last item already found netcode = -2; else item = GetItem( ii ); if( ii < list.size() ) item = list.GetItem( ii ); if( netcode != item->GetNet() ) // End of net found if( netcode != item->GetNet() || ii >= list.size() ) // End of net found { if( candidate ) { for (unsigned jj = idxstart; jj < ii; jj++ ) GetItem( jj )->SetNetNameCandidate( candidate ); { NETLIST_OBJECT* obj = list.GetItem( jj ); obj->SetNetNameCandidate( candidate ); } } if( netcode == -2 ) if( ii >= list.size() ) break; netcode = item->GetNet(); Loading @@ -494,10 +508,18 @@ void NETLIST_OBJECT_LIST::findBestNetNameForEachNet() idxstart = ii; } if( item->m_Type == NET_PIN && item->GetShortNetName().IsEmpty() ) // Search all pins having no net name candidate yet, i.e. on nets // having no labels if( item->m_Type == NET_PIN ) { // A candidate is found: select the better between the previous // and this one // A candidate is found, however components which are not in // netlist are not candidate because some have their reference // is changed each time the netlist is built (power components) // and anyway they are not a good candidate SCH_COMPONENT* link = (SCH_COMPONENT*)item->m_Link; if( link->IsInNetlist() ) { // select the better between the previous and this one item->SetNetNameCandidate( item ); // Needed to calculate GetShortNetName if( candidate == NULL ) candidate = item; Loading @@ -509,6 +531,7 @@ void NETLIST_OBJECT_LIST::findBestNetNameForEachNet() } } } } /* Loading
eeschema/sch_component.cpp +9 −0 Original line number Diff line number Diff line Loading @@ -1888,6 +1888,15 @@ bool SCH_COMPONENT::doIsConnected( const wxPoint& aPosition ) const return false; } /* return true if the component is in netlist * which means this is not a power component, or something * like a component reference starting by # */ bool SCH_COMPONENT::IsInNetlist() const { SCH_FIELD* rf = GetField( REFERENCE ); return ! rf->GetText().StartsWith("#"); } void SCH_COMPONENT::Plot( PLOTTER* aPlotter ) { Loading
eeschema/sch_component.h +7 −0 Original line number Diff line number Diff line Loading @@ -365,6 +365,13 @@ public: bool IsConnectable() const { return true; } /** * @return true if the component is in netlist * which means this is not a power component, or something * like a component reference starting by # */ bool IsInNetlist() const; void GetConnectionPoints( vector< wxPoint >& aPoints ) const; SEARCH_RESULT Visit( INSPECTOR* inspector, const void* testData, Loading