View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0003035 | FreeCAD | Bug | public | 2017-05-17 15:25 | 2017-07-05 17:04 |
Reporter | toshiaki shingu | Assigned To | keithsloan52 | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | 0.16 | ||||
Fixed in Version | 0.17 | ||||
Summary | 0003035: exportDXF won't export LWPOLYLINE correctly | ||||
Description | the last line of below should decrement indent level. dxfLibrary.py v1.39 - 2015.09.12 class LwPolyLine(_Entity): def __init__(self,points,org_point=[0,0],flag=0,width=None,**common): #width = number, or width = list [width_start=None, width_end=None] #for 2d-polyline: points = [ [x, y, z, width_start=None, width_end=None, bulge=0 or None], ...] _Entity.__init__(self,**common) self.points=points self.org_point=org_point self.flag=flag self.width= None # dummy value def __str__(self): result= ' 0\nLWPOLYLINE\n%s ' %(self._common()) result+=' 8\n%s\n' %self.layer result+='100\nAcDbPolyline\n' result+=' 90\n%s\n' % len(self.points) result+=' 70\n%s\n' %(self.flag) result+='%s\n' %_point(self.org_point) if self.width!=None: result+=' 40\n%s\n 41\n%s\n' %(self.width[0],self.width[1]) for point in self.points: result+='%s\n' %_point(point[0:2]) if len(point)>4: width1, width2 = point[3], point[4] if width1!=None: result+=' 40\n%s\n' %width1 if width2!=None: result+=' 41\n%s\n' %width2 if len(point)==6: bulge = point[5] if bulge: result+=' 42\n%s\n' %bulge return result | ||||
Tags | DXF | ||||
FreeCAD Information | |||||
related to | 0002267 | closed | keithsloan52 | File formats | failure to open/import CSG |
|
Please ask on the forum since the dev version is way ahead of 0.16 Also always post your Help > About FreeCAD > Copy to clipboard whenever you ask for help. |
|
This has to do with @Yorik legacy python dxf importer. See here: https://github.com/yorikvanhavre/Draft-dxf-importer/blob/master/dxfLibrary.py#L430-L459 |
|
I don't understand what is the issue here? As far as I can see the code block above only has the last line changed? Why is it so? We want to return a result even if the point has no bulge value... |
|
@toshiaki shingu Can you provide a file that fails with the existing code and succeeds with the indent reduced? |
|
Attached polyline.dxf is a rectanglar exported by importDXF.export(object, file, lwPoly=false). lwpolyline1.dxf is exported by importDXF.export(object, file, lwPoly=True). lwpolylin2.dxf is exported by importDXF.export(object, file, lwPoly=True) with patched dxfLibrary.py. Best wishes, dxfLibrary.py.patch (671 bytes)
*** dxfLibrary.py.orig Sun May 28 10:37:13 2017 --- dxfLibrary.py Sun May 28 11:17:42 2017 *************** *** 443,449 **** result+='100\nAcDbPolyline\n' result+=' 90\n%s\n' % len(self.points) result+=' 70\n%s\n' %(self.flag) - result+='%s\n' %_point(self.org_point) if self.width!=None: result+=' 40\n%s\n 41\n%s\n' %(self.width[0],self.width[1]) for point in self.points: --- 443,448 ---- *************** *** 456,462 **** bulge = point[5] if bulge: result+=' 42\n%s\n' %bulge ! return result --- 455,461 ---- bulge = point[5] if bulge: result+=' 42\n%s\n' %bulge ! return result |
|
@sgrogan1 looks like OP replied |
|
If somebody is looking to fix this problem maybe they could also look at 0002267 which I suspect is similar. Least it involves incorrect DXF file with lwpolyline |
|
Linked 0002267 to this ticket |
|
I had only noticed before, the indent change in the second part of the patch. I didn't notice the line deletion in the first part of the patch. I won't have time to test until the weekend, no promises there either. Definitely 0002267 looks related. Anyway @yorik will need to look at this. If the patch is accepted it needs to be applied on his dxf branch. Then it will propagate to the FreeCAD-addons repo. Tracker Admin edit: FTFY ;) FYI To ref another ticket just prefix ticket number with: # |
|
I corrected the dxf library and made a Pull request see https://github.com/yorikvanhavre/Draft-dxf-importer @yorik @sgrogan1 Have tested for issue 0002267 which also suffers from the same bug. With the corrected code I can now import the plate csg file okay. The intermediate DXF file is now correct |
|
@yorik & @sgrogan1 can you test Keith's PR to confirm the fix? |
|
Keith's PR is merged. Seems to work fine! |
|
@yorik great! Is it merged in to master? When it is please reference the commits to this ticket 0003035 and to 0002267 and close said ticket. Thanks! |
|
Not sure it needs to be merged into Master the library is dynamically loaded by FreeCAD. i.e The fact that the library is fixed should be enough. |
|
Dynamically loaded from an upstream source? |
|
Dynamically loaded by FreeCAD |
|
Marking as fixed. FYI Users need to set the preference for FreeCAD to load the dxf library to pick up latest version. Thanks Keith! |
|
Closing |
Date Modified | Username | Field | Change |
---|---|---|---|
2017-05-17 15:25 | toshiaki shingu | New Issue | |
2017-05-17 15:41 | Kunda1 | Note Added: 0009042 | |
2017-05-17 16:03 |
|
Note Added: 0009043 | |
2017-05-17 16:23 |
|
Note Edited: 0009043 | |
2017-05-25 13:56 | yorik | Note Added: 0009133 | |
2017-05-25 15:28 | Kunda1 | Status | new => feedback |
2017-05-25 22:20 |
|
Note Added: 0009142 | |
2017-05-25 22:21 |
|
Note Edited: 0009142 | |
2017-05-25 22:22 |
|
Note Edited: 0009142 | |
2017-05-29 14:34 | toshiaki shingu | File Added: dxfLibrary.py.patch | |
2017-05-29 14:34 | toshiaki shingu | File Added: polyline.dxf | |
2017-05-29 14:34 | toshiaki shingu | File Added: lwpolyline1.dxf | |
2017-05-29 14:34 | toshiaki shingu | File Added: lwpolyline2.dxf | |
2017-05-29 14:34 | toshiaki shingu | Note Added: 0009186 | |
2017-05-29 14:34 | toshiaki shingu | Status | feedback => new |
2017-06-15 12:18 | Kunda1 | Note Added: 0009381 | |
2017-06-15 12:19 | Kunda1 | Tag Attached: DXF | |
2017-06-15 15:39 | keithsloan52 | Note Added: 0009387 | |
2017-06-15 16:25 | Kunda1 | Note Edited: 0009387 | |
2017-06-15 16:26 | Kunda1 | Relationship added | related to 0002267 |
2017-06-15 16:28 | Kunda1 | Note Added: 0009388 | |
2017-06-15 21:01 |
|
Note Added: 0009392 | |
2017-06-15 21:03 |
|
Note Edited: 0009392 | |
2017-06-15 21:04 |
|
Note Edited: 0009392 | |
2017-06-15 21:06 |
|
Note Edited: 0009392 | |
2017-06-15 21:07 |
|
Note Edited: 0009392 | |
2017-06-15 21:09 |
|
Note Edited: 0009392 | |
2017-06-15 21:10 |
|
Note Edited: 0009392 | |
2017-06-15 21:10 |
|
Note Edited: 0009392 | |
2017-06-15 21:32 | Kunda1 | Note Edited: 0009392 | |
2017-06-21 15:07 | keithsloan52 | Note Added: 0009484 | |
2017-06-21 15:09 | keithsloan52 | Note Edited: 0009484 | |
2017-06-21 15:09 | keithsloan52 | Note Edited: 0009484 | |
2017-06-25 15:49 | Kunda1 | Note Added: 0009527 | |
2017-06-26 14:06 | yorik | Note Added: 0009542 | |
2017-06-26 15:40 | Kunda1 | Note Added: 0009546 | |
2017-06-26 17:09 | keithsloan52 | Note Added: 0009548 | |
2017-06-26 19:14 | Kunda1 | Note Added: 0009550 | |
2017-06-26 20:25 | keithsloan52 | Note Added: 0009551 | |
2017-06-26 21:40 | Kunda1 | Assigned To | => keithsloan52 |
2017-06-26 21:40 | Kunda1 | Status | new => resolved |
2017-06-26 21:40 | Kunda1 | Resolution | open => fixed |
2017-06-26 21:40 | Kunda1 | Fixed in Version | => 0.17 |
2017-06-26 21:40 | Kunda1 | Note Added: 0009552 | |
2017-07-05 17:04 | Kunda1 | Note Added: 0009671 | |
2017-07-05 17:04 | Kunda1 | Status | resolved => closed |