Splines bug: DXF open - ID: 3393986

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Splines bug: DXF open - ID: 3393986

Rallaz
This post is about this bug:
https://sourceforge.net/tracker/?func=detail&aid=3393986&group_id=342582&atid=1433844
The attached file ACCEL1C11.dxf have 75 splines and only splines
The image splines2009-10.png is a screenshot of ACCEL1C11.dxf opened in ACAD (autoCAD) 2009 & 2010, is very similar to LibreCAD but not equal


The image splines2012.png is a screenshot of ACCEL1C11.dxf opened in ACAD 2012, I opened the file with CorelDraw (version 12 I think) and the result is the same as in ACAD 2012


The image splines2010-partial.png is a ACAD2010 zoom on the parts that differ with ACAD2010 & LibreCAD


The file ACCEL12to00.dxf is the original dxf opened with ACAD2012 & saved as dxf v2000
Seems that the 2012 version performs some checks on the splines and correct it, like:
if (startPoint == endPoint) spline.isClosed
else spline.isOpen
Reply | Threaded
Open this post in threaded view
|

Re: Splines bug: DXF open - ID: 3393986

Rallaz
It seems I've forgotten to attach the file

ACCEL12to00.dxf (368K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Splines bug: DXF open - ID: 3393986

dxli
Wrong Spline "Closed" flag,
Wrong "Closed" Flag

Closed flag filtered
Closed flag filtered

diff --git a/dxflib/src/dl_dxf.cpp b/dxflib/src/dl_dxf.cpp
index 9933ad0..f04c416 100644
--- a/dxflib/src/dl_dxf.cpp
+++ b/dxflib/src/dl_dxf.cpp
@@ -928,6 +928,8 @@ void DL_Dxf::addSpline(DL_CreationInterface* creationInterface) {
                      toInt(values[70], 4));
     /*DL_SplineData sd(toInt(values[71], 3), toInt(values[72], 0),
                      toInt(values[73], 0), toInt(values[70], 4));*/
+    std::cout<<"Spline flags= "<<sd.flags<<std::endl;
+    if( sd.flags == 11 ) sd.flags = 8;
     creationInterface->addSpline(sd);
 
     int i;
Reply | Threaded
Open this post in threaded view
|

Re: Splines bug: DXF open - ID: 3393986

Rallaz
Dxli,
Sorry for taking so long to answer

I tested with this patch
+  if( sd.flags == 1 ) sd.flags = 8; // possible typo 11 != 1
and it works well.

I made some more test:
test1:
In librecad draw splines one closed & other open
save as test1.dxf
open with librecad with this patch works
open with autocad2012 all splines are open

test2:
in autocad2012 draw a closed spline using the method "control vertex"
draw another spline using the method "fit points"
save as test2.dxf
open with librecad: works well
open with an text editor the code 70 are "2059" & "3339"

I do not understand :-(

Another think about ACCEL1C11.dxf:
from DXF reference "code 210 = Normal vector (omitted if the spline is nonplanar)"

In ACCEL1C11.dxf is present so the flag "8 = Planar" should be placed