Is it possible to use the Rhino C++ library directly without creating a Rhino plugin?
I have a C# plugin which loads a C++ library. This C++ library includes some utility functions for my C# plugin.
I would like to be able to retrieve information from Rhino in C++ code (e.g. the size of a viewport).
I used the Visual Studio templates provided with the Rhino SDK as examples to attempt to link the RhinoCore.lib static library to my C++ project. But I don’t really know what I’m doing.
(I use CMake)
Thank you, jmv
For what it is worth the RhinoCore.lib is only a linking library, the DLL is where the actual code lives at. Is there a reason why you feel you need to get the information via C++ over C#? RhinoCommon already wrappes RhinoCore etc for you - you should be able to get all the information you need.
This is the conversion of ImGui C# code to C++ code.
Currently I am doing exactly what you suggested.
I get all the information needed to draw with RhinoCommon and store it in a structure that I send to my C++ render function.
I would like to limit marshaling as much as possible and avoid sending this structure to each rendering loop.
It would also allow me to make the code more understandable and organized (since information such as viewport size is only useful for C++ drawing functions).
So with the include files (.h) and “RhinoCore.dll” linked to my project should be enough ?
(I admit I don’t understand what you mean by “only a link library”.
I don’t see in Rhino 7 SDK\Wizards\Plugin\default.vsxproj the linking configuration of the rhinoceros libraries.)
Finally it works, thanks Nathan for giving me a hint!
I copied the “stdafx.h” file into my project and add these lines in CMakeLists.txt.
set (RHINO_LIB_DIR "C:/Program Files/Rhino 7 SDK")
set (RHINO_LIB_INC "C:/Program Files/Rhino 7 SDK/inc")
add_definitions(-DRHINO_LIB_DIR="C:/Program Files/Rhino 7 SDK/lib/Release")
set(CMAKE_MFC_FLAG 2) # https://cmake.org/cmake/help/latest/variable/CMAKE_MFC_FLAG.html
# Rhino want the WIN64, not WIN32
# add [#undef WIN32] before the [#include "stdafx.h"]