dxfwrite spline problem

amka1791 at gmail.com amka1791 at gmail.com
Wed Sep 2 22:12:55 CEST 2015


Hi everyone,

I need to do splines in a dxf file with a script, so I use python dxfwrite : It seems that it is the best thing that exists... But impossible to be sure.

But I have a problem with : when I run this sample script :

---------------------------

#!/usr/bin/python

from dxfwrite import DXFEngine as dxf

spline1 = [(0.0, 0.0), (1.0, 0.0), (2.0, -1.0)]

dwg = dxf.drawing('spline.dxf')
dwg.add(dxf.spline(spline1))
dwg.save()

---------------------------

I have this output :

amel at debian:~/job/RR/pl/06$ ./spline.py 
Traceback (most recent call last):
  File "./spline.py", line 9, in <module>
    dwg.save()
  File "/usr/local/lib/python2.7/dist-packages/dxfwrite/drawing.py", line 131, in save
    self.save_to_fileobj(fileobj)
  File "/usr/local/lib/python2.7/dist-packages/dxfwrite/drawing.py", line 137, in save_to_fileobj
    writetags(fileobj, self.__dxftags__(), self.ENCODING)
  File "/usr/local/lib/python2.7/dist-packages/dxfwrite/base.py", line 53, in writetags
    for dxftag in iterdxftags(dxfobj):
  File "/usr/local/lib/python2.7/dist-packages/dxfwrite/base.py", line 31, in iterdxftags
    for subtag in iterdxftags(tag):
  File "/usr/local/lib/python2.7/dist-packages/dxfwrite/base.py", line 31, in iterdxftags
    for subtag in iterdxftags(tag):
  File "/usr/local/lib/python2.7/dist-packages/dxfwrite/base.py", line 31, in iterdxftags
    for subtag in iterdxftags(tag):
  File "/usr/local/lib/python2.7/dist-packages/dxfwrite/base.py", line 31, in iterdxftags
    for subtag in iterdxftags(tag):
  File "/usr/local/lib/python2.7/dist-packages/dxfwrite/base.py", line 30, in iterdxftags
    for tag in dxfobj.__dxftags__():
  File "/usr/local/lib/python2.7/dist-packages/dxfwrite/curves.py", line 157, in __dxftags__
    linetype = self.linetype)
  File "/usr/local/lib/python2.7/dist-packages/dxfwrite/entities.py", line 593, in __init__
    self.add_vertices(points)
  File "/usr/local/lib/python2.7/dist-packages/dxfwrite/entities.py", line 614, in add_vertices
    for point in points:
  File "/usr/local/lib/python2.7/dist-packages/dxfwrite/algebra/cspline.py", line 98, in _cubic_spline
    a = get_a(k, m, delta_t)
  File "/usr/local/lib/python2.7/dist-packages/dxfwrite/algebra/cspline.py", line 76, in get_a
    a[n-1] = (h * k[n-2] + k[n-1]) / m[n-1]
ZeroDivisionError: float division by zero
amel at debian:~/job/RR/pl/06$ 


---------------------------


Can somebody please help me ?

Thanks, best regards,

Amka


More information about the Python-list mailing list