Changed model offset in file to mm

- Written in mm
- Read as mm if newer than 20171114
- Read as inches if older than 20171114
- Added some documentation
This commit is contained in:
Oliver 2017-11-14 20:53:59 +11:00 committed by Wayne Stambaugh
parent b80449b069
commit 3e71ed2421
4 changed files with 23 additions and 4 deletions

View File

@ -95,9 +95,9 @@ class MODULE_3D_SETTINGS
double x, y, z;
};
VECTOR3D m_Scale;
VECTOR3D m_Rotation;
VECTOR3D m_Offset;
VECTOR3D m_Scale; ///< 3D model scaling factor (dimensionless)
VECTOR3D m_Rotation; ///< 3D model rotation (degrees)
VECTOR3D m_Offset; ///< 3D model offset (mm)
wxString m_Filename; ///< The 3D shape filename in 3D library
};

View File

@ -1140,6 +1140,7 @@ 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",
Double2Str( bs3D->m_Offset.x ).c_str(),
Double2Str( bs3D->m_Offset.y ).c_str(),

View File

@ -44,7 +44,8 @@ class NETINFO_MAPPING;
//#define SEXPR_BOARD_FILE_VERSION 20160815 // differential pair settings per net class
//#define SEXPR_BOARD_FILE_VERSION 20170123 // EDA_TEXT refactor, moved 'hide'
//#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 20170922 // Keepout zones can exist on multiple layers
#define SEXPR_BOARD_FILE_VERSION 20171114 // Save 3D model offset in mm, instead of inches
#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)

View File

@ -359,9 +359,26 @@ MODULE_3D_SETTINGS* PCB_PARSER::parse3DModel()
if( token != T_xyz )
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
*/
n3D->m_Offset.x = parseDouble( "x value" );
n3D->m_Offset.y = parseDouble( "y value" );
n3D->m_Offset.z = parseDouble( "z value" );
if(m_requiredVersion < 20171114UL)
{
n3D->m_Offset.x *= 25.4f;
n3D->m_Offset.y *= 25.4f;
n3D->m_Offset.z *= 25.4f;
}
NeedRIGHT();
break;