Hi CMRHM, yes, all people who currently write scripts for Grasshopper are using the VB/C# Component editor.
If you wish to write code in DotNET, it is absolutely vital you understand object-oriented-programming. The function Close() is part of the Windows.Forms.Form class, which is the class all windows and dialogs use in dotNET. If you're writing code inside a Form, you can call Me.Close() and the window you're currently in will shortly after be shut down. The script you are typing is not a derived from Windows.Forms.Form* and as such does not have a Close() function. In the autocompletion list you see 3 fields (blue boxes); app, doc and A. "app" is a pointer to the current Rhino application. "doc" is a pointer to the currently active document and "A" is the output parameter of the component. The other members of this class are all purple boxes, indicating they are methods (read: functions). If you wish to call a function, you have to call it on an instance of a class that defines that function. For example, if you wish to find the distance between two points A and B, you have to call the DistanceTo() function which is defined in On3dPoint. Thus: Dim dist As Double = A.DistanceTo(B) and Dim dist As Double = B.DistanceTo(A) are both correct because A and B are both instances of the class On3dPoint. You cannot just call DistanceTo() out of the blue or on the wrong class, for that will result in a compilation error. I know this is a lot to take in, and it's saturated with terminology you're not certain about like "fields", "instances", "methods" and "members". It took me at least 2 weeks before it started making sense, and now, 4 years later, I'm still learning new stuff. -- David Rutten [email protected] Robert McNeel & Associates * incidentally, the "Windows" and "Forms" parts of that name refer to namespaces. You can think of namespaces as folders and classes as files. On Mar 12, 10:32 pm, CMRHM <[email protected]> wrote: > OK. > > I indeed can see the autocomplete inside scripteditor. Thanks. So is > this scripteditor THE tool most people are using for coding in GH? If > not, just tell me what should I do! > > I try to copy some code into the scripteditor. > Me.Close() > > but when I type in me, there is no autocomplete things coming out. > > please see the attached picture. Did I do anything wrong? > > http://grasshopper3d.googlegroups.com/web/rhinoVB.NET_01.JPG?hl=en&gs... > > On Mar 12, 7:38 am, David Rutten <[email protected]> wrote: > > > Hi cmrhm, > > > autocompletion /should/ work inside the Grasshopper VB editor. Though > > there's a problem with that editor since it doesn't understand generic > > list syntax, so if an input parameter is a list, it will get confused > > and stop providing autocompletion information. > > > The compiler I'm talking about doesn't have a frontend. It's just a > > class somewhere deep inside the DotNET framework. I send it a string > > containing source code and it gives me a compiled dll in return. The > > only interaction you'll personally get with the compiler is if you > > make a mistake in the source code. In that case the compiler will > > provide me with a list of errors and warnings, which I in turn hand > > over to you by adding them to the component. > > > -- > > David Rutten > > [email protected] > > Robert McNeel & Associates > > > On Mar 12, 4:38 am, CMRHM <[email protected]> wrote: > > > > > So, if you wish to write a Rhino DotNET Plugin, you need to get a > > > > DotNET IDE (Integrated Development Environment) such as Microsoft > > > > Visual Studio and also our plugin wizards which will help you set up a > > > > proper plugin with just a few clicks. > > > > > If, on the other hand, you wish to use the DotNET functionality inside > > > > Grasshopper, all you have to do (assuming you already have grasshopper > > > > installed and running) is make a new VB component, double click it and > > > > start typing. > > > > Hi, David: > > > > Thanks for this thorough explanation. I gained more than I asked. By > > > far, I just want to use .NET Functionality inside the grasshopper. My > > > Q is regarding the compiler for VB.net code. You know, inside GH, > > > that scripteditor is a very basic one. If I type sth in the beginning, > > > there is no many related classes shown up( no autocomplete function). > > > I need a source code compiler to help me to debug the code. > > > > You said The DotNET framework already comes with a compiler for VB and > > > C#. Could you please tell me how to bring up this compiler inside GH? > > > > cmrhm
