View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000482 | FreeCAD | Bug | public | 2011-11-11 15:36 | 2011-11-17 14:34 |
Reporter | cstrachan1 | Assigned To | yorik | ||
Priority | normal | Severity | trivial | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | 0.11 | ||||
Fixed in Version | 0.12 | ||||
Summary | 0000482: Exporting to DXF causes zero vector length exception | ||||
Description | To reproduce: Open attached file DXFTest Select Fusion object Select export from file menu enter a filename ending in .dxf exception occurs: colin@cs-sis-gcs-laptop:~/Downloads/free-cad$ bin/FreeCAD FreeCAD 0.12, Libs: 0.12R4851 © Juergen Riegel, Werner Mayer, Yorik van Havre 2001-2011 ##### #### ### #### # # # # # # # ## #### #### # # # # # #### # # # # # # # ##### # # # # #### #### # # # # # # # # # # # # # # ## ## ## # # #### #### ### # # #### ## ## ## processing Fusion Exception (Fri Nov 11 16:09:39 2011): Cannot normalize null vector Stack Trace: Traceback (most recent call last): File "<string>", line 4, in <module> File "/home/colin/Downloads/free-cad/Mod/Draft/importDXF.py", line 1135, in export block = getBlock(ob) File "/home/colin/Downloads/free-cad/Mod/Draft/importDXF.py", line 1037, in getBlock writeShape(obj,block) File "/home/colin/Downloads/free-cad/Mod/Draft/importDXF.py", line 1052, in writeShape dxfobject.append(dxfLibrary.PolyLine(getWire(wire,nospline), [0.0,0.0,0.0], File "/home/colin/Downloads/free-cad/Mod/Draft/importDXF.py", line 1002, in getWire mp = fcgeo.findMidpoint(edge) File "/home/colin/Downloads/free-cad/Mod/Draft/draftlibs/fcgeo.py", line 523, in findMidpoint perp.normalize() | ||||
Additional Information | Exporting a similar looking object from another file, DFXTest3 attached, does not create the exception. Both objects were created by cutting and pasting from other FreeCAD documents. Modifying the file Mod/Draft/importDXF.py to avoid the exception outputs a valid DXF file but with errors in the geometery. Both files display visually correct models in the modelling window. colin@cs-sis-gcs-laptop:~/Downloads/free-cad$ diff /home/colin/Downloads/free-cad/Mod/Draft/importDXF.py_orig /home/colin/Downloads/free-cad/Mod/Draft/importDXF.py_cs 1002,1015c1002,1016 < mp = fcgeo.findMidpoint(edge) < v2 = edge.Vertexes[-1].Point < c = edge.Curve.Center < angle = abs(fcvec.angle(v1.sub(c),v2.sub(c))) < # if (fcvec.angle(v2.sub(c)) < fcvec.angle(v1.sub(c))): < # angle = -angle < # polyline bulge -> negative makes the arc go clockwise < bul = math.tan(angle/4) < # the next bit of code is for finding the direction of the arc < # a negative cross product means the arc is clockwise < tang1 = edge.Curve.tangent(edge.ParameterRange[0]) < tang2 = edge.Curve.tangent(edge.ParameterRange[1]) < cross1 = Vector.cross(Vector(tang1[0][0],tang1[0][1],tang1[0][2]),Vector(tang2[0][0],tang2[0][1],tang2[0][2])) < if cross1[2] < 0: --- > if (edge.Vertexes[0].Point != edge.Vertexes[-1].Point) : > mp = fcgeo.findMidpoint(edge) > v2 = edge.Vertexes[-1].Point > c = edge.Curve.Center > angle = abs(fcvec.angle(v1.sub(c),v2.sub(c))) > # if (fcvec.angle(v2.sub(c)) < fcvec.angle(v1.sub(c))): > # angle = -angle > # polyline bulge -> negative makes the arc go clockwise > bul = math.tan(angle/4) > # the next bit of code is for finding the direction of the arc > # a negative cross product means the arc is clockwise > tang1 = edge.Curve.tangent(edge.ParameterRange[0]) > tang2 = edge.Curve.tangent(edge.ParameterRange[1]) > cross1 = Vector.cross(Vector(tang1[0][0],tang1[0][1],tang1[0][2]),Vector(tang2[0][0],tang2[0][1],tang2[0][2])) > if cross1[2] < 0: 1018c1019 < points.append((v1.x,v1.y,v1.z,None,None,bul)) --- > points.append((v1.x,v1.y,v1.z,None,None,bul)) | ||||
Tags | No tags attached. | ||||
FreeCAD Information | |||||
2011-11-11 15:36
|
|
2011-11-11 15:37
|
|
2011-11-11 15:37
|
|
2011-11-11 15:37
|
|
2011-11-11 15:39
|
|
|
Ubuntu 11.10 Linux, FreeCAD compiled from svn: updated and compiled 10th Nov 2011. |
|
fixed in r5145 |
Date Modified | Username | Field | Change |
---|---|---|---|
2011-11-11 15:36 | cstrachan1 | New Issue | |
2011-11-11 15:36 | cstrachan1 | File Added: DXFTest.fcstd | |
2011-11-11 15:37 | cstrachan1 | File Added: DXFTest3.fcstd | |
2011-11-11 15:37 | cstrachan1 | File Added: dxftest.png | |
2011-11-11 15:37 | cstrachan1 | File Added: dxftest3.png | |
2011-11-11 15:39 | cstrachan1 | File Added: VisualComparison.png | |
2011-11-11 15:40 | cstrachan1 | Note Added: 0001278 | |
2011-11-12 11:14 | wmayer | Status | new => assigned |
2011-11-12 11:14 | wmayer | Assigned To | => yorik |
2011-11-17 14:34 | yorik | Note Added: 0001303 | |
2011-11-17 14:34 | yorik | Status | assigned => closed |
2011-11-17 14:34 | yorik | Resolution | open => fixed |
2011-11-17 14:34 | yorik | Fixed in Version | => 0.12 |