Don't export hidden models to STEP.

Fixes https://gitlab.com/kicad/code/kicad/issues/5451
This commit is contained in:
Jeff Young 2020-09-03 22:59:03 +01:00
parent a4d23fff12
commit 904d186f6d
3 changed files with 53 additions and 39 deletions

View File

@ -2,6 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
* Copyright (C) 2016-2020 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -31,17 +32,16 @@
KICADMODEL::KICADMODEL() :
m_hide( false ),
m_scale( 1.0, 1.0, 1.0 ),
m_offset( 0.0, 0.0, 0.0 ),
m_rotation( 0.0, 0.0, 0.0 )
{
return;
}
KICADMODEL::~KICADMODEL()
{
return;
}
@ -61,9 +61,13 @@ bool KICADMODEL::Read( SEXPR::SEXPR* aEntry )
SEXPR::SEXPR* child = aEntry->GetChild( 1 );
if( child->IsSymbol() )
{
m_modelname = child->GetSymbol();
}
else if( child->IsString() )
{
m_modelname = child->GetString();
}
else
{
std::ostringstream ostr;
@ -76,9 +80,12 @@ bool KICADMODEL::Read( SEXPR::SEXPR* aEntry )
{
child = aEntry->GetChild( i );
if( !child->IsList() )
continue;
if( child->IsSymbol() && child->GetSymbol() == "hide" )
{
m_hide = true;
}
else if( child->IsList() )
{
std::string name = child->GetChild( 0 )->GetSymbol();
bool ret = true;
@ -117,6 +124,7 @@ bool KICADMODEL::Read( SEXPR::SEXPR* aEntry )
if( !ret )
return false;
}
}
return true;
}

View File

@ -38,8 +38,10 @@ public:
virtual ~KICADMODEL();
bool Read( SEXPR::SEXPR* aEntry );
bool Hide() const { return m_hide; }
std::string m_modelname;
bool m_hide;
TRIPLET m_scale;
TRIPLET m_offset;
TRIPLET m_rotation;

View File

@ -159,7 +159,11 @@ bool KICADMODULE::parseModel( SEXPR::SEXPR* data )
return false;
}
if( mp->Hide() )
delete mp;
else
m_models.push_back( mp );
return true;
}