Leica Disto S910 DXF

423 views
Skip to first unread message

Hamish Harvey

unread,
May 13, 2016, 12:09:11 PM5/13/16
to python-ezdxf
Hi,

I'm trying to read a DXF file from a leica disto S910 with ezdxf. I'm not getting very far. Would appreciate any pointers.

The disto records 3D points and, as far as a can tell, joins them with lines. It also annotates each point with text showing the file name of a jpg image.

I can read the file with ezdxf, enumerate the entities, and get their types (POINT, LINE, TEXT). However if I ask for the location of a point:

e.get_dxf_attrib('location')


I'm told "DXFAttrib 'location' does not exist."


I've attached an example file.


Thanks for any hints. 


Hamish



3D_20160506_121646.dxf

Manfred Moitzi

unread,
May 14, 2016, 10:51:41 AM5/14/16
to python-ezdxf
Hi!

This is a wired situation, because this DXF file is chimera, it is a DXF12 format with structure parts of the later DXF13 format like 
entity subclass marker (100, AcDbPoint) - and sadly AutoCAD opens this crap.

ezdxf can not read this file correctly, it also doesn't help to just change the DXF version of the file (editig $ACADVER from AC1009 to AC1012).

But you can use my dxfgrabber package, which reads this shit:

import dxfgrabber

dwg = dxfgrabber.readfile("Leica_Disto_S910.dxf")
points = (entity for entity in dwg.modelspace() if entity.dxftype == 'POINT')
for num, point in enumerate(points):
    print("#{num}: {location}".format(num=num, location=point.point))


Best regards,
Manfred

Manfred Moitzi

unread,
May 14, 2016, 11:30:35 AM5/14/16
to python...@googlegroups.com
Added a repair function to ezdxf (0.7.7 not released yet):

import ezdxf

dwg = ezdxf.readfile("Leica_Disto_S910.dxf")
msp = dwg.modelspace()
for num, point in enumerate(msp.query('POINT')):
    print("#{num}: {location}".format(num=num, location=point.dxf.location))
dwg.saveas("Leica_Disto_S910_by_ezdxf.dxf")  # saves a valid DXF R12 file


edits:
  • renamed repair function
  • added a check function
  • ezdxf saves a valid DXF R12 file
edit:
  • integrated check for malformed DXF R12 files into general drawing setup process

Best regards,
Manfred

Hamish Harvey

unread,
May 14, 2016, 4:35:37 PM5/14/16
to python-ezdxf
Hi Manfred,

Thanks for the quick response! I got to dxf grabber with a bit more googling last night and found that it worked. I didn’t realise the same person was responsible for both. Thanks for the pointer, and for the repair function!

I was interested to find that FreeCAD read it without complaint but produced partial results - not complete garbage, but not all of the lines in the file appeared.

Hamish

On Sat, May 14, 2016 at 4:30 PM, Manfred Moitzi <manfred...@gmail.com> wrote:
Added a repair function to ezdxf (0.7.7 not released yet):

import ezdxf
from ezdxf.lldxf.repair import repair_leica_disto_dxf12

dwg = ezdxf.readfile("Leica_Disto_S910.dxf")
repair_leica_disto_dxf12(dwg)
msp = dwg.modelspace()
for num, point in enumerate(msp.query('POINT')):
    print("#{num}: {location}".format(num=num, location=point.dxf.location))


Best regards,
Manfred


Am Freitag, 13. Mai 2016 18:09:11 UTC+2 schrieb Hamish Harvey:
Hi,

I'm trying to read a DXF file from a leica disto S910 with ezdxf. I'm not getting very far. Would appreciate any pointers.

The disto records 3D points and, as far as a can tell, joins them with lines. It also annotates each point with text showing the file name of a jpg image.

I can read the file with ezdxf, enumerate the entities, and get their types (POINT, LINE, TEXT). However if I ask for the location of a point:

e.get_dxf_attrib('location')


I'm told "DXFAttrib 'location' does not exist."


I've attached an example file.


Thanks for any hints. 


Hamish



--
You received this message because you are subscribed to a topic in the Google Groups "python-ezdxf" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python-ezdxf/YARu5ogq-2w/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python-ezdxf...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Hamish (David) Harvey
ham...@billharveyassociates.com
+44 7976 613517
twitter.com/hamishharvey

Director, Bill Harvey Associates Limited
http://www.billharveyassociates.com/
Registered address: Gairloch, Hensleigh Drive, Exeter, EX2 4NZ
Registered in England and Wales, no 04550257
Reply all
Reply to author
Forward
0 new messages