Legth of lines at the specific layer

Hallo there,

I would like to get the value of the length of all lines which are at the specific layer. Then, when is possible to get the data in the table in a drawing.
i.e.
L251=3875mm
L252=5620mm

Thanks,
zest

You can iterate through all the lines in a part via the .Lines collection. You can check the .Layer of each line and use .GetLength to find the length and add it to a running total.

Below is some pseudocode:

Dim lineLengths(256) as double

for each tempLine as Line in myPart.Lines
linelengths(templine.Layer) += tempLine.GetLength
next

After the code completes, lineLengths(1) will hold the sum total length of lines on layer 1, lineLengths(2) will hold the total for layer 2, etc.