I'm about to create a script wich creates points from lines on a specified layer with a length and a rotation field.
- The point goes to the first vertex of the line
- length filed: distance between the first and second vertex
- rotate field: clockwise rotation angle from north
Here is the code: http://paste.ubuntu.com/8360617/
Something is wrong because sometimes it works and sometimes not. I can't find the error. Please, can you check the code? What am I doing wrong?
Addition 1: With my test layers with 4-5 lines works fine, points are created with fields, but on working layers (1000+ lines) not working. No points created, no messages, no logs. Sometimes QGIS crashes and quits without any message. QGIS: 2.4.0 OS: Ubuntu 14.04 LTS 64 bit, Windows 7 64 bit
Addition 2: I've made these changes. Works well. Some cases i see this message:
[Errno 9] Bad file descriptor See log for more details
at the log i see this error message:
Uncaught error while executing algorithm Traceback (most recent call last): Traceback (most recent call last): File "C:/PROGRA~1/QGISCH~1/apps/qgis/./python/plugins\processing\core\GeoAlgorithm.py", line 217, in execute self.processAlgorithm(progress) File "C:/PROGRA~1/QGISCH~1/apps/qgis/./python/plugins\processing\script\ScriptAlgorithm.py", line 265, in processAlgorithm exec script in ns File "", line 68, in IOError: [Errno 9] Bad file descriptor
the current code is availabe here: http://paste.ubuntu.com/8364483/
- lines: LEAG_VIZ_V
- points: LEAG_VIZ
- length field: HOSSZ
- rotate field: GMrotation