Altium schematic: case-insensitive search for subsheet files.
Also fixes open polylines on sheet. Also prevents adding polylines with less than 2 points. Fixes https://gitlab.com/kicad/code/kicad/-/issues/16829
This commit is contained in:
parent
f795c1168d
commit
7f29ac39d8
|
@ -463,6 +463,24 @@ void SCH_IO_ALTIUM::ParseAltiumSch( const wxString& aFileName )
|
||||||
// path as the parent sheet path.
|
// path as the parent sheet path.
|
||||||
wxFileName loadAltiumFileName( parentFileName.GetPath(), sheet->GetFileName() );
|
wxFileName loadAltiumFileName( parentFileName.GetPath(), sheet->GetFileName() );
|
||||||
|
|
||||||
|
if( !loadAltiumFileName.IsFileReadable() )
|
||||||
|
{
|
||||||
|
// Try case-insensitive search
|
||||||
|
wxArrayString files;
|
||||||
|
wxDir::GetAllFiles( parentFileName.GetPath(), &files, wxEmptyString, wxDIR_FILES | wxDIR_HIDDEN );
|
||||||
|
|
||||||
|
for( const wxString& candidate : files )
|
||||||
|
{
|
||||||
|
wxFileName candidateFname( candidate );
|
||||||
|
|
||||||
|
if( candidateFname.GetFullName().IsSameAs( sheet->GetFileName(), false ) )
|
||||||
|
{
|
||||||
|
loadAltiumFileName = candidateFname;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( loadAltiumFileName.GetFullName().IsEmpty() || !loadAltiumFileName.IsFileReadable() )
|
if( loadAltiumFileName.GetFullName().IsEmpty() || !loadAltiumFileName.IsFileReadable() )
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
@ -1708,21 +1726,28 @@ void SCH_IO_ALTIUM::ParsePolyline( const std::map<wxString, wxString>& aProperti
|
||||||
{
|
{
|
||||||
ASCH_POLYLINE elem( aProperties );
|
ASCH_POLYLINE elem( aProperties );
|
||||||
|
|
||||||
|
if( elem.Points.size() < 2 )
|
||||||
|
return;
|
||||||
|
|
||||||
if( aSymbol.empty() && ShouldPutItemOnSheet( elem.ownerindex ) )
|
if( aSymbol.empty() && ShouldPutItemOnSheet( elem.ownerindex ) )
|
||||||
{
|
{
|
||||||
SCH_SCREEN* screen = getCurrentScreen();
|
SCH_SCREEN* screen = getCurrentScreen();
|
||||||
wxCHECK( screen, /* void */ );
|
wxCHECK( screen, /* void */ );
|
||||||
|
|
||||||
SCH_SHAPE* poly = new SCH_SHAPE( SHAPE_T::POLY );
|
for( size_t i = 1; i < elem.Points.size(); i++ )
|
||||||
|
{
|
||||||
|
SCH_LINE* line = new SCH_LINE;
|
||||||
|
|
||||||
for( VECTOR2I& point : elem.Points )
|
line->SetStartPoint( elem.Points[i - 1] + m_sheetOffset );
|
||||||
poly->AddPoint( point + m_sheetOffset );
|
line->SetEndPoint( elem.Points[i] + m_sheetOffset );
|
||||||
|
|
||||||
poly->SetStroke( STROKE_PARAMS( elem.LineWidth, GetPlotDashType( elem.LineStyle ),
|
line->SetStroke( STROKE_PARAMS( elem.LineWidth, GetPlotDashType( elem.LineStyle ),
|
||||||
GetColorFromInt( elem.Color ) ) );
|
GetColorFromInt( elem.Color ) ) );
|
||||||
poly->SetFlags( IS_NEW );
|
|
||||||
|
|
||||||
screen->Append( poly );
|
line->SetFlags( IS_NEW );
|
||||||
|
|
||||||
|
screen->Append( line );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue