How to convert length into a number

grasshopper

(Andrewsthekkathsachin) #1

how to convert length into a number


(David Rutten) #2

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.


(Andrewsthekkathsachin) #3

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


(David Rutten) #4

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.


(Andrewsthekkathsachin) #5

ttttttt


#6

length
length.gh (6.2 KB)


(David Rutten) #7

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.