Ensure consistent use of mm within SG models and that SG models write VRML files using 0.1 inch units
This commit is contained in:
parent
9aeaf4a71b
commit
ef62a5f153
|
@ -223,10 +223,14 @@ bool SGCOORDS::WriteVRML( std::ofstream& aFile, bool aReuseFlag )
|
||||||
std::string tmp;
|
std::string tmp;
|
||||||
size_t n = coords.size();
|
size_t n = coords.size();
|
||||||
bool nline = false;
|
bool nline = false;
|
||||||
|
SGPOINT pt;
|
||||||
|
|
||||||
for( size_t i = 0; i < n; )
|
for( size_t i = 0; i < n; )
|
||||||
{
|
{
|
||||||
S3D::FormatPoint( tmp, coords[i] );
|
pt = coords[i];
|
||||||
|
// ensure VRML output has 1U = 0.1 inch as per legacy kicad expectations
|
||||||
|
pt.x /= 2.54;
|
||||||
|
S3D::FormatPoint( tmp, pt );
|
||||||
aFile << tmp ;
|
aFile << tmp ;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
|
|
|
@ -163,6 +163,19 @@ bool WRL1COORDS::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// assuming legacy kicad expectation of 1U = 0.1 inch,
|
||||||
|
// convert to mm to meet the expectations of the SG structure
|
||||||
|
std::vector< WRLVEC3F >::iterator sP = points.begin();
|
||||||
|
std::vector< WRLVEC3F >::iterator eP = points.end();
|
||||||
|
|
||||||
|
while( sP != eP )
|
||||||
|
{
|
||||||
|
sP->x *= 2.54;
|
||||||
|
sP->y *= 2.54;
|
||||||
|
sP->z *= 2.54;
|
||||||
|
++sP;
|
||||||
|
}
|
||||||
|
|
||||||
if( proc.Peek() == '}' )
|
if( proc.Peek() == '}' )
|
||||||
{
|
{
|
||||||
proc.Pop();
|
proc.Pop();
|
||||||
|
|
|
@ -173,6 +173,19 @@ bool WRL2COORDS::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// assuming legacy kicad expectation of 1U = 0.1 inch,
|
||||||
|
// convert to mm to meet the expectations of the SG structure
|
||||||
|
std::vector< WRLVEC3F >::iterator sP = points.begin();
|
||||||
|
std::vector< WRLVEC3F >::iterator eP = points.end();
|
||||||
|
|
||||||
|
while( sP != eP )
|
||||||
|
{
|
||||||
|
sP->x *= 2.54;
|
||||||
|
sP->y *= 2.54;
|
||||||
|
sP->z *= 2.54;
|
||||||
|
++sP;
|
||||||
|
}
|
||||||
|
|
||||||
if( proc.Peek() == '}' )
|
if( proc.Peek() == '}' )
|
||||||
{
|
{
|
||||||
proc.Pop();
|
proc.Pop();
|
||||||
|
|
Loading…
Reference in New Issue