View Issue Details

IDProjectCategoryView StatusLast Update
0002026DraftBugpublic2015-03-27 00:53
Reportermangtronix Assigned Toyorik  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionno change required 
Fixed in Version0.16 
Summary0002026: Exception trying to export Rectangle to DXF
DescriptionCannot export a Rectangle from Draft workbench to DXF. This was working for me in FreeCAD 0.14 3703)

Version is 0.15.4666 with DXF lib version 1.38 (details in Additional Information)
Steps To ReproduceConsole log and report view is below.

1. Open FreeCAD
2. File->New
3. Draft workbench
4. Create rectangle
5. File->Export
6. Autodesk DXF format
7. Save as "test.dxf"
8. Console shows error (below), file is created but with 0 bytes

Expected: test.dxf created containing the rectangle


Python 2.7.9 (default, Mar 21 2015, 09:14:52)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type 'help', 'copyright', 'credits' or 'license' for more information.
>>> App.newDocument("Unnamed")
>>> App.setActiveDocument("Unnamed")
>>> App.ActiveDocument=App.getDocument("Unnamed")
>>> Gui.ActiveDocument=Gui.getDocument("Unnamed")
>>> Gui.activateWorkbench("DraftWorkbench")
>>> import Draft
>>> pl = FreeCAD.Placement()
>>> pl.Rotation.Q = (0.0,-0.0,-0.0,1.0)
>>> pl.Base = FreeCAD.Vector(0.0,0.0,0.0)
>>> Draft.makeRectangle(length=3.0,height=1.0,placement=pl,face=False,support=None)
>>> __objs__=[]
>>> __objs__.append(FreeCAD.getDocument("Unnamed").getObject("Rectangle"))
>>> import importDXF
>>> importDXF.export(__objs__,u"/Users/mangtronix/Dropbox/Projects/3D Print/Models/Phage/Rectangle.dxf")
>>>
>>> del __objs__
>>> print importDXF.CURRENTDXFLIB
1.38


Report View:
Draft workbench activated
Pick first point:
Pick opposite point:
DXF libraries need to be updated. Trying to download...
downloading https://raw.githubusercontent.com/yorikvanhavre/Draft-dxf-importer/1.38/dxfColorMap.py ...
downloading https://raw.githubusercontent.com/yorikvanhavre/Draft-dxf-importer/1.38/dxfImportObjects.py ...
downloading https://raw.githubusercontent.com/yorikvanhavre/Draft-dxf-importer/1.38/dxfLibrary.py ...
downloading https://raw.githubusercontent.com/yorikvanhavre/Draft-dxf-importer/1.38/dxfReader.py ...
processing Rectangle
Traceback (most recent call last):
  File "<string>", line 4, in <module>
  File "/Applications/FreeCAD 0.15.4666.app/Contents/Mod/Draft/importDXF.py", line 1819, in export
    dxf.saveas(filename)
  File "/Users/mangtronix/Dropbox/Projects/3D Print/FreeCAD/Macros/dxfLibrary.py", line 877, in saveas
    tables=[self._table('vport',[str(x) for x in self.vports]),
  File "/Users/mangtronix/Dropbox/Projects/3D Print/FreeCAD/Macros/dxfLibrary.py", line 881, in save
    self._table('view',[str(x) for x in self.views]),
  File "/Users/mangtronix/Dropbox/Projects/3D Print/FreeCAD/Macros/dxfLibrary.py", line 870, in __str__
    return ' 0\nTABLE\n 2\n%s\n 70\n%s\n%s 0\nENDTAB\n'%(name.upper(),len(x),xstr)
  File "/Users/mangtronix/Dropbox/Projects/3D Print/FreeCAD/Macros/dxfLibrary.py", line 391, in __str__
    result+=' 75\n%s\n' %self.pflag75
  File "/Users/mangtronix/Dropbox/Projects/3D Print/FreeCAD/Macros/dxfLibrary.py", line 105, in _point
    #print 'deb: _point=', x #-------------
<type 'exceptions.TypeError'>: float() argument must be a string or a number
Additional InformationOS: Mac OS X
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.15.4666 (Git)
Branch: releases/FreeCAD-0-15
Hash: be823acda289b9354226b3229d98ca0ac9352267
Python version: 2.7.9
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
TagsNo tags attached.
FreeCAD Information

Activities

mangtronix

2015-03-26 16:33

reporter  

Rectangle.FCStd (2,900 bytes)

mangtronix

2015-03-26 16:40

reporter   ~0005943

Currently working around it by downgrading rectangles before export.

yorik

2015-03-27 00:28

administrator   ~0005944

Last edited: 2015-03-27 00:28

I cannot reproduce the problem, your rectangle exports fine for me here...

The error message you are getting is weird, I think you might be experiencing the problem described here http://python-notes.curiousefficiency.org/en/latest/python_concepts/import_traps.html (stale bytecode file trap).

Could you try removing all files beginning with dxf from /Users/mangtronix/Dropbox/Projects/3D Print/FreeCAD/Macros/, both .py and pyc files?

mangtronix

2015-03-27 00:39

reporter   ~0005945

Last edited: 2015-03-27 00:40

OK, that was exactly it! I wonder if the fact I'm using Dropbox for that directory has something to do with the problem. Thanks for the quick response!

yorik

2015-03-27 00:53

administrator   ~0005946

Probably the .py files were upgraded automatically, but the .pyc files stayed from an older version...
Glad you could solve it!

Issue History

Date Modified Username Field Change
2015-03-26 16:33 mangtronix New Issue
2015-03-26 16:33 mangtronix File Added: Rectangle.FCStd
2015-03-26 16:40 mangtronix Note Added: 0005943
2015-03-27 00:28 yorik Note Added: 0005944
2015-03-27 00:28 yorik Note Edited: 0005944
2015-03-27 00:39 mangtronix Note Added: 0005945
2015-03-27 00:40 mangtronix Note Edited: 0005945
2015-03-27 00:53 yorik Note Added: 0005946
2015-03-27 00:53 yorik Status new => closed
2015-03-27 00:53 yorik Assigned To => yorik
2015-03-27 00:53 yorik Resolution open => no change required
2015-03-27 00:53 yorik Fixed in Version => 0.16