CADSTAR PCB: Parse Teardrops

Todo: We need to figure out how we will load teardrops. For now
just drop them on import.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/12349

(cherry picked from commit 21b3753e9b)
Edited to remove string changes
This commit is contained in:
Roberto Fernandez Bautista 2022-09-03 22:03:23 +02:00
parent 5afeb45a84
commit 9a823ca61b
4 changed files with 49 additions and 9 deletions

View File

@ -2444,6 +2444,16 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadNetTracks( const NET_ID& aCadstarNe
shape->SetLocked( v.Fixed ); shape->SetLocked( v.Fixed );
shapes.push_back( shape ); shapes.push_back( shape );
prevEnd = v.Vertex.End; prevEnd = v.Vertex.End;
/* No string changes in 6.0
if( !m_doneTearDropWarning && ( v.TeardropAtEnd || v.TeardropAtStart ) )
{
// TODO: load teardrops
wxLogError( _( "The CADSTAR design contains teardrops. This importer does not yet "
"support them, so the teardrops in the design have been ignored." ) );
m_doneTearDropWarning = true;
}*/
} }
NETINFO_ITEM* net = getKiCadNet( aCadstarNetID ); NETINFO_ITEM* net = getKiCadNet( aCadstarNetID );

View File

@ -54,6 +54,7 @@ public:
m_doneCopperWarning = false; m_doneCopperWarning = false;
m_doneSpacingClassWarning = false; m_doneSpacingClassWarning = false;
m_doneNetClassWarning = false; m_doneNetClassWarning = false;
m_doneTearDropWarning = false;
m_numNets = 0; m_numNets = 0;
m_numCopperLayers = 0 ; m_numCopperLayers = 0 ;
m_progressReporter = aProgressReporter; m_progressReporter = aProgressReporter;
@ -134,6 +135,7 @@ private:
///< multiple duplicate warnings ///< multiple duplicate warnings
bool m_doneNetClassWarning; ///< Used by getKiCadNet() to avoid bool m_doneNetClassWarning; ///< Used by getKiCadNet() to avoid
///< multiple duplicate warnings ///< multiple duplicate warnings
bool m_doneTearDropWarning;
int m_numNets; ///< Number of nets loaded so far int m_numNets; ///< Number of nets loaded so far
int m_numCopperLayers; ///< Number of layers in the design int m_numCopperLayers; ///< Number of layers in the design

View File

@ -2027,20 +2027,42 @@ XNODE* CADSTAR_PCB_ARCHIVE_PARSER::NET_PCB::ROUTE_VERTEX::Parse( XNODE* aNode,
wxASSERT( aNode->GetName() == wxT( "ROUTEWIDTH" ) ); wxASSERT( aNode->GetName() == wxT( "ROUTEWIDTH" ) );
RouteWidth = GetXmlAttributeIDLong( aNode, 0 ); RouteWidth = GetXmlAttributeIDLong( aNode, 0 );
XNODE* prevNode = aNode;
XNODE* nextNode = aNode->GetNext(); XNODE* nextNode = aNode->GetNext();
if( nextNode->GetName() == wxT( "FIX" ) ) for( ; nextNode; nextNode = nextNode->GetNext() )
{ {
Fixed = true; if( nextNode->GetName() == wxT( "FIX" ) )
nextNode = nextNode->GetNext(); {
Fixed = true;
}
else if( nextNode->GetName() == wxT( "TDROPATSTART" ) )
{
TeardropAtStart = true;
TeardropAtStartAngle = GetXmlAttributeIDLong( nextNode, 0 );
}
else if( nextNode->GetName() == wxT( "TDROPATEND" ) )
{
TeardropAtEnd = true;
TeardropAtEndAngle = GetXmlAttributeIDLong( nextNode, 0 );
}
else if( VERTEX::IsVertex( nextNode ) )
{
Vertex.Parse( nextNode, aContext );
}
else if( nextNode->GetName() == wxT( "ROUTEWIDTH" ) )
{
return prevNode;
}
else
{
THROW_UNKNOWN_NODE_IO_ERROR( nextNode->GetName(), wxT( "ROUTE" ) );
}
prevNode = nextNode;
} }
if( !VERTEX::IsVertex( nextNode ) ) return prevNode;
THROW_UNKNOWN_NODE_IO_ERROR( nextNode->GetName(), wxT( "ROUTE_VERTEX" ) );
Vertex.Parse( nextNode, aContext );
return nextNode;
} }
@ -2068,6 +2090,8 @@ void CADSTAR_PCB_ARCHIVE_PARSER::NET_PCB::ROUTE::Parse( XNODE* aNode, PARSER_CON
ROUTE_VERTEX rtVert; ROUTE_VERTEX rtVert;
cNode = rtVert.Parse( cNode, aContext ); cNode = rtVert.Parse( cNode, aContext );
RouteVertices.push_back( rtVert ); RouteVertices.push_back( rtVert );
assert( cNode != nullptr );
} }
else else
{ {

View File

@ -983,6 +983,10 @@ public:
///< next node being a VERTEX (e.g. PT, CWARC, etc.) ///< next node being a VERTEX (e.g. PT, CWARC, etc.)
{ {
long RouteWidth; long RouteWidth;
bool TeardropAtStart = false;
bool TeardropAtEnd = false;
long TeardropAtStartAngle = 0;
long TeardropAtEndAngle = 0;
bool Fixed = false; bool Fixed = false;
VERTEX Vertex; VERTEX Vertex;