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
  • Independence from Grasshopper
  • Karamba3D's Geometry Types
  • Factories as Access Points to the Karamba3D API

Was this helpful?

  1. 1. Introduction

1.2: What's New in Karamba3D 1.3.3 Regarding Scripting

Previous1.1: Scripting with Karamba3DNext2.1: Hello Karamba3D

Last updated 4 years ago

Was this helpful?

Independence from Grasshopper

The biggest change from Karamba3D 1.3.1 to 1.3.2 is its partial independence from Grasshopper. When taking a look at the contents of the ”-file one sees a list of name-spaces: everything under “Karamba.GHopper” comes with “karamba.gha” and links the C# API of Karamba3D to GH. All the rest resides in “karambaCommon.dll” and can be used independently of Grasshopper and RhinoCommon.dll.

Karamba3D's Geometry Types

Under “Karamba.Geometry” one finds the geometry types of Karamba3D. In most cases the K3D-equivalents of a GH geometry types come without the “D” at the end: e.g. Grasshopper’s Vector3D is equivalent to K3D’s Vector3. The static class “Karamba.GHopper.Utilities.FromGH” provides typeconversion from GH-wrappes (e.g. GH_Vector) to K3D types. The namespace “Karamba.GHopper.Geometry" contains the classes MeshExtension and MeshExtension which extend the GH and Karamba3D geometry classes with the “Convert” method for bi-directional type conversion.

Factories as Access Points to the Karamba3D API

For nearly all Karamba3D components visible in Grasshopper there is a static class in “karambaCommon.dll” which does the work behind the scenes. Thus one approach would be to use these static classes to manage Karamba3D models. However this makes scripts dependent on the interface definitions of these static classes. In order to provide a more stable API a hierarchy of factories has been implemented. It resides under “KarambaCommon.Factories”. The “Toolkit” class provides access to it and can be used to set up Karamba3D models. An additional advantage of the toolkit consists in the fact that it provides useful default-values for many arguments. Currently not all features of Karamba3D are available via the “Toolkit”. It will however grow in future and constitutes the recommended access point to Karamba3D. Take a look at the Karamba3D unit-test project at to see how this works.

Karamba3D_1_3_3_SDKDoc.chm
https://github.com/karamba3d/K3D_tests