Page 1 of 1

Calcualating length of lines in a layer

Posted: Mon Jun 15, 2009 5:21 pm
by Tomtefar
I'm using qcad to do some rather simple pipe drawing. I place every pipe on a separate layer, that way I can easily calculate the total length of each pipe with the "Total length of selected entities"-tool.
I was hoping to be able to do this rather automatically with a script. Is that possible? My approach was to use the "select layer" and then the tool previous mentioned, but the

Code: Select all

var sel = new Selection;
results in
Error. Use of undefined variable 'Selection'

Isn't there supposed to be a Selection class?

Some guidance would be very appreciated!

Posted: Tue Jun 16, 2009 7:09 pm
by andrew
Entity selection / modification is not yet supported through scripting.

Posted: Wed Jun 17, 2009 8:07 am
by Tomtefar
I see. Will it be supported soon or should I start to write something (non-qcad-scripting) to get the data from the .dxf-file?

Posted: Wed Jun 17, 2009 5:32 pm
by andrew
It will be supported in QCAD 3 (2010).

Posted: Fri Jun 19, 2009 5:03 pm
by Tomtefar
Did a little work on the test program in dxflib and managed to get what I want from there.
So if anyone is interested in calculating the length of Line entities in a drawing I got some source code, it may be a bit ugly, but it works for me :)