# How to convert length into a number

how to convert length into a number

Lengths are already numbers. If you want to measure the length of a curve, you use the Curve Length component. On the left side you plug in data of type curve, and on the right side youâ€™ll get length data of type number.

i wanted to add two length and the resultant number to be used as a length

I think weâ€™re talking cross purposes here. Thereâ€™s no such thing as a length, thereâ€™s only numbers, some of which might represent the length of a curve, or a vector, or a piece of text, or a listâ€¦

Do you want to scale a curve until it has a specific length? Or lengthen a curve at one or both ends until it has a length? Perhaps a picture would help explain what youâ€™re after.

length.gh (6.2 KB)

2 Likes

Thereâ€™s two problem with this approach:

1. Lines cannot be added together. Numbers can, vectors can, colours can, but not lines. If you want to compute the total length of two lines, you must first measure their lengths using the Curve Length component.
2. When you plug data into a yellow panel, it becomes text. What you are feeding the Addition component is not line data, but actual text; â€śLine (L:18.445413 mm)â€ť. Never run data through a panel unless you specifically want to operate on the text you see. Almost the only times you want this is for classification algorithms.
2 Likes