Before I was using C# (in Visual Studio) and Python for Grasshopper components development.
Now I am slowly but learning C++ for curiosity.
Would it be possible to get a reference or the most simple example of C++ in Rhino?
I have started reading the guide on:
It says: Necessary Tools Microsoft Visual C++ 2010 for Rhino 5 for Windows 64-bit. Microsoft Visual C++ 2005 for Rhino 5 for Windows 32-bit and Rhino 4 for Windows.
Visual C++ 2008, 2012, 2013, and the Express Editions of Visual C++ will not work.
Is it something that I can download from microsoft website?
Microsoft Visual C++ 2010 Redistributable Package (x64)
If yes I cannot install this version as it says that my computer contains a newer one.
For now I was just learning C++ in Visual Studio as Win32 Console Application.
First, Visual C++ 2010 (and Visual C++ 2005) are not free. Most obtain them my purchasing a MSDN Professional Subscription, which gives you access (i.e. download) to all of Microsoft’s developer tools.
I should add that to write C++ plug-ins for Rhino 6, you can use the free Visual Studio Community Edition.
I should add that to write C++ plug-ins for Rhino 6, you can use the free Visual Studio Community Edition.
You even show here how to wrap C++ library to use it in C#. Nice.
Does it still requires purchasing Visual C++ 2010 (and Visual C++ 2005) ?
(As long as I do not know how to wrap it, as I only did it once from one tutorial… ech, I just would like to know in general about this process for using C++ in C#)
I have started reading and testing your given reference about c++ wrapper for C# plugin in rhino. I have tested very simple square root example just to understand the workflow.
I would like to ask about decorated functions in SampleLibrary.cpp file.
There are 4 type of functions:
SAMPLELIBRARY_CPP_CLASS
SAMPLELIBRARY_CPP_FUNCTION
SAMPLELIBRARY_C_CLASS
SAMPLELIBRARY_DLL_EXPORTS
Could you tell me in which situation I should use these fucntions?
Is there a documentation for these functions?
For now I am trying to pass array from C++ class to C# plugin.
To I illustrate this in console application in C++ I am running class like this:
int main()
{
//1. Declare the class with how many elements there are in graph
MyGraph g1(5);
//2. Add Edges to graph
g1.addEdge(0, 1);
g1.addEdge(0, 2);
g1.addEdge(1, 2);
g1.addEdge(1, 3);
g1.addEdge(2, 3);
g1.addEdge(3, 4);
//3. Printing colors
g1.greedyColoring();
//Instead of printing as it was made to work with console application probably I have to define getter for an array of integers.**
return 0;
}
I have started wrapping it like this:
//1 Step
SAMPLELIBRARY_CPP_CLASS
MyGraph g1(int numOfVertices);
and I already have error for declaring the class, with function I did not have any issues.
How to declare a class properly?
In the end the question is more simple, could you show how to declare a c++ class in order to run with c#?