Hi,
Is there a way to script rhino command from inside a rhino plugin created with csharp in visual studio?
Could anyone give me an example, please?
A very basic one as my understanding of c# is limited.
Thanks in advance.
Hi,
Is there a way to script rhino command from inside a rhino plugin created with csharp in visual studio?
Could anyone give me an example, please?
A very basic one as my understanding of c# is limited.
Thanks in advance.
I must say I donāt get anything from that article.
I donāt understand what they mean by ārun-time databaseā, āreferenceā and āpointerā. Iām doomed to crash Rhino
Perhaps a little bit stretched, but think of reference and pointers like this. There are two ways of addressing computer memory and a location for a specific house.
You could put a physical arrow pointing at a particlular house on a particular street, but you can also āreferenceā that same house, or location, by specifying āwhere it isā without actually directly pointing at it with your finger, with an arrow or a sign. You can just type the address on an envelope (= indirection) and let someone else look that location up for you and deliver whatever you want to that location:
The difference:
Hopefully I didnāt totally mess you up nowā¦
// Rolf
If I understand correctly that would mean the address of a specific entry in that run-time database should be the reference and the full path to that entry should be the pointer, is that it?
Still missing the basis, the run-time database, I hope to get that answer from the other thread I created.
Thanks @RIL
A whole different question is what is the example of reference and pointer inside the scope of a rhino plugin? memory? I thought c# is managed and CLR is taking care of memory allocations.
https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/reference-types
Also for what itās worth, maybe to look at, Lunchbox has a command line component that letās you run rhino commands from gh.
I believe an example using csharp scripting component running rhino command is a better example I can use.
Thanks for the link Michael. Iāll take a look at it.
In a computer it is always about memory. Computers doesnāt do anything other than manipulate memory, either by creating values (in a location), copying a value (from one location to another) or modifying a value in a location. Directly or by reference. OK, there are also so called CPU-registers apart from memory, but anyway.
What complicates this TECHNICALLY (but not conceptually) is that modern Operative Systems typically sits between your code and the āmetalā (the actual physical memory) and makes it āvirtualā (thus the memory you address, ādirectlyā or by āreferenceā can be somewhere else, and you donāt have a clue where).
BUT, from a conceptual perspective that doesnāt matter, unless you explicitly disable the virtualization. But thatās another story altogether (die hard C/C++ programmers do that kind of stuff all the time while C# developers not so often).
// Rolf
Thatās clear, but since c# is managed I thought I didnāt have to deal with memory stuff
Well, ideally you wouldnāt. And in many, perhaps even en most cases, you donāt have to deal with memory.
But since computer processing is only about manipulating memory thereās always a chance that you will have to, in some cases.
I didnāt really look into what problem you are faced witrh in this case (I will read after posting this though), but when you design more complex sytems you WILL have to deal with memory also in C#, but in yet another indirect way, namely by learning how to manipulate (fool) the Garbage Collector, which is supposed to do all the memory stuff for you. This is a bit ironic if you think about it, because old cured die-hard C/C++ develoipers, (and also olā TurboPascal developers) would tell you that itās easier to do all that memory stuff directly (āby handā so to speak) rather than learning yet another level of (indirect) manipulation.
I understand their views, but not all of them understand that (with C# and other GC, so called āmanagedā languages) in many cases you donāt have to bother about memory at all, and that that has its benefits too (on productivity).
// Rolf
Ahaaa, I get it now.
Now I see why when working with pointers and references I have to put it in unsafe{}
Also just got something else. int* ptr1 = &x;
this explains why the phrase everything in Python is reference
is so important
You are assigning values of other objects (from the memory assigning a pointer as reference to the value of other object) instead of creating new object
OK, now I have read the article, and this is the part for you:
- If you are not very familiar with how references work, you should only call `Rhino.RhinoApp.RunScript()
It essentially says: If you donāt know what those two things are, donāt bother. It can only go wrong.
So donāt.
Edit: I just realized (after posting) that you actually know more about references than you thought you did (that Python stuff). Good.
&x (the ampersand is the address slip, an indirection) while int* ptr is, well, a (direct) pointer to that address (see the illustrated houses again). And yes, the Unsafe directive actually makes it possible to SAFELY manipulate memory (blocking the GC from messing up what you are pokeing at). So to speak. Strange then to call it āunsafeā, butā¦ oh, well.)
// Rolf
that conflicts with the very meaning of my being. I must try it.
Yeah, I have big problem learning terminologies, I know a lot of stuff but donāt know their names.
It is amazing how long I could code as script kiddie not knowing these names
I donāt agree. The famous Feynman, the phycisist, said he never bothered learning the names of all the concepts and formulas in math and physics because he was occupied with UNDERSTANDING them instead.
Until he noticed that the names of concepts and formulas are actually useful. When you have to communicate with and cooperate with other people.
// Rolf