3.3: How to Reference Karamba3D Assemblies

In order to package the script of section 2.4.2 into a GH-component there needs to be one input-plug that receives a Karamba3D model. Three output plugs return an updated Karamba3D model, a list of boolean values that signifies which elements are active or not and the value of the largest resultant displacement.

The following example can be found in the examples that accompany this guide. Go to “#/TensionElim” and double-click on “TensionElim.sln” to open the project with Visual Studio. Depending on what version of Grasshopper you use it will be necessary to reestablish the project references.

The first step consists in referencing the “karambaCommon.dll”-library so that Karamba3D-classes (such as the Model-class) can be dealt with. For this right-click on “References” in the “Solution Explorer” select “Add Reference...” from the context menu and go to “Browse” on the tabbed view and point to “karambaCommon.dll” in the Rhino “Plug-ins”-folder. Since Karmba3D shall be used within Grasshopper, one needs to include “karamba.gha” as well. Alas by default Visual Studio does not allow the selection of files with extension “.gha”.

As a work-around do the following: Save and close your Visual Studio project. In the project directory you will find a file called “TensionElim.csproj”. Open it with a text editor, search for “karambaCommon”, copy its entry, fill in “karamba.gha” (see fig. 3.3.1), save it and reopen the Visual Studio project.

Now right-click on the “karamba” and “karambaCommon”-entries in “References” and select “Properties” from the context menu. Set the property “Copy Local” (it has the value true by default) to false.

Fig. 3.3.1: Work-around for referencing "karamba.gha" in Visual Studio: Edit the "TensionElim.csproj"-file