CHANGE file format for 3D model offset
- Reverts behaviour of 3e71ed2421
- 3D model offset now explicitly written in mm, using "offset" tag
- Any read "at" tag is converted from inches to mm
- This will not break any 3D model offset when reading files
- It will however render files incompatible with old versions
This commit is contained in:
parent
76dbbfdf92
commit
cb97f68e35
|
@ -1140,8 +1140,10 @@ void PCB_IO::format( MODULE* aModule, int aNestLevel ) const
|
|||
m_out->Print( aNestLevel+1, "(model %s\n",
|
||||
m_out->Quotew( bs3D->m_Filename ).c_str() );
|
||||
|
||||
// Model offset is in mm
|
||||
m_out->Print( aNestLevel+2, "(at (xyz %s %s %s))\n",
|
||||
/* Write 3D model offset in mm
|
||||
* 4.0.x wrote "at" which was actually in inches
|
||||
*/
|
||||
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(),
|
||||
Double2Str( bs3D->m_Offset.z ).c_str() );
|
||||
|
|
|
@ -46,7 +46,8 @@ class NETINFO_MAPPING;
|
|||
//#define SEXPR_BOARD_FILE_VERSION 20170920 // long pad names and custom pad shape
|
||||
//#define SEXPR_BOARD_FILE_VERSION 20170922 // Keepout zones can exist on multiple layers
|
||||
//#define SEXPR_BOARD_FILE_VERSION 20171114 // Save 3D model offset in mm, instead of inches
|
||||
#define SEXPR_BOARD_FILE_VERSION 20171125 // Locked/unlocked TEXTE_MODULE
|
||||
//#define SEXPR_BOARD_FILE_VERSION 20171125 // Locked/unlocked TEXTE_MODULE
|
||||
#define SEXPR_BOARD_FILE_VERSION 20171130 // 3D model offset written using "offset" parameter
|
||||
|
||||
#define CTL_STD_LAYER_NAMES (1 << 0) ///< Use English Standard layer names
|
||||
#define CTL_OMIT_NETS (1 << 1) ///< Omit pads net names (useless in library)
|
||||
|
|
|
@ -360,25 +360,30 @@ MODULE_3D_SETTINGS* PCB_PARSER::parse3DModel()
|
|||
Expecting( T_xyz );
|
||||
|
||||
/* Note:
|
||||
* Prior to SEXPR_BOARD_FILE_VERSION 20171114,
|
||||
* 3D model offset was read and written in inches
|
||||
*
|
||||
* Now, the offset is explicitly written in mm.
|
||||
* If a board is read with an older version,
|
||||
* the offset is converted from inches to mm
|
||||
* Prior to KiCad v5, model offset was designated by "at",
|
||||
* and the units were in inches.
|
||||
* Now we use mm, but support reading of legacy files
|
||||
*/
|
||||
|
||||
n3D->m_Offset.x = parseDouble( "x value" ) * 25.4f;
|
||||
n3D->m_Offset.y = parseDouble( "y value" ) * 25.4f;
|
||||
n3D->m_Offset.z = parseDouble( "z value" ) * 25.4f;
|
||||
NeedRIGHT();
|
||||
break;
|
||||
|
||||
case T_offset:
|
||||
NeedLEFT();
|
||||
token = NextTok();
|
||||
|
||||
if( token != T_xyz )
|
||||
Expecting( T_xyz );
|
||||
|
||||
/*
|
||||
* 3D model offset is in mm
|
||||
*/
|
||||
n3D->m_Offset.x = parseDouble( "x value" );
|
||||
n3D->m_Offset.y = parseDouble( "y value" );
|
||||
n3D->m_Offset.z = parseDouble( "z value" );
|
||||
|
||||
if(m_requiredVersion < 20171114L)
|
||||
{
|
||||
n3D->m_Offset.x *= 25.4f;
|
||||
n3D->m_Offset.y *= 25.4f;
|
||||
n3D->m_Offset.z *= 25.4f;
|
||||
}
|
||||
|
||||
NeedRIGHT();
|
||||
break;
|
||||
|
||||
|
@ -409,7 +414,7 @@ MODULE_3D_SETTINGS* PCB_PARSER::parse3DModel()
|
|||
break;
|
||||
|
||||
default:
|
||||
Expecting( "at, scale, or rotate" );
|
||||
Expecting( "at, offset, scale, or rotate" );
|
||||
}
|
||||
|
||||
NeedRIGHT();
|
||||
|
|
Loading…
Reference in New Issue