Calcualating length of lines in a layer

Post here to ask questions about or get help with the scripting module of QCAD 2.1/2.2.

Moderator: andrew

Locked
Tomtefar
Newbie Member
Posts: 5
Joined: Sun Jun 14, 2009 2:40 pm

Calcualating length of lines in a layer

Post by Tomtefar » Mon Jun 15, 2009 5:21 pm

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!

User avatar
andrew
Site Admin
Posts: 9019
Joined: Fri Mar 30, 2007 6:07 am

Post by andrew » Tue Jun 16, 2009 7:09 pm

Entity selection / modification is not yet supported through scripting.

Tomtefar
Newbie Member
Posts: 5
Joined: Sun Jun 14, 2009 2:40 pm

Post by Tomtefar » Wed Jun 17, 2009 8:07 am

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?

User avatar
andrew
Site Admin
Posts: 9019
Joined: Fri Mar 30, 2007 6:07 am

Post by andrew » Wed Jun 17, 2009 5:32 pm

It will be supported in QCAD 3 (2010).

Tomtefar
Newbie Member
Posts: 5
Joined: Sun Jun 14, 2009 2:40 pm

Post by Tomtefar » Fri Jun 19, 2009 5:03 pm

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 :)

Locked

Return to “QCAD 2.1/2.2 Developers”