I managed to make a quick Python program to convert DXFs with LWPOLYLINEs into DXFs containing LINEs and ARCs as a workaround until this problem is fixed in the LaserBox software.
import ezdxf
import math
def process_line(msp, v0, v1, z):
x0, y0, s0, e0, b0 = v0
x1, y1, s1, e1, b1 = v1
if b0 == 0:
msp.add_line((x0, y0, z), (x1, y1, z))
else:
c, start_angle, end_angle, r = ezdxf.math.bulge_to_arc((x0, y0), (x1, y1), b0)
x, y = c
msp.add_arc((x, y, z), r, start_angle * 180 / math.pi, end_angle * 180 / math.pi)
def process_file(inname, outname):
doc = ezdxf.readfile(inname)
msp = doc.modelspace()
for entity in msp:
if entity.dxftype() == "LWPOLYLINE":
entity.unlink_from_layout()
z = entity.dxf.elevation
for i in range(1, len(entity)):
process_line(msp, entity[i-1], entity[i], z)
process_line(msp, entity[-1], entity[0], z)
doc.saveas(outname)
if __name__ == '__main__':
import argparse
parser = argparse.ArgumentParser(description='Convert DXFs so that LWPOLYLINEs are replaced with LINEs and ARCs.')
parser.add_argument('infile', help='input filename')
parser.add_argument('outfile', help='output filename')
arg = parser.parse_args()
process_file(arg.infile, arg.outfile)