Skip to content

Commit

Permalink
Change C++ DXF import to ignore type 999 (comment) records
Browse files Browse the repository at this point in the history
  • Loading branch information
kpemartin authored and yorikvanhavre committed Nov 13, 2024
1 parent 8636c8c commit 4bc8cd6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
39 changes: 21 additions & 18 deletions src/Mod/Import/App/dxf/dxf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2357,26 +2357,29 @@ bool CDxfRead::get_next_record()
return m_not_eof;
}

if ((*m_ifs).eof()) {
m_not_eof = false;
return false;
}
do {
if ((*m_ifs).eof()) {
m_not_eof = false;
return false;
}

std::getline(*m_ifs, m_record_data);
++m_line;
int temp = 0;
if (!ParseValue<int>(this, &temp)) {
ImportError("CDxfRead::get_next_record() Failed to get integer record type from '%s'\n",
m_record_data);
return false;
}
m_record_type = (eDXFGroupCode_t)temp;
if ((*m_ifs).eof()) {
return false;
}
std::getline(*m_ifs, m_record_data);
++m_line;
int temp = 0;
if (!ParseValue<int>(this, &temp)) {
ImportError("CDxfRead::get_next_record() Failed to get integer record type from '%s'\n",
m_record_data);
return false;
}
m_record_type = (eDXFGroupCode_t)temp;
if ((*m_ifs).eof()) {
return false;
}

std::getline(*m_ifs, m_record_data);
++m_line;
} while (m_record_type == eComment);

std::getline(*m_ifs, m_record_data);
++m_line;
// Remove any carriage return at the end of m_str which may occur because of inconsistent
// handling of LF vs. CRLF line termination.
auto last = m_record_data.rbegin();
Expand Down
1 change: 1 addition & 0 deletions src/Mod/Import/App/dxf/dxf.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ enum eDXFGroupCode_t
eUCSXDirection = 111,
eUCSYDirection = 112,
eExtrusionDirection = 210,
eComment = 999,

// The following apply to points and directions in text DXF files to identify the three
// coordinates
Expand Down

0 comments on commit 4bc8cd6

Please sign in to comment.