View Issue Details

IDProjectCategoryView StatusLast Update
0001727DrawingBugpublic2017-07-11 20:07
Reportercharlyoleg Assigned Toyorik  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
PlatformlinuxOSubuntuOS Version14.04
Product Version0.14 
Summary0001727: API function Drawing.projectToDXF
DescriptionThe API function Drawing.projectToDXF error generates the error:
"Exception: Unknown C++ exception"
And the script stops on this error.

This is a regression compare to FreeCAD 0.13.
Steps To ReproduceRun the attached script.
This is a simple code that generates the bug.
Additional InformationThe attached script provides the following output:

FreeCAD 0.15, Libs: 0.15R3904 (Git)
Test case for the Drawing.projectToDXF() bug
Traceback (most recent call last):
  File "bug_drawing_projectToDXF_small.py", line 33, in <module>
    r_dxf = Drawing.projectToDXF(l_slice, vec_z_unit)
Exception: Unknown C++ exception
TagsDXF, OCC Bug, upstream

Relationships

duplicate of 0001697 closedyorik FreeCAD projection of edges fails 

Activities

charlyoleg

2014-09-01 20:05

reporter  

bug_drawing_projectToDXF_small2.py (932 bytes)   
#!/
# bug_drawing_projectToDXF.py

import sys

sys.path.append("/usr/lib/freecad/lib")
try:
  import FreeCAD
except:
  print("ERR080: Error, the FreeCAD library can not be imported by cnc25d!")
  sys.exit(2)

import Part
from FreeCAD import Base
import Drawing

print("Test case for the Drawing.projectToDXF() bug")

mybox1 = Part.makeBox(4,5,6, Base.Vector(0,0,0))

vec_z_unit = Base.Vector(0,0,1)
l_solid = mybox1.copy()
#
l_slice_list = mybox1.slice(vec_z_unit, 1)
l_slice = Part.makeCompound(l_slice_list)
r_dxf = Drawing.projectToDXF(l_slice, vec_z_unit)
fh_output = open(ai_output_file, 'w')
fh_output.write(r_dxf)
fh_output.close()


# log:
#
# FreeCAD 0.15, Libs: 0.15R3904 (Git)
# Test case for the Drawing.projectToDXF() bug
# Traceback (most recent call last):
#   File "bug_drawing_projectToDXF_small.py", line 34, in <module>
#     r_dxf = Drawing.projectToDXF(l_slice, vec_z_unit)
# Exception: Unknown C++ exception


yorik

2014-09-02 02:58

administrator   ~0005056

The problem is not the dxf projection itself (try projecting the mybox1 object in your script) but the fact that recent OpenCasCade versions seem unable to project shapes that don't contain faces anymore, like the shape you are trying to project.

This is a known OCC bug, we saw it appear many times already... I hope they fix it soon...

BTW, the projectToDxf function has changed, it doesn't produce a DXF header anymore (so you can add more than one shape to a dxf file). You now need to add a header yourself, but it's not much work:

dxfcode = "0\n0\nSECTION\n2\nENTITIES\n" + Drawing.projectToDXF(myshape,myvector) + "0\nENDSEC\n0\nEOF"

wmayer

2016-10-21 15:05

administrator   ~0007411

Projection works with:
OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.8758 (Git)
Build type: Release
Branch: master
Hash: 9c49a0bab1c2610e5435d2666de05f607e1727f6
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.0.0

Kunda1

2017-01-15 04:52

administrator   ~0007781

@wmayer shall we close ?

yorik

2017-02-03 12:44

administrator   ~0008190

Yes this is fixed in OCC now

Issue History

Date Modified Username Field Change
2014-09-01 20:05 charlyoleg New Issue
2014-09-01 20:05 charlyoleg File Added: bug_drawing_projectToDXF_small2.py
2014-09-01 21:24 shoogen Tag Attached: OCC Bug
2014-09-01 21:24 shoogen Tag Attached: DXF
2014-09-02 02:58 yorik Note Added: 0005056
2014-09-02 08:19 shoogen Relationship added duplicate of 0001697
2016-10-21 15:05 wmayer Note Added: 0007411
2017-01-15 04:52 Kunda1 Tag Attached: #tobeclosed
2017-01-15 04:52 Kunda1 Tag Attached: upstream
2017-01-15 04:52 Kunda1 Note Added: 0007781
2017-01-19 19:46 Kunda1 Tag Attached: #pending
2017-02-03 12:44 yorik Note Added: 0008190
2017-02-03 12:44 yorik Status new => closed
2017-02-03 12:44 yorik Assigned To => yorik
2017-02-03 12:44 yorik Resolution open => fixed
2017-07-11 20:07 Kunda1 Tag Detached: #tobeclosed
2017-07-11 20:07 Kunda1 Tag Detached: #pending