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.

ttttttt

length
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