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
|
||||
* 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",
|
||||
Double2Str( bs3D->m_Offset.x ).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();
|
||||
bool ret = true;
|
||||
|
||||
/*
|
||||
* Version 4.x and prior used 'at' parameter,
|
||||
* which was specified in inches.
|
||||
*/
|
||||
if( name == "at" )
|
||||
{
|
||||
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" )
|
||||
{
|
||||
ret = Get3DCoordinate( child->GetChild( 1 ), m_scale );
|
||||
}
|
||||
else if( name == "rotate" )
|
||||
{
|
||||
ret = GetXYZRotation( child->GetChild( 1 ), m_rotation );
|
||||
}
|
||||
|
||||
if( !ret )
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue