Draft: finished new DXF importer - fixes #2205

This commit is contained in:
Yorik van Havre
2016-01-04 18:01:34 -02:00
parent da83100728
commit 273131c088
3 changed files with 53 additions and 25 deletions

View File

@@ -806,19 +806,19 @@ bool CDxfRead::ReadText()
get_line();
ss.str(m_str); ss >> c[2]; c[2] = mm(c[2]); if(ss.fail()) return false;
break;
case 40:
case 40:
// text height
get_line();
ss.str(m_str); ss >> height; height = mm(height); if(ss.fail()) return false;
break;
case 1:
case 1:
// text
get_line();
DerefACI();
OnReadText(c, height * 25.4 / 72.0, m_str);
return(true);
case 62:
case 62:
// color index
get_line();
ss.str(m_str); ss >> m_aci; if(ss.fail()) return false;
@@ -1412,7 +1412,7 @@ bool CDxfRead::ReadDimension()
double s[3]; // startpoint
double e[3]; // endpoint
double p[3]; // dimpoint
double rot = 0.0; // rotation
double rot = -1.0; // rotation
while(!((*m_ifs).eof()))
{
@@ -1436,47 +1436,47 @@ bool CDxfRead::ReadDimension()
get_line();
strcpy(m_layer_name, m_str);
break;
case 12:
case 13:
// start x
get_line();
ss.str(m_str); ss >> s[0]; s[0] = mm(s[0]); if(ss.fail()) return false;
break;
case 22:
case 23:
// start y
get_line();
ss.str(m_str); ss >> s[1]; s[1] = mm(s[1]); if(ss.fail()) return false;
break;
case 32:
case 33:
// start z
get_line();
ss.str(m_str); ss >> s[2]; s[2] = mm(s[2]); if(ss.fail()) return false;
break;
case 13:
case 14:
// end x
get_line();
ss.str(m_str); ss >> e[0]; e[0] = mm(e[0]); if(ss.fail()) return false;
break;
case 23:
case 24:
// end y
get_line();
ss.str(m_str); ss >> e[1]; e[1] = mm(e[1]); if(ss.fail()) return false;
break;
case 33:
case 34:
// end z
get_line();
ss.str(m_str); ss >> e[2]; e[2] = mm(e[2]); if(ss.fail()) return false;
break;
case 14:
case 10:
// dimline x
get_line();
ss.str(m_str); ss >> p[0]; p[0] = mm(p[0]); if(ss.fail()) return false;
break;
case 24:
case 20:
// dimline y
get_line();
ss.str(m_str); ss >> p[1]; p[1] = mm(p[1]); if(ss.fail()) return false;
break;
case 34:
case 30:
// dimline z
get_line();
ss.str(m_str); ss >> p[2]; p[2] = mm(p[2]); if(ss.fail()) return false;
@@ -1713,6 +1713,14 @@ void CDxfRead::DoRead(const bool ignore_errors /* = false */ )
}
continue;
}
else if(!strcmp(m_str, "TEXT")){
if(!ReadText())
{
printf("CDxfRead::DoRead() Failed to read text\n");
return;
}
continue;
}
else if(!strcmp(m_str, "ELLIPSE")){
if(!ReadEllipse())
{
@@ -1761,6 +1769,14 @@ void CDxfRead::DoRead(const bool ignore_errors /* = false */ )
}
continue;
}
else if (!strcmp(m_str, "DIMENSION")) {
if(!ReadDimension())
{
printf("CDxfRead::DoRead() Failed to read Dimension\n");
return;
}
continue;
}
}
get_line();