Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible error in CDxfRead::DoRead: missing POLYLINE #435

Open
stefan006 opened this issue Feb 24, 2021 · 1 comment
Open

Possible error in CDxfRead::DoRead: missing POLYLINE #435

stefan006 opened this issue Feb 24, 2021 · 1 comment

Comments

@stefan006
Copy link

stefan006 commented Feb 24, 2021

There're two consecutive "0" lines in the DXF file. DoRead reads the first "0" and jumps into if(!strcmp(m_str, "0")), then reads the next line which is a "0" again. It jumps out of if(!strcmp(m_str, "0")) and reads the next line which is "POLYLINE". It doesn't do anything with POLYLINE because it is outside of if(!strcmp(m_str, "0"))

This is part of my example file. I'm not allowed to post the whole file. This file has two POLYLINE. SEQEND is the end of the previous POLYLINE.

0
SEQEND
5
1328E9
8
0
0
POLYLINE

@stefan006
Copy link
Author

This is how I fixed it. It works for the few files I have. I don't know whether it breaks anything because I don't know the DXF format very well.

diff --git a/Application/core/dxf/dxf.cpp b/Application/core/dxf/dxf.cpp
index 18a85d9084..0998cafd86 100644
--- a/Application/core/dxf/dxf.cpp
+++ b/Application/core/dxf/dxf.cpp
@@ -2612,10 +2612,13 @@ void CDxfRead::DoRead(const bool ignore_errors /* = false */ )
 	{
 		if(!strcmp(m_str, "0"))
 		{
 			m_thickness = 0.0;
 			get_line();
+                        while (!strcmp(m_str, "0"))
+                            get_line();
+
 			if (!strcmp( m_str, "SECTION" )){
 				if(!ReadSection())
 				{
 					wprintf(wxT("CDxfRead::DoRead() Failed to read block\n"));
 					return;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant