# Line lenght with respect to differing radiuses

hello

i have different circles with diameters of 90, 132, 154 and 190. i want to make lines from centers of these circles in different lenghts, such as 41 for 90 and 60 for 132. now it is easy to make these lines in grasshopper. the problem is i want to automate it in such a way that my code understands that line is 41 for 90 and 60 for 132. i want my input to only be diameter numbers. Is this possible ? i plan on inserting diameter values from text

Hi @UMUT_ŞEN,

Could something like this work for you? You just need to put the distances of the lines in the same index of the diameter of the circle where you want to draw the corresponding line.

Lines on circles.gh (9.5 KB)

Having said this, maybe you are looking for another logic to establish the relationship between the diameter of the circle and the distance of the line. Maybe you need to compare the distance of the lines with the diameters of the circles, and you assign the distance of the line to the diameter that is closer in value (but I am not sure if you are looking for this )

2 Likes

thank you so much

i think this will work to some extend, but issue is something like this:
there will be a huge list of circles that are only numbers such as 90,154,132 etc
there will be thousands of circles and locations of the circles will be pre determined. i planned on using a simple circle command and use " set multiple circles" ; the code from there will understand that if a circle in the selection is diameter of 90; it will draw 41. if it is 132, it will draw 60 and so on. there will be multiple 90 and 132 circles in many different places if that makes sense

Now I understand it better.

Here you have two solutions:

1. Using the replace member component, but again you will need to pair the values in the correct indexes.
2. Using a python script with a replacement dictionary.

Also, consider that when I am drawing the lines I am doing it with a percentage of the radius (because I do not know the vector that you want to use to draw the lines ). That is why I am rounding it for the text of the dimension. If you know the vector of the lines, do not use the percentage and just move the origin of the circles in the correct direction to create the second point of the line.

Lines on circles_02.gh (13.0 KB)

I hope this helps!

1 Like

vector of the lines is assuming circles are on XY plane. from circle center to “up”; meaning Z direction.

Then you just need to move the center of the circles up with a Z vector with the output of the Replace Members component or the Python component and connect that to the End Point input of the Line component.

1 Like

i think we are at %90 solution. only problem left now (i think) is to make grasshopper “read” the predetermied circles from a “set multiple circles” command and measure their diameters. then, your code can do its work. For example: i set 500 different circles from rhino using “set multiple circles” > grasshopper reads their diameters (maybe a command like “getdiameter” ? ) > your code draws the lines

For that you can get the circles in Grasshopper with a Curve component and read their radius with the Deconstruct Arc component. Multiply by 2 if you want to use the diameter (I am just mentioning this because it is the kind of thing I usually overlook ).

1 Like

this is it man, thanks alot!