New in C#: new guid and ..more

I apologize for the trivial questions, this is the first time I’ve tried C # and I’m trying to follow the guide on the site Simple Component with C#, VB

  1. do I have to create a guid for each component?

  2. How should I use the https://www.guidgenerator.com/ site to generate an ID?

Yes, each component gets its own Guid.
You should be able to use Visual Studio, but guidgenerator.com is perfectly OK as well.

I know, but how to use it? What number I have to insert?


what parameters? Just one?

Hi @AmicoCAD,

In Visual Studio, pick Tools > Create GUID:

image

– Dale

1 Like

My goal is to calculate the average of the x, y and z coordinates of the points entering and coming from a list of points.

Could you tell me how to proceed? Does the list code go into “InputParameters” or into “SolveInstance”?

Then, taken the coordinates how can I call the function that makes the average and how do I return it in output?

Please be patient, this is the first time for me, I hope to learn quickly. Thank you.

Have you seen these examples for coding components? It looks like you’re trying to wrap your head around some basics before taking off and coding, and these may help.
https://developer.rhino3d.com/api/grasshopper/html/730f0792-7bfb-4310-a416-239e8c315645.htm

1 Like

Thanks Menno, I’m using your advice and also a book on C #.
Unfortunately, despite the C # ScriptingForGrasshopper_1stEdition guide I have some difficulties to understand the general organization, for example: how do I know if I need a Class, a Method, a property or something else?
Knowing these things first can help me research and write code, I think.

Another question: I would like to associate an icon to each component and to the plugin, but I don’t understand where the image should be loaded and how to say to VS where this image is.

image

for example: how do I know if I need a Class, a Method, a property or something else?
Knowing these things first can help me research and write code, I think.

You are trying to speak before you know the alphabet. Don’t skip steps in the learning process as you are only hurting yourself.

A good place to start: https://youtu.be/sQurwqK0JNE

Then: https://youtu.be/pFCrIzENDn8

Then get back to what you are doing.

3 Likes

Why the error?

I know that the best way is to take a dedicated programming course, but there is not always the time and sometimes quick solutions are needed. Can anyone give me information on the inclusion of icons in the components?
Gradually the time of formation will come, gradually. The training is underway with a volume/book on C # (and I already program in other procedural languages), practice is necessary and often you are wrong even after “understanding”.
Thanks to those who want to give me a hand.


this, what I see.

Have you added the icon to the project resources?
See link below for detailed steps.

1 Like

Great. Thank you very much. I have inserted the icon. You also know how to tell me about the icons in the menu bar?

image

Recently I had to format the pc and reinstall Rhino7 and Visual Studio 2019. I installed RhinoCommon for v7 and I recovered a plugin that I had saved on GitHub: unfortunately it tells me that it does not find some namespaces, do you know how I can solve?

You need to re reference them. To do so right click over riferimenti and set the path to the missing references on your machine.

image
:pray: