I am new at using GH. Could anyone help with how could I use the code below I wrote in visual studio in GH using c#and a panel component? Is there any component that allows a value to be entered manually and change the output?
The objective of this simple piece of coding is simple. It is to generate what the Console.WriteLine statement says at the end before Console.ReadLine. It is a bit interactive as it asks the user to enter the numbers, hence why I asked the question about a GH component that allows values to be entered manually.
////////////
Console.WriteLine(“Please enter radius value:”);
double r = Double.Parse(Console.ReadLine());
Console.WriteLine(“Please enter number of circles:”);
int number = Int32.Parse(Console.ReadLine());
double area = Math.PI * r * r;
double totalarea = number * area;
Console.WriteLine(“For {0} circles of radius {1} the total area is {2}:”, number, r, totalarea);
double area = Math.PI * Math.Pow(Radius, 2);
double areaTotal = area * NumberOfCircles;
Area = area;
AreaTotal = areaTotal;
RhinoApp.WriteLine("The area is " + area.ToString());
RhinoApp.WriteLine("The total area is " + areaTotal.ToString());
Hi manuel but the circles are not visible in Rhino main screen why? sorry for asking if it is stupid question I am just very new to programming and trying to learn!
Hi Manuel… thanks for the tip but I don’t think you understood what I am trying to create here. I want to create circles that are controlled by the number of circles so when I move the slider the number of circles doesn’t change why? thank you so much for your help!! Please, have a look at the file below and tell me when I am making the mistake?
Thanks in advance (14.5 KB)example.gh (14.5 KB)
Er … you use 3 of my C#'s (Lila works for me, I added a simple question in order to deal with the red thing). So … what exactly are you trying to do? Circles like in the 1st C#?
A good start is to avoid using C# keywords as variable names (“var” is a C# keyword, hence the red underline markers). And even a valid variable name must be used in the rest of the code to have any effect.
no I am not trying to create anything like this ! I just want a surface or a 2D grid that I can be able to control the number of circles because so far I can control the radius but not the number of circles! That’s all look at my file…
well I will tell you what I want to create; the goal is :
Create a small function that outputs the total area of a number of circles with the same radius. The radius and number of circles should be variable inputs.
The output should be a string that writes: For “n” circles of “R” radius the total area is “A”.
This is what I was trying to achieve !
So I tried to create a 2D grid to put the circles in. I did manage to do this and all the circles are created have the same radius … so far so good but when I am changing the number of circles, the circles in rhino space do not change because it is been controlled by the grid I think? So I want to change the number or circles that my grid has at times so sometimes I have 5 circles sometimes I have 10 circles in the system … I ll put a quick sketch to show you … thanks in advance!
OK, that’s very easy. I’ll do it as soon as I can recover from what happened in Suzuka F1 race (Lewis was 10 seconds ahead everybody (10 laps to go) … and then Totto - or was James ? - did the ultra genius thing: he pitted him !!!). Later Totto said that this was a 50-50 call (between stupidity and honesty I guess).
is it really easy ? I am so new to that!!! please do it and explain to me as well … please!!! so I can understand! I am not as smart as you and I am new to programming! so you are with Lwis Hamilton? same as me and my dad!!! hopefully he will be alright! THANK YOU SO MUCH!!!
PS: The days of no-action are over: IF Lewis encounters ANY other “similar” issue in the remaining races this year (or in any future race in the years to come), I the Lord of Darkness (keeper of the Truth Out There etc etc) … well Totto you get the gist of my message - I do hope.
Notify if you are brave enouph to dive into the abyss for doing this properly for the general case (clustering, any query, classes, cats, dogs etc etc).
EVERYTHING LOOKS GREAT!!! oh my God!!! BUT as I told you the radius of the circles shouldn’t change you know the radius of the circles should be the same! I think what they ask in the exercise it is something more simple. A simpler version of this. cause we just started programming you know. Man please how did you do that … I don’t know! Can you give me your email ? Do you offer online tutorials etc??
Are you really sure you can’t give any tutorials ? I will need some support during my studies. I am very knew to programming - I don’t know a thing you know :$. Anyway I really appreciate your help … thank you so much!
I’m not an Academic nor I have any interest to become one. But some times I help people who walk the right walk (that’s critical if you are in the AEC market sector).
I would suggest these:
C# 7.0 in a Nutshell (Joseph/Ben Albahari) - my favorite.