Decode "offset" in STEP export tool
- Read "at" as inches - Read "offset" as mm
This commit is contained in:
parent
cb97f68e35
commit
76f5df8a43
|
@ -1142,7 +1142,9 @@ void PCB_IO::format( MODULE* aModule, int aNestLevel ) const
|
||||||
|
|
||||||
/* Write 3D model offset in mm
|
/* Write 3D model offset in mm
|
||||||
* 4.0.x wrote "at" which was actually in inches
|
* 4.0.x wrote "at" which was actually in inches
|
||||||
|
* 5.0.x onwards, 3D model offset is written using "offset"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
m_out->Print( aNestLevel+2, "(offset (xyz %s %s %s))\n",
|
m_out->Print( aNestLevel+2, "(offset (xyz %s %s %s))\n",
|
||||||
Double2Str( bs3D->m_Offset.x ).c_str(),
|
Double2Str( bs3D->m_Offset.x ).c_str(),
|
||||||
Double2Str( bs3D->m_Offset.y ).c_str(),
|
Double2Str( bs3D->m_Offset.y ).c_str(),
|
||||||
|
|
|
@ -80,12 +80,37 @@ bool KICADMODEL::Read( SEXPR::SEXPR* aEntry )
|
||||||
std::string name = child->GetChild( 0 )->GetSymbol();
|
std::string name = child->GetChild( 0 )->GetSymbol();
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Version 4.x and prior used 'at' parameter,
|
||||||
|
* which was specified in inches.
|
||||||
|
*/
|
||||||
if( name == "at" )
|
if( name == "at" )
|
||||||
|
{
|
||||||
ret = Get3DCoordinate( child->GetChild( 1 ), m_offset );
|
ret = Get3DCoordinate( child->GetChild( 1 ), m_offset );
|
||||||
|
|
||||||
|
if( ret )
|
||||||
|
{
|
||||||
|
m_offset.x *= 25.4f;
|
||||||
|
m_offset.y *= 25.4f;
|
||||||
|
m_offset.z *= 25.4f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* From 5.x onwards, 3D model is provided in 'offset',
|
||||||
|
* which is in millimetres
|
||||||
|
*/
|
||||||
|
else if( name == "offset" )
|
||||||
|
{
|
||||||
|
ret = Get3DCoordinate( child->GetChild( 1 ), m_offset );
|
||||||
|
}
|
||||||
else if( name == "scale" )
|
else if( name == "scale" )
|
||||||
|
{
|
||||||
ret = Get3DCoordinate( child->GetChild( 1 ), m_scale );
|
ret = Get3DCoordinate( child->GetChild( 1 ), m_scale );
|
||||||
|
}
|
||||||
else if( name == "rotate" )
|
else if( name == "rotate" )
|
||||||
|
{
|
||||||
ret = GetXYZRotation( child->GetChild( 1 ), m_rotation );
|
ret = GetXYZRotation( child->GetChild( 1 ), m_rotation );
|
||||||
|
}
|
||||||
|
|
||||||
if( !ret )
|
if( !ret )
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue