Scripting Guide v2
  • Welcome to Karamba3D Scripting Guide
  • Go to Scripting Guide 1.3.3
  • Go to Manual
  • 1. Introduction
    • 1.1: Scripting with Karamba3D
    • 1.2: What's New in Karamba3D 1.3.3 Regarding Scripting
  • 2. Scripting with Karamba3D inside Grasshopper
    • 2.1: Hello Karamba3D
    • 2.2: Data Retrieval from Models
    • 2.3: How to Create Structural Models
    • 2.4: How to Modify Structural Models
      • 2.4.1: Cross section Optimization
      • 2.4.2: Activation and Deactivation of Elements
    • 2.5: Data Export from Karamba3D
    • 2.6: The VB Script Component
    • 2.7: The IronPython Component
      • 2.7.1: Results Retrieval on Shells
      • 2.7.2: A Simplified ESO-Procedure on Shells
  • 3. How to create your own Karamba3D Grasshopper-component
    • 3.1: Setting up a Visual Studio Project for GH Plug-ins
    • 3.2: Basic Component Setup
    • 3.3: How to Reference Karamba3D Assemblies
    • 3.4: Input- and Output-Plugs
    • 3.5: Adding Functionality to a GH Component
  • Bibliography
Powered by GitBook
On this page

Was this helpful?

  1. 1. Introduction

1.1: Scripting with Karamba3D

PreviousWelcome to Karamba3D Scripting GuideNext1.2: What's New in Karamba3D 1.3.3 Regarding Scripting

Last updated 4 years ago

Was this helpful?

Sometimes when creating a Grasshopper (GH) definition you may reach a point where it makes sense to switch from GH’s visual computing environment to textual scripting. This is e.g. the case if you want to apply loops, functions or more refined object oriented programming concepts. Other points in favor of a textual approach would be debugging or code reuse.

When installed for Grasshopper Karamba3D consists of three main parts (these files reside in the “Plug-ins”-folder of Rhino - typically C:\ProgramFiles\Rhino6\Plug-ins\Karamba\.):

  • “karamba.dll” is a C++ library which does the numeric calculations.

  • “karambaCommon.dll” provides the .NET user interface to the Karamba3D functionality. It features its own set of geometric types (e.g. vectors, points, meshes,. . . ) and is therefore independent from Grasshopper or Rhino.

  • “karamba.gha” connects GH to “karambaCommon.dll” and takes care of the graphical user- interface.

This scripting guide comes with a help-file (“Karamba3D_1_3_3_SDKDoc.chm” also accessible online ) which covers “karambaCommon.dll” and parts of “karamba.gha”. It can be found in the “”-collection which accompanies this manual. A useful additional source of information regarding scripting with Karamba3D are the “karambaCommon.dll”- and “karamba.gha” files themselves: Feel free to use a tool like “ILSpy” to decompile them and have a look at their inner workings.

The main incentive behind decoupling K3D from Grasshopper was to enable Unit-testing for the C# application programming interface (API) of Karamba3D and thus enhance its code quality. You can download the Karamba3D test-project from . The test cases represent code-snippets which show how to work with the Karamba3D API and form another useful source of know-how regarding C# of K3D.

Karamba3D is work in progress. So are its interface definitions. Be aware of the fact, that they will probably change in future.

Karamba3D 1.3.3 SDK Documentation
Karamba3D Scripting Examples Github
https://github.com/karamba3d/K3D_tests